@squeed/flow-sdk 0.1.2 → 0.1.3
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/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +29 -24
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -26230,35 +26230,40 @@ function KW() {
|
|
|
26230
26230
|
if (a.dom_container)
|
|
26231
26231
|
this._nodes_dom_container = a.dom_container;
|
|
26232
26232
|
else {
|
|
26233
|
-
let
|
|
26234
|
-
|
|
26235
|
-
}
|
|
26236
|
-
this._resize_observer = new ResizeObserver((
|
|
26237
|
-
for (let
|
|
26238
|
-
let
|
|
26239
|
-
n.getElementById(
|
|
26240
|
-
}
|
|
26241
|
-
}), n.on("add", "node", (
|
|
26242
|
-
this._add_node(
|
|
26243
|
-
}), n.on("remove", "node", (
|
|
26244
|
-
this._remove_node(
|
|
26233
|
+
let s = document.createElement("div");
|
|
26234
|
+
s.style.position = "absolute", s.style.zIndex = 10, i.querySelector("canvas").parentNode.appendChild(s), this._nodes_dom_container = s;
|
|
26235
|
+
}
|
|
26236
|
+
this._resize_observer = new ResizeObserver((s) => {
|
|
26237
|
+
for (let l of s) {
|
|
26238
|
+
let u = l.target, c = u.__cy_id;
|
|
26239
|
+
n.getElementById(c).style({ width: u.offsetWidth, height: u.offsetHeight, shape: "rectangle" });
|
|
26240
|
+
}
|
|
26241
|
+
}), n.on("add", "node", (s) => {
|
|
26242
|
+
this._add_node(s.target);
|
|
26243
|
+
}), n.on("remove", "node", (s) => {
|
|
26244
|
+
this._remove_node(s.target);
|
|
26245
26245
|
});
|
|
26246
|
-
for (let
|
|
26247
|
-
this._add_node(
|
|
26248
|
-
|
|
26249
|
-
|
|
26250
|
-
|
|
26251
|
-
|
|
26252
|
-
|
|
26253
|
-
|
|
26246
|
+
for (let s of n.nodes())
|
|
26247
|
+
this._add_node(s);
|
|
26248
|
+
this._nodes_dom_container.style.willChange = "transform", this._nodes_dom_container.style.backfaceVisibility = "hidden";
|
|
26249
|
+
let o = null;
|
|
26250
|
+
n.on("pan zoom", () => {
|
|
26251
|
+
o === null && (o = requestAnimationFrame(() => {
|
|
26252
|
+
o = null;
|
|
26253
|
+
let s = n.pan(), l = n.zoom(), u = "translate3d(" + s.x + "px," + s.y + "px,0) scale(" + l + ")";
|
|
26254
|
+
this._nodes_dom_container.style.transform = u;
|
|
26255
|
+
}));
|
|
26256
|
+
}), this._panZoomRafId = o, n.on("position bounds", "node", (s) => {
|
|
26257
|
+
let l = s.target, u = l.id();
|
|
26258
|
+
if (!this._node_dom[u])
|
|
26254
26259
|
return;
|
|
26255
|
-
let
|
|
26256
|
-
|
|
26260
|
+
let c = this._node_dom[u], d = `translate(-50%, -50%) translate3d(${l.position("x").toFixed(2)}px, ${l.position("y").toFixed(2)}px, 0)`;
|
|
26261
|
+
c.style.transform = d, c.style.display = "inline", c.style.position = "absolute", c.style["z-index"] = 10;
|
|
26257
26262
|
});
|
|
26258
26263
|
}
|
|
26259
26264
|
_add_node(n) {
|
|
26260
26265
|
let a = n.data();
|
|
26261
|
-
a.dom && (a.skip_node_append !== !0 && this._nodes_dom_container.appendChild(a.dom), a.dom.__cy_id = n.id(), this._node_dom[n.id()] = a.dom, this._resize_observer.observe(a.dom));
|
|
26266
|
+
a.dom && (a.skip_node_append !== !0 && this._nodes_dom_container.appendChild(a.dom), a.dom.__cy_id = n.id(), a.dom.style.willChange = "transform", a.dom.style.backfaceVisibility = "hidden", this._node_dom[n.id()] = a.dom, this._resize_observer.observe(a.dom));
|
|
26262
26267
|
}
|
|
26263
26268
|
_remove_node(n) {
|
|
26264
26269
|
let a = n.id(), i = this._node_dom[a];
|
|
@@ -26285,7 +26290,7 @@ function KW() {
|
|
|
26285
26290
|
this._resize_observer.unobserve(this._node_dom[n]);
|
|
26286
26291
|
for (; this._nodes_dom_container.firstChild; )
|
|
26287
26292
|
this._nodes_dom_container.removeChild(this._nodes_dom_container.firstChild);
|
|
26288
|
-
this._node_dom = {}, this._cy.removeListener("add", "node"), this._cy.removeListener("remove", "node"), this._cy.removeListener("pan zoom"), this._cy.removeListener("position bounds", "node"), this._params.dom_container || this._nodes_dom_container.parentNode.removeChild(this._nodes_dom_container), this._cy = null, this._params = null, this._nodes_dom_container = null, this._resize_observer = null;
|
|
26293
|
+
this._node_dom = {}, this._cy.removeListener("add", "node"), this._cy.removeListener("remove", "node"), this._cy.removeListener("pan zoom"), this._cy.removeListener("position bounds", "node"), this._params.dom_container || this._nodes_dom_container.parentNode.removeChild(this._nodes_dom_container), this._panZoomRafId !== null && cancelAnimationFrame(this._panZoomRafId), this._cy = null, this._params = null, this._nodes_dom_container = null, this._resize_observer = null;
|
|
26289
26294
|
}
|
|
26290
26295
|
}
|
|
26291
26296
|
function e(t) {
|