diff --git a/litegraph b/litegraph index 6cbae97..39b040a 160000 --- a/litegraph +++ b/litegraph @@ -1 +1 @@ -Subproject commit 6cbae97b3c385dba16b9100352428af4d6219dae +Subproject commit 39b040a0b148ef0aa248562720d904150ad61859 diff --git a/package.json b/package.json index 21713bd..f17a7d0 100644 --- a/package.json +++ b/package.json @@ -33,12 +33,14 @@ }, "type": "module", "dependencies": { + "@gradio/accordion": "workspace:*", "@gradio/atoms": "workspace:*", "@gradio/button": "workspace:*", "@gradio/client": "workspace:*", "@gradio/form": "workspace:*", "@gradio/gallery": "workspace:*", "@gradio/icons": "workspace:*", + "@gradio/tabs": "workspace:*", "@gradio/theme": "workspace:*", "@gradio/upload": "workspace:*", "@gradio/utils": "workspace:*", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9cdbb2a..294447b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,6 +4,9 @@ importers: .: dependencies: + '@gradio/accordion': + specifier: workspace:* + version: link:gradio/js/accordion '@gradio/atoms': specifier: workspace:* version: link:gradio/js/atoms @@ -22,6 +25,9 @@ importers: '@gradio/icons': specifier: workspace:* version: link:gradio/js/icons + '@gradio/tabs': + specifier: workspace:* + version: link:gradio/js/tabs '@gradio/theme': specifier: workspace:* version: link:gradio/js/theme diff --git a/src/lib/ImageViewer.ts b/src/lib/ImageViewer.ts index 0965f7e..66a7467 100644 --- a/src/lib/ImageViewer.ts +++ b/src/lib/ImageViewer.ts @@ -50,6 +50,7 @@ export class ImageViewer { showModal(event: Event) { const source = (event.target || event.srcElement) as HTMLImageElement; const galleryElem = source.closest("div.block") + console.debug("[ImageViewer] showModal", event, source, galleryElem); if (!galleryElem || ImageViewer.all_gallery_buttons(galleryElem).length === 0) { console.error("No buttons found on gallery element!", galleryElem) return; diff --git a/src/lib/components/AccordionContainer.svelte b/src/lib/components/AccordionContainer.svelte new file mode 100644 index 0000000..60f1c9b --- /dev/null +++ b/src/lib/components/AccordionContainer.svelte @@ -0,0 +1,202 @@ + + +{#if container && children} +
+ {#if edit} + + +
+ {#each children.filter(item => item.id !== SHADOW_PLACEHOLDER_ITEM_ID) as item(item.id)} + {@const hidden = item?.attrs?.hidden} +
+ + {#if item[SHADOW_ITEM_MARKER_PROPERTY_NAME]} +
+ {/if} +
+ {/each} +
+ {#if container.attrs.hidden && edit} +
+ {/if} + {#if showHandles} +
+ {/if} + + + {:else} + + + {#each children.filter(item => item.id !== SHADOW_PLACEHOLDER_ITEM_ID) as item(item.id)} + + {/each} + + + {/if} +
+{/if} + + diff --git a/src/lib/components/BlockContainer.svelte b/src/lib/components/BlockContainer.svelte index 0f910d2..bdfd08f 100644 --- a/src/lib/components/BlockContainer.svelte +++ b/src/lib/components/BlockContainer.svelte @@ -11,11 +11,15 @@ import { flip } from 'svelte/animate'; import layoutState, { type ContainerLayout, type WidgetLayout, type IDragItem } from "$lib/stores/layoutState"; import { startDrag, stopDrag } from "$lib/utils" + import type { Writable } from "svelte/store"; export let container: ContainerLayout | null = null; export let zIndex: number = 0; export let classes: string[] = []; export let showHandles: boolean = false; + export let edit: boolean = false; + export let dragDisabled: boolean = false; + let attrsChanged: Writable | null = null; let children: IDragItem[] | null = null; const flipDurationMs = 100; @@ -38,60 +42,59 @@ children = layoutState.updateChildren(container, evt.detail.items) // Ensure dragging is stopped on drag finish }; + + const tt = "asd\nasdlkj" {#if container && children} - {@const edit = $uiState.uiEditMode === "widgets" && zIndex > 1} - {#key $attrsChanged} -
- - {#if container.attrs.title !== ""} - - {/if} -
+ + {#if container.attrs.title && container.attrs.title !== ""} + + {/if} +
+ {#each children.filter(item => item.id !== SHADOW_PLACEHOLDER_ITEM_ID) as item(item.id)} + {@const hidden = item?.attrs?.hidden} +
- {#each children.filter(item => item.id !== SHADOW_PLACEHOLDER_ITEM_ID) as item(item.id)} - {@const hidden = item?.attrs?.hidden} -
- - {#if item[SHADOW_ITEM_MARKER_PROPERTY_NAME]} -
- {/if} -
- {/each} -
- {#if container.attrs.hidden && edit} -
- {/if} - {#if showHandles} -
- {/if} - -
- {/key} + + {#if item[SHADOW_ITEM_MARKER_PROPERTY_NAME]} +
+ {/if} +
+ {/each} +
+ {#if container.attrs.hidden && edit} +
+ {/if} + {#if showHandles} +
+ {/if} + +
{/if} diff --git a/src/lib/components/ComfyApp.ts b/src/lib/components/ComfyApp.ts index 794064f..1979524 100644 --- a/src/lib/components/ComfyApp.ts +++ b/src/lib/components/ComfyApp.ts @@ -106,6 +106,8 @@ export default class ComfyApp { LiteGraph.release_link_on_empty_shows_menu = true; LiteGraph.alt_drag_do_clone_nodes = true; + (window as any).LiteGraph = LiteGraph; + // await this.#invokeExtensionsAsync("init"); await this.registerNodes(); @@ -230,17 +232,17 @@ export default class ComfyApp { } private addDropHandler() { - this.dropZone = document.getElementById("dropzone"); + // this.dropZone = document.getElementById("dropzone"); - if (this.dropZone) { - window.addEventListener('dragenter', this.allowDrag.bind(this)); - this.dropZone.addEventListener('dragover', this.allowDrag.bind(this)); - this.dropZone.addEventListener('dragleave', this.hideDropZone.bind(this)); - this.dropZone.addEventListener('drop', this.handleDrop.bind(this)); - } - else { - console.warn("No dropzone detected (probably on mobile).") - } + // if (this.dropZone) { + // window.addEventListener('dragenter', this.allowDrag.bind(this)); + // this.dropZone.addEventListener('dragover', this.allowDrag.bind(this)); + // this.dropZone.addEventListener('dragleave', this.hideDropZone.bind(this)); + // this.dropZone.addEventListener('drop', this.handleDrop.bind(this)); + // } + // else { + // console.warn("No dropzone detected (probably on mobile).") + // } } /** @@ -437,7 +439,7 @@ export default class ComfyApp { const n = workflow.nodes.find((n) => n.id === node_.id); if (!node_.isBackendNode) { - console.debug("Not serializing node: ", node_.type) + // console.debug("Not serializing node: ", node_.type) continue; } @@ -562,8 +564,8 @@ export default class ComfyApp { } } - console.warn({ workflow, output }) - console.warn(promptToGraphVis({ workflow, output })) + // console.debug({ workflow, output }) + // console.debug(promptToGraphVis({ workflow, output })) return { workflow, output }; } @@ -588,7 +590,7 @@ export default class ComfyApp { for (let i = 0; i < batchCount; i++) { for (const node of this.lGraph._nodes_in_order) { if ("beforeQueued" in node) { - (node as ComfyGraphNode).beforeQueued(); + (node as ComfyGraphNode).beforeQueued(tag); } } @@ -611,7 +613,7 @@ export default class ComfyApp { for (const n of p.workflow.nodes) { const node = this.lGraph.getNodeById(n.id); if ("afterQueued" in node) { - (node as ComfyGraphNode).afterQueued(p); + (node as ComfyGraphNode).afterQueued(p, tag); } } diff --git a/src/lib/components/ComfyComboProperty.svelte b/src/lib/components/ComfyComboProperty.svelte index 11b746e..5b9b671 100644 --- a/src/lib/components/ComfyComboProperty.svelte +++ b/src/lib/components/ComfyComboProperty.svelte @@ -5,6 +5,7 @@ export let value: string = ""; export let values: string[] = [""]; export let name: string = ""; + export let disabled: boolean = false; let value_: string = "" $: value; @@ -27,7 +28,7 @@