laymur 0.10.3 → 0.11.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.
Files changed (131) hide show
  1. package/README.md +20 -11
  2. package/dist/constraints/UIAspectConstraint.Internal.d.ts +6 -0
  3. package/dist/constraints/UIAspectConstraint.d.ts +9 -46
  4. package/dist/constraints/UIConstraint.d.ts +7 -27
  5. package/dist/constraints/UICustomConstraint.d.ts +13 -45
  6. package/dist/constraints/UIHeightConstraint.Internal.d.ts +6 -0
  7. package/dist/constraints/UIHeightConstraint.d.ts +8 -37
  8. package/dist/constraints/UIHorizontalDistanceConstraint.Internal.d.ts +11 -0
  9. package/dist/constraints/UIHorizontalDistanceConstraint.d.ts +16 -73
  10. package/dist/constraints/UIHorizontalProportionConstraint.Internal.d.ts +6 -0
  11. package/dist/constraints/UIHorizontalProportionConstraint.d.ts +8 -52
  12. package/dist/constraints/UISingleParameterConstraint.Internal.d.ts +12 -0
  13. package/dist/constraints/UISingleParameterConstraint.d.ts +24 -87
  14. package/dist/constraints/UIVerticalDistanceConstraint.Internal.d.ts +11 -0
  15. package/dist/constraints/UIVerticalDistanceConstraint.d.ts +12 -73
  16. package/dist/constraints/UIVerticalProportionConstraint.Internal.d.ts +6 -0
  17. package/dist/constraints/UIVerticalProportionConstraint.d.ts +8 -52
  18. package/dist/constraints/UIWidthConstraint.Internal.d.ts +6 -0
  19. package/dist/constraints/UIWidthConstraint.d.ts +8 -37
  20. package/dist/constraints/builders/UIConstraint2DBuilder.Internal.d.ts +45 -0
  21. package/dist/constraints/builders/UIConstraint2DBuilder.d.ts +35 -0
  22. package/dist/constraints/builders/UICoverConstraintBuilder.Internal.d.ts +13 -0
  23. package/dist/constraints/builders/UICoverConstraintBuilder.d.ts +29 -0
  24. package/dist/constraints/builders/UIFitConstraintBuilder.Internal.d.ts +13 -0
  25. package/dist/constraints/builders/UIFitConstraintBuilder.d.ts +29 -0
  26. package/dist/elements/UIAnchor.Internal.d.ts +9 -0
  27. package/dist/elements/UIAnchor.d.ts +17 -62
  28. package/dist/elements/UIAnimatedImage.Internal.d.ts +24 -0
  29. package/dist/elements/UIAnimatedImage.d.ts +38 -100
  30. package/dist/elements/UIDummy.Internal.d.ts +18 -0
  31. package/dist/elements/UIDummy.d.ts +51 -63
  32. package/dist/elements/UIElement.Internal.d.ts +11 -0
  33. package/dist/elements/UIElement.d.ts +28 -168
  34. package/dist/elements/UIGraphics.Internal.d.ts +7 -0
  35. package/dist/elements/UIGraphics.d.ts +29 -99
  36. package/dist/elements/UIImage.Internal.d.ts +7 -0
  37. package/dist/elements/UIImage.d.ts +18 -73
  38. package/dist/elements/UINineSlice.Internal.d.ts +23 -0
  39. package/dist/elements/UINineSlice.d.ts +45 -0
  40. package/dist/elements/UIProgress.Internal.d.ts +14 -0
  41. package/dist/elements/UIProgress.d.ts +26 -152
  42. package/dist/elements/UIScene.Internal.d.ts +43 -0
  43. package/dist/elements/UIScene.d.ts +29 -171
  44. package/dist/elements/UIText/UIText.Interfaces.d.ts +32 -0
  45. package/dist/elements/UIText/UIText.Internal.d.ts +26 -0
  46. package/dist/elements/UIText/UIText.Measuring.d.ts +49 -0
  47. package/dist/elements/UIText/UIText.Rendering.d.ts +19 -0
  48. package/dist/elements/UIText/UIText.d.ts +63 -0
  49. package/dist/index.d.ts +46 -46
  50. package/dist/index.js +4176 -4002
  51. package/dist/index.js.map +1 -1
  52. package/dist/index.min.js +1 -1
  53. package/dist/index.min.js.map +1 -1
  54. package/dist/layers/UIFullscreenLayer.d.ts +33 -43
  55. package/dist/layers/UILayer.Internal.d.ts +15 -0
  56. package/dist/layers/UILayer.d.ts +29 -184
  57. package/dist/miscellaneous/UIExpression.d.ts +35 -83
  58. package/dist/miscellaneous/UIInputEvent.d.ts +11 -8
  59. package/dist/miscellaneous/UIMode.d.ts +19 -21
  60. package/dist/miscellaneous/UIOrientation.d.ts +7 -22
  61. package/dist/miscellaneous/UIPriority.d.ts +16 -40
  62. package/dist/miscellaneous/UIRelation.d.ts +11 -31
  63. package/dist/miscellaneous/UITransparencyMode.d.ts +4 -21
  64. package/dist/miscellaneous/area/UIArea.d.ts +3 -0
  65. package/dist/miscellaneous/area/UIAreaCircle.d.ts +15 -0
  66. package/dist/miscellaneous/area/UIAreaPolygon.d.ts +12 -0
  67. package/dist/miscellaneous/area/UIAreaRectangle.d.ts +17 -0
  68. package/dist/miscellaneous/area/UIAreaRoundedRectangle.d.ts +21 -0
  69. package/dist/miscellaneous/asserts.d.ts +39 -82
  70. package/dist/miscellaneous/color/UIColor.Internal.d.ts +7 -0
  71. package/dist/miscellaneous/color/UIColor.d.ts +197 -0
  72. package/dist/miscellaneous/computeTransform.d.ts +18 -0
  73. package/dist/miscellaneous/generic-plane/UIGenericInstancedPlane.Internal.d.ts +10 -0
  74. package/dist/miscellaneous/generic-plane/UIGenericInstancedPlane.d.ts +36 -0
  75. package/dist/miscellaneous/generic-plane/UIGenericPlane.Internal.d.ts +5 -0
  76. package/dist/miscellaneous/generic-plane/UIGenericPlane.d.ts +23 -0
  77. package/dist/miscellaneous/generic-plane/UIGenericPlaneRegistry.Internal.d.ts +6 -0
  78. package/dist/miscellaneous/generic-plane/UIGenericPlaneRegistry.d.ts +27 -0
  79. package/dist/miscellaneous/generic-plane/shared.d.ts +22 -0
  80. package/dist/miscellaneous/mask-function/UIProgressMaskFunction.d.ts +9 -0
  81. package/dist/miscellaneous/mask-function/UIProgressMaskFunctionCircular.d.ts +21 -0
  82. package/dist/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.d.ts +16 -0
  83. package/dist/miscellaneous/micro/UIMicro.Internal.d.ts +31 -0
  84. package/dist/miscellaneous/micro/UIMicro.d.ts +59 -0
  85. package/dist/miscellaneous/padding/UIPadding.Internal.d.ts +11 -0
  86. package/dist/miscellaneous/padding/UIPadding.d.ts +46 -0
  87. package/dist/miscellaneous/resize-policy/UIResizePolicy.d.ts +3 -0
  88. package/dist/miscellaneous/resize-policy/UIResizePolicyCross.d.ts +22 -0
  89. package/dist/miscellaneous/resize-policy/UIResizePolicyCrossInverted.d.ts +22 -0
  90. package/dist/miscellaneous/resize-policy/UIResizePolicyFixedHeight.d.ts +22 -0
  91. package/dist/miscellaneous/resize-policy/UIResizePolicyFixedWidth.d.ts +22 -0
  92. package/dist/miscellaneous/resize-policy/UIResizePolicyNone.d.ts +5 -0
  93. package/dist/miscellaneous/text-span/UITextSpan.Internal.d.ts +8 -0
  94. package/dist/miscellaneous/text-span/UITextSpan.d.ts +14 -0
  95. package/dist/miscellaneous/text-style/UITextStyle.Internal.d.ts +48 -0
  96. package/dist/miscellaneous/text-style/UITextStyle.d.ts +85 -0
  97. package/dist/miscellaneous/texture/UITextureView.Internal.d.ts +54 -0
  98. package/dist/miscellaneous/texture/UITextureView.d.ts +61 -0
  99. package/dist/wrappers/UIInputWrapper.Internal.d.ts +17 -0
  100. package/dist/wrappers/UIInputWrapper.d.ts +13 -0
  101. package/dist/wrappers/UISceneWrapper.Internal.d.ts +13 -0
  102. package/dist/wrappers/UISceneWrapper.d.ts +12 -19
  103. package/dist/wrappers/UISolverWrapper.Internal.d.ts +49 -0
  104. package/dist/wrappers/UISolverWrapper.d.ts +2 -1
  105. package/package.json +3 -1
  106. package/dist/builders/UIConstraint2DBuilder.d.ts +0 -130
  107. package/dist/builders/UICoverConstraintBuilder.d.ts +0 -56
  108. package/dist/builders/UIFitConstraintBuilder.d.ts +0 -56
  109. package/dist/composer/UIComposer.d.ts +0 -0
  110. package/dist/composer/UIFullscreenQuad.d.ts +0 -0
  111. package/dist/composer/UIPass.d.ts +0 -0
  112. package/dist/elements/UINineSline.d.ts +0 -139
  113. package/dist/elements/UISpine.d.ts +0 -54
  114. package/dist/elements/UIText.d.ts +0 -149
  115. package/dist/miscellaneous/UIColor.d.ts +0 -245
  116. package/dist/miscellaneous/UIGenericInstancedPlane.d.ts +0 -32
  117. package/dist/miscellaneous/UIMicro.d.ts +0 -148
  118. package/dist/miscellaneous/UIMicroAnchorMode.d.ts +0 -9
  119. package/dist/miscellaneous/UINineSliceBorder.d.ts +0 -21
  120. package/dist/miscellaneous/UIResizePolicy.d.ts +0 -21
  121. package/dist/miscellaneous/UIResizePolicyCross.d.ts +0 -14
  122. package/dist/miscellaneous/UIResizePolicyCrossInverted.d.ts +0 -14
  123. package/dist/miscellaneous/UIResizePolicyFixedHeight.d.ts +0 -24
  124. package/dist/miscellaneous/UIResizePolicyFixedWidth.d.ts +0 -27
  125. package/dist/miscellaneous/UIResizePolicyNone.d.ts +0 -7
  126. package/dist/miscellaneous/UISceneWrapperClientAPI.d.ts +0 -12
  127. package/dist/miscellaneous/UITextPadding.d.ts +0 -7
  128. package/dist/miscellaneous/UITextSpan.d.ts +0 -6
  129. package/dist/miscellaneous/UITextStyle.d.ts +0 -20
  130. package/dist/miscellaneous/textInterfaces.d.ts +0 -19
  131. package/dist/miscellaneous/textTools.d.ts +0 -12
