@mica-js/editor 0.13.0 → 0.15.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/README.md +11 -3
- package/dist/fused-html.d.ts +10 -42
- package/dist/fused-html.js +1 -1
- package/dist/fused-runtime.d.ts +125 -3
- package/dist/fused-runtime.js +2 -2
- package/dist/fused.d.ts +92 -0
- package/dist/fused.js +265 -98
- package/dist/fused.js.map +1 -1
- package/dist/{html-HXwZq1my.js → html-B0pN-5Mx.js} +31 -71
- package/dist/html-B0pN-5Mx.js.map +1 -0
- package/dist/{runtime-hyeAcSP7.js → runtime-DuxZ_yVl.js} +699 -82
- package/dist/runtime-DuxZ_yVl.js.map +1 -0
- package/dist/style.css +54 -19
- package/dist/view-environment/environment-sw.js +78 -160
- package/dist/view-environment/environment.js +227 -130
- package/dist/{wire-BDHL5Aj9.js → wire-Di4FVpnu.js} +11 -4
- package/dist/wire-Di4FVpnu.js.map +1 -0
- package/dist/workers-BpHcfNEu.js +34 -0
- package/dist/{workers-Og_Z_xzw.js.map → workers-BpHcfNEu.js.map} +1 -1
- package/package.json +2 -2
- package/dist/html-HXwZq1my.js.map +0 -1
- package/dist/runtime-hyeAcSP7.js.map +0 -1
- package/dist/wire-BDHL5Aj9.js.map +0 -1
- package/dist/workers-Og_Z_xzw.js +0 -34
|
@@ -324,9 +324,12 @@ function l(e) {
|
|
|
324
324
|
//#endregion
|
|
325
325
|
//#region src/fused/runtime/wire.ts
|
|
326
326
|
function u(e) {
|
|
327
|
+
return !(e instanceof Uint8Array) || !(e.buffer instanceof ArrayBuffer) || e.byteOffset !== 0 || e.byteLength !== e.buffer.byteLength ? [] : [e.buffer];
|
|
328
|
+
}
|
|
329
|
+
function d(e) {
|
|
327
330
|
return e instanceof Error ? e.message : String(e);
|
|
328
331
|
}
|
|
329
|
-
var
|
|
332
|
+
var f = "environment-sw.js", p = [
|
|
330
333
|
"default-src 'none'",
|
|
331
334
|
"script-src 'self' 'unsafe-inline'",
|
|
332
335
|
"style-src 'self' 'unsafe-inline'",
|
|
@@ -353,7 +356,7 @@ var d = "environment-sw.js", f = [
|
|
|
353
356
|
"form-action 'none'",
|
|
354
357
|
"base-uri 'self'"
|
|
355
358
|
].join("; ");
|
|
356
|
-
function
|
|
359
|
+
function m(e, t) {
|
|
357
360
|
let n = e.href.endsWith("/") ? e.href : `${e.href}/`, r = t.lastIndexOf("/");
|
|
358
361
|
return r <= 0 ? n : `${n}${t.slice(0, r + 1)}`;
|
|
359
362
|
}
|
|
@@ -381,11 +384,11 @@ Object.freeze({
|
|
|
381
384
|
txt: "text/plain; charset=utf-8",
|
|
382
385
|
bin: "application/octet-stream"
|
|
383
386
|
});
|
|
384
|
-
function
|
|
387
|
+
function h(e, t) {
|
|
385
388
|
let n = [
|
|
386
389
|
"<meta charset=\"utf-8\">",
|
|
387
|
-
`<meta http-equiv="Content-Security-Policy" content="${
|
|
388
|
-
`<base href="${
|
|
390
|
+
`<meta http-equiv="Content-Security-Policy" content="${y(t.policy)}">`,
|
|
391
|
+
`<base href="${y(t.base)}">`,
|
|
389
392
|
`<style>${t.style.replace(/<\/style/gi, "<\\/style")}</style>`
|
|
390
393
|
].join(""), r = /<head\b[^>]*>/i.exec(e);
|
|
391
394
|
if (r !== null) {
|
|
@@ -404,28 +407,113 @@ function m(e, t) {
|
|
|
404
407
|
}
|
|
405
408
|
return `<head>${n}</head>${e}`;
|
|
406
409
|
}
|
|
407
|
-
var
|
|
408
|
-
function
|
|
410
|
+
var g = /^https?:\/\/[^/]+$/;
|
|
411
|
+
function _(e) {
|
|
409
412
|
if (e !== void 0 && e !== "") try {
|
|
410
413
|
let t = new URL(e);
|
|
411
|
-
return t.protocol !== "http:" && t.protocol !== "https:" ? void 0 :
|
|
414
|
+
return t.protocol !== "http:" && t.protocol !== "https:" ? void 0 : g.test(t.origin) ? t.origin : void 0;
|
|
412
415
|
} catch {
|
|
413
416
|
return;
|
|
414
417
|
}
|
|
415
418
|
}
|
|
416
|
-
function
|
|
419
|
+
function v(e) {
|
|
417
420
|
return new TextDecoder().decode(e).replace(/^\uFEFF/, "");
|
|
418
421
|
}
|
|
419
|
-
function
|
|
422
|
+
function y(e) {
|
|
420
423
|
return e.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<");
|
|
421
424
|
}
|
|
422
|
-
var
|
|
425
|
+
var b = "mica:view:ack", x = "mica:view:attach-ack", S = "mica:view:child-connect", C = "view";
|
|
423
426
|
l("fused-html-host");
|
|
424
|
-
var
|
|
425
|
-
l("fused-html-
|
|
427
|
+
var w = l("fused-html-host-control"), T = l("fused-html-asset");
|
|
428
|
+
l("fused-html-content-view");
|
|
429
|
+
//#endregion
|
|
430
|
+
//#region src/fused/html/environment/asset-grant.ts
|
|
431
|
+
var E = 16, D = /* @__PURE__ */ new Set(["nested"]), O = class {
|
|
432
|
+
#e;
|
|
433
|
+
#t;
|
|
434
|
+
#n;
|
|
435
|
+
constructor(e) {
|
|
436
|
+
this.#e = P(e), this.#t = new URL(e).origin;
|
|
437
|
+
}
|
|
438
|
+
get scope() {
|
|
439
|
+
return this.#e;
|
|
440
|
+
}
|
|
441
|
+
get active() {
|
|
442
|
+
return this.#n === void 0 ? void 0 : k(this.#n);
|
|
443
|
+
}
|
|
444
|
+
grant(e, t) {
|
|
445
|
+
let n = A(e), r = j(e), i = N(t);
|
|
446
|
+
if (n !== void 0 && r !== void 0 && i !== void 0 && F(r, this.#e) && this.#r(t)) return this.#n = {
|
|
447
|
+
token: n,
|
|
448
|
+
root: r,
|
|
449
|
+
parentClientId: i,
|
|
450
|
+
childClientId: void 0
|
|
451
|
+
}, k(this.#n);
|
|
452
|
+
}
|
|
453
|
+
attach(e, t) {
|
|
454
|
+
let n = this.#n;
|
|
455
|
+
if (n === void 0) return;
|
|
456
|
+
let r = A(e), i = N(t);
|
|
457
|
+
if (r !== void 0 && r === n.token && i !== void 0 && M(t) && this.#r(t)) return i !== n.parentClientId && (n.childClientId = i), k(n);
|
|
458
|
+
}
|
|
459
|
+
#r(e) {
|
|
460
|
+
let t = e?.url;
|
|
461
|
+
if (t === void 0 || t === "") return !0;
|
|
462
|
+
let n;
|
|
463
|
+
try {
|
|
464
|
+
n = new URL(t);
|
|
465
|
+
} catch {
|
|
466
|
+
return !1;
|
|
467
|
+
}
|
|
468
|
+
return n.origin === this.#t && F(n.pathname, this.#e);
|
|
469
|
+
}
|
|
470
|
+
serves(e) {
|
|
471
|
+
let t = this.#n;
|
|
472
|
+
if (t === void 0) return;
|
|
473
|
+
let n = N({ id: e });
|
|
474
|
+
if (n !== void 0) return n === t.parentClientId || n === t.childClientId ? t.root : void 0;
|
|
475
|
+
}
|
|
476
|
+
clear() {
|
|
477
|
+
this.#n = void 0;
|
|
478
|
+
}
|
|
479
|
+
};
|
|
480
|
+
function k(e) {
|
|
481
|
+
return Object.freeze({
|
|
482
|
+
token: e.token,
|
|
483
|
+
root: e.root,
|
|
484
|
+
parentClientId: e.parentClientId,
|
|
485
|
+
childClientId: e.childClientId
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
function A(e) {
|
|
489
|
+
if (typeof e != "object" || !e) return;
|
|
490
|
+
let t = e.token;
|
|
491
|
+
if (!(typeof t != "string" || t.length < E)) return t;
|
|
492
|
+
}
|
|
493
|
+
function j(e) {
|
|
494
|
+
if (typeof e != "object" || !e) return;
|
|
495
|
+
let t = e.root;
|
|
496
|
+
if (typeof t == "string" && t.endsWith("/") && !(!t.startsWith("/") || t.includes("\\") || t.includes("?") || t.includes("#")) && !t.split("/").some((e) => e === "." || e === "..")) return t;
|
|
497
|
+
}
|
|
498
|
+
function M(e) {
|
|
499
|
+
let t = e?.frameType;
|
|
500
|
+
return t === void 0 || D.has(t);
|
|
501
|
+
}
|
|
502
|
+
function N(e) {
|
|
503
|
+
let t = e?.id;
|
|
504
|
+
return typeof t == "string" && t.length > 0 ? t : void 0;
|
|
505
|
+
}
|
|
506
|
+
function P(e) {
|
|
507
|
+
let t = new URL(e).pathname;
|
|
508
|
+
return t.endsWith("/") ? t : `${t}/`;
|
|
509
|
+
}
|
|
510
|
+
function F(e, t) {
|
|
511
|
+
let n = t.endsWith("/") ? t : `${t}/`;
|
|
512
|
+
return e !== n && e.startsWith(n);
|
|
513
|
+
}
|
|
426
514
|
//#endregion
|
|
427
515
|
//#region src/fused/theme.ts
|
|
428
|
-
var
|
|
516
|
+
var I = Object.freeze({
|
|
429
517
|
"workbench.background": "--mica-bg",
|
|
430
518
|
"workbench.foreground": "--mica-text",
|
|
431
519
|
"workbench.mutedForeground": "--mica-muted",
|
|
@@ -443,7 +531,7 @@ var w = Object.freeze({
|
|
|
443
531
|
"canvas.selection": "--mica-canvas-selection",
|
|
444
532
|
"error.foreground": "--mica-error",
|
|
445
533
|
shadow: "--mica-shadow"
|
|
446
|
-
}),
|
|
534
|
+
}), L = Object.freeze({
|
|
447
535
|
"workbench.background": "#1c1c1c",
|
|
448
536
|
"workbench.foreground": "#e5e5e5",
|
|
449
537
|
"workbench.mutedForeground": "#a3a3a3",
|
|
@@ -461,7 +549,7 @@ var w = Object.freeze({
|
|
|
461
549
|
"canvas.selection": "#eeeeee",
|
|
462
550
|
"error.foreground": "#f28b82",
|
|
463
551
|
shadow: "#00000055"
|
|
464
|
-
}),
|
|
552
|
+
}), ee = Object.freeze({
|
|
465
553
|
"workbench.background": "#ffffff",
|
|
466
554
|
"workbench.foreground": "#263247",
|
|
467
555
|
"workbench.mutedForeground": "#748098",
|
|
@@ -479,175 +567,177 @@ var w = Object.freeze({
|
|
|
479
567
|
"canvas.selection": "#4285ff",
|
|
480
568
|
"error.foreground": "#b43b35",
|
|
481
569
|
shadow: "#00000022"
|
|
482
|
-
}),
|
|
570
|
+
}), R = Object.freeze({
|
|
483
571
|
appearance: "dark",
|
|
484
|
-
colors:
|
|
485
|
-
}),
|
|
486
|
-
function
|
|
487
|
-
return e.colors[
|
|
572
|
+
colors: L
|
|
573
|
+
}), z = Object.keys(I), B = "panel.background";
|
|
574
|
+
function V(e) {
|
|
575
|
+
return e.colors[B];
|
|
488
576
|
}
|
|
489
|
-
var
|
|
490
|
-
function
|
|
577
|
+
var H = /[;{}<>\\]/;
|
|
578
|
+
function U(e) {
|
|
491
579
|
if (typeof e != "object" || !e) throw TypeError("An HTML view theme must be an object");
|
|
492
580
|
let t = e, n = t.appearance ?? "dark";
|
|
493
581
|
if (n !== "dark" && n !== "light") throw TypeError(`Unknown HTML view theme appearance: ${String(n)}`);
|
|
494
|
-
let r = { ...n === "dark" ?
|
|
582
|
+
let r = { ...n === "dark" ? L : ee }, i = t.colors;
|
|
495
583
|
if (i != null) {
|
|
496
584
|
if (typeof i != "object") throw TypeError("HTML view theme colors must be an object");
|
|
497
585
|
for (let [e, t] of Object.entries(i)) {
|
|
498
|
-
if (!Object.hasOwn(
|
|
499
|
-
r[e] =
|
|
586
|
+
if (!Object.hasOwn(I, e)) throw TypeError(`Unknown HTML view theme token: ${e}`);
|
|
587
|
+
r[e] = W(e, t);
|
|
500
588
|
}
|
|
501
589
|
}
|
|
502
|
-
for (let e of
|
|
590
|
+
for (let e of z) r[e] ??= W(e, L[e]);
|
|
503
591
|
return Object.freeze({
|
|
504
592
|
appearance: n,
|
|
505
593
|
colors: Object.freeze(r)
|
|
506
594
|
});
|
|
507
595
|
}
|
|
508
|
-
function
|
|
596
|
+
function W(e, t) {
|
|
509
597
|
if (typeof t != "string" || t.trim() === "") throw TypeError(`HTML view theme token ${e} must be a non-empty CSS color`);
|
|
510
|
-
if (
|
|
598
|
+
if (H.test(t)) throw TypeError(`HTML view theme token ${e} must be a plain CSS color`);
|
|
511
599
|
return t.trim();
|
|
512
600
|
}
|
|
513
|
-
function
|
|
514
|
-
let t =
|
|
515
|
-
return t.push(`color-scheme:${e.appearance}`), `:root{background-color:${
|
|
601
|
+
function G(e) {
|
|
602
|
+
let t = z.map((t) => `${I[t]}:${e.colors[t]}`);
|
|
603
|
+
return t.push(`color-scheme:${e.appearance}`), `:root{background-color:${V(e)};${t.join(";")}}`;
|
|
516
604
|
}
|
|
517
|
-
function
|
|
605
|
+
function K(e, t) {
|
|
518
606
|
let n = e.style;
|
|
519
|
-
for (let e of
|
|
520
|
-
n.setProperty("color-scheme", t.appearance), n.setProperty("background-color",
|
|
607
|
+
for (let e of z) n.setProperty(I[e], t.colors[e]);
|
|
608
|
+
n.setProperty("color-scheme", t.appearance), n.setProperty("background-color", V(t));
|
|
521
609
|
}
|
|
522
610
|
//#endregion
|
|
523
611
|
//#region src/fused/html/environment/entry.ts
|
|
524
|
-
async function
|
|
525
|
-
let t = e.window ?? globalThis.window, n = e.document ?? t.document, { message: r, port: i } = await
|
|
612
|
+
async function q(e = {}) {
|
|
613
|
+
let t = e.window ?? globalThis.window, n = e.document ?? t.document, { message: r, port: i } = await re(t, e.handshakeTimeoutMs ?? 15e3);
|
|
526
614
|
t.parent.postMessage({
|
|
527
|
-
type:
|
|
615
|
+
type: b,
|
|
528
616
|
token: r.token
|
|
529
617
|
}, r.parentOrigin);
|
|
530
|
-
let o = a(i).getProxy(
|
|
531
|
-
|
|
532
|
-
},
|
|
618
|
+
let o = a(i), s = o.getProxy(w), c = (e, t) => {
|
|
619
|
+
s.reportFailure(e, t).catch(() => void 0);
|
|
620
|
+
}, l = Y(s, c, n);
|
|
533
621
|
try {
|
|
534
|
-
await
|
|
622
|
+
await l.load();
|
|
623
|
+
let i = await ie(t, e.workerTimeoutMs ?? 1e4);
|
|
624
|
+
o.onDidClose(ae(i, new URL(".", t.location.href), r, s)), J({
|
|
535
625
|
window: t,
|
|
536
626
|
document: n,
|
|
537
|
-
control:
|
|
627
|
+
control: s,
|
|
538
628
|
message: r,
|
|
539
|
-
authored:
|
|
540
|
-
theme:
|
|
629
|
+
authored: v(await s.readAsset(r.target.entry)),
|
|
630
|
+
theme: l,
|
|
541
631
|
contentUrl: e.contentUrl ?? new URL("content.html", import.meta.url).href,
|
|
542
632
|
budgetMs: e.contentTimeoutMs ?? 15e3,
|
|
543
|
-
report:
|
|
633
|
+
report: c
|
|
544
634
|
}), t.addEventListener("pagehide", () => {
|
|
545
635
|
try {
|
|
546
|
-
|
|
636
|
+
s.closed();
|
|
547
637
|
} catch {}
|
|
548
638
|
});
|
|
549
639
|
} catch (e) {
|
|
550
|
-
throw
|
|
640
|
+
throw c("view/load-failed", d(e)), e;
|
|
551
641
|
}
|
|
552
642
|
}
|
|
553
|
-
function
|
|
554
|
-
let { window: t, document: n, control: r, message: i, authored: a, theme: o, report: s } = e, c = i.target, l =
|
|
643
|
+
function J(e) {
|
|
644
|
+
let { window: t, document: n, control: r, message: i, authored: a, theme: o, report: s } = e, c = i.target, l = _(t.location.href);
|
|
555
645
|
if (l === void 0) throw Error("The environment page has no concrete origin.");
|
|
556
|
-
let
|
|
557
|
-
if (
|
|
558
|
-
|
|
559
|
-
let
|
|
560
|
-
|
|
561
|
-
let v = !1, y = !1, b = !1,
|
|
562
|
-
|
|
646
|
+
let u = se(), f = new URL(e.contentUrl);
|
|
647
|
+
if (_(f.href) !== l) throw Error("The content document must be served from the environment origin.");
|
|
648
|
+
f.searchParams.set(C, u);
|
|
649
|
+
let g = n.createElement("iframe");
|
|
650
|
+
g.className = "mica-html-view-document", g.title = `${c.title} — ${c.device}`, g.setAttribute("sandbox", "allow-scripts allow-same-origin"), g.setAttribute("referrerpolicy", "no-referrer"), g.setAttribute("allow", ""), g.style.display = "block", g.style.width = "100%", g.style.height = "100%", g.style.border = "0", g.style.background = V(o.current), o.track(g);
|
|
651
|
+
let v = !1, y = !1, b = !1, x = !1, w, T, E = (e) => {
|
|
652
|
+
x || (x = !0, D(), s("view/execution-failed", e));
|
|
563
653
|
}, D = () => {
|
|
564
654
|
T !== void 0 && (clearTimeout(T), T = void 0);
|
|
565
655
|
}, O = (e) => {
|
|
566
656
|
let t = e.data;
|
|
567
|
-
typeof t == "object" && t && t.type === "mica:view:child-hello" && t.token ===
|
|
568
|
-
if (v ||
|
|
657
|
+
typeof t == "object" && t && t.type === "mica:view:child-hello" && t.token === u && e.source === g.contentWindow && e.origin === l && (x || (v || y ? E("The HTML view document started twice.") : (y = !0, D(), r.contentPort().then((e) => {
|
|
658
|
+
if (v || x) {
|
|
569
659
|
e.close();
|
|
570
660
|
return;
|
|
571
661
|
}
|
|
572
|
-
let t =
|
|
662
|
+
let t = g.contentWindow;
|
|
573
663
|
if (t === null) {
|
|
574
664
|
e.close(), E("The HTML view document frame is not available.");
|
|
575
665
|
return;
|
|
576
666
|
}
|
|
577
|
-
if (
|
|
667
|
+
if (!$(g, f.href)) {
|
|
578
668
|
e.close(), E("The HTML view navigated away from its author document.");
|
|
579
669
|
return;
|
|
580
670
|
}
|
|
581
671
|
y = !1, v = !0;
|
|
582
672
|
let n = {
|
|
583
|
-
type:
|
|
584
|
-
token:
|
|
673
|
+
type: S,
|
|
674
|
+
token: u
|
|
585
675
|
};
|
|
586
676
|
try {
|
|
587
677
|
t.postMessage(n, l, [e]);
|
|
588
678
|
} catch (e) {
|
|
589
|
-
E(`The HTML view bridge port was rejected: ${
|
|
679
|
+
E(`The HTML view bridge port was rejected: ${d(e)}`);
|
|
590
680
|
}
|
|
591
681
|
}, (e) => {
|
|
592
|
-
v ||
|
|
682
|
+
v || x || E(`The HTML view bridge port was not granted: ${d(e)}`);
|
|
593
683
|
}))));
|
|
594
684
|
}, k = (e) => {
|
|
595
685
|
let t = e.data;
|
|
596
|
-
if (typeof t == "object" && t && t.type === "mica:view:child-prepared" && t.token ===
|
|
686
|
+
if (typeof t == "object" && t && t.type === "mica:view:child-prepared" && t.token === u && e.source === g.contentWindow && e.origin === l && v && !x) {
|
|
597
687
|
try {
|
|
598
|
-
|
|
688
|
+
A();
|
|
599
689
|
} catch (e) {
|
|
600
|
-
E(
|
|
690
|
+
E(d(e));
|
|
601
691
|
return;
|
|
602
692
|
}
|
|
603
693
|
r.ready().catch((e) => {
|
|
604
|
-
E(`The HTML view was not reported ready: ${
|
|
694
|
+
E(`The HTML view was not reported ready: ${d(e)}`);
|
|
605
695
|
});
|
|
606
696
|
}
|
|
607
697
|
};
|
|
608
|
-
function
|
|
698
|
+
function A() {
|
|
609
699
|
if (b) throw Error("The author document was already written.");
|
|
610
|
-
let e =
|
|
700
|
+
let e = Q(g);
|
|
611
701
|
if (e === null) throw Error("The HTML view document frame is not available.");
|
|
612
702
|
if (w !== void 0 && e !== w) throw Error("The HTML view document changed before its author document was written.");
|
|
613
|
-
w = e, e.open(),
|
|
614
|
-
base:
|
|
615
|
-
policy:
|
|
616
|
-
style:
|
|
617
|
-
})), e.close(), b = !0, o.track(
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
let e =
|
|
703
|
+
w = e, e.open(), Z(te(g), s), e.write(h(a, {
|
|
704
|
+
base: m(new URL(c.assetRoot), c.entry),
|
|
705
|
+
policy: p,
|
|
706
|
+
style: G(o.current)
|
|
707
|
+
})), e.close(), b = !0, o.track(g);
|
|
708
|
+
}
|
|
709
|
+
g.addEventListener("load", () => {
|
|
710
|
+
let e = Q(g);
|
|
621
711
|
if (e === null) E("The HTML view navigated away from its author document.");
|
|
622
712
|
else if (w === void 0) {
|
|
623
|
-
if (
|
|
713
|
+
if (!$(g, f.href)) {
|
|
624
714
|
E("The HTML view navigated away from its author document.");
|
|
625
715
|
return;
|
|
626
716
|
}
|
|
627
|
-
w = e, o.track(
|
|
628
|
-
} else e === w ? o.track(
|
|
717
|
+
w = e, o.track(g);
|
|
718
|
+
} else e === w ? o.track(g) : E("The HTML view navigated away from its author document.");
|
|
629
719
|
}), t.addEventListener("message", O), t.addEventListener("message", k);
|
|
630
|
-
let
|
|
631
|
-
|
|
720
|
+
let j = n.body ?? n.documentElement;
|
|
721
|
+
g.src = f.href, j.append(g), e.budgetMs > 0 && (T = setTimeout(() => {
|
|
632
722
|
T = void 0, E("The HTML view document did not start in time.");
|
|
633
723
|
}, e.budgetMs));
|
|
634
724
|
}
|
|
635
|
-
function
|
|
636
|
-
let r =
|
|
725
|
+
function Y(e, t, n) {
|
|
726
|
+
let r = R, i = 0, a, o = () => {
|
|
637
727
|
try {
|
|
638
|
-
|
|
728
|
+
K(n.documentElement, r);
|
|
639
729
|
} catch {}
|
|
640
730
|
if (a === void 0) return;
|
|
641
731
|
try {
|
|
642
|
-
a.style.background =
|
|
732
|
+
a.style.background = V(r);
|
|
643
733
|
} catch {}
|
|
644
|
-
let e =
|
|
734
|
+
let e = ne(a);
|
|
645
735
|
if (e !== null) try {
|
|
646
|
-
|
|
736
|
+
K(e, r);
|
|
647
737
|
} catch {}
|
|
648
738
|
};
|
|
649
739
|
return e.onDidThemeChange((e) => {
|
|
650
|
-
i += 1, r =
|
|
740
|
+
i += 1, r = X(e, r, t), o();
|
|
651
741
|
}), {
|
|
652
742
|
get current() {
|
|
653
743
|
return r;
|
|
@@ -657,52 +747,52 @@ function R(e, t, n) {
|
|
|
657
747
|
try {
|
|
658
748
|
n = await e.getTheme();
|
|
659
749
|
} catch (e) {
|
|
660
|
-
t("view/bridge-failed", `The workbench theme is unavailable: ${
|
|
750
|
+
t("view/bridge-failed", `The workbench theme is unavailable: ${d(e)}`);
|
|
661
751
|
return;
|
|
662
752
|
}
|
|
663
|
-
i > 0 || (r =
|
|
753
|
+
i > 0 || (r = X(n, r, t), o());
|
|
664
754
|
},
|
|
665
755
|
track(e) {
|
|
666
756
|
a = e, o();
|
|
667
757
|
}
|
|
668
758
|
};
|
|
669
759
|
}
|
|
670
|
-
function
|
|
760
|
+
function X(e, t, n) {
|
|
671
761
|
try {
|
|
672
|
-
return
|
|
762
|
+
return U(e);
|
|
673
763
|
} catch (e) {
|
|
674
|
-
return n("view/bridge-failed", `The workbench sent an unusable theme: ${
|
|
764
|
+
return n("view/bridge-failed", `The workbench sent an unusable theme: ${d(e)}`), t;
|
|
675
765
|
}
|
|
676
766
|
}
|
|
677
|
-
function
|
|
767
|
+
function Z(e, t) {
|
|
678
768
|
e !== null && (e.addEventListener("error", (e) => {
|
|
679
769
|
t("view/execution-failed", e.message);
|
|
680
770
|
}), e.addEventListener("unhandledrejection", (e) => {
|
|
681
|
-
t("view/execution-failed",
|
|
771
|
+
t("view/execution-failed", d(e.reason));
|
|
682
772
|
}));
|
|
683
773
|
}
|
|
684
|
-
function
|
|
774
|
+
function te(e) {
|
|
685
775
|
try {
|
|
686
776
|
return e.contentWindow;
|
|
687
777
|
} catch {
|
|
688
778
|
return null;
|
|
689
779
|
}
|
|
690
780
|
}
|
|
691
|
-
function
|
|
781
|
+
function ne(e) {
|
|
692
782
|
try {
|
|
693
783
|
return e.contentDocument?.documentElement ?? null;
|
|
694
784
|
} catch {
|
|
695
785
|
return null;
|
|
696
786
|
}
|
|
697
787
|
}
|
|
698
|
-
function
|
|
788
|
+
function Q(e) {
|
|
699
789
|
try {
|
|
700
790
|
return e.contentDocument ?? null;
|
|
701
791
|
} catch {
|
|
702
792
|
return null;
|
|
703
793
|
}
|
|
704
794
|
}
|
|
705
|
-
function
|
|
795
|
+
function $(e, t) {
|
|
706
796
|
try {
|
|
707
797
|
let n = e.contentWindow;
|
|
708
798
|
return n !== null && new URL(n.location.href).href === new URL(t).href;
|
|
@@ -710,7 +800,7 @@ function W(e, t) {
|
|
|
710
800
|
return !1;
|
|
711
801
|
}
|
|
712
802
|
}
|
|
713
|
-
function
|
|
803
|
+
function re(e, t) {
|
|
714
804
|
return new Promise((n, r) => {
|
|
715
805
|
let i = t > 0 ? setTimeout(() => {
|
|
716
806
|
e.removeEventListener("message", a), r(/* @__PURE__ */ Error("The editor did not hand over a bridge port."));
|
|
@@ -735,32 +825,39 @@ function G(e, t) {
|
|
|
735
825
|
e.addEventListener("message", a);
|
|
736
826
|
});
|
|
737
827
|
}
|
|
738
|
-
async function
|
|
739
|
-
let
|
|
740
|
-
if (
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
828
|
+
async function ie(e, t) {
|
|
829
|
+
let n = e.navigator.serviceWorker;
|
|
830
|
+
if (n === void 0) throw Error("This browser has no service worker support, so package files cannot load.");
|
|
831
|
+
return await n.register(new URL(f, import.meta.url), { type: "module" }), await oe(n, t), n;
|
|
832
|
+
}
|
|
833
|
+
function ae(e, t, n, r) {
|
|
834
|
+
let i = new URL(n.target.assetRoot).pathname, o = new O(t.href), s = (t) => {
|
|
835
|
+
if (t.source === null || t.source !== e.controller) return;
|
|
836
|
+
let s = t.ports[0];
|
|
837
|
+
if (s === void 0) return;
|
|
838
|
+
let c = t.data;
|
|
839
|
+
if (c?.type === "mica:view:attach" && c.token === n.token) {
|
|
840
|
+
o.active === void 0 && o.grant({
|
|
841
|
+
token: n.token,
|
|
842
|
+
root: i
|
|
843
|
+
}, c.owner);
|
|
844
|
+
let e = o.attach(c, c.client);
|
|
845
|
+
e !== void 0 && s.postMessage({
|
|
846
|
+
type: x,
|
|
847
|
+
token: e.token
|
|
848
|
+
}), s.close();
|
|
849
|
+
} else if (c?.type === "mica:view:asset-read") {
|
|
850
|
+
let e = a(s);
|
|
851
|
+
e.onDidClose(() => s.close()), e.register(T, { async read(e) {
|
|
852
|
+
return o.serves(c.clientId) === i ? r.readAsset(e) : void 0;
|
|
853
|
+
} }, { transfer: (e, t) => u(t) });
|
|
854
|
+
}
|
|
855
|
+
};
|
|
856
|
+
return e.addEventListener("message", s), e.startMessages(), () => {
|
|
857
|
+
o.clear(), e.removeEventListener("message", s);
|
|
749
858
|
};
|
|
750
|
-
s.postMessage(f, [c, l.port2]), await u;
|
|
751
|
-
}
|
|
752
|
-
function q(e, t, n) {
|
|
753
|
-
return new Promise((r, i) => {
|
|
754
|
-
let a = n > 0 ? setTimeout(() => {
|
|
755
|
-
e.close(), i(/* @__PURE__ */ Error("The package asset worker did not answer its grant."));
|
|
756
|
-
}, n) : void 0;
|
|
757
|
-
e.addEventListener("message", (n) => {
|
|
758
|
-
let i = n.data;
|
|
759
|
-
typeof i == "object" && i && i.type === "mica:view:assets-ack" && i.token === t && (a !== void 0 && clearTimeout(a), e.close(), r());
|
|
760
|
-
}), e.start();
|
|
761
|
-
});
|
|
762
859
|
}
|
|
763
|
-
function
|
|
860
|
+
function oe(e, t) {
|
|
764
861
|
return e.controller === null ? new Promise((n, r) => {
|
|
765
862
|
let i = () => {
|
|
766
863
|
o !== void 0 && clearTimeout(o), e.removeEventListener("controllerchange", a), n();
|
|
@@ -770,14 +867,14 @@ function J(e, t) {
|
|
|
770
867
|
e.addEventListener("controllerchange", a, { once: !0 }), e.controller !== null && i();
|
|
771
868
|
}) : Promise.resolve();
|
|
772
869
|
}
|
|
773
|
-
function
|
|
870
|
+
function se() {
|
|
774
871
|
let e = /* @__PURE__ */ new Uint8Array(16), t = globalThis.crypto;
|
|
775
872
|
if (typeof t?.getRandomValues == "function") t.getRandomValues(e);
|
|
776
873
|
else for (let t = 0; t < e.length; t += 1) e[t] = Math.random() * 256;
|
|
777
874
|
return [...e].map((e) => e.toString(16).padStart(2, "0")).join("");
|
|
778
875
|
}
|
|
779
|
-
globalThis.window !== void 0 && globalThis.document !== void 0 &&
|
|
876
|
+
globalThis.window !== void 0 && globalThis.document !== void 0 && q().catch((e) => {
|
|
780
877
|
console.error("[@mica-js/editor] device view environment failed", e);
|
|
781
878
|
});
|
|
782
879
|
//#endregion
|
|
783
|
-
export {
|
|
880
|
+
export { q as startHtmlViewEnvironment };
|
|
@@ -52,12 +52,19 @@ function isImageBitmap(value) {
|
|
|
52
52
|
}
|
|
53
53
|
/** Transfer list of one `prepare` result: every byte snapshot of the presentation props. */
|
|
54
54
|
function transferPresentationBytes(member, value) {
|
|
55
|
+
if (member === "call") return transferBytes(value);
|
|
55
56
|
if (member !== "prepare") return [];
|
|
56
|
-
const
|
|
57
|
+
const prepared = value;
|
|
57
58
|
const buffers = /* @__PURE__ */ new Set();
|
|
58
|
-
for (const instance of instances) for (const prop of Object.values(instance.props)) collectPropBytes(prop, buffers);
|
|
59
|
+
for (const instance of prepared?.instances ?? []) for (const prop of Object.values(instance.props)) collectPropBytes(prop, buffers);
|
|
60
|
+
for (const state of prepared?.deviceState ?? []) collectPropBytes(state.image, buffers);
|
|
59
61
|
return [...buffers];
|
|
60
62
|
}
|
|
63
|
+
/** The host provides a fresh independent image to each prepare or load request. */
|
|
64
|
+
function transferDeviceState(member, args) {
|
|
65
|
+
if (member !== "prepare" && member !== "load") return [];
|
|
66
|
+
return (args[0]?.deviceState ?? []).flatMap(({ image }) => transferBytes(image));
|
|
67
|
+
}
|
|
61
68
|
function collectPropBytes(value, buffers) {
|
|
62
69
|
if (value instanceof Uint8Array) {
|
|
63
70
|
if (value.buffer instanceof ArrayBuffer) buffers.add(value.buffer);
|
|
@@ -178,6 +185,6 @@ function messageOf(cause) {
|
|
|
178
185
|
return cause instanceof Error ? cause.message : String(cause);
|
|
179
186
|
}
|
|
180
187
|
//#endregion
|
|
181
|
-
export { isImageBitmap as a, toWireFailure as c,
|
|
188
|
+
export { isImageBitmap as a, toWireFailure as c, transferOverlayFrame as d, transferPackageBytes as f, transferResourceBytes as h, isFusedBridgeError as i, transferBytes as l, transferProgramArtifact as m, FusedBridgeError as n, mapWireFailure as o, transferPresentationBytes as p, fromWireFailure as r, messageOf as s, FUSED_WIRE_FAILURE as t, transferDeviceState as u };
|
|
182
189
|
|
|
183
|
-
//# sourceMappingURL=wire-
|
|
190
|
+
//# sourceMappingURL=wire-Di4FVpnu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wire-Di4FVpnu.js","names":[],"sources":["../src/fused/runtime/wire.ts"],"sourcesContent":["/**\n * Failure and transfer conventions of the fused sandbox bridge (RFC 0025).\n *\n * RPC carries only `name` and `message` across a sandbox boundary, so a contract failure travels as\n * JSON inside the message and is rebuilt on the other side. Nothing here imports device or model\n * code: the main thread must never pull model execution into its own bundle.\n */\nimport type { Value } from '@mica-js/document/fused';\nimport type {\n IFusedFirmwareSnapshot,\n IFusedProgramFilesSnapshot,\n IFusedOverlayFrame,\n IFusedPrepareResult,\n IFusedPrepareRequest,\n} from './protocol';\n\n/** `name` of a failure whose message carries a {@link IFusedFailurePayload}. */\nexport const FUSED_WIRE_FAILURE = 'FusedSandboxFailure';\n\n/** One failure of a guest call, flattened for the wire. */\nexport interface IFusedFailurePayload {\n /** `method` keeps a business rejection, `runtime` a contract error, `failure` anything else. */\n readonly kind: 'method' | 'runtime' | 'failure';\n readonly code: string;\n readonly message: string;\n readonly instanceId?: string;\n /** JSON-safe snapshot of a `MethodError` payload. */\n readonly details?: unknown;\n}\n\nexport interface IFusedBridgeErrorOptions {\n readonly instanceId?: string;\n readonly details?: Value;\n /**\n * Error name. A method rejection keeps `MethodError`, so the SDK predicate of the consumer still\n * recognizes it; every other failure keeps the default name.\n */\n readonly name?: string;\n}\n\n/**\n * Host-side failure of the fused sandbox bridge.\n *\n * Mirrors `FusedRuntimeError` (`code`, optional `instanceId`) and keeps the business payload of a\n * model `MethodError` rejection. Guest code uses the same class to build the failure it throws.\n */\nexport class FusedBridgeError extends Error {\n readonly code: string;\n readonly instanceId: string | undefined;\n readonly details: Value | undefined;\n\n constructor(code: string, message: string, options: IFusedBridgeErrorOptions = {}) {\n super(message);\n this.name = options.name ?? 'FusedBridgeError';\n this.code = code;\n this.instanceId = options.instanceId;\n this.details = options.details;\n }\n}\n\nexport function isFusedBridgeError(value: unknown): value is FusedBridgeError {\n return value instanceof FusedBridgeError;\n}\n\n/** Encodes one failure as an `Error` the RPC layer can carry. */\nexport function toWireFailure(cause: unknown): Error {\n const payload = failurePayload(cause);\n return Object.assign(new Error(JSON.stringify(payload)), { name: FUSED_WIRE_FAILURE });\n}\n\n/** Rebuilds the failure of a rejected guest call; other errors pass through. */\nexport function fromWireFailure(cause: unknown): Error {\n if (!(cause instanceof Error) || cause.name !== FUSED_WIRE_FAILURE) {\n return cause instanceof Error ? cause : new Error(String(cause));\n }\n const payload = decodePayload(cause.message);\n if (payload === undefined) {\n return cause;\n }\n return new FusedBridgeError(payload.code, payload.message, {\n ...(payload.kind === 'method' ? { name: 'MethodError' } : {}),\n ...(payload.instanceId === undefined ? {} : { instanceId: payload.instanceId }),\n ...(payload.details === undefined ? {} : { details: payload.details as Value }),\n });\n}\n\n/** Runs one guest call and rebuilds a wire failure of its rejection. */\nexport async function mapWireFailure<T>(run: () => Promise<T>): Promise<T> {\n try {\n return await run();\n } catch (cause) {\n throw fromWireFailure(cause);\n }\n}\n\n/** Whether a value is a decodable overlay bitmap of this realm. */\nexport function isImageBitmap(value: unknown): value is ImageBitmap {\n return typeof ImageBitmap !== 'undefined' && value instanceof ImageBitmap;\n}\n\n/** Transfer list of one `prepare` result: every byte snapshot of the presentation props. */\nexport function transferPresentationBytes(member: string, value: unknown): readonly Transferable[] {\n if (member === 'call') return transferBytes(value);\n if (member !== 'prepare') return [];\n const prepared = value as IFusedPrepareResult | undefined;\n const buffers = new Set<ArrayBuffer>();\n for (const instance of prepared?.instances ?? []) {\n for (const prop of Object.values(instance.props)) collectPropBytes(prop, buffers);\n }\n for (const state of prepared?.deviceState ?? []) collectPropBytes(state.image, buffers);\n return [...buffers];\n}\n\n/** The host provides a fresh independent image to each prepare or load request. */\nexport function transferDeviceState(\n member: string,\n args: readonly unknown[],\n): readonly Transferable[] {\n if (member !== 'prepare' && member !== 'load') return [];\n const request = args[0] as IFusedPrepareRequest | undefined;\n return (request?.deviceState ?? []).flatMap(({ image }) => transferBytes(image));\n}\n\nfunction collectPropBytes(value: unknown, buffers: Set<ArrayBuffer>): void {\n if (value instanceof Uint8Array) {\n if (value.buffer instanceof ArrayBuffer) buffers.add(value.buffer);\n return;\n }\n const snapshot = value as IFusedFirmwareSnapshot | IFusedProgramFilesSnapshot | null;\n if (snapshot === null || typeof snapshot !== 'object') return;\n if (snapshot.kind === 'filesystem') {\n for (const file of snapshot.files) collectPropBytes(file.data, buffers);\n return;\n }\n if (snapshot.kind !== 'firmware') return;\n for (const segment of snapshot.segments) {\n if (segment.bytes instanceof Uint8Array && segment.bytes.buffer instanceof ArrayBuffer) {\n buffers.add(segment.bytes.buffer);\n }\n }\n}\n/** Transfer list of one `render` result. */\nexport function transferOverlayFrame(member: string, value: unknown): readonly Transferable[] {\n if (member !== 'render') return [];\n const frame = value as IFusedOverlayFrame | undefined;\n if (frame === undefined || frame === null) return [];\n return isImageBitmap(frame.bitmap) ? [frame.bitmap] : [];\n}\n\n/** Transfer list of one `Uint8Array` result. */\nexport function transferBytes(value: unknown): readonly Transferable[] {\n if (!(value instanceof Uint8Array)) return [];\n if (!(value.buffer instanceof ArrayBuffer)) return [];\n if (value.byteOffset !== 0 || value.byteLength !== value.buffer.byteLength) return [];\n return [value.buffer];\n}\n\n/** Transfer list of one host package `read` result. */\nexport function transferPackageBytes(member: string, value: unknown): readonly Transferable[] {\n return member === 'read' ? transferBytes(value) : [];\n}\n\n/** Transfer list of one host `readResource` result. */\nexport function transferResourceBytes(member: string, value: unknown): readonly Transferable[] {\n return member === 'readResource' ? transferBytes(value) : [];\n}\n\nexport function transferProgramArtifact(member: string, value: unknown): readonly Transferable[] {\n if (member !== 'resolveProgramProject') return [];\n const artifact = value as {\n readonly kind?: string;\n readonly data?: Uint8Array;\n readonly files?: readonly { readonly data: Uint8Array }[];\n };\n const files = artifact.files;\n return [\n ...new Set(\n files ? files.flatMap((file) => transferBytes(file.data)) : transferBytes(artifact.data),\n ),\n ];\n}\n\nfunction failurePayload(cause: unknown): IFusedFailurePayload {\n const message = messageOf(cause);\n const method = methodErrorOf(cause);\n if (method !== undefined) {\n return {\n kind: 'method',\n code: method.code,\n message: method.message,\n ...(method.details === undefined ? {} : { details: jsonSafe(method.details) }),\n };\n }\n const code = codeOf(cause);\n const instanceId = instanceIdOf(cause);\n return {\n kind: code === 'Error' ? 'failure' : 'runtime',\n code,\n message,\n ...(instanceId === undefined ? {} : { instanceId }),\n };\n}\n\nfunction decodePayload(message: string): IFusedFailurePayload | undefined {\n let parsed: unknown;\n try {\n parsed = JSON.parse(message);\n } catch {\n return undefined;\n }\n if (typeof parsed !== 'object' || parsed === null) return undefined;\n const candidate = parsed as Record<string, unknown>;\n if (typeof candidate['code'] !== 'string' || typeof candidate['message'] !== 'string') {\n return undefined;\n }\n const kind =\n candidate['kind'] === 'method' || candidate['kind'] === 'runtime'\n ? candidate['kind']\n : 'failure';\n return {\n kind,\n code: candidate['code'],\n message: candidate['message'],\n ...(typeof candidate['instanceId'] === 'string' ? { instanceId: candidate['instanceId'] } : {}),\n ...(candidate['details'] === undefined ? {} : { details: candidate['details'] }),\n };\n}\n\nfunction codeOf(cause: unknown): string {\n if (typeof cause !== 'object' || cause === null) return 'Error';\n const code = (cause as { readonly code?: unknown }).code;\n if (typeof code === 'string' && code.length > 0) return code;\n const name = (cause as { readonly name?: unknown }).name;\n return typeof name === 'string' && name.length > 0 ? name : 'Error';\n}\n\nfunction instanceIdOf(cause: unknown): string | undefined {\n if (typeof cause !== 'object' || cause === null) return undefined;\n const instanceId = (cause as { readonly instanceId?: unknown }).instanceId;\n return typeof instanceId === 'string' ? instanceId : undefined;\n}\n\n/**\n * Recognizes a model business rejection without importing the SDK: the runtime and its guests may\n * carry different copies of the class, so the shape plus the registered name is what counts.\n */\nfunction methodErrorOf(\n cause: unknown,\n): { readonly code: string; readonly message: string; readonly details?: unknown } | undefined {\n if (typeof cause !== 'object' || cause === null) return undefined;\n const candidate = cause as {\n readonly name?: unknown;\n readonly code?: unknown;\n readonly message?: unknown;\n readonly details?: unknown;\n };\n if (candidate.name !== 'MethodError' || typeof candidate.code !== 'string') return undefined;\n if (typeof candidate.message !== 'string') return undefined;\n return {\n code: candidate.code,\n message: candidate.message,\n ...(candidate.details === undefined ? {} : { details: candidate.details }),\n };\n}\n\n/** JSON-safe copy of a model value; byte payloads become number arrays. */\nfunction jsonSafe(value: unknown): unknown {\n if (value instanceof Uint8Array) return [...value];\n if (Array.isArray(value)) return value.map((item: unknown) => jsonSafe(item));\n if (typeof value === 'object' && value !== null) {\n const record: Record<string, unknown> = {};\n for (const [key, member] of Object.entries(value)) record[key] = jsonSafe(member);\n return record;\n }\n return value;\n}\n\nexport function messageOf(cause: unknown): string {\n return cause instanceof Error ? cause.message : String(cause);\n}\n"],"mappings":";;AAiB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