laymur 0.11.5 → 0.13.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 (72) hide show
  1. package/README.md +33 -29
  2. package/dist/constraints/UIAspectConstraint/UIAspectConstraint.Internal.d.ts +1 -1
  3. package/dist/constraints/UIAspectConstraint/UIAspectConstraint.d.ts +1 -1
  4. package/dist/constraints/UIConstraint.d.ts +3 -3
  5. package/dist/constraints/UICustomConstraint.d.ts +3 -3
  6. package/dist/constraints/UIHeightConstraint/UIHeightConstraint.Internal.d.ts +1 -1
  7. package/dist/constraints/UIHeightConstraint/UIHeightConstraint.d.ts +1 -1
  8. package/dist/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.d.ts +1 -1
  9. package/dist/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.d.ts +1 -1
  10. package/dist/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.d.ts +1 -1
  11. package/dist/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.d.ts +1 -1
  12. package/dist/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.d.ts +1 -1
  13. package/dist/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.d.ts +1 -1
  14. package/dist/constraints/{UISingleParameterConstraint.Internal.d.ts → UISingleParameterConstraint/UISingleParameterConstraint.Internal.d.ts} +5 -3
  15. package/dist/constraints/{UISingleParameterConstraint.d.ts → UISingleParameterConstraint/UISingleParameterConstraint.d.ts} +5 -5
  16. package/dist/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.d.ts +1 -1
  17. package/dist/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.d.ts +1 -1
  18. package/dist/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.d.ts +1 -1
  19. package/dist/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.d.ts +1 -1
  20. package/dist/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.d.ts +1 -1
  21. package/dist/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.d.ts +1 -1
  22. package/dist/constraints/UIWidthConstraint/UIWidthConstraint.Internal.d.ts +1 -1
  23. package/dist/constraints/UIWidthConstraint/UIWidthConstraint.d.ts +1 -1
  24. package/dist/elements/UIAnchor/UIAnchor.d.ts +2 -2
  25. package/dist/elements/UIAnimatedImage/UIAnimatedImage.Internal.d.ts +15 -3
  26. package/dist/elements/UIAnimatedImage/UIAnimatedImage.d.ts +23 -13
  27. package/dist/elements/UIElement/UIElement.Internal.d.ts +1 -1
  28. package/dist/elements/UIElement/UIElement.d.ts +5 -5
  29. package/dist/elements/UIGraphics/UIGraphics.Internal.d.ts +4 -0
  30. package/dist/elements/UIGraphics/UIGraphics.d.ts +12 -8
  31. package/dist/elements/UIImage/UIImage.d.ts +7 -3
  32. package/dist/elements/UIInputDummy/UIInputDummy.Internal.d.ts +1 -1
  33. package/dist/elements/UIInputDummy/UIInputDummy.d.ts +4 -4
  34. package/dist/elements/UINineSlice/UINineSlice.d.ts +26 -11
  35. package/dist/elements/UIProgress/UIProgress.d.ts +14 -6
  36. package/dist/elements/UIScene/UIScene.Internal.d.ts +1 -1
  37. package/dist/elements/UIScene/UIScene.d.ts +19 -12
  38. package/dist/elements/UIText/UIText.d.ts +14 -6
  39. package/dist/index.d.ts +3 -2
  40. package/dist/index.js +994 -627
  41. package/dist/index.js.map +1 -1
  42. package/dist/index.min.js +1 -1
  43. package/dist/index.min.js.map +1 -1
  44. package/dist/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.d.ts +9 -0
  45. package/dist/layers/{UIFullscreenLayer.d.ts → UIFullscreenLayer/UIFullscreenLayer.d.ts} +8 -10
  46. package/dist/layers/UILayer/UILayer.Internal.d.ts +29 -0
  47. package/dist/layers/{UILayer.d.ts → UILayer/UILayer.d.ts} +4 -9
  48. package/dist/miscellaneous/asserts.d.ts +1 -1
  49. package/dist/miscellaneous/color/UIColor.d.ts +37 -1
  50. package/dist/miscellaneous/generic-plane/{UIGenericInstancedPlane.Internal.d.ts → UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.d.ts} +6 -6
  51. package/dist/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.d.ts +1 -0
  52. package/dist/miscellaneous/generic-plane/UIGenericPlane/UIGenericPlane.Internal.d.ts +6 -0
  53. package/dist/miscellaneous/generic-plane/UIGenericPlane/UIGenericPlane.d.ts +1 -0
  54. package/dist/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.d.ts +12 -0
  55. package/dist/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.d.ts +1 -0
  56. package/dist/miscellaneous/generic-plane/shared.d.ts +21 -10
  57. package/dist/miscellaneous/insets/UIInsets.Internal.d.ts +1 -1
  58. package/dist/miscellaneous/insets/UIInsets.d.ts +2 -0
  59. package/dist/miscellaneous/shared.d.ts +1 -1
  60. package/dist/wrappers/{UISceneWrapper.Internal.d.ts → UISceneWrapper/UISceneWrapper.Internal.d.ts} +4 -4
  61. package/dist/wrappers/{UISceneWrapper.d.ts → UISceneWrapper/UISceneWrapper.d.ts} +7 -6
  62. package/dist/wrappers/{UISolverWrapper.Internal.d.ts → UISolverWrapper/UISolverWrapper.Internal.d.ts} +3 -3
  63. package/dist/wrappers/{UISolverWrapper.d.ts → UISolverWrapper/UISolverWrapper.d.ts} +3 -3
  64. package/package.json +1 -1
  65. package/dist/layers/UILayer.Internal.d.ts +0 -15
  66. package/dist/miscellaneous/generic-plane/UIGenericInstancedPlane.d.ts +0 -36
  67. package/dist/miscellaneous/generic-plane/UIGenericPlane.Internal.d.ts +0 -5
  68. package/dist/miscellaneous/generic-plane/UIGenericPlane.d.ts +0 -23
  69. package/dist/miscellaneous/generic-plane/UIGenericPlaneRegistry.Internal.d.ts +0 -6
  70. package/dist/miscellaneous/generic-plane/UIGenericPlaneRegistry.d.ts +0 -27
  71. /package/dist/wrappers/{UIInputWrapper.Internal.d.ts → UIInputWrapper/UIInputWrapper.Internal.d.ts} +0 -0
  72. /package/dist/wrappers/{UIInputWrapper.d.ts → UIInputWrapper/UIInputWrapper.d.ts} +0 -0
