diff --git a/src/AppMobile.svelte b/src/AppMobile.svelte index 06ec893..b7782ae 100644 --- a/src/AppMobile.svelte +++ b/src/AppMobile.svelte @@ -1,14 +1,28 @@ - - + + - - + diff --git a/src/home.svelte b/src/home.svelte deleted file mode 100644 index 41f6034..0000000 --- a/src/home.svelte +++ /dev/null @@ -1,10 +0,0 @@ - - - - ... - About Page - Login Page - - diff --git a/src/lib/ComfyGraphCanvas.ts b/src/lib/ComfyGraphCanvas.ts index 7e5be29..82b19ae 100644 --- a/src/lib/ComfyGraphCanvas.ts +++ b/src/lib/ComfyGraphCanvas.ts @@ -9,7 +9,6 @@ export default class ComfyGraphCanvas extends LGraphCanvas { constructor( app: ComfyApp, canvas: HTMLCanvasElement | string, - graph?: LGraph, options: { skip_render?: boolean; skip_events?: boolean; @@ -17,7 +16,7 @@ export default class ComfyGraphCanvas extends LGraphCanvas { viewport?: Vector4; } = {} ) { - super(canvas, graph, options); + super(canvas, app.lGraph, options); this.app = app; } diff --git a/src/lib/GraphSync.ts b/src/lib/GraphSync.ts index c7c960e..024e83b 100644 --- a/src/lib/GraphSync.ts +++ b/src/lib/GraphSync.ts @@ -88,11 +88,11 @@ export default class GraphSync { this.stores[nodeId].push({ store: wuis.value, unsubscribe: unsub }); } - console.log("NEWSTORES", this.stores[nodeId]) + console.debug("NEWSTORES", this.stores[nodeId]) } private removeStores(nodeId: string) { - console.log("DELSTORES", this.stores[nodeId]) + console.debug("DELSTORES", this.stores[nodeId]) for (const ss of this.stores[nodeId]) { ss.unsubscribe(); } diff --git a/src/lib/api.ts b/src/lib/api.ts index c831e0c..b7fd412 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -49,8 +49,6 @@ export default class ComfyAPI extends EventTarget { private getBackendUrl(): string { const hostname = this.hostname || location.hostname; const port = this.port || location.port; - console.log(hostname) - console.log(port) return `${window.location.protocol}//${hostname}:${port}` } diff --git a/src/lib/components/ComfyApp.svelte b/src/lib/components/ComfyApp.svelte index ca48c4e..b4e5887 100644 --- a/src/lib/components/ComfyApp.svelte +++ b/src/lib/components/ComfyApp.svelte @@ -120,11 +120,11 @@ }); await app.setup(); - refreshView(); - (window as any).app = app; (window as any).appPane = uiPane; + refreshView(); + imageViewer = new ImageViewer(app.rootEl); let wrappers = containerElem.querySelectorAll(".pane-wrapper") diff --git a/src/lib/components/ComfyApp.ts b/src/lib/components/ComfyApp.ts index 7da71ee..8d27968 100644 --- a/src/lib/components/ComfyApp.ts +++ b/src/lib/components/ComfyApp.ts @@ -88,7 +88,7 @@ export default class ComfyApp { this.rootEl = document.getElementById("main") as HTMLDivElement; this.canvasEl = document.getElementById("graph-canvas") as HTMLCanvasElement; this.lGraph = new LGraph(); - this.lCanvas = new ComfyGraphCanvas(this, this.canvasEl, this.lGraph); + this.lCanvas = new ComfyGraphCanvas(this, this.canvasEl); this.canvasCtx = this.canvasEl.getContext("2d"); this.graphSync = new GraphSync(this); @@ -151,37 +151,37 @@ export default class ComfyApp { } private graphOnConfigure() { - console.log("Configured"); + console.debug("Configured"); this.eventBus.emit("configured", this.lGraph); } private graphOnBeforeChange(graph: LGraph, info: any) { - console.log("BeforeChange", info); + console.debug("BeforeChange", info); this.eventBus.emit("beforeChange", graph, info); } private graphOnAfterChange(graph: LGraph, info: any) { - console.log("AfterChange", info); + console.debug("AfterChange", info); this.eventBus.emit("afterChange", graph, info); } private graphOnNodeAdded(node: LGraphNode) { - console.log("Added", node); + console.debug("Added", node); this.eventBus.emit("nodeAdded", node); } private graphOnNodeRemoved(node: LGraphNode) { - console.log("Removed", node); + console.debug("Removed", node); this.eventBus.emit("nodeRemoved", node); } private graphOnNodeConnectionChange(kind: LConnectionKind, node: LGraphNode, slot: INodeSlot, targetNode: LGraphNode, targetSlot: INodeSlot) { - console.log("ConnectionChange", node); + console.debug("ConnectionChange", node); this.eventBus.emit("nodeConnectionChanged", kind, node, slot, targetNode, targetSlot); } private canvasOnClear() { - console.log("CanvasClear"); + console.debug("CanvasClear"); this.eventBus.emit("cleared"); } @@ -306,11 +306,13 @@ export default class ComfyApp { } private showDropZone() { - this.dropZone.style.display = "block"; + if (this.dropZone) + this.dropZone.style.display = "block"; } private hideDropZone() { - this.dropZone.style.display = "none"; + if (this.dropZone) + this.dropZone.style.display = "none"; } private allowDrag(event: DragEvent) { @@ -334,10 +336,15 @@ export default class ComfyApp { private addDropHandler() { this.dropZone = document.getElementById("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)); + 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).") + } } /** diff --git a/src/lib/stores/queueState.ts b/src/lib/stores/queueState.ts index 1b714a0..8f3076f 100644 --- a/src/lib/stores/queueState.ts +++ b/src/lib/stores/queueState.ts @@ -7,7 +7,7 @@ export type QueueItem = { } type QueueStateOps = { - statusUpdated: (status: ComfyAPIQueueStatus) => void, + statusUpdated: (status: ComfyAPIQueueStatus | null) => void, executingUpdated: (runningNodeId: string | null) => void, progressUpdated: (progress: Progress | null) => void } @@ -21,9 +21,10 @@ type WritableQueueStateStore = Writable & QueueStateOps; const store: Writable = writable({ queueRemaining: null, runningNodeId: null, progress: null }) -function statusUpdated(status: ComfyAPIQueueStatus) { +function statusUpdated(status: ComfyAPIQueueStatus | null) { store.update((s) => { - s.queueRemaining = status.exec_info.queue_remaining; + if (status !== null) + s.queueRemaining = status.exec_info.queue_remaining; return s }) } diff --git a/src/lib/stores/widgetState.ts b/src/lib/stores/widgetState.ts index a86b9a8..06084b9 100644 --- a/src/lib/stores/widgetState.ts +++ b/src/lib/stores/widgetState.ts @@ -62,7 +62,7 @@ function nodeAdded(node: LGraphNode) { } } - console.log("NODEADDED", state) + console.debug("NODEADDED", state) store.set(state); } diff --git a/src/about.svelte b/src/mobile/routes/about.svelte similarity index 100% rename from src/about.svelte rename to src/mobile/routes/about.svelte diff --git a/src/mobile/routes/graph.svelte b/src/mobile/routes/graph.svelte new file mode 100644 index 0000000..2fbe4d0 --- /dev/null +++ b/src/mobile/routes/graph.svelte @@ -0,0 +1,43 @@ + + + + +
+ +
+
+ + diff --git a/src/mobile/routes/home.svelte b/src/mobile/routes/home.svelte new file mode 100644 index 0000000..785db20 --- /dev/null +++ b/src/mobile/routes/home.svelte @@ -0,0 +1,90 @@ + + + + + + Yo + +
{app} Nodes
+
+ + + + + + + + + + + + +
diff --git a/src/login.svelte b/src/mobile/routes/login.svelte similarity index 100% rename from src/login.svelte rename to src/mobile/routes/login.svelte diff --git a/vite.config.ts b/vite.config.ts index 4898666..d43b14c 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -28,9 +28,9 @@ export default defineConfig({ server: { port: 3000, - hmr: { - clientPort: 443, - }, + // hmr: { + // clientPort: 443, + // }, // fs: { // allow: [ // "src",