mirage-engine 0.3.9 → 0.3.11
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 +378 -338
- package/dist/mirage-engine.umd.js +15 -15
- package/package.json +3 -3
package/dist/mirage-engine.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
var _e = Object.defineProperty, Fe = Object.defineProperties;
|
|
2
2
|
var Ne = Object.getOwnPropertyDescriptors;
|
|
3
|
-
var
|
|
3
|
+
var we = Object.getOwnPropertySymbols;
|
|
4
4
|
var ze = Object.prototype.hasOwnProperty, Xe = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var
|
|
5
|
+
var me = (s, e, t) => e in s ? _e(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, J = (s, e) => {
|
|
6
6
|
for (var t in e || (e = {}))
|
|
7
|
-
ze.call(e, t) &&
|
|
8
|
-
if (
|
|
9
|
-
for (var t of
|
|
10
|
-
Xe.call(e, t) &&
|
|
7
|
+
ze.call(e, t) && me(s, t, e[t]);
|
|
8
|
+
if (we)
|
|
9
|
+
for (var t of we(e))
|
|
10
|
+
Xe.call(e, t) && me(s, t, e[t]);
|
|
11
11
|
return s;
|
|
12
|
-
},
|
|
13
|
-
var u = (s, e, t) => (
|
|
14
|
-
var
|
|
12
|
+
}, xe = (s, e) => Fe(s, Ne(e));
|
|
13
|
+
var u = (s, e, t) => (me(s, typeof e != "symbol" ? e + "" : e, t), t);
|
|
14
|
+
var Ee = (s, e, t) => new Promise((r, i) => {
|
|
15
15
|
var c = (a) => {
|
|
16
16
|
try {
|
|
17
17
|
o(t.next(a));
|
|
@@ -28,20 +28,20 @@ var we = (s, e, t) => new Promise((r, i) => {
|
|
|
28
28
|
o((t = t.apply(s, e)).next());
|
|
29
29
|
});
|
|
30
30
|
import * as y from "three";
|
|
31
|
-
const
|
|
31
|
+
const Ae = {
|
|
32
32
|
INCLUDE_TREE: "include-tree",
|
|
33
33
|
EXCLUDE_TREE: "exclude-tree",
|
|
34
34
|
INCLUDE_SELF: "include-self",
|
|
35
35
|
EXCLUDE_SELF: "exclude-self",
|
|
36
36
|
END: "end"
|
|
37
|
-
},
|
|
37
|
+
}, K = {
|
|
38
38
|
NAME: "data-mirage-dom",
|
|
39
39
|
KEY: "mirageDom",
|
|
40
40
|
VALUES: {
|
|
41
41
|
HIDE: "hide",
|
|
42
42
|
SHOW: "show"
|
|
43
43
|
}
|
|
44
|
-
},
|
|
44
|
+
}, Ce = {
|
|
45
45
|
TRAVELER: "traveler",
|
|
46
46
|
NATIVE: "native",
|
|
47
47
|
CAPTURE_1: "1",
|
|
@@ -54,29 +54,29 @@ const Le = {
|
|
|
54
54
|
CAPTURE_8: "8",
|
|
55
55
|
CAPTURE_9: "9",
|
|
56
56
|
CAPTURE_10: "10"
|
|
57
|
-
},
|
|
57
|
+
}, _ = {
|
|
58
58
|
NAME: "data-mirage-travel",
|
|
59
59
|
KEY: "mirageTravel",
|
|
60
|
-
VALUES:
|
|
61
|
-
MAX_LAYERS: Object.keys(
|
|
62
|
-
},
|
|
60
|
+
VALUES: Ce,
|
|
61
|
+
MAX_LAYERS: Object.keys(Ce).length - 1
|
|
62
|
+
}, W = {
|
|
63
63
|
NAME: "data-mirage-filter",
|
|
64
64
|
KEY: "mirageFilter",
|
|
65
|
-
VALUES:
|
|
66
|
-
},
|
|
65
|
+
VALUES: Ae
|
|
66
|
+
}, G = {
|
|
67
67
|
NAME: "data-mirage-select",
|
|
68
68
|
KEY: "mirageSelect",
|
|
69
|
-
VALUES:
|
|
69
|
+
VALUES: Ae
|
|
70
70
|
}, Ve = {
|
|
71
71
|
NAME: "data-mirage-shader",
|
|
72
72
|
KEY: "mirageShader"
|
|
73
|
-
},
|
|
73
|
+
}, Se = {
|
|
74
74
|
NAME: "data-mirage-sandwich",
|
|
75
75
|
KEY: "mirageSandwich",
|
|
76
76
|
VALUES: {
|
|
77
77
|
FRONT: "front"
|
|
78
78
|
}
|
|
79
|
-
},
|
|
79
|
+
}, de = 0, Q = 1, ce = 2, Ye = 4, ue = 8, ve = 16;
|
|
80
80
|
function We(s) {
|
|
81
81
|
const e = s.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);
|
|
82
82
|
return e ? {
|
|
@@ -97,7 +97,7 @@ function He(s) {
|
|
|
97
97
|
}
|
|
98
98
|
return e;
|
|
99
99
|
}
|
|
100
|
-
class
|
|
100
|
+
class De {
|
|
101
101
|
constructor(e, t) {
|
|
102
102
|
u(this, "target");
|
|
103
103
|
u(this, "observer");
|
|
@@ -105,7 +105,7 @@ class Me {
|
|
|
105
105
|
u(this, "pendingStyles", /* @__PURE__ */ new Map());
|
|
106
106
|
u(this, "isDomDirty", !1);
|
|
107
107
|
u(this, "isRunning", !1);
|
|
108
|
-
u(this, "pendingMask",
|
|
108
|
+
u(this, "pendingMask", de);
|
|
109
109
|
u(this, "mutationTimer", null);
|
|
110
110
|
u(this, "cssTimer", null);
|
|
111
111
|
u(this, "resizeConfig");
|
|
@@ -120,7 +120,7 @@ class Me {
|
|
|
120
120
|
u(this, "onScrollChange", /* @__PURE__ */ new Set());
|
|
121
121
|
u(this, "onRender", /* @__PURE__ */ new Set());
|
|
122
122
|
u(this, "onTransitionFinished", (e) => {
|
|
123
|
-
this.target.contains(e.target) && this.mutationTimer === null && (this.cssTimer && clearTimeout(this.cssTimer), this.pendingStyles.size == 0 && (this.pendingMask |=
|
|
123
|
+
this.target.contains(e.target) && this.mutationTimer === null && (this.cssTimer && clearTimeout(this.cssTimer), this.pendingStyles.size == 0 && (this.pendingMask |= Q | ce, this.cssTimer = window.setTimeout(() => {
|
|
124
124
|
this.isDomDirty = !0, this.cssTimer = null;
|
|
125
125
|
}, 50)));
|
|
126
126
|
});
|
|
@@ -136,10 +136,10 @@ class Me {
|
|
|
136
136
|
u(this, "renderLoop", () => {
|
|
137
137
|
if (!this.isRunning)
|
|
138
138
|
return;
|
|
139
|
-
this.onBeforeRender.forEach((r) => r()), this.isDomDirty && (this.isDomDirty = !1, this.onLayoutChange.forEach((r) => r(this.pendingMask, this.pendingDeletions)), this.pendingDeletions.clear(), this.pendingMask =
|
|
139
|
+
this.onBeforeRender.forEach((r) => r()), this.isDomDirty && (this.isDomDirty = !1, this.onLayoutChange.forEach((r) => r(this.pendingMask, this.pendingDeletions)), this.pendingDeletions.clear(), this.pendingMask = de);
|
|
140
140
|
const e = window.scrollX, t = window.scrollY;
|
|
141
141
|
(e !== this.lastScrollX || t !== this.lastScrollY) && (this.onScrollChange.forEach((r) => r(e, t)), this.lastScrollX = e, this.lastScrollY = t, this.scrollTimer && clearTimeout(this.scrollTimer), this.scrollTimer = window.setTimeout(() => {
|
|
142
|
-
this.pendingMask |=
|
|
142
|
+
this.pendingMask |= Q, this.isDomDirty = !0, this.scrollTimer = null;
|
|
143
143
|
}, 150)), this.pendingStyles.size > 0 && (this.onStyleChange.forEach((r) => r(this.pendingStyles)), this.pendingStyles.clear()), this.onRender.forEach((r) => r()), requestAnimationFrame(this.renderLoop);
|
|
144
144
|
});
|
|
145
145
|
var i, c;
|
|
@@ -151,23 +151,23 @@ class Me {
|
|
|
151
151
|
onStart: r.onStart,
|
|
152
152
|
onEnd: r.onEnd
|
|
153
153
|
}, this.observer = new MutationObserver((n) => {
|
|
154
|
-
let o =
|
|
154
|
+
let o = de;
|
|
155
155
|
for (const a of n)
|
|
156
156
|
if (a.type === "childList")
|
|
157
|
-
o |=
|
|
157
|
+
o |= ue, a.removedNodes.length > 0 && a.removedNodes.forEach((l) => {
|
|
158
158
|
l instanceof HTMLElement && this.pendingDeletions.add(l);
|
|
159
159
|
});
|
|
160
160
|
else if (a.type === "attributes")
|
|
161
161
|
if (a.attributeName === "style") {
|
|
162
|
-
o |=
|
|
162
|
+
o |= Q | ce;
|
|
163
163
|
const l = a.target, d = He(l.style);
|
|
164
164
|
this.pendingStyles.set(l, d);
|
|
165
165
|
} else
|
|
166
|
-
a.attributeName === "class" ? o |=
|
|
166
|
+
a.attributeName === "class" ? o |= Q | ce : a.attributeName && a.attributeName.startsWith("data-") && (o |= Q | ce, a.attributeName.startsWith("data-mirage") && (o |= ue));
|
|
167
167
|
else
|
|
168
|
-
a.type === "characterData" && (o |=
|
|
169
|
-
if (o !==
|
|
170
|
-
if (this.pendingMask |= o, o &
|
|
168
|
+
a.type === "characterData" && (o |= ve | Q);
|
|
169
|
+
if (o !== de) {
|
|
170
|
+
if (this.pendingMask |= o, o & ue) {
|
|
171
171
|
this.clearTimers(), this.isDomDirty = !0;
|
|
172
172
|
return;
|
|
173
173
|
}
|
|
@@ -192,13 +192,13 @@ class Me {
|
|
|
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
|
|
195
|
+
const $ = 1, te = 2, U = {
|
|
196
196
|
BASE: 0,
|
|
197
197
|
SELECTED: 1,
|
|
198
198
|
getCaptureLayer: (s) => 31 - s,
|
|
199
199
|
HIDDEN: 31
|
|
200
|
-
},
|
|
201
|
-
class
|
|
200
|
+
}, Te = Object.values(W.VALUES);
|
|
201
|
+
class ke {
|
|
202
202
|
/**
|
|
203
203
|
* Calculates or retrieves the exact alphabetic baseline (in pixels) for the given font.
|
|
204
204
|
* @param font CSS font shorthand string (e.g., "400 16px Inter")
|
|
@@ -219,7 +219,7 @@ class Ae {
|
|
|
219
219
|
return document.body.removeChild(t), c;
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
|
-
u(
|
|
222
|
+
u(ke, "cache", /* @__PURE__ */ new Map());
|
|
223
223
|
class Pe extends y.MeshBasicMaterial {
|
|
224
224
|
constructor(t, r, i, c, n = 2) {
|
|
225
225
|
super({
|
|
@@ -255,24 +255,24 @@ class Pe extends y.MeshBasicMaterial {
|
|
|
255
255
|
n !== void 0 && (this.qualityFactor = n);
|
|
256
256
|
const a = (window.devicePixelRatio || 1) * this.qualityFactor, l = i * a, d = c * a;
|
|
257
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
|
-
const h = this.wrapText(t, i), f = r.lineHeight, p =
|
|
259
|
-
h.forEach((g,
|
|
260
|
-
const
|
|
261
|
-
let
|
|
262
|
-
r.textAlign === "center" ?
|
|
258
|
+
const h = this.wrapText(t, i), f = r.lineHeight, p = ke.getBaseline(r.font);
|
|
259
|
+
h.forEach((g, v) => {
|
|
260
|
+
const b = v * f + p;
|
|
261
|
+
let L = 0;
|
|
262
|
+
r.textAlign === "center" ? L = i / 2 : r.textAlign === "right" && (L = i), this.ctx.textAlign = r.textAlign, this.ctx.fillText(g, L, b);
|
|
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 re(s, e = 0) {
|
|
270
270
|
if (typeof s == "number")
|
|
271
271
|
return s;
|
|
272
272
|
const t = parseFloat(s) || 0;
|
|
273
273
|
return typeof s == "string" && s.includes("%") ? t / 100 * e : t;
|
|
274
274
|
}
|
|
275
|
-
function
|
|
275
|
+
function le(s) {
|
|
276
276
|
if (!s || s === "transparent")
|
|
277
277
|
return { color: new y.Color(16777215), alpha: 0 };
|
|
278
278
|
const e = s.match(
|
|
@@ -324,7 +324,7 @@ function $e(s) {
|
|
|
324
324
|
const g = l.substring(d + 1);
|
|
325
325
|
(g.endsWith("%") || g.endsWith("px") || !isNaN(parseFloat(g))) && (h = l.substring(0, d).trim(), f = g);
|
|
326
326
|
}
|
|
327
|
-
const p =
|
|
327
|
+
const p = le(h);
|
|
328
328
|
o.push({
|
|
329
329
|
color: p.color,
|
|
330
330
|
alpha: p.alpha,
|
|
@@ -503,52 +503,52 @@ uniform vec2 uTextureOffset;`, Je = `vec2 screenUv = (vScreenPos.xy / vScreenPos
|
|
|
503
503
|
vec2 resultUv = screenUv;
|
|
504
504
|
|
|
505
505
|
`, Qe = `vec4 texColor = texture2D(uTexture, resultUv);
|
|
506
|
-
baseColor = blendSrcOver(baseColor, texColor);`,
|
|
506
|
+
baseColor = blendSrcOver(baseColor, texColor);`, Re = {
|
|
507
507
|
vertexShader: qe,
|
|
508
508
|
fragmentShader: je
|
|
509
|
-
},
|
|
509
|
+
}, Le = {
|
|
510
510
|
declChunk: Ke,
|
|
511
511
|
uvChunk: Je,
|
|
512
512
|
baseColorChunk: Qe
|
|
513
513
|
};
|
|
514
514
|
function Ze(s, e, t, r = null, i) {
|
|
515
|
-
var
|
|
515
|
+
var x;
|
|
516
516
|
const c = r !== null || !!s.imageSrc;
|
|
517
517
|
let n = "";
|
|
518
518
|
const o = {};
|
|
519
519
|
if (i != null && i.uniforms)
|
|
520
|
-
for (const [
|
|
521
|
-
typeof w == "number" ? (n += `uniform float ${
|
|
522
|
-
`, o[
|
|
523
|
-
`, o[
|
|
524
|
-
`, o[
|
|
525
|
-
`, o[
|
|
526
|
-
`, o[
|
|
527
|
-
const a = i !== void 0, l = (c || a ?
|
|
520
|
+
for (const [C, w] of Object.entries(i.uniforms))
|
|
521
|
+
typeof w == "number" ? (n += `uniform float ${C};
|
|
522
|
+
`, o[C] = { value: w }) : Array.isArray(w) ? w.length === 2 ? (n += `uniform vec2 ${C};
|
|
523
|
+
`, o[C] = { value: new y.Vector2(...w) }) : w.length === 3 ? (n += `uniform vec3 ${C};
|
|
524
|
+
`, o[C] = { value: new y.Vector3(...w) }) : w.length === 4 && (n += `uniform vec4 ${C};
|
|
525
|
+
`, o[C] = { value: new y.Vector4(...w) }) : (n += `uniform float ${C};
|
|
526
|
+
`, o[C] = { value: w });
|
|
527
|
+
const a = i !== void 0, l = (c || a ? Le.declChunk : "") + `
|
|
528
528
|
` + n, d = `vec2 screenUv = (vScreenPos.xy / vScreenPos.w) * 0.5 + 0.5;
|
|
529
529
|
`, h = s.isTraveler ? `vec2 resultUv = screenUv;
|
|
530
530
|
` : `vec2 resultUv = vUv * uTextureRepeat + uTextureOffset;
|
|
531
|
-
`, f = c || a ? d + h + ((i == null ? void 0 : i.uvModifier) || "") : "", p = c || a ?
|
|
531
|
+
`, f = c || a ? d + h + ((i == null ? void 0 : i.uvModifier) || "") : "", p = c || a ? Le.baseColorChunk : "", g = (i == null ? void 0 : i.colorModifier) || "", v = Re.fragmentShader.replace("#INJECT_DECLARATIONS", l).replace("#INJECT_UV_MODIFIER", f).replace("#INJECT_BASE_COLOR", p).replace("#INJECT_COLOR_MODIFIER", g), b = le(s.backgroundColor), L = le(s.borderColor), M = {
|
|
532
532
|
uSize: { value: new y.Vector2(e, t) },
|
|
533
533
|
uBgColor: {
|
|
534
534
|
value: new y.Vector4(
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
535
|
+
b.color.r,
|
|
536
|
+
b.color.g,
|
|
537
|
+
b.color.b,
|
|
538
|
+
b.alpha
|
|
539
539
|
)
|
|
540
540
|
},
|
|
541
541
|
uBorderColor: {
|
|
542
542
|
value: new y.Vector4(
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
543
|
+
L.color.r,
|
|
544
|
+
L.color.g,
|
|
545
|
+
L.color.b,
|
|
546
|
+
L.alpha
|
|
547
547
|
)
|
|
548
548
|
},
|
|
549
549
|
uBorderRadius: { value: new y.Vector4(0, 0, 0, 0) },
|
|
550
|
-
uBorderWidth: { value:
|
|
551
|
-
uOpacity: { value: (
|
|
550
|
+
uBorderWidth: { value: re(s.borderWidth) },
|
|
551
|
+
uOpacity: { value: (x = s.opacity) != null ? x : 1 },
|
|
552
552
|
uTexture: { value: null },
|
|
553
553
|
uTextureRepeat: { value: new y.Vector2(1, 1) },
|
|
554
554
|
uTextureOffset: { value: new y.Vector2(0, 0) },
|
|
@@ -559,20 +559,20 @@ function Ze(s, e, t, r = null, i) {
|
|
|
559
559
|
},
|
|
560
560
|
uGradientStops: { value: new Float32Array(8) }
|
|
561
561
|
};
|
|
562
|
-
|
|
563
|
-
const
|
|
564
|
-
uniforms:
|
|
565
|
-
vertexShader:
|
|
566
|
-
fragmentShader:
|
|
562
|
+
Ie(M.uBorderRadius.value, s.borderRadius, Math.min(e, t)), c && (M.uTexture.value = r);
|
|
563
|
+
const S = new y.ShaderMaterial({
|
|
564
|
+
uniforms: J(J({}, M), o),
|
|
565
|
+
vertexShader: Re.vertexShader,
|
|
566
|
+
fragmentShader: v,
|
|
567
567
|
transparent: !0,
|
|
568
568
|
side: y.FrontSide
|
|
569
569
|
// for better performance
|
|
570
570
|
});
|
|
571
|
-
return s.backgroundImage &&
|
|
571
|
+
return s.backgroundImage && ye(S, { backgroundImage: s.backgroundImage }), S;
|
|
572
572
|
}
|
|
573
573
|
function et(s, e, t, r, i) {
|
|
574
|
-
const c =
|
|
575
|
-
|
|
574
|
+
const c = re(e.borderWidth);
|
|
575
|
+
ye(s, {
|
|
576
576
|
width: t,
|
|
577
577
|
height: r,
|
|
578
578
|
borderRadius: e.borderRadius,
|
|
@@ -584,11 +584,11 @@ function et(s, e, t, r, i) {
|
|
|
584
584
|
backgroundImage: e.backgroundImage
|
|
585
585
|
});
|
|
586
586
|
}
|
|
587
|
-
function
|
|
587
|
+
function ye(s, e) {
|
|
588
588
|
var r, i, c;
|
|
589
589
|
if (e.width !== void 0 && e.height !== void 0 && s.uniforms.uSize.value.set(e.width, e.height), e.borderRadius !== void 0) {
|
|
590
590
|
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);
|
|
591
|
-
|
|
591
|
+
Ie(s.uniforms.uBorderRadius.value, e.borderRadius, n);
|
|
592
592
|
}
|
|
593
593
|
if (e.borderWidth !== void 0 && (s.uniforms.uBorderWidth.value = e.borderWidth), e.backgroundColor !== void 0)
|
|
594
594
|
if (Array.isArray(e.backgroundColor)) {
|
|
@@ -600,7 +600,7 @@ function le(s, e) {
|
|
|
600
600
|
n
|
|
601
601
|
);
|
|
602
602
|
} else if (typeof e.backgroundColor == "string") {
|
|
603
|
-
const n =
|
|
603
|
+
const n = le(e.backgroundColor);
|
|
604
604
|
s.uniforms.uBgColor.value.set(
|
|
605
605
|
n.color.r,
|
|
606
606
|
n.color.g,
|
|
@@ -626,7 +626,7 @@ function le(s, e) {
|
|
|
626
626
|
n
|
|
627
627
|
);
|
|
628
628
|
} else if (typeof e.borderColor == "string") {
|
|
629
|
-
const n =
|
|
629
|
+
const n = le(e.borderColor);
|
|
630
630
|
s.uniforms.uBorderColor.value.set(
|
|
631
631
|
n.color.r,
|
|
632
632
|
n.color.g,
|
|
@@ -679,7 +679,7 @@ function le(s, e) {
|
|
|
679
679
|
for (const n of Object.keys(e))
|
|
680
680
|
n !== "width" && n !== "height" && n !== "borderRadius" && n !== "borderWidth" && n !== "backgroundColor" && n !== "borderColor" && n !== "opacity" && n !== "bgOpacity" && n !== "borderOpacity" && n !== "texture" && n !== "backgroundImage" && 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]);
|
|
681
681
|
}
|
|
682
|
-
function
|
|
682
|
+
function Ie(s, e, t = 0) {
|
|
683
683
|
var a, l, d, h;
|
|
684
684
|
if (e == null) {
|
|
685
685
|
s.set(0, 0, 0, 0);
|
|
@@ -693,10 +693,10 @@ function De(s, e, t = 0) {
|
|
|
693
693
|
s.set(e[0], e[1], e[2], e[3]);
|
|
694
694
|
return;
|
|
695
695
|
}
|
|
696
|
-
const r = e.split("/")[0].trim().split(/\s+/), i =
|
|
696
|
+
const r = e.split("/")[0].trim().split(/\s+/), i = re(r[0], t), c = re((a = r[1]) != null ? a : r[0], t), n = re((l = r[2]) != null ? l : r[0], t), o = re((h = (d = r[3]) != null ? d : r[1]) != null ? h : r[0], t);
|
|
697
697
|
s.set(i, c, n, o);
|
|
698
698
|
}
|
|
699
|
-
const
|
|
699
|
+
const H = {
|
|
700
700
|
create(s, e, t, r, i, c = 2, n = null, o) {
|
|
701
701
|
return s === "BOX" ? Ze(
|
|
702
702
|
e,
|
|
@@ -728,7 +728,7 @@ const X = {
|
|
|
728
728
|
);
|
|
729
729
|
},
|
|
730
730
|
forceUpdateUniforms(s, e) {
|
|
731
|
-
|
|
731
|
+
ye(s, e);
|
|
732
732
|
}
|
|
733
733
|
};
|
|
734
734
|
class tt {
|
|
@@ -757,7 +757,7 @@ class tt {
|
|
|
757
757
|
e.nodeType === Node.ELEMENT_NODE && this.observer && this.observer.unobserve(e), this.disposeTexture(e), this.elementUrls.delete(e), this.loadStatus.delete(e);
|
|
758
758
|
}
|
|
759
759
|
loadTexture(e) {
|
|
760
|
-
return
|
|
760
|
+
return Ee(this, null, function* () {
|
|
761
761
|
if (this.loadStatus.get(e) || this.textures.has(e))
|
|
762
762
|
return;
|
|
763
763
|
const t = this.elementUrls.get(e);
|
|
@@ -818,7 +818,7 @@ class rt {
|
|
|
818
818
|
u(this, "registry");
|
|
819
819
|
u(this, "targetRect");
|
|
820
820
|
u(this, "travelersByLayer", Array.from(
|
|
821
|
-
{ length:
|
|
821
|
+
{ length: _.MAX_LAYERS },
|
|
822
822
|
() => /* @__PURE__ */ new Set()
|
|
823
823
|
));
|
|
824
824
|
u(this, "textureManager");
|
|
@@ -827,7 +827,7 @@ class rt {
|
|
|
827
827
|
var o, a, l, d, h;
|
|
828
828
|
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 tt((f, p) => {
|
|
829
829
|
const g = this.registry.get(f);
|
|
830
|
-
g && g.material instanceof y.ShaderMaterial &&
|
|
830
|
+
g && g.material instanceof y.ShaderMaterial && H.forceUpdateUniforms(g.material, { texture: p });
|
|
831
831
|
}, this.isViewport), this.canvas = document.createElement("canvas"), this.scene = new y.Scene(), this.targetRect = this.target.getBoundingClientRect();
|
|
832
832
|
const c = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, n = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height;
|
|
833
833
|
this.camera = new y.OrthographicCamera(
|
|
@@ -849,10 +849,10 @@ class rt {
|
|
|
849
849
|
return this.mode === "overlay" && this.canvasSize === "viewport";
|
|
850
850
|
}
|
|
851
851
|
getSceneLayer() {
|
|
852
|
-
return typeof this.targetLayer == "number" ? this.targetLayer : this.targetLayer === "selected" ?
|
|
852
|
+
return typeof this.targetLayer == "number" ? this.targetLayer : this.targetLayer === "selected" ? U.SELECTED : U.BASE;
|
|
853
853
|
}
|
|
854
854
|
createRenderTarget() {
|
|
855
|
-
for (let e = 0; e <
|
|
855
|
+
for (let e = 0; e < _.MAX_LAYERS; e++) {
|
|
856
856
|
const t = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, r = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height;
|
|
857
857
|
this.renderTargets.push(
|
|
858
858
|
new y.WebGLRenderTarget(
|
|
@@ -899,12 +899,12 @@ class rt {
|
|
|
899
899
|
updateUniforms(e, t) {
|
|
900
900
|
const r = this.registry.get(e);
|
|
901
901
|
r && (r.traverse((i) => {
|
|
902
|
-
i.isMesh && i.material &&
|
|
902
|
+
i.isMesh && i.material && H.forceUpdateUniforms(
|
|
903
903
|
i.material,
|
|
904
904
|
t
|
|
905
905
|
);
|
|
906
906
|
}), r.userData.nativeMesh && r.userData.nativeMesh.traverse((i) => {
|
|
907
|
-
i.isMesh && i.material &&
|
|
907
|
+
i.isMesh && i.material && H.forceUpdateUniforms(
|
|
908
908
|
i.material,
|
|
909
909
|
t
|
|
910
910
|
);
|
|
@@ -944,7 +944,7 @@ class rt {
|
|
|
944
944
|
let t = this.registry.get(e.element);
|
|
945
945
|
const r = JSON.stringify(e.shaderHooks || null);
|
|
946
946
|
if (t && t.userData.shaderHash !== r && (this.scene.remove(t), t.geometry.dispose(), t.material instanceof y.Material && t.material.dispose(), this.registry.remove(e.element), t = void 0), !t) {
|
|
947
|
-
const n = new y.PlaneGeometry(1, 1), o = e.isTraveler ? (i = this.renderTargets[e.captureLayer - 2]) == null ? void 0 : i.texture : this.textureManager.get(e.element), a =
|
|
947
|
+
const n = new y.PlaneGeometry(1, 1), o = e.isTraveler ? (i = this.renderTargets[e.captureLayer - 2]) == null ? void 0 : i.texture : this.textureManager.get(e.element), a = H.create(
|
|
948
948
|
"BOX",
|
|
949
949
|
e.styles,
|
|
950
950
|
"",
|
|
@@ -957,7 +957,7 @@ class rt {
|
|
|
957
957
|
t = new y.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;
|
|
958
958
|
}
|
|
959
959
|
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)
|
|
960
|
-
for (let n = 0; n <
|
|
960
|
+
for (let n = 0; n < _.MAX_LAYERS; n++)
|
|
961
961
|
n === e.captureLayer - 2 ? this.travelersByLayer[n].add(t) : this.travelersByLayer[n].delete(t);
|
|
962
962
|
else
|
|
963
963
|
for (const n of this.travelersByLayer)
|
|
@@ -977,53 +977,53 @@ class rt {
|
|
|
977
977
|
const i = t.textLines || [
|
|
978
978
|
{ text: t.textContent || "", rect: t.rect }
|
|
979
979
|
], 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;
|
|
980
|
-
if (t.dirtyMask &
|
|
980
|
+
if (t.dirtyMask & ve || n !== o) {
|
|
981
981
|
e.children.filter(
|
|
982
982
|
(g) => g.name.startsWith("TEXT_CHILD")
|
|
983
983
|
).forEach((g) => {
|
|
984
|
-
var
|
|
985
|
-
const
|
|
986
|
-
(
|
|
984
|
+
var b;
|
|
985
|
+
const v = g;
|
|
986
|
+
(b = v.material.map) == null || b.dispose(), v.geometry.dispose(), e.remove(v);
|
|
987
987
|
});
|
|
988
988
|
const h = t.rect, f = h.x + h.width / 2, p = h.y + h.height / 2;
|
|
989
|
-
i.forEach((g,
|
|
990
|
-
const
|
|
989
|
+
i.forEach((g, v) => {
|
|
990
|
+
const b = H.create(
|
|
991
991
|
"TEXT",
|
|
992
992
|
c,
|
|
993
993
|
g.text,
|
|
994
994
|
g.rect.width,
|
|
995
995
|
g.rect.height,
|
|
996
996
|
this.qualityFactor
|
|
997
|
-
),
|
|
998
|
-
|
|
999
|
-
const
|
|
1000
|
-
|
|
1001
|
-
const
|
|
1002
|
-
|
|
1003
|
-
t.rect.width === 0 ? 0 :
|
|
1004
|
-
t.rect.height === 0 ? 0 :
|
|
997
|
+
), L = new y.PlaneGeometry(1, 1), M = new y.Mesh(L, b);
|
|
998
|
+
M.name = `TEXT_CHILD_${v}`;
|
|
999
|
+
const S = t.rect.width === 0 ? 1 : g.rect.width / t.rect.width, x = t.rect.height === 0 ? 1 : g.rect.height / t.rect.height;
|
|
1000
|
+
M.scale.set(S, x, 1);
|
|
1001
|
+
const C = g.rect.x + g.rect.width / 2, w = g.rect.y + g.rect.height / 2, T = C - f, A = -(w - p);
|
|
1002
|
+
M.position.set(
|
|
1003
|
+
t.rect.width === 0 ? 0 : T / t.rect.width,
|
|
1004
|
+
t.rect.height === 0 ? 0 : A / t.rect.height,
|
|
1005
1005
|
5e-3
|
|
1006
|
-
), e.add(
|
|
1006
|
+
), e.add(M);
|
|
1007
1007
|
}), e.userData.textChildStyleHash = n;
|
|
1008
1008
|
}
|
|
1009
1009
|
e.children.forEach((d) => {
|
|
1010
1010
|
if (!d.name.startsWith("TEXT_CHILD"))
|
|
1011
1011
|
return;
|
|
1012
|
-
const h = d, f = t.visibility &
|
|
1013
|
-
if (h.layers.set(f), t.visibility &
|
|
1012
|
+
const h = d, f = t.visibility & $ ? U.BASE : U.HIDDEN;
|
|
1013
|
+
if (h.layers.set(f), t.visibility & te && h.layers.enable(U.SELECTED), t.visibility & $)
|
|
1014
1014
|
if (!r && t.nativeLayer !== void 0 && t.nativeStyles !== void 0)
|
|
1015
1015
|
for (let p = t.captureLayer; p < t.nativeLayer; p++)
|
|
1016
|
-
h.layers.enable(
|
|
1016
|
+
h.layers.enable(U.getCaptureLayer(p));
|
|
1017
1017
|
else if (r && t.nativeLayer !== void 0)
|
|
1018
|
-
for (let p = Math.max(t.captureLayer, t.nativeLayer); p <=
|
|
1019
|
-
h.layers.enable(
|
|
1018
|
+
for (let p = Math.max(t.captureLayer, t.nativeLayer); p <= _.MAX_LAYERS + 1; p++)
|
|
1019
|
+
h.layers.enable(U.getCaptureLayer(p));
|
|
1020
1020
|
else
|
|
1021
|
-
for (let p = t.captureLayer; p <=
|
|
1022
|
-
h.layers.enable(
|
|
1021
|
+
for (let p = t.captureLayer; p <= _.MAX_LAYERS + 1; p++)
|
|
1022
|
+
h.layers.enable(U.getCaptureLayer(p));
|
|
1023
1023
|
});
|
|
1024
1024
|
}
|
|
1025
1025
|
updateMeshProperties(e, t) {
|
|
1026
|
-
var
|
|
1026
|
+
var S, x, C;
|
|
1027
1027
|
const { rect: r, styles: i } = t, c = this.renderer.getPixelRatio(), n = this.renderer.domElement.width / c, o = this.renderer.domElement.height / c;
|
|
1028
1028
|
e.material = e.userData.baseMaterial, e.scale.set(r.width, r.height, 1), e.userData.domRect = {
|
|
1029
1029
|
x: r.x,
|
|
@@ -1038,8 +1038,8 @@ class rt {
|
|
|
1038
1038
|
if (this.isViewport)
|
|
1039
1039
|
h = r.x - window.innerWidth / 2 + r.width / 2, f = -r.y + window.innerHeight / 2 - r.height / 2;
|
|
1040
1040
|
else {
|
|
1041
|
-
const w = r.x - l,
|
|
1042
|
-
h = w - n / 2 + r.width / 2, f = -
|
|
1041
|
+
const w = r.x - l, T = r.y - d;
|
|
1042
|
+
h = w - n / 2 + r.width / 2, f = -T + o / 2 - r.height / 2;
|
|
1043
1043
|
}
|
|
1044
1044
|
e.position.set(
|
|
1045
1045
|
h,
|
|
@@ -1048,13 +1048,13 @@ class rt {
|
|
|
1048
1048
|
);
|
|
1049
1049
|
const p = r.x, g = r.y;
|
|
1050
1050
|
e.userData.basePosition = { x: h, y: f }, e.userData.originalBasePosition = { x: h, y: f }, e.userData.baseSize = { width: r.width, height: r.height }, e.userData.baseDOM = { x: p, y: g }, e.userData.isFixed = t.isFixed, e.userData.initialScroll = { x: window.scrollX, y: window.scrollY };
|
|
1051
|
-
const
|
|
1052
|
-
let
|
|
1053
|
-
if (
|
|
1054
|
-
const w = new DOMMatrix(
|
|
1055
|
-
|
|
1051
|
+
const v = t.element.nodeType === Node.TEXT_NODE ? t.element.parentElement : t.element, b = window.getComputedStyle(v);
|
|
1052
|
+
let L = 0, M = 0;
|
|
1053
|
+
if (b.transform && b.transform !== "none") {
|
|
1054
|
+
const w = new DOMMatrix(b.transform);
|
|
1055
|
+
L = w.m41, M = w.m42;
|
|
1056
1056
|
}
|
|
1057
|
-
if (e.userData.baseTransform = { x:
|
|
1057
|
+
if (e.userData.baseTransform = { x: L, y: M }, delete e.userData.originRatioX, delete e.userData.originRatioY, H.update(
|
|
1058
1058
|
e.userData.baseMaterial,
|
|
1059
1059
|
"BOX",
|
|
1060
1060
|
i,
|
|
@@ -1062,34 +1062,62 @@ class rt {
|
|
|
1062
1062
|
r.width,
|
|
1063
1063
|
r.height,
|
|
1064
1064
|
this.qualityFactor,
|
|
1065
|
-
t.isTraveler ? (
|
|
1065
|
+
t.isTraveler ? (S = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : S.texture : this.textureManager.get(t.element)
|
|
1066
1066
|
), t.nativeStyles && t.nativeRect) {
|
|
1067
1067
|
if (!e.userData.nativeMesh) {
|
|
1068
|
-
const
|
|
1068
|
+
const X = H.create(
|
|
1069
1069
|
"BOX",
|
|
1070
1070
|
t.nativeStyles,
|
|
1071
1071
|
"",
|
|
1072
1072
|
t.nativeRect.width,
|
|
1073
1073
|
t.nativeRect.height,
|
|
1074
1074
|
this.qualityFactor,
|
|
1075
|
-
t.isTraveler ? (
|
|
1075
|
+
t.isTraveler ? (x = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : x.texture : this.textureManager.get(t.element),
|
|
1076
1076
|
t.shaderHooks
|
|
1077
|
-
),
|
|
1078
|
-
t.type === "TEXT" && (
|
|
1077
|
+
), N = new y.Mesh(e.geometry, X);
|
|
1078
|
+
t.type === "TEXT" && (N.name = "BG_MESH"), this.scene.add(N), e.userData.nativeMesh = N;
|
|
1079
1079
|
}
|
|
1080
1080
|
const w = e.userData.nativeMesh;
|
|
1081
|
-
let
|
|
1081
|
+
let T, A;
|
|
1082
1082
|
if (this.isViewport)
|
|
1083
|
-
|
|
1083
|
+
T = t.nativeRect.x - window.innerWidth / 2 + t.nativeRect.width / 2, A = -t.nativeRect.y + window.innerHeight / 2 - t.nativeRect.height / 2;
|
|
1084
1084
|
else {
|
|
1085
|
-
const
|
|
1086
|
-
|
|
1085
|
+
const X = t.nativeRect.x - l, N = t.nativeRect.y - d;
|
|
1086
|
+
T = X - n / 2 + t.nativeRect.width / 2, A = -N + o / 2 - t.nativeRect.height / 2;
|
|
1087
1087
|
}
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1088
|
+
let I = t.nativeRect.width, q = t.nativeRect.height, ie = T, se = A;
|
|
1089
|
+
if (t.nativeStyles.transform) {
|
|
1090
|
+
const X = t.nativeStyles.transform, N = X.match(/scale\(([\d.]+%?)\)/);
|
|
1091
|
+
if (N) {
|
|
1092
|
+
let B = parseFloat(N[1]);
|
|
1093
|
+
N[1].includes("%") && (B /= 100), I *= B, q *= B;
|
|
1094
|
+
}
|
|
1095
|
+
const Z = X.match(/translate\(([^,]+),\s*([^)]+)\)/);
|
|
1096
|
+
if (Z) {
|
|
1097
|
+
const B = Z[1].trim(), F = Z[2].trim();
|
|
1098
|
+
let m = parseFloat(B);
|
|
1099
|
+
B.includes("%") && (m = m / 100 * t.nativeRect.width);
|
|
1100
|
+
let R = parseFloat(F);
|
|
1101
|
+
F.includes("%") && (R = R / 100 * t.nativeRect.height), ie += m, se -= R;
|
|
1102
|
+
}
|
|
1103
|
+
const ne = X.match(/translateX\(([^)]+)\)/);
|
|
1104
|
+
if (ne) {
|
|
1105
|
+
const B = ne[1].trim();
|
|
1106
|
+
let F = parseFloat(B);
|
|
1107
|
+
B.includes("%") && (F = F / 100 * t.nativeRect.width), ie += F;
|
|
1108
|
+
}
|
|
1109
|
+
const oe = X.match(/translateY\(([^)]+)\)/);
|
|
1110
|
+
if (oe) {
|
|
1111
|
+
const B = oe[1].trim();
|
|
1112
|
+
let F = parseFloat(B);
|
|
1113
|
+
B.includes("%") && (F = F / 100 * t.nativeRect.height), se -= F;
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
w.scale.set(I, q, 1), w.position.set(
|
|
1117
|
+
ie,
|
|
1118
|
+
se,
|
|
1091
1119
|
t.nativeStyles.zIndex + this.renderOrder * a
|
|
1092
|
-
),
|
|
1120
|
+
), H.update(
|
|
1093
1121
|
w.material,
|
|
1094
1122
|
"BOX",
|
|
1095
1123
|
t.nativeStyles,
|
|
@@ -1097,24 +1125,24 @@ class rt {
|
|
|
1097
1125
|
t.nativeRect.width,
|
|
1098
1126
|
t.nativeRect.height,
|
|
1099
1127
|
this.qualityFactor,
|
|
1100
|
-
t.isTraveler ? (
|
|
1128
|
+
t.isTraveler ? (C = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : C.texture : this.textureManager.get(t.element)
|
|
1101
1129
|
);
|
|
1102
1130
|
} else
|
|
1103
1131
|
e.userData.nativeMesh && (this.scene.remove(e.userData.nativeMesh), e.userData.nativeMesh.material instanceof y.Material && e.userData.nativeMesh.material.dispose(), delete e.userData.nativeMesh);
|
|
1104
1132
|
}
|
|
1105
1133
|
updateMeshLayers(e, t) {
|
|
1106
|
-
const r = t.visibility &
|
|
1107
|
-
if (e.layers.set(r), t.visibility &
|
|
1134
|
+
const r = t.visibility & $ ? U.BASE : U.HIDDEN;
|
|
1135
|
+
if (e.layers.set(r), t.visibility & te && e.layers.enable(U.SELECTED), e.userData.nativeMesh && t.nativeLayer !== void 0) {
|
|
1108
1136
|
const i = e.userData.nativeMesh;
|
|
1109
|
-
if (i.layers.set(
|
|
1137
|
+
if (i.layers.set(U.HIDDEN), t.visibility & $) {
|
|
1110
1138
|
for (let c = t.captureLayer; c < t.nativeLayer; c++)
|
|
1111
|
-
e.layers.enable(
|
|
1112
|
-
for (let c = Math.max(t.captureLayer, t.nativeLayer); c <=
|
|
1113
|
-
i.layers.enable(
|
|
1139
|
+
e.layers.enable(U.getCaptureLayer(c));
|
|
1140
|
+
for (let c = Math.max(t.captureLayer, t.nativeLayer); c <= _.MAX_LAYERS + 1; c++)
|
|
1141
|
+
i.layers.enable(U.getCaptureLayer(c));
|
|
1114
1142
|
}
|
|
1115
|
-
} else if (t.visibility &
|
|
1116
|
-
for (let i = t.captureLayer; i <=
|
|
1117
|
-
e.layers.enable(
|
|
1143
|
+
} else if (t.visibility & $)
|
|
1144
|
+
for (let i = t.captureLayer; i <= _.MAX_LAYERS + 1; i++)
|
|
1145
|
+
e.layers.enable(U.getCaptureLayer(i));
|
|
1118
1146
|
}
|
|
1119
1147
|
captureRenderTarget(e, t, r) {
|
|
1120
1148
|
if (e.size === 0 || !r)
|
|
@@ -1127,17 +1155,17 @@ class rt {
|
|
|
1127
1155
|
const h = (n.x + 1) / 2 * o, f = (n.y + 1) / 2 * a;
|
|
1128
1156
|
let p = 0, g = 1;
|
|
1129
1157
|
typeof this.clipArea == "number" ? g = this.clipArea : this.clipArea.endsWith("%") ? g = parseFloat(this.clipArea) / 100 : this.clipArea.endsWith("px") && (p = parseFloat(this.clipArea));
|
|
1130
|
-
const
|
|
1131
|
-
this.renderer.setScissor(
|
|
1158
|
+
const v = d.scale.x * g + 0.5, b = d.scale.y * g + 0.5, L = h - v / 2, M = f - b / 2, S = (L * this.qualityFactor - p) / l, x = (M * this.qualityFactor - p) / l, C = (v * this.qualityFactor + p * 2) / l, w = (b * this.qualityFactor + p * 2) / l;
|
|
1159
|
+
this.renderer.setScissor(S, x, C, w), this.renderer.render(this.scene, this.camera);
|
|
1132
1160
|
}
|
|
1133
1161
|
this.renderer.setScissorTest(!1), this.renderer.autoClear = !0, this.renderer.setRenderTarget(null), this.camera.layers.set(this.getSceneLayer()), this.renderer.setClearColor(i, c);
|
|
1134
1162
|
}
|
|
1135
1163
|
render() {
|
|
1136
|
-
for (let e = 0; e <
|
|
1164
|
+
for (let e = 0; e < _.MAX_LAYERS; e++) {
|
|
1137
1165
|
const t = e + 1;
|
|
1138
1166
|
this.captureRenderTarget(
|
|
1139
1167
|
this.travelersByLayer[e],
|
|
1140
|
-
|
|
1168
|
+
U.getCaptureLayer(t),
|
|
1141
1169
|
this.renderTargets[e]
|
|
1142
1170
|
);
|
|
1143
1171
|
}
|
|
@@ -1173,28 +1201,40 @@ class rt {
|
|
|
1173
1201
|
const p = l.x - e, g = l.y - t;
|
|
1174
1202
|
h = p - i / 2 + l.width / 2, f = -g + c / 2 - l.height / 2;
|
|
1175
1203
|
}
|
|
1176
|
-
if (o.position.setX(h), o.position.setY(f), o.scale.set(l.width, l.height, 1), o.updateMatrixWorld(), o.material instanceof y.ShaderMaterial &&
|
|
1204
|
+
if (o.position.setX(h), o.position.setY(f), o.scale.set(l.width, l.height, 1), o.updateMatrixWorld(), o.material instanceof y.ShaderMaterial && H.forceUpdateUniforms(o.material, {
|
|
1177
1205
|
width: l.width,
|
|
1178
1206
|
height: l.height
|
|
1179
1207
|
}), o.userData.nativeMesh) {
|
|
1180
1208
|
const p = o.userData.nativeMesh;
|
|
1181
|
-
let g = l.width,
|
|
1209
|
+
let g = l.width, v = l.height, b = h, L = f;
|
|
1182
1210
|
if (o.userData.nativeTransform) {
|
|
1183
|
-
const
|
|
1184
|
-
if (
|
|
1185
|
-
let
|
|
1186
|
-
|
|
1211
|
+
const M = o.userData.nativeTransform, S = M.match(/scale\(([\d.]+%?)\)/);
|
|
1212
|
+
if (S) {
|
|
1213
|
+
let T = parseFloat(S[1]);
|
|
1214
|
+
S[1].includes("%") && (T /= 100), g *= T, v *= T;
|
|
1215
|
+
}
|
|
1216
|
+
const x = M.match(/translate\(([^,]+),\s*([^)]+)\)/);
|
|
1217
|
+
if (x) {
|
|
1218
|
+
const T = x[1].trim(), A = x[2].trim();
|
|
1219
|
+
let I = parseFloat(T);
|
|
1220
|
+
T.includes("%") && (I = I / 100 * l.width);
|
|
1221
|
+
let q = parseFloat(A);
|
|
1222
|
+
A.includes("%") && (q = q / 100 * l.height), b += I, L -= q;
|
|
1223
|
+
}
|
|
1224
|
+
const C = M.match(/translateX\(([^)]+)\)/);
|
|
1225
|
+
if (C) {
|
|
1226
|
+
const T = C[1].trim();
|
|
1227
|
+
let A = parseFloat(T);
|
|
1228
|
+
T.includes("%") && (A = A / 100 * l.width), b += A;
|
|
1187
1229
|
}
|
|
1188
|
-
const
|
|
1189
|
-
if (
|
|
1190
|
-
const
|
|
1191
|
-
let
|
|
1192
|
-
|
|
1193
|
-
let U = parseFloat(w);
|
|
1194
|
-
w.includes("%") && (U = U / 100 * l.height), x += k, S -= U;
|
|
1230
|
+
const w = M.match(/translateY\(([^)]+)\)/);
|
|
1231
|
+
if (w) {
|
|
1232
|
+
const T = w[1].trim();
|
|
1233
|
+
let A = parseFloat(T);
|
|
1234
|
+
T.includes("%") && (A = A / 100 * l.height), L -= A;
|
|
1195
1235
|
}
|
|
1196
1236
|
}
|
|
1197
|
-
p.position.setX(
|
|
1237
|
+
p.position.setX(b), p.position.setY(L), p.scale.set(g, v, 1), p.updateMatrixWorld();
|
|
1198
1238
|
}
|
|
1199
1239
|
}
|
|
1200
1240
|
});
|
|
@@ -1276,7 +1316,7 @@ function it(s) {
|
|
|
1276
1316
|
(l) => l.text.trim().length > 0 && l.rect.width > 0 && l.rect.height > 0
|
|
1277
1317
|
);
|
|
1278
1318
|
}
|
|
1279
|
-
function
|
|
1319
|
+
function Me(s) {
|
|
1280
1320
|
const e = parseFloat(s.fontSize);
|
|
1281
1321
|
let t = parseFloat(s.lineHeight);
|
|
1282
1322
|
isNaN(t) && (t = e * 1.2);
|
|
@@ -1292,283 +1332,283 @@ function Re(s) {
|
|
|
1292
1332
|
letterSpacing: r
|
|
1293
1333
|
};
|
|
1294
1334
|
}
|
|
1295
|
-
function
|
|
1296
|
-
var
|
|
1335
|
+
function Ue(s, e = Q | ce | Ye | ve | ue, t, r = 1, i = 0, c = 2, n, o) {
|
|
1336
|
+
var N, Z, ne, oe, B, F;
|
|
1297
1337
|
if (s.nodeType === Node.TEXT_NODE) {
|
|
1298
|
-
const
|
|
1299
|
-
if (!
|
|
1338
|
+
const m = s;
|
|
1339
|
+
if (!m.textContent || !m.textContent.trim())
|
|
1300
1340
|
return null;
|
|
1301
|
-
const
|
|
1302
|
-
if (
|
|
1341
|
+
const R = m.textContent.replace(/\s+/g, " ");
|
|
1342
|
+
if (R.length === 0)
|
|
1303
1343
|
return null;
|
|
1304
|
-
const
|
|
1305
|
-
if (
|
|
1344
|
+
const O = it(m);
|
|
1345
|
+
if (O.length === 0)
|
|
1306
1346
|
return null;
|
|
1307
|
-
const
|
|
1308
|
-
if (!
|
|
1347
|
+
const V = m.parentElement, k = V ? window.getComputedStyle(V) : null;
|
|
1348
|
+
if (!k)
|
|
1309
1349
|
return null;
|
|
1310
|
-
const
|
|
1350
|
+
const P = Math.min(...O.map((E) => E.rect.left)), z = Math.min(...O.map((E) => E.rect.top)), j = Math.max(...O.map((E) => E.rect.left + E.rect.width)), D = Math.max(...O.map((E) => E.rect.top + E.rect.height));
|
|
1311
1351
|
return {
|
|
1312
1352
|
id: Math.random().toString(36).substring(2, 9),
|
|
1313
1353
|
type: "TEXT",
|
|
1314
|
-
element:
|
|
1354
|
+
element: m,
|
|
1315
1355
|
rect: {
|
|
1316
|
-
x:
|
|
1317
|
-
y:
|
|
1318
|
-
width:
|
|
1319
|
-
height:
|
|
1356
|
+
x: P + window.scrollX,
|
|
1357
|
+
y: z + window.scrollY,
|
|
1358
|
+
width: j - P,
|
|
1359
|
+
height: D - z
|
|
1320
1360
|
},
|
|
1321
1361
|
styles: {
|
|
1322
1362
|
backgroundColor: "transparent",
|
|
1323
1363
|
backgroundImage: "",
|
|
1324
|
-
opacity:
|
|
1325
|
-
zIndex: (isNaN(parseInt(
|
|
1364
|
+
opacity: V && V.dataset[K.KEY] === K.VALUES.HIDE ? 1 : parseFloat(k.opacity),
|
|
1365
|
+
zIndex: (isNaN(parseInt(k.zIndex)) ? 0 : parseInt(k.zIndex)) + i,
|
|
1326
1366
|
borderRadius: "0px",
|
|
1327
1367
|
borderColor: "transparent",
|
|
1328
1368
|
borderWidth: "0px",
|
|
1329
1369
|
isTraveler: !1
|
|
1330
1370
|
},
|
|
1331
|
-
textContent:
|
|
1332
|
-
textLines:
|
|
1333
|
-
text:
|
|
1371
|
+
textContent: R,
|
|
1372
|
+
textLines: O.map((E) => ({
|
|
1373
|
+
text: E.text.trim(),
|
|
1334
1374
|
rect: {
|
|
1335
|
-
x:
|
|
1336
|
-
y:
|
|
1337
|
-
width:
|
|
1338
|
-
height:
|
|
1375
|
+
x: E.rect.left + window.scrollX,
|
|
1376
|
+
y: E.rect.top + window.scrollY,
|
|
1377
|
+
width: E.rect.width,
|
|
1378
|
+
height: E.rect.height
|
|
1339
1379
|
}
|
|
1340
1380
|
})),
|
|
1341
|
-
textStyles:
|
|
1381
|
+
textStyles: Me(k),
|
|
1342
1382
|
dirtyMask: e,
|
|
1343
1383
|
visibility: t,
|
|
1344
1384
|
isTraveler: !1,
|
|
1345
1385
|
captureLayer: r,
|
|
1346
|
-
isFixed:
|
|
1386
|
+
isFixed: k.position === "fixed",
|
|
1347
1387
|
nativeLayer: n,
|
|
1348
|
-
nativeStyles: o ?
|
|
1388
|
+
nativeStyles: o ? J(J({
|
|
1349
1389
|
backgroundColor: "transparent",
|
|
1350
1390
|
backgroundImage: "",
|
|
1351
|
-
opacity:
|
|
1352
|
-
zIndex: (isNaN(parseInt(
|
|
1391
|
+
opacity: V && V.dataset[K.KEY] === K.VALUES.HIDE ? 1 : parseFloat(k.opacity),
|
|
1392
|
+
zIndex: (isNaN(parseInt(k.zIndex)) ? 0 : parseInt(k.zIndex)) + i,
|
|
1353
1393
|
borderRadius: "0px",
|
|
1354
1394
|
borderColor: "transparent",
|
|
1355
1395
|
borderWidth: "0px",
|
|
1356
1396
|
isTraveler: !1
|
|
1357
|
-
},
|
|
1397
|
+
}, Me(k)), o) : void 0,
|
|
1358
1398
|
nativeRect: o ? {
|
|
1359
|
-
x:
|
|
1360
|
-
y:
|
|
1361
|
-
width:
|
|
1362
|
-
height:
|
|
1399
|
+
x: P + window.scrollX,
|
|
1400
|
+
y: z + window.scrollY,
|
|
1401
|
+
width: j - P,
|
|
1402
|
+
height: D - z
|
|
1363
1403
|
} : void 0,
|
|
1364
1404
|
children: []
|
|
1365
1405
|
};
|
|
1366
1406
|
}
|
|
1367
1407
|
if (s.nodeType !== Node.ELEMENT_NODE)
|
|
1368
1408
|
return null;
|
|
1369
|
-
const a = s, l = a.dataset[
|
|
1409
|
+
const a = s, l = a.dataset[W.KEY];
|
|
1370
1410
|
let d = t, h = t;
|
|
1371
1411
|
if (l) {
|
|
1372
|
-
const
|
|
1373
|
-
for (const
|
|
1374
|
-
if (!
|
|
1412
|
+
const m = new Set(l.split(/\s+/));
|
|
1413
|
+
for (const R of m)
|
|
1414
|
+
if (!Te.includes(R))
|
|
1375
1415
|
throw new Error(
|
|
1376
|
-
`[MirageEngine] Invalid filter token: '${
|
|
1416
|
+
`[MirageEngine] Invalid filter token: '${R}'. Expected one of: 'include-tree', 'exclude-tree', 'include-self', 'exclude-self', 'end'.`
|
|
1377
1417
|
);
|
|
1378
|
-
if (
|
|
1418
|
+
if (m.has(W.VALUES.END))
|
|
1379
1419
|
return null;
|
|
1380
|
-
if (
|
|
1420
|
+
if (m.has(W.VALUES.INCLUDE_TREE) && m.has(W.VALUES.EXCLUDE_TREE))
|
|
1381
1421
|
throw new Error(
|
|
1382
1422
|
"[MirageEngine] Conflicting filters: 'include-tree' and 'exclude-tree' cannot be used together on the same element."
|
|
1383
1423
|
);
|
|
1384
|
-
if (
|
|
1424
|
+
if (m.has(W.VALUES.INCLUDE_SELF) && m.has(W.VALUES.EXCLUDE_SELF))
|
|
1385
1425
|
throw new Error(
|
|
1386
1426
|
"[MirageEngine] Conflicting filters: 'include-self' and 'exclude-self' cannot be used together on the same element."
|
|
1387
1427
|
);
|
|
1388
|
-
|
|
1428
|
+
m.has(W.VALUES.INCLUDE_TREE) ? d = d | $ : m.has(W.VALUES.EXCLUDE_TREE) && (d = d & ~$), h = d, m.has(W.VALUES.INCLUDE_SELF) ? h = h | $ : m.has(W.VALUES.EXCLUDE_SELF) && (h = h & ~$);
|
|
1389
1429
|
}
|
|
1390
|
-
const f = a.dataset[
|
|
1430
|
+
const f = a.dataset[G.KEY];
|
|
1391
1431
|
if (f) {
|
|
1392
|
-
const
|
|
1393
|
-
for (const
|
|
1394
|
-
if (!
|
|
1432
|
+
const m = new Set(f.split(/\s+/));
|
|
1433
|
+
for (const R of m)
|
|
1434
|
+
if (!Te.includes(R))
|
|
1395
1435
|
throw new Error(
|
|
1396
|
-
`[MirageEngine] Invalid select token: '${
|
|
1436
|
+
`[MirageEngine] Invalid select token: '${R}'. Expected one of: 'include-tree', 'exclude-tree', 'include-self', 'exclude-self', 'end'.`
|
|
1397
1437
|
);
|
|
1398
|
-
if (
|
|
1438
|
+
if (m.has(G.VALUES.END))
|
|
1399
1439
|
return null;
|
|
1400
|
-
if (
|
|
1440
|
+
if (m.has(G.VALUES.INCLUDE_TREE) && m.has(G.VALUES.EXCLUDE_TREE))
|
|
1401
1441
|
throw new Error(
|
|
1402
1442
|
"[MirageEngine] Conflicting selects: 'include-tree' and 'exclude-tree' cannot be used together on the same element."
|
|
1403
1443
|
);
|
|
1404
|
-
if (
|
|
1444
|
+
if (m.has(G.VALUES.INCLUDE_SELF) && m.has(G.VALUES.EXCLUDE_SELF))
|
|
1405
1445
|
throw new Error(
|
|
1406
1446
|
"[MirageEngine] Conflicting selects: 'include-self' and 'exclude-self' cannot be used together on the same element."
|
|
1407
1447
|
);
|
|
1408
|
-
|
|
1448
|
+
m.has(G.VALUES.INCLUDE_TREE) ? d = d | te : m.has(G.VALUES.EXCLUDE_TREE) && (d = d & ~te), h = d, m.has(G.VALUES.INCLUDE_SELF) ? h = h | te : m.has(G.VALUES.EXCLUDE_SELF) && (h = h & ~te);
|
|
1409
1449
|
}
|
|
1410
|
-
const p = a.dataset[
|
|
1411
|
-
let g = !1,
|
|
1450
|
+
const p = a.dataset[_.KEY];
|
|
1451
|
+
let g = !1, v = o ? J({}, o) : {}, b = n;
|
|
1412
1452
|
if (p) {
|
|
1413
|
-
let
|
|
1414
|
-
const
|
|
1415
|
-
let
|
|
1416
|
-
if (
|
|
1417
|
-
|
|
1418
|
-
const
|
|
1453
|
+
let m = 1;
|
|
1454
|
+
const R = p.indexOf("{"), O = p.lastIndexOf("}");
|
|
1455
|
+
let V = p;
|
|
1456
|
+
if (R !== -1 && O !== -1 && O > R) {
|
|
1457
|
+
V = p.substring(0, R).trim();
|
|
1458
|
+
const D = p.substring(R, O + 1);
|
|
1419
1459
|
try {
|
|
1420
|
-
|
|
1421
|
-
} catch (
|
|
1460
|
+
v = new Function("return " + D)();
|
|
1461
|
+
} catch (E) {
|
|
1422
1462
|
console.warn(
|
|
1423
|
-
`[MirageEngine] Failed to parse travel styles JSON: ${
|
|
1463
|
+
`[MirageEngine] Failed to parse travel styles JSON: ${D}`
|
|
1424
1464
|
);
|
|
1425
1465
|
}
|
|
1426
1466
|
}
|
|
1427
|
-
const
|
|
1428
|
-
let
|
|
1429
|
-
const
|
|
1430
|
-
if (
|
|
1431
|
-
g = !0,
|
|
1432
|
-
const
|
|
1433
|
-
if (
|
|
1434
|
-
|
|
1467
|
+
const k = V.split(/\s+/);
|
|
1468
|
+
let P = !1;
|
|
1469
|
+
const z = k.indexOf(_.VALUES.TRAVELER);
|
|
1470
|
+
if (z !== -1) {
|
|
1471
|
+
g = !0, P = !0;
|
|
1472
|
+
const D = k[z + 1];
|
|
1473
|
+
if (D && !isNaN(parseInt(D, 10)))
|
|
1474
|
+
m = parseInt(D, 10);
|
|
1435
1475
|
else {
|
|
1436
|
-
const
|
|
1437
|
-
|
|
1476
|
+
const E = k.find((ee) => !isNaN(parseInt(ee, 10)));
|
|
1477
|
+
E && (m = parseInt(E, 10));
|
|
1438
1478
|
}
|
|
1439
1479
|
}
|
|
1440
|
-
const
|
|
1441
|
-
if (
|
|
1442
|
-
const
|
|
1443
|
-
if (
|
|
1444
|
-
|
|
1480
|
+
const j = k.indexOf(_.VALUES.NATIVE);
|
|
1481
|
+
if (j !== -1) {
|
|
1482
|
+
const D = k[j + 1];
|
|
1483
|
+
if (D && !isNaN(parseInt(D, 10)))
|
|
1484
|
+
b = parseInt(D, 10);
|
|
1445
1485
|
else if (!g) {
|
|
1446
|
-
const
|
|
1447
|
-
|
|
1486
|
+
const E = k.find((ee) => !isNaN(parseInt(ee, 10)));
|
|
1487
|
+
E && (b = parseInt(E, 10));
|
|
1448
1488
|
}
|
|
1449
1489
|
}
|
|
1450
|
-
if (
|
|
1451
|
-
const
|
|
1452
|
-
if (
|
|
1490
|
+
if (P) {
|
|
1491
|
+
const D = m + 1;
|
|
1492
|
+
if (D < r)
|
|
1453
1493
|
throw new Error(
|
|
1454
|
-
`[MirageEngine] Traveler layer (${
|
|
1494
|
+
`[MirageEngine] Traveler layer (${m}) cannot be smaller than inherited capture layer (${r - 1}).`
|
|
1455
1495
|
);
|
|
1456
|
-
r = Math.min(
|
|
1496
|
+
r = Math.min(D, _.MAX_LAYERS + 1);
|
|
1457
1497
|
}
|
|
1458
1498
|
}
|
|
1459
|
-
const
|
|
1460
|
-
let
|
|
1461
|
-
|
|
1462
|
-
const
|
|
1463
|
-
if (
|
|
1499
|
+
const L = a.dataset[Ve.KEY];
|
|
1500
|
+
let M;
|
|
1501
|
+
L && (M = JSON.parse(L));
|
|
1502
|
+
const S = a.getBoundingClientRect(), x = window.getComputedStyle(a);
|
|
1503
|
+
if (S.width === 0 || S.height === 0 || x.display === "none")
|
|
1464
1504
|
return null;
|
|
1465
|
-
let
|
|
1466
|
-
|
|
1467
|
-
const w = parseInt(
|
|
1468
|
-
let
|
|
1505
|
+
let C = a.getAttribute("data-mid");
|
|
1506
|
+
C || (C = Math.random().toString(36).substring(2, 11), a.setAttribute("data-mid", C));
|
|
1507
|
+
const w = parseInt(x.zIndex), T = (isNaN(w) ? 0 : w) + i;
|
|
1508
|
+
let A;
|
|
1469
1509
|
if (a.tagName === "IMG")
|
|
1470
|
-
|
|
1510
|
+
A = a.src;
|
|
1471
1511
|
else if (a.tagName.toLowerCase() === "svg") {
|
|
1472
|
-
const
|
|
1473
|
-
const
|
|
1474
|
-
|
|
1475
|
-
const
|
|
1476
|
-
|
|
1477
|
-
const
|
|
1478
|
-
|
|
1479
|
-
const
|
|
1480
|
-
|
|
1481
|
-
for (let
|
|
1482
|
-
|
|
1512
|
+
const m = a.cloneNode(!0), R = v == null ? void 0 : v.color, O = v == null ? void 0 : v.fill, V = v == null ? void 0 : v.stroke, k = v == null ? void 0 : v.opacity, P = (E, ee) => {
|
|
1513
|
+
const Y = window.getComputedStyle(E), ae = ee, Be = Y.fill === Y.color, Oe = Y.stroke === Y.color, fe = O || (Be ? R : void 0) || Y.fill;
|
|
1514
|
+
fe && fe !== "none" && (ae.style.fill = fe);
|
|
1515
|
+
const ge = V || (Oe ? R : void 0) || Y.stroke;
|
|
1516
|
+
ge && ge !== "none" && (ae.style.stroke = ge), Y.strokeWidth && Y.strokeWidth !== "0px" && (ae.style.strokeWidth = Y.strokeWidth);
|
|
1517
|
+
const be = R || Y.color;
|
|
1518
|
+
be && (ae.style.color = be);
|
|
1519
|
+
const pe = k || Y.opacity;
|
|
1520
|
+
pe && pe !== "1" && (ae.style.opacity = pe);
|
|
1521
|
+
for (let he = 0; he < E.children.length; he++)
|
|
1522
|
+
P(E.children[he], ee.children[he]);
|
|
1483
1523
|
};
|
|
1484
|
-
|
|
1485
|
-
const
|
|
1486
|
-
|
|
1487
|
-
let
|
|
1488
|
-
|
|
1524
|
+
P(a, m);
|
|
1525
|
+
const z = a.getBoundingClientRect(), j = window.devicePixelRatio * c;
|
|
1526
|
+
m.hasAttribute("viewBox") || m.setAttribute("viewBox", `0 0 ${z.width} ${z.height}`), m.setAttribute("width", (z.width * j).toString()), m.setAttribute("height", (z.height * j).toString());
|
|
1527
|
+
let D = new XMLSerializer().serializeToString(m);
|
|
1528
|
+
D.includes("xmlns=") || (D = D.replace(
|
|
1489
1529
|
"<svg",
|
|
1490
1530
|
'<svg xmlns="http://www.w3.org/2000/svg"'
|
|
1491
|
-
)),
|
|
1492
|
-
} else if (
|
|
1493
|
-
const
|
|
1494
|
-
|
|
1495
|
-
}
|
|
1496
|
-
const
|
|
1497
|
-
backgroundColor:
|
|
1498
|
-
backgroundImage:
|
|
1499
|
-
opacity: a.dataset[
|
|
1500
|
-
zIndex:
|
|
1501
|
-
borderRadius:
|
|
1502
|
-
borderColor:
|
|
1503
|
-
borderWidth:
|
|
1504
|
-
imageSrc:
|
|
1531
|
+
)), A = `data:image/svg+xml;utf8,${encodeURIComponent(D)}`;
|
|
1532
|
+
} else if (x.backgroundImage && x.backgroundImage !== "none") {
|
|
1533
|
+
const m = x.backgroundImage.match(/url\(['"]?(.*?)['"]?\)/);
|
|
1534
|
+
m && (A = m[1]);
|
|
1535
|
+
}
|
|
1536
|
+
const I = {
|
|
1537
|
+
backgroundColor: x.backgroundColor,
|
|
1538
|
+
backgroundImage: x.backgroundImage,
|
|
1539
|
+
opacity: a.dataset[K.KEY] === K.VALUES.HIDE ? 1 : parseFloat(x.opacity),
|
|
1540
|
+
zIndex: T,
|
|
1541
|
+
borderRadius: x.borderRadius,
|
|
1542
|
+
borderColor: x.borderColor,
|
|
1543
|
+
borderWidth: x.borderWidth,
|
|
1544
|
+
imageSrc: A,
|
|
1505
1545
|
isTraveler: g
|
|
1506
|
-
},
|
|
1507
|
-
let
|
|
1508
|
-
const
|
|
1509
|
-
return a.tagName.toLowerCase() !== "svg" && Array.from(a.childNodes).forEach((
|
|
1510
|
-
const
|
|
1511
|
-
|
|
1546
|
+
}, q = I;
|
|
1547
|
+
let ie, se;
|
|
1548
|
+
const X = [];
|
|
1549
|
+
return a.tagName.toLowerCase() !== "svg" && Array.from(a.childNodes).forEach((m) => {
|
|
1550
|
+
const R = m.nodeType === Node.TEXT_NODE ? h : d, O = Ue(
|
|
1551
|
+
m,
|
|
1512
1552
|
e,
|
|
1513
|
-
|
|
1553
|
+
R,
|
|
1514
1554
|
r,
|
|
1515
|
-
|
|
1555
|
+
T,
|
|
1516
1556
|
c,
|
|
1517
|
-
|
|
1518
|
-
|
|
1557
|
+
m.nodeType === Node.TEXT_NODE ? b : void 0,
|
|
1558
|
+
m.nodeType === Node.TEXT_NODE && Object.keys(v).length > 0 ? v : void 0
|
|
1519
1559
|
);
|
|
1520
|
-
|
|
1560
|
+
O && X.push(O);
|
|
1521
1561
|
}), {
|
|
1522
|
-
id:
|
|
1562
|
+
id: C,
|
|
1523
1563
|
type: "BOX",
|
|
1524
1564
|
element: a,
|
|
1525
1565
|
rect: {
|
|
1526
|
-
x:
|
|
1527
|
-
y:
|
|
1528
|
-
width:
|
|
1529
|
-
height:
|
|
1566
|
+
x: S.left + window.scrollX,
|
|
1567
|
+
y: S.top + window.scrollY,
|
|
1568
|
+
width: S.width,
|
|
1569
|
+
height: S.height
|
|
1530
1570
|
},
|
|
1531
|
-
styles:
|
|
1532
|
-
textContent:
|
|
1533
|
-
textStyles:
|
|
1571
|
+
styles: q,
|
|
1572
|
+
textContent: ie,
|
|
1573
|
+
textStyles: se,
|
|
1534
1574
|
dirtyMask: e,
|
|
1535
1575
|
visibility: h,
|
|
1536
1576
|
isTraveler: g,
|
|
1537
1577
|
captureLayer: r,
|
|
1538
|
-
nativeLayer:
|
|
1539
|
-
nativeStyles:
|
|
1540
|
-
backgroundColor: (
|
|
1541
|
-
backgroundImage: (
|
|
1542
|
-
opacity: (
|
|
1543
|
-
zIndex:
|
|
1544
|
-
borderRadius: (
|
|
1545
|
-
borderColor: (
|
|
1546
|
-
borderWidth: (
|
|
1547
|
-
isTraveler:
|
|
1548
|
-
transform:
|
|
1578
|
+
nativeLayer: b,
|
|
1579
|
+
nativeStyles: b !== void 0 ? xe(J({}, I), {
|
|
1580
|
+
backgroundColor: (N = v.backgroundColor) != null ? N : I.backgroundColor,
|
|
1581
|
+
backgroundImage: (Z = v.backgroundImage) != null ? Z : I.backgroundImage,
|
|
1582
|
+
opacity: (ne = v.opacity) != null ? ne : I.opacity,
|
|
1583
|
+
zIndex: v.zIndex !== void 0 ? v.zIndex + T : I.zIndex,
|
|
1584
|
+
borderRadius: (oe = v.borderRadius) != null ? oe : I.borderRadius,
|
|
1585
|
+
borderColor: (B = v.borderColor) != null ? B : I.borderColor,
|
|
1586
|
+
borderWidth: (F = v.borderWidth) != null ? F : I.borderWidth,
|
|
1587
|
+
isTraveler: I.isTraveler,
|
|
1588
|
+
transform: v.transform
|
|
1549
1589
|
}) : void 0,
|
|
1550
|
-
nativeRect:
|
|
1551
|
-
x:
|
|
1552
|
-
y:
|
|
1553
|
-
width:
|
|
1554
|
-
height:
|
|
1590
|
+
nativeRect: b !== void 0 ? {
|
|
1591
|
+
x: v.x !== void 0 ? parseFloat(v.x) : S.left + window.scrollX,
|
|
1592
|
+
y: v.y !== void 0 ? parseFloat(v.y) : S.top + window.scrollY,
|
|
1593
|
+
width: v.width !== void 0 ? parseFloat(v.width) : S.width,
|
|
1594
|
+
height: v.height !== void 0 ? parseFloat(v.height) : S.height
|
|
1555
1595
|
} : void 0,
|
|
1556
|
-
isFixed:
|
|
1557
|
-
children:
|
|
1558
|
-
shaderHooks:
|
|
1596
|
+
isFixed: x.position === "fixed",
|
|
1597
|
+
children: X,
|
|
1598
|
+
shaderHooks: M
|
|
1559
1599
|
};
|
|
1560
1600
|
}
|
|
1561
1601
|
function st(s, e) {
|
|
1562
1602
|
e.size !== 0 && e.forEach((t, r) => {
|
|
1563
1603
|
var c, n, o, a;
|
|
1564
1604
|
const i = s.get(r);
|
|
1565
|
-
!i || !i.userData.basePosition || (
|
|
1605
|
+
!i || !i.userData.basePosition || (H.forceUpdateUniforms(i.material, {
|
|
1566
1606
|
backgroundColor: t.backgroundColor,
|
|
1567
1607
|
backgroundImage: t.backgroundImage,
|
|
1568
1608
|
opacity: t.opacity,
|
|
1569
1609
|
borderRadius: (n = t.borderRadius) != null ? n : (c = i.userData.baseStyles) == null ? void 0 : c.borderRadius
|
|
1570
1610
|
// width and height are no longer updated here, they are updated in syncMeshesByDOM
|
|
1571
|
-
}), i.userData.nativeMesh &&
|
|
1611
|
+
}), i.userData.nativeMesh && H.forceUpdateUniforms(i.userData.nativeMesh.material, {
|
|
1572
1612
|
backgroundColor: t.backgroundColor,
|
|
1573
1613
|
backgroundImage: t.backgroundImage,
|
|
1574
1614
|
opacity: t.opacity,
|
|
@@ -1583,14 +1623,14 @@ class nt {
|
|
|
1583
1623
|
u(this, "registry");
|
|
1584
1624
|
u(this, "isTravelEnabled", !1);
|
|
1585
1625
|
u(this, "tracker");
|
|
1586
|
-
this.target = e, this.renderer = t, this.registry = r, this.tracker = new
|
|
1626
|
+
this.target = e, this.renderer = t, this.registry = r, this.tracker = new De(e, {
|
|
1587
1627
|
resizeDebounce: i.resizeDebounce
|
|
1588
1628
|
}), this.tracker.onLayoutChange.add((c, n) => {
|
|
1589
|
-
document.querySelector(`[${
|
|
1590
|
-
const a =
|
|
1629
|
+
document.querySelector(`[${_.NAME}~='${_.VALUES.TRAVELER}']`) !== null && !this.isTravelEnabled && (this.isTravelEnabled = !0, this.renderer.createRenderTarget());
|
|
1630
|
+
const a = Ue(
|
|
1591
1631
|
this.target,
|
|
1592
1632
|
c,
|
|
1593
|
-
|
|
1633
|
+
$,
|
|
1594
1634
|
1,
|
|
1595
1635
|
0,
|
|
1596
1636
|
this.renderer.qualityFactor
|
|
@@ -1644,7 +1684,7 @@ class at {
|
|
|
1644
1684
|
if (this.target = e, this.registry = new ot(), !document.getElementById("mirage-engine-styles")) {
|
|
1645
1685
|
const o = document.createElement("style");
|
|
1646
1686
|
o.id = "mirage-engine-styles", o.textContent = `
|
|
1647
|
-
[${
|
|
1687
|
+
[${K.NAME}="${K.VALUES.HIDE}"] {
|
|
1648
1688
|
opacity: 0 !important;
|
|
1649
1689
|
}
|
|
1650
1690
|
`, document.head.appendChild(o);
|
|
@@ -1709,7 +1749,7 @@ class ct {
|
|
|
1709
1749
|
u(this, "midLayer", null);
|
|
1710
1750
|
u(this, "frontLayer", null);
|
|
1711
1751
|
u(this, "tracker", null);
|
|
1712
|
-
this.frontSelector = e.frontSelector || ".front", this.midLayerElement = e.midLayerElement || null, this.items = [], this.isInitialized = !1, this.tracker = new
|
|
1752
|
+
this.frontSelector = e.frontSelector || ".front", this.midLayerElement = e.midLayerElement || null, this.items = [], this.isInitialized = !1, this.tracker = new De(document.body, e.trackerConfig || { resizeDebounce: !0 });
|
|
1713
1753
|
}
|
|
1714
1754
|
init() {
|
|
1715
1755
|
var e;
|
|
@@ -1780,7 +1820,7 @@ class ht {
|
|
|
1780
1820
|
if (this._engine = new at(e, t), t.sandwich !== !1) {
|
|
1781
1821
|
const r = typeof t.sandwich == "object" ? t.sandwich : {};
|
|
1782
1822
|
this._sandwich = new ct({
|
|
1783
|
-
frontSelector: r.frontSelector || `[${
|
|
1823
|
+
frontSelector: r.frontSelector || `[${Se.NAME}='${Se.VALUES.FRONT}']`
|
|
1784
1824
|
}), this._sandwich.useTracker(this._engine.getTracker());
|
|
1785
1825
|
}
|
|
1786
1826
|
}
|