laymur 0.1.45 → 0.1.46

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 (33) hide show
  1. package/dist/Constraints/UIAspectConstraint.d.ts +36 -3
  2. package/dist/Constraints/UIConstraint.d.ts +23 -4
  3. package/dist/Constraints/UIConstraintPower.d.ts +44 -0
  4. package/dist/Constraints/UIConstraintRule.d.ts +37 -0
  5. package/dist/Constraints/UICoverConstraint.d.ts +48 -3
  6. package/dist/Constraints/UIFitConstraint.d.ts +48 -3
  7. package/dist/Constraints/UIHeightConstraint.d.ts +35 -3
  8. package/dist/Constraints/UIHorizontalDistanceConstraint.d.ts +38 -3
  9. package/dist/Constraints/UIHorizontalProportionConstraint.d.ts +36 -3
  10. package/dist/Constraints/UIVerticalDistanceConstraint.d.ts +38 -3
  11. package/dist/Constraints/UIVerticalProportionConstraint.d.ts +36 -3
  12. package/dist/Constraints/UIWidthConstraint.d.ts +35 -3
  13. package/dist/Elements/UIDummy.d.ts +15 -0
  14. package/dist/Elements/UIElement.d.ts +90 -3
  15. package/dist/Elements/UIImage.d.ts +33 -0
  16. package/dist/Elements/UIProgress.d.ts +84 -0
  17. package/dist/Elements/UIScene.d.ts +90 -0
  18. package/dist/Elements/UIText.d.ts +51 -1
  19. package/dist/Miscellaneous/UIMicro.d.ts +142 -0
  20. package/dist/Miscellaneous/UIMode.d.ts +20 -0
  21. package/dist/Miscellaneous/UIOrientation.d.ts +30 -0
  22. package/dist/Miscellaneous/symbols.d.ts +1 -18
  23. package/dist/Miscellaneous/textTools.d.ts +1 -1
  24. package/dist/index.d.ts +0 -2
  25. package/dist/index.js +1 -1
  26. package/dist/index.js.map +1 -1
  27. package/package.json +1 -1
  28. package/dist/Builders/UICommonDoubleElementConstraintDescriptionInterfaces.d.ts +0 -55
  29. package/dist/Builders/UICommonSingleElementConstraintDescriptionInterfaces.d.ts +0 -27
  30. package/dist/Builders/UIConstraintBuilder.d.ts +0 -14
  31. package/dist/Builders/UIElementBuilder.d.ts +0 -7
  32. package/dist/Builders/UIElementBuilderInterfaces.d.ts +0 -27
  33. /package/dist/{Elements → Miscellaneous}/UITextInterfaces.d.ts +0 -0
@@ -1,23 +1,56 @@
1
1
  import type { UIElement } from "../Elements/UIElement";
2
- import { disableConstraintSymbol, enableConstraintSymbol } from "../Miscellaneous/symbols";
3
2
  import { UIOrientation } from "../Miscellaneous/UIOrientation";
4
3
  import { UIConstraint } from "./UIConstraint";
5
4
  import type { UIConstraintPower } from "./UIConstraintPower";
6
5
  import type { UIConstraintRule } from "./UIConstraintRule";
6
+ /**
7
+ * Configuration options for aspect ratio constraints.
8
+ */
7
9
  export interface UIAspectOptions {
10
+ /** The aspect ratio to maintain (width / height) */
8
11
  aspect: number;
12
+ /** Priority level for this constraint */
9
13
  power: UIConstraintPower;
14
+ /** Rule for the constraint relationship (equal, less than, greater than) */
10
15
  rule: UIConstraintRule;
16
+ /** Screen orientation when this constraint should be active */
11
17
  orientation: UIOrientation;
12
18
  }
