@ndbx/runtime
Version:
The `@ndbx/runtime` package provides a runtime environment to embed NodeBox visualizations directly into React applications. NodeBox is a powerful tool for creating interactive and generative visualizations, and this runtime allows you to integrate those
32 lines (31 loc) • 2.85 kB
TypeScript
import { Project, Item, Network, Node, Port, PortType, ParameterValue, Inlet, Outlet, NodeToNodeConnection, Point, FunctionItem, Sticky, NetworkItem } from "./types";
import Context from "./context";
export declare function createProject(title: string): Project;
export declare function createNetwork(cx: Context, project: Project, name: string): Network;
export declare function createFunction(cx: Context, project: Project, name: string): FunctionItem;
export declare function getNodes(network: Network): Node[];
export declare function createSticky(cx: Context, network: Network): Sticky;
export declare function createNode(cx: Context, network: Network, fn: string, position?: Point): Node | undefined;
export declare function replaceNode(cx: Context, network: Network, node: Node, fn: string): Node | undefined;
export declare function createOutlet(cx: Context, network: Network, name: string, type: PortType, position?: Point): Outlet;
export declare function setValue(cx: Context, network: Network, node: Node, parameterName: string, value: ParameterValue): void;
export declare function deleteItems(cx: Context, network: Network, ids: string[]): void;
export declare function duplicateItems(cx: Context, network: Network, ids: string[]): string[];
export declare function addItemsAndConnections(cx: Context, network: Network, items: NetworkItem[], internalConnections: NodeToNodeConnection[], inputConnections?: NodeToNodeConnection[]): string[];
export declare function connectNodeToNode(cx: Context, network: Network, outNode: Node, outPort: Port, inNode: Node, inPort: Port): void;
export declare function connectInletToNode(network: Network, inlet: Inlet, inNode: Node, inPort: Port): void;
export declare function connectNodeToOutlet(network: Network, outNode: Node, outPort: Port, outlet: Outlet): void;
export declare function disconnect(cx: Context, network: Network, inputNodeId: string, inputPortName: string): void;
export declare function setRenderedNode(cx: Context, network: Network, node: Node): void;
export declare function publishPortToOutlet(cx: Context, network: Network, node: Node, port: Port, outletName?: string): Outlet;
export declare function groupIntoNetwork(cx: Context, project: Project, network: Network, ids: string[], newNetworkName: string): void;
/**
* Mark this node, and all downstream nodes, dirty.
* @param cx The context.
* @param network The network.
* @param node The node to mark dirty. If undefined, does nothing.
*/
export declare function markDirty(cx: Context, network: Network, node: Node | undefined): void;
export declare function markProjectDirty(cx: Context, project: Project): void;
export declare function markFunctionDirty(cx: Context, project: Project, fqId: string): void;
export declare function markItemParameterDirty(cx: Context, item: Item, parameterName: string): void;