@comfyorg/comfyui-frontend-types 1.31.0 → 1.31.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.
Files changed (2) hide show
  1. package/index.d.ts +31 -8
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -1335,15 +1335,15 @@ export declare class ComfyApp {
1335
1335
  /**
1336
1336
  * Allows the extension to add context menu items to canvas right-click menus
1337
1337
  * @param canvas The canvas instance
1338
- * @returns An array of context menu items to add
1338
+ * @returns An array of context menu items to add (null values represent separators)
1339
1339
  */
1340
- getCanvasMenuItems?(canvas: LGraphCanvas): IContextMenuValue[];
1340
+ getCanvasMenuItems?(canvas: LGraphCanvas): (IContextMenuValue | null)[];
1341
1341
  /**
1342
1342
  * Allows the extension to add context menu items to node right-click menus
1343
1343
  * @param node The node being right-clicked
1344
- * @returns An array of context menu items to add
1344
+ * @returns An array of context menu items to add (null values represent separators)
1345
1345
  */
1346
- getNodeMenuItems?(node: LGraphNode): IContextMenuValue[];
1346
+ getNodeMenuItems?(node: LGraphNode): (IContextMenuValue | null)[];
1347
1347
  /**
1348
1348
  * Allows the extension to add additional handling to the node before it is registered with **LGraph**
1349
1349
  * @param nodeType The node class (not an instance)
@@ -2466,7 +2466,7 @@ export declare class ComfyApp {
2466
2466
  scale?: number;
2467
2467
  node?: LGraphNode;
2468
2468
  autoopen?: boolean;
2469
- callback?(value?: string | IContextMenuValue<TValue>, options?: unknown, event?: MouseEvent, previous_menu?: ContextMenu<TValue>, extra?: unknown): void | boolean;
2469
+ callback?(value?: string | IContextMenuValue<TValue>, options?: unknown, event?: MouseEvent, previous_menu?: ContextMenu<TValue>, extra?: unknown): void | boolean | Promise<void | boolean>;
2470
2470
  }
2471
2471
 
2472
2472
  declare interface IContextMenuSubmenu<TValue = unknown> extends IContextMenuOptions<TValue> {
@@ -2482,7 +2482,7 @@ export declare class ComfyApp {
2482
2482
  property?: string;
2483
2483
  type?: string;
2484
2484
  slot?: IFoundSlot;
2485
- callback?(this: ContextMenuDivElement<TValue>, value?: TCallbackValue, options?: unknown, event?: MouseEvent, previous_menu?: ContextMenu<TValue>, extra?: TExtra): void | boolean;
2485
+ callback?(this: ContextMenuDivElement<TValue>, value?: TCallbackValue, options?: unknown, event?: MouseEvent, previous_menu?: ContextMenu<TValue>, extra?: TExtra): void | boolean | Promise<void | boolean>;
2486
2486
  }
2487
2487
 
2488
2488
  declare interface ICreateDefaultNodeOptions extends ICreateNodeOptions {
@@ -3154,7 +3154,9 @@ export declare class ComfyApp {
3154
3154
  get empty(): boolean;
3155
3155
  /** @returns All items on the canvas that can be selected */
3156
3156
  positionableItems(): Generator<LGraphNode | LGraphGroup | Reroute>;
3157
+ private readonly floatingLinksInternal;
3157
3158
  get floatingLinks(): ReadonlyMap<LinkId, LLink>;
3159
+ private readonly reroutesInternal;
3158
3160
  /** All reroutes in this graph. */
3159
3161
  get reroutes(): Map<RerouteId, Reroute>;
3160
3162
  get rootGraph(): LGraph;
@@ -4147,7 +4149,7 @@ export declare class ComfyApp {
4147
4149
  closePanels(): void;
4148
4150
  showShowNodePanel(node: LGraphNode): void;
4149
4151
  checkPanels(): void;
4150
- getCanvasMenuOptions(): IContextMenuValue<string>[];
4152
+ getCanvasMenuOptions(): IContextMenuValue[];
4151
4153
  getNodeMenuOptions(node: LGraphNode): (IContextMenuValue<INodeSlotContextItem, unknown, unknown> | IContextMenuValue<string, unknown, unknown> | IContextMenuValue<string | null, unknown, unknown> | IContextMenuValue<"round" | "default" | "box" | "card", unknown, unknown> | IContextMenuValue<unknown, LGraphNode, unknown> | null)[];
4152
4154
  /** @deprecated */
4153
4155
  getGroupMenuOptions(group: LGraphGroup): (IContextMenuValue<string, unknown, unknown> | IContextMenuValue<string | null, unknown, unknown> | null)[];
@@ -4198,6 +4200,10 @@ export declare class ComfyApp {
4198
4200
  closingGraph: LGraph;
4199
4201
  fromNode: SubgraphNode;
4200
4202
  };
4203
+ /** Dispatched after a group of items has been converted to a subgraph*/
4204
+ 'subgraph-converted': {
4205
+ subgraphNode: SubgraphNode;
4206
+ };
4201
4207
  'litegraph:canvas': {
4202
4208
  subType: 'before-change' | 'after-change';
4203
4209
  } | {
@@ -6725,7 +6731,6 @@ export declare class ComfyApp {
6725
6731
  * and a `WeakRef` to a {@link LinkNetwork} to resolve them.
6726
6732
  */
6727
6733
  declare class Reroute implements Positionable, LinkSegment, Serialisable<SerialisableReroute> {
6728
- #private;
6729
6734
  readonly id: RerouteId;
6730
6735
  static radius: number;
6731
6736
  /** Maximum distance from reroutes to their bezier curve control points. */
@@ -6734,17 +6739,26 @@ export declare class ComfyApp {
6734
6739
  static slotRadius: number;
6735
6740
  /** Distance from reroute centre to slot centre. */
6736
6741
  static get slotOffset(): number;
6742
+ /** The network this reroute belongs to. Contains all valid links and reroutes. */
6743
+ private readonly network;
6744
+ private parentIdInternal?;
6737
6745
  get parentId(): RerouteId | undefined;
6738
6746
  /** Ignores attempts to create an infinite loop. @inheritdoc */
6739
6747
  set parentId(value: RerouteId | undefined);
6740
6748
  get parent(): Reroute | undefined;
6741
6749
  /** This property is only defined on the last reroute of a floating reroute chain (closest to input end). */
6742
6750
  floating?: FloatingRerouteSlot;
6751
+ private readonly posInternal;
6743
6752
  /** @inheritdoc */
6744
6753
  get pos(): Point;
6745
6754
  set pos(value: Point);
6746
6755
  /** @inheritdoc */
6747
6756
  get boundingRect(): ReadOnlyRect;
6757
+ /**
6758
+ * Slightly over-sized rectangle, guaranteed to contain the entire surface area for hover detection.
6759
+ * Eliminates most hover positions using an extremely cheap check.
6760
+ */
6761
+ private get hoverArea();
6748
6762
  /** The total number of links & floating links using this reroute */
6749
6763
  get totalLinks(): number;
6750
6764
  /** @inheritdoc */
@@ -6770,6 +6784,13 @@ export declare class ComfyApp {
6770
6784
  _colour?: CanvasColour;
6771
6785
  /** Colour of the first link that rendered this reroute */
6772
6786
  get colour(): CanvasColour;
6787
+ /**
6788
+ * Used to ensure reroute angles are only executed once per frame.
6789
+ * @todo Calculate on change instead.
6790
+ */
6791
+ private lastRenderTime;
6792
+ private readonly inputSlot;
6793
+ private readonly outputSlot;
6773
6794
  get isSlotHovered(): boolean;
6774
6795
  get isInputHovered(): boolean;
6775
6796
  get isOutputHovered(): boolean;
@@ -6889,6 +6910,7 @@ export declare class ComfyApp {
6889
6910
  * @returns `true` if {@link pos} is within the reroute's radius.
6890
6911
  */
6891
6912
  containsPoint(pos: Point): boolean;
6913
+ private contains;
6892
6914
  /** @inheritdoc */
6893
6915
  asSerialisable(): SerialisableReroute;
6894
6916
  }
@@ -7414,6 +7436,7 @@ export declare class ComfyApp {
7414
7436
  * This ensures nested subgraph widget values are preserved when saving.
7415
7437
  */
7416
7438
  serialize(): ISerialisedNode;
7439
+ clone(): LGraphNode | null;
7417
7440
  }
7418
7441
 
7419
7442
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comfyorg/comfyui-frontend-types",
3
- "version": "1.31.0",
3
+ "version": "1.31.2",
4
4
  "types": "./index.d.ts",
5
5
  "files": [
6
6
  "index.d.ts"