19
+ /**
20
+ * Constraint that maintains a specific aspect ratio for a UI element.
21
+ *
22
+ * The aspect ratio is defined as width divided by height (w/h).
23
+ * This constraint ensures that an element maintains its proportions
24
+ * during layout calculations.
25
+ */
13
26
  export declare class UIAspectConstraint extends UIConstraint {
14
27
  private readonly element;
28
+ /** The configuration options for this constraint */
15
29
  private readonly parameters;
30
+ /** The Kiwi.js constraint object */
16
31
  private constraint?;
32
+ /**
33
+ * Creates a new aspect ratio constraint.
34
+ *
35
+ * @param element - The UI element to constrain
36
+ * @param parameters - Configuration options
37
+ */
17
38
  constructor(element: UIElement, parameters?: Partial<UIAspectOptions>);
39
+ /**
40
+ * Destroys this constraint, removing it from the constraint system.
41
+ */
18
42
  destroy(): void;
19
- [disableConstraintSymbol](newOrientation: UIOrientation): void;
20
- [enableConstraintSymbol](newOrientation: UIOrientation): void;
43
+ /**
44
+ * Builds and adds the aspect ratio constraint to the constraint solver.
45
+ *
46
+ * Creates a constraint expression in the form: width - (height * aspect) = 0
47
+ * This ensures that width/height = aspect.
48
+ *
49
+ */
21
50
  protected buildConstraints(): void;
51
+ /**
52
+ * Removes the aspect ratio constraint from the constraint solver.
53
+ *
54
+ */
22
55
  protected destroyConstraints(): void;
23
56
  }
@@ -1,12 +1,31 @@
1
1
  import type { UIElement } from "../Elements/UIElement";
2
2
  import type { UILayer } from "../Layers/UILayer";
3
- import { disableConstraintSymbol, enableConstraintSymbol } from "../Miscellaneous/symbols";
4
- import type { UIOrientation } from "../Miscellaneous/UIOrientation";
3
+ /**
4
+ * Abstract base class for all UI constraints in the system.
5
+ *
6
+ * Constraints control the layout of UI elements by establishing relationships
7
+ * between their properties (position, size) and other elements or the screen.
8
+ *
9
+ * The constraint system uses Kiwi.js under the hood for solving the constraint system.
10
+ * Each constraint adds specific rules to the solver that determine element positioning.
11
+ */
5
12
  export declare abstract class UIConstraint {
6
13
  readonly layer: UILayer;
14
+ /**
15
+ * Optional identifier for the constraint.
16
+ * Useful for debugging and identifying constraints.
17
+ */
7
18
  name: string;
19
+ /**
20
+ * Creates a new UI constraint.
21
+ *
22
+ * @param layer - The UI layer that will manage this constraint
23
+ * @param elements - The set of UI elements affected by this constraint
24
+ */
8
25
  constructor(layer: UILayer, elements: Set<UIElement>);
26
+ /**
27
+ * Destroys the constraint, removing it from the layer and solver.
28
+ * This should be called when the constraint is no longer needed.
29
+ */
9
30
  destroy(): void;
10
- abstract [disableConstraintSymbol](orientation: UIOrientation): void;
11
- abstract [enableConstraintSymbol](orientation: UIOrientation): void;
12
31
  }
@@ -1,13 +1,57 @@
1
+ /**
2
+ * Defines the strength/priority levels for UI constraints.
3
+ *
4
+ * Constraints with higher power (lower index) take precedence over
5
+ * those with lower power when the constraint solver can't satisfy all constraints.
6
+ *
7
+ * The enum values map to different strength configurations in the Kiwi.js solver:
8
+ * - P0: Highest priority, "required" constraint that must be satisfied
9
+ * - P1-P7: Decreasing levels of priority
10
+ */
1
11
  export declare enum UIConstraintPower {
12
+ /** Highest priority - must be satisfied (required constraint) */
2
13
  P0 = 0,
14
+ /** Very high priority */
3
15
  P1 = 1,
16
+ /** High priority */
4
17
  P2 = 2,
18
+ /** Medium-high priority */
5
19
  P3 = 3,
20
+ /** Medium priority */
6
21
  P4 = 4,
22
+ /** Medium-low priority */
7
23
  P5 = 5,
24
+ /** Low priority */
8
25
  P6 = 6,
26
+ /** Lowest priority */
9
27
  P7 = 7
10
28
  }
