@draftably/runtime 0.4.0 → 0.6.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 +1 -1
- package/dist/assets/render.worker-CDf818A5.js +9040 -0
- package/dist/compile-CvMiDEcR.js +7837 -0
- package/dist/element.js +12 -12
- package/dist/graph.js +1 -1
- package/dist/host.js +12 -4
- package/dist/index.js +2 -2
- package/dist/render-DU-eRw6k.js +1250 -0
- package/dist/types/src/dsl/compile.d.ts +2 -0
- package/dist/types/src/dsl/sequence-layout.d.ts +87 -0
- package/dist/types/src/dsl/syntax.d.ts +8 -2
- package/dist/types/src/engines/layout/arrange.d.ts +36 -0
- package/dist/types/src/engines/layout/compute.d.ts +7 -0
- package/dist/types/src/engines/layout/forces.d.ts +8 -0
- package/dist/types/src/engines/layout/grid.d.ts +10 -0
- package/dist/types/src/engines/layout/intent.d.ts +14 -0
- package/dist/types/src/engines/layout/layered.d.ts +5 -0
- package/dist/types/src/engines/layout/objective.d.ts +6 -0
- package/dist/types/src/engines/layout/packing.d.ts +7 -0
- package/dist/types/src/engines/layout/report.d.ts +7 -0
- package/dist/types/src/engines/layout/scene.d.ts +53 -0
- package/dist/types/src/engines/layout/seed.d.ts +3 -0
- package/dist/types/src/engines/layout/separation.d.ts +17 -0
- package/dist/types/src/engines/layout/settings.d.ts +6 -0
- package/dist/types/src/engines/layout/topology.d.ts +18 -0
- package/dist/types/src/engines/layout/trees.d.ts +8 -0
- package/dist/types/src/engines/layout/types.d.ts +133 -0
- package/dist/types/src/engines/layout/util.d.ts +19 -0
- package/dist/types/src/engines/layout-engine.d.ts +14 -119
- package/dist/types/src/engines/routing/compute.d.ts +6 -0
- package/dist/types/src/engines/routing/conflicts.d.ts +36 -0
- package/dist/types/src/engines/routing/context.d.ts +37 -0
- package/dist/types/src/engines/routing/cost.d.ts +13 -0
- package/dist/types/src/engines/routing/doglegs.d.ts +16 -0
- package/dist/types/src/engines/routing/find.d.ts +6 -0
- package/dist/types/src/engines/routing/geometry.d.ts +24 -0
- package/dist/types/src/engines/routing/heap.d.ts +20 -0
- package/dist/types/src/engines/routing/improve.d.ts +7 -0
- package/dist/types/src/engines/routing/nudge.d.ts +7 -0
- package/dist/types/src/engines/routing/paths.d.ts +8 -0
- package/dist/types/src/engines/routing/planned.d.ts +7 -0
- package/dist/types/src/engines/routing/ports.d.ts +10 -0
- package/dist/types/src/engines/routing/repair.d.ts +9 -0
- package/dist/types/src/engines/routing/score.d.ts +12 -0
- package/dist/types/src/engines/routing/search.d.ts +16 -0
- package/dist/types/src/engines/routing/settings.d.ts +4 -0
- package/dist/types/src/engines/routing/sidepairs.d.ts +20 -0
- package/dist/types/src/engines/routing/tidy-ports.d.ts +13 -0
- package/dist/types/src/engines/routing/tidy.d.ts +10 -0
- package/dist/types/src/engines/routing/tuning.d.ts +9 -0
- package/dist/types/src/engines/routing/types.d.ts +157 -0
- package/dist/types/src/engines/routing-engine.d.ts +19 -107
- package/dist/types/src/model/appearance.d.ts +18 -2
- package/dist/types/src/model/labels.d.ts +23 -0
- package/dist/types/src/model/markers.d.ts +7 -0
- package/dist/types/src/model/note.d.ts +11 -2
- package/dist/types/src/model/routes.d.ts +2 -0
- package/dist/types/src/model/status.d.ts +18 -0
- package/dist/types/src/model/types.d.ts +20 -1
- package/dist/types/src/runtime/color-scheme.d.ts +15 -0
- package/dist/types/src/runtime/host.d.ts +34 -2
- package/dist/types/src/runtime/page-shared.d.ts +1 -1
- package/dist/types/src/runtime/schemes.d.ts +2 -0
- package/dist/types/src/runtime/svg-renderer.d.ts +9 -4
- package/dist/types/src/runtime/types.d.ts +7 -0
- package/dist/version-D7YCY2pU.js +4 -0
- package/dist/viewer.css +14 -8
- package/dist/viewer.js +474 -453
- package/package.json +1 -1
- package/dist/assets/render.worker-BXjS76Gy.js +0 -8485
- package/dist/compile-C2lvlbqE.js +0 -7369
- package/dist/render-CFWEEKPT.js +0 -1160
- package/dist/types/src/engines/explorer-engine.d.ts +0 -67
- package/dist/types/src/engines/sculpt-engine.d.ts +0 -71
- package/dist/version-CKs2Vl8m.js +0 -4
package/dist/viewer.js
CHANGED
|
@@ -1,177 +1,177 @@
|
|
|
1
|
-
import { i as Ne, F as
|
|
2
|
-
import { f as
|
|
3
|
-
import { r as
|
|
4
|
-
const $e = 0.02, ze = 8,
|
|
5
|
-
function Oe(
|
|
6
|
-
const t =
|
|
1
|
+
import { i as Ne, F as Re } from "./geometry-DfUVE8b2.js";
|
|
2
|
+
import { f as kt } from "./geometry-DfUVE8b2.js";
|
|
3
|
+
import { r as St } from "./version-D7YCY2pU.js";
|
|
4
|
+
const $e = 0.02, ze = 8, He = 32, ye = (n, t = $e, i = ze) => Math.min(Math.max(n, Math.max($e, t)), Math.min(ze, i));
|
|
5
|
+
function Oe(n = {}) {
|
|
6
|
+
const t = n.padding ?? He;
|
|
7
7
|
return typeof t == "number" ? { top: t, right: t, bottom: t, left: t } : t;
|
|
8
8
|
}
|
|
9
|
-
function Ge(
|
|
10
|
-
if (!
|
|
11
|
-
const t = Math.min(...
|
|
12
|
-
return { x: t, y:
|
|
9
|
+
function Ge(n) {
|
|
10
|
+
if (!n.length) return;
|
|
11
|
+
const t = Math.min(...n.map((d) => d.x)), i = Math.min(...n.map((d) => d.y)), r = Math.max(...n.map((d) => d.x + d.width)), c = Math.max(...n.map((d) => d.y + d.height));
|
|
12
|
+
return { x: t, y: i, width: r - t, height: c - i };
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
const r = Oe(
|
|
16
|
-
Math.min(c / Math.max(1,
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
function Ie(n, t, i = {}) {
|
|
15
|
+
const r = Oe(i), c = Math.max(1, t.width - r.left - r.right), d = Math.max(1, t.height - r.top - r.bottom), m = ye(
|
|
16
|
+
Math.min(c / Math.max(1, n.width), d / Math.max(1, n.height)),
|
|
17
|
+
i.minZoom,
|
|
18
|
+
i.maxZoom ?? 1
|
|
19
19
|
);
|
|
20
20
|
return {
|
|
21
|
-
centerX:
|
|
22
|
-
centerY:
|
|
23
|
-
zoom:
|
|
21
|
+
centerX: n.x + n.width / 2 - (r.left - r.right) / 2 / m,
|
|
22
|
+
centerY: n.y + n.height / 2 - (r.top - r.bottom) / 2 / m,
|
|
23
|
+
zoom: m
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
const c = Oe(r), d = { width:
|
|
28
|
-
let { centerX:
|
|
26
|
+
function Ue(n, t, i, r = {}) {
|
|
27
|
+
const c = Oe(r), d = { width: i.width - c.left - c.right, height: i.height - c.top - c.bottom };
|
|
28
|
+
let { centerX: m, centerY: s, zoom: f } = n;
|
|
29
29
|
if (t.width * f > d.width || t.height * f > d.height)
|
|
30
|
-
return
|
|
30
|
+
return Ie(t, i, { ...r, maxZoom: f });
|
|
31
31
|
f = ye(f, r.minZoom, r.maxZoom);
|
|
32
|
-
const
|
|
33
|
-
return
|
|
32
|
+
const g = (t.x - m) * f + i.width / 2, x = (t.y - s) * f + i.height / 2;
|
|
33
|
+
return g < c.left ? m -= (c.left - g) / f : g + t.width * f > i.width - c.right && (m += (g + t.width * f - (i.width - c.right)) / f), x < c.top ? s -= (c.top - x) / f : x + t.height * f > i.height - c.bottom && (s += (x + t.height * f - (i.height - c.bottom)) / f), { centerX: m, centerY: s, zoom: f };
|
|
34
34
|
}
|
|
35
|
-
const
|
|
36
|
-
code:
|
|
35
|
+
const Ke = (n, t) => Math.abs(n.centerX - t.centerX) < 0.01 && Math.abs(n.centerY - t.centerY) < 0.01 && Math.abs(n.zoom - t.zoom) < 1e-6, Je = 0.4, Qe = (n, t) => n.nodes[t] ? "node" : n.groups[t] ? "group" : n.edges[t] ? "edge" : void 0, Te = (n, t, i) => ({
|
|
36
|
+
code: n,
|
|
37
37
|
severity: "warning",
|
|
38
38
|
message: t,
|
|
39
|
-
itemIds: [
|
|
39
|
+
itemIds: [i]
|
|
40
40
|
});
|
|
41
|
-
function
|
|
42
|
-
const
|
|
43
|
-
|
|
41
|
+
function et(n, t = {}) {
|
|
42
|
+
const i = n.createElement("div"), r = n.createElement("div"), c = n.createElement("div");
|
|
43
|
+
i.className = "draft-anchors", r.className = "draft-anchors__bodies", c.className = "draft-anchors__overlays", i.append(r, c), i.dataset.draftDetail = "full";
|
|
44
44
|
const d = /* @__PURE__ */ new Map();
|
|
45
|
-
let
|
|
46
|
-
const
|
|
45
|
+
let m = [], s = null, f = !1, g = [], x = 1;
|
|
46
|
+
const p = /* @__PURE__ */ new Set(), b = n.defaultView, P = () => {
|
|
47
47
|
let l = !1;
|
|
48
|
-
for (const [
|
|
49
|
-
if (!
|
|
50
|
-
const
|
|
51
|
-
(
|
|
48
|
+
for (const [h, w] of d) {
|
|
49
|
+
if (!w.body) continue;
|
|
50
|
+
const M = (E.get(w) ?? []).some(
|
|
51
|
+
(_) => _.offsetWidth > w.box.width + 0.5 || _.offsetHeight > w.box.height + 0.5
|
|
52
52
|
);
|
|
53
|
-
|
|
53
|
+
M !== p.has(h) && (l = !0, M ? p.add(h) : p.delete(h));
|
|
54
54
|
}
|
|
55
55
|
l && t.onOverflow?.();
|
|
56
|
-
},
|
|
57
|
-
if (!
|
|
58
|
-
for (const
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
for (const
|
|
62
|
-
},
|
|
63
|
-
for (const
|
|
64
|
-
|
|
56
|
+
}, L = b?.ResizeObserver ? new b.ResizeObserver(P) : void 0, E = /* @__PURE__ */ new Map(), re = (l) => {
|
|
57
|
+
if (!L || !l.body) return;
|
|
58
|
+
for (const w of E.get(l) ?? []) L.unobserve(w);
|
|
59
|
+
const h = U(l.el);
|
|
60
|
+
E.set(l, h);
|
|
61
|
+
for (const w of h) L.observe(w);
|
|
62
|
+
}, k = (l) => {
|
|
63
|
+
for (const h of E.get(l) ?? []) L?.unobserve(h);
|
|
64
|
+
E.delete(l);
|
|
65
65
|
}, Y = (l) => {
|
|
66
|
-
const
|
|
67
|
-
return
|
|
66
|
+
const h = l.closest?.("[data-draft-anchor]")?.getAttribute("data-draft-anchor");
|
|
67
|
+
return h ? d.get(h) : void 0;
|
|
68
68
|
};
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
|
|
69
|
+
i.addEventListener("slotchange", (l) => {
|
|
70
|
+
const h = Y(l.target);
|
|
71
|
+
h && re(h);
|
|
72
72
|
});
|
|
73
|
-
const
|
|
74
|
-
const
|
|
75
|
-
for (const
|
|
76
|
-
const
|
|
77
|
-
|
|
73
|
+
const W = b?.MutationObserver ? new b.MutationObserver((l) => {
|
|
74
|
+
const h = /* @__PURE__ */ new Set();
|
|
75
|
+
for (const w of l) {
|
|
76
|
+
const M = w.target.dataset?.draftAnchor ? Y(w.target) : void 0;
|
|
77
|
+
M && !h.has(M) && (h.add(M), re(M));
|
|
78
78
|
}
|
|
79
79
|
}) : void 0;
|
|
80
|
-
|
|
80
|
+
W?.observe(r, { childList: !0, subtree: !0 });
|
|
81
81
|
let G = !1;
|
|
82
|
-
const
|
|
83
|
-
|
|
82
|
+
const J = () => G = !0, F = () => G = !1;
|
|
83
|
+
i.addEventListener("pointerdown", J, !0), n.addEventListener("pointerup", F, !0), n.addEventListener("pointercancel", F, !0);
|
|
84
84
|
function U(l) {
|
|
85
|
-
const
|
|
86
|
-
return
|
|
85
|
+
const h = l.firstElementChild;
|
|
86
|
+
return h instanceof HTMLSlotElement ? h.assignedElements().filter((w) => w instanceof HTMLElement) : [...l.children].filter((w) => w instanceof HTMLElement);
|
|
87
87
|
}
|
|
88
|
-
function
|
|
89
|
-
let l =
|
|
88
|
+
function ne() {
|
|
89
|
+
let l = n.activeElement;
|
|
90
90
|
for (; l?.shadowRoot?.activeElement; ) l = l.shadowRoot.activeElement;
|
|
91
91
|
return l;
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
let l = !1,
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
let
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
[
|
|
93
|
+
function se() {
|
|
94
|
+
let l = !1, h = !1;
|
|
95
|
+
const w = /* @__PURE__ */ new Set();
|
|
96
|
+
g = [];
|
|
97
|
+
let M;
|
|
98
|
+
const _ = (S) => {
|
|
99
|
+
M ??= new Map(
|
|
100
|
+
[s.nodes, s.groups, s.edges].flatMap(Object.keys).map((O, N) => [O, N])
|
|
101
101
|
);
|
|
102
|
-
const
|
|
103
|
-
return
|
|
102
|
+
const z = S.dataset.draftAnchor;
|
|
103
|
+
return M.get(z.slice(z.indexOf(":") + 1)) ?? 1 / 0;
|
|
104
104
|
};
|
|
105
|
-
for (const
|
|
106
|
-
const
|
|
107
|
-
if (!
|
|
108
|
-
f && !
|
|
105
|
+
for (const S of m) {
|
|
106
|
+
const z = S.indexOf(":"), O = S.slice(0, z), N = S.slice(z + 1), B = s ? Qe(s, N) : void 0;
|
|
107
|
+
if (!s || !B || O !== "body" && O !== "overlay" || O === "body" && B !== "node" || w.has(S)) {
|
|
108
|
+
f && !w.has(S) && g.push(S);
|
|
109
109
|
continue;
|
|
110
110
|
}
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
let
|
|
114
|
-
if (
|
|
115
|
-
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
const
|
|
119
|
-
let
|
|
120
|
-
for (;
|
|
121
|
-
const
|
|
122
|
-
|
|
111
|
+
w.add(S);
|
|
112
|
+
const D = Ne(s, N);
|
|
113
|
+
let $ = d.get(S);
|
|
114
|
+
if (!$ || $.kind !== B) {
|
|
115
|
+
$ && ($.el.remove(), k($));
|
|
116
|
+
const I = n.createElement("div");
|
|
117
|
+
I.className = `draft-anchor draft-anchor--${O}`, I.dataset.draftAnchor = S, $ = { el: I, id: N, kind: B, body: O === "body", box: D }, d.set(S, $);
|
|
118
|
+
const Q = $.body ? r : c, Z = Q.children, ue = _(I);
|
|
119
|
+
let ee = 0, H = Z.length;
|
|
120
|
+
for (; ee < H; ) {
|
|
121
|
+
const ie = ee + H >> 1;
|
|
122
|
+
_(Z[ie]) > ue ? H = ie : ee = ie + 1;
|
|
123
123
|
}
|
|
124
|
-
|
|
125
|
-
} else
|
|
126
|
-
if (
|
|
127
|
-
const
|
|
128
|
-
|
|
124
|
+
Q.insertBefore(I, Z[ee] ?? null), re($), l = !0;
|
|
125
|
+
} else $.body && ($.box.width !== D.width || $.box.height !== D.height) && (h = !0);
|
|
126
|
+
if ($.box = D, $.body) {
|
|
127
|
+
const I = $.el.style;
|
|
128
|
+
I.left = `${D.x}px`, I.top = `${D.y}px`, I.width = `${D.width}px`, I.height = `${D.height}px`;
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
for (const [
|
|
132
|
-
if (
|
|
133
|
-
const
|
|
134
|
-
|
|
131
|
+
for (const [S, z] of d) {
|
|
132
|
+
if (w.has(S)) continue;
|
|
133
|
+
const O = ne(), N = !!O && (z.el.contains(O) || U(z.el).some((B) => B.contains(O)));
|
|
134
|
+
z.el.remove(), k(z), d.delete(S), p.delete(S), l = !0, N && i.dispatchEvent(new CustomEvent("draft-anchor-focus-lost"));
|
|
135
135
|
}
|
|
136
|
-
return
|
|
136
|
+
return h && L && P(), l;
|
|
137
137
|
}
|
|
138
138
|
return {
|
|
139
|
-
el:
|
|
139
|
+
el: i,
|
|
140
140
|
setSlots(l) {
|
|
141
|
-
return
|
|
141
|
+
return m = [...new Set(l)], se();
|
|
142
142
|
},
|
|
143
|
-
hasSlots: () =>
|
|
143
|
+
hasSlots: () => m.length > 0,
|
|
144
144
|
setGeometry(l) {
|
|
145
|
-
return
|
|
145
|
+
return s = l, f = !0, se();
|
|
146
146
|
},
|
|
147
|
-
place(l,
|
|
148
|
-
if (!
|
|
149
|
-
(
|
|
150
|
-
for (const
|
|
151
|
-
if (
|
|
152
|
-
const
|
|
153
|
-
|
|
147
|
+
place(l, h, w) {
|
|
148
|
+
if (!m.length) return;
|
|
149
|
+
(w !== x || !i.style.getPropertyValue("--draft-zoom")) && i.style.setProperty("--draft-zoom", String(w)), x = w, r.style.transform = `translate(${l}px, ${h}px) scale(${w})`;
|
|
150
|
+
for (const _ of d.values()) {
|
|
151
|
+
if (_.body) continue;
|
|
152
|
+
const S = _.el.style;
|
|
153
|
+
S.transform = `translate(${l + _.box.x * w}px, ${h + _.box.y * w}px)`, S.width = `${_.box.width * w}px`, S.height = `${_.box.height * w}px`;
|
|
154
154
|
}
|
|
155
|
-
const
|
|
156
|
-
|
|
155
|
+
const M = t.detail !== "full" && w < Je;
|
|
156
|
+
i.dataset.draftDetail === "low" !== M && (i.dataset.draftDetail = M ? "low" : "full", r.inert = M);
|
|
157
157
|
},
|
|
158
|
-
anchors: () => [...d].map(([l,
|
|
158
|
+
anchors: () => [...d].map(([l, h]) => ({
|
|
159
159
|
slot: l,
|
|
160
|
-
id:
|
|
161
|
-
kind:
|
|
162
|
-
el:
|
|
160
|
+
id: h.id,
|
|
161
|
+
kind: h.kind,
|
|
162
|
+
el: h.el
|
|
163
163
|
})),
|
|
164
164
|
// Every anchored body, at any zoom: CSS shows titles again below LOW_DETAIL_ZOOM.
|
|
165
165
|
bodyIds: () => [...d.values()].filter((l) => l.body).map((l) => l.id),
|
|
166
166
|
warnings: () => [
|
|
167
|
-
...
|
|
167
|
+
...g.map(
|
|
168
168
|
(l) => Te(
|
|
169
169
|
"DRAFT_SLOT_UNKNOWN",
|
|
170
|
-
|
|
170
|
+
/^(?:body|overlay):/.test(l) ? s ? `Slot ${l} names no item that can hold it. A body fills a node; an overlay covers a node, group or edge.` : `Slot ${l} shows nothing: this drawing repeats items (compare or states), so slots are off.` : `Slot ${l} shows nothing: a slot name starts with body: or overlay:, such as body:api.`,
|
|
171
171
|
l.slice(l.indexOf(":") + 1)
|
|
172
172
|
)
|
|
173
173
|
),
|
|
174
|
-
...[...
|
|
174
|
+
...[...p].map(
|
|
175
175
|
(l) => Te(
|
|
176
176
|
"DRAFT_SLOT_OVERFLOW",
|
|
177
177
|
`The content of ${l} is larger than its node. Declare the room with size … min-height=.`,
|
|
@@ -181,597 +181,618 @@ function Qe(o, t = {}) {
|
|
|
181
181
|
],
|
|
182
182
|
pressed: () => G,
|
|
183
183
|
idOf(l) {
|
|
184
|
-
for (const
|
|
185
|
-
if (
|
|
184
|
+
for (const h of d.values())
|
|
185
|
+
if (h.el.contains(l) || U(h.el).some((w) => w.contains(l))) return h.id;
|
|
186
186
|
},
|
|
187
187
|
destroy() {
|
|
188
|
-
|
|
188
|
+
L?.disconnect(), W?.disconnect(), n.removeEventListener("pointerup", F, !0), n.removeEventListener("pointercancel", F, !0), E.clear(), d.clear(), i.remove();
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
const tt = /\bdark\b/, rt = /\blight\b/;
|
|
193
|
+
function nt(n, t) {
|
|
194
|
+
const i = n.ownerDocument, r = i.defaultView, c = r?.matchMedia?.("(prefers-color-scheme: dark)"), d = i.createElement("span");
|
|
195
|
+
d.setAttribute("aria-hidden", "true"), d.setAttribute("data-draft-probe", ""), d.style.cssText = "position:absolute;width:0;height:0;overflow:hidden;pointer-events:none;color:light-dark(rgb(0,0,0),rgb(255,255,255));transition:color 1ms !important", n.append(d);
|
|
196
|
+
let m;
|
|
197
|
+
const s = () => {
|
|
198
|
+
const p = r?.getComputedStyle(d).colorScheme ?? "", b = tt.test(p) && (!rt.test(p) || !!c?.matches);
|
|
199
|
+
b !== m && (m = b, t(b));
|
|
200
|
+
}, f = (p) => {
|
|
201
|
+
p.stopPropagation(), s();
|
|
202
|
+
};
|
|
203
|
+
d.addEventListener("transitionrun", f), c?.addEventListener?.("change", s);
|
|
204
|
+
const g = n.nodeType === 11 ? n.host : n, x = r && "ResizeObserver" in r ? new r.ResizeObserver(s) : void 0;
|
|
205
|
+
return x?.observe(g), s(), {
|
|
206
|
+
check: s,
|
|
207
|
+
stop() {
|
|
208
|
+
x?.disconnect(), c?.removeEventListener?.("change", s), d.removeEventListener("transitionrun", f), d.remove();
|
|
189
209
|
}
|
|
190
210
|
};
|
|
191
211
|
}
|
|
192
212
|
const De = Math.max(
|
|
193
213
|
1,
|
|
194
214
|
Math.min(4, (globalThis.navigator?.hardwareConcurrency || 2) - 1)
|
|
195
|
-
),
|
|
196
|
-
let
|
|
197
|
-
const _e = "The worker is the module next to @draftably/runtime's viewer. With Vite, add optimizeDeps: { exclude: ['@draftably/runtime', '@draftably/editor'] } to vite.config.",
|
|
198
|
-
function
|
|
199
|
-
|
|
215
|
+
), ot = 3e4, Fe = /* @__PURE__ */ new Map();
|
|
216
|
+
let st = 0;
|
|
217
|
+
const _e = "The worker is the module next to @draftably/runtime's viewer. With Vite 5–7, add optimizeDeps: { exclude: ['@draftably/runtime', '@draftably/editor'] } to vite.config.", it = () => new Worker(new URL("./assets/render.worker-CDf818A5.js", import.meta.url), { type: "module" });
|
|
218
|
+
function le(n, t, i) {
|
|
219
|
+
n.slots.splice(n.slots.indexOf(t), 1), clearTimeout(t.timer), clearTimeout(t.idle), t.worker.terminate();
|
|
200
220
|
const r = t.job;
|
|
201
|
-
t.job = void 0, r &&
|
|
221
|
+
t.job = void 0, r && i && r.reject(i);
|
|
202
222
|
}
|
|
203
|
-
function
|
|
204
|
-
let
|
|
223
|
+
function at(n, t) {
|
|
224
|
+
let i;
|
|
205
225
|
try {
|
|
206
|
-
|
|
226
|
+
i = (n ?? it)();
|
|
207
227
|
} catch (c) {
|
|
208
228
|
throw new Error(
|
|
209
229
|
`Viewer render worker could not start${c instanceof Error ? `: ${c.message}` : ""}. ${_e}`,
|
|
210
230
|
{ cause: c }
|
|
211
231
|
);
|
|
212
232
|
}
|
|
213
|
-
const r = { worker:
|
|
214
|
-
return t.slots.push(r),
|
|
233
|
+
const r = { worker: i };
|
|
234
|
+
return t.slots.push(r), i.addEventListener("message", (c) => {
|
|
215
235
|
const d = r.job;
|
|
216
|
-
!d || c.data?.id !== d.id || (clearTimeout(r.timer), r.job = void 0, d.resolve(c.data.result), r.idle = setTimeout(() =>
|
|
217
|
-
}),
|
|
218
|
-
c.preventDefault(),
|
|
236
|
+
!d || c.data?.id !== d.id || (clearTimeout(r.timer), r.job = void 0, d.resolve(c.data.result), r.idle = setTimeout(() => le(t, r), ot), ae(n, t));
|
|
237
|
+
}), i.addEventListener("error", (c) => {
|
|
238
|
+
c.preventDefault(), le(
|
|
219
239
|
t,
|
|
220
240
|
r,
|
|
221
241
|
new Error(`${c.message || "Viewer render worker failed."} ${_e}`)
|
|
222
|
-
),
|
|
223
|
-
}),
|
|
224
|
-
|
|
242
|
+
), ae(n, t);
|
|
243
|
+
}), i.addEventListener("messageerror", () => {
|
|
244
|
+
le(t, r, new Error("Viewer render worker returned an unreadable result.")), ae(n, t);
|
|
225
245
|
}), r;
|
|
226
246
|
}
|
|
227
|
-
function
|
|
247
|
+
function ae(n, t) {
|
|
228
248
|
for (; t.queue.length; ) {
|
|
229
|
-
const
|
|
230
|
-
let r = t.slots.find((
|
|
231
|
-
if (!r && t.slots.length >= De && (r = t.slots.find((
|
|
249
|
+
const i = t.queue[0].options.idPrefix;
|
|
250
|
+
let r = t.slots.find((m) => !m.job && m.last === i);
|
|
251
|
+
if (!r && t.slots.length >= De && (r = t.slots.find((m) => !m.job)), !r && t.slots.length < De)
|
|
232
252
|
try {
|
|
233
|
-
r =
|
|
234
|
-
} catch (
|
|
235
|
-
for (const
|
|
253
|
+
r = at(n, t);
|
|
254
|
+
} catch (m) {
|
|
255
|
+
for (const s of t.queue.splice(0)) s.reject(m);
|
|
236
256
|
return;
|
|
237
257
|
}
|
|
238
258
|
if (!r) return;
|
|
239
259
|
const c = t.queue.shift();
|
|
240
|
-
clearTimeout(r.idle), r.job = c, r.last =
|
|
260
|
+
clearTimeout(r.idle), r.job = c, r.last = i;
|
|
241
261
|
const d = r;
|
|
242
262
|
r.timer = setTimeout(() => {
|
|
243
|
-
|
|
263
|
+
le(t, d, new Error("Viewer render worker timed out.")), ae(n, t);
|
|
244
264
|
}, c.timeoutMs), r.worker.postMessage({ id: c.id, source: c.source, options: c.options });
|
|
245
265
|
}
|
|
246
266
|
}
|
|
247
|
-
function
|
|
248
|
-
create:
|
|
267
|
+
function ct(n, t, {
|
|
268
|
+
create: i,
|
|
249
269
|
timeoutMs: r = 5e3,
|
|
250
270
|
signal: c
|
|
251
271
|
}) {
|
|
252
|
-
return new Promise((d,
|
|
253
|
-
const
|
|
254
|
-
Fe.set(
|
|
272
|
+
return new Promise((d, m) => {
|
|
273
|
+
const s = Fe.get(i) ?? { slots: [], queue: [] };
|
|
274
|
+
Fe.set(i, s);
|
|
255
275
|
let f = !1;
|
|
256
|
-
const
|
|
257
|
-
f = !0, c?.removeEventListener("abort",
|
|
258
|
-
},
|
|
259
|
-
id: ++
|
|
260
|
-
source:
|
|
276
|
+
const g = () => {
|
|
277
|
+
f = !0, c?.removeEventListener("abort", p);
|
|
278
|
+
}, x = {
|
|
279
|
+
id: ++st,
|
|
280
|
+
source: n,
|
|
261
281
|
options: t,
|
|
262
282
|
timeoutMs: r,
|
|
263
|
-
resolve: (b) => f || (
|
|
264
|
-
reject: (b) => f || (
|
|
265
|
-
},
|
|
266
|
-
const b =
|
|
267
|
-
b >= 0 &&
|
|
283
|
+
resolve: (b) => f || (g(), d(b)),
|
|
284
|
+
reject: (b) => f || (g(), m(b))
|
|
285
|
+
}, p = () => {
|
|
286
|
+
const b = s.queue.indexOf(x);
|
|
287
|
+
b >= 0 && s.queue.splice(b, 1), x.reject(new Error("Viewer render was aborted."));
|
|
268
288
|
};
|
|
269
|
-
c?.addEventListener("abort",
|
|
289
|
+
c?.addEventListener("abort", p, { once: !0 }), s.queue.push(x), ae(i, s);
|
|
270
290
|
});
|
|
271
291
|
}
|
|
272
|
-
const
|
|
273
|
-
function
|
|
274
|
-
const r =
|
|
275
|
-
|
|
292
|
+
const fe = /* @__PURE__ */ new WeakMap(), we = (n, t) => fe.get(n)?.get(t)?.face;
|
|
293
|
+
function dt(n, t, i) {
|
|
294
|
+
const r = fe.get(n) ?? /* @__PURE__ */ new Map();
|
|
295
|
+
fe.set(n, r);
|
|
276
296
|
const c = r.get(t);
|
|
277
297
|
if (c) return void c.refs++;
|
|
278
|
-
|
|
298
|
+
n.fonts.add(i), r.set(t, { face: i, refs: 1 });
|
|
279
299
|
}
|
|
280
|
-
function pe(
|
|
281
|
-
const
|
|
282
|
-
!r || --r.refs > 0 || (
|
|
300
|
+
function pe(n, t) {
|
|
301
|
+
const i = fe.get(n), r = i?.get(t);
|
|
302
|
+
!r || --r.refs > 0 || (n.fonts.delete(r.face), i.delete(t));
|
|
283
303
|
}
|
|
284
|
-
const
|
|
304
|
+
const lt = "http://www.w3.org/2000/svg", ft = new Set(
|
|
285
305
|
"svg title desc metadata defs style marker g a path rect ellipse circle line polyline polygon text tspan".split(
|
|
286
306
|
" "
|
|
287
307
|
)
|
|
288
|
-
),
|
|
308
|
+
), ut = new Set(
|
|
289
309
|
"aria-labelledby role id data-id data-phase data-state data-theme xmlns viewBox width height x y x1 y1 x2 y2 cx cy r rx ry d points transform fill fill-rule fill-opacity stroke stroke-opacity stroke-width stroke-linecap stroke-linejoin stroke-dasharray opacity font-family font-size font-weight text-anchor dominant-baseline dy text-decoration marker-start marker-end markerWidth markerHeight markerUnits refX refY orient class clip-path nonce href target rel".split(
|
|
290
310
|
" "
|
|
291
311
|
)
|
|
292
312
|
);
|
|
293
|
-
let
|
|
294
|
-
function
|
|
295
|
-
return new
|
|
313
|
+
let mt = 0;
|
|
314
|
+
function ht(n, t) {
|
|
315
|
+
return new n.defaultView.DOMParser().parseFromString(t, "image/svg+xml");
|
|
296
316
|
}
|
|
297
|
-
function
|
|
317
|
+
function gt(n) {
|
|
298
318
|
const t = /* @__PURE__ */ new Map();
|
|
299
|
-
for (const
|
|
300
|
-
const r = (
|
|
301
|
-
if (!Object.values(
|
|
319
|
+
for (const i of Array.from(n.querySelectorAll("text[font-family]"))) {
|
|
320
|
+
const r = (i.getAttribute("font-family") ?? "").split(",")[0].trim().replace(/^['"]|['"]$/g, ""), c = i.getAttribute("font-weight") ?? "400";
|
|
321
|
+
if (!Object.values(Re).some((d) => d.family === r && String(d.weight) === c))
|
|
302
322
|
throw new Error("Runtime SVG requested an unknown bundled font face.");
|
|
303
323
|
t.set(`${r}:${c}`, { family: r, weight: c });
|
|
304
324
|
}
|
|
305
325
|
return [...t.values()];
|
|
306
326
|
}
|
|
307
|
-
function
|
|
308
|
-
const
|
|
309
|
-
for (const r of Array.from(
|
|
327
|
+
function wt(n, t) {
|
|
328
|
+
const i = /* @__PURE__ */ new Map();
|
|
329
|
+
for (const r of Array.from(n.querySelectorAll("style"))) {
|
|
310
330
|
const c = r.textContent ?? "";
|
|
311
331
|
for (const [, d] of c.matchAll(/@font-face\s*\{([^{}]{1,200000})\}/g)) {
|
|
312
|
-
const
|
|
313
|
-
!
|
|
332
|
+
const m = /font-family\s*:\s*['"]([^'"]+)['"]/i.exec(d)?.[1], s = /font-weight\s*:\s*(\d{1,4})/i.exec(d)?.[1], f = /src\s*:\s*url\((data:font\/woff2;base64,[A-Za-z0-9+/=]+)\)/i.exec(d)?.[1];
|
|
333
|
+
!m || !s || !f || Object.values(Re).some((g) => g.family === m && String(g.weight) === s) && i.set(`${m}:${s}`, { family: m, weight: s, data: f });
|
|
314
334
|
}
|
|
315
335
|
}
|
|
316
336
|
return t.map((r) => {
|
|
317
|
-
const c =
|
|
337
|
+
const c = i.get(`${r.family}:${r.weight}`);
|
|
318
338
|
if (!c) throw new Error(`Embedded font ${r.family} ${r.weight} is missing.`);
|
|
319
339
|
return c;
|
|
320
340
|
});
|
|
321
341
|
}
|
|
322
|
-
function
|
|
342
|
+
function pt(n, t, i, r = 1e5) {
|
|
323
343
|
if (t.querySelector("parsererror") || t.documentElement.localName !== "svg")
|
|
324
344
|
throw new Error("Runtime returned invalid SVG.");
|
|
325
345
|
const c = new Set(
|
|
326
|
-
Array.from(t.querySelectorAll("[id]"), (
|
|
346
|
+
Array.from(t.querySelectorAll("[id]"), (s) => s.getAttribute("id") ?? "")
|
|
327
347
|
);
|
|
328
348
|
let d = 0;
|
|
329
|
-
const
|
|
330
|
-
if (++d > r || !
|
|
349
|
+
const m = (s) => {
|
|
350
|
+
if (++d > r || !ft.has(s.localName))
|
|
331
351
|
throw new Error("Runtime SVG exceeded the allowed drawing vocabulary.");
|
|
332
|
-
const f =
|
|
333
|
-
for (const { name:
|
|
334
|
-
if (/^on/i.test(
|
|
335
|
-
if (
|
|
336
|
-
if (
|
|
352
|
+
const f = n.createElementNS(lt, s.localName);
|
|
353
|
+
for (const { name: g, value: x } of Array.from(s.attributes)) {
|
|
354
|
+
if (/^on/i.test(g)) continue;
|
|
355
|
+
if (g === "href") {
|
|
356
|
+
if (s.localName !== "a") continue;
|
|
337
357
|
try {
|
|
338
|
-
const b = new URL(
|
|
358
|
+
const b = new URL(x, n.baseURI);
|
|
339
359
|
(b.protocol === "http:" || b.protocol === "https:") && f.setAttribute("href", b.href);
|
|
340
360
|
} catch {
|
|
341
361
|
}
|
|
342
362
|
continue;
|
|
343
363
|
}
|
|
344
|
-
if (!
|
|
345
|
-
const
|
|
346
|
-
/url\s*\(/i.test(
|
|
364
|
+
if (!ut.has(g) && !/^data-[a-z0-9-]+$/.test(g)) continue;
|
|
365
|
+
const p = [...x.matchAll(/url\(#([^)]*)\)/g)].map((b) => b[1]);
|
|
366
|
+
/url\s*\(/i.test(x) && (p.length === 0 || p.some((b) => !c.has(b))) || g === "aria-labelledby" && x.split(/\s+/).some((b) => !c.has(b)) || f.setAttribute(g, x);
|
|
347
367
|
}
|
|
348
|
-
|
|
349
|
-
for (const
|
|
350
|
-
if (
|
|
351
|
-
else if (
|
|
352
|
-
const
|
|
368
|
+
s.localName === "a" && f.getAttribute("target") === "_blank" && f.setAttribute("rel", "noopener noreferrer");
|
|
369
|
+
for (const g of Array.from(s.childNodes))
|
|
370
|
+
if (g.nodeType === 1) f.append(m(g));
|
|
371
|
+
else if (g.nodeType === 3) {
|
|
372
|
+
const x = g.nodeValue ?? "";
|
|
353
373
|
f.append(
|
|
354
|
-
|
|
355
|
-
|
|
374
|
+
n.createTextNode(
|
|
375
|
+
s.localName === "style" && i ? x.replace(/@font-face\s*\{[^{}]*\}/g, "") : x
|
|
356
376
|
)
|
|
357
377
|
);
|
|
358
378
|
}
|
|
359
379
|
return f;
|
|
360
380
|
};
|
|
361
|
-
return
|
|
381
|
+
return m(t.documentElement);
|
|
362
382
|
}
|
|
363
|
-
function de(
|
|
383
|
+
function de(n, t, i) {
|
|
364
384
|
return {
|
|
365
385
|
ok: !1,
|
|
366
|
-
reason:
|
|
367
|
-
diagnostics: [{ code: t, severity: "error", message:
|
|
386
|
+
reason: n,
|
|
387
|
+
diagnostics: [{ code: t, severity: "error", message: i, itemIds: [] }]
|
|
368
388
|
};
|
|
369
389
|
}
|
|
370
|
-
function
|
|
371
|
-
const
|
|
372
|
-
if (!
|
|
390
|
+
function bt(n, t = {}) {
|
|
391
|
+
const i = n?.ownerDocument?.defaultView;
|
|
392
|
+
if (!i || !(n instanceof i.HTMLElement))
|
|
373
393
|
throw new TypeError("host must be an HTMLElement.");
|
|
374
|
-
if (
|
|
394
|
+
if (n.childNodes.length) throw new Error("Viewer host must be empty and exclusively owned.");
|
|
375
395
|
if ((t.execution ?? { mode: "worker" }).mode === "worker" && t.render?.links?.mode === "safe" && t.render.links.resolve)
|
|
376
396
|
throw new TypeError('A link resolver requires execution: { mode: "main" }.');
|
|
377
|
-
const r =
|
|
397
|
+
const r = n.ownerDocument, c = i, d = r.createElement("section");
|
|
378
398
|
d.className = "draft-viewer", t.outline !== "visible" && d.classList.add("draft-viewer--outline-hidden"), d.setAttribute("aria-label", t.label ?? "Diagram viewer");
|
|
379
|
-
const
|
|
380
|
-
|
|
381
|
-
const
|
|
382
|
-
|
|
399
|
+
const m = r.createElement("div");
|
|
400
|
+
m.className = "draft-viewer__toolbar", m.setAttribute("role", "toolbar"), m.setAttribute("aria-label", "Diagram controls");
|
|
401
|
+
const s = r.createElement("div");
|
|
402
|
+
s.className = "draft-viewer__viewport", s.tabIndex = 0, s.setAttribute("aria-label", t.label ?? "Diagram");
|
|
383
403
|
const f = r.createElement("p");
|
|
384
404
|
f.className = "draft-viewer__status", f.setAttribute("role", "status"), f.setAttribute("aria-live", "polite");
|
|
385
|
-
const
|
|
386
|
-
|
|
387
|
-
const
|
|
405
|
+
const g = r.createElement("ol");
|
|
406
|
+
g.className = "draft-viewer__outline", g.setAttribute("aria-label", "Diagram outline"), d.append(m, s, f, g);
|
|
407
|
+
const x = nt(n, (e) => d.style.colorScheme = e ? "dark" : "light"), p = et(r, {
|
|
388
408
|
detail: t.detail,
|
|
389
|
-
onOverflow: () =>
|
|
409
|
+
onOverflow: () => h()
|
|
390
410
|
});
|
|
391
|
-
|
|
392
|
-
const
|
|
393
|
-
let
|
|
394
|
-
const
|
|
395
|
-
for (const
|
|
411
|
+
s.append(p.el), n.append(d);
|
|
412
|
+
const b = `draftViewer${(++mt).toString(36)}${Math.random().toString(36).slice(2, 9)}`;
|
|
413
|
+
let P = 0, L = !1, E = { centerX: 0, centerY: 0, zoom: 1 }, re = !1, k, Y = { width: 0, height: 0 };
|
|
414
|
+
const W = /* @__PURE__ */ new Set(), G = /* @__PURE__ */ new Map(), J = /* @__PURE__ */ new Map(), F = (e, a) => {
|
|
415
|
+
for (const o of G.get(e) ?? [])
|
|
396
416
|
try {
|
|
397
|
-
|
|
417
|
+
o(a);
|
|
398
418
|
} catch {
|
|
399
419
|
}
|
|
400
|
-
},
|
|
401
|
-
const
|
|
402
|
-
|
|
403
|
-
},
|
|
404
|
-
const e =
|
|
420
|
+
}, U = (e, a) => {
|
|
421
|
+
const o = r.createElement("button");
|
|
422
|
+
o.type = "button", o.textContent = e, o.setAttribute("aria-label", e), o.addEventListener("click", a), m.append(o);
|
|
423
|
+
}, ne = () => {
|
|
424
|
+
const e = s.querySelector("svg");
|
|
405
425
|
if (!e || !k) return;
|
|
406
|
-
const [
|
|
407
|
-
e.style.transformOrigin = "0 0", e.style.transform = `translate(${
|
|
408
|
-
const
|
|
409
|
-
|
|
410
|
-
},
|
|
411
|
-
const e = new Set(
|
|
412
|
-
for (const
|
|
413
|
-
|
|
414
|
-
|
|
426
|
+
const [a, o] = k.viewBox, v = Y, A = E.zoom, C = v.width / 2 - (E.centerX - a) * A, u = v.height / 2 - (E.centerY - o) * A;
|
|
427
|
+
e.style.transformOrigin = "0 0", e.style.transform = `translate(${C}px, ${u}px) scale(${A})`, e.style.width = `${k.width}px`, e.style.height = `${k.height}px`, e.style.maxWidth = "none", p.place(C - a * A, u - o * A, A);
|
|
428
|
+
const q = p.el.dataset.draftDetail;
|
|
429
|
+
s.dataset.draftDetail !== q && (s.dataset.draftDetail = q);
|
|
430
|
+
}, se = () => {
|
|
431
|
+
const e = new Set(p.bodyIds());
|
|
432
|
+
for (const a of s.querySelectorAll(":scope > svg [data-id]"))
|
|
433
|
+
a.toggleAttribute("data-draft-body", e.has(a.getAttribute("data-id")));
|
|
434
|
+
F("anchors", { anchors: p.anchors() });
|
|
415
435
|
};
|
|
416
|
-
let
|
|
436
|
+
let l = {
|
|
417
437
|
revision: 0,
|
|
418
438
|
diagnostics: [],
|
|
419
439
|
stale: !1
|
|
420
440
|
};
|
|
421
|
-
const
|
|
422
|
-
...
|
|
423
|
-
diagnostics: [...
|
|
441
|
+
const h = () => F("diagnostics", {
|
|
442
|
+
...l,
|
|
443
|
+
diagnostics: [...l.diagnostics, ...p.warnings()]
|
|
424
444
|
});
|
|
425
|
-
let w = "user",
|
|
426
|
-
const
|
|
427
|
-
w = e, !
|
|
428
|
-
|
|
445
|
+
let w = "user", M = 0;
|
|
446
|
+
const _ = (e) => c.requestAnimationFrame ? c.requestAnimationFrame(e) : c.setTimeout(e, 16), S = (e) => {
|
|
447
|
+
w = e, !M && (M = _(() => {
|
|
448
|
+
M = 0, L || F("camera", { camera: { ...E }, reason: w });
|
|
429
449
|
}));
|
|
430
|
-
},
|
|
450
|
+
}, z = (e, a, o) => {
|
|
431
451
|
const v = { ...e, zoom: ye(e.zoom) };
|
|
432
|
-
return
|
|
433
|
-
},
|
|
434
|
-
const [e,
|
|
435
|
-
return { x: e, y:
|
|
452
|
+
return re = o, Ke(E, v) ? "unchanged" : (E = v, ne(), S(a), "moved");
|
|
453
|
+
}, O = () => {
|
|
454
|
+
const [e, a, o, v] = k.viewBox;
|
|
455
|
+
return { x: e, y: a, width: o, height: v };
|
|
436
456
|
};
|
|
437
|
-
let
|
|
438
|
-
const
|
|
439
|
-
let
|
|
440
|
-
const
|
|
441
|
-
const v = e ? Ge(e.flatMap((A) =>
|
|
442
|
-
return v ?
|
|
443
|
-
}),
|
|
444
|
-
|
|
445
|
-
const
|
|
446
|
-
const
|
|
447
|
-
|
|
457
|
+
let N = null;
|
|
458
|
+
const B = (e) => N ? Ne(N, e) : void 0;
|
|
459
|
+
let D;
|
|
460
|
+
const $ = (e) => L ? "unchanged" : !k || !Y.width || !Y.height ? (D = e, "pending") : (D = void 0, e()), I = (e, a, o) => $(() => {
|
|
461
|
+
const v = e ? Ge(e.flatMap((A) => B(A) ?? [])) : O();
|
|
462
|
+
return v ? z(Ie(v, Y, a), o, !!e) : "missing";
|
|
463
|
+
}), Q = (e = "fit") => I(void 0, void 0, e), Z = (e) => z({ ...E, zoom: E.zoom * e }, "user", !0), ue = () => z({ ...E, zoom: 1 }, "user", !0);
|
|
464
|
+
U("Zoom in", () => Z(1.2)), U("Zoom out", () => Z(1 / 1.2)), U("Fit diagram", () => Q()), U("Actual size", ue), m.hidden = t.toolbar === !1;
|
|
465
|
+
const ee = new c.ResizeObserver((e) => {
|
|
466
|
+
const a = e.at(-1)?.contentRect;
|
|
467
|
+
a && (Y = { width: a.width, height: a.height }), !(k && !Y.width) && (D ? $(D) : re ? ne() : Q("resize"));
|
|
448
468
|
});
|
|
449
|
-
|
|
450
|
-
const
|
|
451
|
-
f.textContent =
|
|
452
|
-
},
|
|
453
|
-
const
|
|
454
|
-
if (!
|
|
469
|
+
ee.observe(s);
|
|
470
|
+
const H = (e, a) => {
|
|
471
|
+
f.textContent = a.map((o) => o.message).join(" "), d.classList.add("draft-viewer--stale"), l = { revision: e, diagnostics: a, stale: !!k }, h();
|
|
472
|
+
}, ie = async (e, a) => {
|
|
473
|
+
const o = gt(e);
|
|
474
|
+
if (!o.length) return [];
|
|
455
475
|
if (!r.fonts) throw new Error("The host document cannot load diagram fonts.");
|
|
456
|
-
if (
|
|
457
|
-
for (const u of
|
|
458
|
-
const
|
|
459
|
-
if (!(await r.fonts.load(
|
|
460
|
-
(
|
|
461
|
-
) || !r.fonts.check(
|
|
476
|
+
if (a === "host") {
|
|
477
|
+
for (const u of o) {
|
|
478
|
+
const q = `${u.weight} 12px "${u.family}"`;
|
|
479
|
+
if (!(await r.fonts.load(q)).some(
|
|
480
|
+
(V) => V.family.replace(/^['"]|['"]$/g, "") === u.family && V.weight === u.weight && V.status === "loaded"
|
|
481
|
+
) || !r.fonts.check(q))
|
|
462
482
|
throw new Error(`Host font ${u.family} ${u.weight} is unavailable.`);
|
|
463
483
|
}
|
|
464
484
|
return [];
|
|
465
485
|
}
|
|
466
|
-
const v =
|
|
486
|
+
const v = o.map((u) => `${u.family}:${u.weight}`);
|
|
467
487
|
if (v.every((u) => we(r, u)))
|
|
468
488
|
return v.map((u) => ({ key: u, face: we(r, u) }));
|
|
469
|
-
const A =
|
|
470
|
-
if (!
|
|
489
|
+
const A = wt(e, o), C = c.FontFace;
|
|
490
|
+
if (!C) throw new Error("The browser cannot load embedded diagram fonts.");
|
|
471
491
|
return Promise.all(
|
|
472
492
|
A.map(async (u) => {
|
|
473
|
-
const
|
|
474
|
-
if (te) return { key:
|
|
475
|
-
const
|
|
476
|
-
if (await
|
|
493
|
+
const q = `${u.family}:${u.weight}`, te = we(r, q);
|
|
494
|
+
if (te) return { key: q, face: te };
|
|
495
|
+
const T = new C(u.family, `url("${u.data}")`, { weight: u.weight });
|
|
496
|
+
if (await T.load(), T.status !== "loaded")
|
|
477
497
|
throw new Error(`Embedded font ${u.family} ${u.weight} did not load.`);
|
|
478
|
-
return { key:
|
|
498
|
+
return { key: q, face: T };
|
|
479
499
|
})
|
|
480
500
|
);
|
|
481
|
-
},
|
|
501
|
+
}, Ce = async (e, a, o) => {
|
|
482
502
|
const v = t.execution ?? { mode: "worker" };
|
|
483
503
|
if (v.mode === "main") {
|
|
484
|
-
const { renderSvg: A } = await import("./render-
|
|
485
|
-
return A(e, { ...
|
|
504
|
+
const { renderSvg: A } = await import("./render-DU-eRw6k.js");
|
|
505
|
+
return A(e, { ...a, signal: o });
|
|
486
506
|
}
|
|
487
|
-
return
|
|
507
|
+
return ct(e, a, {
|
|
488
508
|
create: v.createWorker,
|
|
489
509
|
timeoutMs: v.timeoutMs,
|
|
490
|
-
signal:
|
|
510
|
+
signal: o
|
|
491
511
|
});
|
|
492
512
|
};
|
|
493
|
-
let
|
|
494
|
-
const
|
|
495
|
-
const
|
|
496
|
-
return e ===
|
|
497
|
-
}, ve = (e) => !(e.target instanceof c.Node) || !
|
|
498
|
-
|
|
513
|
+
let R;
|
|
514
|
+
const qe = (e) => {
|
|
515
|
+
const a = s.querySelector("svg"), o = a?.querySelector(":scope > rect");
|
|
516
|
+
return e === s || e === a || e === o;
|
|
517
|
+
}, ve = (e) => !(e.target instanceof c.Node) || !s.contains(e.target) || p.el.contains(e.target), Ve = (e) => e.composedPath().some((a) => a instanceof c.Element && a.hasAttribute("data-draft-input"));
|
|
518
|
+
s.addEventListener(
|
|
499
519
|
"wheel",
|
|
500
520
|
(e) => {
|
|
501
|
-
|
|
521
|
+
Ve(e) || (e.preventDefault(), Z(e.deltaY < 0 ? 1.1 : 1 / 1.1));
|
|
502
522
|
},
|
|
503
523
|
{ passive: !1 }
|
|
504
|
-
),
|
|
505
|
-
!
|
|
524
|
+
), s.addEventListener("pointerdown", (e) => {
|
|
525
|
+
!qe(e.target) || !k || (R = {
|
|
506
526
|
pointerId: e.pointerId,
|
|
507
527
|
x: e.clientX,
|
|
508
528
|
y: e.clientY,
|
|
509
|
-
centerX:
|
|
510
|
-
centerY:
|
|
511
|
-
scale:
|
|
512
|
-
},
|
|
513
|
-
}),
|
|
514
|
-
|
|
529
|
+
centerX: E.centerX,
|
|
530
|
+
centerY: E.centerY,
|
|
531
|
+
scale: E.zoom
|
|
532
|
+
}, s.setPointerCapture(e.pointerId));
|
|
533
|
+
}), s.addEventListener("pointermove", (e) => {
|
|
534
|
+
R && z(
|
|
515
535
|
{
|
|
516
|
-
centerX:
|
|
517
|
-
centerY:
|
|
518
|
-
zoom:
|
|
536
|
+
centerX: R.centerX - (e.clientX - R.x) / R.scale,
|
|
537
|
+
centerY: R.centerY - (e.clientY - R.y) / R.scale,
|
|
538
|
+
zoom: E.zoom
|
|
519
539
|
},
|
|
520
540
|
"user",
|
|
521
541
|
!0
|
|
522
542
|
);
|
|
523
543
|
});
|
|
524
544
|
const be = () => {
|
|
525
|
-
if (
|
|
545
|
+
if (R) {
|
|
526
546
|
try {
|
|
527
|
-
|
|
547
|
+
s.releasePointerCapture(R.pointerId);
|
|
528
548
|
} catch {
|
|
529
549
|
}
|
|
530
|
-
|
|
550
|
+
R = void 0;
|
|
531
551
|
}
|
|
532
552
|
};
|
|
533
|
-
|
|
553
|
+
s.addEventListener("pointerup", be), s.addEventListener("pointercancel", be), s.addEventListener("click", (e) => {
|
|
534
554
|
if (ve(e)) return;
|
|
535
|
-
const
|
|
536
|
-
if (
|
|
537
|
-
const
|
|
538
|
-
|
|
539
|
-
itemId:
|
|
555
|
+
const a = e.target instanceof c.Element ? e.target : null, o = a?.closest("a[href]");
|
|
556
|
+
if (o && s.contains(o)) {
|
|
557
|
+
const C = o.querySelector("[data-id]")?.getAttribute("data-id"), u = o.getAttribute("href");
|
|
558
|
+
C && u && F("link", {
|
|
559
|
+
itemId: C,
|
|
540
560
|
href: u,
|
|
541
|
-
target:
|
|
561
|
+
target: o.getAttribute("target") === "_blank" ? "_blank" : "_self",
|
|
542
562
|
preventDefault: () => e.preventDefault()
|
|
543
563
|
});
|
|
544
564
|
return;
|
|
545
565
|
}
|
|
546
|
-
const v =
|
|
547
|
-
A &&
|
|
548
|
-
}),
|
|
566
|
+
const v = a?.closest("[data-id]")?.getAttribute("data-id"), A = k?.items.find((C) => C.id === v);
|
|
567
|
+
A && F("itemactivate", { id: A.id, kind: A.kind, input: "pointer", revision: P });
|
|
568
|
+
}), s.addEventListener("contextmenu", (e) => {
|
|
549
569
|
if (ve(e)) return;
|
|
550
|
-
const
|
|
551
|
-
|
|
570
|
+
const o = (e.target instanceof c.Element ? e.target : null)?.closest("[data-id]")?.getAttribute("data-id") ?? null, v = o ? k?.items.find((A) => A.id === o) : void 0;
|
|
571
|
+
F("contextmenu", {
|
|
552
572
|
id: v?.id ?? null,
|
|
553
573
|
...v ? { kind: v.kind } : {},
|
|
554
574
|
clientX: e.clientX,
|
|
555
575
|
clientY: e.clientY,
|
|
556
576
|
preventDefault: () => e.preventDefault()
|
|
557
577
|
});
|
|
558
|
-
}),
|
|
559
|
-
const
|
|
560
|
-
|
|
561
|
-
}),
|
|
562
|
-
e.key === "Escape" &&
|
|
563
|
-
}),
|
|
578
|
+
}), p.el.addEventListener("focusin", (e) => {
|
|
579
|
+
const a = e.target instanceof c.Node ? p.idOf(e.target) : void 0;
|
|
580
|
+
a && !p.pressed() && xe.reveal(a);
|
|
581
|
+
}), p.el.addEventListener("keydown", (e) => {
|
|
582
|
+
e.key === "Escape" && s.focus({ preventScroll: !0 });
|
|
583
|
+
}), p.el.addEventListener(
|
|
564
584
|
"draft-anchor-focus-lost",
|
|
565
|
-
() =>
|
|
566
|
-
),
|
|
567
|
-
e.target !==
|
|
585
|
+
() => s.focus({ preventScroll: !0 })
|
|
586
|
+
), s.addEventListener("keydown", (e) => {
|
|
587
|
+
e.target !== s || e.altKey || e.ctrlKey || e.metaKey || (e.key === "+" || e.key === "=" ? Z(1.2) : e.key === "-" ? Z(1 / 1.2) : e.key.toLowerCase() === "f" && Q());
|
|
568
588
|
});
|
|
569
|
-
const
|
|
570
|
-
for (const [
|
|
571
|
-
|
|
589
|
+
const je = (e, a) => {
|
|
590
|
+
for (const [o, v] of J)
|
|
591
|
+
o !== e && v.resolve({ status: a, revision: o });
|
|
572
592
|
};
|
|
573
593
|
let me = () => {
|
|
574
594
|
};
|
|
575
|
-
const
|
|
576
|
-
const
|
|
577
|
-
if (
|
|
578
|
-
|
|
595
|
+
const Pe = (e, a = {}) => {
|
|
596
|
+
const o = ++P;
|
|
597
|
+
if (L) return Promise.resolve({ status: "destroyed", revision: o });
|
|
598
|
+
je(o, "superseded"), me();
|
|
579
599
|
const v = new AbortController();
|
|
580
600
|
return me = () => v.abort(), new Promise((A) => {
|
|
581
|
-
let
|
|
582
|
-
const u = (
|
|
583
|
-
if (
|
|
584
|
-
|
|
585
|
-
const
|
|
586
|
-
A(
|
|
587
|
-
},
|
|
588
|
-
v.abort(), u({ status: "aborted", revision:
|
|
601
|
+
let C = !1;
|
|
602
|
+
const u = (T) => {
|
|
603
|
+
if (C) return;
|
|
604
|
+
C = !0, a.signal?.removeEventListener("abort", q), J.delete(o);
|
|
605
|
+
const V = L ? { status: "destroyed", revision: o } : o !== P ? { status: "superseded", revision: o } : a.signal?.aborted ? { status: "aborted", revision: o } : T;
|
|
606
|
+
A(V);
|
|
607
|
+
}, q = () => {
|
|
608
|
+
v.abort(), u({ status: "aborted", revision: o });
|
|
589
609
|
};
|
|
590
|
-
if (
|
|
591
|
-
|
|
610
|
+
if (J.set(o, { resolve: u }), a.signal?.aborted) {
|
|
611
|
+
q();
|
|
592
612
|
return;
|
|
593
613
|
}
|
|
594
|
-
|
|
614
|
+
a.signal?.addEventListener("abort", q, { once: !0 });
|
|
595
615
|
const te = {
|
|
596
616
|
...t.render ?? {},
|
|
597
617
|
target: "inline",
|
|
598
|
-
idPrefix:
|
|
618
|
+
idPrefix: b,
|
|
599
619
|
fonts: t.render?.fonts ?? "embed",
|
|
600
|
-
|
|
620
|
+
colorScheme: "auto",
|
|
621
|
+
...a.state !== void 0 ? { state: a.state } : {}
|
|
601
622
|
};
|
|
602
|
-
|
|
603
|
-
if (
|
|
604
|
-
u({ status: "superseded", revision:
|
|
623
|
+
Ce(e, te, v.signal).then(async (T) => {
|
|
624
|
+
if (L || o !== P || a.signal?.aborted) {
|
|
625
|
+
u({ status: "superseded", revision: o });
|
|
605
626
|
return;
|
|
606
627
|
}
|
|
607
|
-
if (!
|
|
608
|
-
|
|
628
|
+
if (!T.ok) {
|
|
629
|
+
H(o, T.diagnostics), u({ status: "error", revision: o, error: T });
|
|
609
630
|
return;
|
|
610
631
|
}
|
|
611
|
-
let
|
|
632
|
+
let V, he;
|
|
612
633
|
try {
|
|
613
|
-
he =
|
|
634
|
+
he = ht(r, T.value.svg), V = await ie(he, te.fonts ?? "embed");
|
|
614
635
|
} catch (y) {
|
|
615
|
-
if (
|
|
636
|
+
if (L || o !== P || a.signal?.aborted) {
|
|
616
637
|
u({
|
|
617
|
-
status:
|
|
618
|
-
revision:
|
|
638
|
+
status: a.signal?.aborted ? "aborted" : "superseded",
|
|
639
|
+
revision: o
|
|
619
640
|
});
|
|
620
641
|
return;
|
|
621
642
|
}
|
|
622
|
-
const
|
|
643
|
+
const j = de(
|
|
623
644
|
"environment",
|
|
624
645
|
"DRAFT_FONT_UNAVAILABLE",
|
|
625
646
|
y instanceof Error ? y.message : "Diagram fonts are unavailable."
|
|
626
647
|
);
|
|
627
|
-
|
|
648
|
+
H(o, j.diagnostics), u({ status: "error", revision: o, error: j });
|
|
628
649
|
return;
|
|
629
650
|
}
|
|
630
|
-
if (
|
|
631
|
-
u({ status: "superseded", revision:
|
|
651
|
+
if (L || o !== P || a.signal?.aborted) {
|
|
652
|
+
u({ status: "superseded", revision: o });
|
|
632
653
|
return;
|
|
633
654
|
}
|
|
634
655
|
let ge;
|
|
635
656
|
try {
|
|
636
|
-
ge =
|
|
657
|
+
ge = pt(r, he, te.fonts !== "host");
|
|
637
658
|
} catch (y) {
|
|
638
|
-
const
|
|
639
|
-
|
|
659
|
+
const j = y instanceof Error ? y.message : "Could not build safe SVG.", X = de("internal", "DRAFT_VIEWER_DOM", j);
|
|
660
|
+
H(o, X.diagnostics), u({ status: "error", revision: o, error: X });
|
|
640
661
|
return;
|
|
641
662
|
}
|
|
642
663
|
const ke = [];
|
|
643
664
|
try {
|
|
644
|
-
for (const y of
|
|
645
|
-
|
|
665
|
+
for (const y of V)
|
|
666
|
+
W.has(y.key) || (dt(r, y.key, y.face), W.add(y.key), ke.push(y.key));
|
|
646
667
|
} catch (y) {
|
|
647
|
-
for (const
|
|
648
|
-
pe(r,
|
|
649
|
-
const
|
|
668
|
+
for (const X of ke)
|
|
669
|
+
pe(r, X), W.delete(X);
|
|
670
|
+
const j = de(
|
|
650
671
|
"environment",
|
|
651
672
|
"DRAFT_FONT_UNAVAILABLE",
|
|
652
673
|
y instanceof Error ? y.message : "Loaded fonts could not be registered."
|
|
653
674
|
);
|
|
654
|
-
|
|
675
|
+
H(o, j.diagnostics), u({ status: "error", revision: o, error: j });
|
|
655
676
|
return;
|
|
656
677
|
}
|
|
657
|
-
const
|
|
658
|
-
k =
|
|
659
|
-
const Ae =
|
|
660
|
-
Ae ? Ae.replaceWith(ge) :
|
|
661
|
-
const Se =
|
|
662
|
-
|
|
678
|
+
const Ye = !!k;
|
|
679
|
+
k = T.value, N = k.geometry ? { ...k.geometry, revision: o } : null;
|
|
680
|
+
const Ae = s.querySelector(":scope > svg");
|
|
681
|
+
Ae ? Ae.replaceWith(ge) : s.prepend(ge), p.setGeometry(N);
|
|
682
|
+
const Se = g.getRootNode().activeElement, Le = g.contains(Se) ? Se.dataset.itemId : void 0;
|
|
683
|
+
g.replaceChildren(
|
|
663
684
|
...k.items.map((y) => {
|
|
664
|
-
const
|
|
665
|
-
|
|
666
|
-
const
|
|
667
|
-
return
|
|
668
|
-
|
|
685
|
+
const j = r.createElement("li"), X = r.createElement("button");
|
|
686
|
+
X.type = "button";
|
|
687
|
+
const Ze = y.label.trim() || (y.kind === "edge" ? `${y.from ?? "?"} to ${y.to ?? "?"}` : y.id);
|
|
688
|
+
return X.textContent = `${y.kind}: ${Ze}`, X.dataset.itemId = y.id, X.addEventListener("click", () => {
|
|
689
|
+
F("itemactivate", {
|
|
669
690
|
id: y.id,
|
|
670
691
|
kind: y.kind,
|
|
671
692
|
input: "keyboard",
|
|
672
|
-
revision:
|
|
693
|
+
revision: o
|
|
673
694
|
});
|
|
674
|
-
const Me = Array.from(
|
|
675
|
-
(
|
|
695
|
+
const Me = Array.from(s.querySelectorAll("[data-id]")).find(
|
|
696
|
+
(K) => K.getAttribute("data-id") === y.id
|
|
676
697
|
);
|
|
677
698
|
if (Me) {
|
|
678
|
-
const
|
|
679
|
-
(
|
|
699
|
+
const K = Me.getBoundingClientRect(), oe = s.getBoundingClientRect();
|
|
700
|
+
(K.width || K.height) && oe.width && oe.height && z(
|
|
680
701
|
{
|
|
681
|
-
centerX:
|
|
682
|
-
centerY:
|
|
683
|
-
zoom: Math.max(1,
|
|
702
|
+
centerX: E.centerX + (K.left + K.width / 2 - (oe.left + oe.width / 2)) / E.zoom,
|
|
703
|
+
centerY: E.centerY + (K.top + K.height / 2 - (oe.top + oe.height / 2)) / E.zoom,
|
|
704
|
+
zoom: Math.max(1, E.zoom)
|
|
684
705
|
},
|
|
685
706
|
"user",
|
|
686
707
|
!0
|
|
687
708
|
);
|
|
688
709
|
}
|
|
689
|
-
}),
|
|
710
|
+
}), j.append(X), j;
|
|
690
711
|
})
|
|
691
|
-
), Le !== void 0 && (Array.from(
|
|
692
|
-
(
|
|
693
|
-
) ??
|
|
694
|
-
const
|
|
695
|
-
for (const y of
|
|
696
|
-
|
|
697
|
-
d.classList.remove("draft-viewer--stale"), f.textContent =
|
|
698
|
-
const
|
|
712
|
+
), Le !== void 0 && (Array.from(g.querySelectorAll("button")).find(
|
|
713
|
+
(j) => j.dataset.itemId === Le
|
|
714
|
+
) ?? s).focus({ preventScroll: !0 });
|
|
715
|
+
const We = new Set(V.map((y) => y.key));
|
|
716
|
+
for (const y of W)
|
|
717
|
+
We.has(y) || (pe(r, y), W.delete(y));
|
|
718
|
+
d.classList.remove("draft-viewer--stale"), f.textContent = T.diagnostics.map((y) => y.message).join(" "), D ? $(D) : !Ye || a.camera === "fit" ? Q() : ne();
|
|
719
|
+
const Be = {
|
|
699
720
|
status: "committed",
|
|
700
|
-
revision:
|
|
721
|
+
revision: o,
|
|
701
722
|
value: k,
|
|
702
|
-
diagnostics:
|
|
723
|
+
diagnostics: T.diagnostics
|
|
703
724
|
};
|
|
704
|
-
|
|
705
|
-
}).catch((
|
|
706
|
-
if (
|
|
725
|
+
x.check(), F("render", { revision: o, value: k, geometry: N }), l = { revision: o, diagnostics: T.diagnostics, stale: !1 }, h(), se(), u(Be);
|
|
726
|
+
}).catch((T) => {
|
|
727
|
+
if (L || o !== P || a.signal?.aborted) {
|
|
707
728
|
u({
|
|
708
|
-
status:
|
|
709
|
-
revision:
|
|
729
|
+
status: a.signal?.aborted ? "aborted" : "superseded",
|
|
730
|
+
revision: o
|
|
710
731
|
});
|
|
711
732
|
return;
|
|
712
733
|
}
|
|
713
|
-
const
|
|
734
|
+
const V = de(
|
|
714
735
|
"environment",
|
|
715
736
|
"DRAFT_VIEWER_WORKER",
|
|
716
|
-
|
|
737
|
+
T instanceof Error ? T.message : "Viewer render failed."
|
|
717
738
|
);
|
|
718
|
-
|
|
739
|
+
H(o, V.diagnostics), u({ status: "error", revision: o, error: V });
|
|
719
740
|
});
|
|
720
741
|
});
|
|
721
742
|
};
|
|
722
|
-
let
|
|
723
|
-
const
|
|
743
|
+
let ce, Ee;
|
|
744
|
+
const Xe = new Promise((e) => Ee = e), xe = {
|
|
724
745
|
get ready() {
|
|
725
|
-
return
|
|
746
|
+
return ce ?? Xe;
|
|
726
747
|
},
|
|
727
|
-
update: (e,
|
|
728
|
-
const
|
|
729
|
-
(A) => A.status === "superseded" &&
|
|
748
|
+
update: (e, a) => {
|
|
749
|
+
const o = Pe(e, a), v = o.then(
|
|
750
|
+
(A) => A.status === "superseded" && ce !== v ? ce : A
|
|
730
751
|
);
|
|
731
|
-
return
|
|
752
|
+
return ce = v, v.then(Ee), o;
|
|
732
753
|
},
|
|
733
|
-
geometry: () =>
|
|
754
|
+
geometry: () => N,
|
|
734
755
|
anchor(e) {
|
|
735
|
-
if (
|
|
736
|
-
const
|
|
737
|
-
|
|
756
|
+
if (L) return;
|
|
757
|
+
const a = p.warnings().length;
|
|
758
|
+
p.setSlots(e), ne(), se(), (p.warnings().length || a) && h();
|
|
738
759
|
},
|
|
739
|
-
on(e,
|
|
740
|
-
if (
|
|
760
|
+
on(e, a) {
|
|
761
|
+
if (L) return () => {
|
|
741
762
|
};
|
|
742
|
-
const
|
|
743
|
-
return
|
|
763
|
+
const o = G.get(e) ?? /* @__PURE__ */ new Set();
|
|
764
|
+
return o.add(a), G.set(e, o), () => o.delete(a);
|
|
744
765
|
},
|
|
745
|
-
getCamera: () => ({ ...
|
|
766
|
+
getCamera: () => ({ ...E }),
|
|
746
767
|
setCamera(e) {
|
|
747
|
-
|
|
768
|
+
L || !Number.isFinite(e.centerX) || !Number.isFinite(e.centerY) || !Number.isFinite(e.zoom) || e.zoom <= 0 || z({ ...e }, "api", !0);
|
|
748
769
|
},
|
|
749
|
-
fit: (e,
|
|
750
|
-
reveal: (e,
|
|
751
|
-
const
|
|
752
|
-
return
|
|
770
|
+
fit: (e, a) => I(e, a, "api"),
|
|
771
|
+
reveal: (e, a) => $(() => {
|
|
772
|
+
const o = B(e);
|
|
773
|
+
return o ? z(Ue(E, o, Y, a), "api", !0) : "missing";
|
|
753
774
|
}),
|
|
754
775
|
focusItem(e) {
|
|
755
|
-
if (!k?.items.some((
|
|
756
|
-
const
|
|
757
|
-
(
|
|
776
|
+
if (!k?.items.some((o) => o.id === e)) return !1;
|
|
777
|
+
const a = Array.from(g.querySelectorAll("button")).find(
|
|
778
|
+
(o) => o.dataset.itemId === e
|
|
758
779
|
);
|
|
759
|
-
return
|
|
780
|
+
return a?.focus(), !!a;
|
|
760
781
|
},
|
|
761
782
|
destroy() {
|
|
762
|
-
if (!
|
|
763
|
-
if (
|
|
783
|
+
if (!L) {
|
|
784
|
+
if (L = !0, x.stop(), P++, D = void 0, M && (c.cancelAnimationFrame ?? c.clearTimeout)(M), R) {
|
|
764
785
|
try {
|
|
765
|
-
|
|
786
|
+
s.releasePointerCapture(R.pointerId);
|
|
766
787
|
} catch {
|
|
767
788
|
}
|
|
768
|
-
|
|
789
|
+
R = void 0;
|
|
769
790
|
}
|
|
770
|
-
for (const [e,
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
for (const e of
|
|
774
|
-
|
|
791
|
+
for (const [e, a] of J)
|
|
792
|
+
a.resolve({ status: "destroyed", revision: e });
|
|
793
|
+
J.clear(), me();
|
|
794
|
+
for (const e of W) pe(r, e);
|
|
795
|
+
W.clear(), ee.disconnect(), F("anchors", { anchors: [] }), p.destroy(), G.clear(), n.replaceChildren(), k = void 0;
|
|
775
796
|
}
|
|
776
797
|
}
|
|
777
798
|
};
|
|
@@ -780,7 +801,7 @@ function wt(o, t = {}) {
|
|
|
780
801
|
export {
|
|
781
802
|
ze as ZOOM_MAX,
|
|
782
803
|
$e as ZOOM_MIN,
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
804
|
+
kt as fontMetricsVersion,
|
|
805
|
+
bt as mountViewer,
|
|
806
|
+
St as runtimeVersion
|
|
786
807
|
};
|