laymur 0.1.11 → 0.1.14

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
- import type { UIConstraintPower } from "../Constraints/UIConstraintPower";
2
- import type { UIConstraintRule } from "../Constraints/UIConstraintRule";
1
+ import { type UIConstraintPower } from "../Constraints/UIConstraintPower";
2
+ import { type UIConstraintRule } from "../Constraints/UIConstraintRule";
3
3
  import { UIElement } from "../Elements/UIElement";
4
4
  import { UILayer } from "../Layers/UILayer";
5
5
  import type { UIOrientation } from "../Miscellaneous/UIOrientation";
@@ -1,6 +1,41 @@
1
- import type { UIDistance2DConstraint, UIDistance2DConstraintParameters, UIProportion2DConstraintParameters, UIProprtion2DConstraint, UISize2DConstraint, UISize2DConstraintParameters } from "./UIConstraint2DBuilderInterfaces";
2
- export declare class UIConstraintBuilder2D {
3
- static size2D(parameters: UISize2DConstraintParameters): UISize2DConstraint;
4
- static distance2D(parameters: UIDistance2DConstraintParameters): UIDistance2DConstraint;
5
- static proportional2D(parameters: UIProportion2DConstraintParameters): UIProprtion2DConstraint;
1
+ import type { UIConstraintPower } from "../Constraints/UIConstraintPower";
2
+ import type { UIConstraintRule } from "../Constraints/UIConstraintRule";
3
+ import { UIHeightConstraint } from "../Constraints/UIHeightConstraint";
4
+ import { UIHorizontalDistanceConstraint } from "../Constraints/UIHorizontalDistanceConstraint";
5
+ import { UIHorizontalProportionConstraint } from "../Constraints/UIHorizontalProportionConstraint";
6
+ import { UIVerticalDistanceConstraint } from "../Constraints/UIVerticalDistanceConstraint";
7
+ import { UIVerticalProportionConstraint } from "../Constraints/UIVerticalProportionConstraint";
8
+ import { UIWidthConstraint } from "../Constraints/UIWidthConstraint";
9
+ import type { UIElement } from "../Elements/UIElement";
10
+ import type { UILayer } from "../Layers/UILayer";
11
+ import type { UIOrientation } from "../Miscellaneous/UIOrientation";
12
+ export interface UIType2D<T> {
13
+ x?: T;
14
+ y?: T;
6
15
  }
16
+ interface UIConstraint2DOptions {
17
+ power: UIType2D<UIConstraintPower>;
18
+ rule: UIType2D<UIConstraintRule>;
19
+ orientation: UIType2D<UIOrientation>;
20
+ }
21
+ export interface UIConstraintSize2DOptions extends UIConstraint2DOptions {
22
+ size: UIType2D<number>;
23
+ }
24
+ export interface UIConstraintSize2DOptions extends UIConstraint2DOptions {
25
+ anchorOne: UIType2D<number>;
26
+ anchorTwo: UIType2D<number>;
27
+ distance: UIType2D<number>;
28
+ }
29
+ export interface UIConstraintProportion2DOptions extends UIConstraint2DOptions {
30
+ proportion: UIType2D<number>;
31
+ }
32
+ export interface UIConstraint2DResult<TX, TY> {
33
+ x: TX;
34
+ y: TY;
35
+ }
36
+ export declare class UIConstraint2DBuilder {
37
+ static size(element: UIElement, options: Partial<UIConstraintSize2DOptions>): UIConstraint2DResult<UIWidthConstraint, UIHeightConstraint>;
38
+ static distance(elementOne: UIElement | UILayer, elementTwo: UIElement, options: Partial<UIConstraintSize2DOptions>): UIConstraint2DResult<UIHorizontalDistanceConstraint, UIVerticalDistanceConstraint>;
39
+ static proportional(elementOne: UIElement | UILayer, elementTwo: UIElement, options: Partial<UIConstraintProportion2DOptions>): UIConstraint2DResult<UIHorizontalProportionConstraint, UIVerticalProportionConstraint>;
40
+ }
41
+ export {};
@@ -3,6 +3,10 @@ import type { UITextSpan, UITextStyle } from "../Elements/UITextInterfaces";
3
3
  export interface UIImageDescription {
4
4
  texture: Texture;
5
5
  }
6
+ export interface UIProgressDescription {
7
+ background: Texture;
8
+ foreground: Texture;
9
+ }
6
10
  export interface UITextDescription {
7
11
  text: string;
8
12
  style?: Partial<UITextStyle>;
@@ -15,8 +19,9 @@ export interface UIDummyDescription {
15
19
  width?: number;
16
20
  height?: number;
17
21
  }
18
- export type UIAnyElementDescription = UIImageDescription | UITextDescription | UITextEnancedDescription | UIDummyDescription;
22
+ export type UIAnyElementDescription = UIImageDescription | UIProgressDescription | UITextDescription | UITextEnancedDescription | UIDummyDescription;
19
23
  export declare function isUIImageDescription(obj: unknown): obj is UIImageDescription;
24
+ export declare function isUIProgressDescription(obj: unknown): obj is UIProgressDescription;
20
25
  export declare function isUITextDescription(obj: unknown): obj is UITextDescription;
21
26
  export declare function isUITextEnhancedDescription(obj: unknown): obj is UITextEnancedDescription;
22
27
  export declare function isUIDummyDescription(obj: unknown): obj is UIDummyDescription;
@@ -5,7 +5,7 @@ import { UIVerticalDistanceConstraint } from "../Constraints/UIVerticalDistanceC
5
5
  import { UIVerticalProportionConstraint } from "../Constraints/UIVerticalProportionConstraint";
6
6
  import { UIDummy } from "../Elements/UIDummy";
7
7
  import type { UIElement } from "../Elements/UIElement";
8
- export interface UIStackConstraintBuilderParameters {
8
+ export interface UIStackConstraintBuilderOptions {
9
9
  offset: number;
10
10
  elements: UIElement[];
11
11
  power?: UIConstraintPower;
@@ -25,7 +25,7 @@ export interface UIStackConstraintBuilderVerticalResult {
25
25
  centerConstraints: UIHorizontalDistanceConstraint[];
26
26
  }
27
27
  export declare class UIStackConstraintBuilder {
28
- static buildHorizontal(parameters: UIStackConstraintBuilderParameters): UIStackConstraintBuilderHorizontalResult;
29
- static buildVertical(parameters: UIStackConstraintBuilderParameters): UIStackConstraintBuilderVerticalResult;
28
+ static buildHorizontal(options: UIStackConstraintBuilderOptions): UIStackConstraintBuilderHorizontalResult;
29
+ static buildVertical(options: UIStackConstraintBuilderOptions): UIStackConstraintBuilderVerticalResult;
30
30
  private static createDummy;
31
31
  }
@@ -4,7 +4,7 @@ import { UIOrientation } from "../Miscellaneous/UIOrientation";
4
4
  import { UIConstraint } from "./UIConstraint";
5
5
  import type { UIConstraintPower } from "./UIConstraintPower";
6
6
  import type { UIConstraintRule } from "./UIConstraintRule";
7
- export interface UIAspectParameters {
7
+ export interface UIAspectOptions {
8
8
  aspect: number;
9
9
  power: UIConstraintPower;
10
10
  rule: UIConstraintRule;
@@ -14,7 +14,7 @@ export declare class UIAspectConstraint extends UIConstraint {
14
14
  private readonly element;
15
15
  private readonly parameters;
16
16
  private constraint?;
17
- constructor(element: UIElement, parameters?: Partial<UIAspectParameters>);
17
+ constructor(element: UIElement, parameters?: Partial<UIAspectOptions>);
18
18
  destroy(): void;
19
19
  [disableConstraintSymbol](newOrientation: UIOrientation): void;
20
20
  [enableConstraintSymbol](newOrientation: UIOrientation): void;
@@ -4,6 +4,7 @@ import { disableConstraintSymbol, enableConstraintSymbol } from "../Miscellaneou
4
4
  import type { UIOrientation } from "../Miscellaneous/UIOrientation";
5
5
  export declare abstract class UIConstraint {
6
6
  readonly layer: UILayer;
7
+ name: string;
7
8
  constructor(layer: UILayer, elements: Set<UIElement>);
8
9
  destroy(): void;
9
10
  abstract [disableConstraintSymbol](orientation: UIOrientation): void;
@@ -3,7 +3,7 @@ import type { UILayer } from "../Layers/UILayer";
3
3
  import { disableConstraintSymbol, enableConstraintSymbol } from "../Miscellaneous/symbols";
4
4
  import { UIOrientation } from "../Miscellaneous/UIOrientation";
5
5
  import { UIConstraint } from "./UIConstraint";
6
- export interface UICoverParameters {
6
+ export interface UICoverOptions {
7
7
  isStrict: boolean;
8
8
  horizontalAnchor: number;
9
9
  verticalAnchor: number;
@@ -18,7 +18,7 @@ export declare class UICoverConstraint extends UIConstraint {
18
18
  private constraintW?;
19
19
  private constraintH?;
20
20
  private constraintStrict?;
21
- constructor(elementOne: UIElement | UILayer, elementTwo: UIElement, parameters?: Partial<UICoverParameters>);
21
+ constructor(elementOne: UIElement | UILayer, elementTwo: UIElement, parameters?: Partial<UICoverOptions>);
22
22
  destroy(): void;
23
23
  [disableConstraintSymbol](orientation: UIOrientation): void;
24
24
  [enableConstraintSymbol](orientation: UIOrientation): void;
@@ -3,7 +3,7 @@ import type { UILayer } from "../Layers/UILayer";
3
3
  import { disableConstraintSymbol, enableConstraintSymbol } from "../Miscellaneous/symbols";
4
4
  import { UIOrientation } from "../Miscellaneous/UIOrientation";
5
5
  import { UIConstraint } from "./UIConstraint";
6
- export interface UIFitParameters {
6
+ export interface UIFitOptions {
7
7
  isStrict: boolean;
8
8
  horizontalAnchor: number;
9
9
  verticalAnchor: number;
@@ -18,7 +18,7 @@ export declare class UIFitConstraint extends UIConstraint {
18
18
  private constraintW?;
19
19
  private constraintH?;
20
20
  private constraintStrict?;
21
- constructor(elementOne: UIElement | UILayer, elementTwo: UIElement, parameters?: Partial<UIFitParameters>);
21
+ constructor(elementOne: UIElement | UILayer, elementTwo: UIElement, parameters?: Partial<UIFitOptions>);
22
22
  destroy(): void;
23
23
  [disableConstraintSymbol](orientation: UIOrientation): void;
24
24
  [enableConstraintSymbol](orientation: UIOrientation): void;
@@ -4,7 +4,7 @@ import { UIOrientation } from "../Miscellaneous/UIOrientation";
4
4
  import { UIConstraint } from "./UIConstraint";
5
5
  import type { UIConstraintPower } from "./UIConstraintPower";
6
6
  import type { UIConstraintRule } from "./UIConstraintRule";
7
- export interface UIHeightParameters {
7
+ export interface UIHeightOptions {
8
8
  height: number;
9
9
  power: UIConstraintPower;
10
10
  rule: UIConstraintRule;
@@ -14,7 +14,7 @@ export declare class UIHeightConstraint extends UIConstraint {
14
14
  private readonly element;
15
15
  private readonly parameters;
16
16
  private constraint?;
17
- constructor(element: UIElement, parameters?: Partial<UIHeightParameters>);
17
+ constructor(element: UIElement, parameters?: Partial<UIHeightOptions>);
18
18
  destroy(): void;
19
19
  [disableConstraintSymbol](orientation: UIOrientation): void;
20
20
  [enableConstraintSymbol](orientation: UIOrientation): void;
@@ -5,7 +5,7 @@ import { UIOrientation } from "../Miscellaneous/UIOrientation";
5
5
  import { UIConstraint } from "./UIConstraint";
6
6
  import type { UIConstraintPower } from "./UIConstraintPower";
7
7
  import type { UIConstraintRule } from "./UIConstraintRule";
8
- export interface UIHorizontalDistanceParameters {
8
+ export interface UIHorizontalDistanceOptions {
9
9
  anchorOne: number;
10
10
  anchorTwo: number;
11
11
  distance: number;
@@ -18,7 +18,7 @@ export declare class UIHorizontalDistanceConstraint extends UIConstraint {
18
18
  private readonly elementTwo;
19
19
  private readonly parameters;
20
20
  private constraint?;
21
- constructor(elementOne: UIElement | UILayer, elementTwo: UIElement, parameters?: Partial<UIHorizontalDistanceParameters>);
21
+ constructor(elementOne: UIElement | UILayer, elementTwo: UIElement, parameters?: Partial<UIHorizontalDistanceOptions>);
22
22
  destroy(): void;
23
23
  [disableConstraintSymbol](orientation: UIOrientation): void;
24
24
  [enableConstraintSymbol](orientation: UIOrientation): void;
@@ -5,7 +5,7 @@ import { UIOrientation } from "../Miscellaneous/UIOrientation";
5
5
  import { UIConstraint } from "./UIConstraint";
6
6
  import type { UIConstraintPower } from "./UIConstraintPower";
7
7
  import type { UIConstraintRule } from "./UIConstraintRule";
8
- export interface UIHorizontalProportionParameters {
8
+ export interface UIHorizontalProportionOptions {
9
9
  proportion: number;
10
10
  power: UIConstraintPower;
11
11
  rule: UIConstraintRule;
@@ -16,7 +16,7 @@ export declare class UIHorizontalProportionConstraint extends UIConstraint {
16
16
  private readonly elementTwo;
17
17
  private readonly parameters;
18
18
  private constraint?;
19
- constructor(elementOne: UIElement | UILayer, elementTwo: UIElement, parameters?: Partial<UIHorizontalProportionParameters>);
19
+ constructor(elementOne: UIElement | UILayer, elementTwo: UIElement, parameters?: Partial<UIHorizontalProportionOptions>);
20
20
  destroy(): void;
21
21
  [disableConstraintSymbol](orientation: UIOrientation): void;
22
22
  [enableConstraintSymbol](orientation: UIOrientation): void;
@@ -5,7 +5,7 @@ import { UIOrientation } from "../Miscellaneous/UIOrientation";
5
5
  import { UIConstraint } from "./UIConstraint";
6
6
  import type { UIConstraintPower } from "./UIConstraintPower";
7
7
  import type { UIConstraintRule } from "./UIConstraintRule";
8
- export interface UIVerticalDistanceParameters {
8
+ export interface UIVerticalDistanceOptions {
9
9
  anchorOne: number;
10
10
  anchorTwo: number;
11
11
  distance: number;
@@ -18,7 +18,7 @@ export declare class UIVerticalDistanceConstraint extends UIConstraint {
18
18
  private readonly elementTwo;
19
19
  private readonly parameters;
20
20
  private constraint?;
21
- constructor(elementOne: UIElement | UILayer, elementTwo: UIElement, parameters?: Partial<UIVerticalDistanceParameters>);
21
+ constructor(elementOne: UIElement | UILayer, elementTwo: UIElement, parameters?: Partial<UIVerticalDistanceOptions>);
22
22
  destroy(): void;
23
23
  [disableConstraintSymbol](orientation: UIOrientation): void;
24
24
  [enableConstraintSymbol](orientation: UIOrientation): void;
@@ -5,7 +5,7 @@ import { UIOrientation } from "../Miscellaneous/UIOrientation";
5
5
  import { UIConstraint } from "./UIConstraint";
6
6
  import type { UIConstraintPower } from "./UIConstraintPower";
7
7
  import type { UIConstraintRule } from "./UIConstraintRule";
8
- export interface UIVerticalProportionParameters {
8
+ export interface UIVerticalProportionOptions {
9
9
  proportion: number;
10
10
  power: UIConstraintPower;
11
11
  rule: UIConstraintRule;
@@ -16,7 +16,7 @@ export declare class UIVerticalProportionConstraint extends UIConstraint {
16
16
  private readonly elementTwo;
17
17
  private readonly parameters;
18
18
  private constraint?;
19
- constructor(elementOne: UIElement | UILayer, elementTwo: UIElement, parameters?: Partial<UIVerticalProportionParameters>);
19
+ constructor(elementOne: UIElement | UILayer, elementTwo: UIElement, parameters?: Partial<UIVerticalProportionOptions>);
20
20
  destroy(): void;
21
21
  [disableConstraintSymbol](orientation: UIOrientation): void;
22
22
  [enableConstraintSymbol](orientation: UIOrientation): void;
@@ -4,7 +4,7 @@ import { UIOrientation } from "../Miscellaneous/UIOrientation";
4
4
  import { UIConstraint } from "./UIConstraint";
5
5
  import type { UIConstraintPower } from "./UIConstraintPower";
6
6
  import type { UIConstraintRule } from "./UIConstraintRule";
7
- export interface UIWidthParameters {
7
+ export interface UIWidthOptions {
8
8
  width: number;
9
9
  power: UIConstraintPower;
10
10
  rule: UIConstraintRule;
@@ -14,7 +14,7 @@ export declare class UIWidthConstraint extends UIConstraint {
14
14
  private readonly element;
15
15
  private readonly parameters;
16
16
  private constraint?;
17
- constructor(element: UIElement, parameters?: Partial<UIWidthParameters>);
17
+ constructor(element: UIElement, parameters?: Partial<UIWidthOptions>);
18
18
  destroy(): void;
19
19
  [disableConstraintSymbol](orientation: UIOrientation): void;
20
20
  [enableConstraintSymbol](orientation: UIOrientation): void;
@@ -9,7 +9,6 @@ export declare class UIImage extends UIElement {
9
9
  get texture(): Texture;
10
10
  get color(): Color;
11
11
  get opacity(): number;
12
- set texture(value: Texture);
13
12
  set color(value: Color);
14
13
  set opacity(value: number);
15
14
  destroy(): void;
@@ -0,0 +1,16 @@
1
+ import type { Texture } from "three";
2
+ import type { UILayer } from "../Layers/UILayer";
3
+ import { renderSymbol } from "../Miscellaneous/symbols";
4
+ import { UIElement } from "./UIElement";
5
+ export declare class UIProgress extends UIElement {
6
+ private readonly material;
7
+ private readonly textureBackground;
8
+ private readonly textureForeground;
9
+ constructor(layer: UILayer, textureBackground: Texture, textureForeground: Texture);
10
+ get background(): Texture;
11
+ get foreground(): Texture;
12
+ get progress(): number;
13
+ set progress(value: number);
14
+ destroy(): void;
15
+ [renderSymbol](): void;
16
+ }
@@ -3,7 +3,7 @@ import type { UILayer } from "../Layers/UILayer";
3
3
  import { renderSymbol } from "../Miscellaneous/symbols";
4
4
  import { UIElement } from "./UIElement";
5
5
  import type { UITextPadding, UITextSpan, UITextStyle } from "./UITextInterfaces";
6
- export interface UITextParameters {
6
+ export interface UITextOptions {
7
7
  maxWidth: number;
8
8
  padding: Partial<UITextPadding>;
9
9
  defaultStyle: Partial<UITextStyle>;
@@ -16,7 +16,7 @@ export declare class UIText extends UIElement {
16
16
  private readonly textBlockSize;
17
17
  private readonly padding;
18
18
  private lastSuggestedAspect;
19
- constructor(layer: UILayer, spans: (UITextSpan | string)[], parameters?: Partial<UITextParameters>);
19
+ constructor(layer: UILayer, spans: (UITextSpan | string)[], parameters?: Partial<UITextOptions>);
20
20
  get color(): Color;
21
21
  get opacity(): number;
22
22
  set color(value: Color);
@@ -1,5 +1,5 @@
1
1
  import type { Texture, WebGLRenderer } from "three";
2
- export interface UIPassRenderParameters {
2
+ export interface UIPassRenderOptions {
3
3
  width: number;
4
4
  height: number;
5
5
  padding: number;
@@ -7,5 +7,5 @@ export interface UIPassRenderParameters {
7
7
  export declare abstract class UIPass {
8
8
  abstract get padding(): number;
9
9
  abstract get needsUpdate(): boolean;
10
- abstract render(renderer: WebGLRenderer, texture: Texture, parameters: UIPassRenderParameters): void;
10
+ abstract render(renderer: WebGLRenderer, texture: Texture, parameters: UIPassRenderOptions): void;
11
11
  }
@@ -0,0 +1,5 @@
1
+ import type { Texture } from "three";
2
+ import { ShaderMaterial } from "three";
3
+ export declare class UIProgressMaterial extends ShaderMaterial {
4
+ constructor(backgroundTexture: Texture, foregroundTexture: Texture);
5
+ }
package/dist/index.d.ts CHANGED
@@ -16,6 +16,7 @@ export * from "./Constraints/UIWidthConstraint";
16
16
  export * from "./Elements/UIDummy";
17
17
  export { UIElementEvent } from "./Elements/UIElement";
18
18
  export * from "./Elements/UIImage";
19
+ export * from "./Elements/UIProgress";
19
20
  export * from "./Elements/UIText";
20
21
  export * from "./Layers/UIFullScreenLayer";
21
22
  export * from "./Layers/UIManualLayer";