29
+ /**
30
+ * Type guard to check if a value is a valid UIConstraintPower.
31
+ *
32
+ * @param obj - The value to check
33
+ * @returns True if the value is a valid UIConstraintPower enum value
34
+ */
11
35
  export declare function isUIConstraintPower(obj: unknown): obj is UIConstraintPower;
36
+ /**
37
+ * Resolves an optional power level to a definite value.
38
+ *
39
+ * @param power - The constraint power to resolve, or undefined
40
+ * @returns The provided power level, or P0 (highest) if none was provided
41
+ */
12
42
  export declare function resolvePower(power?: UIConstraintPower): UIConstraintPower;
43
+ /**
44
+ * Converts a UIConstraintPower enum value to a Kiwi.js strength value.
45
+ *
46
+ * The Kiwi.js constraint solver uses a three-tiered strength system.
47
+ * This function maps our power levels to appropriate strength values:
48
+ *
49
+ * - P0: Maximum strength in all tiers (required constraint)
50
+ * - P1-P2: Varying strengths in the first tier
51
+ * - P3-P4: Varying strengths in the second tier
52
+ * - P5-P7: Varying strengths in the third tier
53
+ *
54
+ * @param power - The constraint power to convert, or undefined
55
+ * @returns A Kiwi.js strength value corresponding to the power level
56
+ */
13
57
  export declare function convertPowerToStrength(power?: UIConstraintPower): number;
@@ -1,9 +1,46 @@
1
1
  import { Operator } from "kiwi.js";
2
+ /**
3
+ * Defines the type of relationship between values in a constraint.
4
+ *
5
+ * Maps directly to Kiwi.js Operators for the constraint solver.
6
+ * Used to specify whether values should be equal, less than, or greater than each other.
7
+ */
2
8
  export declare enum UIConstraintRule {
9
+ /**
10
+ * Values must be equal (x = y).
11
+ * Creates an equality constraint in the solver.
12
+ */
3
13
  EQUAL = 2,
14
+ /**
15
+ * Left value must be less than or equal to right value (x ≤ y).
16
+ * Creates an inequality constraint in the solver.
17
+ */
4
18
  LESS = 0,
19
+ /**
20
+ * Left value must be greater than or equal to right value (x ≥ y).
21
+ * Creates an inequality constraint in the solver.
22
+ */
5
23
  GREATER = 1
6
24
  }
25
+ /**
26
+ * Type guard to check if a value is a valid UIConstraintRule.
27
+ *
28
+ * @param obj - The value to check
29
+ * @returns True if the value is a valid UIConstraintRule enum value
30
+ */
7
31
  export declare function isUIConstraintRule(obj: unknown): obj is UIConstraintRule;
32
+ /**
33
+ * Resolves an optional rule to a definite value.
34
+ *
35
+ * @param rule - The constraint rule to resolve, or undefined
36
+ * @returns The provided rule, or EQUAL if none was provided
37
+ */
8
38
  export declare function resolveRule(rule?: UIConstraintRule): UIConstraintRule;
39
+ /**
40
+ * Converts a UIConstraintRule to the corresponding Kiwi.js Operator.
41
+ * This function provides a safe way to convert between our enum and Kiwi's enum.
42
+ *
43
+ * @param rule - The constraint rule to convert, or undefined
44
+ * @returns The corresponding Kiwi.js Operator value
45
+ */
9
46
  export declare function convertRuleToOperator(rule?: UIConstraintRule): Operator;
@@ -1,27 +1,72 @@
1
1
  import { UIElement } from "../Elements/UIElement";
2
2
  import type { UILayer } from "../Layers/UILayer";
3
- import { disableConstraintSymbol, enableConstraintSymbol } from "../Miscellaneous/symbols";
4
3
  import { UIOrientation } from "../Miscellaneous/UIOrientation";
5
4
  import { UIConstraint } from "./UIConstraint";
5
+ /**
6
+ * Configuration options for cover constraints.
7
+ */
6
8
  export interface UICoverOptions {
9
+ /** Whether to force equal height (true) or allow stretching (false) */
7
10
  isStrict: boolean;
11
+ /** Horizontal anchor point (0-1) for alignment between elements */
8
12
  horizontalAnchor: number;
13
+ /** Vertical anchor point (0-1) for alignment between elements */
9
14
  verticalAnchor: number;
15
+ /** Screen orientation when this constraint should be active */
10
16
  orientation: UIOrientation;
11
17
  }
