@comfyorg/comfyui-frontend-types 1.28.3 → 1.28.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.
Files changed (2) hide show
  1. package/index.d.ts +134 -79
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -29,6 +29,7 @@ import { RunningTaskItem } from '../schemas/apiSchema';
29
29
  import { Settings } from '../schemas/apiSchema';
30
30
  import { Settings as Settings_2 } from '../../schemas/apiSchema';
31
31
  import { Settings as Settings_3 } from '../../../schemas/apiSchema';
32
+ import { ShallowRef } from 'vue';
32
33
  import { StatusWsMessage } from '../schemas/apiSchema';
33
34
  import { StatusWsMessageStatus } from '../schemas/apiSchema';
34
35
  import { SystemStats } from '../schemas/apiSchema';
@@ -69,9 +70,6 @@ declare type ApiToEventType<T = ApiCalls> = {
69
70
  [K in keyof T]: K extends 'status' ? StatusWsMessageStatus : K extends 'executing' ? NodeId_2 : T[K];
70
71
  };
71
72
 
72
- /** A very firm array */
73
- declare type ArRect = [x: number, y: number, width: number, height: number];
74
-
75
73
  /** Wraps all properties in {@link CustomEvent}. */
76
74
  declare type AsCustomEvents<T> = {
77
75
  readonly [K in keyof T]: CustomEvent<T[K]>;
@@ -258,6 +256,7 @@ declare abstract class BaseWidget<TWidget extends IBaseWidget = IBaseWidget> imp
258
256
  computedDisabled?: boolean;
259
257
  hidden?: boolean;
260
258
  advanced?: boolean;
259
+ promoted?: boolean;
261
260
  tooltip?: string;
262
261
  element?: HTMLElement;
263
262
  callback?(value: any, canvas?: LGraphCanvas, node?: LGraphNode, pos?: Point, e?: CanvasPointerEvent): void;
@@ -971,7 +970,14 @@ export declare class ComfyApi extends EventTarget {
971
970
  }
972
971
 
973
972
  export declare class ComfyApp {
974
- #private;
973
+ /**
974
+ * List of entries to queue
975
+ */
976
+ private queueItems;
977
+ /**
978
+ * If the queue is currently being processed
979
+ */
980
+ private processingQueue;
975
981
  /**
976
982
  * Content Clipboard
977
983
  * @type {serialized node object}
@@ -987,10 +993,15 @@ export declare class ComfyApp {
987
993
  extensionManager: ExtensionManager;
988
994
  _nodeOutputs: Record<string, any>;
989
995
  nodePreviewImages: Record<string, string[]>;
996
+ private rootGraphInternal;
997
+ /** @deprecated Use {@link rootGraph} instead */
990
998
  get graph(): LGraph;
999
+ get rootGraph(): LGraph | undefined;
991
1000
  canvas: LGraphCanvas;
992
1001
  dragOverNode: LGraphNode | null;
993
- canvasEl: HTMLCanvasElement;
1002
+ readonly canvasElRef: ShallowRef<HTMLCanvasElement | undefined, HTMLCanvasElement | undefined>;
1003
+ get canvasEl(): HTMLCanvasElement;
1004
+ private configuringGraphLevel;
994
1005
  get configuringGraph(): boolean;
995
1006
  ctx: CanvasRenderingContext2D;
996
1007
  bodyTop: HTMLElement;
@@ -1001,6 +1012,7 @@ export declare class ComfyApp {
1001
1012
  menu: ComfyAppMenu;
1002
1013
  bypassBgColor: string;
1003
1014
  openClipspace: () => void;
1015
+ private positionConversion?;
1004
1016
  /**
1005
1017
  * The node errors from the previous execution.
1006
1018
  * @deprecated Use useExecutionStore().lastNodeErrors instead
@@ -1074,12 +1086,29 @@ export declare class ComfyApp {
1074
1086
  static onClipspaceEditorClosed(): void;
1075
1087
  static copyToClipspace(node: LGraphNode): void;
1076
1088
  static pasteFromClipspace(node: LGraphNode): void;
1089
+ /**
1090
+ * Adds a handler allowing drag+drop of files onto the window to load workflows
1091
+ */
1092
+ private addDropHandler;
1093
+ /**
1094
+ * Handle keypress
1095
+ */
1096
+ private addProcessKeyHandler;
1097
+ private addDrawNodeHandler;
1098
+ /**
1099
+ * Handles updates from the API socket
1100
+ */
1101
+ private addApiUpdateHandlers;
1102
+ /** Flag that the graph is configuring to prevent nodes from running checks while its still loading */
1103
+ private addConfigureHandler;
1104
+ private addAfterConfigureHandler;
1077
1105
  /**
1078
1106
  * Set up the app on the page
1079
1107
  */
1080
1108
  setup(canvasEl: HTMLCanvasElement): Promise<void>;
1081
- resizeCanvas(): void;
1109
+ private resizeCanvas;
1082
1110
  private updateVueAppNodeDefs;
1111
+ getNodeDefs(): Promise<Record<string, ComfyNodeDef>>;
1083
1112
  /**
1084
1113
  * Registers nodes with the graph
1085
1114
  */
@@ -1087,6 +1116,8 @@ export declare class ComfyApp {
1087
1116
  registerNodeDef(nodeId: string, nodeDef: ComfyNodeDef): Promise<void>;
1088
1117
  registerNodesFromDefs(defs: Record<string, ComfyNodeDef>): Promise<void>;
1089
1118
  loadTemplateData(templateData: any): void;
1119
+ private showMissingNodesError;
1120
+ private showMissingModelsError;
1090
1121
  loadGraphData(graphData?: ComfyWorkflowJSON, clean?: boolean, restore_view?: boolean, workflow?: string | null | ComfyWorkflow, { showMissingNodesDialog, showMissingModelsDialog, checkForRerouteMigration }?: {
1091
1122
  showMissingNodesDialog?: boolean | undefined;
1092
1123
  showMissingModelsDialog?: boolean | undefined;
@@ -1544,9 +1575,9 @@ export declare class ComfyApp {
1544
1575
  get desiredHeight(): number;
1545
1576
  set desiredHeight(value: number);
1546
1577
  constructor(width: number, height: number);
1547
- static fromSize(size: ReadOnlySize): ConstrainedSize;
1578
+ static fromSize(size: Readonly<Size>): ConstrainedSize;
1548
1579
  static fromRect(rect: ReadOnlyRect): ConstrainedSize;
1549
- setSize(size: ReadOnlySize): void;
1580
+ setSize(size: Readonly<Size>): void;
1550
1581
  setValues(width: number, height: number): void;
1551
1582
  toSize(): Size;
1552
1583
  }
@@ -1731,7 +1762,7 @@ export declare class ComfyApp {
1731
1762
  * @param b Point b as `x, y`
1732
1763
  * @returns Distance between point {@link a} & {@link b}
1733
1764
  */
1734
- declare function distance(a: ReadOnlyPoint, b: ReadOnlyPoint): number;
1765
+ declare function distance(a: Readonly<Point>, b: Readonly<Point>): number;
1735
1766
 
1736
1767
  /**
1737
1768
  * A DOM widget that wraps a custom HTML element as a litegraph widget.
@@ -1919,7 +1950,7 @@ export declare class ComfyApp {
1919
1950
  readonly subgraphNodePath: readonly NodeId[];
1920
1951
  /** A flattened map of all DTOs in this node network. Subgraph instances have been expanded into their inner nodes. */
1921
1952
  readonly nodesByExecutionId: Map<ExecutionId, ExecutableLGraphNode>;
1922
- /** The actual subgraph instance that contains this node, otherise undefined. */
1953
+ /** The actual subgraph instance that contains this node, otherwise undefined. */
1923
1954
  readonly subgraphNode?: SubgraphNode | undefined;
1924
1955
  applyToGraph?(...args: CallbackParams<typeof ExecutableNodeDTO.node.applyToGraph>): CallbackReturn<typeof ExecutableNodeDTO.node.applyToGraph>;
1925
1956
  /** The graph that this node is a part of. */
@@ -1930,7 +1961,7 @@ export declare class ComfyApp {
1930
1961
  type: ISlotType;
1931
1962
  }[];
1932
1963
  /**
1933
- * The path to the acutal node through subgraph instances, represented as a list of all subgraph node IDs (instances),
1964
+ * The path to the actual node through subgraph instances, represented as a list of all subgraph node IDs (instances),
1934
1965
  * followed by the actual original node ID within the subgraph. Each segment is separated by `:`.
1935
1966
  *
1936
1967
  * e.g. `1:2:3`:
@@ -1953,7 +1984,7 @@ export declare class ComfyApp {
1953
1984
  subgraphNodePath: readonly NodeId[],
1954
1985
  /** A flattened map of all DTOs in this node network. Subgraph instances have been expanded into their inner nodes. */
1955
1986
  nodesByExecutionId: Map<ExecutionId, ExecutableLGraphNode>,
1956
- /** The actual subgraph instance that contains this node, otherise undefined. */
1987
+ /** The actual subgraph instance that contains this node, otherwise undefined. */
1957
1988
  subgraphNode?: SubgraphNode | undefined);
1958
1989
  /** Returns either the DTO itself, or the DTOs of the inner nodes of the subgraph. */
1959
1990
  getInnerNodes(): ExecutableLGraphNode[];
@@ -2180,6 +2211,7 @@ export declare class ComfyApp {
2180
2211
  * @see IWidget
2181
2212
  */
2182
2213
  declare interface IBaseWidget<TValue = boolean | number | string | object | undefined, TType extends string = string, TOptions extends IWidgetOptions<unknown> = IWidgetOptions<unknown>> {
2214
+ [symbol: symbol]: boolean;
2183
2215
  linkedWidgets?: IBaseWidget[];
2184
2216
  name: string;
2185
2217
  options: TOptions;
@@ -2224,6 +2256,13 @@ export declare class ComfyApp {
2224
2256
  computedDisabled?: boolean;
2225
2257
  hidden?: boolean;
2226
2258
  advanced?: boolean;
2259
+ /**
2260
+ * This property is automatically computed on graph change
2261
+ * and should not be changed.
2262
+ * Promoted widgets have a colored border
2263
+ * @see /core/graph/subgraph/proxyWidget.registerProxyWidgets
2264
+ */
2265
+ promoted?: boolean;
2227
2266
  tooltip?: string;
2228
2267
  callback?(value: any, canvas?: LGraphCanvas, node?: LGraphNode, pos?: Point, e?: CanvasPointerEvent): void;
2229
2268
  /**
@@ -2596,7 +2635,7 @@ export declare class ComfyApp {
2596
2635
  nameLocked?: boolean;
2597
2636
  pos?: Point;
2598
2637
  /** @remarks Automatically calculated; not included in serialisation. */
2599
- boundingRect: Rect;
2638
+ boundingRect: ReadOnlyRect;
2600
2639
  /**
2601
2640
  * A list of floating link IDs that are connected to this slot.
2602
2641
  * This is calculated at runtime; it is **not** serialized.
@@ -2909,6 +2948,8 @@ export declare class ComfyApp {
2909
2948
  property?: string;
2910
2949
  /** If `true`, an input socket will not be created for this widget. */
2911
2950
  socketless?: boolean;
2951
+ /** If `true`, the widget will not be rendered by the Vue renderer. */
2952
+ canvasOnly?: boolean;
2912
2953
  values?: TValues;
2913
2954
  callback?: IWidget['callback'];
2914
2955
  }
@@ -3217,7 +3258,7 @@ export declare class ComfyApp {
3217
3258
  /**
3218
3259
  * Snaps the provided items to a grid.
3219
3260
  *
3220
- * Item positions are reounded to the nearest multiple of {@link LiteGraph.CANVAS_GRID_SIZE}.
3261
+ * Item positions are rounded to the nearest multiple of {@link LiteGraph.CANVAS_GRID_SIZE}.
3221
3262
  *
3222
3263
  * When {@link LiteGraph.alwaysSnapToGrid} is enabled
3223
3264
  * and the grid size is falsy, a default of 1 is used.
@@ -3512,7 +3553,7 @@ export declare class ComfyApp {
3512
3553
  linkMarkerShape: LinkMarkerShape;
3513
3554
  links_render_mode: number;
3514
3555
  /** Minimum font size in pixels before switching to low quality rendering.
3515
- * This intializes first and if we cant get the value from the settings we default to 8px
3556
+ * This initializes first and if we can't get the value from the settings we default to 8px
3516
3557
  */
3517
3558
  private _min_font_size_for_lod;
3518
3559
  get min_font_size_for_lod(): number;
@@ -3576,7 +3617,7 @@ export declare class ComfyApp {
3576
3617
  dirty_area?: Rect | null;
3577
3618
  /** @deprecated Unused */
3578
3619
  node_in_panel?: LGraphNode | null;
3579
- last_mouse: ReadOnlyPoint;
3620
+ last_mouse: Readonly<Point>;
3580
3621
  last_mouseclick: number;
3581
3622
  graph: LGraph | Subgraph | null;
3582
3623
  get _graph(): LGraph | Subgraph;
@@ -3704,7 +3745,7 @@ export declare class ComfyApp {
3704
3745
  * Assigns a new graph to this canvas.
3705
3746
  */
3706
3747
  setGraph(newGraph: LGraph | Subgraph): void;
3707
- openSubgraph(subgraph: Subgraph): void;
3748
+ openSubgraph(subgraph: Subgraph, fromNode: SubgraphNode): void;
3708
3749
  /**
3709
3750
  * @returns the visually active graph (in case there are more in the stack)
3710
3751
  */
@@ -3979,13 +4020,13 @@ export declare class ComfyApp {
3979
4020
  * @param start_dir the direction enum
3980
4021
  * @param end_dir the direction enum
3981
4022
  */
3982
- renderLink(ctx: CanvasRenderingContext2D, a: ReadOnlyPoint, b: ReadOnlyPoint, link: LLink | null, skip_border: boolean, flow: number | null, color: CanvasColour | null, start_dir: LinkDirection, end_dir: LinkDirection, { startControl, endControl, reroute, num_sublines, disabled }?: {
4023
+ renderLink(ctx: CanvasRenderingContext2D, a: Readonly<Point>, b: Readonly<Point>, link: LLink | null, skip_border: boolean, flow: number | null, color: CanvasColour | null, start_dir: LinkDirection, end_dir: LinkDirection, { startControl, endControl, reroute, num_sublines, disabled }?: {
3983
4024
  /** When defined, render data will be saved to this reroute instead of the {@link link}. */
3984
4025
  reroute?: Reroute;
3985
4026
  /** Offset of the bezier curve control point from {@link a point a} (output side) */
3986
- startControl?: ReadOnlyPoint;
4027
+ startControl?: Readonly<Point>;
3987
4028
  /** Offset of the bezier curve control point from {@link b point b} (input side) */
3988
- endControl?: ReadOnlyPoint;
4029
+ endControl?: Readonly<Point>;
3989
4030
  /** Number of sublines (useful to represent vec3 or rgb) @todo If implemented, refactor calculations out of the loop */
3990
4031
  num_sublines?: number;
3991
4032
  /** Whether this is a floating link segment */
@@ -4040,6 +4081,27 @@ export declare class ComfyApp {
4040
4081
  * If nothing is selected, the view is fitted around all items in the graph.
4041
4082
  */
4042
4083
  fitViewToSelectionAnimated(options?: AnimationOptions): void;
4084
+ /**
4085
+ * Calculate new position with delta
4086
+ */
4087
+ private calculateNewPosition;
4088
+ /**
4089
+ * Apply batched node position updates
4090
+ */
4091
+ private applyNodePositionUpdates;
4092
+ /**
4093
+ * Initialize layout mutations with Canvas source
4094
+ */
4095
+ private initLayoutMutations;
4096
+ /**
4097
+ * Collect all nodes that are children of groups in the selection
4098
+ */
4099
+ private collectNodesInGroups;
4100
+ /**
4101
+ * Move group children (both nodes and non-nodes)
4102
+ */
4103
+ private moveGroupChildren;
4104
+ moveChildNodesInGroupVueMode(allItems: Set<Positionable>, deltaX: number, deltaY: number): void;
4043
4105
  }
4044
4106
 
4045
4107
  declare interface LGraphCanvasEventMap {
@@ -4050,6 +4112,11 @@ export declare class ComfyApp {
4050
4112
  /** The old active graph, or `null` if there was no active graph. */
4051
4113
  oldGraph: LGraph | Subgraph | null | undefined;
4052
4114
  };
4115
+ 'subgraph-opened': {
4116
+ subgraph: Subgraph;
4117
+ closingGraph: LGraph;
4118
+ fromNode: SubgraphNode;
4119
+ };
4053
4120
  'litegraph:canvas': {
4054
4121
  subType: 'before-change' | 'after-change';
4055
4122
  } | {
@@ -4170,7 +4237,7 @@ export declare class ComfyApp {
4170
4237
  title: string;
4171
4238
  font?: string;
4172
4239
  font_size: number;
4173
- _bounding: Float32Array;
4240
+ _bounding: Rectangle;
4174
4241
  _pos: Point;
4175
4242
  _size: Size;
4176
4243
  /** @deprecated See {@link _children} */
@@ -4190,7 +4257,8 @@ export declare class ComfyApp {
4190
4257
  /** Size of the group, as width,height in graph units */
4191
4258
  get size(): Size;
4192
4259
  set size(v: Size);
4193
- get boundingRect(): Float32Array<ArrayBufferLike>;
4260
+ get boundingRect(): Rectangle;
4261
+ getBounding(): Rectangle;
4194
4262
  get nodes(): LGraphNode[];
4195
4263
  get titleHeight(): number;
4196
4264
  get children(): ReadonlySet<Positionable>;
@@ -4396,9 +4464,9 @@ export declare class ComfyApp {
4396
4464
  */
4397
4465
  get boundingRect(): ReadOnlyRectangle;
4398
4466
  /** The offset from {@link pos} to the top-left of {@link boundingRect}. */
4399
- get boundingOffset(): ReadOnlyPoint;
4400
- /** {@link pos} and {@link size} values are backed by this {@link Rect}. */
4401
- _posSize: Float32Array;
4467
+ get boundingOffset(): Readonly<Point>;
4468
+ /** {@link pos} and {@link size} values are backed by this {@link Rectangle}. */
4469
+ _posSize: Rectangle;
4402
4470
  _pos: Point;
4403
4471
  _size: Size;
4404
4472
  get pos(): Point;
@@ -4723,7 +4791,7 @@ export declare class ComfyApp {
4723
4791
  measure(out: Rect, ctx: CanvasRenderingContext2D): void;
4724
4792
  /**
4725
4793
  * returns the bounding of the object, used for rendering purposes
4726
- * @param out {Float32Array[4]?} [optional] a place to store the output, to free garbage
4794
+ * @param out {Rect?} [optional] a place to store the output, to free garbage
4727
4795
  * @param includeExternal {boolean?} [optional] set to true to
4728
4796
  * include the shadow and connection points in the bounding calculation
4729
4797
  * @returns the bounding box in format of [topleft_cornerx, topleft_cornery, width, height]
@@ -4830,7 +4898,7 @@ export declare class ComfyApp {
4830
4898
  findOutputSlotByType<TReturn extends true>(type: ISlotType, returnObj?: TReturn, preferFreeSlot?: boolean, doNotUseOccupied?: boolean): INodeOutputSlot;
4831
4899
  /**
4832
4900
  * returns the output (or input) slot with a given type, -1 if not found
4833
- * @param input uise inputs instead of outputs
4901
+ * @param input use inputs instead of outputs
4834
4902
  * @param type the type of the slot to find
4835
4903
  * @param returnObj if the obj itself wanted
4836
4904
  * @param preferFreeSlot if we want a free slot (if not found, will return the first of the type anyway)
@@ -5034,6 +5102,7 @@ export declare class ComfyApp {
5034
5102
  * Returns `true` if the widget is visible, otherwise `false`.
5035
5103
  */
5036
5104
  isWidgetVisible(widget: IBaseWidget): boolean;
5105
+ updateComputedDisabled(): void;
5037
5106
  drawWidgets(ctx: CanvasRenderingContext2D, { lowQuality, editorAlpha }: DrawWidgetsOptions): void;
5038
5107
  /**
5039
5108
  * When {@link LGraphNode.collapsed} is `true`, this method draws the node's collapsed slots.
@@ -5342,13 +5411,6 @@ export declare class ComfyApp {
5342
5411
  disabledPattern?: CanvasPattern | null;
5343
5412
  }
5344
5413
 
5345
- declare interface LinkRenderOptions {
5346
- color?: CanvasColour;
5347
- flow?: boolean;
5348
- skipBorder?: boolean;
5349
- disabled?: boolean;
5350
- }
5351
-
5352
5414
  /** The path calculation that links follow */
5353
5415
  declare enum LinkRenderType {
5354
5416
  HIDDEN_LINK = -1,
@@ -5369,7 +5431,7 @@ export declare class ComfyApp {
5369
5431
  /** The last canvas 2D path that was used to render this segment */
5370
5432
  path?: Path2D;
5371
5433
  /** Centre point of the {@link path}. Calculated during render only - can be inaccurate */
5372
- readonly _pos: Float32Array;
5434
+ readonly _pos: Point;
5373
5435
  /**
5374
5436
  * Y-forward along the {@link path} from its centre point, in radians.
5375
5437
  * `undefined` if using circles for link centres.
@@ -5424,6 +5486,7 @@ export declare class ComfyApp {
5424
5486
  GROUP_FONT: string;
5425
5487
  WIDGET_BGCOLOR: string;
5426
5488
  WIDGET_OUTLINE_COLOR: string;
5489
+ WIDGET_PROMOTED_OUTLINE_COLOR: string;
5427
5490
  WIDGET_ADVANCED_OUTLINE_COLOR: string;
5428
5491
  WIDGET_TEXT_COLOR: string;
5429
5492
  WIDGET_SECONDARY_TEXT_COLOR: string;
@@ -5570,9 +5633,9 @@ export declare class ComfyApp {
5570
5633
  * !WILL CHANGE node mode when using onTrigger (enable mode colors), onExecuted does not need this
5571
5634
  */
5572
5635
  do_add_triggers_slots: boolean;
5573
- /** [false!] being events, it is strongly reccomended to use them sequentially, one by one */
5636
+ /** [false!] being events, it is strongly recommended to use them sequentially, one by one */
5574
5637
  allow_multi_output_for_events: boolean;
5575
- /** [true!] allows to create and connect a ndoe clicking with the third button (wheel) */
5638
+ /** [true!] allows to create and connect a node clicking with the third button (wheel) */
5576
5639
  middle_click_slot_add_default_node: boolean;
5577
5640
  /** [true!] dragging a link to empty space will open a menu, add from list, search or defaults */
5578
5641
  release_link_on_empty_shows_menu: boolean;
@@ -5745,19 +5808,9 @@ export declare class ComfyApp {
5745
5808
  }
5746
5809
 
5747
5810
  declare class LitegraphLinkAdapter {
5748
- private graph;
5749
- private pathRenderer;
5750
- enableLayoutStoreWrites: boolean;
5751
- constructor(graph: LGraph);
5752
- /**
5753
- * Render a single link with all necessary data properly fetched
5754
- * Populates link.path for hit detection
5755
- */
5756
- renderLink(ctx: CanvasRenderingContext2D, link: LLink, context: LinkRenderContext, options?: LinkRenderOptions): void;
5757
- /**
5758
- * Convert litegraph link data to pure render format
5759
- */
5760
- private convertToLinkRenderData;
5811
+ readonly enableLayoutStoreWrites: boolean;
5812
+ private readonly pathRenderer;
5813
+ constructor(enableLayoutStoreWrites?: boolean);
5761
5814
  /**
5762
5815
  * Convert LinkDirection enum to Direction string
5763
5816
  */
@@ -5787,14 +5840,14 @@ export declare class ComfyApp {
5787
5840
  * Direct rendering method compatible with LGraphCanvas
5788
5841
  * Converts data and delegates to pure renderer
5789
5842
  */
5790
- renderLinkDirect(ctx: CanvasRenderingContext2D, a: ReadOnlyPoint, b: ReadOnlyPoint, link: LLink | null, skip_border: boolean, flow: number | boolean | null, color: CanvasColour | null, start_dir: LinkDirection, end_dir: LinkDirection, context: LinkRenderContext, extras?: {
5843
+ renderLinkDirect(ctx: CanvasRenderingContext2D, a: Readonly<Point>, b: Readonly<Point>, link: LLink | null, skip_border: boolean, flow: number | boolean | null, color: CanvasColour | null, start_dir: LinkDirection, end_dir: LinkDirection, context: LinkRenderContext, extras?: {
5791
5844
  reroute?: Reroute;
5792
- startControl?: ReadOnlyPoint;
5793
- endControl?: ReadOnlyPoint;
5845
+ startControl?: Readonly<Point>;
5846
+ endControl?: Readonly<Point>;
5794
5847
  num_sublines?: number;
5795
5848
  disabled?: boolean;
5796
5849
  }): void;
5797
- renderDraggingLink(ctx: CanvasRenderingContext2D, from: ReadOnlyPoint, to: ReadOnlyPoint, colour: CanvasColour, startDir: LinkDirection, endDir: LinkDirection, context: LinkRenderContext): void;
5850
+ renderDraggingLink(ctx: CanvasRenderingContext2D, from: Readonly<Point>, to: Readonly<Point>, colour: CanvasColour, startDir: LinkDirection, endDir: LinkDirection, context: LinkRenderContext): void;
5798
5851
  /**
5799
5852
  * Calculate bounding box for a link
5800
5853
  * Includes padding for line width and control points
@@ -5822,7 +5875,7 @@ export declare class ComfyApp {
5822
5875
  };
5823
5876
  _data?: unknown;
5824
5877
  /** Centre point of the link, calculated during render only - can be inaccurate */
5825
- _pos: Float32Array;
5878
+ _pos: Point;
5826
5879
  /** @todo Clean up - never implemented in comfy. */
5827
5880
  _last_time?: number;
5828
5881
  /** The last canvas 2D path that was used to render this link */
@@ -6062,6 +6115,8 @@ export declare class ComfyApp {
6062
6115
  readonly inputIndex: number;
6063
6116
  readonly inputPos: Point;
6064
6117
  constructor(network: LinkNetwork, link: LLink, toType: 'input' | 'output', fromReroute?: Reroute | undefined, dragDirection?: LinkDirection);
6118
+ abstract canConnectToInput(inputNode: NodeLike, input: INodeInputSlot): boolean;
6119
+ abstract canConnectToOutput(outputNode: NodeLike, output: INodeOutputSlot): boolean;
6065
6120
  abstract connectToInput(node: LGraphNode, input: INodeInputSlot, events?: CustomEventTarget<LinkConnectorEventMap>): void;
6066
6121
  abstract connectToOutput(node: LGraphNode, output: INodeOutputSlot, events?: CustomEventTarget<LinkConnectorEventMap>): void;
6067
6122
  abstract connectToSubgraphInput(input: SubgraphInput, events?: CustomEventTarget<LinkConnectorEventMap>): void;
@@ -6235,7 +6290,7 @@ export declare class ComfyApp {
6235
6290
  };
6236
6291
 
6237
6292
  /** A point represented as `[x, y]` co-ordinates */
6238
- declare type Point = [x: number, y: number] | Float32Array | Float64Array;
6293
+ declare type Point = [x: number, y: number];
6239
6294
 
6240
6295
  /**
6241
6296
  * An object that can be positioned, selected, and moved.
@@ -6310,21 +6365,15 @@ export declare class ComfyApp {
6310
6365
  readonly outputNode?: SubgraphOutputNode;
6311
6366
  }
6312
6367
 
6313
- /** A point represented as `[x, y]` co-ordinates that will not be modified */
6314
- declare type ReadOnlyPoint = readonly [x: number, y: number] | ReadOnlyTypedArray<Float32Array> | ReadOnlyTypedArray<Float64Array>;
6315
-
6316
6368
  /** A rectangle starting at top-left coordinates `[x, y, width, height]` that will not be modified */
6317
- declare type ReadOnlyRect = readonly [x: number, y: number, width: number, height: number] | ReadOnlyTypedArray<Float32Array> | ReadOnlyTypedArray<Float64Array>;
6369
+ declare type ReadOnlyRect = readonly [x: number, y: number, width: number, height: number] | ReadOnlyTypedArray<Float64Array>;
6318
6370
 
6319
6371
  declare type ReadOnlyRectangle = Omit<ReadOnlyTypedArray<Rectangle>, 'setHeightBottomAnchored' | 'setWidthRightAnchored' | 'resizeTopLeft' | 'resizeBottomLeft' | 'resizeTopRight' | 'resizeBottomRight' | 'resizeBottomRight' | 'updateTo'>;
6320
6372
 
6321
- /** A size represented as `[width, height]` that will not be modified */
6322
- declare type ReadOnlySize = readonly [width: number, height: number] | ReadOnlyTypedArray<Float32Array> | ReadOnlyTypedArray<Float64Array>;
6323
-
6324
- declare type ReadOnlyTypedArray<T extends TypedArrays | TypedBigIntArrays> = Omit<Readonly<T>, 'fill' | 'copyWithin' | 'reverse' | 'set' | 'sort' | 'subarray'>;
6373
+ declare type ReadOnlyTypedArray<T extends Float64Array> = Omit<Readonly<T>, 'fill' | 'copyWithin' | 'reverse' | 'set' | 'sort' | 'subarray'>;
6325
6374
 
6326
6375
  /** A rectangle starting at top-left coordinates `[x, y, width, height]` */
6327
- declare type Rect = ArRect | Float32Array | Float64Array;
6376
+ declare type Rect = [x: number, y: number, width: number, height: number] | Float64Array;
6328
6377
 
6329
6378
  /**
6330
6379
  * A rectangle, represented as a float64 array of 4 numbers: [x, y, width, height].
@@ -6348,7 +6397,7 @@ export declare class ComfyApp {
6348
6397
  * @param height The height of the rectangle. Default: {@link width}
6349
6398
  * @returns A new rectangle whose centre is at {@link x}
6350
6399
  */
6351
- static fromCentre([x, y]: ReadOnlyPoint, width: number, height?: number): Rectangle;
6400
+ static fromCentre([x, y]: Readonly<Point>, width: number, height?: number): Rectangle;
6352
6401
  static ensureRect(rect: ReadOnlyRect): Rectangle;
6353
6402
  subarray(begin?: number, end?: number): Float64Array<ArrayBuffer>;
6354
6403
  /**
@@ -6357,14 +6406,14 @@ export declare class ComfyApp {
6357
6406
  * Updating the values of the returned object will update this rectangle.
6358
6407
  */
6359
6408
  get pos(): Point;
6360
- set pos(value: ReadOnlyPoint);
6409
+ set pos(value: Readonly<Point>);
6361
6410
  /**
6362
6411
  * A reference to the size of this rectangle.
6363
6412
  *
6364
6413
  * Updating the values of the returned object will update this rectangle.
6365
6414
  */
6366
6415
  get size(): Size;
6367
- set size(value: ReadOnlySize);
6416
+ set size(value: Readonly<Size>);
6368
6417
  /** The x co-ordinate of the top-left corner of this rectangle. */
6369
6418
  get x(): number;
6370
6419
  set x(value: number);
@@ -6410,7 +6459,7 @@ export declare class ComfyApp {
6410
6459
  * @param point The point to check
6411
6460
  * @returns `true` if {@link point} is inside this rectangle, otherwise `false`.
6412
6461
  */
6413
- containsPoint([x, y]: ReadOnlyPoint): boolean;
6462
+ containsPoint([x, y]: Readonly<Point>): boolean;
6414
6463
  /**
6415
6464
  * Checks if {@link other} is a smaller rectangle inside this rectangle.
6416
6465
  * One **must** be larger than the other; identical rectangles are not considered to contain each other.
@@ -6461,9 +6510,9 @@ export declare class ComfyApp {
6461
6510
  /** @returns The width and height of this rectangle, as a new {@link Size}. */
6462
6511
  getSize(): Size;
6463
6512
  /** @returns The offset from the top-left of this rectangle to the point [{@link x}, {@link y}], as a new {@link Point}. */
6464
- getOffsetTo([x, y]: ReadOnlyPoint): Point;
6513
+ getOffsetTo([x, y]: Readonly<Point>): Point;
6465
6514
  /** @returns The offset from the point [{@link x}, {@link y}] to the top-left of this rectangle, as a new {@link Point}. */
6466
- getOffsetFrom([x, y]: ReadOnlyPoint): Point;
6515
+ getOffsetFrom([x, y]: Readonly<Point>): Point;
6467
6516
  /** Resizes the rectangle without moving it, setting its top-left corner to [{@link x}, {@link y}]. */
6468
6517
  resizeTopLeft(x1: number, y1: number): void;
6469
6518
  /** Resizes the rectangle without moving it, setting its bottom-left corner to [{@link x}, {@link y}]. */
@@ -6503,6 +6552,16 @@ export declare class ComfyApp {
6503
6552
  readonly fromSlotIndex: number;
6504
6553
  /** The reroute that the link is being connected from. */
6505
6554
  readonly fromReroute?: Reroute;
6555
+ /**
6556
+ * Capability checks used for hit-testing and validation during drag.
6557
+ * Implementations should return `false` when a connection is not possible
6558
+ * rather than throwing.
6559
+ */
6560
+ canConnectToInput(node: NodeLike, input: INodeInputSlot): boolean;
6561
+ canConnectToOutput(node: NodeLike, output: INodeOutputSlot): boolean;
6562
+ /** Optional: only some links support validating subgraph IO or reroutes. */
6563
+ canConnectToSubgraphInput?(input: SubgraphInput): boolean;
6564
+ canConnectToReroute?(reroute: Reroute): boolean;
6506
6565
  connectToInput(node: LGraphNode, input: INodeInputSlot, events?: CustomEventTarget<LinkConnectorEventMap>): void;
6507
6566
  connectToOutput(node: LGraphNode, output: INodeOutputSlot, events?: CustomEventTarget<LinkConnectorEventMap>): void;
6508
6567
  connectToSubgraphInput(input: SubgraphInput, events?: CustomEventTarget<LinkConnectorEventMap>): void;
@@ -6587,7 +6646,7 @@ export declare class ComfyApp {
6587
6646
  /** @inheritdoc */
6588
6647
  _centreAngle?: number;
6589
6648
  /** @inheritdoc */
6590
- _pos: Float32Array;
6649
+ _pos: Point;
6591
6650
  /** @inheritdoc */
6592
6651
  _dragging?: boolean;
6593
6652
  /** Colour of the first link that rendered this reroute */
@@ -6862,7 +6921,7 @@ export declare class ComfyApp {
6862
6921
  declare type SimpleApiEvents = keyof PickNevers_2<ApiEventTypes>;
6863
6922
 
6864
6923
  /** A size represented as `[width, height]` */
6865
- declare type Size = [width: number, height: number] | Float32Array | Float64Array;
6924
+ declare type Size = [width: number, height: number];
6866
6925
 
6867
6926
  declare class SliderWidget extends BaseWidget<ISliderWidget> implements ISliderWidget {
6868
6927
  type: "slider";
@@ -7100,7 +7159,7 @@ export declare class ComfyApp {
7100
7159
  id: UUID;
7101
7160
  /** The data type this slot uses. Unlike nodes, this does not support legacy numeric types. */
7102
7161
  type: string;
7103
- /** Links connected to this slot, or `undefined` if not connected. An ouptut slot should only ever have one link. */
7162
+ /** Links connected to this slot, or `undefined` if not connected. An output slot should only ever have one link. */
7104
7163
  linkIds?: LinkId[];
7105
7164
  }
7106
7165
 
@@ -7305,7 +7364,7 @@ export declare class ComfyApp {
7305
7364
  onPointerMove(e: CanvasPointerEvent): void;
7306
7365
  getLinks(): LLink[];
7307
7366
  decrementSlots(inputsOrOutputs: 'inputs' | 'outputs'): void;
7308
- measure(): ReadOnlySize;
7367
+ measure(): Readonly<Size>;
7309
7368
  abstract arrange(rect: ReadOnlyRect): void;
7310
7369
  abstract connect(slot: INodeInputSlot | INodeOutputSlot, node: LGraphNode, afterRerouteId?: RerouteId): LLink | undefined;
7311
7370
  /**
@@ -7552,10 +7611,6 @@ export declare class ComfyApp {
7552
7611
 
7553
7612
  declare type TWidgetValue = IWidget['value'];
7554
7613
 
7555
- declare type TypedArrays = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
7556
-
7557
- declare type TypedBigIntArrays = BigInt64Array | BigUint64Array;
7558
-
7559
7614
  export { User }
7560
7615
 
7561
7616
  export { UserData }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comfyorg/comfyui-frontend-types",
3
- "version": "1.28.3",
3
+ "version": "1.28.5",
4
4
  "types": "./index.d.ts",
5
5
  "files": [
6
6
  "index.d.ts"