@nodish/core 0.1.4 → 0.2.1
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/LICENSE +661 -0
- package/dist/{vue.css → index.css} +1 -1
- package/dist/index.d.ts +519 -0
- package/dist/{vue.js → index.js} +608 -600
- package/package.json +13 -14
- 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
|
@@ -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;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { PortTypeDefinition, PortTypeId, TypeWidgetSpec } from '../model';
|
|
2
|
-
/**
|
|
3
|
-
* Authoring format for a data type. {@link defineType} expands this into a full
|
|
4
|
-
* {@link PortTypeDefinition} (default label, color, and widget lifecycle hooks).
|
|
5
|
-
*/
|
|
6
|
-
export interface TypeSpec {
|
|
7
|
-
/** Unique type id (e.g. `"number"`, `"my-pack/label"`). */
|
|
8
|
-
id: PortTypeId;
|
|
9
|
-
label?: string;
|
|
10
|
-
color?: string;
|
|
11
|
-
validate: (value: unknown) => boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Whether an output of type `from` may connect into ports of this type.
|
|
14
|
-
* Omitted means strict identity.
|
|
15
|
-
*/
|
|
16
|
-
accepts?: (from: PortTypeId) => boolean;
|
|
17
|
-
/** Fallback when a port of this type omits its own default. */
|
|
18
|
-
defaultValue?: unknown;
|
|
19
|
-
/** Viewer widget descriptor for ports of this type. */
|
|
20
|
-
widget?: TypeWidgetSpec;
|
|
21
|
-
/** Override default parse behaviour for this type's widget. */
|
|
22
|
-
parse?: (raw: string) => unknown;
|
|
23
|
-
/** Override default format behaviour for this type's widget. */
|
|
24
|
-
format?: (value: unknown) => string;
|
|
25
|
-
/** Override default coerce behaviour for this type's widget. */
|
|
26
|
-
coerce?: (value: unknown) => unknown;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Turn a {@link TypeSpec} into a complete {@link PortTypeDefinition}.
|
|
30
|
-
*/
|
|
31
|
-
export declare function defineType(spec: TypeSpec): PortTypeDefinition;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { IndefiniteNode, NodeRegistry } from '../model';
|
|
2
|
-
export interface NodeGroup {
|
|
3
|
-
name: string;
|
|
4
|
-
path: string[];
|
|
5
|
-
subgroups: NodeGroup[];
|
|
6
|
-
nodes: IndefiniteNode[];
|
|
7
|
-
}
|
|
8
|
-
export declare function buildNodeGroupTree(registry: NodeRegistry, filter?: (node: IndefiniteNode) => boolean): NodeGroup;
|
|
9
|
-
export declare function sortNodeGroupTree(group: NodeGroup): NodeGroup;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { Component } from 'vue';
|
|
2
|
-
import { NodeMap, TypeRegistry } from '../model';
|
|
3
|
-
import { NodeSpecRegistry } from './defineNode';
|
|
4
|
-
/**
|
|
5
|
-
* A publishable bundle of custom types and/or node types (npm package contents).
|
|
6
|
-
* Load onto a {@link NodeMap} with {@link NodeMap.loadPack}.
|
|
7
|
-
*/
|
|
8
|
-
export interface NodePack {
|
|
9
|
-
/** Unique pack id (e.g. `"@my-org/my-pack"`). Recorded in {@link GraphDocument.extensions}. */
|
|
10
|
-
id: string;
|
|
11
|
-
/** Custom {@link PortTypeDefinition}s to register. */
|
|
12
|
-
types?: TypeRegistry;
|
|
13
|
-
/** Custom node definitions to register (authoring form). */
|
|
14
|
-
nodeTypes?: NodeSpecRegistry;
|
|
15
|
-
/**
|
|
16
|
-
* Optional hook to register Vue widgets after types and nodes are merged.
|
|
17
|
-
* Runs once per pack load.
|
|
18
|
-
*/
|
|
19
|
-
setup?: (ctx: PackSetupContext) => void;
|
|
20
|
-
}
|
|
21
|
-
/** Context passed to {@link NodePack.setup} for widget registration. */
|
|
22
|
-
export interface PackSetupContext {
|
|
23
|
-
/**
|
|
24
|
-
* Bind a Vue component to all editable ports of a type id.
|
|
25
|
-
* Overrides the generic widget for that type.
|
|
26
|
-
*/
|
|
27
|
-
registerTypeWidget: (typeId: string, component: Component) => void;
|
|
28
|
-
/**
|
|
29
|
-
* Bind a Vue component to a custom widget id
|
|
30
|
-
* ({@link TypeWidgetSpec} `kind: "custom"`).
|
|
31
|
-
*/
|
|
32
|
-
registerComponentWidget: (componentId: string, component: Component) => void;
|
|
33
|
-
}
|
|
34
|
-
export declare function registerTypes(map: NodeMap, types: TypeRegistry): void;
|
|
35
|
-
/** Merge node specs into the runtime registry, expanding ports and defaults. */
|
|
36
|
-
export declare function registerNodeTypes(map: NodeMap, nodeTypes: NodeSpecRegistry): void;
|
|
37
|
-
export declare function registerNodePack(map: NodeMap, pack: NodePack): void;
|
|
38
|
-
export declare function unregisterNodePack(map: NodeMap, packId: string): void;
|
|
39
|
-
export type { NodeSpecRegistry } from './defineNode';
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { Port, PortTypeDefinition, TypeWidgetSpec } from '../model';
|
|
2
|
-
export declare function effectiveWidget(typeDef: PortTypeDefinition | undefined, port: Port): TypeWidgetSpec | undefined;
|
|
3
|
-
/** Height in px implied by a widget spec (before port.customProps.rowHeight override). */
|
|
4
|
-
export declare function widgetRowHeight(widget: TypeWidgetSpec | undefined, defaultRowH: number): number;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function clonePlain<T>(value: T): T;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { CreateNodeMapInit } from '../store/graph/createNodeMap';
|
|
2
|
-
import { GraphDocument } from '../store/model';
|
|
3
|
-
export type { CreateNodeMapInit, GraphDocument };
|
|
4
|
-
/**
|
|
5
|
-
* Create an in-memory graph workspace with registries, boundary nodes, and
|
|
6
|
-
* {@link NodeMap.loadPack} wired for widget setup.
|
|
7
|
-
*
|
|
8
|
-
* Registers built-in `number`/`string` widgets on first call (for packs that
|
|
9
|
-
* use those conventional type ids).
|
|
10
|
-
*/
|
|
11
|
-
export declare function createNodeMap(init?: CreateNodeMapInit): import('.').NodeMap;
|
package/dist/src/vue/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export { default as NodeViewer } from '../components/NodeViewer.vue';
|
|
2
|
-
export { createNodeMap } from './createNodeMap';
|
|
3
|
-
export type { CreateNodeMapInit } from './createNodeMap';
|
|
4
|
-
export { applyDocument, exportGraph, importGraph, parseGraphDocument, serializeDocument, validateDocument, } from '../store/graph/document';
|
|
5
|
-
export { runGraph, type GraphRunResult, type Values, } from '../store/graph/evaluate';
|
|
6
|
-
export { instantiate } from '../store/graph/instance';
|
|
7
|
-
export { boundaryNodes, INPUT_TYPE, OUTPUT_TYPE } from '../store/nodes/io';
|
|
8
|
-
export { registerComponentWidget, registerDefaultTypeWidgets, registerTypeWidget, } from '../components/types/registerDefaultTypeWidgets';
|
|
9
|
-
export type { Connection, ConnectionId, DefiniteNode, GraphDocument, GraphInterface, IndefiniteNode, NodeGraph, NodeId, NodeMap, NodeRegistry, Port, PortRef, PortTypeDefinition, PortTypeId, TypeRegistry, } from '../store/model';
|
|
10
|
-
export * from '../pack/index';
|