@theclearsky/react-blender-nodes 0.0.6 → 0.0.7

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/index.d.ts CHANGED
@@ -3,6 +3,7 @@ import { ClassProp } from 'class-variance-authority/types';
3
3
  import { ClassValue } from 'clsx';
4
4
  import { ComponentProps } from 'react';
5
5
  import { Connection } from '@xyflow/react';
6
+ import { Context } from 'react';
6
7
  import { ControlLinePosition } from '@xyflow/react';
7
8
  import { ControlPosition } from '@xyflow/react';
8
9
  import { Edge } from '@xyflow/react';
@@ -10,7 +11,9 @@ import { EdgeChange } from '@xyflow/react';
10
11
  import { EdgeLabelOptions } from '@xyflow/react';
11
12
  import { EdgePosition } from '@xyflow/system';
12
13
  import { EdgeProps } from '@xyflow/react';
14
+ import { FC } from 'react';
13
15
  import { ForwardRefExoticComponent } from 'react';
16
+ import { HandleShape as HandleShape_2 } from '../..';
14
17
  import { HandleType } from '@xyflow/react';
15
18
  import { HTMLAttributes } from 'react';
16
19
  import { JSX } from 'react/jsx-runtime';
@@ -23,7 +26,10 @@ import { ReactNode } from 'react';
23
26
  import { RefAttributes } from 'react';
24
27
  import { RefObject } from 'react';
25
28
  import { ResizeControlDirection } from '@xyflow/system';
29
+ import * as SelectPrimitive from '@radix-ui/react-select';
30
+ import { TypeOfNode as TypeOfNode_2 } from './types';
26
31
  import { VariantProps } from 'class-variance-authority';
32
+ import { Viewport } from '@xyflow/react';
27
33
  import { XYPosition } from '@xyflow/react';
28
34
  import { z } from 'zod';
29
35
 
@@ -85,6 +91,29 @@ export declare type Action<DataTypeUniqueId extends string = string, NodeTypeUni
85
91
  /** New value for the input */
86
92
  value: string | number;
87
93
  };
94
+ } | {
95
+ /** Open a node group and push it onto the openedNodeGroupStack */
96
+ type: typeof actionTypesMap.OPEN_NODE_GROUP;
97
+ payload: {
98
+ /** ID of the node to open */
99
+ nodeId: string;
100
+ } | {
101
+ /** Type of node to open */
102
+ nodeType: NodeTypeUniqueId;
103
+ };
104
+ } | {
105
+ /** Close a node group and pop it from the openedNodeGroupStack */
106
+ type: typeof actionTypesMap.CLOSE_NODE_GROUP;
107
+ } | {
108
+ /** Add a new node group to the graph */
109
+ type: typeof actionTypesMap.ADD_NODE_GROUP;
110
+ } | {
111
+ /** Set the viewport of the graph */
112
+ type: typeof actionTypesMap.SET_VIEWPORT;
113
+ payload: {
114
+ /** Current viewport of the graph */
115
+ viewport: Viewport;
116
+ };
88
117
  };
89
118
 
90
119
  /** Map of action types for type-safe action dispatching */
@@ -95,8 +124,14 @@ export declare const actionTypesMap: {
95
124
  readonly UPDATE_EDGES_BY_REACT_FLOW: "UPDATE_EDGES_BY_REACT_FLOW";
96
125
  readonly ADD_EDGE_BY_REACT_FLOW: "ADD_EDGE_BY_REACT_FLOW";
97
126
  readonly UPDATE_INPUT_VALUE: "UPDATE_INPUT_VALUE";
127
+ readonly OPEN_NODE_GROUP: "OPEN_NODE_GROUP";
128
+ readonly CLOSE_NODE_GROUP: "CLOSE_NODE_GROUP";
129
+ readonly ADD_NODE_GROUP: "ADD_NODE_GROUP";
130
+ readonly SET_VIEWPORT: "SET_VIEWPORT";
98
131
  };
99
132
 
133
+ export declare function addAnInputOrOutputToAllNodesOfANodeTypeAcrossStateIncludingSubtrees<DataTypeUniqueId extends string = string, NodeTypeUniqueId extends string = string, UnderlyingType extends SupportedUnderlyingTypes = SupportedUnderlyingTypes, ComplexSchemaType extends UnderlyingType extends 'complex' ? z.ZodType : never = never>(state: State<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>, nodeType: NodeTypeUniqueId, typeOfInputOrOutput: TypeOfInput<DataTypeUniqueId>, addAtIndex: HandleIndices, beforeOrAfterIndex?: 'before' | 'after'): Pick<State<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>, 'typeOfNodes' | 'nodes' | 'edges'>;
134
+
100
135
  /**
101
136
  * Adds a new edge between two handles with type checking and inference
102
137
  *
@@ -120,9 +155,7 @@ export declare const actionTypesMap: {
120
155
  * @param enableComplexTypeChecking - Whether to enable complex type checking
121
156
  * @returns Object containing updated nodes, edges, and validation result
122
157
  */
