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,72 +0,0 @@
1
- import { UIElement } from "../Elements/UIElement";
2
- import type { UILayer } from "../Layers/UILayer";
3
- import { UIOrientation } from "../Miscellaneous/UIOrientation";
4
- import { UIConstraint } from "./UIConstraint";
5
- /**
6
- * Configuration options for fit constraints.
7
- */
8
- export interface UIFitOptions {
9
- /** Whether to force equal height (true) or allow stretching (false) */
10
- isStrict: boolean;
11
- /** Horizontal anchor point (0-1) for alignment between elements */
12
- horizontalAnchor: number;
13
- /** Vertical anchor point (0-1) for alignment between elements */
14
- verticalAnchor: number;
15
- /** Screen orientation when this constraint should be active */
16
- orientation: UIOrientation;
17
- }
18
- /**
19
- * Constraint that makes an element fit within another element or layer.
20
- *
21
- * The fitting element will:
22
- * - Be aligned with the container element using the specified anchors
23
- * - Have at most the same width and height as the container element
24
- * - Optionally maintain strict proportions
25
- *
26
- * This is similar to CSS's "contain" object-fit behavior.
27
- */
28
- export declare class UIFitConstraint extends UIConstraint {
29
- private readonly elementOne;
30
- private readonly elementTwo;
31
- /** The configuration options for this constraint */
32
- private readonly parameters;
33
- /** Constraint for X-axis alignment */
34
- private constraintX?;
35
- /** Constraint for Y-axis alignment */
36
- private constraintY?;
37
- /** Constraint for width relationship */
38
- private constraintW?;
39
- /** Constraint for height relationship */
40
- private constraintH?;
41
- /** Optional constraint for maintaining strict proportions */
42
- private constraintStrict?;
43
- /**
44
- * Creates a new fit constraint.
45
- *
46
- * @param elementOne - The element or layer that contains the fitting element (the container)
47
- * @param elementTwo - The element that will fit within the container
48
- * @param parameters - Configuration options
49
- */
50
- constructor(elementOne: UIElement | UILayer, elementTwo: UIElement, parameters?: Partial<UIFitOptions>);
51
- /**
52
- * Destroys this constraint, removing it from the constraint system.
53
- */
54
- destroy(): void;
55
- /**
56
- * Builds and adds the fit constraints to the constraint solver.
57
- *
58
- * Creates five constraints:
59
- * 1. X alignment between the elements
60
- * 2. Y alignment between the elements
61
- * 3. Width fitting (elementTwo width ≤ elementOne width)
62
- * 4. Height fitting (elementTwo height ≤ elementOne height)
63
- * 5. Optional strict proportions (if isStrict = true)
64
- *
65
- */
66
- protected buildConstraints(): void;
67
- /**
68
- * Removes all fit constraints from the constraint solver.
69
- *
70
- */
71
- protected destroyConstraints(): void;
72
- }
@@ -1,55 +0,0 @@
1
- import type { UIElement } from "../Elements/UIElement";
2
- import { UIOrientation } from "../Miscellaneous/UIOrientation";
3
- import { UIConstraint } from "./UIConstraint";
4
- import type { UIConstraintPower } from "./UIConstraintPower";
5
- import type { UIConstraintRule } from "./UIConstraintRule";
6
- /**
7
- * Configuration options for height constraints.
8
- */
9
- export interface UIHeightOptions {
10
- /** The fixed height value to constrain the element to */
11
- height: number;
12
- /** Priority level for this constraint */
13
- power: UIConstraintPower;
14
- /** Rule for the constraint relationship (equal, less than, greater than) */
15
- rule: UIConstraintRule;
16
- /** Screen orientation when this constraint should be active */
17
- orientation: UIOrientation;
18
- }
19
- /**
20
- * Constraint that enforces a specific height for a UI element.
21
- *
22
- * This constraint can be configured to require an exact height
23
- * or set minimum/maximum height limits using different rules.
24
- */
25
- export declare class UIHeightConstraint extends UIConstraint {
26
- private readonly element;
27
- /** The configuration options for this constraint */
28
- private readonly options;
29
- /** The Kiwi.js constraint object */
30
- private constraint?;
31
- /**
32
- * Creates a new height constraint.
33
- *
34
- * @param element - The UI element to constrain
35
- * @param options - Configuration options
36
- */
37
- constructor(element: UIElement, options?: Partial<UIHeightOptions>);
38
- /**
39
- * Destroys this constraint, removing it from the constraint system.
40
- */
41
- destroy(): void;
42
- /**
43
- * Builds and adds the height constraint to the constraint solver.
44
- *
45
- * Creates a constraint that enforces the element's height based
46
- * on the specified rule (equal to, less than, or greater than).
47
- *
48
- */
49
- protected buildConstraints(): void;
50
- /**
51
- * Removes the height constraint from the constraint solver.
52
- *
53
- */
54
- protected destroyConstraints(): void;
55
- }
@@ -1,63 +0,0 @@
1
- import { UIAnchor } from "../Elements/UIAnchor";
2
- import { UIElement } from "../Elements/UIElement";
3
- import { UILayer } from "../Layers/UILayer";
4
- import { UIOrientation } from "../Miscellaneous/UIOrientation";
5
- import { UIConstraint } from "./UIConstraint";
6
- import type { UIConstraintPower } from "./UIConstraintPower";
7
- import type { UIConstraintRule } from "./UIConstraintRule";
8
- /**
9
- * Configuration options for horizontal distance constraints.
10
- */
11
- export interface UIHorizontalDistanceOptions {
12
- /** Horizontal anchor point (0-1) for the first element */
13
- anchorOne: number;
14
- /** Horizontal anchor point (0-1) for the second element */
15
- anchorTwo: number;
16
- /** The target distance between the two elements' anchor points */
17
- distance: number;
18
- /** Priority level for this constraint */
19
- power: UIConstraintPower;
20
- /** Rule for the constraint relationship (equal, less than, greater than) */
21
- rule: UIConstraintRule;
22
- /** Screen orientation when this constraint should be active */
23
- orientation: UIOrientation;
24
- }
25
- /**
26
- * Constraint that enforces a specific horizontal distance between two UI elements.
27
- *
28
- * This constraint measures the distance between two anchor points on the x-axis
29
- * and ensures it matches (or is less/greater than) the specified distance value.
30
- */
31
- export declare class UIHorizontalDistanceConstraint extends UIConstraint {
32
- private readonly elementOne;
33
- private readonly elementTwo;
34
- /** The configuration options for this constraint */
35
- private readonly parameters;
36
- /** The Kiwi.js constraint object */
37
- private constraint?;
38
- /**
39
- * Creates a new horizontal distance constraint.
40
- *
41
- * @param elementOne - The first element or layer
42
- * @param elementTwo - The second element
43
- * @param parameters - Configuration options
44
- */
45
- constructor(elementOne: UIElement | UIAnchor | UILayer, elementTwo: UIElement | UIAnchor, parameters?: Partial<UIHorizontalDistanceOptions>);
46
- /**
47
- * Destroys this constraint, removing it from the constraint system.
48
- */
49
- destroy(): void;
50
- /**
51
- * Builds and adds the horizontal distance constraint to the constraint solver.
52
- *
53
- * Creates a constraint that enforces the distance between anchor points
54
- * on the x-axis of two elements based on the specified rule.
55
- *
56
- */
57
- protected buildConstraints(): void;
58
- /**
59
- * Removes the horizontal distance constraint from the constraint solver.
60
- *
61
- */
62
- protected destroyConstraints(): void;
63
- }
@@ -1,58 +0,0 @@
1
- import { UIElement } from "../Elements/UIElement";
2
- import type { UILayer } from "../Layers/UILayer";
3
- import { UIOrientation } from "../Miscellaneous/UIOrientation";
4
- import { UIConstraint } from "./UIConstraint";
5
- import type { UIConstraintPower } from "./UIConstraintPower";
6
- import type { UIConstraintRule } from "./UIConstraintRule";
7
- /**
8
- * Configuration options for horizontal proportion constraints.
9
- */
10
- export interface UIHorizontalProportionOptions {
11
- /** The proportion ratio between elements' widths */
12
- proportion: number;
13
- /** Priority level for this constraint */
14
- power: UIConstraintPower;
15
- /** Rule for the constraint relationship (equal, less than, greater than) */
16
- rule: UIConstraintRule;
17
- /** Screen orientation when this constraint should be active */
18
- orientation: UIOrientation;
19
- }
20
- /**
21
- * Constraint that enforces a proportional relationship between the widths of two elements.
22
- *
23
- * This constraint ensures that the width of one element is proportionally
24
- * related to the width of another element by a specified ratio.
25
- */
26
- export declare class UIHorizontalProportionConstraint extends UIConstraint {
27
- private readonly elementOne;
28
- private readonly elementTwo;
29
- /** The configuration options for this constraint */
30
- private readonly parameters;
31
- /** The Kiwi.js constraint object */
32
- private constraint?;
33
- /**
34
- * Creates a new horizontal proportion constraint.
35
- *
36
- * @param elementOne - The reference element or layer
37
- * @param elementTwo - The element to constrain proportionally
38
- * @param parameters - Configuration options
39
- */
40
- constructor(elementOne: UIElement | UILayer, elementTwo: UIElement, parameters?: Partial<UIHorizontalProportionOptions>);
41
- /**
42
- * Destroys this constraint, removing it from the constraint system.
43
- */
44
- destroy(): void;
45
- /**
46
- * Builds and adds the horizontal proportion constraint to the constraint solver.
47
- *
48
- * Creates a constraint expression in the form: (elementOne.width * proportion) - elementTwo.width = 0
49
- * This ensures the width ratio between elements matches the specified proportion.
50
- *
51
- */
52
- protected buildConstraints(): void;
53
- /**
54
- * Removes the horizontal proportion constraint from the constraint solver.
55
- *
56
- */
57
- protected destroyConstraints(): void;
58
- }
@@ -1,63 +0,0 @@
1
- import { UIAnchor } from "../Elements/UIAnchor";
2
- import { UIElement } from "../Elements/UIElement";
3
- import { UILayer } from "../Layers/UILayer";
4
- import { UIOrientation } from "../Miscellaneous/UIOrientation";
5
- import { UIConstraint } from "./UIConstraint";
6
- import type { UIConstraintPower } from "./UIConstraintPower";
7
- import type { UIConstraintRule } from "./UIConstraintRule";
8
- /**
9
- * Configuration options for vertical distance constraints.
10
- */
11
- export interface UIVerticalDistanceOptions {
12
- /** Vertical anchor point (0-1) for the first element */
13
- anchorOne: number;
14
- /** Vertical anchor point (0-1) for the second element */
15
- anchorTwo: number;
16
- /** The target distance between the two elements' anchor points */
17
- distance: number;
18
- /** Priority level for this constraint */
19
- power: UIConstraintPower;
20
- /** Rule for the constraint relationship (equal, less than, greater than) */
21
- rule: UIConstraintRule;
22
- /** Screen orientation when this constraint should be active */
23
- orientation: UIOrientation;
24
- }
25
- /**
26
- * Constraint that enforces a specific vertical distance between two UI elements.
27
- *
28
- * This constraint measures the distance between two anchor points on the y-axis
29
- * and ensures it matches (or is less/greater than) the specified distance value.
30
- */
31
- export declare class UIVerticalDistanceConstraint extends UIConstraint {
32
- private readonly elementOne;
33
- private readonly elementTwo;
34
- /** The configuration options for this constraint */
35
- private readonly parameters;
36
- /** The Kiwi.js constraint object */
37
- private constraint?;
38
- /**
39
- * Creates a new vertical distance constraint.
40
- *
41
- * @param elementOne - The first element or layer
42
- * @param elementTwo - The second element
43
- * @param parameters - Configuration options
44
- */
45
- constructor(elementOne: UIElement | UIAnchor | UILayer, elementTwo: UIElement | UIAnchor, parameters?: Partial<UIVerticalDistanceOptions>);
46
- /**
47
- * Destroys this constraint, removing it from the constraint system.
48
- */
49
- destroy(): void;
50
- /**
51
- * Builds and adds the vertical distance constraint to the constraint solver.
52
- *
53
- * Creates a constraint that enforces the distance between anchor points
54
- * on the y-axis of two elements based on the specified rule.
55
- *
56
- */
57
- protected buildConstraints(): void;
58
- /**
59
- * Removes the vertical distance constraint from the constraint solver.
60
- *
61
- */
62
- protected destroyConstraints(): void;
63
- }
@@ -1,58 +0,0 @@
1
- import { UIElement } from "../Elements/UIElement";
2
- import type { UILayer } from "../Layers/UILayer";
3
- import { UIOrientation } from "../Miscellaneous/UIOrientation";
4
- import { UIConstraint } from "./UIConstraint";
5
- import type { UIConstraintPower } from "./UIConstraintPower";
6
- import type { UIConstraintRule } from "./UIConstraintRule";
7
- /**
8
- * Configuration options for vertical proportion constraints.
9
- */
10
- export interface UIVerticalProportionOptions {
11
- /** The proportion ratio between elements' heights */
12
- proportion: number;
13
- /** Priority level for this constraint */
14
- power: UIConstraintPower;
15
- /** Rule for the constraint relationship (equal, less than, greater than) */
16
- rule: UIConstraintRule;
17
- /** Screen orientation when this constraint should be active */
18
- orientation: UIOrientation;
19
- }
20
- /**
21
- * Constraint that enforces a proportional relationship between the heights of two elements.
22
- *
23
- * This constraint ensures that the height of one element is proportionally
24
- * related to the height of another element by a specified ratio.
25
- */
26
- export declare class UIVerticalProportionConstraint extends UIConstraint {
27
- private readonly elementOne;
28
- private readonly elementTwo;
29
- /** The configuration options for this constraint */
30
- private readonly parameters;
31
- /** The Kiwi.js constraint object */
32
- private constraint?;
33
- /**
34
- * Creates a new vertical proportion constraint.
35
- *
36
- * @param elementOne - The reference element or layer
37
- * @param elementTwo - The element to constrain proportionally
38
- * @param parameters - Configuration options
39
- */
40
- constructor(elementOne: UIElement | UILayer, elementTwo: UIElement, parameters?: Partial<UIVerticalProportionOptions>);
41
- /**
42
- * Destroys this constraint, removing it from the constraint system.
43
- */
44
- destroy(): void;
45
- /**
46
- * Builds and adds the vertical proportion constraint to the constraint solver.
47
- *
48
- * Creates a constraint expression in the form: (elementOne.height * proportion) - elementTwo.height = 0
49
- * This ensures the height ratio between elements matches the specified proportion.
50
- *
51
- */
52
- protected buildConstraints(): void;
53
- /**
54
- * Removes the vertical proportion constraint from the constraint solver.
55
- *
56
- */
57
- protected destroyConstraints(): void;
58
- }
@@ -1,55 +0,0 @@
1
- import type { UIElement } from "../Elements/UIElement";
2
- import { UIOrientation } from "../Miscellaneous/UIOrientation";
3
- import { UIConstraint } from "./UIConstraint";
4
- import type { UIConstraintPower } from "./UIConstraintPower";
5
- import type { UIConstraintRule } from "./UIConstraintRule";
6
- /**
7
- * Configuration options for width constraints.
8
- */
9
- export interface UIWidthOptions {
10
- /** The fixed width value to constrain the element to */
11
- width: number;
12
- /** Priority level for this constraint */
13
- power: UIConstraintPower;
14
- /** Rule for the constraint relationship (equal, less than, greater than) */
15
- rule: UIConstraintRule;
16
- /** Screen orientation when this constraint should be active */
17
- orientation: UIOrientation;
18
- }
19
- /**
20
- * Constraint that enforces a specific width for a UI element.
21
- *
22
- * This constraint can be configured to require an exact width
23
- * or set minimum/maximum width limits using different rules.
24
- */
25
- export declare class UIWidthConstraint extends UIConstraint {
26
- private readonly element;
27
- /** The configuration options for this constraint */
28
- private readonly options;
29
- /** The Kiwi.js constraint object */
30
- private constraint?;
31
- /**
32
- * Creates a new width constraint.
33
- *
34
- * @param element - The UI element to constrain
35
- * @param options - Configuration options
36
- */
37
- constructor(element: UIElement, options?: Partial<UIWidthOptions>);
38
- /**
39
- * Destroys this constraint, removing it from the constraint system.
40
- */
41
- destroy(): void;
42
- /**
43
- * Builds and adds the width constraint to the constraint solver.
44
- *
45
- * Creates a constraint that enforces the element's width based
46
- * on the specified rule (equal to, less than, or greater than).
47
- *
48
- */
49
- protected buildConstraints(): void;
50
- /**
51
- * Removes the width constraint from the constraint solver.
52
- *
53
- */
54
- protected destroyConstraints(): void;
55
- }
@@ -1,66 +0,0 @@
1
- import { Eventail } from "eventail";
2
- import { Variable } from "kiwi.js";
3
- import type { Object3D, WebGLRenderer } from "three";
4
- import type { UILayer } from "../Layers/UILayer";
5
- import { needsRecalculation, xSymbol, ySymbol } from "../Miscellaneous/symbols";
6
- export declare abstract class UIAnchor extends Eventail {
7
- readonly layer: UILayer;
8
- protected readonly object?: Object3D | undefined;
9
- /** X position variable for constraint system */
10
- [xSymbol]: Variable;
11
- /** Y position variable for constraint system */
12
- [ySymbol]: Variable;
13
- /** Flag indicating whether the element needs recalculation */
14
- [needsRecalculation]: boolean;
15
- /** Unique identifier for the element */
16
- name: string;
17
- /**
18
- * Creates a new UI element.
19
- *
20
- * @param layer - The UI layer that contains this element
21
- * @param x - Initial x position
22
- * @param y - Initial y position
23
- */
24
- constructor(layer: UILayer, x: number, y: number, object?: Object3D | undefined);
25
- /** Gets the current x position of the anchor */
26
- get x(): number;
27
- /** Gets the current y position of the anchor */
28
- get y(): number;
29
- /** Gets the current z-index (depth) of the element */
30
- get zIndex(): number;
31
- /** Gets whether the element needs recalculation */
32
- protected get needsRecalculation(): boolean;
33
- /**
34
- * Sets the x position of the element
35
- * @param value - New x position
36
- */
37
- set x(value: number);
38
- /**
39
- * Sets the y position of the element
40
- * @param value - New y position
41
- */
42
- set y(value: number);
43
- /**
44
- * Sets the z-index (depth) of the element
45
- * @param value - New z-index
46
- */
47
- set zIndex(value: number);
48
- /**
49
- * Destroys the anchor, cleaning up all resources and removing it from the layer.
50
- * This should be called when the anchor is no longer needed.
51
- */
52
- destroy(): void;
53
- /**
54
- * Applies transformations to the underlying Three.js object.
55
- * This is called when the element's position, size, or other properties change.
56
- */
57
- protected applyTransformations(): void;
58
- /**
59
- * Renders the element.
60
- * This must be implemented by concrete subclasses.
61
- *
62
- * @param renderer - The WebGL renderer
63
- * @param deltaTime - Time elapsed since the last frame
64
- */
65
- protected abstract render(renderer: WebGLRenderer, deltaTime: number): void;
66
- }
@@ -1,21 +0,0 @@
1
- import type { UILayer } from "../Layers/UILayer";
2
- import { UIElement } from "./UIElement";
3
- /**
4
- * A minimal UI element with no visual representation.
5
- * Used as a placeholder, spacer, or container for other elements.
6
- */
7
- export declare class UIDummy extends UIElement {
8
- /**
9
- * Creates a new dummy UI element.
10
- *
11
- * @param layer - The UI layer that contains this element
12
- * @param width - Width of the dummy element (defaults to DEFAULT_DUMMY_SIZE)
13
- * @param height - Height of the dummy element (defaults to DEFAULT_DUMMY_SIZE)
14
- */
15
- constructor(layer: UILayer, width?: number, height?: number);
16
- /**
17
- * Renders the dummy element.
18
- * Since dummies have no visual representation, this only applies transformations.
19
- */
20
- protected render(): void;
21
- }
@@ -1,134 +0,0 @@
1
- import { Eventail } from "eventail";
2
- import { Variable } from "kiwi.js";
3
- import type { WebGLRenderer } from "three";
4
- import { type Object3D } from "three";
5
- import type { UILayer } from "../Layers/UILayer";
6
- import { heightSymbol, needsRecalculation, widthSymbol, xSymbol, ySymbol } from "../Miscellaneous/symbols";
7
- import { UIMicro, UIMicroInternal } from "../Miscellaneous/UIMicro";
8
- import { UIMode } from "../Miscellaneous/UIMode";
9
- import { UIComposer, UIComposerInternal } from "../Passes/UIComposer";
10
- /**
11
- * Events that can be emitted by UI elements.
12
- */
13
- export declare enum UIElementEvent {
14
- /** Triggered when an interactive element is clicked */
15
- CLICK = "click"
16
- }
17
- /**
18
- * Abstract base class for all UI elements in the system.
19
- * Provides core functionality for positioning, sizing, and rendering UI elements.
20
- *
21
- * Each UI element has:
22
- * - Position (x, y) and size (width, height) variables
23
- * - Layer management integration
24
- * - Event handling capabilities
25
- * - Micro transformations support
26
- * - Rendering capabilities
27
- */
28
- export declare abstract class UIElement extends Eventail {
29
- readonly layer: UILayer;
30
- protected readonly object: Object3D;
31
- /** X position variable for constraint system */
32
- [xSymbol]: Variable;
33
- /** Y position variable for constraint system */
34
- [ySymbol]: Variable;
35
- /** Width variable for constraint system */
36
- [widthSymbol]: Variable;
37
- /** Height variable for constraint system */
38
- [heightSymbol]: Variable;
39
- /** Flag indicating whether the element needs recalculation */
40
- [needsRecalculation]: boolean;
41
- /** Unique identifier for the element */
42
- name: string;
43
- /** Micro transformation interface for the element */
44
- readonly micro: UIMicro;
45
- /** Composer interface for the element */
46
- readonly composer: UIComposer;
47
- /** Internal micro transformation implementation */
48
- protected readonly microInternal: UIMicroInternal;
49
- /** Internal composer implementation */
50
- protected readonly composerInternal: UIComposerInternal;
51
- /** Current visibility/interactivity mode */
52
- protected modeInternal: UIMode;
53
- /**
54
- * Creates a new UI element.
55
- *
56
- * @param layer - The UI layer that contains this element
57
- * @param object - The Three.js object that represents this element
58
- * @param x - Initial x position
59
- * @param y - Initial y position
60
- * @param width - Initial width
61
- * @param height - Initial height
62
- */
63
- constructor(layer: UILayer, object: Object3D, x: number, y: number, width: number, height: number);
64
- /** Gets the current x position of the element */
65
- get x(): number;
66
- /** Gets the current y position of the element */
67
- get y(): number;
68
- /** Gets the current width of the element */
69
- get width(): number;
70
- /** Gets the current height of the element */
71
- get height(): number;
72
- /** Gets the current z-index (depth) of the element */
73
- get zIndex(): number;
74
- /** Gets the current visibility/interactivity mode of the element */
75
- get mode(): UIMode;
76
- /** Gets whether the element needs recalculation */
77
- protected get needsRecalculation(): boolean;
78
- /**
79
- * Sets the x position of the element
80
- * @param value - New x position
81
- */
82
- set x(value: number);
83
- /**
84
- * Sets the y position of the element
85
- * @param value - New y position
86
- */
87
- set y(value: number);
88
- /**
89
- * Sets the width of the element
90
- * @param value - New width
91
- */
92
- set width(value: number);
93
- /**
94
- * Sets the height of the element
95
- * @param value - New height
96
- */
97
- set height(value: number);
98
- /**
99
- * Sets the z-index (depth) of the element
100
- * @param value - New z-index
101
- */
102
- set zIndex(value: number);
103
- /**
104
- * Sets the visibility/interactivity mode of the element
105
- * @param value - New UI mode
106
- */
107
- set mode(value: UIMode);
108
- /**
109
- * Destroys the element, cleaning up all resources and removing it from the layer.
110
- * This should be called when the element is no longer needed.
111
- */
112
- destroy(): void;
113
- /**
114
- * Applies transformations to the underlying Three.js object.
115
- * This is called when the element's position, size, or other properties change.
116
- */
117
- protected applyTransformations(): void;
118
- /**
119
- * Handles click events on this element.
120
- *
121
- * @param x - X coordinate of the click
122
- * @param y - Y coordinate of the click
123
- * @returns Whether the click was handled by this element
124
- */
125
- protected click(x: number, y: number): boolean;
126
- /**
127
- * Renders the element.
128
- * This must be implemented by concrete subclasses.
129
- *
130
- * @param renderer - The WebGL renderer
131
- * @param deltaTime - Time elapsed since the last frame
132
- */
133
- protected abstract render(renderer: WebGLRenderer, deltaTime: number): void;
134
- }