Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/lib/litegraph/src/subgraph/EmptySubgraphInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import type { SubgraphInputNode } from './SubgraphInputNode'

/**
* A virtual slot that simply creates a new input slot when connected to.
*
* @internal
*/
export class EmptySubgraphInput extends SubgraphInput {
declare parent: SubgraphInputNode
Expand Down
2 changes: 2 additions & 0 deletions src/lib/litegraph/src/subgraph/EmptySubgraphOutput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import type { SubgraphOutputNode } from './SubgraphOutputNode'

/**
* A virtual slot that simply creates a new output slot when connected to.
*
* @internal
*/
export class EmptySubgraphOutput extends SubgraphOutput {
declare parent: SubgraphOutputNode
Expand Down
1 change: 1 addition & 0 deletions src/lib/litegraph/src/subgraph/SubgraphIONodeBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import type { Subgraph } from './Subgraph'
import type { SubgraphInput } from './SubgraphInput'
import type { SubgraphOutput } from './SubgraphOutput'

/** @internal */
export abstract class SubgraphIONodeBase<
TSlot extends SubgraphInput | SubgraphOutput
>
Expand Down
2 changes: 2 additions & 0 deletions src/lib/litegraph/src/subgraph/SubgraphOutput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import { isNodeSlot, isSubgraphInput } from './subgraphUtils'
* You have "Subgraph Outputs", because they go from inside the subgraph and out, but links to them come from "node outputs".
*
* Functionally, however, when editing a subgraph, that "subgraph output" is the "target" or "input side" of a link.
*
* @internal
*/
export class SubgraphOutput extends SubgraphSlot {
declare parent: SubgraphOutputNode
Expand Down
6 changes: 5 additions & 1 deletion src/lib/litegraph/src/subgraph/SubgraphSlotBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ interface SubgraphSlotDrawOptions {
editorAlpha?: number
}

/** Shared base class for the slots used on Subgraph . */
/**
* Shared base class for the slots used on Subgraph .
*
* @internal
*/
export abstract class SubgraphSlot
extends SlotBase
implements SubgraphIO, Hoverable, Serialisable<SubgraphIO>
Expand Down
9 changes: 9 additions & 0 deletions src/lib/litegraph/src/subgraph/subgraphDeduplication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,13 @@ function firstById<T, Id>(
* `GraphCanvas.vue` also keys Vue node instances by bare `NodeId`, so
* collisions could reuse a component across graph changes instead of
* remounting it.
*
* @param subgraphs - Serialized subgraph definitions to deduplicate
* @param reservedNodeIds - Node IDs already in use by root-level nodes
* @param state - Graph state containing the `lastNodeId` counter (mutated)
* @param rootNodes - Optional root-level nodes with proxyWidgets to patch
*
* @internal
*/
export function deduplicateSubgraphNodeIds(
subgraphs: ExportedSubgraph[],
Expand Down Expand Up @@ -503,6 +510,8 @@ function patchRerouteReferences(
*
* Falls back to the original order if no reordering is needed or if the
* dependency graph contains cycles.
*
* @internal
*/
export function topologicalSortSubgraphs(
subgraphs: ExportedSubgraph[]
Expand Down
18 changes: 18 additions & 0 deletions src/lib/litegraph/src/subgraph/subgraphUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ interface FilteredItems {
unknown: Set<Positionable>
}

/** @internal */
export function splitPositionables(
items: Iterable<Positionable>
): FilteredItems {
Expand Down Expand Up @@ -98,6 +99,7 @@ interface BoundaryLinks {
boundaryOutputLinks: LLink[]
}

/** @internal */
export function getBoundaryLinks(
graph: LGraph,
items: Set<Positionable>
Expand Down Expand Up @@ -226,6 +228,7 @@ export function getBoundaryLinks(
}
}

/** @internal */
export function multiClone(nodes: Iterable<LGraphNode>): ISerialisedNode[] {
const clonedNodes: ISerialisedNode[] = []

Expand Down Expand Up @@ -253,6 +256,8 @@ export function multiClone(nodes: Iterable<LGraphNode>): ISerialisedNode[] {
* Groups resolved connections by output object. If the output is nullish, the connection will be in its own group.
* @param resolvedConnections The resolved connections to group
* @returns A map of grouped connections.
*
* @internal
*/
export function groupResolvedByOutput(
resolvedConnections: ResolvedConnection[]
Expand Down Expand Up @@ -295,6 +300,7 @@ function mapReroutes(
return lastId
}

/** @internal */
export function mapSubgraphInputsAndLinks(
resolvedInputLinks: ResolvedConnection[],
links: SerialisableLLink[],
Expand Down Expand Up @@ -376,6 +382,8 @@ export function mapSubgraphInputsAndLinks(
* @param resolvedOutputLinks The resolved output links.
* @param links The links to add to the subgraph.
* @returns The subgraph output slots.
*
* @internal
*/
export function mapSubgraphOutputsAndLinks(
resolvedOutputLinks: ResolvedConnection[],
Expand Down Expand Up @@ -454,6 +462,8 @@ export function mapSubgraphOutputsAndLinks(
* Collects all subgraph IDs used directly in a single graph (non-recursive).
* @param graph The graph to check for subgraph nodes
* @returns Set of subgraph IDs used in this graph
*
* @internal
*/
export function getDirectSubgraphIds(graph: GraphOrSubgraph): Set<SubgraphId> {
const subgraphIds = new Set<SubgraphId>()
Expand All @@ -472,6 +482,8 @@ export function getDirectSubgraphIds(graph: GraphOrSubgraph): Set<SubgraphId> {
* @param rootGraph The graph to start from
* @param subgraphRegistry Map of all available subgraphs
* @returns Set of all subgraph IDs found
*
* @internal
*/
export function findUsedSubgraphIds(
rootGraph: GraphOrSubgraph,
Expand Down Expand Up @@ -625,6 +637,8 @@ export function reorderSubgraphInputs(
* Type guard to check if a slot is a SubgraphInput.
* @param slot The slot to check
* @returns true if the slot is a SubgraphInput
*
* @internal
*/
export function isSubgraphInput(slot: unknown): slot is SubgraphInput {
return (
Expand All @@ -639,6 +653,8 @@ export function isSubgraphInput(slot: unknown): slot is SubgraphInput {
* Type guard to check if a slot is a SubgraphOutput.
* @param slot The slot to check
* @returns true if the slot is a SubgraphOutput
*
* @internal
*/
export function isSubgraphOutput(slot: unknown): slot is SubgraphOutput {
return (
Expand All @@ -653,6 +669,8 @@ export function isSubgraphOutput(slot: unknown): slot is SubgraphOutput {
* Type guard to check if a slot is a regular node slot (INodeInputSlot or INodeOutputSlot).
* @param slot The slot to check
* @returns true if the slot is a regular node slot
*
* @internal
*/
export function isNodeSlot(
slot: unknown
Expand Down
Loading