laymur 0.1.72 → 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,31 +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 zPosition = object.position.z;
2043
- const matrix4 = tempMatrixG.identity().setFromMatrix3(combinedMatrix);
2044
- matrix4.decompose(object.position, object.quaternion, object.scale);
2045
- object.position.z = zPosition;
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;
2046
2043
  }
2047
2044
 
2048
2045
  /**
@@ -2987,7 +2984,7 @@ class UILayer extends i {
2987
2984
  constraints: new Set(),
2988
2985
  });
2989
2986
  if (object) {
2990
- const zIndex = renderOrder !== null && renderOrder !== void 0 ? renderOrder : this.scene.children.length;
2987
+ const zIndex = renderOrder ?? this.scene.children.length;
2991
2988
  object.position.z = zIndex;
2992
2989
  object.renderOrder = zIndex;
2993
2990
  this.scene.add(object);
@@ -3054,7 +3051,6 @@ class UILayer extends i {
3054
3051
  this.constraints.delete(constraint);
3055
3052
  }
3056
3053
  [addConstraintSymbol](owner, constraint) {
3057
- var _e;
3058
3054
  const dependencies = this.constraints.get(owner);
3059
3055
  if (dependencies === undefined) {
3060
3056
  throw new Error("Before adding constraint you need to add it's owner");
@@ -3064,15 +3060,14 @@ class UILayer extends i {
3064
3060
  }
3065
3061
  dependencies.constraints.add(constraint);
3066
3062
  try {
3067
- (_e = this.solver) === null || _e === void 0 ? void 0 : _e.addConstraint(constraint);
3063
+ this.solver?.addConstraint(constraint);
3068
3064
  }
3069
- catch (_f) {
3065
+ catch {
3070
3066
  this._private_rebuildSolver();
3071
3067
  }
3072
3068
  this.needsRecalculation = true;
3073
3069
  }
3074
3070
  [removeConstraintSymbol](owner, constraint) {
3075
- var _e;
3076
3071
  const dependencies = this.constraints.get(owner);
3077
3072
  if (dependencies === undefined) {
3078
3073
  throw new Error("Before removing constraint you need to add it's owner");
@@ -3082,15 +3077,14 @@ class UILayer extends i {
3082
3077
  }
3083
3078
  dependencies.constraints.delete(constraint);
3084
3079
  try {
3085
- (_e = this.solver) === null || _e === void 0 ? void 0 : _e.removeConstraint(constraint);
3080
+ this.solver?.removeConstraint(constraint);
3086
3081
  }
3087
- catch (_f) {
3082
+ catch {
3088
3083
  this._private_rebuildSolver();
3089
3084
  }
3090
3085
  this.needsRecalculation = true;
3091
3086
  }
3092
3087
  [addVariableSymbol](owner, variable, strength) {
3093
- var _e;
3094
3088
  const dependencies = owner instanceof UIElement || owner instanceof UIAnchor
3095
3089
  ? this.elements.get(owner)
3096
3090
  : this.constraints.get(owner);
@@ -3105,15 +3099,14 @@ class UILayer extends i {
3105
3099
  suggestedValue: variable.value(),
3106
3100
  });
3107
3101
  try {
3108
- (_e = this.solver) === null || _e === void 0 ? void 0 : _e.addEditVariable(variable, strength);
3102
+ this.solver?.addEditVariable(variable, strength);
3109
3103
  }
3110
- catch (_f) {
3104
+ catch {
3111
3105
  this._private_rebuildSolver();
3112
3106
  }
3113
3107
  this.needsRecalculation = true;
3114
3108
  }
3115
3109
  [removeVariableSymbol](owner, variable) {
3116
- var _e;
3117
3110
  const dependencies = owner instanceof UIElement || owner instanceof UIAnchor
3118
3111
  ? this.elements.get(owner)
3119
3112
  : this.constraints.get(owner);
@@ -3125,15 +3118,14 @@ class UILayer extends i {
3125
3118
  }
3126
3119
  dependencies.variables.delete(variable);
3127
3120
  try {
3128
- (_e = this.solver) === null || _e === void 0 ? void 0 : _e.removeEditVariable(variable);
3121
+ this.solver?.removeEditVariable(variable);
3129
3122
  }
3130
- catch (_f) {
3123
+ catch {
3131
3124
  this._private_rebuildSolver();
3132
3125
  }
3133
3126
  this.needsRecalculation = true;
3134
3127
  }
3135
3128
  [suggestVariableSymbol](owner, variable, value) {
3136
- var _e;
3137
3129
  const dependencies = owner instanceof UIElement || owner instanceof UIAnchor
3138
3130
  ? this.elements.get(owner)
3139
3131
  : this.constraints.get(owner);
@@ -3147,9 +3139,9 @@ class UILayer extends i {
3147
3139
  if (description.suggestedValue !== value) {
3148
3140
  description.suggestedValue = value;
3149
3141
  try {
3150
- (_e = this.solver) === null || _e === void 0 ? void 0 : _e.suggestValue(variable, value);
3142
+ this.solver?.suggestValue(variable, value);
3151
3143
  }
3152
- catch (_f) {
3144
+ catch {
3153
3145
  this._private_rebuildSolver();
3154
3146
  }
3155
3147
  this.needsRecalculation = true;
@@ -3170,7 +3162,6 @@ class UILayer extends i {
3170
3162
  this.camera.updateMatrix();
3171
3163
  }
3172
3164
  render(renderer, deltaTime) {
3173
- var _e;
3174
3165
  if (this.mode === UIMode.HIDDEN) {
3175
3166
  return;
3176
3167
  }
@@ -3179,7 +3170,7 @@ class UILayer extends i {
3179
3170
  const originalClearAlpha = renderer.getClearAlpha();
3180
3171
  if (this.needsRecalculation) {
3181
3172
  this.needsRecalculation = false;
3182
- (_e = this.solver) === null || _e === void 0 ? void 0 : _e.updateVariables();
3173
+ this.solver?.updateVariables();
3183
3174
  for (const element of this.elements.keys()) {
3184
3175
  element[needsRecalculation] = true;
3185
3176
  }
@@ -3221,31 +3212,30 @@ class UILayer extends i {
3221
3212
  this.camera.updateProjectionMatrix();
3222
3213
  }
3223
3214
  rebuildLayerConstraints(width, height) {
3224
- var _e, _f, _g, _h, _j, _k, _l, _m;
3225
3215
  if (this.constraintX) {
3226
- (_e = this.solver) === null || _e === void 0 ? void 0 : _e.removeConstraint(this.constraintX);
3216
+ this.solver?.removeConstraint(this.constraintX);
3227
3217
  this.constraintX = undefined;
3228
3218
  }
3229
3219
  if (this.constraintY) {
3230
- (_f = this.solver) === null || _f === void 0 ? void 0 : _f.removeConstraint(this.constraintY);
3220
+ this.solver?.removeConstraint(this.constraintY);
3231
3221
  this.constraintY = undefined;
3232
3222
  }
3233
3223
  if (this.constraintW) {
3234
- (_g = this.solver) === null || _g === void 0 ? void 0 : _g.removeConstraint(this.constraintW);
3224
+ this.solver?.removeConstraint(this.constraintW);
3235
3225
  this.constraintW = undefined;
3236
3226
  }
3237
3227
  if (this.constraintH) {
3238
- (_h = this.solver) === null || _h === void 0 ? void 0 : _h.removeConstraint(this.constraintH);
3228
+ this.solver?.removeConstraint(this.constraintH);
3239
3229
  this.constraintH = undefined;
3240
3230
  }
3241
3231
  this.constraintX = new Constraint(new Expression(this[xSymbol]), Operator.Eq, 0, Strength.required);
3242
3232
  this.constraintY = new Constraint(new Expression(this[ySymbol]), Operator.Eq, 0, Strength.required);
3243
3233
  this.constraintW = new Constraint(new Expression(this[widthSymbol]), Operator.Eq, width, Strength.required);
3244
3234
  this.constraintH = new Constraint(new Expression(this[heightSymbol]), Operator.Eq, height, Strength.required);
3245
- (_j = this.solver) === null || _j === void 0 ? void 0 : _j.addConstraint(this.constraintX);
3246
- (_k = this.solver) === null || _k === void 0 ? void 0 : _k.addConstraint(this.constraintY);
3247
- (_l = this.solver) === null || _l === void 0 ? void 0 : _l.addConstraint(this.constraintW);
3248
- (_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);
3249
3239
  }
3250
3240
  updateOrientation(width, height) {
3251
3241
  const lastOrientation = this.orientationPrivate;
@@ -3336,7 +3326,8 @@ function assertSameLayer(elementOne, elementTwo, message) {
3336
3326
  }
3337
3327
  function assertSize(width, height, message) {
3338
3328
  if (width <= 0 || height <= 0) {
3339
- 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`);
3340
3331
  }
3341
3332
  }
3342
3333
 
@@ -3359,7 +3350,6 @@ class UIHorizontalDistanceConstraint extends UIConstraint {
3359
3350
  * @param parameters - Configuration options
3360
3351
  */
