Typescript conversion 0.7.84 (#194)

* Convert litegraph.js to TS

* Overhaul static litegraph.d.ts with updated types

* Fix rename oversights and revert fix unused param

- Some functions were broken by merging updated TS function signatures which included param renames
- Removal of unused params does not belong in the TS conversion PR, and has been reverted

* Remove legacy static .d.ts file

* Add callback decl from #180

Support allowing links to widgets (#180)
c23e610c11

* Convert NodeId to string | number

Results in significantly less downstream changes, despite being a change from the old static file.

---------

Co-authored-by: filtered <176114999+webfiltered@users.noreply.github.com>
This commit is contained in:
Chenlei Hu
2024-10-07 11:15:29 -04:00
committed by GitHub
parent 36a8b1fea0
commit 142c22ea41
18 changed files with 1703 additions and 2322 deletions

View File

@@ -1,7 +1,23 @@
// @ts-nocheck
//this is the class in charge of storing link information
import type { ISlotType } from "./interfaces"
import type { NodeId } from "./LGraphNode"
export type LinkId = number | string
export type SerialisedLLinkArray = [LinkId, NodeId, number, NodeId, number, ISlotType]
//this is the class in charge of storing link information
export class LLink {
id?: LinkId
type?: ISlotType
origin_id?: NodeId
origin_slot?: number
target_id?: NodeId
target_slot?: number
data?: number | string | boolean | { toToolTip?(): string }
_data?: unknown
_pos: Float32Array
_last_time?: number
constructor(id, type, origin_id, origin_slot, target_id, target_slot) {
this.id = id;
this.type = type;
@@ -13,6 +29,8 @@ export class LLink {
this._data = null;
this._pos = new Float32Array(2); //center
}
// configure(o: LLink | SerialisedLLinkArray) {
configure(o) {
if (o.constructor === Array) {
this.id = o[0];
@@ -30,7 +48,8 @@ export class LLink {
this.target_slot = o.target_slot;
}
}
serialize() {
serialize(): SerialisedLLinkArray {
return [
this.id,
this.origin_id,