laymur 0.10.2 → 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 +4180 -4006
  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,54 +0,0 @@
1
- import type { SkeletonData } from "@esotericsoftware/spine-threejs";
2
- import { SkeletonMesh } from "@esotericsoftware/spine-threejs";
3
- import type { WebGLRenderer } from "three";
4
- import type { UILayer } from "../layers/UILayer";
5
- import type { UIMode } from "../miscellaneous/UIMode";
6
- import { UIElement } from "./UIElement";
7
- /**
8
- * Configuration options for creating a UISpine element.
9
- */
10
- export interface UISpineOptions {
11
- /** X position of the element */
12
- x: number;
13
- /** Y position of the element */
14
- y: number;
15
- /** Width of the element */
16
- width: number;
17
- /** Height of the element */
18
- height: number;
19
- /** Default UIMode */
20
- mode: UIMode;
21
- }
22
- /**
23
- * UI element for displaying Spine skeletal animations.
24
- *
25
- * UISpine is a concrete implementation of UIElement that renders Spine
26
- * animations. It exposes the underlying Spine API directly for full control
27
- * over animations, bones, slots, and other Spine features.
28
- *
29
- * @see {@link UIElement} - Base class providing UI element functionality
30
- * @see {@link AnimationState} - Spine animation state for controlling playback
31
- * @see {@link Skeleton} - Spine skeleton for bone manipulation
32
- */
33
- export declare class UISpine extends UIElement {
34
- /** Internal storage for the Spine SkeletonMesh (Three.js Object3D) */
35
- private readonly skeletonMeshInternal;
36
- /**
37
- * Creates a new UISpine instance.
38
- *
39
- * @param layer - The UI layer that contains this spine animation
40
- * @param skeletonData - The Spine skeleton data loaded from .json/.skel
41
- * @param options - Configuration options for the spine element
42
- */
43
- constructor(layer: UILayer, skeletonData: SkeletonData, options?: Partial<UISpineOptions>);
44
- /**
45
- * Gets the Spine SkeletonMesh (Three.js Object3D).
46
- * @returns The SkeletonMesh instance
47
- */
48
- get skeletonMesh(): SkeletonMesh;
49
- /**
50
- * Destroys the UI spine element by cleaning up color event listeners and all associated resources.
51
- */
52
- destroy(): void;
53
- protected onWillRender(renderer: WebGLRenderer, deltaTime: number): void;
54
- }
@@ -1,149 +0,0 @@
1
- import type { WebGLRenderer } from "three";
2
- import { type UILayer } from "../layers/UILayer";
3
- import type { UITextContent } from "../miscellaneous/textInterfaces";
4
- import { UIColor } from "../miscellaneous/UIColor";
5
- import type { UIMode } from "../miscellaneous/UIMode";
6
- import { type UIPadding } from "../miscellaneous/UITextPadding";
7
- import { type UITextStyle } from "../miscellaneous/UITextStyle";
8
- import { UIElement } from "./UIElement";
9
- /**
10
- * Configuration options for UIText element creation.
11
- */
12
- export interface UITextOptions {
13
- /** X-coordinate of the text element. */
14
- x: number;
15
- /** Y-coordinate of the text element. */
16
- y: number;
17
- /** Color tint applied to the text. */
18
- color: UIColor;
19
- /** Maximum width in pixels before text wrapping occurs. */
20
- maxWidth: number;
21
- /** Padding configuration for text content. */
22
- padding: Partial<UIPadding>;
23
- /** Common style properties applied to all text content. */
24
- commonStyle: Partial<UITextStyle>;
25
- /** Default UIMode */
26
- mode: UIMode;
27
- }
28
- /**
29
- * UI element for rendering dynamic text with canvas-based rendering.
30
- *
31
- * UIText is a concrete implementation of UIElement that renders text content
32
- * using HTML5 Canvas and displays it as a texture. It supports rich text
33
- * formatting, automatic text wrapping, padding, and dynamic resizing based
34
- * on content. The text is rendered to a canvas texture which is then applied
35
- * to a Three.js mesh for display in the 3D scene.
36
- *
37
- * @see {@link UIElement} - Base class providing UI element functionality
38
- * @see {@link UITextContent} - Text content structure
39
- * @see {@link UITextStyle} - Text styling options
40
- * @see {@link UIPadding} - Padding configuration
41
- */
42
- export declare class UIText extends UIElement {
43
- /** The HTML canvas element used for text rendering. */
44
- private readonly canvas;
45
- /** The 2D rendering context for drawing text on the canvas. */
46
- private readonly context;
47
- /** The canvas texture containing the rendered text. */
48
- private texture;
49
- /** Internal storage for the color tint. */
50
- private readonly colorInternal;
51
- /** Internal storage for the current text content. */
52
- private contentInternal;
53
- /** Internal storage for the maximum width before text wrapping. */
54
- private maxWidthInternal;
55
- /** Internal storage for the current padding configuration. */
56
- private paddingInternal;
57
- /** Internal storage for the common text style properties. */
58
- private commonStyleInternal;
59
- /** Target aspect ratio for the text element based on content. */
60
- private targetAspectRatio;
61
- /**
62
- * Creates a new UIText instance with dynamic text rendering.
63
- *
64
- * The text element will automatically size itself based on the content
65
- * and specified options. A canvas is created for rendering the text,
66
- * which is then used as a texture for the 3D mesh.
67
- *
68
- * @param layer - The UI layer that contains this text element
69
- * @param content - The text content to display
70
- * @param options - Configuration options for text rendering
71
- * @throws Will throw an error if canvas context creation fails
72
- */
73
- constructor(layer: UILayer, content: UITextContent, options?: Partial<UITextOptions>);
74
- /**
75
- * Gets the current color tint applied to the text.
76
- * @returns The UIColor instance
77
- */
78
- get color(): UIColor;
79
- /**
80
- * Gets the current text content being displayed.
81
- * @returns The current text content structure
82
- */
83
- get content(): UITextContent;
84
- /**
85
- * Gets the maximum width before text wrapping occurs.
86
- * @returns The maximum width in pixels
87
- */
88
- get maxWidth(): number;
89
- /**
90
- * Gets the current padding configuration.
91
- * @returns The padding configuration for all sides
92
- */
93
- get padding(): UIPadding;
94
- /**
95
- * Gets the common style properties applied to the text.
96
- * @returns The partial text style configuration
97
- */
98
- get commonStyle(): Partial<UITextStyle>;
99
- /**
100
- * Sets the color tint applied to the text.
101
- * @param value - The UIColor instance
102
- */
103
- set color(value: UIColor);
104
- /**
105
- * Sets new text content and triggers a rebuild.
106
- * @param value - The new text content structure
107
- */
108
- set content(value: UITextContent);
109
- /**
110
- * Sets the maximum width before text wrapping and triggers a rebuild.
111
- * @param value - The new maximum width in pixels
112
- */
113
- set maxWidth(value: number);
114
- /**
115
- * Sets new padding configuration and triggers a rebuild.
116
- * @param value - The new padding configuration
117
- */
118
- set padding(value: UIPadding);
119
- /**
120
- * Sets new common style properties and triggers a rebuild.
121
- * @param value - The new partial text style configuration
122
- */
123
- set commonStyle(value: Partial<UITextStyle>);
124
- /**
125
- * Destroys the text element by cleaning up all associated resources.
126
- *
127
- * This method disposes of the texture resources and calls the parent destroy method
128
- * to clean up the underlying UI element. After calling this method,
129
- * the text element should not be used anymore.
130
- */
131
- destroy(): void;
132
- /**
133
- * Called before each render frame to maintain proper text aspect ratio.
134
- * Adjusts the height based on the target aspect ratio calculated from text content.
135
- * @param renderer - The WebGL renderer
136
- * @param deltaTime - Time since last frame in seconds
137
- */
138
- protected onWillRender(renderer: WebGLRenderer, deltaTime: number): void;
139
- /**
140
- * Rebuilds the text canvas and texture based on current content and settings.
141
- *
142
- * This method calculates the text layout, resizes the canvas to fit the content
143
- * with padding, renders the text lines to the canvas, and updates the texture.
144
- * It also calculates and sets the target aspect ratio for proper display.
145
- */
146
- private rebuildText;
147
- /** Event handler for when the color changes */
148
- private readonly onColorChange;
149
- }
@@ -1,245 +0,0 @@
1
- import { Eventail } from "eventail";
2
- import { Color, Vector4 } from "three";
3
- /**
4
- * Predefined color names supported by UIColor.
5
- */
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
- /**
8
- * Events emitted by UIColor.
9
- */
10
- export declare enum UIColorEvent {
11
- /** Emitted when color components change. */
12
- CHANGE = "change"
13
- }
14
- /**
15
- * Event-based RGBA color with support for RGB, HSL, hex, and named colors.
16
- * Color components are stored as normalized values (0-1).
17
- */
18
- export declare class UIColor extends Eventail {
19
- private rInternal;
20
- private gInternal;
21
- private bInternal;
22
- private aInternal;
23
- private hInternal;
24
- private sInternal;
25
- private lInternal;
26
- private rgbDirty;
27
- private hslDirty;
28
- constructor();
29
- /**
30
- * @param r - Red (0-1)
31
- * @param g - Green (0-1)
32
- * @param b - Blue (0-1)
33
- * @param a - Alpha (0-1)
34
- */
35
- constructor(r: number, g: number, b: number, a?: number);
36
- /**
37
- * @param colorName - Named color
38
- * @param a - Alpha (0-1)
39
- */
40
- constructor(colorName: UIColorName, a?: number);
41
- /**
42
- * @param threeColor - Three.js Color object
43
- * @param a - Alpha (0-1)
44
- */
45
- constructor(threeColor: Color, a?: number);
46
- /**
47
- * @param hexRGB - Hex RGB value (e.g., 0xFF0000)
48
- * @param a - Alpha (0-1)
49
- */
50
- constructor(hexRGB: number, a?: number);
51
- /** Creates black color (0x000000). */
52
- static get black(): UIColor;
53
- /** Creates white color (0xFFFFFF). */
54
- static get white(): UIColor;
55
- /** Creates red color (0xFF0000). */
56
- static get red(): UIColor;
57
- /** Creates green color (0x008000). */
58
- static get green(): UIColor;
59
- /** Creates blue color (0x0000FF). */
60
- static get blue(): UIColor;
61
- /** Creates yellow color (0xFFFF00). */
62
- static get yellow(): UIColor;
63
- /** Creates cyan color (0x00FFFF). */
64
- static get cyan(): UIColor;
65
- /** Creates magenta color (0xFF00FF). */
66
- static get magenta(): UIColor;
67
- /** Creates gray color (0x808080). */
68
- static get gray(): UIColor;
69
- /** Creates grey color (0x808080). */
70
- static get grey(): UIColor;
71
- /** Creates silver color (0xC0C0C0). */
72
- static get silver(): UIColor;
73
- /** Creates maroon color (0x800000). */
74
- static get maroon(): UIColor;
75
- /** Creates olive color (0x808000). */
76
- static get olive(): UIColor;
77
- /** Creates lime color (0x00FF00). */
78
- static get lime(): UIColor;
79
- /** Creates aqua color (0x00FFFF). */
80
- static get aqua(): UIColor;
81
- /** Creates teal color (0x008080). */
82
- static get teal(): UIColor;
83
- /** Creates navy color (0x000080). */
84
- static get navy(): UIColor;
85
- /** Creates fuchsia color (0xFF00FF). */
86
- static get fuchsia(): UIColor;
87
- /** Creates purple color (0x800080). */
88
- static get purple(): UIColor;
89
- /** Creates orange color (0xFFA500). */
90
- static get orange(): UIColor;
91
- /** Creates pink color (0xFFC0CB). */
92
- static get pink(): UIColor;
93
- /** Creates brown color (0xA52A2A). */
94
- static get brown(): UIColor;
95
- /** Creates gold color (0xFFD700). */
96
- static get gold(): UIColor;
97
- /** Creates violet color (0xEE82EE). */
98
- static get violet(): UIColor;
99
- /** Creates indigo color (0x4B0082). */
100
- static get indigo(): UIColor;
101
- /** Creates coral color (0xFF7F50). */
102
- static get coral(): UIColor;
103
- /** Creates salmon color (0xFA8072). */
104
- static get salmon(): UIColor;
105
- /** Creates khaki color (0xF0E68C). */
106
- static get khaki(): UIColor;
107
- /** Creates plum color (0xDDA0DD). */
108
- static get plum(): UIColor;
109
- /** Creates orchid color (0xDA70D6). */
110
- static get orchid(): UIColor;
111
- /** Creates tan color (0xD2B48C). */
112
- static get tan(): UIColor;
113
- /** Creates beige color (0xF5F5DC). */
114
- static get beige(): UIColor;
115
- /** Creates mint color (0x98FB98). */
116
- static get mint(): UIColor;
117
- /** Creates lavender color (0xE6E6FA). */
118
- static get lavender(): UIColor;
119
- /** Creates crimson color (0xDC143C). */
120
- static get crimson(): UIColor;
121
- /** Creates azure color (0xF0FFFF). */
122
- static get azure(): UIColor;
123
- /** Creates ivory color (0xFFFFF0). */
124
- static get ivory(): UIColor;
125
- /** Creates snow color (0xFFFAFA). */
126
- static get snow(): UIColor;
127
- /** Red component (0-1). */
128
- get r(): number;
129
- /** Green component (0-1). */
130
- get g(): number;
131
- /** Blue component (0-1). */
132
- get b(): number;
133
- /** Alpha component (0-1). */
134
- get a(): number;
135
- /** Hue component (0-360). */
136
- get hue(): number;
137
- /** Saturation component (0-1). */
138
- get saturation(): number;
139
- /** Lightness component (0-1). */
140
- get lightness(): number;
141
- set r(value: number);
142
- set g(value: number);
143
- set b(value: number);
144
- set a(value: number);
145
- set hue(value: number);
146
- set saturation(value: number);
147
- set lightness(value: number);
148
- /**
149
- * Sets all color components.
150
- *
151
- * @param r - Red (0-1)
152
- * @param g - Green (0-1)
153
- * @param b - Blue (0-1)
154
- * @param a - Alpha (0-1)
155
- * @returns This instance
156
- */
157
- set(r: number, g: number, b: number, a?: number): this;
158
- /**
159
- * Returns 32-bit hex RGBA value (alpha in MSB).
160
- */
161
- getHexRGBA(): number;
162
- /**
163
- * Returns 24-bit hex RGB value.
164
- */
165
- getHexRGB(): number;
166
- /**
167
- * Sets color from 32-bit hex RGBA value.
168
- *
169
- * @param hex - Hex RGBA (alpha in MSB)
170
- * @returns This instance
171
- */
172
- setHexRGBA(hex: number): this;
173
- /**
174
- * Sets color from 24-bit hex RGB value.
175
- *
176
- * @param hex - Hex RGB (e.g., 0xFF0000)
177
- * @param a - Alpha (0-1)
178
- * @returns This instance
179
- */
180
- setHexRGB(hex: number, a?: number): this;
181
- /**
182
- * Sets color from HSL values.
183
- *
184
- * @param h - Hue (0-360)
185
- * @param s - Saturation (0-1)
186
- * @param l - Lightness (0-1)
187
- * @param a - Alpha (0-1)
188
- * @returns This instance
189
- */
190
- setHSL(h: number, s: number, l: number, a?: number): this;
191
- /**
192
- * Sets color from predefined name.
193
- *
194
- * @param colorName - Color name
195
- * @param a - Alpha (0-1)
196
- * @returns This instance
197
- * @throws Error if color name is unknown
198
- */
199
- setColorName(colorName: UIColorName, a?: number): this;
200
- /**
201
- * Sets color from Three.js Color object.
202
- *
203
- * @param threeColor - Three.js Color object
204
- * @param a - Alpha (0-1)
205
- * @returns This instance
206
- */
207
- setThreeColor(threeColor: Color, a?: number): this;
208
- /**
209
- * Returns CSS rgba() string.
210
- */
211
- toCSSColor(): string;
212
- /**
213
- * Converts color to linear color space for GLSL.
214
- *
215
- * @param result - Vector4 to store the result
216
- * @returns Vector4 with linear RGB (0-1) and alpha
217
- */
218
- toGLSLColor(result?: Vector4): Vector4;
219
- /**
220
- * Converts color to Three.js Color object (without alpha).
221
- *
222
- * @param result - Color object to store the result
223
- * @returns Color with RGB values
224
- */
225
- toThreeColor(result?: Color): Color;
226
- /**
227
- * Copies values from another color.
228
- *
229
- * @param color - UIColor or Three.js Color
230
- * @returns This instance
231
- */
232
- copy(color: UIColor | Color): this;
233
- /**
234
- * Creates a copy of this color.
235
- */
236
- clone(): UIColor;
237
- /**
238
- * Updates RGB values from HSL if needed.
239
- */
240
- private ensureRGBUpdatedFromHSL;
241
- /**
242
- * Updates HSL values from RGB if needed.
243
- */
244
- private ensureHSLUpdatedFromRGB;
245
- }
@@ -1,32 +0,0 @@
1
- import { InstancedBufferAttribute, Matrix2, Matrix3, Matrix4, Mesh, Texture, Vector2, Vector3, Vector4 } from "three";
2
- import { UIColor } from "../miscellaneous/UIColor";
3
- import { UITransparencyMode } from "./UITransparencyMode";
4
- export type UIPropertyType = Texture | UIColor | Vector2 | Vector3 | Vector4 | Matrix2 | Matrix3 | Matrix4 | number;
5
- export type UIPropertyTypeName = "Texture" | "UIColor" | "Vector2" | "Vector3" | "Vector4" | "Matrix2" | "Matrix3" | "Matrix4" | "number";
6
- interface Descriptor {
7
- firstIndex: number;
8
- count: number;
9
- }
10
- export declare class UIGenericInstancedPlane extends Mesh {
11
- protected handlerToDescriptor: Map<number, Descriptor>;
12
- protected lastHandler: number;
13
- protected capacity: number;
14
- protected propertyBuffers: Map<string, InstancedBufferAttribute>;
15
- private readonly instancedGeometry;
16
- private readonly shaderMaterial;
17
- constructor(source: string, layout: Record<string, UIPropertyTypeName>, transparency?: UITransparencyMode, capacity?: number);
18
- createInstances(count: number): number;
19
- destroyInstances(handler: number): void;
20
- updateProperties(handler: number, offset: number, instancesProperties: Record<string, UIPropertyType>[]): void;
21
- updateTransforms(handler: number, offset: number, instancesTransforms: Matrix4[]): void;
22
- updateUVTransforms(handler: number, offset: number, uvTransforms: Matrix3[]): void;
23
- updateVisibility(handler: number, offset: number, instancesVisibility: boolean[]): void;
24
- destroy(): void;
25
- private resolveDescriptor;
26
- private resolveBufferAttribute;
27
- private resolveUniform;
28
- private resizeGeometry;
29
- private copyRangeData;
30
- private shiftRangesDown;
31
- }
32
- export {};
@@ -1,148 +0,0 @@
1
- import { Eventail } from "eventail";
2
- import { UIMicroAnchorMode } from "./UIMicroAnchorMode";
3
- export declare enum UIMicroEvent {
4
- CHANGE = 0
5
- }
6
- /**
7
- * Micro-transformation system for non-constraint based UI element adjustments.
8
- *
9
- * UIMicro provides a lightweight transformation system that operates independently
10
- * of the constraint solver. It manages position offsets, anchor points, scaling,
11
- * and rotation transformations that can be applied to UI elements for animations,
12
- * visual effects, or fine-tuned positioning without affecting the constraint-based
13
- * layout system.
14
- *
15
- * All transformations are tracked with change detection to optimize rendering
16
- * performance by only recalculating when properties have actually changed.
17
- *
18
- * @see {@link UIElement} - Elements that use micro transformations
19
- */
20
- export declare class UIMicro extends Eventail {
21
- /** Internal storage for x-coordinate offset. */
22
- private xInternal;
23
- /** Internal storage for y-coordinate offset. */
24
- private yInternal;
25
- /** Internal storage for x-axis anchor point. */
26
- private anchorXInternal;
27
- /** Internal storage for y-axis anchor point. */
28
- private anchorYInternal;
29
- /** Internal storage for x-axis scale factor. */
30
- private scaleXInternal;
31
- /** Internal storage for y-axis scale factor. */
32
- private scaleYInternal;
33
- /** Internal storage for rotation in radians. */
34
- private rotationInternal;
35
- /** Internal storage for anchor mode determining which transformations are applied around the anchor point. */
36
- private anchorModeInternal;
37
- /** Flag indicating if any transformation properties have changed. */
38
- private recalculationRequired;
39
- /**
40
- * Gets the x-coordinate offset for micro positioning.
41
- * @returns The x-offset value
42
- */
43
- get x(): number;
44
- /**
45
- * Gets the y-coordinate offset for micro positioning.
46
- * @returns The y-offset value
47
- */
48
- get y(): number;
49
- /**
50
- * Gets the x-axis anchor point for transformations.
51
- * @returns The anchor point (0.0 = left, 0.5 = center, 1.0 = right)
52
- */
53
- get anchorX(): number;
54
- /**
55
- * Gets the y-axis anchor point for transformations.
56
- * @returns The anchor point (0.0 = top, 0.5 = center, 1.0 = bottom)
57
- */
58
- get anchorY(): number;
59
- /**
60
- * Gets the x-axis scale factor.
61
- * @returns The scale factor (1.0 = normal size)
62
- */
63
- get scaleX(): number;
64
- /**
65
- * Gets the y-axis scale factor.
66
- * @returns The scale factor (1.0 = normal size)
67
- */
68
- get scaleY(): number;
69
- /**
70
- * Gets the uniform scale factor (maximum of scaleX and scaleY).
71
- * @returns The larger of the two scale factors
72
- */
73
- get size(): number;
74
- /**
75
- * Gets the rotation angle in degrees.
76
- * @returns The rotation angle in degrees
77
- */
78
- get angle(): number;
79
- /**
80
- * Gets the current anchor mode determining which transformations are applied around the anchor point.
81
- * @returns The anchor mode (ROTATION_SCALE or POSITION_ROTATION_SCALE)
82
- */
83
- get anchorMode(): UIMicroAnchorMode;
84
- /**
85
- * Gets the rotation angle in radians.
86
- * @returns The rotation angle in radians
87
- */
88
- get rotation(): number;
89
- /**
90
- * Sets the x-coordinate offset for micro positioning.
91
- * @param value - The new x-offset value
92
- */
93
- set x(value: number);
94
- /**
95
- * Sets the y-coordinate offset for micro positioning.
96
- * @param value - The new y-offset value
97
- */
98
- set y(value: number);
99
- /**
100
- * Sets the x-axis anchor point for transformations.
101
- * @param value - The anchor point (0.0 = left, 0.5 = center, 1.0 = right)
102
- */
103
- set anchorX(value: number);
104
- /**
105
- * Sets the y-axis anchor point for transformations.
106
- * @param value - The anchor point (0.0 = top, 0.5 = center, 1.0 = bottom)
107
- */
108
- set anchorY(value: number);
109
- /**
110
- * Sets the x-axis scale factor.
111
- * @param value - The scale factor (1.0 = normal size)
112
- */
113
- set scaleX(value: number);
114
- /**
115
- * Sets the y-axis scale factor.
116
- * @param value - The scale factor (1.0 = normal size)
117
- */
118
- set scaleY(value: number);
119
- /**
120
- * Sets both scale factors to the same value for uniform scaling.
121
- * @param value - The uniform scale factor (1.0 = normal size)
122
- */
123
- set size(value: number);
124
- /**
125
- * Sets the rotation angle in degrees.
126
- * @param value - The rotation angle in degrees
127
- */
128
- set angle(value: number);
129
- /**
130
- * Sets the rotation angle in radians.
131
- * @param value - The rotation angle in radians
132
- */
133
- set rotation(value: number);
134
- /**
135
- * Sets the anchor mode determining which transformations are applied around the anchor point.
136
- * @param value - The anchor mode (ROTATION_SCALE or POSITION_ROTATION_SCALE)
137
- */
138
- set anchorMode(value: UIMicroAnchorMode);
139
- /**
140
- * Resets all transformation properties to their default values.
141
- *
142
- * This method restores position (0,0), anchor (0,0), scale (1,1),
143
- * and rotation (0) to their initial states. Only triggers recalculation
144
- * if any values actually change.
145
- */
146
- reset(): void;
147
- copy(value: UIMicro): void;
148
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * Defines the anchor mode for UIMicro, determining which transformations are applied around the anchor point.
3
- */
4
- export declare enum UIMicroAnchorMode {
5
- /** Rotation and scaling are applied around the anchor point */
6
- ROTATION_SCALE = 0,
7
- /** Position, rotation, and scaling transformations are all applied around the anchor point */
8
- POSITION_ROTATION_SCALE = 1
9
- }
@@ -1,21 +0,0 @@
1
- export type UINineSliceBorders = {
2
- left: number;
3
- right: number;
4
- top: number;
5
- bottom: number;
6
- } | {
7
- horizontal: number;
8
- vertical: number;
9
- } | number;
10
- /**
11
- * Resolves various nine-slice border inputs into a normalized border object.
12
- *
13
- * @param value - The border value to resolve (can be number, partial object, or full object)
14
- * @returns Normalized border object with left, right, top, bottom properties
15
- */
16
- export declare function resolveNineSliceBorders(value: unknown): {
17
- l: number;
18
- r: number;
19
- t: number;
20
- b: number;
21
- };
@@ -1,21 +0,0 @@
1
- import { Eventail } from "eventail";
2
- export declare enum UIResizePolicyEvent {
3
- CHANGE = 0
4
- }
5
- /**
6
- * Base class for UI resize policies.
7
- *
8
- * Calculates scale factors based on viewport dimensions. Different policies
9
- * implement different scaling strategies.
10
- */
11
- export declare abstract class UIResizePolicy extends Eventail {
12
- /**
13
- * Calculates scale factor for given dimensions.
14
- *
15
- * @param width - Viewport width in pixels
16
- * @param height - Viewport height in pixels
17
- * @returns Scale factor to apply
18
- * @protected
19
- */
20
- protected abstract calculateScaleInternal(width: number, height: number): number;
21
- }