@@ -1,56 +1,32 @@
1
- /**
2
- * Priority levels for UI layout constraints and variables.
3
- *
4
- * UIPriority defines a hierarchical system of priority levels used by the
5
- * constraint solver to determine which constraints should take precedence
6
- * when conflicts arise. Lower numeric values represent higher priority,
7
- * with P0 being the highest priority and P7 being the lowest.
8
- *
9
- * The priority system maps to Kiwi solver strength values with different
10
- * strength components (required, strong, medium, weak) to create a nuanced
11
- * priority hierarchy for layout solving.
12
- *
13
- * @see {@link convertPriority} - Converts to Kiwi solver strength values
14
- */
1
+ /** Constraint solver priority levels */
15
2
  export declare enum UIPriority {
16
- /** Highest priority - required constraints that must be satisfied. */
3
+ /** Highest priority */
17
4
  P0 = 0,
18
- /** High priority - strong constraints with medium strength. */
5
+ /** High priority */
19
6
  P1 = 1,
20
- /** Medium-high priority - strong constraints with low strength. */
7
+ /** Medium-high priority */
21
8
  P2 = 2,
22
- /** Medium priority - medium strength constraints. */
9
+ /** Medium priority */
23
10
  P3 = 3,
24
- /** Medium-low priority - medium strength constraints with low weight. */
11
+ /** Medium-low priority */
25
12
  P4 = 4,
26
- /** Low priority - weak strength constraints with medium weight. */
13
+ /** Low priority */
27
14
  P5 = 5,
28
- /** Very low priority - weak strength constraints with low weight. */
15
+ /** Very low priority */
29
16
  P6 = 6,
30
- /** Lowest priority - weak strength constraints with minimal weight. */
17
+ /** Lowest priority */
31
18
  P7 = 7
32
19
  }
