@mirage-engine/core 0.1.0 → 0.2.0
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 +11 -0
- package/dist/mirage-engine.js +422 -325
- package/dist/mirage-engine.umd.js +36 -33
- package/dist/src/core/Syncer.d.ts +7 -3
- package/dist/src/renderer/Renderer.d.ts +6 -1
- package/dist/src/types/common.d.ts +1 -0
- package/dist/src/types/config.d.ts +8 -2
- package/dist/src/types/flags.d.ts +4 -4
- package/package.json +2 -2
- package/src/core/Engine.ts +1 -1
- package/src/core/Syncer.ts +71 -8
- package/src/dom/Extractor.ts +26 -11
- package/src/renderer/Renderer.ts +129 -23
- package/src/types/common.ts +4 -4
- package/src/types/config.ts +9 -3
- package/src/types/flags.ts +4 -5
package/dist/mirage-engine.js
CHANGED
|
@@ -1,61 +1,63 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var A = Object.defineProperty;
|
|
2
|
+
var P = (i, e, t) => e in i ? A(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
3
|
+
var h = (i, e, t) => (P(i, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
4
|
import * as d from "three";
|
|
5
|
-
const
|
|
5
|
+
const E = 0, O = 1, D = 2, k = 4, z = 8, N = 16, x = 1, R = 2, Z = 0, q = [
|
|
6
6
|
"include-tree",
|
|
7
7
|
"exclude-tree",
|
|
8
8
|
"include-self",
|
|
9
9
|
"exclude-self",
|
|
10
10
|
"end"
|
|
11
11
|
];
|
|
12
|
-
function
|
|
13
|
-
const
|
|
12
|
+
function Y(i, e, t) {
|
|
13
|
+
const r = e.split(`
|
|
14
14
|
`), s = [];
|
|
15
|
-
return
|
|
16
|
-
const
|
|
17
|
-
let o =
|
|
18
|
-
for (let
|
|
19
|
-
const c =
|
|
20
|
-
|
|
15
|
+
return r.forEach((a) => {
|
|
16
|
+
const n = a.split(" ");
|
|
17
|
+
let o = n[0];
|
|
18
|
+
for (let l = 1; l < n.length; l++) {
|
|
19
|
+
const c = n[l];
|
|
20
|
+
i.measureText(o + " " + c).width < t ? o += " " + c : (s.push(o), o = c);
|
|
21
21
|
}
|
|
22
22
|
s.push(o);
|
|
23
23
|
}), s;
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
const
|
|
27
|
-
if (!
|
|
25
|
+
function I(i, e, t, r, s = 2) {
|
|
26
|
+
const a = document.createElement("canvas"), n = a.getContext("2d");
|
|
27
|
+
if (!n)
|
|
28
28
|
throw new Error("[Mirage] Failed to create canvas context");
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
const c =
|
|
32
|
-
c.forEach((
|
|
33
|
-
const
|
|
34
|
-
let
|
|
35
|
-
|
|
29
|
+
const l = (window.devicePixelRatio || 1) * s;
|
|
30
|
+
a.width = t * l, a.height = r * l, n.scale(l, l), n.font = e.font, n.fillStyle = e.color, n.textBaseline = "top", n.globalAlpha = 1;
|
|
31
|
+
const c = Y(n, i, t), g = e.lineHeight;
|
|
32
|
+
c.forEach((p, m) => {
|
|
33
|
+
const T = m * g + 2;
|
|
34
|
+
let v = 0;
|
|
35
|
+
e.textAlign === "center" ? v = t / 2 : e.textAlign === "right" && (v = t), n.textAlign = e.textAlign, n.fillText(p, v, T);
|
|
36
36
|
});
|
|
37
|
-
const
|
|
38
|
-
return
|
|
37
|
+
const u = new d.CanvasTexture(a);
|
|
38
|
+
return u.colorSpace = d.SRGBColorSpace, u.minFilter = d.LinearFilter, u.magFilter = d.LinearFilter, u.needsUpdate = !0, u;
|
|
39
39
|
}
|
|
40
|
-
function
|
|
41
|
-
return typeof
|
|
40
|
+
function w(i) {
|
|
41
|
+
return typeof i == "number" ? i : parseFloat(i) || 0;
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
var o,
|
|
45
|
-
if (!
|
|
46
|
-
|
|
43
|
+
function _(i, e) {
|
|
44
|
+
var o, l, c, g;
|
|
45
|
+
if (!e) {
|
|
46
|
+
i.set(0, 0, 0, 0);
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
|
-
const
|
|
50
|
-
|
|
49
|
+
const t = e.split("/")[0].trim().split(/\s+/), r = w(t[0]), s = w((o = t[1]) != null ? o : t[0]), a = w((l = t[2]) != null ? l : t[0]), n = w((g = (c = t[3]) != null ? c : t[1]) != null ? g : t[0]);
|
|
50
|
+
i.set(r, s, a, n);
|
|
51
51
|
}
|
|
52
|
-
const
|
|
52
|
+
const U = (
|
|
53
53
|
/* glsl */
|
|
54
54
|
`
|
|
55
55
|
varying vec2 vUv;
|
|
56
|
+
varying vec4 vScreenPos;
|
|
56
57
|
void main() {
|
|
57
58
|
vUv = uv;
|
|
58
59
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
60
|
+
vScreenPos = gl_Position;
|
|
59
61
|
}
|
|
60
62
|
`
|
|
61
63
|
), W = (
|
|
@@ -65,7 +67,7 @@ const Y = (
|
|
|
65
67
|
varying vec2 vUv;
|
|
66
68
|
|
|
67
69
|
uniform vec2 uSize;
|
|
68
|
-
uniform vec4
|
|
70
|
+
uniform vec4 uBorderRadius;
|
|
69
71
|
uniform float uBorderWidth;
|
|
70
72
|
uniform vec3 uBgColor;
|
|
71
73
|
uniform vec3 uBorderColor;
|
|
@@ -73,121 +75,132 @@ const Y = (
|
|
|
73
75
|
uniform float uBgOpacity;
|
|
74
76
|
uniform float uBorderOpacity;
|
|
75
77
|
|
|
76
|
-
|
|
78
|
+
#INJECT_DECLARATIONS
|
|
79
|
+
|
|
77
80
|
float sdRoundedBox(vec2 p, vec2 b, float r) {
|
|
78
81
|
vec2 q = abs(p) - b + r;
|
|
79
|
-
|
|
82
|
+
|
|
80
83
|
return min(max(q.x, q.y), 0.0) + length(max(q, 0.0)) - r;
|
|
81
84
|
}
|
|
82
85
|
|
|
83
86
|
void main() {
|
|
84
|
-
// uVu: (0.0, 0.0) ~ (1.0, 1.0) / center: (0.5, 0.5)
|
|
85
|
-
// p: (-1.0, -1.0) ~ (1.0, 1.0) / center: (0.0, 0.0)
|
|
86
87
|
vec2 p = (vUv - 0.5) * uSize;
|
|
87
88
|
vec2 halfSize = uSize * 0.5;
|
|
89
|
+
|
|
90
|
+
#INJECT_UV_MODIFIER
|
|
88
91
|
|
|
89
|
-
//
|
|
90
|
-
|
|
92
|
+
// color decision pipeline
|
|
93
|
+
vec4 baseColor = vec4(uBgColor, uBgOpacity);
|
|
94
|
+
|
|
95
|
+
#INJECT_BASE_COLOR
|
|
96
|
+
|
|
97
|
+
// sdf shape pipeline
|
|
98
|
+
vec2 xRadii = mix(uBorderRadius.xw, uBorderRadius.yz, step(0.0, p.x));
|
|
91
99
|
float r = mix(xRadii.y, xRadii.x, step(0.0, p.y));
|
|
92
100
|
float d = sdRoundedBox(p, halfSize, r);
|
|
93
101
|
|
|
94
|
-
// 1px blur for anti-aliasing
|
|
95
102
|
float aa = 1.0;
|
|
96
|
-
|
|
97
|
-
// x == 0~aa -> 1
|
|
98
|
-
// x < 0 -> 0
|
|
99
|
-
// x > aa -> 1
|
|
100
103
|
float bgMask = 1.0 - smoothstep(0.0, aa, d);
|
|
101
104
|
|
|
102
|
-
// v valley
|
|
103
|
-
// 10px -> 5
|
|
104
105
|
float halfBorder = uBorderWidth * 0.5;
|
|
105
|
-
// 10px :
|
|
106
|
-
// 0 -> 0
|
|
107
|
-
// -10 -> 0
|
|
108
|
-
// -5 -> -5
|
|
109
106
|
float borderD = abs(d + halfBorder) - halfBorder;
|
|
110
|
-
// ^ border 내부는 음수/외부는 양수
|
|
111
|
-
|
|
112
|
-
// [!] 내부가 음수인 곳에서 시작점이 0이면 내부는 안티 얼리어싱 되지 않음.
|
|
113
|
-
// 1에서 빼든 그대로든 상관없이 경계선 밖 1px
|
|
114
|
-
|
|
115
|
-
// 최종 alpha를 위해 border 부분에 해당하는 픽셀 만 1로 반환.
|
|
116
107
|
float borderAlpha = (1.0 - smoothstep(0.0, aa, borderD)) * uBorderOpacity;
|
|
117
|
-
|
|
118
108
|
if (uBorderWidth <= 0.01) {
|
|
119
109
|
borderAlpha = 0.0;
|
|
120
110
|
}
|
|
121
111
|
|
|
112
|
+
// final blending (border + background)
|
|
122
113
|
float aFront = borderAlpha;
|
|
123
|
-
float aBack =
|
|
114
|
+
float aBack = baseColor.a;
|
|
124
115
|
float aOut = aFront + aBack * (1.0 - aFront);
|
|
125
116
|
|
|
126
117
|
float safeAlpha = max(aOut, 0.0001);
|
|
127
|
-
vec3 cOut = (uBorderColor * aFront +
|
|
118
|
+
vec3 cOut = (uBorderColor * aFront + baseColor.rgb * aBack * (1.0 - aFront)) / safeAlpha;
|
|
119
|
+
vec4 finalColor = vec4(cOut, aOut);
|
|
128
120
|
|
|
129
|
-
|
|
121
|
+
// final color control (Tint, Noise)
|
|
122
|
+
#INJECT_COLOR_MODIFIER
|
|
130
123
|
|
|
124
|
+
float finalOpacity = finalColor.a * bgMask * uOpacity;
|
|
131
125
|
if (finalOpacity < 0.001) discard;
|
|
132
126
|
|
|
133
|
-
gl_FragColor = vec4(
|
|
127
|
+
gl_FragColor = vec4(finalColor.rgb, finalOpacity);
|
|
134
128
|
|
|
135
129
|
#include <colorspace_fragment>
|
|
136
130
|
}
|
|
137
131
|
`
|
|
138
132
|
);
|
|
139
|
-
function
|
|
140
|
-
if (!
|
|
133
|
+
function S(i) {
|
|
134
|
+
if (!i || i === "transparent")
|
|
141
135
|
return { color: new d.Color(16777215), alpha: 0 };
|
|
142
|
-
const
|
|
136
|
+
const e = i.match(
|
|
143
137
|
/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/
|
|
144
138
|
);
|
|
145
|
-
if (
|
|
146
|
-
const
|
|
147
|
-
return { color: new d.Color(`rgb(${
|
|
139
|
+
if (e) {
|
|
140
|
+
const t = parseInt(e[1], 10), r = parseInt(e[2], 10), s = parseInt(e[3], 10), a = e[4] !== void 0 ? parseFloat(e[4]) : 1;
|
|
141
|
+
return { color: new d.Color(`rgb(${t}, ${r}, ${s})`), alpha: a };
|
|
148
142
|
}
|
|
149
|
-
return { color: new d.Color(
|
|
143
|
+
return { color: new d.Color(i), alpha: 1 };
|
|
150
144
|
}
|
|
151
|
-
function H(
|
|
152
|
-
var
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
145
|
+
function H(i, e, t, r = null, s) {
|
|
146
|
+
var v;
|
|
147
|
+
const a = r !== null, n = a ? (
|
|
148
|
+
/* glsl */
|
|
149
|
+
`
|
|
150
|
+
uniform sampler2D uTexture;
|
|
151
|
+
varying vec4 vScreenPos;
|
|
152
|
+
`
|
|
153
|
+
) : "", o = a ? (
|
|
154
|
+
/* glsl */
|
|
155
|
+
`
|
|
156
|
+
vec2 screenUv = (vScreenPos.xy / vScreenPos.w) * 0.5 + 0.5;
|
|
157
|
+
vec2 resultUv = screenUv;
|
|
158
|
+
${(s == null ? void 0 : s.uvModifier) || ""}
|
|
159
|
+
`
|
|
160
|
+
) : "", l = a ? (
|
|
161
|
+
/* glsl */
|
|
162
|
+
`
|
|
163
|
+
baseColor = texture2D(uTexture, resultUv);
|
|
164
|
+
`
|
|
165
|
+
) : "", c = (s == null ? void 0 : s.colorModifier) || "", g = W.replace("#INJECT_DECLARATIONS", n).replace("#INJECT_UV_MODIFIER", o).replace("#INJECT_BASE_COLOR", l).replace("#INJECT_COLOR_MODIFIER", c), u = S(i.backgroundColor), p = S(i.borderColor), m = {
|
|
166
|
+
uSize: { value: new d.Vector2(e, t) },
|
|
167
|
+
uBorderRadius: { value: new d.Vector4(0, 0, 0, 0) },
|
|
168
|
+
uBorderWidth: { value: w(i.borderWidth) },
|
|
169
|
+
uBgColor: { value: u.color },
|
|
170
|
+
uBorderColor: { value: p.color },
|
|
171
|
+
uOpacity: { value: (v = i.opacity) != null ? v : 1 },
|
|
172
|
+
uBgOpacity: { value: u.alpha },
|
|
173
|
+
uBorderOpacity: { value: p.alpha },
|
|
174
|
+
uTexture: { value: null }
|
|
162
175
|
};
|
|
163
|
-
return
|
|
164
|
-
uniforms:
|
|
165
|
-
vertexShader:
|
|
166
|
-
fragmentShader:
|
|
176
|
+
return _(m.uBorderRadius.value, i.borderRadius), a && (m.uTexture.value = r), new d.ShaderMaterial({
|
|
177
|
+
uniforms: m,
|
|
178
|
+
vertexShader: U,
|
|
179
|
+
fragmentShader: g,
|
|
167
180
|
transparent: !0,
|
|
168
181
|
side: d.FrontSide
|
|
169
182
|
// for better performance
|
|
170
183
|
});
|
|
171
184
|
}
|
|
172
|
-
function
|
|
173
|
-
var
|
|
174
|
-
const
|
|
175
|
-
|
|
185
|
+
function $(i, e, t, r, s) {
|
|
186
|
+
var o;
|
|
187
|
+
const a = S(e.backgroundColor), n = S(e.borderColor);
|
|
188
|
+
i.uniforms.uSize.value.set(t, r), _(i.uniforms.uBorderRadius.value, e.borderRadius), i.uniforms.uBorderWidth.value = w(e.borderWidth), i.uniforms.uBgColor.value.copy(a.color), i.uniforms.uBorderColor.value.copy(n.color), i.uniforms.uOpacity.value = (o = e.opacity) != null ? o : 1, i.uniforms.uBgOpacity.value = a.alpha, i.uniforms.uBorderOpacity.value = n.alpha, i.uniforms.uTexture && s !== void 0 && (i.uniforms.uTexture.value = s);
|
|
176
189
|
}
|
|
177
|
-
const
|
|
178
|
-
create(
|
|
179
|
-
if (
|
|
180
|
-
return H(
|
|
181
|
-
if (
|
|
182
|
-
const
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
190
|
+
const F = {
|
|
191
|
+
create(i, e, t, r, s, a = 2, n = null) {
|
|
192
|
+
if (i === "BOX")
|
|
193
|
+
return H(e, r, s, n);
|
|
194
|
+
if (i === "TEXT") {
|
|
195
|
+
const o = I(
|
|
196
|
+
t || "",
|
|
197
|
+
e,
|
|
198
|
+
r,
|
|
186
199
|
s,
|
|
187
|
-
|
|
200
|
+
a
|
|
188
201
|
);
|
|
189
202
|
return new d.MeshBasicMaterial({
|
|
190
|
-
map:
|
|
203
|
+
map: o,
|
|
191
204
|
transparent: !0,
|
|
192
205
|
side: d.FrontSide,
|
|
193
206
|
color: 16777215
|
|
@@ -195,74 +208,90 @@ const E = {
|
|
|
195
208
|
}
|
|
196
209
|
return new d.MeshBasicMaterial({ visible: !1 });
|
|
197
210
|
},
|
|
198
|
-
update(
|
|
199
|
-
if (
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
211
|
+
update(i, e, t, r, s, a, n = 2, o) {
|
|
212
|
+
if (e === "BOX")
|
|
213
|
+
$(
|
|
214
|
+
i,
|
|
215
|
+
t,
|
|
203
216
|
s,
|
|
204
|
-
|
|
217
|
+
a,
|
|
218
|
+
o
|
|
205
219
|
);
|
|
206
|
-
else if (
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
-
|
|
220
|
+
else if (e === "TEXT") {
|
|
221
|
+
const l = i;
|
|
222
|
+
l.map && l.map.dispose();
|
|
223
|
+
const c = I(
|
|
224
|
+
r || "",
|
|
225
|
+
t,
|
|
212
226
|
s,
|
|
213
|
-
|
|
214
|
-
|
|
227
|
+
a,
|
|
228
|
+
n
|
|
215
229
|
);
|
|
216
|
-
|
|
230
|
+
l.map = c, l.needsUpdate = !0;
|
|
217
231
|
}
|
|
218
232
|
}
|
|
219
233
|
};
|
|
220
|
-
class
|
|
221
|
-
constructor(
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
234
|
+
class G {
|
|
235
|
+
constructor(e, t, r) {
|
|
236
|
+
h(this, "canvas");
|
|
237
|
+
h(this, "scene");
|
|
238
|
+
h(this, "camera");
|
|
239
|
+
h(this, "renderer");
|
|
240
|
+
h(this, "renderTarget", null);
|
|
241
|
+
h(this, "renderOrder", 0);
|
|
242
|
+
h(this, "qualityFactor", 2);
|
|
243
|
+
h(this, "mode", "overlay");
|
|
244
|
+
h(this, "target");
|
|
245
|
+
h(this, "mountContainer");
|
|
246
|
+
h(this, "targetRect");
|
|
247
|
+
h(this, "meshMap", /* @__PURE__ */ new Map());
|
|
248
|
+
var n, o;
|
|
249
|
+
this.target = e, this.mountContainer = r, this.mode = (n = t.mode) != null ? n : "overlay", this.canvas = document.createElement("canvas"), this.scene = new d.Scene(), this.targetRect = this.target.getBoundingClientRect();
|
|
250
|
+
const s = this.targetRect.width, a = this.targetRect.height;
|
|
236
251
|
this.camera = new d.OrthographicCamera(
|
|
237
252
|
s / -2,
|
|
238
253
|
s / 2,
|
|
239
|
-
|
|
240
|
-
|
|
254
|
+
a / 2,
|
|
255
|
+
a / -2,
|
|
241
256
|
1,
|
|
242
257
|
1e3
|
|
243
|
-
), this.camera.position.z = 100, this.renderer = new d.WebGLRenderer({
|
|
258
|
+
), this.camera.position.z = 100, this.camera.layers.set(0), this.renderer = new d.WebGLRenderer({
|
|
244
259
|
canvas: this.canvas,
|
|
245
260
|
alpha: !0,
|
|
246
261
|
antialias: !0
|
|
247
262
|
// [new]
|
|
248
263
|
// premultipliedAlpha: true
|
|
249
|
-
}), this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.setSize(s,
|
|
264
|
+
}), this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.setSize(s, a), this.applyTextQuality((o = t.quality) != null ? o : "medium");
|
|
265
|
+
}
|
|
266
|
+
createRenderTarget() {
|
|
267
|
+
this.renderTarget = new d.WebGLRenderTarget(
|
|
268
|
+
this.targetRect.width * this.qualityFactor,
|
|
269
|
+
this.targetRect.height * this.qualityFactor,
|
|
270
|
+
{
|
|
271
|
+
minFilter: d.LinearFilter,
|
|
272
|
+
magFilter: d.LinearFilter,
|
|
273
|
+
format: d.RGBAFormat,
|
|
274
|
+
stencilBuffer: !1,
|
|
275
|
+
depthBuffer: !0,
|
|
276
|
+
samples: 4
|
|
277
|
+
}
|
|
278
|
+
);
|
|
250
279
|
}
|
|
251
|
-
applyTextQuality(
|
|
252
|
-
if (typeof
|
|
253
|
-
this.
|
|
280
|
+
applyTextQuality(e) {
|
|
281
|
+
if (typeof e == "number") {
|
|
282
|
+
this.qualityFactor = Math.max(0.1, e);
|
|
254
283
|
return;
|
|
255
284
|
}
|
|
256
|
-
switch (
|
|
285
|
+
switch (e) {
|
|
257
286
|
case "low":
|
|
258
|
-
this.
|
|
287
|
+
this.qualityFactor = 1;
|
|
259
288
|
break;
|
|
260
289
|
case "high":
|
|
261
|
-
this.
|
|
290
|
+
this.qualityFactor = 4;
|
|
262
291
|
break;
|
|
263
292
|
case "medium":
|
|
264
293
|
default:
|
|
265
|
-
this.
|
|
294
|
+
this.qualityFactor = 2;
|
|
266
295
|
break;
|
|
267
296
|
}
|
|
268
297
|
}
|
|
@@ -275,239 +304,300 @@ class $ {
|
|
|
275
304
|
dispose() {
|
|
276
305
|
this.renderer.dispose(), this.canvas.remove();
|
|
277
306
|
}
|
|
278
|
-
setSize(
|
|
279
|
-
this.renderer.setSize(
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
this.
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
307
|
+
setSize(e, t) {
|
|
308
|
+
this.renderer.setSize(e, t), this.renderTarget && this.renderTarget.setSize(
|
|
309
|
+
e * this.qualityFactor,
|
|
310
|
+
t * this.qualityFactor
|
|
311
|
+
), this.camera.left = e / -2, this.camera.right = e / 2, this.camera.top = t / 2, this.camera.bottom = t / -2, this.camera.updateProjectionMatrix();
|
|
312
|
+
}
|
|
313
|
+
syncScene(e) {
|
|
314
|
+
const t = this.target.getBoundingClientRect(), r = Math.abs(t.width - this.targetRect.width) > 0.1 || Math.abs(t.height - this.targetRect.height) > 0.1, s = this.mode === "overlay" && (Math.abs(t.top - this.targetRect.top) > 0.1 || Math.abs(t.left - this.targetRect.left) > 0.1);
|
|
315
|
+
r ? (this.targetRect = t, this.setSize(this.targetRect.width, this.targetRect.height), this.updateCanvasLayout()) : s ? (this.targetRect = t, this.updateCanvasLayout()) : this.targetRect = t, this.renderOrder = 0;
|
|
316
|
+
const a = /* @__PURE__ */ new Set();
|
|
317
|
+
this.reconcileNode(e, a);
|
|
318
|
+
for (const [n, o] of this.meshMap.entries())
|
|
319
|
+
a.has(n) || (this.scene.remove(o), o.geometry.dispose(), o.material instanceof d.Material && o.material.dispose(), this.meshMap.delete(n));
|
|
320
|
+
}
|
|
321
|
+
reconcileNode(e, t) {
|
|
322
|
+
var s;
|
|
323
|
+
t.add(e.element);
|
|
324
|
+
let r = this.meshMap.get(e.element);
|
|
325
|
+
if (!r) {
|
|
326
|
+
const a = new d.PlaneGeometry(1, 1);
|
|
327
|
+
let n;
|
|
328
|
+
n = F.create(
|
|
294
329
|
"BOX",
|
|
295
|
-
|
|
330
|
+
e.styles,
|
|
296
331
|
"",
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
332
|
+
e.rect.width,
|
|
333
|
+
e.rect.height,
|
|
334
|
+
this.qualityFactor,
|
|
335
|
+
e.isTraveler ? (s = this.renderTarget) == null ? void 0 : s.texture : void 0
|
|
336
|
+
), r = new d.Mesh(a, n), e.type === "TEXT" && (r.name = "BG_MESH"), this.scene.add(r), this.meshMap.set(e.element, r);
|
|
301
337
|
}
|
|
302
|
-
if (
|
|
303
|
-
for (const
|
|
304
|
-
this.reconcileNode(
|
|
338
|
+
if (r.userData.domRect = e.rect, this.updateMeshProperties(r, e), this.updateMeshLayers(r, e), e.isTraveler && r.layers.enable(28), e.type === "BOX")
|
|
339
|
+
for (const a of e.children)
|
|
340
|
+
this.reconcileNode(a, t);
|
|
305
341
|
else
|
|
306
|
-
|
|
342
|
+
e.type === "TEXT" && this.reconcileTextChild(r, e);
|
|
307
343
|
}
|
|
308
|
-
reconcileTextChild(
|
|
309
|
-
var o,
|
|
310
|
-
let
|
|
344
|
+
reconcileTextChild(e, t) {
|
|
345
|
+
var o, l;
|
|
346
|
+
let r = e.children.find(
|
|
311
347
|
(c) => c.name === "TEXT_CHILD"
|
|
312
348
|
);
|
|
313
|
-
const s = JSON.stringify(
|
|
314
|
-
if (!
|
|
315
|
-
|
|
316
|
-
const c =
|
|
349
|
+
const s = JSON.stringify(t.textStyles), a = (o = r == null ? void 0 : r.userData) == null ? void 0 : o.styleHash;
|
|
350
|
+
if (!r || t.dirtyMask & N || s !== a) {
|
|
351
|
+
r && ((l = r.material.map) == null || l.dispose(), r.geometry.dispose(), e.remove(r));
|
|
352
|
+
const c = F.create(
|
|
317
353
|
"TEXT",
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
this.
|
|
323
|
-
),
|
|
324
|
-
|
|
354
|
+
t.textStyles,
|
|
355
|
+
t.textContent || "",
|
|
356
|
+
t.rect.width,
|
|
357
|
+
t.rect.height,
|
|
358
|
+
this.qualityFactor
|
|
359
|
+
), g = new d.PlaneGeometry(1, 1);
|
|
360
|
+
r = new d.Mesh(g, c), r.name = "TEXT_CHILD", r.userData = { styleHash: s }, this.updateMeshLayers(r, t), r.position.z = 5e-3, e.add(r);
|
|
325
361
|
}
|
|
326
|
-
if (
|
|
327
|
-
const c =
|
|
328
|
-
|
|
362
|
+
if (r) {
|
|
363
|
+
const c = e.userData.domRect, g = c.x + c.width / 2, u = c.y + c.height / 2, p = t.rect.x + t.rect.width / 2, m = t.rect.y + t.rect.height / 2, T = p - g, v = -(m - u);
|
|
364
|
+
r.position.set(T, v, 5e-3);
|
|
329
365
|
}
|
|
330
366
|
}
|
|
331
|
-
updateMeshProperties(
|
|
332
|
-
|
|
333
|
-
t.
|
|
334
|
-
|
|
367
|
+
updateMeshProperties(e, t) {
|
|
368
|
+
var m;
|
|
369
|
+
const { rect: r, styles: s } = t, a = this.renderer.getPixelRatio(), n = this.renderer.domElement.width / a, o = this.renderer.domElement.height / a;
|
|
370
|
+
e.scale.set(r.width, r.height, 1);
|
|
371
|
+
const l = 1e-3;
|
|
335
372
|
this.renderOrder++;
|
|
336
|
-
const c = this.targetRect.left + window.scrollX,
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
-
|
|
340
|
-
s.zIndex + this.renderOrder *
|
|
341
|
-
),
|
|
342
|
-
|
|
373
|
+
const c = this.targetRect.left + window.scrollX, g = this.targetRect.top + window.scrollY, u = r.x - c, p = r.y - g;
|
|
374
|
+
e.position.set(
|
|
375
|
+
u - n / 2 + r.width / 2,
|
|
376
|
+
-p + o / 2 - r.height / 2,
|
|
377
|
+
s.zIndex + this.renderOrder * l
|
|
378
|
+
), F.update(
|
|
379
|
+
e.material,
|
|
343
380
|
"BOX",
|
|
344
|
-
|
|
381
|
+
t.styles,
|
|
345
382
|
"",
|
|
346
|
-
|
|
347
|
-
|
|
383
|
+
t.rect.width,
|
|
384
|
+
t.rect.height,
|
|
385
|
+
this.qualityFactor,
|
|
386
|
+
t.isTraveler ? (m = this.renderTarget) == null ? void 0 : m.texture : void 0
|
|
348
387
|
);
|
|
349
388
|
}
|
|
389
|
+
updateMeshLayers(e, t) {
|
|
390
|
+
const r = (1 - (t.visibility & x)) * 30;
|
|
391
|
+
e.layers.set(r), t.visibility === (x | R) && e.layers.enable(29);
|
|
392
|
+
}
|
|
393
|
+
captureRenderTarget() {
|
|
394
|
+
const e = [];
|
|
395
|
+
for (const l of this.meshMap.values())
|
|
396
|
+
l.layers.mask & 1 << 28 && e.push(l);
|
|
397
|
+
if (e.length === 0)
|
|
398
|
+
return;
|
|
399
|
+
const t = new d.Color(), r = this.renderer.getClearAlpha();
|
|
400
|
+
this.renderer.getClearColor(t), this.renderer.setClearColor(0, 0), this.renderer.setRenderTarget(this.renderTarget), this.renderer.clear(), this.renderer.autoClear = !1, this.renderer.setScissorTest(!0), this.camera.layers.set(29);
|
|
401
|
+
const s = new d.Vector3(), a = this.targetRect.width, n = this.targetRect.height, o = this.renderer.getPixelRatio();
|
|
402
|
+
for (const l of e) {
|
|
403
|
+
s.setFromMatrixPosition(l.matrixWorld), s.project(this.camera);
|
|
404
|
+
const c = (s.x + 1) / 2 * a, g = (s.y + 1) / 2 * n, u = l.scale.x, p = l.scale.y, m = c - u / 2, T = g - p / 2, v = m * this.qualityFactor / o, B = T * this.qualityFactor / o, b = u * this.qualityFactor / o, f = p * this.qualityFactor / o;
|
|
405
|
+
this.renderer.setScissor(v, B, b, f), this.renderer.render(this.scene, this.camera);
|
|
406
|
+
}
|
|
407
|
+
this.renderer.setScissorTest(!1), this.renderer.autoClear = !0, this.renderer.setRenderTarget(null), this.camera.layers.set(28), this.renderer.setClearColor(t, r);
|
|
408
|
+
}
|
|
350
409
|
render() {
|
|
351
|
-
this.renderer.render(this.scene, this.camera);
|
|
410
|
+
this.renderTarget && this.captureRenderTarget(), this.renderer.render(this.scene, this.camera);
|
|
411
|
+
}
|
|
412
|
+
// for debugging
|
|
413
|
+
showScissoredRenderTarget() {
|
|
414
|
+
if (!this.renderTarget)
|
|
415
|
+
return;
|
|
416
|
+
const e = this.targetRect.width, t = this.targetRect.height, r = new d.PlaneGeometry(e, t), s = new d.MeshBasicMaterial({
|
|
417
|
+
map: this.renderTarget.texture,
|
|
418
|
+
side: d.DoubleSide,
|
|
419
|
+
transparent: !0,
|
|
420
|
+
opacity: 0.8
|
|
421
|
+
}), a = new d.Mesh(r, s);
|
|
422
|
+
a.position.set(0, 0, 90), a.layers.set(28), this.scene.add(a);
|
|
352
423
|
}
|
|
353
424
|
}
|
|
354
|
-
function
|
|
355
|
-
const
|
|
356
|
-
|
|
357
|
-
const
|
|
425
|
+
function J(i) {
|
|
426
|
+
const e = document.createRange();
|
|
427
|
+
e.selectNodeContents(i);
|
|
428
|
+
const t = e.getBoundingClientRect();
|
|
358
429
|
return {
|
|
359
|
-
left:
|
|
360
|
-
top:
|
|
361
|
-
width:
|
|
362
|
-
height:
|
|
430
|
+
left: t.left,
|
|
431
|
+
top: t.top,
|
|
432
|
+
width: t.width,
|
|
433
|
+
height: t.height
|
|
363
434
|
};
|
|
364
435
|
}
|
|
365
|
-
function
|
|
366
|
-
const
|
|
367
|
-
let
|
|
368
|
-
isNaN(
|
|
369
|
-
let
|
|
370
|
-
return isNaN(
|
|
371
|
-
font: `${
|
|
372
|
-
color:
|
|
373
|
-
textAlign:
|
|
436
|
+
function V(i) {
|
|
437
|
+
const e = parseFloat(i.fontSize);
|
|
438
|
+
let t = parseFloat(i.lineHeight);
|
|
439
|
+
isNaN(t) && (t = e * 1.2);
|
|
440
|
+
let r = parseFloat(i.letterSpacing);
|
|
441
|
+
return isNaN(r) && (r = 0), {
|
|
442
|
+
font: `${i.fontStyle} ${i.fontWeight} ${i.fontSize} ${i.fontFamily}`,
|
|
443
|
+
color: i.color,
|
|
444
|
+
textAlign: i.textAlign || "start",
|
|
374
445
|
textBaseline: "alphabetic",
|
|
375
|
-
direction:
|
|
376
|
-
lineHeight:
|
|
377
|
-
letterSpacing:
|
|
446
|
+
direction: i.direction || "inherit",
|
|
447
|
+
lineHeight: t,
|
|
448
|
+
letterSpacing: r
|
|
378
449
|
};
|
|
379
450
|
}
|
|
380
|
-
function
|
|
381
|
-
if (
|
|
382
|
-
const
|
|
383
|
-
if (!
|
|
451
|
+
function X(i, e = O | D | k | N | z, t, r) {
|
|
452
|
+
if (i.nodeType === Node.TEXT_NODE) {
|
|
453
|
+
const f = i;
|
|
454
|
+
if (!f.textContent || !f.textContent.trim())
|
|
384
455
|
return null;
|
|
385
|
-
const
|
|
386
|
-
if (
|
|
456
|
+
const C = f.textContent.replace(/\s+/g, " ").trim();
|
|
457
|
+
if (C.length === 0)
|
|
387
458
|
return null;
|
|
388
|
-
const
|
|
389
|
-
if (
|
|
459
|
+
const y = J(f);
|
|
460
|
+
if (y.width === 0 || y.height === 0)
|
|
390
461
|
return null;
|
|
391
|
-
const
|
|
392
|
-
return
|
|
462
|
+
const L = f.parentElement, M = L ? window.getComputedStyle(L) : null;
|
|
463
|
+
return M ? {
|
|
393
464
|
id: Math.random().toString(36).substring(2, 9),
|
|
394
465
|
type: "TEXT",
|
|
395
|
-
element:
|
|
466
|
+
element: f,
|
|
396
467
|
rect: {
|
|
397
|
-
x:
|
|
398
|
-
y:
|
|
399
|
-
width:
|
|
400
|
-
height:
|
|
468
|
+
x: y.left + window.scrollX,
|
|
469
|
+
y: y.top + window.scrollY,
|
|
470
|
+
width: y.width,
|
|
471
|
+
height: y.height
|
|
401
472
|
},
|
|
402
473
|
styles: {
|
|
403
474
|
backgroundColor: "transparent",
|
|
404
|
-
opacity: parseFloat(
|
|
475
|
+
opacity: parseFloat(M.opacity),
|
|
405
476
|
zIndex: 0,
|
|
406
477
|
borderRadius: "0px",
|
|
407
478
|
borderColor: "transparent",
|
|
408
479
|
borderWidth: "0px"
|
|
409
480
|
},
|
|
410
|
-
textContent:
|
|
411
|
-
textStyles:
|
|
412
|
-
dirtyMask:
|
|
413
|
-
visibility:
|
|
481
|
+
textContent: C,
|
|
482
|
+
textStyles: V(M),
|
|
483
|
+
dirtyMask: e,
|
|
484
|
+
visibility: t,
|
|
485
|
+
isTraveler: !1,
|
|
414
486
|
children: []
|
|
415
487
|
} : null;
|
|
416
488
|
}
|
|
417
|
-
const s =
|
|
418
|
-
let
|
|
419
|
-
if (
|
|
420
|
-
const
|
|
421
|
-
for (const
|
|
422
|
-
if (!
|
|
489
|
+
const s = i, a = s.dataset.mirageFilter;
|
|
490
|
+
let n = t, o = t;
|
|
491
|
+
if (a) {
|
|
492
|
+
const f = new Set(a.split(/\s+/));
|
|
493
|
+
for (const C of f)
|
|
494
|
+
if (!q.includes(C))
|
|
423
495
|
throw new Error(
|
|
424
|
-
`[MirageEngine] Invalid filter token: '${
|
|
496
|
+
`[MirageEngine] Invalid filter token: '${C}'. Expected one of: 'include-tree', 'exclude-tree', 'include-self', 'exclude-self', 'end'.`
|
|
425
497
|
);
|
|
426
|
-
if (
|
|
498
|
+
if (f.has("end"))
|
|
427
499
|
return null;
|
|
428
|
-
if (
|
|
500
|
+
if (f.has("include-tree") && f.has("exclude-tree"))
|
|
429
501
|
throw new Error(
|
|
430
502
|
"[MirageEngine] Conflicting filters: 'include-tree' and 'exclude-tree' cannot be used together on the same element."
|
|
431
503
|
);
|
|
432
|
-
if (
|
|
504
|
+
if (f.has("include-self") && f.has("exclude-self"))
|
|
433
505
|
throw new Error(
|
|
434
506
|
"[MirageEngine] Conflicting filters: 'include-self' and 'exclude-self' cannot be used together on the same element."
|
|
435
507
|
);
|
|
436
|
-
|
|
508
|
+
f.has("include-tree") ? n = n | x : f.has("exclude-tree") && (n = n & ~x), o = n, f.has("include-self") ? o = o | x : f.has("exclude-self") && (o = o & ~x);
|
|
437
509
|
}
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
const
|
|
443
|
-
if (
|
|
510
|
+
o = o | t & R;
|
|
511
|
+
const l = s.dataset.mirageTravel;
|
|
512
|
+
let c = !1;
|
|
513
|
+
l && new Set(l.split(/\s+/)).has("traveler") && (o = o & ~R, n = n & ~R, c = !0);
|
|
514
|
+
const g = s.getBoundingClientRect(), u = window.getComputedStyle(s);
|
|
515
|
+
if (g.width === 0 || g.height === 0 || u.display === "none")
|
|
444
516
|
return null;
|
|
445
517
|
let p = s.getAttribute("data-mid");
|
|
446
518
|
p || (p = Math.random().toString(36).substring(2, 11), s.setAttribute("data-mid", p));
|
|
447
|
-
const
|
|
448
|
-
backgroundColor:
|
|
449
|
-
opacity: parseFloat(
|
|
450
|
-
zIndex: isNaN(
|
|
451
|
-
borderRadius:
|
|
452
|
-
borderColor:
|
|
453
|
-
borderWidth:
|
|
519
|
+
const m = parseInt(u.zIndex), T = {
|
|
520
|
+
backgroundColor: u.backgroundColor,
|
|
521
|
+
opacity: parseFloat(u.opacity),
|
|
522
|
+
zIndex: isNaN(m) ? 0 : m,
|
|
523
|
+
borderRadius: u.borderRadius,
|
|
524
|
+
borderColor: u.borderColor,
|
|
525
|
+
borderWidth: u.borderWidth
|
|
454
526
|
};
|
|
455
|
-
let
|
|
456
|
-
const
|
|
457
|
-
return Array.from(s.childNodes).forEach((
|
|
458
|
-
const
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
i
|
|
527
|
+
let v, B;
|
|
528
|
+
const b = [];
|
|
529
|
+
return Array.from(s.childNodes).forEach((f) => {
|
|
530
|
+
const C = f.nodeType === Node.TEXT_NODE ? o : n, y = X(
|
|
531
|
+
f,
|
|
532
|
+
e,
|
|
533
|
+
C
|
|
463
534
|
);
|
|
464
|
-
|
|
535
|
+
y && b.push(y);
|
|
465
536
|
}), {
|
|
466
537
|
id: p,
|
|
467
538
|
type: "BOX",
|
|
468
539
|
element: s,
|
|
469
540
|
rect: {
|
|
470
|
-
x:
|
|
471
|
-
y:
|
|
472
|
-
width:
|
|
473
|
-
height:
|
|
541
|
+
x: g.left + window.scrollX,
|
|
542
|
+
y: g.top + window.scrollY,
|
|
543
|
+
width: g.width,
|
|
544
|
+
height: g.height
|
|
474
545
|
},
|
|
475
|
-
styles:
|
|
476
|
-
textContent:
|
|
477
|
-
textStyles:
|
|
478
|
-
dirtyMask:
|
|
546
|
+
styles: T,
|
|
547
|
+
textContent: v,
|
|
548
|
+
textStyles: B,
|
|
549
|
+
dirtyMask: e,
|
|
479
550
|
visibility: o,
|
|
480
|
-
|
|
551
|
+
isTraveler: c,
|
|
552
|
+
children: b
|
|
481
553
|
};
|
|
482
554
|
}
|
|
483
|
-
class
|
|
484
|
-
constructor(
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
555
|
+
class j {
|
|
556
|
+
constructor(e, t, r) {
|
|
557
|
+
h(this, "target");
|
|
558
|
+
h(this, "renderer");
|
|
559
|
+
h(this, "filter");
|
|
560
|
+
h(this, "observer");
|
|
561
|
+
h(this, "isDomDirty", !1);
|
|
562
|
+
h(this, "isRunning", !1);
|
|
563
|
+
h(this, "isTravelEnabled", !1);
|
|
564
|
+
h(this, "pendingMask", E);
|
|
565
|
+
h(this, "mutationTimer", null);
|
|
566
|
+
h(this, "cssTimer", null);
|
|
567
|
+
h(this, "resizeConfig");
|
|
568
|
+
h(this, "resizeTimer", null);
|
|
569
|
+
h(this, "isResizing", !1);
|
|
570
|
+
h(this, "onTransitionFinished", (e) => {
|
|
571
|
+
this.target.contains(e.target) && this.mutationTimer === null && (this.cssTimer && clearTimeout(this.cssTimer), this.pendingMask |= O | D, this.cssTimer = window.setTimeout(() => {
|
|
496
572
|
this.isDomDirty = !0, this.cssTimer = null;
|
|
497
573
|
}, 50));
|
|
498
574
|
});
|
|
499
|
-
|
|
500
|
-
this.
|
|
575
|
+
h(this, "onWindowResize", () => {
|
|
576
|
+
if (!this.resizeConfig.enabled) {
|
|
577
|
+
this.isDomDirty = !0;
|
|
578
|
+
return;
|
|
579
|
+
}
|
|
580
|
+
this.isResizing || (this.isResizing = !0, this.resizeConfig.onStart && this.resizeConfig.onStart()), this.resizeTimer && clearTimeout(this.resizeTimer), this.resizeTimer = window.setTimeout(() => {
|
|
581
|
+
this.isDomDirty = !0, this.resizeConfig.onEnd && this.resizeConfig.onEnd(), this.isResizing = !1, this.resizeTimer = null;
|
|
582
|
+
}, this.resizeConfig.delay);
|
|
501
583
|
});
|
|
502
|
-
|
|
584
|
+
h(this, "renderLoop", () => {
|
|
503
585
|
this.isRunning && (this.isDomDirty && this.forceUpdateScene(), this.renderer.render(), requestAnimationFrame(this.renderLoop));
|
|
504
586
|
});
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
587
|
+
var a, n;
|
|
588
|
+
this.target = e, this.renderer = t, this.filter = r.filter;
|
|
589
|
+
const s = (a = r.resizeDebounce) != null ? a : !0;
|
|
590
|
+
s === !1 ? this.resizeConfig = { enabled: !1, delay: 0 } : s === !0 ? this.resizeConfig = { enabled: !0, delay: 150 } : this.resizeConfig = {
|
|
591
|
+
enabled: !0,
|
|
592
|
+
delay: (n = s.delay) != null ? n : 150,
|
|
593
|
+
onStart: s.onStart,
|
|
594
|
+
onEnd: s.onEnd
|
|
595
|
+
}, this.observer = new MutationObserver((o) => {
|
|
596
|
+
let l = E;
|
|
597
|
+
for (const c of o)
|
|
598
|
+
c.type === "childList" ? l |= z : c.type === "attributes" && (c.attributeName === "style" || c.attributeName === "class") && (l |= O | D);
|
|
599
|
+
if (l !== E) {
|
|
600
|
+
if (this.pendingMask |= l, l & z) {
|
|
511
601
|
this.clearTimers(), console.log("Structural Change detected"), this.isDomDirty = !0;
|
|
512
602
|
return;
|
|
513
603
|
}
|
|
@@ -533,21 +623,28 @@ class V {
|
|
|
533
623
|
}
|
|
534
624
|
forceUpdateScene() {
|
|
535
625
|
this.isDomDirty = !1;
|
|
536
|
-
const
|
|
537
|
-
|
|
626
|
+
const e = document.querySelector("[data-mirage-travel='traveler']") !== null;
|
|
627
|
+
e && !this.isTravelEnabled && (this.isTravelEnabled = !0, this.renderer.createRenderTarget());
|
|
628
|
+
const t = X(
|
|
629
|
+
this.target,
|
|
630
|
+
this.pendingMask,
|
|
631
|
+
e ? x | R : x,
|
|
632
|
+
this.filter
|
|
633
|
+
);
|
|
634
|
+
t && this.renderer.syncScene(t), this.pendingMask = E;
|
|
538
635
|
}
|
|
539
636
|
}
|
|
540
|
-
class
|
|
541
|
-
constructor(
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
var s,
|
|
546
|
-
this.target =
|
|
547
|
-
let
|
|
548
|
-
if (
|
|
637
|
+
class K {
|
|
638
|
+
constructor(e, t) {
|
|
639
|
+
h(this, "renderer");
|
|
640
|
+
h(this, "syncer");
|
|
641
|
+
h(this, "target");
|
|
642
|
+
var s, a, n;
|
|
643
|
+
this.target = e;
|
|
644
|
+
let r;
|
|
645
|
+
if (t.mode === "duplicate" ? r = (a = (s = t.container) != null ? s : this.target.parentElement) != null ? a : void 0 : r = (n = this.target.parentElement) != null ? n : void 0, !r)
|
|
549
646
|
throw new Error("[Mirage] Cannot find a container (parent or option).");
|
|
550
|
-
this.renderer = new
|
|
647
|
+
this.renderer = new G(this.target, t, r), this.renderer.mount(), this.syncer = new j(this.target, this.renderer, t);
|
|
551
648
|
}
|
|
552
649
|
start() {
|
|
553
650
|
this.syncer.start();
|
|
@@ -560,15 +657,15 @@ class Z {
|
|
|
560
657
|
}
|
|
561
658
|
}
|
|
562
659
|
export {
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
660
|
+
q as ALLOWED_FILTERS,
|
|
661
|
+
N as DIRTY_CONTENT,
|
|
662
|
+
E as DIRTY_NONE,
|
|
663
|
+
O as DIRTY_RECT,
|
|
664
|
+
z as DIRTY_STRUCTURE,
|
|
665
|
+
D as DIRTY_STYLE,
|
|
666
|
+
k as DIRTY_ZINDEX,
|
|
667
|
+
Z as EXCLUDED,
|
|
668
|
+
K as Engine,
|
|
669
|
+
R as SYSTEM_LAYER,
|
|
670
|
+
x as USER_LAYER
|
|
574
671
|
};
|