@mirage-engine/core 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/CHANGELOG.md +16 -0
- package/dist/mirage-engine.js +254 -251
- package/dist/mirage-engine.umd.js +11 -11
- package/package.json +2 -2
- package/src/animation/Animator.ts +2 -0
package/dist/mirage-engine.js
CHANGED
|
@@ -2,16 +2,16 @@ var Oe = Object.defineProperty, Xe = Object.defineProperties;
|
|
|
2
2
|
var _e = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var xe = Object.getOwnPropertySymbols;
|
|
4
4
|
var Ne = Object.prototype.hasOwnProperty, ze = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var ve = (
|
|
5
|
+
var ve = (r, e, t) => e in r ? Oe(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, te = (r, e) => {
|
|
6
6
|
for (var t in e || (e = {}))
|
|
7
|
-
Ne.call(e, t) && ve(
|
|
7
|
+
Ne.call(e, t) && ve(r, t, e[t]);
|
|
8
8
|
if (xe)
|
|
9
9
|
for (var t of xe(e))
|
|
10
|
-
ze.call(e, t) && ve(
|
|
11
|
-
return
|
|
12
|
-
}, Se = (
|
|
13
|
-
var p = (
|
|
14
|
-
var Ee = (
|
|
10
|
+
ze.call(e, t) && ve(r, t, e[t]);
|
|
11
|
+
return r;
|
|
12
|
+
}, Se = (r, e) => Xe(r, _e(e));
|
|
13
|
+
var p = (r, e, t) => (ve(r, typeof e != "symbol" ? e + "" : e, t), t);
|
|
14
|
+
var Ee = (r, e, t) => new Promise((i, s) => {
|
|
15
15
|
var c = (n) => {
|
|
16
16
|
try {
|
|
17
17
|
a(t.next(n));
|
|
@@ -24,8 +24,8 @@ var Ee = (i, e, t) => new Promise((r, s) => {
|
|
|
24
24
|
} catch (l) {
|
|
25
25
|
s(l);
|
|
26
26
|
}
|
|
27
|
-
}, a = (n) => n.done ?
|
|
28
|
-
a((t = t.apply(
|
|
27
|
+
}, a = (n) => n.done ? i(n.value) : Promise.resolve(n.value).then(c, o);
|
|
28
|
+
a((t = t.apply(r, e)).next());
|
|
29
29
|
});
|
|
30
30
|
import * as w from "three";
|
|
31
31
|
const De = {
|
|
@@ -77,22 +77,23 @@ const De = {
|
|
|
77
77
|
FRONT: "front"
|
|
78
78
|
}
|
|
79
79
|
}, ue = 0, re = 1, he = 2, Ye = 4, fe = 8, we = 16;
|
|
80
|
-
function We(
|
|
81
|
-
const e =
|
|
80
|
+
function We(r) {
|
|
81
|
+
const e = r.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
|
-
function Pe(
|
|
89
|
+
function Pe(r) {
|
|
89
90
|
const e = {};
|
|
90
|
-
if (
|
|
91
|
-
const t = We(
|
|
92
|
-
e.backgroundColor = [t.r, t.g, t.b];
|
|
91
|
+
if (r.opacity && (e.opacity = parseFloat(r.opacity)), r.backgroundColor) {
|
|
92
|
+
const t = We(r.backgroundColor);
|
|
93
|
+
e.backgroundColor = [t.r, t.g, t.b, t.a];
|
|
93
94
|
}
|
|
94
|
-
if (
|
|
95
|
-
const t = new DOMMatrix(
|
|
95
|
+
if (r.backgroundImage ? e.backgroundImage = r.backgroundImage : r.background && (e.backgroundImage = r.background), r.boxShadow && (e.boxShadow = r.boxShadow), r.borderRadius && (e.borderRadius = parseFloat(r.borderRadius)), r.width && (e.width = parseFloat(r.width)), r.height && (e.height = parseFloat(r.height)), r.transform && r.transform !== "none") {
|
|
96
|
+
const t = new DOMMatrix(r.transform);
|
|
96
97
|
e.x = t.m41, e.y = t.m42, e.z = t.m43;
|
|
97
98
|
}
|
|
98
99
|
return e;
|
|
@@ -136,20 +137,20 @@ class He {
|
|
|
136
137
|
p(this, "renderLoop", () => {
|
|
137
138
|
if (!this.isRunning)
|
|
138
139
|
return;
|
|
139
|
-
this.onBeforeRender.forEach((
|
|
140
|
+
this.onBeforeRender.forEach((i) => i()), this.isDomDirty && (this.isDomDirty = !1, this.onLayoutChange.forEach((i) => i(this.pendingMask, this.pendingDeletions)), this.pendingDeletions.clear(), this.pendingMask = ue);
|
|
140
141
|
const e = window.scrollX, t = window.scrollY;
|
|
141
|
-
(e !== this.lastScrollX || t !== this.lastScrollY) && (this.onScrollChange.forEach((
|
|
142
|
+
(e !== this.lastScrollX || t !== this.lastScrollY) && (this.onScrollChange.forEach((i) => i(e, t)), this.lastScrollX = e, this.lastScrollY = t, this.scrollTimer && clearTimeout(this.scrollTimer), this.scrollTimer = window.setTimeout(() => {
|
|
142
143
|
this.pendingMask |= re, this.isDomDirty = !0, this.scrollTimer = null;
|
|
143
|
-
}, 150)), this.pendingStyles.size > 0 && (this.onStyleChange.forEach((
|
|
144
|
+
}, 150)), this.pendingStyles.size > 0 && (this.onStyleChange.forEach((i) => i(this.pendingStyles)), this.pendingStyles.clear()), this.onRender.forEach((i) => i()), requestAnimationFrame(this.renderLoop);
|
|
144
145
|
});
|
|
145
146
|
var s, c;
|
|
146
147
|
this.target = e;
|
|
147
|
-
const
|
|
148
|
-
|
|
148
|
+
const i = (s = t.resizeDebounce) != null ? s : !0;
|
|
149
|
+
i === !1 ? this.resizeConfig = { enabled: !1, delay: 0 } : i === !0 ? this.resizeConfig = { enabled: !0, delay: 150 } : this.resizeConfig = {
|
|
149
150
|
enabled: !0,
|
|
150
|
-
delay: (c =
|
|
151
|
-
onStart:
|
|
152
|
-
onEnd:
|
|
151
|
+
delay: (c = i.delay) != null ? c : 150,
|
|
152
|
+
onStart: i.onStart,
|
|
153
|
+
onEnd: i.onEnd
|
|
153
154
|
}, this.observer = new MutationObserver((o) => {
|
|
154
155
|
let a = ue;
|
|
155
156
|
for (const n of o)
|
|
@@ -192,10 +193,10 @@ class He {
|
|
|
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 q = 1, ae = 2, ht = 0,
|
|
196
|
+
const q = 1, ae = 2, ht = 0, B = {
|
|
196
197
|
BASE: 0,
|
|
197
198
|
SELECTED: 1,
|
|
198
|
-
getCaptureLayer: (
|
|
199
|
+
getCaptureLayer: (r) => 31 - r,
|
|
199
200
|
HIDDEN: 31
|
|
200
201
|
}, Te = Object.values(G.VALUES);
|
|
201
202
|
class Ae {
|
|
@@ -213,15 +214,15 @@ class Ae {
|
|
|
213
214
|
static calculateBaselineFromDOM(e) {
|
|
214
215
|
if (typeof document == "undefined")
|
|
215
216
|
return 0;
|
|
216
|
-
const t = document.createElement("div"),
|
|
217
|
-
t.style.visibility = "hidden", t.style.position = "absolute", t.style.top = "0px", t.style.left = "0px", t.style.font = e, t.style.margin = "0", t.style.padding = "0", t.style.border = "none",
|
|
218
|
-
const c = s.offsetTop -
|
|
217
|
+
const t = document.createElement("div"), i = document.createElement("span"), s = document.createElement("img");
|
|
218
|
+
t.style.visibility = "hidden", t.style.position = "absolute", t.style.top = "0px", t.style.left = "0px", t.style.font = e, t.style.margin = "0", t.style.padding = "0", t.style.border = "none", i.style.margin = "0", i.style.padding = "0", i.style.border = "none", i.style.lineHeight = "normal", s.width = 1, s.height = 1, s.style.verticalAlign = "baseline", i.appendChild(document.createTextNode("Hidden Text")), t.appendChild(i), t.appendChild(s), document.body.appendChild(t);
|
|
219
|
+
const c = s.offsetTop - i.offsetTop;
|
|
219
220
|
return document.body.removeChild(t), c;
|
|
220
221
|
}
|
|
221
222
|
}
|
|
222
223
|
p(Ae, "cache", /* @__PURE__ */ new Map());
|
|
223
224
|
class Ge extends w.MeshBasicMaterial {
|
|
224
|
-
constructor(t,
|
|
225
|
+
constructor(t, i, s, c, o = 2) {
|
|
225
226
|
super({
|
|
226
227
|
transparent: !0,
|
|
227
228
|
side: w.FrontSide,
|
|
@@ -232,9 +233,9 @@ class Ge extends w.MeshBasicMaterial {
|
|
|
232
233
|
p(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 = o, 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,
|
|
236
|
+
this.qualityFactor = o, 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, i, s, c);
|
|
236
237
|
}
|
|
237
|
-
wrapText(t,
|
|
238
|
+
wrapText(t, i) {
|
|
238
239
|
const s = t.split(`
|
|
239
240
|
`), c = [];
|
|
240
241
|
return s.forEach((o) => {
|
|
@@ -246,54 +247,54 @@ class Ge extends w.MeshBasicMaterial {
|
|
|
246
247
|
let n = a[0];
|
|
247
248
|
for (let l = 1; l < a.length; l++) {
|
|
248
249
|
const d = a[l];
|
|
249
|
-
this.ctx.measureText(n + d).width <=
|
|
250
|
+
this.ctx.measureText(n + d).width <= i + 2 ? n += d : (n && c.push(n), n = d.trimStart());
|
|
250
251
|
}
|
|
251
252
|
n && c.push(n);
|
|
252
253
|
}), c;
|
|
253
254
|
}
|
|
254
|
-
updateText(t,
|
|
255
|
+
updateText(t, i, s, c, o) {
|
|
255
256
|
o !== void 0 && (this.qualityFactor = o);
|
|
256
257
|
const n = (window.devicePixelRatio || 1) * this.qualityFactor, l = s * n, d = c * n;
|
|
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(n, 0, 0, n, 0, 0), this.ctx.font =
|
|
258
|
-
const h = this.wrapText(t, s), u =
|
|
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(n, 0, 0, n, 0, 0), this.ctx.font = i.font, this.ctx.fillStyle = i.color, this.ctx.textBaseline = "alphabetic", this.ctx.globalAlpha = 1;
|
|
259
|
+
const h = this.wrapText(t, s), u = i.lineHeight, f = Ae.getBaseline(i.font);
|
|
259
260
|
h.forEach((g, v) => {
|
|
260
261
|
const b = v * u + f;
|
|
261
262
|
let C = 0;
|
|
262
|
-
|
|
263
|
+
i.textAlign === "center" ? C = s / 2 : i.textAlign === "right" && (C = s), this.ctx.textAlign = i.textAlign, this.ctx.fillText(g, C, b);
|
|
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 ne(
|
|
270
|
-
if (typeof
|
|
271
|
-
return
|
|
272
|
-
const t = parseFloat(
|
|
273
|
-
return typeof
|
|
270
|
+
function ne(r, e = 0) {
|
|
271
|
+
if (typeof r == "number")
|
|
272
|
+
return r;
|
|
273
|
+
const t = parseFloat(r) || 0;
|
|
274
|
+
return typeof r == "string" && r.includes("%") ? t / 100 * e : t;
|
|
274
275
|
}
|
|
275
|
-
function le(
|
|
276
|
-
if (!
|
|
276
|
+
function le(r) {
|
|
277
|
+
if (!r || r === "transparent")
|
|
277
278
|
return { color: new w.Color(16777215), alpha: 0 };
|
|
278
|
-
const e =
|
|
279
|
+
const e = r.match(
|
|
279
280
|
/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/
|
|
280
281
|
);
|
|
281
282
|
if (e) {
|
|
282
|
-
const t = parseInt(e[1], 10),
|
|
283
|
-
return { color: new w.Color(`rgb(${t}, ${
|
|
283
|
+
const t = parseInt(e[1], 10), i = parseInt(e[2], 10), s = parseInt(e[3], 10), c = e[4] !== void 0 ? parseFloat(e[4]) : 1;
|
|
284
|
+
return { color: new w.Color(`rgb(${t}, ${i}, ${s})`), alpha: c };
|
|
284
285
|
}
|
|
285
|
-
return { color: new w.Color(
|
|
286
|
+
return { color: new w.Color(r), alpha: 1 };
|
|
286
287
|
}
|
|
287
|
-
function Ie(
|
|
288
|
+
function Ie(r) {
|
|
288
289
|
const e = [];
|
|
289
|
-
let t = "",
|
|
290
|
-
for (let s = 0; s <
|
|
291
|
-
const c =
|
|
290
|
+
let t = "", i = 0;
|
|
291
|
+
for (let s = 0; s < r.length; s++) {
|
|
292
|
+
const c = r[s];
|
|
292
293
|
if (c === "(")
|
|
293
|
-
|
|
294
|
+
i++;
|
|
294
295
|
else if (c === ")")
|
|
295
|
-
|
|
296
|
-
else if (c === "," &&
|
|
296
|
+
i--;
|
|
297
|
+
else if (c === "," && i === 0) {
|
|
297
298
|
e.push(t.trim()), t = "";
|
|
298
299
|
continue;
|
|
299
300
|
}
|
|
@@ -301,15 +302,15 @@ function Ie(i) {
|
|
|
301
302
|
}
|
|
302
303
|
return t && e.push(t.trim()), e;
|
|
303
304
|
}
|
|
304
|
-
function qe(
|
|
305
|
-
if (!
|
|
305
|
+
function qe(r) {
|
|
306
|
+
if (!r || typeof r != "string" || !r.includes("linear-gradient"))
|
|
306
307
|
return null;
|
|
307
|
-
const e =
|
|
308
|
+
const e = r.match(/linear-gradient\((.*)\)/);
|
|
308
309
|
if (!e)
|
|
309
310
|
return null;
|
|
310
|
-
const t = e[1],
|
|
311
|
+
const t = e[1], i = Ie(t);
|
|
311
312
|
let s = Math.PI, c = 0;
|
|
312
|
-
const o =
|
|
313
|
+
const o = i[0].trim();
|
|
313
314
|
if (o.startsWith("to "))
|
|
314
315
|
o === "to top" ? s = 0 : o === "to right" ? s = Math.PI / 2 : o === "to bottom" ? s = Math.PI : o === "to left" ? s = Math.PI * 1.5 : o === "to top right" || o === "to right top" ? s = Math.PI / 4 : o === "to bottom right" || o === "to right bottom" ? s = Math.PI * 0.75 : o === "to bottom left" || o === "to left bottom" ? s = Math.PI * 1.25 : (o === "to top left" || o === "to left top") && (s = Math.PI * 1.75), c = 1;
|
|
315
316
|
else if (o.endsWith("deg") || o.endsWith("rad") || o.endsWith("turn")) {
|
|
@@ -317,8 +318,8 @@ function qe(i) {
|
|
|
317
318
|
o.endsWith("deg") ? s = n * (Math.PI / 180) : o.endsWith("rad") ? s = n : o.endsWith("turn") && (s = n * Math.PI * 2), c = 1;
|
|
318
319
|
}
|
|
319
320
|
const a = [];
|
|
320
|
-
for (let n = c; n <
|
|
321
|
-
const l =
|
|
321
|
+
for (let n = c; n < i.length && !(a.length >= 8); n++) {
|
|
322
|
+
const l = i[n].trim(), d = l.lastIndexOf(" ");
|
|
322
323
|
let h = l, u = null;
|
|
323
324
|
if (d !== -1 && !l.endsWith(")")) {
|
|
324
325
|
const g = l.substring(d + 1);
|
|
@@ -350,13 +351,13 @@ function qe(i) {
|
|
|
350
351
|
}
|
|
351
352
|
return { angle: s, stops: a };
|
|
352
353
|
}
|
|
353
|
-
function $e(
|
|
354
|
-
if (!
|
|
354
|
+
function $e(r) {
|
|
355
|
+
if (!r || r === "none")
|
|
355
356
|
return null;
|
|
356
|
-
const e = Ie(
|
|
357
|
+
const e = Ie(r);
|
|
357
358
|
if (e.length === 0)
|
|
358
359
|
return null;
|
|
359
|
-
const t = e[0].trim(),
|
|
360
|
+
const t = e[0].trim(), i = /(rgba?\([^)]+\)|#[0-9a-fA-F]+|[a-zA-Z]+)/, s = t.match(i);
|
|
360
361
|
let c = "transparent", o = t;
|
|
361
362
|
if (s && s[1] !== "inset") {
|
|
362
363
|
const f = s[1];
|
|
@@ -546,9 +547,9 @@ baseColor = blendSrcOver(baseColor, texColor);`, Re = {
|
|
|
546
547
|
uvChunk: Ze,
|
|
547
548
|
baseColorChunk: Qe
|
|
548
549
|
};
|
|
549
|
-
function et(
|
|
550
|
+
function et(r, e, t, i = null, s) {
|
|
550
551
|
var S;
|
|
551
|
-
const c =
|
|
552
|
+
const c = i !== null || !!r.imageSrc;
|
|
552
553
|
let o = "";
|
|
553
554
|
const a = {};
|
|
554
555
|
if (s != null && s.uniforms)
|
|
@@ -561,10 +562,10 @@ function et(i, e, t, r = null, s) {
|
|
|
561
562
|
`, a[R] = { value: E });
|
|
562
563
|
const n = s !== void 0, l = (c || n ? Me.declChunk : "") + `
|
|
563
564
|
` + o, d = `vec2 screenUv = (vScreenPos.xy / vScreenPos.w) * 0.5 + 0.5;
|
|
564
|
-
`, h =
|
|
565
|
+
`, h = r.isTraveler ? `vec2 resultUv = screenUv;
|
|
565
566
|
` : `vec2 localUv = (p / uSize) + 0.5;
|
|
566
567
|
vec2 resultUv = localUv * uTextureRepeat + uTextureOffset;
|
|
567
|
-
`, u = c || n ? d + h + ((s == null ? void 0 : s.uvModifier) || "") : "", f = c || n ? Me.baseColorChunk : "", g = (s == null ? void 0 : s.colorModifier) || "", v = Re.fragmentShader.replace("#INJECT_DECLARATIONS", l).replace("#INJECT_UV_MODIFIER", u).replace("#INJECT_BASE_COLOR", f).replace("#INJECT_COLOR_MODIFIER", g), b = le(
|
|
568
|
+
`, u = c || n ? d + h + ((s == null ? void 0 : s.uvModifier) || "") : "", f = c || n ? Me.baseColorChunk : "", g = (s == null ? void 0 : s.colorModifier) || "", v = Re.fragmentShader.replace("#INJECT_DECLARATIONS", l).replace("#INJECT_UV_MODIFIER", u).replace("#INJECT_BASE_COLOR", f).replace("#INJECT_COLOR_MODIFIER", g), b = le(r.backgroundColor), C = le(r.borderColor), I = {
|
|
568
569
|
uSize: { value: new w.Vector2(e, t) },
|
|
569
570
|
uMeshSize: { value: new w.Vector2(e, t) },
|
|
570
571
|
uShadowColor: { value: new w.Vector4(0, 0, 0, 0) },
|
|
@@ -588,8 +589,8 @@ vec2 resultUv = localUv * uTextureRepeat + uTextureOffset;
|
|
|
588
589
|
)
|
|
589
590
|
},
|
|
590
591
|
uBorderRadius: { value: new w.Vector4(0, 0, 0, 0) },
|
|
591
|
-
uBorderWidth: { value: ne(
|
|
592
|
-
uOpacity: { value: (S =
|
|
592
|
+
uBorderWidth: { value: ne(r.borderWidth) },
|
|
593
|
+
uOpacity: { value: (S = r.opacity) != null ? S : 1 },
|
|
593
594
|
uTexture: { value: null },
|
|
594
595
|
uTextureRepeat: { value: new w.Vector2(1, 1) },
|
|
595
596
|
uTextureOffset: { value: new w.Vector2(0, 0) },
|
|
@@ -600,7 +601,7 @@ vec2 resultUv = localUv * uTextureRepeat + uTextureOffset;
|
|
|
600
601
|
},
|
|
601
602
|
uGradientStops: { value: new Float32Array(8) }
|
|
602
603
|
};
|
|
603
|
-
ke(I.uBorderRadius.value,
|
|
604
|
+
ke(I.uBorderRadius.value, r.borderRadius, Math.min(e, t)), c && (I.uTexture.value = i);
|
|
604
605
|
const D = new w.ShaderMaterial({
|
|
605
606
|
uniforms: te(te({}, I), a),
|
|
606
607
|
vertexShader: Re.vertexShader,
|
|
@@ -609,13 +610,13 @@ vec2 resultUv = localUv * uTextureRepeat + uTextureOffset;
|
|
|
609
610
|
side: w.FrontSide
|
|
610
611
|
// for better performance
|
|
611
612
|
});
|
|
612
|
-
return
|
|
613
|
+
return r.backgroundImage && be(D, { backgroundImage: r.backgroundImage }), D;
|
|
613
614
|
}
|
|
614
|
-
function tt(
|
|
615
|
+
function tt(r, e, t, i, s) {
|
|
615
616
|
const c = ne(e.borderWidth);
|
|
616
|
-
be(
|
|
617
|
+
be(r, {
|
|
617
618
|
width: t,
|
|
618
|
-
height:
|
|
619
|
+
height: i,
|
|
619
620
|
borderRadius: e.borderRadius,
|
|
620
621
|
borderWidth: c,
|
|
621
622
|
backgroundColor: e.backgroundColor,
|
|
@@ -626,24 +627,24 @@ function tt(i, e, t, r, s) {
|
|
|
626
627
|
boxShadow: e.boxShadow
|
|
627
628
|
});
|
|
628
629
|
}
|
|
629
|
-
function be(
|
|
630
|
-
var
|
|
630
|
+
function be(r, e) {
|
|
631
|
+
var i, s, c;
|
|
631
632
|
if (e.boxShadow !== void 0) {
|
|
632
633
|
const o = $e(e.boxShadow);
|
|
633
|
-
o ? (
|
|
634
|
+
o ? (r.uniforms.uShadowColor.value.set(o.color.r, o.color.g, o.color.b, o.alpha), r.uniforms.uShadowOffset.value.set(o.offsetX, o.offsetY), r.uniforms.uShadowBlur.value = o.blurRadius, r.uniforms.uShadowSpread.value = o.spreadRadius, r.userData.shadowPadding = o.blurRadius + o.spreadRadius + Math.max(Math.abs(o.offsetX), Math.abs(o.offsetY))) : (r.uniforms.uShadowColor.value.w = 0, r.userData.shadowPadding = 0);
|
|
634
635
|
}
|
|
635
|
-
if (e.width !== void 0 && e.height !== void 0 &&
|
|
636
|
-
const o =
|
|
637
|
-
|
|
636
|
+
if (e.width !== void 0 && e.height !== void 0 && r.uniforms.uSize.value.set(e.width, e.height), r.uniforms.uMeshSize) {
|
|
637
|
+
const o = r.userData.shadowPadding || 0, a = e.width !== void 0 ? e.width : r.uniforms.uSize.value.x, n = e.height !== void 0 ? e.height : r.uniforms.uSize.value.y;
|
|
638
|
+
r.uniforms.uMeshSize.value.set(a + o * 2, n + o * 2);
|
|
638
639
|
}
|
|
639
640
|
if (e.borderRadius !== void 0) {
|
|
640
|
-
const o = e.width !== void 0 && e.height !== void 0 ? Math.min(e.width, e.height) : Math.min(
|
|
641
|
-
ke(
|
|
641
|
+
const o = e.width !== void 0 && e.height !== void 0 ? Math.min(e.width, e.height) : Math.min(r.uniforms.uSize.value.x, r.uniforms.uSize.value.y);
|
|
642
|
+
ke(r.uniforms.uBorderRadius.value, e.borderRadius, o);
|
|
642
643
|
}
|
|
643
|
-
if (e.borderWidth !== void 0 && (
|
|
644
|
+
if (e.borderWidth !== void 0 && (r.uniforms.uBorderWidth.value = e.borderWidth), e.backgroundColor !== void 0)
|
|
644
645
|
if (Array.isArray(e.backgroundColor)) {
|
|
645
|
-
const o =
|
|
646
|
-
|
|
646
|
+
const o = e.backgroundColor[3] !== void 0 ? e.backgroundColor[3] : r.uniforms.uBgColor.value.w;
|
|
647
|
+
r.uniforms.uBgColor.value.set(
|
|
647
648
|
e.backgroundColor[0],
|
|
648
649
|
e.backgroundColor[1],
|
|
649
650
|
e.backgroundColor[2],
|
|
@@ -651,15 +652,15 @@ function be(i, e) {
|
|
|
651
652
|
);
|
|
652
653
|
} else if (typeof e.backgroundColor == "string") {
|
|
653
654
|
const o = le(e.backgroundColor);
|
|
654
|
-
|
|
655
|
+
r.uniforms.uBgColor.value.set(
|
|
655
656
|
o.color.r,
|
|
656
657
|
o.color.g,
|
|
657
658
|
o.color.b,
|
|
658
659
|
o.alpha
|
|
659
660
|
);
|
|
660
661
|
} else {
|
|
661
|
-
const o =
|
|
662
|
-
|
|
662
|
+
const o = r.uniforms.uBgColor.value.w;
|
|
663
|
+
r.uniforms.uBgColor.value.set(
|
|
663
664
|
e.backgroundColor.r,
|
|
664
665
|
e.backgroundColor.g,
|
|
665
666
|
e.backgroundColor.b,
|
|
@@ -668,8 +669,8 @@ function be(i, e) {
|
|
|
668
669
|
}
|
|
669
670
|
if (e.borderColor !== void 0)
|
|
670
671
|
if (Array.isArray(e.borderColor)) {
|
|
671
|
-
const o =
|
|
672
|
-
|
|
672
|
+
const o = r.uniforms.uBorderColor.value.w;
|
|
673
|
+
r.uniforms.uBorderColor.value.set(
|
|
673
674
|
e.borderColor[0],
|
|
674
675
|
e.borderColor[1],
|
|
675
676
|
e.borderColor[2],
|
|
@@ -677,108 +678,108 @@ function be(i, e) {
|
|
|
677
678
|
);
|
|
678
679
|
} else if (typeof e.borderColor == "string") {
|
|
679
680
|
const o = le(e.borderColor);
|
|
680
|
-
|
|
681
|
+
r.uniforms.uBorderColor.value.set(
|
|
681
682
|
o.color.r,
|
|
682
683
|
o.color.g,
|
|
683
684
|
o.color.b,
|
|
684
685
|
o.alpha
|
|
685
686
|
);
|
|
686
687
|
} else {
|
|
687
|
-
const o =
|
|
688
|
-
|
|
688
|
+
const o = r.uniforms.uBorderColor.value.w;
|
|
689
|
+
r.uniforms.uBorderColor.value.set(
|
|
689
690
|
e.borderColor.r,
|
|
690
691
|
e.borderColor.g,
|
|
691
692
|
e.borderColor.b,
|
|
692
693
|
o
|
|
693
694
|
);
|
|
694
695
|
}
|
|
695
|
-
e.opacity !== void 0 && (
|
|
696
|
-
const t = e.texture !== void 0 ? e.texture : (
|
|
696
|
+
e.opacity !== void 0 && (r.uniforms.uOpacity.value = e.opacity), e.bgOpacity !== void 0 && (r.uniforms.uBgColor.value.w = e.bgOpacity), e.borderOpacity !== void 0 && (r.uniforms.uBorderColor.value.w = e.borderOpacity), r.uniforms.uTexture && e.texture !== void 0 && (r.uniforms.uTexture.value = e.texture);
|
|
697
|
+
const t = e.texture !== void 0 ? e.texture : (i = r.uniforms.uTexture) == null ? void 0 : i.value;
|
|
697
698
|
if (t && (t.image instanceof ImageBitmap || t.image instanceof HTMLImageElement || t.image instanceof HTMLCanvasElement)) {
|
|
698
|
-
const o = t.image.naturalWidth || t.image.videoWidth || t.image.width, a = t.image.naturalHeight || t.image.videoHeight || t.image.height, n = (s = e.width) != null ? s :
|
|
699
|
+
const o = t.image.naturalWidth || t.image.videoWidth || t.image.width, a = t.image.naturalHeight || t.image.videoHeight || t.image.height, n = (s = e.width) != null ? s : r.uniforms.uSize.value.x, l = (c = e.height) != null ? c : r.uniforms.uSize.value.y;
|
|
699
700
|
if (o && a && n && l) {
|
|
700
701
|
const d = o / a, h = n / l;
|
|
701
702
|
if (d > h) {
|
|
702
703
|
const u = h / d;
|
|
703
|
-
|
|
704
|
+
r.uniforms.uTextureRepeat.value.set(u, 1), r.uniforms.uTextureOffset.value.set((1 - u) / 2, 0);
|
|
704
705
|
} else {
|
|
705
706
|
const u = d / h;
|
|
706
|
-
|
|
707
|
+
r.uniforms.uTextureRepeat.value.set(1, u), r.uniforms.uTextureOffset.value.set(0, (1 - u) / 2);
|
|
707
708
|
}
|
|
708
709
|
}
|
|
709
710
|
} else
|
|
710
|
-
|
|
711
|
+
r.uniforms.uTextureRepeat && (r.uniforms.uTextureRepeat.value.set(1, 1), r.uniforms.uTextureOffset.value.set(0, 0));
|
|
711
712
|
if (e.backgroundImage !== void 0) {
|
|
712
713
|
const o = qe(e.backgroundImage);
|
|
713
714
|
if (o) {
|
|
714
|
-
|
|
715
|
+
r.uniforms.uGradientCount.value = o.stops.length, r.uniforms.uGradientAngle.value = o.angle;
|
|
715
716
|
for (let a = 0; a < 8; a++)
|
|
716
717
|
if (a < o.stops.length) {
|
|
717
718
|
const n = o.stops[a];
|
|
718
|
-
|
|
719
|
+
r.uniforms.uGradientColors.value[a].set(
|
|
719
720
|
n.color.r,
|
|
720
721
|
n.color.g,
|
|
721
722
|
n.color.b,
|
|
722
723
|
n.alpha
|
|
723
|
-
),
|
|
724
|
+
), r.uniforms.uGradientStops.value[a] = n.stop;
|
|
724
725
|
} else
|
|
725
|
-
|
|
726
|
+
r.uniforms.uGradientColors.value[a].set(0, 0, 0, 0), r.uniforms.uGradientStops.value[a] = 1;
|
|
726
727
|
} else
|
|
727
|
-
|
|
728
|
+
r.uniforms.uGradientCount.value = 0;
|
|
728
729
|
}
|
|
729
730
|
for (const o of Object.keys(e))
|
|
730
|
-
o !== "width" && o !== "height" && o !== "borderRadius" && o !== "borderWidth" && o !== "backgroundColor" && o !== "borderColor" && o !== "opacity" && o !== "bgOpacity" && o !== "borderOpacity" && o !== "texture" && o !== "backgroundImage" && o !== "boxShadow" &&
|
|
731
|
+
o !== "width" && o !== "height" && o !== "borderRadius" && o !== "borderWidth" && o !== "backgroundColor" && o !== "borderColor" && o !== "opacity" && o !== "bgOpacity" && o !== "borderOpacity" && o !== "texture" && o !== "backgroundImage" && o !== "boxShadow" && r.uniforms[o] !== void 0 && (r.uniforms[o].value !== void 0 && r.uniforms[o].value !== null && typeof r.uniforms[o].value.set == "function" ? Array.isArray(e[o]) ? r.uniforms[o].value.set(...e[o]) : e[o] !== void 0 && (e[o].copy ? r.uniforms[o].value.copy(e[o]) : r.uniforms[o].value = e[o]) : r.uniforms[o].value = e[o]);
|
|
731
732
|
}
|
|
732
|
-
function ke(
|
|
733
|
+
function ke(r, e, t = 0) {
|
|
733
734
|
var n, l, d, h;
|
|
734
735
|
if (e == null) {
|
|
735
|
-
|
|
736
|
+
r.set(0, 0, 0, 0);
|
|
736
737
|
return;
|
|
737
738
|
}
|
|
738
739
|
if (typeof e == "number") {
|
|
739
|
-
|
|
740
|
+
r.set(e, e, e, e);
|
|
740
741
|
return;
|
|
741
742
|
}
|
|
742
743
|
if (Array.isArray(e)) {
|
|
743
|
-
|
|
744
|
+
r.set(e[0], e[1], e[2], e[3]);
|
|
744
745
|
return;
|
|
745
746
|
}
|
|
746
|
-
const
|
|
747
|
-
|
|
747
|
+
const i = e.split("/")[0].trim().split(/\s+/), s = ne(i[0], t), c = ne((n = i[1]) != null ? n : i[0], t), o = ne((l = i[2]) != null ? l : i[0], t), a = ne((h = (d = i[3]) != null ? d : i[1]) != null ? h : i[0], t);
|
|
748
|
+
r.set(s, c, o, a);
|
|
748
749
|
}
|
|
749
750
|
const W = {
|
|
750
|
-
create(
|
|
751
|
-
return
|
|
751
|
+
create(r, e, t, i, s, c = 2, o = null, a) {
|
|
752
|
+
return r === "BOX" ? et(
|
|
752
753
|
e,
|
|
753
|
-
|
|
754
|
+
i,
|
|
754
755
|
s,
|
|
755
756
|
o,
|
|
756
757
|
a
|
|
757
|
-
) :
|
|
758
|
+
) : r === "TEXT" ? new Ge(
|
|
758
759
|
t || "",
|
|
759
760
|
e,
|
|
760
|
-
|
|
761
|
+
i,
|
|
761
762
|
s,
|
|
762
763
|
c
|
|
763
764
|
) : new w.MeshBasicMaterial({ visible: !1 });
|
|
764
765
|
},
|
|
765
|
-
update(
|
|
766
|
+
update(r, e, t, i, s, c, o = 2, a) {
|
|
766
767
|
e === "BOX" ? tt(
|
|
767
|
-
|
|
768
|
+
r,
|
|
768
769
|
t,
|
|
769
770
|
s,
|
|
770
771
|
c,
|
|
771
772
|
a
|
|
772
|
-
) : e === "TEXT" &&
|
|
773
|
-
|
|
773
|
+
) : e === "TEXT" && r.updateText(
|
|
774
|
+
i || "",
|
|
774
775
|
t,
|
|
775
776
|
s,
|
|
776
777
|
c,
|
|
777
778
|
o
|
|
778
779
|
);
|
|
779
780
|
},
|
|
780
|
-
forceUpdateUniforms(
|
|
781
|
-
be(
|
|
781
|
+
forceUpdateUniforms(r, e) {
|
|
782
|
+
be(r, e);
|
|
782
783
|
}
|
|
783
784
|
};
|
|
784
785
|
class rt {
|
|
@@ -789,8 +790,8 @@ class rt {
|
|
|
789
790
|
p(this, "elementUrls", /* @__PURE__ */ new WeakMap());
|
|
790
791
|
p(this, "onUpdate");
|
|
791
792
|
this.onUpdate = e, t && (this.observer = new IntersectionObserver(
|
|
792
|
-
(
|
|
793
|
-
for (const s of
|
|
793
|
+
(i) => {
|
|
794
|
+
for (const s of i) {
|
|
794
795
|
const c = s.target;
|
|
795
796
|
s.isIntersecting ? this.loadTexture(c) : this.disposeTexture(c);
|
|
796
797
|
}
|
|
@@ -814,24 +815,24 @@ class rt {
|
|
|
814
815
|
if (t) {
|
|
815
816
|
this.loadStatus.set(e, !0);
|
|
816
817
|
try {
|
|
817
|
-
let
|
|
818
|
+
let i;
|
|
818
819
|
if (t.startsWith("data:image/svg+xml"))
|
|
819
|
-
|
|
820
|
+
i = yield new Promise((c, o) => {
|
|
820
821
|
const a = new Image();
|
|
821
822
|
a.onload = () => c(a), a.onerror = o, a.src = t;
|
|
822
823
|
});
|
|
823
824
|
else {
|
|
824
825
|
const o = yield (yield fetch(t)).blob();
|
|
825
|
-
|
|
826
|
+
i = yield createImageBitmap(o, { imageOrientation: "flipY" });
|
|
826
827
|
}
|
|
827
828
|
if (this.elementUrls.get(e) !== t) {
|
|
828
|
-
"close" in
|
|
829
|
+
"close" in i && i.close();
|
|
829
830
|
return;
|
|
830
831
|
}
|
|
831
|
-
const s = new w.Texture(
|
|
832
|
-
|
|
833
|
-
} catch (
|
|
834
|
-
console.warn("[MirageEngine] Failed to load texture:", t,
|
|
832
|
+
const s = new w.Texture(i);
|
|
833
|
+
i instanceof HTMLImageElement || (s.flipY = !1), s.colorSpace = w.LinearSRGBColorSpace, s.needsUpdate = !0, this.textures.set(e, s), this.onUpdate(e, s);
|
|
834
|
+
} catch (i) {
|
|
835
|
+
console.warn("[MirageEngine] Failed to load texture:", t, i);
|
|
835
836
|
} finally {
|
|
836
837
|
this.elementUrls.has(e) && this.loadStatus.set(e, !1);
|
|
837
838
|
}
|
|
@@ -850,7 +851,7 @@ class rt {
|
|
|
850
851
|
}
|
|
851
852
|
}
|
|
852
853
|
class it {
|
|
853
|
-
constructor(e, t,
|
|
854
|
+
constructor(e, t, i, s) {
|
|
854
855
|
p(this, "canvas");
|
|
855
856
|
p(this, "scene");
|
|
856
857
|
p(this, "camera");
|
|
@@ -875,7 +876,7 @@ class it {
|
|
|
875
876
|
// private meshMap: Map<HTMLElement, THREE.Mesh> = new Map();
|
|
876
877
|
p(this, "fixedMeshes", /* @__PURE__ */ new Set());
|
|
877
878
|
var a, n, l, d, h;
|
|
878
|
-
this.target = e, this.mountContainer =
|
|
879
|
+
this.target = e, this.mountContainer = i, this.registry = s, this.mode = (a = t.mode) != null ? a : "overlay", this.canvasSize = (n = t.canvasSize) != null ? n : "viewport", this.clipArea = (l = t.travelerClipArea) != null ? l : 1, this.targetLayer = (d = t.layer) != null ? d : "base", this.textureManager = new rt((u, f) => {
|
|
879
880
|
const g = this.registry.get(u);
|
|
880
881
|
g && g.material instanceof w.ShaderMaterial && W.forceUpdateUniforms(g.material, { texture: f });
|
|
881
882
|
}, this.isViewport), this.canvas = document.createElement("canvas"), this.scene = new w.Scene(), this.targetRect = this.target.getBoundingClientRect();
|
|
@@ -899,15 +900,15 @@ class it {
|
|
|
899
900
|
return this.mode === "overlay" && this.canvasSize === "viewport";
|
|
900
901
|
}
|
|
901
902
|
getSceneLayer() {
|
|
902
|
-
return typeof this.targetLayer == "number" ? this.targetLayer : this.targetLayer === "selected" ?
|
|
903
|
+
return typeof this.targetLayer == "number" ? this.targetLayer : this.targetLayer === "selected" ? B.SELECTED : B.BASE;
|
|
903
904
|
}
|
|
904
905
|
createRenderTarget() {
|
|
905
906
|
for (let e = 0; e < _.MAX_LAYERS; e++) {
|
|
906
|
-
const t = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width,
|
|
907
|
+
const t = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, i = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height;
|
|
907
908
|
this.renderTargets.push(
|
|
908
909
|
new w.WebGLRenderTarget(
|
|
909
910
|
t * this.qualityFactor,
|
|
910
|
-
|
|
911
|
+
i * this.qualityFactor,
|
|
911
912
|
{
|
|
912
913
|
minFilter: w.LinearFilter,
|
|
913
914
|
magFilter: w.LinearFilter,
|
|
@@ -947,13 +948,13 @@ class it {
|
|
|
947
948
|
this.canvas.style.width = `${e}px`, this.canvas.style.height = `${t}px`, this.mode === "duplicate" ? (this.canvas.style.position = "", this.canvas.style.top = "", this.canvas.style.left = "", this.canvas.style.display = "block") : (this.canvas.style.position = this.isViewport ? "fixed" : "absolute", this.canvas.style.top = this.isViewport ? `-${this.overscan}px` : `${this.target.offsetTop}px`, this.canvas.style.left = this.isViewport ? `-${this.overscan}px` : `${this.target.offsetLeft}px`, this.canvas.style.display = "block");
|
|
948
949
|
}
|
|
949
950
|
updateUniforms(e, t) {
|
|
950
|
-
const
|
|
951
|
-
|
|
951
|
+
const i = this.registry.get(e);
|
|
952
|
+
i && (i.traverse((s) => {
|
|
952
953
|
s.isMesh && s.material && W.forceUpdateUniforms(
|
|
953
954
|
s.material,
|
|
954
955
|
t
|
|
955
956
|
);
|
|
956
|
-
}),
|
|
957
|
+
}), i.userData.nativeMesh && i.userData.nativeMesh.traverse((s) => {
|
|
957
958
|
s.isMesh && s.material && W.forceUpdateUniforms(
|
|
958
959
|
s.material,
|
|
959
960
|
t
|
|
@@ -965,13 +966,13 @@ class it {
|
|
|
965
966
|
}
|
|
966
967
|
setSize(e, t) {
|
|
967
968
|
this.renderer.setSize(e, t);
|
|
968
|
-
for (const
|
|
969
|
-
|
|
969
|
+
for (const i of this.renderTargets)
|
|
970
|
+
i.setSize(e * this.qualityFactor, t * this.qualityFactor);
|
|
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
|
|
974
|
-
n ? (this.targetRect =
|
|
974
|
+
const i = this.target.getBoundingClientRect(), s = this.isViewport ? window.innerWidth + this.overscan * 2 : i.width, c = this.isViewport ? window.innerHeight + this.overscan * 2 : i.height, o = this.isViewport ? this.canvas.clientWidth : this.targetRect.width, a = this.isViewport ? this.canvas.clientHeight : this.targetRect.height, n = Math.abs(s - o) > 0.1 || Math.abs(c - a) > 0.1, l = this.mode === "overlay" && (Math.abs(i.top - this.targetRect.top) > 0.1 || Math.abs(i.left - this.targetRect.left) > 0.1);
|
|
975
|
+
n ? (this.targetRect = i, this.setSize(s, c), this.updateCanvasLayout()) : l ? (this.targetRect = i, this.updateCanvasLayout()) : this.targetRect = i, 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);
|
|
@@ -992,8 +993,8 @@ class it {
|
|
|
992
993
|
reconcileNode(e) {
|
|
993
994
|
var s, c;
|
|
994
995
|
let t = this.registry.get(e.element);
|
|
995
|
-
const
|
|
996
|
-
if (t && t.userData.shaderHash !==
|
|
996
|
+
const i = JSON.stringify(e.shaderHooks || null);
|
|
997
|
+
if (t && t.userData.shaderHash !== i && (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
998
|
const o = new w.PlaneGeometry(1, 1), a = e.isTraveler ? (s = this.renderTargets[e.captureLayer - 2]) == null ? void 0 : s.texture : this.textureManager.get(e.element), n = W.create(
|
|
998
999
|
"BOX",
|
|
999
1000
|
e.styles,
|
|
@@ -1004,7 +1005,7 @@ class it {
|
|
|
1004
1005
|
a,
|
|
1005
1006
|
e.shaderHooks
|
|
1006
1007
|
);
|
|
1007
|
-
t = new w.Mesh(o, n), e.type === "TEXT" && (t.name = "BG_MESH"), this.scene.add(t), this.registry.register(e.element, t), t.userData.baseMaterial = n, t.userData.domElement = e.element, t.userData.shaderHash =
|
|
1008
|
+
t = new w.Mesh(o, n), e.type === "TEXT" && (t.name = "BG_MESH"), this.scene.add(t), this.registry.register(e.element, t), t.userData.baseMaterial = n, t.userData.domElement = e.element, t.userData.shaderHash = i;
|
|
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 o = 0; o < _.MAX_LAYERS; o++)
|
|
@@ -1022,11 +1023,11 @@ class it {
|
|
|
1022
1023
|
!0
|
|
1023
1024
|
));
|
|
1024
1025
|
}
|
|
1025
|
-
reconcileTextChild(e, t,
|
|
1026
|
+
reconcileTextChild(e, t, i) {
|
|
1026
1027
|
var l;
|
|
1027
1028
|
const s = t.textLines || [
|
|
1028
1029
|
{ text: t.textContent || "", rect: t.rect }
|
|
1029
|
-
], c =
|
|
1030
|
+
], c = i ? t.nativeStyles : t.textStyles, o = JSON.stringify(c) + t.textContent + s.map((d) => d.text).join("|"), a = (l = e.userData) == null ? void 0 : l.textChildStyleHash;
|
|
1030
1031
|
if (t.dirtyMask & we || o !== a) {
|
|
1031
1032
|
e.children.filter(
|
|
1032
1033
|
(g) => g.name.startsWith("TEXT_CHILD")
|
|
@@ -1060,48 +1061,48 @@ class it {
|
|
|
1060
1061
|
if (!d.name.startsWith("TEXT_CHILD"))
|
|
1061
1062
|
return;
|
|
1062
1063
|
const h = d;
|
|
1063
|
-
if (
|
|
1064
|
-
h.layers.set(
|
|
1064
|
+
if (i && t.nativeLayer !== void 0)
|
|
1065
|
+
h.layers.set(B.HIDDEN), t.visibility & q && h.layers.enable(B.getCaptureLayer(t.nativeLayer));
|
|
1065
1066
|
else {
|
|
1066
|
-
const u = t.visibility & q ?
|
|
1067
|
-
if (h.layers.set(u), t.visibility & ae && h.layers.enable(
|
|
1068
|
-
if (!
|
|
1067
|
+
const u = t.visibility & q ? B.BASE : B.HIDDEN;
|
|
1068
|
+
if (h.layers.set(u), t.visibility & ae && h.layers.enable(B.SELECTED), t.visibility & q)
|
|
1069
|
+
if (!i && t.nativeLayer !== void 0 && t.nativeStyles !== void 0)
|
|
1069
1070
|
for (let f = t.captureLayer; f <= _.MAX_LAYERS + 1; f++)
|
|
1070
|
-
f !== t.nativeLayer && h.layers.enable(
|
|
1071
|
+
f !== t.nativeLayer && h.layers.enable(B.getCaptureLayer(f));
|
|
1071
1072
|
else
|
|
1072
1073
|
for (let f = t.captureLayer; f <= _.MAX_LAYERS + 1; f++)
|
|
1073
|
-
h.layers.enable(
|
|
1074
|
+
h.layers.enable(B.getCaptureLayer(f));
|
|
1074
1075
|
}
|
|
1075
1076
|
});
|
|
1076
1077
|
}
|
|
1077
1078
|
updateMeshProperties(e, t) {
|
|
1078
1079
|
var S, R, E, V, N;
|
|
1079
|
-
const { rect:
|
|
1080
|
+
const { rect: i, styles: s } = t, c = this.renderer.getPixelRatio(), o = this.renderer.domElement.width / c, a = this.renderer.domElement.height / c;
|
|
1080
1081
|
e.material = e.userData.baseMaterial;
|
|
1081
1082
|
let n = ((S = e.material.userData) == null ? void 0 : S.shadowPadding) || 0;
|
|
1082
|
-
e.scale.set(
|
|
1083
|
-
x:
|
|
1084
|
-
y:
|
|
1085
|
-
width:
|
|
1086
|
-
height:
|
|
1083
|
+
e.scale.set(i.width + n * 2, i.height + n * 2, 1), e.userData.domRect = {
|
|
1084
|
+
x: i.x,
|
|
1085
|
+
y: i.y,
|
|
1086
|
+
width: i.width,
|
|
1087
|
+
height: i.height
|
|
1087
1088
|
};
|
|
1088
1089
|
const l = 1e-3;
|
|
1089
1090
|
this.renderOrder++;
|
|
1090
1091
|
const d = this.targetRect.left + window.scrollX, h = this.targetRect.top + window.scrollY;
|
|
1091
1092
|
let u, f;
|
|
1092
1093
|
if (this.isViewport)
|
|
1093
|
-
u =
|
|
1094
|
+
u = i.x - window.innerWidth / 2 + i.width / 2, f = -i.y + window.innerHeight / 2 - i.height / 2;
|
|
1094
1095
|
else {
|
|
1095
|
-
const M =
|
|
1096
|
-
u = M - o / 2 +
|
|
1096
|
+
const M = i.x - d, P = i.y - h;
|
|
1097
|
+
u = M - o / 2 + i.width / 2, f = -P + a / 2 - i.height / 2;
|
|
1097
1098
|
}
|
|
1098
1099
|
e.position.set(
|
|
1099
1100
|
u,
|
|
1100
1101
|
f,
|
|
1101
1102
|
s.zIndex + this.renderOrder * l
|
|
1102
1103
|
);
|
|
1103
|
-
const g =
|
|
1104
|
-
e.userData.basePosition = { x: u, y: f }, e.userData.originalBasePosition = { x: u, y: f }, e.userData.baseSize = { width:
|
|
1104
|
+
const g = i.x, v = i.y;
|
|
1105
|
+
e.userData.basePosition = { x: u, y: f }, e.userData.originalBasePosition = { x: u, y: f }, e.userData.baseSize = { width: i.width, height: i.height }, e.userData.baseDOM = { x: g, y: v }, e.userData.isFixed = t.isFixed, e.userData.initialScroll = { x: window.scrollX, y: window.scrollY };
|
|
1105
1106
|
const b = t.element.nodeType === Node.TEXT_NODE ? t.element.parentElement : t.element, C = window.getComputedStyle(b);
|
|
1106
1107
|
let I = 0, D = 0;
|
|
1107
1108
|
if (C.transform && C.transform !== "none") {
|
|
@@ -1113,8 +1114,8 @@ class it {
|
|
|
1113
1114
|
"BOX",
|
|
1114
1115
|
s,
|
|
1115
1116
|
"",
|
|
1116
|
-
|
|
1117
|
-
|
|
1117
|
+
i.width,
|
|
1118
|
+
i.height,
|
|
1118
1119
|
this.qualityFactor,
|
|
1119
1120
|
t.isTraveler ? (R = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : R.texture : this.textureManager.get(t.element)
|
|
1120
1121
|
), t.nativeStyles && t.nativeRect) {
|
|
@@ -1139,7 +1140,7 @@ class it {
|
|
|
1139
1140
|
const z = t.nativeRect.x - d, Y = t.nativeRect.y - h;
|
|
1140
1141
|
P = z - o / 2 + t.nativeRect.width / 2, J = -Y + a / 2 - t.nativeRect.height / 2;
|
|
1141
1142
|
}
|
|
1142
|
-
let Z = t.nativeRect.width, L = t.nativeRect.height,
|
|
1143
|
+
let Z = t.nativeRect.width, L = t.nativeRect.height, F = P, $ = J;
|
|
1143
1144
|
if (t.nativeStyles.transform) {
|
|
1144
1145
|
const z = t.nativeStyles.transform, Y = z.match(/scale\(([\d.]+%?)\)/);
|
|
1145
1146
|
if (Y) {
|
|
@@ -1162,13 +1163,13 @@ class it {
|
|
|
1162
1163
|
let X = parseFloat(y);
|
|
1163
1164
|
y.includes("%") && (X = X / 100 * t.nativeRect.width);
|
|
1164
1165
|
let O = parseFloat(x);
|
|
1165
|
-
x.includes("%") && (O = O / 100 * t.nativeRect.height),
|
|
1166
|
+
x.includes("%") && (O = O / 100 * t.nativeRect.height), F += X, $ -= O;
|
|
1166
1167
|
}
|
|
1167
1168
|
const A = z.match(/translateX\(([^)]+)\)/);
|
|
1168
1169
|
if (A) {
|
|
1169
1170
|
const y = A[1].trim();
|
|
1170
1171
|
let x = parseFloat(y);
|
|
1171
|
-
y.includes("%") && (x = x / 100 * t.nativeRect.width),
|
|
1172
|
+
y.includes("%") && (x = x / 100 * t.nativeRect.width), F += x;
|
|
1172
1173
|
}
|
|
1173
1174
|
const U = z.match(/translateY\(([^)]+)\)/);
|
|
1174
1175
|
if (U) {
|
|
@@ -1179,7 +1180,7 @@ class it {
|
|
|
1179
1180
|
}
|
|
1180
1181
|
let K = ((V = M.material.userData) == null ? void 0 : V.shadowPadding) || 0;
|
|
1181
1182
|
M.scale.set(Z + K * 2, L + K * 2, 1), M.position.set(
|
|
1182
|
-
|
|
1183
|
+
F,
|
|
1183
1184
|
$,
|
|
1184
1185
|
t.nativeStyles.zIndex + this.renderOrder * l
|
|
1185
1186
|
), W.update(
|
|
@@ -1196,23 +1197,23 @@ class it {
|
|
|
1196
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
|
-
const
|
|
1200
|
-
if (e.layers.set(
|
|
1200
|
+
const i = t.visibility & q ? B.BASE : B.HIDDEN;
|
|
1201
|
+
if (e.layers.set(i), t.visibility & ae && e.layers.enable(B.SELECTED), e.userData.nativeMesh && t.nativeLayer !== void 0) {
|
|
1201
1202
|
const s = e.userData.nativeMesh;
|
|
1202
|
-
if (s.layers.set(
|
|
1203
|
-
s.layers.enable(
|
|
1203
|
+
if (s.layers.set(B.HIDDEN), t.visibility & q) {
|
|
1204
|
+
s.layers.enable(B.getCaptureLayer(t.nativeLayer));
|
|
1204
1205
|
for (let c = t.captureLayer; c <= _.MAX_LAYERS + 1; c++)
|
|
1205
|
-
c !== t.nativeLayer && e.layers.enable(
|
|
1206
|
+
c !== t.nativeLayer && e.layers.enable(B.getCaptureLayer(c));
|
|
1206
1207
|
}
|
|
1207
1208
|
} else if (t.visibility & q)
|
|
1208
1209
|
for (let s = t.captureLayer; s <= _.MAX_LAYERS + 1; s++)
|
|
1209
|
-
e.layers.enable(
|
|
1210
|
+
e.layers.enable(B.getCaptureLayer(s));
|
|
1210
1211
|
}
|
|
1211
|
-
captureRenderTarget(e, t,
|
|
1212
|
-
if (e.size === 0 || !
|
|
1212
|
+
captureRenderTarget(e, t, i) {
|
|
1213
|
+
if (e.size === 0 || !i)
|
|
1213
1214
|
return;
|
|
1214
1215
|
const s = new w.Color(), c = this.renderer.getClearAlpha();
|
|
1215
|
-
this.renderer.getClearColor(s), this.renderer.setClearColor(0, 0), this.renderer.setRenderTarget(
|
|
1216
|
+
this.renderer.getClearColor(s), this.renderer.setClearColor(0, 0), this.renderer.setRenderTarget(i), this.renderer.clear(), this.renderer.autoClear = !1, this.renderer.setScissorTest(!0), this.camera.layers.set(t);
|
|
1216
1217
|
const o = new w.Vector3(), a = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, n = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height, l = this.renderer.getPixelRatio();
|
|
1217
1218
|
for (const d of e) {
|
|
1218
1219
|
o.setFromMatrixPosition(d.matrixWorld), o.project(this.camera);
|
|
@@ -1229,14 +1230,14 @@ class it {
|
|
|
1229
1230
|
const t = e + 1;
|
|
1230
1231
|
this.captureRenderTarget(
|
|
1231
1232
|
this.travelersByLayer[e],
|
|
1232
|
-
|
|
1233
|
+
B.getCaptureLayer(t),
|
|
1233
1234
|
this.renderTargets[e]
|
|
1234
1235
|
);
|
|
1235
1236
|
}
|
|
1236
1237
|
this.renderer.render(this.scene, this.camera);
|
|
1237
1238
|
}
|
|
1238
1239
|
syncMeshesByDOM() {
|
|
1239
|
-
const e = this.targetRect.left + window.scrollX, t = this.targetRect.top + window.scrollY,
|
|
1240
|
+
const e = this.targetRect.left + window.scrollX, t = this.targetRect.top + window.scrollY, i = this.renderer.getPixelRatio(), s = this.renderer.domElement.width / i, c = this.renderer.domElement.height / i;
|
|
1240
1241
|
this.scene.children.forEach((o) => {
|
|
1241
1242
|
var h, u;
|
|
1242
1243
|
const a = o;
|
|
@@ -1292,23 +1293,23 @@ class it {
|
|
|
1292
1293
|
}
|
|
1293
1294
|
const P = E.match(/translate\(([^,]+),\s*([^)]+)\)/);
|
|
1294
1295
|
if (P) {
|
|
1295
|
-
const L = P[1].trim(),
|
|
1296
|
+
const L = P[1].trim(), F = P[2].trim();
|
|
1296
1297
|
let $ = parseFloat(L);
|
|
1297
1298
|
L.includes("%") && ($ = $ / 100 * l.width);
|
|
1298
|
-
let K = parseFloat(
|
|
1299
|
-
|
|
1299
|
+
let K = parseFloat(F);
|
|
1300
|
+
F.includes("%") && (K = K / 100 * l.height), D += $, S -= K;
|
|
1300
1301
|
}
|
|
1301
1302
|
const J = E.match(/translateX\(([^)]+)\)/);
|
|
1302
1303
|
if (J) {
|
|
1303
1304
|
const L = J[1].trim();
|
|
1304
|
-
let
|
|
1305
|
-
L.includes("%") && (
|
|
1305
|
+
let F = parseFloat(L);
|
|
1306
|
+
L.includes("%") && (F = F / 100 * l.width), D += F;
|
|
1306
1307
|
}
|
|
1307
1308
|
const Z = E.match(/translateY\(([^)]+)\)/);
|
|
1308
1309
|
if (Z) {
|
|
1309
1310
|
const L = Z[1].trim();
|
|
1310
|
-
let
|
|
1311
|
-
L.includes("%") && (
|
|
1311
|
+
let F = parseFloat(L);
|
|
1312
|
+
L.includes("%") && (F = F / 100 * l.height), S -= F;
|
|
1312
1313
|
}
|
|
1313
1314
|
}
|
|
1314
1315
|
let R = ((u = b.material.userData) == null ? void 0 : u.shadowPadding) || 0;
|
|
@@ -1321,32 +1322,32 @@ class it {
|
|
|
1321
1322
|
});
|
|
1322
1323
|
}
|
|
1323
1324
|
}
|
|
1324
|
-
function st(
|
|
1325
|
-
const e =
|
|
1326
|
-
let
|
|
1325
|
+
function st(r) {
|
|
1326
|
+
const e = r.textContent || "", t = [];
|
|
1327
|
+
let i = "", s = null, c = -1;
|
|
1327
1328
|
const o = (l, d) => {
|
|
1328
1329
|
for (let h = 0; h < l.length; h++) {
|
|
1329
1330
|
const u = l[h], f = document.createRange();
|
|
1330
|
-
f.setStart(
|
|
1331
|
+
f.setStart(r, d + h), f.setEnd(r, d + h + 1);
|
|
1331
1332
|
const g = f.getBoundingClientRect();
|
|
1332
1333
|
if (g.width === 0 && g.height === 0) {
|
|
1333
|
-
|
|
1334
|
+
i += u;
|
|
1334
1335
|
continue;
|
|
1335
1336
|
}
|
|
1336
|
-
c === -1 || Math.abs(g.top - c) > g.height / 2 ? (
|
|
1337
|
-
text:
|
|
1337
|
+
c === -1 || Math.abs(g.top - c) > g.height / 2 ? (i && s && t.push({
|
|
1338
|
+
text: i,
|
|
1338
1339
|
rect: {
|
|
1339
1340
|
left: s.left,
|
|
1340
1341
|
top: s.top,
|
|
1341
1342
|
width: s.right - s.left,
|
|
1342
1343
|
height: s.bottom - s.top
|
|
1343
1344
|
}
|
|
1344
|
-
}),
|
|
1345
|
+
}), i = u, s = {
|
|
1345
1346
|
left: g.left,
|
|
1346
1347
|
top: g.top,
|
|
1347
1348
|
right: g.right,
|
|
1348
1349
|
bottom: g.bottom
|
|
1349
|
-
}, c = g.top) : (
|
|
1350
|
+
}, c = g.top) : (i += u, s && (s.left = Math.min(s.left, g.left), s.top = Math.min(s.top, g.top), s.right = Math.max(s.right, g.right), s.bottom = Math.max(
|
|
1350
1351
|
s.bottom,
|
|
1351
1352
|
g.bottom
|
|
1352
1353
|
)));
|
|
@@ -1355,38 +1356,38 @@ function st(i) {
|
|
|
1355
1356
|
let n = 0;
|
|
1356
1357
|
for (const l of a) {
|
|
1357
1358
|
const d = document.createRange();
|
|
1358
|
-
d.setStart(
|
|
1359
|
+
d.setStart(r, n), d.setEnd(r, n + l.length);
|
|
1359
1360
|
const h = d.getClientRects();
|
|
1360
1361
|
if (h.length > 1)
|
|
1361
1362
|
o(l, n);
|
|
1362
1363
|
else {
|
|
1363
1364
|
const u = h.length === 1 ? h[0] : d.getBoundingClientRect();
|
|
1364
1365
|
if (u.width === 0 && u.height === 0) {
|
|
1365
|
-
|
|
1366
|
+
i += l, n += l.length;
|
|
1366
1367
|
continue;
|
|
1367
1368
|
}
|
|
1368
|
-
c === -1 || Math.abs(u.top - c) > u.height / 2 ? (
|
|
1369
|
-
text:
|
|
1369
|
+
c === -1 || Math.abs(u.top - c) > u.height / 2 ? (i && s && t.push({
|
|
1370
|
+
text: i,
|
|
1370
1371
|
rect: {
|
|
1371
1372
|
left: s.left,
|
|
1372
1373
|
top: s.top,
|
|
1373
1374
|
width: s.right - s.left,
|
|
1374
1375
|
height: s.bottom - s.top
|
|
1375
1376
|
}
|
|
1376
|
-
}),
|
|
1377
|
+
}), i = l, s = {
|
|
1377
1378
|
left: u.left,
|
|
1378
1379
|
top: u.top,
|
|
1379
1380
|
right: u.right,
|
|
1380
1381
|
bottom: u.bottom
|
|
1381
|
-
}, c = u.top) : (
|
|
1382
|
+
}, c = u.top) : (i += l, s && (s.left = Math.min(s.left, u.left), s.top = Math.min(s.top, u.top), s.right = Math.max(s.right, u.right), s.bottom = Math.max(
|
|
1382
1383
|
s.bottom,
|
|
1383
1384
|
u.bottom
|
|
1384
1385
|
)));
|
|
1385
1386
|
}
|
|
1386
1387
|
n += l.length;
|
|
1387
1388
|
}
|
|
1388
|
-
return
|
|
1389
|
-
text:
|
|
1389
|
+
return i && s && t.push({
|
|
1390
|
+
text: i,
|
|
1390
1391
|
rect: {
|
|
1391
1392
|
left: s.left,
|
|
1392
1393
|
top: s.top,
|
|
@@ -1397,26 +1398,26 @@ function st(i) {
|
|
|
1397
1398
|
(l) => l.text.trim().length > 0 && l.rect.width > 0 && l.rect.height > 0
|
|
1398
1399
|
);
|
|
1399
1400
|
}
|
|
1400
|
-
function Le(
|
|
1401
|
-
const e = parseFloat(
|
|
1402
|
-
let t = parseFloat(
|
|
1401
|
+
function Le(r) {
|
|
1402
|
+
const e = parseFloat(r.fontSize);
|
|
1403
|
+
let t = parseFloat(r.lineHeight);
|
|
1403
1404
|
isNaN(t) && (t = e * 1.2);
|
|
1404
|
-
let
|
|
1405
|
-
return isNaN(
|
|
1406
|
-
font: `${
|
|
1407
|
-
fontSize:
|
|
1408
|
-
color:
|
|
1409
|
-
textAlign:
|
|
1405
|
+
let i = parseFloat(r.letterSpacing);
|
|
1406
|
+
return isNaN(i) && (i = 0), {
|
|
1407
|
+
font: `${r.fontStyle} ${r.fontWeight} ${r.fontSize} ${r.fontFamily}`,
|
|
1408
|
+
fontSize: r.fontSize,
|
|
1409
|
+
color: r.color,
|
|
1410
|
+
textAlign: r.textAlign || "start",
|
|
1410
1411
|
textBaseline: "alphabetic",
|
|
1411
|
-
direction:
|
|
1412
|
+
direction: r.direction || "inherit",
|
|
1412
1413
|
lineHeight: t,
|
|
1413
|
-
letterSpacing:
|
|
1414
|
+
letterSpacing: i
|
|
1414
1415
|
};
|
|
1415
1416
|
}
|
|
1416
|
-
function Ue(
|
|
1417
|
-
var
|
|
1418
|
-
if (
|
|
1419
|
-
const m =
|
|
1417
|
+
function Ue(r, e = re | he | Ye | we | fe, t, i = 1, s = 0, c = 2, o, a) {
|
|
1418
|
+
var F, $, K, z, Y, ie, se;
|
|
1419
|
+
if (r.nodeType === Node.TEXT_NODE) {
|
|
1420
|
+
const m = r;
|
|
1420
1421
|
if (!m.textContent || !m.textContent.trim())
|
|
1421
1422
|
return null;
|
|
1422
1423
|
const A = m.textContent.replace(/\s+/g, " ");
|
|
@@ -1463,7 +1464,7 @@ function Ue(i, e = re | he | Ye | we | fe, t, r = 1, s = 0, c = 2, o, a) {
|
|
|
1463
1464
|
dirtyMask: e,
|
|
1464
1465
|
visibility: t,
|
|
1465
1466
|
isTraveler: !1,
|
|
1466
|
-
captureLayer:
|
|
1467
|
+
captureLayer: i,
|
|
1467
1468
|
isFixed: x.position === "fixed",
|
|
1468
1469
|
nativeLayer: o,
|
|
1469
1470
|
nativeStyles: a ? te(te({
|
|
@@ -1485,9 +1486,9 @@ function Ue(i, e = re | he | Ye | we | fe, t, r = 1, s = 0, c = 2, o, a) {
|
|
|
1485
1486
|
children: []
|
|
1486
1487
|
};
|
|
1487
1488
|
}
|
|
1488
|
-
if (
|
|
1489
|
+
if (r.nodeType !== Node.ELEMENT_NODE)
|
|
1489
1490
|
return null;
|
|
1490
|
-
const n =
|
|
1491
|
+
const n = r, l = n.dataset[G.KEY];
|
|
1491
1492
|
let d = t, h = t;
|
|
1492
1493
|
if (l) {
|
|
1493
1494
|
const m = new Set(l.split(/\s+/));
|
|
@@ -1570,11 +1571,11 @@ function Ue(i, e = re | he | Ye | we | fe, t, r = 1, s = 0, c = 2, o, a) {
|
|
|
1570
1571
|
}
|
|
1571
1572
|
if (X) {
|
|
1572
1573
|
const k = m + 1;
|
|
1573
|
-
if (k <
|
|
1574
|
+
if (k < i)
|
|
1574
1575
|
throw new Error(
|
|
1575
|
-
`[MirageEngine] Traveler layer (${m}) cannot be smaller than inherited capture layer (${
|
|
1576
|
+
`[MirageEngine] Traveler layer (${m}) cannot be smaller than inherited capture layer (${i - 1}).`
|
|
1576
1577
|
);
|
|
1577
|
-
|
|
1578
|
+
i = Math.min(k, _.MAX_LAYERS + 1);
|
|
1578
1579
|
}
|
|
1579
1580
|
}
|
|
1580
1581
|
const C = n.dataset[Ve.KEY];
|
|
@@ -1591,9 +1592,9 @@ function Ue(i, e = re | he | Ye | we | fe, t, r = 1, s = 0, c = 2, o, a) {
|
|
|
1591
1592
|
N = n.src;
|
|
1592
1593
|
else if (n.tagName.toLowerCase() === "svg") {
|
|
1593
1594
|
const m = n.cloneNode(!0), A = v == null ? void 0 : v.color, U = v == null ? void 0 : v.fill, y = v == null ? void 0 : v.stroke, x = v == null ? void 0 : v.opacity, X = (T, oe) => {
|
|
1594
|
-
const H = window.getComputedStyle(T), ce = oe,
|
|
1595
|
+
const H = window.getComputedStyle(T), ce = oe, Fe = H.fill === H.color, Be = H.stroke === H.color, ge = U || (Fe ? A : void 0) || H.fill;
|
|
1595
1596
|
ge && ge !== "none" && (ce.style.fill = ge);
|
|
1596
|
-
const pe = y || (
|
|
1597
|
+
const pe = y || (Be ? A : void 0) || H.stroke;
|
|
1597
1598
|
pe && pe !== "none" && (ce.style.stroke = pe), H.strokeWidth && H.strokeWidth !== "0px" && (ce.style.strokeWidth = H.strokeWidth);
|
|
1598
1599
|
const ye = A || H.color;
|
|
1599
1600
|
ye && (ce.style.color = ye);
|
|
@@ -1633,7 +1634,7 @@ function Ue(i, e = re | he | Ye | we | fe, t, r = 1, s = 0, c = 2, o, a) {
|
|
|
1633
1634
|
m,
|
|
1634
1635
|
e,
|
|
1635
1636
|
A,
|
|
1636
|
-
|
|
1637
|
+
i,
|
|
1637
1638
|
V,
|
|
1638
1639
|
c,
|
|
1639
1640
|
m.nodeType === Node.TEXT_NODE ? b : void 0,
|
|
@@ -1656,10 +1657,10 @@ function Ue(i, e = re | he | Ye | we | fe, t, r = 1, s = 0, c = 2, o, a) {
|
|
|
1656
1657
|
dirtyMask: e,
|
|
1657
1658
|
visibility: h,
|
|
1658
1659
|
isTraveler: g,
|
|
1659
|
-
captureLayer:
|
|
1660
|
+
captureLayer: i,
|
|
1660
1661
|
nativeLayer: b,
|
|
1661
1662
|
nativeStyles: b !== void 0 ? Se(te({}, M), {
|
|
1662
|
-
backgroundColor: (
|
|
1663
|
+
backgroundColor: (F = v.backgroundColor) != null ? F : M.backgroundColor,
|
|
1663
1664
|
backgroundImage: ($ = v.backgroundImage) != null ? $ : M.backgroundImage,
|
|
1664
1665
|
opacity: (K = v.opacity) != null ? K : M.opacity,
|
|
1665
1666
|
zIndex: v.zIndex !== void 0 ? v.zIndex + V : M.zIndex,
|
|
@@ -1681,32 +1682,34 @@ function Ue(i, e = re | he | Ye | we | fe, t, r = 1, s = 0, c = 2, o, a) {
|
|
|
1681
1682
|
shaderHooks: I
|
|
1682
1683
|
};
|
|
1683
1684
|
}
|
|
1684
|
-
function ot(
|
|
1685
|
-
e.size !== 0 && e.forEach((t,
|
|
1685
|
+
function ot(r, e) {
|
|
1686
|
+
e.size !== 0 && e.forEach((t, i) => {
|
|
1686
1687
|
var c, o, a, n;
|
|
1687
|
-
const s =
|
|
1688
|
+
const s = r.get(i);
|
|
1688
1689
|
!s || !s.userData.basePosition || (W.forceUpdateUniforms(s.material, {
|
|
1689
1690
|
backgroundColor: t.backgroundColor,
|
|
1690
1691
|
backgroundImage: t.backgroundImage,
|
|
1692
|
+
boxShadow: t.boxShadow,
|
|
1691
1693
|
opacity: t.opacity,
|
|
1692
1694
|
borderRadius: (o = t.borderRadius) != null ? o : (c = s.userData.baseStyles) == null ? void 0 : c.borderRadius
|
|
1693
1695
|
// width and height are no longer updated here, they are updated in syncMeshesByDOM
|
|
1694
1696
|
}), s.userData.nativeMesh && W.forceUpdateUniforms(s.userData.nativeMesh.material, {
|
|
1695
1697
|
backgroundColor: t.backgroundColor,
|
|
1696
1698
|
backgroundImage: t.backgroundImage,
|
|
1699
|
+
boxShadow: t.boxShadow,
|
|
1697
1700
|
opacity: t.opacity,
|
|
1698
1701
|
borderRadius: (n = t.borderRadius) != null ? n : (a = s.userData.baseStyles) == null ? void 0 : a.borderRadius
|
|
1699
1702
|
}));
|
|
1700
1703
|
});
|
|
1701
1704
|
}
|
|
1702
1705
|
class at {
|
|
1703
|
-
constructor(e, t,
|
|
1706
|
+
constructor(e, t, i, s) {
|
|
1704
1707
|
p(this, "target");
|
|
1705
1708
|
p(this, "renderer");
|
|
1706
1709
|
p(this, "registry");
|
|
1707
1710
|
p(this, "isTravelEnabled", !1);
|
|
1708
1711
|
p(this, "tracker");
|
|
1709
|
-
this.target = e, this.renderer = t, this.registry =
|
|
1712
|
+
this.target = e, this.renderer = t, this.registry = i, this.tracker = new He(e, {
|
|
1710
1713
|
resizeDebounce: s.resizeDebounce
|
|
1711
1714
|
}), this.tracker.onLayoutChange.add((c, o) => {
|
|
1712
1715
|
document.querySelector(`[${_.NAME}~='${_.VALUES.TRAVELER}']`) !== null && !this.isTravelEnabled && (this.isTravelEnabled = !0, this.renderer.createRenderTarget());
|
|
@@ -1772,13 +1775,13 @@ class dt {
|
|
|
1772
1775
|
}
|
|
1773
1776
|
`, document.head.appendChild(a);
|
|
1774
1777
|
}
|
|
1775
|
-
let
|
|
1776
|
-
if (t.mode === "duplicate" ?
|
|
1778
|
+
let i;
|
|
1779
|
+
if (t.mode === "duplicate" ? i = (c = (s = t.container) != null ? s : this.target.parentElement) != null ? c : void 0 : i = (o = this.target.parentElement) != null ? o : void 0, !i)
|
|
1777
1780
|
throw new Error("[Mirage] Cannot find a container (parent or option).");
|
|
1778
1781
|
this.renderer = new it(
|
|
1779
1782
|
this.target,
|
|
1780
1783
|
t,
|
|
1781
|
-
|
|
1784
|
+
i,
|
|
1782
1785
|
this.registry
|
|
1783
1786
|
), this.renderer.mount(), this.syncer = new at(this.target, this.renderer, this.registry, t);
|
|
1784
1787
|
}
|
|
@@ -1817,8 +1820,8 @@ class dt {
|
|
|
1817
1820
|
}), window.addEventListener("keyup", (c) => {
|
|
1818
1821
|
t[c.key] !== void 0 && (t[c.key] = !1);
|
|
1819
1822
|
});
|
|
1820
|
-
const
|
|
1821
|
-
requestAnimationFrame(s), t.ArrowRight && e.position.setX(e.position.x +
|
|
1823
|
+
const i = 2, s = () => {
|
|
1824
|
+
requestAnimationFrame(s), t.ArrowRight && e.position.setX(e.position.x + i), t.ArrowLeft && e.position.setX(e.position.x - i), t.ArrowUp && e.position.setY(e.position.y + i), t.ArrowDown && e.position.setY(e.position.y - i);
|
|
1822
1825
|
};
|
|
1823
1826
|
s();
|
|
1824
1827
|
}
|
|
@@ -1840,7 +1843,7 @@ export {
|
|
|
1840
1843
|
ht as EXCLUDED,
|
|
1841
1844
|
dt as Engine,
|
|
1842
1845
|
ae as SELECT_LAYER,
|
|
1843
|
-
|
|
1846
|
+
B as THREE_LAYERS,
|
|
1844
1847
|
Ce as TRAVEL_VALUES,
|
|
1845
1848
|
He as Tracker,
|
|
1846
1849
|
q as USER_LAYER,
|