Add Subgraphs (#1000)

This commit is contained in:
filtered
2025-06-28 15:21:56 -07:00
committed by GitHub
parent 3e7f9627b4
commit bcaaa00770
54 changed files with 3662 additions and 462 deletions

View File

@@ -1,7 +1,6 @@
import { beforeEach, describe, expect } from "vitest"
import { LGraphNode } from "@/LGraphNode"
import { LiteGraph } from "@/litegraph"
import { LGraphNode, LiteGraph } from "@/litegraph"
import { test } from "./testExtensions"

View File

@@ -28,6 +28,8 @@ describe("LGraphNode", () => {
beforeEach(() => {
origLiteGraph = Object.assign({}, LiteGraph)
// @ts-expect-error
delete origLiteGraph.Classes
Object.assign(LiteGraph, {
NODE_TITLE_HEIGHT: 20,

View File

@@ -240,11 +240,13 @@ LGraph {
"widgets_up": undefined,
},
],
"_subgraphs": Map {},
"_version": 3,
"catch_errors": true,
"config": {},
"elapsed_time": 0.01,
"errors_in_execution": undefined,
"events": CustomEventTarget {},
"execution_time": undefined,
"execution_timer_id": undefined,
"extra": {},
@@ -285,11 +287,13 @@ LGraph {
"_nodes_by_id": {},
"_nodes_executable": [],
"_nodes_in_order": [],
"_subgraphs": Map {},
"_version": 0,
"catch_errors": true,
"config": {},
"elapsed_time": 0.01,
"errors_in_execution": undefined,
"events": CustomEventTarget {},
"execution_time": undefined,
"execution_timer_id": undefined,
"extra": {},

View File

@@ -246,11 +246,13 @@ LGraph {
"widgets_up": undefined,
},
],
"_subgraphs": Map {},
"_version": 3,
"catch_errors": true,
"config": {},
"elapsed_time": 0.01,
"errors_in_execution": undefined,
"events": CustomEventTarget {},
"execution_time": undefined,
"execution_timer_id": undefined,
"extra": {},

View File

@@ -240,11 +240,13 @@ LGraph {
"widgets_up": undefined,
},
],
"_subgraphs": Map {},
"_version": 3,
"catch_errors": true,
"config": {},
"elapsed_time": 0.01,
"errors_in_execution": undefined,
"events": CustomEventTarget {},
"execution_time": undefined,
"execution_timer_id": undefined,
"extra": {},
@@ -285,11 +287,13 @@ LGraph {
"_nodes_by_id": {},
"_nodes_executable": [],
"_nodes_in_order": [],
"_subgraphs": Map {},
"_version": 0,
"catch_errors": true,
"config": {},
"elapsed_time": 0.01,
"errors_in_execution": undefined,
"events": CustomEventTarget {},
"execution_time": undefined,
"execution_timer_id": undefined,
"extra": {},

View File

@@ -12,6 +12,12 @@ LiteGraphGlobal {
"CENTER": 5,
"CIRCLE_SHAPE": 3,
"CONNECTING_LINK_COLOR": "#AFA",
"Classes": {
"InputIndicators": [Function],
"Rectangle": [Function],
"SubgraphIONodeBase": [Function],
"SubgraphSlot": [Function],
},
"ContextMenu": [Function],
"CurveEditor": [Function],
"DEFAULT_FONT": "Arial",
@@ -31,7 +37,6 @@ LiteGraphGlobal {
"Globals": {},
"HIDDEN_LINK": -1,
"INPUT": 1,
"InputIndicators": [Function],
"LEFT": 3,
"LGraph": [Function],
"LGraphCanvas": [Function],

View File

@@ -313,7 +313,7 @@ describe("Rectangle", () => {
test.each([
[[0, 0] as Point, true],
[[10, 10] as Point, true],
[[9, 9] as Point, true],
[[5, 5] as Point, true],
[[-1, 5] as Point, false],
[[11, 5] as Point, false],
@@ -340,7 +340,7 @@ describe("Rectangle", () => {
// Outer rectangle is smaller
[new Rectangle(0, 0, 5, 5), new Rectangle(0, 0, 10, 10), true],
// Same size
[new Rectangle(0, 0, 100, 100), true],
[new Rectangle(0, 0, 99, 99), true],
])("should return %s when checking if %s is inside outer rect", (inner: Rectangle, expectedOrOuter: boolean | Rectangle, expectedIfThreeArgs?: boolean) => {
let testOuter = rect
rect.updateTo([0, 0, 100, 100])