@celldl/viewer 0.20260730.0 → 0.20260731.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 +13 -10
- package/dist/CellDLViewer-VYbEXBgZ.js +12034 -0
- package/dist/CellDLViewer-VYbEXBgZ.js.map +1 -0
- package/dist/CellDLViewer.css +1 -0
- package/dist/CellDLViewer.es.js +1 -2
- package/dist/CellDLViewer.es.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +11 -10
- package/dist/CellDLViewer-Cyo8fJde.js +0 -1463
- package/dist/CellDLViewer-Cyo8fJde.js.map +0 -1
- package/dist/vendor-BsdU7enb.js +0 -14131
- package/dist/vendor-BsdU7enb.js.map +0 -1
- package/dist/viewer.css +0 -1
|
@@ -1,1463 +0,0 @@
|
|
|
1
|
-
import { c as ct, d as ut, i as O, f as dt, t as A, a as ft, b as mt, e as pt, g as gt, h as yt, u as wt, P as vt, Q as xt, p as Ct, j as bt, s as Et } from "./vendor-BsdU7enb.js";
|
|
2
|
-
import * as f from "vue";
|
|
3
|
-
import { defineComponent as St, openBlock as It, createElementBlock as Tt, createElementVNode as F, createVNode as Pt } from "vue";
|
|
4
|
-
const G = ct(() => {
|
|
5
|
-
const n = window.matchMedia("(prefers-color-scheme: light)"), t = f.ref(n.matches), e = f.ref(!n.matches), s = f.ref("system");
|
|
6
|
-
function i(g) {
|
|
7
|
-
t.value = g.matches, e.value = !g.matches;
|
|
8
|
-
}
|
|
9
|
-
function r() {
|
|
10
|
-
document.documentElement.classList.toggle("celldl-dark-mode", e.value);
|
|
11
|
-
}
|
|
12
|
-
n.addEventListener("change", (g) => {
|
|
13
|
-
s.value === "system" && (i(g), r());
|
|
14
|
-
});
|
|
15
|
-
function l() {
|
|
16
|
-
return s.value;
|
|
17
|
-
}
|
|
18
|
-
function a(g) {
|
|
19
|
-
s.value = g ?? "system", s.value === "light" ? (t.value = !0, e.value = !1) : s.value === "dark" ? (t.value = !1, e.value = !0) : i(n), r();
|
|
20
|
-
}
|
|
21
|
-
function c() {
|
|
22
|
-
return t.value;
|
|
23
|
-
}
|
|
24
|
-
function B() {
|
|
25
|
-
return e.value;
|
|
26
|
-
}
|
|
27
|
-
return {
|
|
28
|
-
theme: l,
|
|
29
|
-
setTheme: a,
|
|
30
|
-
useLightMode: c,
|
|
31
|
-
useDarkMode: B
|
|
32
|
-
};
|
|
33
|
-
}), tt = 16, Lt = tt / 2, et = 2.54, Nt = 10 * et, Dt = 72, Mt = 6, S = 96, Ot = /* @__PURE__ */ new Map([
|
|
34
|
-
["px", 1],
|
|
35
|
-
["in", S],
|
|
36
|
-
["cm", S / et],
|
|
37
|
-
["mm", S / Nt],
|
|
38
|
-
["pt", S / Dt],
|
|
39
|
-
["pc", S / Mt],
|
|
40
|
-
["%", null],
|
|
41
|
-
// 1/100.0 of viewport dimension
|
|
42
|
-
["em", tt],
|
|
43
|
-
// em/pt depends on current font size
|
|
44
|
-
["ex", Lt]
|
|
45
|
-
// ex/pt depends on current font size
|
|
46
|
-
]), At = /(.*)(em|ex|px|in|cm|mm|pt|pc|%)/;
|
|
47
|
-
function H(n) {
|
|
48
|
-
if (typeof n != "string")
|
|
49
|
-
return n;
|
|
50
|
-
const t = n.match(At);
|
|
51
|
-
if (t === null || t.length < 3)
|
|
52
|
-
return +n;
|
|
53
|
-
{
|
|
54
|
-
const e = Ot.get(t[2]);
|
|
55
|
-
if (e != null)
|
|
56
|
-
return e * +t[1];
|
|
57
|
-
}
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
const Rt = "http://www.w3.org/2000/svg";
|
|
61
|
-
function R(n) {
|
|
62
|
-
return n.getAttribute("viewBox")?.split(" ").map((t) => +t);
|
|
63
|
-
}
|
|
64
|
-
function st(n) {
|
|
65
|
-
const t = [];
|
|
66
|
-
for (const [e, s] of Object.entries(n))
|
|
67
|
-
t.push(` ${e}="${s}"`);
|
|
68
|
-
return t.join("");
|
|
69
|
-
}
|
|
70
|
-
function Vt(n, t, e) {
|
|
71
|
-
return Object.assign({}, e, {
|
|
72
|
-
cx: `${n.x}`,
|
|
73
|
-
cy: `${n.y}`,
|
|
74
|
-
r: `${t}`
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
function $t(n, t, e = {}) {
|
|
78
|
-
return `<circle${st(Vt(n, t, e))}/>`;
|
|
79
|
-
}
|
|
80
|
-
function jt(n, t, e) {
|
|
81
|
-
return Object.assign({}, e, {
|
|
82
|
-
x: `${Math.min(n.x, t.x)}`,
|
|
83
|
-
y: `${Math.min(n.y, t.y)}`,
|
|
84
|
-
width: `${Math.abs(t.x - n.x)}`,
|
|
85
|
-
height: `${Math.abs(t.y - n.y)}`
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
function kt(n, t, e = {}) {
|
|
89
|
-
return `<rect${st(jt(n, t, e))}/>`;
|
|
90
|
-
}
|
|
91
|
-
const it = "http://celldl.org/ontologies/celldl#", _t = "https://bg-rdf.org/ontologies/bondgraph#", Ut = "https://bg-rdf.org/ontologies/bondgraph-framework#", Bt = "https://w3id.org/cdt/", Ft = "https://bg-rdf.org/templates/", Gt = "http://purl.org/dc/terms/", Ht = "http://www.w3.org/2002/07/owl#", nt = "http://www.w3.org/1999/02/22-rdf-syntax-ns#", qt = "http://www.w3.org/2000/01/rdf-schema#", Xt = "http://www.w3.org/2001/XMLSchema#", zt = {
|
|
92
|
-
celldl: it,
|
|
93
|
-
// These should come from BG plugin
|
|
94
|
-
bg: _t,
|
|
95
|
-
bgf: Ut,
|
|
96
|
-
cdt: Bt,
|
|
97
|
-
tpl: Ft
|
|
98
|
-
}, rt = {
|
|
99
|
-
dcterms: Gt,
|
|
100
|
-
owl: Ht,
|
|
101
|
-
rdf: nt,
|
|
102
|
-
rdfs: qt,
|
|
103
|
-
svg: `${Rt}/`,
|
|
104
|
-
xsd: Xt
|
|
105
|
-
}, lt = Object.assign({}, zt, rt);
|
|
106
|
-
Object.entries(lt).map(
|
|
107
|
-
(n) => `PREFIX ${n[0]}: <${n[1]}>`
|
|
108
|
-
).join(`
|
|
109
|
-
`);
|
|
110
|
-
class _ {
|
|
111
|
-
#t;
|
|
112
|
-
constructor(t) {
|
|
113
|
-
this.#t = t;
|
|
114
|
-
}
|
|
115
|
-
uri(t) {
|
|
116
|
-
return U(this.#t + (t || ""));
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
const v = new _(it), u = new _(nt);
|
|
120
|
-
new Map(Object.entries(lt));
|
|
121
|
-
class Wt {
|
|
122
|
-
addMetadataPropertiesForSubject(t, e) {
|
|
123
|
-
const s = [];
|
|
124
|
-
for (const [i, r] of e.predicateValues())
|
|
125
|
-
s.push(...this.#t(t, i, r));
|
|
126
|
-
return s;
|
|
127
|
-
}
|
|
128
|
-
#t(t, e, s) {
|
|
129
|
-
const i = [];
|
|
130
|
-
if (C(s) || m(s))
|
|
131
|
-
i.push(this.add(t, e, s));
|
|
132
|
-
else if (s instanceof x) {
|
|
133
|
-
const r = V();
|
|
134
|
-
i.push(this.add(t, e, r, null)), i.push(...this.addMetadataPropertiesForSubject(r, s));
|
|
135
|
-
} else if (Array.isArray(s) && s.length > 0) {
|
|
136
|
-
const r = V();
|
|
137
|
-
i.push(this.add(t, e, r, null)), this.#i(r, s);
|
|
138
|
-
} else if (s instanceof Set)
|
|
139
|
-
for (const r of s.values())
|
|
140
|
-
i.push(...this.#t(t, e, r));
|
|
141
|
-
return i;
|
|
142
|
-
}
|
|
143
|
-
addStatementList(t) {
|
|
144
|
-
t.forEach((e) => {
|
|
145
|
-
this.add(e.subject, e.predicate, e.object, null);
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
metadataFromPredicates(t) {
|
|
149
|
-
const e = new x();
|
|
150
|
-
for (const s of t) {
|
|
151
|
-
const i = this.#e(s.object);
|
|
152
|
-
i && e.setProperty(s.predicate, i, !0);
|
|
153
|
-
}
|
|
154
|
-
return e;
|
|
155
|
-
}
|
|
156
|
-
metadataPropertiesForSubject(t) {
|
|
157
|
-
const e = this.statementsMatching(t, null, null, null);
|
|
158
|
-
return this.metadataFromPredicates(e);
|
|
159
|
-
}
|
|
160
|
-
removeStatementList(t) {
|
|
161
|
-
t.forEach((e) => {
|
|
162
|
-
this.removeStatements(e.subject, e.predicate, e.object, null);
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
#e(t) {
|
|
166
|
-
return C(t) || m(t) ? t : Zt(t) ? this.contains(t, u.uri("rest"), null) ? this.#s(t) : this.metadataPropertiesForSubject(t) : null;
|
|
167
|
-
}
|
|
168
|
-
#s(t) {
|
|
169
|
-
const e = [], s = [t.value];
|
|
170
|
-
let i = t;
|
|
171
|
-
for (; i && !i.equals(u.uri("nil")); ) {
|
|
172
|
-
const r = this.statementsMatching(i, u.uri("first"), null, null);
|
|
173
|
-
if (r.length !== 1 || r[0] === void 0) break;
|
|
174
|
-
const l = this.#e(r[0].object);
|
|
175
|
-
if (!l) break;
|
|
176
|
-
e.push(l);
|
|
177
|
-
const a = this.statementsMatching(i, u.uri("rest"), null, null);
|
|
178
|
-
if (a.length !== 1 || a[0] === void 0 || (i = a[0].object, s.includes(i.value)))
|
|
179
|
-
break;
|
|
180
|
-
s.push(i.value);
|
|
181
|
-
}
|
|
182
|
-
return e;
|
|
183
|
-
}
|
|
184
|
-
#i(t, e) {
|
|
185
|
-
const s = [];
|
|
186
|
-
let i = t;
|
|
187
|
-
return e.forEach((r, l) => {
|
|
188
|
-
if (s.push(...this.#t(i, u.uri("first"), r)), l < e.length - 1) {
|
|
189
|
-
const a = V();
|
|
190
|
-
s.push(this.add(i, u.uri("rest"), a, null)), i = a;
|
|
191
|
-
}
|
|
192
|
-
}), s.push(this.add(i, u.uri("rest"), u.uri("nil"), null)), s;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
function V(n = void 0) {
|
|
196
|
-
return globalThis.oxigraph.blankNode(n);
|
|
197
|
-
}
|
|
198
|
-
function Zt(n) {
|
|
199
|
-
return !!n.termType && n.termType === "BlankNode";
|
|
200
|
-
}
|
|
201
|
-
function C(n) {
|
|
202
|
-
return !!n.termType && n.termType === "Literal";
|
|
203
|
-
}
|
|
204
|
-
function b(n) {
|
|
205
|
-
return m(n) && (n.uri = n.value, n.id = () => {
|
|
206
|
-
let t = n.value.split("#");
|
|
207
|
-
return t.length < 2 && (t = n.value.split("/")), t.length > 1 ? t.at(-1) : "";
|
|
208
|
-
}), n;
|
|
209
|
-
}
|
|
210
|
-
function U(n) {
|
|
211
|
-
return b(globalThis.oxigraph.namedNode(n));
|
|
212
|
-
}
|
|
213
|
-
function m(n) {
|
|
214
|
-
return !!n.termType && n.termType === "NamedNode";
|
|
215
|
-
}
|
|
216
|
-
function q(n) {
|
|
217
|
-
return {
|
|
218
|
-
graph: b(n.graph),
|
|
219
|
-
object: b(n.object),
|
|
220
|
-
predicate: b(n.predicate),
|
|
221
|
-
subject: b(n.subject),
|
|
222
|
-
termType: n.termType,
|
|
223
|
-
value: n.value
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
const I = "text/turtle";
|
|
227
|
-
class Qt extends Wt {
|
|
228
|
-
#t;
|
|
229
|
-
constructor() {
|
|
230
|
-
super(), this.#t = new globalThis.oxigraph.Store();
|
|
231
|
-
}
|
|
232
|
-
statements(t = null) {
|
|
233
|
-
return this.statementsMatching(null, null, null, t);
|
|
234
|
-
}
|
|
235
|
-
add(t, e, s, i = null) {
|
|
236
|
-
const r = globalThis.oxigraph.quad(t, e, s, i || globalThis.oxigraph.defaultGraph());
|
|
237
|
-
return this.#t.add(r), q(r);
|
|
238
|
-
}
|
|
239
|
-
contains(t = null, e = null, s = null, i = null) {
|
|
240
|
-
return this.#t.match(t, e, s, i || globalThis.oxigraph.defaultGraph()).length > 0;
|
|
241
|
-
}
|
|
242
|
-
load(t = null, e, s = I, i = null) {
|
|
243
|
-
try {
|
|
244
|
-
this.#t.load(e, {
|
|
245
|
-
format: s,
|
|
246
|
-
base_iri: t || void 0,
|
|
247
|
-
to_graph_name: i || globalThis.oxigraph.defaultGraph()
|
|
248
|
-
});
|
|
249
|
-
} catch (r) {
|
|
250
|
-
throw new Error(`Error parsing RDF: ${r.message}`);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
removeStatements(t = null, e = null, s = null, i = null) {
|
|
254
|
-
const r = this.#t.match(t, e, s, i || globalThis.oxigraph.defaultGraph());
|
|
255
|
-
for (const l of r)
|
|
256
|
-
this.#t.delete(l);
|
|
257
|
-
}
|
|
258
|
-
async serialise(t, e = I, s = {}, i = null) {
|
|
259
|
-
if (e === I) {
|
|
260
|
-
const r = this.#t.match(null, null, null, i || globalThis.oxigraph.defaultGraph());
|
|
261
|
-
return (await ut.write(r, {
|
|
262
|
-
format: "text/turtle",
|
|
263
|
-
prefixes: Object.assign({ "": `${t}#` }, rt, s),
|
|
264
|
-
baseIri: t,
|
|
265
|
-
explicitBaseIRI: !0,
|
|
266
|
-
compact: !1,
|
|
267
|
-
ordered: !0
|
|
268
|
-
})).replaceAll(t, "");
|
|
269
|
-
} else
|
|
270
|
-
return this.#t.dump({
|
|
271
|
-
format: e,
|
|
272
|
-
from_graph_name: i || globalThis.oxigraph.defaultGraph()
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
query(t, e = !1) {
|
|
276
|
-
try {
|
|
277
|
-
const s = this.#t.query(t, {
|
|
278
|
-
use_default_graph_as_union: e
|
|
279
|
-
});
|
|
280
|
-
for (const i of s)
|
|
281
|
-
for (const r of i.values())
|
|
282
|
-
b(r);
|
|
283
|
-
return s;
|
|
284
|
-
} catch (s) {
|
|
285
|
-
console.log(`Error parsing SPARQL query: ${s.message} ${t}`);
|
|
286
|
-
let i = !0;
|
|
287
|
-
for (const r of s.stack.split(`
|
|
288
|
-
`))
|
|
289
|
-
i ? i = r.indexOf("RdfStore.query") < 0 : console.log(r);
|
|
290
|
-
}
|
|
291
|
-
return [];
|
|
292
|
-
}
|
|
293
|
-
statementsMatching(t = null, e = null, s = null, i = null) {
|
|
294
|
-
return this.#t.match(t, e, s, i || globalThis.oxigraph.defaultGraph()).map((l) => q(l));
|
|
295
|
-
}
|
|
296
|
-
subjectsOfType(t) {
|
|
297
|
-
return this.query(
|
|
298
|
-
`PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
|
|
299
|
-
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
|
|
300
|
-
|
|
301
|
-
SELECT DISTINCT ?s ?t WHERE {
|
|
302
|
-
?s rdf:type/rdfs:subClassOf* <${t.uri}> .
|
|
303
|
-
?s rdf:type ?t .
|
|
304
|
-
} ORDER BY ?s`,
|
|
305
|
-
!0
|
|
306
|
-
).map((e) => [
|
|
307
|
-
e.get("s"),
|
|
308
|
-
e.get("t")
|
|
309
|
-
]);
|
|
310
|
-
}
|
|
311
|
-
update(t) {
|
|
312
|
-
try {
|
|
313
|
-
this.#t.update(t);
|
|
314
|
-
} catch (e) {
|
|
315
|
-
console.log(`Error parsing SPARQL update: ${e.message} ${t}`);
|
|
316
|
-
let s = !0;
|
|
317
|
-
for (const i of e.stack.split(`
|
|
318
|
-
`))
|
|
319
|
-
s ? s = i.indexOf("RdfStore.update") < 0 : console.log(i);
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
class x extends Map {
|
|
324
|
-
#t = /* @__PURE__ */ new Set();
|
|
325
|
-
static fromProperties(t) {
|
|
326
|
-
return t.reduce((e, s) => (e.setProperty(s[0], s[1]), e), new x());
|
|
327
|
-
}
|
|
328
|
-
get rdfTypes() {
|
|
329
|
-
return this.#t;
|
|
330
|
-
}
|
|
331
|
-
copy() {
|
|
332
|
-
const t = new x();
|
|
333
|
-
for (const [e, s] of this.entries())
|
|
334
|
-
t.set(e, this.#e(s));
|
|
335
|
-
return t.#t = new Set(this.#t.values()), t;
|
|
336
|
-
}
|
|
337
|
-
#e(t) {
|
|
338
|
-
return C(t) || m(t) ? t : t instanceof x ? t.copy() : Array.isArray(t) ? t.map((e) => this.#e(e)) : new Set([...t.values()].map((e) => this.#e(e)));
|
|
339
|
-
}
|
|
340
|
-
getProperty(t) {
|
|
341
|
-
return this.get(t.value) || null;
|
|
342
|
-
}
|
|
343
|
-
getPropertyAsArray(t) {
|
|
344
|
-
const e = this.getProperty(t);
|
|
345
|
-
return e ? C(e) || m(e) || e instanceof x ? [e] : Array.isArray(e) ? e : [...e.values()] : [];
|
|
346
|
-
}
|
|
347
|
-
isA(t) {
|
|
348
|
-
return this.#t.has(t.uri);
|
|
349
|
-
}
|
|
350
|
-
*predicateValues() {
|
|
351
|
-
for (const [t, e] of super.entries())
|
|
352
|
-
yield [U(t), e];
|
|
353
|
-
}
|
|
354
|
-
setProperty(t, e, s = !1) {
|
|
355
|
-
t.equals(u.uri("type")) && m(e) && this.#t.add(e.uri);
|
|
356
|
-
const i = t.uri;
|
|
357
|
-
if (s && this.has(i)) {
|
|
358
|
-
const r = this.get(i);
|
|
359
|
-
if (r instanceof Set) {
|
|
360
|
-
let l = !1;
|
|
361
|
-
if (C(e) || m(e)) {
|
|
362
|
-
for (const a of r)
|
|
363
|
-
if (e.equals(a)) {
|
|
364
|
-
l = !0;
|
|
365
|
-
break;
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
l || r.add(e);
|
|
369
|
-
} else r ? (!(C(r) || m(r)) || !r.equals(e)) && this.set(i, /* @__PURE__ */ new Set([r, e])) : this.set(i, /* @__PURE__ */ new Set([e]));
|
|
370
|
-
} else
|
|
371
|
-
this.set(i, e);
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
const T = 1e-4, X = T * T;
|
|
375
|
-
class o {
|
|
376
|
-
constructor(t = 0, e = 0) {
|
|
377
|
-
this.x = t, this.y = e;
|
|
378
|
-
}
|
|
379
|
-
static fromPoint(t) {
|
|
380
|
-
return new o(t.x, t.y);
|
|
381
|
-
}
|
|
382
|
-
static fromArray(t) {
|
|
383
|
-
return new o(t[0], t[1]);
|
|
384
|
-
}
|
|
385
|
-
asArray() {
|
|
386
|
-
return [this.x, this.y];
|
|
387
|
-
}
|
|
388
|
-
add(t) {
|
|
389
|
-
return o.fromPoint(h.add(this, t));
|
|
390
|
-
}
|
|
391
|
-
colinear(t, e, s = !1) {
|
|
392
|
-
return h.colinear(this, t, e, s);
|
|
393
|
-
}
|
|
394
|
-
copy() {
|
|
395
|
-
return new o(this.x, this.y);
|
|
396
|
-
}
|
|
397
|
-
distance(t) {
|
|
398
|
-
return h.distance(this, t);
|
|
399
|
-
}
|
|
400
|
-
equals(t) {
|
|
401
|
-
return h.equals(this, t);
|
|
402
|
-
}
|
|
403
|
-
isZero() {
|
|
404
|
-
return h.isZero(this);
|
|
405
|
-
}
|
|
406
|
-
apply(t) {
|
|
407
|
-
return o.fromPoint(h.apply(this, t));
|
|
408
|
-
}
|
|
409
|
-
scalarScale(t) {
|
|
410
|
-
return o.fromPoint(h.scalarScale(this, t));
|
|
411
|
-
}
|
|
412
|
-
scale(t) {
|
|
413
|
-
return o.fromPoint(h.scale(this, t));
|
|
414
|
-
}
|
|
415
|
-
subtract(t) {
|
|
416
|
-
return o.fromPoint(h.subtract(this, t));
|
|
417
|
-
}
|
|
418
|
-
toString() {
|
|
419
|
-
return `(${this.x}, ${this.y})`;
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
class h {
|
|
423
|
-
static add(t, e) {
|
|
424
|
-
return new o(t.x + e.x, t.y + e.y);
|
|
425
|
-
}
|
|
426
|
-
static apply(t, e) {
|
|
427
|
-
return new o(e(t.x), e(t.y));
|
|
428
|
-
}
|
|
429
|
-
static colinear(t, e, s, i = !1) {
|
|
430
|
-
const r = h.distance(t, e), l = h.distance(e, s), a = h.distance(t, s);
|
|
431
|
-
return a > r && a > l ? r + l < a * (1 + T) : i ? !1 : l > r && l > a ? r + a < l * (1 + T) : l + a < r * (1 + T);
|
|
432
|
-
}
|
|
433
|
-
static distance(t, e) {
|
|
434
|
-
return Math.sqrt((t.x - e.x) ** 2 + (t.y - e.y) ** 2);
|
|
435
|
-
}
|
|
436
|
-
static equals(t, e) {
|
|
437
|
-
return (t.x - e.x) ** 2 + (t.y - e.y) ** 2 <= X;
|
|
438
|
-
}
|
|
439
|
-
static isZero(t) {
|
|
440
|
-
return t.x ** 2 + t.y ** 2 <= X;
|
|
441
|
-
}
|
|
442
|
-
static scalarScale(t, e) {
|
|
443
|
-
return new o(e * t.x, e * t.y);
|
|
444
|
-
}
|
|
445
|
-
static scale(t, e) {
|
|
446
|
-
return new o(e.x * t.x, e.y * t.y);
|
|
447
|
-
}
|
|
448
|
-
static subtract(t, e) {
|
|
449
|
-
return new o(t.x - e.x, t.y - e.y);
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
function P(n, t = 3) {
|
|
453
|
-
const e = 10 ** t;
|
|
454
|
-
return Math.round(e * n) / e;
|
|
455
|
-
}
|
|
456
|
-
class w {
|
|
457
|
-
#t;
|
|
458
|
-
#e;
|
|
459
|
-
#s;
|
|
460
|
-
#i;
|
|
461
|
-
constructor(t, e, s, i) {
|
|
462
|
-
[this.#t, this.#e] = t <= s ? [t, s] : [s, t], [this.#s, this.#i] = e <= i ? [e, i] : [i, e];
|
|
463
|
-
}
|
|
464
|
-
get left() {
|
|
465
|
-
return this.#t;
|
|
466
|
-
}
|
|
467
|
-
get right() {
|
|
468
|
-
return this.#e;
|
|
469
|
-
}
|
|
470
|
-
get top() {
|
|
471
|
-
return this.#s;
|
|
472
|
-
}
|
|
473
|
-
get bottom() {
|
|
474
|
-
return this.#i;
|
|
475
|
-
}
|
|
476
|
-
static fromPoints(t, e) {
|
|
477
|
-
return new w(t.x, t.y, e.x, e.y);
|
|
478
|
-
}
|
|
479
|
-
static fromSvg(t, e = null) {
|
|
480
|
-
const s = t.getBBox();
|
|
481
|
-
let i = new o(s.x, s.y), r = new o(s.x + s.width, s.y + s.height);
|
|
482
|
-
return e && (i = e.transformPoint(i), r = e.transformPoint(r)), new w(i.x, i.y, r.x, r.y);
|
|
483
|
-
}
|
|
484
|
-
get height() {
|
|
485
|
-
return this.#i - this.#s;
|
|
486
|
-
}
|
|
487
|
-
get topLeft() {
|
|
488
|
-
return new o(this.#t, this.#s);
|
|
489
|
-
}
|
|
490
|
-
get width() {
|
|
491
|
-
return this.#e - this.#t;
|
|
492
|
-
}
|
|
493
|
-
asArray() {
|
|
494
|
-
return [this.#t, this.#s, this.#e, this.#i];
|
|
495
|
-
}
|
|
496
|
-
asPoints() {
|
|
497
|
-
return [new o(this.#t, this.#s), new o(this.#e, this.#i)];
|
|
498
|
-
}
|
|
499
|
-
equal(t, e = 1e-4) {
|
|
500
|
-
return Math.abs(this.#t - t.#t) < e && Math.abs(this.#s - t.#s) < e && Math.abs(this.#e - t.#e) < e && Math.abs(this.#i - t.#i) < e;
|
|
501
|
-
}
|
|
502
|
-
expand(t) {
|
|
503
|
-
return new w(this.#t - t, this.#s - t, this.#e + t, this.#i + t);
|
|
504
|
-
}
|
|
505
|
-
inContainer(t) {
|
|
506
|
-
return this.#t >= t.#t && this.#s <= t.#s && this.#s >= t.#s && this.#i <= t.#i;
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
class y {
|
|
510
|
-
static #t = null;
|
|
511
|
-
#e = 0;
|
|
512
|
-
constructor() {
|
|
513
|
-
if (y.#t)
|
|
514
|
-
throw new Error("Use `IdGenerator.instance` instead of `new`");
|
|
515
|
-
y.#t = this;
|
|
516
|
-
}
|
|
517
|
-
static get instance() {
|
|
518
|
-
return y.#t || (y.#t = new y()), y.#t;
|
|
519
|
-
}
|
|
520
|
-
get nextId() {
|
|
521
|
-
return this.#e += 1, this.#e;
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
const Yt = y.instance;
|
|
525
|
-
function Kt(n = "") {
|
|
526
|
-
return `${n}:${Yt.nextId}`;
|
|
527
|
-
}
|
|
528
|
-
class L {
|
|
529
|
-
#t = !1;
|
|
530
|
-
#e = 0;
|
|
531
|
-
#s = -1 / 0;
|
|
532
|
-
#i = 1 / 0;
|
|
533
|
-
id;
|
|
534
|
-
constructor(t = 0, e = -1 / 0, s = 1 / 0) {
|
|
535
|
-
this.#e = t, this.#l(e) <= this.#l(s) ? (this.#s = e, this.#i = s) : (this.#s = s, this.#i = e), this.id = Kt("V");
|
|
536
|
-
}
|
|
537
|
-
clean() {
|
|
538
|
-
this.#t = !1;
|
|
539
|
-
}
|
|
540
|
-
get dirty() {
|
|
541
|
-
return this.#t;
|
|
542
|
-
}
|
|
543
|
-
get fixed() {
|
|
544
|
-
return this.minimum === this.maximum;
|
|
545
|
-
}
|
|
546
|
-
get minimum() {
|
|
547
|
-
return this.#l(this.#s);
|
|
548
|
-
}
|
|
549
|
-
get maximum() {
|
|
550
|
-
return this.#l(this.#i);
|
|
551
|
-
}
|
|
552
|
-
get value() {
|
|
553
|
-
return this.#e;
|
|
554
|
-
}
|
|
555
|
-
set value(t) {
|
|
556
|
-
this.#e !== t && (t < this.minimum ? t = this.minimum : t > this.maximum && (t = this.maximum), this.#e !== t && (this.#e = t, this.#t = !0));
|
|
557
|
-
}
|
|
558
|
-
#l(t) {
|
|
559
|
-
return typeof t == "number" ? t : t.value;
|
|
560
|
-
}
|
|
561
|
-
copy() {
|
|
562
|
-
return new L(this.#e, this.#s, this.#i);
|
|
563
|
-
}
|
|
564
|
-
adjustValue(t) {
|
|
565
|
-
this.#s = this.minimum + t, this.#i = this.maximum + t, this.#e += t;
|
|
566
|
-
}
|
|
567
|
-
narrowRange(t, e) {
|
|
568
|
-
let s = t, i = e;
|
|
569
|
-
this.#l(s) > this.#l(i) && (s = e, i = t), this.#l(s) > this.minimum && (this.#s = s), this.#l(i) < this.maximum && (this.#i = i);
|
|
570
|
-
}
|
|
571
|
-
reassignMaximum(t) {
|
|
572
|
-
this.#i = t;
|
|
573
|
-
}
|
|
574
|
-
reassignMinimum(t) {
|
|
575
|
-
this.#s = t;
|
|
576
|
-
}
|
|
577
|
-
reassignValue(t) {
|
|
578
|
-
this.#e = t;
|
|
579
|
-
}
|
|
580
|
-
toString() {
|
|
581
|
-
return `${this.id}: [${P(this.minimum)}, ${P(this.#e)}, ${P(this.maximum)}]`;
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
class E extends L {
|
|
585
|
-
constructor(t) {
|
|
586
|
-
super(t, t, t);
|
|
587
|
-
}
|
|
588
|
-
get fixed() {
|
|
589
|
-
return !0;
|
|
590
|
-
}
|
|
591
|
-
copy() {
|
|
592
|
-
return new E(this.value);
|
|
593
|
-
}
|
|
594
|
-
narrowRange(t, e) {
|
|
595
|
-
}
|
|
596
|
-
reassignValue(t) {
|
|
597
|
-
super.reassignValue(t), super.reassignMinimum(t), super.reassignMaximum(t);
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
class p {
|
|
601
|
-
#t;
|
|
602
|
-
#e;
|
|
603
|
-
constructor(t, e) {
|
|
604
|
-
this.#t = t, this.#e = e;
|
|
605
|
-
}
|
|
606
|
-
static fromPoint(t) {
|
|
607
|
-
return new p(new L(t.x), new L(t.y));
|
|
608
|
-
}
|
|
609
|
-
get dirty() {
|
|
610
|
-
return this.#t.dirty || this.#e.dirty;
|
|
611
|
-
}
|
|
612
|
-
get fixed() {
|
|
613
|
-
return this.#t.fixed && this.#e.fixed;
|
|
614
|
-
}
|
|
615
|
-
get point() {
|
|
616
|
-
return new o(this.#t.value, this.#e.value);
|
|
617
|
-
}
|
|
618
|
-
set point(t) {
|
|
619
|
-
this.#t.value = t.x, this.#e.value = t.y;
|
|
620
|
-
}
|
|
621
|
-
get x() {
|
|
622
|
-
return this.#t.value;
|
|
623
|
-
}
|
|
624
|
-
get y() {
|
|
625
|
-
return this.#e.value;
|
|
626
|
-
}
|
|
627
|
-
get xValue() {
|
|
628
|
-
return this.#t;
|
|
629
|
-
}
|
|
630
|
-
set xValue(t) {
|
|
631
|
-
this.#t = t;
|
|
632
|
-
}
|
|
633
|
-
get yValue() {
|
|
634
|
-
return this.#e;
|
|
635
|
-
}
|
|
636
|
-
set yValue(t) {
|
|
637
|
-
this.#e = t;
|
|
638
|
-
}
|
|
639
|
-
clean() {
|
|
640
|
-
this.#t.clean(), this.#e.clean();
|
|
641
|
-
}
|
|
642
|
-
adjustValue(t) {
|
|
643
|
-
this.xValue.adjustValue(t.x), this.yValue.adjustValue(t.y);
|
|
644
|
-
}
|
|
645
|
-
copy() {
|
|
646
|
-
return new p(this.#t, this.#e);
|
|
647
|
-
}
|
|
648
|
-
reassignValue(t) {
|
|
649
|
-
this.xValue.reassignValue(t.x), this.yValue.reassignValue(t.y);
|
|
650
|
-
}
|
|
651
|
-
toString() {
|
|
652
|
-
return `RP: (${P(this.x)}, ${P(this.y)})`;
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
class z extends p {
|
|
656
|
-
constructor(t, e) {
|
|
657
|
-
super(t, e);
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
class D {
|
|
661
|
-
#t;
|
|
662
|
-
#e;
|
|
663
|
-
#s;
|
|
664
|
-
#i;
|
|
665
|
-
#l;
|
|
666
|
-
#r = null;
|
|
667
|
-
constructor(t, e, s = null) {
|
|
668
|
-
this.setCornerPositions(t, e), this.setCentroidOffset(s || new o(0.5, 0.5));
|
|
669
|
-
}
|
|
670
|
-
get centroid() {
|
|
671
|
-
return this.#i;
|
|
672
|
-
}
|
|
673
|
-
get dirty() {
|
|
674
|
-
return this.#t.dirty || this.#e.dirty;
|
|
675
|
-
}
|
|
676
|
-
get fixed() {
|
|
677
|
-
return this.#t.fixed && this.#e.fixed;
|
|
678
|
-
}
|
|
679
|
-
get svgElement() {
|
|
680
|
-
return this.#r;
|
|
681
|
-
}
|
|
682
|
-
get topLeftPoint() {
|
|
683
|
-
return this.#t.point;
|
|
684
|
-
}
|
|
685
|
-
clean() {
|
|
686
|
-
this.#t.clean(), this.#e.clean();
|
|
687
|
-
}
|
|
688
|
-
copy() {
|
|
689
|
-
return new D(this.#t, this.#e, this.#l);
|
|
690
|
-
}
|
|
691
|
-
setCornerPositions(t, e) {
|
|
692
|
-
let s = t.xValue, i = t.yValue, r = e.xValue, l = e.yValue;
|
|
693
|
-
s.value > r.value && (s = e.xValue, r = t.xValue), i.value > l.value && (i = e.yValue, l = t.yValue), this.#t = new p(s, i), this.#e = new p(r, l), this.#s = h.subtract(this.#e.point, this.#t.point);
|
|
694
|
-
}
|
|
695
|
-
setCentroidOffset(t) {
|
|
696
|
-
this.#l = t, this.#i = p.fromPoint(this.#s.scale(this.#l).add(this.#t.point));
|
|
697
|
-
}
|
|
698
|
-
svg(t = {}) {
|
|
699
|
-
return kt(this.#t.point, this.#e.point, t);
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
class Jt extends D {
|
|
703
|
-
constructor(t) {
|
|
704
|
-
super(
|
|
705
|
-
new z(new E(t[0]), new E(t[1])),
|
|
706
|
-
new z(new E(t[2]), new E(t[3]))
|
|
707
|
-
);
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
const te = "#456", ee = "#334155", se = 2, W = 3;
|
|
711
|
-
class d {
|
|
712
|
-
#t;
|
|
713
|
-
constructor(t) {
|
|
714
|
-
this.#t = t;
|
|
715
|
-
}
|
|
716
|
-
static fromString(t) {
|
|
717
|
-
return t === "" || t === "none" ? new d(O()) : new d(dt(t));
|
|
718
|
-
}
|
|
719
|
-
static Identity() {
|
|
720
|
-
return new d(O());
|
|
721
|
-
}
|
|
722
|
-
get isIdentity() {
|
|
723
|
-
return A(this.#t) === A(O());
|
|
724
|
-
}
|
|
725
|
-
inverse() {
|
|
726
|
-
return new d(ft(this.#t));
|
|
727
|
-
}
|
|
728
|
-
leftMultiply(t) {
|
|
729
|
-
return new d(mt([t.#t, this.#t]));
|
|
730
|
-
}
|
|
731
|
-
toString() {
|
|
732
|
-
return A(this.#t);
|
|
733
|
-
}
|
|
734
|
-
transformPoint(t) {
|
|
735
|
-
return o.fromPoint(pt(this.#t, t));
|
|
736
|
-
}
|
|
737
|
-
transformPoints(t) {
|
|
738
|
-
return gt(this.#t, t).map((e) => o.fromPoint(e));
|
|
739
|
-
}
|
|
740
|
-
static Translate(t, e) {
|
|
741
|
-
return new d(yt(t, e));
|
|
742
|
-
}
|
|
743
|
-
}
|
|
744
|
-
const ie = 9;
|
|
745
|
-
class ne {
|
|
746
|
-
constructor(t, e) {
|
|
747
|
-
if (this.celldlObject = t, e === null)
|
|
748
|
-
throw new Error(`CellDL object '${t.id}' isn't represented in SVG...`);
|
|
749
|
-
const s = t.celldlModel?.svgDiagram;
|
|
750
|
-
this.#c = d.Identity();
|
|
751
|
-
let i = e;
|
|
752
|
-
for (; i !== s; ) {
|
|
753
|
-
const r = getComputedStyle(i).transform;
|
|
754
|
-
r !== "none" && (this.#c = this.#c.leftMultiply(d.fromString(r))), i = i.parentNode;
|
|
755
|
-
}
|
|
756
|
-
this.#c.isIdentity && (this.#c = null), t.setCelldlSvgElement(this), this.#n = e, this.#o = e, this.#m();
|
|
757
|
-
}
|
|
758
|
-
#t;
|
|
759
|
-
#e;
|
|
760
|
-
#s = new o(0.5, 0.5);
|
|
761
|
-
#i;
|
|
762
|
-
// Wrt centroid, anticlockwise from bottom right
|
|
763
|
-
#l = !1;
|
|
764
|
-
#r = /* @__PURE__ */ new Set();
|
|
765
|
-
#o;
|
|
766
|
-
#a = new o();
|
|
767
|
-
#n;
|
|
768
|
-
#h;
|
|
769
|
-
#c = null;
|
|
770
|
-
get bounds() {
|
|
771
|
-
return this.#t;
|
|
772
|
-
}
|
|
773
|
-
get centroid() {
|
|
774
|
-
return this.#e;
|
|
775
|
-
}
|
|
776
|
-
get centroidOffset() {
|
|
777
|
-
return this.#s;
|
|
778
|
-
}
|
|
779
|
-
get corners() {
|
|
780
|
-
return [this.#i[0], this.#i[2]];
|
|
781
|
-
}
|
|
782
|
-
get globalTransform() {
|
|
783
|
-
return this.#c;
|
|
784
|
-
}
|
|
785
|
-
get height() {
|
|
786
|
-
return this.#a.y;
|
|
787
|
-
}
|
|
788
|
-
get id() {
|
|
789
|
-
return this.celldlObject.id;
|
|
790
|
-
}
|
|
791
|
-
get selected() {
|
|
792
|
-
return this.#l;
|
|
793
|
-
}
|
|
794
|
-
get size() {
|
|
795
|
-
return this.#a;
|
|
796
|
-
}
|
|
797
|
-
get svgElement() {
|
|
798
|
-
return this.#n;
|
|
799
|
-
}
|
|
800
|
-
get topLeft() {
|
|
801
|
-
return this.#h;
|
|
802
|
-
}
|
|
803
|
-
get width() {
|
|
804
|
-
return this.#a.x;
|
|
805
|
-
}
|
|
806
|
-
setCentroid(t) {
|
|
807
|
-
this.#e = t;
|
|
808
|
-
}
|
|
809
|
-
svgBounds(t = !1) {
|
|
810
|
-
return t || this.#t === void 0 ? w.fromSvg(this.#n, this.#c) : this.#t;
|
|
811
|
-
}
|
|
812
|
-
#u() {
|
|
813
|
-
const t = [];
|
|
814
|
-
if (this.#o.tagName === "g" && this.#o.classList.contains(N.Connection)) {
|
|
815
|
-
const e = this.#o.children;
|
|
816
|
-
for (let s = 0; s < e.length; ++s)
|
|
817
|
-
t.push(e[s]);
|
|
818
|
-
} else
|
|
819
|
-
t.push(this.#o);
|
|
820
|
-
return t;
|
|
821
|
-
}
|
|
822
|
-
#d(t, e) {
|
|
823
|
-
if (e) {
|
|
824
|
-
for (const s of this.#u())
|
|
825
|
-
s.classList.add(t);
|
|
826
|
-
this.#r.add(t);
|
|
827
|
-
} else {
|
|
828
|
-
for (const s of this.#u())
|
|
829
|
-
s.classList.remove(t);
|
|
830
|
-
this.#r.delete(t);
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
|
-
activate(t = !0) {
|
|
834
|
-
this.#d("active", t);
|
|
835
|
-
}
|
|
836
|
-
highlight(t = !0) {
|
|
837
|
-
this.#d("highlight", t);
|
|
838
|
-
}
|
|
839
|
-
pointerEvent(t, e, s) {
|
|
840
|
-
return !1;
|
|
841
|
-
}
|
|
842
|
-
select(t = !0) {
|
|
843
|
-
this.#d("selected", t), this.#l = t;
|
|
844
|
-
}
|
|
845
|
-
#f() {
|
|
846
|
-
const t = this.svgBounds(!0);
|
|
847
|
-
this.#a = new o(t.right - t.left, t.bottom - t.top), this.#e ? (this.#h = this.#e.subtract(this.#a.scale(this.#s)), this.#t = new w(
|
|
848
|
-
this.#h.x,
|
|
849
|
-
this.#h.y,
|
|
850
|
-
this.#h.x + this.#a.x,
|
|
851
|
-
this.#h.y + this.#a.y
|
|
852
|
-
)) : (this.#h = new o(t.left, t.top), this.#t = t, this.#e = this.#a.scale(this.#s).add(this.#h));
|
|
853
|
-
const e = this.#a.scale(this.#s).scalarScale(-1), s = se / 2 - W / 2;
|
|
854
|
-
this.#i = [
|
|
855
|
-
e.add(this.#a).add({ x: s, y: s }),
|
|
856
|
-
e.add({ x: this.#a.x, y: 0 }).add({ x: s, y: -s }),
|
|
857
|
-
e.add({ x: -s, y: -s }),
|
|
858
|
-
e.add({ x: 0, y: this.#a.y }).add({ x: -s, y: s })
|
|
859
|
-
];
|
|
860
|
-
}
|
|
861
|
-
#m() {
|
|
862
|
-
if (this.#s = new o(0.5, 0.5), this.#n.tagName === "g") {
|
|
863
|
-
const t = this.#n.children.item(0);
|
|
864
|
-
t.dataset.centreX && (this.#s = new o(+t.dataset.centreX, +t.dataset.centreY));
|
|
865
|
-
}
|
|
866
|
-
if (this.#f(), this.#n.tagName === "g" && !this.#n.classList.contains(N.Connection) && this.#n.firstElementChild !== null) {
|
|
867
|
-
const t = (this.#n.classList.contains(N.Compartment) ? w.fromSvg(this.#n.firstChild) : w.fromSvg(this.#n)).expand(W / 2);
|
|
868
|
-
if (this.#n.firstElementChild.tagName === "svg") {
|
|
869
|
-
const i = this.#n.firstElementChild;
|
|
870
|
-
i.setAttribute("x", `${t.topLeft.x}px`), i.setAttribute("y", `${t.topLeft.y}px`), i.setAttribute("width", `${t.width}px`), i.setAttribute("height", `${t.height}px`);
|
|
871
|
-
}
|
|
872
|
-
const s = new Jt(t.asArray()).svg({
|
|
873
|
-
class: `selection-element parent-id editor-specific ${[...this.#r.values()].join(" ")}`
|
|
874
|
-
});
|
|
875
|
-
if (this.#n.insertAdjacentHTML("beforeend", s), this.#o = this.#n.lastChild, this.celldlObject.isConduit) {
|
|
876
|
-
const i = new o(t.right - t.left, t.bottom - t.top).scale(this.#s).add(new o(t.left, t.top)), r = $t(i, ie, {
|
|
877
|
-
class: "selection-element parent-id editor-specific conduit"
|
|
878
|
-
});
|
|
879
|
-
this.#n.insertAdjacentHTML("beforeend", r);
|
|
880
|
-
}
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
class re extends ne {
|
|
885
|
-
#t;
|
|
886
|
-
constructor(t, e) {
|
|
887
|
-
super(t, e), this.#t = new D(
|
|
888
|
-
p.fromPoint(this.topLeft),
|
|
889
|
-
p.fromPoint(this.topLeft.add(this.size)),
|
|
890
|
-
this.centroidOffset
|
|
891
|
-
), this.setCentroid(this.#t.centroid.point);
|
|
892
|
-
}
|
|
893
|
-
}
|
|
894
|
-
var N = /* @__PURE__ */ ((n) => (n.Annotation = "celldl-Annotation", n.Component = "celldl-Component", n.Connector = "celldl-Connector", n.Connection = "celldl-Connection", n.Conduit = "celldl-Conduit", n.Compartment = "celldl-Compartment", n.Interface = "celldl-InterfacePort", n.Layer = "celldl-Layer", n.UnconnectedPort = "celldl-Unconnected", n.Unknown = "", n))(N || {});
|
|
895
|
-
class ot {
|
|
896
|
-
constructor(t, e = {}, s) {
|
|
897
|
-
this.uri = t, this.options = e, this.#e = s, this.#t = this.constructor.celldlClassName, this.#i = v.uri(this.constructor.celldlType);
|
|
898
|
-
}
|
|
899
|
-
static celldlClassName = "";
|
|
900
|
-
static celldlType = "Object";
|
|
901
|
-
#t;
|
|
902
|
-
#e;
|
|
903
|
-
#s;
|
|
904
|
-
#i;
|
|
905
|
-
#l;
|
|
906
|
-
toString() {
|
|
907
|
-
return `${this.#t} ${this.id}`;
|
|
908
|
-
}
|
|
909
|
-
get celldlClassName() {
|
|
910
|
-
return this.#t;
|
|
911
|
-
}
|
|
912
|
-
get celldlModel() {
|
|
913
|
-
return this.#e;
|
|
914
|
-
}
|
|
915
|
-
get celldlSvgElement() {
|
|
916
|
-
return this.#s;
|
|
917
|
-
}
|
|
918
|
-
setCelldlSvgElement(t) {
|
|
919
|
-
this.#s = t;
|
|
920
|
-
}
|
|
921
|
-
get hasEditGuides() {
|
|
922
|
-
return !1;
|
|
923
|
-
}
|
|
924
|
-
get id() {
|
|
925
|
-
return this.uri.id();
|
|
926
|
-
}
|
|
927
|
-
isA(t) {
|
|
928
|
-
return this.#i.equals(t);
|
|
929
|
-
}
|
|
930
|
-
get isAlignable() {
|
|
931
|
-
return !0;
|
|
932
|
-
}
|
|
933
|
-
get isAnnotation() {
|
|
934
|
-
return this.celldlClassName === "celldl-Annotation";
|
|
935
|
-
}
|
|
936
|
-
get isComponent() {
|
|
937
|
-
return this.celldlClassName === "celldl-Component" || this.celldlClassName === "celldl-Conduit";
|
|
938
|
-
}
|
|
939
|
-
get isConduit() {
|
|
940
|
-
return this.celldlClassName === "celldl-Conduit";
|
|
941
|
-
}
|
|
942
|
-
get isConnectable() {
|
|
943
|
-
return !1;
|
|
944
|
-
}
|
|
945
|
-
get isConnection() {
|
|
946
|
-
return this.celldlClassName === "celldl-Connection";
|
|
947
|
-
}
|
|
948
|
-
get isCompartment() {
|
|
949
|
-
return this.celldlClassName === "celldl-Compartment";
|
|
950
|
-
}
|
|
951
|
-
get isInterface() {
|
|
952
|
-
return this.celldlClassName === "celldl-InterfacePort";
|
|
953
|
-
}
|
|
954
|
-
get selected() {
|
|
955
|
-
return this.#s?.selected;
|
|
956
|
-
}
|
|
957
|
-
get svgElement() {
|
|
958
|
-
return this.#s?.svgElement || null;
|
|
959
|
-
}
|
|
960
|
-
get tooltip() {
|
|
961
|
-
return this.#l;
|
|
962
|
-
}
|
|
963
|
-
set tooltip(t) {
|
|
964
|
-
this.#l = t;
|
|
965
|
-
}
|
|
966
|
-
activate(t = !0) {
|
|
967
|
-
this.#s?.activate(t);
|
|
968
|
-
}
|
|
969
|
-
highlight(t = !0) {
|
|
970
|
-
this.#s?.highlight(t);
|
|
971
|
-
}
|
|
972
|
-
select(t = !0) {
|
|
973
|
-
this.#s?.select(t);
|
|
974
|
-
}
|
|
975
|
-
assignSvgElement(t) {
|
|
976
|
-
}
|
|
977
|
-
}
|
|
978
|
-
class at extends ot {
|
|
979
|
-
assignSvgElement(t) {
|
|
980
|
-
new re(this, t);
|
|
981
|
-
}
|
|
982
|
-
}
|
|
983
|
-
class Z extends at {
|
|
984
|
-
static celldlClassName = "celldl-Annotation";
|
|
985
|
-
static celldlType = "Annotation";
|
|
986
|
-
}
|
|
987
|
-
class M extends at {
|
|
988
|
-
static celldlType = "Connector";
|
|
989
|
-
get isConnectable() {
|
|
990
|
-
return !0;
|
|
991
|
-
}
|
|
992
|
-
}
|
|
993
|
-
class k extends M {
|
|
994
|
-
static celldlClassName = "celldl-Component";
|
|
995
|
-
static celldlType = "Component";
|
|
996
|
-
}
|
|
997
|
-
class le extends k {
|
|
998
|
-
static celldlClassName = "celldl-Conduit";
|
|
999
|
-
static celldlType = "Conduit";
|
|
1000
|
-
}
|
|
1001
|
-
class oe extends M {
|
|
1002
|
-
static celldlClassName = "celldl-Compartment";
|
|
1003
|
-
static celldlType = "Compartment";
|
|
1004
|
-
}
|
|
1005
|
-
class Q extends ot {
|
|
1006
|
-
static celldlClassName = "celldl-Connection";
|
|
1007
|
-
static celldlType = "Connection";
|
|
1008
|
-
}
|
|
1009
|
-
class Y extends M {
|
|
1010
|
-
static celldlClassName = "celldl-InterfacePort";
|
|
1011
|
-
static celldlType = "Interface";
|
|
1012
|
-
#t = [];
|
|
1013
|
-
toString() {
|
|
1014
|
-
return `${super.toString()} External: ${this.#t.map((t) => t.id).join(", ")}`;
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1017
|
-
class K extends M {
|
|
1018
|
-
static celldlClassName = "celldl-Unconnected";
|
|
1019
|
-
static celldlType = "UnconnectedPort";
|
|
1020
|
-
}
|
|
1021
|
-
const ae = "celldl-rdf-metadata", J = "file://tmp/viewing.celldl";
|
|
1022
|
-
class $ {
|
|
1023
|
-
#t = null;
|
|
1024
|
-
#e = new Qt();
|
|
1025
|
-
#s;
|
|
1026
|
-
#i;
|
|
1027
|
-
#l;
|
|
1028
|
-
#r = /* @__PURE__ */ new Map();
|
|
1029
|
-
#o = /* @__PURE__ */ new Map();
|
|
1030
|
-
constructor(t, e = "", s = {}, i = void 0) {
|
|
1031
|
-
if (this.#s = t, this.#i = U(J), this.#l = new _(`${J}#`), e !== "") {
|
|
1032
|
-
this.#a(e), this.#n();
|
|
1033
|
-
const r = i ? i.tooltip : void 0;
|
|
1034
|
-
for (const l of this.#o.values())
|
|
1035
|
-
if (l.id in s) {
|
|
1036
|
-
const a = s[l.id];
|
|
1037
|
-
this.#r.set(l.id, a), r && r in a && (l.tooltip = String(a[r]));
|
|
1038
|
-
}
|
|
1039
|
-
}
|
|
1040
|
-
}
|
|
1041
|
-
finishSetup() {
|
|
1042
|
-
this.#g(), this.#v(), this.#p(), this.#y(), this.#m(), this.#x();
|
|
1043
|
-
}
|
|
1044
|
-
async viewModel() {
|
|
1045
|
-
this.#t ? await this.#s.viewDiagram(this) : this.#s.closeDiagram();
|
|
1046
|
-
}
|
|
1047
|
-
viewerEvent(t, e = void 0) {
|
|
1048
|
-
const s = {
|
|
1049
|
-
type: t
|
|
1050
|
-
};
|
|
1051
|
-
e && (s.component = {
|
|
1052
|
-
id: e.id
|
|
1053
|
-
}, this.#r.has(e.id) && (s.component.annotation = this.#r.get(e.id))), document.dispatchEvent(
|
|
1054
|
-
new CustomEvent("viewer-event", {
|
|
1055
|
-
detail: s
|
|
1056
|
-
})
|
|
1057
|
-
);
|
|
1058
|
-
}
|
|
1059
|
-
get rdfStore() {
|
|
1060
|
-
return this.#e;
|
|
1061
|
-
}
|
|
1062
|
-
get svgDiagram() {
|
|
1063
|
-
return this.#t;
|
|
1064
|
-
}
|
|
1065
|
-
get uri() {
|
|
1066
|
-
return this.#i.value;
|
|
1067
|
-
}
|
|
1068
|
-
makeUri(t) {
|
|
1069
|
-
return this.#l.uri(t);
|
|
1070
|
-
}
|
|
1071
|
-
objectById(t) {
|
|
1072
|
-
return this.#o.get(t) || null;
|
|
1073
|
-
}
|
|
1074
|
-
#a(t) {
|
|
1075
|
-
const i = new DOMParser().parseFromString(t, "image/svg+xml").firstElementChild;
|
|
1076
|
-
if (i.hasAttribute("width") && i.hasAttribute("height")) {
|
|
1077
|
-
const l = H(i.getAttribute("width")), a = H(i.getAttribute("height"));
|
|
1078
|
-
l !== null && a !== null && (i.attributes.removeNamedItem("width"), i.attributes.removeNamedItem("height"), i.hasAttribute("viewBox") || i.setAttribute("viewBox", `0 0 ${l} ${a}`));
|
|
1079
|
-
}
|
|
1080
|
-
const r = i.querySelectorAll(`path[stroke="${ee}"]`);
|
|
1081
|
-
for (let l = 0; l < r.length; ++l)
|
|
1082
|
-
r[l].setAttribute("stroke", te);
|
|
1083
|
-
this.#t = i;
|
|
1084
|
-
}
|
|
1085
|
-
#n() {
|
|
1086
|
-
const t = this.#t?.getElementById(ae);
|
|
1087
|
-
if (t && (!("contentType" in t.dataset) || t.dataset.contentType === I)) {
|
|
1088
|
-
const e = t.childNodes;
|
|
1089
|
-
for (let s = 0; s < e.length; ++s) {
|
|
1090
|
-
const i = e[s];
|
|
1091
|
-
if (i.nodeName === "#cdata-section") {
|
|
1092
|
-
this.#e.load(this.#i.uri, i.data, I);
|
|
1093
|
-
break;
|
|
1094
|
-
}
|
|
1095
|
-
}
|
|
1096
|
-
}
|
|
1097
|
-
}
|
|
1098
|
-
#h(t) {
|
|
1099
|
-
const e = this.#t?.getElementById(t.id);
|
|
1100
|
-
return e ? (t.assignSvgElement(e), !0) : (console.error(`Missing SVG element for ${t.id}`), !1);
|
|
1101
|
-
}
|
|
1102
|
-
#c(t, e) {
|
|
1103
|
-
const s = this.#e.metadataPropertiesForSubject(e);
|
|
1104
|
-
return new t(e, s, this);
|
|
1105
|
-
}
|
|
1106
|
-
#u(t) {
|
|
1107
|
-
return this.#e.subjectsOfType(t).filter((e) => e[0].value.startsWith(this.#i.value));
|
|
1108
|
-
}
|
|
1109
|
-
#d(t) {
|
|
1110
|
-
this.#o.set(t.id, t);
|
|
1111
|
-
}
|
|
1112
|
-
#f(t, e) {
|
|
1113
|
-
for (const s of this.#u(t))
|
|
1114
|
-
if (s[1].equals(t)) {
|
|
1115
|
-
const i = this.#c(e, s[0]);
|
|
1116
|
-
this.#h(i) && this.#d(i);
|
|
1117
|
-
}
|
|
1118
|
-
}
|
|
1119
|
-
#m() {
|
|
1120
|
-
this.#f(v.uri("Annotation"), Z);
|
|
1121
|
-
}
|
|
1122
|
-
#g() {
|
|
1123
|
-
this.#f(v.uri("Component"), k), this.#f(v.uri("UnconnectedPort"), K);
|
|
1124
|
-
}
|
|
1125
|
-
#v() {
|
|
1126
|
-
this.#f(v.uri("Connector"), Y);
|
|
1127
|
-
}
|
|
1128
|
-
#p() {
|
|
1129
|
-
this.#f(v.uri("Conduit"), le);
|
|
1130
|
-
}
|
|
1131
|
-
getConnector(t) {
|
|
1132
|
-
if (t && m(t) && t.value.startsWith(this.#i.value)) {
|
|
1133
|
-
const e = t.id(), s = this.#o.get(e);
|
|
1134
|
-
return s?.isConnectable ? s : null;
|
|
1135
|
-
}
|
|
1136
|
-
return null;
|
|
1137
|
-
}
|
|
1138
|
-
#y() {
|
|
1139
|
-
this.#f(v.uri("Connection"), Q);
|
|
1140
|
-
}
|
|
1141
|
-
#x() {
|
|
1142
|
-
const t = this.#t.querySelectorAll("*[id]");
|
|
1143
|
-
for (let e = 0; e < t.length; ++e) {
|
|
1144
|
-
const s = t[e];
|
|
1145
|
-
if (!this.#o.has(s.id)) {
|
|
1146
|
-
const i = s.classList.contains("celldl-Annotation") ? Z : s.classList.contains("celldl-Compartment") ? oe : s.classList.contains("celldl-Component") ? k : s.classList.contains("celldl-Connection") ? Q : s.classList.contains("celldl-InterfacePort") ? Y : s.classList.contains("celldl-Unconnected") ? K : null;
|
|
1147
|
-
if (i !== null) {
|
|
1148
|
-
const r = new i(this.makeUri(s.id), {}, this);
|
|
1149
|
-
r.assignSvgElement(s), this.#d(r);
|
|
1150
|
-
}
|
|
1151
|
-
}
|
|
1152
|
-
}
|
|
1153
|
-
}
|
|
1154
|
-
}
|
|
1155
|
-
class he {
|
|
1156
|
-
#t = !1;
|
|
1157
|
-
#e = new o();
|
|
1158
|
-
#s = null;
|
|
1159
|
-
#i;
|
|
1160
|
-
#l = new o();
|
|
1161
|
-
#r = new o();
|
|
1162
|
-
#o;
|
|
1163
|
-
#a = 0.125;
|
|
1164
|
-
#n = 1;
|
|
1165
|
-
#h = 32;
|
|
1166
|
-
#c = 0.05;
|
|
1167
|
-
constructor(t) {
|
|
1168
|
-
t.addEventListener("wheel", this.#m.bind(this), { passive: !0 }), this.#i = t.id, this.#l = new o(
|
|
1169
|
-
t.offsetLeft + t.clientLeft,
|
|
1170
|
-
t.offsetTop + t.clientTop
|
|
1171
|
-
), this.#r = new o(t.clientWidth, t.clientHeight), this.#o = new ResizeObserver(this.#f.bind(this)), this.#o.observe(t);
|
|
1172
|
-
}
|
|
1173
|
-
get panning() {
|
|
1174
|
-
return this.#t;
|
|
1175
|
-
}
|
|
1176
|
-
get scale() {
|
|
1177
|
-
return this.#n;
|
|
1178
|
-
}
|
|
1179
|
-
#u() {
|
|
1180
|
-
return R(this.#s);
|
|
1181
|
-
}
|
|
1182
|
-
#d(t) {
|
|
1183
|
-
this.#s.setAttribute("viewBox", t.map((e) => String(e)).join(" "));
|
|
1184
|
-
}
|
|
1185
|
-
enable(t) {
|
|
1186
|
-
let e = R(t);
|
|
1187
|
-
if (e[2] * this.#r.y >= e[3] * this.#r.x ? (this.#n = this.#r.x / e[2], e[1] -= (this.#r.y / this.#n - e[3]) / 2, e[3] = this.#r.y / this.#n) : (this.#n = this.#r.y / e[3], e[0] -= (this.#r.x / this.#n - e[2]) / 2, e[2] = this.#r.x / this.#n), this.#a > this.#n && (this.#a = this.#n), this.#n >= 1) {
|
|
1188
|
-
this.#n = 1, e = R(t);
|
|
1189
|
-
const s = this.#r.subtract({ x: e[2], y: e[3] });
|
|
1190
|
-
e[0] -= s.x / 2, e[1] -= s.y / 2, e[2] = this.#r.x, e[3] = this.#r.y;
|
|
1191
|
-
}
|
|
1192
|
-
this.#s = t, this.#d(e), this.#t = !1;
|
|
1193
|
-
}
|
|
1194
|
-
disable() {
|
|
1195
|
-
this.#s = null, this.#t = !1, this.#n = 1;
|
|
1196
|
-
}
|
|
1197
|
-
pointerDown(t) {
|
|
1198
|
-
this.#t = !0, this.#e = o.fromPoint(t);
|
|
1199
|
-
}
|
|
1200
|
-
pointerMove(t) {
|
|
1201
|
-
if (this.#s && this.#t) {
|
|
1202
|
-
const e = this.#e.subtract(t).scalarScale(1 / this.#n);
|
|
1203
|
-
if (!e.isZero()) {
|
|
1204
|
-
const s = this.#u();
|
|
1205
|
-
return s[0] += e.x, s[1] += e.y, this.#d(s), this.#e = o.fromPoint(t), !0;
|
|
1206
|
-
}
|
|
1207
|
-
}
|
|
1208
|
-
return !1;
|
|
1209
|
-
}
|
|
1210
|
-
pointerUp(t) {
|
|
1211
|
-
this.#t = !1;
|
|
1212
|
-
}
|
|
1213
|
-
#f(t) {
|
|
1214
|
-
if (this.#s) {
|
|
1215
|
-
for (const e of t)
|
|
1216
|
-
if (e.target.id === this.#i) {
|
|
1217
|
-
const s = new o(e.contentRect.width, e.contentRect.height), i = this.#u(), r = s.subtract(this.#r);
|
|
1218
|
-
Math.abs(r.x * i[3]) >= Math.abs(r.y * i[2]) ? (this.#n = s.x / i[2], i[1] -= (this.#r.y / this.#n - i[3]) / 2, i[3] = s.y / this.#n) : (this.#n = s.y / i[3], i[0] -= (this.#r.x / this.#n - i[2]) / 2, i[2] = s.x / this.#n), this.#r = s, this.#d(i);
|
|
1219
|
-
}
|
|
1220
|
-
}
|
|
1221
|
-
}
|
|
1222
|
-
#m(t) {
|
|
1223
|
-
if (this.#s) {
|
|
1224
|
-
const s = (t.deltaY === 0 && t.deltaX ? t.deltaX : t.deltaY) < 0 ? 1 : -1, i = this.#n * Math.exp(s * this.#c / 3);
|
|
1225
|
-
this.#n = Math.min(Math.max(i, this.#a), this.#h);
|
|
1226
|
-
const r = this.#r.scalarScale(1 / this.#n), l = this.#u();
|
|
1227
|
-
l[0] += (l[2] - r.x) * (t.clientX - this.#l.x) / this.#r.x, l[1] += (l[3] - r.y) * (t.clientY - this.#l.y) / this.#r.y, l[2] = r.x, l[3] = r.y, this.#d(l);
|
|
1228
|
-
}
|
|
1229
|
-
}
|
|
1230
|
-
}
|
|
1231
|
-
const ce = 200;
|
|
1232
|
-
function j(n) {
|
|
1233
|
-
if (n.dataset.parentId)
|
|
1234
|
-
return n.dataset.parentId;
|
|
1235
|
-
if (n.classList.contains("parent-id"))
|
|
1236
|
-
return n.parentElement?.id || "";
|
|
1237
|
-
for (; n.tagName === "text"; ) {
|
|
1238
|
-
const t = n.previousElementSibling;
|
|
1239
|
-
if (t)
|
|
1240
|
-
n = t;
|
|
1241
|
-
else
|
|
1242
|
-
break;
|
|
1243
|
-
}
|
|
1244
|
-
return n.id;
|
|
1245
|
-
}
|
|
1246
|
-
const ue = "svg-panel";
|
|
1247
|
-
let de = class ht {
|
|
1248
|
-
static instance = null;
|
|
1249
|
-
#t = null;
|
|
1250
|
-
#e = null;
|
|
1251
|
-
#s = null;
|
|
1252
|
-
#i = !1;
|
|
1253
|
-
#l = null;
|
|
1254
|
-
#r = !1;
|
|
1255
|
-
#o = null;
|
|
1256
|
-
#a = null;
|
|
1257
|
-
#n = 0;
|
|
1258
|
-
#h;
|
|
1259
|
-
#c;
|
|
1260
|
-
#u = "";
|
|
1261
|
-
constructor() {
|
|
1262
|
-
ht.instance = this;
|
|
1263
|
-
}
|
|
1264
|
-
mount(t) {
|
|
1265
|
-
this.#t = t, this.#l = new he(this.#t);
|
|
1266
|
-
const { tippy: e } = wt(this.#t, {
|
|
1267
|
-
content: "",
|
|
1268
|
-
animation: "none",
|
|
1269
|
-
duration: [0, 0],
|
|
1270
|
-
showOnCreate: !1,
|
|
1271
|
-
hideOnClick: !1,
|
|
1272
|
-
trigger: "manual",
|
|
1273
|
-
arrow: !0,
|
|
1274
|
-
followCursor: !0
|
|
1275
|
-
});
|
|
1276
|
-
e.value && (this.#h = e, this.#c = this.#h.value.popper), this.#t.addEventListener("contextmenu", (s) => {
|
|
1277
|
-
if (this.#e) {
|
|
1278
|
-
const i = s.target, r = this.#e.objectById(j(i));
|
|
1279
|
-
r && r === this.#o && this.#b(r), document.dispatchEvent(new CustomEvent("open-context-menu", {
|
|
1280
|
-
detail: {
|
|
1281
|
-
// state: this.#contextMenuActiveItems,
|
|
1282
|
-
event: s
|
|
1283
|
-
}
|
|
1284
|
-
}));
|
|
1285
|
-
}
|
|
1286
|
-
}), document.addEventListener("context-menu-click", (s) => {
|
|
1287
|
-
s.detail.id;
|
|
1288
|
-
});
|
|
1289
|
-
}
|
|
1290
|
-
#d() {
|
|
1291
|
-
this.#t && (this.#t.addEventListener("click", this.#E.bind(this)), this.#t.addEventListener("pointerover", this.#S.bind(this)), this.#t.addEventListener("pointerout", this.#I.bind(this)), this.#t.addEventListener("pointerdown", this.#T.bind(this)), this.#t.addEventListener("pointermove", this.#P.bind(this)), this.#t.addEventListener("pointerup", this.#L.bind(this)));
|
|
1292
|
-
}
|
|
1293
|
-
#f() {
|
|
1294
|
-
this.#t && (this.#t.removeEventListener("click", this.#E.bind(this)), this.#t.removeEventListener("pointerover", this.#S.bind(this)), this.#t.removeEventListener("pointerout", this.#I.bind(this)), this.#t.removeEventListener("pointerdown", this.#T.bind(this)), this.#t.removeEventListener("pointermove", this.#P.bind(this)), this.#t.removeEventListener("pointerup", this.#L.bind(this)));
|
|
1295
|
-
}
|
|
1296
|
-
get celldlModel() {
|
|
1297
|
-
return this.#e;
|
|
1298
|
-
}
|
|
1299
|
-
get windowSize() {
|
|
1300
|
-
return this.#t ? [this.#t.clientWidth, this.#t.clientHeight] : [0, 0];
|
|
1301
|
-
}
|
|
1302
|
-
async viewDiagram(t) {
|
|
1303
|
-
this.#e !== null ? this.closeDiagram(!0) : this.#d(), this.#e = t, this.#s = t.svgDiagram, this.#t && this.#t.appendChild(this.#s), await f.nextTick(), t.finishSetup(), this.#l?.enable(this.#s), this.#o = null, this.#r = !1, this.#a = null;
|
|
1304
|
-
}
|
|
1305
|
-
closeDiagram(t = !1) {
|
|
1306
|
-
this.#e !== null && (t || this.#f(), this.#l?.disable(), this.#t && this.#t.removeChild(this.#s), this.#s = null, this.#e = null);
|
|
1307
|
-
}
|
|
1308
|
-
resetObjectStates() {
|
|
1309
|
-
this.#C(), this.#w();
|
|
1310
|
-
}
|
|
1311
|
-
#m() {
|
|
1312
|
-
this.#s?.style.removeProperty("cursor"), this.#t && this.#t.style.setProperty("cursor", "default");
|
|
1313
|
-
}
|
|
1314
|
-
#g() {
|
|
1315
|
-
this.#h && this.#h.value.hide();
|
|
1316
|
-
}
|
|
1317
|
-
#v(t, e = "") {
|
|
1318
|
-
if (t === "")
|
|
1319
|
-
this.#g();
|
|
1320
|
-
else if (this.#h && (this.#h.value.setContent(t), this.#h.value.show(), this.#c && (this.#u !== "" && (this.#c.classList.remove(this.#u), this.#u = ""), e !== ""))) {
|
|
1321
|
-
const s = `tooltip-${e}`;
|
|
1322
|
-
this.#c.classList.add(s), this.#u = s;
|
|
1323
|
-
}
|
|
1324
|
-
}
|
|
1325
|
-
#p(t, e = void 0) {
|
|
1326
|
-
this.#e && this.#e.viewerEvent(t, e);
|
|
1327
|
-
}
|
|
1328
|
-
#y(t, e) {
|
|
1329
|
-
t.activate(e);
|
|
1330
|
-
}
|
|
1331
|
-
#x(t) {
|
|
1332
|
-
t && this.#o !== t && (this.#y(t, !0), this.#o = t, t.tooltip && this.#v(t.tooltip, "info"), this.#p("active", t));
|
|
1333
|
-
}
|
|
1334
|
-
#w() {
|
|
1335
|
-
this.#o && (this.#y(this.#o, !1), this.#o = null, this.#p("unactive"));
|
|
1336
|
-
}
|
|
1337
|
-
#b(t) {
|
|
1338
|
-
this.#C(), t !== null && (t.select(!0), this.#a = t, this.#p("select", t));
|
|
1339
|
-
}
|
|
1340
|
-
#C() {
|
|
1341
|
-
this.#a && (this.#p("unselect", this.#a), this.#a.select(!1), this.#a = null);
|
|
1342
|
-
}
|
|
1343
|
-
#E(t) {
|
|
1344
|
-
const e = t.target;
|
|
1345
|
-
if (this.#e === null || !this.#s?.contains(e) || // clickTolerance = 1px ? to set pointerMoved?
|
|
1346
|
-
this.#r && Date.now() - this.#n > ce)
|
|
1347
|
-
return;
|
|
1348
|
-
const s = this.#e.objectById(j(e));
|
|
1349
|
-
this.#N(t, e, s);
|
|
1350
|
-
}
|
|
1351
|
-
#N(t, e, s) {
|
|
1352
|
-
let i = !1;
|
|
1353
|
-
this.#a !== null && (i = s === this.#a, this.#C()), !i && s && s === this.#o && this.#b(s);
|
|
1354
|
-
}
|
|
1355
|
-
#D(t) {
|
|
1356
|
-
return t === this.#s || t.id === ue || !this.#s?.contains(t);
|
|
1357
|
-
}
|
|
1358
|
-
#S(t) {
|
|
1359
|
-
if (this.#e === null)
|
|
1360
|
-
return;
|
|
1361
|
-
const e = t.target, s = this.#e.objectById(j(e));
|
|
1362
|
-
if (this.#D(e)) {
|
|
1363
|
-
this.#g(), this.#o && s !== this.#o && this.#w();
|
|
1364
|
-
return;
|
|
1365
|
-
}
|
|
1366
|
-
this.#o && s !== this.#o && this.#w(), s && this.#x(s);
|
|
1367
|
-
}
|
|
1368
|
-
#I(t) {
|
|
1369
|
-
const e = t.target;
|
|
1370
|
-
(e === this.#s || !this.#s?.contains(e)) && this.#o && this.#w();
|
|
1371
|
-
}
|
|
1372
|
-
#T(t) {
|
|
1373
|
-
this.#r = !1, this.#n = Date.now(), this.#s?.style.removeProperty("cursor"), this.#t?.style.setProperty("cursor", "grab"), this.#l.pointerDown(t), this.#i = !0;
|
|
1374
|
-
}
|
|
1375
|
-
#P(t) {
|
|
1376
|
-
if (this.#i) {
|
|
1377
|
-
this.#r = this.#l.pointerMove(t) || this.#r;
|
|
1378
|
-
return;
|
|
1379
|
-
}
|
|
1380
|
-
this.#r = !0;
|
|
1381
|
-
}
|
|
1382
|
-
#L(t) {
|
|
1383
|
-
if (this.#e !== null && this.#i) {
|
|
1384
|
-
this.#l.pointerUp(t), this.#i = !1, this.#m();
|
|
1385
|
-
return;
|
|
1386
|
-
}
|
|
1387
|
-
}
|
|
1388
|
-
};
|
|
1389
|
-
const fe = { class: "flex flex-col h-full" }, me = { class: "viewer-pane relative flex grow" }, pe = /* @__PURE__ */ St({
|
|
1390
|
-
__name: "CellDLViewer",
|
|
1391
|
-
props: {
|
|
1392
|
-
annotations: {},
|
|
1393
|
-
celldlData: {},
|
|
1394
|
-
options: {},
|
|
1395
|
-
theme: {}
|
|
1396
|
-
},
|
|
1397
|
-
emits: ["error", "event"],
|
|
1398
|
-
setup(n, { emit: t }) {
|
|
1399
|
-
const e = n, s = f.getCurrentInstance();
|
|
1400
|
-
if (s) {
|
|
1401
|
-
const c = s.appContext.app;
|
|
1402
|
-
c.config.globalProperties.$primevue || c.use(vt, {
|
|
1403
|
-
theme: {
|
|
1404
|
-
preset: xt,
|
|
1405
|
-
options: {
|
|
1406
|
-
darkModeSelector: ".celldl-dark-mode"
|
|
1407
|
-
}
|
|
1408
|
-
}
|
|
1409
|
-
}), c.use(Ct);
|
|
1410
|
-
}
|
|
1411
|
-
G().setTheme(e.theme), f.watch(
|
|
1412
|
-
() => e.theme,
|
|
1413
|
-
() => {
|
|
1414
|
-
G().setTheme(e.theme);
|
|
1415
|
-
}
|
|
1416
|
-
);
|
|
1417
|
-
const i = f.ref(null);
|
|
1418
|
-
let r;
|
|
1419
|
-
const l = new de(), a = t;
|
|
1420
|
-
return f.watch(
|
|
1421
|
-
() => e.celldlData,
|
|
1422
|
-
async () => {
|
|
1423
|
-
if (e.celldlData === "")
|
|
1424
|
-
r = new $(l), await r.viewModel();
|
|
1425
|
-
else
|
|
1426
|
-
try {
|
|
1427
|
-
r = new $(l, e.celldlData, e.annotations, e.options), await r.viewModel();
|
|
1428
|
-
} catch (c) {
|
|
1429
|
-
a("error", `Invalid CellDL file... (${c})`);
|
|
1430
|
-
}
|
|
1431
|
-
}
|
|
1432
|
-
), f.onMounted(async () => {
|
|
1433
|
-
i.value && (l.mount(i.value), r = new $(l), await r.viewModel());
|
|
1434
|
-
}), bt(document, "viewer-event", (c) => {
|
|
1435
|
-
a("event", c.detail);
|
|
1436
|
-
}), (c, B) => {
|
|
1437
|
-
const g = Et;
|
|
1438
|
-
return It(), Tt("div", fe, [
|
|
1439
|
-
F("main", me, [
|
|
1440
|
-
F("div", {
|
|
1441
|
-
id: "svg-content",
|
|
1442
|
-
ref_key: "svgContent",
|
|
1443
|
-
ref: i
|
|
1444
|
-
}, [
|
|
1445
|
-
Pt(g, {
|
|
1446
|
-
ref: "context-menu",
|
|
1447
|
-
model: c.contextMenuItems
|
|
1448
|
-
}, null, 8, ["model"])
|
|
1449
|
-
], 512)
|
|
1450
|
-
])
|
|
1451
|
-
]);
|
|
1452
|
-
};
|
|
1453
|
-
}
|
|
1454
|
-
}), ge = (n, t) => {
|
|
1455
|
-
const e = n.__vccOpts || n;
|
|
1456
|
-
for (const [s, i] of t)
|
|
1457
|
-
e[s] = i;
|
|
1458
|
-
return e;
|
|
1459
|
-
}, ve = /* @__PURE__ */ ge(pe, [["__scopeId", "data-v-1526afda"]]);
|
|
1460
|
-
export {
|
|
1461
|
-
ve as default
|
|
1462
|
-
};
|
|
1463
|
-
//# sourceMappingURL=CellDLViewer-Cyo8fJde.js.map
|