3361
3352
  constructor(_private_elementOne, _private_elementTwo, parameters) {
3362
- var _a, _b, _c;
3363
3353
  assertSameLayer(_private_elementOne, _private_elementTwo);
3364
3354
  super(_private_elementTwo.layer, new Set(_private_elementOne instanceof UIElement || _private_elementOne instanceof UIAnchor
3365
3355
  ? [_private_elementOne, _private_elementTwo]
@@ -3367,12 +3357,12 @@ class UIHorizontalDistanceConstraint extends UIConstraint {
3367
3357
  this._private_elementOne = _private_elementOne;
3368
3358
  this._private_elementTwo = _private_elementTwo;
3369
3359
  this._private_parameters = {
3370
- anchorOne: (_a = parameters === null || parameters === void 0 ? void 0 : parameters.anchorOne) !== null && _a !== void 0 ? _a : DEFAULT_ANCHOR$3,
3371
- anchorTwo: (_b = parameters === null || parameters === void 0 ? void 0 : parameters.anchorTwo) !== null && _b !== void 0 ? _b : DEFAULT_ANCHOR$3,
3372
- distance: (_c = parameters === null || parameters === void 0 ? void 0 : parameters.distance) !== null && _c !== void 0 ? _c : 0,
3373
- power: resolvePower(parameters === null || parameters === void 0 ? void 0 : parameters.power),
3374
- rule: resolveRule(parameters === null || parameters === void 0 ? void 0 : parameters.rule),
3375
- 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),
3376
3366
  };
3377
3367
  if (this._private_parameters.orientation === UIOrientation.ALWAYS ||
3378
3368
  this._private_parameters.orientation === this.layer.orientation) {
@@ -3454,7 +3444,6 @@ class UIHorizontalProportionConstraint extends UIConstraint {
3454
3444
  * @param parameters - Configuration options
3455
3445
  */
3456
3446
  constructor(_private_elementOne, _private_elementTwo, parameters) {
3457
- var _a;
3458
3447
  assertSameLayer(_private_elementOne, _private_elementTwo);
3459
3448
  super(_private_elementTwo.layer, new Set(_private_elementOne instanceof UIElement
3460
3449
  ? [_private_elementOne, _private_elementTwo]
@@ -3462,10 +3451,10 @@ class UIHorizontalProportionConstraint extends UIConstraint {
3462
3451
  this._private_elementOne = _private_elementOne;
3463
3452
  this._private_elementTwo = _private_elementTwo;
3464
3453
  this._private_parameters = {
3465
- proportion: (_a = parameters === null || parameters === void 0 ? void 0 : parameters.proportion) !== null && _a !== void 0 ? _a : 1,
3466
- power: resolvePower(parameters === null || parameters === void 0 ? void 0 : parameters.power),
3467
- rule: resolveRule(parameters === null || parameters === void 0 ? void 0 : parameters.rule),
3468
- 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),
3469
3458
  };
3470
3459
  if (this._private_parameters.orientation === UIOrientation.ALWAYS ||
3471
3460
  this._private_parameters.orientation === this.layer.orientation) {
@@ -3547,7 +3536,6 @@ class UIVerticalDistanceConstraint extends UIConstraint {
3547
3536
  * @param parameters - Configuration options
3548
3537
  */
3549
3538
  constructor(_private_elementOne, _private_elementTwo, parameters) {
3550
- var _a, _b, _c;
3551
3539
  assertSameLayer(_private_elementOne, _private_elementTwo);
3552
3540
  super(_private_elementTwo.layer, new Set(_private_elementOne instanceof UIElement || _private_elementOne instanceof UIAnchor
3553
3541
  ? [_private_elementOne, _private_elementTwo]
@@ -3555,12 +3543,12 @@ class UIVerticalDistanceConstraint extends UIConstraint {
3555
3543
  this._private_elementOne = _private_elementOne;
3556
3544
  this._private_elementTwo = _private_elementTwo;
3557
3545
  this._private_parameters = {
3558
- anchorOne: (_a = parameters === null || parameters === void 0 ? void 0 : parameters.anchorOne) !== null && _a !== void 0 ? _a : DEFAULT_ANCHOR$2,
3559
- anchorTwo: (_b = parameters === null || parameters === void 0 ? void 0 : parameters.anchorTwo) !== null && _b !== void 0 ? _b : DEFAULT_ANCHOR$2,
3560
- distance: (_c = parameters === null || parameters === void 0 ? void 0 : parameters.distance) !== null && _c !== void 0 ? _c : 0,
3561
- power: resolvePower(parameters === null || parameters === void 0 ? void 0 : parameters.power),
3562
- rule: resolveRule(parameters === null || parameters === void 0 ? void 0 : parameters.rule),
3563
- 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),
3564
3552
  };
3565
3553
  if (this._private_parameters.orientation === UIOrientation.ALWAYS ||
3566
3554
  this._private_parameters.orientation === this.layer.orientation) {
@@ -3642,7 +3630,6 @@ class UIVerticalProportionConstraint extends UIConstraint {
3642
3630
  * @param parameters - Configuration options
3643
3631
  */
3644
3632
  constructor(_private_elementOne, _private_elementTwo, parameters) {
3645
- var _a;
3646
3633
  assertSameLayer(_private_elementOne, _private_elementTwo);
3647
3634
  super(_private_elementTwo.layer, new Set(_private_elementOne instanceof UIElement
3648
3635
  ? [_private_elementOne, _private_elementTwo]
@@ -3650,10 +3637,10 @@ class UIVerticalProportionConstraint extends UIConstraint {
3650
3637
  this._private_elementOne = _private_elementOne;
3651
3638
  this._private_elementTwo = _private_elementTwo;
3652
3639
  this._private_parameters = {
3653
- proportion: (_a = parameters === null || parameters === void 0 ? void 0 : parameters.proportion) !== null && _a !== void 0 ? _a : 1,
3654
- power: resolvePower(parameters === null || parameters === void 0 ? void 0 : parameters.power),
3655
- rule: resolveRule(parameters === null || parameters === void 0 ? void 0 : parameters.rule),
3656
- 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),
3657
3644
  };
3658
3645
  if (this._private_parameters.orientation === UIOrientation.ALWAYS ||
3659
3646
  this._private_parameters.orientation === this.layer.orientation) {
@@ -3730,14 +3717,13 @@ class UIWidthConstraint extends UIConstraint {
3730
3717
  * @param options - Configuration options
3731
3718
  */
3732
3719
  constructor(_private_element, options) {
3733
- var _a;
3734
3720
  super(_private_element.layer, new Set([_private_element]));
3735
3721
  this._private_element = _private_element;
3736
3722
  this._private_options = {
3737
- width: (_a = options === null || options === void 0 ? void 0 : options.width) !== null && _a !== void 0 ? _a : _private_element.width,
3738
- power: resolvePower(options === null || options === void 0 ? void 0 : options.power),
3739
- rule: resolveRule(options === null || options === void 0 ? void 0 : options.rule),
3740
- 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),
3741
3727
  };
3742
3728
  if (this._private_options.orientation === UIOrientation.ALWAYS ||
3743
3729
  this._private_options.orientation === this.layer.orientation) {
@@ -3800,57 +3786,54 @@ class UIWidthConstraint extends UIConstraint {
3800
3786
 
3801
3787
  class UIConstraint2DBuilder {
3802
3788
  static size(element, options = {}) {
3803
- var _a, _b, _c, _d, _e, _f, _g, _h;
3804
3789
  return {
3805
3790
  x: new UIWidthConstraint(element, {
3806
- width: (_a = options.size) === null || _a === void 0 ? void 0 : _a.x,
3807
- power: (_b = options.power) === null || _b === void 0 ? void 0 : _b.x,
3808
- rule: (_c = options.rule) === null || _c === void 0 ? void 0 : _c.x,
3809
- 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,
3810
3795
  }),
3811
3796
  y: new UIHeightConstraint(element, {
3812
- height: (_e = options.size) === null || _e === void 0 ? void 0 : _e.y,
3813
- power: (_f = options.power) === null || _f === void 0 ? void 0 : _f.y,
3814
- rule: (_g = options.rule) === null || _g === void 0 ? void 0 : _g.y,
3815
- 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,
3816
3801
  }),
3817
3802
  };
3818
3803
  }
3819
3804
  static distance(elementOne, elementTwo, options = {}) {
3820
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
3821
3805
  return {
3822
3806
  x: new UIHorizontalDistanceConstraint(elementOne, elementTwo, {
3823
- anchorOne: (_a = options.anchorOne) === null || _a === void 0 ? void 0 : _a.x,
3824
- anchorTwo: (_b = options.anchorTwo) === null || _b === void 0 ? void 0 : _b.x,
3825
- distance: (_c = options.distance) === null || _c === void 0 ? void 0 : _c.x,
3826
- power: (_d = options.power) === null || _d === void 0 ? void 0 : _d.x,
3827
- rule: (_e = options.rule) === null || _e === void 0 ? void 0 : _e.x,
3828
- 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,
3829
3813
  }),
3830
3814
  y: new UIVerticalDistanceConstraint(elementOne, elementTwo, {
3831
- anchorOne: (_g = options.anchorOne) === null || _g === void 0 ? void 0 : _g.y,
3832
- anchorTwo: (_h = options.anchorTwo) === null || _h === void 0 ? void 0 : _h.y,
3833
- distance: (_j = options.distance) === null || _j === void 0 ? void 0 : _j.y,
3834
- power: (_k = options.power) === null || _k === void 0 ? void 0 : _k.y,
3835
- rule: (_l = options.rule) === null || _l === void 0 ? void 0 : _l.y,
3836
- 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,
3837
3821
  }),
3838
3822
  };
3839
3823
  }
3840
3824
  static proportion(elementOne, elementTwo, options = {}) {
3841
- var _a, _b, _c, _d, _e, _f, _g, _h;
3842
3825
  return {
3843
3826
  x: new UIHorizontalProportionConstraint(elementOne, elementTwo, {
3844
- proportion: (_a = options.proportion) === null || _a === void 0 ? void 0 : _a.x,
3845
- power: (_b = options.power) === null || _b === void 0 ? void 0 : _b.x,
3846
- rule: (_c = options.rule) === null || _c === void 0 ? void 0 : _c.x,
3847
- 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,
3848
3831
  }),
3849
3832
  y: new UIVerticalProportionConstraint(elementOne, elementTwo, {
3850
- proportion: (_e = options.proportion) === null || _e === void 0 ? void 0 : _e.y,
3851
- power: (_f = options.power) === null || _f === void 0 ? void 0 : _f.y,
3852
- rule: (_g = options.rule) === null || _g === void 0 ? void 0 : _g.y,
3853
- 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,
3854
3837
  }),
3855
3838
  };
3856
3839
  }
@@ -3863,8 +3846,7 @@ var UIConstraintContainerDirection;
3863
3846
  })(UIConstraintContainerDirection || (UIConstraintContainerDirection = {}));
3864
3847
  class UIConstraintContainerBuilder {
3865
3848
  static build(container, elementOne, elementTwo, options = {}) {
3866
- var _a;
3867
- const direction = (_a = options.direction) !== null && _a !== void 0 ? _a : UIConstraintContainerDirection.FROM_LEFT_TOP;
3849
+ const direction = options.direction ?? UIConstraintContainerDirection.FROM_LEFT_TOP;
3868
3850
  const horizontalDistances = [];
3869
3851
  const verticalDistances = [];
3870
3852
  horizontalDistances.push(new UIHorizontalDistanceConstraint(container, elementOne, {
@@ -3969,14 +3951,13 @@ class UIAspectConstraint extends UIConstraint {
3969
3951
  * @param parameters - Configuration options
3970
3952
  */
3971
3953
  constructor(_private_element, parameters) {
3972
- var _a;
3973
3954
  super(_private_element.layer, new Set([_private_element]));
3974
3955
  this._private_element = _private_element;
3975
3956
  this._private_parameters = {
3976
- aspect: (_a = parameters === null || parameters === void 0 ? void 0 : parameters.aspect) !== null && _a !== void 0 ? _a : this._private_element.width / this._private_element.height,
3977
- power: resolvePower(parameters === null || parameters === void 0 ? void 0 : parameters.power),
3978
- rule: resolveRule(parameters === null || parameters === void 0 ? void 0 : parameters.rule),
3979
- 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),
3980
3961
  };
3981
3962
  if (this._private_parameters.orientation === UIOrientation.ALWAYS ||
3982
3963
  this._private_parameters.orientation === this.layer.orientation) {
@@ -4061,7 +4042,6 @@ class UICoverConstraint extends UIConstraint {
4061
4042
  * @param parameters - Configuration options
4062
4043
  */
4063
4044
  constructor(_private_elementOne, _private_elementTwo, parameters) {
4064
- var _a, _b, _c;
4065
4045
  assertSameLayer(_private_elementOne, _private_elementTwo);
4066
4046
  super(_private_elementTwo.layer, new Set(_private_elementOne instanceof UIElement
4067
4047
  ? [_private_elementOne, _private_elementTwo]
@@ -4069,10 +4049,10 @@ class UICoverConstraint extends UIConstraint {
4069
4049
  this._private_elementOne = _private_elementOne;
4070
4050
  this._private_elementTwo = _private_elementTwo;
4071
4051
  this._private_parameters = {
4072
- isStrict: (_a = parameters === null || parameters === void 0 ? void 0 : parameters.isStrict) !== null && _a !== void 0 ? _a : true,
4073
- horizontalAnchor: (_b = parameters === null || parameters === void 0 ? void 0 : parameters.horizontalAnchor) !== null && _b !== void 0 ? _b : DEFAULT_ANCHOR$1,
4074
- verticalAnchor: (_c = parameters === null || parameters === void 0 ? void 0 : parameters.verticalAnchor) !== null && _c !== void 0 ? _c : DEFAULT_ANCHOR$1,
4075
- 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),
4076
4056
  };
4077
4057
  if (this._private_parameters.orientation === UIOrientation.ALWAYS ||
4078
4058
  this._private_parameters.orientation === this.layer.orientation) {
@@ -4186,7 +4166,6 @@ class UIFitConstraint extends UIConstraint {
4186
4166
  * @param parameters - Configuration options
4187
4167
  */
4188
4168
  constructor(_private_elementOne, _private_elementTwo, parameters) {
4189
- var _a, _b, _c;
4190
4169
  super(_private_elementTwo.layer, new Set(_private_elementOne instanceof UIElement
4191
4170
  ? [_private_elementOne, _private_elementTwo]
4192
4171
  : [_private_elementTwo]));
@@ -4194,10 +4173,10 @@ class UIFitConstraint extends UIConstraint {
4194
4173
  this._private_elementTwo = _private_elementTwo;
4195
4174
  assertSameLayer(_private_elementOne, _private_elementTwo);
4196
4175
  this._private_parameters = {
4197
- isStrict: (_a = parameters === null || parameters === void 0 ? void 0 : parameters.isStrict) !== null && _a !== void 0 ? _a : true,
4198
- horizontalAnchor: (_b = parameters === null || parameters === void 0 ? void 0 : parameters.horizontalAnchor) !== null && _b !== void 0 ? _b : DEFAULT_ANCHOR,
4199
- verticalAnchor: (_c = parameters === null || parameters === void 0 ? void 0 : parameters.verticalAnchor) !== null && _c !== void 0 ? _c : DEFAULT_ANCHOR,
4200
- 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),
4201
4180
  };
4202
4181
  if (this._private_parameters.orientation === UIOrientation.ALWAYS ||
4203
4182
  this._private_parameters.orientation === this.layer.orientation) {
@@ -4330,9 +4309,8 @@ class UIImage extends UIElement {
4330
4309
  * @throws Error if the texture has invalid dimensions
4331
4310
  */
4332
4311
  constructor(layer, texture) {
4333
- var _a, _b;
4334
- const width = (_a = texture.image) === null || _a === void 0 ? void 0 : _a.width;
4335
- 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;
4336
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.`);
4337
4315
  const material = new UIMaterial(texture);
4338
4316
  const object = new Mesh(geometry, material);
@@ -4564,12 +4542,11 @@ class UIProgress extends UIElement {
4564
4542
  * @throws Error if either texture has invalid dimensions
4565
4543
  */
4566
4544
  constructor(layer, textureForeground, options = {}) {
4567
- var _a, _b, _c, _d, _e, _f;
4568
- const foregroundWidth = (_a = textureForeground.image) === null || _a === void 0 ? void 0 : _a.width;
4569
- 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;
4570
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.`);
4571
- const backgroundWidth = (_d = (_c = options.textureBackground) === null || _c === void 0 ? void 0 : _c.image) === null || _d === void 0 ? void 0 : _d.width;
4572
- 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;
4573
4550
  if (options.textureBackground) {
4574
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.`);
4575
4552
  }
@@ -4602,8 +4579,8 @@ class UIProgress extends UIElement {
4602
4579
  if (options.foregroundOpacity) {
4603
4580
  material.setForegroundOpacity(options.foregroundOpacity);
4604
4581
  }
4605
- const imageWidth = backgroundWidth !== null && backgroundWidth !== void 0 ? backgroundWidth : foregroundWidth;
4606
- const imageHeight = foregroundHeight !== null && foregroundHeight !== void 0 ? foregroundHeight : backgroundHeight;
4582
+ const imageWidth = backgroundWidth ?? foregroundWidth;
4583
+ const imageHeight = foregroundHeight ?? backgroundHeight;
4607
4584
  super(layer, object, 0, 0, imageWidth, imageHeight);
4608
4585
  this._private_material = material;
4609
4586
  this._private_imageWidth = imageWidth;
@@ -4796,21 +4773,20 @@ class UIScene extends UIElement {
4796
4773
  * @throws Error if resolution factor is out of valid range or dimensions are invalid
4797
4774
  */
4798
4775
  constructor(layer, options = {}) {
4799
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
4800
- const resolutionFactor = (_a = options.resolutionFactor) !== null && _a !== void 0 ? _a : DEFAULT_RESOLUTION_FACTOR;
4776
+ const resolutionFactor = options.resolutionFactor ?? DEFAULT_RESOLUTION_FACTOR;
4801
4777
  if (resolutionFactor < MIN_RESOLUTION_FACTOR ||
4802
4778
  resolutionFactor > MAX_RESOLUTION_FACTOR) {
4803
4779
  throw new Error(`Invalid resolution factor: ${resolutionFactor}. Must be between ${MIN_RESOLUTION_FACTOR} and ${MAX_RESOLUTION_FACTOR}.`);
4804
4780
  }
4805
- const width = (_b = options.width) !== null && _b !== void 0 ? _b : DEFAULT_WIDTH;
4806
- 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;
4807
4783
  assertSize(width, height, `Invalid width or height: ${width}x${height}. Must be positive.`);
4808
4784
  const renderTarget = new WebGLRenderTarget(width * resolutionFactor, height * resolutionFactor, {
4809
4785
  format: RGBAFormat,
4810
4786
  minFilter: LinearFilter,
4811
4787
  magFilter: LinearFilter,
4812
4788
  type: UnsignedByteType,
4813
- depthBuffer: (_d = options.useDepth) !== null && _d !== void 0 ? _d : DEFAULT_USE_DEPTH,
4789
+ depthBuffer: options.useDepth ?? DEFAULT_USE_DEPTH,
4814
4790
  stencilBuffer: false,
4815
4791
  });
4816
4792
  const material = new UIMaterial(renderTarget.texture);
@@ -4818,16 +4794,17 @@ class UIScene extends UIElement {
4818
4794
  super(layer, object, 0, 0, width, height);
4819
4795
  /** Whether the scene needs to be re-rendered on the next frame */
4820
4796
  this._private_needsRenderInternal = false;
4821
- this._private_sceneInternal = (_e = options.scene) !== null && _e !== void 0 ? _e : new Scene();
4797
+ this._private_sceneInternal = options.scene ?? new Scene();
4822
4798
  this._private_cameraInternal =
4823
- (_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);
4824
4801
  this._private_resolutionFactorInternal = resolutionFactor;
4825
- this._private_updateModeInternal = (_g = options.updateBehavior) !== null && _g !== void 0 ? _g : DEFAULT_UPDATE_MODE;
4826
- 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) {
4827
4804
  this._private_needsRenderInternal = true;
4828
4805
  }
4829
- this._private_clearColorInternal = (_j = options.clearColor) !== null && _j !== void 0 ? _j : DEFAULT_CLEAR_COLOR;
4830
- 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;
4831
4808
  this._private_renderTarget = renderTarget;
4832
4809
  this._private_material = material;
4833
4810
  this.applyTransformations();
@@ -4981,7 +4958,6 @@ class UIScene extends UIElement {
4981
4958
  }
4982
4959
 
4983
4960
  function resolvePadding(padding) {
4984
- var _a, _b, _c, _d;
4985
4961
  if (typeof padding === "number") {
4986
4962
  return {
4987
4963
  left: padding,
@@ -4991,32 +4967,31 @@ function resolvePadding(padding) {
4991
4967
  };
4992
4968
  }
4993
4969
  return {
4994
- left: Math.max((_a = padding === null || padding === void 0 ? void 0 : padding.left) !== null && _a !== void 0 ? _a : 0, 0),
4995
- right: Math.max((_b = padding === null || padding === void 0 ? void 0 : padding.right) !== null && _b !== void 0 ? _b : 0, 0),
4996
- top: Math.max((_c = padding === null || padding === void 0 ? void 0 : padding.top) !== null && _c !== void 0 ? _c : 0, 0),
4997
- 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),
4998
4974
  };
4999
4975
  }
5000
4976
  function resolveTextStyle(currentStyle, baseStyle) {
5001
- 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;
5002
- 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);
5003
- 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;
5004
- 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);
5005
- 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);
5006
4981
  return {
5007
- 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",
5008
- 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",
5009
4984
  fontSize,
5010
- 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",
5011
- 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",
5012
4987
  lineHeight,
5013
- 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,
5014
- 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,
5015
- 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,
5016
4991
  shadowBlur,
5017
- 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",
5018
- 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,
5019
- 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",
5020
4995
  strokeWidth,
5021
4996
  };
5022
4997
  }
@@ -5170,7 +5145,6 @@ class UIText extends UIElement {
5170
5145
  * @throws Error if canvas context creation fails
5171
5146
  */
5172
5147
  constructor(layer, spans, parameters = {}) {
5173
- var _a;
5174
5148
  const canvas = document.createElement("canvas");
5175
5149
  const context = canvas.getContext("2d");
5176
5150
  if (!context) {
@@ -5187,7 +5161,7 @@ class UIText extends UIElement {
5187
5161
  chunks.push({ text, style, metrics });
5188
5162
  }
5189
5163
  }
5190
- 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);
5191
5165
  const textBlockSize = calculateTextBlockSize(wrappedLines);
5192
5166
  const padding = resolvePadding(parameters.padding);
5193
5167
  canvas.width = textBlockSize.width + padding.left + padding.right;
@@ -5313,8 +5287,7 @@ class UIFullScreenLayer extends UILayer {
5313
5287
  super.render(renderer, deltaTime);
5314
5288
  }
5315
5289
  _private_calculateScale() {
5316
- var _a;
5317
- const targetHeight = (_a = this.tergetScreenHeight) !== null && _a !== void 0 ? _a : window.innerHeight;
5290
+ const targetHeight = this.tergetScreenHeight ?? window.innerHeight;
5318
5291
  return targetHeight / window.innerHeight;
5319
5292
  }
5320
5293
  }