@nodescript/core
Version:
Visual programming language for Browser and Node
82 lines (81 loc) • 3.21 kB
TypeScript
import { NodeSpec } from '../types/model.js';
import { ModuleSpec, NodeEvalMode } from '../types/module.js';
import { GraphView } from './GraphView.js';
import { PropEntryView, PropLineView, PropView } from './PropView.js';
export declare class NodeView {
readonly graph: GraphView;
readonly localId: string;
readonly nodeSpec: NodeSpec;
/**
* Returns nodes in right-to-left order based on topology.
*/
static orderNodes(nodes: Iterable<NodeView>): NodeView[];
private _moduleSpec;
private _nodeUid;
constructor(graph: GraphView, localId: string, nodeSpec: NodeSpec);
toJSON(): NodeSpec;
get loader(): import("./ModuleLoader.js").ModuleLoader;
get ref(): string;
get metadata(): import("../types/model.js").NodeMetadata;
get nodeUid(): string;
isParamNode(): boolean;
isOutputNode(): boolean;
isFrameNode(): boolean;
isCommentNode(): boolean;
reloadModuleSpec(): Promise<void>;
getModuleSpec(): ModuleSpec;
isRoot(): boolean;
supportsSubgraph(): boolean;
getSubgraph(): GraphView | null;
getProps(): PropView[];
getProp(key: string): PropView | null;
getDefaultProp(): PropView | null;
isExpanded(): boolean;
allLines(): Iterable<PropLineView>;
effectiveLines(): Iterable<PropLineView>;
expandedLines(): Iterable<PropLineView>;
getOutboundLinks(linkMap?: import("../util/multimap.js").MultiMap<string, NodeLink>): Set<NodeLink>;
inboundLinks(): Iterable<NodeLink>;
/**
* Returns this node, plus all the nodes connect to its inbound sockets, recursively.
*
* This can also be thought of as a list of node's transitive dependencies.
*/
leftNodes(visited?: Set<string>): Iterable<NodeView>;
/**
* Returns this node, plus all the nodes connected to its outbound sockets, recursively.
*
* This can also be thought of as a list of node's dependents.
*/
rightNodes(linkMap?: import("../util/multimap.js").MultiMap<string, NodeLink>, visited?: Set<string>): Iterable<NodeView>;
/**
* Determines whether a link can be created from this node result socket
* into one of the specified `node` property socket.
* This is based solely on graph topology and disallows loops.
*/
canLinkTo(node: NodeView): boolean;
/**
* Determines whether Node is evaluated manually (by pressing a Play button)
* or immediately in the editor. Has no effect outside of the editor.
*
* Manually evaluated nodes cascade up and takes precedence, i.e. if a graph contains at least one
* node with `evalMode: manual`, then its own `evalMode` is also manual.
* Same applies to subgraphs: if a subgraph contains manually evaluated nodes,
* then its enclosing node is also manually evaluated.
*/
getEvalMode(): NodeEvalMode;
/**
* Returns `true` if the node itself or any of its left nodes are async,
* i.e. have `moduleSpec.result.async: true`.
*/
isAsync(): boolean;
canDock(): boolean;
isDocked(): boolean;
}
export interface NodeLink {
node: NodeView;
linkNode: NodeView;
prop: PropView;
entry?: PropEntryView;
linkKey?: string;
}