@@ -0,0 +1,9 @@
1
+ import type { UIResizePolicy } from "../../miscellaneous/resize-policy/UIResizePolicy";
2
+ import { UIResizePolicyNone } from "../../miscellaneous/resize-policy/UIResizePolicyNone";
3
+ import type { UILayerOptions } from "../UILayer/UILayer.Internal";
4
+ /** Configuration for fullscreen layer */
5
+ export interface UIFullscreenLayerOptions extends Omit<UILayerOptions, "width" | "height"> {
6
+ /** Strategy for handling window resize */
7
+ resizePolicy: UIResizePolicy;
8
+ }
9
+ export declare const FULLSCREEN_LAYER_DEFAULT_RESIZE_POLICY: UIResizePolicyNone;
@@ -1,17 +1,13 @@
1
1
  import type { Camera, Vector2, WebGLRenderer } from "three";
2
2
  import { Ray, Vector3 } from "three";
3
- import type { UIResizePolicy } from "../miscellaneous/resize-policy/UIResizePolicy";
4
- import { UILayer } from "./UILayer";
5
- import type { UILayerMode } from "./UILayer.Internal";
3
+ import type { UIResizePolicy } from "../../miscellaneous/resize-policy/UIResizePolicy";
4
+ import { UILayer } from "../UILayer/UILayer";
5
+ import type { UIFullscreenLayerOptions } from "./UIFullscreenLayer.Internal";
6
6
  /** Layer that automatically handles browser window resizing and input events */