33
20
  /**
34
- * Converts UIPriority enum values to Kiwi solver strength values.
35
- *
36
- * This function maps the UI priority levels to the three-component strength
37
- * system used by the Kiwi constraint solver (required, strong, medium, weak).
38
- * Higher priority levels get stronger constraint strength values.
39
- *
40
- * @param priority - The UI priority level to convert
41
- * @returns The corresponding Kiwi solver strength value
42
- * @throws Will throw an error if an invalid priority is provided
43
- * @see {@link UIPriority} - Priority level definitions
21
+ * Converts priority to solver strength.
22
+ * @param priority Priority level
23
+ * @returns Solver strength value
24
+ * @throws If priority is invalid
44
25
  */
45
26
  export declare function convertPriority(priority: UIPriority): number;
46
27
  /**
47
- * Resolves an optional priority value to a concrete UIPriority.
48
- *
49
- * If no priority is provided, returns the default highest priority (P0).
50
- * This function is commonly used in constraint creation where priority
51
- * is an optional parameter.
52
- *
53
- * @param priority - The optional priority value to resolve
54
- * @returns The resolved priority, defaulting to P0 if undefined
28
+ * Resolves optional priority.
29
+ * @param priority Priority to resolve
30
+ * @returns Priority or P0 if undefined
55
31
  */
56
32
  export declare function resolvePriority(priority?: UIPriority): UIPriority;
@@ -1,43 +1,23 @@
1
1
  import { Operator } from "@lume/kiwi";
2
- /**
3
- * Relational operators for UI layout constraints.
4
- *
5
- * UIRelation defines the mathematical relationship between the left-hand
6
- * and right-hand sides of constraint equations. These relations are used
7
- * by the constraint solver to determine how expressions should be compared
8
- * when solving layout constraints.
9
- *
10
- * @see {@link convertRelation} - Converts to Kiwi solver operators
11
- */
2
+ /** Relational operators for constraints */
12
3
  export declare enum UIRelation {
13
- /** Equality relation: left-hand side equals right-hand side. */
4
+ /** Equality: LHS = RHS */
14
5
  EQUAL = 0,
15
- /** Less than or equal relation: left-hand side ≤ right-hand side. */
6
+ /** Less than or equal: LHS ≤ RHS */
16
7
  LESS_THAN = 1,
17
- /** Greater than or equal relation: left-hand side ≥ right-hand side. */
8
+ /** Greater than or equal: LHS ≥ RHS */
18
9
  GREATER_THAN = 2
19
10
  }