123
- export declare function addEdgeWithTypeChecking<DataTypeUniqueId extends string = string, NodeTypeUniqueId extends string = string, UnderlyingType extends SupportedUnderlyingTypes = SupportedUnderlyingTypes, ComplexSchemaType extends UnderlyingType extends 'complex' ? z.ZodType : never = never>(newEdgeSourceNodeId: string, newEdgeSourceHandleId: string, newEdgeTargetNodeId: string, newEdgeTargetHandleId: string, state: State<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>): {
124
- updatedNodes: Nodes<UnderlyingType, NodeTypeUniqueId, ComplexSchemaType, DataTypeUniqueId>;
125
- updatedEdges: Edges;
158
+ export declare function addEdgeWithTypeChecking<DataTypeUniqueId extends string = string, NodeTypeUniqueId extends string = string, UnderlyingType extends SupportedUnderlyingTypes = SupportedUnderlyingTypes, ComplexSchemaType extends UnderlyingType extends 'complex' ? z.ZodType : never = never>(newEdgeSourceNodeId: string, newEdgeSourceHandleId: string, newEdgeTargetNodeId: string, newEdgeTargetHandleId: string, state: State<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>, groupInputNodeId: string | undefined, groupOutputNodeId: string | undefined, unmodifiedState: State<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>): {
126
159
  validation: ConnectionValidationResult;
127
160
  };
128
161
 
@@ -377,6 +410,12 @@ isCurrentlyInsideReactFlow?: boolean;
377
410
  nodeResizerProps?: NodeResizerWithMoreControlsProps;
378
411
  /** Node type unique id */
379
412
  nodeTypeUniqueId?: string | undefined;
413
+ /**
414
+ * Whether to show the node open button (square mouse pointer icon)
415
+ * - Used by full graph for node groups
416
+ * @default false
417
+ */
418
+ showNodeOpenButton?: boolean;
380
419
  } & HTMLAttributes<HTMLDivElement> & RefAttributes<HTMLDivElement>>;
381
420
 
382
421
  /**
@@ -489,6 +528,12 @@ export declare type ConfigurableNodeProps<UnderlyingType extends SupportedUnderl
489
528
  nodeResizerProps?: NodeResizerWithMoreControlsProps;
490
529
  /** Node type unique id */
491
530
  nodeTypeUniqueId?: NodeTypeUniqueId;
531
+ /**
532
+ * Whether to show the node open button (square mouse pointer icon)
533
+ * - Used by full graph for node groups
534
+ * @default false
535
+ */
536
+ showNodeOpenButton?: boolean;
492
537
  } & HTMLAttributes<HTMLDivElement>;
493
538
 
494
539
  /**
@@ -590,7 +635,7 @@ declare type ConnectionValidationResult = {
590
635
  * );
591
636
  * ```
592
637
  */
593
- export declare function constructInputOrOutputOfType<DataTypeUniqueId extends string = string, NodeTypeUniqueId extends string = string, UnderlyingType extends SupportedUnderlyingTypes = SupportedUnderlyingTypes, ComplexSchemaType extends UnderlyingType extends 'complex' ? z.ZodType : never = never>(typeOfDataTypeInNode: TypeOfInput<DataTypeUniqueId> | TypeOfNode<DataTypeUniqueId>['outputs'][number], allDataTypes: State<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>['dataTypes']): ConfigurableNodeInput<UnderlyingType, ComplexSchemaType, DataTypeUniqueId> | ConfigurableNodeOutput<UnderlyingType, ComplexSchemaType, DataTypeUniqueId>;
638
+ export declare function constructInputOrOutputOfType<DataTypeUniqueId extends string = string, NodeTypeUniqueId extends string = string, UnderlyingType extends SupportedUnderlyingTypes = SupportedUnderlyingTypes, ComplexSchemaType extends UnderlyingType extends 'complex' ? z.ZodType : never = never>(typeOfDataTypeInNode: TypeOfInput<DataTypeUniqueId> | TypeOfNode<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>['outputs'][number], allDataTypes: State<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>['dataTypes']): ConfigurableNodeInput<UnderlyingType, ComplexSchemaType, DataTypeUniqueId> | ConfigurableNodeOutput<UnderlyingType, ComplexSchemaType, DataTypeUniqueId>;
594
639
 
595
640
  /**
596
641
  * Constructs a ConfigurableNodeInputPanel from a type definition
@@ -843,6 +888,45 @@ export declare type ContextAwareInputProps = {
843
888
  isCurrentlyInsideReactFlow: boolean;
844
889
  };
845
890
 
891
+ /**
892
+ * Context-aware open button component that handles both ReactFlow and standalone contexts
893
+ *
894
+ * This component intelligently renders either a ReactFlow-aware button (for ReactFlow context)
895
+ * or a simple button (for standalone usage) based on the context.
896
+ *
897
+ * Features:
898
+ * - Automatically detects ReactFlow context
899
+ * - Renders appropriate button based on context
900
+ * - Integrates with FullGraph's dispatch system
901
+ * - Supports conditional rendering
902
+ *
903
+ * @param props - The component props
904
+ * @returns JSX element containing the appropriate open button
905
+ *
906
+ * @example
907
+ * ```tsx
908
+ * <ContextAwareOpenButton
909
+ * nodeId="node-123"
910
+ * showButton={true}
911
+ * isCurrentlyInsideReactFlow={true}
912
+ * />
913
+ * ```
914
+ */
915
+ export declare const ContextAwareOpenButton: ({ showButton, isCurrentlyInsideReactFlow, }: ContextAwareOpenButtonProps) => JSX.Element;
916
+
917
+ /**
918
+ * Props for the ContextAwareOpenButton component
919
+ */
920
+ export declare type ContextAwareOpenButtonProps = {
921
+ /**
922
+ * Whether the button should be shown
923
+ * @default false
924
+ */
925
+ showButton?: boolean;
926
+ /** Whether the component is currently inside a ReactFlow context */
927
+ isCurrentlyInsideReactFlow: boolean;
928
+ };
929
+
846
930
  /**
847
931
  * A context menu component with nested submenu support
848
932
  *
@@ -978,7 +1062,7 @@ export declare type Coordinate = {
978
1062
  * @param contextMenuPosition - The position where the context menu was opened
979
1063
  * @returns ContextMenuItem array for the context menu
980
1064
  */
