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 +158 -183
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +14 -10
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MathUtils, Vector2, Box2, Matrix3,
|
|
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
|
|
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
|
|
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
|
|
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:
|
|
1834
|
-
power: resolvePower(options
|
|
1835
|
-
rule: resolveRule(options
|
|
1836
|
-
orientation: resolveOrientation(options
|
|
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
|
-
|
|
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
|
|
2022
|
-
const tempMatrixG = new Matrix4();
|
|
2019
|
+
const tempVectorA = new Vector3();
|
|
2023
2020
|
function applyMicroTransformations(object, micro, x, y, width, height, padding) {
|
|
2024
|
-
const
|
|
2025
|
-
const
|
|
2026
|
-
const
|
|
2027
|
-
const
|
|
2028
|
-
const
|
|
2029
|
-
const
|
|
2030
|
-
const
|
|
2031
|
-
const
|
|
2032
|
-
const
|
|
2033
|
-
const
|
|
2034
|
-
const
|
|
2035
|
-
const
|
|
2036
|
-
|
|
2037
|
-
.
|
|
2038
|
-
.
|
|
2039
|
-
.
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
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
|
|
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
|
-
|
|
3063
|
+
this.solver?.addConstraint(constraint);
|
|
3066
3064
|
}
|
|
3067
|
-
catch
|
|
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
|
-
|
|
3080
|
+
this.solver?.removeConstraint(constraint);
|
|
3084
3081
|
}
|
|
3085
|
-
catch
|
|
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
|
-
|
|
3102
|
+
this.solver?.addEditVariable(variable, strength);
|
|
3107
3103
|
}
|
|
3108
|
-
catch
|
|
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
|
-
|
|
3121
|
+
this.solver?.removeEditVariable(variable);
|
|
3127
3122
|
}
|
|
3128
|
-
catch
|
|
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
|
-
|
|
3142
|
+
this.solver?.suggestValue(variable, value);
|
|
3149
3143
|
}
|
|
3150
|
-
catch
|
|
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
|
-
|
|
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
|
-
|
|
3216
|
+
this.solver?.removeConstraint(this.constraintX);
|
|
3225
3217
|
this.constraintX = undefined;
|
|
3226
3218
|
}
|
|
3227
3219
|
if (this.constraintY) {
|
|
3228
|
-
|
|
3220
|
+
this.solver?.removeConstraint(this.constraintY);
|
|
3229
3221
|
this.constraintY = undefined;
|
|
3230
3222
|
}
|
|
3231
3223
|
if (this.constraintW) {
|
|
3232
|
-
|
|
3224
|
+
this.solver?.removeConstraint(this.constraintW);
|
|
3233
3225
|
this.constraintW = undefined;
|
|
3234
3226
|
}
|
|
3235
3227
|
if (this.constraintH) {
|
|
3236
|
-
|
|
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
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
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
|
|
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:
|
|
3369
|
-
anchorTwo:
|
|
3370
|
-
distance:
|
|
3371
|
-
power: resolvePower(parameters
|
|
3372
|
-
rule: resolveRule(parameters
|
|
3373
|
-
orientation: resolveOrientation(parameters
|
|
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:
|
|
3464
|
-
power: resolvePower(parameters
|
|
3465
|
-
rule: resolveRule(parameters
|
|
3466
|
-
orientation: resolveOrientation(parameters
|
|
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:
|
|
3557
|
-
anchorTwo:
|
|
3558
|
-
distance:
|
|
3559
|
-
power: resolvePower(parameters
|
|
3560
|
-
rule: resolveRule(parameters
|
|
3561
|
-
orientation: resolveOrientation(parameters
|
|
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:
|
|
3652
|
-
power: resolvePower(parameters
|
|
3653
|
-
rule: resolveRule(parameters
|
|
3654
|
-
orientation: resolveOrientation(parameters
|
|
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:
|
|
3736
|
-
power: resolvePower(options
|
|
3737
|
-
rule: resolveRule(options
|
|
3738
|
-
orientation: resolveOrientation(options
|
|
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:
|
|
3805
|
-
power:
|
|
3806
|
-
rule:
|
|
3807
|
-
orientation:
|
|
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:
|
|
3811
|
-
power:
|
|
3812
|
-
rule:
|
|
3813
|
-
orientation:
|
|
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:
|
|
3822
|
-
anchorTwo:
|
|
3823
|
-
distance:
|
|
3824
|
-
power:
|
|
3825
|
-
rule:
|
|
3826
|
-
orientation:
|
|
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:
|
|
3830
|
-
anchorTwo:
|
|
3831
|
-
distance:
|
|
3832
|
-
power:
|
|
3833
|
-
rule:
|
|
3834
|
-
orientation:
|
|
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:
|
|
3843
|
-
power:
|
|
3844
|
-
rule:
|
|
3845
|
-
orientation:
|
|
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:
|
|
3849
|
-
power:
|
|
3850
|
-
rule:
|
|
3851
|
-
orientation:
|
|
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
|
-
|
|
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:
|
|
3975
|
-
power: resolvePower(parameters
|
|
3976
|
-
rule: resolveRule(parameters
|
|
3977
|
-
orientation: resolveOrientation(parameters
|
|
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:
|
|
4071
|
-
horizontalAnchor:
|
|
4072
|
-
verticalAnchor:
|
|
4073
|
-
orientation: resolveOrientation(parameters
|
|
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:
|
|
4196
|
-
horizontalAnchor:
|
|
4197
|
-
verticalAnchor:
|
|
4198
|
-
orientation: resolveOrientation(parameters
|
|
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
|
-
|
|
4332
|
-
const
|
|
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
|
-
|
|
4566
|
-
const
|
|
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 =
|
|
4570
|
-
const backgroundHeight =
|
|
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
|
|
4604
|
-
const imageHeight = foregroundHeight
|
|
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
|
-
|
|
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 =
|
|
4804
|
-
const 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:
|
|
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 =
|
|
4797
|
+
this._private_sceneInternal = options.scene ?? new Scene();
|
|
4820
4798
|
this._private_cameraInternal =
|
|
4821
|
-
|
|
4799
|
+
options.camera ??
|
|
4800
|
+
new PerspectiveCamera(DEFAULT_FOV, width / height, DEFAULT_NEAR, DEFAULT_FAR);
|
|
4822
4801
|
this._private_resolutionFactorInternal = resolutionFactor;
|
|
4823
|
-
this._private_updateModeInternal =
|
|
4824
|
-
if (
|
|
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 =
|
|
4828
|
-
this._private_clearAlphaInternal =
|
|
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(
|
|
4993
|
-
right: Math.max(
|
|
4994
|
-
top: Math.max(
|
|
4995
|
-
bottom: Math.max(
|
|
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
|
-
|
|
5000
|
-
const
|
|
5001
|
-
const
|
|
5002
|
-
const
|
|
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:
|
|
5006
|
-
fontFamily:
|
|
4982
|
+
color: currentStyle?.color ?? baseStyle?.color ?? "#000000",
|
|
4983
|
+
fontFamily: currentStyle?.fontFamily ?? baseStyle?.fontFamily ?? "Arial",
|
|
5007
4984
|
fontSize,
|
|
5008
|
-
fontStyle:
|
|
5009
|
-
fontWeight:
|
|
4985
|
+
fontStyle: currentStyle?.fontStyle ?? baseStyle?.fontStyle ?? "normal",
|
|
4986
|
+
fontWeight: currentStyle?.fontWeight ?? baseStyle?.fontWeight ?? "normal",
|
|
5010
4987
|
lineHeight,
|
|
5011
|
-
enableShadow:
|
|
5012
|
-
shadowOffsetX:
|
|
5013
|
-
shadowOffsetY:
|
|
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:
|
|
5016
|
-
enableStroke:
|
|
5017
|
-
strokeColor:
|
|
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(
|
|
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
|
-
|
|
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
|
}
|