@elicdavis/node-flow 0.2.2 → 0.2.4

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 CHANGED
@@ -156,97 +156,6 @@ interface Box {
156
156
  }
157
157
  declare function InBox(box: Box, position: Vector2): boolean;
158
158
 
159
- declare enum PortType {
160
- Input = "INPUT",
161
- Output = "OUTPUT",
162
- InputArray = "INPUTARRAY"
163
- }
164
- interface PortStyle {
165
- size?: number;
166
- fillColor?: string;
167
- borderColor?: string;
168
- borderSize?: number;
169
- }
170
- type ConnectionChangeCallback = (connection: Connection, connectionIndex: number, port: Port, portType: PortType, node: FlowNode) => void;
171
- interface PortConfig {
172
- name?: string;
173
- type?: string;
174
- description?: string;
175
- array?: boolean;
176
- /**
177
- * Lets this port connect to a port of any type, instead of only to one
178
- * declaring the same `type` string. For a port whose type is decided by
179
- * whatever gets wired into it, where `type` is a placeholder shown to
180
- * the user rather than a promise about the values passing through.
181
- */
182
- anyType?: boolean;
183
- /**
184
- * Every type this port takes, when it takes more than one. For a port
185
- * that works on a single value or an array of them, where `type` is
186
- * only the one it happens to be showing.
187
- *
188
- * An empty or absent list means the port takes exactly its `type`,
189
- * unless `anyType` says otherwise.
190
- */
191
- acceptedTypes?: Array<string>;
192
- /**
193
- * Leaves the port off the node until something is connected to it.
194
- */
195
- hidden?: boolean;
196
- emptyStyle?: PortStyle;
197
- filledStyle?: PortStyle;
198
- onConnectionAdded?: ConnectionChangeCallback;
199
- onConnectionRemoved?: ConnectionChangeCallback;
200
- }
201
- /**
202
- * Whether two ports may be connected, going by their types alone. Each port
203
- * offers the set of types it takes - one entry for an ordinary port, several
204
- * for a port that takes more than one, and none at all for a port that takes
205
- * anything. They connect when those sets overlap.
206
- */
207
- declare function portsCompatible(a: Port | undefined | null, b: Port | undefined | null): boolean;
208
- declare function typeSetsCompatible(a: Array<string>, b: Array<string>): boolean;
209
- declare function portConfigTypes(config: PortConfig): Array<string>;
210
- declare class Port {
211
- #private;
212
- constructor(node: FlowNode, portType: PortType, config?: PortConfig);
213
- setDataType(type: string): void;
214
- setAnyType(anyType: boolean): void;
215
- /**
216
- * Scope accepted types to singular type
217
- */
218
- settleOn(type: string): void;
219
- addConnection(connection: Connection, index?: number): void;
220
- replaceConnection(connection: Connection, index: number): void;
221
- addConnectionAddedListener(callback: ConnectionChangeCallback): void;
222
- connections(): Array<Connection>;
223
- /**
224
- * How many wires the port has room for: one per connection on an array
225
- * input, so each can be told apart and picked up on its own.
226
- */
227
- slots(): number;
228
- setHidden(hidden: boolean): void;
229
- /**
230
- * A port asked to hide still shows while anything is connected to it,
231
- * and while its node is showing its hidden ports.
232
- */
233
- hidden(): boolean;
234
- tucked(): boolean;
235
- addConnectionRemovedListener(callback: ConnectionChangeCallback): void;
236
- clearConnection(connection: Connection): void;
237
- getDataType(): string;
238
- acceptsAnyType(): boolean;
239
- /**
240
- * Every type this port takes. Empty means it takes anything.
241
- */
242
- acceptedTypes(): Array<string>;
243
- setAcceptedTypes(types: Array<string>): void;
244
- getPortType(): PortType;
245
- getDisplayName(): string;
246
- filledStyleColor(): string;
247
- render(ctx: CanvasRenderingContext2D, position: Vector2, camera: Camera, mousePosition: Vector2 | undefined, postProcess: PassSubsystem): Box;
248
- }
249
-
250
159
  /**
251
160
  * Where the pointer is, in canvas pixels, and whether it is over the widget.
252
161
  * A press that starts on a widget keeps reporting to it until it is let go,
@@ -301,17 +210,6 @@ declare abstract class WidgetBase implements Widget {
301
210
  protected onClick(pointer: WidgetPointer): void;
302
211
  }
303
212
 
304
- interface StrokeStyleConfig {
305
- size?: number;
306
- color?: string;
307
- }
308
-
309
- interface BoxStyleConfig {
310
- border?: StrokeStyleConfig;
311
- color?: string;
312
- radius?: number;
313
- }
314
-
315
213
  interface ValueWidgetConfig<T> {
316
214
  /**
317
215
  * A node property the widget shows and edits. Setting the property from
@@ -535,6 +433,134 @@ declare class WidgetFactory {
535
433
  }
536
434
  declare const GlobalWidgetFactory: WidgetFactory;
537
435
 
436
+ declare enum PortType {
437
+ Input = "INPUT",
438
+ Output = "OUTPUT",
439
+ InputArray = "INPUTARRAY"
440
+ }
441
+ interface PortStyle {
442
+ size?: number;
443
+ fillColor?: string;
444
+ borderColor?: string;
445
+ borderSize?: number;
446
+ }
447
+ type ConnectionChangeCallback = (connection: Connection, connectionIndex: number, port: Port, portType: PortType, node: FlowNode) => void;
448
+ interface PortConfig {
449
+ name?: string;
450
+ type?: string;
451
+ description?: string;
452
+ array?: boolean;
453
+ /**
454
+ * Lets this port connect to a port of any type, instead of only to one
455
+ * declaring the same `type` string. For a port whose type is decided by
456
+ * whatever gets wired into it, where `type` is a placeholder shown to
457
+ * the user rather than a promise about the values passing through.
458
+ */
459
+ anyType?: boolean;
460
+ /**
461
+ * Every type this port takes, when it takes more than one. For a port
462
+ * that works on a single value or an array of them, where `type` is
463
+ * only the one it happens to be showing.
464
+ *
465
+ * An empty or absent list means the port takes exactly its `type`,
466
+ * unless `anyType` says otherwise.
467
+ */
468
+ acceptedTypes?: Array<string>;
469
+ /**
470
+ * Leaves the port off the node until something is connected to it.
471
+ */
472
+ hidden?: boolean;
473
+ /**
474
+ * A widget drawn on the port's own row while nothing is connected to
475
+ * it, for a value the port holds on its own. Input ports only.
476
+ */
477
+ widget?: WidgetConfig;
478
+ emptyStyle?: PortStyle;
479
+ filledStyle?: PortStyle;
480
+ onConnectionAdded?: ConnectionChangeCallback;
481
+ onConnectionRemoved?: ConnectionChangeCallback;
482
+ }
483
+ /**
484
+ * Whether two ports may be connected, going by their types alone. Each port
485
+ * offers the set of types it takes - one entry for an ordinary port, several
486
+ * for a port that takes more than one, and none at all for a port that takes
487
+ * anything. They connect when those sets overlap.
488
+ */
489
+ declare function portsCompatible(a: Port | undefined | null, b: Port | undefined | null): boolean;
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`, and only that
493
+ * way round.
494
+ */
495
+ interface Cast {
496
+ from: string;
497
+ to: string;
498
+ }
499
+ /**
500
+ * Whether an output may feed an input: their types overlap, or a cast takes
501
+ * one of the output's types to one of the input's.
502
+ */
503
+ declare function portsConnect(output: Port | undefined | null, input: Port | undefined | null, casts?: Array<Cast>): boolean;
504
+ declare function typeSetsConnect(output: Array<string>, input: Array<string>, casts?: Array<Cast>): boolean;
505
+ declare function portConfigTypes(config: PortConfig): Array<string>;
506
+ declare function portTypeColor(type: string): string;
507
+ declare class Port {
508
+ #private;
509
+ constructor(node: FlowNode, portType: PortType, config?: PortConfig);
510
+ setDataType(type: string): void;
511
+ setAnyType(anyType: boolean): void;
512
+ /**
513
+ * Scope accepted types to singular type
514
+ */
515
+ settleOn(type: string): void;
516
+ addConnection(connection: Connection, index?: number): void;
517
+ replaceConnection(connection: Connection, index: number): void;
518
+ addConnectionAddedListener(callback: ConnectionChangeCallback): void;
519
+ connections(): Array<Connection>;
520
+ /**
521
+ * How many wires the port has room for: one per connection on an array
522
+ * input, so each can be told apart and picked up on its own.
523
+ */
524
+ slots(): number;
525
+ setHidden(hidden: boolean): void;
526
+ setWidget(widget: Widget | null): void;
527
+ widget(): Widget | null;
528
+ /**
529
+ * The widget stands in for a wire, so it leaves once one is connected.
530
+ */
531
+ widgetShown(): boolean;
532
+ /**
533
+ * A port asked to hide still shows while anything is connected to it,
534
+ * and while its node is showing its hidden ports.
535
+ */
536
+ hidden(): boolean;
537
+ tucked(): boolean;
538
+ addConnectionRemovedListener(callback: ConnectionChangeCallback): void;
539
+ clearConnection(connection: Connection): void;
540
+ getDataType(): string;
541
+ acceptsAnyType(): boolean;
542
+ /**
543
+ * Every type this port takes. Empty means it takes anything.
544
+ */
545
+ acceptedTypes(): Array<string>;
546
+ setAcceptedTypes(types: Array<string>): void;
547
+ getPortType(): PortType;
548
+ getDisplayName(): string;
549
+ filledStyleColor(): string;
550
+ render(ctx: CanvasRenderingContext2D, position: Vector2, camera: Camera, mousePosition: Vector2 | undefined, postProcess: PassSubsystem): Box;
551
+ }
552
+
553
+ interface StrokeStyleConfig {
554
+ size?: number;
555
+ color?: string;
556
+ }
557
+
558
+ interface BoxStyleConfig {
559
+ border?: StrokeStyleConfig;
560
+ color?: string;
561
+ radius?: number;
562
+ }
563
+
538
564
  interface Metadata {
539
565
  [name: string]: any;
540
566
  }
@@ -614,6 +640,8 @@ declare class FlowNode {
614
640
  metadata(): any;
615
641
  selected(): boolean;
616
642
  select(): void;
643
+ highlighted(): boolean;
644
+ setHighlighted(highlighted: boolean): void;
617
645
  raiseDragStoppedEvent(): void;
618
646
  addTitleChangeListener(callback: TitleChangeCallback): void;
619
647
  addInfoChangeListener(callback: InfoChangeCallback): void;
@@ -688,6 +716,7 @@ declare class FlowNode {
688
716
 
689
717
  type NodeAddedCallback = (node: FlowNode) => void;
690
718
  type NodeRemovedCallback = (node: FlowNode) => void;
719
+ type NodeHoverCallback = (node: FlowNode | null) => void;
691
720
  /**
692
721
  * A connection between two nodes of a copied set, by their position in that
693
722
  * set rather than by node, so it can be rebuilt against the copies.
@@ -721,15 +750,19 @@ interface ConnectionRendererConfiguration {
721
750
  interface NodeSubsystemConfig {
722
751
  idleConnection?: ConnectionRendererConfiguration;
723
752
  nodes?: NodeFactoryConfig;
753
+ casts?: Array<Cast>;
724
754
  }
725
755
  declare class NodeSubsystem {
726
756
  #private;
727
757
  constructor(postProcessPass: PassSubsystem, config?: NodeSubsystemConfig);
758
+ setCasts(casts: Array<Cast>): void;
759
+ casts(): Array<Cast>;
728
760
  addPublisher(identifier: string, publisher: Publisher): void;
729
761
  addOnNodeCreatedListener(callback: NodeCreatedCallback): void;
730
762
  nodeFactory(): NodeFactory;
731
763
  addOnNodeAddedListener(callback: NodeAddedCallback): void;
732
764
  addOnNodeRemovedListener(callback: NodeRemovedCallback): void;
765
+ addNodeHoverListener(callback: NodeHoverCallback): void;
733
766
  clickStart(mousePosition: Vector2, camera: Camera, ctrlKey: boolean): boolean;
734
767
  mouseDragEvent(delta: Vector2, scale: number): boolean;
735
768
  clearNodeInputConnection(node: FlowNode, index: number): void;
@@ -775,6 +808,7 @@ interface NodeMenuFilter {
775
808
  needs: PortType;
776
809
  /** Types that side has to accept. An empty list takes anything. */
777
810
  types: Array<string>;
811
+ casts?: Array<Cast>;
778
812
  onCreated?: (node: FlowNode) => void;
779
813
  }
780
814
  interface PublisherNodes {
@@ -903,6 +937,7 @@ interface FlowNodeGraphConfiguration {
903
937
  idleConnection?: ConnectionRendererConfiguration;
904
938
  contextMenu?: ContextMenuConfig;
905
939
  nodes?: NodeFactoryConfig;
940
+ casts?: Array<Cast>;
906
941
  board?: NoteSubsystemConfig;
907
942
  minimap?: MinimapConfig;
908
943
  }
@@ -931,6 +966,7 @@ declare class NodeFlowGraph {
931
966
  currentView(): GraphView;
932
967
  organize(): void;
933
968
  addPublisher(identifier: string, publisher: Publisher): void;
969
+ setCasts(casts: Array<Cast>): void;
934
970
  getNodes(): Array<FlowNode>;
935
971
  /**
936
972
  * Returns currently selected nodes in stable graph order (same selection
@@ -969,6 +1005,7 @@ declare class NodeFlowGraph {
969
1005
  addOnNodeCreatedListener(callback: NodeCreatedCallback): void;
970
1006
  addOnNodeAddedListener(callback: NodeAddedCallback): void;
971
1007
  addOnNodeRemovedListener(callback: NodeRemovedCallback): void;
1008
+ addNodeHoverListener(callback: NodeHoverCallback): void;
972
1009
  requestRender(): void;
973
1010
  renderContinuously(): () => void;
974
1011
  dispose(): void;
@@ -998,6 +1035,7 @@ declare const defaults: {
998
1035
  MouseOver: string;
999
1036
  Grabbed: string;
1000
1037
  Selected: string;
1038
+ Highlighted: string;
1001
1039
  };
1002
1040
  Bevel: BevelColors | null;
1003
1041
  Port: {
@@ -1084,6 +1122,7 @@ declare const defaults: {
1084
1122
  H3: {
1085
1123
  FontSize: number;
1086
1124
  };
1125
+ CodeFontFamily: string | null;
1087
1126
  CodeBlock: {
1088
1127
  BackgroundColor: string;
1089
1128
  FontColor: string;
@@ -1155,4 +1194,4 @@ interface InPlaceEdit {
1155
1194
  */
1156
1195
  declare function editInPlace(config: InPlaceEditConfig): InPlaceEdit | null;
1157
1196
 
1158
- 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 };
1197
+ 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
@@ -156,97 +156,6 @@ interface Box {
156
156
  }
157
157
  declare function InBox(box: Box, position: Vector2): boolean;
158
158
 
159
- declare enum PortType {
160
- Input = "INPUT",
161
- Output = "OUTPUT",
162
- InputArray = "INPUTARRAY"
163
- }
164
- interface PortStyle {
165
- size?: number;
166
- fillColor?: string;
167
- borderColor?: string;
168
- borderSize?: number;
169
- }
170
- type ConnectionChangeCallback = (connection: Connection, connectionIndex: number, port: Port, portType: PortType, node: FlowNode) => void;
171
- interface PortConfig {
172
- name?: string;
173
- type?: string;
174
- description?: string;
175
- array?: boolean;
176
- /**
177
- * Lets this port connect to a port of any type, instead of only to one
178
- * declaring the same `type` string. For a port whose type is decided by
179
- * whatever gets wired into it, where `type` is a placeholder shown to
180
- * the user rather than a promise about the values passing through.
181
- */
182
- anyType?: boolean;
183
- /**
184
- * Every type this port takes, when it takes more than one. For a port
185
- * that works on a single value or an array of them, where `type` is
186
- * only the one it happens to be showing.
187
- *
188
- * An empty or absent list means the port takes exactly its `type`,
189
- * unless `anyType` says otherwise.
190
- */
191
- acceptedTypes?: Array<string>;
192
- /**
193
- * Leaves the port off the node until something is connected to it.
194
- */
195
- hidden?: boolean;
196
- emptyStyle?: PortStyle;
197
- filledStyle?: PortStyle;
198
- onConnectionAdded?: ConnectionChangeCallback;
199
- onConnectionRemoved?: ConnectionChangeCallback;
200
- }
201
- /**
202
- * Whether two ports may be connected, going by their types alone. Each port
203
- * offers the set of types it takes - one entry for an ordinary port, several
204
- * for a port that takes more than one, and none at all for a port that takes
205
- * anything. They connect when those sets overlap.
206
- */
207
- declare function portsCompatible(a: Port | undefined | null, b: Port | undefined | null): boolean;
208
- declare function typeSetsCompatible(a: Array<string>, b: Array<string>): boolean;
209
- declare function portConfigTypes(config: PortConfig): Array<string>;
210
- declare class Port {
211
- #private;
212
- constructor(node: FlowNode, portType: PortType, config?: PortConfig);
213
- setDataType(type: string): void;
214
- setAnyType(anyType: boolean): void;
215
- /**
216
- * Scope accepted types to singular type
217
- */
218
- settleOn(type: string): void;
219
- addConnection(connection: Connection, index?: number): void;
220
- replaceConnection(connection: Connection, index: number): void;
221
- addConnectionAddedListener(callback: ConnectionChangeCallback): void;
222
- connections(): Array<Connection>;
223
- /**
224
- * How many wires the port has room for: one per connection on an array
225
- * input, so each can be told apart and picked up on its own.
226
- */
227
- slots(): number;
228
- setHidden(hidden: boolean): void;
229
- /**
230
- * A port asked to hide still shows while anything is connected to it,
231
- * and while its node is showing its hidden ports.
232
- */
233
- hidden(): boolean;
234
- tucked(): boolean;
235
- addConnectionRemovedListener(callback: ConnectionChangeCallback): void;
236
- clearConnection(connection: Connection): void;
237
- getDataType(): string;
238
- acceptsAnyType(): boolean;
239
- /**
240
- * Every type this port takes. Empty means it takes anything.
241
- */
242
- acceptedTypes(): Array<string>;
243
- setAcceptedTypes(types: Array<string>): void;
244
- getPortType(): PortType;
245
- getDisplayName(): string;
246
- filledStyleColor(): string;
247
- render(ctx: CanvasRenderingContext2D, position: Vector2, camera: Camera, mousePosition: Vector2 | undefined, postProcess: PassSubsystem): Box;
248
- }
249
-
250
159
  /**
251
160
  * Where the pointer is, in canvas pixels, and whether it is over the widget.
252
161
  * A press that starts on a widget keeps reporting to it until it is let go,
@@ -301,17 +210,6 @@ declare abstract class WidgetBase implements Widget {
301
210
  protected onClick(pointer: WidgetPointer): void;
302
211
  }
303
212
 
304
- interface StrokeStyleConfig {
305
- size?: number;
306
- color?: string;
307
- }
308
-
309
- interface BoxStyleConfig {
310
- border?: StrokeStyleConfig;
311
- color?: string;
312
- radius?: number;
313
- }
314
-
315
213
  interface ValueWidgetConfig<T> {
316
214
  /**
317
215
  * A node property the widget shows and edits. Setting the property from
@@ -535,6 +433,134 @@ declare class WidgetFactory {
535
433
  }
536
434
  declare const GlobalWidgetFactory: WidgetFactory;
537
435
 
436
+ declare enum PortType {
437
+ Input = "INPUT",
438
+ Output = "OUTPUT",
439
+ InputArray = "INPUTARRAY"
440
+ }
441
+ interface PortStyle {
442
+ size?: number;
443
+ fillColor?: string;
444
+ borderColor?: string;
445
+ borderSize?: number;
446
+ }
447
+ type ConnectionChangeCallback = (connection: Connection, connectionIndex: number, port: Port, portType: PortType, node: FlowNode) => void;
448
+ interface PortConfig {
449
+ name?: string;
450
+ type?: string;
451
+ description?: string;
452
+ array?: boolean;
453
+ /**
454
+ * Lets this port connect to a port of any type, instead of only to one
455
+ * declaring the same `type` string. For a port whose type is decided by
456
+ * whatever gets wired into it, where `type` is a placeholder shown to
457
+ * the user rather than a promise about the values passing through.
458
+ */
459
+ anyType?: boolean;
460
+ /**
461
+ * Every type this port takes, when it takes more than one. For a port
462
+ * that works on a single value or an array of them, where `type` is
463
+ * only the one it happens to be showing.
464
+ *
465
+ * An empty or absent list means the port takes exactly its `type`,
466
+ * unless `anyType` says otherwise.
467
+ */
468
+ acceptedTypes?: Array<string>;
469
+ /**
470
+ * Leaves the port off the node until something is connected to it.
471
+ */
472
+ hidden?: boolean;
473
+ /**
474
+ * A widget drawn on the port's own row while nothing is connected to
475
+ * it, for a value the port holds on its own. Input ports only.
476
+ */
477
+ widget?: WidgetConfig;
478
+ emptyStyle?: PortStyle;
479
+ filledStyle?: PortStyle;
480
+ onConnectionAdded?: ConnectionChangeCallback;
481
+ onConnectionRemoved?: ConnectionChangeCallback;
482
+ }
483
+ /**
484
+ * Whether two ports may be connected, going by their types alone. Each port
485
+ * offers the set of types it takes - one entry for an ordinary port, several
486
+ * for a port that takes more than one, and none at all for a port that takes
487
+ * anything. They connect when those sets overlap.
488
+ */
489
+ declare function portsCompatible(a: Port | undefined | null, b: Port | undefined | null): boolean;
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`, and only that
493
+ * way round.
494
+ */
495
+ interface Cast {
496
+ from: string;
497
+ to: string;
498
+ }
499
+ /**
500
+ * Whether an output may feed an input: their types overlap, or a cast takes
501
+ * one of the output's types to one of the input's.
502
+ */
503
+ declare function portsConnect(output: Port | undefined | null, input: Port | undefined | null, casts?: Array<Cast>): boolean;
504
+ declare function typeSetsConnect(output: Array<string>, input: Array<string>, casts?: Array<Cast>): boolean;
505
+ declare function portConfigTypes(config: PortConfig): Array<string>;
506
+ declare function portTypeColor(type: string): string;
507
+ declare class Port {
508
+ #private;
509
+ constructor(node: FlowNode, portType: PortType, config?: PortConfig);
510
+ setDataType(type: string): void;
511
+ setAnyType(anyType: boolean): void;
512
+ /**
513
+ * Scope accepted types to singular type
514
+ */
515
+ settleOn(type: string): void;
516
+ addConnection(connection: Connection, index?: number): void;
517
+ replaceConnection(connection: Connection, index: number): void;
518
+ addConnectionAddedListener(callback: ConnectionChangeCallback): void;
519
+ connections(): Array<Connection>;
520
+ /**
521
+ * How many wires the port has room for: one per connection on an array
522
+ * input, so each can be told apart and picked up on its own.
523
+ */
524
+ slots(): number;
525
+ setHidden(hidden: boolean): void;
526
+ setWidget(widget: Widget | null): void;
527
+ widget(): Widget | null;
528
+ /**
529
+ * The widget stands in for a wire, so it leaves once one is connected.
530
+ */
531
+ widgetShown(): boolean;
532
+ /**
533
+ * A port asked to hide still shows while anything is connected to it,
534
+ * and while its node is showing its hidden ports.
535
+ */
536
+ hidden(): boolean;
537
+ tucked(): boolean;
538
+ addConnectionRemovedListener(callback: ConnectionChangeCallback): void;
539
+ clearConnection(connection: Connection): void;
540
+ getDataType(): string;
541
+ acceptsAnyType(): boolean;
542
+ /**
543
+ * Every type this port takes. Empty means it takes anything.
544
+ */
545
+ acceptedTypes(): Array<string>;
546
+ setAcceptedTypes(types: Array<string>): void;
547
+ getPortType(): PortType;
548
+ getDisplayName(): string;
549
+ filledStyleColor(): string;
550
+ render(ctx: CanvasRenderingContext2D, position: Vector2, camera: Camera, mousePosition: Vector2 | undefined, postProcess: PassSubsystem): Box;
551
+ }
552
+
553
+ interface StrokeStyleConfig {
554
+ size?: number;
555
+ color?: string;
556
+ }
557
+
558
+ interface BoxStyleConfig {
559
+ border?: StrokeStyleConfig;
560
+ color?: string;
561
+ radius?: number;
562
+ }
563
+
538
564
  interface Metadata {
539
565
  [name: string]: any;
540
566
  }
