laymur 0.16.0 → 0.17.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/.claude/settings.local.json +9 -0
- package/.editorconfig +14 -0
- package/CLAUDE.md +181 -0
- package/README.md +84 -208
- package/assets/logotype.png +0 -0
- package/eslint.config.js +111 -0
- package/package.json +20 -36
- package/rollup.config.js +52 -0
- package/{dist/constraints/UIAspectConstraint/UIAspectConstraint.Internal.d.ts → src/core/constraints/UIAspectConstraint/UIAspectConstraint.Internal.ts} +3 -2
- package/src/core/constraints/UIAspectConstraint/UIAspectConstraint.ts +60 -0
- package/src/core/constraints/UIConstraint.ts +20 -0
- package/src/core/constraints/UICustomConstraint.ts +62 -0
- package/{dist/constraints/UIHeightConstraint/UIHeightConstraint.Internal.d.ts → src/core/constraints/UIHeightConstraint/UIHeightConstraint.Internal.ts} +3 -2
- package/src/core/constraints/UIHeightConstraint/UIHeightConstraint.ts +52 -0
- package/src/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.ts +13 -0
- package/src/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.ts +139 -0
- package/src/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.ts +16 -0
- package/src/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.ts +189 -0
- package/{dist/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.d.ts → src/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.ts} +3 -2
- package/src/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.ts +68 -0
- package/{dist/constraints/UISingleParameterConstraint/UISingleParameterConstraint.Internal.d.ts → src/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.Internal.ts} +9 -8
- package/src/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.ts +94 -0
- package/src/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.ts +13 -0
- package/src/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.ts +135 -0
- package/src/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.ts +16 -0
- package/src/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.ts +189 -0
- package/{dist/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.d.ts → src/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.ts} +3 -2
- package/src/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.ts +68 -0
- package/{dist/constraints/UIWidthConstraint/UIWidthConstraint.Internal.d.ts → src/core/constraints/UIWidthConstraint/UIWidthConstraint.Internal.ts} +3 -2
- package/src/core/constraints/UIWidthConstraint/UIWidthConstraint.ts +52 -0
- package/src/core/constraints/builders/UIConstraint2DBuilder.Internal.ts +84 -0
- package/src/core/constraints/builders/UIConstraint2DBuilder.ts +168 -0
- package/src/core/constraints/builders/UICoverConstraintBuilder.Internal.ts +15 -0
- package/src/core/constraints/builders/UICoverConstraintBuilder.ts +84 -0
- package/src/core/constraints/builders/UIFitConstraintBuilder.Internal.ts +15 -0
- package/src/core/constraints/builders/UIFitConstraintBuilder.ts +84 -0
- package/src/core/elements/UIAnchor/UIAnchor.Internal.ts +13 -0
- package/src/core/elements/UIAnchor/UIAnchor.ts +70 -0
- package/src/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.ts +30 -0
- package/src/core/elements/UIAnimatedImage/UIAnimatedImage.ts +355 -0
- package/src/core/elements/UIDummy/UIDummy.Internal.ts +33 -0
- package/src/core/elements/UIDummy/UIDummy.ts +244 -0
- package/{dist/elements/UIElement/UIElement.Internal.d.ts → src/core/elements/UIElement/UIElement.Internal.ts} +7 -5
- package/src/core/elements/UIElement/UIElement.ts +127 -0
- package/{dist/elements/UIGraphics/UIGraphics.Internal.d.ts → src/core/elements/UIGraphics/UIGraphics.Internal.ts} +7 -5
- package/src/core/elements/UIGraphics/UIGraphics.ts +168 -0
- package/{dist/elements/UIImage/UIImage.Internal.d.ts → src/core/elements/UIImage/UIImage.Internal.ts} +3 -2
- package/src/core/elements/UIImage/UIImage.ts +138 -0
- package/src/core/elements/UINineSlice/UINineSlice.Internal.ts +26 -0
- package/src/core/elements/UINineSlice/UINineSlice.ts +296 -0
- package/src/core/elements/UIProgress/UIProgress.Internal.ts +24 -0
- package/src/core/elements/UIProgress/UIProgress.ts +259 -0
- package/src/core/elements/UIScene/UIScene.Internal.ts +46 -0
- package/src/core/elements/UIScene/UIScene.ts +259 -0
- package/{dist/elements/UIText/UIText.Interfaces.d.ts → src/core/elements/UIText/UIText.Interfaces.ts} +21 -16
- package/src/core/elements/UIText/UIText.Internal.ts +29 -0
- package/src/core/elements/UIText/UIText.Measuring.ts +183 -0
- package/src/core/elements/UIText/UIText.Rendering.ts +83 -0
- package/src/core/elements/UIText/UIText.ts +376 -0
- package/{dist/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.d.ts → src/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.ts} +14 -11
- package/src/core/layers/UIFullscreenLayer/UIFullscreenLayer.ts +233 -0
- package/{dist/layers/UILayer/UILayer.Internal.d.ts → src/core/layers/UILayer/UILayer.Internal.ts} +15 -11
- package/src/core/layers/UILayer/UILayer.ts +156 -0
- package/src/core/miscellaneous/UIExpression.ts +142 -0
- package/src/core/miscellaneous/UIMode.ts +29 -0
- package/src/core/miscellaneous/UIOrientation.ts +18 -0
- package/src/core/miscellaneous/UIPriority.ts +63 -0
- package/src/core/miscellaneous/UIRelation.ts +39 -0
- package/src/core/miscellaneous/UITransparencyMode.ts +9 -0
- package/src/core/miscellaneous/area/UIArea.ts +5 -0
- package/src/core/miscellaneous/area/UIAreaCircle.ts +32 -0
- package/src/core/miscellaneous/area/UIAreaPolygon.ts +50 -0
- package/src/core/miscellaneous/area/UIAreaRectangle.ts +38 -0
- package/src/core/miscellaneous/area/UIAreaRoundedRectangle.ts +78 -0
- package/src/core/miscellaneous/asserts.ts +187 -0
- package/src/core/miscellaneous/canvas.ts +73 -0
- package/src/core/miscellaneous/color/UIColor.Internal.ts +89 -0
- package/src/core/miscellaneous/color/UIColor.ts +844 -0
- package/src/core/miscellaneous/computeTransform.ts +127 -0
- package/src/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.ts +235 -0
- package/src/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.ts +524 -0
- package/{dist/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.d.ts → src/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.ts} +10 -8
- package/src/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.ts +448 -0
- package/src/core/miscellaneous/generic-plane/shared.ts +323 -0
- package/src/core/miscellaneous/insets/UIInsets.Internal.ts +9 -0
- package/src/core/miscellaneous/insets/UIInsets.ts +248 -0
- package/src/core/miscellaneous/mask-function/UIProgressMaskFunction.ts +24 -0
- package/src/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.ts +58 -0
- package/src/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.ts +52 -0
- package/src/core/miscellaneous/math.ts +16 -0
- package/src/core/miscellaneous/micro/UIMicro.Internal.ts +33 -0
- package/src/core/miscellaneous/micro/UIMicro.ts +222 -0
- package/src/core/miscellaneous/resize-policy/UIResizePolicy.ts +8 -0
- package/src/core/miscellaneous/resize-policy/UIResizePolicyCover.ts +57 -0
- package/src/core/miscellaneous/resize-policy/UIResizePolicyCross.ts +65 -0
- package/src/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.ts +65 -0
- package/src/core/miscellaneous/resize-policy/UIResizePolicyFit.ts +57 -0
- package/src/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.ts +65 -0
- package/src/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.ts +65 -0
- package/src/core/miscellaneous/resize-policy/UIResizePolicyNone.ts +11 -0
- package/src/core/miscellaneous/shared.ts +73 -0
- package/{dist/miscellaneous/text-span/UITextSpan.Internal.d.ts → src/core/miscellaneous/text-span/UITextSpan.Internal.ts} +5 -4
- package/src/core/miscellaneous/text-span/UITextSpan.ts +43 -0
- package/src/core/miscellaneous/text-style/UITextStyle.Internal.ts +52 -0
- package/src/core/miscellaneous/text-style/UITextStyle.ts +479 -0
- package/src/core/miscellaneous/texture/UITextureView.Internal.ts +55 -0
- package/src/core/miscellaneous/texture/UITextureView.ts +308 -0
- package/src/core/miscellaneous/webglCapabilities.ts +129 -0
- package/src/core/shaders/UIImage.glsl +10 -0
- package/src/core/shaders/UINineSlice.glsl +53 -0
- package/src/core/shaders/UIProgress.glsl +15 -0
- package/src/core/shaders/UIProgressMaskFunctionCircular.glsl +13 -0
- package/src/core/shaders/UIProgressMaskFunctionDirectional.glsl +12 -0
- package/src/core/shaders/glsl.d.ts +27 -0
- package/src/core/wrappers/UIInputWrapper/UIInputWrapper.Internal.ts +23 -0
- package/src/core/wrappers/UIInputWrapper/UIInputWrapper.ts +124 -0
- package/src/core/wrappers/UISceneWrapper/UISceneWrapper.Internal.ts +22 -0
- package/src/core/wrappers/UISceneWrapper/UISceneWrapper.ts +101 -0
- package/src/core/wrappers/UISolverWrapper/UISolverWrapper.Internal.ts +58 -0
- package/src/core/wrappers/UISolverWrapper/UISolverWrapper.ts +605 -0
- package/src/particles/behaviorModules/UIBehaviorDirectionalGravity.ts +70 -0
- package/src/particles/behaviorModules/UIBehaviorModule.ts +20 -0
- package/src/particles/behaviorModules/UIBehaviorPointGravity.ts +173 -0
- package/src/particles/behaviorModules/UIBehaviorScaleOverLife.ts +104 -0
- package/src/particles/behaviorModules/UIBehaviorTorqueDamping.ts +75 -0
- package/src/particles/behaviorModules/UIBehaviorTorqueNoise.ts +115 -0
- package/src/particles/behaviorModules/UIBehaviorVelocityDamping.ts +77 -0
- package/src/particles/behaviorModules/UIBehaviorVelocityNoise.ts +118 -0
- package/src/particles/elements/UIEmitter.Internal.ts +22 -0
- package/src/particles/elements/UIEmitter.ts +313 -0
- package/src/particles/index.ts +18 -0
- package/src/particles/instancedParticle/UIInstancedParticle.Internal.ts +263 -0
- package/src/particles/instancedParticle/UIInstancedParticle.ts +138 -0
- package/src/particles/miscellaneous/miscellaneous.ts +115 -0
- package/src/particles/renderingModules/UIRenderingColorOverLife.ts +39 -0
- package/src/particles/renderingModules/UIRenderingColorOverVelocity.ts +49 -0
- package/src/particles/renderingModules/UIRenderingModule.ts +17 -0
- package/src/particles/renderingModules/UIRenderingTexture.ts +30 -0
- package/src/particles/shaders/UIRenderingColorOverLife.glsl +4 -0
- package/src/particles/shaders/UIRenderingColorOverVelocity.glsl +6 -0
- package/src/particles/shaders/UIRenderingTexture.glsl +4 -0
- package/src/particles/spawnModules/UISpawnModule.ts +22 -0
- package/src/particles/spawnModules/UISpawnOffset.ts +62 -0
- package/src/particles/spawnModules/UISpawnRandomLifetime.ts +68 -0
- package/src/particles/spawnModules/UISpawnRandomRotation.ts +60 -0
- package/src/particles/spawnModules/UISpawnRandomScale.ts +81 -0
- package/src/particles/spawnModules/UISpawnRandomTorque.ts +62 -0
- package/src/particles/spawnModules/UISpawnRandomVelocity.ts +92 -0
- package/src/particles/spawnModules/UISpawnRectangle.ts +81 -0
- package/tsconfig.json +29 -0
- package/dist/constraints/UIAspectConstraint/UIAspectConstraint.d.ts +0 -22
- package/dist/constraints/UIConstraint.d.ts +0 -12
- package/dist/constraints/UICustomConstraint.d.ts +0 -28
- package/dist/constraints/UIHeightConstraint/UIHeightConstraint.d.ts +0 -20
- package/dist/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.d.ts +0 -11
- package/dist/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.d.ts +0 -36
- package/dist/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.d.ts +0 -14
- package/dist/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.d.ts +0 -44
- package/dist/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.d.ts +0 -22
- package/dist/constraints/UISingleParameterConstraint/UISingleParameterConstraint.d.ts +0 -43
- package/dist/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.d.ts +0 -11
- package/dist/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.d.ts +0 -32
- package/dist/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.d.ts +0 -14
- package/dist/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.d.ts +0 -44
- package/dist/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.d.ts +0 -22
- package/dist/constraints/UIWidthConstraint/UIWidthConstraint.d.ts +0 -20
- package/dist/constraints/builders/UIConstraint2DBuilder.Internal.d.ts +0 -64
- package/dist/constraints/builders/UIConstraint2DBuilder.d.ts +0 -46
- package/dist/constraints/builders/UICoverConstraintBuilder.Internal.d.ts +0 -13
- package/dist/constraints/builders/UICoverConstraintBuilder.d.ts +0 -29
- package/dist/constraints/builders/UIFitConstraintBuilder.Internal.d.ts +0 -13
- package/dist/constraints/builders/UIFitConstraintBuilder.d.ts +0 -29
- package/dist/elements/UIAnchor/UIAnchor.Internal.d.ts +0 -9
- package/dist/elements/UIAnchor/UIAnchor.d.ts +0 -32
- package/dist/elements/UIAnimatedImage/UIAnimatedImage.Internal.d.ts +0 -27
- package/dist/elements/UIAnimatedImage/UIAnimatedImage.d.ts +0 -77
- package/dist/elements/UIDummy/UIDummy.Internal.d.ts +0 -30
- package/dist/elements/UIDummy/UIDummy.d.ts +0 -82
- package/dist/elements/UIElement/UIElement.d.ts +0 -38
- package/dist/elements/UIGraphics/UIGraphics.d.ts +0 -51
- package/dist/elements/UIImage/UIImage.d.ts +0 -32
- package/dist/elements/UINineSlice/UINineSlice.Internal.d.ts +0 -23
- package/dist/elements/UINineSlice/UINineSlice.d.ts +0 -60
- package/dist/elements/UIProgress/UIProgress.Internal.d.ts +0 -14
- package/dist/elements/UIProgress/UIProgress.d.ts +0 -45
- package/dist/elements/UIScene/UIScene.Internal.d.ts +0 -43
- package/dist/elements/UIScene/UIScene.d.ts +0 -59
- package/dist/elements/UIText/UIText.Internal.d.ts +0 -26
- package/dist/elements/UIText/UIText.Measuring.d.ts +0 -50
- package/dist/elements/UIText/UIText.Rendering.d.ts +0 -20
- package/dist/elements/UIText/UIText.d.ts +0 -71
- package/dist/index.js +0 -9246
- package/dist/index.js.map +0 -1
- package/dist/index.min.js +0 -2
- package/dist/index.min.js.map +0 -1
- package/dist/layers/UIFullscreenLayer/UIFullscreenLayer.d.ts +0 -63
- package/dist/layers/UILayer/UILayer.d.ts +0 -49
- package/dist/miscellaneous/UIExpression.d.ts +0 -69
- package/dist/miscellaneous/UIMode.d.ts +0 -23
- package/dist/miscellaneous/UIOrientation.d.ts +0 -15
- package/dist/miscellaneous/UIPriority.d.ts +0 -32
- package/dist/miscellaneous/UIRelation.d.ts +0 -23
- package/dist/miscellaneous/UITransparencyMode.d.ts +0 -9
- package/dist/miscellaneous/area/UIArea.d.ts +0 -3
- package/dist/miscellaneous/area/UIAreaCircle.d.ts +0 -15
- package/dist/miscellaneous/area/UIAreaPolygon.d.ts +0 -12
- package/dist/miscellaneous/area/UIAreaRectangle.d.ts +0 -17
- package/dist/miscellaneous/area/UIAreaRoundedRectangle.d.ts +0 -21
- package/dist/miscellaneous/asserts.d.ts +0 -43
- package/dist/miscellaneous/canvas.d.ts +0 -31
- package/dist/miscellaneous/color/UIColor.Internal.d.ts +0 -7
- package/dist/miscellaneous/color/UIColor.d.ts +0 -234
- package/dist/miscellaneous/computeTransform.d.ts +0 -18
- package/dist/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.d.ts +0 -19
- package/dist/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.d.ts +0 -1
- package/dist/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.d.ts +0 -1
- package/dist/miscellaneous/generic-plane/shared.d.ts +0 -38
- package/dist/miscellaneous/insets/UIInsets.Internal.d.ts +0 -11
- package/dist/miscellaneous/insets/UIInsets.d.ts +0 -48
- package/dist/miscellaneous/mask-function/UIProgressMaskFunction.d.ts +0 -9
- package/dist/miscellaneous/mask-function/UIProgressMaskFunctionCircular.d.ts +0 -21
- package/dist/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.d.ts +0 -16
- package/dist/miscellaneous/math.d.ts +0 -5
- package/dist/miscellaneous/micro/UIMicro.Internal.d.ts +0 -31
- package/dist/miscellaneous/micro/UIMicro.d.ts +0 -59
- package/dist/miscellaneous/resize-policy/UIResizePolicy.d.ts +0 -3
- package/dist/miscellaneous/resize-policy/UIResizePolicyCover.d.ts +0 -22
- package/dist/miscellaneous/resize-policy/UIResizePolicyCross.d.ts +0 -22
- package/dist/miscellaneous/resize-policy/UIResizePolicyCrossInverted.d.ts +0 -22
- package/dist/miscellaneous/resize-policy/UIResizePolicyFit.d.ts +0 -22
- package/dist/miscellaneous/resize-policy/UIResizePolicyFixedHeight.d.ts +0 -22
- package/dist/miscellaneous/resize-policy/UIResizePolicyFixedWidth.d.ts +0 -22
- package/dist/miscellaneous/resize-policy/UIResizePolicyNone.d.ts +0 -5
- package/dist/miscellaneous/shared.d.ts +0 -46
- package/dist/miscellaneous/text-span/UITextSpan.d.ts +0 -14
- package/dist/miscellaneous/text-style/UITextStyle.Internal.d.ts +0 -48
- package/dist/miscellaneous/text-style/UITextStyle.d.ts +0 -85
- package/dist/miscellaneous/texture/UITextureView.Internal.d.ts +0 -49
- package/dist/miscellaneous/texture/UITextureView.d.ts +0 -67
- package/dist/miscellaneous/webglCapabilities.d.ts +0 -2
- package/dist/wrappers/UIInputWrapper/UIInputWrapper.Internal.d.ts +0 -17
- package/dist/wrappers/UIInputWrapper/UIInputWrapper.d.ts +0 -13
- package/dist/wrappers/UISceneWrapper/UISceneWrapper.Internal.d.ts +0 -13
- package/dist/wrappers/UISceneWrapper/UISceneWrapper.d.ts +0 -20
- package/dist/wrappers/UISolverWrapper/UISolverWrapper.Internal.d.ts +0 -49
- package/dist/wrappers/UISolverWrapper/UISolverWrapper.d.ts +0 -215
- /package/{dist/index.d.ts → src/core/index.ts} +0 -0
package/.editorconfig
ADDED
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
Laymur is a constraint-based UI library for Three.js mobile advertisements where bundle size is critical. It uses the Cassowary constraint solving algorithm (via Kiwi.js) to handle responsive layouts across different screen sizes and orientations.
|
|
8
|
+
|
|
9
|
+
**Current Status**: Early Alpha (v0.15.0) - APIs may change
|
|
10
|
+
|
|
11
|
+
## Build Commands
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Clean build artifacts
|
|
15
|
+
npm run clean
|
|
16
|
+
|
|
17
|
+
# Development build (unminified)
|
|
18
|
+
npm run build
|
|
19
|
+
|
|
20
|
+
# Production build (minified, console.log stripped)
|
|
21
|
+
npm run build:prod
|
|
22
|
+
|
|
23
|
+
# Pre-publish (runs automatically before npm publish)
|
|
24
|
+
npm run prepublishOnly
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The build outputs two files:
|
|
28
|
+
|
|
29
|
+
- `dist/index.js` - Development build with source maps
|
|
30
|
+
- `dist/index.min.js` - Production build with aggressive minification
|
|
31
|
+
|
|
32
|
+
## Architecture Overview
|
|
33
|
+
|
|
34
|
+
### Core Architecture Layers
|
|
35
|
+
|
|
36
|
+
1. **Layers** (`src/layers/`)
|
|
37
|
+
- Entry point for UI hierarchy
|
|
38
|
+
- `UIFullscreenLayer` handles browser window scaling and input events
|
|
39
|
+
- Owns three wrapper systems: Scene, Solver, and Input
|
|
40
|
+
|
|
41
|
+
2. **Elements** (`src/elements/`)
|
|
42
|
+
- Visual UI components that live on layers
|
|
43
|
+
- All elements extend from `UIElement` → `UIDummy` → `UIAnchor`
|
|
44
|
+
- Elements have both constraint-based layout (x, y, width, height) and visual transforms (`micro`)
|
|
45
|
+
|
|
46
|
+
3. **Constraints** (`src/constraints/`)
|
|
47
|
+
- Define relationships between element positions and sizes
|
|
48
|
+
- Solved using Kiwi.js (Cassowary algorithm)
|
|
49
|
+
- Constraints can be orientation-aware (horizontal/vertical/always)
|
|
50
|
+
|
|
51
|
+
4. **Wrappers** (`src/wrappers/`)
|
|
52
|
+
- `UISolverWrapper` - Manages Kiwi.js constraint solver
|
|
53
|
+
- `UISceneWrapper` - Manages Three.js rendering via plane registry
|
|
54
|
+
- `UIInputWrapper` - Manages pointer event catching and propagation
|
|
55
|
+
|
|
56
|
+
### Event System (Ferrsign)
|
|
57
|
+
|
|
58
|
+
The library uses **Ferrsign** for type-safe event handling:
|
|
59
|
+
|
|
60
|
+
- `Ferrsign0` - Events with no arguments
|
|
61
|
+
- `Ferrsign1` - Events with 1 argument
|
|
62
|
+
- `Ferrsign2` - Events with 2 arguments
|
|
63
|
+
- `Ferrsign3` - Events with 3 arguments
|
|
64
|
+
- For 4+ arguments, wrap in an object
|
|
65
|
+
|
|
66
|
+
**Important**: Event data types are defined in `.Internal.ts` files:
|
|
67
|
+
|
|
68
|
+
- `UIInputEventData` in `UIDummy.Internal.ts`
|
|
69
|
+
- `UIFullscreenLayerInputEventData` in `UIFullscreenLayer.Internal.ts`
|
|
70
|
+
|
|
71
|
+
### File Organization Patterns
|
|
72
|
+
|
|
73
|
+
Each component follows this structure:
|
|
74
|
+
|
|
75
|
+
- `Component.ts` - Main implementation
|
|
76
|
+
- `Component.Internal.ts` - Internal types, interfaces, constants, event data types
|
|
77
|
+
|
|
78
|
+
**Import Convention**: Use `type {} from` not `{ type } from`:
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
// ✓ Correct
|
|
82
|
+
import { Ferrsign1 } from "ferrsign";
|
|
83
|
+
import type { FerrsignView1 } from "ferrsign";
|
|
84
|
+
|
|
85
|
+
// ✗ Wrong
|
|
86
|
+
import { Ferrsign1, type FerrsignView1 } from "ferrsign";
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Type imports must be in the beginning of files, not inline (`import type { X }` not `type X = import("...")`).
|
|
90
|
+
|
|
91
|
+
### Coordinate System
|
|
92
|
+
|
|
93
|
+
- Origin (0, 0) is **bottom-left** of the layer
|
|
94
|
+
- Y increases upward (opposite of DOM)
|
|
95
|
+
- All positions and sizes use world units (not pixels)
|
|
96
|
+
- Elements have two transform systems:
|
|
97
|
+
- **Constraint layout**: x, y, width, height (affects constraints)
|
|
98
|
+
- **Visual transforms**: `element.micro.*` (doesn't affect constraints)
|
|
99
|
+
|
|
100
|
+
### Rendering Pipeline
|
|
101
|
+
|
|
102
|
+
1. Layer calls `solverWrapper.updateVariables()` if dirty
|
|
103
|
+
2. Layer emits `signalRendering` event
|
|
104
|
+
3. Elements update their plane transforms if dirty
|
|
105
|
+
4. `UISceneWrapper` renders all visible planes via `UIGenericPlaneRegistry`
|
|
106
|
+
5. Dirty flags are cleared
|
|
107
|
+
|
|
108
|
+
### Shader System
|
|
109
|
+
|
|
110
|
+
- Shaders are in `src/shaders/` as `.glsl` files
|
|
111
|
+
- Imported as strings via rollup-plugin-string
|
|
112
|
+
- Minified during production build (comments/whitespace removed)
|
|
113
|
+
- Each element type has its own shader with custom uniforms
|
|
114
|
+
|
|
115
|
+
## Key Design Principles
|
|
116
|
+
|
|
117
|
+
1. **Bundle Size Optimization**
|
|
118
|
+
- Private properties prefixed with `_` are mangled in production
|
|
119
|
+
- Aggressive terser settings in production build
|
|
120
|
+
- No unused code - tree-shakeable exports
|
|
121
|
+
|
|
122
|
+
2. **Constraint-Based Layout**
|
|
123
|
+
- Elements don't directly set their own positions
|
|
124
|
+
- Constraints define relationships, solver calculates final values
|
|
125
|
+
- Use `UISolverWrapper.suggestVariableValue()` for direct position hints
|
|
126
|
+
|
|
127
|
+
3. **Separation of Layout and Transforms**
|
|
128
|
+
- Constraints control layout (x, y, width, height)
|
|
129
|
+
- `UIMicro` controls visual transforms (rotation, scale, offset)
|
|
130
|
+
- This allows animations without recalculating constraints
|
|
131
|
+
|
|
132
|
+
4. **Dirty Flag System**
|
|
133
|
+
- Solver, input, and individual elements track dirty state
|
|
134
|
+
- Only recalculate when necessary
|
|
135
|
+
- `setDirtyFalse()` called after updates
|
|
136
|
+
|
|
137
|
+
## Common Patterns
|
|
138
|
+
|
|
139
|
+
### Adding a New Element Type
|
|
140
|
+
|
|
141
|
+
1. Create `UINewElement.ts` and `UINewElement.Internal.ts`
|
|
142
|
+
2. Extend `UIElement` (or `UIDummy` if interactive)
|
|
143
|
+
3. Define shader in `src/shaders/UINewElement.glsl`
|
|
144
|
+
4. Register plane with `sceneWrapper.createPlane()`
|
|
145
|
+
5. Subscribe to `layer.signalRendering` for updates
|
|
146
|
+
6. Export from `src/index.ts`
|
|
147
|
+
|
|
148
|
+
### Adding Event Support
|
|
149
|
+
|
|
150
|
+
1. Define event data interface in `.Internal.ts` file
|
|
151
|
+
2. Create private `Ferrsign*` fields in class
|
|
152
|
+
3. Create public getters returning `FerrsignView*`
|
|
153
|
+
4. Emit events with `signalName.emit(...)`
|
|
154
|
+
5. Export event data type from `src/index.ts`
|
|
155
|
+
|
|
156
|
+
### Working with Constraints
|
|
157
|
+
|
|
158
|
+
Constraints are active when:
|
|
159
|
+
|
|
160
|
+
- Priority > 0
|
|
161
|
+
- Enabled = true
|
|
162
|
+
- Orientation matches (ALWAYS, or current layer orientation)
|
|
163
|
+
|
|
164
|
+
Priority levels (0-1000, higher = stronger):
|
|
165
|
+
|
|
166
|
+
- P0-P3: Strong constraints (layout structure)
|
|
167
|
+
- P4-P6: Medium constraints (sizing)
|
|
168
|
+
- P7-P9: Weak constraints (suggestions)
|
|
169
|
+
|
|
170
|
+
## Dependencies
|
|
171
|
+
|
|
172
|
+
- **@lume/kiwi** (^0.4.4) - Cassowary constraint solver
|
|
173
|
+
- **ferrsign** (^0.0.4) - Type-safe event system
|
|
174
|
+
- **three** (peer, >=0.157.0 <0.180.0) - 3D rendering
|
|
175
|
+
|
|
176
|
+
## Notes
|
|
177
|
+
|
|
178
|
+
- The library assumes strict TypeScript (`strict: true`)
|
|
179
|
+
- No tests currently - early alpha stage
|
|
180
|
+
- Designed for mobile ad scenarios (small bundle, responsive)
|
|
181
|
+
- Works best for relatively simple UI layouts
|
package/README.md
CHANGED
|
@@ -1,32 +1,25 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
+
<img src="./assets/logotype.png" width="200" alt="Laymur logo"><br/>
|
|
2
3
|
<h1 align="center">Laymur</h1>
|
|
3
4
|
<p align="center">
|
|
4
|
-
|
|
5
|
+
Constraint-based UI library for Three.js.<br/>
|
|
6
|
+
Primarily built for mobile advertisements (playable ads).
|
|
5
7
|
</p>
|
|
6
8
|
</p>
|
|
7
|
-
|
|
8
9
|
<p align="center">
|
|
9
|
-
<a href="https://www.npmjs.com/package/laymur"><img src="https://img.shields.io/npm/v/laymur.svg" alt="npm version"></a>
|
|
10
|
-
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
|
|
11
|
-
<a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-%5E5.8.0-blue" alt="TypeScript"></a>
|
|
12
|
-
<a href="https://threejs.org/"><img src="https://img.shields.io/badge/Three.js-0.157.0--0.180.0-green" alt="Three.js"></a>
|
|
10
|
+
<a href="https://www.npmjs.com/package/laymur"><img src="https://img.shields.io/npm/v/laymur.svg" alt="npm version"></a>
|
|
11
|
+
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
|
|
12
|
+
<a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-%5E5.8.0-blue" alt="TypeScript"></a>
|
|
13
|
+
<a href="https://threejs.org/"><img src="https://img.shields.io/badge/Three.js-0.157.0--0.180.0-green" alt="Three.js"></a>
|
|
13
14
|
</p>
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
This library is in early development. APIs may change.
|
|
18
|
-
|
|
19
|
-
## What it does
|
|
20
|
-
|
|
21
|
-
A compact UI library designed for Three.js mobile advertisements where bundle size matters. Uses constraint-based positioning to handle responsive layouts across different screen sizes and orientations.
|
|
16
|
+
## Features
|
|
22
17
|
|
|
23
|
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
Originally built for mobile ad development scenarios where you need to keep the bundle small while supporting various screen configurations.
|
|
18
|
+
* **Cassowary solver** — constraint-based layouts via `@lume/kiwi`
|
|
19
|
+
* **Orientation-aware** — define portrait and landscape rules in one layout, solver toggles automatically
|
|
20
|
+
* **Micro-transforms** — visual-only transforms (scale, rotation, offset) that bypass the solver
|
|
21
|
+
* **Resize policies** — Cover, Fit, FixedHeight, FixedWidth, Cross strategies
|
|
22
|
+
* **Modular particles** — separate `laymur/particles` entry point, import only if needed
|
|
30
23
|
|
|
31
24
|
## Installation
|
|
32
25
|
|
|
@@ -34,235 +27,118 @@ Originally built for mobile ad development scenarios where you need to keep the
|
|
|
34
27
|
npm install laymur
|
|
35
28
|
```
|
|
36
29
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
## Quick Example
|
|
40
|
-
|
|
41
|
-
```typescript
|
|
42
|
-
import { UIFullscreenLayer, UIImage, UIText } from "laymur";
|
|
43
|
-
import { WebGLRenderer, TextureLoader, Clock } from "three";
|
|
44
|
-
|
|
45
|
-
const renderer = new WebGLRenderer();
|
|
46
|
-
const layer = new UIFullscreenLayer();
|
|
47
|
-
const clock = new Clock();
|
|
48
|
-
|
|
49
|
-
const texture = new TextureLoader().load("background.jpg");
|
|
50
|
-
const background = new UIImage(layer, texture, { x: 0, y: 0 });
|
|
51
|
-
const title = new UIText(layer, "Mobile Ad Title", {
|
|
52
|
-
x: 100,
|
|
53
|
-
y: 100,
|
|
54
|
-
maxLineWidth: 800,
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
function animate() {
|
|
58
|
-
layer.render(renderer, clock.getDelta());
|
|
59
|
-
requestAnimationFrame(animate);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
animate();
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## Basic Components
|
|
66
|
-
|
|
67
|
-
### Layers
|
|
68
|
-
|
|
69
|
-
- **UIFullscreenLayer** - Handles browser window scaling
|
|
30
|
+
Peer Dependencies:
|
|
70
31
|
|
|
71
|
-
|
|
32
|
+
* `three` (>=0.157.0 <0.180.0)
|
|
33
|
+
* `@lume/kiwi` (^0.4.4)
|
|
34
|
+
* `ferrsign` (^0.0.4)
|
|
72
35
|
|
|
73
|
-
|
|
74
|
-
- **UIAnimatedImage** - Animated texture sequences
|
|
75
|
-
- **UIText** - Text rendering with word wrapping and styled spans
|
|
76
|
-
- **UIGraphics** - Vector graphics and shapes
|
|
77
|
-
- **UIScene** - Embed 3D scenes
|
|
78
|
-
- **UIProgress** - Progress bars
|
|
79
|
-
- **UINineSlice** - Scalable UI panels with border preservation
|
|
80
|
-
- **UIAnchor** - Positioning points
|
|
36
|
+
## Core Concepts
|
|
81
37
|
|
|
82
|
-
###
|
|
83
|
-
|
|
84
|
-
- **UIWidthConstraint** / **UIHeightConstraint** - Fixed sizes
|
|
85
|
-
- **UIAspectConstraint** - Maintain aspect ratios
|
|
86
|
-
- **UIHorizontalDistanceConstraint** / **UIVerticalDistanceConstraint** - Spacing between elements
|
|
87
|
-
- **UIHorizontalProportionConstraint** / **UIVerticalProportionConstraint** - Proportional sizing
|
|
88
|
-
- **UIHorizontalInterpolationConstraint** / **UIVerticalInterpolationConstraint** - Position element between two anchors
|
|
89
|
-
- **UICustomConstraint** - Custom constraint expressions
|
|
90
|
-
- **UIFitConstraintBuilder** - Fit element inside container (like CSS object-fit: contain)
|
|
91
|
-
- **UICoverConstraintBuilder** - Cover container with element (like CSS object-fit: cover)
|
|
38
|
+
### 1. Layers & Elements
|
|
92
39
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
The constraint system automatically calculates positions and sizes based on relationships you define:
|
|
40
|
+
`UIFullscreenLayer` manages coordinate system, canvas scaling, and input. All UI elements attach to a layer.
|
|
96
41
|
|
|
97
42
|
```typescript
|
|
98
|
-
import { UIImage,
|
|
99
|
-
|
|
100
|
-
const sidebar = new UIImage(layer, sidebarTexture, { x: 0, y: 0 });
|
|
101
|
-
const content = new UIImage(layer, contentTexture, { x: 0, y: 0 });
|
|
43
|
+
import { UIFullscreenLayer, UIImage, UIMode, UIResizePolicyFixedHeight } from 'laymur';
|
|
102
44
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
new UIHorizontalDistanceConstraint(sidebar, content, {
|
|
108
|
-
distance: 20,
|
|
109
|
-
anchorA: 1.0, // Right edge of sidebar
|
|
110
|
-
anchorB: 0.0, // Left edge of content
|
|
45
|
+
const layer = new UIFullscreenLayer({
|
|
46
|
+
name: "MainHUD",
|
|
47
|
+
mode: UIMode.VISIBLE,
|
|
48
|
+
resizePolicy: new UIResizePolicyFixedHeight(1080, 1920)
|
|
111
49
|
});
|
|
112
50
|
```
|
|
113
51
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
Text supports styled spans with different fonts, sizes, and colors:
|
|
117
|
-
|
|
118
|
-
```typescript
|
|
119
|
-
import { UIText } from "laymur";
|
|
120
|
-
|
|
121
|
-
const text = new UIText(
|
|
122
|
-
layer,
|
|
123
|
-
[
|
|
124
|
-
{ text: "Download ", style: { fontSize: 24, color: "#333333" } },
|
|
125
|
-
{ text: "Now!", style: { fontSize: 32, color: "#ff0000", fontWeight: "bold" } },
|
|
126
|
-
],
|
|
127
|
-
{
|
|
128
|
-
x: 100,
|
|
129
|
-
y: 100,
|
|
130
|
-
maxLineWidth: 600,
|
|
131
|
-
},
|
|
132
|
-
);
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
## Transformations
|
|
136
|
-
|
|
137
|
-
Apply visual transformations without affecting the constraint layout:
|
|
138
|
-
|
|
139
|
-
```typescript
|
|
140
|
-
const element = new UIImage(layer, texture, { x: 0, y: 0 });
|
|
141
|
-
|
|
142
|
-
// Apply transformations for animations
|
|
143
|
-
element.micro.x = 10;
|
|
144
|
-
element.micro.scaleX = 1.2;
|
|
145
|
-
element.micro.rotation = 0.1;
|
|
146
|
-
element.micro.anchorX = 0.5; // Transform origin (0 = left/bottom, 0.5 = center, 1 = right/top)
|
|
147
|
-
|
|
148
|
-
// Reset all transformations
|
|
149
|
-
element.micro.reset();
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
## Event Handling
|
|
52
|
+
### 2. Constraint System
|
|
153
53
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
### Element Input Events
|
|
157
|
-
|
|
158
|
-
Elements with area (width and height) can emit input events:
|
|
54
|
+
Cassowary-based constraint solver. Supports priorities, element relationships, orientation-specific rules, and inequality relations.
|
|
159
55
|
|
|
160
56
|
```typescript
|
|
161
|
-
import {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
button.signalEntered.on((data: UIInputEventData) => {
|
|
180
|
-
console.log("Pointer entered button");
|
|
57
|
+
import {
|
|
58
|
+
UIHorizontalDistanceConstraint,
|
|
59
|
+
UIVerticalProportionConstraint,
|
|
60
|
+
UIAspectConstraint,
|
|
61
|
+
UIOrientation,
|
|
62
|
+
UIPriority,
|
|
63
|
+
UIRelation
|
|
64
|
+
} from 'laymur';
|
|
65
|
+
|
|
66
|
+
// Lock aspect ratio
|
|
67
|
+
new UIAspectConstraint(element);
|
|
68
|
+
|
|
69
|
+
// Position relative to layer center
|
|
70
|
+
new UIHorizontalDistanceConstraint(layer, element, {
|
|
71
|
+
anchorA: 0.5,
|
|
72
|
+
anchorB: 0.5,
|
|
181
73
|
});
|
|
182
74
|
|
|
183
|
-
|
|
184
|
-
|
|
75
|
+
// Size as proportion of layer, landscape only
|
|
76
|
+
new UIVerticalProportionConstraint(layer, element, {
|
|
77
|
+
proportion: 0.4,
|
|
78
|
+
orientation: UIOrientation.HORIZONTAL,
|
|
79
|
+
priority: UIPriority.P1,
|
|
185
80
|
});
|
|
186
81
|
|
|
187
|
-
|
|
188
|
-
|
|
82
|
+
// Max width constraint
|
|
83
|
+
new UIHorizontalProportionConstraint(layer, element, {
|
|
84
|
+
proportion: 0.8,
|
|
85
|
+
relation: UIRelation.LESS_THAN,
|
|
189
86
|
});
|
|
190
87
|
```
|
|
191
88
|
|
|
192
|
-
###
|
|
89
|
+
### 3. Micro-transforms
|
|
193
90
|
|
|
194
|
-
|
|
91
|
+
For animations, use `.micro` — updates visual matrix without triggering the solver.
|
|
195
92
|
|
|
196
93
|
```typescript
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
layer.signalPointerPressed.on((data: UIFullscreenLayerInputEventData) => {
|
|
200
|
-
console.log("Layer pressed at", data.x, data.y);
|
|
201
|
-
console.log("Layer:", data.layer);
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
layer.signalPointerMoved.on((data: UIFullscreenLayerInputEventData) => {
|
|
205
|
-
console.log("Pointer moved to", data.x, data.y);
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
layer.signalPointerReleased.on((data: UIFullscreenLayerInputEventData) => {
|
|
209
|
-
console.log("Pointer released");
|
|
210
|
-
});
|
|
94
|
+
element.micro.scaleX = Math.sin(Date.now() * 0.001) + 1;
|
|
95
|
+
element.micro.rotation += 0.01;
|
|
211
96
|
```
|
|
212
97
|
|
|
213
|
-
###
|
|
98
|
+
### 4. Particle System
|
|
214
99
|
|
|
215
|
-
|
|
100
|
+
Modular pipeline: Spawn → Behavior → Rendering.
|
|
216
101
|
|
|
217
102
|
```typescript
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
animation.signalPlayed.on(() => {
|
|
221
|
-
console.log("Animation started or resumed");
|
|
222
|
-
});
|
|
103
|
+
import { UIEmitter, UISpawnRectangle, UIBehaviorDirectionalGravity, UIRenderingTexture } from 'laymur/particles';
|
|
223
104
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
105
|
+
const emitter = new UIEmitter(
|
|
106
|
+
layer,
|
|
107
|
+
[new UISpawnRectangle([-500, 0], [500, 0])],
|
|
108
|
+
[new UIBehaviorDirectionalGravity({ x: 0, y: 100 })],
|
|
109
|
+
[new UIRenderingTexture(particleTexture)],
|
|
110
|
+
{ expectedCapacity: 1024 } // Pre-allocation hint, not a hard limit
|
|
111
|
+
);
|
|
227
112
|
|
|
228
|
-
|
|
229
|
-
console.log("Animation stopped and reset");
|
|
230
|
-
});
|
|
113
|
+
emitter.play(60); // particles/sec
|
|
231
114
|
```
|
|
232
115
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
```typescript
|
|
236
|
-
const handler = (data: UIInputEventData) => {
|
|
237
|
-
console.log("Pressed!");
|
|
238
|
-
};
|
|
116
|
+
## API Overview
|
|
239
117
|
|
|
240
|
-
|
|
241
|
-
button.signalPressed.off(handler); // Unsubscribe
|
|
242
|
-
```
|
|
118
|
+
Most commonly used exports (not exhaustive):
|
|
243
119
|
|
|
244
|
-
|
|
120
|
+
### Core
|
|
245
121
|
|
|
246
|
-
|
|
122
|
+
UIFullscreenLayer, UIImage, UIAnimatedImage, UIText, UINineSlice, UIProgress
|
|
247
123
|
|
|
248
|
-
|
|
124
|
+
### Constraints
|
|
249
125
|
|
|
250
|
-
|
|
126
|
+
UIAspectConstraint, UIHorizontalDistanceConstraint, UIVerticalDistanceConstraint, UIHorizontalProportionConstraint, UIVerticalProportionConstraint, UICoverConstraintBuilder, UIFitConstraintBuilder
|
|
251
127
|
|
|
252
|
-
|
|
128
|
+
### Particles (laymur/particles)
|
|
253
129
|
|
|
254
|
-
|
|
255
|
-
- **NPM**: [https://www.npmjs.com/package/laymur-animations](https://www.npmjs.com/package/laymur-animations)
|
|
130
|
+
UIEmitter, UISpawnRectangle, UISpawnRandomLifetime, UIBehaviorDirectionalGravity, UIBehaviorVelocityDamping, UIRenderingTexture, UIRenderingColorOverLife
|
|
256
131
|
|
|
257
|
-
##
|
|
132
|
+
## Entry Points
|
|
258
133
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
134
|
+
```json
|
|
135
|
+
// package.json
|
|
136
|
+
"exports": {
|
|
137
|
+
".": "./dist/index.js",
|
|
138
|
+
"./particles": "./dist/particles/index.js"
|
|
139
|
+
}
|
|
140
|
+
```
|
|
263
141
|
|
|
264
142
|
## License
|
|
265
143
|
|
|
266
|
-
MIT ©
|
|
267
|
-
|
|
268
|
-
Uses [Kiwi.js](https://github.com/lume/kiwi) (BSD-3-Clause) for constraint solving and [Three.js](https://threejs.org/) (MIT) for 3D rendering.
|
|
144
|
+
MIT © jango
|
|
Binary file
|
package/eslint.config.js
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import tsPlugin from "@typescript-eslint/eslint-plugin";
|
|
2
|
+
import tsParser from "@typescript-eslint/parser";
|
|
3
|
+
|
|
4
|
+
export default [
|
|
5
|
+
{
|
|
6
|
+
files: ["src/**/*.ts"],
|
|
7
|
+
ignores: ["dist/**", "node_modules/**"],
|
|
8
|
+
languageOptions: {
|
|
9
|
+
parser: tsParser,
|
|
10
|
+
parserOptions: {
|
|
11
|
+
project: "./tsconfig.json",
|
|
12
|
+
tsconfigRootDir: process.cwd(),
|
|
13
|
+
sourceType: "module",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
plugins: {
|
|
17
|
+
"@typescript-eslint": tsPlugin,
|
|
18
|
+
},
|
|
19
|
+
rules: {
|
|
20
|
+
"@typescript-eslint/use-unknown-in-catch-callback-variable": "error",
|
|
21
|
+
"@typescript-eslint/unified-signatures": "error",
|
|
22
|
+
"@typescript-eslint/switch-exhaustiveness-check": "error",
|
|
23
|
+
"@typescript-eslint/strict-boolean-expressions": "error",
|
|
24
|
+
"@typescript-eslint/restrict-plus-operands": "error",
|
|
25
|
+
"@typescript-eslint/prefer-return-this-type": "error",
|
|
26
|
+
"@typescript-eslint/prefer-regexp-exec": "error",
|
|
27
|
+
"@typescript-eslint/prefer-literal-enum-member": "error",
|
|
28
|
+
"@typescript-eslint/prefer-find": "error",
|
|
29
|
+
"@typescript-eslint/prefer-enum-initializers": "error",
|
|
30
|
+
"@typescript-eslint/no-wrapper-object-types": "error",
|
|
31
|
+
"@typescript-eslint/no-unsafe-function-type": "error",
|
|
32
|
+
"@typescript-eslint/no-unsafe-enum-comparison": "error",
|
|
33
|
+
"@typescript-eslint/no-unnecessary-type-conversion": "error",
|
|
34
|
+
"@typescript-eslint/no-unnecessary-type-constraint": "error",
|
|
35
|
+
"@typescript-eslint/no-unnecessary-template-expression": "error",
|
|
36
|
+
"@typescript-eslint/no-unnecessary-qualifier": "error",
|
|
37
|
+
"@typescript-eslint/no-unnecessary-parameter-property-assignment": "error",
|
|
38
|
+
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
|
|
39
|
+
"@typescript-eslint/no-this-alias": "error",
|
|
40
|
+
"@typescript-eslint/no-redundant-type-constituents": "error",
|
|
41
|
+
"no-loop-func": "off",
|
|
42
|
+
"@typescript-eslint/no-loop-func": "error",
|
|
43
|
+
"@typescript-eslint/no-extra-non-null-assertion": "error",
|
|
44
|
+
"@typescript-eslint/no-empty-object-type": "error",
|
|
45
|
+
"@typescript-eslint/no-duplicate-type-constituents": "error",
|
|
46
|
+
"@typescript-eslint/no-duplicate-enum-values": "error",
|
|
47
|
+
"@typescript-eslint/no-import-type-side-effects": "error",
|
|
48
|
+
"@typescript-eslint/require-await": "error",
|
|
49
|
+
|
|
50
|
+
"no-unused-vars": "off",
|
|
51
|
+
"@typescript-eslint/no-unused-vars": "error",
|
|
52
|
+
"no-console": "error",
|
|
53
|
+
"no-debugger": "error",
|
|
54
|
+
"no-implicit-coercion": "error",
|
|
55
|
+
"no-extend-native": "error",
|
|
56
|
+
eqeqeq: ["error", "always"],
|
|
57
|
+
curly: ["error", "all"],
|
|
58
|
+
|
|
59
|
+
"@typescript-eslint/explicit-function-return-type": ["error", { allowExpressions: false }],
|
|
60
|
+
"@typescript-eslint/explicit-module-boundary-types": "error",
|
|
61
|
+
"@typescript-eslint/no-explicit-any": "error",
|
|
62
|
+
"@typescript-eslint/no-inferrable-types": "warn",
|
|
63
|
+
"@typescript-eslint/no-floating-promises": "error",
|
|
64
|
+
"@typescript-eslint/no-misused-promises": "error",
|
|
65
|
+
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
|
66
|
+
"@typescript-eslint/no-unnecessary-condition": "warn",
|
|
67
|
+
"@typescript-eslint/no-non-null-assertion": "warn",
|
|
68
|
+
"@typescript-eslint/ban-ts-comment": [
|
|
69
|
+
"error",
|
|
70
|
+
{ "ts-expect-error": "allow-with-description" },
|
|
71
|
+
],
|
|
72
|
+
"@typescript-eslint/prefer-readonly": "error",
|
|
73
|
+
"@typescript-eslint/prefer-optional-chain": "error",
|
|
74
|
+
"@typescript-eslint/consistent-type-imports": "error",
|
|
75
|
+
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
|
|
76
|
+
"@typescript-eslint/prefer-nullish-coalescing": "error",
|
|
77
|
+
"@typescript-eslint/prefer-string-starts-ends-with": "error",
|
|
78
|
+
"@typescript-eslint/prefer-includes": "error",
|
|
79
|
+
"@typescript-eslint/prefer-reduce-type-parameter": "error",
|
|
80
|
+
"@typescript-eslint/prefer-function-type": "error",
|
|
81
|
+
"@typescript-eslint/array-type": ["error", { default: "array" }],
|
|
82
|
+
"@typescript-eslint/prefer-for-of": "error",
|
|
83
|
+
|
|
84
|
+
"@typescript-eslint/member-ordering": "warn",
|
|
85
|
+
"@typescript-eslint/naming-convention": [
|
|
86
|
+
"error",
|
|
87
|
+
{ selector: "default", format: ["camelCase"] },
|
|
88
|
+
{ selector: "variableLike", format: ["camelCase", "UPPER_CASE"] },
|
|
89
|
+
{ selector: "typeLike", format: ["PascalCase"] },
|
|
90
|
+
{ selector: "enumMember", format: ["UPPER_CASE"] },
|
|
91
|
+
{
|
|
92
|
+
selector: "property",
|
|
93
|
+
format: ["camelCase"],
|
|
94
|
+
leadingUnderscore: "allow",
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
selector: "classProperty",
|
|
98
|
+
format: ["camelCase"],
|
|
99
|
+
modifiers: ["private"],
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
"@typescript-eslint/explicit-member-accessibility": [
|
|
103
|
+
"error",
|
|
104
|
+
{
|
|
105
|
+
accessibility: "explicit",
|
|
106
|
+
overrides: { constructors: "no-public" },
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
];
|