18
+ /**
19
+ * Constraint that makes an element cover another element or layer.
20
+ *
21
+ * The covering element will:
22
+ * - Be aligned with the covered element using the specified anchors
23
+ * - Have at least the same width and height as the covered element
24
+ * - Optionally maintain strict proportions
25
+ *
26
+ * This is similar to CSS's "cover" object-fit behavior.
27
+ */
12
28
  export declare class UICoverConstraint extends UIConstraint {
13
29
  private readonly elementOne;
14
30
  private readonly elementTwo;
31
+ /** The configuration options for this constraint */
15
32
  private readonly parameters;
33
+ /** Constraint for X-axis alignment */
16
34
  private constraintX?;
35
+ /** Constraint for Y-axis alignment */
17
36
  private constraintY?;
37
+ /** Constraint for width relationship */
18
38
  private constraintW?;
39
+ /** Constraint for height relationship */
19
40
  private constraintH?;
41
+ /** Optional constraint for maintaining strict proportions */
20
42
  private constraintStrict?;
43
+ /**
44
+ * Creates a new cover constraint.
45
+ *
46
+ * @param elementOne - The element or layer to be covered (the reference)
47
+ * @param elementTwo - The element that will cover the reference
48
+ * @param parameters - Configuration options
49
+ */
21
50
  constructor(elementOne: UIElement | UILayer, elementTwo: UIElement, parameters?: Partial<UICoverOptions>);
51
+ /**
52
+ * Destroys this constraint, removing it from the constraint system.
53
+ */
22
54
  destroy(): void;
23
- [disableConstraintSymbol](orientation: UIOrientation): void;
24
- [enableConstraintSymbol](orientation: UIOrientation): void;
55
+ /**
56
+ * Builds and adds the cover constraints to the constraint solver.
57
+ *
58
+ * Creates five constraints:
59
+ * 1. X alignment between the elements
60
+ * 2. Y alignment between the elements
61
+ * 3. Width covering (elementTwo width ≥ elementOne width)
62
+ * 4. Height covering (elementTwo height ≥ elementOne height)
63
+ * 5. Optional strict proportions (if isStrict = false)
64
+ *
65
+ */
25
66
  protected buildConstraints(): void;
67
+ /**
68
+ * Removes all cover constraints from the constraint solver.
69
+ *
70
+ */
26
71
  protected destroyConstraints(): void;
27
72
  }
@@ -1,27 +1,72 @@
1
1
  import { UIElement } from "../Elements/UIElement";
2
2
  import type { UILayer } from "../Layers/UILayer";
3
- import { disableConstraintSymbol, enableConstraintSymbol } from "../Miscellaneous/symbols";
4
3
  import { UIOrientation } from "../Miscellaneous/UIOrientation";
5
4
  import { UIConstraint } from "./UIConstraint";
5
+ /**
6
+ * Configuration options for fit constraints.
7
+ */
6
8
  export interface UIFitOptions {
9
+ /** Whether to force equal height (true) or allow stretching (false) */
7
10
  isStrict: boolean;
11
+ /** Horizontal anchor point (0-1) for alignment between elements */
8
12
  horizontalAnchor: number;
13
+ /** Vertical anchor point (0-1) for alignment between elements */
9
14
  verticalAnchor: number;
15
+ /** Screen orientation when this constraint should be active */
10
16
  orientation: UIOrientation;
11
17
  }
