Files
ComfyUI_frontend/src/scripts
Christian Byrne bbd8d67f5f designate canvasOnly on runtime-generated virtual widgets so they are hidden in Vue renderer (#5831)
## Summary

Added `canvasOnly` flag to runtime-generated widgets to prevent Vue
renderer from displaying them while keeping canvas functionality intact.

## Changes

- **What**: Added `canvasOnly` widget option to hide upload, webcam, and
refresh widgets from Vue renderer

In the Canvas (LiteGraph) system, there was a small set of widgets with
strictly defined components. There, if we wanted some unique or
relatively complex behavior (like an upload butotn), we needed to create
a separate widget that would be coupled to the original widget at
runtime (and would not be serialized).

In the Vue renderer system, we can simply add flags to the inputSpec or
widget options and conditionally render complex UI additions -- i.e.,
there is no need for the hard-to-maintain runtime widget associations.
Expressing such things entirely in the view layer simplifies business
logic related to graph state, as we no longer need to account for
preserving the connections between runtime widgets and their special
siblings -- we also do not need to worry about the implications for
state serialization.

## Related

- https://github.com/Comfy-Org/ComfyUI_frontend/pull/5798

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-5831-designate-canvasOnly-on-runtime-generated-virtual-widgets-so-they-are-hidden-in-Vue-ren-27c6d73d365081fb8641feec010190df)
by [Unito](https://www.unito.io)

---------

Co-authored-by: github-actions <github-actions@github.com>
2025-09-28 18:48:29 -07:00
..
2025-09-26 11:52:19 -07:00
2025-09-07 01:10:32 -07:00

Scripts Directory Documentation

This directory contains TypeScript code inherited from the legacy ComfyUI JavaScript frontend project. The code has been migrated from JavaScript to TypeScript while maintaining compatibility with the original functionality.

When implementing new features, prefer using the new Vue3 system over the legacy scripts.

Key Components

ComfyApi (api.ts)

Main API client class that handles communication with the ComfyUI backend. Provides methods for:

  • Queue management
  • Model operations
  • Extension handling
  • WebSocket communication
  • User data management

ComfyApp (app.ts)

Core application class that manages:

  • Graph manipulation
  • Node management
  • Canvas interactions
  • Extension system
  • Workflow state

UI Components (ui/)

Collection of reusable UI components including:

  • Buttons and button groups
  • Popups and dialogs
  • Draggable lists
  • Image previews
  • Menu system
  • Settings dialog

Integration with Vite

All TypeScript exports are shimmed through Vite configuration to maintain compatibility with the legacy JavaScript codebase. The shimming logic can be found in vite.config.mts.

Legacy Compatibility

This codebase maintains compatibility with the original ComfyUI Legacy Frontend while providing TypeScript type safety and modern development features.

For users wanting to fall back to the legacy frontend, use the command line argument:

--front-end-version Comfy-Org/ComfyUI_legacy_frontend@latest