981
- export declare function createNodeContextMenu<DataTypeUniqueId extends string = string, NodeTypeUniqueId extends string = string, UnderlyingType extends SupportedUnderlyingTypes = SupportedUnderlyingTypes, ComplexSchemaType extends UnderlyingType extends 'complex' ? z.ZodType : never = never>({ typeOfNodes, dispatch, setContextMenu, contextMenuPosition, }: CreateNodeContextMenuProps<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>): ContextMenuItem[];
1065
+ export declare function createNodeContextMenu<DataTypeUniqueId extends string = string, NodeTypeUniqueId extends string = string, UnderlyingType extends SupportedUnderlyingTypes = SupportedUnderlyingTypes, ComplexSchemaType extends UnderlyingType extends 'complex' ? z.ZodType : never = never>({ typeOfNodes, dispatch, setContextMenu, contextMenuPosition, isRecursionAllowed, currentNodeType, }: CreateNodeContextMenuProps<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>): ContextMenuItem[];
982
1066
 
983
1067
  export declare type CreateNodeContextMenuProps<DataTypeUniqueId extends string = string, NodeTypeUniqueId extends string = string, UnderlyingType extends SupportedUnderlyingTypes = SupportedUnderlyingTypes, ComplexSchemaType extends UnderlyingType extends 'complex' ? any : never = never> = {
984
1068
  typeOfNodes: State<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>['typeOfNodes'];
@@ -990,6 +1074,16 @@ export declare type CreateNodeContextMenuProps<DataTypeUniqueId extends string =
990
1074
  position: XYPosition;
991
1075
  }) => void;
992
1076
  contextMenuPosition: XYPosition;
1077
+ /**
1078
+ * Whether to allow recursion
1079
+ * - If not provided, is considered true
1080
+ * - When true, the recursion is checked, and nesting of node groups is not allowed if it creates a recursion
1081
+ * - When false, the recursion is not checked, and all nesting of node groups is allowed
1082
+ *
1083
+ * @default true
1084
+ */
1085
+ isRecursionAllowed?: boolean;
1086
+ currentNodeType?: NodeTypeUniqueId;
993
1087
  };
994
1088
 
995
1089
  /**
@@ -1124,6 +1218,10 @@ export declare type Edges = ConfigurableEdgeState[];
1124
1218
  */
1125
1219
  export declare function FullGraph<DataTypeUniqueId extends string = string, NodeTypeUniqueId extends string = string, UnderlyingType extends SupportedUnderlyingTypes = SupportedUnderlyingTypes, ComplexSchemaType extends UnderlyingType extends 'complex' ? z.ZodType : never = never>({ state, dispatch, }: FullGraphProps<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>): JSX.Element;
1126
1220
 
