laymur 0.1.71 → 0.1.73

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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { MathUtils, Vector2, Box2, Matrix3, Matrix4, ShaderMaterial, Color, AddEquation, SrcAlphaFactor, OneMinusSrcAlphaFactor, NormalBlending, CustomBlending, OneMinusDstColorFactor, OneFactor, MultiplyBlending, SubtractiveBlending, AdditiveBlending, PlaneGeometry, Scene, Mesh, OrthographicCamera, WebGLRenderTarget, UnsignedByteType, LinearFilter, RGBAFormat, NoBlending, Object3D, UniformsUtils, PerspectiveCamera, CanvasTexture } from 'three';
1
+ import { MathUtils, Vector2, Box2, Matrix3, Vector3, ShaderMaterial, Color, AddEquation, SrcAlphaFactor, OneMinusSrcAlphaFactor, NormalBlending, CustomBlending, OneMinusDstColorFactor, OneFactor, MultiplyBlending, SubtractiveBlending, AdditiveBlending, PlaneGeometry, Scene, Mesh, OrthographicCamera, WebGLRenderTarget, UnsignedByteType, LinearFilter, RGBAFormat, NoBlending, Object3D, UniformsUtils, PerspectiveCamera, CanvasTexture } from 'three';
2
2
 
3
3
  /*-----------------------------------------------------------------------------
4
4
  | Copyright (c) 2014, Nucleic Development Team.
@@ -1616,7 +1616,7 @@ function isUIOrientation(obj) {
1616
1616
  * @returns The provided orientation, or ALWAYS if none was provided
1617
1617
  */
1618
1618
  function resolveOrientation(orientation) {
1619
- return orientation !== null && orientation !== void 0 ? orientation : UIOrientation.ALWAYS;
1619
+ return orientation ?? UIOrientation.ALWAYS;
1620
1620
  }
1621
1621
 
1622
1622
  /**
@@ -1711,7 +1711,7 @@ function isUIConstraintPower(obj) {
1711
1711
  * @returns The provided power level, or P0 (highest) if none was provided
1712
1712
  */
1713
1713
  function resolvePower(power) {
1714
- return power !== null && power !== void 0 ? power : UIConstraintPower.P0;
1714
+ return power ?? UIConstraintPower.P0;
1715
1715
  }
1716
1716
  /**
1717
1717
  * Converts a UIConstraintPower enum value to a Kiwi.js strength value.
@@ -1790,7 +1790,7 @@ function isUIConstraintRule(obj) {
1790
1790
  * @returns The provided rule, or EQUAL if none was provided
1791
1791
  */
1792
1792
  function resolveRule(rule) {
1793
- return rule !== null && rule !== void 0 ? rule : UIConstraintRule.EQUAL;
1793
+ return rule ?? UIConstraintRule.EQUAL;
1794
1794
  }
1795
1795
  /**
1796
1796
  * Converts a UIConstraintRule to the corresponding Kiwi.js Operator.
@@ -1826,14 +1826,13 @@ class UIHeightConstraint extends UIConstraint {
1826
1826
  * @param options - Configuration options
1827
1827
  */
