@netless/appliance-plugin 1.1.34-beta.3 → 1.1.35-beta.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/READMA.zh-CN.md +33 -1
- package/README.md +32 -0
- package/cdn/cdn.js +1 -1
- package/cdn/fullWorker-BShzOf.js +486 -0
- package/cdn/subWorker-DofGU2.js +486 -0
- package/dist/appliance-plugin.js +1 -1
- package/dist/appliance-plugin.mjs +1 -1
- package/dist/assets/fullWorker-BLBp1QlT.js +593 -0
- package/dist/assets/subWorker-CA5sK8hX.js +593 -0
- package/dist/{bridge-Bb-MjyNY.mjs → bridge-D6IerdOk.mjs} +6 -6
- package/dist/{bridge-m2Uim0rf.js → bridge-s6K3XU2g.js} +1 -1
- package/dist/bridge.js +1 -1
- package/dist/bridge.mjs +1 -1
- package/dist/core/autoShape/index.d.ts +12 -0
- package/dist/core/autoShape/mapper.d.ts +3 -0
- package/dist/core/autoShape/recognizer.d.ts +8 -0
- package/dist/core/autoShape/registry.d.ts +2 -0
- package/dist/core/autoShape/templates.d.ts +2 -0
- package/dist/core/autoShape/types.d.ts +78 -0
- package/dist/core/mainEngine.d.ts +9 -0
- package/dist/core/tools/pencil.d.ts +3 -0
- package/dist/core/types.d.ts +7 -0
- package/dist/fullWorker.js +147 -147
- package/dist/index-328yD4vj.js +1 -0
- package/dist/{index-B5p02yLM.mjs → index-4k563Sm-.mjs} +3076 -2293
- package/dist/index-C89lvDjQ.js +1 -0
- package/dist/{index-C-ITXa9_.js → index-CBE_U7Gn.js} +3 -3
- package/dist/{index-BAEfMWKR.mjs → index-CPmHcL9u.mjs} +1041 -1013
- package/dist/{index-BbVM6AMN.mjs → index-D-IWIyEl.mjs} +260 -253
- package/dist/{index-D9CYiyfx.mjs → index-D1p6YXf0.mjs} +3014 -2238
- package/dist/{index-HS0sRcOj.js → index-DDL0Hq_X.js} +3 -3
- package/dist/{index-on8Dtynb.mjs → index-DR2km5D4.mjs} +215 -208
- package/dist/index-DXx1-O0K.js +1 -0
- package/dist/index-DbLWM-6h.js +1 -0
- package/dist/{index-O6ldDna3.mjs → index-IQRiGPX7.mjs} +1041 -1013
- package/dist/plugin/multi/containerManager.d.ts +7 -0
- package/dist/plugin/types.d.ts +24 -0
- package/dist/subWorker.js +147 -147
- package/dist/svgToImageLoader-B3gIDAQo.js +1 -0
- package/dist/svgToImageLoader-DZz5bAo4.mjs +22 -0
- package/package.json +11 -5
- package/cdn/fullWorker-cY8Uuj.js +0 -486
- package/cdn/subWorker-BleGf3.js +0 -486
- package/dist/assets/fullWorker-BuSPsz-_.js +0 -593
- package/dist/assets/subWorker-B0NfJ2Bk.js +0 -593
- package/dist/index-BVYBjZU_.js +0 -1
- package/dist/index-D696FwsD.js +0 -1
- package/dist/index-DTeRhVER.js +0 -1
- package/dist/index-DnT8RFOT.js +0 -1
- package/dist/svgToImageLoader-DPRAAhwW.js +0 -1
- package/dist/svgToImageLoader-mXH53h-l.mjs +0 -18
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var K = Object.defineProperty;
|
|
2
2
|
var j = (o, e, t) => e in o ? K(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
|
-
var
|
|
4
|
-
import { E as B, a as
|
|
3
|
+
var u = (o, e, t) => j(o, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { E as B, a as y, b as D, c as M, d as E, V as P, S as Z } from "./index-D1p6YXf0.mjs";
|
|
5
5
|
import { isEqual as W, isString as _, clone as J, throttle as Q } from "lodash";
|
|
6
6
|
import "spritejs";
|
|
7
7
|
import "lz-string";
|
|
@@ -15,7 +15,7 @@ import { Transformer as ee } from "markmap-lib";
|
|
|
15
15
|
import { O as te } from "./ObserverMap-BudneEfB.mjs";
|
|
16
16
|
class re {
|
|
17
17
|
constructor() {
|
|
18
|
-
|
|
18
|
+
u(this, "threadEngine");
|
|
19
19
|
}
|
|
20
20
|
registerBackgroundThread(e) {
|
|
21
21
|
return this.threadEngine = e, this;
|
|
@@ -24,11 +24,11 @@ class re {
|
|
|
24
24
|
class ae extends re {
|
|
25
25
|
constructor() {
|
|
26
26
|
super(...arguments);
|
|
27
|
-
|
|
27
|
+
u(this, "emitEventType", B.CopyNode);
|
|
28
28
|
}
|
|
29
29
|
async consume(t) {
|
|
30
30
|
const { msgType: r, dataType: s, emitEventType: i } = t;
|
|
31
|
-
if (r ===
|
|
31
|
+
if (r === y.FullWork && s === D.Local && i === this.emitEventType)
|
|
32
32
|
return this.consumeForLocalWorker(t), !0;
|
|
33
33
|
}
|
|
34
34
|
async consumeForLocalWorker(t) {
|
|
@@ -39,7 +39,7 @@ class ae extends re {
|
|
|
39
39
|
}
|
|
40
40
|
class se {
|
|
41
41
|
constructor(e) {
|
|
42
|
-
|
|
42
|
+
u(this, "builders", /* @__PURE__ */ new Map());
|
|
43
43
|
this.builders = new Map(e.map((t) => [t, this.build(t)]));
|
|
44
44
|
}
|
|
45
45
|
build(e) {
|
|
@@ -79,16 +79,16 @@ async function ne() {
|
|
|
79
79
|
function oe() {
|
|
80
80
|
return (N == null ? void 0 : N.default) || null;
|
|
81
81
|
}
|
|
82
|
-
const
|
|
82
|
+
const T = class T {
|
|
83
83
|
constructor() {
|
|
84
84
|
// 使用 workId 作为 key,存储每个实例的 mermaid 代码块
|
|
85
|
-
|
|
85
|
+
u(this, "mermaidCodeBlocksByWorkId", /* @__PURE__ */ new Map());
|
|
86
86
|
}
|
|
87
87
|
/**
|
|
88
88
|
* 获取 MermaidManager 单例实例
|
|
89
89
|
*/
|
|
90
90
|
static getInstance() {
|
|
91
|
-
return
|
|
91
|
+
return T.instance || (T.instance = new T()), T.instance;
|
|
92
92
|
}
|
|
93
93
|
/**
|
|
94
94
|
* 生成唯一的 mermaid ID
|
|
@@ -134,39 +134,39 @@ const I = class I {
|
|
|
134
134
|
*/
|
|
135
135
|
extendMarkdown(e, t) {
|
|
136
136
|
const r = e.md.renderer, s = r.rules.fence, i = this;
|
|
137
|
-
r.rules.fence = (a, n, c,
|
|
138
|
-
const
|
|
139
|
-
if (
|
|
140
|
-
const
|
|
141
|
-
return i.createContainer(
|
|
137
|
+
r.rules.fence = (a, n, c, h, g) => {
|
|
138
|
+
const p = a[n];
|
|
139
|
+
if (p.info.trim() === "mermaid") {
|
|
140
|
+
const f = i.generateId();
|
|
141
|
+
return i.createContainer(f, p.content, t);
|
|
142
142
|
}
|
|
143
|
-
return s ? s(a, n, c,
|
|
143
|
+
return s ? s(a, n, c, h, g) : "";
|
|
144
144
|
};
|
|
145
145
|
}
|
|
146
146
|
// 为了向后兼容,保留静态方法(内部使用单例)
|
|
147
147
|
static generateId() {
|
|
148
|
-
return
|
|
148
|
+
return T.getInstance().generateId();
|
|
149
149
|
}
|
|
150
150
|
static createContainer(e, t, r) {
|
|
151
|
-
return
|
|
151
|
+
return T.getInstance().createContainer(
|
|
152
152
|
e,
|
|
153
153
|
t,
|
|
154
154
|
r
|
|
155
155
|
);
|
|
156
156
|
}
|
|
157
157
|
static getCode(e, t) {
|
|
158
|
-
return
|
|
158
|
+
return T.getInstance().getCode(e, t);
|
|
159
159
|
}
|
|
160
160
|
static clear(e) {
|
|
161
|
-
|
|
161
|
+
T.getInstance().clear(e);
|
|
162
162
|
}
|
|
163
163
|
static extendMarkdown(e, t) {
|
|
164
|
-
|
|
164
|
+
T.getInstance().extendMarkdown(e, t);
|
|
165
165
|
}
|
|
166
166
|
};
|
|
167
|
-
|
|
168
|
-
let
|
|
169
|
-
class
|
|
167
|
+
u(T, "instance", null);
|
|
168
|
+
let O = T;
|
|
169
|
+
class b {
|
|
170
170
|
/**
|
|
171
171
|
* 检查 markmap 节点及其子节点是否包含 mermaid 代码块
|
|
172
172
|
* @param node markmap 节点数据
|
|
@@ -179,7 +179,7 @@ class T {
|
|
|
179
179
|
return !0;
|
|
180
180
|
if (e.children && Array.isArray(e.children)) {
|
|
181
181
|
for (const t of e.children)
|
|
182
|
-
if (
|
|
182
|
+
if (b.checkNodeHasMermaid(t))
|
|
183
183
|
return !0;
|
|
184
184
|
}
|
|
185
185
|
return !1;
|
|
@@ -191,7 +191,7 @@ class T {
|
|
|
191
191
|
* @returns Promise<void>
|
|
192
192
|
*/
|
|
193
193
|
static async renderMermaidAfterDOMUpdate(e, t) {
|
|
194
|
-
await
|
|
194
|
+
await b.renderMermaidBlocks(e, t);
|
|
195
195
|
}
|
|
196
196
|
/**
|
|
197
197
|
* 渲染所有 mermaid 容器中的图表
|
|
@@ -214,42 +214,42 @@ class T {
|
|
|
214
214
|
let s = null, i = !1;
|
|
215
215
|
for (let n = 0; n < 30; n++) {
|
|
216
216
|
const c = e.querySelectorAll("foreignObject");
|
|
217
|
-
if (s = e.querySelectorAll(".mermaid-container"), s.length > 0 || (c.length > 0 && (i = !0), await new Promise((
|
|
217
|
+
if (s = e.querySelectorAll(".mermaid-container"), s.length > 0 || (c.length > 0 && (i = !0), await new Promise((h) => setTimeout(h, 50)), i && n >= 20))
|
|
218
218
|
break;
|
|
219
219
|
}
|
|
220
220
|
if (!s || s.length === 0)
|
|
221
221
|
return;
|
|
222
222
|
const a = Array.from(s).map(
|
|
223
223
|
async (n, c) => {
|
|
224
|
-
const
|
|
224
|
+
const h = n, g = h.getAttribute("data-mermaid-id"), p = g ? O.getCode(g, t) : void 0, d = h.querySelector(
|
|
225
225
|
".mermaid-placeholder"
|
|
226
226
|
);
|
|
227
|
-
if (!(!
|
|
227
|
+
if (!(!d || !p))
|
|
228
228
|
try {
|
|
229
|
-
const
|
|
230
|
-
if (
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
const
|
|
234
|
-
if (
|
|
235
|
-
if (!
|
|
236
|
-
const
|
|
237
|
-
(
|
|
229
|
+
const w = `mermaid-${t.replace(/[^a-zA-Z0-9_-]/g, "-")}-${Date.now()}-${c}`, { svg: v } = await r.render(w, p);
|
|
230
|
+
if (d && d.parentNode) {
|
|
231
|
+
const I = document.createElement("div");
|
|
232
|
+
I.innerHTML = v;
|
|
233
|
+
const l = I.querySelector("svg");
|
|
234
|
+
if (l) {
|
|
235
|
+
if (!l.getAttribute("viewBox") && l.getAttribute("width") && l.getAttribute("height")) {
|
|
236
|
+
const S = l.getAttribute("width"), k = l.getAttribute("height"), x = parseFloat((S == null ? void 0 : S.replace(/px|%/, "")) || "0"), A = parseFloat(
|
|
237
|
+
(k == null ? void 0 : k.replace(/px|%/, "")) || "0"
|
|
238
238
|
);
|
|
239
|
-
|
|
239
|
+
x > 0 && A > 0 && l.setAttribute(
|
|
240
240
|
"viewBox",
|
|
241
|
-
`0 0 ${
|
|
241
|
+
`0 0 ${x} ${A}`
|
|
242
242
|
);
|
|
243
243
|
}
|
|
244
|
-
|
|
245
|
-
const
|
|
246
|
-
|
|
244
|
+
l.style.display = "block", l.style.maxWidth = "100%", l.style.width = "auto", l.style.height = "auto", l.style.overflow = "visible", l.style.verticalAlign = "top", l.style.objectFit = "contain";
|
|
245
|
+
const m = document.createElement("div");
|
|
246
|
+
m.className = "mermaid-wrapper", m.style.width = "100%", m.style.height = "auto", m.style.overflow = "hidden", m.style.display = "inline-block", m.style.verticalAlign = "top", m.style.margin = "0", m.style.padding = "0", m.style.boxSizing = "border-box", m.style.position = "relative", this.isSafari() && (m.style.clipPath = "inset(100% 0 0 0)", m.style.pointerEvents = "none"), m.appendChild(l), l.style.width = "100%", l.style.height = "100%", l.style.maxWidth = "100%", l.style.maxHeight = "100%", l.style.objectFit = "contain", l.setAttribute("data-type", "mermaid"), this.isSafari() && (l.style.opacity = "0"), d.parentNode.replaceChild(m, d);
|
|
247
247
|
} else
|
|
248
|
-
|
|
248
|
+
d.outerHTML = v;
|
|
249
249
|
}
|
|
250
|
-
} catch (
|
|
251
|
-
const
|
|
252
|
-
|
|
250
|
+
} catch (f) {
|
|
251
|
+
const w = f instanceof Error ? f.message : String(f);
|
|
252
|
+
d && (d.textContent = `Mermaid 渲染失败: ${w}`, d.style.color = "red", d.style.fontSize = "12px");
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
255
|
);
|
|
@@ -292,8 +292,8 @@ class T {
|
|
|
292
292
|
'svg[data-type="mermaid"]'
|
|
293
293
|
);
|
|
294
294
|
if (!n) {
|
|
295
|
-
const
|
|
296
|
-
|
|
295
|
+
const g = a.querySelector(".mermaid-wrapper");
|
|
296
|
+
g && (n = g.querySelector(
|
|
297
297
|
'svg[data-type="mermaid"]'
|
|
298
298
|
));
|
|
299
299
|
}
|
|
@@ -301,67 +301,67 @@ class T {
|
|
|
301
301
|
return;
|
|
302
302
|
const c = a.querySelector(
|
|
303
303
|
".mermaid-container"
|
|
304
|
-
),
|
|
305
|
-
if (
|
|
304
|
+
), h = c == null ? void 0 : c.getAttribute("data-mermaid-id");
|
|
305
|
+
if (h)
|
|
306
306
|
try {
|
|
307
|
-
const
|
|
307
|
+
const g = parseFloat(a.getAttribute("x") || "0"), p = parseFloat(a.getAttribute("y") || "0"), d = parseFloat(
|
|
308
308
|
a.getAttribute("width") || "0"
|
|
309
|
-
),
|
|
309
|
+
), f = parseFloat(
|
|
310
310
|
a.getAttribute("height") || "0"
|
|
311
311
|
);
|
|
312
|
-
if (
|
|
312
|
+
if (d <= 0 || f <= 0)
|
|
313
313
|
return;
|
|
314
|
-
const
|
|
315
|
-
if (!
|
|
314
|
+
const w = a.parentElement;
|
|
315
|
+
if (!w || w.tagName !== "g")
|
|
316
316
|
return;
|
|
317
|
-
let v =
|
|
317
|
+
let v = w.getAttribute("transform");
|
|
318
318
|
if (!v)
|
|
319
|
-
v = `translate(${
|
|
319
|
+
v = `translate(${g}, ${p})`;
|
|
320
320
|
else {
|
|
321
|
-
const
|
|
321
|
+
const k = v.match(
|
|
322
322
|
/translate\(([^,]+),([^)]+)\)/
|
|
323
323
|
);
|
|
324
|
-
if (
|
|
325
|
-
const
|
|
324
|
+
if (k) {
|
|
325
|
+
const x = parseFloat(k[1]), A = parseFloat(k[2]), F = x + g, R = A + p;
|
|
326
326
|
v = v.replace(
|
|
327
327
|
/translate\([^)]+\)/,
|
|
328
328
|
`translate(${F}, ${R})`
|
|
329
329
|
);
|
|
330
330
|
} else
|
|
331
|
-
v = `translate(${
|
|
331
|
+
v = `translate(${g}, ${p}) ${v}`;
|
|
332
332
|
}
|
|
333
|
-
const
|
|
334
|
-
`g[data-mermaid-wrapper][data-mermaid-id="${
|
|
333
|
+
const I = e.querySelector(
|
|
334
|
+
`g[data-mermaid-wrapper][data-mermaid-id="${h}"][data-mermaid-clone="true"]`
|
|
335
335
|
);
|
|
336
|
-
let
|
|
337
|
-
if (
|
|
338
|
-
|
|
339
|
-
const
|
|
340
|
-
|
|
336
|
+
let l;
|
|
337
|
+
if (I) {
|
|
338
|
+
l = I;
|
|
339
|
+
const k = l.querySelector('svg[data-type="mermaid"]');
|
|
340
|
+
k && l.removeChild(k);
|
|
341
341
|
} else
|
|
342
|
-
|
|
342
|
+
l = document.createElementNS(
|
|
343
343
|
"http://www.w3.org/2000/svg",
|
|
344
344
|
"g"
|
|
345
|
-
),
|
|
346
|
-
|
|
347
|
-
const
|
|
348
|
-
if (
|
|
349
|
-
const
|
|
350
|
-
if (
|
|
351
|
-
const
|
|
352
|
-
|
|
345
|
+
), l.setAttribute("data-mermaid-wrapper", "true"), l.setAttribute("data-mermaid-clone", "true"), l.setAttribute("data-mermaid-id", h);
|
|
346
|
+
l.setAttribute("transform", v);
|
|
347
|
+
const m = n.cloneNode(!0);
|
|
348
|
+
if (m.setAttribute("width", d.toString()), m.setAttribute("height", f.toString()), m.setAttribute("data-mermaid-transformed", "true"), m.style.width = "", m.style.height = "", m.style.maxWidth = "", m.style.maxHeight = "", m.style.transform = "", m.style.transformOrigin = "", m.style.display = "block", m.style.overflow = "visible", m.style.opacity = "1", !m.getAttribute("viewBox")) {
|
|
349
|
+
const k = m.getAttribute("width"), x = m.getAttribute("height");
|
|
350
|
+
if (k && x) {
|
|
351
|
+
const A = parseFloat(
|
|
352
|
+
k.replace(/px|%/, "") || "0"
|
|
353
353
|
), F = parseFloat(
|
|
354
|
-
|
|
354
|
+
x.replace(/px|%/, "") || "0"
|
|
355
355
|
);
|
|
356
|
-
|
|
356
|
+
A > 0 && F > 0 && m.setAttribute(
|
|
357
357
|
"viewBox",
|
|
358
|
-
`0 0 ${
|
|
358
|
+
`0 0 ${A} ${F}`
|
|
359
359
|
);
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
|
-
|
|
363
|
-
} catch (
|
|
364
|
-
console.error("[transformMermaidSvgToMarkmapSvg] error: ",
|
|
362
|
+
l.appendChild(m), I || (w && w.parentNode ? w.parentNode.insertBefore(l, w.nextSibling) : e.appendChild(l)), c && (c.style.opacity = "0", c.style.pointerEvents = "none");
|
|
363
|
+
} catch (g) {
|
|
364
|
+
console.error("[transformMermaidSvgToMarkmapSvg] error: ", g);
|
|
365
365
|
}
|
|
366
366
|
}
|
|
367
367
|
);
|
|
@@ -378,40 +378,40 @@ class T {
|
|
|
378
378
|
static injectMermaidHtml(e, t, r) {
|
|
379
379
|
const s = [], i = t.split(`
|
|
380
380
|
`);
|
|
381
|
-
let a = "", n = !1, c = [],
|
|
382
|
-
for (let
|
|
383
|
-
const
|
|
384
|
-
if (
|
|
385
|
-
n = !0, c = [],
|
|
386
|
-
else if (n &&
|
|
381
|
+
let a = "", n = !1, c = [], h = -1;
|
|
382
|
+
for (let p = 0; p < i.length; p++) {
|
|
383
|
+
const d = i[p], f = d.match(/^(#{1,6})\s+(.+)$/);
|
|
384
|
+
if (f && (a = f[2].trim()), d.trim().startsWith("```mermaid"))
|
|
385
|
+
n = !0, c = [], h = p;
|
|
386
|
+
else if (n && d.trim() === "```") {
|
|
387
387
|
n = !1;
|
|
388
|
-
const
|
|
388
|
+
const w = c.join(`
|
|
389
389
|
`);
|
|
390
|
-
|
|
390
|
+
w && a && s.push({
|
|
391
391
|
title: a,
|
|
392
|
-
content:
|
|
393
|
-
index:
|
|
392
|
+
content: w,
|
|
393
|
+
index: h
|
|
394
394
|
}), c = [];
|
|
395
|
-
} else n && c.push(
|
|
395
|
+
} else n && c.push(d);
|
|
396
396
|
}
|
|
397
|
-
const
|
|
398
|
-
if (!
|
|
399
|
-
const
|
|
400
|
-
for (const
|
|
401
|
-
if (
|
|
402
|
-
const v =
|
|
397
|
+
const g = (p) => {
|
|
398
|
+
if (!p) return;
|
|
399
|
+
const d = p.content || "", f = b.decodeHtmlEntities(d);
|
|
400
|
+
for (const w of s)
|
|
401
|
+
if (f.includes(w.title) || d.includes(w.title)) {
|
|
402
|
+
const v = O.generateId(), I = O.createContainer(
|
|
403
403
|
v,
|
|
404
|
-
|
|
404
|
+
w.content,
|
|
405
405
|
r
|
|
406
406
|
);
|
|
407
|
-
|
|
407
|
+
p.content ? p.content = p.content + I : p.content = I;
|
|
408
408
|
break;
|
|
409
409
|
}
|
|
410
|
-
|
|
411
|
-
w
|
|
410
|
+
p.children && p.children.length > 0 && p.children.forEach((w) => {
|
|
411
|
+
g(w);
|
|
412
412
|
});
|
|
413
413
|
};
|
|
414
|
-
return
|
|
414
|
+
return g(e), e;
|
|
415
415
|
}
|
|
416
416
|
/**
|
|
417
417
|
* 解码 HTML 实体
|
|
@@ -434,17 +434,17 @@ class T {
|
|
|
434
434
|
class U extends ee {
|
|
435
435
|
constructor(t) {
|
|
436
436
|
super(t);
|
|
437
|
-
|
|
437
|
+
u(this, "currentWorkId", null);
|
|
438
438
|
}
|
|
439
439
|
/**
|
|
440
440
|
* 设置当前工作 ID(用于命名空间隔离)
|
|
441
441
|
* @param workId 工作 ID
|
|
442
442
|
*/
|
|
443
443
|
setWorkId(t) {
|
|
444
|
-
this.currentWorkId = t, t &&
|
|
444
|
+
this.currentWorkId = t, t && O.extendMarkdown(this, t);
|
|
445
445
|
}
|
|
446
446
|
transform(t, r) {
|
|
447
|
-
this.currentWorkId ?
|
|
447
|
+
this.currentWorkId ? O.clear(this.currentWorkId) : O.clear();
|
|
448
448
|
const s = this.convertKatexToText(t), i = super.transform(s, r);
|
|
449
449
|
return i.root && this.processKatexInRoot(i.root), i;
|
|
450
450
|
}
|
|
@@ -526,22 +526,22 @@ class U extends ee {
|
|
|
526
526
|
const c = n.src || n.getAttribute("src");
|
|
527
527
|
if (!c || a.has(c) || (a.add(c), n.complete && n.naturalWidth > 0))
|
|
528
528
|
return;
|
|
529
|
-
const
|
|
530
|
-
const
|
|
531
|
-
|
|
529
|
+
const h = new Promise((g) => {
|
|
530
|
+
const p = setTimeout(() => {
|
|
531
|
+
g();
|
|
532
532
|
}, r);
|
|
533
533
|
if (n.complete && n.naturalWidth > 0) {
|
|
534
|
-
clearTimeout(
|
|
534
|
+
clearTimeout(p), g();
|
|
535
535
|
return;
|
|
536
536
|
}
|
|
537
|
-
const
|
|
538
|
-
clearTimeout(
|
|
539
|
-
},
|
|
540
|
-
clearTimeout(
|
|
537
|
+
const d = () => {
|
|
538
|
+
clearTimeout(p), n.removeEventListener("load", d), n.removeEventListener("error", f), g();
|
|
539
|
+
}, f = () => {
|
|
540
|
+
clearTimeout(p), n.removeEventListener("load", d), n.removeEventListener("error", f), g();
|
|
541
541
|
};
|
|
542
|
-
n.addEventListener("load",
|
|
542
|
+
n.addEventListener("load", d), n.addEventListener("error", f), !n.src && c && (n.src = c);
|
|
543
543
|
});
|
|
544
|
-
i.push(
|
|
544
|
+
i.push(h);
|
|
545
545
|
}), i.length > 0 && await Promise.all(i);
|
|
546
546
|
}
|
|
547
547
|
}
|
|
@@ -568,12 +568,12 @@ async function de(o) {
|
|
|
568
568
|
i.querySelectorAll("image").forEach((n) => {
|
|
569
569
|
n.href && !n.href.baseVal.startsWith("data:") && (n.getAttribute("crossorigin") || n.setAttribute("crossorigin", "anonymous"), t.push(
|
|
570
570
|
new Promise((c) => {
|
|
571
|
-
const
|
|
572
|
-
|
|
571
|
+
const h = new Image();
|
|
572
|
+
h.crossOrigin = "anonymous", h.onload = () => {
|
|
573
573
|
c(void 0);
|
|
574
|
-
},
|
|
574
|
+
}, h.onerror = () => {
|
|
575
575
|
c(void 0);
|
|
576
|
-
},
|
|
576
|
+
}, h.src = n.href.baseVal;
|
|
577
577
|
})
|
|
578
578
|
));
|
|
579
579
|
});
|
|
@@ -592,7 +592,7 @@ async function me(o) {
|
|
|
592
592
|
await new Promise((a) => setTimeout(a, 50));
|
|
593
593
|
}
|
|
594
594
|
}
|
|
595
|
-
async function
|
|
595
|
+
async function pe(o) {
|
|
596
596
|
const e = o.querySelectorAll("svg");
|
|
597
597
|
if (!e.length)
|
|
598
598
|
return;
|
|
@@ -604,7 +604,7 @@ async function ue(o) {
|
|
|
604
604
|
await Promise.all(t);
|
|
605
605
|
}
|
|
606
606
|
async function G(o) {
|
|
607
|
-
if (
|
|
607
|
+
if (b.hasMermaidSvg(o)) {
|
|
608
608
|
const r = Date.now();
|
|
609
609
|
let s = !1;
|
|
610
610
|
for (; Date.now() - r < 5e3 && !s; ) {
|
|
@@ -612,8 +612,8 @@ async function G(o) {
|
|
|
612
612
|
if (i.length > 0) {
|
|
613
613
|
let a = !0;
|
|
614
614
|
for (const n of Array.from(i)) {
|
|
615
|
-
const c = parseFloat(n.getAttribute("width") || "0"),
|
|
616
|
-
if (n.querySelector(".mermaid-container") && (c < 50 ||
|
|
615
|
+
const c = parseFloat(n.getAttribute("width") || "0"), h = parseFloat(n.getAttribute("height") || "0");
|
|
616
|
+
if (n.querySelector(".mermaid-container") && (c < 50 || h < 50)) {
|
|
617
617
|
a = !1;
|
|
618
618
|
break;
|
|
619
619
|
}
|
|
@@ -628,42 +628,42 @@ async function G(o) {
|
|
|
628
628
|
}
|
|
629
629
|
}
|
|
630
630
|
}
|
|
631
|
-
async function
|
|
631
|
+
async function ue(o, e = {}) {
|
|
632
632
|
const { width: t = o.offsetWidth, height: r = o.offsetHeight } = e, s = o.offsetWidth || t, i = o.offsetHeight || r;
|
|
633
633
|
try {
|
|
634
|
-
const { loadSvgToImageLib: a, getSvgToImageLib: n } = await import("./svgToImageLoader-
|
|
634
|
+
const { loadSvgToImageLib: a, getSvgToImageLib: n } = await import("./svgToImageLoader-DZz5bAo4.mjs");
|
|
635
635
|
let c = n();
|
|
636
636
|
if (!c)
|
|
637
637
|
try {
|
|
638
638
|
c = await a();
|
|
639
|
-
} catch (
|
|
640
|
-
return console.error("[loadSvgToImageLib] error: ",
|
|
639
|
+
} catch (d) {
|
|
640
|
+
return console.error("[loadSvgToImageLib] error: ", d), null;
|
|
641
641
|
}
|
|
642
|
-
const
|
|
642
|
+
const h = o.style.width, g = o.style.height, p = o.style.display;
|
|
643
643
|
o.style.width || (o.style.width = `${s}px`), o.style.height || (o.style.height = `${i}px`), (!o.style.display || o.style.display === "none") && (o.style.display = "block");
|
|
644
644
|
try {
|
|
645
|
-
await new Promise((
|
|
645
|
+
await new Promise((f) => {
|
|
646
646
|
requestAnimationFrame(() => {
|
|
647
647
|
requestAnimationFrame(() => {
|
|
648
|
-
|
|
648
|
+
f();
|
|
649
649
|
});
|
|
650
650
|
});
|
|
651
651
|
});
|
|
652
|
-
const
|
|
652
|
+
const d = await c.toPng(o, {
|
|
653
653
|
width: s,
|
|
654
654
|
height: i,
|
|
655
655
|
quality: 1
|
|
656
656
|
});
|
|
657
|
-
return o.style.width =
|
|
658
|
-
const
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
},
|
|
662
|
-
|
|
663
|
-
},
|
|
657
|
+
return o.style.width = h, o.style.height = g, o.style.display = p, new Promise((f) => {
|
|
658
|
+
const w = new Image();
|
|
659
|
+
w.crossOrigin = "anonymous", w.onload = () => {
|
|
660
|
+
f(w);
|
|
661
|
+
}, w.onerror = () => {
|
|
662
|
+
f(null);
|
|
663
|
+
}, w.src = d;
|
|
664
664
|
});
|
|
665
|
-
} catch (
|
|
666
|
-
return o.style.width =
|
|
665
|
+
} catch (d) {
|
|
666
|
+
return o.style.width = h, o.style.height = g, o.style.display = p, console.error("[divToImageElement] error: ", d), null;
|
|
667
667
|
}
|
|
668
668
|
} catch (a) {
|
|
669
669
|
return console.error("[divToImageElement] error: ", a), null;
|
|
@@ -671,14 +671,14 @@ async function pe(o, e = {}) {
|
|
|
671
671
|
}
|
|
672
672
|
class ge {
|
|
673
673
|
constructor(e) {
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
674
|
+
u(this, "toolsType", M.BackgroundSVG);
|
|
675
|
+
u(this, "vNodes");
|
|
676
|
+
u(this, "workOptions");
|
|
677
|
+
u(this, "workId");
|
|
678
|
+
u(this, "markmapInstance", null);
|
|
679
|
+
u(this, "isDestroyed", !1);
|
|
680
|
+
u(this, "element");
|
|
681
|
+
u(this, "manager");
|
|
682
682
|
const { vNodes: t, workId: r, toolsOpt: s, manager: i } = e;
|
|
683
683
|
this.workId = r, this.vNodes = t, this.workOptions = s, this.manager = i, this.element = this.createElement(), this.manager.fullLayer.appendChild(this.element), this.vNodes.setInfo(this.workId, {
|
|
684
684
|
workShape: this
|
|
@@ -707,8 +707,8 @@ class ge {
|
|
|
707
707
|
this.isDestroyed || !this.element || !this.element.parentNode || (this.updateElementPosition(e), await this.updateSvg(e));
|
|
708
708
|
}
|
|
709
709
|
isSameSize(e) {
|
|
710
|
-
const { width: t, height: r } = e, { width: s, height: i } = this.workOptions, a = t * this.manager.camera.scale, n = r * this.manager.camera.scale, c = s * this.manager.camera.scale,
|
|
711
|
-
return a === c && n ===
|
|
710
|
+
const { width: t, height: r } = e, { width: s, height: i } = this.workOptions, a = t * this.manager.camera.scale, n = r * this.manager.camera.scale, c = s * this.manager.camera.scale, h = i * this.manager.camera.scale;
|
|
711
|
+
return a === c && n === h;
|
|
712
712
|
}
|
|
713
713
|
isSamePosition(e) {
|
|
714
714
|
const { centerX: t, centerY: r } = e, { centerX: s, centerY: i } = this.workOptions, a = this.manager.getPagePoint(s, i), n = this.manager.getPagePoint(t, r);
|
|
@@ -729,8 +729,8 @@ class ge {
|
|
|
729
729
|
updateElementPosition(e) {
|
|
730
730
|
if (this.isDestroyed || !this.element || !this.fullLayer)
|
|
731
731
|
return;
|
|
732
|
-
const { centerX: t, centerY: r, width: s, height: i, zIndex: a } = this.workOptions, n = this.manager.getPagePoint(t, r), c = s * this.manager.camera.scale,
|
|
733
|
-
(!e || e && !this.isSameSize(e)) && (this.element.setAttribute("width", `${c}`), this.element.setAttribute("height", `${
|
|
732
|
+
const { centerX: t, centerY: r, width: s, height: i, zIndex: a } = this.workOptions, n = this.manager.getPagePoint(t, r), c = s * this.manager.camera.scale, h = i * this.manager.camera.scale;
|
|
733
|
+
(!e || e && !this.isSameSize(e)) && (this.element.setAttribute("width", `${c}`), this.element.setAttribute("height", `${h}`), this.element.style.width = `${c}px`, this.element.style.height = `${h}px`), (!e || e && !this.isSamePosition(e)) && (this.element.style.left = `${n.x}px`, this.element.style.top = `${n.y}px`), (!e || e && !this.isSameZIndex(e)) && (this.element.style.zIndex = (a || 0).toString());
|
|
734
734
|
}
|
|
735
735
|
async updateSvg(e) {
|
|
736
736
|
const { type: t, state: r } = this.workOptions;
|
|
@@ -740,20 +740,20 @@ class ge {
|
|
|
740
740
|
this.element,
|
|
741
741
|
this.manager.markmapOptions
|
|
742
742
|
), this.markmapInstance.handleClick = async (n, c) => {
|
|
743
|
-
var
|
|
744
|
-
(
|
|
745
|
-
const
|
|
743
|
+
var p, d, f;
|
|
744
|
+
(p = this.markmapInstance) == null || p.toggleNode(c);
|
|
745
|
+
const h = this.serializeData((d = this.markmapInstance) == null ? void 0 : d.state.data);
|
|
746
746
|
this.setWorkOptions(
|
|
747
747
|
{
|
|
748
748
|
...this.workOptions,
|
|
749
|
-
state:
|
|
749
|
+
state: h
|
|
750
750
|
},
|
|
751
751
|
!1
|
|
752
|
-
),
|
|
752
|
+
), b.checkNodeHasMermaid(c) && await b.renderMermaidAfterDOMUpdate(
|
|
753
753
|
this.element,
|
|
754
754
|
this.workId
|
|
755
|
-
), this.scenePath && this.collector && ((
|
|
756
|
-
type:
|
|
755
|
+
), this.scenePath && this.collector && ((f = this.collector) == null || f.dispatch({
|
|
756
|
+
type: y.UpdateNode,
|
|
757
757
|
workId: this.workId,
|
|
758
758
|
opt: this.workOptions,
|
|
759
759
|
isSync: !0,
|
|
@@ -765,12 +765,12 @@ class ge {
|
|
|
765
765
|
L.setWorkId(this.workId);
|
|
766
766
|
const i = L.transform(s);
|
|
767
767
|
let { root: a } = i;
|
|
768
|
-
s && q(s) && (a =
|
|
768
|
+
s && q(s) && (a = b.injectMermaidHtml(a, s, this.workId));
|
|
769
769
|
try {
|
|
770
770
|
r && Array.isArray(r) && this.transformState(
|
|
771
771
|
r,
|
|
772
772
|
a
|
|
773
|
-
), await this.markmapInstance.setData(a), !this.isDestroyed && this.element && this.fullLayer && this.markmapInstance && (window.markmapInstance = this.markmapInstance, s && q(s) && await
|
|
773
|
+
), await this.markmapInstance.setData(a), !this.isDestroyed && this.element && this.fullLayer && this.markmapInstance && (window.markmapInstance = this.markmapInstance, s && q(s) && await b.renderMermaidAfterDOMUpdate(
|
|
774
774
|
this.element,
|
|
775
775
|
this.workId
|
|
776
776
|
), await this.fit(
|
|
@@ -799,7 +799,7 @@ class ge {
|
|
|
799
799
|
var t;
|
|
800
800
|
!this.isDestroyed && this.element && this.fullLayer && this.markmapInstance && (e && this.element && await U.waitForImagesInForeignObjects(
|
|
801
801
|
this.element
|
|
802
|
-
), await ((t = this.markmapInstance) == null ? void 0 : t.fit()), this.element &&
|
|
802
|
+
), await ((t = this.markmapInstance) == null ? void 0 : t.fit()), this.element && b.isSafari() && b.hasMermaidSvg(this.element) && (await G(this.element), await b.transformMermaidSvgToMarkmapSvg(
|
|
803
803
|
this.element
|
|
804
804
|
)));
|
|
805
805
|
}
|
|
@@ -844,7 +844,7 @@ class ge {
|
|
|
844
844
|
function X(o) {
|
|
845
845
|
const { toolsType: e, ...t } = o;
|
|
846
846
|
switch (e) {
|
|
847
|
-
case
|
|
847
|
+
case M.BackgroundSVG:
|
|
848
848
|
return new ge(t);
|
|
849
849
|
default:
|
|
850
850
|
return;
|
|
@@ -852,9 +852,9 @@ function X(o) {
|
|
|
852
852
|
}
|
|
853
853
|
class Y {
|
|
854
854
|
constructor(e) {
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
855
|
+
u(this, "viewId");
|
|
856
|
+
u(this, "fullLayer");
|
|
857
|
+
u(this, "curNodeMap");
|
|
858
858
|
this.viewId = e, this.curNodeMap = new te();
|
|
859
859
|
}
|
|
860
860
|
init(e) {
|
|
@@ -889,14 +889,14 @@ class Y {
|
|
|
889
889
|
}
|
|
890
890
|
class fe {
|
|
891
891
|
constructor(e, t) {
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
892
|
+
u(this, "opt");
|
|
893
|
+
u(this, "viewId");
|
|
894
|
+
u(this, "fullLayer");
|
|
895
|
+
u(this, "vNodes");
|
|
896
|
+
u(this, "master");
|
|
897
|
+
u(this, "cameraOpt");
|
|
898
|
+
u(this, "methodBuilder");
|
|
899
|
+
u(this, "updateCamera", Q(async (e) => {
|
|
900
900
|
const { cameraOpt: t } = e;
|
|
901
901
|
t && !W(this.cameraOpt, t) && await this.setCameraOpt(t);
|
|
902
902
|
}, 100));
|
|
@@ -938,13 +938,13 @@ class fe {
|
|
|
938
938
|
this.vNodes.clear();
|
|
939
939
|
}
|
|
940
940
|
canUseFullLayer(e) {
|
|
941
|
-
return e ===
|
|
941
|
+
return e === M.BackgroundSVG;
|
|
942
942
|
}
|
|
943
943
|
async consumeFull(e) {
|
|
944
944
|
const { toolsType: t, opt: r, workId: s } = e;
|
|
945
945
|
if (s != null && s.toString() && t && this.canUseFullLayer(t))
|
|
946
946
|
switch (t) {
|
|
947
|
-
case
|
|
947
|
+
case M.BackgroundSVG:
|
|
948
948
|
await this.setFullWork({
|
|
949
949
|
toolsType: t,
|
|
950
950
|
opt: r,
|
|
@@ -961,7 +961,7 @@ class fe {
|
|
|
961
961
|
const n = this.vNodes.get(i);
|
|
962
962
|
return !n || !n.workShape ? (a = this.createWorkShapeNode({
|
|
963
963
|
toolsOpt: r,
|
|
964
|
-
toolsType:
|
|
964
|
+
toolsType: M.BackgroundSVG,
|
|
965
965
|
workId: i
|
|
966
966
|
}), a && await a.init()) : (a = n.workShape, await a.setWorkOptions(r)), a;
|
|
967
967
|
}
|
|
@@ -984,29 +984,29 @@ class fe {
|
|
|
984
984
|
if (!await this.methodBuilder.consumeForBackgroundThread(e)) {
|
|
985
985
|
const { msgType: t, toolsType: r } = e;
|
|
986
986
|
switch (t) {
|
|
987
|
-
case
|
|
987
|
+
case y.Destroy: {
|
|
988
988
|
this.destroy();
|
|
989
989
|
break;
|
|
990
990
|
}
|
|
991
|
-
case
|
|
991
|
+
case y.Clear: {
|
|
992
992
|
this.clearAll();
|
|
993
993
|
break;
|
|
994
994
|
}
|
|
995
|
-
case
|
|
995
|
+
case y.UpdateCamera: {
|
|
996
996
|
this.updateCamera(e);
|
|
997
997
|
break;
|
|
998
998
|
}
|
|
999
|
-
case
|
|
1000
|
-
this.toggleFullLayer(r ===
|
|
999
|
+
case y.UpdateTools: {
|
|
1000
|
+
this.toggleFullLayer(r === M.Clicker);
|
|
1001
1001
|
break;
|
|
1002
1002
|
}
|
|
1003
|
-
case
|
|
1004
|
-
case
|
|
1005
|
-
case
|
|
1003
|
+
case y.BackgroundSVGUpdate:
|
|
1004
|
+
case y.UpdateNode:
|
|
1005
|
+
case y.FullWork: {
|
|
1006
1006
|
r && this.canUseFullLayer(r) && await this.consumeFull(e);
|
|
1007
1007
|
break;
|
|
1008
1008
|
}
|
|
1009
|
-
case
|
|
1009
|
+
case y.BackgroundSVGDelete: {
|
|
1010
1010
|
this.removeWork(e);
|
|
1011
1011
|
break;
|
|
1012
1012
|
}
|
|
@@ -1025,13 +1025,13 @@ class fe {
|
|
|
1025
1025
|
}
|
|
1026
1026
|
class we {
|
|
1027
1027
|
constructor(e, t) {
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1028
|
+
u(this, "viewId");
|
|
1029
|
+
u(this, "fullLayer");
|
|
1030
|
+
u(this, "master");
|
|
1031
|
+
u(this, "vNodes");
|
|
1032
|
+
u(this, "cameraOpt");
|
|
1033
|
+
u(this, "opt");
|
|
1034
|
+
u(this, "workShapes", /* @__PURE__ */ new Map());
|
|
1035
1035
|
this.viewId = e, this.opt = t, this.master = t.master, this.fullLayer = t.container, this.vNodes = new Y(e), this.vNodes.init(this.fullLayer);
|
|
1036
1036
|
}
|
|
1037
1037
|
get camera() {
|
|
@@ -1076,15 +1076,15 @@ class we {
|
|
|
1076
1076
|
if (t && r && s) {
|
|
1077
1077
|
await this.setCameraOpt(s);
|
|
1078
1078
|
for (const [i, a] of Object.entries(r))
|
|
1079
|
-
if (a != null && a.type && (a == null ? void 0 : a.toolsType) ===
|
|
1079
|
+
if (a != null && a.type && (a == null ? void 0 : a.toolsType) === M.BackgroundSVG)
|
|
1080
1080
|
switch (a == null ? void 0 : a.type) {
|
|
1081
|
-
case
|
|
1082
|
-
case
|
|
1081
|
+
case y.UpdateNode:
|
|
1082
|
+
case y.FullWork: {
|
|
1083
1083
|
const { opt: n } = a, c = {
|
|
1084
1084
|
...a,
|
|
1085
1085
|
opt: n,
|
|
1086
1086
|
workId: i,
|
|
1087
|
-
msgType:
|
|
1087
|
+
msgType: y.FullWork,
|
|
1088
1088
|
dataType: D.Service,
|
|
1089
1089
|
viewId: this.viewId
|
|
1090
1090
|
};
|
|
@@ -1094,12 +1094,12 @@ class we {
|
|
|
1094
1094
|
}
|
|
1095
1095
|
try {
|
|
1096
1096
|
if (t) {
|
|
1097
|
-
await G(this.fullLayer), await de(this.fullLayer), await
|
|
1098
|
-
const i = await
|
|
1097
|
+
await G(this.fullLayer), await de(this.fullLayer), await pe(this.fullLayer);
|
|
1098
|
+
const i = await ue(this.fullLayer);
|
|
1099
1099
|
i && this.opt.post({
|
|
1100
1100
|
sp: [
|
|
1101
1101
|
{
|
|
1102
|
-
type:
|
|
1102
|
+
type: y.Snapshot,
|
|
1103
1103
|
scenePath: t,
|
|
1104
1104
|
imageElement: i,
|
|
1105
1105
|
viewId: this.viewId,
|
|
@@ -1113,7 +1113,7 @@ class we {
|
|
|
1113
1113
|
this.opt.post({
|
|
1114
1114
|
sp: [
|
|
1115
1115
|
{
|
|
1116
|
-
type:
|
|
1116
|
+
type: y.ReportError,
|
|
1117
1117
|
reportString: `[SnapshotThreadImpl] getSnapshotRender error: ${a}`
|
|
1118
1118
|
}
|
|
1119
1119
|
]
|
|
@@ -1136,7 +1136,7 @@ class we {
|
|
|
1136
1136
|
const n = this.vNodes.get(i);
|
|
1137
1137
|
return !n || !n.workShape ? (a = this.createWorkShapeNode({
|
|
1138
1138
|
toolsOpt: r,
|
|
1139
|
-
toolsType:
|
|
1139
|
+
toolsType: M.BackgroundSVG,
|
|
1140
1140
|
workId: i
|
|
1141
1141
|
}), a && await a.init()) : (a = n.workShape, await a.setWorkOptions(r)), a;
|
|
1142
1142
|
}
|
|
@@ -1155,10 +1155,10 @@ class we {
|
|
|
1155
1155
|
}
|
|
1156
1156
|
class Ne {
|
|
1157
1157
|
constructor(e) {
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1158
|
+
u(this, "backgroundThreadMap", /* @__PURE__ */ new Map());
|
|
1159
|
+
u(this, "snapshotThread");
|
|
1160
|
+
u(this, "master");
|
|
1161
|
+
u(this, "post", (e) => {
|
|
1162
1162
|
const { sp: t } = e;
|
|
1163
1163
|
t && this.master.collectorSyncData(t);
|
|
1164
1164
|
});
|
|
@@ -1171,75 +1171,78 @@ class Ne {
|
|
|
1171
1171
|
return new we(e, t);
|
|
1172
1172
|
}
|
|
1173
1173
|
async consume(e) {
|
|
1174
|
-
var t, r, s, i, a;
|
|
1175
|
-
for (const
|
|
1174
|
+
var t, r, s, i, a, n;
|
|
1175
|
+
for (const c of e.values()) {
|
|
1176
1176
|
const {
|
|
1177
|
-
msgType:
|
|
1178
|
-
viewId:
|
|
1179
|
-
layerOpt:
|
|
1180
|
-
offscreenCanvasOpt:
|
|
1181
|
-
cameraOpt:
|
|
1182
|
-
tasksqueue:
|
|
1183
|
-
mainTasksqueueCount:
|
|
1184
|
-
} =
|
|
1185
|
-
if (
|
|
1177
|
+
msgType: h,
|
|
1178
|
+
viewId: g,
|
|
1179
|
+
layerOpt: p,
|
|
1180
|
+
offscreenCanvasOpt: d,
|
|
1181
|
+
cameraOpt: f,
|
|
1182
|
+
tasksqueue: w,
|
|
1183
|
+
mainTasksqueueCount: v
|
|
1184
|
+
} = c;
|
|
1185
|
+
if (h === y.Console) {
|
|
1186
1186
|
console.log(this);
|
|
1187
1187
|
continue;
|
|
1188
1188
|
}
|
|
1189
|
-
if (
|
|
1190
|
-
const
|
|
1191
|
-
if (
|
|
1192
|
-
const
|
|
1193
|
-
|
|
1189
|
+
if (h === y.Init) {
|
|
1190
|
+
const l = (t = this.master.control.viewContainerManager.getView(g)) == null ? void 0 : t.displayer, m = (r = l == null ? void 0 : l.backgroundContainerRef) == null ? void 0 : r.current;
|
|
1191
|
+
if (l && m && p && d) {
|
|
1192
|
+
const S = this.backgroundThreadMap.get(g);
|
|
1193
|
+
S == null || S.destroy();
|
|
1194
|
+
const k = this.createBackgroundThread(g, {
|
|
1195
|
+
displayer: l,
|
|
1194
1196
|
container: m,
|
|
1195
|
-
layerOpt:
|
|
1197
|
+
layerOpt: p,
|
|
1196
1198
|
master: this.master,
|
|
1197
|
-
canvasOpt:
|
|
1199
|
+
canvasOpt: d,
|
|
1198
1200
|
post: this.post
|
|
1199
1201
|
});
|
|
1200
|
-
this.backgroundThreadMap.set(
|
|
1202
|
+
this.backgroundThreadMap.set(g, k), k && f && await k.setCameraOpt(f);
|
|
1201
1203
|
}
|
|
1202
1204
|
continue;
|
|
1203
1205
|
}
|
|
1204
|
-
if (
|
|
1205
|
-
const
|
|
1206
|
-
if (
|
|
1207
|
-
|
|
1208
|
-
const
|
|
1206
|
+
if (h === y.Snapshot) {
|
|
1207
|
+
const l = (s = this.master.control.viewContainerManager.getView(g)) == null ? void 0 : s.displayer, S = (a = ((i = this.master.control.viewContainerManager.mainView) == null ? void 0 : i.displayer).backgroundSnapshotContainerRef) == null ? void 0 : a.current;
|
|
1208
|
+
if (l && S && f) {
|
|
1209
|
+
(n = this.snapshotThread) == null || n.destroy(), S.style.width = `${f.width}px`, S.style.height = `${f.height}px`;
|
|
1210
|
+
const k = {
|
|
1209
1211
|
...P.defaultLayerOpt,
|
|
1210
1212
|
offscreen: !1,
|
|
1211
|
-
width:
|
|
1212
|
-
height:
|
|
1213
|
-
},
|
|
1213
|
+
width: f.width,
|
|
1214
|
+
height: f.height
|
|
1215
|
+
}, x = {
|
|
1214
1216
|
...P.defaultScreenCanvasOpt,
|
|
1215
|
-
width:
|
|
1216
|
-
height:
|
|
1217
|
+
width: f.width,
|
|
1218
|
+
height: f.height
|
|
1217
1219
|
};
|
|
1218
|
-
this.snapshotThread = this.createSnapshotThread(
|
|
1219
|
-
displayer:
|
|
1220
|
-
container:
|
|
1221
|
-
layerOpt:
|
|
1220
|
+
this.snapshotThread = this.createSnapshotThread(g, {
|
|
1221
|
+
displayer: l,
|
|
1222
|
+
container: S,
|
|
1223
|
+
layerOpt: k,
|
|
1222
1224
|
master: this.master,
|
|
1223
|
-
canvasOpt:
|
|
1225
|
+
canvasOpt: x,
|
|
1224
1226
|
post: this.post
|
|
1225
|
-
}), await this.snapshotThread.getSnapshot(
|
|
1227
|
+
}), await this.snapshotThread.getSnapshot(c), this.snapshotThread.destroy(), this.snapshotThread = void 0;
|
|
1226
1228
|
continue;
|
|
1227
1229
|
}
|
|
1228
1230
|
}
|
|
1229
|
-
if (
|
|
1230
|
-
for (const [
|
|
1231
|
-
const
|
|
1232
|
-
|
|
1231
|
+
if (h === y.TasksQueue && (w != null && w.size)) {
|
|
1232
|
+
for (const [l, m] of this.backgroundThreadMap.entries()) {
|
|
1233
|
+
const S = w.get(l);
|
|
1234
|
+
S && (await m.on(S), v && this.post({ workerTasksqueueCount: v }));
|
|
1233
1235
|
}
|
|
1234
1236
|
continue;
|
|
1235
1237
|
}
|
|
1236
|
-
if (
|
|
1237
|
-
for (const
|
|
1238
|
-
|
|
1238
|
+
if (g === Z) {
|
|
1239
|
+
for (const l of this.backgroundThreadMap.values())
|
|
1240
|
+
await l.on(c);
|
|
1241
|
+
h === y.Destroy && this.backgroundThreadMap.clear();
|
|
1239
1242
|
continue;
|
|
1240
1243
|
}
|
|
1241
|
-
const
|
|
1242
|
-
|
|
1244
|
+
const I = this.backgroundThreadMap.get(g);
|
|
1245
|
+
I && (await I.on(c), h === y.Destroy && this.backgroundThreadMap.delete(g));
|
|
1243
1246
|
}
|
|
1244
1247
|
}
|
|
1245
1248
|
async consumeTargetOne(e, t) {
|
|
@@ -1247,6 +1250,10 @@ class Ne {
|
|
|
1247
1250
|
r && await r.on(t);
|
|
1248
1251
|
}
|
|
1249
1252
|
destroy() {
|
|
1253
|
+
var e;
|
|
1254
|
+
(e = this.snapshotThread) == null || e.destroy(), this.snapshotThread = void 0;
|
|
1255
|
+
for (const t of this.backgroundThreadMap.values())
|
|
1256
|
+
t.destroy();
|
|
1250
1257
|
this.backgroundThreadMap.clear();
|
|
1251
1258
|
}
|
|
1252
1259
|
}
|