@elicdavis/node-flow 0.2.0 → 0.2.2

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
@@ -227,9 +227,11 @@ declare class Port {
227
227
  slots(): number;
228
228
  setHidden(hidden: boolean): void;
229
229
  /**
230
- * A port asked to hide still shows while anything is connected to it.
230
+ * A port asked to hide still shows while anything is connected to it,
231
+ * and while its node is showing its hidden ports.
231
232
  */
232
233
  hidden(): boolean;
234
+ tucked(): boolean;
233
235
  addConnectionRemovedListener(callback: ConnectionChangeCallback): void;
234
236
  clearConnection(connection: Connection): void;
235
237
  getDataType(): string;
@@ -289,6 +291,7 @@ declare abstract class WidgetBase implements Widget {
289
291
  protected box(): Box;
290
292
  protected canvas(): HTMLCanvasElement | null;
291
293
  protected scale(): number;
294
+ protected editText(value: string, onCommit: (text: string) => void): void;
292
295
  protected onPointerDown(pointer: WidgetPointer): void;
293
296
  protected onPointerMove(pointer: WidgetPointer): void;
294
297
  protected onPointerUp(pointer: WidgetPointer): void;
@@ -643,6 +646,9 @@ declare class FlowNode {
643
646
  calculateBounds(ctx: CanvasRenderingContext2D, camera: Camera): Box;
644
647
  addInput(config: PortConfig): Port;
645
648
  addOutput(config: PortConfig): Port;
649
+ hiddenPortsShown(): boolean;
650
+ setHiddenPortsShown(shown: boolean): void;
651
+ hiddenPortCount(): number;
646
652
  addWidget(widget: Widget): void;
647
653
  insertWidget(index: number, widget: Widget): void;
648
654
  removeWidget(widget: Widget): void;
@@ -1088,7 +1094,7 @@ declare const defaults: {
1088
1094
  };
1089
1095
  type ThemeValues = typeof defaults;
1090
1096
  type DeepPartial<T> = {
1091
- [K in keyof T]?: T[K] extends object | null ? (null extends T[K] ? T[K] : DeepPartial<T[K]>) : T[K];
1097
+ [K in keyof T]?: T[K] extends BevelColors | null ? T[K] : T[K] extends object ? DeepPartial<T[K]> : T[K];
1092
1098
  };
1093
1099
  type ThemeConfig = DeepPartial<ThemeValues>;
1094
1100
  declare const DefaultTheme: Readonly<ThemeValues>;
@@ -1136,10 +1142,17 @@ interface InPlaceEditConfig {
1136
1142
  value: string;
1137
1143
  onCommit: (text: string) => void;
1138
1144
  }
1145
+ interface InPlaceEdit {
1146
+ input: HTMLInputElement;
1147
+ /**
1148
+ * Moves the input over where the widget was just drawn, in canvas pixels.
1149
+ */
1150
+ place(box: Box, scale: number): void;
1151
+ }
1139
1152
  /**
1140
1153
  * Lays a text input over a widget. Enter or clicking away keeps what was
1141
1154
  * typed; Escape throws it away.
1142
1155
  */
1143
- declare function editInPlace(config: InPlaceEditConfig): HTMLInputElement | null;
1156
+ declare function editInPlace(config: InPlaceEditConfig): InPlaceEdit | null;
1144
1157
 
1145
- 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 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 };
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 };
package/dist/index.d.ts CHANGED
@@ -227,9 +227,11 @@ declare class Port {
227
227
  slots(): number;
228
228
  setHidden(hidden: boolean): void;
229
229
  /**
230
- * A port asked to hide still shows while anything is connected to it.
230
+ * A port asked to hide still shows while anything is connected to it,
231
+ * and while its node is showing its hidden ports.
231
232
  */
232
233
  hidden(): boolean;
234
+ tucked(): boolean;
233
235
  addConnectionRemovedListener(callback: ConnectionChangeCallback): void;
234
236
  clearConnection(connection: Connection): void;
235
237
  getDataType(): string;
@@ -289,6 +291,7 @@ declare abstract class WidgetBase implements Widget {
289
291
  protected box(): Box;
290
292
  protected canvas(): HTMLCanvasElement | null;
291
293
  protected scale(): number;
294
+ protected editText(value: string, onCommit: (text: string) => void): void;
292
295
  protected onPointerDown(pointer: WidgetPointer): void;
293
296
  protected onPointerMove(pointer: WidgetPointer): void;
294
297
  protected onPointerUp(pointer: WidgetPointer): void;
@@ -643,6 +646,9 @@ declare class FlowNode {
643
646
  calculateBounds(ctx: CanvasRenderingContext2D, camera: Camera): Box;
644
647
  addInput(config: PortConfig): Port;
645
648
  addOutput(config: PortConfig): Port;
649
+ hiddenPortsShown(): boolean;
650
+ setHiddenPortsShown(shown: boolean): void;
651
+ hiddenPortCount(): number;
646
652
  addWidget(widget: Widget): void;
647
653
  insertWidget(index: number, widget: Widget): void;
648
654
  removeWidget(widget: Widget): void;
@@ -1088,7 +1094,7 @@ declare const defaults: {
1088
1094
  };
1089
1095
  type ThemeValues = typeof defaults;
1090
1096
  type DeepPartial<T> = {
1091
- [K in keyof T]?: T[K] extends object | null ? (null extends T[K] ? T[K] : DeepPartial<T[K]>) : T[K];
1097
+ [K in keyof T]?: T[K] extends BevelColors | null ? T[K] : T[K] extends object ? DeepPartial<T[K]> : T[K];
1092
1098
  };
1093
1099
  type ThemeConfig = DeepPartial<ThemeValues>;
1094
1100
  declare const DefaultTheme: Readonly<ThemeValues>;
@@ -1136,10 +1142,17 @@ interface InPlaceEditConfig {
1136
1142
  value: string;
1137
1143
  onCommit: (text: string) => void;
1138
1144
  }
1145
+ interface InPlaceEdit {
1146
+ input: HTMLInputElement;
1147
+ /**
1148
+ * Moves the input over where the widget was just drawn, in canvas pixels.
1149
+ */
1150
+ place(box: Box, scale: number): void;
1151
+ }
1139
1152
  /**
1140
1153
  * Lays a text input over a widget. Enter or clicking away keeps what was
1141
1154
  * typed; Escape throws it away.
1142
1155
  */
1143
- declare function editInPlace(config: InPlaceEditConfig): HTMLInputElement | null;
1156
+ declare function editInPlace(config: InPlaceEditConfig): InPlaceEdit | null;
1144
1157
 
1145
- 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 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 };
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 };