Comfy-Org / Comfy-Org/ComfyUI_frontend
scripts/ui.ts — 717-line legacy UI barrel with internal circular deps
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 699
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 490
Description
## Problem
`src/scripts/ui.ts` is a 717-line file containing:
- `ComfyUI` class (legacy UI manager with DOM manipulation, queue UI, settings dialog, auto-queue toggle)
- `$el()` utility function (DOM element factory)
- `ComfyList` class (legacy queue/history list)
- `dragElement()` function (raw DOM drag-and-drop)
- Re-exports: `ComfyDialog`, `ComfySettingsDialog`, `toggleSwitch`
It creates circular deps with its own subdirectory:
- `scripts/ui.ts ↔ scripts/ui/dialog.ts`
- `scripts/ui.ts ↔ scripts/ui/toggleSwitch.ts`
### Current consumers
Only 4 files import from `scripts/ui.ts`:
- `groupNodeManage.ts` — uses `$el`
- `clipspace.ts` — uses `$el`, `ComfyDialog`
- `nodeTemplates.ts` — uses `$el`, `ComfyDialog`
- `litegraphService.ts` — uses `$el`
### Relationship to existing issues
This is **distinct from** #11029 (app.ts god class). `ui.ts` is the legacy UI rendering layer; `app.ts` is the application orchestrator. Both are large legacy files but serve different roles.
### Suggested fix
1. Extract `$el()` to a standalone utility (e.g. `utils/domUtil.ts`) — it's small and useful
2. Deprecate `ComfyUI` class — migrate settings/queue UI to Vue components
3. Break internal circular deps by restructuring the `scripts/ui/` barrel
### Files involved
- `src/scripts/ui.ts`
- `src/scripts/ui/dialog.ts`
- `src/scripts/ui/settings.ts`
- `src/scripts/ui/toggleSwitch.ts`
Parent: #11022
┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-11104-scripts-ui-ts-717-line-legacy-UI-barrel-with-internal-circular-deps-33e6d73d3650817687f6c25cb8ea5cc0) by [Unito](https://www.unito.io)
Contributor guide
Assessment
This issue has not been assessed yet.