@comfyorg/comfyui-frontend-types 1.42.7 → 1.42.8

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 +70 -6
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -3,8 +3,6 @@ import { ComfyWorkflowJSON } from '../platform/workflow/validation/schemas/workf
3
3
  import { ComfyWorkflowJSON as ComfyWorkflowJSON_2 } from '../../validation/schemas/workflowSchema';
4
4
  import { Component } from 'vue';
5
5
  import { CurveData } from '../../../../components/curve/types';
6
- import { DOMWidget } from '../scripts/domWidget';
7
- import { DOMWidgetOptions } from '../scripts/domWidget';
8
6
  import { IFuseOptions } from 'fuse.js';
9
7
  import { ModelFile as ModelFile_2 } from '../../validation/schemas/workflowSchema';
10
8
  import { NodeId as NodeId_2 } from '../platform/workflow/validation/schemas/workflowSchema';
@@ -145,6 +143,21 @@ declare interface BaseBottomPanelExtension {
145
143
  targetPanel?: 'terminal' | 'shortcuts';
146
144
  }
147
145
 
146
+ declare interface BaseDOMWidget<V extends object | string = object | string> extends IBaseWidget<V, string, DOMWidgetOptions<V>> {
147
+ type: string;
148
+ options: DOMWidgetOptions<V>;
149
+ value: V;
150
+ callback?: (value: V) => void;
151
+ /** The unique ID of the widget. */
152
+ readonly id: string;
153
+ /** The node that the widget belongs to. */
154
+ readonly node: LGraphNode;
155
+ /** Whether the widget is visible. */
156
+ isVisible(): boolean;
157
+ /** The margin of the widget. */
158
+ margin: number;
159
+ }
160
+
148
161
  declare interface BaseExportedGraph {
149
162
  /** Unique graph ID. Automatically generated if not provided. */
150
163
  id: UUID;
@@ -2667,9 +2680,43 @@ export declare class ComfyApp {
2667
2680
  */
2668
2681
  declare function distance(a: Readonly<Point>, b: Readonly<Point>): number;
2669
2682
 
2670
- export { DOMWidget }
2683
+ /**
2684
+ * A DOM widget that wraps a custom HTML element as a litegraph widget.
2685
+ */
2686
+ export declare interface DOMWidget<T extends HTMLElement, V extends object | string> extends BaseDOMWidget<V> {
2687
+ element: T;
2688
+ /**
2689
+ * @deprecated Legacy property used by some extensions for customtext
2690
+ * (textarea) widgets. Use {@link element} instead as it provides the same
2691
+ * functionality and works for all DOMWidget types.
2692
+ */
2693
+ inputEl?: T;
2694
+ }
2671
2695
 
2672
- export { DOMWidgetOptions }
2696
+ export declare interface DOMWidgetOptions<V extends object | string> extends IWidgetOptions {
2697
+ /**
2698
+ * Whether to render a placeholder rectangle when zoomed out.
2699
+ */
2700
+ hideOnZoom?: boolean;
2701
+ selectOn?: string[];
2702
+ onHide?: (widget: BaseDOMWidget<V>) => void;
2703
+ getValue?: () => V;
2704
+ setValue?: (value: V) => void;
2705
+ getMinHeight?: () => number;
2706
+ getMaxHeight?: () => number;
2707
+ getHeight?: () => string | number;
2708
+ onDraw?: (widget: BaseDOMWidget<V>) => void;
2709
+ margin?: number;
2710
+ /**
2711
+ * @deprecated Use `afterResize` instead. This callback is a legacy API
2712
+ * that fires before resize happens, but it is no longer supported. Now it
2713
+ * fires after resize happens.
2714
+ * The resize logic has been upstreamed to litegraph in
2715
+ * https://github.com/Comfy-Org/ComfyUI_frontend/pull/2557
2716
+ */
2717
+ beforeResize?: (this: BaseDOMWidget<V>, node: LGraphNode) => void;
2718
+ afterResize?: (this: BaseDOMWidget<V>, node: LGraphNode) => void;
2719
+ }
2673
2720
 
2674
2721
  declare class DragAndScale {
2675
2722
  /**
@@ -5957,6 +6004,14 @@ export declare class ComfyApp {
5957
6004
  * @returns object or null { link: id, name: string, type: string or 0 }
5958
6005
  */
5959
6006
  getInputInfo(slot: number): INodeInputSlot | null;
6007
+ /**
6008
+ * Resolves the output source for cross-graph virtual nodes (e.g. Set/Get),
6009
+ * bypassing {@link getInputLink} when the source lives in a different graph.
6010
+ */
6011
+ resolveVirtualOutput?(slot: number): {
6012
+ node: LGraphNode;
6013
+ slot: number;
6014
+ } | undefined;
5960
6015
  /**
5961
6016
  * Returns the link info in the connection of an input slot
5962
6017
  * @returns object or null
@@ -6100,7 +6155,6 @@ export declare class ComfyApp {
6100
6155
  addCustomWidget<TPlainWidget extends IBaseWidget>(custom_widget: TPlainWidget): TPlainWidget | WidgetTypeMap[TPlainWidget['type']];
6101
6156
  addTitleButton(options: LGraphButtonOptions): LGraphButton;
6102
6157
  onTitleButtonClick(button: LGraphButton, canvas: LGraphCanvas): void;
6103
- removeWidgetByName(name: string): void;
6104
6158
  removeWidget(widget: IBaseWidget): void;
6105
6159
  ensureWidgetRemoved(widget: IBaseWidget): void;
6106
6160
  move(deltaX: number, deltaY: number): void;
@@ -8629,6 +8683,16 @@ export declare class ComfyApp {
8629
8683
  getIoNodeOnPos(x: number, y: number): SubgraphInputNode | SubgraphOutputNode | undefined;
8630
8684
  private _configureSubgraph;
8631
8685
  configure(data: (ISerialisedGraph & ExportedSubgraph) | (SerialisableGraph & ExportedSubgraph), keep_old?: boolean): boolean | undefined;
8686
+ /**
8687
+ * Repairs SubgraphInput/Output `linkIds` that reference links removed
8688
+ * by `_removeDuplicateLinks` during `super.configure()`.
8689
+ *
8690
+ * For each stale link ID, finds the surviving link that connects to the
8691
+ * same IO node and slot index, and substitutes it.
8692
+ */
8693
+ private _repairIOSlotLinkIds;
8694
+ private _repairSlotLinkIds;
8695
+ private _findLinkBySlot;
8632
8696
  attachCanvas(canvas: LGraphCanvas): void;
8633
8697
  addInput(name: string, type: string): SubgraphInput;
8634
8698
  addOutput(name: string, type: string): SubgraphOutput;
@@ -8929,6 +8993,7 @@ export declare class ComfyApp {
8929
8993
  private _buildDisplayNameByViewKey;
8930
8994
  private _makePromotionEntryKey;
8931
8995
  private _makePromotionViewKey;
8996
+ private _serializeEntries;
8932
8997
  private _resolveLegacyEntry;
8933
8998
  /** Manages lifecycle of all subgraph event listeners */
8934
8999
  private _eventAbortController;
@@ -8976,7 +9041,6 @@ export declare class ComfyApp {
8976
9041
  private _clearDomOverrideForView;
8977
9042
  private _removePromotedView;
8978
9043
  removeWidget(widget: IBaseWidget): void;
8979
- removeWidgetByName(name: string): void;
8980
9044
  ensureWidgetRemoved(widget: IBaseWidget): void;
8981
9045
  onRemoved(): void;
8982
9046
  drawTitleBox(ctx: CanvasRenderingContext2D, { scale, low_quality, title_height, box_size }: DrawTitleBoxOptions): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comfyorg/comfyui-frontend-types",
3
- "version": "1.42.7",
3
+ "version": "1.42.8",
4
4
  "types": "./index.d.ts",
5
5
  "files": [
6
6
  "index.d.ts"