@elicdavis/node-flow 0.1.12 → 0.1.14
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.mts +29 -2
- package/dist/index.d.ts +29 -2
- package/dist/index.js +332 -95
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +331 -95
- package/dist/index.mjs.map +1 -1
- package/dist/web/NodeFlow.js +4 -4
- package/dist/web/NodeFlow.js.map +3 -3
- package/package.json +1 -1
- package/src/camera.ts +23 -1
- package/src/connection.ts +33 -4
- package/src/contextMenu.ts +35 -3
- package/src/graph.ts +97 -38
- package/src/index.ts +3 -0
- package/src/input.ts +183 -74
- package/src/node.ts +19 -18
- package/src/nodes/subsystem.ts +43 -0
- package/src/theme.ts +1 -0
package/dist/index.d.mts
CHANGED
|
@@ -19,10 +19,21 @@ interface TextStyleConfig {
|
|
|
19
19
|
style?: FontStyle;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
declare enum ContextMenuItemState {
|
|
23
|
+
Enabled = 0,
|
|
24
|
+
Disabled = 1,
|
|
25
|
+
Hidden = 2
|
|
26
|
+
}
|
|
22
27
|
interface ContextMenuItemConfig {
|
|
23
28
|
name?: string;
|
|
24
29
|
textStyle?: TextStyleConfig;
|
|
25
30
|
group?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Evaluated when the menu is opened. Defaults to Enabled when omitted.
|
|
33
|
+
* Hidden items are omitted from the menu; Disabled items are shown muted
|
|
34
|
+
* and are not clickable.
|
|
35
|
+
*/
|
|
36
|
+
enabled?: () => ContextMenuItemState;
|
|
26
37
|
callback?: () => void;
|
|
27
38
|
}
|
|
28
39
|
interface ContextMenuConfig {
|
|
@@ -343,6 +354,11 @@ declare class NodeSubsystem {
|
|
|
343
354
|
clickEnd(): void;
|
|
344
355
|
connectNodes(nodeOut: FlowNode, outPort: number, nodeIn: FlowNode, inPort: number): Connection | undefined;
|
|
345
356
|
getNodes(): Array<FlowNode>;
|
|
357
|
+
/**
|
|
358
|
+
* Returns currently selected nodes in stable graph order (same selection
|
|
359
|
+
* state used by Ctrl+click and box-select styling via FlowNode.selected()).
|
|
360
|
+
*/
|
|
361
|
+
getSelectedNodes(): Array<FlowNode>;
|
|
346
362
|
/**
|
|
347
363
|
* Returns all nodes who are connected to the inputs of the
|
|
348
364
|
* node in question
|
|
@@ -479,11 +495,21 @@ declare class NodeFlowGraph {
|
|
|
479
495
|
addNoteRemovedListener(callback: NoteRemovedCallback): void;
|
|
480
496
|
addNoteDragStartListener(callback: NoteDragStartCallback): void;
|
|
481
497
|
addNoteDragStopListener(callback: NoteDragStopCallback): void;
|
|
482
|
-
zoom(amount: number): void;
|
|
498
|
+
zoom(amount: number, anchor?: Vector2): void;
|
|
483
499
|
currentView(): GraphView;
|
|
484
500
|
organize(): void;
|
|
485
501
|
addPublisher(identifier: string, publisher: Publisher): void;
|
|
486
502
|
getNodes(): Array<FlowNode>;
|
|
503
|
+
/**
|
|
504
|
+
* Returns currently selected nodes in stable graph order (same selection
|
|
505
|
+
* state used by Ctrl+click and box-select styling via FlowNode.selected()).
|
|
506
|
+
*/
|
|
507
|
+
getSelectedNodes(): Array<FlowNode>;
|
|
508
|
+
/**
|
|
509
|
+
* Adjusts camera position and zoom so all nodes fit in view (~10% padding).
|
|
510
|
+
* Falls back to camera.reset() when there are no nodes.
|
|
511
|
+
*/
|
|
512
|
+
centerOnGraph(): void;
|
|
487
513
|
connectedInputsNodeReferences(nodeIndex: number): Array<FlowNode>;
|
|
488
514
|
connectedOutputsNodeReferences(nodeIndex: number): Array<FlowNode>;
|
|
489
515
|
connectNodes(nodeOut: FlowNode, outPort: number, nodeIn: FlowNode, inPort: number): Connection | undefined;
|
|
@@ -557,6 +583,7 @@ declare const Theme: {
|
|
|
557
583
|
BackgroundColor: string;
|
|
558
584
|
HighlightColor: string;
|
|
559
585
|
FontColor: string;
|
|
586
|
+
DisabledFontColor: string;
|
|
560
587
|
};
|
|
561
588
|
Note: {
|
|
562
589
|
FontColor: string;
|
|
@@ -801,4 +828,4 @@ declare class WidgetFactory {
|
|
|
801
828
|
}
|
|
802
829
|
declare const GlobalWidgetFactory: WidgetFactory;
|
|
803
830
|
|
|
804
|
-
export { ButtonWidget, ColorWidget, FlowNode, type FlowNodeConfig, type FlowNodeGraphConfiguration, type FlowNodeStyle, type FlowNodeTitleConfig, FlowNote, type FlowNoteConfig, GlobalWidgetFactory, type GraphRenderer, ImageWidget, MessageType, NodeFlowGraph, type NodeIntersection, type NodeMessageConfig, NodeState, type NoteAddedCallback, type NoteContentChangeCallback, type NoteDragStartCallback, type NoteDragStopCallback, type NoteRemovedCallback, type NoteSubsystemConfig, type NoteWidthChangeCallback, NumberWidget, Publisher, type PublisherConfig, SliderWidget, StringWidget, TextWidget, Theme, ToggleWidget, type WidgetConfig };
|
|
831
|
+
export { ButtonWidget, ColorWidget, type ContextMenuConfig, type ContextMenuItemConfig, ContextMenuItemState, FlowNode, type FlowNodeConfig, type FlowNodeGraphConfiguration, type FlowNodeStyle, type FlowNodeTitleConfig, FlowNote, type FlowNoteConfig, GlobalWidgetFactory, type GraphRenderer, ImageWidget, MessageType, NodeFlowGraph, type NodeIntersection, type NodeMessageConfig, NodeState, type NoteAddedCallback, type NoteContentChangeCallback, type NoteDragStartCallback, type NoteDragStopCallback, type NoteRemovedCallback, type NoteSubsystemConfig, type NoteWidthChangeCallback, NumberWidget, Publisher, type PublisherConfig, SliderWidget, StringWidget, TextWidget, Theme, ToggleWidget, type WidgetConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -19,10 +19,21 @@ interface TextStyleConfig {
|
|
|
19
19
|
style?: FontStyle;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
declare enum ContextMenuItemState {
|
|
23
|
+
Enabled = 0,
|
|
24
|
+
Disabled = 1,
|
|
25
|
+
Hidden = 2
|
|
26
|
+
}
|
|
22
27
|
interface ContextMenuItemConfig {
|
|
23
28
|
name?: string;
|
|
24
29
|
textStyle?: TextStyleConfig;
|
|
25
30
|
group?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Evaluated when the menu is opened. Defaults to Enabled when omitted.
|
|
33
|
+
* Hidden items are omitted from the menu; Disabled items are shown muted
|
|
34
|
+
* and are not clickable.
|
|
35
|
+
*/
|
|
36
|
+
enabled?: () => ContextMenuItemState;
|
|
26
37
|
callback?: () => void;
|
|
27
38
|
}
|
|
28
39
|
interface ContextMenuConfig {
|
|
@@ -343,6 +354,11 @@ declare class NodeSubsystem {
|
|
|
343
354
|
clickEnd(): void;
|
|
344
355
|
connectNodes(nodeOut: FlowNode, outPort: number, nodeIn: FlowNode, inPort: number): Connection | undefined;
|
|
345
356
|
getNodes(): Array<FlowNode>;
|
|
357
|
+
/**
|
|
358
|
+
* Returns currently selected nodes in stable graph order (same selection
|
|
359
|
+
* state used by Ctrl+click and box-select styling via FlowNode.selected()).
|
|
360
|
+
*/
|
|
361
|
+
getSelectedNodes(): Array<FlowNode>;
|
|
346
362
|
/**
|
|
347
363
|
* Returns all nodes who are connected to the inputs of the
|
|
348
364
|
* node in question
|
|
@@ -479,11 +495,21 @@ declare class NodeFlowGraph {
|
|
|
479
495
|
addNoteRemovedListener(callback: NoteRemovedCallback): void;
|
|
480
496
|
addNoteDragStartListener(callback: NoteDragStartCallback): void;
|
|
481
497
|
addNoteDragStopListener(callback: NoteDragStopCallback): void;
|
|
482
|
-
zoom(amount: number): void;
|
|
498
|
+
zoom(amount: number, anchor?: Vector2): void;
|
|
483
499
|
currentView(): GraphView;
|
|
484
500
|
organize(): void;
|
|
485
501
|
addPublisher(identifier: string, publisher: Publisher): void;
|
|
486
502
|
getNodes(): Array<FlowNode>;
|
|
503
|
+
/**
|
|
504
|
+
* Returns currently selected nodes in stable graph order (same selection
|
|
505
|
+
* state used by Ctrl+click and box-select styling via FlowNode.selected()).
|
|
506
|
+
*/
|
|
507
|
+
getSelectedNodes(): Array<FlowNode>;
|
|
508
|
+
/**
|
|
509
|
+
* Adjusts camera position and zoom so all nodes fit in view (~10% padding).
|
|
510
|
+
* Falls back to camera.reset() when there are no nodes.
|
|
511
|
+
*/
|
|
512
|
+
centerOnGraph(): void;
|
|
487
513
|
connectedInputsNodeReferences(nodeIndex: number): Array<FlowNode>;
|
|
488
514
|
connectedOutputsNodeReferences(nodeIndex: number): Array<FlowNode>;
|
|
489
515
|
connectNodes(nodeOut: FlowNode, outPort: number, nodeIn: FlowNode, inPort: number): Connection | undefined;
|
|
@@ -557,6 +583,7 @@ declare const Theme: {
|
|
|
557
583
|
BackgroundColor: string;
|
|
558
584
|
HighlightColor: string;
|
|
559
585
|
FontColor: string;
|
|
586
|
+
DisabledFontColor: string;
|
|
560
587
|
};
|
|
561
588
|
Note: {
|
|
562
589
|
FontColor: string;
|
|
@@ -801,4 +828,4 @@ declare class WidgetFactory {
|
|
|
801
828
|
}
|
|
802
829
|
declare const GlobalWidgetFactory: WidgetFactory;
|
|
803
830
|
|
|
804
|
-
export { ButtonWidget, ColorWidget, FlowNode, type FlowNodeConfig, type FlowNodeGraphConfiguration, type FlowNodeStyle, type FlowNodeTitleConfig, FlowNote, type FlowNoteConfig, GlobalWidgetFactory, type GraphRenderer, ImageWidget, MessageType, NodeFlowGraph, type NodeIntersection, type NodeMessageConfig, NodeState, type NoteAddedCallback, type NoteContentChangeCallback, type NoteDragStartCallback, type NoteDragStopCallback, type NoteRemovedCallback, type NoteSubsystemConfig, type NoteWidthChangeCallback, NumberWidget, Publisher, type PublisherConfig, SliderWidget, StringWidget, TextWidget, Theme, ToggleWidget, type WidgetConfig };
|
|
831
|
+
export { ButtonWidget, ColorWidget, type ContextMenuConfig, type ContextMenuItemConfig, ContextMenuItemState, FlowNode, type FlowNodeConfig, type FlowNodeGraphConfiguration, type FlowNodeStyle, type FlowNodeTitleConfig, FlowNote, type FlowNoteConfig, GlobalWidgetFactory, type GraphRenderer, ImageWidget, MessageType, NodeFlowGraph, type NodeIntersection, type NodeMessageConfig, NodeState, type NoteAddedCallback, type NoteContentChangeCallback, type NoteDragStartCallback, type NoteDragStopCallback, type NoteRemovedCallback, type NoteSubsystemConfig, type NoteWidthChangeCallback, NumberWidget, Publisher, type PublisherConfig, SliderWidget, StringWidget, TextWidget, Theme, ToggleWidget, type WidgetConfig };
|