laymur 0.1.73 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/README.md +367 -0
  2. package/dist/builders/UIConstraint2DBuilder.d.ts +130 -0
  3. package/dist/composer/UIComposer.d.ts +0 -0
  4. package/dist/composer/UIFullscreenQuad.d.ts +0 -0
  5. package/dist/composer/UIPass.d.ts +0 -0
  6. package/dist/constraints/UIAspectConstraint.d.ts +60 -0
  7. package/dist/constraints/UIConstraint.d.ts +29 -0
  8. package/dist/constraints/UICoverConstraint.d.ts +0 -0
  9. package/dist/constraints/UICustomConstraint.d.ts +60 -0
  10. package/dist/constraints/UIFitConstraint.d.ts +0 -0
  11. package/dist/constraints/UIHeightConstraint.d.ts +49 -0
  12. package/dist/constraints/UIHorizontalDistanceConstraint.d.ts +94 -0
  13. package/dist/constraints/UIHorizontalProportionConstraint.d.ts +67 -0
  14. package/dist/constraints/UISingleParameterConstraint.d.ts +108 -0
  15. package/dist/constraints/UIVerticalDistanceConstraint.d.ts +94 -0
  16. package/dist/constraints/UIVerticalProportionConstraint.d.ts +67 -0
  17. package/dist/constraints/UIWidthConstraint.d.ts +49 -0
  18. package/dist/elements/UIAnchor.d.ts +78 -0
  19. package/dist/elements/UIDummy.d.ts +72 -0
  20. package/dist/elements/UIElement.d.ts +121 -0
  21. package/dist/elements/UIImage.d.ts +88 -0
  22. package/dist/elements/UINineSline.d.ts +0 -0
  23. package/dist/elements/UIProgress.d.ts +39 -0
  24. package/dist/elements/UIScene.d.ts +199 -0
  25. package/dist/elements/UIText.d.ts +157 -0
  26. package/dist/index.d.ts +29 -31
  27. package/dist/index.js +3320 -3251
  28. package/dist/index.js.map +1 -1
  29. package/dist/index.min.js +1 -1
  30. package/dist/index.min.js.map +1 -1
  31. package/dist/layers/UIFullscreenLayer.d.ts +112 -0
  32. package/dist/layers/UILayer.d.ts +144 -0
  33. package/dist/materials/UIInstancedMaterial.d.ts +0 -0
  34. package/dist/materials/UIMaterial.d.ts +13 -0
  35. package/dist/materials/UINineSliceMaterial.d.ts +0 -0
  36. package/dist/{Materials → materials}/UIProgressMaterial.d.ts +0 -4
  37. package/dist/miscellaneous/UIExpression.d.ts +117 -0
  38. package/dist/miscellaneous/UIMicro.d.ts +130 -0
  39. package/dist/{Miscellaneous → miscellaneous}/UIOrientation.d.ts +2 -9
  40. package/dist/miscellaneous/UIPriority.d.ts +56 -0
  41. package/dist/miscellaneous/UIRelation.d.ts +43 -0
  42. package/dist/miscellaneous/UITextPadding.d.ts +7 -0
  43. package/dist/miscellaneous/UITextSpan.d.ts +6 -0
  44. package/dist/miscellaneous/UITextStyle.d.ts +18 -0
  45. package/dist/miscellaneous/asserts.d.ts +112 -0
  46. package/dist/miscellaneous/textInterfaces.d.ts +19 -0
  47. package/dist/miscellaneous/textTools.d.ts +12 -0
  48. package/dist/scalable/UIScalableMesh.d.ts +16 -0
  49. package/dist/scalable/UIScalablePlaneMesh.d.ts +14 -0
  50. package/dist/wrappers/UISceneWrapper.d.ts +18 -0
  51. package/dist/wrappers/UISolverWrapper.d.ts +29 -0
  52. package/package.json +3 -3
  53. package/dist/Builders/UIConstraint2DBuilder.d.ts +0 -42
  54. package/dist/Builders/UIConstraintContainerBuilder.d.ts +0 -20
  55. package/dist/Builders/UIConstraintStackBuilder.d.ts +0 -24
  56. package/dist/Constraints/UIAspectConstraint.d.ts +0 -56
  57. package/dist/Constraints/UIConstraint.d.ts +0 -32
  58. package/dist/Constraints/UIConstraintPower.d.ts +0 -57
  59. package/dist/Constraints/UIConstraintRule.d.ts +0 -46
  60. package/dist/Constraints/UICoverConstraint.d.ts +0 -72
  61. package/dist/Constraints/UIFitConstraint.d.ts +0 -72
  62. package/dist/Constraints/UIHeightConstraint.d.ts +0 -55
  63. package/dist/Constraints/UIHorizontalDistanceConstraint.d.ts +0 -63
  64. package/dist/Constraints/UIHorizontalProportionConstraint.d.ts +0 -58
  65. package/dist/Constraints/UIVerticalDistanceConstraint.d.ts +0 -63
  66. package/dist/Constraints/UIVerticalProportionConstraint.d.ts +0 -58
  67. package/dist/Constraints/UIWidthConstraint.d.ts +0 -55
  68. package/dist/Elements/UIAnchor.d.ts +0 -66
  69. package/dist/Elements/UIDummy.d.ts +0 -21
  70. package/dist/Elements/UIElement.d.ts +0 -134
  71. package/dist/Elements/UIImage.d.ts +0 -57
  72. package/dist/Elements/UIProgress.d.ts +0 -127
  73. package/dist/Elements/UIScene.d.ts +0 -141
  74. package/dist/Elements/UIText.d.ts +0 -76
  75. package/dist/Layers/UIFullScreenLayer.d.ts +0 -13
  76. package/dist/Layers/UILayer.d.ts +0 -68
  77. package/dist/Materials/UIMaterial.d.ts +0 -13
  78. package/dist/Miscellaneous/UIBlending.d.ts +0 -7
  79. package/dist/Miscellaneous/UIMicro.d.ts +0 -176
  80. package/dist/Miscellaneous/UITextInterfaces.d.ts +0 -49
  81. package/dist/Miscellaneous/asserts.d.ts +0 -5
  82. package/dist/Miscellaneous/math.d.ts +0 -1
  83. package/dist/Miscellaneous/microTransformationTools.d.ts +0 -3
  84. package/dist/Miscellaneous/symbols.d.ts +0 -1
  85. package/dist/Miscellaneous/textTools.d.ts +0 -9
  86. package/dist/Passes/UIComposer.d.ts +0 -114
  87. package/dist/Passes/UIFullScreenQuad.d.ts +0 -51
  88. package/dist/Passes/UIPass.d.ts +0 -43
  89. /package/dist/{Miscellaneous → miscellaneous}/UIMode.d.ts +0 -0
  90. /package/dist/{Miscellaneous → miscellaneous}/threeInstances.d.ts +0 -0
