mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-03 14:54:37 +00:00
[fix] Remove TypeScript declare modifiers from class properties
This commit is contained in:
@@ -11,7 +11,7 @@ const nodeDefsPath = './src/locales/en/nodeDefs.json'
|
||||
|
||||
test('collect-i18n-node-defs', async ({ comfyPage }) => {
|
||||
// Mock view route
|
||||
comfyPage.page.route('**/view**', async (route) => {
|
||||
await comfyPage.page.route('**/view**', async (route) => {
|
||||
await route.fulfill({
|
||||
body: JSON.stringify({})
|
||||
})
|
||||
|
||||
@@ -404,8 +404,8 @@ export class LGraphNode
|
||||
selected?: boolean
|
||||
showAdvanced?: boolean
|
||||
|
||||
declare comfyClass?: string
|
||||
declare isVirtualNode?: boolean
|
||||
comfyClass?: string
|
||||
isVirtualNode?: boolean
|
||||
applyToGraph?(extraLinks?: LLink[]): void
|
||||
|
||||
isSubgraphNode(): this is SubgraphNode {
|
||||
|
||||
@@ -14,7 +14,9 @@ import type {
|
||||
import type { INodeInputSlot } from '@/lib/litegraph/src/interfaces'
|
||||
import type { Point } from '@/lib/litegraph/src/interfaces'
|
||||
import type { SubgraphInput } from '@/lib/litegraph/src/subgraph/SubgraphInput'
|
||||
import type { SubgraphInputNode } from '@/lib/litegraph/src/subgraph/SubgraphInputNode'
|
||||
import type { SubgraphOutput } from '@/lib/litegraph/src/subgraph/SubgraphOutput'
|
||||
import type { SubgraphOutputNode } from '@/lib/litegraph/src/subgraph/SubgraphOutputNode'
|
||||
import { LinkDirection } from '@/lib/litegraph/src/types/globalEnums'
|
||||
|
||||
import type { RenderLink } from './RenderLink'
|
||||
@@ -175,7 +177,9 @@ export class FloatingRenderLink implements RenderLink {
|
||||
): void {
|
||||
const floatingLink = this.link
|
||||
floatingLink.origin_id = SUBGRAPH_INPUT_ID
|
||||
floatingLink.origin_slot = input.parent.slots.indexOf(input)
|
||||
floatingLink.origin_slot = (
|
||||
input.parent as SubgraphInputNode
|
||||
).slots.indexOf(input)
|
||||
|
||||
this.fromSlot._floatingLinks?.delete(floatingLink)
|
||||
input._floatingLinks ??= new Set()
|
||||
@@ -188,7 +192,9 @@ export class FloatingRenderLink implements RenderLink {
|
||||
): void {
|
||||
const floatingLink = this.link
|
||||
floatingLink.origin_id = SUBGRAPH_OUTPUT_ID
|
||||
floatingLink.origin_slot = output.parent.slots.indexOf(output)
|
||||
floatingLink.origin_slot = (
|
||||
output.parent as SubgraphOutputNode
|
||||
).slots.indexOf(output)
|
||||
|
||||
this.fromSlot._floatingLinks?.delete(floatingLink)
|
||||
output._floatingLinks ??= new Set()
|
||||
|
||||
@@ -12,8 +12,6 @@ import type { SubgraphInputNode } from './SubgraphInputNode'
|
||||
* A virtual slot that simply creates a new input slot when connected to.
|
||||
*/
|
||||
export class EmptySubgraphInput extends SubgraphInput {
|
||||
declare parent: SubgraphInputNode
|
||||
|
||||
constructor(parent: SubgraphInputNode) {
|
||||
super(
|
||||
{
|
||||
@@ -30,7 +28,7 @@ export class EmptySubgraphInput extends SubgraphInput {
|
||||
node: LGraphNode,
|
||||
afterRerouteId?: RerouteId
|
||||
): LLink | undefined {
|
||||
const { subgraph } = this.parent
|
||||
const { subgraph } = this.parent as SubgraphInputNode
|
||||
const existingNames = subgraph.inputs.map((x) => x.name)
|
||||
|
||||
const name = nextUniqueName(slot.name, existingNames)
|
||||
|
||||
@@ -12,8 +12,6 @@ import type { SubgraphOutputNode } from './SubgraphOutputNode'
|
||||
* A virtual slot that simply creates a new output slot when connected to.
|
||||
*/
|
||||
export class EmptySubgraphOutput extends SubgraphOutput {
|
||||
declare parent: SubgraphOutputNode
|
||||
|
||||
constructor(parent: SubgraphOutputNode) {
|
||||
super(
|
||||
{
|
||||
@@ -30,7 +28,7 @@ export class EmptySubgraphOutput extends SubgraphOutput {
|
||||
node: LGraphNode,
|
||||
afterRerouteId?: RerouteId
|
||||
): LLink | undefined {
|
||||
const { subgraph } = this.parent
|
||||
const { subgraph } = this.parent as SubgraphOutputNode
|
||||
const existingNames = subgraph.outputs.map((x) => x.name)
|
||||
|
||||
const name = nextUniqueName(slot.name, existingNames)
|
||||
|
||||
@@ -30,8 +30,6 @@ import { isNodeSlot, isSubgraphOutput } from './subgraphUtils'
|
||||
* Functionally, however, when editing a subgraph, that "subgraph input" is the "origin" or "output side" of a link.
|
||||
*/
|
||||
export class SubgraphInput extends SubgraphSlot {
|
||||
declare parent: SubgraphInputNode
|
||||
|
||||
events = new CustomEventTarget<SubgraphInputEventMap>()
|
||||
|
||||
/** The linked widget that this slot is connected to. */
|
||||
@@ -50,13 +48,13 @@ export class SubgraphInput extends SubgraphSlot {
|
||||
node: LGraphNode,
|
||||
afterRerouteId?: RerouteId
|
||||
): LLink | undefined {
|
||||
const { subgraph } = this.parent
|
||||
const parent = this.parent as SubgraphInputNode
|
||||
const { subgraph } = parent
|
||||
|
||||
// Allow nodes to block connection
|
||||
const inputIndex = node.inputs.indexOf(slot)
|
||||
if (
|
||||
node.onConnectInput?.(inputIndex, this.type, this, this.parent, -1) ===
|
||||
false
|
||||
node.onConnectInput?.(inputIndex, this.type, this, parent, -1) === false
|
||||
)
|
||||
return
|
||||
|
||||
@@ -77,7 +75,7 @@ export class SubgraphInput extends SubgraphSlot {
|
||||
if (slot.link != null) {
|
||||
subgraph.beforeChange()
|
||||
const link = subgraph.getLink(slot.link)
|
||||
this.parent._disconnectNodeInput(node, slot, link)
|
||||
parent._disconnectNodeInput(node, slot, link)
|
||||
}
|
||||
|
||||
const inputWidget = node.getWidgetFromSlot(slot)
|
||||
@@ -97,8 +95,8 @@ export class SubgraphInput extends SubgraphSlot {
|
||||
const link = new LLink(
|
||||
++subgraph.state.lastLinkId,
|
||||
slot.type,
|
||||
this.parent.id,
|
||||
this.parent.slots.indexOf(this),
|
||||
parent.id,
|
||||
parent.slots.indexOf(this),
|
||||
node.id,
|
||||
inputIndex,
|
||||
afterRerouteId
|
||||
|
||||
@@ -35,7 +35,8 @@ import type { SubgraphInput } from './SubgraphInput'
|
||||
* An instance of a {@link Subgraph}, displayed as a node on the containing (parent) graph.
|
||||
*/
|
||||
export class SubgraphNode extends LGraphNode implements BaseLGraph {
|
||||
declare inputs: (INodeInputSlot & Partial<ISubgraphInput>)[]
|
||||
// Override inputs with proper typing for subgraph inputs
|
||||
override inputs: (INodeInputSlot & Partial<ISubgraphInput>)[] = []
|
||||
|
||||
override readonly type: UUID
|
||||
override readonly isVirtualNode = true as const
|
||||
|
||||
@@ -29,14 +29,13 @@ import { isNodeSlot, isSubgraphInput } from './subgraphUtils'
|
||||
* Functionally, however, when editing a subgraph, that "subgraph output" is the "target" or "input side" of a link.
|
||||
*/
|
||||
export class SubgraphOutput extends SubgraphSlot {
|
||||
declare parent: SubgraphOutputNode
|
||||
|
||||
override connect(
|
||||
slot: INodeOutputSlot,
|
||||
node: LGraphNode,
|
||||
afterRerouteId?: RerouteId
|
||||
): LLink | undefined {
|
||||
const { subgraph } = this.parent
|
||||
const parent = this.parent as SubgraphOutputNode
|
||||
const { subgraph } = parent
|
||||
|
||||
// Validate type compatibility
|
||||
if (!LiteGraph.isValidConnection(slot.type, this.type)) return
|
||||
@@ -47,8 +46,7 @@ export class SubgraphOutput extends SubgraphSlot {
|
||||
throw new Error('Slot is not an output of the given node')
|
||||
|
||||
if (
|
||||
node.onConnectOutput?.(outputIndex, this.type, this, this.parent, -1) ===
|
||||
false
|
||||
node.onConnectOutput?.(outputIndex, this.type, this, parent, -1) === false
|
||||
)
|
||||
return
|
||||
|
||||
@@ -68,8 +66,8 @@ export class SubgraphOutput extends SubgraphSlot {
|
||||
slot.type,
|
||||
node.id,
|
||||
outputIndex,
|
||||
this.parent.id,
|
||||
this.parent.slots.indexOf(this),
|
||||
parent.id,
|
||||
parent.slots.indexOf(this),
|
||||
afterRerouteId
|
||||
)
|
||||
|
||||
|
||||
@@ -47,8 +47,8 @@ export abstract class BaseWidget<TWidget extends IBaseWidget = IBaseWidget>
|
||||
/** Minimum gap between label and value */
|
||||
static labelValueGap = 5
|
||||
|
||||
declare computedHeight?: number
|
||||
declare serialize?: boolean
|
||||
computedHeight?: number
|
||||
serialize?: boolean
|
||||
computeLayoutSize?(node: LGraphNode): {
|
||||
minHeight: number
|
||||
maxHeight?: number
|
||||
|
||||
@@ -66,6 +66,7 @@ LGraph {
|
||||
"clip_area": undefined,
|
||||
"clonable": undefined,
|
||||
"color": undefined,
|
||||
"comfyClass": undefined,
|
||||
"console": undefined,
|
||||
"exec_version": undefined,
|
||||
"execute_triggered": undefined,
|
||||
@@ -77,6 +78,7 @@ LGraph {
|
||||
"id": 1,
|
||||
"ignore_remove": undefined,
|
||||
"inputs": [],
|
||||
"isVirtualNode": undefined,
|
||||
"last_serialization": {
|
||||
"id": 1,
|
||||
},
|
||||
@@ -138,6 +140,7 @@ LGraph {
|
||||
"clip_area": undefined,
|
||||
"clonable": undefined,
|
||||
"color": undefined,
|
||||
"comfyClass": undefined,
|
||||
"console": undefined,
|
||||
"exec_version": undefined,
|
||||
"execute_triggered": undefined,
|
||||
@@ -149,6 +152,7 @@ LGraph {
|
||||
"id": 1,
|
||||
"ignore_remove": undefined,
|
||||
"inputs": [],
|
||||
"isVirtualNode": undefined,
|
||||
"last_serialization": {
|
||||
"id": 1,
|
||||
},
|
||||
@@ -211,6 +215,7 @@ LGraph {
|
||||
"clip_area": undefined,
|
||||
"clonable": undefined,
|
||||
"color": undefined,
|
||||
"comfyClass": undefined,
|
||||
"console": undefined,
|
||||
"exec_version": undefined,
|
||||
"execute_triggered": undefined,
|
||||
@@ -222,6 +227,7 @@ LGraph {
|
||||
"id": 1,
|
||||
"ignore_remove": undefined,
|
||||
"inputs": [],
|
||||
"isVirtualNode": undefined,
|
||||
"last_serialization": {
|
||||
"id": 1,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user