@rkmodules/rules 0.0.71 → 0.0.73
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.cjs.css +48 -13
- package/dist/index.cjs.js +411 -92
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.css +48 -13
- package/dist/index.esm.js +411 -92
- package/dist/index.esm.js.map +1 -1
- package/dist/lib/Flow/Components/Menu.d.ts +11 -0
- package/dist/lib/Flow/Components/NodeContainer.d.ts +2 -1
- package/dist/lib/Flow/Context.d.ts +3 -1
- package/dist/lib/Flow/Nodes/Input.d.ts +7 -0
- package/dist/lib/Flow/Nodes/Output.d.ts +11 -0
- package/dist/lib/Flow/Nodes/index.d.ts +2 -0
- package/dist/lib/Flow/index.d.ts +3 -1
- package/dist/lib/Flow/types.d.ts +2 -1
- package/dist/lib/Primitives/input.d.ts +2 -0
- package/dist/lib/Primitives/output.d.ts +2 -0
- package/dist/lib/hooks/useFlow.d.ts +2 -10
- package/package.json +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface MenuProps {
|
|
3
|
+
handle: React.ReactNode;
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
export declare function Menu({ handle, children }: MenuProps): React.JSX.Element;
|
|
7
|
+
interface MenuItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export declare function MenuItem({ children, ...props }: MenuItemProps): React.JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -5,6 +5,7 @@ interface NodeContainerProps {
|
|
|
5
5
|
className?: string;
|
|
6
6
|
selected?: boolean;
|
|
7
7
|
children?: React.ReactNode;
|
|
8
|
+
noDelete?: boolean;
|
|
8
9
|
}
|
|
9
|
-
export declare function NodeContainer({ id, label, className, selected, children, }: NodeContainerProps): React.JSX.Element;
|
|
10
|
+
export declare function NodeContainer({ id, label, className, selected, children, noDelete, }: NodeContainerProps): React.JSX.Element;
|
|
10
11
|
export {};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Engine } from "../Engine";
|
|
2
|
+
import { Engine, GraphedFunction } from "../Engine";
|
|
3
3
|
import { WidgetProps } from "./Components/Control";
|
|
4
4
|
type FlowContextState = {
|
|
5
5
|
engine: Engine;
|
|
6
|
+
graphedFn: GraphedFunction;
|
|
6
7
|
controls?: Record<string, React.ComponentType<WidgetProps<any>>>;
|
|
7
8
|
};
|
|
8
9
|
export declare const FlowContext: React.Context<FlowContextState>;
|
|
9
10
|
export declare const useEngine: () => Engine;
|
|
10
11
|
export declare const useControls: () => {};
|
|
12
|
+
export declare const useGraphedFunction: () => GraphedFunction;
|
|
11
13
|
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { NodeProps } from "@xyflow/react";
|
|
3
|
+
import { FunctionNode } from "../types";
|
|
4
|
+
/**
|
|
5
|
+
* todo: get input data from graphed function
|
|
6
|
+
*/
|
|
7
|
+
export declare const InputNode: React.MemoExoticComponent<({ id, data, selected }: NodeProps<FunctionNode>) => React.JSX.Element>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { NodeProps } from "@xyflow/react";
|
|
3
|
+
import { FunctionNode } from "../types";
|
|
4
|
+
/**
|
|
5
|
+
* todo: create a factory for output component
|
|
6
|
+
* - allow to pass prompt handler (async)
|
|
7
|
+
* - allow to pass custom UI for renaming/adding/deleting
|
|
8
|
+
*
|
|
9
|
+
* - create input node
|
|
10
|
+
*/
|
|
11
|
+
export declare const OutputNode: React.MemoExoticComponent<({ id, data, selected }: NodeProps<FunctionNode>) => React.JSX.Element>;
|
|
@@ -3,4 +3,6 @@ export declare const nodeTypes: {
|
|
|
3
3
|
Calc: import("react").MemoExoticComponent<({ id, data, selected }: import("@xyflow/react").NodeProps<import("..").FunctionNode>) => import("react").JSX.Element>;
|
|
4
4
|
Log: import("react").MemoExoticComponent<({ id, data, selected }: import("@xyflow/react").NodeProps<import("..").FunctionNode>) => import("react").JSX.Element>;
|
|
5
5
|
Merge: import("react").MemoExoticComponent<({ id, data, selected }: import("@xyflow/react").NodeProps<import("..").FunctionNode>) => import("react").JSX.Element>;
|
|
6
|
+
Input: import("react").MemoExoticComponent<({ id, data, selected }: import("@xyflow/react").NodeProps<import("..").FunctionNode>) => import("react").JSX.Element>;
|
|
7
|
+
Output: import("react").MemoExoticComponent<({ id, data, selected }: import("@xyflow/react").NodeProps<import("..").FunctionNode>) => import("react").JSX.Element>;
|
|
6
8
|
};
|
package/dist/lib/Flow/index.d.ts
CHANGED
|
@@ -13,9 +13,11 @@ export * from "./types";
|
|
|
13
13
|
interface FlowProps {
|
|
14
14
|
function: GraphedFunction;
|
|
15
15
|
engine: Engine;
|
|
16
|
+
center?: boolean;
|
|
17
|
+
fitView?: boolean;
|
|
16
18
|
onChange?: (updater: Updater<GraphedFunction>) => void;
|
|
17
19
|
onClick?: (event: React.MouseEvent, position: XYPosition) => void;
|
|
18
20
|
onSelect?: (ids: string[]) => void;
|
|
19
21
|
customControls?: Record<string, React.ComponentType<WidgetProps<any>>>;
|
|
20
22
|
}
|
|
21
|
-
export declare function Flow(
|
|
23
|
+
export declare function Flow(props: FlowProps): React.JSX.Element;
|
package/dist/lib/Flow/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Node } from "@xyflow/react";
|
|
2
|
-
import { PrimitiveFunction, VarDef, VarRef } from "../Engine";
|
|
2
|
+
import { GraphedFunction, PrimitiveFunction, VarDef, VarRef } from "../Engine";
|
|
3
3
|
export type FunctionNode = Node<{
|
|
4
4
|
name: string;
|
|
5
5
|
label: string;
|
|
@@ -10,6 +10,7 @@ export type FunctionNode = Node<{
|
|
|
10
10
|
paramDefs: Record<string, VarDef>;
|
|
11
11
|
outputDefs: Record<string, VarDef>;
|
|
12
12
|
onChange: (newData: Partial<FunctionNode["data"]>) => void;
|
|
13
|
+
onIOChange?: (callback: (fn: GraphedFunction) => Partial<GraphedFunction>) => void;
|
|
13
14
|
}>;
|
|
14
15
|
export type NodeDropItem = {
|
|
15
16
|
name: string;
|
|
@@ -5,18 +5,11 @@ export type PositionData = Record<string, {
|
|
|
5
5
|
x: number;
|
|
6
6
|
y: number;
|
|
7
7
|
}>;
|
|
8
|
-
|
|
9
|
-
* TODO: replace this whole thing with a zustand state
|
|
10
|
-
* - whenever the outer function changes, update the inner node graph
|
|
11
|
-
* - but do so useing shallow comparison, so only update changed nodes
|
|
12
|
-
* - also store the node positions in the zustand state, so they are not lost on rerender
|
|
13
|
-
*
|
|
14
|
-
* - state is not persisted in local storage, that is the job of the outer function variable in the page
|
|
15
|
-
*/
|
|
16
|
-
interface FlowOptions {
|
|
8
|
+
export interface FlowOptions {
|
|
17
9
|
dragHandle?: string;
|
|
18
10
|
positions?: PositionData;
|
|
19
11
|
onDataChange?: (id: string) => (newData: Partial<FunctionNode["data"]>) => void;
|
|
12
|
+
onIOChange?: (callback: (fn: GraphedFunction) => Partial<GraphedFunction>) => void;
|
|
20
13
|
}
|
|
21
14
|
/**
|
|
22
15
|
* creates a flow state and provides handlers to update nodes and edges
|
|
@@ -27,4 +20,3 @@ export declare function useFlow(fn: GraphedFunction, engine: Engine, options: Fl
|
|
|
27
20
|
setNodes: (updater: (nodes: FunctionNode[]) => FunctionNode[]) => void;
|
|
28
21
|
setEdges: (updater: (edges: Edge[]) => Edge[]) => void;
|
|
29
22
|
};
|
|
30
|
-
export {};
|