mirage-engine 0.3.15 → 0.3.17
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/mirage-engine.js +231 -228
- package/dist/mirage-engine.umd.js +6 -6
- package/package.json +3 -3
package/dist/mirage-engine.js
CHANGED
|
@@ -12,22 +12,22 @@ var ve = (s, e, t) => e in s ? ze(s, e, { enumerable: !0, configurable: !0, writ
|
|
|
12
12
|
}, Se = (s, e) => Ne(s, Xe(e));
|
|
13
13
|
var u = (s, e, t) => (ve(s, typeof e != "symbol" ? e + "" : e, t), t);
|
|
14
14
|
var Ee = (s, e, t) => new Promise((r, i) => {
|
|
15
|
-
var c = (
|
|
15
|
+
var c = (a) => {
|
|
16
16
|
try {
|
|
17
|
-
|
|
17
|
+
o(t.next(a));
|
|
18
18
|
} catch (l) {
|
|
19
19
|
i(l);
|
|
20
20
|
}
|
|
21
|
-
}, n = (
|
|
21
|
+
}, n = (a) => {
|
|
22
22
|
try {
|
|
23
|
-
|
|
23
|
+
o(t.throw(a));
|
|
24
24
|
} catch (l) {
|
|
25
25
|
i(l);
|
|
26
26
|
}
|
|
27
|
-
},
|
|
28
|
-
|
|
27
|
+
}, o = (a) => a.done ? r(a.value) : Promise.resolve(a.value).then(c, n);
|
|
28
|
+
o((t = t.apply(s, e)).next());
|
|
29
29
|
});
|
|
30
|
-
import * as
|
|
30
|
+
import * as w from "three";
|
|
31
31
|
const Ae = {
|
|
32
32
|
INCLUDE_TREE: "include-tree",
|
|
33
33
|
EXCLUDE_TREE: "exclude-tree",
|
|
@@ -76,22 +76,23 @@ const Ae = {
|
|
|
76
76
|
VALUES: {
|
|
77
77
|
FRONT: "front"
|
|
78
78
|
}
|
|
79
|
-
}, ue = 0, re = 1, he = 2, Pe = 4, fe = 8,
|
|
79
|
+
}, ue = 0, re = 1, he = 2, Pe = 4, fe = 8, we = 16;
|
|
80
80
|
function He(s) {
|
|
81
|
-
const e = s.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);
|
|
81
|
+
const e = s.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/);
|
|
82
82
|
return e ? {
|
|
83
83
|
r: parseInt(e[1]) / 255,
|
|
84
84
|
g: parseInt(e[2]) / 255,
|
|
85
|
-
b: parseInt(e[3]) / 255
|
|
86
|
-
|
|
85
|
+
b: parseInt(e[3]) / 255,
|
|
86
|
+
a: e[4] !== void 0 ? parseFloat(e[4]) : 1
|
|
87
|
+
} : { r: 1, g: 1, b: 1, a: 1 };
|
|
87
88
|
}
|
|
88
89
|
function Ge(s) {
|
|
89
90
|
const e = {};
|
|
90
|
-
if (s.opacity && (e.opacity = parseFloat(s.opacity)), s.backgroundColor
|
|
91
|
+
if (s.opacity && (e.opacity = parseFloat(s.opacity)), s.backgroundColor) {
|
|
91
92
|
const t = He(s.backgroundColor);
|
|
92
|
-
e.backgroundColor = [t.r, t.g, t.b];
|
|
93
|
+
e.backgroundColor = [t.r, t.g, t.b, t.a];
|
|
93
94
|
}
|
|
94
|
-
if (s.backgroundImage ? e.backgroundImage = s.backgroundImage : s.background && (e.backgroundImage = s.background), s.borderRadius && (e.borderRadius = parseFloat(s.borderRadius)), s.width && (e.width = parseFloat(s.width)), s.height && (e.height = parseFloat(s.height)), s.transform && s.transform !== "none") {
|
|
95
|
+
if (s.backgroundImage ? e.backgroundImage = s.backgroundImage : s.background && (e.backgroundImage = s.background), s.boxShadow && (e.boxShadow = s.boxShadow), s.borderRadius && (e.borderRadius = parseFloat(s.borderRadius)), s.width && (e.width = parseFloat(s.width)), s.height && (e.height = parseFloat(s.height)), s.transform && s.transform !== "none") {
|
|
95
96
|
const t = new DOMMatrix(s.transform);
|
|
96
97
|
e.x = t.m41, e.y = t.m42, e.z = t.m43;
|
|
97
98
|
}
|
|
@@ -151,23 +152,23 @@ class ke {
|
|
|
151
152
|
onStart: r.onStart,
|
|
152
153
|
onEnd: r.onEnd
|
|
153
154
|
}, this.observer = new MutationObserver((n) => {
|
|
154
|
-
let
|
|
155
|
-
for (const
|
|
156
|
-
if (
|
|
157
|
-
|
|
155
|
+
let o = ue;
|
|
156
|
+
for (const a of n)
|
|
157
|
+
if (a.type === "childList")
|
|
158
|
+
o |= fe, a.removedNodes.length > 0 && a.removedNodes.forEach((l) => {
|
|
158
159
|
l instanceof HTMLElement && this.pendingDeletions.add(l);
|
|
159
160
|
});
|
|
160
|
-
else if (
|
|
161
|
-
if (
|
|
162
|
-
|
|
163
|
-
const l =
|
|
161
|
+
else if (a.type === "attributes")
|
|
162
|
+
if (a.attributeName === "style") {
|
|
163
|
+
o |= re | he;
|
|
164
|
+
const l = a.target, d = Ge(l.style);
|
|
164
165
|
this.pendingStyles.set(l, d);
|
|
165
166
|
} else
|
|
166
|
-
|
|
167
|
+
a.attributeName === "class" ? o |= re | he : a.attributeName && a.attributeName.startsWith("data-") && (o |= re | he, a.attributeName.startsWith("data-mirage") && (o |= fe));
|
|
167
168
|
else
|
|
168
|
-
|
|
169
|
-
if (
|
|
170
|
-
if (this.pendingMask |=
|
|
169
|
+
a.type === "characterData" && (o |= we | re);
|
|
170
|
+
if (o !== ue) {
|
|
171
|
+
if (this.pendingMask |= o, o & fe) {
|
|
171
172
|
this.clearTimers(), this.isDomDirty = !0;
|
|
172
173
|
return;
|
|
173
174
|
}
|
|
@@ -192,7 +193,7 @@ class ke {
|
|
|
192
193
|
this.mutationTimer && (clearTimeout(this.mutationTimer), this.mutationTimer = null), this.cssTimer && (clearTimeout(this.cssTimer), this.cssTimer = null), this.scrollTimer && (clearTimeout(this.scrollTimer), this.scrollTimer = null);
|
|
193
194
|
}
|
|
194
195
|
}
|
|
195
|
-
const $ = 1,
|
|
196
|
+
const $ = 1, oe = 2, O = {
|
|
196
197
|
BASE: 0,
|
|
197
198
|
SELECTED: 1,
|
|
198
199
|
getCaptureLayer: (s) => 31 - s,
|
|
@@ -220,11 +221,11 @@ class Ie {
|
|
|
220
221
|
}
|
|
221
222
|
}
|
|
222
223
|
u(Ie, "cache", /* @__PURE__ */ new Map());
|
|
223
|
-
class $e extends
|
|
224
|
+
class $e extends w.MeshBasicMaterial {
|
|
224
225
|
constructor(t, r, i, c, n = 2) {
|
|
225
226
|
super({
|
|
226
227
|
transparent: !0,
|
|
227
|
-
side:
|
|
228
|
+
side: w.FrontSide,
|
|
228
229
|
color: 16777215
|
|
229
230
|
});
|
|
230
231
|
u(this, "canvas");
|
|
@@ -232,41 +233,41 @@ class $e extends y.MeshBasicMaterial {
|
|
|
232
233
|
u(this, "qualityFactor");
|
|
233
234
|
if (this.canvas = document.createElement("canvas"), this.ctx = this.canvas.getContext("2d"), !this.ctx)
|
|
234
235
|
throw new Error("[Mirage] Failed to create canvas context");
|
|
235
|
-
this.qualityFactor = n, this.map = new
|
|
236
|
+
this.qualityFactor = n, this.map = new w.CanvasTexture(this.canvas), this.map.colorSpace = w.LinearSRGBColorSpace, this.map.minFilter = w.LinearFilter, this.map.magFilter = w.LinearFilter, this.updateText(t, r, i, c);
|
|
236
237
|
}
|
|
237
238
|
wrapText(t, r) {
|
|
238
239
|
const i = t.split(`
|
|
239
240
|
`), c = [];
|
|
240
241
|
return i.forEach((n) => {
|
|
241
|
-
const
|
|
242
|
-
if (
|
|
242
|
+
const o = n.match(/[^\s\-]+\-?|\-|\s+/g) || [];
|
|
243
|
+
if (o.length === 0) {
|
|
243
244
|
c.push("");
|
|
244
245
|
return;
|
|
245
246
|
}
|
|
246
|
-
let
|
|
247
|
-
for (let l = 1; l <
|
|
248
|
-
const d =
|
|
249
|
-
this.ctx.measureText(
|
|
247
|
+
let a = o[0];
|
|
248
|
+
for (let l = 1; l < o.length; l++) {
|
|
249
|
+
const d = o[l];
|
|
250
|
+
this.ctx.measureText(a + d).width <= r + 2 ? a += d : (a && c.push(a), a = d.trimStart());
|
|
250
251
|
}
|
|
251
|
-
|
|
252
|
+
a && c.push(a);
|
|
252
253
|
}), c;
|
|
253
254
|
}
|
|
254
255
|
updateText(t, r, i, c, n) {
|
|
255
256
|
n !== void 0 && (this.qualityFactor = n);
|
|
256
|
-
const
|
|
257
|
-
this.canvas.width !== l || this.canvas.height !== d ? (this.canvas.width = l, this.canvas.height = d) : this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height), this.ctx.setTransform(
|
|
257
|
+
const a = (window.devicePixelRatio || 1) * this.qualityFactor, l = i * a, d = c * a;
|
|
258
|
+
this.canvas.width !== l || this.canvas.height !== d ? (this.canvas.width = l, this.canvas.height = d) : this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height), this.ctx.setTransform(a, 0, 0, a, 0, 0), this.ctx.font = r.font, this.ctx.fillStyle = r.color, this.ctx.textBaseline = "alphabetic", this.ctx.globalAlpha = 1;
|
|
258
259
|
const h = this.wrapText(t, i), f = r.lineHeight, g = Ie.getBaseline(r.font);
|
|
259
260
|
h.forEach((p, v) => {
|
|
260
|
-
const
|
|
261
|
+
const y = v * f + g;
|
|
261
262
|
let C = 0;
|
|
262
|
-
r.textAlign === "center" ? C = i / 2 : r.textAlign === "right" && (C = i), this.ctx.textAlign = r.textAlign, this.ctx.fillText(p, C,
|
|
263
|
+
r.textAlign === "center" ? C = i / 2 : r.textAlign === "right" && (C = i), this.ctx.textAlign = r.textAlign, this.ctx.fillText(p, C, y);
|
|
263
264
|
}), this.map && (this.map.needsUpdate = !0);
|
|
264
265
|
}
|
|
265
266
|
dispose() {
|
|
266
267
|
this.map && this.map.dispose(), super.dispose();
|
|
267
268
|
}
|
|
268
269
|
}
|
|
269
|
-
function
|
|
270
|
+
function ae(s, e = 0) {
|
|
270
271
|
if (typeof s == "number")
|
|
271
272
|
return s;
|
|
272
273
|
const t = parseFloat(s) || 0;
|
|
@@ -274,15 +275,15 @@ function oe(s, e = 0) {
|
|
|
274
275
|
}
|
|
275
276
|
function le(s) {
|
|
276
277
|
if (!s || s === "transparent")
|
|
277
|
-
return { color: new
|
|
278
|
+
return { color: new w.Color(16777215), alpha: 0 };
|
|
278
279
|
const e = s.match(
|
|
279
280
|
/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/
|
|
280
281
|
);
|
|
281
282
|
if (e) {
|
|
282
283
|
const t = parseInt(e[1], 10), r = parseInt(e[2], 10), i = parseInt(e[3], 10), c = e[4] !== void 0 ? parseFloat(e[4]) : 1;
|
|
283
|
-
return { color: new
|
|
284
|
+
return { color: new w.Color(`rgb(${t}, ${r}, ${i})`), alpha: c };
|
|
284
285
|
}
|
|
285
|
-
return { color: new
|
|
286
|
+
return { color: new w.Color(s), alpha: 1 };
|
|
286
287
|
}
|
|
287
288
|
function Ue(s) {
|
|
288
289
|
const e = [];
|
|
@@ -313,42 +314,42 @@ function qe(s) {
|
|
|
313
314
|
if (n.startsWith("to "))
|
|
314
315
|
n === "to top" ? i = 0 : n === "to right" ? i = Math.PI / 2 : n === "to bottom" ? i = Math.PI : n === "to left" ? i = Math.PI * 1.5 : n === "to top right" || n === "to right top" ? i = Math.PI / 4 : n === "to bottom right" || n === "to right bottom" ? i = Math.PI * 0.75 : n === "to bottom left" || n === "to left bottom" ? i = Math.PI * 1.25 : (n === "to top left" || n === "to left top") && (i = Math.PI * 1.75), c = 1;
|
|
315
316
|
else if (n.endsWith("deg") || n.endsWith("rad") || n.endsWith("turn")) {
|
|
316
|
-
const
|
|
317
|
-
n.endsWith("deg") ? i =
|
|
317
|
+
const a = parseFloat(n);
|
|
318
|
+
n.endsWith("deg") ? i = a * (Math.PI / 180) : n.endsWith("rad") ? i = a : n.endsWith("turn") && (i = a * Math.PI * 2), c = 1;
|
|
318
319
|
}
|
|
319
|
-
const
|
|
320
|
-
for (let
|
|
321
|
-
const l = r[
|
|
320
|
+
const o = [];
|
|
321
|
+
for (let a = c; a < r.length && !(o.length >= 8); a++) {
|
|
322
|
+
const l = r[a].trim(), d = l.lastIndexOf(" ");
|
|
322
323
|
let h = l, f = null;
|
|
323
324
|
if (d !== -1 && !l.endsWith(")")) {
|
|
324
325
|
const p = l.substring(d + 1);
|
|
325
326
|
(p.endsWith("%") || p.endsWith("px") || !isNaN(parseFloat(p))) && (h = l.substring(0, d).trim(), f = p);
|
|
326
327
|
}
|
|
327
328
|
const g = le(h);
|
|
328
|
-
|
|
329
|
+
o.push({
|
|
329
330
|
color: g.color,
|
|
330
331
|
alpha: g.alpha,
|
|
331
332
|
rawStop: f,
|
|
332
333
|
stop: 0
|
|
333
334
|
});
|
|
334
335
|
}
|
|
335
|
-
if (
|
|
336
|
-
for (let l = 0; l <
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
let
|
|
340
|
-
for (let l = 1; l <
|
|
341
|
-
if (
|
|
342
|
-
const d = l -
|
|
336
|
+
if (o.length > 0) {
|
|
337
|
+
for (let l = 0; l < o.length; l++)
|
|
338
|
+
o[l].rawStop !== null && (o[l].stop = parseFloat(o[l].rawStop) / 100);
|
|
339
|
+
o[0].rawStop === null && (o[0].stop = 0), o.length > 1 && o[o.length - 1].rawStop === null && (o[o.length - 1].stop = 1);
|
|
340
|
+
let a = 0;
|
|
341
|
+
for (let l = 1; l < o.length; l++)
|
|
342
|
+
if (o[l].rawStop !== null || l === o.length - 1) {
|
|
343
|
+
const d = l - a;
|
|
343
344
|
if (d > 1) {
|
|
344
|
-
const h = a
|
|
345
|
+
const h = o[a].stop, g = (o[l].stop - h) / d;
|
|
345
346
|
for (let p = 1; p < d; p++)
|
|
346
|
-
a
|
|
347
|
+
o[a + p].stop = h + g * p;
|
|
347
348
|
}
|
|
348
|
-
|
|
349
|
+
a = l;
|
|
349
350
|
}
|
|
350
351
|
}
|
|
351
|
-
return { angle: i, stops:
|
|
352
|
+
return { angle: i, stops: o };
|
|
352
353
|
}
|
|
353
354
|
function je(s) {
|
|
354
355
|
if (!s || s === "none")
|
|
@@ -363,8 +364,8 @@ function je(s) {
|
|
|
363
364
|
(g.startsWith("rgb") || g.startsWith("#") || g === "black" || g === "white" || g === "transparent") && (c = g, n = t.replace(g, "").trim());
|
|
364
365
|
}
|
|
365
366
|
n = n.replace("inset", "").trim();
|
|
366
|
-
const
|
|
367
|
-
return { offsetX:
|
|
367
|
+
const o = n.split(/\s+/).map((g) => parseFloat(g) || 0), a = o[0] || 0, l = o[1] || 0, d = o[2] || 0, h = o[3] || 0, f = le(c);
|
|
368
|
+
return { offsetX: a, offsetY: l, blurRadius: d, spreadRadius: h, color: f.color, alpha: f.alpha };
|
|
368
369
|
}
|
|
369
370
|
const Ke = `varying vec2 vUv;
|
|
370
371
|
varying vec4 vScreenPos;
|
|
@@ -550,70 +551,70 @@ function tt(s, e, t, r = null, i) {
|
|
|
550
551
|
var S;
|
|
551
552
|
const c = r !== null || !!s.imageSrc;
|
|
552
553
|
let n = "";
|
|
553
|
-
const
|
|
554
|
+
const o = {};
|
|
554
555
|
if (i != null && i.uniforms)
|
|
555
556
|
for (const [R, E] of Object.entries(i.uniforms))
|
|
556
557
|
typeof E == "number" ? (n += `uniform float ${R};
|
|
557
|
-
`,
|
|
558
|
-
`,
|
|
559
|
-
`,
|
|
560
|
-
`,
|
|
561
|
-
`,
|
|
562
|
-
const
|
|
558
|
+
`, o[R] = { value: E }) : Array.isArray(E) ? E.length === 2 ? (n += `uniform vec2 ${R};
|
|
559
|
+
`, o[R] = { value: new w.Vector2(...E) }) : E.length === 3 ? (n += `uniform vec3 ${R};
|
|
560
|
+
`, o[R] = { value: new w.Vector3(...E) }) : E.length === 4 && (n += `uniform vec4 ${R};
|
|
561
|
+
`, o[R] = { value: new w.Vector4(...E) }) : (n += `uniform float ${R};
|
|
562
|
+
`, o[R] = { value: E });
|
|
563
|
+
const a = i !== void 0, l = (c || a ? Me.declChunk : "") + `
|
|
563
564
|
` + n, d = `vec2 screenUv = (vScreenPos.xy / vScreenPos.w) * 0.5 + 0.5;
|
|
564
565
|
`, h = s.isTraveler ? `vec2 resultUv = screenUv;
|
|
565
566
|
` : `vec2 localUv = (p / uSize) + 0.5;
|
|
566
567
|
vec2 resultUv = localUv * uTextureRepeat + uTextureOffset;
|
|
567
|
-
`, f = c ||
|
|
568
|
-
uSize: { value: new
|
|
569
|
-
uMeshSize: { value: new
|
|
570
|
-
uShadowColor: { value: new
|
|
571
|
-
uShadowOffset: { value: new
|
|
568
|
+
`, f = c || a ? d + h + ((i == null ? void 0 : i.uvModifier) || "") : "", g = c || a ? Me.baseColorChunk : "", p = (i == null ? void 0 : i.colorModifier) || "", v = Le.fragmentShader.replace("#INJECT_DECLARATIONS", l).replace("#INJECT_UV_MODIFIER", f).replace("#INJECT_BASE_COLOR", g).replace("#INJECT_COLOR_MODIFIER", p), y = le(s.backgroundColor), C = le(s.borderColor), k = {
|
|
569
|
+
uSize: { value: new w.Vector2(e, t) },
|
|
570
|
+
uMeshSize: { value: new w.Vector2(e, t) },
|
|
571
|
+
uShadowColor: { value: new w.Vector4(0, 0, 0, 0) },
|
|
572
|
+
uShadowOffset: { value: new w.Vector2(0, 0) },
|
|
572
573
|
uShadowBlur: { value: 0 },
|
|
573
574
|
uShadowSpread: { value: 0 },
|
|
574
575
|
uBgColor: {
|
|
575
|
-
value: new
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
576
|
+
value: new w.Vector4(
|
|
577
|
+
y.color.r,
|
|
578
|
+
y.color.g,
|
|
579
|
+
y.color.b,
|
|
580
|
+
y.alpha
|
|
580
581
|
)
|
|
581
582
|
},
|
|
582
583
|
uBorderColor: {
|
|
583
|
-
value: new
|
|
584
|
+
value: new w.Vector4(
|
|
584
585
|
C.color.r,
|
|
585
586
|
C.color.g,
|
|
586
587
|
C.color.b,
|
|
587
588
|
C.alpha
|
|
588
589
|
)
|
|
589
590
|
},
|
|
590
|
-
uBorderRadius: { value: new
|
|
591
|
-
uBorderWidth: { value:
|
|
591
|
+
uBorderRadius: { value: new w.Vector4(0, 0, 0, 0) },
|
|
592
|
+
uBorderWidth: { value: ae(s.borderWidth) },
|
|
592
593
|
uOpacity: { value: (S = s.opacity) != null ? S : 1 },
|
|
593
594
|
uTexture: { value: null },
|
|
594
|
-
uTextureRepeat: { value: new
|
|
595
|
-
uTextureOffset: { value: new
|
|
595
|
+
uTextureRepeat: { value: new w.Vector2(1, 1) },
|
|
596
|
+
uTextureOffset: { value: new w.Vector2(0, 0) },
|
|
596
597
|
uGradientCount: { value: 0 },
|
|
597
598
|
uGradientAngle: { value: 0 },
|
|
598
599
|
uGradientColors: {
|
|
599
|
-
value: Array.from({ length: 8 }, () => new
|
|
600
|
+
value: Array.from({ length: 8 }, () => new w.Vector4(0, 0, 0, 0))
|
|
600
601
|
},
|
|
601
602
|
uGradientStops: { value: new Float32Array(8) }
|
|
602
603
|
};
|
|
603
604
|
Be(k.uBorderRadius.value, s.borderRadius, Math.min(e, t)), c && (k.uTexture.value = r);
|
|
604
|
-
const D = new
|
|
605
|
-
uniforms: te(te({}, k),
|
|
605
|
+
const D = new w.ShaderMaterial({
|
|
606
|
+
uniforms: te(te({}, k), o),
|
|
606
607
|
vertexShader: Le.vertexShader,
|
|
607
608
|
fragmentShader: v,
|
|
608
609
|
transparent: !0,
|
|
609
|
-
side:
|
|
610
|
+
side: w.FrontSide
|
|
610
611
|
// for better performance
|
|
611
612
|
});
|
|
612
|
-
return s.backgroundImage &&
|
|
613
|
+
return s.backgroundImage && ye(D, { backgroundImage: s.backgroundImage }), D;
|
|
613
614
|
}
|
|
614
615
|
function rt(s, e, t, r, i) {
|
|
615
|
-
const c =
|
|
616
|
-
|
|
616
|
+
const c = ae(e.borderWidth);
|
|
617
|
+
ye(s, {
|
|
617
618
|
width: t,
|
|
618
619
|
height: r,
|
|
619
620
|
borderRadius: e.borderRadius,
|
|
@@ -626,15 +627,15 @@ function rt(s, e, t, r, i) {
|
|
|
626
627
|
boxShadow: e.boxShadow
|
|
627
628
|
});
|
|
628
629
|
}
|
|
629
|
-
function
|
|
630
|
+
function ye(s, e) {
|
|
630
631
|
var r, i, c;
|
|
631
632
|
if (e.boxShadow !== void 0) {
|
|
632
633
|
const n = je(e.boxShadow);
|
|
633
634
|
n ? (s.uniforms.uShadowColor.value.set(n.color.r, n.color.g, n.color.b, n.alpha), s.uniforms.uShadowOffset.value.set(n.offsetX, n.offsetY), s.uniforms.uShadowBlur.value = n.blurRadius, s.uniforms.uShadowSpread.value = n.spreadRadius, s.userData.shadowPadding = n.blurRadius + n.spreadRadius + Math.max(Math.abs(n.offsetX), Math.abs(n.offsetY))) : (s.uniforms.uShadowColor.value.w = 0, s.userData.shadowPadding = 0);
|
|
634
635
|
}
|
|
635
636
|
if (e.width !== void 0 && e.height !== void 0 && s.uniforms.uSize.value.set(e.width, e.height), s.uniforms.uMeshSize) {
|
|
636
|
-
const n = s.userData.shadowPadding || 0,
|
|
637
|
-
s.uniforms.uMeshSize.value.set(
|
|
637
|
+
const n = s.userData.shadowPadding || 0, o = e.width !== void 0 ? e.width : s.uniforms.uSize.value.x, a = e.height !== void 0 ? e.height : s.uniforms.uSize.value.y;
|
|
638
|
+
s.uniforms.uMeshSize.value.set(o + n * 2, a + n * 2);
|
|
638
639
|
}
|
|
639
640
|
if (e.borderRadius !== void 0) {
|
|
640
641
|
const n = e.width !== void 0 && e.height !== void 0 ? Math.min(e.width, e.height) : Math.min(s.uniforms.uSize.value.x, s.uniforms.uSize.value.y);
|
|
@@ -642,7 +643,7 @@ function we(s, e) {
|
|
|
642
643
|
}
|
|
643
644
|
if (e.borderWidth !== void 0 && (s.uniforms.uBorderWidth.value = e.borderWidth), e.backgroundColor !== void 0)
|
|
644
645
|
if (Array.isArray(e.backgroundColor)) {
|
|
645
|
-
const n = s.uniforms.uBgColor.value.w;
|
|
646
|
+
const n = e.backgroundColor[3] !== void 0 ? e.backgroundColor[3] : s.uniforms.uBgColor.value.w;
|
|
646
647
|
s.uniforms.uBgColor.value.set(
|
|
647
648
|
e.backgroundColor[0],
|
|
648
649
|
e.backgroundColor[1],
|
|
@@ -695,9 +696,9 @@ function we(s, e) {
|
|
|
695
696
|
e.opacity !== void 0 && (s.uniforms.uOpacity.value = e.opacity), e.bgOpacity !== void 0 && (s.uniforms.uBgColor.value.w = e.bgOpacity), e.borderOpacity !== void 0 && (s.uniforms.uBorderColor.value.w = e.borderOpacity), s.uniforms.uTexture && e.texture !== void 0 && (s.uniforms.uTexture.value = e.texture);
|
|
696
697
|
const t = e.texture !== void 0 ? e.texture : (r = s.uniforms.uTexture) == null ? void 0 : r.value;
|
|
697
698
|
if (t && (t.image instanceof ImageBitmap || t.image instanceof HTMLImageElement || t.image instanceof HTMLCanvasElement)) {
|
|
698
|
-
const n = t.image.naturalWidth || t.image.videoWidth || t.image.width,
|
|
699
|
-
if (n &&
|
|
700
|
-
const d = n /
|
|
699
|
+
const n = t.image.naturalWidth || t.image.videoWidth || t.image.width, o = t.image.naturalHeight || t.image.videoHeight || t.image.height, a = (i = e.width) != null ? i : s.uniforms.uSize.value.x, l = (c = e.height) != null ? c : s.uniforms.uSize.value.y;
|
|
700
|
+
if (n && o && a && l) {
|
|
701
|
+
const d = n / o, h = a / l;
|
|
701
702
|
if (d > h) {
|
|
702
703
|
const f = h / d;
|
|
703
704
|
s.uniforms.uTextureRepeat.value.set(f, 1), s.uniforms.uTextureOffset.value.set((1 - f) / 2, 0);
|
|
@@ -712,17 +713,17 @@ function we(s, e) {
|
|
|
712
713
|
const n = qe(e.backgroundImage);
|
|
713
714
|
if (n) {
|
|
714
715
|
s.uniforms.uGradientCount.value = n.stops.length, s.uniforms.uGradientAngle.value = n.angle;
|
|
715
|
-
for (let
|
|
716
|
-
if (
|
|
717
|
-
const
|
|
718
|
-
s.uniforms.uGradientColors.value[
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
), s.uniforms.uGradientStops.value[
|
|
716
|
+
for (let o = 0; o < 8; o++)
|
|
717
|
+
if (o < n.stops.length) {
|
|
718
|
+
const a = n.stops[o];
|
|
719
|
+
s.uniforms.uGradientColors.value[o].set(
|
|
720
|
+
a.color.r,
|
|
721
|
+
a.color.g,
|
|
722
|
+
a.color.b,
|
|
723
|
+
a.alpha
|
|
724
|
+
), s.uniforms.uGradientStops.value[o] = a.stop;
|
|
724
725
|
} else
|
|
725
|
-
s.uniforms.uGradientColors.value[
|
|
726
|
+
s.uniforms.uGradientColors.value[o].set(0, 0, 0, 0), s.uniforms.uGradientStops.value[o] = 1;
|
|
726
727
|
} else
|
|
727
728
|
s.uniforms.uGradientCount.value = 0;
|
|
728
729
|
}
|
|
@@ -730,7 +731,7 @@ function we(s, e) {
|
|
|
730
731
|
n !== "width" && n !== "height" && n !== "borderRadius" && n !== "borderWidth" && n !== "backgroundColor" && n !== "borderColor" && n !== "opacity" && n !== "bgOpacity" && n !== "borderOpacity" && n !== "texture" && n !== "backgroundImage" && n !== "boxShadow" && s.uniforms[n] !== void 0 && (s.uniforms[n].value !== void 0 && s.uniforms[n].value !== null && typeof s.uniforms[n].value.set == "function" ? Array.isArray(e[n]) ? s.uniforms[n].value.set(...e[n]) : e[n] !== void 0 && (e[n].copy ? s.uniforms[n].value.copy(e[n]) : s.uniforms[n].value = e[n]) : s.uniforms[n].value = e[n]);
|
|
731
732
|
}
|
|
732
733
|
function Be(s, e, t = 0) {
|
|
733
|
-
var
|
|
734
|
+
var a, l, d, h;
|
|
734
735
|
if (e == null) {
|
|
735
736
|
s.set(0, 0, 0, 0);
|
|
736
737
|
return;
|
|
@@ -743,32 +744,32 @@ function Be(s, e, t = 0) {
|
|
|
743
744
|
s.set(e[0], e[1], e[2], e[3]);
|
|
744
745
|
return;
|
|
745
746
|
}
|
|
746
|
-
const r = e.split("/")[0].trim().split(/\s+/), i =
|
|
747
|
-
s.set(i, c, n,
|
|
747
|
+
const r = e.split("/")[0].trim().split(/\s+/), i = ae(r[0], t), c = ae((a = r[1]) != null ? a : r[0], t), n = ae((l = r[2]) != null ? l : r[0], t), o = ae((h = (d = r[3]) != null ? d : r[1]) != null ? h : r[0], t);
|
|
748
|
+
s.set(i, c, n, o);
|
|
748
749
|
}
|
|
749
750
|
const W = {
|
|
750
|
-
create(s, e, t, r, i, c = 2, n = null,
|
|
751
|
+
create(s, e, t, r, i, c = 2, n = null, o) {
|
|
751
752
|
return s === "BOX" ? tt(
|
|
752
753
|
e,
|
|
753
754
|
r,
|
|
754
755
|
i,
|
|
755
756
|
n,
|
|
756
|
-
|
|
757
|
+
o
|
|
757
758
|
) : s === "TEXT" ? new $e(
|
|
758
759
|
t || "",
|
|
759
760
|
e,
|
|
760
761
|
r,
|
|
761
762
|
i,
|
|
762
763
|
c
|
|
763
|
-
) : new
|
|
764
|
+
) : new w.MeshBasicMaterial({ visible: !1 });
|
|
764
765
|
},
|
|
765
|
-
update(s, e, t, r, i, c, n = 2,
|
|
766
|
+
update(s, e, t, r, i, c, n = 2, o) {
|
|
766
767
|
e === "BOX" ? rt(
|
|
767
768
|
s,
|
|
768
769
|
t,
|
|
769
770
|
i,
|
|
770
771
|
c,
|
|
771
|
-
|
|
772
|
+
o
|
|
772
773
|
) : e === "TEXT" && s.updateText(
|
|
773
774
|
r || "",
|
|
774
775
|
t,
|
|
@@ -778,7 +779,7 @@ const W = {
|
|
|
778
779
|
);
|
|
779
780
|
},
|
|
780
781
|
forceUpdateUniforms(s, e) {
|
|
781
|
-
|
|
782
|
+
ye(s, e);
|
|
782
783
|
}
|
|
783
784
|
};
|
|
784
785
|
class it {
|
|
@@ -817,8 +818,8 @@ class it {
|
|
|
817
818
|
let r;
|
|
818
819
|
if (t.startsWith("data:image/svg+xml"))
|
|
819
820
|
r = yield new Promise((c, n) => {
|
|
820
|
-
const
|
|
821
|
-
|
|
821
|
+
const o = new Image();
|
|
822
|
+
o.onload = () => c(o), o.onerror = n, o.src = t;
|
|
822
823
|
});
|
|
823
824
|
else {
|
|
824
825
|
const n = yield (yield fetch(t)).blob();
|
|
@@ -828,8 +829,8 @@ class it {
|
|
|
828
829
|
"close" in r && r.close();
|
|
829
830
|
return;
|
|
830
831
|
}
|
|
831
|
-
const i = new
|
|
832
|
-
r instanceof HTMLImageElement || (i.flipY = !1), i.colorSpace =
|
|
832
|
+
const i = new w.Texture(r);
|
|
833
|
+
r instanceof HTMLImageElement || (i.flipY = !1), i.colorSpace = w.LinearSRGBColorSpace, i.needsUpdate = !0, this.textures.set(e, i), this.onUpdate(e, i);
|
|
833
834
|
} catch (r) {
|
|
834
835
|
console.warn("[MirageEngine] Failed to load texture:", t, r);
|
|
835
836
|
} finally {
|
|
@@ -874,26 +875,26 @@ class st {
|
|
|
874
875
|
u(this, "textureManager");
|
|
875
876
|
// private meshMap: Map<HTMLElement, THREE.Mesh> = new Map();
|
|
876
877
|
u(this, "fixedMeshes", /* @__PURE__ */ new Set());
|
|
877
|
-
var
|
|
878
|
-
this.target = e, this.mountContainer = r, this.registry = i, this.mode = (
|
|
878
|
+
var o, a, l, d, h;
|
|
879
|
+
this.target = e, this.mountContainer = r, this.registry = i, this.mode = (o = t.mode) != null ? o : "overlay", this.canvasSize = (a = t.canvasSize) != null ? a : "viewport", this.clipArea = (l = t.travelerClipArea) != null ? l : 1, this.targetLayer = (d = t.layer) != null ? d : "base", this.textureManager = new it((f, g) => {
|
|
879
880
|
const p = this.registry.get(f);
|
|
880
|
-
p && p.material instanceof
|
|
881
|
-
}, this.isViewport), this.canvas = document.createElement("canvas"), this.scene = new
|
|
881
|
+
p && p.material instanceof w.ShaderMaterial && W.forceUpdateUniforms(p.material, { texture: g });
|
|
882
|
+
}, this.isViewport), this.canvas = document.createElement("canvas"), this.scene = new w.Scene(), this.targetRect = this.target.getBoundingClientRect();
|
|
882
883
|
const c = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, n = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height;
|
|
883
|
-
this.camera = new
|
|
884
|
+
this.camera = new w.OrthographicCamera(
|
|
884
885
|
c / -2,
|
|
885
886
|
c / 2,
|
|
886
887
|
n / 2,
|
|
887
888
|
n / -2,
|
|
888
889
|
1,
|
|
889
890
|
1e3
|
|
890
|
-
), this.camera.position.z = 100, this.camera.layers.set(this.getSceneLayer()), this.renderer = new
|
|
891
|
+
), this.camera.position.z = 100, this.camera.layers.set(this.getSceneLayer()), this.renderer = new w.WebGLRenderer({
|
|
891
892
|
canvas: this.canvas,
|
|
892
893
|
alpha: !0,
|
|
893
894
|
antialias: !0
|
|
894
895
|
// [new]
|
|
895
896
|
// premultipliedAlpha: true
|
|
896
|
-
}),
|
|
897
|
+
}), w.ColorManagement.enabled = !1, this.renderer.outputColorSpace = w.LinearSRGBColorSpace, this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.setSize(c, n), this.applyTextQuality((h = t.quality) != null ? h : "medium");
|
|
897
898
|
}
|
|
898
899
|
get isViewport() {
|
|
899
900
|
return this.mode === "overlay" && this.canvasSize === "viewport";
|
|
@@ -905,13 +906,13 @@ class st {
|
|
|
905
906
|
for (let e = 0; e < z.MAX_LAYERS; e++) {
|
|
906
907
|
const t = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, r = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height;
|
|
907
908
|
this.renderTargets.push(
|
|
908
|
-
new
|
|
909
|
+
new w.WebGLRenderTarget(
|
|
909
910
|
t * this.qualityFactor,
|
|
910
911
|
r * this.qualityFactor,
|
|
911
912
|
{
|
|
912
|
-
minFilter:
|
|
913
|
-
magFilter:
|
|
914
|
-
format:
|
|
913
|
+
minFilter: w.LinearFilter,
|
|
914
|
+
magFilter: w.LinearFilter,
|
|
915
|
+
format: w.RGBAFormat,
|
|
915
916
|
stencilBuffer: !1,
|
|
916
917
|
depthBuffer: !0
|
|
917
918
|
}
|
|
@@ -970,8 +971,8 @@ class st {
|
|
|
970
971
|
this.camera.left = e / -2, this.camera.right = e / 2, this.camera.top = t / 2, this.camera.bottom = t / -2, this.camera.updateProjectionMatrix();
|
|
971
972
|
}
|
|
972
973
|
syncScene(e, t) {
|
|
973
|
-
const r = this.target.getBoundingClientRect(), i = this.isViewport ? window.innerWidth + this.overscan * 2 : r.width, c = this.isViewport ? window.innerHeight + this.overscan * 2 : r.height, n = this.isViewport ? this.canvas.clientWidth : this.targetRect.width,
|
|
974
|
-
|
|
974
|
+
const r = this.target.getBoundingClientRect(), i = this.isViewport ? window.innerWidth + this.overscan * 2 : r.width, c = this.isViewport ? window.innerHeight + this.overscan * 2 : r.height, n = this.isViewport ? this.canvas.clientWidth : this.targetRect.width, o = this.isViewport ? this.canvas.clientHeight : this.targetRect.height, a = Math.abs(i - n) > 0.1 || Math.abs(c - o) > 0.1, l = this.mode === "overlay" && (Math.abs(r.top - this.targetRect.top) > 0.1 || Math.abs(r.left - this.targetRect.left) > 0.1);
|
|
975
|
+
a ? (this.targetRect = r, this.setSize(i, c), this.updateCanvasLayout()) : l ? (this.targetRect = r, this.updateCanvasLayout()) : this.targetRect = r, this.renderOrder = 0, this.reconcileNode(e), t.size > 0 && t.forEach((d) => {
|
|
975
976
|
const h = this.registry.get(d);
|
|
976
977
|
if (h) {
|
|
977
978
|
this.scene.remove(h);
|
|
@@ -980,7 +981,7 @@ class st {
|
|
|
980
981
|
this.fixedMeshes.delete(h), h.geometry.dispose(), h.userData.nativeMesh && (this.scene.remove(h.userData.nativeMesh), Array.isArray(h.userData.nativeMesh.material) ? h.userData.nativeMesh.material.forEach(
|
|
981
982
|
(f) => f.dispose()
|
|
982
983
|
) : h.userData.nativeMesh.material.dispose(), h.userData.nativeMesh.geometry.dispose()), h.traverse((f) => {
|
|
983
|
-
f instanceof
|
|
984
|
+
f instanceof w.Mesh && (f.geometry && f.geometry.dispose(), f.material && (Array.isArray(f.material) ? f.material.forEach((g) => g.dispose()) : f.material.dispose()));
|
|
984
985
|
}), this.registry.remove(d), this.textureManager.unregister(d);
|
|
985
986
|
}
|
|
986
987
|
});
|
|
@@ -993,18 +994,18 @@ class st {
|
|
|
993
994
|
var i, c;
|
|
994
995
|
let t = this.registry.get(e.element);
|
|
995
996
|
const r = JSON.stringify(e.shaderHooks || null);
|
|
996
|
-
if (t && t.userData.shaderHash !== r && (this.scene.remove(t), t.geometry.dispose(), t.material instanceof
|
|
997
|
-
const n = new
|
|
997
|
+
if (t && t.userData.shaderHash !== r && (this.scene.remove(t), t.geometry.dispose(), t.material instanceof w.Material && t.material.dispose(), this.registry.remove(e.element), t = void 0), !t) {
|
|
998
|
+
const n = new w.PlaneGeometry(1, 1), o = e.isTraveler ? (i = this.renderTargets[e.captureLayer - 2]) == null ? void 0 : i.texture : this.textureManager.get(e.element), a = W.create(
|
|
998
999
|
"BOX",
|
|
999
1000
|
e.styles,
|
|
1000
1001
|
"",
|
|
1001
1002
|
e.rect.width,
|
|
1002
1003
|
e.rect.height,
|
|
1003
1004
|
this.qualityFactor,
|
|
1004
|
-
|
|
1005
|
+
o,
|
|
1005
1006
|
e.shaderHooks
|
|
1006
1007
|
);
|
|
1007
|
-
t = new
|
|
1008
|
+
t = new w.Mesh(n, a), e.type === "TEXT" && (t.name = "BG_MESH"), this.scene.add(t), this.registry.register(e.element, t), t.userData.baseMaterial = a, t.userData.domElement = e.element, t.userData.shaderHash = r;
|
|
1008
1009
|
}
|
|
1009
1010
|
if ((c = e.nativeStyles) != null && c.transform ? t.userData.nativeTransform = e.nativeStyles.transform : t.userData.nativeTransform = void 0, this.updateMeshProperties(t, e), this.updateMeshLayers(t, e), e.isTraveler)
|
|
1010
1011
|
for (let n = 0; n < z.MAX_LAYERS; n++)
|
|
@@ -1026,25 +1027,25 @@ class st {
|
|
|
1026
1027
|
var l;
|
|
1027
1028
|
const i = t.textLines || [
|
|
1028
1029
|
{ text: t.textContent || "", rect: t.rect }
|
|
1029
|
-
], c = r ? t.nativeStyles : t.textStyles, n = JSON.stringify(c) + t.textContent + i.map((d) => d.text).join("|"),
|
|
1030
|
-
if (t.dirtyMask &
|
|
1030
|
+
], c = r ? t.nativeStyles : t.textStyles, n = JSON.stringify(c) + t.textContent + i.map((d) => d.text).join("|"), o = (l = e.userData) == null ? void 0 : l.textChildStyleHash;
|
|
1031
|
+
if (t.dirtyMask & we || n !== o) {
|
|
1031
1032
|
e.children.filter(
|
|
1032
1033
|
(p) => p.name.startsWith("TEXT_CHILD")
|
|
1033
1034
|
).forEach((p) => {
|
|
1034
|
-
var
|
|
1035
|
+
var y;
|
|
1035
1036
|
const v = p;
|
|
1036
|
-
(
|
|
1037
|
+
(y = v.material.map) == null || y.dispose(), v.geometry.dispose(), e.remove(v);
|
|
1037
1038
|
});
|
|
1038
1039
|
const h = t.rect, f = h.x + h.width / 2, g = h.y + h.height / 2;
|
|
1039
1040
|
i.forEach((p, v) => {
|
|
1040
|
-
const
|
|
1041
|
+
const y = W.create(
|
|
1041
1042
|
"TEXT",
|
|
1042
1043
|
c,
|
|
1043
1044
|
p.text,
|
|
1044
1045
|
p.rect.width,
|
|
1045
1046
|
p.rect.height,
|
|
1046
1047
|
this.qualityFactor
|
|
1047
|
-
), C = new
|
|
1048
|
+
), C = new w.PlaneGeometry(1, 1), k = new w.Mesh(C, y);
|
|
1048
1049
|
k.name = `TEXT_CHILD_${v}`;
|
|
1049
1050
|
const D = t.rect.width === 0 ? 1 : p.rect.width / t.rect.width, S = t.rect.height === 0 ? 1 : p.rect.height / t.rect.height;
|
|
1050
1051
|
k.scale.set(D, S, 1);
|
|
@@ -1064,7 +1065,7 @@ class st {
|
|
|
1064
1065
|
h.layers.set(O.HIDDEN), t.visibility & $ && h.layers.enable(O.getCaptureLayer(t.nativeLayer));
|
|
1065
1066
|
else {
|
|
1066
1067
|
const f = t.visibility & $ ? O.BASE : O.HIDDEN;
|
|
1067
|
-
if (h.layers.set(f), t.visibility &
|
|
1068
|
+
if (h.layers.set(f), t.visibility & oe && h.layers.enable(O.SELECTED), t.visibility & $)
|
|
1068
1069
|
if (!r && t.nativeLayer !== void 0 && t.nativeStyles !== void 0)
|
|
1069
1070
|
for (let g = t.captureLayer; g <= z.MAX_LAYERS + 1; g++)
|
|
1070
1071
|
g !== t.nativeLayer && h.layers.enable(O.getCaptureLayer(g));
|
|
@@ -1076,10 +1077,10 @@ class st {
|
|
|
1076
1077
|
}
|
|
1077
1078
|
updateMeshProperties(e, t) {
|
|
1078
1079
|
var S, R, E, V, N;
|
|
1079
|
-
const { rect: r, styles: i } = t, c = this.renderer.getPixelRatio(), n = this.renderer.domElement.width / c,
|
|
1080
|
+
const { rect: r, styles: i } = t, c = this.renderer.getPixelRatio(), n = this.renderer.domElement.width / c, o = this.renderer.domElement.height / c;
|
|
1080
1081
|
e.material = e.userData.baseMaterial;
|
|
1081
|
-
let
|
|
1082
|
-
e.scale.set(r.width +
|
|
1082
|
+
let a = ((S = e.material.userData) == null ? void 0 : S.shadowPadding) || 0;
|
|
1083
|
+
e.scale.set(r.width + a * 2, r.height + a * 2, 1), e.userData.domRect = {
|
|
1083
1084
|
x: r.x,
|
|
1084
1085
|
y: r.y,
|
|
1085
1086
|
width: r.width,
|
|
@@ -1093,7 +1094,7 @@ class st {
|
|
|
1093
1094
|
f = r.x - window.innerWidth / 2 + r.width / 2, g = -r.y + window.innerHeight / 2 - r.height / 2;
|
|
1094
1095
|
else {
|
|
1095
1096
|
const L = r.x - d, P = r.y - h;
|
|
1096
|
-
f = L - n / 2 + r.width / 2, g = -P +
|
|
1097
|
+
f = L - n / 2 + r.width / 2, g = -P + o / 2 - r.height / 2;
|
|
1097
1098
|
}
|
|
1098
1099
|
e.position.set(
|
|
1099
1100
|
f,
|
|
@@ -1102,7 +1103,7 @@ class st {
|
|
|
1102
1103
|
);
|
|
1103
1104
|
const p = r.x, v = r.y;
|
|
1104
1105
|
e.userData.basePosition = { x: f, y: g }, e.userData.originalBasePosition = { x: f, y: g }, e.userData.baseSize = { width: r.width, height: r.height }, e.userData.baseDOM = { x: p, y: v }, e.userData.isFixed = t.isFixed, e.userData.initialScroll = { x: window.scrollX, y: window.scrollY };
|
|
1105
|
-
const
|
|
1106
|
+
const y = t.element.nodeType === Node.TEXT_NODE ? t.element.parentElement : t.element, C = window.getComputedStyle(y);
|
|
1106
1107
|
let k = 0, D = 0;
|
|
1107
1108
|
if (C.transform && C.transform !== "none") {
|
|
1108
1109
|
const L = new DOMMatrix(C.transform);
|
|
@@ -1128,7 +1129,7 @@ class st {
|
|
|
1128
1129
|
this.qualityFactor,
|
|
1129
1130
|
t.isTraveler ? (E = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : E.texture : this.textureManager.get(t.element),
|
|
1130
1131
|
t.shaderHooks
|
|
1131
|
-
), Y = new
|
|
1132
|
+
), Y = new w.Mesh(e.geometry, X);
|
|
1132
1133
|
t.type === "TEXT" && (Y.name = "BG_MESH"), this.scene.add(Y), e.userData.nativeMesh = Y;
|
|
1133
1134
|
}
|
|
1134
1135
|
const L = e.userData.nativeMesh;
|
|
@@ -1137,7 +1138,7 @@ class st {
|
|
|
1137
1138
|
P = t.nativeRect.x - window.innerWidth / 2 + t.nativeRect.width / 2, J = -t.nativeRect.y + window.innerHeight / 2 - t.nativeRect.height / 2;
|
|
1138
1139
|
else {
|
|
1139
1140
|
const X = t.nativeRect.x - d, Y = t.nativeRect.y - h;
|
|
1140
|
-
P = X - n / 2 + t.nativeRect.width / 2, J = -Y +
|
|
1141
|
+
P = X - n / 2 + t.nativeRect.width / 2, J = -Y + o / 2 - t.nativeRect.height / 2;
|
|
1141
1142
|
}
|
|
1142
1143
|
let Z = t.nativeRect.width, M = t.nativeRect.height, B = P, q = J;
|
|
1143
1144
|
if (t.nativeStyles.transform) {
|
|
@@ -1193,11 +1194,11 @@ class st {
|
|
|
1193
1194
|
t.isTraveler ? (N = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : N.texture : this.textureManager.get(t.element)
|
|
1194
1195
|
);
|
|
1195
1196
|
} else
|
|
1196
|
-
e.userData.nativeMesh && (this.scene.remove(e.userData.nativeMesh), e.userData.nativeMesh.material instanceof
|
|
1197
|
+
e.userData.nativeMesh && (this.scene.remove(e.userData.nativeMesh), e.userData.nativeMesh.material instanceof w.Material && e.userData.nativeMesh.material.dispose(), delete e.userData.nativeMesh);
|
|
1197
1198
|
}
|
|
1198
1199
|
updateMeshLayers(e, t) {
|
|
1199
1200
|
const r = t.visibility & $ ? O.BASE : O.HIDDEN;
|
|
1200
|
-
if (e.layers.set(r), t.visibility &
|
|
1201
|
+
if (e.layers.set(r), t.visibility & oe && e.layers.enable(O.SELECTED), e.userData.nativeMesh && t.nativeLayer !== void 0) {
|
|
1201
1202
|
const i = e.userData.nativeMesh;
|
|
1202
1203
|
if (i.layers.set(O.HIDDEN), t.visibility & $) {
|
|
1203
1204
|
i.layers.enable(O.getCaptureLayer(t.nativeLayer));
|
|
@@ -1211,15 +1212,15 @@ class st {
|
|
|
1211
1212
|
captureRenderTarget(e, t, r) {
|
|
1212
1213
|
if (e.size === 0 || !r)
|
|
1213
1214
|
return;
|
|
1214
|
-
const i = new
|
|
1215
|
+
const i = new w.Color(), c = this.renderer.getClearAlpha();
|
|
1215
1216
|
this.renderer.getClearColor(i), this.renderer.setClearColor(0, 0), this.renderer.setRenderTarget(r), this.renderer.clear(), this.renderer.autoClear = !1, this.renderer.setScissorTest(!0), this.camera.layers.set(t);
|
|
1216
|
-
const n = new
|
|
1217
|
+
const n = new w.Vector3(), o = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, a = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height, l = this.renderer.getPixelRatio();
|
|
1217
1218
|
for (const d of e) {
|
|
1218
1219
|
n.setFromMatrixPosition(d.matrixWorld), n.project(this.camera);
|
|
1219
|
-
const h = (n.x + 1) / 2 *
|
|
1220
|
+
const h = (n.x + 1) / 2 * o, f = (n.y + 1) / 2 * a;
|
|
1220
1221
|
let g = 0, p = 1;
|
|
1221
1222
|
typeof this.clipArea == "number" ? p = this.clipArea : this.clipArea.endsWith("%") ? p = parseFloat(this.clipArea) / 100 : this.clipArea.endsWith("px") && (g = parseFloat(this.clipArea));
|
|
1222
|
-
const v = d.scale.x * p + 0.5,
|
|
1223
|
+
const v = d.scale.x * p + 0.5, y = d.scale.y * p + 0.5, C = h - v / 2, k = f - y / 2, D = (C * this.qualityFactor - g) / l, S = (k * this.qualityFactor - g) / l, R = (v * this.qualityFactor + g * 2) / l, E = (y * this.qualityFactor + g * 2) / l;
|
|
1223
1224
|
this.renderer.setScissor(D, S, R, E), this.renderer.render(this.scene, this.camera);
|
|
1224
1225
|
}
|
|
1225
1226
|
this.renderer.setScissorTest(!1), this.renderer.autoClear = !0, this.renderer.setRenderTarget(null), this.camera.layers.set(this.getSceneLayer()), this.renderer.setClearColor(i, c);
|
|
@@ -1239,21 +1240,21 @@ class st {
|
|
|
1239
1240
|
const e = this.targetRect.left + window.scrollX, t = this.targetRect.top + window.scrollY, r = this.renderer.getPixelRatio(), i = this.renderer.domElement.width / r, c = this.renderer.domElement.height / r;
|
|
1240
1241
|
this.scene.children.forEach((n) => {
|
|
1241
1242
|
var h, f;
|
|
1242
|
-
const
|
|
1243
|
-
if (!
|
|
1243
|
+
const o = n;
|
|
1244
|
+
if (!o.userData || !o.userData.domElement)
|
|
1244
1245
|
return;
|
|
1245
|
-
const
|
|
1246
|
-
if (!
|
|
1246
|
+
const a = o.userData.domElement;
|
|
1247
|
+
if (!a.isConnected)
|
|
1247
1248
|
return;
|
|
1248
1249
|
let l;
|
|
1249
|
-
if (
|
|
1250
|
+
if (a.nodeType === Node.TEXT_NODE) {
|
|
1250
1251
|
const g = document.createRange();
|
|
1251
|
-
g.selectNode(
|
|
1252
|
+
g.selectNode(a), l = g.getBoundingClientRect();
|
|
1252
1253
|
} else
|
|
1253
|
-
l =
|
|
1254
|
-
const d =
|
|
1254
|
+
l = a.getBoundingClientRect();
|
|
1255
|
+
const d = o.userData.domRect;
|
|
1255
1256
|
if (!d || Math.abs(l.x - d.x) > 0.5 || Math.abs(l.y - d.y) > 0.5 || Math.abs(l.width - d.width) > 0.5 || Math.abs(l.height - d.height) > 0.5) {
|
|
1256
|
-
|
|
1257
|
+
o.userData.domRect = {
|
|
1257
1258
|
x: l.x,
|
|
1258
1259
|
y: l.y,
|
|
1259
1260
|
width: l.width,
|
|
@@ -1263,19 +1264,19 @@ class st {
|
|
|
1263
1264
|
if (this.isViewport)
|
|
1264
1265
|
g = l.x - window.innerWidth / 2 + l.width / 2, p = -l.y + window.innerHeight / 2 - l.height / 2;
|
|
1265
1266
|
else {
|
|
1266
|
-
const
|
|
1267
|
-
g =
|
|
1267
|
+
const y = l.x - e, C = l.y - t;
|
|
1268
|
+
g = y - i / 2 + l.width / 2, p = -C + c / 2 - l.height / 2;
|
|
1268
1269
|
}
|
|
1269
|
-
|
|
1270
|
-
let v = ((h =
|
|
1271
|
-
if (
|
|
1270
|
+
o.position.setX(g), o.position.setY(p);
|
|
1271
|
+
let v = ((h = o.material.userData) == null ? void 0 : h.shadowPadding) || 0;
|
|
1272
|
+
if (o.scale.set(l.width + v * 2, l.height + v * 2, 1), o.updateMatrixWorld(), o.material instanceof w.ShaderMaterial && W.forceUpdateUniforms(o.material, {
|
|
1272
1273
|
width: l.width,
|
|
1273
1274
|
height: l.height
|
|
1274
|
-
}),
|
|
1275
|
-
const
|
|
1275
|
+
}), o.userData.nativeMesh) {
|
|
1276
|
+
const y = o.userData.nativeMesh;
|
|
1276
1277
|
let C = l.width, k = l.height, D = g, S = p;
|
|
1277
|
-
if (
|
|
1278
|
-
const E =
|
|
1278
|
+
if (o.userData.nativeTransform) {
|
|
1279
|
+
const E = o.userData.nativeTransform, V = E.match(/scale\(([\d.]+%?)\)/);
|
|
1279
1280
|
if (V) {
|
|
1280
1281
|
let M = parseFloat(V[1]);
|
|
1281
1282
|
V[1].includes("%") && (M /= 100), C *= M, k *= M;
|
|
@@ -1311,8 +1312,8 @@ class st {
|
|
|
1311
1312
|
M.includes("%") && (B = B / 100 * l.height), S -= B;
|
|
1312
1313
|
}
|
|
1313
1314
|
}
|
|
1314
|
-
let R = ((f =
|
|
1315
|
-
|
|
1315
|
+
let R = ((f = y.material.userData) == null ? void 0 : f.shadowPadding) || 0;
|
|
1316
|
+
y.position.setX(D), y.position.setY(S), y.scale.set(C + R * 2, k + R * 2, 1), y.updateMatrixWorld(), y.material instanceof w.ShaderMaterial && W.forceUpdateUniforms(y.material, {
|
|
1316
1317
|
width: C,
|
|
1317
1318
|
height: k
|
|
1318
1319
|
});
|
|
@@ -1351,18 +1352,18 @@ function nt(s) {
|
|
|
1351
1352
|
p.bottom
|
|
1352
1353
|
)));
|
|
1353
1354
|
}
|
|
1354
|
-
},
|
|
1355
|
-
let
|
|
1356
|
-
for (const l of
|
|
1355
|
+
}, o = e.match(/[^\s\-]+\-?|\-|\s+/g) || [];
|
|
1356
|
+
let a = 0;
|
|
1357
|
+
for (const l of o) {
|
|
1357
1358
|
const d = document.createRange();
|
|
1358
|
-
d.setStart(s,
|
|
1359
|
+
d.setStart(s, a), d.setEnd(s, a + l.length);
|
|
1359
1360
|
const h = d.getClientRects();
|
|
1360
1361
|
if (h.length > 1)
|
|
1361
|
-
n(l,
|
|
1362
|
+
n(l, a);
|
|
1362
1363
|
else {
|
|
1363
1364
|
const f = h.length === 1 ? h[0] : d.getBoundingClientRect();
|
|
1364
1365
|
if (f.width === 0 && f.height === 0) {
|
|
1365
|
-
r += l,
|
|
1366
|
+
r += l, a += l.length;
|
|
1366
1367
|
continue;
|
|
1367
1368
|
}
|
|
1368
1369
|
c === -1 || Math.abs(f.top - c) > f.height / 2 ? (r && i && t.push({
|
|
@@ -1383,7 +1384,7 @@ function nt(s) {
|
|
|
1383
1384
|
f.bottom
|
|
1384
1385
|
)));
|
|
1385
1386
|
}
|
|
1386
|
-
|
|
1387
|
+
a += l.length;
|
|
1387
1388
|
}
|
|
1388
1389
|
return r && i && t.push({
|
|
1389
1390
|
text: r,
|
|
@@ -1413,7 +1414,7 @@ function De(s) {
|
|
|
1413
1414
|
letterSpacing: r
|
|
1414
1415
|
};
|
|
1415
1416
|
}
|
|
1416
|
-
function Oe(s, e = re | he | Pe |
|
|
1417
|
+
function Oe(s, e = re | he | Pe | we | fe, t, r = 1, i = 0, c = 2, n, o) {
|
|
1417
1418
|
var B, q, K, X, Y, ie, se;
|
|
1418
1419
|
if (s.nodeType === Node.TEXT_NODE) {
|
|
1419
1420
|
const m = s;
|
|
@@ -1466,7 +1467,7 @@ function Oe(s, e = re | he | Pe | ye | fe, t, r = 1, i = 0, c = 2, n, a) {
|
|
|
1466
1467
|
captureLayer: r,
|
|
1467
1468
|
isFixed: x.position === "fixed",
|
|
1468
1469
|
nativeLayer: n,
|
|
1469
|
-
nativeStyles:
|
|
1470
|
+
nativeStyles: o ? te(te({
|
|
1470
1471
|
backgroundColor: "transparent",
|
|
1471
1472
|
backgroundImage: "",
|
|
1472
1473
|
opacity: b && b.dataset[ee.KEY] === ee.VALUES.HIDE ? 1 : parseFloat(x.opacity),
|
|
@@ -1475,8 +1476,8 @@ function Oe(s, e = re | he | Pe | ye | fe, t, r = 1, i = 0, c = 2, n, a) {
|
|
|
1475
1476
|
borderColor: "transparent",
|
|
1476
1477
|
borderWidth: "0px",
|
|
1477
1478
|
isTraveler: !1
|
|
1478
|
-
}, De(x)),
|
|
1479
|
-
nativeRect:
|
|
1479
|
+
}, De(x)), o) : void 0,
|
|
1480
|
+
nativeRect: o ? {
|
|
1480
1481
|
x: _ + window.scrollX,
|
|
1481
1482
|
y: F + window.scrollY,
|
|
1482
1483
|
width: Q - _,
|
|
@@ -1487,7 +1488,7 @@ function Oe(s, e = re | he | Pe | ye | fe, t, r = 1, i = 0, c = 2, n, a) {
|
|
|
1487
1488
|
}
|
|
1488
1489
|
if (s.nodeType !== Node.ELEMENT_NODE)
|
|
1489
1490
|
return null;
|
|
1490
|
-
const
|
|
1491
|
+
const a = s, l = a.dataset[G.KEY];
|
|
1491
1492
|
let d = t, h = t;
|
|
1492
1493
|
if (l) {
|
|
1493
1494
|
const m = new Set(l.split(/\s+/));
|
|
@@ -1508,7 +1509,7 @@ function Oe(s, e = re | he | Pe | ye | fe, t, r = 1, i = 0, c = 2, n, a) {
|
|
|
1508
1509
|
);
|
|
1509
1510
|
m.has(G.VALUES.INCLUDE_TREE) ? d = d | $ : m.has(G.VALUES.EXCLUDE_TREE) && (d = d & ~$), h = d, m.has(G.VALUES.INCLUDE_SELF) ? h = h | $ : m.has(G.VALUES.EXCLUDE_SELF) && (h = h & ~$);
|
|
1510
1511
|
}
|
|
1511
|
-
const f =
|
|
1512
|
+
const f = a.dataset[j.KEY];
|
|
1512
1513
|
if (f) {
|
|
1513
1514
|
const m = new Set(f.split(/\s+/));
|
|
1514
1515
|
for (const A of m)
|
|
@@ -1526,10 +1527,10 @@ function Oe(s, e = re | he | Pe | ye | fe, t, r = 1, i = 0, c = 2, n, a) {
|
|
|
1526
1527
|
throw new Error(
|
|
1527
1528
|
"[MirageEngine] Conflicting selects: 'include-self' and 'exclude-self' cannot be used together on the same element."
|
|
1528
1529
|
);
|
|
1529
|
-
m.has(j.VALUES.INCLUDE_TREE) ? d = d |
|
|
1530
|
+
m.has(j.VALUES.INCLUDE_TREE) ? d = d | oe : m.has(j.VALUES.EXCLUDE_TREE) && (d = d & ~oe), h = d, m.has(j.VALUES.INCLUDE_SELF) ? h = h | oe : m.has(j.VALUES.EXCLUDE_SELF) && (h = h & ~oe);
|
|
1530
1531
|
}
|
|
1531
|
-
const g =
|
|
1532
|
-
let p = !1, v =
|
|
1532
|
+
const g = a.dataset[z.KEY];
|
|
1533
|
+
let p = !1, v = o ? te({}, o) : {}, y = n;
|
|
1533
1534
|
if (g) {
|
|
1534
1535
|
let m = 1;
|
|
1535
1536
|
const A = g.indexOf("{"), U = g.lastIndexOf("}");
|
|
@@ -1562,10 +1563,10 @@ function Oe(s, e = re | he | Pe | ye | fe, t, r = 1, i = 0, c = 2, n, a) {
|
|
|
1562
1563
|
if (Q !== -1) {
|
|
1563
1564
|
const I = x[Q + 1];
|
|
1564
1565
|
if (I && !isNaN(parseInt(I, 10)))
|
|
1565
|
-
|
|
1566
|
+
y = parseInt(I, 10);
|
|
1566
1567
|
else if (!p) {
|
|
1567
1568
|
const T = x.find((ne) => !isNaN(parseInt(ne, 10)));
|
|
1568
|
-
T && (
|
|
1569
|
+
T && (y = parseInt(T, 10));
|
|
1569
1570
|
}
|
|
1570
1571
|
}
|
|
1571
1572
|
if (_) {
|
|
@@ -1577,20 +1578,20 @@ function Oe(s, e = re | he | Pe | ye | fe, t, r = 1, i = 0, c = 2, n, a) {
|
|
|
1577
1578
|
r = Math.min(I, z.MAX_LAYERS + 1);
|
|
1578
1579
|
}
|
|
1579
1580
|
}
|
|
1580
|
-
const C =
|
|
1581
|
+
const C = a.dataset[We.KEY];
|
|
1581
1582
|
let k;
|
|
1582
1583
|
C && (k = JSON.parse(C));
|
|
1583
|
-
const D =
|
|
1584
|
+
const D = a.getBoundingClientRect(), S = window.getComputedStyle(a);
|
|
1584
1585
|
if (D.width === 0 || D.height === 0 || S.display === "none")
|
|
1585
1586
|
return null;
|
|
1586
|
-
let R =
|
|
1587
|
-
R || (R = Math.random().toString(36).substring(2, 11),
|
|
1587
|
+
let R = a.getAttribute("data-mid");
|
|
1588
|
+
R || (R = Math.random().toString(36).substring(2, 11), a.setAttribute("data-mid", R));
|
|
1588
1589
|
const E = parseInt(S.zIndex), V = (isNaN(E) ? 0 : E) + i;
|
|
1589
1590
|
let N;
|
|
1590
|
-
if (
|
|
1591
|
-
N =
|
|
1592
|
-
else if (
|
|
1593
|
-
const m =
|
|
1591
|
+
if (a.tagName === "IMG")
|
|
1592
|
+
N = a.src;
|
|
1593
|
+
else if (a.tagName.toLowerCase() === "svg") {
|
|
1594
|
+
const m = a.cloneNode(!0), A = v == null ? void 0 : v.color, U = v == null ? void 0 : v.fill, b = v == null ? void 0 : v.stroke, x = v == null ? void 0 : v.opacity, _ = (T, ne) => {
|
|
1594
1595
|
const H = window.getComputedStyle(T), ce = ne, Fe = H.fill === H.color, _e = H.stroke === H.color, ge = U || (Fe ? A : void 0) || H.fill;
|
|
1595
1596
|
ge && ge !== "none" && (ce.style.fill = ge);
|
|
1596
1597
|
const pe = b || (_e ? A : void 0) || H.stroke;
|
|
@@ -1602,8 +1603,8 @@ function Oe(s, e = re | he | Pe | ye | fe, t, r = 1, i = 0, c = 2, n, a) {
|
|
|
1602
1603
|
for (let de = 0; de < T.children.length; de++)
|
|
1603
1604
|
_(T.children[de], ne.children[de]);
|
|
1604
1605
|
};
|
|
1605
|
-
_(
|
|
1606
|
-
const F =
|
|
1606
|
+
_(a, m);
|
|
1607
|
+
const F = a.getBoundingClientRect(), Q = window.devicePixelRatio * c;
|
|
1607
1608
|
m.hasAttribute("viewBox") || m.setAttribute("viewBox", `0 0 ${F.width} ${F.height}`), m.setAttribute("width", (F.width * Q).toString()), m.setAttribute("height", (F.height * Q).toString());
|
|
1608
1609
|
let I = new XMLSerializer().serializeToString(m);
|
|
1609
1610
|
I.includes("xmlns=") || (I = I.replace(
|
|
@@ -1617,7 +1618,7 @@ function Oe(s, e = re | he | Pe | ye | fe, t, r = 1, i = 0, c = 2, n, a) {
|
|
|
1617
1618
|
const L = {
|
|
1618
1619
|
backgroundColor: S.backgroundColor,
|
|
1619
1620
|
backgroundImage: S.backgroundImage,
|
|
1620
|
-
opacity:
|
|
1621
|
+
opacity: a.dataset[ee.KEY] === ee.VALUES.HIDE ? 1 : parseFloat(S.opacity),
|
|
1621
1622
|
zIndex: V,
|
|
1622
1623
|
borderRadius: S.borderRadius,
|
|
1623
1624
|
borderColor: S.borderColor,
|
|
@@ -1628,7 +1629,7 @@ function Oe(s, e = re | he | Pe | ye | fe, t, r = 1, i = 0, c = 2, n, a) {
|
|
|
1628
1629
|
}, P = L;
|
|
1629
1630
|
let J, Z;
|
|
1630
1631
|
const M = [];
|
|
1631
|
-
return
|
|
1632
|
+
return a.tagName.toLowerCase() !== "svg" && Array.from(a.childNodes).forEach((m) => {
|
|
1632
1633
|
const A = m.nodeType === Node.TEXT_NODE ? h : d, U = Oe(
|
|
1633
1634
|
m,
|
|
1634
1635
|
e,
|
|
@@ -1636,14 +1637,14 @@ function Oe(s, e = re | he | Pe | ye | fe, t, r = 1, i = 0, c = 2, n, a) {
|
|
|
1636
1637
|
r,
|
|
1637
1638
|
V,
|
|
1638
1639
|
c,
|
|
1639
|
-
m.nodeType === Node.TEXT_NODE ?
|
|
1640
|
+
m.nodeType === Node.TEXT_NODE ? y : void 0,
|
|
1640
1641
|
m.nodeType === Node.TEXT_NODE && Object.keys(v).length > 0 ? v : void 0
|
|
1641
1642
|
);
|
|
1642
1643
|
U && M.push(U);
|
|
1643
1644
|
}), {
|
|
1644
1645
|
id: R,
|
|
1645
1646
|
type: "BOX",
|
|
1646
|
-
element:
|
|
1647
|
+
element: a,
|
|
1647
1648
|
rect: {
|
|
1648
1649
|
x: D.left + window.scrollX,
|
|
1649
1650
|
y: D.top + window.scrollY,
|
|
@@ -1657,8 +1658,8 @@ function Oe(s, e = re | he | Pe | ye | fe, t, r = 1, i = 0, c = 2, n, a) {
|
|
|
1657
1658
|
visibility: h,
|
|
1658
1659
|
isTraveler: p,
|
|
1659
1660
|
captureLayer: r,
|
|
1660
|
-
nativeLayer:
|
|
1661
|
-
nativeStyles:
|
|
1661
|
+
nativeLayer: y,
|
|
1662
|
+
nativeStyles: y !== void 0 ? Se(te({}, L), {
|
|
1662
1663
|
backgroundColor: (B = v.backgroundColor) != null ? B : L.backgroundColor,
|
|
1663
1664
|
backgroundImage: (q = v.backgroundImage) != null ? q : L.backgroundImage,
|
|
1664
1665
|
opacity: (K = v.opacity) != null ? K : L.opacity,
|
|
@@ -1670,7 +1671,7 @@ function Oe(s, e = re | he | Pe | ye | fe, t, r = 1, i = 0, c = 2, n, a) {
|
|
|
1670
1671
|
isTraveler: L.isTraveler,
|
|
1671
1672
|
transform: v.transform
|
|
1672
1673
|
}) : void 0,
|
|
1673
|
-
nativeRect:
|
|
1674
|
+
nativeRect: y !== void 0 ? {
|
|
1674
1675
|
x: v.x !== void 0 ? parseFloat(v.x) : D.left + window.scrollX,
|
|
1675
1676
|
y: v.y !== void 0 ? parseFloat(v.y) : D.top + window.scrollY,
|
|
1676
1677
|
width: v.width !== void 0 ? parseFloat(v.width) : D.width,
|
|
@@ -1681,25 +1682,27 @@ function Oe(s, e = re | he | Pe | ye | fe, t, r = 1, i = 0, c = 2, n, a) {
|
|
|
1681
1682
|
shaderHooks: k
|
|
1682
1683
|
};
|
|
1683
1684
|
}
|
|
1684
|
-
function
|
|
1685
|
+
function ot(s, e) {
|
|
1685
1686
|
e.size !== 0 && e.forEach((t, r) => {
|
|
1686
|
-
var c, n,
|
|
1687
|
+
var c, n, o, a;
|
|
1687
1688
|
const i = s.get(r);
|
|
1688
1689
|
!i || !i.userData.basePosition || (W.forceUpdateUniforms(i.material, {
|
|
1689
1690
|
backgroundColor: t.backgroundColor,
|
|
1690
1691
|
backgroundImage: t.backgroundImage,
|
|
1692
|
+
boxShadow: t.boxShadow,
|
|
1691
1693
|
opacity: t.opacity,
|
|
1692
1694
|
borderRadius: (n = t.borderRadius) != null ? n : (c = i.userData.baseStyles) == null ? void 0 : c.borderRadius
|
|
1693
1695
|
// width and height are no longer updated here, they are updated in syncMeshesByDOM
|
|
1694
1696
|
}), i.userData.nativeMesh && W.forceUpdateUniforms(i.userData.nativeMesh.material, {
|
|
1695
1697
|
backgroundColor: t.backgroundColor,
|
|
1696
1698
|
backgroundImage: t.backgroundImage,
|
|
1699
|
+
boxShadow: t.boxShadow,
|
|
1697
1700
|
opacity: t.opacity,
|
|
1698
|
-
borderRadius: (
|
|
1701
|
+
borderRadius: (a = t.borderRadius) != null ? a : (o = i.userData.baseStyles) == null ? void 0 : o.borderRadius
|
|
1699
1702
|
}));
|
|
1700
1703
|
});
|
|
1701
1704
|
}
|
|
1702
|
-
class
|
|
1705
|
+
class at {
|
|
1703
1706
|
constructor(e, t, r, i) {
|
|
1704
1707
|
u(this, "target");
|
|
1705
1708
|
u(this, "renderer");
|
|
@@ -1710,7 +1713,7 @@ class ot {
|
|
|
1710
1713
|
resizeDebounce: i.resizeDebounce
|
|
1711
1714
|
}), this.tracker.onLayoutChange.add((c, n) => {
|
|
1712
1715
|
document.querySelector(`[${z.NAME}~='${z.VALUES.TRAVELER}']`) !== null && !this.isTravelEnabled && (this.isTravelEnabled = !0, this.renderer.createRenderTarget());
|
|
1713
|
-
const
|
|
1716
|
+
const a = Oe(
|
|
1714
1717
|
this.target,
|
|
1715
1718
|
c,
|
|
1716
1719
|
$,
|
|
@@ -1718,9 +1721,9 @@ class ot {
|
|
|
1718
1721
|
0,
|
|
1719
1722
|
this.renderer.qualityFactor
|
|
1720
1723
|
);
|
|
1721
|
-
|
|
1724
|
+
a && this.renderer.syncScene(a, n);
|
|
1722
1725
|
}), this.tracker.onStyleChange.add((c) => {
|
|
1723
|
-
|
|
1726
|
+
ot(this.registry, c);
|
|
1724
1727
|
}), this.tracker.onRender.add(() => {
|
|
1725
1728
|
this.renderer.syncMeshesByDOM(), this.renderer.render();
|
|
1726
1729
|
});
|
|
@@ -1765,12 +1768,12 @@ class ct {
|
|
|
1765
1768
|
u(this, "registry");
|
|
1766
1769
|
var i, c, n;
|
|
1767
1770
|
if (this.target = e, this.registry = new lt(), !document.getElementById("mirage-engine-styles")) {
|
|
1768
|
-
const
|
|
1769
|
-
|
|
1771
|
+
const o = document.createElement("style");
|
|
1772
|
+
o.id = "mirage-engine-styles", o.textContent = `
|
|
1770
1773
|
[${ee.NAME}="${ee.VALUES.HIDE}"] {
|
|
1771
1774
|
opacity: 0 !important;
|
|
1772
1775
|
}
|
|
1773
|
-
`, document.head.appendChild(
|
|
1776
|
+
`, document.head.appendChild(o);
|
|
1774
1777
|
}
|
|
1775
1778
|
let r;
|
|
1776
1779
|
if (t.mode === "duplicate" ? r = (c = (i = t.container) != null ? i : this.target.parentElement) != null ? c : void 0 : r = (n = this.target.parentElement) != null ? n : void 0, !r)
|
|
@@ -1780,7 +1783,7 @@ class ct {
|
|
|
1780
1783
|
t,
|
|
1781
1784
|
r,
|
|
1782
1785
|
this.registry
|
|
1783
|
-
), this.renderer.mount(), this.syncer = new
|
|
1786
|
+
), this.renderer.mount(), this.syncer = new at(this.target, this.renderer, this.registry, t);
|
|
1784
1787
|
}
|
|
1785
1788
|
start() {
|
|
1786
1789
|
this.syncer.start();
|