Format all code with prettier (#197)

* Add formatter support

* Format all code

* Fix moved @ts-expect-error
This commit is contained in:
Chenlei Hu
2024-10-07 14:06:44 -04:00
committed by GitHub
parent 8418c884c0
commit 28382b7e45
25 changed files with 16345 additions and 14414 deletions

View File

@@ -1,62 +1,69 @@
import type { ISlotType } from "./interfaces"
import type { NodeId } from "./LGraphNode"
import type { ISlotType } from "./interfaces";
import type { NodeId } from "./LGraphNode";
export type LinkId = number | string
export type LinkId = number | string;
export type SerialisedLLinkArray = [LinkId, NodeId, number, NodeId, number, ISlotType]
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
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;
this.origin_id = origin_id;
this.origin_slot = origin_slot;
this.target_id = target_id;
this.target_slot = target_slot;
constructor(id, type, origin_id, origin_slot, target_id, target_slot) {
this.id = id;
this.type = type;
this.origin_id = origin_id;
this.origin_slot = origin_slot;
this.target_id = target_id;
this.target_slot = target_slot;
this._data = null;
this._pos = new Float32Array(2); //center
this._data = null;
this._pos = new Float32Array(2); //center
}
// configure(o: LLink | SerialisedLLinkArray) {
configure(o) {
if (o.constructor === Array) {
this.id = o[0];
this.origin_id = o[1];
this.origin_slot = o[2];
this.target_id = o[3];
this.target_slot = o[4];
this.type = o[5];
} else {
this.id = o.id;
this.type = o.type;
this.origin_id = o.origin_id;
this.origin_slot = o.origin_slot;
this.target_id = o.target_id;
this.target_slot = o.target_slot;
}
}
// configure(o: LLink | SerialisedLLinkArray) {
configure(o) {
if (o.constructor === Array) {
this.id = o[0];
this.origin_id = o[1];
this.origin_slot = o[2];
this.target_id = o[3];
this.target_slot = o[4];
this.type = o[5];
} else {
this.id = o.id;
this.type = o.type;
this.origin_id = o.origin_id;
this.origin_slot = o.origin_slot;
this.target_id = o.target_id;
this.target_slot = o.target_slot;
}
}
serialize(): SerialisedLLinkArray {
return [
this.id,
this.origin_id,
this.origin_slot,
this.target_id,
this.target_slot,
this.type
];
}
serialize(): SerialisedLLinkArray {
return [
this.id,
this.origin_id,
this.origin_slot,
this.target_id,
this.target_slot,
this.type,
];
}
}