@rkmodules/rules 0.0.23 → 0.0.25

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.
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { FunctionNode } from "../types";
3
- import { GraphedFunction, VarDef } from "../../Engine";
3
+ import { VarDef } from "../../Engine";
4
4
  interface GenericNodeProps {
5
5
  id: string;
6
6
  data: FunctionNode["data"];
@@ -9,7 +9,6 @@ interface GenericNodeProps {
9
9
  outputs?: Record<string, VarDef>;
10
10
  params?: Record<string, VarDef>;
11
11
  children?: React.ReactNode;
12
- onChange: (fn: GraphedFunction) => void;
13
12
  }
14
- export declare function GenericNode({ id, data, selected, inputs, outputs, params, children, onChange, }: GenericNodeProps): React.JSX.Element;
13
+ export declare function GenericNode({ id, data, selected, inputs, outputs, params, children, }: GenericNodeProps): React.JSX.Element;
15
14
  export {};
@@ -1,8 +1,7 @@
1
1
  import React from "react";
2
- export declare const Input: ({ name, varDef, id, data, onChange }: {
2
+ export declare const Input: ({ name, varDef, id, data }: {
3
3
  name: any;
4
4
  varDef: any;
5
5
  id: any;
6
6
  data: any;
7
- onChange: any;
8
7
  }) => React.JSX.Element;
@@ -1,8 +1,7 @@
1
1
  import React from "react";
2
- export declare const Param: ({ id, name, varDef, data, onChange }: {
2
+ export declare const Param: ({ id, name, varDef, data }: {
3
3
  id: any;
4
4
  name: any;
5
5
  varDef: any;
6
6
  data: any;
7
- onChange: any;
8
7
  }) => React.JSX.Element;
@@ -1,6 +1,4 @@
1
1
  import React from "react";
2
- import { Engine, GraphedFunction } from "../Engine";
2
+ import { Engine } from "../Engine";
3
3
  export declare const EngineContext: React.Context<Engine>;
4
4
  export declare const useEngine: () => Engine;
5
- export declare const ChangeContext: React.Context<(fn: GraphedFunction) => void>;
6
- export declare const useChange: () => (fn: GraphedFunction) => void;
@@ -1,6 +1,6 @@
1
- import { Edge, Node, XYPosition } from "@xyflow/react";
2
- import { GraphedFunction } from "../Engine/types";
3
1
  import React from "react";
2
+ import { XYPosition } from "@xyflow/react";
3
+ import { GraphedFunction } from "../Engine/types";
4
4
  import { Engine } from "../Engine";
5
5
  import "./style/xyflow.css";
6
6
  export * from "./types";
@@ -9,6 +9,6 @@ interface FlowProps {
9
9
  engine: Engine;
10
10
  onChange?: (fn: GraphedFunction) => void;
11
11
  onClick?: (event: React.MouseEvent, position: XYPosition) => void;
12
- onSelect?: (nodes: Node[], edges: Edge[]) => void;
12
+ onSelect?: (ids: string[]) => void;
13
13
  }
14
14
  export declare function Flow({ function: fn, engine, onChange, onClick, onSelect, }: FlowProps): React.JSX.Element;
@@ -1,10 +1,14 @@
1
1
  import { Node } from "@xyflow/react";
2
- import { GraphedFunction, PrimitiveFunction, VarRef } from "../Engine";
2
+ import { GraphedFunction, PrimitiveFunction, VarDef, VarRef } from "../Engine";
3
3
  export type FunctionNode = Node<{
4
4
  name: string;
5
5
  caller: GraphedFunction;
6
6
  inputs?: VarRef;
7
7
  params?: VarRef;
8
+ inputDefs: Record<string, VarDef>;
9
+ paramDefs: Record<string, VarDef>;
10
+ outputDefs: Record<string, VarDef>;
11
+ onChange: (newData: Partial<FunctionNode["data"]>) => void;
8
12
  }>;
9
13
  export type NodeDropItem = {
10
14
  name: string;
@@ -1,3 +1,4 @@
1
+ import React from "react";
1
2
  import { Edge } from "@xyflow/react";
2
3
  import { Engine, GraphedFunction } from "../Engine";
3
4
  import { FunctionNode } from "../Flow";
@@ -7,13 +8,13 @@ export type PositionData = Record<string, {
7
8
  }>;
8
9
  type CreateGraphOptions = {
9
10
  dragHandle?: string;
11
+ setNodes: React.Dispatch<React.SetStateAction<FunctionNode[]>>;
12
+ setEdges: React.Dispatch<React.SetStateAction<Edge[]>>;
13
+ onChange?: (fn: GraphedFunction) => void;
10
14
  };
11
15
  export declare function createGraph(fn: GraphedFunction, engine: Engine, positions?: PositionData, options?: CreateGraphOptions): {
12
16
  nodes: FunctionNode[];
13
17
  edges: Edge[];
14
18
  };
15
- export declare function useFlow(fn: any, engine: any, options: any): {
16
- nodes: FunctionNode[];
17
- edges: Edge[];
18
- };
19
+ export declare function useFlow(fn: GraphedFunction, engine: Engine, options: CreateGraphOptions): void;
19
20
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rkmodules/rules",
3
- "version": "0.0.23",
3
+ "version": "0.0.25",
4
4
  "main": "dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [