- Returns object with slot, index, and pos
- Locate-by-type returns object with slot & index
- Uses standard `undefined` return for concise chaining & validation
- Free 10x perf increase over getConnectionPos (used basic random data
to test, out of curiosity)
`LGraphNode.connect()` has been altered many times and attempts to
handle too many scenarios in a single public call.
- Moves link creation to a separate function
- Allows the legacy duck-typed API to continue functioning as-is
### Current
- Connections are disconnected the moment a link starts being dragged
- Reseating a connection where it came from creates a new connection
- If the process is somehow interrupted, the links are already gone
### Proposed
- Connection is disconnected after a new connection is made
- Rendering is bypassed for the link segment being moved
- Does nothing if dropping a link exactly where it came from
- Adds early return when trying to connect a node to itself
- Removes unused context menu for optional in/outputs
- At the top of the node context menu, greyed out `Inputs` and `Outputs`
- API does not fit with current design
- If required, rewrite would be simpler
- Adds remaining TS nullable types
- Adds type guards to allow strict mode
- Uses explicit throw in places that would throw regardless
- Adds ts-ignore that must be removed later
* [ ] #578
- Adds minor type coercions to resolve type errors
- Deprecates unused public APIs
- 7a0336e3ad7239b7bb588bbbe7912322257e9ae2 works around a bug in the tsc
strict plugin
- Adds ts-ignore that must be removed later
* [ ] #578
Removes formatters' ability to print code that goes to a new line, but
uses no braces to delineate.
It becomes more difficult to follow when using JS-style indents (two
spaces).
No effort required - braces added by auto-fixer.
- Prefer comments above lines over end-of-line comments
- Makes auto-formatting easier
- Subjective, but it is generally easier to read in JS
- Standardises JSdoc format
- Auto-fixes for many issues (applies on save w/ESLint extension)
Reverts Comfy-Org/litegraph.js#601
Reason: breaks legacy reroute
On inserting a workflow with legacy reroute node
```
Uncaught (in promise) NullGraphError: Attempted to access LGraph reference that was null or undefined.
at RerouteNode.removeOutput (LGraphNode.ts:1425:28)
at RerouteNode.clone (rerouteNode.ts:215:18)
at LGraphCanvas.copyToClipboard (LGraphCanvas.ts:3331:29)
at Object.insertWorkflow (workflowService.ts:350:12)
```
- Guards against nullish `graph`
- [Fix regression in return type -
getInputLink](143ca5f3f2)
- long-standing, so no impact apparently
- Resolves some potential null dereferencing
- Part of effort to convert LGraphNode to TS strict
- Adds some small runtime changes - no impact expected, but it is
possible
- Runtime changes are in separate commits from compile-time type changes
- Risk of downstream impact is low
- Replaces traditional incrementing `for` loops and `forEach()` calls with modern `for..of` syntax
- Improves readability
- Semantic checking used; not expecting issues to arise from this portion