laymur 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/README.md +353 -2
  2. package/dist/builders/UIConstraint2DBuilder.d.ts +102 -14
  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 +40 -36
  7. package/dist/constraints/UIConstraint.d.ts +17 -20
  8. package/dist/constraints/UICoverConstraint.d.ts +0 -72
  9. package/dist/constraints/UICustomConstraint.d.ts +60 -0
  10. package/dist/constraints/UIFitConstraint.d.ts +0 -72
  11. package/dist/constraints/UIHeightConstraint.d.ts +32 -38
  12. package/dist/constraints/UIHorizontalDistanceConstraint.d.ts +77 -46
  13. package/dist/constraints/UIHorizontalProportionConstraint.d.ts +49 -40
  14. package/dist/constraints/UISingleParameterConstraint.d.ts +108 -0
  15. package/dist/constraints/UIVerticalDistanceConstraint.d.ts +77 -46
  16. package/dist/constraints/UIVerticalProportionConstraint.d.ts +49 -40
  17. package/dist/constraints/UIWidthConstraint.d.ts +32 -38
  18. package/dist/elements/UIAnchor.d.ts +58 -45
  19. package/dist/elements/UIDummy.d.ts +63 -12
  20. package/dist/elements/UIElement.d.ts +81 -93
  21. package/dist/elements/UIImage.d.ts +64 -33
  22. package/dist/elements/UINineSline.d.ts +0 -0
  23. package/dist/elements/UIProgress.d.ts +7 -95
  24. package/dist/elements/UIScene.d.ts +142 -84
  25. package/dist/elements/UIText.d.ts +124 -43
  26. package/dist/index.d.ts +10 -11
  27. package/dist/index.js +2887 -2716
  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 +134 -57
  33. package/dist/materials/UIInstancedMaterial.d.ts +0 -0
  34. package/dist/materials/UIMaterial.d.ts +6 -6
  35. package/dist/materials/UINineSliceMaterial.d.ts +0 -0
  36. package/dist/materials/UIProgressMaterial.d.ts +0 -4
  37. package/dist/miscellaneous/UIExpression.d.ts +117 -0
  38. package/dist/miscellaneous/UIMicro.d.ts +73 -119
  39. package/dist/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 +111 -4
  46. package/dist/miscellaneous/textInterfaces.d.ts +19 -0
  47. package/dist/miscellaneous/textTools.d.ts +8 -5
  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 +1 -1
  53. package/dist/Passes/UIComposer.d.ts +0 -114
  54. package/dist/Passes/UIFullScreenQuad.d.ts +0 -51
  55. package/dist/Passes/UIPass.d.ts +0 -43
  56. package/dist/builders/UIConstraintContainerBuilder.d.ts +0 -20
  57. package/dist/builders/UIConstraintStackBuilder.d.ts +0 -24
  58. package/dist/constraints/UIConstraintPower.d.ts +0 -57
  59. package/dist/constraints/UIConstraintRule.d.ts +0 -46
  60. package/dist/layers/UIFullScreenLayer.d.ts +0 -13
  61. package/dist/miscellaneous/UIBlending.d.ts +0 -7
  62. package/dist/miscellaneous/UITextInterfaces.d.ts +0 -49
  63. package/dist/miscellaneous/math.d.ts +0 -1
  64. package/dist/miscellaneous/microTransformationTools.d.ts +0 -3
@@ -1,63 +1,94 @@
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";
1
+ import type { UIPlaneElement, UIPointElement } from "../miscellaneous/asserts";
2
+ import type { UISingleParameterConstraintOptions } from "./UISingleParameterConstraint";
3
+ import { UISingleParameterConstraint } from "./UISingleParameterConstraint";
8
4
  /**
9
- * Configuration options for vertical distance constraints.
5
+ * Configuration options for UIVerticalDistanceConstraint creation.
10
6
  */
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 */
7
+ export interface UIVerticalDistanceConstraintOptions extends UISingleParameterConstraintOptions {
8
+ /** Anchor point for element A (0.0 = top edge, 0.5 = center, 1.0 = bottom edge). */
9
+ anchorA: number;
10
+ /** Anchor point for element B (0.0 = top edge, 0.5 = center, 1.0 = bottom edge). */
11
+ anchorB: number;
12
+ /** The desired vertical distance between the elements. */
17
13
  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
14
  }