18
+ /**
19
+ * Constraint that makes an element fit within another element or layer.
20
+ *
21
+ * The fitting element will:
22
+ * - Be aligned with the container element using the specified anchors
23
+ * - Have at most the same width and height as the container element
24
+ * - Optionally maintain strict proportions
25
+ *
26
+ * This is similar to CSS's "contain" object-fit behavior.
27
+ */
12
28
  export declare class UIFitConstraint extends UIConstraint {
13
29
  private readonly elementOne;
14
30
  private readonly elementTwo;
31
+ /** The configuration options for this constraint */
15
32
  private readonly parameters;
33
+ /** Constraint for X-axis alignment */
16
34
  private constraintX?;
35
+ /** Constraint for Y-axis alignment */
17
36
  private constraintY?;
37
+ /** Constraint for width relationship */
18
38
  private constraintW?;
39
+ /** Constraint for height relationship */
19
40
  private constraintH?;
41
+ /** Optional constraint for maintaining strict proportions */
20
42
  private constraintStrict?;
43
+ /**
44
+ * Creates a new fit constraint.
45
+ *
46
+ * @param elementOne - The element or layer that contains the fitting element (the container)
47
+ * @param elementTwo - The element that will fit within the container
48
+ * @param parameters - Configuration options
49
+ */
21
50
  constructor(elementOne: UIElement | UILayer, elementTwo: UIElement, parameters?: Partial<UIFitOptions>);
51
+ /**
52
+ * Destroys this constraint, removing it from the constraint system.
53
+ */
22
54
  destroy(): void;
23
- [disableConstraintSymbol](orientation: UIOrientation): void;
24
- [enableConstraintSymbol](orientation: UIOrientation): void;
55
+ /**
56
+ * Builds and adds the fit constraints to the constraint solver.
57
+ *
58
+ * Creates five constraints:
59
+ * 1. X alignment between the elements
60
+ * 2. Y alignment between the elements
61
+ * 3. Width fitting (elementTwo width ≤ elementOne width)
62
+ * 4. Height fitting (elementTwo height ≤ elementOne height)
63
+ * 5. Optional strict proportions (if isStrict = true)
64
+ *
65
+ */
25
66
  protected buildConstraints(): void;
67
+ /**
68
+ * Removes all fit constraints from the constraint solver.
69
+ *
70
+ */
26
71
  protected destroyConstraints(): void;
27
72
  }
@@ -1,23 +1,55 @@
1
1
  import type { UIElement } from "../Elements/UIElement";
2
- import { disableConstraintSymbol, enableConstraintSymbol } from "../Miscellaneous/symbols";
3
2
  import { UIOrientation } from "../Miscellaneous/UIOrientation";
4
3
  import { UIConstraint } from "./UIConstraint";
5
4
  import type { UIConstraintPower } from "./UIConstraintPower";
6
5
  import type { UIConstraintRule } from "./UIConstraintRule";
6
+ /**
7
+ * Configuration options for height constraints.
8
+ */
7
9
  export interface UIHeightOptions {
10
+ /** The fixed height value to constrain the element to */
8
11
  height: number;
12
+ /** Priority level for this constraint */
9
13
  power: UIConstraintPower;
14
+ /** Rule for the constraint relationship (equal, less than, greater than) */
10
15
  rule: UIConstraintRule;
16
+ /** Screen orientation when this constraint should be active */
11
17
  orientation: UIOrientation;
12
18
  }
19
+ /**
20
+ * Constraint that enforces a specific height for a UI element.
21
+ *
22
+ * This constraint can be configured to require an exact height
23
+ * or set minimum/maximum height limits using different rules.
24
+ */
13
25
  export declare class UIHeightConstraint extends UIConstraint {
14
26
  private readonly element;
27
+ /** The configuration options for this constraint */
15
28
  private readonly options;
29
+ /** The Kiwi.js constraint object */
16
30
  private constraint?;
31
+ /**
32
+ * Creates a new height constraint.
33
+ *
34
+ * @param element - The UI element to constrain
35
+ * @param options - Configuration options
36
+ */
17
37
  constructor(element: UIElement, options?: Partial<UIHeightOptions>);
38
+ /**
39
+ * Destroys this constraint, removing it from the constraint system.
40
+ */
18
41
  destroy(): void;
19
- [disableConstraintSymbol](orientation: UIOrientation): void;
20
- [enableConstraintSymbol](orientation: UIOrientation): void;
42
+ /**
43
+ * Builds and adds the height constraint to the constraint solver.
44
+ *
45
+ * Creates a constraint that enforces the element's height based
46
+ * on the specified rule (equal to, less than, or greater than).
47
+ *
48
+ */
21
49
  protected buildConstraints(): void;
50
+ /**
51
+ * Removes the height constraint from the constraint solver.
52
+ *
53
+ */
22
54
  protected destroyConstraints(): void;
23
55
  }
