@celldl/viewer 0.20260731.2 → 0.20260801.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 +3 -3
- package/dist/CellDLViewer.css +1 -1
- package/dist/CellDLViewer.es.js +5 -5
- package/dist/CellDLViewer.es.js.map +1 -1
- package/dist/{WrappedViewer-cgZteVYv.js → WrappedViewer-BUx-WA2c.js} +176 -168
- package/dist/{WrappedViewer-cgZteVYv.js.map → WrappedViewer-BUx-WA2c.js.map} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -11068,7 +11068,7 @@ class Ar {
|
|
|
11068
11068
|
#n = 1 / 0;
|
|
11069
11069
|
id;
|
|
11070
11070
|
constructor(e = 0, t = -1 / 0, n = 1 / 0) {
|
|
11071
|
-
this.#t = e, this.#
|
|
11071
|
+
this.#t = e, this.#a(t) <= this.#a(n) ? (this.#r = t, this.#n = n) : (this.#r = n, this.#n = t), this.id = Gf("V");
|
|
11072
11072
|
}
|
|
11073
11073
|
clean() {
|
|
11074
11074
|
this.#e = !1;
|
|
@@ -11080,10 +11080,10 @@ class Ar {
|
|
|
11080
11080
|
return this.minimum === this.maximum;
|
|
11081
11081
|
}
|
|
11082
11082
|
get minimum() {
|
|
11083
|
-
return this.#
|
|
11083
|
+
return this.#a(this.#r);
|
|
11084
11084
|
}
|
|
11085
11085
|
get maximum() {
|
|
11086
|
-
return this.#
|
|
11086
|
+
return this.#a(this.#n);
|
|
11087
11087
|
}
|
|
11088
11088
|
get value() {
|
|
11089
11089
|
return this.#t;
|
|
@@ -11091,7 +11091,7 @@ class Ar {
|
|
|
11091
11091
|
set value(e) {
|
|
11092
11092
|
this.#t !== e && (e < this.minimum ? e = this.minimum : e > this.maximum && (e = this.maximum), this.#t !== e && (this.#t = e, this.#e = !0));
|
|
11093
11093
|
}
|
|
11094
|
-
#
|
|
11094
|
+
#a(e) {
|
|
11095
11095
|
return typeof e == "number" ? e : e.value;
|
|
11096
11096
|
}
|
|
11097
11097
|
copy() {
|
|
@@ -11102,7 +11102,7 @@ class Ar {
|
|
|
11102
11102
|
}
|
|
11103
11103
|
narrowRange(e, t) {
|
|
11104
11104
|
let n = e, i = t;
|
|
11105
|
-
this.#
|
|
11105
|
+
this.#a(n) > this.#a(i) && (n = t, i = e), this.#a(n) > this.minimum && (this.#r = n), this.#a(i) < this.maximum && (this.#n = i);
|
|
11106
11106
|
}
|
|
11107
11107
|
reassignMaximum(e) {
|
|
11108
11108
|
this.#n = e;
|
|
@@ -11198,8 +11198,8 @@ class ln {
|
|
|
11198
11198
|
#t;
|
|
11199
11199
|
#r;
|
|
11200
11200
|
#n;
|
|
11201
|
-
#
|
|
11202
|
-
#
|
|
11201
|
+
#a;
|
|
11202
|
+
#i = null;
|
|
11203
11203
|
constructor(e, t, n = null) {
|
|
11204
11204
|
this.setCornerPositions(e, t), this.setCentroidOffset(n || new Te(0.5, 0.5));
|
|
11205
11205
|
}
|
|
@@ -11213,7 +11213,7 @@ class ln {
|
|
|
11213
11213
|
return this.#e.fixed && this.#t.fixed;
|
|
11214
11214
|
}
|
|
11215
11215
|
get svgElement() {
|
|
11216
|
-
return this.#
|
|
11216
|
+
return this.#i;
|
|
11217
11217
|
}
|
|
11218
11218
|
get topLeftPoint() {
|
|
11219
11219
|
return this.#e.point;
|
|
@@ -11222,14 +11222,14 @@ class ln {
|
|
|
11222
11222
|
this.#e.clean(), this.#t.clean();
|
|
11223
11223
|
}
|
|
11224
11224
|
copy() {
|
|
11225
|
-
return new ln(this.#e, this.#t, this.#
|
|
11225
|
+
return new ln(this.#e, this.#t, this.#a);
|
|
11226
11226
|
}
|
|
11227
11227
|
setCornerPositions(e, t) {
|
|
11228
11228
|
let n = e.xValue, i = e.yValue, s = t.xValue, a = t.yValue;
|
|
11229
11229
|
n.value > s.value && (n = t.xValue, s = e.xValue), i.value > a.value && (i = t.yValue, a = e.yValue), this.#e = new at(n, i), this.#t = new at(s, a), this.#r = Me.subtract(this.#t.point, this.#e.point);
|
|
11230
11230
|
}
|
|
11231
11231
|
setCentroidOffset(e) {
|
|
11232
|
-
this.#
|
|
11232
|
+
this.#a = e, this.#n = at.fromPoint(this.#r.scale(this.#a).add(this.#e.point));
|
|
11233
11233
|
}
|
|
11234
11234
|
svg(e = {}) {
|
|
11235
11235
|
return Cf(this.#e.point, this.#t.point, e);
|
|
@@ -11371,12 +11371,12 @@ class tc {
|
|
|
11371
11371
|
#r = new Te(0.5, 0.5);
|
|
11372
11372
|
#n;
|
|
11373
11373
|
// Wrt centroid, anticlockwise from bottom right
|
|
11374
|
-
#
|
|
11375
|
-
#
|
|
11376
|
-
#a;
|
|
11377
|
-
#l = new Te();
|
|
11374
|
+
#a = !1;
|
|
11375
|
+
#i = /* @__PURE__ */ new Set();
|
|
11378
11376
|
#u;
|
|
11379
|
-
#
|
|
11377
|
+
#l = new Te();
|
|
11378
|
+
#o;
|
|
11379
|
+
#s;
|
|
11380
11380
|
#f = null;
|
|
11381
11381
|
constructor(e, t) {
|
|
11382
11382
|
if (this.celldlObject = e, t === null)
|
|
@@ -11388,7 +11388,7 @@ class tc {
|
|
|
11388
11388
|
const s = getComputedStyle(i).transform;
|
|
11389
11389
|
s !== "none" && (this.#f = this.#f.leftMultiply(st.fromString(s))), i = i.parentNode;
|
|
11390
11390
|
}
|
|
11391
|
-
this.#f.isIdentity && (this.#f = null), e.setCelldlSvgElement(this), this.#
|
|
11391
|
+
this.#f.isIdentity && (this.#f = null), e.setCelldlSvgElement(this), this.#o = t, this.#u = t, this.#p();
|
|
11392
11392
|
}
|
|
11393
11393
|
get bounds() {
|
|
11394
11394
|
return this.#e;
|
|
@@ -11412,16 +11412,16 @@ class tc {
|
|
|
11412
11412
|
return this.celldlObject.id;
|
|
11413
11413
|
}
|
|
11414
11414
|
get selected() {
|
|
11415
|
-
return this.#
|
|
11415
|
+
return this.#a;
|
|
11416
11416
|
}
|
|
11417
11417
|
get size() {
|
|
11418
11418
|
return this.#l;
|
|
11419
11419
|
}
|
|
11420
11420
|
get svgElement() {
|
|
11421
|
-
return this.#
|
|
11421
|
+
return this.#o;
|
|
11422
11422
|
}
|
|
11423
11423
|
get topLeft() {
|
|
11424
|
-
return this.#
|
|
11424
|
+
return this.#s;
|
|
11425
11425
|
}
|
|
11426
11426
|
get width() {
|
|
11427
11427
|
return this.#l.x;
|
|
@@ -11430,44 +11430,44 @@ class tc {
|
|
|
11430
11430
|
this.#t = e;
|
|
11431
11431
|
}
|
|
11432
11432
|
svgBounds(e = !1) {
|
|
11433
|
-
return e || this.#e === void 0 ? _t.fromSvg(this.#
|
|
11433
|
+
return e || this.#e === void 0 ? _t.fromSvg(this.#o, this.#f) : this.#e;
|
|
11434
11434
|
}
|
|
11435
11435
|
#h() {
|
|
11436
11436
|
const e = [];
|
|
11437
|
-
if (this.#
|
|
11438
|
-
const t = this.#
|
|
11437
|
+
if (this.#u.tagName === "g" && this.#u.classList.contains(Ne.Connection)) {
|
|
11438
|
+
const t = this.#u.children;
|
|
11439
11439
|
for (let n = 0; n < t.length; ++n)
|
|
11440
11440
|
e.push(t[n]);
|
|
11441
11441
|
} else
|
|
11442
|
-
e.push(this.#
|
|
11442
|
+
e.push(this.#u);
|
|
11443
11443
|
return e;
|
|
11444
11444
|
}
|
|
11445
|
-
#
|
|
11445
|
+
#c(e, t) {
|
|
11446
11446
|
if (t) {
|
|
11447
11447
|
for (const n of this.#h())
|
|
11448
11448
|
n.classList.add(e);
|
|
11449
|
-
this.#
|
|
11449
|
+
this.#i.add(e);
|
|
11450
11450
|
} else {
|
|
11451
11451
|
for (const n of this.#h())
|
|
11452
11452
|
n.classList.remove(e);
|
|
11453
|
-
this.#
|
|
11453
|
+
this.#i.delete(e);
|
|
11454
11454
|
}
|
|
11455
11455
|
}
|
|
11456
11456
|
activate(e = !0) {
|
|
11457
|
-
this.#
|
|
11457
|
+
this.#c("active", e);
|
|
11458
11458
|
}
|
|
11459
11459
|
highlight(e = !0) {
|
|
11460
|
-
this.#
|
|
11460
|
+
this.#c("highlight", e);
|
|
11461
11461
|
}
|
|
11462
11462
|
pointerEvent(e, t, n) {
|
|
11463
11463
|
return !1;
|
|
11464
11464
|
}
|
|
11465
11465
|
select(e = !0) {
|
|
11466
|
-
this.#
|
|
11466
|
+
this.#c("selected", e), this.#a = e;
|
|
11467
11467
|
}
|
|
11468
|
-
#
|
|
11468
|
+
#d() {
|
|
11469
11469
|
const e = this.svgBounds(!0);
|
|
11470
|
-
this.#l = new Te(e.right - e.left, e.bottom - e.top), this.#t ? (this.#
|
|
11470
|
+
this.#l = new Te(e.right - e.left, e.bottom - e.top), this.#t ? (this.#s = this.#t.subtract(this.#l.scale(this.#r)), this.#e = new _t(this.#s.x, this.#s.y, this.#s.x + this.#l.x, this.#s.y + this.#l.y)) : (this.#s = new Te(e.left, e.top), this.#e = e, this.#t = this.#l.scale(this.#r).add(this.#s));
|
|
11471
11471
|
const t = this.#l.scale(this.#r).scalarScale(-1), n = zf / 2 - so / 2;
|
|
11472
11472
|
this.#n = [
|
|
11473
11473
|
t.add(this.#l).add({ x: n, y: n }),
|
|
@@ -11477,24 +11477,24 @@ class tc {
|
|
|
11477
11477
|
];
|
|
11478
11478
|
}
|
|
11479
11479
|
#p() {
|
|
11480
|
-
if (this.#r = new Te(0.5, 0.5), this.#
|
|
11481
|
-
const e = this.#
|
|
11480
|
+
if (this.#r = new Te(0.5, 0.5), this.#o.tagName === "g") {
|
|
11481
|
+
const e = this.#o.children.item(0);
|
|
11482
11482
|
e.dataset.centreX && (this.#r = new Te(+e.dataset.centreX, +e.dataset.centreY));
|
|
11483
11483
|
}
|
|
11484
|
-
if (this.#
|
|
11485
|
-
const e = (this.#
|
|
11486
|
-
if (this.#
|
|
11487
|
-
const i = this.#
|
|
11484
|
+
if (this.#d(), this.#o.tagName === "g" && !this.#o.classList.contains(Ne.Connection) && this.#o.firstElementChild !== null) {
|
|
11485
|
+
const e = (this.#o.classList.contains(Ne.Compartment) ? _t.fromSvg(this.#o.firstChild) : _t.fromSvg(this.#o)).expand(so / 2);
|
|
11486
|
+
if (this.#o.firstElementChild.tagName === "svg") {
|
|
11487
|
+
const i = this.#o.firstElementChild;
|
|
11488
11488
|
i.setAttribute("x", `${e.topLeft.x}px`), i.setAttribute("y", `${e.topLeft.y}px`), i.setAttribute("width", `${e.width}px`), i.setAttribute("height", `${e.height}px`);
|
|
11489
11489
|
}
|
|
11490
11490
|
const n = new Vf(e.asArray()).svg({
|
|
11491
|
-
class: `selection-element parent-id editor-specific ${[...this.#
|
|
11491
|
+
class: `selection-element parent-id editor-specific ${[...this.#i.values()].join(" ")}`
|
|
11492
11492
|
});
|
|
11493
|
-
if (this.#
|
|
11493
|
+
if (this.#o.insertAdjacentHTML("beforeend", n), this.#u = this.#o.lastChild, this.celldlObject.isConduit) {
|
|
11494
11494
|
const i = new Te(e.right - e.left, e.bottom - e.top).scale(this.#r).add(new Te(e.left, e.top)), s = Af(i, ec, {
|
|
11495
11495
|
class: "selection-element parent-id editor-specific conduit"
|
|
11496
11496
|
});
|
|
11497
|
-
this.#
|
|
11497
|
+
this.#o.insertAdjacentHTML("beforeend", s);
|
|
11498
11498
|
}
|
|
11499
11499
|
}
|
|
11500
11500
|
}
|
|
@@ -11518,7 +11518,7 @@ class wa {
|
|
|
11518
11518
|
#t;
|
|
11519
11519
|
#r;
|
|
11520
11520
|
#n;
|
|
11521
|
-
#
|
|
11521
|
+
#a;
|
|
11522
11522
|
constructor(e, t = {}, n) {
|
|
11523
11523
|
this.uri = e, this.options = t, this.#t = n, this.#e = this.constructor.celldlClassName, this.#n = It.uri(this.constructor.celldlType);
|
|
11524
11524
|
}
|
|
@@ -11577,10 +11577,10 @@ class wa {
|
|
|
11577
11577
|
return this.#r?.svgElement || null;
|
|
11578
11578
|
}
|
|
11579
11579
|
get tooltip() {
|
|
11580
|
-
return this.#
|
|
11580
|
+
return this.#a;
|
|
11581
11581
|
}
|
|
11582
11582
|
set tooltip(e) {
|
|
11583
|
-
this.#
|
|
11583
|
+
this.#a = e;
|
|
11584
11584
|
}
|
|
11585
11585
|
activate(e = !0) {
|
|
11586
11586
|
this.#r?.activate(e);
|
|
@@ -11643,22 +11643,22 @@ class co {
|
|
|
11643
11643
|
#t = new qf();
|
|
11644
11644
|
#r;
|
|
11645
11645
|
#n;
|
|
11646
|
-
#
|
|
11647
|
-
#
|
|
11648
|
-
#
|
|
11646
|
+
#a;
|
|
11647
|
+
#i = /* @__PURE__ */ new Map();
|
|
11648
|
+
#u = /* @__PURE__ */ new Map();
|
|
11649
11649
|
constructor(e, t = "", n = {}, i = void 0) {
|
|
11650
|
-
if (this.#r = e, this.#n = Ri(fo), this.#
|
|
11651
|
-
this.#l(t), this.#
|
|
11650
|
+
if (this.#r = e, this.#n = Ri(fo), this.#a = new Ii(`${fo}#`), t !== "") {
|
|
11651
|
+
this.#l(t), this.#o();
|
|
11652
11652
|
const s = i ? i.tooltip : void 0;
|
|
11653
|
-
for (const a of this.#
|
|
11653
|
+
for (const a of this.#u.values())
|
|
11654
11654
|
if (a.id in n) {
|
|
11655
11655
|
const o = n[a.id];
|
|
11656
|
-
this.#
|
|
11656
|
+
this.#i.set(a.id, o), s && s in o && (a.tooltip = String(o[s]));
|
|
11657
11657
|
}
|
|
11658
11658
|
}
|
|
11659
11659
|
}
|
|
11660
11660
|
finishSetup() {
|
|
11661
|
-
this.#
|
|
11661
|
+
this.#b(), this.#y(), this.#w(), this.#g(), this.#p(), this.#_();
|
|
11662
11662
|
}
|
|
11663
11663
|
async viewModel() {
|
|
11664
11664
|
this.#e ? await this.#r.viewDiagram(this) : this.#r.closeDiagram();
|
|
@@ -11669,7 +11669,7 @@ class co {
|
|
|
11669
11669
|
};
|
|
11670
11670
|
t && (n.component = {
|
|
11671
11671
|
id: t.id
|
|
11672
|
-
}, this.#
|
|
11672
|
+
}, this.#i.has(t.id) && (n.component.annotation = this.#i.get(t.id))), document.dispatchEvent(new CustomEvent("viewer-event", {
|
|
11673
11673
|
detail: n
|
|
11674
11674
|
}));
|
|
11675
11675
|
}
|
|
@@ -11683,10 +11683,10 @@ class co {
|
|
|
11683
11683
|
return this.#n.value;
|
|
11684
11684
|
}
|
|
11685
11685
|
makeUri(e) {
|
|
11686
|
-
return this.#
|
|
11686
|
+
return this.#a.uri(e);
|
|
11687
11687
|
}
|
|
11688
11688
|
objectById(e) {
|
|
11689
|
-
return this.#
|
|
11689
|
+
return this.#u.get(e) || null;
|
|
11690
11690
|
}
|
|
11691
11691
|
#l(e) {
|
|
11692
11692
|
const i = new DOMParser().parseFromString(e, "image/svg+xml").firstElementChild;
|
|
@@ -11699,7 +11699,7 @@ class co {
|
|
|
11699
11699
|
s[a].setAttribute("stroke", Hf);
|
|
11700
11700
|
this.#e = i;
|
|
11701
11701
|
}
|
|
11702
|
-
#
|
|
11702
|
+
#o() {
|
|
11703
11703
|
const e = this.#e?.getElementById(sc);
|
|
11704
11704
|
if (e && (!("contentType" in e.dataset) || e.dataset.contentType === mr)) {
|
|
11705
11705
|
const t = e.childNodes;
|
|
@@ -11712,7 +11712,7 @@ class co {
|
|
|
11712
11712
|
}
|
|
11713
11713
|
}
|
|
11714
11714
|
}
|
|
11715
|
-
#
|
|
11715
|
+
#s(e) {
|
|
11716
11716
|
const t = this.#e?.getElementById(e.id);
|
|
11717
11717
|
return t ? (e.assignSvgElement(t), !0) : (console.error(`Missing SVG element for ${e.id}`), !1);
|
|
11718
11718
|
}
|
|
@@ -11723,47 +11723,47 @@ class co {
|
|
|
11723
11723
|
#h(e) {
|
|
11724
11724
|
return this.#t.subjectsOfType(e).filter((t) => t[0].value.startsWith(this.#n.value));
|
|
11725
11725
|
}
|
|
11726
|
-
#
|
|
11727
|
-
this.#
|
|
11726
|
+
#c(e) {
|
|
11727
|
+
this.#u.set(e.id, e);
|
|
11728
11728
|
}
|
|
11729
|
-
#
|
|
11729
|
+
#d(e, t) {
|
|
11730
11730
|
for (const n of this.#h(e))
|
|
11731
11731
|
if (n[1].equals(e)) {
|
|
11732
11732
|
const i = this.#f(t, n[0]);
|
|
11733
|
-
this.#
|
|
11733
|
+
this.#s(i) && this.#c(i);
|
|
11734
11734
|
}
|
|
11735
11735
|
}
|
|
11736
11736
|
#p() {
|
|
11737
|
-
this.#
|
|
11737
|
+
this.#d(It.uri("Annotation"), oo);
|
|
11738
11738
|
}
|
|
11739
|
-
#
|
|
11740
|
-
this.#
|
|
11739
|
+
#b() {
|
|
11740
|
+
this.#d(It.uri("Component"), ii), this.#d(It.uri("UnconnectedPort"), uo);
|
|
11741
11741
|
}
|
|
11742
|
-
#
|
|
11743
|
-
this.#
|
|
11742
|
+
#y() {
|
|
11743
|
+
this.#d(It.uri("Connector"), lo);
|
|
11744
11744
|
}
|
|
11745
|
-
#
|
|
11746
|
-
this.#
|
|
11745
|
+
#w() {
|
|
11746
|
+
this.#d(It.uri("Conduit"), nc);
|
|
11747
11747
|
}
|
|
11748
11748
|
getConnector(e) {
|
|
11749
11749
|
if (e && ot(e) && e.value.startsWith(this.#n.value)) {
|
|
11750
|
-
const t = e.id(), n = this.#
|
|
11750
|
+
const t = e.id(), n = this.#u.get(t);
|
|
11751
11751
|
return n?.isConnectable ? n : null;
|
|
11752
11752
|
}
|
|
11753
11753
|
return null;
|
|
11754
11754
|
}
|
|
11755
|
-
#
|
|
11756
|
-
this.#
|
|
11755
|
+
#g() {
|
|
11756
|
+
this.#d(It.uri("Connection"), ao);
|
|
11757
11757
|
}
|
|
11758
|
-
#
|
|
11758
|
+
#_() {
|
|
11759
11759
|
const e = this.#e.querySelectorAll("*[id]");
|
|
11760
11760
|
for (let t = 0; t < e.length; ++t) {
|
|
11761
11761
|
const n = e[t];
|
|
11762
|
-
if (!this.#
|
|
11762
|
+
if (!this.#u.has(n.id)) {
|
|
11763
11763
|
const i = n.classList.contains("celldl-Annotation") ? oo : n.classList.contains("celldl-Compartment") ? ic : n.classList.contains("celldl-Component") ? ii : n.classList.contains("celldl-Connection") ? ao : n.classList.contains("celldl-InterfacePort") ? lo : n.classList.contains("celldl-Unconnected") ? uo : null;
|
|
11764
11764
|
if (i !== null) {
|
|
11765
11765
|
const s = new i(this.makeUri(n.id), {}, this);
|
|
11766
|
-
s.assignSvgElement(n), this.#
|
|
11766
|
+
s.assignSvgElement(n), this.#c(s);
|
|
11767
11767
|
}
|
|
11768
11768
|
}
|
|
11769
11769
|
}
|
|
@@ -11774,52 +11774,52 @@ class oc {
|
|
|
11774
11774
|
#t = new Te();
|
|
11775
11775
|
#r = null;
|
|
11776
11776
|
#n;
|
|
11777
|
-
#
|
|
11778
|
-
#
|
|
11779
|
-
#
|
|
11777
|
+
#a = new Te();
|
|
11778
|
+
#i = new Te();
|
|
11779
|
+
#u;
|
|
11780
11780
|
#l = !0;
|
|
11781
|
-
#
|
|
11782
|
-
#
|
|
11781
|
+
#o = 0.125;
|
|
11782
|
+
#s = 1;
|
|
11783
11783
|
#f = 32;
|
|
11784
11784
|
#h = 0.05;
|
|
11785
11785
|
constructor(e) {
|
|
11786
|
-
e.addEventListener("wheel", this.#
|
|
11786
|
+
e.addEventListener("wheel", this.#b.bind(this), { passive: !0 }), this.#n = e.id, this.#a = new Te(e.offsetLeft + e.clientLeft, e.offsetTop + e.clientTop), (e.clientWidth === 0 || e.clientHeight === 0) && (console.error("Container for viewer has no size..."), this.#l = !1), this.#i = new Te(e.clientWidth, e.clientHeight), this.#u = new ResizeObserver(this.#p.bind(this)), this.#u.observe(e);
|
|
11787
11787
|
}
|
|
11788
11788
|
get panning() {
|
|
11789
11789
|
return this.#e;
|
|
11790
11790
|
}
|
|
11791
11791
|
get scale() {
|
|
11792
|
-
return this.#
|
|
11792
|
+
return this.#s;
|
|
11793
11793
|
}
|
|
11794
|
-
#
|
|
11794
|
+
#c() {
|
|
11795
11795
|
return zn(this.#r);
|
|
11796
11796
|
}
|
|
11797
|
-
#
|
|
11797
|
+
#d(e) {
|
|
11798
11798
|
this.#r.setAttribute("viewBox", e.map((t) => String(t)).join(" "));
|
|
11799
11799
|
}
|
|
11800
11800
|
enable(e) {
|
|
11801
11801
|
if (!this.#l)
|
|
11802
11802
|
return;
|
|
11803
11803
|
let t = zn(e);
|
|
11804
|
-
if (t[2] * this.#
|
|
11805
|
-
this.#
|
|
11806
|
-
const n = this.#
|
|
11807
|
-
t[0] -= n.x / 2, t[1] -= n.y / 2, t[2] = this.#
|
|
11804
|
+
if (t[2] * this.#i.y >= t[3] * this.#i.x ? (this.#s = this.#i.x / t[2], t[1] -= (this.#i.y / this.#s - t[3]) / 2, t[3] = this.#i.y / this.#s) : (this.#s = this.#i.y / t[3], t[0] -= (this.#i.x / this.#s - t[2]) / 2, t[2] = this.#i.x / this.#s), this.#o > this.#s && (this.#o = this.#s), this.#s >= 1) {
|
|
11805
|
+
this.#s = 1, t = zn(e);
|
|
11806
|
+
const n = this.#i.subtract({ x: t[2], y: t[3] });
|
|
11807
|
+
t[0] -= n.x / 2, t[1] -= n.y / 2, t[2] = this.#i.x, t[3] = this.#i.y;
|
|
11808
11808
|
}
|
|
11809
|
-
this.#r = e, this.#
|
|
11809
|
+
this.#r = e, this.#d(t), this.#e = !1;
|
|
11810
11810
|
}
|
|
11811
11811
|
disable() {
|
|
11812
|
-
this.#r = null, this.#e = !1, this.#
|
|
11812
|
+
this.#r = null, this.#e = !1, this.#s = 1;
|
|
11813
11813
|
}
|
|
11814
11814
|
pointerDown(e) {
|
|
11815
11815
|
this.#e = !0, this.#t = Te.fromPoint(e);
|
|
11816
11816
|
}
|
|
11817
11817
|
pointerMove(e) {
|
|
11818
11818
|
if (this.#r && this.#e) {
|
|
11819
|
-
const t = this.#t.subtract(e).scalarScale(1 / this.#
|
|
11819
|
+
const t = this.#t.subtract(e).scalarScale(1 / this.#s);
|
|
11820
11820
|
if (!t.isZero()) {
|
|
11821
|
-
const n = this.#
|
|
11822
|
-
return n[0] += t.x, n[1] += t.y, this.#
|
|
11821
|
+
const n = this.#c();
|
|
11822
|
+
return n[0] += t.x, n[1] += t.y, this.#d(n), this.#t = Te.fromPoint(e), !0;
|
|
11823
11823
|
}
|
|
11824
11824
|
}
|
|
11825
11825
|
return !1;
|
|
@@ -11831,17 +11831,17 @@ class oc {
|
|
|
11831
11831
|
if (this.#r) {
|
|
11832
11832
|
for (const t of e)
|
|
11833
11833
|
if (t.target.id === this.#n) {
|
|
11834
|
-
const n = new Te(t.contentRect.width, t.contentRect.height), i = this.#
|
|
11835
|
-
Math.abs(s.x * i[3]) >= Math.abs(s.y * i[2]) ? (this.#
|
|
11834
|
+
const n = new Te(t.contentRect.width, t.contentRect.height), i = this.#c(), s = n.subtract(this.#i);
|
|
11835
|
+
Math.abs(s.x * i[3]) >= Math.abs(s.y * i[2]) ? (this.#s = n.x / i[2], i[1] -= (this.#i.y / this.#s - i[3]) / 2, i[3] = n.y / this.#s) : (this.#s = n.y / i[3], i[0] -= (this.#i.x / this.#s - i[2]) / 2, i[2] = n.x / this.#s), this.#i = n, this.#d(i);
|
|
11836
11836
|
}
|
|
11837
11837
|
}
|
|
11838
11838
|
}
|
|
11839
|
-
#
|
|
11839
|
+
#b(e) {
|
|
11840
11840
|
if (this.#r) {
|
|
11841
|
-
const n = (e.deltaY === 0 && e.deltaX ? e.deltaX : e.deltaY) < 0 ? 1 : -1, i = this.#
|
|
11842
|
-
this.#
|
|
11843
|
-
const s = this.#
|
|
11844
|
-
a[0] += (a[2] - s.x) * (e.clientX - this.#
|
|
11841
|
+
const n = (e.deltaY === 0 && e.deltaX ? e.deltaX : e.deltaY) < 0 ? 1 : -1, i = this.#s * Math.exp(n * this.#h / 3);
|
|
11842
|
+
this.#s = Math.min(Math.max(i, this.#o), this.#f);
|
|
11843
|
+
const s = this.#i.scalarScale(1 / this.#s), a = this.#c();
|
|
11844
|
+
a[0] += (a[2] - s.x) * (e.clientX - this.#a.x) / this.#i.x, a[1] += (a[3] - s.y) * (e.clientY - this.#a.y) / this.#i.y, a[2] = s.x, a[3] = s.y, this.#d(a);
|
|
11845
11845
|
}
|
|
11846
11846
|
}
|
|
11847
11847
|
}
|
|
@@ -11865,22 +11865,23 @@ class Ai {
|
|
|
11865
11865
|
static instance = null;
|
|
11866
11866
|
#e = null;
|
|
11867
11867
|
#t = null;
|
|
11868
|
-
#r =
|
|
11869
|
-
#n =
|
|
11870
|
-
#
|
|
11871
|
-
#
|
|
11872
|
-
#
|
|
11868
|
+
#r = "";
|
|
11869
|
+
#n = null;
|
|
11870
|
+
#a = !1;
|
|
11871
|
+
#i = null;
|
|
11872
|
+
#u = !1;
|
|
11873
11873
|
#l = null;
|
|
11874
|
-
#
|
|
11875
|
-
#
|
|
11874
|
+
#o = null;
|
|
11875
|
+
#s = 0;
|
|
11876
11876
|
#f;
|
|
11877
|
-
#h
|
|
11877
|
+
#h;
|
|
11878
|
+
#c = "";
|
|
11878
11879
|
constructor() {
|
|
11879
11880
|
Ai.instance = this;
|
|
11880
11881
|
}
|
|
11881
|
-
mount(e) {
|
|
11882
|
-
this.#e = e, this.#
|
|
11883
|
-
const { tippy:
|
|
11882
|
+
mount(e, t) {
|
|
11883
|
+
this.#e = e, this.#r = t, this.#i = new oc(this.#e);
|
|
11884
|
+
const { tippy: n } = bi(this.#e, {
|
|
11884
11885
|
content: "",
|
|
11885
11886
|
animation: "none",
|
|
11886
11887
|
duration: [0, 0],
|
|
@@ -11890,12 +11891,12 @@ class Ai {
|
|
|
11890
11891
|
arrow: !0,
|
|
11891
11892
|
followCursor: !0
|
|
11892
11893
|
});
|
|
11893
|
-
|
|
11894
|
+
n.value && (this.#f = n, this.#h = this.#f.value.popper);
|
|
11894
11895
|
}
|
|
11895
11896
|
#d() {
|
|
11896
11897
|
this.#e && (this.#e.addEventListener("click", this.#x.bind(this)), this.#e.addEventListener("pointerover", this.#E.bind(this)), this.#e.addEventListener("pointerout", this.#S.bind(this)), this.#e.addEventListener("pointerdown", this.#T.bind(this)), this.#e.addEventListener("pointermove", this.#I.bind(this)), this.#e.addEventListener("pointerup", this.#R.bind(this)));
|
|
11897
11898
|
}
|
|
11898
|
-
#
|
|
11899
|
+
#p() {
|
|
11899
11900
|
this.#e && (this.#e.removeEventListener("click", this.#x.bind(this)), this.#e.removeEventListener("pointerover", this.#E.bind(this)), this.#e.removeEventListener("pointerout", this.#S.bind(this)), this.#e.removeEventListener("pointerdown", this.#T.bind(this)), this.#e.removeEventListener("pointermove", this.#I.bind(this)), this.#e.removeEventListener("pointerup", this.#R.bind(this)));
|
|
11900
11901
|
}
|
|
11901
11902
|
get celldlModel() {
|
|
@@ -11905,97 +11906,99 @@ class Ai {
|
|
|
11905
11906
|
return this.#e ? [this.#e.clientWidth, this.#e.clientHeight] : [0, 0];
|
|
11906
11907
|
}
|
|
11907
11908
|
async viewDiagram(e) {
|
|
11908
|
-
this.#t !== null ? this.closeDiagram(!0) : this.#d(), this.#t = e, this.#
|
|
11909
|
+
this.#t !== null ? this.closeDiagram(!0) : this.#d(), this.#t = e, this.#n = e.svgDiagram, this.#e && this.#e.appendChild(this.#n), await pr.nextTick(), e.finishSetup(), this.#r !== "" && (this.#n?.setAttribute(this.#r, ""), this.#n?.querySelectorAll("*").forEach((t) => {
|
|
11910
|
+
t.setAttribute(this.#r, "");
|
|
11911
|
+
})), this.#i?.enable(this.#n), this.#l = null, this.#u = !1, this.#o = null;
|
|
11909
11912
|
}
|
|
11910
11913
|
closeDiagram(e = !1) {
|
|
11911
|
-
this.#t !== null && (e || this.#
|
|
11914
|
+
this.#t !== null && (e || this.#p(), this.#i?.disable(), this.#e && this.#e.removeChild(this.#n), this.#n = null, this.#t = null);
|
|
11912
11915
|
}
|
|
11913
11916
|
resetObjectStates() {
|
|
11914
|
-
this.#v(), this.#
|
|
11917
|
+
this.#v(), this.#m();
|
|
11915
11918
|
}
|
|
11916
|
-
#
|
|
11917
|
-
this.#
|
|
11919
|
+
#b() {
|
|
11920
|
+
this.#n?.style.removeProperty("cursor"), this.#e && this.#e.style.setProperty("cursor", "default");
|
|
11918
11921
|
}
|
|
11919
|
-
#
|
|
11920
|
-
this.#
|
|
11922
|
+
#y() {
|
|
11923
|
+
this.#f && this.#f.value.hide();
|
|
11921
11924
|
}
|
|
11922
|
-
#
|
|
11925
|
+
#w(e, t = "") {
|
|
11923
11926
|
if (e === "")
|
|
11924
|
-
this.#
|
|
11925
|
-
else if (this.#
|
|
11927
|
+
this.#y();
|
|
11928
|
+
else if (this.#f && (this.#f.value.setContent(e), this.#f.value.show(), this.#h && (this.#c !== "" && (this.#h.classList.remove(this.#c), this.#c = ""), t !== ""))) {
|
|
11926
11929
|
const n = `tooltip-${t}`;
|
|
11927
|
-
this.#
|
|
11930
|
+
this.#h.classList.add(n), this.#c = n;
|
|
11928
11931
|
}
|
|
11929
11932
|
}
|
|
11930
|
-
#
|
|
11933
|
+
#g(e, t = void 0) {
|
|
11931
11934
|
this.#t && this.#t.viewerEvent(e, t);
|
|
11932
11935
|
}
|
|
11933
|
-
#
|
|
11936
|
+
#_(e, t) {
|
|
11934
11937
|
e.activate(t);
|
|
11935
11938
|
}
|
|
11936
|
-
#
|
|
11937
|
-
e && this.#
|
|
11939
|
+
#A(e) {
|
|
11940
|
+
e && this.#l !== e && (this.#_(e, !0), this.#l = e, e.tooltip && this.#w(e.tooltip, "info"), this.#g("active", e));
|
|
11938
11941
|
}
|
|
11939
|
-
#
|
|
11940
|
-
this.#
|
|
11942
|
+
#m() {
|
|
11943
|
+
this.#l && (this.#_(this.#l, !1), this.#l = null, this.#g("unactive"));
|
|
11941
11944
|
}
|
|
11942
|
-
#
|
|
11943
|
-
this.#v(), e !== null && (e.select(!0), this.#
|
|
11945
|
+
#N(e) {
|
|
11946
|
+
this.#v(), e !== null && (e.select(!0), this.#o = e, this.#g("select", e));
|
|
11944
11947
|
}
|
|
11945
11948
|
#v() {
|
|
11946
|
-
this.#
|
|
11949
|
+
this.#o && (this.#g("unselect", this.#o), this.#o.select(!1), this.#o = null);
|
|
11947
11950
|
}
|
|
11948
11951
|
#x(e) {
|
|
11949
11952
|
const t = e.target;
|
|
11950
|
-
if (this.#t === null || !this.#
|
|
11951
|
-
this.#
|
|
11953
|
+
if (this.#t === null || !this.#n?.contains(t) || // clickTolerance = 1px ? to set pointerMoved?
|
|
11954
|
+
this.#u && Date.now() - this.#s > ac)
|
|
11952
11955
|
return;
|
|
11953
11956
|
const n = this.#t.objectById(ho(t));
|
|
11954
|
-
this.#
|
|
11957
|
+
this.#C(e, t, n);
|
|
11955
11958
|
}
|
|
11956
|
-
#
|
|
11959
|
+
#C(e, t, n) {
|
|
11957
11960
|
let i = !1;
|
|
11958
|
-
this.#
|
|
11961
|
+
this.#o !== null && (i = n === this.#o, this.#v()), !i && n && n === this.#l && this.#N(n);
|
|
11959
11962
|
}
|
|
11960
|
-
#
|
|
11961
|
-
return e === this.#
|
|
11963
|
+
#O(e) {
|
|
11964
|
+
return e === this.#n || e.id === lc || !this.#n?.contains(e);
|
|
11962
11965
|
}
|
|
11963
11966
|
#E(e) {
|
|
11964
11967
|
if (this.#t === null)
|
|
11965
11968
|
return;
|
|
11966
11969
|
const t = e.target, n = this.#t.objectById(ho(t));
|
|
11967
|
-
if (this.#
|
|
11968
|
-
this.#
|
|
11970
|
+
if (this.#O(t)) {
|
|
11971
|
+
this.#y(), this.#l && n !== this.#l && this.#m();
|
|
11969
11972
|
return;
|
|
11970
11973
|
}
|
|
11971
|
-
this.#
|
|
11974
|
+
this.#l && n !== this.#l && this.#m(), n && this.#A(n);
|
|
11972
11975
|
}
|
|
11973
11976
|
#S(e) {
|
|
11974
11977
|
const t = e.target;
|
|
11975
|
-
(t === this.#
|
|
11978
|
+
(t === this.#n || !this.#n?.contains(t)) && this.#l && this.#m();
|
|
11976
11979
|
}
|
|
11977
11980
|
#T(e) {
|
|
11978
|
-
this.#
|
|
11981
|
+
this.#u = !1, this.#s = Date.now(), this.#n?.style.removeProperty("cursor"), this.#e?.style.setProperty("cursor", "grab"), this.#i.pointerDown(e), this.#a = !0;
|
|
11979
11982
|
}
|
|
11980
11983
|
#I(e) {
|
|
11981
|
-
if (this.#
|
|
11982
|
-
this.#
|
|
11984
|
+
if (this.#a) {
|
|
11985
|
+
this.#u = this.#i.pointerMove(e) || this.#u;
|
|
11983
11986
|
return;
|
|
11984
11987
|
}
|
|
11985
|
-
this.#
|
|
11988
|
+
this.#u = !0;
|
|
11986
11989
|
}
|
|
11987
11990
|
#R(e) {
|
|
11988
|
-
if (this.#t !== null && this.#
|
|
11989
|
-
this.#
|
|
11991
|
+
if (this.#t !== null && this.#a) {
|
|
11992
|
+
this.#i.pointerUp(e), this.#a = !1, this.#b();
|
|
11990
11993
|
return;
|
|
11991
11994
|
}
|
|
11992
11995
|
}
|
|
11993
11996
|
}
|
|
11994
|
-
const
|
|
11997
|
+
const uc = /* @__PURE__ */ oi({
|
|
11995
11998
|
__name: "WrappedViewer",
|
|
11996
11999
|
props: {
|
|
11997
12000
|
annotations: {},
|
|
11998
|
-
|
|
12001
|
+
svgData: {},
|
|
11999
12002
|
options: {},
|
|
12000
12003
|
theme: {}
|
|
12001
12004
|
},
|
|
@@ -12003,34 +12006,39 @@ const Ec = /* @__PURE__ */ oi({
|
|
|
12003
12006
|
setup(r, { emit: e }) {
|
|
12004
12007
|
const t = r, n = pr.getCurrentInstance();
|
|
12005
12008
|
n && n.appContext.app.use(Cu);
|
|
12006
|
-
const i = pr.ref(null);
|
|
12007
|
-
let
|
|
12008
|
-
const
|
|
12009
|
-
if (t.
|
|
12010
|
-
|
|
12009
|
+
const i = n?.type.__scopeId || "", s = pr.ref(null);
|
|
12010
|
+
let a;
|
|
12011
|
+
const o = new Ai(), f = e, g = async () => {
|
|
12012
|
+
if (t.svgData === "")
|
|
12013
|
+
a = new co(o), await a.viewModel();
|
|
12011
12014
|
else
|
|
12012
12015
|
try {
|
|
12013
|
-
|
|
12014
|
-
} catch (
|
|
12015
|
-
|
|
12016
|
+
a = new co(o, t.svgData, t.annotations, t.options), await a.viewModel();
|
|
12017
|
+
} catch (c) {
|
|
12018
|
+
f("error", `Invalid CellDL file... (${c})`);
|
|
12016
12019
|
}
|
|
12017
12020
|
};
|
|
12018
12021
|
return pr.watch(
|
|
12019
|
-
() => t.
|
|
12022
|
+
() => t.svgData,
|
|
12020
12023
|
async () => {
|
|
12021
|
-
await
|
|
12024
|
+
await g();
|
|
12022
12025
|
}
|
|
12023
12026
|
), pr.onMounted(async () => {
|
|
12024
|
-
|
|
12025
|
-
}), $a(document, "viewer-event", (
|
|
12026
|
-
|
|
12027
|
-
}), (
|
|
12027
|
+
s.value && (o.mount(s.value, i), await g());
|
|
12028
|
+
}), $a(document, "viewer-event", (c) => {
|
|
12029
|
+
f("event", c.detail);
|
|
12030
|
+
}), (c, m) => (Ca(), Oa("div", {
|
|
12028
12031
|
ref_key: "svgContent",
|
|
12029
|
-
ref:
|
|
12032
|
+
ref: s
|
|
12030
12033
|
}, null, 512));
|
|
12031
12034
|
}
|
|
12032
|
-
})
|
|
12035
|
+
}), fc = (r, e) => {
|
|
12036
|
+
const t = r.__vccOpts || r;
|
|
12037
|
+
for (const [n, i] of e)
|
|
12038
|
+
t[n] = i;
|
|
12039
|
+
return t;
|
|
12040
|
+
}, Tc = /* @__PURE__ */ fc(uc, [["__scopeId", "data-v-a85a514c"]]);
|
|
12033
12041
|
export {
|
|
12034
|
-
|
|
12042
|
+
Tc as default
|
|
12035
12043
|
};
|
|
12036
|
-
//# sourceMappingURL=WrappedViewer-
|
|
12044
|
+
//# sourceMappingURL=WrappedViewer-BUx-WA2c.js.map
|