@comfyorg/comfyui-frontend-types 1.29.0 → 1.29.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 +66 -4
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -1139,6 +1139,18 @@ export declare class ComfyApp {
1139
1139
  * @param {ComfyExtension} extension
1140
1140
  */
1141
1141
  registerExtension(extension: ComfyExtension): void;
1142
+ /**
1143
+ * Collects context menu items from all extensions for canvas menus
1144
+ * @param canvas The canvas instance
1145
+ * @returns Array of context menu items from all extensions
1146
+ */
1147
+ collectCanvasMenuItems(canvas: LGraphCanvas): IContextMenuValue[];
1148
+ /**
1149
+ * Collects context menu items from all extensions for node menus
1150
+ * @param node The node being right-clicked
1151
+ * @returns Array of context menu items from all extensions
1152
+ */
1153
+ collectNodeMenuItems(node: LGraphNode): IContextMenuValue[];
1142
1154
  /**
1143
1155
  * Refresh combo list on whole nodes
1144
1156
  */
@@ -1293,6 +1305,18 @@ export declare class ComfyApp {
1293
1305
  * @returns An array of command ids to add to the selection toolbox
1294
1306
  */
1295
1307
  getSelectionToolboxCommands?(selectedItem: Positionable): string[];
1308
+ /**
1309
+ * Allows the extension to add context menu items to canvas right-click menus
1310
+ * @param canvas The canvas instance
1311
+ * @returns An array of context menu items to add
1312
+ */
1313
+ getCanvasMenuItems?(canvas: LGraphCanvas): IContextMenuValue[];
1314
+ /**
1315
+ * Allows the extension to add context menu items to node right-click menus
1316
+ * @param node The node being right-clicked
1317
+ * @returns An array of context menu items to add
1318
+ */
1319
+ getNodeMenuItems?(node: LGraphNode): IContextMenuValue[];
1296
1320
  /**
1297
1321
  * Allows the extension to add additional handling to the node before it is registered with **LGraph**
1298
1322
  * @param nodeType The node class (not an instance)
@@ -2201,6 +2225,11 @@ export declare class ComfyApp {
2201
2225
  value: string;
2202
2226
  }
2203
2227
 
2228
+ declare interface IAudioRecordWidget extends IBaseWidget<string, 'audiorecord'> {
2229
+ type: 'audiorecord';
2230
+ value: string;
2231
+ }
2232
+
2204
2233
  /**
2205
2234
  * The base type for all widgets. Should not be implemented directly.
2206
2235
  * @template TValue The type of value this widget holds.
@@ -2904,7 +2933,7 @@ export declare class ComfyApp {
2904
2933
  * Recommend declaration merging any properties that use IWidget (e.g. {@link LGraphNode.widgets}) with a new type alias.
2905
2934
  * @see ICustomWidget
2906
2935
  */
2907
- declare type IWidget = IBooleanWidget | INumericWidget | IStringWidget | IComboWidget | IStringComboWidget | ICustomWidget | ISliderWidget | IButtonWidget | IKnobWidget | IFileUploadWidget | IColorWidget | IMarkdownWidget | IImageWidget | ITreeSelectWidget | IMultiSelectWidget | IChartWidget | IGalleriaWidget | IImageCompareWidget | ISelectButtonWidget | ITextareaWidget | IAssetWidget;
2936
+ declare type IWidget = IBooleanWidget | INumericWidget | IStringWidget | IComboWidget | IStringComboWidget | ICustomWidget | ISliderWidget | IButtonWidget | IKnobWidget | IFileUploadWidget | IColorWidget | IMarkdownWidget | IImageWidget | ITreeSelectWidget | IMultiSelectWidget | IChartWidget | IGalleriaWidget | IImageCompareWidget | ISelectButtonWidget | ITextareaWidget | IAssetWidget | IAudioRecordWidget;
2908
2937
 
2909
2938
  declare interface IWidgetKnobOptions extends IWidgetOptions<number[]> {
2910
2939
  min: number;
@@ -3097,7 +3126,7 @@ export declare class ComfyApp {
3097
3126
  onExecuteStep?(): void;
3098
3127
  onNodeAdded?(node: LGraphNode): void;
3099
3128
  onNodeRemoved?(node: LGraphNode): void;
3100
- onTrigger?(action: string, param: unknown): void;
3129
+ onTrigger?: LGraphTriggerHandler;
3101
3130
  onBeforeChange?(graph: LGraph, info?: LGraphNode): void;
3102
3131
  onAfterChange?(graph: LGraph, info?: LGraphNode | null): void;
3103
3132
  onConnectionChange?(node: LGraphNode): void;
@@ -3276,6 +3305,7 @@ export declare class ComfyApp {
3276
3305
  * this replaces the ones using the old version with the new version
3277
3306
  */
3278
3307
  checkNodeTypes(): void;
3308
+ trigger<A extends LGraphTriggerAction>(action: A, param: LGraphTriggerParam<A>): void;
3279
3309
  trigger(action: string, param: unknown): void;
3280
3310
  /** @todo Clean up - never implemented. */
3281
3311
  triggerInput(name: string, value: any): void;
@@ -5021,10 +5051,10 @@ export declare class ComfyApp {
5021
5051
  * Gets the position of an output slot, in graph co-ordinates.
5022
5052
  *
5023
5053
  * This method is preferred over the legacy {@link getConnectionPos} method.
5024
- * @param slot Output slot index
5054
+ * @param outputSlotIndex Output slot index
5025
5055
  * @returns Position of the output slot
5026
5056
  */
5027
- getOutputPos(slot: number): Point;
5057
+ getOutputPos(outputSlotIndex: number): Point;
5028
5058
  /** @inheritdoc */
5029
5059
  snapToGrid(snapTo: number): boolean;
5030
5060
  /** @see {@link snapToGrid} */
@@ -5182,6 +5212,16 @@ export declare class ComfyApp {
5182
5212
  lastRerouteId: number;
5183
5213
  }
5184
5214
 
5215
+ declare type LGraphTriggerAction = LGraphTriggerEvent['type'];
5216
+
5217
+ declare type LGraphTriggerEvent = NodePropertyChangedEvent | NodeSlotErrorsChangedEvent | NodeSlotLinksChangedEvent;
5218
+
5219
+ declare type LGraphTriggerHandler = (event: LGraphTriggerEvent) => void;
5220
+
5221
+ declare type LGraphTriggerParam<A extends LGraphTriggerAction> = Extract<LGraphTriggerEvent, {
5222
+ type: A;
5223
+ }>;
5224
+
5185
5225
  /**
5186
5226
  * Component of {@link LGraphCanvas} that handles connecting and moving links.
5187
5227
  * @see {@link LLink}
@@ -6211,6 +6251,28 @@ export declare class ComfyApp {
6211
6251
 
6212
6252
  declare type NodeProperty = string | number | boolean | object;
6213
6253
 
6254
+ declare interface NodePropertyChangedEvent {
6255
+ type: 'node:property:changed';
6256
+ nodeId: NodeId;
6257
+ property: string;
6258
+ oldValue: unknown;
6259
+ newValue: unknown;
6260
+ }
6261
+
6262
+ declare interface NodeSlotErrorsChangedEvent {
6263
+ type: 'node:slot-errors:changed';
6264
+ nodeId: NodeId;
6265
+ }
6266
+
6267
+ declare interface NodeSlotLinksChangedEvent {
6268
+ type: 'node:slot-links:changed';
6269
+ nodeId: NodeId;
6270
+ slotType: NodeSlotType;
6271
+ slotIndex: number;
6272
+ connected: boolean;
6273
+ linkId: number;
6274
+ }
6275
+
6214
6276
  /** Node slot type - input or output */
6215
6277
  declare enum NodeSlotType {
6216
6278
  INPUT = 1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comfyorg/comfyui-frontend-types",
3
- "version": "1.29.0",
3
+ "version": "1.29.2",
4
4
  "types": "./index.d.ts",
5
5
  "files": [
6
6
  "index.d.ts"