From 59c58379fe9d8ea16cd402215fc8059abd1e5d7f Mon Sep 17 00:00:00 2001 From: Alexander Brown Date: Fri, 30 Jan 2026 13:24:16 -0800 Subject: [PATCH] fix: migrate remaining ECMAScript private fields to TypeScript private (#8495) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Migrates remaining `#field` syntax to `private _field` for Vue reactivity compatibility. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-8495-fix-migrate-remaining-ECMAScript-private-fields-to-TypeScript-private-2f86d73d365081ec87afe2273c0ff6eb) by [Unito](https://www.unito.io) Co-authored-by: Amp --- src/lib/litegraph/src/LGraph.ts | 18 +++++++++--------- src/lib/litegraph/src/LLink.ts | 6 +++--- .../litegraph/src/subgraph/SubgraphInput.ts | 8 ++++---- .../litegraph/src/subgraph/SubgraphSlotBase.ts | 8 ++++---- src/stores/nodeDefStore.ts | 4 ++-- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/lib/litegraph/src/LGraph.ts b/src/lib/litegraph/src/LGraph.ts index fd7b7c000..c567335f8 100644 --- a/src/lib/litegraph/src/LGraph.ts +++ b/src/lib/litegraph/src/LGraph.ts @@ -2466,13 +2466,13 @@ export class LGraph } } - #canvas?: LGraphCanvas + private _canvas?: LGraphCanvas get primaryCanvas(): LGraphCanvas | undefined { - return this.rootGraph.#canvas + return this.rootGraph._canvas } set primaryCanvas(canvas: LGraphCanvas) { - this.rootGraph.#canvas = canvas + this.rootGraph._canvas = canvas } load(url: string | Blob | URL | File, callback: () => void) { @@ -2541,9 +2541,9 @@ export class Subgraph /** A list of node widgets displayed in the parent graph, on the subgraph object. */ readonly widgets: ExposedWidget[] = [] - #rootGraph: LGraph + private _rootGraph: LGraph override get rootGraph(): LGraph { - return this.#rootGraph + return this._rootGraph } constructor(rootGraph: LGraph, data: ExportedSubgraph) { @@ -2551,11 +2551,11 @@ export class Subgraph super() - this.#rootGraph = rootGraph + this._rootGraph = rootGraph const cloned = structuredClone(data) this._configureBase(cloned) - this.#configureSubgraph(cloned) + this._configureSubgraph(cloned) } getIoNodeOnPos( @@ -2567,7 +2567,7 @@ export class Subgraph if (outputNode.containsPoint([x, y])) return outputNode } - #configureSubgraph( + private _configureSubgraph( data: | (ISerialisedGraph & ExportedSubgraph) | (SerialisableGraph & ExportedSubgraph) @@ -2611,7 +2611,7 @@ export class Subgraph ): boolean | undefined { const r = super.configure(data, keep_old) - this.#configureSubgraph(data) + this._configureSubgraph(data) return r } diff --git a/src/lib/litegraph/src/LLink.ts b/src/lib/litegraph/src/LLink.ts index 6ca8832a1..0e5dd98b3 100644 --- a/src/lib/litegraph/src/LLink.ts +++ b/src/lib/litegraph/src/LLink.ts @@ -119,14 +119,14 @@ export class LLink implements LinkSegment, Serialisable { /** @inheritdoc */ _dragging?: boolean - #color?: CanvasColour | null + private _color?: CanvasColour | null /** Custom colour for this link only */ public get color(): CanvasColour | null | undefined { - return this.#color + return this._color } public set color(value: CanvasColour) { - this.#color = value === '' ? null : value + this._color = value === '' ? null : value } public get isFloatingOutput(): boolean { diff --git a/src/lib/litegraph/src/subgraph/SubgraphInput.ts b/src/lib/litegraph/src/subgraph/SubgraphInput.ts index 939115513..0f143b7f6 100644 --- a/src/lib/litegraph/src/subgraph/SubgraphInput.ts +++ b/src/lib/litegraph/src/subgraph/SubgraphInput.ts @@ -35,14 +35,14 @@ export class SubgraphInput extends SubgraphSlot { events = new CustomEventTarget() /** The linked widget that this slot is connected to. */ - #widgetRef?: WeakRef + private _widgetRef?: WeakRef get _widget() { - return this.#widgetRef?.deref() + return this._widgetRef?.deref() } set _widget(widget) { - this.#widgetRef = widget ? new WeakRef(widget) : undefined + this._widgetRef = widget ? new WeakRef(widget) : undefined } override connect( @@ -187,7 +187,7 @@ export class SubgraphInput extends SubgraphSlot { * @returns `true` if the connection is valid, otherwise `false`. */ matchesWidget(otherWidget: IBaseWidget): boolean { - const widget = this.#widgetRef?.deref() + const widget = this._widgetRef?.deref() if (!widget) return true if ( diff --git a/src/lib/litegraph/src/subgraph/SubgraphSlotBase.ts b/src/lib/litegraph/src/subgraph/SubgraphSlotBase.ts index 7c717eaa4..4f66d1e14 100644 --- a/src/lib/litegraph/src/subgraph/SubgraphSlotBase.ts +++ b/src/lib/litegraph/src/subgraph/SubgraphSlotBase.ts @@ -46,7 +46,7 @@ export abstract class SubgraphSlot return LiteGraph.NODE_SLOT_HEIGHT } - readonly #pos: Point = [0, 0] + private readonly _pos: Point = [0, 0] readonly measurement: ConstrainedSize = new ConstrainedSize( SubgraphSlot.defaultHeight, @@ -67,14 +67,14 @@ export abstract class SubgraphSlot ) override get pos() { - return this.#pos + return this._pos } override set pos(value) { if (!value || value.length < 2) return - this.#pos[0] = value[0] - this.#pos[1] = value[1] + this._pos[0] = value[0] + this._pos[1] = value[1] } /** Whether this slot is connected to another slot. */ diff --git a/src/stores/nodeDefStore.ts b/src/stores/nodeDefStore.ts index 7bfa17c2c..d8cd96473 100644 --- a/src/stores/nodeDefStore.ts +++ b/src/stores/nodeDefStore.ts @@ -89,7 +89,7 @@ export class ComfyNodeDefImpl * @internal * Migrate default input options to forceInput. */ - static #migrateDefaultInput(nodeDef: ComfyNodeDefV1): ComfyNodeDefV1 { + private static _migrateDefaultInput(nodeDef: ComfyNodeDefV1): ComfyNodeDefV1 { const def = _.cloneDeep(nodeDef) def.input ??= {} // For required inputs, now we have the input socket always present. Specifying @@ -118,7 +118,7 @@ export class ComfyNodeDefImpl } constructor(def: ComfyNodeDefV1) { - const obj = ComfyNodeDefImpl.#migrateDefaultInput(def) + const obj = ComfyNodeDefImpl._migrateDefaultInput(def) /** * Assign extra fields to `this` for compatibility with group node feature.