20
11
  /**
21
- * Converts UIRelation enum values to Kiwi solver operator values.
22
- *
23
- * This function maps the UI relation types to the corresponding operators
24
- * used by the Kiwi constraint solver for mathematical comparisons in
25
- * constraint equations.
26
- *
27
- * @param relation - The UI relation type to convert
28
- * @returns The corresponding Kiwi solver operator
29
- * @throws Will throw an error if an invalid relation is provided
30
- * @see {@link UIRelation} - Relation type definitions
12
+ * Converts relation to solver operator.
13
+ * @param relation Relation type
14
+ * @returns Solver operator
15
+ * @throws If relation is invalid
31
16
  */
32
17
  export declare function convertRelation(relation: UIRelation): Operator;
33
18
  /**
34
- * Resolves an optional relation value to a concrete UIRelation.
35
- *
36
- * If no relation is provided, returns the default equality relation.
37
- * This function is commonly used in constraint creation where relation
38
- * is an optional parameter.
39
- *
40
- * @param relation - The optional relation value to resolve
41
- * @returns The resolved relation, defaulting to EQUAL if undefined
19
+ * Resolves optional relation.
20
+ * @param relation Relation to resolve
21
+ * @returns Relation or EQUAL if undefined
42
22
  */
43
23
  export declare function resolveRelation(relation?: UIRelation): UIRelation;
@@ -1,26 +1,9 @@
1
- /**
2
- * Transparency rendering modes for UI elements.
3
- *
4
- * Controls how transparent and semi-transparent pixels are handled during rendering.
5
- * Each mode offers different performance and visual quality trade-offs.
6
- */
1
+ /** Transparency rendering modes */
7
2
  export declare enum UITransparencyMode {
8
- /**
9
- * Clip mode - pixels are either fully opaque or fully transparent.
10
- * Uses alpha testing to discard pixels below a threshold.
11
- * Best performance but no smooth transparency gradients.
12
- */
3
+ /** Binary transparency. Best performance. */
13
4
  CLIP = 0,
14
- /**
15
- * Hash mode - dithered transparency using screen-door transparency.
16
- * Creates transparency illusion through pixel patterns.
17
- * Good performance with better visual quality than CLIP.
18
- */
5
+ /** Dithered transparency. Good performance. */
19
6
  HASH = 1,
20
- /**
21
- * Blend mode - true alpha blending with smooth transparency.
22
- * Supports full range of transparency values with smooth gradients.
23
- * Best visual quality but requires depth sorting and impacts performance.
24
- */
7
+ /** Alpha blending. Best quality, requires depth sorting. */
25
8
  BLEND = 2
26
9
  }
@@ -0,0 +1,3 @@
1
+ /** Base class for interaction area shapes */
2
+ export declare abstract class UIArea {
3
+ }
@@ -0,0 +1,15 @@
1
+ import { UIArea } from "./UIArea";
2
+ /** Circular interaction area */
3
+ export declare class UIAreaCircle extends UIArea {
4
+ centerX: number;
5
+ centerY: number;
6
+ radius: number;
7
+ /**
8
+ * Creates circular area.
9
+ *
10
+ * @param centerX - Center X in normalized coordinates (0 to 1)
11
+ * @param centerY - Center Y in normalized coordinates (0 to 1)
12
+ * @param radius - Radius in normalized coordinates (0 to 1)
13
+ */
14
+ constructor(centerX: number, centerY: number, radius: number);
15
+ }
@@ -0,0 +1,12 @@
1
+ import type { Vector2Like } from "three";
2
+ import { UIArea } from "./UIArea";
3
+ /** Polygonal interaction area using ray casting */
4
+ export declare class UIAreaPolygon extends UIArea {
5
+ vertices: Vector2Like[];
6
+ /**
7
+ * Creates polygonal area.
8
+ *
9
+ * @param vertices - Vertices in normalized coordinates (0 to 1)
10
+ */
11
+ constructor(vertices: Vector2Like[]);
12
+ }
@@ -0,0 +1,17 @@
1
+ import { UIArea } from "./UIArea";
2
+ /** Rectangular interaction area */
3
+ export declare class UIAreaRectangle extends UIArea {
4
+ x: number;
5
+ y: number;
6
+ width: number;
7
+ height: number;
8
+ /**
9
+ * Creates rectangular area.
10
+ *
11
+ * @param x - X position in normalized coordinates (0 to 1)
12
+ * @param y - Y position in normalized coordinates (0 to 1)
13
+ * @param width - Width in normalized coordinates (0 to 1)
14
+ * @param height - Height in normalized coordinates (0 to 1)
15
+ */
16
+ constructor(x: number, y: number, width: number, height: number);
17
+ }
@@ -0,0 +1,21 @@
1
+ import { UIArea } from "./UIArea";
2
+ /** Rectangular interaction area with rounded corners */
3
+ export declare class UIAreaRoundedRectangle extends UIArea {
4
+ x: number;
5
+ y: number;
6
+ width: number;
7
+ height: number;
8
+ radius: number;
9
+ /**
10
+ * Creates rounded rectangular area.
11
+ *
12
+ * Radius clamped to half of smallest dimension.
13
+ *
14
+ * @param x - X position in normalized coordinates (0 to 1)
15
+ * @param y - Y position in normalized coordinates (0 to 1)
16
+ * @param width - Width in normalized coordinates (0 to 1)
17
+ * @param height - Height in normalized coordinates (0 to 1)
18
+ * @param radius - Corner radius in normalized coordinates (0 to 1)
19
+ */
20
+ constructor(x: number, y: number, width: number, height: number, radius: number);
21
+ }
@@ -1,120 +1,77 @@
1
1
  import { UILayer } from "../layers/UILayer";
