@elicdavis/node-flow 0.2.3 → 0.2.5
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 +28 -1
- package/dist/index.d.ts +28 -1
- package/dist/index.js +146 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +143 -19
- package/dist/index.mjs.map +1 -1
- package/index.html +2 -1
- package/package.json +1 -1
- package/src/contextMenu.ts +3 -3
- package/src/graph.ts +39 -5
- package/src/index.ts +6 -6
- package/src/input.ts +16 -0
- package/src/markdown/syntaxParser.ts +2 -2
- package/src/node.ts +29 -0
- package/src/nodes/publisher.ts +6 -8
- package/src/nodes/subsystem.ts +43 -5
- package/src/port.ts +31 -0
- package/src/quickMenu.ts +11 -0
- package/src/theme.ts +3 -1
- package/test/markdown.test.ts +11 -0
- package/test/markdown_code_block.test.ts +21 -1
- package/test/mouse_leave.test.ts +70 -0
- package/test/node_hover.test.ts +69 -0
- package/test/node_menu_filter.test.ts +24 -0
- package/test/port.test.ts +49 -1
package/dist/index.d.mts
CHANGED
|
@@ -488,7 +488,21 @@ interface PortConfig {
|
|
|
488
488
|
*/
|
|
489
489
|
declare function portsCompatible(a: Port | undefined | null, b: Port | undefined | null): boolean;
|
|
490
490
|
declare function typeSetsCompatible(a: Array<string>, b: Array<string>): boolean;
|
|
491
|
+
/**
|
|
492
|
+
* Lets an output of type `from` feed an input of type `to`
|
|
493
|
+
*/
|
|
494
|
+
interface Cast {
|
|
495
|
+
from: string;
|
|
496
|
+
to: string;
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Whether an output may feed an input: their types overlap, or a cast takes
|
|
500
|
+
* one of the output's types to one of the input's.
|
|
501
|
+
*/
|
|
502
|
+
declare function portsConnect(output: Port | undefined | null, input: Port | undefined | null, casts?: Array<Cast>): boolean;
|
|
503
|
+
declare function typeSetsConnect(output: Array<string>, input: Array<string>, casts?: Array<Cast>): boolean;
|
|
491
504
|
declare function portConfigTypes(config: PortConfig): Array<string>;
|
|
505
|
+
declare function portTypeColor(type: string): string;
|
|
492
506
|
declare class Port {
|
|
493
507
|
#private;
|
|
494
508
|
constructor(node: FlowNode, portType: PortType, config?: PortConfig);
|
|
@@ -625,6 +639,8 @@ declare class FlowNode {
|
|
|
625
639
|
metadata(): any;
|
|
626
640
|
selected(): boolean;
|
|
627
641
|
select(): void;
|
|
642
|
+
highlighted(): boolean;
|
|
643
|
+
setHighlighted(highlighted: boolean): void;
|
|
628
644
|
raiseDragStoppedEvent(): void;
|
|
629
645
|
addTitleChangeListener(callback: TitleChangeCallback): void;
|
|
630
646
|
addInfoChangeListener(callback: InfoChangeCallback): void;
|
|
@@ -699,6 +715,7 @@ declare class FlowNode {
|
|
|
699
715
|
|
|
700
716
|
type NodeAddedCallback = (node: FlowNode) => void;
|
|
701
717
|
type NodeRemovedCallback = (node: FlowNode) => void;
|
|
718
|
+
type NodeHoverCallback = (node: FlowNode | null) => void;
|
|
702
719
|
/**
|
|
703
720
|
* A connection between two nodes of a copied set, by their position in that
|
|
704
721
|
* set rather than by node, so it can be rebuilt against the copies.
|
|
@@ -732,15 +749,19 @@ interface ConnectionRendererConfiguration {
|
|
|
732
749
|
interface NodeSubsystemConfig {
|
|
733
750
|
idleConnection?: ConnectionRendererConfiguration;
|
|
734
751
|
nodes?: NodeFactoryConfig;
|
|
752
|
+
casts?: Array<Cast>;
|
|
735
753
|
}
|
|
736
754
|
declare class NodeSubsystem {
|
|
737
755
|
#private;
|
|
738
756
|
constructor(postProcessPass: PassSubsystem, config?: NodeSubsystemConfig);
|
|
757
|
+
setCasts(casts: Array<Cast>): void;
|
|
758
|
+
casts(): Array<Cast>;
|
|
739
759
|
addPublisher(identifier: string, publisher: Publisher): void;
|
|
740
760
|
addOnNodeCreatedListener(callback: NodeCreatedCallback): void;
|
|
741
761
|
nodeFactory(): NodeFactory;
|
|
742
762
|
addOnNodeAddedListener(callback: NodeAddedCallback): void;
|
|
743
763
|
addOnNodeRemovedListener(callback: NodeRemovedCallback): void;
|
|
764
|
+
addNodeHoverListener(callback: NodeHoverCallback): void;
|
|
744
765
|
clickStart(mousePosition: Vector2, camera: Camera, ctrlKey: boolean): boolean;
|
|
745
766
|
mouseDragEvent(delta: Vector2, scale: number): boolean;
|
|
746
767
|
clearNodeInputConnection(node: FlowNode, index: number): void;
|
|
@@ -786,6 +807,7 @@ interface NodeMenuFilter {
|
|
|
786
807
|
needs: PortType;
|
|
787
808
|
/** Types that side has to accept. An empty list takes anything. */
|
|
788
809
|
types: Array<string>;
|
|
810
|
+
casts?: Array<Cast>;
|
|
789
811
|
onCreated?: (node: FlowNode) => void;
|
|
790
812
|
}
|
|
791
813
|
interface PublisherNodes {
|
|
@@ -914,6 +936,7 @@ interface FlowNodeGraphConfiguration {
|
|
|
914
936
|
idleConnection?: ConnectionRendererConfiguration;
|
|
915
937
|
contextMenu?: ContextMenuConfig;
|
|
916
938
|
nodes?: NodeFactoryConfig;
|
|
939
|
+
casts?: Array<Cast>;
|
|
917
940
|
board?: NoteSubsystemConfig;
|
|
918
941
|
minimap?: MinimapConfig;
|
|
919
942
|
}
|
|
@@ -942,6 +965,7 @@ declare class NodeFlowGraph {
|
|
|
942
965
|
currentView(): GraphView;
|
|
943
966
|
organize(): void;
|
|
944
967
|
addPublisher(identifier: string, publisher: Publisher): void;
|
|
968
|
+
setCasts(casts: Array<Cast>): void;
|
|
945
969
|
getNodes(): Array<FlowNode>;
|
|
946
970
|
/**
|
|
947
971
|
* Returns currently selected nodes in stable graph order (same selection
|
|
@@ -980,6 +1004,7 @@ declare class NodeFlowGraph {
|
|
|
980
1004
|
addOnNodeCreatedListener(callback: NodeCreatedCallback): void;
|
|
981
1005
|
addOnNodeAddedListener(callback: NodeAddedCallback): void;
|
|
982
1006
|
addOnNodeRemovedListener(callback: NodeRemovedCallback): void;
|
|
1007
|
+
addNodeHoverListener(callback: NodeHoverCallback): void;
|
|
983
1008
|
requestRender(): void;
|
|
984
1009
|
renderContinuously(): () => void;
|
|
985
1010
|
dispose(): void;
|
|
@@ -1009,6 +1034,7 @@ declare const defaults: {
|
|
|
1009
1034
|
MouseOver: string;
|
|
1010
1035
|
Grabbed: string;
|
|
1011
1036
|
Selected: string;
|
|
1037
|
+
Highlighted: string;
|
|
1012
1038
|
};
|
|
1013
1039
|
Bevel: BevelColors | null;
|
|
1014
1040
|
Port: {
|
|
@@ -1095,6 +1121,7 @@ declare const defaults: {
|
|
|
1095
1121
|
H3: {
|
|
1096
1122
|
FontSize: number;
|
|
1097
1123
|
};
|
|
1124
|
+
CodeFontFamily: string | null;
|
|
1098
1125
|
CodeBlock: {
|
|
1099
1126
|
BackgroundColor: string;
|
|
1100
1127
|
FontColor: string;
|
|
@@ -1166,4 +1193,4 @@ interface InPlaceEdit {
|
|
|
1166
1193
|
*/
|
|
1167
1194
|
declare function editInPlace(config: InPlaceEditConfig): InPlaceEdit | null;
|
|
1168
1195
|
|
|
1169
|
-
export { type BevelColors, type Box, ButtonWidget, type ButtonWidgetConfig, type CameraOrientation, ColorWidget, type ColorWidgetConfig, Connection, type ConnectionRenderer, type ConnectionRendererParams, type ContextMenuConfig, type ContextMenuItemConfig, ContextMenuItemState, type CopyCallback, CursorStyle, type DanglingConnection, DefaultConnectionRenderer, DefaultTheme, type FieldLook, FlowNode, type FlowNodeConfig, type FlowNodeGraphConfiguration, type FlowNodeStyle, type FlowNodeTitleConfig, FlowNote, type FlowNoteConfig, GlobalWidgetFactory, type GraphRenderer, GraphView, ImageWidget, type ImageWidgetConfig, InBox, type InPlaceEdit, type InPlaceEditConfig, type InternalConnection, MessageType, Minimap, type MinimapConfig, type NodeCreatedCallback, NodeFactory, type NodeFactoryConfig, NodeFlowGraph, type NodeIntersection, type NodeMenuFilter, type NodeMessageConfig, NodeState, type NoteAddedCallback, type NoteContentChangeCallback, type NoteDragStartCallback, type NoteDragStopCallback, type NoteRemovedCallback, type NoteSubsystemConfig, type NoteWidthChangeCallback, NumberWidget, type NumberWidgetConfig, type PasteCallback, Port, type PortConfig, type PortStyle, PortType, Publisher, type PublisherConfig, RowWidget, type RowWidgetConfig, type RowWidgetFactoryConfig, SliderWidget, type SliderWidgetConfig, StringWidget, type StringWidgetConfig, TextWidget, type TextWidgetConfig, Theme, type ThemeConfig, type ThemeValues, ToggleWidget, type ToggleWidgetConfig, ValueWidget, type ValueWidgetConfig, type Vector2, type Widget, WidgetBase, type WidgetBuilder, type WidgetConfig, type WidgetConfigs, WidgetFactory, type WidgetPointer, type WidgetTypes, drawField, drawFieldBox, drawFieldText, editInPlace, formatNumber, onThemeChange, portConfigTypes, portsCompatible, renderContinuously, requestRender, setTheme, themeVersion, typeSetsCompatible, widgetFont };
|
|
1196
|
+
export { type BevelColors, type Box, ButtonWidget, type ButtonWidgetConfig, type CameraOrientation, type Cast, ColorWidget, type ColorWidgetConfig, Connection, type ConnectionRenderer, type ConnectionRendererParams, type ContextMenuConfig, type ContextMenuItemConfig, ContextMenuItemState, type CopyCallback, CursorStyle, type DanglingConnection, DefaultConnectionRenderer, DefaultTheme, type FieldLook, FlowNode, type FlowNodeConfig, type FlowNodeGraphConfiguration, type FlowNodeStyle, type FlowNodeTitleConfig, FlowNote, type FlowNoteConfig, GlobalWidgetFactory, type GraphRenderer, GraphView, ImageWidget, type ImageWidgetConfig, InBox, type InPlaceEdit, type InPlaceEditConfig, type InternalConnection, MessageType, Minimap, type MinimapConfig, type NodeCreatedCallback, NodeFactory, type NodeFactoryConfig, NodeFlowGraph, type NodeHoverCallback, type NodeIntersection, type NodeMenuFilter, type NodeMessageConfig, NodeState, type NoteAddedCallback, type NoteContentChangeCallback, type NoteDragStartCallback, type NoteDragStopCallback, type NoteRemovedCallback, type NoteSubsystemConfig, type NoteWidthChangeCallback, NumberWidget, type NumberWidgetConfig, type PasteCallback, Port, type PortConfig, type PortStyle, PortType, Publisher, type PublisherConfig, RowWidget, type RowWidgetConfig, type RowWidgetFactoryConfig, SliderWidget, type SliderWidgetConfig, StringWidget, type StringWidgetConfig, TextWidget, type TextWidgetConfig, Theme, type ThemeConfig, type ThemeValues, ToggleWidget, type ToggleWidgetConfig, ValueWidget, type ValueWidgetConfig, type Vector2, type Widget, WidgetBase, type WidgetBuilder, type WidgetConfig, type WidgetConfigs, WidgetFactory, type WidgetPointer, type WidgetTypes, drawField, drawFieldBox, drawFieldText, editInPlace, formatNumber, onThemeChange, portConfigTypes, portTypeColor, portsCompatible, portsConnect, renderContinuously, requestRender, setTheme, themeVersion, typeSetsCompatible, typeSetsConnect, widgetFont };
|
package/dist/index.d.ts
CHANGED
|
@@ -488,7 +488,21 @@ interface PortConfig {
|
|
|
488
488
|
*/
|
|
489
489
|
declare function portsCompatible(a: Port | undefined | null, b: Port | undefined | null): boolean;
|
|
490
490
|
declare function typeSetsCompatible(a: Array<string>, b: Array<string>): boolean;
|
|
491
|
+
/**
|
|
492
|
+
* Lets an output of type `from` feed an input of type `to`
|
|
493
|
+
*/
|
|
494
|
+
interface Cast {
|
|
495
|
+
from: string;
|
|
496
|
+
to: string;
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Whether an output may feed an input: their types overlap, or a cast takes
|
|
500
|
+
* one of the output's types to one of the input's.
|
|
501
|
+
*/
|
|
502
|
+
declare function portsConnect(output: Port | undefined | null, input: Port | undefined | null, casts?: Array<Cast>): boolean;
|
|
503
|
+
declare function typeSetsConnect(output: Array<string>, input: Array<string>, casts?: Array<Cast>): boolean;
|
|
491
504
|
declare function portConfigTypes(config: PortConfig): Array<string>;
|
|
505
|
+
declare function portTypeColor(type: string): string;
|
|
492
506
|
declare class Port {
|
|
493
507
|
#private;
|
|
494
508
|
constructor(node: FlowNode, portType: PortType, config?: PortConfig);
|
|
@@ -625,6 +639,8 @@ declare class FlowNode {
|
|
|
625
639
|
metadata(): any;
|
|
626
640
|
selected(): boolean;
|
|
627
641
|
select(): void;
|
|
642
|
+
highlighted(): boolean;
|
|
643
|
+
setHighlighted(highlighted: boolean): void;
|
|
628
644
|
raiseDragStoppedEvent(): void;
|
|
629
645
|
addTitleChangeListener(callback: TitleChangeCallback): void;
|
|
630
646
|
addInfoChangeListener(callback: InfoChangeCallback): void;
|
|
@@ -699,6 +715,7 @@ declare class FlowNode {
|
|
|
699
715
|
|
|
700
716
|
type NodeAddedCallback = (node: FlowNode) => void;
|
|
701
717
|
type NodeRemovedCallback = (node: FlowNode) => void;
|
|
718
|
+
type NodeHoverCallback = (node: FlowNode | null) => void;
|
|
702
719
|
/**
|
|
703
720
|
* A connection between two nodes of a copied set, by their position in that
|
|
704
721
|
* set rather than by node, so it can be rebuilt against the copies.
|
|
@@ -732,15 +749,19 @@ interface ConnectionRendererConfiguration {
|
|
|
732
749
|
interface NodeSubsystemConfig {
|
|
733
750
|
idleConnection?: ConnectionRendererConfiguration;
|
|
734
751
|
nodes?: NodeFactoryConfig;
|
|
752
|
+
casts?: Array<Cast>;
|
|
735
753
|
}
|
|
736
754
|
declare class NodeSubsystem {
|
|
737
755
|
#private;
|
|
738
756
|
constructor(postProcessPass: PassSubsystem, config?: NodeSubsystemConfig);
|
|
757
|
+
setCasts(casts: Array<Cast>): void;
|
|
758
|
+
casts(): Array<Cast>;
|
|
739
759
|
addPublisher(identifier: string, publisher: Publisher): void;
|
|
740
760
|
addOnNodeCreatedListener(callback: NodeCreatedCallback): void;
|
|
741
761
|
nodeFactory(): NodeFactory;
|
|
742
762
|
addOnNodeAddedListener(callback: NodeAddedCallback): void;
|
|
743
763
|
addOnNodeRemovedListener(callback: NodeRemovedCallback): void;
|
|
764
|
+
addNodeHoverListener(callback: NodeHoverCallback): void;
|
|
744
765
|
clickStart(mousePosition: Vector2, camera: Camera, ctrlKey: boolean): boolean;
|
|
745
766
|
mouseDragEvent(delta: Vector2, scale: number): boolean;
|
|
746
767
|
clearNodeInputConnection(node: FlowNode, index: number): void;
|
|
@@ -786,6 +807,7 @@ interface NodeMenuFilter {
|
|
|
786
807
|
needs: PortType;
|
|
787
808
|
/** Types that side has to accept. An empty list takes anything. */
|
|
788
809
|
types: Array<string>;
|
|
810
|
+
casts?: Array<Cast>;
|
|
789
811
|
onCreated?: (node: FlowNode) => void;
|
|
790
812
|
}
|
|
791
813
|
interface PublisherNodes {
|
|
@@ -914,6 +936,7 @@ interface FlowNodeGraphConfiguration {
|
|
|
914
936
|
idleConnection?: ConnectionRendererConfiguration;
|
|
915
937
|
contextMenu?: ContextMenuConfig;
|
|
916
938
|
nodes?: NodeFactoryConfig;
|
|
939
|
+
casts?: Array<Cast>;
|
|
917
940
|
board?: NoteSubsystemConfig;
|
|
918
941
|
minimap?: MinimapConfig;
|
|
919
942
|
}
|
|
@@ -942,6 +965,7 @@ declare class NodeFlowGraph {
|
|
|
942
965
|
currentView(): GraphView;
|
|
943
966
|
organize(): void;
|
|
944
967
|
addPublisher(identifier: string, publisher: Publisher): void;
|
|
968
|
+
setCasts(casts: Array<Cast>): void;
|
|
945
969
|
getNodes(): Array<FlowNode>;
|
|
946
970
|
/**
|
|
947
971
|
* Returns currently selected nodes in stable graph order (same selection
|
|
@@ -980,6 +1004,7 @@ declare class NodeFlowGraph {
|
|
|
980
1004
|
addOnNodeCreatedListener(callback: NodeCreatedCallback): void;
|
|
981
1005
|
addOnNodeAddedListener(callback: NodeAddedCallback): void;
|
|
982
1006
|
addOnNodeRemovedListener(callback: NodeRemovedCallback): void;
|
|
1007
|
+
addNodeHoverListener(callback: NodeHoverCallback): void;
|
|
983
1008
|
requestRender(): void;
|
|
984
1009
|
renderContinuously(): () => void;
|
|
985
1010
|
dispose(): void;
|
|
@@ -1009,6 +1034,7 @@ declare const defaults: {
|
|
|
1009
1034
|
MouseOver: string;
|
|
1010
1035
|
Grabbed: string;
|
|
1011
1036
|
Selected: string;
|
|
1037
|
+
Highlighted: string;
|
|
1012
1038
|
};
|
|
1013
1039
|
Bevel: BevelColors | null;
|
|
1014
1040
|
Port: {
|
|
@@ -1095,6 +1121,7 @@ declare const defaults: {
|
|
|
1095
1121
|
H3: {
|
|
1096
1122
|
FontSize: number;
|
|
1097
1123
|
};
|
|
1124
|
+
CodeFontFamily: string | null;
|
|
1098
1125
|
CodeBlock: {
|
|
1099
1126
|
BackgroundColor: string;
|
|
1100
1127
|
FontColor: string;
|
|
@@ -1166,4 +1193,4 @@ interface InPlaceEdit {
|
|
|
1166
1193
|
*/
|
|
1167
1194
|
declare function editInPlace(config: InPlaceEditConfig): InPlaceEdit | null;
|
|
1168
1195
|
|
|
1169
|
-
export { type BevelColors, type Box, ButtonWidget, type ButtonWidgetConfig, type CameraOrientation, ColorWidget, type ColorWidgetConfig, Connection, type ConnectionRenderer, type ConnectionRendererParams, type ContextMenuConfig, type ContextMenuItemConfig, ContextMenuItemState, type CopyCallback, CursorStyle, type DanglingConnection, DefaultConnectionRenderer, DefaultTheme, type FieldLook, FlowNode, type FlowNodeConfig, type FlowNodeGraphConfiguration, type FlowNodeStyle, type FlowNodeTitleConfig, FlowNote, type FlowNoteConfig, GlobalWidgetFactory, type GraphRenderer, GraphView, ImageWidget, type ImageWidgetConfig, InBox, type InPlaceEdit, type InPlaceEditConfig, type InternalConnection, MessageType, Minimap, type MinimapConfig, type NodeCreatedCallback, NodeFactory, type NodeFactoryConfig, NodeFlowGraph, type NodeIntersection, type NodeMenuFilter, type NodeMessageConfig, NodeState, type NoteAddedCallback, type NoteContentChangeCallback, type NoteDragStartCallback, type NoteDragStopCallback, type NoteRemovedCallback, type NoteSubsystemConfig, type NoteWidthChangeCallback, NumberWidget, type NumberWidgetConfig, type PasteCallback, Port, type PortConfig, type PortStyle, PortType, Publisher, type PublisherConfig, RowWidget, type RowWidgetConfig, type RowWidgetFactoryConfig, SliderWidget, type SliderWidgetConfig, StringWidget, type StringWidgetConfig, TextWidget, type TextWidgetConfig, Theme, type ThemeConfig, type ThemeValues, ToggleWidget, type ToggleWidgetConfig, ValueWidget, type ValueWidgetConfig, type Vector2, type Widget, WidgetBase, type WidgetBuilder, type WidgetConfig, type WidgetConfigs, WidgetFactory, type WidgetPointer, type WidgetTypes, drawField, drawFieldBox, drawFieldText, editInPlace, formatNumber, onThemeChange, portConfigTypes, portsCompatible, renderContinuously, requestRender, setTheme, themeVersion, typeSetsCompatible, widgetFont };
|
|
1196
|
+
export { type BevelColors, type Box, ButtonWidget, type ButtonWidgetConfig, type CameraOrientation, type Cast, ColorWidget, type ColorWidgetConfig, Connection, type ConnectionRenderer, type ConnectionRendererParams, type ContextMenuConfig, type ContextMenuItemConfig, ContextMenuItemState, type CopyCallback, CursorStyle, type DanglingConnection, DefaultConnectionRenderer, DefaultTheme, type FieldLook, FlowNode, type FlowNodeConfig, type FlowNodeGraphConfiguration, type FlowNodeStyle, type FlowNodeTitleConfig, FlowNote, type FlowNoteConfig, GlobalWidgetFactory, type GraphRenderer, GraphView, ImageWidget, type ImageWidgetConfig, InBox, type InPlaceEdit, type InPlaceEditConfig, type InternalConnection, MessageType, Minimap, type MinimapConfig, type NodeCreatedCallback, NodeFactory, type NodeFactoryConfig, NodeFlowGraph, type NodeHoverCallback, type NodeIntersection, type NodeMenuFilter, type NodeMessageConfig, NodeState, type NoteAddedCallback, type NoteContentChangeCallback, type NoteDragStartCallback, type NoteDragStopCallback, type NoteRemovedCallback, type NoteSubsystemConfig, type NoteWidthChangeCallback, NumberWidget, type NumberWidgetConfig, type PasteCallback, Port, type PortConfig, type PortStyle, PortType, Publisher, type PublisherConfig, RowWidget, type RowWidgetConfig, type RowWidgetFactoryConfig, SliderWidget, type SliderWidgetConfig, StringWidget, type StringWidgetConfig, TextWidget, type TextWidgetConfig, Theme, type ThemeConfig, type ThemeValues, ToggleWidget, type ToggleWidgetConfig, ValueWidget, type ValueWidgetConfig, type Vector2, type Widget, WidgetBase, type WidgetBuilder, type WidgetConfig, type WidgetConfigs, WidgetFactory, type WidgetPointer, type WidgetTypes, drawField, drawFieldBox, drawFieldText, editInPlace, formatNumber, onThemeChange, portConfigTypes, portTypeColor, portsCompatible, portsConnect, renderContinuously, requestRender, setTheme, themeVersion, typeSetsCompatible, typeSetsConnect, widgetFont };
|