Commit Graph

1488 Commits

Author SHA1 Message Date
filtered
0dd060a369 [API] Require always-exported node properties be defined (#821)
Now required:

- `type`
- `pos`
- `size`
- `flags`
- `order`
- `mode`
2025-03-23 03:25:57 +11:00
filtered
6380037d1f [API] Add subgraph schema export types (serialisation) (#822)
Adds export / serialisation interfaces to support subgraph impl.
2025-03-22 15:59:01 +00:00
filtered
cd9778bb6c Fix reroutes lost when dropping output links on reroute (#820)
Blocks attempts to drag links from an output onto a reroute in any of
the links.
2025-03-22 13:49:26 +00:00
Comfy Org PR Bot
b87a671a88 0.11.0-0 (#819)
Preminor version increment to 0.11.0-0

Co-authored-by: webfiltered <176114999+webfiltered@users.noreply.github.com>
2025-03-22 09:25:16 +11:00
filtered
2dbd5f4cf0 Allow creating floating reroutes from new link menu (#818)
Adds an `Add Reroute` option to the new link menu. Creates a new
floating reroute connected to the source slot.
2025-03-22 09:23:20 +11:00
filtered
7c6245ab1c [Test] Add LinkConnector unit & integration tests (#816)
- Follow-up on #817

### Unit tests

Adds tests for:

- LinkConnector
- LGraph

### Integration tests for LinkConnector

- Uses and configures a real graph + LGraph
- Avoids mocks
  - User input is still mocked
- Performs actual tasks as would be called by LGraphCanvas
- A little verbose in places, but _many_ edge cases are caught by these
tests
2025-03-22 06:47:40 +11:00
filtered
850d1b9652 [API] Finalise LinkConnector design, adding reroute logic (#817)
- Splits link connect logic out of `LinkConnector` to individual
`RenderLink` classes
- Add support for connecting / reconnecting reroutes in various
configurations
- Adds support for moving existing floating links from outputs / inputs
- Fixes numerous corruption issues when reconnecting reroutes / moving
links
- Tests in separate PR #816
2025-03-21 19:41:20 +00:00
filtered
87aeab16a0 [API] Fix several floating links issues & add Reroute.totalLinks (#815)
Resolves several issues with floating links.  Highlights:

- Caches floating links on slots, removing some loop checks (inefficient
/ does not scale)
- Simpler APIs
- Adds `Reroute.totalLinks` (regular and floating
2025-03-21 19:17:54 +00:00
filtered
766e69bbf1 Fix regression: shift-drag new link from link line (#814)
- Resolves #375
- Resolves https://github.com/Comfy-Org/ComfyUI_frontend/issues/2941
2025-03-21 19:10:26 +00:00
filtered
38bbf2fead Add reroute snap highlight (#813)
### Reroute snap highlight

When connecting links, a simple border now helps to indicate that a
connecting link can be dropped on a reroute below the pointer.

### Reroute ID badges

Optionally, intended for debugging purposes, drawing of ID badges can
also be manually enabled via console.
2025-03-21 19:05:09 +00:00
filtered
a043e7a72e [API] Add reroute convenience methods (#812)
Adds `LGraph.getReroute`, which accepts null & undefined IDs. Interface
overloads result in `never` when given a _known_ `undefined` or `null`
value.
2025-03-21 18:58:07 +00:00
filtered
cdbc0fa5e5 Cancel link connection by pressing Esc (#811)
Cancels connecting links if the escape key is pressed.
2025-03-21 18:53:13 +00:00
filtered
4078e3ad8b Improve reroutes - prep for LinkConnector overhaul (#810)
- Fixes TS types
- Various bug fixes for reroute / link (re)connect
- Adds reroute snap circle when connecting links
- Validates reroutes on drop (part of larger work)
- Prevent nodes linking to themselves
2025-03-21 18:47:36 +00:00
filtered
9e64bf7278 [Test] Add LinkConnector tests (#808) 2025-03-20 22:20:11 +11:00
filtered
e65898b9ec [API] Remove unused: LGraph.onAction (#802) 2025-03-18 20:06:46 +00:00
filtered
7845be9b15 [TS] TS type fix & nits (#801)
Fixes downstream type specificity issues with UUID template type. No
real benefit from template literal type at present.
2025-03-17 13:52:59 +00:00
filtered
0b4b420445 Add lib export: createUuidv4 (#800) 2025-03-17 13:39:19 +00:00
Comfy Org PR Bot
1579b5ea71 0.10.9 (#799)
Patch version increment to 0.10.9

Co-authored-by: webfiltered <176114999+webfiltered@users.noreply.github.com>
2025-03-17 13:06:36 +00:00
filtered
257d4fc7b9 Fix old graph ID kept when configuring new graph (#798)
Prevents ID leakage when using default `LGraph.configure()` settings.
2025-03-17 23:54:44 +11:00
filtered
39a9799db7 [Test] Add unit tests - complex floating links & nodes (#796) 2025-03-17 13:25:57 +11:00
filtered
c1f9745e54 Add cursor rule for unit tests (#795)
- Adds baseline cursor rules to assist agents generating unit tests.
- Ignores CI fro .cursor and other directories
2025-03-17 13:23:39 +11:00
Comfy Org PR Bot
5821049493 0.10.8 (#794)
Patch version increment to 0.10.8

Co-authored-by: huchenlei <20929282+huchenlei@users.noreply.github.com>
2025-03-16 19:13:52 -04:00
Chenlei Hu
b71150a939 [Test] Add more tests on reroute (#793) 2025-03-16 19:12:57 -04:00
Chenlei Hu
94b9ecec71 [Bug] Fix remove of floatingLinks (#792)
Resolves https://github.com/Comfy-Org/litegraph.js/issues/791

This PR fixes removal of floating links.

---------

Co-authored-by: filtered <176114999+webfiltered@users.noreply.github.com>
2025-03-16 22:13:24 +00:00
filtered
dbc605e4da Add graph ID creation / serialisation (#790)
- Updates UUIDv4 generator
- Adds a unique id & revision support to graphs
- `revision` to be incremented downstream (e.g. on save)
- `id` automatically assigned if not provided
2025-03-16 18:41:08 +00:00
filtered
3447ea1981 Remove unused code (#789)
'start' and 'finish' do not exist on canvas 2d context.
2025-03-16 04:37:34 +00:00
filtered
9b16144390 [CodeHealth] Standardise & remove deprecated code (#787)
- Removes event.keyCode use (i18n-safe)
- Prefer strict equality for readability
2025-03-15 03:15:38 +00:00
Comfy Org PR Bot
20dc103aa9 0.10.7 (#786)
Patch version increment to 0.10.7

Co-authored-by: webfiltered <176114999+webfiltered@users.noreply.github.com>
2025-03-14 03:24:42 +00:00
filtered
cd65c4bfea Fix regression in #782 undo fails via context menu (#785)
Only breaks when adding reroute via context menu.
2025-03-14 03:09:17 +00:00
Comfy Org PR Bot
680cf631e0 0.10.6 (#784)
Patch version increment to 0.10.6

Co-authored-by: webfiltered <176114999+webfiltered@users.noreply.github.com>
2025-03-14 12:50:51 +11:00
filtered
bd17247b4f Centre reroutes spawned via link context menu (#782)
- Centre reroutes spawned via link context menu
- Fix changeTracker history for reroute context menu
2025-03-14 12:46:40 +11:00
filtered
48483670f5 Fix #781 regression in reconnect floating reroutes (#783)
- Follow-up on #781
- Fixes regression when reconnecting a reroute chain from an input
2025-03-14 01:41:52 +00:00
filtered
690f7bdfb3 Improve reroute re-connecting UX (#781)
More intuitive UX when connecting reroutes to each other.
- Remove middle reroutes when connecting around them
- Fix earlier reroutes in chain lost when stitching
- Fix all reroutes removed when stitching in reverse
2025-03-14 01:15:38 +00:00
Comfy Org PR Bot
9dda7e937b 0.10.5 (#780)
Patch version increment to 0.10.5

Co-authored-by: webfiltered <176114999+webfiltered@users.noreply.github.com>
2025-03-14 11:19:24 +11:00
filtered
b80e1744be Snap to reroute when connecting links (#778)
Add basic snap to reroute on hover; reuses existing slot visual.
2025-03-14 00:18:17 +00:00
filtered
bb822e999f Fix new link from reroute to canvas does nothing (#779)
Resolves regression - now performs the same action as dropping a link
from an output to canvas.
2025-03-14 11:17:44 +11:00
filtered
9315a8810e Increase slot context menu hit box (#777)
Previously, gap between slots was the same height as the slot itself.

Gap is now entirely removed, bringing it inline with the
previously-modified snap and link connection hit boxes.
2025-03-13 22:30:22 +00:00
filtered
034692120e [Refactor] Replace deprecated getConnectionPos (#776)
Uses `getInputPos` or `getOutputPos` where appropriate.
2025-03-13 22:19:28 +00:00
filtered
36f197b34e Fix move links & drop on canvas ignores reroutes (#775)
Moving links onto the canvas re-connects existing reroutes after picking
a new node.
2025-03-13 20:56:07 +00:00
Comfy Org PR Bot
d59cc61a21 0.10.4 (#774)
Patch version increment to 0.10.4

Co-authored-by: huchenlei <20929282+huchenlei@users.noreply.github.com>
2025-03-14 07:18:07 +11:00
filtered
e6a914117b Add floating reroutes (#773)
### Floating reroutes

Native reroutes can now be kept in a disconnected state.

Link chains may be kept provided they are connected to _either_ an input
or an output. By design, reroutes will be automatically removed if both
sides are disconnected.
2025-03-13 19:56:57 +00:00
Chenlei Hu
d0e1998415 [TS] Add null-checks for LGraphNode layouts (#772)
Ref: https://github.com/Comfy-Org/litegraph.js/issues/616
Resolves https://github.com/Comfy-Org/litegraph.js/issues/770

This PR adds null-checks to various part of layout code to avoid we get
into irrecoverable state.
2025-03-13 13:50:04 -04:00
filtered
18811f50fc Add serialisation support for floating links (#771)
Adds the serialisation code to support the new floating links impl.
2025-03-13 15:20:14 +00:00
filtered
df36b23db8 [TS] Prefer narrow interface - readonly network (#769)
Uses new readonly link network interface in APIs that do not require
write.
2025-03-13 15:00:57 +00:00
filtered
835e22d754 [Cleanup] Removed unused convenience setter - reroutes (#768)
- New features are making the reroutes convenience setter unmanageable.
- Not currently in use.
- Prefer `configure()`, as it includes validation.
2025-03-13 14:53:26 +00:00
filtered
2e9f877bbd [Cleanup] Reroute and serialisation (#767)
- Fixes root cause of minor in-memory-only corruption when deleting
reroutes from output slots
  - Already automatically corrected via serialisation
- If `reroutes` or `links` are empty arrays, removes them from newer
object-based serialised output entirely
- Minor refactors
- Removes unused code
- Fixes some serialisation types
- Adds `ReadonlyLinkNetwork` interface
2025-03-13 14:40:12 +00:00
filtered
bcaeccfc45 Fix #346 last reroute is never deleted (#766)
Clears the reroutes in extras when exporting for serialisation, if none
exist.

- Resolves #346
2025-03-13 00:35:05 +00:00
filtered
486c5ad6c0 [Refactor] Split link render code to private method (#765)
- Enables floating reroutes
- Allows rendering logic for a chain of reroutes to be called without a
real `LLink` connected to an input
- Deprecates unused `visible_links` array
2025-03-13 00:00:52 +00:00
filtered
cca2ac28e0 [Refactor] Prefer for loop over reduce (#764)
- Follow-up on #763
2025-03-13 10:12:04 +11:00
Chenlei Hu
77465113cd Implement _.pick to simplify serialization (#763)
Simplify the serialization code, so that we only write each prop once.
2025-03-12 16:08:54 -04:00