Comfy-Org / Comfy-Org/ComfyUI_frontend

Allows exporting `WIDGET_TYPE_MAP` for advanced widget creation.

Open
#4,721 2 comments 1 reaction 1 assignee Claimed by @huchenlei View on GitHub
area:widgets developer experience Public API
Dominant language
TypeScript
Stars
2k
Forks
702
Avg merge
1d 8h
Merged PRs (30d)
512

Description

Currently with new behavior introduced in https://github.com/Comfy-Org/litegraph.js/commit/4d36369cd8dd228dc8686bb33195e83d4ef22b70, all extensions implementation that directly push plain widget object to widgets array will break since `toClass` will blindly clone matching type but without even considering the fact that plain object works previously.

This is needed since some nodes could add an explicit `slider` type but Comfy did not export that within `ComfyWidgets` hence the need to explicit create it.

Affected line:
https://github.com/Comfy-Org/litegraph.js/blob/9b16144390fce1d8d972cdef1be58c0692e7627a/src/LGraphCanvas.ts#L2334

I've suggest to let people directly create conformant class through exposing WIDGET_TYPE_MAP somewhere in `LiteGraph` namespace, revert the change to accept plain object, or exporting `slider` widget as official widget.

Or it is already exported somewhere?

┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-4721-Allows-exporting-WIDGET_TYPE_MAP-for-advanced-widget-creation-2476d73d365081aba1daff44d8321371) by [Unito](https://www.unito.io)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.