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