2
- /** Small epsilon value for floating-point comparisons and minimum positive number validation. */
3
2
  export declare const EPSILON = 0.000001;
4
- /**
5
- * Interface for objects that belong to a UI layer.
6
- *
7
- * Elements implementing this interface are associated with a specific layer
8
- * for constraint solving and rendering management.
9
- */
3
+ /** Objects that belong to a UI layer */
10
4
  export interface UILayerElement {
11
- /** The UI layer that contains this element. */
5
+ /** The UI layer containing this element */
12
6
  readonly layer: UILayer;
13
7
  }
14
- /**
15
- * Interface for UI elements that have a position in 2D space.
16
- *
17
- * Point elements are characterized by x and y coordinates represented
18
- * as solver variable descriptors for constraint-based positioning.
19
- */
8
+ /** UI elements with position in 2D space */
20
9
  export interface UIPointElement {
21
- /** Solver variable descriptor for the x-coordinate. */
10
+ /** Solver variable for x coordinate */
22
11
  readonly xVariable: number;
23
- /** Solver variable descriptor for the y-coordinate. */
12
+ /** Solver variable for y coordinate */
24
13
  readonly yVariable: number;
25
- /** The x-coordinate of the element. */
14
+ /** X coordinate in world units */
26
15
  readonly x: number;
27
- /** The y-coordinate of the element. */
16
+ /** Y coordinate in world units */
28
17
  readonly y: number;
29
18
  }
30
- /**
31
- * Interface for UI elements that have both position and dimensions in 2D space.
32
- *
33
- * Plane elements extend point elements with width and height properties,
34
- * enabling rectangular area constraints and positioning.
35
- */
19
+ /** UI elements with position and dimensions */
36
20
  export interface UIPlaneElement extends UIPointElement {
37
- /** Solver variable descriptor for the width dimension. */
21
+ /** Solver variable for width */
38
22
  readonly wVariable: number;
39
- /** Solver variable descriptor for the height dimension. */
23
+ /** Solver variable for height */
40
24
  readonly hVariable: number;
41
- /** The width of the element. */
25
+ /** Width in world units */
42
26
  readonly width: number;
43
- /** The height of the element. */
27
+ /** Height in world units */
44
28
  readonly height: number;
45
29
  }
46
30
  /**
47
- * Type guard to check if an object implements the UILayerElement interface.
48
- *
49
- * @param obj - The object to check
50
- * @returns True if the object has a valid layer property, false otherwise
31
+ * Checks if object implements UILayerElement.
32
+ * @param obj Object to check
33
+ * @returns True if object has valid layer property
51
34
  */
52
35
  export declare function isUILayerElement(obj: unknown): obj is UILayerElement;
53
36
  /**
54
- * Type guard to check if an object implements the UIPointElement interface.
55
- *
56
- * @param obj - The object to check
57
- * @returns True if the object has valid xVariable and yVariable properties, false otherwise
37
+ * Checks if object implements UIPointElement.
38
+ * @param obj Object to check
39
+ * @returns True if object has valid position variables
58
40
  */
59
41
  export declare function isUIPointElement(obj: unknown): obj is UIPointElement;
60
42
  /**
61
- * Type guard to check if an object implements the UIPlaneElement interface.
62
- *
63
- * Note: This function only checks for width and height variables. Objects
64
- * should also satisfy UIPointElement requirements for complete validation.
65
- *
66
- * @param obj - The object to check
67
- * @returns True if the object has valid wVariable and hVariable properties, false otherwise
43
+ * Checks if object implements UIPlaneElement.
44
+ * @param obj Object to check
45
+ * @returns True if object has valid dimension variables
68
46
  */
69
47
  export declare function isUIPlaneElement(obj: unknown): obj is UIPlaneElement;
