laymur 0.6.1 → 0.8.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.
- package/dist/index.js +174 -176
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/layers/UIFullscreenLayer.d.ts +11 -2
- package/dist/miscellaneous/UIColor.d.ts +63 -109
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Vector2, Vector3, type Camera, type WebGLRenderer } from "three";
|
|
2
2
|
import { UIMode } from "../miscellaneous/UIMode";
|
|
3
3
|
import type { UIResizePolicy } from "../miscellaneous/UIResizePolicy";
|
|
4
4
|
import { UILayer } from "./UILayer";
|
|
@@ -43,7 +43,16 @@ export declare class UIFullscreenLayer extends UILayer {
|
|
|
43
43
|
* @param camera - Camera for projection
|
|
44
44
|
* @returns 2D position in layer space
|
|
45
45
|
*/
|
|
46
|
-
projectWorldPosition(position: Vector3, camera: Camera):
|
|
46
|
+
projectWorldPosition(position: Vector3, camera: Camera): Vector2;
|
|
47
|
+
/**
|
|
48
|
+
* Projects 2D layer position to 3D world coordinates.
|
|
49
|
+
*
|
|
50
|
+
* @param position - 2D position in layer space
|
|
51
|
+
* @param camera - Camera for unprojection
|
|
52
|
+
* @param z - Z depth in camera space (defaults to 1)
|
|
53
|
+
* @returns 3D position in world space
|
|
54
|
+
*/
|
|
55
|
+
projectLayerPosition(position: Vector2, camera: Camera, z?: number): Vector3;
|
|
47
56
|
/**
|
|
48
57
|
* Handles window resize. Updates layer dimensions according to resize policy.
|
|
49
58
|
*/
|
|
@@ -1,126 +1,77 @@
|
|
|
1
1
|
import { Eventail } from "eventail";
|
|
2
2
|
import type { Color } from "three";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
* These names correspond to the predefined colors in the COLOR_NAMES database.
|
|
4
|
+
* Predefined color names supported by UIColor.
|
|
6
5
|
*/
|
|
7
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";
|
|
8
7
|
/**
|
|
9
|
-
* Events
|
|
8
|
+
* Events emitted by UIColor.
|
|
10
9
|
*/
|
|
11
10
|
export declare enum UIColorEvent {
|
|
12
|
-
/** Emitted when
|
|
11
|
+
/** Emitted when color components change. */
|
|
13
12
|
CHANGE = "change"
|
|
14
13
|
}
|
|
15
14
|
/**
|
|
16
|
-
* Event-based RGBA color
|
|
17
|
-
*
|
|
18
|
-
* UIColor provides a comprehensive color management system with support for RGB, HSL,
|
|
19
|
-
* hexadecimal formats, and named colors. It extends Eventail to emit change events
|
|
20
|
-
* when color properties are modified, enabling reactive color updates throughout
|
|
21
|
-
* the UI system.
|
|
22
|
-
*
|
|
23
|
-
* Color components are stored as normalized values (0-1) for precision and
|
|
24
|
-
* compatibility with graphics APIs.
|
|
25
|
-
*
|
|
26
|
-
* @see {@link UIColorEvent} - Events emitted by color instances
|
|
27
|
-
* @see {@link UIColorName} - Supported named color values
|
|
15
|
+
* Event-based RGBA color with support for RGB, HSL, hex, and named colors.
|
|
16
|
+
* Color components are stored as normalized values (0-1).
|
|
28
17
|
*/
|
|
29
18
|
export declare class UIColor extends Eventail {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
/** Internal storage for the blue component (0-1). */
|
|
35
|
-
bInternal: number;
|
|
36
|
-
/** Internal storage for the alpha component (0-1). */
|
|
37
|
-
aInternal: number;
|
|
38
|
-
/**
|
|
39
|
-
* Creates a new UIColor instance with white color (1, 1, 1, 1).
|
|
40
|
-
*/
|
|
19
|
+
private rInternal;
|
|
20
|
+
private gInternal;
|
|
21
|
+
private bInternal;
|
|
22
|
+
private aInternal;
|
|
41
23
|
constructor();
|
|
42
24
|
/**
|
|
43
|
-
*
|
|
44
|
-
* @param
|
|
45
|
-
* @param a - Optional alpha value (0-1), defaults to 1
|
|
25
|
+
* @param colorName - Named color
|
|
26
|
+
* @param a - Alpha (0-1)
|
|
46
27
|
*/
|
|
47
28
|
constructor(colorName: UIColorName, a?: number);
|
|
48
29
|
/**
|
|
49
|
-
*
|
|
50
|
-
* @param
|
|
51
|
-
* @param
|
|
52
|
-
* @param
|
|
53
|
-
* @param a - Optional alpha value (0-1), defaults to 1
|
|
30
|
+
* @param r - Red (0-1)
|
|
31
|
+
* @param g - Green (0-1)
|
|
32
|
+
* @param b - Blue (0-1)
|
|
33
|
+
* @param a - Alpha (0-1)
|
|
54
34
|
*/
|
|
55
35
|
constructor(r: number, g: number, b: number, a?: number);
|
|
56
36
|
/**
|
|
57
|
-
*
|
|
58
|
-
* @param
|
|
59
|
-
* @param a - Optional alpha value (0-1), defaults to 1
|
|
37
|
+
* @param hexRGB - Hex RGB value (e.g., 0xFF0000)
|
|
38
|
+
* @param a - Alpha (0-1)
|
|
60
39
|
*/
|
|
61
40
|
constructor(hexRGB: number, a?: number);
|
|
62
|
-
/**
|
|
63
|
-
* Gets the red component value.
|
|
64
|
-
* @returns The red component (0-1)
|
|
65
|
-
*/
|
|
41
|
+
/** Red component (0-1). */
|
|
66
42
|
get r(): number;
|
|
67
|
-
/**
|
|
68
|
-
* Gets the green component value.
|
|
69
|
-
* @returns The green component (0-1)
|
|
70
|
-
*/
|
|
43
|
+
/** Green component (0-1). */
|
|
71
44
|
get g(): number;
|
|
72
|
-
/**
|
|
73
|
-
* Gets the blue component value.
|
|
74
|
-
* @returns The blue component (0-1)
|
|
75
|
-
*/
|
|
45
|
+
/** Blue component (0-1). */
|
|
76
46
|
get b(): number;
|
|
77
|
-
/**
|
|
78
|
-
* Gets the alpha component value.
|
|
79
|
-
* @returns The alpha component (0-1)
|
|
80
|
-
*/
|
|
47
|
+
/** Alpha component (0-1). */
|
|
81
48
|
get a(): number;
|
|
82
|
-
/**
|
|
83
|
-
* Sets the red component value and emits change event.
|
|
84
|
-
* @param value - The red component (0-1)
|
|
85
|
-
*/
|
|
86
49
|
set r(value: number);
|
|
87
|
-
/**
|
|
88
|
-
* Sets the green component value and emits change event.
|
|
89
|
-
* @param value - The green component (0-1)
|
|
90
|
-
*/
|
|
91
50
|
set g(value: number);
|
|
92
|
-
/**
|
|
93
|
-
* Sets the blue component value and emits change event.
|
|
94
|
-
* @param value - The blue component (0-1)
|
|
95
|
-
*/
|
|
96
51
|
set b(value: number);
|
|
97
|
-
/**
|
|
98
|
-
* Sets the alpha component value and emits change event.
|
|
99
|
-
* @param value - The alpha component (0-1)
|
|
100
|
-
*/
|
|
101
52
|
set a(value: number);
|
|
102
53
|
/**
|
|
103
|
-
* Sets all color components
|
|
104
|
-
*
|
|
105
|
-
* @param
|
|
106
|
-
* @param
|
|
107
|
-
* @param
|
|
108
|
-
* @
|
|
54
|
+
* Sets all color components.
|
|
55
|
+
*
|
|
56
|
+
* @param r - Red (0-1)
|
|
57
|
+
* @param g - Green (0-1)
|
|
58
|
+
* @param b - Blue (0-1)
|
|
59
|
+
* @param a - Alpha (0-1)
|
|
60
|
+
* @returns This instance
|
|
109
61
|
*/
|
|
110
62
|
set(r: number, g: number, b: number, a?: number): this;
|
|
111
63
|
/**
|
|
112
|
-
*
|
|
113
|
-
* @returns Hexadecimal RGBA value with alpha in the most significant byte
|
|
64
|
+
* Returns 32-bit hex RGBA value (alpha in MSB).
|
|
114
65
|
*/
|
|
115
66
|
getHexRGBA(): number;
|
|
116
67
|
/**
|
|
117
|
-
*
|
|
118
|
-
* @returns Hexadecimal RGB value (e.g., 0xFF0000 for red)
|
|
68
|
+
* Returns 24-bit hex RGB value.
|
|
119
69
|
*/
|
|
120
70
|
getHexRGB(): number;
|
|
121
71
|
/**
|
|
122
|
-
* Converts
|
|
123
|
-
*
|
|
72
|
+
* Converts to HSL format.
|
|
73
|
+
*
|
|
74
|
+
* @returns Object with h (0-360), s (0-1), l (0-1)
|
|
124
75
|
*/
|
|
125
76
|
getHSL(): {
|
|
126
77
|
h: number;
|
|
@@ -128,49 +79,52 @@ export declare class UIColor extends Eventail {
|
|
|
128
79
|
l: number;
|
|
129
80
|
};
|
|
130
81
|
/**
|
|
131
|
-
* Sets
|
|
132
|
-
*
|
|
133
|
-
* @
|
|
82
|
+
* Sets color from 32-bit hex RGBA value.
|
|
83
|
+
*
|
|
84
|
+
* @param hex - Hex RGBA (alpha in MSB)
|
|
85
|
+
* @returns This instance
|
|
134
86
|
*/
|
|
135
87
|
setHexRGBA(hex: number): this;
|
|
136
88
|
/**
|
|
137
|
-
* Sets
|
|
138
|
-
*
|
|
139
|
-
* @param
|
|
140
|
-
* @
|
|
89
|
+
* Sets color from 24-bit hex RGB value.
|
|
90
|
+
*
|
|
91
|
+
* @param hex - Hex RGB (e.g., 0xFF0000)
|
|
92
|
+
* @param a - Alpha (0-1)
|
|
93
|
+
* @returns This instance
|
|
141
94
|
*/
|
|
142
95
|
setHexRGB(hex: number, a?: number): this;
|
|
143
96
|
/**
|
|
144
|
-
* Sets
|
|
145
|
-
*
|
|
146
|
-
* @param
|
|
147
|
-
* @param
|
|
148
|
-
* @param
|
|
149
|
-
* @
|
|
97
|
+
* Sets color from HSL values.
|
|
98
|
+
*
|
|
99
|
+
* @param h - Hue (0-360)
|
|
100
|
+
* @param s - Saturation (0-1)
|
|
101
|
+
* @param l - Lightness (0-1)
|
|
102
|
+
* @param a - Alpha (0-1)
|
|
103
|
+
* @returns This instance
|
|
150
104
|
*/
|
|
151
105
|
setHSL(h: number, s: number, l: number, a?: number): this;
|
|
152
106
|
/**
|
|
153
|
-
* Sets
|
|
154
|
-
*
|
|
155
|
-
* @param
|
|
156
|
-
* @
|
|
157
|
-
* @
|
|
107
|
+
* Sets color from predefined name.
|
|
108
|
+
*
|
|
109
|
+
* @param colorName - Color name
|
|
110
|
+
* @param a - Alpha (0-1)
|
|
111
|
+
* @returns This instance
|
|
112
|
+
* @throws Error if color name is unknown
|
|
158
113
|
*/
|
|
159
114
|
setName(colorName: UIColorName, a?: number): this;
|
|
160
115
|
/**
|
|
161
|
-
*
|
|
162
|
-
* @param color - The color to copy from (UIColor or Three.js Color)
|
|
163
|
-
* @returns This UIColor instance for method chaining
|
|
116
|
+
* Returns CSS rgba() string.
|
|
164
117
|
*/
|
|
165
|
-
|
|
118
|
+
toCSSColor(): string;
|
|
166
119
|
/**
|
|
167
|
-
*
|
|
168
|
-
*
|
|
120
|
+
* Copies values from another color.
|
|
121
|
+
*
|
|
122
|
+
* @param color - UIColor or Three.js Color
|
|
123
|
+
* @returns This instance
|
|
169
124
|
*/
|
|
170
|
-
|
|
125
|
+
copy(color: UIColor | Color): this;
|
|
171
126
|
/**
|
|
172
|
-
* Creates a
|
|
173
|
-
* @returns A new UIColor instance with the same RGBA values
|
|
127
|
+
* Creates a copy of this color.
|
|
174
128
|
*/
|
|
175
129
|
clone(): UIColor;
|
|
176
130
|
}
|