25
15
  /**
26
- * Constraint that enforces a specific vertical distance between two UI elements.
16
+ * Constraint that enforces vertical distance between two UI elements.
27
17
  *
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.
18
+ * UIVerticalDistanceConstraint creates a mathematical relationship that maintains
19
+ * a specific vertical distance between two elements using configurable anchor points.
20
+ * For plane elements, anchors determine the reference point (0.0 = top, 0.5 = center, 1.0 = bottom).
21
+ * For point elements, the anchor is always the element's position. The constraint equation is:
22
+ * (elementB.y + elementB.height * anchorB) - (elementA.y + elementA.height * anchorA) = distance
23
+ *
24
+ * @see {@link UISingleParameterConstraint} - Base class for single-parameter constraints
25
+ * @see {@link UIPointElement} - Point elements that can be constrained
26
+ * @see {@link UIPlaneElement} - Plane elements that can be constrained
27
+ * @see {@link UIExpression} - Mathematical expressions for constraint equations
30
28
  */
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 options;
36
- /** The Kiwi.js constraint object */
37
- private constraint?;
38
- /**
39
- * Creates a new vertical distance constraint.
29
+ export declare class UIVerticalDistanceConstraint extends UISingleParameterConstraint {
30
+ private readonly a;
31
+ private readonly b;
32
+ /** The constraint descriptor managed by the solver system. */
33
+ protected readonly constraint: number;
34
+ /** Internal storage for element A's anchor point. */
35
+ private anchorAInternal;
36
+ /** Internal storage for element B's anchor point. */
37
+ private anchorBInternal;
38
+ /** Internal storage for the vertical distance value. */
39
+ private distanceInternal;
40
+ /**
41
+ * Creates a new UIVerticalDistanceConstraint instance.
40
42
  *
41
- * @param elementOne - The first element or layer
42
- * @param elementTwo - The second element
43
- * @param options - Configuration options
43
+ * The constraint will use default anchor points (0.5 = center) and zero distance
44
+ * if not specified in options. Both elements must be from the same layer.
45
+ *
46
+ * @param a - The first UI element (point or plane element)
47
+ * @param b - The second UI element (point or plane element)
48
+ * @param options - Configuration options for the constraint
49
+ * @throws Will throw an error if elements are not from the same layer
50
+ * @see {@link assertValidConstraintSubjects}
44
51
  */
45
- constructor(elementOne: UIElement | UIAnchor | UILayer, elementTwo: UIElement | UIAnchor, options?: Partial<UIVerticalDistanceOptions>);
52
+ constructor(a: UIPointElement | UIPlaneElement, b: UIPointElement | UIPlaneElement, options?: Partial<UIVerticalDistanceConstraintOptions>);
46
53
  /**
47
- * Destroys this constraint, removing it from the constraint system.
54
+ * Gets the current vertical distance being enforced.
55
+ * @returns The vertical distance in pixels
48
56
  */
49
- destroy(): void;
57
+ get distance(): number;
50
58
  /**
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
- *
59
+ * Gets the anchor point for element A.
60
+ * @returns The anchor value (0.0 = top, 0.5 = center, 1.0 = bottom)
61
+ */
62
+ get anchorA(): number;
63
+ /**
64
+ * Gets the anchor point for element B.
65
+ * @returns The anchor value (0.0 = top, 0.5 = center, 1.0 = bottom)
56
66
  */
57
- protected buildConstraints(): void;
67
+ get anchorB(): number;
58
68
  /**
59
- * Removes the vertical distance constraint from the constraint solver.
69
+ * Sets a new vertical distance and updates the constraint equation.
70
+ * @param value - The new vertical distance in pixels
71
+ */
72
+ set distance(value: number);
73
+ /**
74
+ * Sets a new anchor point for element A and updates the constraint equation.
75
+ * @param value - The new anchor value (0.0 = top, 0.5 = center, 1.0 = bottom)
76
+ */
77
+ set anchorA(value: number);
78
+ /**
79
+ * Sets a new anchor point for element B and updates the constraint equation.
80
+ * @param value - The new anchor value (0.0 = top, 0.5 = center, 1.0 = bottom)
81
+ */
82
+ set anchorB(value: number);
83
+ /**
84
+ * Builds the left-hand side expression for the constraint equation.
85
+ *
86
+ * Creates the expression: (elementB.y + elementB.height * anchorB) - (elementA.y + elementA.height * anchorA)
87
+ * For point elements, only the y position is used since they have no height.
88
+ * For plane elements, the anchor determines the reference point within the element's height.
60
89
  *
90
+ * @returns The UIExpression representing the vertical distance calculation
91
+ * @private
61
92
  */
