laymur 0.2.10 → 0.2.12
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/builders/UICoverConstraintBuilder.d.ts +54 -0
- package/dist/builders/UIFitConstraintBuilder.d.ts +54 -0
- package/dist/constraints/UIAspectConstraint.d.ts +3 -3
- package/dist/constraints/UIHeightConstraint.d.ts +3 -3
- package/dist/constraints/UIWidthConstraint.d.ts +3 -3
- package/dist/elements/UIElement.d.ts +13 -2
- package/dist/elements/UINineSline.d.ts +136 -4
- package/dist/elements/UIScene.d.ts +2 -1
- package/dist/elements/UIText.d.ts +7 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +481 -244
- 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/UILayer.d.ts +22 -2
- package/dist/materials/UINineSliceMaterial.d.ts +18 -5
- package/dist/miscellaneous/UINineSliceBorder.d.ts +21 -0
- package/dist/miscellaneous/asserts.d.ts +8 -0
- package/dist/wrappers/UISceneWrapper.d.ts +2 -1
- package/package.json +2 -1
- package/dist/constraints/UICoverConstraint.d.ts +0 -0
- package/dist/constraints/UIFitConstraint.d.ts +0 -0
- package/dist/materials/UIInstancedMaterial.d.ts +0 -0
package/dist/layers/UILayer.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Eventail } from "eventail";
|
|
2
|
-
import type
|
|
2
|
+
import { type WebGLRenderer } from "three";
|
|
3
3
|
import { UIMode } from "../miscellaneous/UIMode";
|
|
4
4
|
import { UIOrientation } from "../miscellaneous/UIOrientation";
|
|
5
5
|
import { UISceneWrapper } from "../wrappers/UISceneWrapper";
|
|
@@ -11,7 +11,9 @@ export declare enum UILayerEvent {
|
|
|
11
11
|
/** Emitted when the layer's orientation changes between horizontal and vertical. */
|
|
12
12
|
ORIENTATION_CHANGE = "orientation_change",
|
|
13
13
|
/** Emitted when the layer's visibility/interaction mode changes. */
|
|
14
|
-
MODE_CHANGE = "mode_change"
|
|
14
|
+
MODE_CHANGE = "mode_change",
|
|
15
|
+
/** Emitted before the layer is rendered. */
|
|
16
|
+
WILL_RENDER = "will_render"
|
|
15
17
|
}
|
|
16
18
|
/**
|
|
17
19
|
* Abstract base class for UI layout containers with constraint solving and rendering.
|
|
@@ -141,4 +143,22 @@ export declare abstract class UILayer extends Eventail {
|
|
|
141
143
|
* @protected
|
|
142
144
|
*/
|
|
143
145
|
protected clickInternal(x: number, y: number): void;
|
|
146
|
+
/**
|
|
147
|
+
* Internal method for accessing the constraint solver wrapper.
|
|
148
|
+
*
|
|
149
|
+
* Provides access to the layer's constraint solver for elements and
|
|
150
|
+
* constraints that need to create variables or constraints.
|
|
151
|
+
*
|
|
152
|
+
* @returns The constraint solver wrapper instance
|
|
153
|
+
*/
|
|
154
|
+
protected ["getSolverWrapperInternal"](): UISolverWrapper;
|
|
155
|
+
/**
|
|
156
|
+
* Internal method for accessing the 3D scene wrapper.
|
|
157
|
+
*
|
|
158
|
+
* Provides access to the layer's scene management system for elements
|
|
159
|
+
* that need to be added to or removed from the 3D scene.
|
|
160
|
+
*
|
|
161
|
+
* @returns The scene wrapper instance
|
|
162
|
+
*/
|
|
163
|
+
protected ["getSceneWrapperInternal"](): UISceneWrapper;
|
|
144
164
|
}
|
|
@@ -1,14 +1,27 @@
|
|
|
1
1
|
import type { Texture } from "three";
|
|
2
|
-
import {
|
|
2
|
+
import { ShaderMaterial } from "three";
|
|
3
3
|
export declare class UINineSliceMaterial extends ShaderMaterial {
|
|
4
4
|
constructor(texture: Texture);
|
|
5
|
+
getSliceBorderLeft(): number;
|
|
6
|
+
getSliceBorderRight(): number;
|
|
7
|
+
getSliceBorderTop(): number;
|
|
8
|
+
getSliceBorderBottom(): number;
|
|
9
|
+
getQuadSize(): {
|
|
10
|
+
w: number;
|
|
11
|
+
h: number;
|
|
12
|
+
};
|
|
5
13
|
getTexture(): Texture;
|
|
6
14
|
getColor(): number;
|
|
7
15
|
getOpacity(): number;
|
|
8
16
|
getTransparency(): boolean;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
17
|
+
setSliceBorderLeft(l: number): this;
|
|
18
|
+
setSliceBorderRight(r: number): this;
|
|
19
|
+
setSliceBorderTop(t: number): this;
|
|
20
|
+
setSliceBorderBottom(b: number): this;
|
|
21
|
+
setSliceBorder(l: number, r: number, t: number, b: number): this;
|
|
22
|
+
setQuadSize(w: number, h: number): this;
|
|
23
|
+
setTexture(value: Texture): this;
|
|
24
|
+
setColor(color: number): this;
|
|
13
25
|
setOpacity(opacity: number): this;
|
|
26
|
+
setTransparency(value: boolean): this;
|
|
14
27
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type UINineSliceBorder = {
|
|
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 resolveNineSliceBorder(value: unknown): {
|
|
17
|
+
left: number;
|
|
18
|
+
right: number;
|
|
19
|
+
top: number;
|
|
20
|
+
bottom: number;
|
|
21
|
+
};
|
|
@@ -22,6 +22,10 @@ export interface UIPointElement {
|
|
|
22
22
|
xVariable: number;
|
|
23
23
|
/** Solver variable descriptor for the y-coordinate. */
|
|
24
24
|
yVariable: number;
|
|
25
|
+
/** The x-coordinate of the element. */
|
|
26
|
+
x: number;
|
|
27
|
+
/** The y-coordinate of the element. */
|
|
28
|
+
y: number;
|
|
25
29
|
}
|
|
26
30
|
/**
|
|
27
31
|
* Interface for UI elements that have both position and dimensions in 2D space.
|
|
@@ -34,6 +38,10 @@ export interface UIPlaneElement extends UIPointElement {
|
|
|
34
38
|
wVariable: number;
|
|
35
39
|
/** Solver variable descriptor for the height dimension. */
|
|
36
40
|
hVariable: number;
|
|
41
|
+
/** The width of the element. */
|
|
42
|
+
width: number;
|
|
43
|
+
/** The height of the element. */
|
|
44
|
+
height: number;
|
|
37
45
|
}
|
|
38
46
|
/**
|
|
39
47
|
* Type guard to check if an object implements the UILayerElement interface.
|
|
@@ -14,5 +14,6 @@ export declare class UISceneWrapper {
|
|
|
14
14
|
setZIndex(element: UIElement, zIndex: number): void;
|
|
15
15
|
setVisibility(element: UIElement, visible: boolean): void;
|
|
16
16
|
getSortedVisibleElements(): UIElement[];
|
|
17
|
-
|
|
17
|
+
prepareRender(renderer: WebGLRenderer): void;
|
|
18
|
+
render(renderer: WebGLRenderer): void;
|
|
18
19
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "laymur",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.12",
|
|
4
4
|
"description": "Lightweight Three.js UI toolkit mainly for mobile ads",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"clean": "rm -rf dist",
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"@typescript-eslint/parser": "^8.32.0",
|
|
52
52
|
"eslint": "^9.26.0",
|
|
53
53
|
"rollup": "^4.40.2",
|
|
54
|
+
"rollup-plugin-string": "^3.0.0",
|
|
54
55
|
"rollup-plugin-typescript2": "^0.36.0",
|
|
55
56
|
"ts-transformer-minify-privates": "^1.0.0",
|
|
56
57
|
"typescript": "^5.8.3"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|