@@ -1,27 +1,62 @@
1
1
  import { UIElement } from "../Elements/UIElement";
2
2
  import type { UILayer } from "../Layers/UILayer";
3
- import { disableConstraintSymbol, enableConstraintSymbol } from "../Miscellaneous/symbols";
4
3
  import { UIOrientation } from "../Miscellaneous/UIOrientation";
5
4
  import { UIConstraint } from "./UIConstraint";
6
5
  import type { UIConstraintPower } from "./UIConstraintPower";
7
6
  import type { UIConstraintRule } from "./UIConstraintRule";
7
+ /**
8
+ * Configuration options for horizontal distance constraints.
9
+ */
8
10
  export interface UIHorizontalDistanceOptions {
11
+ /** Horizontal anchor point (0-1) for the first element */
9
12
  anchorOne: number;
13
+ /** Horizontal anchor point (0-1) for the second element */
10
14
  anchorTwo: number;
15
+ /** The target distance between the two elements' anchor points */
11
16
  distance: number;
17
+ /** Priority level for this constraint */
12
18
  power: UIConstraintPower;
19
+ /** Rule for the constraint relationship (equal, less than, greater than) */
13
20
  rule: UIConstraintRule;
21
+ /** Screen orientation when this constraint should be active */
14
22
  orientation: UIOrientation;
15
23
  }
24
+ /**
25
+ * Constraint that enforces a specific horizontal distance between two UI elements.
26
+ *
27
+ * This constraint measures the distance between two anchor points on the x-axis
28
+ * and ensures it matches (or is less/greater than) the specified distance value.
29
+ */
16
30
  export declare class UIHorizontalDistanceConstraint extends UIConstraint {
17
31
  private readonly elementOne;
18
32
  private readonly elementTwo;
33
+ /** The configuration options for this constraint */
19
34
  private readonly parameters;
35
+ /** The Kiwi.js constraint object */
20
36
  private constraint?;
37
+ /**
38
+ * Creates a new horizontal distance constraint.
39
+ *
40
+ * @param elementOne - The first element or layer
41
+ * @param elementTwo - The second element
42
+ * @param parameters - Configuration options
43
+ */
21
44
  constructor(elementOne: UIElement | UILayer, elementTwo: UIElement, parameters?: Partial<UIHorizontalDistanceOptions>);
45
+ /**
46
+ * Destroys this constraint, removing it from the constraint system.
47
+ */
22
48
  destroy(): void;
23
- [disableConstraintSymbol](orientation: UIOrientation): void;
24
- [enableConstraintSymbol](orientation: UIOrientation): void;
49
+ /**
50
+ * Builds and adds the horizontal distance constraint to the constraint solver.
51
+ *
52
+ * Creates a constraint that enforces the distance between anchor points
53
+ * on the x-axis of two elements based on the specified rule.
54
+ *
55
+ */
25
56
  protected buildConstraints(): void;
57
+ /**
58
+ * Removes the horizontal distance constraint from the constraint solver.
59
+ *
60
+ */
26
61
  protected destroyConstraints(): void;
27
62
  }
@@ -1,25 +1,58 @@
1
1
  import { UIElement } from "../Elements/UIElement";
2
2
  import type { UILayer } from "../Layers/UILayer";
3
- import { disableConstraintSymbol, enableConstraintSymbol } from "../Miscellaneous/symbols";
4
3
  import { UIOrientation } from "../Miscellaneous/UIOrientation";
5
4
  import { UIConstraint } from "./UIConstraint";
6
5
  import type { UIConstraintPower } from "./UIConstraintPower";
7
6
  import type { UIConstraintRule } from "./UIConstraintRule";