70
48
  /**
71
- * Validates that two objects are valid constraint subjects from the same layer.
72
- *
73
- * Ensures that both objects are either UILayer instances or UILayerElement instances,
74
- * that they are not both layers (which cannot be constrained to each other),
75
- * and that they belong to the same layer for constraint solving.
76
- *
77
- * @param a - The first constraint subject
78
- * @param b - The second constraint subject
79
- * @param subject - The name of the constraint for error messages
80
- * @returns The common layer that both subjects belong to
81
- * @throws Will throw an error if subjects are invalid or from different layers
49
+ * Validates constraint subjects are from same layer.
50
+ * @param a First constraint subject
51
+ * @param b Second constraint subject
52
+ * @param subject Constraint name for error messages
53
+ * @returns Common layer for both subjects
54
+ * @throws If subjects are invalid or from different layers
82
55
  */
83
56
  export declare function assertValidConstraintSubjects(a: unknown, b: unknown, subject: string): UILayer;
84
57
  /**
85
- * Validates that a value is a finite number within safe integer range.
86
- *
87
- * Checks that the value is finite (not NaN, Infinity, or -Infinity) and
88
- * within the safe integer range for reliable mathematical operations.
89
- *
90
- * @param value - The number to validate
91
- * @param subject - The name of the value for error messages
92
- * @throws Will throw an error if the value is not finite or exceeds safe range
58
+ * Validates value is finite number within safe range.
59
+ * @param value Number to validate
60
+ * @param subject Value name for error messages
61
+ * @throws If value is not finite or exceeds safe range
93
62
  */
94
63
  export declare function assertValidNumber(value: number, subject: string): void;
95
64
  /**
96
- * Validates that a value is a positive number above the epsilon threshold.
97
- *
98
- * First validates that the value is a finite number, then ensures it is
99
- * greater than or equal to EPSILON to avoid numerical precision issues
100
- * with very small positive values.
101
- *
102
- * @param value - The number to validate
103
- * @param subject - The name of the value for error messages
104
- * @throws Will throw an error if the value is invalid or not sufficiently positive
105
- * @see {@link assertValidNumber}
65
+ * Validates value is positive (>= EPSILON).
66
+ * @param value Number to validate
67
+ * @param subject Value name for error messages
68
+ * @throws If value is invalid or below EPSILON
106
69
  */
107
70
  export declare function assertValidPositiveNumber(value: number, subject: string): void;
108
71
  /**
109
- * Validates that a value is a non-negative number (including zero).
110
- *
111
- * First validates that the value is a finite number, then ensures it is
112
- * greater than or equal to zero. Unlike assertValidPositiveNumber, this
113
- * function allows zero as a valid value.
114
- *
115
- * @param value - The number to validate
116
- * @param subject - The name of the value for error messages
117
- * @throws Will throw an error if the value is invalid or negative
118
- * @see {@link assertValidNumber}
72
+ * Validates value is non-negative (>= 0).
73
+ * @param value Number to validate
74
+ * @param subject Value name for error messages
75
+ * @throws If value is invalid or negative
119
76
  */
120
77
  export declare function assertValidNonNegativeNumber(value: number, subject: string): void;
