Files
melMass-comfy_mtb/web
Mel Massadian 114db05be0 refactor: 🔨 migrate comfy_shared to typescript and modularize
Split monolithic 1400-line comfy_shared.js into focused TypeScript modules in web_source/src/comfy_shared/:
- api.ts: server API utilities (runAction, getServerInfo, setServerInfo)
- colors.ts: color brightness utilities
- documentation.ts: node documentation widget system
- dom.ts: DOM and HTML utilities
- dynamic-connections.ts: dynamic input/output management
- logger.ts: logging utilities with toast notifications
- node-extensions.ts: node type extension helpers
- storage.ts: namespaced localStorage management
- types.ts: comprehensive type definitions
- utils.ts: base utilities (UUID, debounce, deep merge)
- widgets.ts: LiteGraph widget utilities

Benefits:
- ~200 LOC reduction through proper typing and elimination of redundant code
- Better code organization with single-responsibility modules
- Full TypeScript type safety with proper generics
- Improved documentation and maintainability
- Easier to tree-shake unused utilities

Updated vite.config.ts to build comfy_shared as separate entry point and marked external dependencies (/mtb_async modules).

Modified InspectorItem.svelte to use extracted item.value instead of always pulling from widgets[0].

Renamed panel.ts to panel.svelte.ts to enable Svelte 5 runes and made APIPanel reactive using $state instead of $$set.
2025-12-07 19:54:31 +01:00
..
2024-11-20 21:41:57 +01:00
2024-04-25 21:56:59 +02:00
2024-05-27 22:28:53 +02:00
2025-09-07 11:55:05 +00:00
2025-06-26 15:42:31 +02:00
2025-09-07 11:55:06 +00:00
2025-09-07 11:55:05 +00:00
2025-06-07 14:34:39 +02:00
2025-09-07 11:55:05 +00:00
2025-06-26 17:33:38 +02:00
2024-04-27 14:16:07 +02:00
2023-12-02 19:16:35 +01:00

Core

These 3 scripts cannot be used independently and must all be present to work, they are mostly enhancing the frontend of python nodes

  • comfy_shared: library of methods used in mtb_widgets and debug

mtb_widgets define ui callbacks, and various widgets like the COLOR type:

or the BOOL type:

There is also Debug which is a node that should be able to display any data input, it handle a few cases and fallback to the string representation of the data otherwise: debug

note + A basic HTML note mainly to add better looking notes/instructions for workflow makers: image

Standalone

These scripts can be taken and placed independently of comfy_mtb or any other files, mimicking what pythongosss did for their

  • imageFeed: a fork of @pythongosssss ' s image feed, it adds support for: a lightbox to see images bigger, a way to load the current session history (in case of a web page reload), and different icons, most of the work come from the original script.

Note

The original imagefeed got updated since and offer more options, ideally I would clean my lightbox thing and PR it to pythongoss later but in the meantime the script will detect if you already use the original one and not load this fork

  • imagefeed2-hd

  • notify: a basic toast notification system that I use in some places accross mtb, it can be used by simply calling window.MTB.notify("Hello world!")
    extract