geonodes-web-render 0.3.1 → 0.3.2
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,7 @@ function Jf(e) {
|
|
|
8546
8546
|
connectOnClick: !1,
|
|
8547
8547
|
panOnDrag: [1, 2],
|
|
8548
8548
|
panOnScroll: !1,
|
|
8549
|
-
zoomOnScroll:
|
|
8549
|
+
zoomOnScroll: s,
|
|
8550
8550
|
zoomOnDoubleClick: !1,
|
|
8551
8551
|
children: [
|
|
8552
8552
|
/* @__PURE__ */ g(bd, {
|
|
@@ -8596,10 +8596,10 @@ function Jf(e) {
|
|
|
8596
8596
|
});
|
|
8597
8597
|
}
|
|
8598
8598
|
function Yf(e) {
|
|
8599
|
-
let { jsonText: t, showHeader: n = !0, onSelectionChange: r } = e, [
|
|
8599
|
+
let { jsonText: t, showHeader: n = !0, onSelectionChange: r, zoomOnScroll: i = !0 } = e, [o, s] = f({
|
|
8600
8600
|
json: t,
|
|
8601
8601
|
ids: []
|
|
8602
|
-
}),
|
|
8602
|
+
}), l = u(() => {
|
|
8603
8603
|
if (!t.trim()) return null;
|
|
8604
8604
|
try {
|
|
8605
8605
|
let { rootId: e, trees: n } = ff(JSON.parse(t)), r = {};
|
|
@@ -8622,36 +8622,36 @@ function Yf(e) {
|
|
|
8622
8622
|
error: e instanceof Error ? e.message : String(e)
|
|
8623
8623
|
};
|
|
8624
8624
|
}
|
|
8625
|
-
}, [t]),
|
|
8626
|
-
if (!
|
|
8627
|
-
let e =
|
|
8628
|
-
for (let t of e)
|
|
8625
|
+
}, [t]), d = u(() => {
|
|
8626
|
+
if (!l?.views) return [];
|
|
8627
|
+
let e = o.json === t ? o.ids : [], n = [l.rootId];
|
|
8628
|
+
for (let t of e) l.views[t] && n.push(t);
|
|
8629
8629
|
return n;
|
|
8630
8630
|
}, [
|
|
8631
|
-
|
|
8632
|
-
|
|
8631
|
+
l,
|
|
8632
|
+
o,
|
|
8633
8633
|
t
|
|
8634
|
-
]),
|
|
8635
|
-
|
|
8634
|
+
]), p = l?.views ? l.views[d[d.length - 1]] : null, m = a((e) => {
|
|
8635
|
+
s((n) => ({
|
|
8636
8636
|
json: t,
|
|
8637
8637
|
ids: n.json === t ? [...n.ids, e] : [e]
|
|
8638
8638
|
}));
|
|
8639
|
-
}, [t]),
|
|
8639
|
+
}, [t]), h = u(() => ({ openGroup: m }), [m]);
|
|
8640
8640
|
c(() => {
|
|
8641
|
-
if (
|
|
8641
|
+
if (d.length <= 1) return;
|
|
8642
8642
|
function e(e) {
|
|
8643
8643
|
if (e.key !== "Tab" && e.key !== "Escape" || e.ctrlKey || e.metaKey || e.altKey) return;
|
|
8644
8644
|
let n = e.target;
|
|
8645
|
-
n && (n.isContentEditable || n.tagName === "INPUT" || n.tagName === "TEXTAREA" || n.closest(".cm-editor")) || (e.preventDefault(),
|
|
8645
|
+
n && (n.isContentEditable || n.tagName === "INPUT" || n.tagName === "TEXTAREA" || n.closest(".cm-editor")) || (e.preventDefault(), s({
|
|
8646
8646
|
json: t,
|
|
8647
|
-
ids:
|
|
8647
|
+
ids: d.slice(1, -1)
|
|
8648
8648
|
}));
|
|
8649
8649
|
}
|
|
8650
8650
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
8651
|
-
}, [
|
|
8652
|
-
let
|
|
8651
|
+
}, [d, t]);
|
|
8652
|
+
let v = l?.views ? d.map((e) => ({
|
|
8653
8653
|
id: e,
|
|
8654
|
-
label:
|
|
8654
|
+
label: l.views[e].graph.label
|
|
8655
8655
|
})) : [];
|
|
8656
8656
|
return /* @__PURE__ */ _("div", {
|
|
8657
8657
|
className: "panel flow-panel",
|
|
@@ -8663,25 +8663,26 @@ function Yf(e) {
|
|
|
8663
8663
|
}), /* @__PURE__ */ g("div", {
|
|
8664
8664
|
className: "panel-status",
|
|
8665
8665
|
"aria-live": "polite",
|
|
8666
|
-
children:
|
|
8666
|
+
children: p ? `${p.graph.nodes.length} nodes, ${p.graph.edges.length} links` : null
|
|
8667
8667
|
})]
|
|
8668
8668
|
}) : null, /* @__PURE__ */ g("div", {
|
|
8669
8669
|
className: "panel-body flow-panel__body",
|
|
8670
|
-
children:
|
|
8670
|
+
children: l?.error ? /* @__PURE__ */ _("div", {
|
|
8671
8671
|
className: "flow-error",
|
|
8672
8672
|
role: "alert",
|
|
8673
|
-
children: [/* @__PURE__ */ g("strong", { children: "Parse error" }), /* @__PURE__ */ g("span", { children:
|
|
8674
|
-
}) :
|
|
8675
|
-
value:
|
|
8673
|
+
children: [/* @__PURE__ */ g("strong", { children: "Parse error" }), /* @__PURE__ */ g("span", { children: l.error })]
|
|
8674
|
+
}) : p ? /* @__PURE__ */ g(Cf.Provider, {
|
|
8675
|
+
value: h,
|
|
8676
8676
|
children: /* @__PURE__ */ g(sd, { children: /* @__PURE__ */ g(Jf, {
|
|
8677
|
-
nodes:
|
|
8678
|
-
edges:
|
|
8679
|
-
breadcrumbs:
|
|
8680
|
-
onNavigate: (e) =>
|
|
8677
|
+
nodes: p.flow.nodes,
|
|
8678
|
+
edges: p.flow.edges,
|
|
8679
|
+
breadcrumbs: v,
|
|
8680
|
+
onNavigate: (e) => s({
|
|
8681
8681
|
json: t,
|
|
8682
|
-
ids:
|
|
8682
|
+
ids: d.slice(1, e + 1)
|
|
8683
8683
|
}),
|
|
8684
|
-
onSelectionIds: r
|
|
8684
|
+
onSelectionIds: r,
|
|
8685
|
+
zoomOnScroll: i
|
|
8685
8686
|
}) })
|
|
8686
8687
|
}) : /* @__PURE__ */ g("div", {
|
|
8687
8688
|
className: "flow-empty",
|
|
@@ -8716,7 +8717,8 @@ function Xf(e) {
|
|
|
8716
8717
|
children: [/* @__PURE__ */ g("strong", { children: "Decode error" }), /* @__PURE__ */ g("span", { children: i })]
|
|
8717
8718
|
}) : /* @__PURE__ */ g(Yf, {
|
|
8718
8719
|
jsonText: n,
|
|
8719
|
-
showHeader: !1
|
|
8720
|
+
showHeader: !1,
|
|
8721
|
+
zoomOnScroll: !1
|
|
8720
8722
|
})
|
|
8721
8723
|
})
|
|
8722
8724
|
});
|
|
@@ -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