Commit Graph

1023 Commits

Author SHA1 Message Date
filtered
48bf415e52 [API] Allow connecting to nodes without known slot (#942)
Allows better downstream customisation of `LinkConnector`.
2025-04-20 08:20:12 +00:00
Chenlei Hu
453257cd30 [Bug] Remove unused prop LayoutElement.value (#940)
Resolves https://github.com/Comfy-Org/litegraph.js/issues/939

The prop is unused and is causing object clone circular ref issue.
2025-04-19 22:23:49 -04:00
Christian Byrne
7c88bda647 Add optional icon to LGraphBadge and use for API nodes (#930)
Adds option to include an icon when creating an `LGraphBadge`. Then,
adds the icon to the title of nodes whose `constructor.nodeData` has a
non-null `credits_cost` property (API nodes that ComfyUI_frontend was
able to successfully query a credit cost for).


![Selection_1228](https://github.com/user-attachments/assets/9b63c0d1-b25b-4066-858f-7f32488eeb38)


- https://github.com/Comfy-Org/ComfyUI-private/pull/2
- https://github.com/Comfy-Org/litegraph.js/pull/930
- https://github.com/Comfy-Org/ComfyUI_frontend/pull/3470

---------

Co-authored-by: filtered <176114999+webfiltered@users.noreply.github.com>
2025-04-20 10:10:45 +10:00
filtered
6293b4bbe0 Disconnect moved output links when dropped on canvas (#936)
- Resolves #884
2025-04-18 23:22:28 +10:00
filtered
02d165bf2a [API] LinkConnector reset no longer run after drop (#935)
`reset()` is no longer automatically called after `dropLinks`. This
brings the API in line with original intent, and how canvas is already
configured; reset is called by `pointer.finally()`.
2025-04-18 11:45:36 +00:00
filtered
5c76bec611 [TS] Export types (#933)
Re-exports module-level exports at the package level.
2025-04-18 21:01:10 +10:00
filtered
ce46f19de9 Fix LinkConnector methods cannot be cancelled via API (#934)
- Checks if `e.preventDefault()` has been called for all cancellable
LinkConnector callbacks
- Sets `cancelable: true` on dispatched events
- Dedupes canvas pointer calls
2025-04-18 20:50:33 +10:00
filtered
51ec57dc5c Fix graph.links cannot be iterated (#932)
Proxied links object now correctly supports spread operator.
2025-04-16 09:13:20 +00:00
Chenlei Hu
0063bf618d [Bug] Show widget slot when slot is hovered (#929)
Resolves https://github.com/Comfy-Org/litegraph.js/issues/925


https://github.com/user-attachments/assets/81bd6ce3-6feb-456a-9bb3-e512008b2e63
2025-04-15 10:59:56 -04:00
Chenlei Hu
bdffdc9f10 [Bug] Fix configure of non-serializable widget (#921)
Follow up on https://github.com/Comfy-Org/litegraph.js/pull/915

Filter out non-serializable widgets during node configuration. Current
usage in frontend should not be affected as preview media widgets are
mostly dynamically added at the end of widget list.
2025-04-12 21:01:31 -04:00
filtered
2e72031344 [API] Remove deprecated: getAncestors (#919)
Removes unused and deprecated API: LGraph.getAncestors
2025-04-11 17:29:53 +00:00
Christian Byrne
3ba61c7265 Don't log every single node being replaced when node defs refreshed (#918)
Currently, when node defs are refreshed (e.g., by pressing "r"
shortcut), every single node def is logged, which is useless when
there's hundred of nodes and clutters console. This PR changes to only
log those messages when in debug mode.
2025-04-11 09:11:25 -07:00
Chenlei Hu
197a6cbae8 Add IBaseWidget.serialize flag (#915)
https://github.com/Comfy-Org/ComfyUI_frontend/pull/3323

Some widgets are only used for display purpose (The preview image
widget), their value shouldn't be serialized into the workflow. This PR
adds a flag to allow widget to skip value serialization.
2025-04-09 16:06:05 -04:00
filtered
04b4485cc9 Add Disposable interface & polyfill (#914)
Adds the `Disposable` and `AsyncDisposable` interfaces via polyfill.

Implements Disposable interface in `InputIndicator`.

Ref:
https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html#using-declarations-and-explicit-resource-management
2025-04-09 11:05:39 +00:00
filtered
c60e9d8080 [Cleanup] Remove unused code (#913) 2025-04-09 09:35:08 +00:00
filtered
ae4a63c839 [Cleanup] Simplify code (#912)
- Simplifies internal APIs used by private functions
- Prefer param destructuring over manual object re-impl.
2025-04-09 08:54:34 +00:00
filtered
297b557b94 [Refactor] Rename layout method to arrange/measure (#911)
Prefer verb function names.
2025-04-09 07:49:41 +00:00
filtered
05e8e25b6b [Cleanup] Remove redundant code (#906)
Removes a now-redundant workaround from LinkConnector.
2025-04-09 16:28:34 +10:00
Chenlei Hu
bf5e3f3c77 [Bug] Fix layout issue caused by absolute positioned slots (#908)
Before:

![image](https://github.com/user-attachments/assets/00bbbf14-a153-4301-b4c4-0c30cb2ebcc7)

After:

![image](https://github.com/user-attachments/assets/2247a0a5-2757-478c-b701-9ceab7a133cc)

Workflow:

[dynamically_added_input.json](https://github.com/user-attachments/files/19640371/dynamically_added_input.json)

This PR also fixes the issue that output slot's `pos` property is not
relative to node pos.
2025-04-07 19:52:58 -04:00
Chenlei Hu
d77100c401 [Refactor] Add LGraphNode.layout (#907)
Moves layout of LGraphNode slot and widget to `LGraphNode.layout`.
Codesearch shows that there is currently no usage on posY arg, so we can
just pass null to it instead.
https://cs.comfy.org/search?q=context:global+drawNodeWidgets&patternType=keyword&sm=0
2025-04-07 15:40:58 -04:00
filtered
079a18a391 Reland "Support associated socket for widgets" (#904)
- Reverts Comfy-Org/litegraph.js#896
- Relands #891
2025-04-06 11:35:42 -04:00
filtered
3815296ab5 Add Disconnect Links option to input slot menu (#901) 2025-04-06 15:22:19 +00:00
filtered
ed34080e46 Remove auto-generated serialisation data on load (#900)
- Resolves #883
2025-04-06 15:10:08 +00:00
filtered
3b5cc8cd19 Add alt-right-click to delete reroutes (#899)
Alt-right-click to remove, regular right-click to show context menu.
2025-04-06 14:55:17 +00:00
filtered
6cafeeff19 Fix corruption of selected link highlights (#897)
Occurred when deselecting one side of a link when both sides were
selected.
2025-04-06 14:30:22 +00:00
filtered
7360e09172 Standardise right-click behaviour (#894)
- Uses CanvasPointer click to open context menu (formerly occurred on
`pointerdown`)
- Frees up right-click & drag to be used by future features
- Right-clicking a reroute now selects the reroute, using the same
selection logic used for right-clicking nodes
2025-04-06 13:31:09 +00:00
filtered
c77082fe2f Close context menus on any click outside the menu (#895)
Current: Right click in e.g. `textarea` leaves litegraph context menus
open.
Proposed: Any click anywhere outside the context menu (or its sub-menus)
will close all context menus.
2025-04-06 13:30:42 +00:00
filtered
ee625b4112 Revert "Support associated socket for widgets" (#896)
Reverts Comfy-Org/litegraph.js#891

Temporary revert to unblock other PRs (causing test failures; frontend
PR for this has not yet been merged).
2025-04-06 12:38:18 +00:00
Chenlei Hu
1ef4921c0a Support associated socket for widgets (#891)
This PR is the litegraph side change necessary for widget sockets
feature in ComfyUI_frontend. Changes include

- Add readonly `Widget.computedDisabled` property for getting the
computed disabled state. When the associated socket is connected, the
widget is disabled
- Dynamically show the associated socket when
      - the mouse is over the widget
      - the slot is valid during link drop
      - the slot is connected
- Removes the legacy widget drop behavior

Ref: https://github.com/Comfy-Org/rfcs/pull/9
2025-04-05 16:29:37 -04:00
filtered
c07176eb08 [Cleanup] Remove redundant code (#890)
- Follow-up on #888
2025-04-05 09:45:43 +00:00
filtered
64c7113440 Fix link corruption (#888)
- Adds link & floating link integrity tests to all LinkConnector
integration tests
- Fixes link changes may be lost when moving floating links
2025-04-05 05:34:55 +00:00
Chenlei Hu
29c923e0e3 [Bug] Fix slot link state corruption on moving link between sockets (#882)
Ref: https://github.com/Comfy-Org/litegraph.js/issues/881

This PR fixes the corrupted link state when moving link from one input
socket to another.
2025-04-04 14:28:41 -04:00
Chenlei Hu
8a94232f61 [nit] Remove IDrawOptions.showText (#879)
`showText` is essentially an alias of `!lowQuality`. Removing it from
the interface.
2025-04-03 11:24:51 -04:00
filtered
05b0918915 Support dragging reroutes from floating links (#878)
Allows dragging reroutes from floating links.
2025-04-03 12:08:28 +00:00
Chenlei Hu
184ba3915a [TS] Properly type slot widget (#876)
INodeSlot.widget is not real widget references at runtime. This PR
narrows the type so that we don't run into unexpected issues.
2025-04-01 14:54:14 -04:00
Chenlei Hu
df279024c4 Upstream render of slot error (#872)
Upstream slot error rendering from ComfyUI_frontend.


![image](https://github.com/user-attachments/assets/d14b49a1-7943-4249-a20a-8b3d33df8ddb)
2025-03-30 17:40:44 -04:00
Chenlei Hu
30a7f19a64 Upstream progressbar rendering (#871)
Upstreams progress bar rendering from ComfyUI_frontend.
2025-03-30 17:14:09 -04:00
Chenlei Hu
0eeaf90647 [nit] Rename IDrawBoundingOptions args (#869) 2025-03-30 11:46:45 -04:00
Chenlei Hu
854ac4350f Add LGraphNode.strokeStyles API (#868)
This should allow frontend drop the stroke logic in hijack of
`drawNodeShape`. Example usage:

```ts
node.strokeStyles["executionError"] = (this: LGraphNode) => 
  app.lastNodeErrors?.[this.id] ? { colour: 'red', thickness: 2 } : undefined
```
2025-03-30 11:29:37 -04:00
Chenlei Hu
27a2b785ac [Cleanup] Remove use_legacy_node_error_indicator (#867)
The fallback option was added in
https://github.com/Comfy-Org/litegraph.js/pull/358. So far no code is
using this legacy fallback option. Removing it now.
2025-03-30 10:30:39 -04:00
filtered
7b3ea64714 Fix 862 (#864)
- Follow-up on #862
- Corrects issues with floating reroute switch logic
- Updates test expectations
2025-03-28 09:00:58 +11:00
filtered
a20bae064f Allow floating reroute switches (#862)
- Resolves https://github.com/Comfy-Org/ComfyUI_frontend/issues/3247

Bypasses the logic that automatically removed reroutes that had no
remaining links. Reroutes are now always converted to floating whenever
reroutes are reconnected.
2025-03-27 18:18:22 +00:00
Chenlei Hu
a6aec4017b [Bug] Fix link drop on widget (#860)
Resolves https://github.com/Comfy-Org/litegraph.js/issues/857
2025-03-26 15:08:04 -04:00
Chenlei Hu
6fd6c60b9f [Bug] Fix drag link from input to output (#859)
Resolves https://github.com/Comfy-Org/litegraph.js/issues/858
2025-03-26 14:53:30 -04:00
Chenlei Hu
808d78169b Early return in LGraphCanvas.deselectAll (#856)
Avoid trigger `onSelectionChange` when nothing is selected.
2025-03-25 10:22:40 -04:00
Chenlei Hu
c5db2d8736 [Bug] Fix number widget range not enforced (#850)
Resolves https://github.com/Comfy-Org/ComfyUI_frontend/issues/3204
2025-03-24 15:37:55 -04:00
filtered
123c46d28b [TS] Add placeholder interfaces for subgraph classes (#851) 2025-03-24 19:23:20 +00:00
filtered
5662aa3790 [API] Remove unused: LGraph.getSupportedTypes (#849)
Also removes unused `supported_types` static array.
2025-03-24 07:03:07 +00:00
filtered
f0bd360935 [API] Remove unused callbacks (#848)
- Follow-up on #847
- Removes now-redundant callbacks
2025-03-24 06:58:56 +00:00
filtered
28543d7d9d [API] Remove unused LGraph APIs (#847)
Removes unused, outdated helper methods from the original, incomplete
subgraph impl.
2025-03-24 06:24:28 +00:00