laymur 0.9.0 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { Eventail } from "eventail";
2
- import type { Color } from "three";
2
+ import { Color, Vector4 } from "three";
3
3
  /**
4
4
  * Predefined color names supported by UIColor.
5
5
  */
@@ -20,24 +20,110 @@ export declare class UIColor extends Eventail {
20
20
  private gInternal;
21
21
  private bInternal;
22
22
  private aInternal;
23
+ private hInternal;
24
+ private sInternal;
25
+ private lInternal;
26
+ private rgbDirty;
27
+ private hslDirty;
23
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);
24
36
  /**
25
37
  * @param colorName - Named color
26
38
  * @param a - Alpha (0-1)
27
39
  */
28
40
  constructor(colorName: UIColorName, a?: number);
29
41
  /**
30
- * @param r - Red (0-1)
31
- * @param g - Green (0-1)
32
- * @param b - Blue (0-1)
42
+ * @param threeColor - Three.js Color object
33
43
  * @param a - Alpha (0-1)
34
44
  */
35
- constructor(r: number, g: number, b: number, a?: number);
45
+ constructor(threeColor: Color, a?: number);
36
46
  /**
37
47
  * @param hexRGB - Hex RGB value (e.g., 0xFF0000)
38
48
  * @param a - Alpha (0-1)
39
49
  */
40
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;
41
127
  /** Red component (0-1). */
42
128
  get r(): number;
43
129
  /** Green component (0-1). */
@@ -46,10 +132,19 @@ export declare class UIColor extends Eventail {
46
132
  get b(): number;
47
133
  /** Alpha component (0-1). */
48
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;
49
141
  set r(value: number);
50
142
  set g(value: number);
51
143
  set b(value: number);
52
144
  set a(value: number);
145
+ set hue(value: number);
146
+ set saturation(value: number);
147
+ set lightness(value: number);
53
148
  /**
54
149
  * Sets all color components.
55
150
  *
@@ -68,16 +163,6 @@ export declare class UIColor extends Eventail {
68
163
  * Returns 24-bit hex RGB value.
69
164
  */
70
165
  getHexRGB(): number;
71
- /**
72
- * Converts to HSL format.
73
- *
74
- * @returns Object with h (0-360), s (0-1), l (0-1)
75
- */
76
- getHSL(): {
77
- h: number;
78
- s: number;
79
- l: number;
80
- };
81
166
  /**
82
167
  * Sets color from 32-bit hex RGBA value.
83
168
  *
@@ -111,11 +196,33 @@ export declare class UIColor extends Eventail {
111
196
  * @returns This instance
112
197
  * @throws Error if color name is unknown
113
198
  */
114
- setName(colorName: UIColorName, a?: number): this;
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;
115
208
  /**
116
209
  * Returns CSS rgba() string.
117
210
  */
118
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;
119
226
  /**
120
227
  * Copies values from another color.
121
228
  *
@@ -127,4 +234,12 @@ export declare class UIColor extends Eventail {
127
234
  * Creates a copy of this color.
128
235
  */
129
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;
130
245
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "laymur",
3
- "version": "0.9.0",
3
+ "version": "0.10.1",
4
4
  "description": "Constraint-based UI library for Three.js mobile advertisements",
5
5
  "scripts": {
6
6
  "clean": "rm -rf dist",