7
+ /**
8
+ * Configuration options for horizontal proportion constraints.
9
+ */
8
10
  export interface UIHorizontalProportionOptions {
11
+ /** The proportion ratio between elements' widths */
9
12
  proportion: number;
13
+ /** Priority level for this constraint */
10
14
  power: UIConstraintPower;
15
+ /** Rule for the constraint relationship (equal, less than, greater than) */
11
16
  rule: UIConstraintRule;
17
+ /** Screen orientation when this constraint should be active */
12
18
  orientation: UIOrientation;
13
19
  }
20
+ /**
21
+ * Constraint that enforces a proportional relationship between the widths of two elements.
22
+ *
23
+ * This constraint ensures that the width of one element is proportionally
24
+ * related to the width of another element by a specified ratio.
25
+ */
14
26
  export declare class UIHorizontalProportionConstraint extends UIConstraint {
15
27
  private readonly elementOne;
16
28
  private readonly elementTwo;
29
+ /** The configuration options for this constraint */
17
30
  private readonly parameters;
31
+ /** The Kiwi.js constraint object */
18
32
  private constraint?;
33
+ /**
34
+ * Creates a new horizontal proportion constraint.
35
+ *
36
+ * @param elementOne - The reference element or layer
37
+ * @param elementTwo - The element to constrain proportionally
38
+ * @param parameters - Configuration options
39
+ */
19
40
  constructor(elementOne: UIElement | UILayer, elementTwo: UIElement, parameters?: Partial<UIHorizontalProportionOptions>);
41
+ /**
42
+ * Destroys this constraint, removing it from the constraint system.
43
+ */
20
44
  destroy(): void;
21
- [disableConstraintSymbol](orientation: UIOrientation): void;
22
- [enableConstraintSymbol](orientation: UIOrientation): void;
45
+ /**
46
+ * Builds and adds the horizontal proportion constraint to the constraint solver.
47
+ *
48
+ * Creates a constraint expression in the form: (elementOne.width * proportion) - elementTwo.width = 0
49
+ * This ensures the width ratio between elements matches the specified proportion.
50
+ *
51
+ */
23
52
  protected buildConstraints(): void;
53
+ /**
54
+ * Removes the horizontal proportion constraint from the constraint solver.
55
+ *
56
+ */
24
57
  protected destroyConstraints(): void;
25
58
  }
@@ -1,27 +1,62 @@
1
1
  import { UIElement } from "../Elements/UIElement";
2
2
  import type { UILayer } from "../Layers/UILayer";
3
- import { disableConstraintSymbol, enableConstraintSymbol } from "../Miscellaneous/symbols";
4
3
  import { UIOrientation } from "../Miscellaneous/UIOrientation";
5
4
  import { UIConstraint } from "./UIConstraint";
6
5
  import type { UIConstraintPower } from "./UIConstraintPower";
7
6
  import type { UIConstraintRule } from "./UIConstraintRule";
7
+ /**
8
+ * Configuration options for vertical distance constraints.
9
+ */
8
10
  export interface UIVerticalDistanceOptions {
11
+ /** Vertical anchor point (0-1) for the first element */
9
12
  anchorOne: number;
13
+ /** Vertical anchor point (0-1) for the second element */
10
14
  anchorTwo: number;
15
+ /** The target distance between the two elements' anchor points */
11
16
  distance: number;
17
+ /** Priority level for this constraint */
12
18
  power: UIConstraintPower;
19
+ /** Rule for the constraint relationship (equal, less than, greater than) */
13
20
  rule: UIConstraintRule;
21
+ /** Screen orientation when this constraint should be active */
14
22
  orientation: UIOrientation;
15
23
  }
