geonodes-web-render 0.2.0 → 0.3.1

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.
@@ -6,7 +6,12 @@ export type GraphViewEmbedOptions = {
6
6
  };
7
7
  export declare function GraphView(props: GraphViewEmbedOptions): import("react").JSX.Element;
8
8
  /**
9
- * Mount the graph view into a DOM container. Call unmountGraphView() to remove.
9
+ * Mount the graph view into a DOM container. Returns a function that unmounts
10
+ * this graph; you can also call unmountGraphView(container).
10
11
  */
11
12
  export declare function mountGraphView(container: HTMLElement, options: GraphViewEmbedOptions): () => void;
12
- export declare function unmountGraphView(): void;
13
+ /**
14
+ * Unmount a previously mounted graph. With no argument, unmounts the most
15
+ * recently mounted one (kept for backwards compatibility).
16
+ */
17
+ export declare function unmountGraphView(container?: HTMLElement): void;
@@ -2,4 +2,6 @@ export declare function GeometryNodesFlow(props: {
2
2
  jsonText: string;
3
3
  /** When false, hide the panel header ("Geometry Nodes Graph" and node count). Default true. */
4
4
  showHeader?: boolean;
5
+ /** Reports the currently selected node ids (raw Tree Clipper node ids as strings). */
6
+ onSelectionChange?: (nodeIds: string[]) => void;
5
7
  }): import("react").JSX.Element;
@@ -1,3 +1,21 @@
1
+ type SpecParam = {
2
+ name: string;
3
+ default: string | null;
4
+ };
5
+ export type SpecSocket = {
6
+ attr: string;
7
+ type: string;
8
+ label: string;
9
+ };
10
+ export type SpecEntry = {
11
+ class: string;
12
+ params: SpecParam[];
13
+ props: SpecParam[];
14
+ inputs: SpecSocket[];
15
+ outputs: SpecSocket[];
16
+ };
17
+ export type SpecDb = Record<string, Record<string, SpecEntry>>;
18
+ export declare function getNodebpySpec(): SpecDb;
1
19
  type RawSocket = {
2
20
  id: number;
3
21
  data: {
@@ -79,5 +97,12 @@ type RawTree = {
79
97
  type RawExport = {
80
98
  node_trees: RawTree[];
81
99
  };
100
+ /**
101
+ * Reduce a Tree Clipper export to a subset of nodes (by raw node id), keeping
102
+ * only links whose two endpoints both survive. Group trees instantiated by a
103
+ * surviving group node are kept complete (transitively); trees left with no
104
+ * nodes are dropped. Returns the input unchanged when nothing matches.
105
+ */
106
+ export declare function filterExportToSelection(raw: RawExport, selected: ReadonlySet<number>): RawExport;
82
107
  export declare function exportToNodebpy(raw: RawExport): string;
83
108
  export {};
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Pretty-print a Tree Clipper export so that each repeated entity (a node tree,
3
+ * an interface socket, a node, a link) lands on its own line, while every
4
+ * structural wrapper around those entity lists stays collapsed inline.
5
+ *
6
+ * Only the entity arrays break across lines; the `{"id": …, "data": {… "items": [`
7
+ * prefix and the trailing `]}}` suffix each stay on a single line. The result:
8
+ * the number of lines in an entity list equals the number of entities, so
9
+ * selecting one more node on the canvas adds exactly one visible line.
10
+ *
11
+ * Entity lines can get very long; the editor scrolls horizontally rather than
12
+ * wrapping them, so they stay one-per-row on screen.
13
+ */
14
+ export declare function formatTreeClipperJson(value: unknown): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geonodes-web-render",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "Browser-based viewer for Blender Geometry Nodes exported via Tree Clipper. Renders node trees as a read-only, Blender-styled graph.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -37,6 +37,7 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@codemirror/lang-json": "^6.0.2",
40
+ "@codemirror/lang-python": "^6.2.1",
40
41
  "@codemirror/state": "^6.6.0",
41
42
  "@codemirror/theme-one-dark": "^6.1.3",
42
43
  "@codemirror/view": "^6.40.0",