@nodish/core 0.1.4 → 0.2.0
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 +519 -0
- package/dist/{vue.js → index.js} +1 -1
- package/package.json +7 -11
- package/dist/pack.d.ts +0 -326
- package/dist/pack.js +0 -43
- package/dist/src/components/AddNodePanel.vue.d.ts +0 -20
- package/dist/src/components/GraphInterfacePanel.vue.d.ts +0 -13
- package/dist/src/components/GraphNode.vue.d.ts +0 -26
- package/dist/src/components/GroupPanel.vue.d.ts +0 -13
- package/dist/src/components/InspectorPanel.vue.d.ts +0 -43
- package/dist/src/components/NodePanel.vue.d.ts +0 -18
- package/dist/src/components/NodePort.vue.d.ts +0 -21
- package/dist/src/components/NodeViewer.vue.d.ts +0 -14
- package/dist/src/components/WireLayer.vue.d.ts +0 -8
- package/dist/src/components/inspector/InspectorCheckboxField.vue.d.ts +0 -10
- package/dist/src/components/inspector/InspectorColorField.vue.d.ts +0 -12
- package/dist/src/components/inspector/InspectorError.vue.d.ts +0 -5
- package/dist/src/components/inspector/InspectorPositionField.vue.d.ts +0 -12
- package/dist/src/components/inspector/InspectorSection.vue.d.ts +0 -24
- package/dist/src/components/inspector/InspectorWidthField.vue.d.ts +0 -12
- package/dist/src/components/layout.d.ts +0 -26
- package/dist/src/components/types/NumberWidget.vue.d.ts +0 -15
- package/dist/src/components/types/PortValueWidget.vue.d.ts +0 -17
- package/dist/src/components/types/ReadonlyWidget.vue.d.ts +0 -9
- package/dist/src/components/types/TextWidget.vue.d.ts +0 -15
- package/dist/src/components/types/registerDefaultTypeWidgets.d.ts +0 -6
- package/dist/src/components/types/registry.d.ts +0 -13
- package/dist/src/pack/index.d.ts +0 -5
- package/dist/src/store/composite/editContext.d.ts +0 -14
- package/dist/src/store/composite/guards.d.ts +0 -7
- package/dist/src/store/composite/index.d.ts +0 -12
- package/dist/src/store/graph/connect.d.ts +0 -8
- package/dist/src/store/graph/createNodeMap.d.ts +0 -20
- package/dist/src/store/graph/document.d.ts +0 -25
- package/dist/src/store/graph/dynamicPorts.d.ts +0 -9
- package/dist/src/store/graph/evaluate.d.ts +0 -18
- package/dist/src/store/graph/expandIO.d.ts +0 -2
- package/dist/src/store/graph/instance.d.ts +0 -7
- package/dist/src/store/graph/pruneConnections.d.ts +0 -2
- package/dist/src/store/graph/removeNode.d.ts +0 -3
- package/dist/src/store/graph/stacking.d.ts +0 -5
- package/dist/src/store/graph/validateGraphTypes.d.ts +0 -2
- package/dist/src/store/interface/editor.d.ts +0 -5
- package/dist/src/store/interface/graphInterface.d.ts +0 -20
- package/dist/src/store/model.d.ts +0 -241
- package/dist/src/store/nodes/io.d.ts +0 -46
- package/dist/src/store/packs/installPack.d.ts +0 -4
- package/dist/src/store/registry/defineNode.d.ts +0 -50
- package/dist/src/store/registry/defineType.d.ts +0 -31
- package/dist/src/store/registry/groups.d.ts +0 -9
- package/dist/src/store/registry/index.d.ts +0 -39
- package/dist/src/store/types/effectiveWidget.d.ts +0 -4
- package/dist/src/store/utils/clonePlain.d.ts +0 -1
- package/dist/src/vue/attachLoadPack.d.ts +0 -2
- package/dist/src/vue/createNodeMap.d.ts +0 -11
- package/dist/src/vue/index.d.ts +0 -10
- /package/dist/{vue.css → index.css} +0 -0
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Port, PortTypeDefinition, TypeWidgetSpec } from '../../store/model';
|
|
2
|
-
type __VLS_Props = {
|
|
3
|
-
port: Port;
|
|
4
|
-
typeDef?: PortTypeDefinition;
|
|
5
|
-
effectiveWidget?: TypeWidgetSpec;
|
|
6
|
-
placeholder: string;
|
|
7
|
-
};
|
|
8
|
-
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
9
|
-
"update:value": (value: unknown) => any;
|
|
10
|
-
commit: () => any;
|
|
11
|
-
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
12
|
-
"onUpdate:value"?: ((value: unknown) => any) | undefined;
|
|
13
|
-
onCommit?: (() => any) | undefined;
|
|
14
|
-
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLInputElement>;
|
|
15
|
-
export default _default;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Port, PortTypeDefinition, TypeWidgetSpec } from '../../store/model';
|
|
2
|
-
type __VLS_Props = {
|
|
3
|
-
port: Port;
|
|
4
|
-
typeDef?: PortTypeDefinition;
|
|
5
|
-
effectiveWidget?: TypeWidgetSpec;
|
|
6
|
-
mode: "editable" | "readonly";
|
|
7
|
-
displayValue?: unknown;
|
|
8
|
-
placeholder: string;
|
|
9
|
-
};
|
|
10
|
-
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
11
|
-
"update:value": (value: unknown) => any;
|
|
12
|
-
commit: () => any;
|
|
13
|
-
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
14
|
-
"onUpdate:value"?: ((value: unknown) => any) | undefined;
|
|
15
|
-
onCommit?: (() => any) | undefined;
|
|
16
|
-
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
17
|
-
export default _default;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Port, PortTypeDefinition, TypeWidgetSpec } from '../../store/model';
|
|
2
|
-
type __VLS_Props = {
|
|
3
|
-
port: Port;
|
|
4
|
-
typeDef?: PortTypeDefinition;
|
|
5
|
-
effectiveWidget?: TypeWidgetSpec;
|
|
6
|
-
displayValue?: unknown;
|
|
7
|
-
};
|
|
8
|
-
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLSpanElement>;
|
|
9
|
-
export default _default;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Port, PortTypeDefinition, TypeWidgetSpec } from '../../store/model';
|
|
2
|
-
type __VLS_Props = {
|
|
3
|
-
port: Port;
|
|
4
|
-
typeDef?: PortTypeDefinition;
|
|
5
|
-
effectiveWidget?: TypeWidgetSpec;
|
|
6
|
-
placeholder: string;
|
|
7
|
-
};
|
|
8
|
-
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
9
|
-
"update:value": (value: unknown) => any;
|
|
10
|
-
commit: () => any;
|
|
11
|
-
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
12
|
-
"onUpdate:value"?: ((value: unknown) => any) | undefined;
|
|
13
|
-
onCommit?: (() => any) | undefined;
|
|
14
|
-
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
15
|
-
export default _default;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Register built-in Vue widgets for conventional `number` and `string` type ids.
|
|
3
|
-
* Call once at app startup before loading packs that rely on those widgets.
|
|
4
|
-
*/
|
|
5
|
-
export declare function registerDefaultTypeWidgets(): void;
|
|
6
|
-
export { registerComponentWidget, registerTypeWidget } from './registry';
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Component } from 'vue';
|
|
2
|
-
import { PortTypeDefinition, TypeWidgetSpec } from '../../store/model';
|
|
3
|
-
/**
|
|
4
|
-
* Bind a Vue component to all editable ports of a type id.
|
|
5
|
-
* Overrides the generic widget for that type.
|
|
6
|
-
*/
|
|
7
|
-
export declare function registerTypeWidget(typeId: string, component: Component): void;
|
|
8
|
-
/**
|
|
9
|
-
* Bind a Vue component to a custom widget id
|
|
10
|
-
* ({@link TypeWidgetSpec} `kind: "custom"`).
|
|
11
|
-
*/
|
|
12
|
-
export declare function registerComponentWidget(componentId: string, component: Component): void;
|
|
13
|
-
export declare function resolveTypeWidget(typeDef: PortTypeDefinition | undefined, effectiveWidget: TypeWidgetSpec | undefined, mode: "editable" | "readonly"): Component;
|
package/dist/src/pack/index.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export type { DynamicPortsSpec, IOSpec, NodeSpec, NodeSpecRegistry, PortSpec, } from '../store/registry/defineNode';
|
|
2
|
-
export { defineType } from '../store/registry/defineType';
|
|
3
|
-
export type { TypeSpec } from '../store/registry/defineType';
|
|
4
|
-
export type { NodePack, PackSetupContext } from '../store/registry';
|
|
5
|
-
export type { GraphPortSpec, IndefiniteNode, NodeLocation, PortDefinition, PortTypeDefinition, TypeWidgetSpec, } from '../store/model';
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { DefiniteNode, NodeMap } from '../model';
|
|
2
|
-
import { UpdateGraphInterfaceOptions } from '../interface/graphInterface';
|
|
3
|
-
export interface EditFrame {
|
|
4
|
-
compositeNodeId: string;
|
|
5
|
-
}
|
|
6
|
-
export interface EditContext {
|
|
7
|
-
activeMap: NodeMap;
|
|
8
|
-
interfaceOptions?: UpdateGraphInterfaceOptions;
|
|
9
|
-
}
|
|
10
|
-
export declare function compositeAtDepth(root: NodeMap, stack: EditFrame[], depth: number): DefiniteNode | null;
|
|
11
|
-
export declare function currentComposite(root: NodeMap, stack: EditFrame[]): DefiniteNode | null;
|
|
12
|
-
export declare function resolveEditContext(root: NodeMap, stack: EditFrame[]): EditContext;
|
|
13
|
-
export declare function compositeLabel(node: DefiniteNode): string;
|
|
14
|
-
export declare function breadcrumbPath(root: NodeMap, stack: EditFrame[]): string[];
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { DefiniteNode, NodeGraph, NodeMap } from '../model';
|
|
2
|
-
import { EditFrame } from './editContext';
|
|
3
|
-
export declare function graphContainsNodeId(graph: NodeGraph, id: string, deep: boolean): boolean;
|
|
4
|
-
export declare function ancestorCompositeIds(stack: EditFrame[]): string[];
|
|
5
|
-
export declare function validateCompositePlacement(root: NodeMap, stack: EditFrame[], targetGraph: NodeGraph): string | null;
|
|
6
|
-
export declare function validateCompositeDrillIn(root: NodeMap, stack: EditFrame[], target: DefiniteNode): string | null;
|
|
7
|
-
export declare function wouldCreateCompositeCycle(root: NodeMap, stack: EditFrame[], node: DefiniteNode, hostGraph: NodeGraph): string | null;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { NodeSpec } from '../registry/defineNode';
|
|
2
|
-
import { UpdateGraphInterfaceOptions } from '../interface/graphInterface';
|
|
3
|
-
import { DefiniteNode, GraphInterface, NodeLocation, NodeMap } from '../model';
|
|
4
|
-
export declare const COMPOSITE_TYPE = "composite/group";
|
|
5
|
-
export type { UpdateGraphInterfaceOptions };
|
|
6
|
-
export declare const compositeNode: NodeSpec;
|
|
7
|
-
export declare function buildNestedMap(parent: NodeMap, composite: DefiniteNode): NodeMap;
|
|
8
|
-
export declare function persistNestedMap(parent: NodeMap, composite: DefiniteNode, nested: NodeMap): void;
|
|
9
|
-
export declare function reconcileCompositePorts(map: NodeMap, composite: DefiniteNode): void;
|
|
10
|
-
export declare function applyGraphInterfaceUpdate(map: NodeMap, iface: GraphInterface, options?: UpdateGraphInterfaceOptions): string[];
|
|
11
|
-
export declare function instantiateComposite(parent: NodeMap, location: NodeLocation): DefiniteNode;
|
|
12
|
-
export declare function isCompositeNode(node: DefiniteNode): boolean;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Connection, NodeId, NodeMap, PortRef, PortTypeId } from '../model';
|
|
2
|
-
export declare function assignable(map: NodeMap, from: PortTypeId, to: PortTypeId): boolean;
|
|
3
|
-
export declare function ancestorNodeIds(map: NodeMap, nodeId: NodeId): NodeId[];
|
|
4
|
-
export declare function descendantNodeIds(map: NodeMap, nodeId: NodeId): NodeId[];
|
|
5
|
-
export declare function wouldCreateCycle(map: NodeMap, from: PortRef, to: PortRef): boolean;
|
|
6
|
-
export declare function canConnect(map: NodeMap, from: PortRef, to: PortRef): boolean;
|
|
7
|
-
export declare function addConnection(map: NodeMap, from: PortRef, to: PortRef): Connection | null;
|
|
8
|
-
export declare function removeConnection(map: NodeMap, id: string): void;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { GraphDocument, GraphInterface, NodeGraph, NodeMap, TypeRegistry } from '../model';
|
|
2
|
-
import { NodePack } from '../registry';
|
|
3
|
-
import { NodeSpecRegistry } from '../registry/defineNode';
|
|
4
|
-
/** Options for the vue entry `createNodeMap()`. */
|
|
5
|
-
export interface CreateNodeMapInit {
|
|
6
|
-
/** Initial graph contents. Defaults to empty nodes and connections. */
|
|
7
|
-
graph?: NodeGraph;
|
|
8
|
-
/** Pre-loaded pack ids (usually leave empty and use {@link NodeMap.loadPack}). */
|
|
9
|
-
extensions?: string[];
|
|
10
|
-
/** Graph boundary ports; defaults to no inputs and no outputs. */
|
|
11
|
-
graphInterface?: GraphInterface;
|
|
12
|
-
/** Extra types to merge into the registry at creation time. */
|
|
13
|
-
types?: TypeRegistry;
|
|
14
|
-
/** Extra node types to merge into the registry at creation time (authoring form). */
|
|
15
|
-
nodeTypes?: NodeSpecRegistry;
|
|
16
|
-
/** Packs to load immediately after creation (via {@link NodeMap.loadPack}). */
|
|
17
|
-
packs?: NodePack[];
|
|
18
|
-
}
|
|
19
|
-
export declare function createNodeMapBase(init?: CreateNodeMapInit): NodeMap;
|
|
20
|
-
export type { GraphDocument };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { GraphDocument, NodeMap } from '../model';
|
|
2
|
-
/**
|
|
3
|
-
* Serialize the current workspace to a {@link GraphDocument}.
|
|
4
|
-
* Alias of {@link exportGraph}.
|
|
5
|
-
*/
|
|
6
|
-
export declare function serializeDocument(map: NodeMap): GraphDocument;
|
|
7
|
-
/** Serialize the current workspace to a {@link GraphDocument}. */
|
|
8
|
-
export declare function exportGraph(map: NodeMap): GraphDocument;
|
|
9
|
-
/**
|
|
10
|
-
* Parse a JSON string into a {@link GraphDocument}.
|
|
11
|
-
* @throws When JSON is invalid or required fields are missing.
|
|
12
|
-
*/
|
|
13
|
-
export declare function parseGraphDocument(json: string): GraphDocument;
|
|
14
|
-
/**
|
|
15
|
-
* Validate a document against the current map without applying it.
|
|
16
|
-
* @returns Human-readable error messages (empty when valid).
|
|
17
|
-
*/
|
|
18
|
-
export declare function validateDocument(map: NodeMap, doc: GraphDocument): string[];
|
|
19
|
-
/**
|
|
20
|
-
* Replace the map's graph and interface from a document.
|
|
21
|
-
* @returns Errors from extension checks before apply, then validation errors after apply.
|
|
22
|
-
*/
|
|
23
|
-
export declare function applyDocument(map: NodeMap, doc: GraphDocument): string[];
|
|
24
|
-
/** Replace the map's graph from a document. Alias of {@link applyDocument}. */
|
|
25
|
-
export declare function importGraph(map: NodeMap, doc: GraphDocument): string[];
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { DefiniteNode, IndefiniteNode, NodeIO, NodeIODefinition, NodeMap, PortDirection } from '../model';
|
|
2
|
-
export declare function resolveNodePorts(def: IndefiniteNode, params: Record<string, unknown>): {
|
|
3
|
-
inputs: NodeIODefinition;
|
|
4
|
-
outputs: NodeIODefinition;
|
|
5
|
-
};
|
|
6
|
-
export declare function nodeParams(node: DefiniteNode): Record<string, unknown>;
|
|
7
|
-
export declare function defaultParams(def: IndefiniteNode): Record<string, unknown>;
|
|
8
|
-
export declare function reconcileSide(old: NodeIO, defs: NodeIODefinition, direction: PortDirection): NodeIO;
|
|
9
|
-
export declare function reconcilePorts(map: NodeMap, node: DefiniteNode): void;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { NodeId, NodeMap } from '../model';
|
|
2
|
-
/** Port values keyed by port name. */
|
|
3
|
-
export type Values = Record<string, unknown>;
|
|
4
|
-
/** Evaluation errors keyed by {@link NodeId}. */
|
|
5
|
-
export type NodeErrors = Record<NodeId, string>;
|
|
6
|
-
export interface GraphRunResult {
|
|
7
|
-
/** Output port values from the graph's Output node, keyed by port name. */
|
|
8
|
-
values: Values;
|
|
9
|
-
/** First error per node encountered during evaluation. */
|
|
10
|
-
errors: NodeErrors;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Evaluate the graph as a function: supply values for the Input node's output
|
|
14
|
-
* ports (keyed by port name) and receive the Output node's input port values.
|
|
15
|
-
*
|
|
16
|
-
* Uses pull-based recursive evaluation with per-node memoization and cycle detection.
|
|
17
|
-
*/
|
|
18
|
-
export declare function runGraph(map: NodeMap, inputs?: Values): GraphRunResult;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { DefiniteNode, IndefiniteNode, NodeLocation } from '../model';
|
|
2
|
-
/**
|
|
3
|
-
* Create a placed {@link DefiniteNode} from a node type, generating fresh port ids.
|
|
4
|
-
* For dynamic nodes, the initial port set comes from {@link IndefiniteNode.resolvePorts}
|
|
5
|
-
* seeded with the definition's default parameter values.
|
|
6
|
-
*/
|
|
7
|
-
export declare function instantiate(def: IndefiniteNode, location: NodeLocation): DefiniteNode;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { NodeId, NodeMap } from '../model';
|
|
2
|
-
export declare function topZ(map: NodeMap): number;
|
|
3
|
-
export declare function normalizeStackingOrder(map: NodeMap): void;
|
|
4
|
-
export declare function ensureStackingOrder(map: NodeMap): void;
|
|
5
|
-
export declare function bringToFront(map: NodeMap, id: NodeId): void;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { GraphInterface, NodeMap } from '../model';
|
|
2
|
-
import { EditFrame } from '../composite/editContext';
|
|
3
|
-
export type InterfaceMutator = (iface: GraphInterface) => void;
|
|
4
|
-
export declare function canonicalGraphInterface(root: NodeMap, stack: EditFrame[]): GraphInterface;
|
|
5
|
-
export declare function applyInterfaceMutation(root: NodeMap, stack: EditFrame[], mutate: InterfaceMutator): string[];
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { DefiniteNode, GraphInterface, GraphPortSpec, NodeMap } from '../model';
|
|
2
|
-
import { expandIO } from '../graph/expandIO';
|
|
3
|
-
export declare const PORT_NAME_RE: RegExp;
|
|
4
|
-
export declare function validateGraphInterface(map: NodeMap, iface: GraphInterface): string[];
|
|
5
|
-
export declare function cloneGraphInterface(iface: GraphInterface): GraphInterface;
|
|
6
|
-
export declare function uniquePortName(existing: Record<string, GraphPortSpec> | undefined, base?: string): string;
|
|
7
|
-
export declare function addParameter(iface: GraphInterface, name?: string): GraphInterface;
|
|
8
|
-
export declare function addReturn(iface: GraphInterface, name?: string): GraphInterface;
|
|
9
|
-
export declare function removeParameter(iface: GraphInterface, name: string): GraphInterface;
|
|
10
|
-
export declare function removeReturn(iface: GraphInterface, name: string): GraphInterface;
|
|
11
|
-
export declare function renameParameter(iface: GraphInterface, oldName: string, newName: string): GraphInterface;
|
|
12
|
-
export declare function renameReturn(iface: GraphInterface, oldName: string, newName: string): GraphInterface;
|
|
13
|
-
export declare function setParameterSpec(iface: GraphInterface, name: string, spec: GraphPortSpec): GraphInterface;
|
|
14
|
-
export declare function setReturnSpec(iface: GraphInterface, name: string, spec: GraphPortSpec): GraphInterface;
|
|
15
|
-
export interface UpdateGraphInterfaceOptions {
|
|
16
|
-
/** When editing a nested graph, sync ports on the parent composite instance. */
|
|
17
|
-
ownerComposite?: DefiniteNode;
|
|
18
|
-
parentMap?: NodeMap;
|
|
19
|
-
}
|
|
20
|
-
export { expandIO };
|
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
import { NodePack } from './registry';
|
|
2
|
-
export type NodeId = string;
|
|
3
|
-
export type PortId = string;
|
|
4
|
-
export type ConnectionId = string;
|
|
5
|
-
export type NodeTypeId = string;
|
|
6
|
-
export type NodeLocation = {
|
|
7
|
-
x: number;
|
|
8
|
-
y: number;
|
|
9
|
-
};
|
|
10
|
-
/** Key into the {@link TypeRegistry} (e.g. `"number"`). */
|
|
11
|
-
export type PortTypeId = string;
|
|
12
|
-
export type PortType = PortTypeId;
|
|
13
|
-
/**
|
|
14
|
-
* Serializable widget descriptor for port value editing and display. Lives on the
|
|
15
|
-
* type definition; the Vue viewer resolves it to a concrete component.
|
|
16
|
-
*/
|
|
17
|
-
export type TypeWidgetSpec = {
|
|
18
|
-
kind: "number";
|
|
19
|
-
min?: number;
|
|
20
|
-
max?: number;
|
|
21
|
-
step?: number;
|
|
22
|
-
/** Port row height in px; defaults to one line (20px). */
|
|
23
|
-
rowHeight?: number;
|
|
24
|
-
} | {
|
|
25
|
-
kind: "text";
|
|
26
|
-
/** Multiline row count; height is `rows × 20px` unless `rowHeight` is set. */
|
|
27
|
-
rows?: number;
|
|
28
|
-
/** Port row height in px; overrides `rows`. */
|
|
29
|
-
rowHeight?: number;
|
|
30
|
-
} | {
|
|
31
|
-
kind: "custom";
|
|
32
|
-
/** Id passed to `registerComponentWidget` in a pack's `setup` hook. */
|
|
33
|
-
componentId: string;
|
|
34
|
-
/** Port row height in px; defaults to one line (20px). */
|
|
35
|
-
rowHeight?: number;
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* A registered data type. Carries validation, connection compatibility, and
|
|
39
|
-
* optional value lifecycle hooks. Registered at startup — only {@link PortTypeId}
|
|
40
|
-
* keys on ports are serialized in documents.
|
|
41
|
-
*/
|
|
42
|
-
export interface PortTypeDefinition {
|
|
43
|
-
id: PortTypeId;
|
|
44
|
-
label: string;
|
|
45
|
-
color: string;
|
|
46
|
-
validate: (value: unknown) => boolean;
|
|
47
|
-
/**
|
|
48
|
-
* Whether an output of type `from` may connect into an input of this type.
|
|
49
|
-
* Decided by the destination type. Omitted means strict identity (`from === id`).
|
|
50
|
-
*/
|
|
51
|
-
accepts?: (from: PortTypeId) => boolean;
|
|
52
|
-
/** Fallback when a port of this type omits its own default. */
|
|
53
|
-
defaultValue?: unknown;
|
|
54
|
-
/** Display/edit descriptor for the viewer (no functions). */
|
|
55
|
-
widget?: TypeWidgetSpec;
|
|
56
|
-
/** Parse a raw string (e.g. from an input field) into a value. */
|
|
57
|
-
parse?: (raw: string) => unknown;
|
|
58
|
-
/** Format a value for display in the viewer. */
|
|
59
|
-
format?: (value: unknown) => string;
|
|
60
|
-
/** Normalize or clamp a value after edit or connection. */
|
|
61
|
-
coerce?: (value: unknown) => unknown;
|
|
62
|
-
}
|
|
63
|
-
/** Library of available data types, keyed by id. */
|
|
64
|
-
export type TypeRegistry = Record<PortTypeId, PortTypeDefinition>;
|
|
65
|
-
export type PortDirection = "input" | "output";
|
|
66
|
-
/**
|
|
67
|
-
* Port template declared by a node type ({@link IndefiniteNode}). Has no id and
|
|
68
|
-
* no live value — only describes ports that instances will receive.
|
|
69
|
-
*/
|
|
70
|
-
export type PortDefinition = {
|
|
71
|
-
/** Stable, human-authored key; referenced inside `execute()`. */
|
|
72
|
-
name: string;
|
|
73
|
-
type: PortType;
|
|
74
|
-
/** Used by an input when nothing is connected to it. */
|
|
75
|
-
defaultValue?: unknown;
|
|
76
|
-
description?: string;
|
|
77
|
-
/**
|
|
78
|
-
* Input-only. Never accepts a connection — no socket, always shows its widget.
|
|
79
|
-
* Also feeds parameters into {@link IndefiniteNode.resolvePorts}.
|
|
80
|
-
*/
|
|
81
|
-
userOnly?: boolean;
|
|
82
|
-
/**
|
|
83
|
-
* Input-only. Accepts any number of incoming connections; `execute()` receives
|
|
84
|
-
* values as an unordered array of `type`.
|
|
85
|
-
*/
|
|
86
|
-
multi?: boolean;
|
|
87
|
-
/**
|
|
88
|
-
* Widget-specific configuration merged on top of the type's widget spec.
|
|
89
|
-
* Recognized keys: `options`, `min`, `max`, `step`, `rows`, `rowHeight`.
|
|
90
|
-
*/
|
|
91
|
-
customProps?: Record<string, unknown>;
|
|
92
|
-
};
|
|
93
|
-
/**
|
|
94
|
-
* Materialized port on a placed node ({@link DefiniteNode}). Has a unique id so
|
|
95
|
-
* connections and the DOM can reference it directly.
|
|
96
|
-
*/
|
|
97
|
-
export type Port = {
|
|
98
|
-
id: PortId;
|
|
99
|
-
/** Matches the {@link PortDefinition.name} it came from. */
|
|
100
|
-
name: string;
|
|
101
|
-
type: PortType;
|
|
102
|
-
direction: PortDirection;
|
|
103
|
-
/** Input: value when disconnected. Output: optional cache of last computed value. */
|
|
104
|
-
value?: unknown;
|
|
105
|
-
userOnly?: boolean;
|
|
106
|
-
multi?: boolean;
|
|
107
|
-
customProps?: Record<string, unknown>;
|
|
108
|
-
};
|
|
109
|
-
/** Port templates on a definition, keyed by name (authoring-friendly). */
|
|
110
|
-
export type NodeIODefinition = Record<string, PortDefinition>;
|
|
111
|
-
/** Materialized ports on an instance, keyed by id (connection/DOM-friendly). */
|
|
112
|
-
export type NodeIO = Record<PortId, Port>;
|
|
113
|
-
/** Reference to one port on one node. */
|
|
114
|
-
export type PortRef = {
|
|
115
|
-
node: NodeId;
|
|
116
|
-
port: PortId;
|
|
117
|
-
};
|
|
118
|
-
/**
|
|
119
|
-
* Node type template that {@link DefiniteNode} instances are created from. Lives
|
|
120
|
-
* in the runtime registry only (never in a saved graph). Authors ship types via
|
|
121
|
-
* {@link NodePack}.
|
|
122
|
-
*
|
|
123
|
-
* - **Primitive:** implements {@link IndefiniteNode.execute}.
|
|
124
|
-
* - **Composite:** supplies a nested {@link IndefiniteNode.graph} instead of `execute`.
|
|
125
|
-
*/
|
|
126
|
-
export interface IndefiniteNode {
|
|
127
|
-
/** Unique node type id (e.g. `"my-pack/add"`). */
|
|
128
|
-
typeId: NodeTypeId;
|
|
129
|
-
displayName: string;
|
|
130
|
-
color: string;
|
|
131
|
-
description: string;
|
|
132
|
-
/**
|
|
133
|
-
* Hierarchical menu category, broadest first, e.g. `["Math", "Basic Operations"]`.
|
|
134
|
-
* Empty or omitted places the node at the menu root.
|
|
135
|
-
*/
|
|
136
|
-
group?: string[];
|
|
137
|
-
inputs: NodeIODefinition;
|
|
138
|
-
outputs: NodeIODefinition;
|
|
139
|
-
/**
|
|
140
|
-
* Runtime evaluation, keyed by port name (not id). Omit for composite types.
|
|
141
|
-
* @returns Output values keyed by port name.
|
|
142
|
-
*/
|
|
143
|
-
execute?: (inputs: Record<string, unknown>) => Record<string, unknown>;
|
|
144
|
-
/** Nested subgraph for composite types (registry-only, not evaluated standalone). */
|
|
145
|
-
graph?: NodeGraph;
|
|
146
|
-
/**
|
|
147
|
-
* Dynamic port count driven by user-only inputs. When present, static
|
|
148
|
-
* `inputs`/`outputs` are initial defaults; reconciliation re-materializes
|
|
149
|
-
* ports by name so existing ids and connections survive a recount.
|
|
150
|
-
*/
|
|
151
|
-
resolvePorts?: (params: Record<string, unknown>) => {
|
|
152
|
-
inputs: NodeIODefinition;
|
|
153
|
-
outputs: NodeIODefinition;
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* A node placed on the workspace. Serializable data only — behaviour lives on
|
|
158
|
-
* the {@link IndefiniteNode} referenced by {@link DefiniteNode.typeId}.
|
|
159
|
-
*/
|
|
160
|
-
export interface DefiniteNode {
|
|
161
|
-
id: NodeId;
|
|
162
|
-
/** {@link IndefiniteNode} this instance was created from. */
|
|
163
|
-
typeId: NodeTypeId;
|
|
164
|
-
location: NodeLocation;
|
|
165
|
-
inputs: NodeIO;
|
|
166
|
-
outputs: NodeIO;
|
|
167
|
-
label?: string;
|
|
168
|
-
color?: string;
|
|
169
|
-
/** Node width in px. Falls back to layout default when undefined. */
|
|
170
|
-
width?: number;
|
|
171
|
-
/**
|
|
172
|
-
* Stacking order — higher paints on top. Stored for save/load. Undefined until
|
|
173
|
-
* first assigned.
|
|
174
|
-
*/
|
|
175
|
-
z?: number;
|
|
176
|
-
/** Nested graph for composite/group instances. Serializable with the node. */
|
|
177
|
-
composite?: CompositeState;
|
|
178
|
-
}
|
|
179
|
-
/** Serializable nested graph owned by a composite instance. */
|
|
180
|
-
export interface CompositeState {
|
|
181
|
-
graph: NodeGraph;
|
|
182
|
-
interface: GraphInterface;
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Directed wire from an output port to an input port. Stored centrally on the
|
|
186
|
-
* graph so either endpoint can be looked up uniformly.
|
|
187
|
-
*/
|
|
188
|
-
export interface Connection {
|
|
189
|
-
id: ConnectionId;
|
|
190
|
-
/** Must reference an output port. */
|
|
191
|
-
from: PortRef;
|
|
192
|
-
/** Must reference an input port. */
|
|
193
|
-
to: PortRef;
|
|
194
|
-
}
|
|
195
|
-
/** Serializable port template for boundary definitions (object key = port name). */
|
|
196
|
-
export type GraphPortSpec = Omit<PortDefinition, "name">;
|
|
197
|
-
/**
|
|
198
|
-
* External signature of a graph. Parameters become the Input node's output ports;
|
|
199
|
-
* returns become the Output node's input ports.
|
|
200
|
-
*/
|
|
201
|
-
export interface GraphInterface {
|
|
202
|
-
/** Graph inputs (function parameters). Key = port name. */
|
|
203
|
-
parameters?: Record<string, GraphPortSpec>;
|
|
204
|
-
/** Graph outputs (return values). Key = port name. */
|
|
205
|
-
returns?: Record<string, GraphPortSpec>;
|
|
206
|
-
}
|
|
207
|
-
export declare const defaultGraphInterface: GraphInterface;
|
|
208
|
-
/**
|
|
209
|
-
* Placed nodes and connections. Every graph must contain exactly one Input node
|
|
210
|
-
* and one Output node.
|
|
211
|
-
*/
|
|
212
|
-
export interface NodeGraph {
|
|
213
|
-
nodes: DefiniteNode[];
|
|
214
|
-
connections: Connection[];
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* Serializable graph snapshot. Contains no `execute()` implementations or type
|
|
218
|
-
* definitions — custom nodes are resolved at runtime from loaded {@link NodePack}s.
|
|
219
|
-
*/
|
|
220
|
-
export interface GraphDocument {
|
|
221
|
-
graph: NodeGraph;
|
|
222
|
-
interface: GraphInterface;
|
|
223
|
-
/** Pack ids required to interpret this document. See {@link NodeMap.extensions}. */
|
|
224
|
-
extensions?: string[];
|
|
225
|
-
}
|
|
226
|
-
/** Library of available node types, keyed by {@link NodeTypeId}. */
|
|
227
|
-
export type NodeRegistry = Record<NodeTypeId, IndefiniteNode>;
|
|
228
|
-
/** In-memory workspace: serializable graph plus runtime type and node registries. */
|
|
229
|
-
export interface NodeMap {
|
|
230
|
-
graph: NodeGraph;
|
|
231
|
-
types: TypeRegistry;
|
|
232
|
-
nodeTypes: NodeRegistry;
|
|
233
|
-
/** Ids of packs loaded via {@link NodeMap.loadPack}. */
|
|
234
|
-
extensions: string[];
|
|
235
|
-
graphInterface: GraphInterface;
|
|
236
|
-
/**
|
|
237
|
-
* Register types, nodes, and optional widget setup from a pack.
|
|
238
|
-
* @returns Registration errors (empty array on success).
|
|
239
|
-
*/
|
|
240
|
-
loadPack(pack: NodePack): string[];
|
|
241
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { NodeSpec } from '../registry/defineNode';
|
|
2
|
-
import { DefiniteNode, GraphInterface, NodeMap } from '../model';
|
|
3
|
-
/** {@link IndefiniteNode.typeId} for the graph Input (Group Input) boundary node. */
|
|
4
|
-
export declare const INPUT_TYPE = "io/input";
|
|
5
|
-
/** {@link IndefiniteNode.typeId} for the graph Output (Group Output) boundary node. */
|
|
6
|
-
export declare const OUTPUT_TYPE = "io/output";
|
|
7
|
-
export declare const DEFAULT_BOUNDARY_LAYOUT: {
|
|
8
|
-
input: {
|
|
9
|
-
x: number;
|
|
10
|
-
y: number;
|
|
11
|
-
};
|
|
12
|
-
output: {
|
|
13
|
-
x: number;
|
|
14
|
-
y: number;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
export type { GraphInterface } from '../model';
|
|
18
|
-
export { defaultGraphInterface as defaultInterface } from '../model';
|
|
19
|
-
export declare function createIONodes(iface?: GraphInterface): {
|
|
20
|
-
input: NodeSpec;
|
|
21
|
-
output: NodeSpec;
|
|
22
|
-
};
|
|
23
|
-
export declare function applyGraphInterface(map: NodeMap, iface: GraphInterface): void;
|
|
24
|
-
/**
|
|
25
|
-
* Return the single Input and Output nodes on the graph.
|
|
26
|
-
* @throws When the graph does not contain exactly one of each.
|
|
27
|
-
*/
|
|
28
|
-
export declare function boundaryNodes(map: NodeMap): {
|
|
29
|
-
input: DefiniteNode;
|
|
30
|
-
output: DefiniteNode;
|
|
31
|
-
};
|
|
32
|
-
export declare function ensureBoundaryNodes(map: NodeMap, layout?: {
|
|
33
|
-
input: {
|
|
34
|
-
x: number;
|
|
35
|
-
y: number;
|
|
36
|
-
};
|
|
37
|
-
output: {
|
|
38
|
-
x: number;
|
|
39
|
-
y: number;
|
|
40
|
-
};
|
|
41
|
-
}): {
|
|
42
|
-
input: DefiniteNode;
|
|
43
|
-
output: DefiniteNode;
|
|
44
|
-
};
|
|
45
|
-
export declare function updateGraphInterface(map: NodeMap, iface: GraphInterface): string[];
|
|
46
|
-
export declare function validateBoundary(map: NodeMap): string[];
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { GraphPortSpec, IndefiniteNode, NodeGraph, NodeTypeId } from '../model';
|
|
2
|
-
/**
|
|
3
|
-
* Port in a node spec — same as {@link GraphPortSpec}; the name comes from the
|
|
4
|
-
* object key so authors do not repeat it.
|
|
5
|
-
*/
|
|
6
|
-
export type PortSpec = GraphPortSpec;
|
|
7
|
-
/** Input or output port templates keyed by port name. */
|
|
8
|
-
export type IOSpec = Record<string, PortSpec>;
|
|
9
|
-
/**
|
|
10
|
-
* Authoring form of {@link IndefiniteNode.resolvePorts}. Returns ports in
|
|
11
|
-
* {@link IOSpec} shape; normalized when registered via {@link registerNodeTypes}.
|
|
12
|
-
*/
|
|
13
|
-
export type DynamicPortsSpec = (params: Record<string, unknown>) => {
|
|
14
|
-
inputs?: IOSpec;
|
|
15
|
-
outputs?: IOSpec;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Authoring format for a node type. Normalized into a full {@link IndefiniteNode}
|
|
19
|
-
* when registered on a {@link NodeMap} (via {@link NodePack} or
|
|
20
|
-
* {@link registerNodeTypes}).
|
|
21
|
-
*/
|
|
22
|
-
export interface NodeSpec {
|
|
23
|
-
/** Unique node type id (e.g. `"my-pack/add"`). */
|
|
24
|
-
typeId: NodeTypeId;
|
|
25
|
-
displayName: string;
|
|
26
|
-
color?: string;
|
|
27
|
-
description?: string;
|
|
28
|
-
/**
|
|
29
|
-
* Hierarchical menu category, broadest first. See {@link IndefiniteNode.group}.
|
|
30
|
-
*/
|
|
31
|
-
group?: string[];
|
|
32
|
-
inputs?: IOSpec;
|
|
33
|
-
outputs?: IOSpec;
|
|
34
|
-
/**
|
|
35
|
-
* Runtime evaluation, keyed by port name. Omit for composite node packs.
|
|
36
|
-
* @returns Output values keyed by port name.
|
|
37
|
-
*/
|
|
38
|
-
execute?: (inputs: Record<string, unknown>) => Record<string, unknown>;
|
|
39
|
-
/** Nested subgraph for composite types in a published pack. Not evaluated yet. */
|
|
40
|
-
graph?: NodeGraph;
|
|
41
|
-
/**
|
|
42
|
-
* Dynamic port count driven by user-only inputs. Static `inputs`/`outputs`
|
|
43
|
-
* act as initial defaults when present.
|
|
44
|
-
*/
|
|
45
|
-
resolvePorts?: DynamicPortsSpec;
|
|
46
|
-
}
|
|
47
|
-
/** Node types in authoring form, keyed by {@link NodeTypeId}. */
|
|
48
|
-
export type NodeSpecRegistry = Record<NodeTypeId, NodeSpec>;
|
|
49
|
-
/** Expand a {@link NodeSpec} into a runtime {@link IndefiniteNode}. */
|
|
50
|
-
export declare function normalizeNode(spec: NodeSpec): IndefiniteNode;
|