1828
1828
  constructor(_private_element, options) {
1829
- var _a;
1830
1829
  super(_private_element.layer, new Set([_private_element]));
1831
1830
  this._private_element = _private_element;
1832
1831
  this._private_options = {
1833
- height: (_a = options === null || options === void 0 ? void 0 : options.height) !== null && _a !== void 0 ? _a : _private_element.height,
1834
- power: resolvePower(options === null || options === void 0 ? void 0 : options.power),
1835
- rule: resolveRule(options === null || options === void 0 ? void 0 : options.rule),
1836
- orientation: resolveOrientation(options === null || options === void 0 ? void 0 : options.orientation),
1832
+ height: options?.height ?? _private_element.height,
1833
+ power: resolvePower(options?.power),
1834
+ rule: resolveRule(options?.rule),
1835
+ orientation: resolveOrientation(options?.orientation),
1837
1836
  };
1838
1837
  if (this._private_options.orientation === UIOrientation.ALWAYS ||
1839
1838
  this._private_options.orientation === this.layer.orientation) {
@@ -1938,8 +1937,7 @@ class UIAnchor extends i {
1938
1937
  }
1939
1938
  /** Gets the current z-index (depth) of the element */
1940
1939
  get zIndex() {
1941
- var _d, _e;
1942
- return (_e = (_d = this.object) === null || _d === void 0 ? void 0 : _d.position.z) !== null && _e !== void 0 ? _e : 0;
1940
+ return this.object?.position.z ?? 0;
1943
1941
  }
1944
1942
  /** Gets whether the element needs recalculation */
1945
1943
  get needsRecalculation() {
@@ -2018,29 +2016,30 @@ const tempMatrixB = new Matrix3();
2018
2016
  const tempMatrixC = new Matrix3();
2019
2017
  const tempMatrixD = new Matrix3();
2020
2018
  const tempMatrixE = new Matrix3();
2021
- const tempMatrixF = new Matrix3();
2022
- const tempMatrixG = new Matrix4();
2019
+ const tempVectorA = new Vector3();
2023
2020
  function applyMicroTransformations(object, micro, x, y, width, height, padding) {
2024
- const paddingFreeX = x - padding;
2025
- const paddingFreeY = y - padding;
2026
- const paddingFreeAnchorX = width * micro.anchorX;
2027
- const paddingFreeAnchorY = height * micro.anchorY;
2028
- const fullAnchorX = paddingFreeX + paddingFreeAnchorX;
2029
- const fullAnchorY = paddingFreeY + paddingFreeAnchorY;
2030
- const microAnchorMatrix = tempMatrixA.makeTranslation(-fullAnchorX, -fullAnchorY);
2031
- const microScaleMatrix = tempMatrixB.makeScale(micro.scaleX, micro.scaleY);
2032
- const microRotationMatrix = tempMatrixC.makeRotation(micro.rotation);
2033
- const microReversedAnchorMatrix = tempMatrixD.makeTranslation(paddingFreeAnchorX, paddingFreeAnchorY);
2034
- const translation = tempMatrixE.makeTranslation(x + micro.x, y + micro.y);
2035
- const combinedMatrix = tempMatrixF
2036
- .identity()
2037
- .premultiply(translation)
2038
- .premultiply(microReversedAnchorMatrix)
2039
- .premultiply(microRotationMatrix)
2040
- .premultiply(microScaleMatrix)
2041
- .premultiply(microAnchorMatrix);
2042
- const matrix4 = tempMatrixG.identity().setFromMatrix3(combinedMatrix);
2043
- matrix4.decompose(object.position, object.quaternion, object.scale);
2021
+ const realX = x - padding;
2022
+ const realY = y - padding;
2023
+ const realWidth = width + padding * 2;
2024
+ const realHeight = height + padding * 2;
2025
+ const anchorOffsetX = realWidth * micro.anchorX;
2026
+ const anchorOffsetY = realHeight * micro.anchorY;
2027
+ const centerX = realX + anchorOffsetX;
2028
+ const centerY = realY + anchorOffsetY;
2029
+ const translateToCenter = tempMatrixA.set(1, 0, -centerX, 0, 1, -centerY, 0, 0, 1);
2030
+ const scale = tempMatrixB.set(micro.scaleX, 0, 0, 0, micro.scaleY, 0, 0, 0, 1);
2031
+ const rotation = tempMatrixC.set(Math.cos(micro.rotation), -Math.sin(micro.rotation), 0, Math.sin(micro.rotation), Math.cos(micro.rotation), 0, 0, 0, 1);
2032
+ const translateFinal = tempMatrixD.set(1, 0, micro.x + centerX, 0, 1, micro.y + centerY, 0, 0, 1);
2033
+ const finalMatrix = tempMatrixE
2034
+ .multiplyMatrices(translateFinal, rotation)
2035
+ .multiply(scale)
2036
+ .multiply(translateToCenter);
2037
+ const point = tempVectorA.set(realX, realY, 1).applyMatrix3(finalMatrix);
2038
+ object.position.x = point.x;
2039
+ object.position.y = point.y;
2040
+ object.rotation.z = micro.rotation;
2041
+ object.scale.x = realWidth * micro.scaleX;
2042
+ object.scale.y = realHeight * micro.scaleY;
2044
2043
  }
2045
2044
 
2046
2045
  /**
@@ -2985,7 +2984,7 @@ class UILayer extends i {
2985
2984
  constraints: new Set(),
2986
2985
  });
2987
2986
  if (object) {
2988
- const zIndex = renderOrder !== null && renderOrder !== void 0 ? renderOrder : this.scene.children.length;
2987
+ const zIndex = renderOrder ?? this.scene.children.length;
2989
2988
  object.position.z = zIndex;
2990
2989
  object.renderOrder = zIndex;
2991
2990
  this.scene.add(object);
@@ -3052,7 +3051,6 @@ class UILayer extends i {
3052
3051
  this.constraints.delete(constraint);
3053
3052
  }
3054
3053
  [addConstraintSymbol](owner, constraint) {
3055
- var _e;
3056
3054
  const dependencies = this.constraints.get(owner);
3057
3055
  if (dependencies === undefined) {
3058
3056
  throw new Error("Before adding constraint you need to add it's owner");
@@ -3062,15 +3060,14 @@ class UILayer extends i {
3062
3060
  }
3063
3061
  dependencies.constraints.add(constraint);
3064
3062
  try {
3065
- (_e = this.solver) === null || _e === void 0 ? void 0 : _e.addConstraint(constraint);
3063
+ this.solver?.addConstraint(constraint);
3066
3064
  }
3067
- catch (_f) {
3065
+ catch {
3068
3066
  this._private_rebuildSolver();
3069
3067
  }
3070
3068
  this.needsRecalculation = true;
3071
3069
  }
3072
3070
  [removeConstraintSymbol](owner, constraint) {
3073
- var _e;
3074
3071
  const dependencies = this.constraints.get(owner);
3075
3072
  if (dependencies === undefined) {
3076
3073
  throw new Error("Before removing constraint you need to add it's owner");
@@ -3080,15 +3077,14 @@ class UILayer extends i {
3080
3077
  }
3081
3078
  dependencies.constraints.delete(constraint);
3082
3079
  try {
3083
- (_e = this.solver) === null || _e === void 0 ? void 0 : _e.removeConstraint(constraint);
3080
+ this.solver?.removeConstraint(constraint);
3084
3081
  }
3085
- catch (_f) {
3082
+ catch {
3086
3083
  this._private_rebuildSolver();
3087
3084
  }
3088
3085
  this.needsRecalculation = true;
3089
3086
  }
3090
3087
  [addVariableSymbol](owner, variable, strength) {
3091
- var _e;
3092
3088
  const dependencies = owner instanceof UIElement || owner instanceof UIAnchor
3093
3089
  ? this.elements.get(owner)
3094
3090
  : this.constraints.get(owner);
@@ -3103,15 +3099,14 @@ class UILayer extends i {
3103
3099
  suggestedValue: variable.value(),
3104
3100
  });
3105
3101
  try {
3106
- (_e = this.solver) === null || _e === void 0 ? void 0 : _e.addEditVariable(variable, strength);
3102
+ this.solver?.addEditVariable(variable, strength);
3107
3103
  }
3108
- catch (_f) {
3104
+ catch {
3109
3105
  this._private_rebuildSolver();
3110
3106
  }
3111
3107
  this.needsRecalculation = true;
3112
3108
  }
3113
3109
  [removeVariableSymbol](owner, variable) {
3114
- var _e;
3115
3110
  const dependencies = owner instanceof UIElement || owner instanceof UIAnchor
3116
3111
  ? this.elements.get(owner)
3117
3112
  : this.constraints.get(owner);
@@ -3123,15 +3118,14 @@ class UILayer extends i {
3123
3118
  }
3124
3119
  dependencies.variables.delete(variable);
3125
3120
  try {
3126
- (_e = this.solver) === null || _e === void 0 ? void 0 : _e.removeEditVariable(variable);
3121
+ this.solver?.removeEditVariable(variable);
3127
3122
  }
3128
- catch (_f) {
3123
+ catch {
3129
3124
  this._private_rebuildSolver();
3130
3125
  }
3131
3126
  this.needsRecalculation = true;
3132
3127
  }
3133
3128
  [suggestVariableSymbol](owner, variable, value) {
3134
- var _e;
3135
3129
  const dependencies = owner instanceof UIElement || owner instanceof UIAnchor
3136
3130
  ? this.elements.get(owner)
3137
3131
  : this.constraints.get(owner);
@@ -3145,9 +3139,9 @@ class UILayer extends i {
3145
3139
  if (description.suggestedValue !== value) {
3146
3140
  description.suggestedValue = value;
3147
3141
  try {
3148
- (_e = this.solver) === null || _e === void 0 ? void 0 : _e.suggestValue(variable, value);
3142
+ this.solver?.suggestValue(variable, value);
3149
3143
  }
3150
- catch (_f) {
3144
+ catch {
3151
3145
  this._private_rebuildSolver();
3152
3146
  }
3153
3147
  this.needsRecalculation = true;
@@ -3168,7 +3162,6 @@ class UILayer extends i {
3168
3162
  this.camera.updateMatrix();
3169
3163
  }
3170
3164
  render(renderer, deltaTime) {
3171
- var _e;
3172
3165
  if (this.mode === UIMode.HIDDEN) {
3173
3166
  return;
3174
3167
  }
@@ -3177,7 +3170,7 @@ class UILayer extends i {
3177
3170
  const originalClearAlpha = renderer.getClearAlpha();
3178
3171
  if (this.needsRecalculation) {
3179
3172
  this.needsRecalculation = false;
3180
- (_e = this.solver) === null || _e === void 0 ? void 0 : _e.updateVariables();
3173
+ this.solver?.updateVariables();
3181
3174
  for (const element of this.elements.keys()) {
3182
3175
  element[needsRecalculation] = true;
3183
3176
  }
@@ -3219,31 +3212,30 @@ class UILayer extends i {
3219
3212
  this.camera.updateProjectionMatrix();
3220
3213
  }
3221
3214
  rebuildLayerConstraints(width, height) {
3222
- var _e, _f, _g, _h, _j, _k, _l, _m;
3223
3215
  if (this.constraintX) {
3224
- (_e = this.solver) === null || _e === void 0 ? void 0 : _e.removeConstraint(this.constraintX);
3216
+ this.solver?.removeConstraint(this.constraintX);
3225
3217
  this.constraintX = undefined;
3226
3218
  }
3227
3219
  if (this.constraintY) {
3228
- (_f = this.solver) === null || _f === void 0 ? void 0 : _f.removeConstraint(this.constraintY);
3220
+ this.solver?.removeConstraint(this.constraintY);
3229
3221
  this.constraintY = undefined;
3230
3222
  }
3231
3223
  if (this.constraintW) {
3232
- (_g = this.solver) === null || _g === void 0 ? void 0 : _g.removeConstraint(this.constraintW);
3224
+ this.solver?.removeConstraint(this.constraintW);
3233
3225
  this.constraintW = undefined;
3234
3226
  }
3235
3227
  if (this.constraintH) {
3236
- (_h = this.solver) === null || _h === void 0 ? void 0 : _h.removeConstraint(this.constraintH);
3228
+ this.solver?.removeConstraint(this.constraintH);
3237
3229
  this.constraintH = undefined;
3238
3230
  }
3239
3231
  this.constraintX = new Constraint(new Expression(this[xSymbol]), Operator.Eq, 0, Strength.required);
3240
3232
  this.constraintY = new Constraint(new Expression(this[ySymbol]), Operator.Eq, 0, Strength.required);
3241
3233
  this.constraintW = new Constraint(new Expression(this[widthSymbol]), Operator.Eq, width, Strength.required);
3242
3234
  this.constraintH = new Constraint(new Expression(this[heightSymbol]), Operator.Eq, height, Strength.required);
3243
- (_j = this.solver) === null || _j === void 0 ? void 0 : _j.addConstraint(this.constraintX);
3244
- (_k = this.solver) === null || _k === void 0 ? void 0 : _k.addConstraint(this.constraintY);
3245
- (_l = this.solver) === null || _l === void 0 ? void 0 : _l.addConstraint(this.constraintW);
3246
- (_m = this.solver) === null || _m === void 0 ? void 0 : _m.addConstraint(this.constraintH);
3235
+ this.solver?.addConstraint(this.constraintX);
3236
+ this.solver?.addConstraint(this.constraintY);
3237
+ this.solver?.addConstraint(this.constraintW);
3238
+ this.solver?.addConstraint(this.constraintH);
3247
3239
  }
3248
3240
  updateOrientation(width, height) {
3249
3241
  const lastOrientation = this.orientationPrivate;
@@ -3334,7 +3326,8 @@ function assertSameLayer(elementOne, elementTwo, message) {
3334
3326
  }
3335
3327
  function assertSize(width, height, message) {
3336
3328
  if (width <= 0 || height <= 0) {
3337
- throw new Error(message !== null && message !== void 0 ? message : `Invalid dimensions: width (${width}) and height (${height}) must both be positive numbers greater than 0`);
3329
+ throw new Error(message ??
3330
+ `Invalid dimensions: width (${width}) and height (${height}) must both be positive numbers greater than 0`);
3338
3331
  }
3339
3332
  }
3340
3333
 
@@ -3357,7 +3350,6 @@ class UIHorizontalDistanceConstraint extends UIConstraint {
3357
3350
  * @param parameters - Configuration options
3358
3351
  */
3359
3352
  constructor(_private_elementOne, _private_elementTwo, parameters) {
3360
- var _a, _b, _c;
3361
3353
  assertSameLayer(_private_elementOne, _private_elementTwo);
3362
3354
  super(_private_elementTwo.layer, new Set(_private_elementOne instanceof UIElement || _private_elementOne instanceof UIAnchor
3363
3355
  ? [_private_elementOne, _private_elementTwo]
@@ -3365,12 +3357,12 @@ class UIHorizontalDistanceConstraint extends UIConstraint {
3365
3357
  this._private_elementOne = _private_elementOne;
3366
3358
  this._private_elementTwo = _private_elementTwo;
3367
3359
  this._private_parameters = {
3368
- anchorOne: (_a = parameters === null || parameters === void 0 ? void 0 : parameters.anchorOne) !== null && _a !== void 0 ? _a : DEFAULT_ANCHOR$3,
3369
- anchorTwo: (_b = parameters === null || parameters === void 0 ? void 0 : parameters.anchorTwo) !== null && _b !== void 0 ? _b : DEFAULT_ANCHOR$3,
3370
- distance: (_c = parameters === null || parameters === void 0 ? void 0 : parameters.distance) !== null && _c !== void 0 ? _c : 0,
3371
- power: resolvePower(parameters === null || parameters === void 0 ? void 0 : parameters.power),
3372
- rule: resolveRule(parameters === null || parameters === void 0 ? void 0 : parameters.rule),
3373
- orientation: resolveOrientation(parameters === null || parameters === void 0 ? void 0 : parameters.orientation),
3360
+ anchorOne: parameters?.anchorOne ?? DEFAULT_ANCHOR$3,
3361
+ anchorTwo: parameters?.anchorTwo ?? DEFAULT_ANCHOR$3,
3362
+ distance: parameters?.distance ?? 0,
3363
+ power: resolvePower(parameters?.power),
3364
+ rule: resolveRule(parameters?.rule),
3365
+ orientation: resolveOrientation(parameters?.orientation),
3374
3366
  };
3375
3367
  if (this._private_parameters.orientation === UIOrientation.ALWAYS ||
3376
3368
  this._private_parameters.orientation === this.layer.orientation) {
@@ -3452,7 +3444,6 @@ class UIHorizontalProportionConstraint extends UIConstraint {
3452
3444
  * @param parameters - Configuration options
3453
3445
  */
3454
3446
  constructor(_private_elementOne, _private_elementTwo, parameters) {
3455
- var _a;
3456
3447
  assertSameLayer(_private_elementOne, _private_elementTwo);
3457
3448
  super(_private_elementTwo.layer, new Set(_private_elementOne instanceof UIElement
3458
3449
  ? [_private_elementOne, _private_elementTwo]
@@ -3460,10 +3451,10 @@ class UIHorizontalProportionConstraint extends UIConstraint {
3460
3451
  this._private_elementOne = _private_elementOne;
3461
3452
  this._private_elementTwo = _private_elementTwo;
3462
3453
  this._private_parameters = {
3463
- proportion: (_a = parameters === null || parameters === void 0 ? void 0 : parameters.proportion) !== null && _a !== void 0 ? _a : 1,
3464
- power: resolvePower(parameters === null || parameters === void 0 ? void 0 : parameters.power),
3465
- rule: resolveRule(parameters === null || parameters === void 0 ? void 0 : parameters.rule),
3466
- orientation: resolveOrientation(parameters === null || parameters === void 0 ? void 0 : parameters.orientation),
3454
+ proportion: parameters?.proportion ?? 1,
3455
+ power: resolvePower(parameters?.power),
3456
+ rule: resolveRule(parameters?.rule),
3457
+ orientation: resolveOrientation(parameters?.orientation),
3467
3458
  };
3468
3459
  if (this._private_parameters.orientation === UIOrientation.ALWAYS ||
3469
3460
  this._private_parameters.orientation === this.layer.orientation) {
@@ -3545,7 +3536,6 @@ class UIVerticalDistanceConstraint extends UIConstraint {
3545
3536
  * @param parameters - Configuration options
3546
3537
  */
3547
3538
  constructor(_private_elementOne, _private_elementTwo, parameters) {
3548
- var _a, _b, _c;
3549
3539
  assertSameLayer(_private_elementOne, _private_elementTwo);
3550
3540
  super(_private_elementTwo.layer, new Set(_private_elementOne instanceof UIElement || _private_elementOne instanceof UIAnchor
3551
3541
  ? [_private_elementOne, _private_elementTwo]
@@ -3553,12 +3543,12 @@ class UIVerticalDistanceConstraint extends UIConstraint {
3553
3543
  this._private_elementOne = _private_elementOne;
3554
3544
  this._private_elementTwo = _private_elementTwo;
3555
3545
  this._private_parameters = {
3556
- anchorOne: (_a = parameters === null || parameters === void 0 ? void 0 : parameters.anchorOne) !== null && _a !== void 0 ? _a : DEFAULT_ANCHOR$2,
3557
- anchorTwo: (_b = parameters === null || parameters === void 0 ? void 0 : parameters.anchorTwo) !== null && _b !== void 0 ? _b : DEFAULT_ANCHOR$2,
3558
- distance: (_c = parameters === null || parameters === void 0 ? void 0 : parameters.distance) !== null && _c !== void 0 ? _c : 0,
3559
- power: resolvePower(parameters === null || parameters === void 0 ? void 0 : parameters.power),
3560
- rule: resolveRule(parameters === null || parameters === void 0 ? void 0 : parameters.rule),
3561
- orientation: resolveOrientation(parameters === null || parameters === void 0 ? void 0 : parameters.orientation),
3546
+ anchorOne: parameters?.anchorOne ?? DEFAULT_ANCHOR$2,
3547
+ anchorTwo: parameters?.anchorTwo ?? DEFAULT_ANCHOR$2,
3548
+ distance: parameters?.distance ?? 0,
3549
+ power: resolvePower(parameters?.power),
3550
+ rule: resolveRule(parameters?.rule),
3551
+ orientation: resolveOrientation(parameters?.orientation),
3562
3552
  };
3563
3553
  if (this._private_parameters.orientation === UIOrientation.ALWAYS ||
3564
3554
  this._private_parameters.orientation === this.layer.orientation) {
@@ -3640,7 +3630,6 @@ class UIVerticalProportionConstraint extends UIConstraint {
3640
3630
  * @param parameters - Configuration options
3641
3631
  */
3642
3632
  constructor(_private_elementOne, _private_elementTwo, parameters) {
3643
- var _a;
3644
3633
  assertSameLayer(_private_elementOne, _private_elementTwo);
3645
3634
  super(_private_elementTwo.layer, new Set(_private_elementOne instanceof UIElement
3646
3635
  ? [_private_elementOne, _private_elementTwo]
@@ -3648,10 +3637,10 @@ class UIVerticalProportionConstraint extends UIConstraint {
3648
3637
  this._private_elementOne = _private_elementOne;
3649
3638
  this._private_elementTwo = _private_elementTwo;
3650
3639
  this._private_parameters = {
3651
- proportion: (_a = parameters === null || parameters === void 0 ? void 0 : parameters.proportion) !== null && _a !== void 0 ? _a : 1,
3652
- power: resolvePower(parameters === null || parameters === void 0 ? void 0 : parameters.power),
3653
- rule: resolveRule(parameters === null || parameters === void 0 ? void 0 : parameters.rule),
3654
- orientation: resolveOrientation(parameters === null || parameters === void 0 ? void 0 : parameters.orientation),
3640
+ proportion: parameters?.proportion ?? 1,
3641
+ power: resolvePower(parameters?.power),
3642
+ rule: resolveRule(parameters?.rule),
3643
+ orientation: resolveOrientation(parameters?.orientation),
3655
3644
  };
3656
3645
  if (this._private_parameters.orientation === UIOrientation.ALWAYS ||
3657
3646
  this._private_parameters.orientation === this.layer.orientation) {
@@ -3728,14 +3717,13 @@ class UIWidthConstraint extends UIConstraint {
3728
3717
  * @param options - Configuration options
3729
3718
  */
3730
3719
  constructor(_private_element, options) {
3731
- var _a;
3732
3720
  super(_private_element.layer, new Set([_private_element]));
3733
3721
  this._private_element = _private_element;
3734
3722
  this._private_options = {
3735
- width: (_a = options === null || options === void 0 ? void 0 : options.width) !== null && _a !== void 0 ? _a : _private_element.width,
3736
- power: resolvePower(options === null || options === void 0 ? void 0 : options.power),
3737
- rule: resolveRule(options === null || options === void 0 ? void 0 : options.rule),
3738
- orientation: resolveOrientation(options === null || options === void 0 ? void 0 : options.orientation),
3723
+ width: options?.width ?? _private_element.width,
3724
+ power: resolvePower(options?.power),
3725
+ rule: resolveRule(options?.rule),
3726
+ orientation: resolveOrientation(options?.orientation),
3739
3727
  };
3740
3728
  if (this._private_options.orientation === UIOrientation.ALWAYS ||
3741
3729
  this._private_options.orientation === this.layer.orientation) {
@@ -3798,57 +3786,54 @@ class UIWidthConstraint extends UIConstraint {
3798
3786
 
3799
3787
  class UIConstraint2DBuilder {
3800
3788
  static size(element, options = {}) {
3801
- var _a, _b, _c, _d, _e, _f, _g, _h;
3802
3789
  return {
3803
3790
  x: new UIWidthConstraint(element, {
3804
- width: (_a = options.size) === null || _a === void 0 ? void 0 : _a.x,
3805
- power: (_b = options.power) === null || _b === void 0 ? void 0 : _b.x,
3806
- rule: (_c = options.rule) === null || _c === void 0 ? void 0 : _c.x,
3807
- orientation: (_d = options.orientation) === null || _d === void 0 ? void 0 : _d.x,
3791
+ width: options.size?.x,
3792
+ power: options.power?.x,
3793
+ rule: options.rule?.x,
3794
+ orientation: options.orientation?.x,
3808
3795
  }),
3809
3796
  y: new UIHeightConstraint(element, {
3810
- height: (_e = options.size) === null || _e === void 0 ? void 0 : _e.y,
3811
- power: (_f = options.power) === null || _f === void 0 ? void 0 : _f.y,
3812
- rule: (_g = options.rule) === null || _g === void 0 ? void 0 : _g.y,
3813
- orientation: (_h = options.orientation) === null || _h === void 0 ? void 0 : _h.y,
3797
+ height: options.size?.y,
3798
+ power: options.power?.y,
3799
+ rule: options.rule?.y,
3800
+ orientation: options.orientation?.y,
3814
3801
  }),
3815
3802
  };
3816
3803
  }
3817
3804
  static distance(elementOne, elementTwo, options = {}) {
3818
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
3819
3805
  return {
3820
3806
  x: new UIHorizontalDistanceConstraint(elementOne, elementTwo, {
3821
- anchorOne: (_a = options.anchorOne) === null || _a === void 0 ? void 0 : _a.x,
3822
- anchorTwo: (_b = options.anchorTwo) === null || _b === void 0 ? void 0 : _b.x,
3823
- distance: (_c = options.distance) === null || _c === void 0 ? void 0 : _c.x,
3824
- power: (_d = options.power) === null || _d === void 0 ? void 0 : _d.x,
3825
- rule: (_e = options.rule) === null || _e === void 0 ? void 0 : _e.x,
3826
- orientation: (_f = options.orientation) === null || _f === void 0 ? void 0 : _f.x,
3807
+ anchorOne: options.anchorOne?.x,
3808
+ anchorTwo: options.anchorTwo?.x,
3809
+ distance: options.distance?.x,
3810
+ power: options.power?.x,
3811
+ rule: options.rule?.x,
3812
+ orientation: options.orientation?.x,
3827
3813
  }),
3828
3814
  y: new UIVerticalDistanceConstraint(elementOne, elementTwo, {
3829
- anchorOne: (_g = options.anchorOne) === null || _g === void 0 ? void 0 : _g.y,
3830
- anchorTwo: (_h = options.anchorTwo) === null || _h === void 0 ? void 0 : _h.y,
3831
- distance: (_j = options.distance) === null || _j === void 0 ? void 0 : _j.y,
3832
- power: (_k = options.power) === null || _k === void 0 ? void 0 : _k.y,
3833
- rule: (_l = options.rule) === null || _l === void 0 ? void 0 : _l.y,
3834
- orientation: (_m = options.orientation) === null || _m === void 0 ? void 0 : _m.y,
3815
+ anchorOne: options.anchorOne?.y,
3816
+ anchorTwo: options.anchorTwo?.y,
3817
+ distance: options.distance?.y,
3818
+ power: options.power?.y,
3819
+ rule: options.rule?.y,
3820
+ orientation: options.orientation?.y,
3835
3821
  }),
3836
3822
  };
3837
3823
  }
3838
3824
  static proportion(elementOne, elementTwo, options = {}) {
3839
- var _a, _b, _c, _d, _e, _f, _g, _h;
3840
3825
  return {
3841
3826
  x: new UIHorizontalProportionConstraint(elementOne, elementTwo, {
3842
- proportion: (_a = options.proportion) === null || _a === void 0 ? void 0 : _a.x,
3843
- power: (_b = options.power) === null || _b === void 0 ? void 0 : _b.x,
3844
- rule: (_c = options.rule) === null || _c === void 0 ? void 0 : _c.x,
3845
- orientation: (_d = options.orientation) === null || _d === void 0 ? void 0 : _d.x,
3827
+ proportion: options.proportion?.x,
3828
+ power: options.power?.x,
3829
+ rule: options.rule?.x,
3830
+ orientation: options.orientation?.x,
3846
3831
  }),
3847
3832
  y: new UIVerticalProportionConstraint(elementOne, elementTwo, {
3848
- proportion: (_e = options.proportion) === null || _e === void 0 ? void 0 : _e.y,
3849
- power: (_f = options.power) === null || _f === void 0 ? void 0 : _f.y,
3850
- rule: (_g = options.rule) === null || _g === void 0 ? void 0 : _g.y,
3851
- orientation: (_h = options.orientation) === null || _h === void 0 ? void 0 : _h.y,
3833
+ proportion: options.proportion?.y,
3834
+ power: options.power?.y,
3835
+ rule: options.rule?.y,
3836
+ orientation: options.orientation?.y,
3852
3837
  }),
3853
3838
  };
3854
3839
  }
@@ -3861,8 +3846,7 @@ var UIConstraintContainerDirection;
3861
3846
  })(UIConstraintContainerDirection || (UIConstraintContainerDirection = {}));
3862
3847
  class UIConstraintContainerBuilder {
3863
3848
  static build(container, elementOne, elementTwo, options = {}) {
3864
- var _a;
3865
- const direction = (_a = options.direction) !== null && _a !== void 0 ? _a : UIConstraintContainerDirection.FROM_LEFT_TOP;
3849
+ const direction = options.direction ?? UIConstraintContainerDirection.FROM_LEFT_TOP;
3866
3850
  const horizontalDistances = [];
3867
3851
  const verticalDistances = [];
3868
3852
  horizontalDistances.push(new UIHorizontalDistanceConstraint(container, elementOne, {
@@ -3967,14 +3951,13 @@ class UIAspectConstraint extends UIConstraint {
3967
3951
  * @param parameters - Configuration options
3968
3952
  */
3969
3953
  constructor(_private_element, parameters) {
3970
- var _a;
3971
3954
  super(_private_element.layer, new Set([_private_element]));
3972
3955
  this._private_element = _private_element;
3973
3956
  this._private_parameters = {
3974
- aspect: (_a = parameters === null || parameters === void 0 ? void 0 : parameters.aspect) !== null && _a !== void 0 ? _a : this._private_element.width / this._private_element.height,
3975
- power: resolvePower(parameters === null || parameters === void 0 ? void 0 : parameters.power),
3976
- rule: resolveRule(parameters === null || parameters === void 0 ? void 0 : parameters.rule),
3977
- orientation: resolveOrientation(parameters === null || parameters === void 0 ? void 0 : parameters.orientation),
3957
+ aspect: parameters?.aspect ?? this._private_element.width / this._private_element.height,
3958
+ power: resolvePower(parameters?.power),
3959
+ rule: resolveRule(parameters?.rule),
3960
+ orientation: resolveOrientation(parameters?.orientation),
3978
3961
  };
3979
3962
  if (this._private_parameters.orientation === UIOrientation.ALWAYS ||
3980
3963
  this._private_parameters.orientation === this.layer.orientation) {
@@ -4059,7 +4042,6 @@ class UICoverConstraint extends UIConstraint {
4059
4042
  * @param parameters - Configuration options
4060
4043
  */
4061
4044
  constructor(_private_elementOne, _private_elementTwo, parameters) {
4062
- var _a, _b, _c;
4063
4045
  assertSameLayer(_private_elementOne, _private_elementTwo);
4064
4046
  super(_private_elementTwo.layer, new Set(_private_elementOne instanceof UIElement
4065
4047
  ? [_private_elementOne, _private_elementTwo]
@@ -4067,10 +4049,10 @@ class UICoverConstraint extends UIConstraint {
4067
4049
  this._private_elementOne = _private_elementOne;
4068
4050
  this._private_elementTwo = _private_elementTwo;
4069
4051
  this._private_parameters = {
4070
- isStrict: (_a = parameters === null || parameters === void 0 ? void 0 : parameters.isStrict) !== null && _a !== void 0 ? _a : true,
4071
- horizontalAnchor: (_b = parameters === null || parameters === void 0 ? void 0 : parameters.horizontalAnchor) !== null && _b !== void 0 ? _b : DEFAULT_ANCHOR$1,
4072
- verticalAnchor: (_c = parameters === null || parameters === void 0 ? void 0 : parameters.verticalAnchor) !== null && _c !== void 0 ? _c : DEFAULT_ANCHOR$1,
4073
- orientation: resolveOrientation(parameters === null || parameters === void 0 ? void 0 : parameters.orientation),
4052
+ isStrict: parameters?.isStrict ?? true,
4053
+ horizontalAnchor: parameters?.horizontalAnchor ?? DEFAULT_ANCHOR$1,
4054
+ verticalAnchor: parameters?.verticalAnchor ?? DEFAULT_ANCHOR$1,
4055
+ orientation: resolveOrientation(parameters?.orientation),
4074
4056
  };
4075
4057
  if (this._private_parameters.orientation === UIOrientation.ALWAYS ||
4076
4058
  this._private_parameters.orientation === this.layer.orientation) {
@@ -4184,7 +4166,6 @@ class UIFitConstraint extends UIConstraint {
4184
4166
  * @param parameters - Configuration options
4185
4167
  */
4186
4168
  constructor(_private_elementOne, _private_elementTwo, parameters) {
4187
- var _a, _b, _c;
4188
4169
  super(_private_elementTwo.layer, new Set(_private_elementOne instanceof UIElement
4189
4170
  ? [_private_elementOne, _private_elementTwo]
4190
4171
  : [_private_elementTwo]));
@@ -4192,10 +4173,10 @@ class UIFitConstraint extends UIConstraint {
4192
4173
  this._private_elementTwo = _private_elementTwo;
4193
4174
  assertSameLayer(_private_elementOne, _private_elementTwo);
4194
4175
  this._private_parameters = {
4195
- isStrict: (_a = parameters === null || parameters === void 0 ? void 0 : parameters.isStrict) !== null && _a !== void 0 ? _a : true,
4196
- horizontalAnchor: (_b = parameters === null || parameters === void 0 ? void 0 : parameters.horizontalAnchor) !== null && _b !== void 0 ? _b : DEFAULT_ANCHOR,
4197
- verticalAnchor: (_c = parameters === null || parameters === void 0 ? void 0 : parameters.verticalAnchor) !== null && _c !== void 0 ? _c : DEFAULT_ANCHOR,
4198
- orientation: resolveOrientation(parameters === null || parameters === void 0 ? void 0 : parameters.orientation),
4176
+ isStrict: parameters?.isStrict ?? true,
4177
+ horizontalAnchor: parameters?.horizontalAnchor ?? DEFAULT_ANCHOR,
4178
+ verticalAnchor: parameters?.verticalAnchor ?? DEFAULT_ANCHOR,
4179
+ orientation: resolveOrientation(parameters?.orientation),
4199
4180
  };
4200
4181
  if (this._private_parameters.orientation === UIOrientation.ALWAYS ||
4201
4182
  this._private_parameters.orientation === this.layer.orientation) {
@@ -4328,9 +4309,8 @@ class UIImage extends UIElement {
4328
4309
  * @throws Error if the texture has invalid dimensions
4329
4310
  */
4330
4311
  constructor(layer, texture) {
4331
- var _a, _b;
4332
- const width = (_a = texture.image) === null || _a === void 0 ? void 0 : _a.width;
4333
- const height = (_b = texture.image) === null || _b === void 0 ? void 0 : _b.height;
4312
+ const width = texture.image?.width;
4313
+ const height = texture.image?.height;
4334
4314
  assertSize(width, height, `Invalid image dimensions - texture "${texture.name || "unnamed"}" has invalid width (${width}) or height (${height}). Image dimensions must be non-zero positive numbers.`);
4335
4315
  const material = new UIMaterial(texture);
4336
4316
  const object = new Mesh(geometry, material);
@@ -4562,12 +4542,11 @@ class UIProgress extends UIElement {
4562
4542
  * @throws Error if either texture has invalid dimensions
4563
4543
  */
4564
4544
  constructor(layer, textureForeground, options = {}) {
4565
- var _a, _b, _c, _d, _e, _f;
4566
- const foregroundWidth = (_a = textureForeground.image) === null || _a === void 0 ? void 0 : _a.width;
4567
- const foregroundHeight = (_b = textureForeground.image) === null || _b === void 0 ? void 0 : _b.height;
4545
+ const foregroundWidth = textureForeground.image?.width;
4546
+ const foregroundHeight = textureForeground.image?.height;
4568
4547
  assertSize(foregroundWidth, foregroundHeight, `Invalid image dimensions - texture "${textureForeground.name || "unnamed"}" has invalid width (${foregroundWidth}) or height (${foregroundHeight}). Image dimensions must be non-zero positive numbers.`);
4569
- const backgroundWidth = (_d = (_c = options.textureBackground) === null || _c === void 0 ? void 0 : _c.image) === null || _d === void 0 ? void 0 : _d.width;
4570
- const backgroundHeight = (_f = (_e = options.textureBackground) === null || _e === void 0 ? void 0 : _e.image) === null || _f === void 0 ? void 0 : _f.height;
4548
+ const backgroundWidth = options.textureBackground?.image?.width;
4549
+ const backgroundHeight = options.textureBackground?.image?.height;
4571
4550
  if (options.textureBackground) {
4572
4551
  assertSize(backgroundWidth, backgroundHeight, `Invalid image dimensions - texture "${options.textureBackground.name || "unnamed"}" has invalid width (${backgroundWidth}) or height (${backgroundHeight}). Image dimensions must be non-zero positive numbers.`);
4573
4552
  }
@@ -4600,8 +4579,8 @@ class UIProgress extends UIElement {
4600
4579
  if (options.foregroundOpacity) {
4601
4580
  material.setForegroundOpacity(options.foregroundOpacity);
4602
4581
  }
4603
- const imageWidth = backgroundWidth !== null && backgroundWidth !== void 0 ? backgroundWidth : foregroundWidth;
4604
- const imageHeight = foregroundHeight !== null && foregroundHeight !== void 0 ? foregroundHeight : backgroundHeight;
4582
+ const imageWidth = backgroundWidth ?? foregroundWidth;
4583
+ const imageHeight = foregroundHeight ?? backgroundHeight;
4605
4584
  super(layer, object, 0, 0, imageWidth, imageHeight);
4606
4585
  this._private_material = material;
4607
4586
  this._private_imageWidth = imageWidth;
@@ -4794,21 +4773,20 @@ class UIScene extends UIElement {
4794
4773
  * @throws Error if resolution factor is out of valid range or dimensions are invalid
4795
4774
  */
4796
4775
  constructor(layer, options = {}) {
4797
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
4798
- const resolutionFactor = (_a = options.resolutionFactor) !== null && _a !== void 0 ? _a : DEFAULT_RESOLUTION_FACTOR;
4776
+ const resolutionFactor = options.resolutionFactor ?? DEFAULT_RESOLUTION_FACTOR;
4799
4777
  if (resolutionFactor < MIN_RESOLUTION_FACTOR ||
4800
4778
  resolutionFactor > MAX_RESOLUTION_FACTOR) {
4801
4779
  throw new Error(`Invalid resolution factor: ${resolutionFactor}. Must be between ${MIN_RESOLUTION_FACTOR} and ${MAX_RESOLUTION_FACTOR}.`);
4802
4780
  }
4803
- const width = (_b = options.width) !== null && _b !== void 0 ? _b : DEFAULT_WIDTH;
4804
- const height = (_c = options.height) !== null && _c !== void 0 ? _c : DEFAULT_HEIGHT;
4781
+ const width = options.width ?? DEFAULT_WIDTH;
4782
+ const height = options.height ?? DEFAULT_HEIGHT;
4805
4783
  assertSize(width, height, `Invalid width or height: ${width}x${height}. Must be positive.`);
4806
4784
  const renderTarget = new WebGLRenderTarget(width * resolutionFactor, height * resolutionFactor, {
4807
4785
  format: RGBAFormat,
4808
4786
  minFilter: LinearFilter,
4809
4787
  magFilter: LinearFilter,
4810
4788
  type: UnsignedByteType,
4811
- depthBuffer: (_d = options.useDepth) !== null && _d !== void 0 ? _d : DEFAULT_USE_DEPTH,
4789
+ depthBuffer: options.useDepth ?? DEFAULT_USE_DEPTH,
4812
4790
  stencilBuffer: false,
4813
4791
  });
4814
4792
  const material = new UIMaterial(renderTarget.texture);
@@ -4816,16 +4794,17 @@ class UIScene extends UIElement {
4816
4794
  super(layer, object, 0, 0, width, height);
4817
4795
  /** Whether the scene needs to be re-rendered on the next frame */
4818
4796
  this._private_needsRenderInternal = false;
4819
- this._private_sceneInternal = (_e = options.scene) !== null && _e !== void 0 ? _e : new Scene();
4797
+ this._private_sceneInternal = options.scene ?? new Scene();
4820
4798
  this._private_cameraInternal =
4821
- (_f = options.camera) !== null && _f !== void 0 ? _f : new PerspectiveCamera(DEFAULT_FOV, width / height, DEFAULT_NEAR, DEFAULT_FAR);
4799
+ options.camera ??
4800
+ new PerspectiveCamera(DEFAULT_FOV, width / height, DEFAULT_NEAR, DEFAULT_FAR);
4822
4801
  this._private_resolutionFactorInternal = resolutionFactor;
4823
- this._private_updateModeInternal = (_g = options.updateBehavior) !== null && _g !== void 0 ? _g : DEFAULT_UPDATE_MODE;
4824
- if ((_h = options.renderedByDefault) !== null && _h !== void 0 ? _h : DEFAULT_RENDERED_BY_DEFAULT) {
4802
+ this._private_updateModeInternal = options.updateBehavior ?? DEFAULT_UPDATE_MODE;
4803
+ if (options.renderedByDefault ?? DEFAULT_RENDERED_BY_DEFAULT) {
4825
4804
  this._private_needsRenderInternal = true;
4826
4805
  }
4827
- this._private_clearColorInternal = (_j = options.clearColor) !== null && _j !== void 0 ? _j : DEFAULT_CLEAR_COLOR;
4828
- this._private_clearAlphaInternal = (_k = options.clearAlpha) !== null && _k !== void 0 ? _k : DEFAULT_CLEAR_ALPHA;
4806
+ this._private_clearColorInternal = options.clearColor ?? DEFAULT_CLEAR_COLOR;
4807
+ this._private_clearAlphaInternal = options.clearAlpha ?? DEFAULT_CLEAR_ALPHA;
4829
4808
  this._private_renderTarget = renderTarget;
4830
4809
  this._private_material = material;
4831
4810
  this.applyTransformations();
@@ -4979,7 +4958,6 @@ class UIScene extends UIElement {
4979
4958
  }
4980
4959
 
4981
4960
  function resolvePadding(padding) {
4982
- var _a, _b, _c, _d;
4983
4961
  if (typeof padding === "number") {
4984
4962
  return {
4985
4963
  left: padding,
@@ -4989,32 +4967,31 @@ function resolvePadding(padding) {
4989
4967
  };
4990
4968
  }
4991
4969
  return {
4992
- left: Math.max((_a = padding === null || padding === void 0 ? void 0 : padding.left) !== null && _a !== void 0 ? _a : 0, 0),
4993
- right: Math.max((_b = padding === null || padding === void 0 ? void 0 : padding.right) !== null && _b !== void 0 ? _b : 0, 0),
4994
- top: Math.max((_c = padding === null || padding === void 0 ? void 0 : padding.top) !== null && _c !== void 0 ? _c : 0, 0),
4995
- bottom: Math.max((_d = padding === null || padding === void 0 ? void 0 : padding.bottom) !== null && _d !== void 0 ? _d : 0, 0),
4970
+ left: Math.max(padding?.left ?? 0, 0),
4971
+ right: Math.max(padding?.right ?? 0, 0),
4972
+ top: Math.max(padding?.top ?? 0, 0),
4973
+ bottom: Math.max(padding?.bottom ?? 0, 0),
4996
4974
  };
4997
4975
  }
4998
4976
  function resolveTextStyle(currentStyle, baseStyle) {
4999
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3;
5000
- const fontSize = Math.max((_b = (_a = currentStyle === null || currentStyle === void 0 ? void 0 : currentStyle.fontSize) !== null && _a !== void 0 ? _a : baseStyle === null || baseStyle === void 0 ? void 0 : baseStyle.fontSize) !== null && _b !== void 0 ? _b : 16, 1);
5001
- const lineHeight = (_d = (_c = currentStyle === null || currentStyle === void 0 ? void 0 : currentStyle.lineHeight) !== null && _c !== void 0 ? _c : baseStyle === null || baseStyle === void 0 ? void 0 : baseStyle.lineHeight) !== null && _d !== void 0 ? _d : fontSize * 1.2;
5002
- const shadowBlur = Math.max((_f = (_e = currentStyle === null || currentStyle === void 0 ? void 0 : currentStyle.shadowBlur) !== null && _e !== void 0 ? _e : baseStyle === null || baseStyle === void 0 ? void 0 : baseStyle.shadowBlur) !== null && _f !== void 0 ? _f : 0, 0);
5003
- const strokeWidth = Math.max((_h = (_g = currentStyle === null || currentStyle === void 0 ? void 0 : currentStyle.strokeWidth) !== null && _g !== void 0 ? _g : baseStyle === null || baseStyle === void 0 ? void 0 : baseStyle.strokeWidth) !== null && _h !== void 0 ? _h : 0, 0);
4977
+ const fontSize = Math.max(currentStyle?.fontSize ?? baseStyle?.fontSize ?? 16, 1);
4978
+ const lineHeight = currentStyle?.lineHeight ?? baseStyle?.lineHeight ?? fontSize * 1.2;
4979
+ const shadowBlur = Math.max(currentStyle?.shadowBlur ?? baseStyle?.shadowBlur ?? 0, 0);
4980
+ const strokeWidth = Math.max(currentStyle?.strokeWidth ?? baseStyle?.strokeWidth ?? 0, 0);
5004
4981
  return {
5005
- color: (_k = (_j = currentStyle === null || currentStyle === void 0 ? void 0 : currentStyle.color) !== null && _j !== void 0 ? _j : baseStyle === null || baseStyle === void 0 ? void 0 : baseStyle.color) !== null && _k !== void 0 ? _k : "#000000",
5006
- fontFamily: (_m = (_l = currentStyle === null || currentStyle === void 0 ? void 0 : currentStyle.fontFamily) !== null && _l !== void 0 ? _l : baseStyle === null || baseStyle === void 0 ? void 0 : baseStyle.fontFamily) !== null && _m !== void 0 ? _m : "Arial",
4982
+ color: currentStyle?.color ?? baseStyle?.color ?? "#000000",
4983
+ fontFamily: currentStyle?.fontFamily ?? baseStyle?.fontFamily ?? "Arial",
5007
4984
  fontSize,
5008
- fontStyle: (_p = (_o = currentStyle === null || currentStyle === void 0 ? void 0 : currentStyle.fontStyle) !== null && _o !== void 0 ? _o : baseStyle === null || baseStyle === void 0 ? void 0 : baseStyle.fontStyle) !== null && _p !== void 0 ? _p : "normal",
5009
- fontWeight: (_r = (_q = currentStyle === null || currentStyle === void 0 ? void 0 : currentStyle.fontWeight) !== null && _q !== void 0 ? _q : baseStyle === null || baseStyle === void 0 ? void 0 : baseStyle.fontWeight) !== null && _r !== void 0 ? _r : "normal",
4985
+ fontStyle: currentStyle?.fontStyle ?? baseStyle?.fontStyle ?? "normal",
4986
+ fontWeight: currentStyle?.fontWeight ?? baseStyle?.fontWeight ?? "normal",
5010
4987
  lineHeight,
5011
- enableShadow: (_t = (_s = currentStyle === null || currentStyle === void 0 ? void 0 : currentStyle.enableShadow) !== null && _s !== void 0 ? _s : baseStyle === null || baseStyle === void 0 ? void 0 : baseStyle.enableShadow) !== null && _t !== void 0 ? _t : false,
5012
- shadowOffsetX: (_v = (_u = currentStyle === null || currentStyle === void 0 ? void 0 : currentStyle.shadowOffsetX) !== null && _u !== void 0 ? _u : baseStyle === null || baseStyle === void 0 ? void 0 : baseStyle.shadowOffsetX) !== null && _v !== void 0 ? _v : 0,
5013
- shadowOffsetY: (_x = (_w = currentStyle === null || currentStyle === void 0 ? void 0 : currentStyle.shadowOffsetY) !== null && _w !== void 0 ? _w : baseStyle === null || baseStyle === void 0 ? void 0 : baseStyle.shadowOffsetY) !== null && _x !== void 0 ? _x : 0,
4988
+ enableShadow: currentStyle?.enableShadow ?? baseStyle?.enableShadow ?? false,
4989
+ shadowOffsetX: currentStyle?.shadowOffsetX ?? baseStyle?.shadowOffsetX ?? 0,
4990
+ shadowOffsetY: currentStyle?.shadowOffsetY ?? baseStyle?.shadowOffsetY ?? 0,
5014
4991
  shadowBlur,
5015
- shadowColor: (_z = (_y = currentStyle === null || currentStyle === void 0 ? void 0 : currentStyle.shadowColor) !== null && _y !== void 0 ? _y : baseStyle === null || baseStyle === void 0 ? void 0 : baseStyle.shadowColor) !== null && _z !== void 0 ? _z : "transparent",
5016
- enableStroke: (_1 = (_0 = currentStyle === null || currentStyle === void 0 ? void 0 : currentStyle.enableStroke) !== null && _0 !== void 0 ? _0 : baseStyle === null || baseStyle === void 0 ? void 0 : baseStyle.enableStroke) !== null && _1 !== void 0 ? _1 : false,
5017
- strokeColor: (_3 = (_2 = currentStyle === null || currentStyle === void 0 ? void 0 : currentStyle.strokeColor) !== null && _2 !== void 0 ? _2 : baseStyle === null || baseStyle === void 0 ? void 0 : baseStyle.strokeColor) !== null && _3 !== void 0 ? _3 : "transparent",
4992
+ shadowColor: currentStyle?.shadowColor ?? baseStyle?.shadowColor ?? "transparent",
4993
+ enableStroke: currentStyle?.enableStroke ?? baseStyle?.enableStroke ?? false,
4994
+ strokeColor: currentStyle?.strokeColor ?? baseStyle?.strokeColor ?? "transparent",
5018
4995
  strokeWidth,
5019
4996
  };
5020
4997
  }
@@ -5168,7 +5145,6 @@ class UIText extends UIElement {
5168
5145
  * @throws Error if canvas context creation fails
5169
5146
  */
5170
5147
  constructor(layer, spans, parameters = {}) {
5171
- var _a;
5172
5148
  const canvas = document.createElement("canvas");
5173
5149
  const context = canvas.getContext("2d");
5174
5150
  if (!context) {
@@ -5185,7 +5161,7 @@ class UIText extends UIElement {
5185
5161
  chunks.push({ text, style, metrics });
5186
5162
  }
5187
5163
  }
5188
- const wrappedLines = wrapTextLines((_a = parameters.maxWidth) !== null && _a !== void 0 ? _a : DEFAULT_LINE_SIZE, chunks);
5164
+ const wrappedLines = wrapTextLines(parameters.maxWidth ?? DEFAULT_LINE_SIZE, chunks);
5189
5165
  const textBlockSize = calculateTextBlockSize(wrappedLines);
5190
5166
  const padding = resolvePadding(parameters.padding);
5191
5167
  canvas.width = textBlockSize.width + padding.left + padding.right;
@@ -5311,8 +5287,7 @@ class UIFullScreenLayer extends UILayer {
5311
5287
  super.render(renderer, deltaTime);
5312
5288
  }
5313
5289
  _private_calculateScale() {
5314
- var _a;
5315
- const targetHeight = (_a = this.tergetScreenHeight) !== null && _a !== void 0 ? _a : window.innerHeight;
5290
+ const targetHeight = this.tergetScreenHeight ?? window.innerHeight;
5316
5291
  return targetHeight / window.innerHeight;
5317
5292
  }
5318
5293
  }