@@ -614,6 +640,8 @@ declare class FlowNode {
614
640
  metadata(): any;
615
641
  selected(): boolean;
616
642
  select(): void;
643
+ highlighted(): boolean;
644
+ setHighlighted(highlighted: boolean): void;
617
645
  raiseDragStoppedEvent(): void;
618
646
  addTitleChangeListener(callback: TitleChangeCallback): void;
619
647
  addInfoChangeListener(callback: InfoChangeCallback): void;
@@ -688,6 +716,7 @@ declare class FlowNode {
688
716
 
689
717
  type NodeAddedCallback = (node: FlowNode) => void;
690
718
  type NodeRemovedCallback = (node: FlowNode) => void;
719
+ type NodeHoverCallback = (node: FlowNode | null) => void;
691
720
  /**
692
721
  * A connection between two nodes of a copied set, by their position in that
693
722
  * set rather than by node, so it can be rebuilt against the copies.
@@ -721,15 +750,19 @@ interface ConnectionRendererConfiguration {
721
750
  interface NodeSubsystemConfig {
722
751
  idleConnection?: ConnectionRendererConfiguration;
723
752
  nodes?: NodeFactoryConfig;
753
+ casts?: Array<Cast>;
724
754
  }
725
755
  declare class NodeSubsystem {
726
756
  #private;
727
757
  constructor(postProcessPass: PassSubsystem, config?: NodeSubsystemConfig);
758
+ setCasts(casts: Array<Cast>): void;
759
+ casts(): Array<Cast>;
728
760
  addPublisher(identifier: string, publisher: Publisher): void;
729
761
  addOnNodeCreatedListener(callback: NodeCreatedCallback): void;
730
762
  nodeFactory(): NodeFactory;
731
763
  addOnNodeAddedListener(callback: NodeAddedCallback): void;
732
764
  addOnNodeRemovedListener(callback: NodeRemovedCallback): void;
765
+ addNodeHoverListener(callback: NodeHoverCallback): void;
733
766
  clickStart(mousePosition: Vector2, camera: Camera, ctrlKey: boolean): boolean;
734
767
  mouseDragEvent(delta: Vector2, scale: number): boolean;
735
768
  clearNodeInputConnection(node: FlowNode, index: number): void;
@@ -775,6 +808,7 @@ interface NodeMenuFilter {
775
808
  needs: PortType;
776
809
  /** Types that side has to accept. An empty list takes anything. */
777
810
  types: Array<string>;
811
+ casts?: Array<Cast>;
778
812
  onCreated?: (node: FlowNode) => void;
779
813
  }
780
814
  interface PublisherNodes {
@@ -903,6 +937,7 @@ interface FlowNodeGraphConfiguration {
903
937
  idleConnection?: ConnectionRendererConfiguration;
904
938
  contextMenu?: ContextMenuConfig;
905
939
  nodes?: NodeFactoryConfig;
940
+ casts?: Array<Cast>;
906
941
  board?: NoteSubsystemConfig;
907
942
  minimap?: MinimapConfig;
908
943
  }
@@ -931,6 +966,7 @@ declare class NodeFlowGraph {
931
966
  currentView(): GraphView;
932
967
  organize(): void;
933
968
  addPublisher(identifier: string, publisher: Publisher): void;
969
+ setCasts(casts: Array<Cast>): void;
934
970
  getNodes(): Array<FlowNode>;
935
971
  /**
936
972
  * Returns currently selected nodes in stable graph order (same selection
@@ -969,6 +1005,7 @@ declare class NodeFlowGraph {
969
1005
  addOnNodeCreatedListener(callback: NodeCreatedCallback): void;
970
1006
  addOnNodeAddedListener(callback: NodeAddedCallback): void;
971
1007
  addOnNodeRemovedListener(callback: NodeRemovedCallback): void;
1008
+ addNodeHoverListener(callback: NodeHoverCallback): void;
972
1009
  requestRender(): void;
973
1010
  renderContinuously(): () => void;
974
1011
  dispose(): void;
@@ -998,6 +1035,7 @@ declare const defaults: {
998
1035
  MouseOver: string;
999
1036
  Grabbed: string;
1000
1037
  Selected: string;
1038
+ Highlighted: string;
1001
1039
  };
1002
1040
  Bevel: BevelColors | null;
1003
1041
  Port: {
@@ -1084,6 +1122,7 @@ declare const defaults: {
1084
1122
  H3: {
1085
1123
  FontSize: number;
1086
1124
  };
1125
+ CodeFontFamily: string | null;
1087
1126
  CodeBlock: {
1088
1127
  BackgroundColor: string;
1089
1128
  FontColor: string;
@@ -1155,4 +1194,4 @@ interface InPlaceEdit {
1155
1194
  */
1156
1195
  declare function editInPlace(config: InPlaceEditConfig): InPlaceEdit | null;
1157
1196
 
1158
- 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 };
1197
+ 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 };