geonodes-web-render 0.3.1 → 0.3.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/embed.js
CHANGED
|
@@ -8495,42 +8495,42 @@ var Kf = {
|
|
|
8495
8495
|
simulationZone: Gf
|
|
8496
8496
|
}, qf = { padding: .08 };
|
|
8497
8497
|
function Jf(e) {
|
|
8498
|
-
let { nodes: t, edges: n, breadcrumbs: r, onNavigate: i, onSelectionIds: o } = e, { fitView:
|
|
8498
|
+
let { nodes: t, edges: n, breadcrumbs: r, onNavigate: i, onSelectionIds: o, zoomOnScroll: s = !0 } = e, { fitView: l } = ll(), u = d(null), f = d(!1), [p, m, h] = fd(t), [v, y, b] = pd(n);
|
|
8499
8499
|
c(() => {
|
|
8500
|
-
|
|
8500
|
+
m(t), o?.([]), f.current = !1, l(qf);
|
|
8501
8501
|
}, [
|
|
8502
8502
|
t,
|
|
8503
|
-
|
|
8503
|
+
m,
|
|
8504
8504
|
o,
|
|
8505
|
-
|
|
8505
|
+
l
|
|
8506
8506
|
]), c(() => {
|
|
8507
|
-
|
|
8508
|
-
}, [n,
|
|
8509
|
-
let e =
|
|
8507
|
+
y(n);
|
|
8508
|
+
}, [n, y]), c(() => {
|
|
8509
|
+
let e = u.current;
|
|
8510
8510
|
if (!e) return;
|
|
8511
8511
|
let t = new ResizeObserver(() => {
|
|
8512
|
-
|
|
8512
|
+
f.current || l(qf);
|
|
8513
8513
|
});
|
|
8514
8514
|
return t.observe(e), () => t.disconnect();
|
|
8515
|
-
}, [
|
|
8516
|
-
let
|
|
8517
|
-
e && (
|
|
8515
|
+
}, [l]);
|
|
8516
|
+
let x = a((e) => {
|
|
8517
|
+
e && (f.current = !0);
|
|
8518
8518
|
}, []);
|
|
8519
8519
|
return /* @__PURE__ */ g("div", {
|
|
8520
|
-
ref:
|
|
8520
|
+
ref: u,
|
|
8521
8521
|
style: {
|
|
8522
8522
|
width: "100%",
|
|
8523
8523
|
height: "100%"
|
|
8524
8524
|
},
|
|
8525
8525
|
children: /* @__PURE__ */ _(dd, {
|
|
8526
|
-
nodes:
|
|
8527
|
-
edges:
|
|
8528
|
-
onNodesChange:
|
|
8529
|
-
onEdgesChange:
|
|
8526
|
+
nodes: p,
|
|
8527
|
+
edges: v,
|
|
8528
|
+
onNodesChange: h,
|
|
8529
|
+
onEdgesChange: b,
|
|
8530
8530
|
onSelectionChange: a(({ nodes: e }) => {
|
|
8531
8531
|
o?.(e.map((e) => e.id));
|
|
8532
8532
|
}, [o]),
|
|
8533
|
-
onMoveStart:
|
|
8533
|
+
onMoveStart: x,
|
|
8534
8534
|
nodeTypes: Kf,
|
|
8535
8535
|
fitView: !0,
|
|
8536
8536
|
fitViewOptions: qf,
|
|
@@ -8546,7 +8546,8 @@ function Jf(e) {
|
|
|
8546
8546
|
connectOnClick: !1,
|
|
8547
8547
|
panOnDrag: [1, 2],
|
|
8548
8548
|
panOnScroll: !1,
|
|
8549
|
-
zoomOnScroll:
|
|
8549
|
+
zoomOnScroll: s,
|
|
8550
|
+
preventScrolling: s,
|
|
8550
8551
|
zoomOnDoubleClick: !1,
|
|
8551
8552
|
children: [
|
|
8552
8553
|
/* @__PURE__ */ g(bd, {
|
|
@@ -8596,10 +8597,10 @@ function Jf(e) {
|
|
|
8596
8597
|
});
|
|
8597
8598
|
}
|
|
8598
8599
|
function Yf(e) {
|
|
8599
|
-
let { jsonText: t, showHeader: n = !0, onSelectionChange: r } = e, [
|
|
8600
|
+
let { jsonText: t, showHeader: n = !0, onSelectionChange: r, zoomOnScroll: i = !0 } = e, [o, s] = f({
|
|
8600
8601
|
json: t,
|
|
8601
8602
|
ids: []
|
|
8602
|
-
}),
|
|
8603
|
+
}), l = u(() => {
|
|
8603
8604
|
if (!t.trim()) return null;
|
|
8604
8605
|
try {
|
|
8605
8606
|
let { rootId: e, trees: n } = ff(JSON.parse(t)), r = {};
|
|
@@ -8622,36 +8623,36 @@ function Yf(e) {
|
|
|
8622
8623
|
error: e instanceof Error ? e.message : String(e)
|
|
8623
8624
|
};
|
|
8624
8625
|
}
|
|
8625
|
-
}, [t]),
|
|
8626
|
-
if (!
|
|
8627
|
-
let e =
|
|
8628
|
-
for (let t of e)
|
|
8626
|
+
}, [t]), d = u(() => {
|
|
8627
|
+
if (!l?.views) return [];
|
|
8628
|
+
let e = o.json === t ? o.ids : [], n = [l.rootId];
|
|
8629
|
+
for (let t of e) l.views[t] && n.push(t);
|
|
8629
8630
|
return n;
|
|
8630
8631
|
}, [
|
|
8631
|
-
|
|
8632
|
-
|
|
8632
|
+
l,
|
|
8633
|
+
o,
|
|
8633
8634
|
t
|
|
8634
|
-
]),
|
|
8635
|
-
|
|
8635
|
+
]), p = l?.views ? l.views[d[d.length - 1]] : null, m = a((e) => {
|
|
8636
|
+
s((n) => ({
|
|
8636
8637
|
json: t,
|
|
8637
8638
|
ids: n.json === t ? [...n.ids, e] : [e]
|
|
8638
8639
|
}));
|
|
8639
|
-
}, [t]),
|
|
8640
|
+
}, [t]), h = u(() => ({ openGroup: m }), [m]);
|
|
8640
8641
|
c(() => {
|
|
8641
|
-
if (
|
|
8642
|
+
if (d.length <= 1) return;
|
|
8642
8643
|
function e(e) {
|
|
8643
8644
|
if (e.key !== "Tab" && e.key !== "Escape" || e.ctrlKey || e.metaKey || e.altKey) return;
|
|
8644
8645
|
let n = e.target;
|
|
8645
|
-
n && (n.isContentEditable || n.tagName === "INPUT" || n.tagName === "TEXTAREA" || n.closest(".cm-editor")) || (e.preventDefault(),
|
|
8646
|
+
n && (n.isContentEditable || n.tagName === "INPUT" || n.tagName === "TEXTAREA" || n.closest(".cm-editor")) || (e.preventDefault(), s({
|
|
8646
8647
|
json: t,
|
|
8647
|
-
ids:
|
|
8648
|
+
ids: d.slice(1, -1)
|
|
8648
8649
|
}));
|
|
8649
8650
|
}
|
|
8650
8651
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
8651
|
-
}, [
|
|
8652
|
-
let
|
|
8652
|
+
}, [d, t]);
|
|
8653
|
+
let v = l?.views ? d.map((e) => ({
|
|
8653
8654
|
id: e,
|
|
8654
|
-
label:
|
|
8655
|
+
label: l.views[e].graph.label
|
|
8655
8656
|
})) : [];
|
|
8656
8657
|
return /* @__PURE__ */ _("div", {
|
|
8657
8658
|
className: "panel flow-panel",
|
|
@@ -8663,25 +8664,26 @@ function Yf(e) {
|
|
|
8663
8664
|
}), /* @__PURE__ */ g("div", {
|
|
8664
8665
|
className: "panel-status",
|
|
8665
8666
|
"aria-live": "polite",
|
|
8666
|
-
children:
|
|
8667
|
+
children: p ? `${p.graph.nodes.length} nodes, ${p.graph.edges.length} links` : null
|
|
8667
8668
|
})]
|
|
8668
8669
|
}) : null, /* @__PURE__ */ g("div", {
|
|
8669
8670
|
className: "panel-body flow-panel__body",
|
|
8670
|
-
children:
|
|
8671
|
+
children: l?.error ? /* @__PURE__ */ _("div", {
|
|
8671
8672
|
className: "flow-error",
|
|
8672
8673
|
role: "alert",
|
|
8673
|
-
children: [/* @__PURE__ */ g("strong", { children: "Parse error" }), /* @__PURE__ */ g("span", { children:
|
|
8674
|
-
}) :
|
|
8675
|
-
value:
|
|
8674
|
+
children: [/* @__PURE__ */ g("strong", { children: "Parse error" }), /* @__PURE__ */ g("span", { children: l.error })]
|
|
8675
|
+
}) : p ? /* @__PURE__ */ g(Cf.Provider, {
|
|
8676
|
+
value: h,
|
|
8676
8677
|
children: /* @__PURE__ */ g(sd, { children: /* @__PURE__ */ g(Jf, {
|
|
8677
|
-
nodes:
|
|
8678
|
-
edges:
|
|
8679
|
-
breadcrumbs:
|
|
8680
|
-
onNavigate: (e) =>
|
|
8678
|
+
nodes: p.flow.nodes,
|
|
8679
|
+
edges: p.flow.edges,
|
|
8680
|
+
breadcrumbs: v,
|
|
8681
|
+
onNavigate: (e) => s({
|
|
8681
8682
|
json: t,
|
|
8682
|
-
ids:
|
|
8683
|
+
ids: d.slice(1, e + 1)
|
|
8683
8684
|
}),
|
|
8684
|
-
onSelectionIds: r
|
|
8685
|
+
onSelectionIds: r,
|
|
8686
|
+
zoomOnScroll: i
|
|
8685
8687
|
}) })
|
|
8686
8688
|
}) : /* @__PURE__ */ g("div", {
|
|
8687
8689
|
className: "flow-empty",
|
|
@@ -8716,7 +8718,8 @@ function Xf(e) {
|
|
|
8716
8718
|
children: [/* @__PURE__ */ g("strong", { children: "Decode error" }), /* @__PURE__ */ g("span", { children: i })]
|
|
8717
8719
|
}) : /* @__PURE__ */ g(Yf, {
|
|
8718
8720
|
jsonText: n,
|
|
8719
|
-
showHeader: !1
|
|
8721
|
+
showHeader: !1,
|
|
8722
|
+
zoomOnScroll: !1
|
|
8720
8723
|
})
|
|
8721
8724
|
})
|
|
8722
8725
|
});
|
|
@@ -4,4 +4,7 @@ export declare function GeometryNodesFlow(props: {
|
|
|
4
4
|
showHeader?: boolean;
|
|
5
5
|
/** Reports the currently selected node ids (raw Tree Clipper node ids as strings). */
|
|
6
6
|
onSelectionChange?: (nodeIds: string[]) => void;
|
|
7
|
+
/** Zoom the canvas on mouse-wheel. Default true; set false (e.g. in an embed)
|
|
8
|
+
* so the wheel scrolls the host page instead of the node tree. */
|
|
9
|
+
zoomOnScroll?: boolean;
|
|
7
10
|
}): import("react").JSX.Element;
|
package/package.json
CHANGED