62
- protected destroyConstraints(): void;
93
+ private buildLHS;
63
94
  }
@@ -1,58 +1,67 @@
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";
1
+ import type { UIPlaneElement } from "../miscellaneous/asserts";
2
+ import type { UISingleParameterConstraintOptions } from "./UISingleParameterConstraint";
3
+ import { UISingleParameterConstraint } from "./UISingleParameterConstraint";
7
4
  /**
8
- * Configuration options for vertical proportion constraints.
5
+ * Configuration options for UIVerticalProportionConstraint creation.
9
6
  */
10
- export interface UIVerticalProportionOptions {
11
- /** The proportion ratio between elements' heights */
7
+ export interface UIVerticalProportionConstraintOptions extends UISingleParameterConstraintOptions {
8
+ /** The proportional relationship between element heights (elementA.height = elementB.height * proportion). */
12
9
  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
10
  }
20
11
  /**
21
- * Constraint that enforces a proportional relationship between the heights of two elements.
12
+ * Constraint that enforces proportional height relationships between two UI elements.
22
13
  *
23
- * This constraint ensures that the height of one element is proportionally
24
- * related to the height of another element by a specified ratio.
14
+ * UIVerticalProportionConstraint creates a mathematical relationship that maintains
15
+ * a proportional ratio between the heights of two plane elements. The constraint equation is:
16
+ * elementA.height * proportion = elementB.height, which can be rearranged as:
17
+ * elementA.height * proportion - elementB.height = 0
18
+ *
19
+ * This is useful for creating responsive layouts where elements need to maintain
20
+ * specific height ratios, such as header-to-content ratios or row height proportions.
21
+ *
22
+ * @see {@link UISingleParameterConstraint} - Base class for single-parameter constraints
23
+ * @see {@link UIPlaneElement} - Plane elements that can have proportional constraints applied
24
+ * @see {@link UIExpression} - Mathematical expressions for constraint equations
25
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 options;
31
- /** The Kiwi.js constraint object */
32
- private constraint?;
26
+ export declare class UIVerticalProportionConstraint extends UISingleParameterConstraint {
27
+ private readonly a;
28
+ private readonly b;
29
+ /** The constraint descriptor managed by the solver system. */
30
+ protected readonly constraint: number;
31
+ /** Internal storage for the current proportion value. */
32
+ private proportionInternal;
33
33
  /**
34
- * Creates a new vertical proportion constraint.
34
+ * Creates a new UIVerticalProportionConstraint instance.
35
+ *
36
+ * The constraint will enforce the relationship: elementA.height * proportion = elementB.height.
37
+ * If no proportion is specified, it defaults to 1.0 (equal heights).
38
+ * Both elements must be from the same layer.
35
39
  *
36
- * @param elementOne - The reference element or layer
37
- * @param elementTwo - The element to constrain proportionally
38
- * @param options - Configuration options
40
+ * @param a - The first UI plane element (whose height will be multiplied by proportion)
41
+ * @param b - The second UI plane element (target height for the proportion)
42
+ * @param options - Configuration options for the constraint
43
+ * @throws Will throw an error if elements are not from the same layer
44
+ * @see {@link assertValidConstraintSubjects}
39
45
  */
40
- constructor(elementOne: UIElement | UILayer, elementTwo: UIElement, options?: Partial<UIVerticalProportionOptions>);
46
+ constructor(a: UIPlaneElement, b: UIPlaneElement, options?: Partial<UIVerticalProportionConstraintOptions>);
41
47
  /**
42
- * Destroys this constraint, removing it from the constraint system.
48
+ * Gets the current proportion value being enforced.
49
+ * @returns The proportion ratio (elementA.height = elementB.height * proportion)
43
50
  */
44
- destroy(): void;
51
+ get proportion(): number;
45
52
  /**
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
- *
53
+ * Sets a new proportion value and updates the constraint equation.
54
+ * @param value - The new proportion ratio
51
55
  */
52
- protected buildConstraints(): void;
56
+ set proportion(value: number);
53
57
  /**
54
- * Removes the vertical proportion constraint from the constraint solver.
58
+ * Builds the left-hand side expression for the constraint equation.
59
+ *
60
+ * Creates the expression: (elementA.height * proportion) - elementB.height = 0
61
+ * This enforces the relationship: elementA.height * proportion = elementB.height
55
62
  *
63
+ * @returns The UIExpression representing the proportional height relationship
64
+ * @private
56
65
  */
57
- protected destroyConstraints(): void;
66
+ private buildLHS;
58
67
  }
@@ -1,55 +1,49 @@
1
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";
2
+ import type { UISingleParameterConstraintOptions } from "./UISingleParameterConstraint";
3
+ import { UISingleParameterConstraint } from "./UISingleParameterConstraint";
6
4
  /**
7
- * Configuration options for width constraints.
5
+ * Configuration options for UIWidthConstraint creation.
8
6
  */
9
- export interface UIWidthOptions {
10
- /** The fixed width value to constrain the element to */
7
+ export interface UIWidthConstraintOptions extends UISingleParameterConstraintOptions {
8
+ /** The desired width value for the element. */
11
9
  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
10
  }
19
11
  /**
20
- * Constraint that enforces a specific width for a UI element.
12
+ * Constraint that enforces a specific width value for UI elements.
21
13
  *
22
- * This constraint can be configured to require an exact width
23
- * or set minimum/maximum width limits using different rules.
14
+ * UIWidthConstraint creates a mathematical relationship that fixes an element's
15
+ * width to a constant value. The constraint equation is: element.width = width.
16
+ * This is useful for ensuring elements maintain a specific width regardless of
17
+ * other layout changes or for setting fixed dimensions in responsive layouts.
18
+ *
19
+ * @see {@link UISingleParameterConstraint} - Base class for single-parameter constraints
20
+ * @see {@link UIElement} - Elements that can have width constraints applied
21
+ * @see {@link UIExpression} - Mathematical expressions for constraint equations
24
22
  */
25
- export declare class UIWidthConstraint extends UIConstraint {
23
+ export declare class UIWidthConstraint extends UISingleParameterConstraint {
26
24
  private readonly element;
27
- /** The configuration options for this constraint */
28
- private readonly options;
29
- /** The Kiwi.js constraint object */
30
- private constraint?;
25
+ /** The constraint descriptor managed by the solver system. */
26
+ protected readonly constraint: number;
27
+ /** Internal storage for the current width value. */
28
+ private widthInternal;
31
29
  /**
32
- * Creates a new width constraint.
30
+ * Creates a new UIWidthConstraint instance.
31
+ *
32
+ * If no width is specified in options, the constraint will use the
33
+ * element's current width as the target width value.
33
34
  *
34
- * @param element - The UI element to constrain
35
- * @param options - Configuration options
35
+ * @param element - The UI element to apply the width constraint to
36
+ * @param options - Configuration options for the constraint
36
37
  */
37
- constructor(element: UIElement, options?: Partial<UIWidthOptions>);
38
+ constructor(element: UIElement, options?: Partial<UIWidthConstraintOptions>);
38
39
  /**
39
- * Destroys this constraint, removing it from the constraint system.
40
+ * Gets the current width value being enforced.
41
+ * @returns The width value in pixels
40
42
  */
41
- destroy(): void;
43
+ get width(): number;
42
44
  /**
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
- *
45
+ * Sets a new width value and updates the constraint equation.
46
+ * @param value - The new width value in pixels
53
47
  */
54
- protected destroyConstraints(): void;
48
+ set width(value: number);
55
49
  }
@@ -1,65 +1,78 @@
1
- import { Variable } from "@lume/kiwi";
2
1
  import { Eventail } from "eventail";
3
- import type { Object3D, WebGLRenderer } from "three";
4
2
  import type { UILayer } from "../layers/UILayer";
5
- export declare abstract class UIAnchor extends Eventail {
3
+ import type { UIPointElement } from "../miscellaneous/asserts";
4
+ import type { UISolverWrapper } from "../wrappers/UISolverWrapper";
5
+ /**
6
+ * Abstract base class representing a minimal UI element as a point in 2D space.
7
+ *
8
+ * A UIAnchor serves as the fundamental building block for UI layout systems,
9
+ * representing a single point with x and y coordinates. It provides constraint-based
10
+ * positioning through solver variables and serves as an anchor point for more
11
+ * complex UI elements.
12
+ *
13
+ * @see {@link UIPointElement} - Interface defining point element behavior
14
+ * @see {@link UILayer} - Container layer for UI elements
15
+ * @see {@link UISolverWrapper} - Constraint solver integration
16
+ */
17
+ export declare abstract class UIAnchor extends Eventail implements UIPointElement {
6
18
  readonly layer: UILayer;
7
- protected readonly object?: Object3D | undefined;
8
- /** X position variable for constraint system */
9
- ["xInternal"]: Variable;
10
- /** Y position variable for constraint system */
11
- ["yInternal"]: Variable;
12
- /** Flag indicating whether the element needs recalculation */
13
- ["needsRecalculationInternal"]: boolean;
14
- /** Unique identifier for the element */
19
+ /** Optional name identifier for the anchor. */
15
20
  name: string;
16
21
  /**
17
- * Creates a new UI element.
18
- *
19
- * @param layer - The UI layer that contains this element
20
- * @param x - Initial x position
21
- * @param y - Initial y position
22
+ * Solver variable descriptor for the x-coordinate.
23
+ * This variable is managed by the constraint solver system.
22
24
  */
23
- constructor(layer: UILayer, x: number, y: number, object?: Object3D | undefined);
24
- /** Gets the current x position of the anchor */
25
- get x(): number;
26
- /** Gets the current y position of the anchor */
27
- get y(): number;
28
- /** Gets the current z-index (depth) of the element */
29
- get zIndex(): number;
30
- /** Gets whether the element needs recalculation */
31
- protected get needsRecalculation(): boolean;
25
+ readonly xVariable: number;
32
26
  /**
33
- * Sets the x position of the element
34
- * @param value - New x position
27
+ * Solver variable descriptor for the y-coordinate.
28
+ * This variable is managed by the constraint solver system.
35
29
  */
36
- set x(value: number);
30
+ readonly yVariable: number;
37
31
  /**
38
- * Sets the y position of the element
39
- * @param value - New y position
32
+ * Reference to the constraint solver wrapper for variable management.
33
+ * @see {@link UISolverWrapper}
40
34
  */
41
- set y(value: number);
35
+ protected readonly solverWrapper: UISolverWrapper;
42
36
  /**
43
- * Sets the z-index (depth) of the element
44
- * @param value - New z-index
37
+ * Creates a new UIAnchor instance.
38
+ *
39
+ * @param layer - The UI layer that contains this anchor
40
+ * @param x - Initial x-coordinate position
41
+ * @param y - Initial y-coordinate position
42
+ * @throws Will throw an error if x or y are not valid numbers
43
+ * @see {@link assertValidNumber}
45
44
  */
46
- set zIndex(value: number);
45
+ constructor(layer: UILayer, x: number, y: number);
47
46
  /**
48
- * Destroys the anchor, cleaning up all resources and removing it from the layer.
49
- * This should be called when the anchor is no longer needed.
47
+ * Gets the current x-coordinate value from the solver.
48
+ * @returns The current x-coordinate position
50
49
  */
51
- destroy(): void;
50
+ get x(): number;
52
51
  /**
53
- * Applies transformations to the underlying Three.js object.
54
- * This is called when the element's position, size, or other properties change.
52
+ * Gets the current y-coordinate value from the solver.
53
+ * @returns The current y-coordinate position
55
54
  */
56
- protected applyTransformations(): void;
55
+ get y(): number;
56
+ /**
57
+ * Sets the x-coordinate value through the solver system.
58
+ * @param value - The new x-coordinate value
59
+ * @throws Will throw an error if value is not a valid number
60
+ * @see {@link assertValidNumber}
61
+ */
62
+ set x(value: number);
57
63
  /**
58
- * Renders the element.
59
- * This must be implemented by concrete subclasses.
64
+ * Sets the y-coordinate value through the solver system.
65
+ * @param value - The new y-coordinate value
66
+ * @throws Will throw an error if value is not a valid number
67
+ * @see {@link assertValidNumber}
68
+ */
69
+ set y(value: number);
70
+ /**
71
+ * Destroys the anchor by removing its solver variables.
60
72
  *
61
- * @param renderer - The WebGL renderer
62
- * @param deltaTime - Time elapsed since the last frame
73
+ * This method cleans up the solver variables associated with this anchor,
74
+ * effectively removing it from the constraint solving system. After calling
75
+ * this method, the anchor should not be used anymore.
63
76
  */
64
- protected abstract render(renderer: WebGLRenderer, deltaTime: number): void;
77
+ destroy(): void;
65
78
  }
@@ -1,21 +1,72 @@
1
1
  import type { UILayer } from "../layers/UILayer";
2
- import { UIElement } from "./UIElement";
2
+ import { type UIPlaneElement } from "../miscellaneous/asserts";
3
+ import { UIAnchor } from "./UIAnchor";
3
4
  /**
4
- * A minimal UI element with no visual representation.
5
- * Used as a placeholder, spacer, or container for other elements.
5
+ * Abstract UI element that extends UIAnchor with dimensions but without rendering.
6
+ *
7
+ * UIDummy represents a rectangular area in the UI layout system that has position
8
+ * and dimensions (width and height) but does not perform any visual rendering.
9
+ * It serves as a placeholder or spacer element in constraint-based layouts,
10
+ * useful for defining layout structure without visual content.
11
+ *
12
+ * @see {@link UIAnchor} - Base class providing position functionality
13
+ * @see {@link UIPlaneElement} - Interface defining dimensional element behavior
14
+ * @see {@link UILayer} - Container layer for UI elements
6
15
  */
7
- export declare class UIDummy extends UIElement {
16
+ export declare abstract class UIDummy extends UIAnchor implements UIPlaneElement {
8
17
  /**
9
- * Creates a new dummy UI element.
18
+ * Solver variable descriptor for the width dimension.
19
+ * This variable is managed by the constraint solver system.
20
+ */
21
+ readonly wVariable: number;
22
+ /**
23
+ * Solver variable descriptor for the height dimension.
24
+ * This variable is managed by the constraint solver system.
25
+ */
26
+ readonly hVariable: number;
27
+ /**
28
+ * Creates a new UIDummy instance with position and dimensions.
10
29
  *
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)
30
+ * @param layer - The UI layer that contains this dummy element
31
+ * @param x - Initial x-coordinate position
32
+ * @param y - Initial y-coordinate position
33
+ * @param width - Initial width dimension (defaults to 100)
34
+ * @param height - Initial height dimension (defaults to 100)
35
+ * @throws Will throw an error if width or height are not valid positive numbers
36
+ * @see {@link assertValidPositiveNumber}
14
37
  */
15
- constructor(layer: UILayer, width?: number, height?: number);
38
+ constructor(layer: UILayer, x: number, y: number, width?: number, height?: number);
16
39
  /**
17
- * Renders the dummy element.
18
- * Since dummies have no visual representation, this only applies transformations.
40
+ * Gets the current width value from the solver.
41
+ * @returns The current width dimension
42
+ */
43
+ get width(): number;
44
+ /**
45
+ * Gets the current height value from the solver.
46
+ * @returns The current height dimension
47
+ */
48
+ get height(): number;
49
+ /**
50
+ * Sets the width value through the solver system.
51
+ * @param value - The new width dimension (must be positive)
52
+ * @throws Will throw an error if value is not a valid positive number
53
+ * @see {@link assertValidPositiveNumber}
54
+ */
55
+ set width(value: number);
56
+ /**
57
+ * Sets the height value through the solver system.
58
+ * @param value - The new height dimension (must be positive)
59
+ * @throws Will throw an error if value is not a valid positive number
60
+ * @see {@link assertValidPositiveNumber}
61
+ */
62
+ set height(value: number);
63
+ /**
64
+ * Destroys the dummy element by removing its solver variables.
65
+ *
66
+ * This method cleans up the dimension solver variables (width and height)
67
+ * associated with this dummy element, then calls the parent destroy method
68
+ * to clean up position variables. After calling this method, the dummy
69
+ * element should not be used anymore.
19
70
  */
20
- protected render(): void;
71
+ destroy(): void;
21
72
  }