@@ -0,0 +1,7 @@
1
+ import type { Color } from "three";
2
+ import type { UIColor } from "./UIColor";
3
+ /** Color configuration as Three.js Color, hex number, hex string, or UIColor */
4
+ export type UIColorConfig = Color | number | string | UIColor;
5
+ /** Predefined color names */
6
+ export type UIColorName = "black" | "white" | "red" | "green" | "blue" | "yellow" | "cyan" | "magenta" | "gray" | "grey" | "silver" | "maroon" | "olive" | "lime" | "aqua" | "teal" | "navy" | "fuchsia" | "purple" | "orange" | "pink" | "brown" | "gold" | "violet" | "indigo" | "coral" | "salmon" | "khaki" | "plum" | "orchid" | "tan" | "beige" | "mint" | "lavender" | "crimson" | "azure" | "ivory" | "snow";
7
+ export declare const COLORS: Record<string, number | undefined>;
@@ -0,0 +1,197 @@
1
+ import { Color, Vector4 } from "three";
2
+ import type { UIColorConfig, UIColorName } from "./UIColor.Internal";
3
+ /** RGBA color with RGB, HSL, hex, and named color support */
4
+ export declare class UIColor {
5
+ private rInternal;
6
+ private gInternal;
7
+ private bInternal;
8
+ private aInternal;
9
+ private hInternal;
10
+ private sInternal;
11
+ private lInternal;
12
+ private dirtyInternal;
13
+ private rgbDirty;
14
+ private hslDirty;
15
+ constructor();
16
+ /**
17
+ * @param r - Red (0-1)
18
+ * @param g - Green (0-1)
19
+ * @param b - Blue (0-1)
20
+ * @param a - Alpha (0-1)
21
+ */
22
+ constructor(r: number, g: number, b: number, a?: number);
23
+ /**
24
+ * @param colorName - Named color
25
+ * @param a - Alpha (0-1)
26
+ */
27
+ constructor(colorName: UIColorName, a?: number);
28
+ /**
29
+ * @param threeColor - Three.js Color object
30
+ * @param a - Alpha (0-1)
31
+ */
32
+ constructor(threeColor: Color, a?: number);
33
+ /**
34
+ * @param hexRGB - Hex RGB value (e.g., 0xff0000)
35
+ * @param a - Alpha (0-1)
36
+ */
37
+ constructor(hexRGB: number, a?: number);
38
+ /**
39
+ * @param hexString - Hex string (e.g., "#ffffff" or "#ffffffff")
40
+ */
41
+ constructor(hexString?: string);
42
+ /**
43
+ * @param uiColor - UIColor object to copy from
44
+ */
45
+ constructor(uiColor?: UIColor);
46
+ /**
47
+ * @param uiColorConfig - UIColorConfig object
48
+ */
49
+ constructor(uiColorConfig?: UIColorConfig);
50
+ /** Black (0x000000) */
51
+ static get black(): UIColor;
52
+ /** White (0xffffff) */
53
+ static get white(): UIColor;
54
+ /** Red (0xff0000) */
55
+ static get red(): UIColor;
56
+ /** Green (0x008000) */
57
+ static get green(): UIColor;
58
+ /** Blue (0x0000ff) */
59
+ static get blue(): UIColor;
60
+ /** Yellow (0xffff00) */
61
+ static get yellow(): UIColor;
62
+ /** Cyan (0x00ffff) */
63
+ static get cyan(): UIColor;
64
+ /** Magenta (0xff00ff) */
65
+ static get magenta(): UIColor;
66
+ /** Gray (0x808080) */
67
+ static get gray(): UIColor;
68
+ /** Grey (0x808080) */
69
+ static get grey(): UIColor;
70
+ /** Silver (0xc0c0c0) */
71
+ static get silver(): UIColor;
72
+ /** Maroon (0x800000) */
73
+ static get maroon(): UIColor;
74
+ /** Olive (0x808000) */
75
+ static get olive(): UIColor;
76
+ /** Lime (0x00ff00) */
77
+ static get lime(): UIColor;
78
+ /** Aqua (0x00ffff) */
79
+ static get aqua(): UIColor;
80
+ /** Teal (0x008080) */
81
+ static get teal(): UIColor;
82
+ /** Navy (0x000080) */
83
+ static get navy(): UIColor;
84
+ /** Fuchsia (0xff00ff) */
85
+ static get fuchsia(): UIColor;
86
+ /** Purple (0x800080) */
87
+ static get purple(): UIColor;
88
+ /** Orange (0xffa500) */
89
+ static get orange(): UIColor;
90
+ /** Pink (0xffc0cb) */
91
+ static get pink(): UIColor;
92
+ /** Brown (0xa52a2a) */
93
+ static get brown(): UIColor;
94
+ /** Gold (0xffd700) */
95
+ static get gold(): UIColor;
96
+ /** Violet (0xee82ee) */
97
+ static get violet(): UIColor;
98
+ /** Indigo (0x4b0082) */
99
+ static get indigo(): UIColor;
100
+ /** Coral (0xff7f50) */
101
+ static get coral(): UIColor;
102
+ /** Salmon (0xfa8072) */
103
+ static get salmon(): UIColor;
104
+ /** Khaki (0xf0e68c) */
105
+ static get khaki(): UIColor;
106
+ /** Plum (0xdda0dd) */
107
+ static get plum(): UIColor;
108
+ /** Orchid (0xda70d6) */
109
+ static get orchid(): UIColor;
110
+ /** Tan (0xd2b48c) */
111
+ static get tan(): UIColor;
112
+ /** Beige (0xf5f5dc) */
113
+ static get beige(): UIColor;
114
+ /** Mint (0x98fb98) */
115
+ static get mint(): UIColor;
116
+ /** Lavender (0xe6e6fa) */
117
+ static get lavender(): UIColor;
118
+ /** Crimson (0xdc143c) */
119
+ static get crimson(): UIColor;
120
+ /** Azure (0xf0ffff) */
121
+ static get azure(): UIColor;
122
+ /** Ivory (0xfffff0) */
123
+ static get ivory(): UIColor;
124
+ /** Snow (0xfffafa) */
125
+ static get snow(): UIColor;
126
+ /** Red component (0 to 1) */
127
+ get r(): number;
128
+ /** Green component (0 to 1) */
129
+ get g(): number;
130
+ /** Blue component (0 to 1) */
131
+ get b(): number;
132
+ /** Alpha component (0 to 1) */
133
+ get a(): number;
134
+ /** Hue component (0 to 360) */
135
+ get hue(): number;
136
+ /** Saturation component (0 to 1) */
137
+ get saturation(): number;
138
+ /** Lightness component (0 to 1) */
139
+ get lightness(): number;
140
+ /** Red component (0 to 1) */
141
+ set r(value: number);
142
+ /** Green component (0 to 1) */
143
+ set g(value: number);
144
+ /** Blue component (0 to 1) */
145
+ set b(value: number);
146
+ /** Alpha component (0 to 1) */
147
+ set a(value: number);
148
+ /** Hue component (0 to 360) */
149
+ set hue(value: number);
150
+ /** Saturation component (0 to 1) */
151
+ set saturation(value: number);
152
+ /** Lightness component (0 to 1) */
153
+ set lightness(value: number);
154
+ /** Sets RGB(A) components */
155
+ set(r: number, g: number, b: number, a?: number): this;
156
+ /** Returns RGBA as 32-bit hex (RRGGBBAA) */
157
+ getHexRGBA(): number;
158
+ /** Returns RGB as 24-bit hex (RRGGBB) */
159
+ getHexRGB(): number;
160
+ /** Returns RGB as hex string ("#ffffff") */
161
+ getHexStringRGB(): string;
162
+ /** Returns RGBA as hex string ("#ffffffff") */
163
+ getHexStringRGBA(): string;
164
+ /** Sets from 32-bit hex RGBA (RRGGBBAA) */
165
+ setHexRGBA(hex: number): this;
166
+ /** Sets from 24-bit hex RGB (RRGGBB) */
167
+ setHexRGB(hex: number, a?: number): this;
168
+ /**
169
+ * Sets from hex string.
170
+ *
171
+ * @param hexString - Format: "#ffffff" or "#ffffffff"
172
+ * @throws If format invalid
173
+ */
174
+ setHexString(hexString: string): this;
175
+ /** Sets from HSL values */
176
+ setHSL(h: number, s: number, l: number, a?: number): this;
177
+ /**
178
+ * Sets from predefined name.
179
+ *
180
+ * @throws If color name unknown
181
+ */
182
+ setColorName(colorName: UIColorName, a?: number): this;
183
+ /** Sets from linear (GLSL) color space */
184
+ setGLSLColor(r: number, g: number, b: number, a?: number): this;
185
+ /** Sets from Three.js Color */
186
+ setThreeColor(threeColor: Color, a?: number): this;
187
+ /** Returns CSS color string ("rgba(255, 0, 0, 1)") */
188
+ toCSSColor(): string;
189
+ /** Converts to linear (GLSL) color space */
190
+ toGLSLColor(result?: Vector4): Vector4;
191
+ /** Converts to Three.js Color (without alpha) */
192
+ toThreeColor(result?: Color): Color;
193
+ /** Copies from another color */
194
+ copy(color: UIColor | Color): this;
195
+ /** Returns copy of this color */
196
+ clone(): UIColor;
197
+ }
@@ -0,0 +1,18 @@
1
+ import { Matrix4 } from "three";
2
+ import { UIMicroAnchorMode } from "../miscellaneous/micro/UIMicro.Internal";
3
+ /**
4
+ * Computes element transform matrix.
5
+ * @returns Transform matrix (reused, do not store reference)
6
+ */
7
+ export declare function computeTransformMatrix(x: number, y: number, width: number, height: number, zIndex: number, microX: number, microY: number, microAnchorX: number, microAnchorY: number, microScaleX: number, microScaleY: number, microRotation: number, microAnchorMode: UIMicroAnchorMode): Matrix4;
8
+ /**
9
+ * Computes transform matrix for trimmed sprite.
10
+ * @param width Source width including trimmed areas
11
+ * @param height Source height including trimmed areas
12
+ * @param trimLeft Pixels trimmed from left
13
+ * @param trimRight Pixels trimmed from right
14
+ * @param trimTop Pixels trimmed from top
15
+ * @param trimBottom Pixels trimmed from bottom
16
+ * @returns Transform matrix (reused, do not store reference)
17
+ */
18
+ export declare function computeTrimmedTransformMatrix(x: number, y: number, width: number, height: number, zIndex: number, microX: number, microY: number, microAnchorX: number, microAnchorY: number, microScaleX: number, microScaleY: number, microRotation: number, microAnchorMode: UIMicroAnchorMode, trimLeft: number, trimRight: number, trimTop: number, trimBottom: number): Matrix4;
@@ -0,0 +1,10 @@
1
+ import { InstancedBufferAttribute, InstancedBufferGeometry, ShaderMaterial } from "three";
2
+ import { UITransparencyMode } from "../UITransparencyMode";
3
+ import type { UIPropertyType } from "./shared";
4
+ export declare const INSTANCED_PLANE_GEOMETRY: InstancedBufferGeometry;
5
+ export declare const CAPACITY_STEP = 4;
6
+ export declare function writePropertyToArray(value: UIPropertyType, array: Float32Array, offset: number): void;
7
+ export declare function writeInstanceDefaults(visibilityArray: Float32Array, transformArray: Float32Array, index: number): void;
8
+ export declare function buildEmptyInstancedBufferAttribute(value: UIPropertyType, capacity: number): InstancedBufferAttribute;
9
+ export declare function buildMaterial(source: string, uniformProperties: Record<string, UIPropertyType>, varyingProperties: Record<string, UIPropertyType>, transparency: UITransparencyMode): ShaderMaterial;
10
+ export declare function reconstructValue(referenceValue: UIPropertyType, array: Float32Array, offset: number): UIPropertyType;