geonodes-web-render 0.1.3 → 0.2.0

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.
@@ -4,7 +4,7 @@ export type GraphViewEmbedOptions = {
4
4
  /** Called when user requests close (e.g. modal close button). Use to unmount. */
5
5
  onClose?: () => void;
6
6
  };
7
- export declare function GraphView(props: GraphViewEmbedOptions): import("react/jsx-runtime").JSX.Element;
7
+ export declare function GraphView(props: GraphViewEmbedOptions): import("react").JSX.Element;
8
8
  /**
9
9
  * Mount the graph view into a DOM container. Call unmountGraphView() to remove.
10
10
  */
@@ -1,2 +1,2 @@
1
1
  import { NodeProps } from '@xyflow/react';
2
- export declare function GenericGNNode(props: NodeProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function GenericGNNode(props: NodeProps): import("react").JSX.Element;
@@ -2,4 +2,4 @@ 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
- }): import("react/jsx-runtime").JSX.Element;
5
+ }): import("react").JSX.Element;
@@ -1,2 +1,2 @@
1
1
  import { NodeProps } from '@xyflow/react';
2
- export declare function RerouteNode(props: NodeProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function RerouteNode(props: NodeProps): import("react").JSX.Element;
@@ -1,2 +1,2 @@
1
1
  import { NodeProps } from '@xyflow/react';
2
- export declare function SimulationZoneFrame(props: NodeProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function SimulationZoneFrame(props: NodeProps): import("react").JSX.Element;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Lets group nodes ask the surrounding flow to drill into their nested tree.
3
+ * Null outside a provider, so group nodes degrade to a plain name display.
4
+ */
5
+ export declare const GroupNavContext: import('react').Context<{
6
+ openGroup: (treeId: string) => void;
7
+ } | null>;
8
+ export declare function useGroupNav(): {
9
+ openGroup: (treeId: string) => void;
10
+ } | null;
@@ -0,0 +1,83 @@
1
+ type RawSocket = {
2
+ id: number;
3
+ data: {
4
+ name: string;
5
+ type: string;
6
+ enabled?: boolean;
7
+ hide_value?: boolean;
8
+ default_value?: unknown;
9
+ };
10
+ };
11
+ type RawNodeData = {
12
+ name: string;
13
+ label?: string;
14
+ bl_idname: string;
15
+ inputs?: {
16
+ data: {
17
+ items: RawSocket[];
18
+ };
19
+ };
20
+ outputs?: {
21
+ data: {
22
+ items: RawSocket[];
23
+ };
24
+ };
25
+ node_tree?: number | null;
26
+ single_input?: number;
27
+ single_output?: number;
28
+ is_active_output?: boolean;
29
+ mapping?: unknown;
30
+ } & Record<string, unknown>;
31
+ type RawNode = {
32
+ id: number;
33
+ data: RawNodeData;
34
+ };
35
+ type RawInterfaceItem = {
36
+ id: number;
37
+ data: {
38
+ name: string;
39
+ socket_type?: string;
40
+ in_out?: string;
41
+ item_type?: string;
42
+ default_value?: unknown;
43
+ };
44
+ };
45
+ type RawLink = {
46
+ id: number;
47
+ data: {
48
+ from_socket: number;
49
+ to_socket: number;
50
+ };
51
+ };
52
+ type RawTree = {
53
+ id: number;
54
+ data: {
55
+ name: string;
56
+ bl_idname?: string;
57
+ is_modifier?: boolean;
58
+ interface?: {
59
+ data: {
60
+ items_tree: {
61
+ data: {
62
+ items: RawInterfaceItem[];
63
+ };
64
+ };
65
+ };
66
+ };
67
+ nodes: {
68
+ data: {
69
+ items: RawNode[];
70
+ };
71
+ };
72
+ links: {
73
+ data: {
74
+ items: RawLink[];
75
+ };
76
+ };
77
+ };
78
+ };
79
+ type RawExport = {
80
+ node_trees: RawTree[];
81
+ };
82
+ export declare function exportToNodebpy(raw: RawExport): string;
83
+ export {};
@@ -33,6 +33,7 @@ type BlenderNode = {
33
33
  single_input?: number;
34
34
  single_output?: number;
35
35
  vector?: number[];
36
+ node_tree?: number | null;
36
37
  mode?: string;
37
38
  operation?: string;
38
39
  data_type?: string;
@@ -74,23 +75,25 @@ type BlenderLink = {
74
75
  to_socket: number;
75
76
  };
76
77
  };
77
- export type BlenderTreeExport = {
78
- node_trees: Array<{
79
- id: number;
80
- data: {
81
- name: string;
82
- nodes: {
83
- data: {
84
- items: BlenderNode[];
85
- };
78
+ type BlenderTree = {
79
+ id: number;
80
+ data: {
81
+ name: string;
82
+ is_modifier?: boolean;
83
+ nodes: {
84
+ data: {
85
+ items: BlenderNode[];
86
86
  };
87
- links: {
88
- data: {
89
- items: BlenderLink[];
90
- };
87
+ };
88
+ links: {
89
+ data: {
90
+ items: BlenderLink[];
91
91
  };
92
92
  };
93
- }>;
93
+ };
94
+ };
95
+ export type BlenderTreeExport = {
96
+ node_trees: BlenderTree[];
94
97
  };
95
98
  export type NormalizedSocket = {
96
99
  id: string;
@@ -117,6 +120,9 @@ export type NormalizedNode = {
117
120
  outputs: NormalizedSocket[];
118
121
  floatCurve?: FloatCurveData;
119
122
  properties?: Record<string, string>;
123
+ /** For group nodes: id/name of the referenced node tree (if present in the export). */
124
+ groupTreeId?: string;
125
+ groupTreeName?: string;
120
126
  };
121
127
  export type NormalizedLink = {
122
128
  id: string;
@@ -129,6 +135,13 @@ export type NormalizedGraph = {
129
135
  nodes: NormalizedNode[];
130
136
  links: NormalizedLink[];
131
137
  };
138
+ export type NormalizedExport = {
139
+ /** Id of the top-level tree (the one not referenced by any group node). */
140
+ rootId: string;
141
+ /** All trees in the export, keyed by tree id. */
142
+ trees: Record<string, NormalizedGraph>;
143
+ };
144
+ export declare function normalizeBlenderExport(raw: BlenderTreeExport): NormalizedExport;
132
145
  export declare function normalizeBlenderGraph(raw: BlenderTreeExport): NormalizedGraph;
133
146
  export declare function toGraphIR(normalized: NormalizedGraph): GraphIR;
134
147
  export {};
@@ -47,6 +47,9 @@ export type NodeIR = {
47
47
  floatCurve?: FloatCurveData;
48
48
  /** Node-type-specific enum properties (e.g. operation, data_type for Compare) */
49
49
  properties?: Record<string, string>;
50
+ /** For group nodes: id/name of the referenced node tree within the export */
51
+ groupTreeId?: string;
52
+ groupTreeName?: string;
50
53
  };
51
54
  export type EdgeIR = {
52
55
  id: string;
@@ -10,6 +10,8 @@ export type GNFlowNodeData = {
10
10
  connectedInputIds: string[];
11
11
  floatCurve?: FloatCurveData;
12
12
  properties?: Record<string, string>;
13
+ groupTreeId?: string;
14
+ groupTreeName?: string;
13
15
  };
14
16
  export type GNRerouteNodeData = {
15
17
  color: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geonodes-web-render",
3
- "version": "0.1.3",
3
+ "version": "0.2.0",
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": {
@@ -15,7 +15,7 @@
15
15
  ],
16
16
  "repository": {
17
17
  "type": "git",
18
- "url": "https://github.com/kolibril13/geonodes-web-render"
18
+ "url": "git+https://github.com/kolibril13/geonodes-web-render.git"
19
19
  },
20
20
  "license": "MIT",
21
21
  "keywords": [
@@ -32,6 +32,7 @@
32
32
  "build:lib": "vite build --config vite.lib.config.ts",
33
33
  "lint": "eslint .",
34
34
  "preview": "vite preview",
35
+ "convert:nodebpy": "rolldown scripts/convertExamples.ts --format esm --file node_modules/.tmp/convertExamples.mjs --external node:fs --external node:path && node node_modules/.tmp/convertExamples.mjs",
35
36
  "prepublishOnly": "npm run build:lib"
36
37
  },
37
38
  "dependencies": {
@@ -40,7 +41,7 @@
40
41
  "@codemirror/theme-one-dark": "^6.1.3",
41
42
  "@codemirror/view": "^6.40.0",
42
43
  "@uiw/react-codemirror": "^4.25.8",
43
- "@xyflow/react": "^12.10.1",
44
+ "@xyflow/react": "^12.11.0",
44
45
  "react": "^18.0.0 || ^19.0.0",
45
46
  "react-dom": "^18.0.0 || ^19.0.0"
46
47
  },