@@ -1,49 +0,0 @@
1
- export interface UITextStyle {
2
- color: string;
3
- fontFamily: string;
4
- fontSize: number;
5
- fontStyle: "normal" | "italic" | "oblique";
6
- fontWeight: "normal" | "bold" | "bolder" | "lighter" | number;
7
- lineHeight: number;
8
- enableShadow: boolean;
9
- shadowOffsetX: number;
10
- shadowOffsetY: number;
11
- shadowBlur: number;
12
- shadowColor: string;
13
- enableStroke: boolean;
14
- strokeColor: string;
15
- strokeWidth: number;
16
- }
17
- export interface UITextPadding {
18
- left: number;
19
- right: number;
20
- top: number;
21
- bottom: number;
22
- }
23
- export interface UITextSize {
24
- width: number;
25
- height: number;
26
- }
27
- export interface UIChunkMetrics {
28
- width: number;
29
- height: number;
30
- baseline: number;
31
- lineHeight: number;
32
- }
33
- export interface UITextChunk {
34
- text: string;
35
- style: UITextStyle;
36
- metrics: UIChunkMetrics;
37
- }
38
- export interface UITextLine {
39
- chunks: UITextChunk[];
40
- width: number;
41
- height: number;
42
- baseline: number;
43
- lineHeight: number;
44
- }
45
- export interface UITextSpan {
46
- text: string;
47
- style?: Partial<UITextStyle>;
48
- }
49
- export declare function isUITextSpan(obj?: unknown): obj is UITextSpan;
@@ -1,5 +0,0 @@
1
- import type { UIAnchor } from "../Elements/UIAnchor";
2
- import type { UIElement } from "../Elements/UIElement";
3
- import { UILayer } from "../Layers/UILayer";
4
- export declare function assertSameLayer(elementOne: UIElement | UIAnchor | UILayer, elementTwo: UIElement | UIAnchor, message?: string): void;
5
- export declare function assertSize(width: number, height: number, message?: string): void;
@@ -1 +0,0 @@
1
- export declare function testElement(elementX: number, elementY: number, elementWidth: number, elementHeight: number, xClick: number, yClick: number): boolean;
@@ -1,3 +0,0 @@
1
- import { type Object3D } from "three";
2
- import type { UIMicroInternal } from "./UIMicro";
3
- export declare function applyMicroTransformations(object: Object3D, micro: UIMicroInternal, x: number, y: number, width: number, height: number, padding: number): void;
@@ -1 +0,0 @@
1
- export {};
@@ -1,9 +0,0 @@
1
- import type { UIChunkMetrics, UITextChunk, UITextLine, UITextPadding, UITextSize, UITextStyle } from "./UITextInterfaces";
2
- export declare function resolvePadding(padding?: Partial<UITextPadding> | number): UITextPadding;
3
- export declare function resolveTextStyle(currentStyle?: Partial<UITextStyle>, baseStyle?: Partial<UITextStyle>): UITextStyle;
4
- export declare function splitText(text: string): string[];
5
- export declare function measureTextChunk(context: CanvasRenderingContext2D, chunk: string, style: UITextStyle): UIChunkMetrics;
6
- export declare function wrapTextLines(maxWidth: number, chunks: UITextChunk[]): UITextLine[];
7
- export declare function calculateTextBlockSize(lines: UITextLine[]): UITextSize;
8
- export declare function renderText(x: number, y: number, text: string, style: UITextStyle, context: CanvasRenderingContext2D): void;
9
- export declare function renderTextLines(paddingTop: number, paddingLeft: number, lines: UITextLine[], context: CanvasRenderingContext2D): void;
@@ -1,114 +0,0 @@
1
- import type { Material, WebGLRenderer } from "three";
2
- import type { UIPass } from "./UIPass";
3
- /**
4
- * UI composition system for applying post-processing effects to rendered UI
5
- * The system manages render targets and passes to create complex visual effects
6
- */
7
- /**
8
- * Internal implementation of the UI composition system
9
- * Handles the actual rendering and composition of passes
10
- */
11
- export declare class UIComposerInternal {
12
- /** Collection of all registered composition passes */
13
- readonly passes: UIPass[];
14
- /** Source render target used during ping-pong rendering */
15
- private fromRenderTarget;
16
- /** Destination render target used during ping-pong rendering */
17
- private toRenderTarget;
18
- /** Default material used to render the final result */
19
- private readonly defaultMaterial;
20
- /** Full-screen quad used for rendering */
21
- private readonly screen;
22
- /** Whether the composition needs to be updated */
23
- private needsUpdateInternal;
24
- /** Whether the padding has changed since last frame */
25
- private paddingHasChangedInternal;
26
- /** Current padding value in pixels */
27
- private paddingInternal;
28
- /**
29
- * Creates a new UI composer with initial render targets
30
- */
31
- constructor();
32
- /**
33
- * Whether the composition needs to be updated in the next frame
34
- * True when either the composer or any valuable passes need update
35
- */
36
- get needsUpdate(): boolean;
37
- /**
38
- * Whether the padding has changed since the last frame
39
- * Used to trigger layout updates when padding changes
40
- */
41
- get paddingHasChanged(): boolean;
42
- /**
43
- * Current padding in pixels used for the composition
44
- * Calculated as the maximum padding required by all passes
45
- */
46
- get padding(): number;
47
- /**
48
- * Requests an update for the next frame
49
- * Will trigger a re-composition of all passes
50
- */
51
- requestUpdate(): void;
52
- /**
53
- * Composes all registered passes to create the final result
54
- *
55
- * @param renderer - WebGL renderer to use for composition
56
- * @param width - Width of the render target in pixels
57
- * @param height - Height of the render target in pixels
58
- * @param material - Input material containing the initial texture
59
- * @param canOverrideBlending - Whether blending can be overridden on the input material
60
- * @returns Material to use for rendering the composed result
61
- */
62
- compose(renderer: WebGLRenderer, width: number, height: number, material: Material, canOverrideBlending?: boolean): Material;
63
- /**
64
- * Cleans up resources used by the composer
65
- * Should be called when the composer is no longer needed
66
- */
67
- destroy(): void;
68
- /**
69
- * Checks if any passes are valuable (contribute meaningful effects)
70
- * @returns True if at least one pass is valuable
71
- */
72
- private hasValuablePasses;
73
- /**
74
- * Checks if any passes need an update
75
- * @returns True if at least one pass needs update
76
- */
77
- private hasPassesNeedingUpdate;
78
- /**
79
- * Calculates the maximum padding required by all passes
80
- * @returns Maximum padding value in pixels
81
- */
82
- private calculatePadding;
83
- /**
84
- * Updates the screen quad's padding based on dimensions
85
- *
86
- * @param width - Width of the render target in pixels
87
- * @param height - Height of the render target in pixels
88
- * @param padding - Padding value in pixels
89
- */
90
- private setScreenPadding;
91
- /**
92
- * Swaps the from and to render targets
93
- * Used for ping-pong rendering between passes
94
- */
95
- private reverseRenderTargets;
96
- }
97
- /**
98
- * Public interface for the UI composition system
99
- * Provides a simplified API for managing UI passes
100
- */
101
- export declare class UIComposer {
102
- private readonly raw;
103
- /**
104
- * Creates a new UI composer
105
- *
106
- * @param raw - Internal implementation that handles actual rendering
107
- */
108
- constructor(raw: UIComposerInternal);
109
- /**
110
- * Collection of all registered composition passes
111
- * Add passes to this collection to apply effects to the UI
112
- */
113
- get passes(): UIPass[];
114
- }
@@ -1,51 +0,0 @@
1
- import type { Material, WebGLRenderer } from "three";
2
- /**
3
- * Utility class for rendering a full-screen quad with optional padding
4
- * Used by the UI composition system to render passes
5
- */
6
- export declare class UIFullScreenQuad {
7
- private paddingHorizontalInternal;
8
- private paddingVerticalInternal;
9
- /**
10
- * Orthographic camera configured for device coordinates
11
- * Adjusted when padding changes to ensure correct rendering with padding
12
- */
13
- private readonly camera;
14
- /**
15
- * Creates a new UIFullScreenQuad
16
- *
17
- * @param paddingHorizontalInternal - Initial horizontal padding
18
- * @param paddingVerticalInternal - Initial vertical padding
19
- */
20
- constructor(paddingHorizontalInternal?: number, paddingVerticalInternal?: number);
21
- /**
22
- * Gets the current horizontal padding
23
- */
24
- get paddingHorizontal(): number;
25
- /**
26
- * Gets the current vertical padding
27
- */
28
- get paddingVertical(): number;
29
- /**
30
- * Sets the horizontal padding
31
- * Updates the camera projection when changed
32
- */
33
- set paddingHorizontal(value: number);
34
- /**
35
- * Sets the vertical padding
36
- * Updates the camera projection when changed
37
- */
38
- set paddingVertical(value: number);
39
- /**
40
- * Renders the fullscreen quad with the provided material
41
- *
42
- * @param renderer - The WebGL renderer to use
43
- * @param material - The material to apply to the fullscreen quad
44
- */
45
- render(renderer: WebGLRenderer, material: Material): void;
46
- /**
47
- * Updates the camera projection matrix to account for padding
48
- * Expands the camera frustum to include the padded area
49
- */
50
- private updateCameraTransform;
51
- }
@@ -1,43 +0,0 @@
1
- import type { Texture, WebGLRenderer } from "three";
2
- /**
3
- * Options passed to a UIPass when rendering
4
- */
5
- export interface UIPassRenderOptions {
6
- /** Width of the render target in pixels (without padding) */
7
- width: number;
8
- /** Height of the render target in pixels (without padding) */
9
- height: number;
10
- /** Current padding used for the render target */
11
- padding: number;
12
- }
13
- /**
14
- * Abstract base class for all UI composition passes
15
- *
16
- * UI passes are used to apply post-processing effects to the rendered UI
17
- * Each pass can be chained together in a UIComposer to create complex effects
18
- */
19
- export declare abstract class UIPass {
20
- /**
21
- * The amount of padding in pixels this pass requires
22
- * The compositor will use the maximum padding value from all passes
23
- */
24
- abstract get padding(): number;
25
- /**
26
- * Whether this pass needs to be updated in the next frame
27
- * Set to true when properties change to trigger a re-render
28
- */
29
- abstract get needsUpdate(): boolean;
30
- /**
31
- * Whether this pass contributes a meaningful effect
32
- * Passes that are not valuable may be skipped during composition
33
- */
34
- abstract get isValuable(): boolean;
35
- /**
36
- * Renders this pass
37
- *
38
- * @param renderer - The WebGL renderer to use
39
- * @param texture - The input texture from the previous pass
40
- * @param parameters - Render options including dimensions and padding
41
- */
42
- abstract render(renderer: WebGLRenderer, texture: Texture, parameters: UIPassRenderOptions): void;
43
- }