geonodes-web-render 0.3.0 → 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 +123 -102
- package/dist/types/gn/components/GeometryNodesFlow.d.ts +3 -0
- package/package.json +1 -1
package/dist/embed.js
CHANGED
|
@@ -8495,92 +8495,111 @@ 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:
|
|
8499
|
-
|
|
8500
|
-
|
|
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
|
+
c(() => {
|
|
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
|
-
|
|
8510
|
-
|
|
8511
|
-
|
|
8512
|
-
|
|
8513
|
-
|
|
8514
|
-
|
|
8515
|
-
|
|
8516
|
-
|
|
8517
|
-
|
|
8518
|
-
|
|
8519
|
-
|
|
8520
|
-
|
|
8521
|
-
|
|
8522
|
-
|
|
8523
|
-
|
|
8524
|
-
|
|
8525
|
-
|
|
8526
|
-
|
|
8527
|
-
|
|
8528
|
-
|
|
8529
|
-
|
|
8530
|
-
|
|
8531
|
-
|
|
8532
|
-
|
|
8533
|
-
|
|
8534
|
-
|
|
8535
|
-
|
|
8536
|
-
|
|
8537
|
-
|
|
8538
|
-
|
|
8539
|
-
|
|
8540
|
-
|
|
8541
|
-
|
|
8542
|
-
|
|
8543
|
-
|
|
8544
|
-
|
|
8545
|
-
|
|
8546
|
-
|
|
8547
|
-
|
|
8548
|
-
|
|
8549
|
-
|
|
8550
|
-
|
|
8551
|
-
|
|
8552
|
-
|
|
8553
|
-
|
|
8554
|
-
|
|
8555
|
-
|
|
8556
|
-
|
|
8557
|
-
|
|
8558
|
-
|
|
8559
|
-
|
|
8560
|
-
|
|
8561
|
-
|
|
8562
|
-
|
|
8507
|
+
y(n);
|
|
8508
|
+
}, [n, y]), c(() => {
|
|
8509
|
+
let e = u.current;
|
|
8510
|
+
if (!e) return;
|
|
8511
|
+
let t = new ResizeObserver(() => {
|
|
8512
|
+
f.current || l(qf);
|
|
8513
|
+
});
|
|
8514
|
+
return t.observe(e), () => t.disconnect();
|
|
8515
|
+
}, [l]);
|
|
8516
|
+
let x = a((e) => {
|
|
8517
|
+
e && (f.current = !0);
|
|
8518
|
+
}, []);
|
|
8519
|
+
return /* @__PURE__ */ g("div", {
|
|
8520
|
+
ref: u,
|
|
8521
|
+
style: {
|
|
8522
|
+
width: "100%",
|
|
8523
|
+
height: "100%"
|
|
8524
|
+
},
|
|
8525
|
+
children: /* @__PURE__ */ _(dd, {
|
|
8526
|
+
nodes: p,
|
|
8527
|
+
edges: v,
|
|
8528
|
+
onNodesChange: h,
|
|
8529
|
+
onEdgesChange: b,
|
|
8530
|
+
onSelectionChange: a(({ nodes: e }) => {
|
|
8531
|
+
o?.(e.map((e) => e.id));
|
|
8532
|
+
}, [o]),
|
|
8533
|
+
onMoveStart: x,
|
|
8534
|
+
nodeTypes: Kf,
|
|
8535
|
+
fitView: !0,
|
|
8536
|
+
fitViewOptions: qf,
|
|
8537
|
+
minZoom: .2,
|
|
8538
|
+
nodesDraggable: !1,
|
|
8539
|
+
nodesConnectable: !1,
|
|
8540
|
+
elementsSelectable: !0,
|
|
8541
|
+
nodesFocusable: !1,
|
|
8542
|
+
edgesFocusable: !1,
|
|
8543
|
+
selectNodesOnDrag: !1,
|
|
8544
|
+
selectionOnDrag: !0,
|
|
8545
|
+
selectionMode: va.Partial,
|
|
8546
|
+
connectOnClick: !1,
|
|
8547
|
+
panOnDrag: [1, 2],
|
|
8548
|
+
panOnScroll: !1,
|
|
8549
|
+
zoomOnScroll: s,
|
|
8550
|
+
zoomOnDoubleClick: !1,
|
|
8551
|
+
children: [
|
|
8552
|
+
/* @__PURE__ */ g(bd, {
|
|
8553
|
+
gap: 20,
|
|
8554
|
+
size: 1
|
|
8555
|
+
}),
|
|
8556
|
+
/* @__PURE__ */ g(kd, { showInteractive: !1 }),
|
|
8557
|
+
r.length > 1 ? /* @__PURE__ */ g(Sc, {
|
|
8558
|
+
position: "top-left",
|
|
8559
|
+
children: /* @__PURE__ */ g("nav", {
|
|
8560
|
+
className: "gn-breadcrumbs",
|
|
8561
|
+
"aria-label": "Node group path",
|
|
8562
|
+
children: r.map((e, t) => {
|
|
8563
|
+
let n = t === r.length - 1;
|
|
8564
|
+
return /* @__PURE__ */ _("span", {
|
|
8565
|
+
className: "gn-breadcrumbs__item",
|
|
8566
|
+
children: [t > 0 ? /* @__PURE__ */ g("span", {
|
|
8567
|
+
className: "gn-breadcrumbs__sep",
|
|
8568
|
+
"aria-hidden": "true",
|
|
8569
|
+
children: "›"
|
|
8570
|
+
}) : null, n ? /* @__PURE__ */ g("span", {
|
|
8571
|
+
className: "gn-breadcrumbs__current",
|
|
8572
|
+
"aria-current": "page",
|
|
8573
|
+
children: e.label
|
|
8574
|
+
}) : /* @__PURE__ */ g("button", {
|
|
8575
|
+
type: "button",
|
|
8576
|
+
className: "gn-breadcrumbs__link",
|
|
8577
|
+
onClick: () => i(t),
|
|
8578
|
+
children: e.label
|
|
8579
|
+
})]
|
|
8580
|
+
}, `${e.id}-${t}`);
|
|
8581
|
+
})
|
|
8582
|
+
})
|
|
8583
|
+
}) : null,
|
|
8584
|
+
/* @__PURE__ */ g(Sc, {
|
|
8585
|
+
position: "bottom-right",
|
|
8586
|
+
children: /* @__PURE__ */ g("a", {
|
|
8587
|
+
href: "https://extensions.blender.org/add-ons/tree-clipper/",
|
|
8588
|
+
target: "_blank",
|
|
8589
|
+
rel: "noopener noreferrer",
|
|
8590
|
+
className: "tree-clipper-badge",
|
|
8591
|
+
children: "Exported from Blender using Tree Clipper ↗"
|
|
8563
8592
|
})
|
|
8564
8593
|
})
|
|
8565
|
-
|
|
8566
|
-
|
|
8567
|
-
position: "bottom-right",
|
|
8568
|
-
children: /* @__PURE__ */ g("a", {
|
|
8569
|
-
href: "https://extensions.blender.org/add-ons/tree-clipper/",
|
|
8570
|
-
target: "_blank",
|
|
8571
|
-
rel: "noopener noreferrer",
|
|
8572
|
-
className: "tree-clipper-badge",
|
|
8573
|
-
children: "Exported from Blender using Tree Clipper ↗"
|
|
8574
|
-
})
|
|
8575
|
-
})
|
|
8576
|
-
]
|
|
8594
|
+
]
|
|
8595
|
+
})
|
|
8577
8596
|
});
|
|
8578
8597
|
}
|
|
8579
8598
|
function Yf(e) {
|
|
8580
|
-
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({
|
|
8581
8600
|
json: t,
|
|
8582
8601
|
ids: []
|
|
8583
|
-
}),
|
|
8602
|
+
}), l = u(() => {
|
|
8584
8603
|
if (!t.trim()) return null;
|
|
8585
8604
|
try {
|
|
8586
8605
|
let { rootId: e, trees: n } = ff(JSON.parse(t)), r = {};
|
|
@@ -8603,36 +8622,36 @@ function Yf(e) {
|
|
|
8603
8622
|
error: e instanceof Error ? e.message : String(e)
|
|
8604
8623
|
};
|
|
8605
8624
|
}
|
|
8606
|
-
}, [t]),
|
|
8607
|
-
if (!
|
|
8608
|
-
let e =
|
|
8609
|
-
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);
|
|
8610
8629
|
return n;
|
|
8611
8630
|
}, [
|
|
8612
|
-
|
|
8613
|
-
|
|
8631
|
+
l,
|
|
8632
|
+
o,
|
|
8614
8633
|
t
|
|
8615
|
-
]),
|
|
8616
|
-
|
|
8634
|
+
]), p = l?.views ? l.views[d[d.length - 1]] : null, m = a((e) => {
|
|
8635
|
+
s((n) => ({
|
|
8617
8636
|
json: t,
|
|
8618
8637
|
ids: n.json === t ? [...n.ids, e] : [e]
|
|
8619
8638
|
}));
|
|
8620
|
-
}, [t]),
|
|
8639
|
+
}, [t]), h = u(() => ({ openGroup: m }), [m]);
|
|
8621
8640
|
c(() => {
|
|
8622
|
-
if (
|
|
8641
|
+
if (d.length <= 1) return;
|
|
8623
8642
|
function e(e) {
|
|
8624
8643
|
if (e.key !== "Tab" && e.key !== "Escape" || e.ctrlKey || e.metaKey || e.altKey) return;
|
|
8625
8644
|
let n = e.target;
|
|
8626
|
-
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({
|
|
8627
8646
|
json: t,
|
|
8628
|
-
ids:
|
|
8647
|
+
ids: d.slice(1, -1)
|
|
8629
8648
|
}));
|
|
8630
8649
|
}
|
|
8631
8650
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
8632
|
-
}, [
|
|
8633
|
-
let
|
|
8651
|
+
}, [d, t]);
|
|
8652
|
+
let v = l?.views ? d.map((e) => ({
|
|
8634
8653
|
id: e,
|
|
8635
|
-
label:
|
|
8654
|
+
label: l.views[e].graph.label
|
|
8636
8655
|
})) : [];
|
|
8637
8656
|
return /* @__PURE__ */ _("div", {
|
|
8638
8657
|
className: "panel flow-panel",
|
|
@@ -8644,25 +8663,26 @@ function Yf(e) {
|
|
|
8644
8663
|
}), /* @__PURE__ */ g("div", {
|
|
8645
8664
|
className: "panel-status",
|
|
8646
8665
|
"aria-live": "polite",
|
|
8647
|
-
children:
|
|
8666
|
+
children: p ? `${p.graph.nodes.length} nodes, ${p.graph.edges.length} links` : null
|
|
8648
8667
|
})]
|
|
8649
8668
|
}) : null, /* @__PURE__ */ g("div", {
|
|
8650
8669
|
className: "panel-body flow-panel__body",
|
|
8651
|
-
children:
|
|
8670
|
+
children: l?.error ? /* @__PURE__ */ _("div", {
|
|
8652
8671
|
className: "flow-error",
|
|
8653
8672
|
role: "alert",
|
|
8654
|
-
children: [/* @__PURE__ */ g("strong", { children: "Parse error" }), /* @__PURE__ */ g("span", { children:
|
|
8655
|
-
}) :
|
|
8656
|
-
value:
|
|
8673
|
+
children: [/* @__PURE__ */ g("strong", { children: "Parse error" }), /* @__PURE__ */ g("span", { children: l.error })]
|
|
8674
|
+
}) : p ? /* @__PURE__ */ g(Cf.Provider, {
|
|
8675
|
+
value: h,
|
|
8657
8676
|
children: /* @__PURE__ */ g(sd, { children: /* @__PURE__ */ g(Jf, {
|
|
8658
|
-
nodes:
|
|
8659
|
-
edges:
|
|
8660
|
-
breadcrumbs:
|
|
8661
|
-
onNavigate: (e) =>
|
|
8677
|
+
nodes: p.flow.nodes,
|
|
8678
|
+
edges: p.flow.edges,
|
|
8679
|
+
breadcrumbs: v,
|
|
8680
|
+
onNavigate: (e) => s({
|
|
8662
8681
|
json: t,
|
|
8663
|
-
ids:
|
|
8682
|
+
ids: d.slice(1, e + 1)
|
|
8664
8683
|
}),
|
|
8665
|
-
onSelectionIds: r
|
|
8684
|
+
onSelectionIds: r,
|
|
8685
|
+
zoomOnScroll: i
|
|
8666
8686
|
}) })
|
|
8667
8687
|
}) : /* @__PURE__ */ g("div", {
|
|
8668
8688
|
className: "flow-empty",
|
|
@@ -8697,7 +8717,8 @@ function Xf(e) {
|
|
|
8697
8717
|
children: [/* @__PURE__ */ g("strong", { children: "Decode error" }), /* @__PURE__ */ g("span", { children: i })]
|
|
8698
8718
|
}) : /* @__PURE__ */ g(Yf, {
|
|
8699
8719
|
jsonText: n,
|
|
8700
|
-
showHeader: !1
|
|
8720
|
+
showHeader: !1,
|
|
8721
|
+
zoomOnScroll: !1
|
|
8701
8722
|
})
|
|
8702
8723
|
})
|
|
8703
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