1221
+ export declare const FullGraphContext: Context< {
1222
+ allProps: FullGraphProps;
1223
+ }>;
1224
+
1127
1225
  /**
1128
1226
  * Props for the FullGraph component
1129
1227
  *
@@ -1141,6 +1239,62 @@ export declare type FullGraphProps<DataTypeUniqueId extends string = string, Nod
1141
1239
  ]>;
1142
1240
  };
1143
1241
 
1242
+ /**
1243
+ * Gets all the dependencies of a node type recursively
1244
+ * - Basically, it returns the node types that this node type directly depends on and all their dependencies recursively
1245
+ * - Includes itself
1246
+ *
1247
+ * @param stateOrNodeToNodeDependencies - The state or the node to node dependencies
1248
+ * @param nodeType - The node type
1249
+ * @returns All dependencies of the node type as a set
1250
+ */
1251
+ export declare function getAllDependenciesOfNodeTypeRecursively<DataTypeUniqueId extends string = string, NodeTypeUniqueId extends string = string, UnderlyingType extends SupportedUnderlyingTypes = SupportedUnderlyingTypes, ComplexSchemaType extends UnderlyingType extends 'complex' ? z.ZodType : never = never>(stateOrNodeToNodeDependencies: Pick<State<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>, 'typeOfNodes'> | Partial<Record<NodeTypeUniqueId, Set<NodeTypeUniqueId>>>, nodeType: NodeTypeUniqueId): Set<NodeTypeUniqueId>;
1252
+
1253
+ /**
1254
+ * Gets all the dependents of a node type recursively
1255
+ * - Basically, it returns the node types that are dependent on the given node type and all their dependents recursively
1256
+ * - Includes itself
1257
+ *
1258
+ * @param stateOrNodeToNodeDependents - The state or the node to node dependents
1259
+ * @param nodeType - The node type
1260
+ * @returns All dependents of the node type as a set
1261
+ */
1262
+ export declare function getAllDependentsOfNodeTypeRecursively<DataTypeUniqueId extends string = string, NodeTypeUniqueId extends string = string, UnderlyingType extends SupportedUnderlyingTypes = SupportedUnderlyingTypes, ComplexSchemaType extends UnderlyingType extends 'complex' ? z.ZodType : never = never>(stateOrNodeToNodeDependents: Pick<State<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>, 'typeOfNodes'> | Partial<Record<NodeTypeUniqueId, Set<NodeTypeUniqueId>>>, nodeType: NodeTypeUniqueId): Set<NodeTypeUniqueId>;
1263
+
1264
+ export declare function getCurrentNodesAndEdgesFromState<DataTypeUniqueId extends string = string, NodeTypeUniqueId extends string = string, UnderlyingType extends SupportedUnderlyingTypes = SupportedUnderlyingTypes, ComplexSchemaType extends UnderlyingType extends 'complex' ? z.ZodType : never = never>(state: State<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>): {
1265
+ nodes: State<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>['nodes'];
1266
+ edges: State<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>['edges'];
1267
+ inputNodeId?: string;
1268
+ outputNodeId?: string;
1269
+ };
1270
+
1271
+ export declare function getDependencyGraphBetweenNodeTypes<DataTypeUniqueId extends string = string, NodeTypeUniqueId extends string = string, UnderlyingType extends SupportedUnderlyingTypes = SupportedUnderlyingTypes, ComplexSchemaType extends UnderlyingType extends 'complex' ? z.ZodType : never = never>(state: Pick<State<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>, 'typeOfNodes'>): {
1272
+ nodeToNodeDependents: Partial<Record<NodeTypeUniqueId, Set<NodeTypeUniqueId>>>;
1273
+ nodeToNodeDependencies: Partial<Record<NodeTypeUniqueId, Set<NodeTypeUniqueId>>>;
1274
+ };
1275
+
1276
+ /**
1277
+ * Gets the direct dependencies of a node type
1278
+ * - Basically, it returns the node types that this node type directly depends on
1279
+ * - Doesn't include itself
1280
+ *
1281
+ * @param stateOrNodeToNodeDependencies - The state or the node to node dependencies
1282
+ * @param nodeType - The node type
1283
+ * @returns The direct dependencies of the node type as a set
1284
+ */
1285
+ export declare function getDirectDependenciesOfNodeType<DataTypeUniqueId extends string = string, NodeTypeUniqueId extends string = string, UnderlyingType extends SupportedUnderlyingTypes = SupportedUnderlyingTypes, ComplexSchemaType extends UnderlyingType extends 'complex' ? z.ZodType : never = never>(stateOrNodeToNodeDependencies: Pick<State<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>, 'typeOfNodes'> | Partial<Record<NodeTypeUniqueId, Set<NodeTypeUniqueId>>>, nodeType: NodeTypeUniqueId): Set<NodeTypeUniqueId>;
1286
+
1287
+ /**
1288
+ * Gets the direct dependents of a node type
1289
+ * - Basically, it returns the node types that are directly dependent on the given node type
1290
+ * - Doesn't include itself
1291
+ *
1292
+ * @param stateOrNodeToNodeDependents - The state or the node to node dependents
1293
+ * @param nodeType - The node type
1294
+ * @returns The direct dependents of the node type as a set
1295
+ */
1296
+ export declare function getDirectDependentsOfNodeType<DataTypeUniqueId extends string = string, NodeTypeUniqueId extends string = string, UnderlyingType extends SupportedUnderlyingTypes = SupportedUnderlyingTypes, ComplexSchemaType extends UnderlyingType extends 'complex' ? z.ZodType : never = never>(stateOrNodeToNodeDependents: Pick<State<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>, 'typeOfNodes'> | Partial<Record<NodeTypeUniqueId, Set<NodeTypeUniqueId>>>, nodeType: NodeTypeUniqueId): Set<NodeTypeUniqueId>;
1297
+
1144
1298
  export declare function getResultantDataTypeOfHandleConsideringInferredType<DataTypeUniqueId extends string = string, UnderlyingType extends SupportedUnderlyingTypes = SupportedUnderlyingTypes, ComplexSchemaType extends UnderlyingType extends 'complex' ? z.ZodType : never = never>(handle: ConfigurableNodeInput<UnderlyingType, ComplexSchemaType, DataTypeUniqueId> | ConfigurableNodeOutput<UnderlyingType, ComplexSchemaType, DataTypeUniqueId> | undefined): {
1145
1299
  dataTypeObject: DataType<UnderlyingType, ComplexSchemaType>;
1146
1300
  dataTypeUniqueId: DataTypeUniqueId;
@@ -1509,7 +1663,7 @@ export declare function makeStateWithAutoInfer<DataTypeUniqueId extends string =
1509
1663
  * };