7
7
  export declare class UIFullscreenLayer extends UILayer {
8
8
  private resizePolicyInternal;
9
9
  private resizePolicyDirty;
10
- /**
11
- * @param resizePolicy Strategy for handling window resize
12
- * @param mode Initial visibility and interactivity mode
13
- */
14
- constructor(resizePolicy?: UIResizePolicy, mode?: UILayerMode);
10
+ constructor(options?: Partial<UIFullscreenLayerOptions>);
15
11
  /** Current resize policy */
16
12
  get resizePolicy(): UIResizePolicy;
17
13
  /** Updates resize policy */
@@ -28,17 +24,19 @@ export declare class UIFullscreenLayer extends UILayer {
28
24
  * Projects 3D world position to 2D layer coordinates
29
25
  * @param position World position
30
26
  * @param camera Three.js camera
27
+ * @param result Reusable vector instance
31
28
  * @returns Layer coordinates
32
29
  */
33
- projectWorldPosition(position: Vector3, camera: Camera): Vector3;
30
+ projectWorldPosition(position: Vector3, camera: Camera, result?: Vector3): Vector3;
34
31
  /**
35
32
  * Projects 2D layer coordinates to 3D world position
36
33
  * @param position Layer coordinates
37
34
  * @param camera Three.js camera
38
35
  * @param z Depth coordinate
36
+ * @param result Reusable vector instance
39
37
  * @returns World position
40
38
  */
41
- projectLayerPosition(position: Vector2, camera: Camera, z?: number): Vector3;
39
+ projectLayerPosition(position: Vector2, camera: Camera, z?: number, result?: Vector3): Vector3;
42
40
  /**
43
41
  * Builds ray from layer position through camera
44
42
  * @param position Layer coordinates
@@ -0,0 +1,29 @@
1
+ import { UIMode } from "../../miscellaneous/UIMode";
2
+ import type { UIOrientation } from "../../miscellaneous/UIOrientation";
3
+ /** Layer lifecycle and state events */
4
+ export declare enum UILayerEvent {
5
+ /** Fired when orientation changes */
6
+ ORIENTATION_CHANGED = "orientation_changed",
7
+ /** Fired when mode changes */
8
+ MODE_CHANGED = "mode_changed",
9
+ /** Fired during rendering */
10
+ RENDERING = "rendering"
11
+ }
12
+ /** Layer visibility and interactivity state */
13
+ export type UILayerMode = UIMode.HIDDEN | UIMode.VISIBLE | UIMode.INTERACTIVE;
14
+ /** Layer orientation state */
15
+ export type UILayerOrientation = UIOrientation.VERTICAL | UIOrientation.HORIZONTAL;
16
+ /** Configuration options for UILayer */
17
+ export interface UILayerOptions {
18
+ /** Initial width */
19
+ width: number;
20
+ /** Initial height */
21
+ height: number;
22
+ /** Optional layer name */
23
+ name: string;
24
+ /** Initial visibility and interactivity mode */
25
+ mode: UILayerMode;
26
+ }
27
+ export declare const LAYER_DEFAULT_SIZE = 1024;
28
+ export declare const LAYER_DEFAULT_NAME = "";
29
+ export declare const LAYER_DEFAULT_MODE: UILayerMode;
@@ -1,8 +1,8 @@
1
1
  import { Eventail } from "eventail";
2
2
  import type { WebGLRenderer } from "three";
3
- import type { UIPlaneElement } from "../miscellaneous/shared";
4
- import { UIInputWrapper } from "../wrappers/UIInputWrapper";
5
- import type { UILayerMode, UILayerOrientation } from "./UILayer.Internal";
3
+ import type { UIPlaneElement } from "../../miscellaneous/shared";
4
+ import { UIInputWrapper } from "../../wrappers/UIInputWrapper/UIInputWrapper";
5
+ import type { UILayerMode, UILayerOptions, UILayerOrientation } from "./UILayer.Internal";
6
6
  /** Base layer for UI rendering and layout management */
7
7
  export declare abstract class UILayer extends Eventail implements UIPlaneElement {
8
8
  /** Optional layer name */
@@ -20,12 +20,7 @@ export declare abstract class UILayer extends Eventail implements UIPlaneElement
20
20
  private readonly sceneWrapperInternal;
21
21
  private modeInternal;
22
22
  private orientationInternal;
23
- /**
24
- * @param w Initial width in world units
25
- * @param h Initial height in world units
26
- * @param mode Initial visibility and interactivity mode
27
- */
28
- constructor(w: number, h: number, mode: UILayerMode);
23
+ constructor(options: Partial<UILayerOptions>);
29
24
  /** X coordinate in world units (always 0 for layers) */
30
25
  get x(): number;
31
26
  /** Y coordinate in world units (always 0 for layers) */
@@ -1,4 +1,4 @@
1
- import { UILayer } from "../layers/UILayer";
1
+ import { UILayer } from "../layers/UILayer/UILayer";
2
2
  export declare const EPSILON = 0.000001;
3
3
  /**
4
4
  * Validates value is finite number within safe range.
@@ -151,8 +151,44 @@ export declare class UIColor {
151
151
  set saturation(value: number);
152
152
  /** Lightness component (0 to 1) */
153
153
  set lightness(value: number);
154
- /** Sets RGB(A) components */
154
+ /** Sets to white (default) */
155
+ set(): this;
156
+ /**
157
+ * @param r - Red (0-1)
158
+ * @param g - Green (0-1)
159
+ * @param b - Blue (0-1)
160
+ * @param a - Alpha (0-1)
161
+ */
155
162
  set(r: number, g: number, b: number, a?: number): this;
163
+ /**
164
+ * @param colorName - Named color
165
+ * @param a - Alpha (0-1)
166
+ */
167
+ set(colorName: UIColorName, a?: number): this;
168
+ /**
169
+ * @param threeColor - Three.js Color object
170
+ * @param a - Alpha (0-1)
171
+ */
172
+ set(threeColor: Color, a?: number): this;
173
+ /**
174
+ * @param hexRGB - Hex RGB value (e.g., 0xff0000)
175
+ * @param a - Alpha (0-1)
176
+ */
177
+ set(hexRGB: number, a?: number): this;
178
+ /**
179
+ * @param hexString - Hex string (e.g., "#ffffff" or "#ffffffff")
180
+ */
181
+ set(hexString: string): this;
182
+ /**
183
+ * @param uiColor - UIColor object to copy from
184
+ */
185
+ set(uiColor: UIColor): this;
186
+ /**
187
+ * @param uiColorConfig - UIColorConfig object
188
+ */
189
+ set(uiColorConfig?: UIColorConfig): this;
190
+ /** Sets RGBA components directly */
191
+ setRGBA(r: number, g: number, b: number, a?: number): this;
156
192
  /** Returns RGBA as 32-bit hex (RRGGBBAA) */
157
193
  getHexRGBA(): number;
158
194
  /** Returns RGB as 24-bit hex (RRGGBB) */
@@ -1,10 +1,10 @@
1
1
  import { InstancedBufferAttribute, InstancedBufferGeometry, ShaderMaterial } from "three";
2
- import { UITransparencyMode } from "../UITransparencyMode";
3
- import type { UIPropertyType } from "./shared";
2
+ import { UITransparencyMode } from "../../UITransparencyMode";
3
+ import type { GLProperty, UIProperty } from "../shared";
4
4
  export declare const INSTANCED_PLANE_GEOMETRY: InstancedBufferGeometry;
5
5
  export declare const CAPACITY_STEP = 4;
6
- export declare function writePropertyToArray(value: UIPropertyType, array: Float32Array, offset: number): void;
6
+ export declare function writePropertyToArray(value: UIProperty, array: Float32Array, offset: number): void;
7
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;
8
+ export declare function buildEmptyInstancedBufferAttribute(value: UIProperty, capacity: number): InstancedBufferAttribute;
9
+ export declare function buildMaterial(source: string, uniformProperties: Record<string, GLProperty>, varyingProperties: Record<string, GLProperty>, transparency: UITransparencyMode): ShaderMaterial;
10
+ export declare function reconstructValue(referenceValue: UIProperty, array: Float32Array, offset: number): UIProperty;
@@ -0,0 +1,6 @@
1
+ import type { Matrix4 } from "three";
2
+ import { PlaneGeometry, ShaderMaterial } from "three";
3
+ import { UITransparencyMode } from "../../UITransparencyMode";
4
+ import type { GLProperty } from "../shared";
5
+ export declare const PLANE_GEOMETRY: PlaneGeometry;
6
+ export declare function buildGenericPlaneMaterial(source: string, properties: Record<string, GLProperty>, transparency: UITransparencyMode, transform: Matrix4): ShaderMaterial;
@@ -0,0 +1,12 @@
1
+ import type { UIGenericInstancedPlane } from "../UIGenericInstancedPlane/UIGenericInstancedPlane";
2
+ import type { UIGenericPlane } from "../UIGenericPlane/UIGenericPlane";
3
+ export type PlaneDescriptor = SinglePlaneDescriptor | InstancedPlaneDescriptor;
4
+ export interface SinglePlaneDescriptor {
5
+ plane: UIGenericPlane;
6
+ }
7
+ export interface InstancedPlaneDescriptor {
8
+ plane: UIGenericInstancedPlane;
9
+ instanceHandler: number;
10
+ }
11
+ export declare function isSinglePlaneDescriptor(descriptor: PlaneDescriptor): descriptor is SinglePlaneDescriptor;
12
+ export declare function isInstancedPlaneDescriptor(descriptor: PlaneDescriptor): descriptor is InstancedPlaneDescriptor;
@@ -2,21 +2,32 @@ import type { IUniform, ShaderMaterial } from "three";
2
2
  import { Matrix3, Matrix4, Texture, Vector2, Vector3, Vector4 } from "three";
3
3
  import type { UITransparencyMode } from "../UITransparencyMode";
4
4
  import { UIColor } from "../color/UIColor";
5
- export type UIPropertyType = Texture | UIColor | Vector2 | Vector3 | Vector4 | Matrix3 | Matrix4 | number;
6
- export interface GLSLTypeInfo {
5
+ export type UIProperty = Texture | UIColor | Vector2 | Vector3 | Vector4 | Matrix3 | Matrix4 | number;
6
+ export type UIPropertyName = "Texture" | "UIColor" | "Vector2" | "Vector3" | "Vector4" | "Matrix3" | "Matrix4" | "number";
7
+ export type UIPropertyConstructor = typeof Texture | typeof UIColor | typeof Vector2 | typeof Vector3 | typeof Vector4 | typeof Matrix3 | typeof Matrix4 | NumberConstructor;
8
+ export type UIPropertyCopyTo = UIColor | Vector2 | Vector3 | Vector4 | Matrix3 | Matrix4;
9
+ export type UIPropertyCopyFrom = UIColor & Vector2 & Vector3 & Vector4 & Matrix3 & Matrix4;
10
+ export interface GLTypeInfo {
11
+ glslTypeName: string;
12
+ bufferSize: number;
7
13
  instantiable: boolean;
8
- glslType: string;
9
- itemSize: number;
10
14
  }
11
- export interface GenericPlaneData {
15
+ export interface GLProperty {
16
+ value: UIProperty;
17
+ glslTypeInfo: GLTypeInfo;
18
+ }
19
+ export interface PlaneData {
12
20
  source: string;
13
- properties: Record<string, UIPropertyType>;
14
- transparency: UITransparencyMode;
21
+ properties: Record<string, GLProperty>;
15
22
  transform: Matrix4;
16
23
  visibility: boolean;
24
+ transparency: UITransparencyMode;
17
25
  }
18
26
  export declare const DEFAULT_ALPHA_TEST = 0.5;
19
- export declare function resolveGLSLTypeInfo(value: UIPropertyType): GLSLTypeInfo;
20
- export declare function resolveUniform(name: string, material: ShaderMaterial): IUniform<unknown>;
21
- export declare function arePropertiesCompatible(currentProperties: Record<string, UIPropertyType>, newProperties: Record<string, UIPropertyType>): boolean;
27
+ export declare function resolveGLSLTypeInfo(value: UIProperty | UIPropertyName | UIPropertyConstructor): GLTypeInfo;
28
+ export declare function resolvePropertyUniform(name: string, material: ShaderMaterial): IUniform<UIProperty>;
29
+ export declare function arePropertiesPartiallyCompatible(full: Readonly<Record<string, Readonly<GLProperty>>>, partial: Readonly<Record<string, Readonly<GLProperty>>>): boolean;
30
+ export declare function convertUIPropertiesToGLProperties(uiProperties: Record<string, UIProperty>): Record<string, GLProperty>;
31
+ export declare function cloneProperty<T extends UIProperty>(property: T): T;
32
+ export declare function cloneProperties(properties: Record<string, UIProperty>): Record<string, UIProperty>;
22
33
  export declare function buildGenericPlaneFragmentShader(uniformDeclarations: string[], varyingDeclarations: string[], source: string): string;
@@ -7,5 +7,5 @@ export type UIInsetsConfig = {
7
7
  right: number;
8
8
  top: number;
9
9
  bottom: number;
10
- } | number;
10
+ } | [number, number, number, number] | [number, number] | number;
11
11
  export declare const INSETS_DEFAULT_VALUE = 0;
@@ -35,6 +35,8 @@ export declare class UIInsets {
35
35
  setVertical(value: number): void;
36
36
  /** Sets all sides to same value */
37
37
  setUnified(value: number): void;
38
+ /** Sets insets */
39
+ set(config?: UIInsetsConfig): void;
38
40
  /** Sets from Vector4 (x=left, y=right, z=top, w=bottom) */
39
41
  setVector4(vector: Vector4): void;
40
42
  /** Converts to Vector4 (left, right, top, bottom) */
@@ -1,4 +1,4 @@
1
- import { UILayer } from "../layers/UILayer";
1
+ import { UILayer } from "../layers/UILayer/UILayer";
2
2
  /** Objects that belong to a UI layer */
3
3
  export interface UILayerElement {
4
4
  /** The UI layer containing this element */
@@ -1,11 +1,11 @@
1
1
  import type { Matrix4, Object3D } from "three";
2
- import type { UITransparencyMode } from "../miscellaneous/UITransparencyMode";
3
- import type { UIPropertyType } from "../miscellaneous/generic-plane/shared";
2
+ import type { UITransparencyMode } from "../../miscellaneous/UITransparencyMode";
3
+ import type { UIProperty } from "../../miscellaneous/generic-plane/shared";
4
4
  export interface UISceneWrapperInterface {
5
- createPlane(source: string, properties: Record<string, UIPropertyType>, transparency: UITransparencyMode): number;
5
+ createPlane(source: string, properties: Record<string, UIProperty>, transform: Matrix4, visibility: boolean, transparency: UITransparencyMode): number;
6
6
  destroyPlane(handler: number): void;
7
7
  setTransform(handler: number, transform: Matrix4): void;
8
- setProperties(handler: number, properties: Record<string, UIPropertyType>): void;
8
+ setProperties(handler: number, properties: Record<string, UIProperty>): void;
9
9
  setVisibility(handler: number, visible: boolean): void;
10
10
  setTransparency(handler: number, transparency: UITransparencyMode): void;
11
11
  insertCustomObject(object: Object3D): void;
@@ -1,15 +1,16 @@
1
1
  import type { Matrix4, Object3D, WebGLRenderer } from "three";
2
- import type { UIPropertyType } from "../miscellaneous/generic-plane/shared";
3
- import type { UITransparencyMode } from "../miscellaneous/UITransparencyMode";
4
- export declare class UISceneWrapper {
2
+ import type { UIProperty } from "../../miscellaneous/generic-plane/shared";
3
+ import type { UITransparencyMode } from "../../miscellaneous/UITransparencyMode";
4
+ import type { UISceneWrapperInterface } from "./UISceneWrapper.Internal";
5
+ export declare class UISceneWrapper implements UISceneWrapperInterface {
5
6
  private readonly scene;
6
7
  private readonly camera;
7
- private readonly registry;
8
+ private readonly planeRegistry;
8
9
  constructor(width: number, height: number);
9
- createPlane(source: string, properties: Record<string, UIPropertyType>, transparency: UITransparencyMode): number;
10
+ createPlane(source: string, properties: Record<string, UIProperty>, transform: Matrix4, visibility: boolean, transparency: UITransparencyMode): number;
10
11
  destroyPlane(handler: number): void;
11
12
  setTransform(handler: number, transform: Matrix4): void;
12
- setProperties(handler: number, properties: Record<string, UIPropertyType>): void;
13
+ setProperties(handler: number, properties: Record<string, UIProperty>): void;
13
14
  setVisibility(handler: number, visible: boolean): void;
14
15
  setTransparency(handler: number, transparency: UITransparencyMode): void;
15
16
  insertCustomObject(object: Object3D): this;
@@ -1,7 +1,7 @@
1
1
  import type { Constraint, Variable } from "@lume/kiwi";
2
- import type { UIExpression } from "../miscellaneous/UIExpression";
3
- import type { UIPriority } from "../miscellaneous/UIPriority";
4
- import type { UIRelation } from "../miscellaneous/UIRelation";
2
+ import type { UIExpression } from "../../miscellaneous/UIExpression";
3
+ import type { UIPriority } from "../../miscellaneous/UIPriority";
4
+ import type { UIRelation } from "../../miscellaneous/UIRelation";
5
5
  export interface UISolverWrapperInterface {
6
6
  get dirty(): boolean;
7
7
  createVariable(value: number, priority: UIPriority): number;
@@ -1,6 +1,6 @@
1
- import { UIExpression } from "../miscellaneous/UIExpression";
2
- import { UIPriority } from "../miscellaneous/UIPriority";
3
- import { UIRelation } from "../miscellaneous/UIRelation";
1
+ import { UIExpression } from "../../miscellaneous/UIExpression";
2
+ import { UIPriority } from "../../miscellaneous/UIPriority";
3
+ import { UIRelation } from "../../miscellaneous/UIRelation";
4
4
  import type { UISolverWrapperInterface } from "./UISolverWrapper.Internal";
5
5
  /**
6
6
  * Wrapper around the Kiwi constraint solver providing enhanced UI-specific functionality.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "laymur",
3
- "version": "0.11.5",
3
+ "version": "0.13.0",
4
4
  "description": "Constraint-based UI library for Three.js mobile advertisements",
5
5
  "scripts": {
6
6
  "clean": "rm -rf dist",
@@ -1,15 +0,0 @@
1
- import type { UIMode } from "../miscellaneous/UIMode";
2
- import type { UIOrientation } from "../miscellaneous/UIOrientation";
3
- /** Layer lifecycle and state events */
4
- export declare enum UILayerEvent {
5
- /** Fired when orientation changes */
6
- ORIENTATION_CHANGED = "orientation_changed",
7
- /** Fired when mode changes */
8
- MODE_CHANGED = "mode_changed",
9
- /** Fired during rendering */
10
- RENDERING = "rendering"
11
- }
12
- /** Layer visibility and interactivity state */
13
- export type UILayerMode = UIMode.HIDDEN | UIMode.VISIBLE | UIMode.INTERACTIVE;
14
- /** Layer orientation state */
15
- export type UILayerOrientation = UIOrientation.VERTICAL | UIOrientation.HORIZONTAL;
@@ -1,36 +0,0 @@
1
- import { Matrix4, Mesh } from "three";
2
- import { UITransparencyMode } from "../UITransparencyMode";
3
- import type { GenericPlaneData, UIPropertyType } from "./shared";
4
- export declare class UIGenericInstancedPlane extends Mesh {
5
- readonly source: string;
6
- readonly transparency: UITransparencyMode;
7
- private readonly handlerToIndex;
8
- private readonly propertyBuffers;
9
- private readonly instancedGeometry;
10
- private readonly shaderMaterial;
11
- private readonly uniformProperties;
12
- private readonly varyingProperties;
13
- private lastHandler;
14
- private capacity;
15
- constructor(source: string, properties: Record<string, UIPropertyType>, transparency?: UITransparencyMode, initialCapacity?: number);
16
- get instanceCount(): number;
17
- get properties(): Record<string, UIPropertyType>;
18
- createInstance(): number;
19
- destroyInstance(handler: number): void;
20
- setProperties(handler: number, properties: Record<string, UIPropertyType>): void;
21
- setTransform(handler: number, transform: Matrix4): void;
22
- setVisibility(handler: number, visible: boolean): void;
23
- isCompatible(source: string, properties: Record<string, UIPropertyType>, transparency?: UITransparencyMode): boolean;
24
- arePropertiesCompatible(properties: Record<string, UIPropertyType>): boolean;
25
- extractInstanceData(handler: number): GenericPlaneData;
26
- extractProperties(handler: number): Record<string, UIPropertyType>;
27
- extractTransform(handler: number): Matrix4;
28
- extractVisibility(handler: number): boolean;
29
- destroy(): void;
30
- private initializeInstanceDefaults;
31
- private ensureCapacity;
32
- private moveInstanceData;
33
- private updateIndicesAfterMove;
34
- private resolveIndex;
35
- private resolveAttribute;
36
- }
@@ -1,5 +0,0 @@
1
- import { PlaneGeometry, ShaderMaterial } from "three";
2
- import { UITransparencyMode } from "../UITransparencyMode";
3
- import type { UIPropertyType } from "./shared";
4
- export declare const PLANE_GEOMETRY: PlaneGeometry;
5
- export declare function buildGenericPlaneMaterial(source: string, properties: Record<string, UIPropertyType>, transparency: UITransparencyMode): ShaderMaterial;
@@ -1,23 +0,0 @@
1
- import { Matrix4, Mesh } from "three";
2
- import { UITransparencyMode } from "../UITransparencyMode";
3
- import type { GenericPlaneData, UIPropertyType } from "./shared";
4
- export declare class UIGenericPlane extends Mesh {
5
- readonly source: string;
6
- private readonly shaderMaterial;
7
- private readonly propertiesInternal;
8
- private readonly transformInternal;
9
- private transparencyInternal;
10
- constructor(source: string, properties: Record<string, UIPropertyType>, transparency: UITransparencyMode);
11
- get properties(): Record<string, UIPropertyType>;
12
- get transform(): Matrix4;
13
- get visibility(): boolean;
14
- get transparency(): UITransparencyMode;
15
- setProperties(properties: Record<string, UIPropertyType>): void;
16
- setTransform(transform: Matrix4): void;
17
- setVisibility(visibility: boolean): void;
18
- setTransparency(transparency: UITransparencyMode): void;
19
- extractInstanceData(): GenericPlaneData;
20
- isCompatible(source: string, properties: Record<string, UIPropertyType>, transparency: UITransparencyMode): boolean;
21
- arePropertiesCompatible(properties: Record<string, UIPropertyType>): boolean;
22
- destroy(): void;
23
- }
@@ -1,6 +0,0 @@
1
- import type { UIGenericInstancedPlane } from "./UIGenericInstancedPlane";
2
- import type { UIGenericPlane } from "./UIGenericPlane";
3
- export interface GenericPlaneDescriptor {
4
- plane: UIGenericPlane | UIGenericInstancedPlane;
5
- instanceHandler?: number;
6
- }
@@ -1,27 +0,0 @@
1
- import type { Matrix4, Scene } from "three";
2
- import type { UITransparencyMode } from "../UITransparencyMode";
3
- import type { UIPropertyType } from "./shared";
4
- export declare class UIPlaneRegistry {
5
- private readonly scene;
6
- private readonly descriptors;
7
- private lastHandler;
8
- constructor(scene: Scene);
9
- create(source: string, properties: Record<string, UIPropertyType>, transparency: UITransparencyMode): number;
10
- destroy(handler: number): void;
11
- setTransform(handler: number, transform: Matrix4): void;
12
- setProperties(handler: number, properties: Record<string, UIPropertyType>): void;
13
- setVisibility(handler: number, visible: boolean): void;
14
- setTransparency(handler: number, transparency: UITransparencyMode): void;
15
- private placeInstance;
16
- private extractInstanceData;
17
- private removeFromCurrentPlane;
18
- private updatePropertiesInPlace;
19
- private checkNeedsRelocation;
20
- private attachToInstancedPlane;
21
- private createSinglePlane;
22
- private findCompatibleSinglePlane;
23
- private findCompatibleInstancedPlane;
24
- private promoteToInstanced;
25
- private demoteToSingle;
26
- private resolveDescriptor;
27
- }