@needle-tools/engine
Version:
Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in.
2,063 lines (2,062 loc) • 178 kB
JavaScript
import { Vector4 as Pt, Vector3 as It, Vector2 as Ct, TextureLoader as Rt, Texture as Bt, ShaderMaterial as Ut, PlaneGeometry as At, Plane as Tt, Object3D as Mt, MeshBasicMaterial as Ft, Mesh as Ot, LinearFilter as Lt, FrontSide as zt, FileLoader as Wt, EventDispatcher as Et, DoubleSide as Dt, Color as Ht, BufferGeometry as Gt, BufferAttribute as $t, BackSide as Nt } from "./three.js";
var V = {};
V.d = (i, e) => {
for (var t in e)
V.o(e, t) && !V.o(i, t) && Object.defineProperty(i, t, { enumerable: !0, get: e[t] });
};
V.o = (i, e) => Object.prototype.hasOwnProperty.call(i, e);
V.r = (i) => {
typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(i, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(i, "__esModule", { value: !0 });
};
var m = {};
V.d(m, {
ti: () => (
/* reexport */
p
),
nS: () => (
/* reexport */
yt
),
eB: () => (
/* reexport */
T
),
Yp: () => (
/* reexport */
ne
),
VB: () => (
/* reexport */
I
),
BC: () => (
/* reexport */
O
),
zN: () => (
/* reexport */
C
),
cV: () => (
/* reexport */
B
),
hW: () => (
/* reexport */
F
),
k2: () => (
/* reexport */
ze
),
K6: () => (
/* reexport */
w
),
M7: () => (
/* reexport */
oe
),
ls: () => (
/* reexport */
L
),
Hi: () => (
/* reexport */
tt
),
EY: () => (
/* reexport */
M
),
MR: () => (
/* reexport */
je
),
zf: () => (
/* reexport */
Le
),
Ay: () => (
/* binding */
an
),
yo: () => (
/* binding */
bt
)
});
var ne = {};
V.r(ne);
V.d(ne, {
get: () => Fe,
set: () => Xt
});
var oe = {};
V.r(oe);
V.d(oe, {
alphaTestTransformer: () => Y,
asPreprocessorValueTransformer: () => Ye,
toPreprocessorTriggerTransformer: () => me,
toUserDataTransformer: () => ss,
uniformOrUserDataTransformer: () => x
});
const se = {
fontFamily: null,
fontSize: 0.05,
fontKerning: "auto",
fontStyle: "normal",
fontWeight: "normal",
offset: 5e-3,
lineHeight: 1.2,
lineBreak: `- ,.:?!
`,
// added '\n' to also acts as friendly breaks when white-space:normal
whiteSpace: "pre-line",
flexDirection: "column",
justifyContent: "start",
alignItems: "start",
backgroundImage: null,
textAlign: "left",
boxSizing: "content-box",
position: "static",
color: 16777215,
fontColor: 16777215,
fontOpacity: 1,
opacity: 1,
fontPXRange: 4,
fontSupersampling: !0,
fontSmooth: "antialiased",
borderRadius: 0,
borderWidth: 0,
borderColor: "black",
borderOpacity: 1,
backgroundSize: "cover",
backgroundColor: 0,
backgroundOpacity: 0,
overflow: "visible",
letterSpacing: 0,
invertAlpha: !1,
segments: 1
}, Xt = function(i) {
for (const e in i)
se[e] = i[e];
}, Fe = function(i) {
return Object.prototype.hasOwnProperty.call(se, i) || console.warn(`ThreeMeshUI::DefaultValues is trying to retrieve non-existing property '${i}'`), se[i];
};
class p {
/**
*
* @param {string} propertyId
* @param {any} [value=null]
* @param primitive
*/
constructor(e, t = null, s = !0) {
this._id = e, this._value = t, this._needsUpdate = !0, this._needsProcess = !1, this._needsRender = !1, this._isPrimitive = s;
}
/**
*
* @return {string}
*/
get id() {
return this._id;
}
/**
*
* @return {any}
*/
get value() {
return this._value;
}
/**
*
* @param {any} value
*/
set value(e) {
this.isValid(e) && this._value !== e && (this._value = e, this._needsUpdate = !0);
}
/* eslint-disable no-unused-vars */
/**
*
* @param element
* @param {Object.<string,any>} out
*/
update(e, t) {
this.output(t);
}
/* eslint-disable no-unused-vars */
/**
* Output this property in a dictionnary
* @param {Object.<string,any>} out
*/
output(e) {
}
/**
*
* @param {Out} out
*/
_outputValue(e) {
e[this._id] = this._value;
}
/* eslint-disable no-unused-vars */
/**
* Execute additional process after all properties have been updated
* @param {MeshUIBaseElement} element
*/
process(e) {
}
/* eslint-disable no-unused-vars */
/**
* Execute additional process after all properties have been updated
* @param {MeshUIBaseElement} element
*/
render(e) {
}
/**
*
* @param {MeshUIBaseElement} element
*/
getInheritedInput(e) {
if (this._value !== "inherit") return this._value;
const t = e._parent._value;
return t && t[`_${this._id}`] ? t[`_${this._id}`].getInheritedInput(t) : this.getDefaultValue();
}
/**
*
* @return {any}
*/
getDefaultValue() {
return Fe(this._id);
}
/* eslint-disable no-unused-vars */
/**
*
* @param {any} value
* @return {boolean}
*/
isValid(e) {
return !0;
}
/**
*
*/
emptyStrategyLogic() {
throw new Error(`ThreeMeshUI::${this.constructor.name} has empty strategy. Update has not been processed.`);
}
requestUpdate() {
this._needsUpdate = !0;
}
requestProcess() {
this._needsProcess = !1;
}
requestRender() {
this._needsRender = !1;
}
}
class jt extends p {
constructor() {
super("renderOrder", "auto", !0), this.output = this._outputValue, this._actualValue = 0;
}
/**
*
* @param {number} value
*/
set value(e) {
this.isValid(e) && (this._value = e, this._needsUpdate = !0);
}
update(e, t) {
if (this._value !== "auto")
this._actualValue = this._value;
else {
const s = e._parent._value;
if (s !== null) {
const r = s._renderOrder._actualValue, n = 1 + s._children._uis.indexOf(e);
this._actualValue = r + n;
}
}
for (const s of e._children._uis)
s._renderOrder._value === "auto" && (s._renderOrder._needsUpdate = !0);
this._outputValue(t);
}
_outputValue(e) {
e[this._id] = this._actualValue;
}
/**
*
* @return {number}
*/
get value() {
return this._value;
}
}
class C extends p {
/**
*
* @param {string} propertyId
* @param {any} [value=null]
* @param primitive
*/
constructor(e, t = null, s = !0) {
super(e, t, s), this.output = this._outputValue, this._notInheritedValue = null;
}
update(e, t) {
this._notInheritedValue = this._value, this._notInheritedValue === "inherit" && (this._notInheritedValue = this.getInheritedInput(e)), this.propagate(e), this._outputValue(t);
}
propagate(e) {
for (const t of e._children._uis) {
const s = t[`_${this._id}`];
s !== void 0 && s._value === "inherit" && (t[`_${this._id}`]._needsUpdate = !0);
}
}
/**
* Output this property in a dictionnary
* @override
*/
_outputValue(e) {
e[this._id] = this._notInheritedValue;
}
set value(e) {
this.isValid(e) && this._value !== e && (this._value = e, this._needsUpdate = !0);
}
/**
*
* @override
* @return {any|"inherit"}
*/
get value() {
return this._value === "inherit" ? this._notInheritedValue : this._value;
}
}
class Yt extends C {
constructor() {
super("offset", "inherit", !1);
}
/* eslint-disable no-unused-vars */
update(e, t) {
super.update(e, t), e._parent._value !== null && (e.position.z = this._notInheritedValue);
}
}
class Kt extends C {
constructor() {
super("fontSmooth", "inherit", !0), this._needsUpdate = !1, this.isValid = Jt, this.output = this._outputValue;
}
}
const qt = ["inherit", "none", "antialiased"];
function Jt(i) {
return qt.indexOf(i) === -1 ? (console.warn(`.fontSmoothing value '${i}' is not valid. Aborted`), !1) : !0;
}
var Zt = (i) => {
var e = {};
return V.d(e, i), e;
};
const u = Zt({ BackSide: () => Nt, BufferAttribute: () => $t, BufferGeometry: () => Gt, Color: () => Ht, DoubleSide: () => Dt, EventDispatcher: () => Et, FileLoader: () => Wt, FrontSide: () => zt, LinearFilter: () => Lt, Mesh: () => Ot, MeshBasicMaterial: () => Ft, Object3D: () => Mt, Plane: () => Tt, PlaneGeometry: () => At, ShaderMaterial: () => Ut, Texture: () => Bt, TextureLoader: () => Rt, Vector2: () => Ct, Vector3: () => It, Vector4: () => Pt });
class g extends p {
/**
*
* @param {string} propertyId
* @param {boolean} [primitive=true]
* @param {any} defaultValue
*/
constructor(e, t, s = !0) {
super(e, "unset", s), this._input = "inherit", this._allowsInherit = !0, this._inheritedInput = void 0, this._inline = void 0;
}
/**
*
* @param {MeshUIBaseElement} element
* @param {Object.<string,any> } out
*/
update(e, t) {
this._allowsInherit || (this._inheritedInput = this.getInheritedInput(e)), this.computeOutputValue(e);
for (const s of e._children._uis) {
const r = s[`_${this._id}`];
(r._input ? r._input : r._value) === "inherit" && (s[`_${this._id}`]._needsUpdate = !0);
}
this.output(t);
}
/**
*
* @param {MeshUIBaseElement} element
*/
computeOutputValue(e) {
this._value = this._input;
}
/**
*
* @param {MeshUIBaseElement} element
*/
_computeFromInherited(e) {
this._value = this._inheritedInput;
}
/**
* @override
* @deprecated
* @param {any} v
*/
set value(e) {
console.warn(".(style) sub-property cannot be directly set. It must comes from inline or computed setter.");
}
/**
*
* @param {any} value
*/
set inline(e) {
this.isValidValue(e) && e !== this._inline && (this._input = this._inline = e, this._needsUpdate = !0);
}
/**
*
* @return {any}
*/
get inline() {
return this._inline;
}
/**
*
* @param {any} value
* @return {boolean}
*/
isValidValue(e) {
return !0;
}
/**
* @param {MeshUIBaseElement} element
*/
getInheritedInput(e) {
if (this._input !== "inherit") return this._input;
const t = e._parent._value;
return t ? t[`_${this._id}`].getInheritedInput(t) : this.getDefaultValue();
}
}
class j extends g {
constructor(e, t) {
super(e, t, !1), this._input = new u.Vector4(0, 0, 0, 0), this._inline = null, this._value = new u.Vector4(0, 0, 0, 0);
}
/**
* @override
* @return {Vector4}
*/
get value() {
return this._value;
}
/* eslint-disable no-unused-vars */
/**
* @override
*/
computeOutputValue(e) {
this._vector4ValueSetter(this._value, this._input);
}
set inline(e) {
this._vector4ValueSetter(this._input, e), !this._input.equals(this._value) && (this._needsUpdate = !0);
}
/**
*
* @param {Number} v
*/
set top(e) {
this._input.x !== e && (this._input.x = e, this._needsUpdate = !0);
}
/**
*
* @returns {number}
*/
get top() {
return this._input.x;
}
/**
*
* @param {Number} v
*/
set right(e) {
this._input.y !== e && (this._input.y = e, this._needsUpdate = !0);
}
/**
*
* @returns {number}
*/
get right() {
return this._input.y;
}
/**
*
* @param {Number} v
*/
set bottom(e) {
this._input.z !== e && (this._input.z = e, this._needsUpdate = !0);
}
/**
*
* @returns {number}
*/
get bottom() {
return this._input.z;
}
/**
*
* @param {Number} v
*/
set left(e) {
this._input.w !== e && (this._input.w = e, this._needsUpdate = !0);
}
/**
*
* @returns {number}
*/
get left() {
return this._input.w;
}
dispose() {
this._computed = null, this._inline = null, this._input = null, this._output = null;
}
/**
*
* @param {Vector4} vector4
* @param {Vector4|Array.<Number>|Number|String} value
* @protected
*/
_vector4ValueSetter(e, t) {
if (t instanceof u.Vector4) {
e.copy(t);
return;
}
if ((typeof t == "string" || t instanceof String) && (t = t.split(" ")), Array.isArray(t))
switch (t = t.map((s) => parseFloat(s)), t.length) {
case 1:
e.setScalar(t[0]);
return;
case 2:
e.x = e.z = t[0], e.y = e.w = t[1];
return;
case 3:
e.x = t[0], e.y = t[1], e.z = t[2];
return;
case 4:
e.x = t[0], e.y = t[1], e.z = t[2], e.w = t[3];
return;
default:
console.error("StyleVector4Property::set() Four Dimension property had more than four values");
return;
}
isNaN(t) || e.setScalar(t);
}
}
class Qt extends j {
constructor() {
super("padding", new u.Vector4(0, 0, 0, 0));
}
computeOutputValue(e) {
super.computeOutputValue(e), e._bounds._needsUpdate = !0, e._bounds._needsRender = !0, e._layouter._needsProcess = !0, e._renderer._needsRender = !0, e._parent._value && (e._parent._value._layouter._needsProcess = !0);
}
}
class ei extends j {
constructor() {
super("margin", new u.Vector4(0, 0, 0, 0));
}
computeOutputValue(e) {
super.computeOutputValue(e), e._renderer._needsRender = !0, e._parent._value && (e._parent._value._flexDirection._needsProcess = !0);
}
}
const Ie = function(i, e, t) {
i[e] = t;
}, ti = function(i, e, t) {
t !== null && (i[e] = t);
};
class z {
/**
* @constructor
* @param {MediationDefinition} definition
*/
constructor(e) {
this._definition = e;
}
/**
*
* @param {MediationDefinition} value
*/
set definition(e) {
this._definition = e;
}
/**
*
* @param {MeshUIBaseElement} subject
* @param {any} target
* @param {Object.<(string|number), any>} options
* @param {any} [secondTarget=null]
*/
mediate(e, t, s, r = null) {
for (const n in this._definition) {
const o = this._definition[n];
if (s[n] !== void 0) {
const a = o.t ? o.t : Ie;
a(t, o.m, s[n]), r && a(r, o.m, s[n]);
}
}
}
/***********************************************************************************************************************
* STATIC
**********************************************************************************************************************/
/**
*
* @param {MeshUIComponent} subject
* @param {any} target
* @param {Object.<(string|number), any>} options
* @param {Object.<{subjectProperty:string, t?:(target:any, targetProperty:string, value:any) => void}>} mediationDefinitions
* @param {any} [secondTarget=null]
*/
static mediate(e, t, s, r, n = null) {
if (t)
for (const o in r) {
const a = r[o];
if (s[o] !== void 0) {
const l = a.t ? a.t : Ie;
l(t, a.m, s[o]), n && l(n, a.m, s[o]);
}
}
}
}
class ii extends p {
constructor() {
super("parent", null, !1);
}
/* eslint-disable no-unused-vars */
/**
* Update when :
* - element has been added
* - element has been removed
*
* @param element
* @param out
*/
update(e, t) {
e.parent && e.parent.isUI ? this._value = e.parent : this._value = null;
}
set value(e) {
console.warn("ParentProperty is readonly");
}
/**
*
* @return {MeshUIBaseElement}
*/
get value() {
return this._value;
}
/**
*
* @param {(p:Object3D)=>boolean } conditionCallback
*/
find(e) {
return this._value ? e(this._value) ? this._value : this._value._parent.find(e) : null;
}
/**
*
*/
dispose() {
this._value = null;
}
}
const re = function(i, e, t = 6) {
return i.toFixed(t) === e.toFixed(t);
};
class Ce extends p {
/**
*
* @param {string} propertyId
* @param {number} [value]
*/
constructor(e, t) {
super(e, t, !0), this.output = this._outputValue;
}
/**
*
* @param {number} value
*/
set value(e) {
this.isValid(e) && (re(this._value, e) || (this._value = e, this._needsUpdate = !0));
}
/**
*
* @return {number}
*/
get value() {
return this._value;
}
}
class Re extends C {
/**
*
* @param {string} propertyId
*/
constructor(e) {
super(e, "inherit", !0), this.isValid = ri;
}
}
const si = [u.FrontSide, u.BackSide, u.DoubleSide];
function ri(i) {
return si.indexOf(i) === -1 ? (console.warn(`SideProperty value '${i}' is not valid. Abort`), !1) : !0;
}
class Oe {
constructor() {
this._offsetX = 0, this._offsetY = 0, this._lineBreak = null, this._kerning = 0, this._fontFactor = 1, this._fontSize = 0, this._cumulativeWidth = 0, this._paddingLeft = 0, this._paddingRight = 0, this._marginLeft = 0, this._marginRight = 0;
}
/**
* @returns {void}
*/
resetOffsets() {
this._offsetX = this._offsetY = 0, this._cumulativeWidth = 0;
}
/**
* The horizontal distance this inline fills
* @returns {number}
*/
get xadvance() {
return 0;
}
/**
* The offset x of this inline in a line
* @returns {number}
*/
get xoffset() {
return 0;
}
/**
* The offset y of this inline in a line
* @returns {number}
*/
get yoffset() {
return 0;
}
/**
*
* @returns {number}
*/
get width() {
return 0;
}
/**
*
* @returns {number}
*/
get height() {
return 0;
}
/**
*
* @param {string|null} value
*/
set lineBreak(e) {
this._lineBreak = e;
}
/**
*
* @returns {string|null}
*/
get lineBreak() {
return this._lineBreak;
}
/**
*
* @returns {number}
*/
get anchor() {
return 0;
}
/**
*
* @returns {number}
*/
get kerning() {
return this._kerning * this._fontFactor;
}
/**
*
* @param {number} value
*/
set kerning(e) {
this._kerning = e;
}
/**
*
* @returns {number}
*/
get fontSize() {
return this._fontSize;
}
/**
*
* @param {number} value
*/
set fontSize(e) {
this._fontSize = e;
}
/**
*
* @returns {number}
*/
get lineHeight() {
return 0;
}
/**
*
* @returns {number}
*/
get offsetX() {
return this._offsetX;
}
/**
*
* @param value
*/
set offsetX(e) {
this._offsetX = e;
}
/**
*
* @returns {number}
*/
get offsetY() {
return this._offsetY;
}
/**
*
* @param {number} value
*/
set offsetY(e) {
this._offsetY = e;
}
/**
*
* @return {number}
*/
get cumulativeWidth() {
return this._cumulativeWidth;
}
/**
*
* @param {number} value
*/
set cumulativeWidth(e) {
this._cumulativeWidth = e;
}
/**
*
* @return {number}
*/
get marginLeft() {
return this._marginLeft;
}
/**
*
* @param {number} value
*/
set marginLeft(e) {
this._marginLeft = e;
}
/**
*
* @return {number}
*/
get marginRight() {
return this._marginRight;
}
/**
*
* @param {number} value
*/
set marginRight(e) {
this._marginRight = e;
}
/**
*
* @return {number}
*/
get paddingLeft() {
return this._paddingLeft;
}
/**
*
* @param {number} value
*/
set paddingLeft(e) {
this._paddingLeft = e;
}
/**
*
* @return {number}
*/
get paddingRight() {
return this._paddingRight;
}
/**
*
* @param {number} value
*/
set paddingRight(e) {
this._paddingRight = e;
}
/**
*
* @returns {number}
*/
get lineBase() {
return 0;
}
/**
*
* @param {number} value
*/
set fontFactor(e) {
this._fontFactor = e;
}
/**
*
* @returns {number}
*/
get fontFactor() {
return this._fontFactor;
}
}
class Le {
/**
*
* @param {TypographicFont} typographicFont
*/
constructor(e) {
this._char = "", this._width = 1, this._heigth = 1, this._xadvance = 1, this._xoffset = 0, this._yoffset = 0, this._font = e;
}
/**
*
* @returns {TypographicFont}
*/
get font() {
return this._font;
}
/**
*
* @return {string}
*/
get char() {
return this._char;
}
/**
*
* @returns {number}
*/
get width() {
return this._width;
}
/**
*
* @returns {number}
*/
get height() {
return this._heigth;
}
/**
*
* @returns {number}
*/
get xadvance() {
return this._xadvance;
}
/**
*
* @returns {number}
*/
get xoffset() {
return this._xoffset;
}
/**
*
* @returns {number}
*/
get yoffset() {
return this._yoffset;
}
/**
*
* @param value
*/
set yoffset(e) {
this._yoffset = e;
}
/**
*
* @abstract
* @param {string} otherChar
* @returns {TypographicGlyph}
*/
/* eslint-disable no-unused-vars */
clone(e) {
throw new Error("Abstract... Need to be implemented");
}
/**
*
* @abstract
* @returns {InlineGlyph}
*/
asInlineGlyph() {
throw new Error("Abstract... Need to be implemented");
}
}
class ze extends Oe {
/**
*
* @param {TypographicGlyph} characterDesc
*/
constructor(e) {
super(), this._typographic = e;
}
/**
*
* @returns {TypographicGlyph}
*/
get typographic() {
return this._typographic;
}
/*********************************************************************************************************************
* GETTERS FROM CHARACTER DESCRIPTION
********************************************************************************************************************/
/**
* @override
* @returns {number}
*/
get xadvance() {
return this._typographic.xadvance * this._fontFactor;
}
/**
* @override
* @returns {number}
*/
get xoffset() {
return this._typographic.xoffset * this._fontFactor;
}
/**
* @override
* @returns {number}
*/
get yoffset() {
return this._typographic.yoffset * this._fontFactor;
}
/**
* @override
* @returns {number}
*/
get width() {
return this._typographic.width * this._fontFactor;
}
/**
* @override
* @returns {number}
*/
get height() {
return this._typographic.height * this._fontFactor;
}
/**
*
* @return {string}
*/
get char() {
return this._typographic.char;
}
/**
* @override
* @returns {number}
*/
get anchor() {
return this.yoffset;
}
/**
* @override
* @returns {number}
*/
get lineHeight() {
return this._typographic.font.lineHeight * this._fontFactor;
}
/**
* @override
* @returns {number}
*/
get lineBase() {
return this._typographic.font.lineBase * this._fontFactor;
}
}
const ni = {
light: "100",
normal: "400",
bold: "700",
bolder: "900"
};
function ae(i) {
if (!isNaN(i)) return i.toString();
const e = ni[i];
return e || i;
}
class oi extends u.EventDispatcher {
/**
*
* @param {import('./../core/elements/MeshUIBaseElement').FontWeightFormat} weight
* @param {"normal"|"italic"} style
*/
constructor(e, t) {
super(), this._isReady = !1, this._weight = ae(e), this._style = t, this._size = 42, this._lineHeight = 42, this._lineBase = 42, this._font = null;
}
/**
*
* @returns {TypographicFont}
*/
get typographic() {
return this._font;
}
/**
*
* @returns {boolean}
*/
get isReady() {
return this._isReady;
}
/**
*
* @returns {string}
*/
get weight() {
return this._weight;
}
/**
*
* @returns {string}
*/
get style() {
return this._style;
}
/**
*
* @returns {Texture}
*/
get texture() {
return this._texture;
}
/**
* @param {Function.<ShaderMaterial|Material>} v
* @abstract
*/
set fontMaterial(e) {
throw Error(`FontVariant('${this.id}')::fontMaterial - is abstract.`);
}
/**
* @return {Function.<ShaderMaterial|Material>}
* @abstract
*/
get fontMaterial() {
throw Error(`FontVariant('${this.id}')::fontMaterial - is abstract.`);
}
/**
*
* @returns {string}
*/
get id() {
return `${this._name}(w:${this.weight},s:${this.style})`;
}
/**
*
* @param {string} character
* @returns {TypographicGlyph}
*/
getTypographicGlyph(e) {
let t = this._chars[e];
if (t) return t;
if (e.match(/\s/)) return this._chars[" "];
const s = this._getFallbackCharacter(e);
if (s && (t = this._chars[s], t))
return t;
throw Error(`FontVariant('${this.id}')::getTypographicGlyph() - character('${e}') and/or fallback character were not found in provided msdf charset.`);
}
/* eslint-disable no-unused-vars */
/**
* @abstract
* @protected
* @param {string} missingChar
* @returns {string|null}
*/
_getFallbackCharacter(e) {
throw new Error(`FontVariant(${typeof this})::_getFallbackCharacter() is abstract and should therefore be overridden.`);
}
/* eslint-disable no-unused-vars */
/**
* Convert an InlineCharacter to a geometry
*
* @abstract
* @param {InlineGlyph} inline
* @param {MeshUIBaseElement} element
* @returns {BufferGeometry|Array.<BufferGeometry>}
*/
getGeometricGlyph(e, t) {
throw new Error(`FontVariant(${typeof this})::getGeometryCharacter() is abstract and should therefore be overridden.`);
}
/* eslint-enable no-unused-vars */
/**
* Obtain the kerning amount of a glyphPair
* @param {string} glyphPair
* @returns {number}
*/
getKerningAmount(e) {
return this._kernings[e] ? this._kernings[e] : 0;
}
/**
* Perform some changes on the character description of this font
* @param {Object.<string,Object.<string,number|string>>} adjustmentObject
*/
adjustTypographicGlyphs(e) {
for (const t in e) {
const s = this.getTypographicGlyph(t), r = e[t];
for (const n in r)
s["_" + n] = e[t][n];
}
}
/**
*
* @private
*/
_checkReadiness() {
this._readyCondition() && ui(this);
}
/* eslint-disable no-unused-vars */
/**
* @abstract
* @param element
* @internal
*/
_alterElementProperties(e) {
throw new Error(`FontVariant(${typeof this})::_alterElementProperties() is abstract and should therefore be overridden.`);
}
/**
*
* @abstract
* @returns {boolean}
* @protected
*/
_readyCondition() {
throw new Error(`FontVariant(${typeof this})::_readyCondition() is abstract and should therefore be overridden.`);
}
}
const ai = { type: "ready" };
function ui(i) {
i._isReady = !0, i.dispatchEvent(ai);
}
const O = oi;
class hi extends p {
/**
*
* @param {FontVariant} [value=null]
*/
constructor(e = null) {
super("font", e, !1), this._needsUpdate = !1, this._fontVariant = null, this._handleFontReadyClosure = null, this.isValid = li;
}
output(e) {
e[this._id] = this._fontVariant;
}
/* eslint-disable no-unused-vars */
/**
*
* @override
*/
update(e, t) {
if (this._fontVariant && !this._fontVariant.isReady && this._fontVariant.removeEventListener("ready", this._handleFontReadyClosure), this._value && this._value instanceof O)
this._fontVariant = this._value;
else {
const s = e._fontFamily._value;
s && (this._fontVariant = s.getVariant(
e._fontWeight._value,
e._fontStyle._value
));
}
this._fontVariant && (this._fontVariant._alterElementProperties(e), this._handleFontReadyClosure = ci(e, this), this._fontVariant.isReady ? this._handleFontReadyClosure() : this._fontVariant.addEventListener("ready", this._handleFontReadyClosure), (!e._fontMaterial._defaultMaterial || !(e._fontMaterial._defaultMaterial instanceof this._fontVariant.fontMaterial)) && (e._fontMaterial._defaultMaterial = new this._fontVariant.fontMaterial(), e._fontMaterial._needsUpdate = !0));
}
/**
* @override
* @param {FontVariant} value
*/
set value(e) {
this.isValid(e) && this._value !== e && (this._value = e, this._needsUpdate = !0);
}
/**
*
* @return {FontVariant}
*/
get value() {
return this._value;
}
/**
*
* @return {FontVariant|null}
*/
get fontVariant() {
return this._fontVariant;
}
/**
*
*/
dispose() {
this._handleFontReadyClosure && (this._fontVariant.removeEventListener("ready", this._handleFontReadyClosure), this._handleFontReadyClosure = null), this._value = null, this._fontVariant = null;
}
}
function li(i) {
return i instanceof O ? !0 : (console.warn(`.font value '${i}' is not valid. It requires a FontVariant instance. Aborted`), !1);
}
function ci(i, e) {
return function() {
e._needsUpdate = !0, i._glyphs._needsProcess = !0, e._fontVariant.removeEventListener("ready", e._handleFontReadyClosure), e._handleFontReadyClosure = null;
};
}
class di extends g {
constructor(e) {
super("display", e), this._value = "flex", this._allowsInherit = !1, this._needsUpdate = !1, this.isValidValue = fi;
}
computeOutputValue(e) {
e._visible._value = this._output !== "none";
}
}
const _i = ["none", "flex"];
function fi(i) {
return _i.indexOf(i) === -1 ? (console.warn(`(.style) display value '${i}' is not valid. Aborted`), !1) : !0;
}
class pi extends g {
constructor(e) {
super("boxSizing", e), this._allowsInherit = !1, this.isValidValue = mi;
}
computeOutputValue(e) {
this._value = this._inheritedInput, e._bounds._needsUpdate = !0;
}
}
const gi = ["border-box", "content-box"];
function mi(i) {
return gi.indexOf(i) === -1 ? (console.warn(`(.style) boxSizing value '${i}' is not valid. Aborted`), !1) : !0;
}
class U extends g {
constructor(e, t) {
super(e, t, !1), this._value = new u.Color(), this.output = this._outputValue;
}
/* eslint-disable no-unused-vars */
/**
* @override
*/
computeOutputValue(e) {
this._input !== "inherit" && this._value.set(this._input);
}
set inline(e) {
this._input = this._inline = e, this._needsUpdate = !0;
}
}
class Z extends g {
/**
*
* @param {string} propertyId
* @param {any} defaultValue
*/
constructor(e, t) {
super(e, t, !0), this.isValidValue = vi, this._allowsInherit = !1, this._input = t, this._value = t, this.output = this._outputValue, this.computeOutputValue = this._computeFromInherited;
}
_outputValue(e) {
e[this._id] = this._inheritedInput;
}
}
function vi(i) {
return i < 0 && i > 1 ? (console.warn(`(.style) styleFactorProperty('${this.id}') value '${i}' is not valid)`), !1) : !0;
}
class yi extends g {
constructor(e) {
super("backgroundImage", e, !0), this._input = null, this._allowsInherit = !1, this._textureSize = new u.Vector2(1, 1), this.isValidValue = bi;
}
/**
* @override
* @return {any|Texture|null}
*/
get value() {
return this._value;
}
output(e) {
e[this._id] = this._value, e.tSize = this._textureSize;
}
/* eslint-disable no-unused-vars */
computeOutputValue(e) {
if (this._value = this._inheritedInput, this._value instanceof u.Texture && !this._value.image) {
console.warn("ThreeMeshUI - .backgroundImage :: Please provide preloaded texture in order to have accurate sizing.");
return;
}
this._needsProcess = !0;
}
/* eslint-disable no-unused-vars */
/**
*
* @param element
*/
process(e) {
this._value ? this._textureSize.set(this._value.image.width, this._value.image.height) : this._textureSize.set(1, 1);
}
}
function bi(i) {
return !0;
}
class xi extends g {
constructor(e) {
super("backgroundSize", e, !0), this.isValidValue = Si, this.output = this._outputValue;
}
}
const wi = ["cover", "contain", "stretch"];
function Si(i) {
return wi.indexOf(i) === -1 ? (console.warn(`(.style) backgroundSize value '${i}' is not valid. Aborted`), !1) : !0;
}
class Vi extends g {
constructor(e) {
super("overflow", e, !0), this.isValidValue = Pi, this._clippingPlanes = null, this._renderStrategy = this._emptyRender;
}
/**
* Update of overflow is a bit different, as parent may trigger changes on it
* @override
*/
update(e, t) {
this._inline !== void 0 && this._inline !== "unset" ? this._input = this._inline : this._computed !== void 0 && (this._input = this._computed), this._allowsInherit || (this._inheritedInput = this.getInheritedInput(e)), this.computeOutputValue(e);
for (const s of e._children._uis)
s._overflow._needsUpdate = !0;
this.output(t);
}
output(e) {
e.clippingPlanes = this._clippingPlanes;
}
computeOutputValue(e) {
super.computeOutputValue(e), this._value === "hidden" ? this._renderStrategy = this._propagateRender : (this._renderStrategy = this._emptyRender, this._clippingPlanes = null);
const t = e._parent._value;
if (t !== null) {
const s = t._overflow;
if ((s._value === "hidden" || s._clippingPlanes !== null) && !this._clippingPlanes) {
this._clippingPlanes = [
// top
new u.Plane(new u.Vector3(0, -1, 0), 1),
// right
new u.Plane(new u.Vector3(-1, 0, 0), 1),
// bottom
new u.Plane(new u.Vector3(0, 1, 0), 1),
// left
new u.Plane(new u.Vector3(1, 0, 0), 1)
];
for (let r = 0; r < this._clippingPlanes.length; r++)
this._clippingPlanes[r].parent = t;
s._clippingPlanes !== null && this._clippingPlanes.push(...s._clippingPlanes), this._renderStrategy = this._hiddenRender, this._needsRender = !0;
} else (s._value === "visible" || s._clippingPlanes === null) && this._clippingPlanes !== null && (this._clippingPlanes = null, this._renderStrategy = this._emptyRender, this._needsRender = !0);
}
}
render(e) {
this._renderStrategy(e);
}
/* eslint-disable no-unused-vars */
_emptyRender(e) {
}
_hiddenRender(e) {
const t = e._parent._value, s = t._bounds._offsetHeight, r = t._bounds._offsetWidth, n = t._padding._value, o = t._borderWidth._value;
for (let a = 0; a < 4 && a < this._clippingPlanes.length; a++) {
const l = this._clippingPlanes[a];
switch (a % 4) {
// top
case 0:
l.constant = s / 2 - (n.x + o.x);
break;
// right
case 1:
l.constant = r / 2 - (n.y + o.y);
break;
// bottom
case 2:
l.constant = s / 2 - (n.z + o.z);
break;
// left
case 3:
l.constant = r / 2 - (n.w + o.w);
break;
}
l.applyMatrix4(t.matrixWorld);
}
for (let a = 0; a < e._children._uis.length; a++) {
const l = e._children._uis[a];
l._overflow._needsRender = !0;
}
}
_propagateRender(e) {
for (let t = 0; t < e._children._uis.length; t++) {
const s = e._children._uis[t];
s._overflow._needsRender = !0;
}
}
}
const ki = ["visible", "hidden"];
function Pi(i) {
return ki.indexOf(i) === -1 ? (console.warn(`(.style) overflow value '${i}' is not valid. Aborted`), !1) : !0;
}
const R = "rem", We = "em", G = "%", Ii = [R, We, G], Ee = function(i) {
return Ii.indexOf(i) === -1 ? R : i;
};
class Ci extends j {
/**
*
* @param {Vector4} defaultValue
*/
constructor(e) {
super("borderRadius", e), this._valueUV = this._value.clone(), this._input = new u.Vector4(0, 0, 0, 0), this._mediation = !0, this._cornerTL = new u.Vector2(0, 1), this._cornerTR = new u.Vector2(1, 1), this._cornerBR = new u.Vector2(1, 0), this._cornerBL = new u.Vector2(0, 0);
const t = new W(this._valueUV, ["x", "y"]), s = new W(this._valueUV, ["z", "w"]), r = new W(this._valueUV, ["x", "w"]), n = new W(this._valueUV, ["y", "z"]);
t.complementaryMediation = s, s.complementaryMediation = t, r.complementaryMediation = n, n.complementaryMediation = r, this._sideMediators = [t, s, r, n], this._units = R;
}
/**
*
* @param {string} units
*/
set units(e) {
this._units = Ee(e), this._needsProcess = !0;
}
/**
*
* @returns {string}
*/
get units() {
return this._units;
}
/**
*
* @param {boolean} v
*/
set mediation(e) {
e !== this._mediation && (this._mediation = e, this._needsUpdate = !0);
}
/**
*
* @returns {boolean}
*/
get mediation() {
return this._mediation;
}
/**
*
* @param {Object.<string,any>} out
*/
output(e) {
e.cornerTL = this._cornerTL, e.cornerTR = this._cornerTR, e.cornerBR = this._cornerBR, e.cornerBL = this._cornerBL;
}
/**
*
* @override
*/
/* eslint-disable no-unused-vars */
computeOutputValue(e) {
this._vector4ValueSetter(this._value, this._input), this._needsProcess = !0;
}
/* eslint-disable no-unused-vars */
/**
*
* @override
*/
process(e) {
this._needsRender = !0;
}
/**
*
* @override
*/
render(e) {
this._valueUV.copy(this._value);
const t = e._bounds._offsetWidth, s = e._bounds._offsetHeight;
if (this._units === G && this._valueUV.divideScalar(100), this._units === R && this._valueUV.divideScalar(Math.min(t, s)), this._mediation)
do
this._sideMediators.forEach((o) => o.computeValue()), this._sideMediators.sort((o, a) => o.value < a.value ? 1 : -1), this._sideMediators[0].value > 1 && this._sideMediators[0].mediate();
while (this._sideMediators[0].value > 1);
let r = t > s ? s / t : 1, n = t < s ? t / s : 1;
this._units === G && (r = n = 1), this._cornerTL.x = this._valueUV.x * r, this._cornerTL.y = 1 - this._valueUV.x * n, this._cornerTR.x = 1 - this._valueUV.y * r, this._cornerTR.y = 1 - this._valueUV.y * n, this._cornerBR.x = 1 - this._valueUV.z * r, this._cornerBR.y = this._valueUV.z * n, this._cornerBL.x = this._valueUV.w * r, this._cornerBL.y = this._valueUV.w * n;
}
/**
*
*/
dispose() {
for (const e of this._sideMediators)
e.dispose();
this._sideMediators = null, this._cornerTL = null, this._cornerTR = null, this._cornerBR = null, this._cornerBL = null, super.dispose();
}
/**
*
* @param {Number} v
*/
set topLeft(e) {
this._input.x !== e && (this._input.x = e, this._needsUpdate = !0);
}
/**
*
* @returns {number}
*/
get topLeft() {
return this._input.x;
}
/**
*
* @param {Number} v
*/
set topRight(e) {
this._input.y !== e && (this._input.y = e, this._needsUpdate = !0);
}
/**
*
* @returns {number}
*/
get topRight() {
return this._input.y;
}
/**
*
* @param {Number} v
*/
set bottomRight(e) {
this._input.z !== e && (this._input.z = e, this._needsUpdate = !0);
}
/**
*
* @returns {number}
*/
get bottomRight() {
return this._input.z;
}
/**
*
* @param {Number} v
*/
set bottomLeft(e) {
this._input.w !== e && (this._input.w = e, this._needsUpdate = !0);
}
/**
*
* @returns {number}
*/
get bottomLeft() {
return this._input.w;
}
/**
* @override
* @param {Number} v
*/
set top(e) {
this._input.x === e && this._input.y === e || (this._input.x = this._input.y = e, this._needsUpdate = !0);
}
/**
* @override
* @returns {number}
*/
get top() {
return (this._input.x + this._input.y) / 2;
}
/**
* @override
* @param {Number} v
*/
set right(e) {
this._input.y === e && this._input.z === e || (this._input.y = this._input.z = e, this._needsUpdate = !0);
}
/**
* @override
* @returns {number}
*/
get right() {
return (this._input.y + this._input.z) / 2;
}
/**
* @override
* @param {Number} v
*/
set bottom(e) {
this._input.z === e && this._input.w === e || (this._input.z = this._input.w = e, this._needsUpdate = !0);
}
/**
* @override
* @returns {number}
*/
get bottom() {
return (this._input.z + this._input.w) / 2;
}
/**
* @override
* @param {Number} v
*/
set left(e) {
this._input.w === e && this._input.x === e || (this._input.w = this._input.x = e, this._needsUpdate = !0);
}
/**
* @override
* @returns {number}
*/
get left() {
return (this._input.w + this._input.x) / 2;
}
}
class W {
/**
*
* @param {Vector4} borderRadiuses
* @param {Array.<string>} sideProperties
*/
constructor(e, t) {
this._borderRadiuses = e, this._sideProperties = t, this._complementaryMediation = null, this._value = 0;
}
/**
* The sum of the border radius of that side
* @returns {number}
*/
get value() {
return this._value;
}
/**
* A complementary side mediation ie: For top, complementary is bottom
* @param {BorderRadiusMediator} brm
*/
set complementaryMediation(e) {
this._complementaryMediation = e;
}
/**
* Adds all side property to compute the value of that side
*/
computeValue() {
let e = 0;
for (const t of this._sideProperties)
e += this._borderRadiuses[t];
this._value = e;
}
/**
*
* @param {boolean} [mediateOpposite=true]
*/
mediate(e = !0) {
if (!(this._value < 1)) {
for (const t of this._sideProperties)
this._borderRadiuses[t] /= this._value;
e && this._complementaryMediation.mediate(!1);
}
}
/**
*
*/
dispose() {
this._complementaryMediation = null, this._borderRadiuses = null;
}
}
class Ri extends j {
/**
*
* @param defaultValue
*/
constructor(e) {
super("borderWidth", e, !1), this._valueUV = this._value.clone(), this.output = this._outputValue, this._units = R;
}
/**
*
* @param {string} units
*/
set units(e) {
this._units = Ee(e), this._needsUpdate = !0;
}
/**
*
* @returns {string}
*/
get units() {
return this._units;
}
/* eslint-disable no-unused-vars */
/**
*
* @override
*/
computeOutputValue(e) {
this._vector4ValueSetter(this._value, this._input), this._needsProcess = !0, e._bounds._needsUpdate = !0, e._layouter._needsUpdate = !0;
}
_outputValue(e) {
e[this._id] = this._valueUV;
}
/**
*
* @override
*/
process(e) {
this._needsRender = !0, e._borderRadius._needsRender = !0;
}
/**
* @override
*/
render(e) {
this._valueUV.copy(this._value);
const t = e._bounds._offsetWidth, s = e._bounds._offsetHeight;
if (this._units === G && (console.log("Percent"), console.log(this._valueUV)), this._units === R)
t !== 0 && (this._valueUV.w /= t, this._valueUV.y /= t), s !== 0 && (this._valueUV.x /= s, this._valueUV.z /= s);
else if (this._units === We) {
if (t !== 0) {
const r = t > s ? s / t : 1;
this._valueUV.y *= r, this._valueUV.w *= r;
}
if (s !== 0) {
const r = t < s ? t / s : 1;
this._valueUV.x *= r, this._valueUV.z *= r;
}
}
}
}
class Bi extends p {
/**
*
* @param {string} propertyId
* @param {any} [value=null]
*/
constructor(e, t = !0) {
super("visible", t, !0), this._needsUpdate = !1;
}
/* eslint-disable no-unused-vars */
update(e, t) {
e.visible = this._value, e._parent._value && (e._parent._value._children._needsUpdate = !0);
}
set value(e) {
this.isValid(e) && this._value !== e && (this._value = e, this._needsUpdate = !0);
}
/**
*
* @return {boolean}
*/
get value() {
return this._value;
}
}
class De extends U {
constructor(e) {
super("backgroundColor", e, !1), this._input = "transparent", this._allowsInherit = !1;
}
/* eslint-disable no-unused-vars */
/**
*
* @param {MeshUIBaseElement} element
*/
computeOutputValue(e) {
e._backgroundMesh.visible = !(this._input === "none" || this._input === "transparent"), this._input === "inherit" ? this._value.set(this.getInheritedInput(e)) : this._input === "transparent" || this._input === "none" || this._value.set(this._input);
}
}
class P extends p {
/**
*
* @param {string} propertyId
*/
constructor(e = "untitled") {
super(e, void 0, !1);
}
/* eslint-disable no-unused-vars */
/**
*
* @param element
* @param {Object.<string,any>} out
*/
update(e, t) {
}
/* eslint-disable no-unused-vars */
/**
* Output this property in a dictionnary
* @param {Object.<string,any>} out
*/
output(e) {
}
}
class Ui extends p {
constructor() {
super("inlineJustificator", null, !1), this._value = null;
}
/* eslint-disable no-unused-vars */
update(e, t) {
}
/**
*
* @override
*/
process(e) {
const t = e._bounds._innerHeight, s = e._layouter._value, r = Math.abs(s.height);
let n = (() => {
switch (e._alignItems._value) {
case "inherit":
case "start":
return t / 2;
case "end":
return r - t / 2;
case "stretch":
// @TODO : Stretch should trigger an error in own property
case "center":
return r / 2;
}
})();
const o = e._padding._value, a = e._borderWidth._value;
n += (-o.x + o.z) / 2 + (-a.x + a.z) / 2, s.forEach((l) => {
l.y += n, l.forEach((d) => {
d.offsetY += n;
});
});
}
}
const Ai = ["start", "center", "end", "stretch"], Ti = function(i) {
return Ai.indexOf(i) === -1 ? (console.warn(`(.style) alignItems value '${i}' is not valid. Aborted`), !1) : !0;
};
class ue extends g {
constructor() {
super("alignItems", "inherit", !0), this.isValidValue = Ti;
}
}
class he extends g {
constructor() {
super("textAlign", "inherit", !0), this.isValidValue = Fi;
}
}
const Mi = ["left", "right", "center", "justify", "justify-left", "justify-right", "justify-center"], Fi = function(i) {
return Mi.indexOf(i) === -1 ? (console.warn(`(.style) textAlign value '${i}' is not valid. Aborted`), !1) : !0;
};
class le extends g {
constructor() {
super("flexDirection", "inherit", !0), this.isValid = Li;
}
}
const Oi = ["row", "row-reverse", "column", "column-reverse"];
function Li(i) {
return Oi.indexOf(i) === -1 ? (console.warn(`(.style) flexDirection value '${i}' is not valid. Aborted`), !1) : !0;
}
class ce extends g {
constructor() {
super("justifyContent", "inherit", !0), this.isValidValue = Wi;
}
}
const zi = ["start", "center", "end", "space-between", "space-around", "space-evenly"];
function Wi(i) {
return zi.indexOf(i) === -1 ? (console.warn(`(.style) justifyContent value '${i}' is not valid. Aborted`), !1) : !0;
}
class Ei extends g {
constructor() {
super("order", 0, !0), this._value = 0, this._input = 0, this._allowsInherit = !1;
}
/* eslint-disable no-unused-vars */
computeOutputValue(e) {
this._value = this._inheritedInput, e._parent._value && (e._parent._value._children._needsProcess = !0);
}
}
class He extends g {
constructor() {
super("position", "static", !0), this._allowsInherit = !1, this._value = "static", this._needsUpdate = !1, this.computeOutputValue = this._computeFromInherited, this.isValidValue = Hi;
}
_computeFromInherited(e) {
super._computeFromInherited(e), e._parent._value && (e._parent._value._children._needsProcess = !0);
}
}
const Di = ["static", "absolute"];
function Hi(i) {
return Di.indexOf(i) === -1 ? (console.warn(`(.style) position value '${i}' is not valid. Aborted`), !1) : !0;
}
class Ge extends g {
/**
*
* @param {string} propertyId
* @param {number} defaultValue
*/
constructor(e, t = null) {
super(e, t, !0), this._input = "auto", this._auto = !0, this._relative = !1, this._updateRequired = !0;
}
/**
*
* @param {any} value
*/
set inline(e) {
this.isValidValue(e) && e !== this._inline && (this._inline = e, this._input !== this._inline && this._parseInput());
}
get inline() {
return this._inline;
}
_parseInput() {
let e = !0;
if (this._inline !== void 0 && this._inline !== "unset" ? this._input = this._inline : this._computed !== void 0 ? (this._computed === this._input && (e = !1), this._input = this._computed) : e = this._input === "inherit", e) {
if (this._auto = !this._input || this._input === "auto", this._auto)
this._relative = !1;
else if ((typeof this._input == "string" || this._input instanceof String) && this._input.endsWith("%")) {
this._relative = !0, this._value = 0;
const t = parseFloat(this._input.replace("%", "").trim());
isNaN(t) || (this._value = t / 100);
} else
this._relative = !1, this._value = this._input;
this._needsUpdate = this._updateRequired = e;
}
}
update(e, t) {
if (this._updateRequired) {
this._updateRequired = !1, this._allowsInherit || (this._inheritedInput = this.getInheritedInput(e)), this.computeOutputValue(e);
for (const s of e._children._uis)
s[`_${this._id}`]._needsUpdate = !0;
this.output(t), e._parent._value && (e._parent._value._layouter._needsProcess = !0);
}
}
/* eslint-disable no-unused-vars */
computeOutputValue(e) {
e._bounds._needsUpdate = !0, e._renderer._needsRender = !0;
}
getInheritedInput(e) {
if (this._input !== "inherit" && !this._auto) return this._input;
const t = e._parent._value;
return t ? t[`_${this._id}`].getInheritedInput(t) : this.getDefaultValue();
}
getDefaultValue() {
return 0;
}
/**
*
* @return {number}
*/
get value() {
return this._value;
}
}
class Gi extends Ge {
constructor() {
super("width");
}
}
class $i extends Ge {
constructor() {
super("height");
}
computeOutputValue(e) {
super.computeOutputValue(e);
}
}
class $e extends P {
constructor() {
super("textContent"), this._needsUpdate = !1;
}
/* eslint-disable no-unused-vars */
set value(e) {
}
/* eslint-disable no-unused-vars */
process(e) {
let t = "";
for (let s = 0; s < e.children.length; s++) {
const r = e.children[s];
r.isUI && (t += r.textContent);
}
this._value = t;
}
}
class Ne extends g {
constructor(e) {
super("fontStyle", e, !0), this.isValidValue = Xi;
}
}
const Ni = ["normal", "italic"];
function Xi(i) {
return Ni.indexOf(i) === -1 ? (console.warn(`(.style) fontStyle value '${i}' is not valid. Aborted`), !1) : !0;
}
class Xe extends g {
constructor() {
super("fontWeight", "inherit", !0), this.isValid = Yi;
}
}
const ji = ["100", "200", "300", "400", "500", "600", "700", "800", "900", "light", "normal", "bold", "bolder"];
function Yi(i) {
return ji.indexOf(i.toString()) === -1 ? (console.warn(`(.style) fontWeight value '${i}' is not valid. Aborted`), !1) : !0;
}
class je {
constructor() {
this._size = 42, this._lineHeight = 42, this._lineBase = 38, this._name = "-", this._charset = "";