1510
1664
  * ```
1511
1665
  */
1512
- export declare function makeTypeOfNodeWithAutoInfer<DataTypeUniqueId extends string = string>(input: TypeOfNode<DataTypeUniqueId>): TypeOfNode<DataTypeUniqueId>;
1666
+ export declare function makeTypeOfNodeWithAutoInfer<DataTypeUniqueId extends string = string, NodeTypeUniqueId extends string = string, UnderlyingType extends SupportedUnderlyingTypes = SupportedUnderlyingTypes, ComplexSchemaType extends UnderlyingType extends 'complex' ? z.ZodType : never = never>(input: TypeOfNode<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>): TypeOfNode<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>;
1513
1667
 
1514
1668
  /**
1515
1669
  * Array of node changes for ReactFlow
@@ -1590,6 +1744,8 @@ export declare type Nodes<UnderlyingType extends SupportedUnderlyingTypes = Supp
1590
1744
 
1591
1745
  declare type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
1592
1746
 
1747
+ declare type Orientation = 'horizontal' | 'vertical';
1748
+
1593
1749
  /**
1594
1750
  * ReactFlow-aware input component that automatically updates node data
1595
1751
  *
@@ -1610,6 +1766,22 @@ export declare type ReactFlowAwareInputProps = {
1610
1766
  input: ConfigurableNodeInput;
1611
1767
  };
1612
1768
 
1769
+ /**
1770
+ * ReactFlow-aware open button component that dispatches open node group action
1771
+ *
1772
+ * This component renders the open button and dispatches the OPEN_NODE_GROUP action
1773
+ * when clicked. It integrates with the ReactFlow context to maintain state consistency.
1774
+ *
1775
+ * @param props - The component props
1776
+ * @returns JSX element containing the open button
1777
+ */
1778
+ export declare const ReactFlowAwareOpenButton: ({}: ReactFlowAwareOpenButtonProps) => JSX.Element;
1779
+
1780
+ /**
1781
+ * Props for the ReactFlowAwareOpenButton component
1782
+ */
1783
+ export declare type ReactFlowAwareOpenButtonProps = {};
1784
+
1613
1785
  /**
1614
1786
  * Removes an edge between two handles with type checking and inference
1615
1787
  *
@@ -1633,7 +1805,7 @@ export declare type ReactFlowAwareInputProps = {
1633
1805
  * @param enableComplexTypeChecking - Whether to enable complex type checking
1634
1806
  * @returns Object containing updated nodes, edges, and validation result
1635
1807
  */
1636
- export declare function removeEdgeWithTypeChecking<DataTypeUniqueId extends string = string, NodeTypeUniqueId extends string = string, UnderlyingType extends SupportedUnderlyingTypes = SupportedUnderlyingTypes, ComplexSchemaType extends UnderlyingType extends 'complex' ? z.ZodType : never = never>(removedEdge: State<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>['edges'][number], state: State<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>, removedEdgeChange: EdgeChange<ConfigurableEdgeState>): {
1808
+ export declare function removeEdgeWithTypeChecking<DataTypeUniqueId extends string = string, NodeTypeUniqueId extends string = string, UnderlyingType extends SupportedUnderlyingTypes = SupportedUnderlyingTypes, ComplexSchemaType extends UnderlyingType extends 'complex' ? z.ZodType : never = never>(removedEdge: State<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>['edges'][number], state: Pick<State<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>, 'nodes' | 'edges' | 'enableTypeInference' | 'enableComplexTypeChecking' | 'allowedConversionsBetweenDataTypes' | 'dataTypes' | 'typeOfNodes'>, removedEdgeChange: EdgeChange<ConfigurableEdgeState>): {
1637
1809
  updatedNodes: Nodes<UnderlyingType, NodeTypeUniqueId, ComplexSchemaType, DataTypeUniqueId>;
1638
1810
  updatedEdges: Edges;
1639
1811
  validation: ConnectionValidationResult;
@@ -1647,6 +1819,286 @@ export declare function removeEdgeWithTypeChecking<DataTypeUniqueId extends stri
1647
1819
  */
1648
1820
  export declare function sanitizeNumberToShowAsText(value: number, numberOfDecimals: number): string;
1649
1821
 
1822
+ export declare const ScrollableButtonContainer: ForwardRefExoticComponent<ScrollableButtonContainerProps & RefAttributes<HTMLDivElement>>;
1823
+
1824
+ export declare type ScrollableButtonContainerProps = {
1825
+ children?: React.ReactNode;
1826
+ orientation?: Orientation;
1827
+ className?: string;
1828
+ scrollAreaClassName?: string;
1829
+ showArrows?: boolean;
1830
+ disabled?: boolean;
1831
+ ariaLabel?: string;
1832
+ scrollSpeedPxPerFrame?: number;
1833
+ reserveArrowSpace?: boolean;
1834
+ observeChildren?: boolean;
1835
+ };
1836
+
1837
+ /**
1838
+ * Root Select component that provides context for all sub-components
1839
+ *
1840
+ * This component manages the overall state and provides context for all
1841
+ * Select sub-components. It supports both controlled and uncontrolled usage
1842
+ * with proper accessibility features.
1843
+ *
1844
+ * @param props - The component props
1845
+ * @returns JSX element containing the select context
1846
+ */
1847
+ export declare const Select: FC<SelectPrimitive.SelectProps>;
1848
+
1849
+ /**
1850
+ * The dropdown content container that holds all select options
1851
+ *
1852
+ * This component renders the dropdown panel that contains all the selectable
1853
+ * options. It includes proper positioning, scrolling, and keyboard navigation
1854
+ * support with Blender-inspired styling.
1855
+ *
1856
+ * Features:
1857
+ * - Automatic positioning and collision detection
1858
+ * - Scrollable content with scroll indicators
1859
+ * - Keyboard navigation support
1860
+ * - Blender-inspired dark theme styling
1861
+ * - Proper focus management
1862
+ *
1863
+ * @param props - The component props
1864
+ * @param ref - Forwarded ref to the content element
1865
+ * @returns JSX element containing the select content
1866
+ *
1867
+ * @example
1868
+ * ```tsx
1869
+ * <SelectContent>
1870
+ * <SelectGroup>
1871
+ * <SelectLabel>Fruits</SelectLabel>
1872
+ * <SelectItem value="apple">Apple</SelectItem>
1873
+ * <SelectItem value="banana">Banana</SelectItem>
1874
+ * </SelectGroup>
1875
+ * </SelectContent>
1876
+ * ```
1877
+ */
1878
+ export declare const SelectContent: ForwardRefExoticComponent<Omit<SelectPrimitive.SelectContentProps & RefAttributes<HTMLDivElement>, "ref"> & RefAttributes<HTMLDivElement>>;
1879
+
1880
+ /**
1881
+ * Props for the SelectContent component
1882
+ */
1883
+ export declare type SelectContentProps = React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>;
1884
+
1885
+ /**
1886
+ * Container for grouping related select options with optional labels
1887
+ *
1888
+ * This component provides a semantic container for grouping related select
1889
+ * options. It can include a SelectLabel for the group and helps organize
1890
+ * options logically.
1891
+ *
1892
+ * Features:
1893
+ * - Semantic grouping of options
1894
+ * - Optional group labels
1895
+ * - Proper accessibility structure
1896
+ * - Blender-inspired styling
1897
+ *
1898
+ * @param props - The component props
1899
+ * @returns JSX element containing the select group
1900
+ *
1901
+ * @example
1902
+ * ```tsx
1903
+ * <SelectGroup>
1904
+ * <SelectLabel>Fruits</SelectLabel>
1905
+ * <SelectItem value="apple">Apple</SelectItem>
1906
+ * <SelectItem value="banana">Banana</SelectItem>
1907
+ * </SelectGroup>
1908
+ * ```
1909
+ */
1910
+ export declare const SelectGroup: ForwardRefExoticComponent<SelectPrimitive.SelectGroupProps & RefAttributes<HTMLDivElement>>;
1911
+
1912
+ /**
1913
+ * Individual selectable option within the select dropdown
1914
+ *
1915
+ * This component represents a single selectable option within the select
1916
+ * dropdown. It includes hover states, selection indicators, and proper
1917
+ * keyboard navigation support.
1918
+ *
1919
+ * Features:
1920
+ * - Hover and focus states
1921
+ * - Selection indicator (checkmark)
1922
+ * - Keyboard navigation support
1923
+ * - Blender-inspired styling
1924
+ * - Proper accessibility attributes
1925
+ *
1926
+ * @param props - The component props
1927
+ * @param ref - Forwarded ref to the item element
1928
+ * @returns JSX element containing the select item
1929
+ *
1930
+ * @example
1931
+ * ```tsx
1932
+ * <SelectItem value="apple">Apple</SelectItem>
1933
+ * <SelectItem value="banana">Banana</SelectItem>
1934
+ * ```
1935
+ */
1936
+ export declare const SelectItem: ForwardRefExoticComponent<Omit<SelectPrimitive.SelectItemProps & RefAttributes<HTMLDivElement>, "ref"> & RefAttributes<HTMLDivElement>>;
1937
+
1938
+ /**
1939
+ * Props for the SelectItem component
1940
+ */
1941
+ export declare type SelectItemProps = React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>;
1942
+
1943
+ /**
1944
+ * Label component for grouping select options
1945
+ *
1946
+ * This component provides a label for grouping related select options.
1947
+ * It's typically used within a SelectGroup to create visual separation
1948
+ * and organization of options.
1949
+ *
1950
+ * Features:
1951
+ * - Semantic grouping of options
1952
+ * - Blender-inspired styling
1953
+ * - Proper accessibility attributes
1954
+ *
1955
+ * @param props - The component props
1956
+ * @param ref - Forwarded ref to the label element
1957
+ * @returns JSX element containing the select label
1958
+ *
1959
+ * @example
1960
+ * ```tsx
1961
+ * <SelectGroup>
1962
+ * <SelectLabel>Fruits</SelectLabel>
1963
+ * <SelectItem value="apple">Apple</SelectItem>
1964
+ * <SelectItem value="banana">Banana</SelectItem>
1965
+ * </SelectGroup>
1966
+ * ```
1967
+ */
1968
+ export declare const SelectLabel: ForwardRefExoticComponent<Omit<SelectPrimitive.SelectLabelProps & RefAttributes<HTMLDivElement>, "ref"> & RefAttributes<HTMLDivElement>>;
1969
+
1970
+ /**
1971
+ * Props for the SelectLabel component
1972
+ */
1973
+ export declare type SelectLabelProps = React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>;
1974
+
1975
+ /**
1976
+ * Button for scrolling down in the select content when there are many options
1977
+ *
1978
+ * This component provides a scroll down button that appears when the select
1979
+ * content is scrollable and there are more options below.
1980
+ *
1981
+ * @param props - The component props
1982
+ * @param ref - Forwarded ref to the button element
1983
+ * @returns JSX element containing the scroll down button
1984
+ */
1985
+ export declare const SelectScrollDownButton: ForwardRefExoticComponent<Omit<SelectPrimitive.SelectScrollDownButtonProps & RefAttributes<HTMLDivElement>, "ref"> & RefAttributes<HTMLDivElement>>;
1986
+
1987
+ /**
1988
+ * Props for the SelectScrollDownButton component
1989
+ */
1990
+ export declare type SelectScrollDownButtonProps = React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>;
1991
+
1992
+ /**
1993
+ * Button for scrolling up in the select content when there are many options
1994
+ *
1995
+ * This component provides a scroll up button that appears when the select
1996
+ * content is scrollable and the user has scrolled down.
1997
+ *
1998
+ * @param props - The component props
1999
+ * @param ref - Forwarded ref to the button element
2000
+ * @returns JSX element containing the scroll up button
2001
+ */
2002
+ export declare const SelectScrollUpButton: ForwardRefExoticComponent<Omit<SelectPrimitive.SelectScrollUpButtonProps & RefAttributes<HTMLDivElement>, "ref"> & RefAttributes<HTMLDivElement>>;
2003
+
2004
+ /**
2005
+ * Props for the SelectScrollUpButton component
2006
+ */
2007
+ export declare type SelectScrollUpButtonProps = React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>;
2008
+
2009
+ /**
2010
+ * Visual separator between groups of select options
2011
+ *
2012
+ * This component provides a visual separator line between different groups
2013
+ * of select options, helping to organize and visually separate related items.
2014
+ *
2015
+ * Features:
2016
+ * - Visual separation between option groups
2017
+ * - Blender-inspired styling
2018
+ * - Proper accessibility attributes
2019
+ *
2020
+ * @param props - The component props
2021
+ * @param ref - Forwarded ref to the separator element
2022
+ * @returns JSX element containing the select separator
2023
+ *
2024
+ * @example
2025
+ * ```tsx
2026
+ * <SelectItem value="apple">Apple</SelectItem>
2027
+ * <SelectSeparator />
2028
+ * <SelectItem value="orange">Orange</SelectItem>
2029
+ * ```
2030
+ */
2031
+ export declare const SelectSeparator: ForwardRefExoticComponent<Omit<SelectPrimitive.SelectSeparatorProps & RefAttributes<HTMLDivElement>, "ref"> & RefAttributes<HTMLDivElement>>;
2032
+
2033
+ /**
2034
+ * Props for the SelectSeparator component
2035
+ */
2036
+ export declare type SelectSeparatorProps = React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>;
2037
+
2038
+ /**
2039
+ * The trigger button that opens the select dropdown
2040
+ *
2041
+ * This component renders the button that users click to open the select dropdown.
2042
+ * It displays the currently selected value or placeholder text and includes
2043
+ * proper accessibility attributes.
2044
+ *
2045
+ * Features:
2046
+ * - Displays selected value or placeholder
2047
+ * - Keyboard navigation support
2048
+ * - Blender-inspired dark theme styling
2049
+ * - Proper ARIA attributes
2050
+ *
2051
+ * @param props - The component props
2052
+ * @param ref - Forwarded ref to the button element
2053
+ * @returns JSX element containing the select trigger
2054
+ *
2055
+ * @example
2056
+ * ```tsx
2057
+ * <SelectTrigger className="w-[180px]">
2058
+ * <SelectValue placeholder="Select a fruit" />
2059
+ * </SelectTrigger>
2060
+ * ```
2061
+ */
2062
+ export declare const SelectTrigger: ForwardRefExoticComponent<Omit<SelectPrimitive.SelectTriggerProps & RefAttributes<HTMLButtonElement>, "ref"> & RefAttributes<HTMLButtonElement>>;
2063
+
2064
+ /**
2065
+ * Props for the SelectTrigger component
2066
+ */
2067
+ export declare type SelectTriggerProps = React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>;
2068
+
2069
+ /**
2070
+ * Component that displays the currently selected value or placeholder
2071
+ *
2072
+ * This component is used within SelectTrigger to display the currently
2073
+ * selected value or a placeholder when no value is selected. It provides
2074
+ * proper text handling and accessibility.
2075
+ *
2076
+ * Features:
2077
+ * - Displays selected value or placeholder
2078
+ * - Proper text truncation
2079
+ * - Accessibility support
2080
+ * - Blender-inspired styling
2081
+ *
2082
+ * @param props - The component props
2083
+ * @param ref - Forwarded ref to the value element
2084
+ * @returns JSX element containing the select value
2085
+ *
2086
+ * @example
2087
+ * ```tsx
2088
+ * <SelectTrigger>
2089
+ * <SelectValue placeholder="Select a fruit" />
2090
+ * </SelectTrigger>
2091
+ * ```
2092
+ */
2093
+ export declare const SelectValue: ForwardRefExoticComponent<Omit<SelectPrimitive.SelectValueProps & RefAttributes<HTMLSpanElement>, "ref"> & RefAttributes<HTMLSpanElement>>;
2094
+
2095
+ /**
2096
+ * Props for the SelectValue component
2097
+ */
2098
+ export declare type SelectValueProps = React.ComponentPropsWithoutRef<typeof SelectPrimitive.Value>;
2099
+
2100
+ export declare function setCurrentNodesAndEdgesToStateWithMutatingState<DataTypeUniqueId extends string = string, NodeTypeUniqueId extends string = string, UnderlyingType extends SupportedUnderlyingTypes = SupportedUnderlyingTypes, ComplexSchemaType extends UnderlyingType extends 'complex' ? z.ZodType : never = never>(state: Pick<State<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>, 'nodes' | 'edges' | 'typeOfNodes' | 'openedNodeGroupStack' | 'dataTypes'>, nodes?: State<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>['nodes'], edges?: State<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>['edges']): State<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>;
2101
+
1650
2102
  /**
1651
2103
  * A combined slider and number input component with drag functionality
1652
2104
  *
@@ -1718,6 +2170,44 @@ export declare type SliderNumberInputProps = {
1718
2170
  step?: number;
1719
2171
  };
1720
2172
 
2173
+ export declare const standardDataTypeNames: readonly ["newGroupInput", "newGroupOutput"];
2174
+
2175
+ export declare const standardDataTypeNamesMap: {
2176
+ readonly newGroupInput: "newGroupInput";
2177
+ readonly newGroupOutput: "newGroupOutput";
2178
+ };
2179
+
2180
+ export declare const standardDataTypes: {
2181
+ newGroupInput: {
2182
+ name: string;
2183
+ underlyingType: "inferFromConnection";
2184
+ complexSchema?: undefined;
2185
+ color: string;
2186
+ shape?: HandleShape_2;
2187
+ allowInput?: boolean;
2188
+ };
2189
+ newGroupOutput: {
2190
+ name: string;
2191
+ underlyingType: "inferFromConnection";
2192
+ complexSchema?: undefined;
2193
+ color: string;
2194
+ shape?: HandleShape_2;
2195
+ allowInput?: boolean;
2196
+ };
2197
+ };
2198
+
2199
+ export declare const standardNodeTypeNames: readonly ["groupInput", "groupOutput"];
2200
+
2201
+ export declare const standardNodeTypeNamesMap: {
2202
+ readonly groupInput: "groupInput";
2203
+ readonly groupOutput: "groupOutput";
2204
+ };
2205
+
2206
+ export declare const standardNodeTypes: {
2207
+ groupInput: TypeOfNode_2<"newGroupInput" | "newGroupOutput", string, "string" | "number" | "complex" | "noEquivalent" | "inferFromConnection", never>;
2208
+ groupOutput: TypeOfNode_2<"newGroupInput" | "newGroupOutput", string, "string" | "number" | "complex" | "noEquivalent" | "inferFromConnection", never>;
2209
+ };
2210
+
1721
2211
  /**
1722
2212
  * Complete state definition for the graph system
1723
2213
  *
@@ -1727,10 +2217,23 @@ export declare type SliderNumberInputProps = {
1727
2217
  * @template ComplexSchemaType - Zod schema type for complex data types
1728
2218
  */
1729
2219
  export declare type State<DataTypeUniqueId extends string = string, NodeTypeUniqueId extends string = string, UnderlyingType extends SupportedUnderlyingTypes = SupportedUnderlyingTypes, ComplexSchemaType extends UnderlyingType extends 'complex' ? z.ZodType : never = never> = {
2220
+ openedNodeGroupStack?: ({
2221
+ nodeType: NodeTypeUniqueId;
2222
+ previousViewport?: Viewport;
2223
+ } | {
2224
+ nodeType: NodeTypeUniqueId;
2225
+ /**
2226
+ * If not provided, it means that this node group isn't instantiated yet and we are editing the original node group
2227
+ */
2228
+ nodeId: string;
2229
+ previousViewport?: Viewport;
2230
+ })[];
1730
2231
  /** Map of data type definitions */
1731
2232
  dataTypes: Record<DataTypeUniqueId, DataType<UnderlyingType, ComplexSchemaType>>;
2233
+ /** Current viewport of the graph */
2234
+ viewport?: Viewport;
1732
2235
  /** Map of node type definitions */
1733
- typeOfNodes: Record<NodeTypeUniqueId, TypeOfNode<DataTypeUniqueId>>;
2236
+ typeOfNodes: Record<NodeTypeUniqueId, TypeOfNode<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>>;
1734
2237
  /** Array of nodes in the graph */
1735
2238
  nodes: Nodes<UnderlyingType, NodeTypeUniqueId, ComplexSchemaType, DataTypeUniqueId>;
1736
2239
  /** Array of edges in the graph */
@@ -1783,6 +2286,15 @@ export declare type State<DataTypeUniqueId extends string = string, NodeTypeUniq
1783
2286
  * @default undefined
1784
2287
  */
1785
2288
  enableCycleChecking?: boolean;
2289
+ /**
2290
+ * Whether to enable recursion checking
2291
+ * - If not provided, is considered disabled
2292
+ * - When disabled, the recursion is not checked, all nesting of node groups is allowed
2293
+ * - When enabled, the recursion is checked, and nesting of node groups is not allowed if it creates a recursion
2294
+ *
2295
+ * @default undefined
2296
+ */
2297
+ enableRecursionChecking?: boolean;
1786
2298
  };
1787
2299
 
1788
2300
  /**
@@ -1837,7 +2349,7 @@ export declare type TypeOfInputPanel<DataTypeUniqueId extends string = string> =
1837
2349
  *
1838
2350
  * @template DataTypeUniqueId - Unique identifier type for data types
1839
2351
  */
1840
- export declare type TypeOfNode<DataTypeUniqueId extends string = string> = {
2352
+ export declare type TypeOfNode<DataTypeUniqueId extends string = string, NodeTypeUniqueId extends string = string, UnderlyingType extends SupportedUnderlyingTypes = SupportedUnderlyingTypes, ComplexSchemaType extends UnderlyingType extends 'complex' ? z.ZodType : never = never> = {
1841
2353
  /** Display name of the node type */
1842
2354
  name: string;
1843
2355
  /** Color used for the node header */
@@ -1846,7 +2358,28 @@ export declare type TypeOfNode<DataTypeUniqueId extends string = string> = {
1846
2358
  inputs: (TypeOfInput<DataTypeUniqueId> | TypeOfInputPanel<DataTypeUniqueId>)[];
1847
2359
  /** Array of outputs */
1848
2360
  outputs: TypeOfInput<DataTypeUniqueId>[];
1849
- subtree?: {};
2361
+ /** Subtree of the node type (if this exists, this is a node group) */
2362
+ subtree?: {
2363
+ nodes: State<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>['nodes'];
2364
+ edges: State<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>['edges'];
2365
+ /**
2366
+ * Number of references to this node group
2367
+ * This subtree can only be edited or deleted if there are no references to it
2368
+ */
2369
+ numberOfReferences: number;
2370
+ /**
2371
+ * Input node id of the node group
2372
+ * - It is used to connect the node group to the rest of the graph
2373
+ * - Not allowed to be deleted or duplicated, must always be one
2374
+ */
2375
+ inputNodeId: string;
2376
+ /**
2377
+ * Output node id of the node group
2378
+ * - It is used to connect the node group to the rest of the graph
2379
+ * - Not allowed to be deleted or duplicated, must always be one
2380
+ */
2381
+ outputNodeId: string;
2382
+ };
1850
2383
  };
1851
2384
 
1852
2385
  /**
@@ -2010,7 +2543,7 @@ export declare type UseDragReturn = {
2010
2543
  *
2011
2544
  * // Add a new node (type-safe!)
2012
2545
  * dispatch({
2013
- * type: 'ADD_NODE',
2546
+ * type: actionTypesMap.ADD_NODE,
2014
2547
  * payload: { type: 'inputNode', position: { x: 100, y: 100 } },
2015
2548
  * });
2016
2549
  * ```