24
+ /**
25
+ * Constraint that enforces a specific vertical distance between two UI elements.
26
+ *
27
+ * This constraint measures the distance between two anchor points on the y-axis
28
+ * and ensures it matches (or is less/greater than) the specified distance value.
29
+ */
16
30
  export declare class UIVerticalDistanceConstraint extends UIConstraint {
17
31
  private readonly elementOne;
18
32
  private readonly elementTwo;
33
+ /** The configuration options for this constraint */
19
34
  private readonly parameters;
35
+ /** The Kiwi.js constraint object */
20
36
  private constraint?;
37
+ /**
38
+ * Creates a new vertical distance constraint.
39
+ *
40
+ * @param elementOne - The first element or layer
41
+ * @param elementTwo - The second element
42
+ * @param parameters - Configuration options
43
+ */
21
44
  constructor(elementOne: UIElement | UILayer, elementTwo: UIElement, parameters?: Partial<UIVerticalDistanceOptions>);
45
+ /**
46
+ * Destroys this constraint, removing it from the constraint system.
47
+ */
22
48
  destroy(): void;
23
- [disableConstraintSymbol](orientation: UIOrientation): void;
24
- [enableConstraintSymbol](orientation: UIOrientation): void;
49
+ /**
50
+ * Builds and adds the vertical distance constraint to the constraint solver.
51
+ *
52
+ * Creates a constraint that enforces the distance between anchor points
53
+ * on the y-axis of two elements based on the specified rule.
54
+ *
55
+ */
25
56
  protected buildConstraints(): void;
57
+ /**
58
+ * Removes the vertical distance constraint from the constraint solver.
59
+ *
60
+ */
26
61
  protected destroyConstraints(): void;
27
62
  }
@@ -1,25 +1,58 @@
1
1
  import { UIElement } from "../Elements/UIElement";
2
2
  import type { UILayer } from "../Layers/UILayer";
3
- import { disableConstraintSymbol, enableConstraintSymbol } from "../Miscellaneous/symbols";
4
3
  import { UIOrientation } from "../Miscellaneous/UIOrientation";
5
4
  import { UIConstraint } from "./UIConstraint";
6
5
  import type { UIConstraintPower } from "./UIConstraintPower";
7
6
  import type { UIConstraintRule } from "./UIConstraintRule";
7
+ /**
8
+ * Configuration options for vertical proportion constraints.
9
+ */
8
10
  export interface UIVerticalProportionOptions {
11
+ /** The proportion ratio between elements' heights */
9
12
  proportion: number;
13
+ /** Priority level for this constraint */
10
14
  power: UIConstraintPower;
15
+ /** Rule for the constraint relationship (equal, less than, greater than) */
11
16
  rule: UIConstraintRule;
17
+ /** Screen orientation when this constraint should be active */
12
18
  orientation: UIOrientation;
13
19
  }
20
+ /**
21
+ * Constraint that enforces a proportional relationship between the heights of two elements.
22
+ *
23
+ * This constraint ensures that the height of one element is proportionally
24
+ * related to the height of another element by a specified ratio.
25
+ */
14
26
  export declare class UIVerticalProportionConstraint extends UIConstraint {
15
27
  private readonly elementOne;
16
28
  private readonly elementTwo;
29
+ /** The configuration options for this constraint */
17
30
  private readonly parameters;
31
+ /** The Kiwi.js constraint object */
18
32
  private constraint?;
33
+ /**
34
+ * Creates a new vertical proportion constraint.
35
+ *
36
+ * @param elementOne - The reference element or layer
37
+ * @param elementTwo - The element to constrain proportionally
38
+ * @param parameters - Configuration options
39
+ */
19
40
  constructor(elementOne: UIElement | UILayer, elementTwo: UIElement, parameters?: Partial<UIVerticalProportionOptions>);
41
+ /**
42
+ * Destroys this constraint, removing it from the constraint system.
43
+ */
20
44
  destroy(): void;
21
- [disableConstraintSymbol](orientation: UIOrientation): void;
22
- [enableConstraintSymbol](orientation: UIOrientation): void;
45
+ /**
46
+ * Builds and adds the vertical proportion constraint to the constraint solver.
47
+ *
48
+ * Creates a constraint expression in the form: (elementOne.height * proportion) - elementTwo.height = 0
49
+ * This ensures the height ratio between elements matches the specified proportion.
50
+ *
51
+ */
23
52
  protected buildConstraints(): void;
53
+ /**
54
+ * Removes the vertical proportion constraint from the constraint solver.
55
+ *
56
+ */
24
57
  protected destroyConstraints(): void;
25
58
  }