Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
abd31401f0 | ||
|
|
2f48f96830 | ||
|
|
63d51e9119 | ||
|
|
6f02912d2e | ||
|
|
3b49bac47b | ||
|
|
33ed379a98 | ||
|
|
c817231241 | ||
|
|
2c7566e8e6 | ||
|
|
c875f9c4f6 | ||
|
|
43ed176502 | ||
|
|
228ea20dcb | ||
|
|
f24eb23991 |
@@ -37,11 +37,14 @@ Also note that the saved workflow format is subject to change until it's been fi
|
|||||||
|
|
||||||
### Requirements
|
### Requirements
|
||||||
|
|
||||||
|
- `git`
|
||||||
- `pnpm`
|
- `pnpm`
|
||||||
- An installation of vanilla [ComfyUI](https://github.com/comfyanonymous/ComfyUI) for the backend
|
- An installation of vanilla [ComfyUI](https://github.com/comfyanonymous/ComfyUI) for the backend
|
||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
|
**NOTE:** If you're using Windows, the following commands must be run with [Git Bash](https://git-scm.com/downloads).
|
||||||
|
|
||||||
1. Clone the repo with submodules:
|
1. Clone the repo with submodules:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
59
bin/serve.py
59
bin/serve.py
@@ -2,15 +2,19 @@
|
|||||||
|
|
||||||
import http.server
|
import http.server
|
||||||
import socketserver
|
import socketserver
|
||||||
|
import argparse
|
||||||
|
|
||||||
PORT = 8000
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument("-l", "--listen", type=str, default="localhost", help="Listen address for ComfyBox server")
|
||||||
|
parser.add_argument("-p", "--port", type=int, default=8000, help="Port for ComfyBox server")
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
message = f"""Starting ComfyBox.
|
message = f"""Starting ComfyBox.
|
||||||
Be sure you've started ComfyUI already using this command:
|
Be sure you've started ComfyUI already using this command:
|
||||||
|
|
||||||
python main.py --enable-cors-header
|
python main.py --enable-cors-header
|
||||||
|
|
||||||
Serving at http://localhost:{PORT}...
|
Serving at http://{args.listen}:{args.port}...
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# python -m http.server will sometimes send incorrect MIME types.
|
# python -m http.server will sometimes send incorrect MIME types.
|
||||||
@@ -19,33 +23,34 @@ Serving at http://localhost:{PORT}...
|
|||||||
# Hopefully this will cover everything.
|
# Hopefully this will cover everything.
|
||||||
class HttpRequestHandler(http.server.SimpleHTTPRequestHandler):
|
class HttpRequestHandler(http.server.SimpleHTTPRequestHandler):
|
||||||
extensions_map = {
|
extensions_map = {
|
||||||
'': 'application/octet-stream',
|
"": "application/octet-stream",
|
||||||
'.manifest': 'text/cache-manifest',
|
".manifest": "text/cache-manifest",
|
||||||
'.html': 'text/html',
|
".html": "text/html",
|
||||||
'.png': 'image/png',
|
".png": "image/png",
|
||||||
'.jpg': 'image/jpg',
|
".jpg": "image/jpg",
|
||||||
'.jpeg': 'image/jpeg',
|
".jpeg": "image/jpeg",
|
||||||
'.gif': 'image/gif',
|
".gif": "image/gif",
|
||||||
'.svg': 'image/svg+xml',
|
".svg": "image/svg+xml",
|
||||||
'.css': 'text/css',
|
".css": "text/css",
|
||||||
'.js': 'application/x-javascript',
|
".js": "application/x-javascript",
|
||||||
'.mjs': 'application/x-javascript',
|
".mjs": "application/x-javascript",
|
||||||
'.cjs': 'application/x-javascript',
|
".cjs": "application/x-javascript",
|
||||||
'.wasm': 'application/wasm',
|
".wasm": "application/wasm",
|
||||||
'.json': 'application/json',
|
".json": "application/json",
|
||||||
'.xml': 'application/xml',
|
".xml": "application/xml",
|
||||||
'.xml': 'application/xml',
|
".xml": "application/xml",
|
||||||
'.pdf': 'application/pdf',
|
".pdf": "application/pdf",
|
||||||
'.webp': 'image/webp',
|
".webp": "image/webp",
|
||||||
'.avif': 'image/avif',
|
".avif": "image/avif",
|
||||||
'.heic': 'image/heic',
|
".heic": "image/heic",
|
||||||
'.heif': 'image/heif',
|
".heif": "image/heif",
|
||||||
'.mp3': 'audio/mpeg',
|
".mp3": "audio/mpeg",
|
||||||
'.mp4': 'video/mp4',
|
".mp4": "video/mp4",
|
||||||
'.m4v': 'video/mp4'
|
".m4v": "video/mp4",
|
||||||
}
|
}
|
||||||
|
|
||||||
httpd = socketserver.TCPServer(("localhost", PORT), HttpRequestHandler)
|
|
||||||
|
httpd = socketserver.TCPServer((args.listen, args.port), HttpRequestHandler)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
print(message)
|
print(message)
|
||||||
|
|||||||
69
package.json
69
package.json
@@ -18,38 +18,38 @@
|
|||||||
"build:css": "pollen -c gradio/js/theme/src/pollen.config.cjs && mv src/pollen.css node_modules/@gradio/theme/src"
|
"build:css": "pollen -c gradio/js/theme/src/pollen.config.cjs && mv src/pollen.css node_modules/@gradio/theme/src"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@floating-ui/core": "^1.2.6",
|
"@floating-ui/core": "^1.3.1",
|
||||||
"@floating-ui/dom": "^1.2.8",
|
"@floating-ui/dom": "^1.4.2",
|
||||||
"@zerodevx/svelte-toast": "^0.9.3",
|
"@zerodevx/svelte-toast": "^0.9.3",
|
||||||
"eslint": "^8.37.0",
|
"eslint": "^8.43.0",
|
||||||
"eslint-config-prettier": "^8.8.0",
|
"eslint-config-prettier": "^8.8.0",
|
||||||
"eslint-plugin-svelte3": "^4.0.0",
|
"eslint-plugin-svelte3": "^4.0.0",
|
||||||
"happy-dom": "^9.18.3",
|
"happy-dom": "^9.20.3",
|
||||||
"jsdom": "^22.0.0",
|
"jsdom": "^22.1.0",
|
||||||
"prettier": "^2.8.7",
|
"prettier": "^2.8.8",
|
||||||
"prettier-plugin-svelte": "^2.10.0",
|
"prettier-plugin-svelte": "^2.10.1",
|
||||||
"rollup-plugin-visualizer": "^5.9.0",
|
"rollup-plugin-visualizer": "^5.9.2",
|
||||||
"sass": "^1.61.0",
|
"sass": "^1.63.6",
|
||||||
"svelte": "^3.59.0",
|
"svelte": "^4.0.0",
|
||||||
"svelte-check": "^3.2.0",
|
"svelte-check": "^3.4.4",
|
||||||
"svelte-dnd-action": "^0.9.22",
|
"svelte-dnd-action": "^0.9.22",
|
||||||
"typescript": "^5.0.3",
|
"typescript": "^5.1.3",
|
||||||
"vite": "^4.3.8",
|
"vite": "^4.3.9",
|
||||||
"vite-plugin-glsl": "^1.1.2",
|
"vite-plugin-glsl": "^1.1.2",
|
||||||
"vite-plugin-static-copy": "^0.14.0",
|
"vite-plugin-static-copy": "^0.14.0",
|
||||||
"vite-plugin-svelte-console-remover": "^1.0.10",
|
"vite-plugin-svelte-console-remover": "^1.0.10",
|
||||||
"vite-tsconfig-paths": "^4.0.8",
|
"vite-tsconfig-paths": "^4.2.0",
|
||||||
"vitest": "^0.27.3"
|
"vitest": "^0.27.3"
|
||||||
},
|
},
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@codemirror/autocomplete": "^6.3.0",
|
"@codemirror/autocomplete": "^6.8.0",
|
||||||
"@codemirror/commands": "^6.1.2",
|
"@codemirror/commands": "^6.2.4",
|
||||||
"@codemirror/language": "^6.6.0",
|
"@codemirror/language": "^6.8.0",
|
||||||
"@codemirror/lint": "^6.0.0",
|
"@codemirror/lint": "^6.2.2",
|
||||||
"@codemirror/search": "^6.2.2",
|
"@codemirror/search": "^6.5.0",
|
||||||
"@codemirror/state": "^6.1.2",
|
"@codemirror/state": "^6.2.1",
|
||||||
"@codemirror/view": "^6.4.1",
|
"@codemirror/view": "^6.13.2",
|
||||||
"@dogagenc/svelte-markdown": "^0.2.4",
|
"@dogagenc/svelte-markdown": "^0.2.4",
|
||||||
"@gradio/accordion": "workspace:*",
|
"@gradio/accordion": "workspace:*",
|
||||||
"@gradio/atoms": "workspace:*",
|
"@gradio/atoms": "workspace:*",
|
||||||
@@ -65,6 +65,9 @@
|
|||||||
"@gradio/theme": "workspace:*",
|
"@gradio/theme": "workspace:*",
|
||||||
"@gradio/upload": "workspace:*",
|
"@gradio/upload": "workspace:*",
|
||||||
"@gradio/utils": "workspace:*",
|
"@gradio/utils": "workspace:*",
|
||||||
|
"@lezer/generator": "^1.3.0",
|
||||||
|
"@lezer/highlight": "^1.1.6",
|
||||||
|
"@lezer/lr": "^1.3.7",
|
||||||
"@litegraph-ts/core": "workspace:*",
|
"@litegraph-ts/core": "workspace:*",
|
||||||
"@litegraph-ts/nodes-basic": "workspace:*",
|
"@litegraph-ts/nodes-basic": "workspace:*",
|
||||||
"@litegraph-ts/nodes-events": "workspace:*",
|
"@litegraph-ts/nodes-events": "workspace:*",
|
||||||
@@ -72,32 +75,32 @@
|
|||||||
"@litegraph-ts/nodes-math": "workspace:*",
|
"@litegraph-ts/nodes-math": "workspace:*",
|
||||||
"@litegraph-ts/nodes-strings": "workspace:*",
|
"@litegraph-ts/nodes-strings": "workspace:*",
|
||||||
"@litegraph-ts/tsconfig": "workspace:*",
|
"@litegraph-ts/tsconfig": "workspace:*",
|
||||||
"@sveltejs/vite-plugin-svelte": "^2.1.1",
|
"@sveltejs/vite-plugin-svelte": "^2.4.2",
|
||||||
"@tsconfig/svelte": "^4.0.1",
|
"@tsconfig/svelte": "^4.0.1",
|
||||||
"@types/dompurify": "^3.0.2",
|
"@types/dompurify": "^3.0.2",
|
||||||
"canvas-to-svg": "^1.0.3",
|
"canvas-to-svg": "^1.0.3",
|
||||||
"cm6-theme-basic-dark": "^0.2.0",
|
"cm6-theme-basic-dark": "^0.2.0",
|
||||||
"cm6-theme-basic-light": "^0.2.0",
|
"cm6-theme-basic-light": "^0.2.0",
|
||||||
"codemirror": "^6.0.1",
|
"codemirror": "^6.0.1",
|
||||||
"csv": "^6.3.0",
|
"csv": "^6.3.1",
|
||||||
"csv-parse": "^5.3.10",
|
"csv-parse": "^5.4.0",
|
||||||
"dompurify": "^3.0.3",
|
"dompurify": "^3.0.3",
|
||||||
"events": "^3.3.0",
|
"events": "^3.3.0",
|
||||||
"framework7": "^8.0.3",
|
"framework7": "^8.1.0",
|
||||||
"framework7-svelte": "^8.0.3",
|
"framework7-svelte": "^8.1.0",
|
||||||
"img-comparison-slider": "^8.0.0",
|
"img-comparison-slider": "^8.0.0",
|
||||||
"marked": "^5.0.3",
|
"marked": "^5.1.0",
|
||||||
"pollen-css": "^4.6.2",
|
"pollen-css": "^4.6.2",
|
||||||
"radix-icons-svelte": "^1.2.1",
|
"radix-icons-svelte": "^1.2.1",
|
||||||
"style-mod": "^4.0.3",
|
"style-mod": "^4.0.3",
|
||||||
"svelte-bootstrap-icons": "^2.3.1",
|
"svelte-bootstrap-icons": "^2.3.1",
|
||||||
"svelte-feather-icons": "^4.0.0",
|
"svelte-feather-icons": "^4.0.1",
|
||||||
"svelte-floating-ui": "^1.5.2",
|
"svelte-floating-ui": "^1.5.3",
|
||||||
"svelte-preprocess": "^5.0.3",
|
"svelte-preprocess": "^5.0.4",
|
||||||
"svelte-select": "^5.5.3",
|
"svelte-select": "^5.6.1",
|
||||||
"svelte-splitpanes": "^0.7.13",
|
"svelte-splitpanes": "^0.7.15",
|
||||||
"svelte-tiny-virtual-list": "^2.0.5",
|
"svelte-tiny-virtual-list": "^2.0.5",
|
||||||
"tailwindcss": "^3.3.1",
|
"tailwindcss": "^3.3.2",
|
||||||
"typed-emitter": "github:andywer/typed-emitter",
|
"typed-emitter": "github:andywer/typed-emitter",
|
||||||
"uuid": "^9.0.0",
|
"uuid": "^9.0.0",
|
||||||
"vite-plugin-full-reload": "^1.0.5",
|
"vite-plugin-full-reload": "^1.0.5",
|
||||||
|
|||||||
1514
pnpm-lock.yaml
generated
1514
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -12,7 +12,7 @@
|
|||||||
import {cubicIn} from 'svelte/easing';
|
import {cubicIn} from 'svelte/easing';
|
||||||
import { flip } from 'svelte/animate';
|
import { flip } from 'svelte/animate';
|
||||||
import { type ContainerLayout, type WidgetLayout, type IDragItem } from "$lib/stores/layoutStates";
|
import { type ContainerLayout, type WidgetLayout, type IDragItem } from "$lib/stores/layoutStates";
|
||||||
import { startDrag, stopDrag } from "$lib/utils"
|
import { startDrag, stopDrag, vibrateIfPossible } from "$lib/utils"
|
||||||
import { writable, type Writable } from "svelte/store";
|
import { writable, type Writable } from "svelte/store";
|
||||||
import { isHidden } from "$lib/widgets/utils";
|
import { isHidden } from "$lib/widgets/utils";
|
||||||
import { handleContainerConsider, handleContainerFinalize } from "./utils";
|
import { handleContainerConsider, handleContainerFinalize } from "./utils";
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
function handleClick(e: CustomEvent<boolean>) {
|
function handleClick(e: CustomEvent<boolean>) {
|
||||||
navigator.vibrate(20)
|
vibrateIfPossible(20)
|
||||||
$isOpen = e.detail
|
$isOpen = e.detail
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@
|
|||||||
>
|
>
|
||||||
<WidgetContainer {layoutState} dragItem={item} zIndex={zIndex+1} {isMobile} />
|
<WidgetContainer {layoutState} dragItem={item} zIndex={zIndex+1} {isMobile} />
|
||||||
{#if item[SHADOW_ITEM_MARKER_PROPERTY_NAME]}
|
{#if item[SHADOW_ITEM_MARKER_PROPERTY_NAME]}
|
||||||
<div in:fade={{duration:200, easing: cubicIn}} class='drag-item-shadow'/>
|
<div in:fade|global={{duration:200, easing: cubicIn}} class='drag-item-shadow'/>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
|
|||||||
@@ -102,7 +102,7 @@
|
|||||||
>
|
>
|
||||||
<WidgetContainer {layoutState} dragItem={item} zIndex={zIndex+1} {isMobile} />
|
<WidgetContainer {layoutState} dragItem={item} zIndex={zIndex+1} {isMobile} />
|
||||||
{#if item[SHADOW_ITEM_MARKER_PROPERTY_NAME]}
|
{#if item[SHADOW_ITEM_MARKER_PROPERTY_NAME]}
|
||||||
<div in:fade={{duration:200, easing: cubicIn}} class='drag-item-shadow'/>
|
<div in:fade|global={{duration:200, easing: cubicIn}} class='drag-item-shadow'/>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
|
|||||||
@@ -336,7 +336,7 @@
|
|||||||
✕
|
✕
|
||||||
</button>
|
</button>
|
||||||
{#if workflow[SHADOW_ITEM_MARKER_PROPERTY_NAME]}
|
{#if workflow[SHADOW_ITEM_MARKER_PROPERTY_NAME]}
|
||||||
<div in:fade={{duration:200, easing: cubicIn}} class='drag-item-shadow'/>
|
<div in:fade|global={{duration:200, easing: cubicIn}} class='drag-item-shadow'/>
|
||||||
{/if}
|
{/if}
|
||||||
</button>
|
</button>
|
||||||
{/each}
|
{/each}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
export let mode: ComfyPaneMode = "none";
|
export let mode: ComfyPaneMode = "none";
|
||||||
export let showSwitcher: boolean = false;
|
export let showSwitcher: boolean = false;
|
||||||
|
|
||||||
const MODES: [ComfyPaneMode, typeof SvelteComponent][] = [
|
const MODES: [ComfyPaneMode, typeof SvelteComponent<any>][] = [
|
||||||
["properties", Sliders2],
|
["properties", Sliders2],
|
||||||
["templates", BoxSeam],
|
["templates", BoxSeam],
|
||||||
["queue", LayoutTextSidebarReverse]
|
["queue", LayoutTextSidebarReverse]
|
||||||
|
|||||||
@@ -197,7 +197,7 @@
|
|||||||
<div class="template-desc">{item.template.metadata.description}</div>
|
<div class="template-desc">{item.template.metadata.description}</div>
|
||||||
</div>
|
</div>
|
||||||
{#if item[SHADOW_ITEM_MARKER_PROPERTY_NAME]}
|
{#if item[SHADOW_ITEM_MARKER_PROPERTY_NAME]}
|
||||||
<div in:fade={{duration:200, easing: cubicIn}} class='template-drag-item-shadow'/>
|
<div in:fade|global={{duration:200, easing: cubicIn}} class='template-drag-item-shadow'/>
|
||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
import {cubicIn} from 'svelte/easing';
|
import {cubicIn} from 'svelte/easing';
|
||||||
import { flip } from 'svelte/animate';
|
import { flip } from 'svelte/animate';
|
||||||
import { type ContainerLayout, type WidgetLayout, type IDragItem, type WritableLayoutStateStore } from "$lib/stores/layoutStates";
|
import { type ContainerLayout, type WidgetLayout, type IDragItem, type WritableLayoutStateStore } from "$lib/stores/layoutStates";
|
||||||
import { startDrag, stopDrag } from "$lib/utils"
|
import { startDrag, stopDrag, vibrateIfPossible } from "$lib/utils"
|
||||||
import type { Writable } from "svelte/store";
|
import type { Writable } from "svelte/store";
|
||||||
import { isHidden } from "$lib/widgets/utils";
|
import { isHidden } from "$lib/widgets/utils";
|
||||||
import { handleContainerConsider, handleContainerFinalize } from "./utils";
|
import { handleContainerConsider, handleContainerFinalize } from "./utils";
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleSelect() {
|
function handleSelect() {
|
||||||
navigator.vibrate(20)
|
vibrateIfPossible(20)
|
||||||
}
|
}
|
||||||
|
|
||||||
function _startDrag(e: MouseEvent | TouchEvent) {
|
function _startDrag(e: MouseEvent | TouchEvent) {
|
||||||
@@ -112,7 +112,7 @@
|
|||||||
</label>
|
</label>
|
||||||
<WidgetContainer {layoutState} dragItem={item} zIndex={zIndex+1} {isMobile} />
|
<WidgetContainer {layoutState} dragItem={item} zIndex={zIndex+1} {isMobile} />
|
||||||
{#if item[SHADOW_ITEM_MARKER_PROPERTY_NAME]}
|
{#if item[SHADOW_ITEM_MARKER_PROPERTY_NAME]}
|
||||||
<div in:fade={{duration:200, easing: cubicIn}} class='drag-item-shadow'/>
|
<div in:fade|global={{duration:200, easing: cubicIn}} class='drag-item-shadow'/>
|
||||||
{/if}
|
{/if}
|
||||||
</Block>
|
</Block>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ function convertEntry(entry: QueueEntry, status: QueueUIEntryStatus): QueueUIEnt
|
|||||||
message += ` (${subgraphsString})`
|
message += ` (${subgraphsString})`
|
||||||
}
|
}
|
||||||
|
|
||||||
let submessage = `Nodes: ${Object.keys(entry.prompt).length}`
|
let submessage = `#: ${entry.number}, Nodes: ${Object.keys(entry.prompt).length}`
|
||||||
|
|
||||||
if (Object.keys(entry.outputs).length > 0) {
|
if (Object.keys(entry.outputs).length > 0) {
|
||||||
const imageCount = Object.values(entry.outputs).filter(o => o.images).flatMap(o => o.images).length
|
const imageCount = Object.values(entry.outputs).filter(o => o.images).flatMap(o => o.images).length
|
||||||
|
|||||||
@@ -828,3 +828,9 @@ const MOBILE_USER_AGENTS = ["iPhone", "iPad", "Android", "BlackBerry", "WebOs"].
|
|||||||
export function isMobileBrowser(userAgent: string): boolean {
|
export function isMobileBrowser(userAgent: string): boolean {
|
||||||
return MOBILE_USER_AGENTS.some(a => userAgent.match(a))
|
return MOBILE_USER_AGENTS.some(a => userAgent.match(a))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function vibrateIfPossible(strength: number | Array<number>) {
|
||||||
|
if (window.navigator.vibrate) {
|
||||||
|
window.navigator.vibrate(strength);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
import { Button } from "@gradio/button";
|
import { Button } from "@gradio/button";
|
||||||
import { get, type Writable, writable } from "svelte/store";
|
import { get, type Writable, writable } from "svelte/store";
|
||||||
import { isDisabled } from "./utils"
|
import { isDisabled } from "./utils"
|
||||||
|
import { vibrateIfPossible } from "$lib/utils";
|
||||||
import type { ComfyButtonNode } from "$lib/nodes/widgets";
|
import type { ComfyButtonNode } from "$lib/nodes/widgets";
|
||||||
|
|
||||||
export let widget: WidgetLayout | null = null;
|
export let widget: WidgetLayout | null = null;
|
||||||
@@ -24,7 +25,7 @@
|
|||||||
|
|
||||||
function onClick(e: MouseEvent) {
|
function onClick(e: MouseEvent) {
|
||||||
node.onClick();
|
node.onClick();
|
||||||
navigator.vibrate(20)
|
vibrateIfPossible(20)
|
||||||
}
|
}
|
||||||
|
|
||||||
const style = {
|
const style = {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
import { Checkbox } from "@gradio/form";
|
import { Checkbox } from "@gradio/form";
|
||||||
import { get, type Writable, writable } from "svelte/store";
|
import { get, type Writable, writable } from "svelte/store";
|
||||||
import { isDisabled } from "./utils"
|
import { isDisabled } from "./utils"
|
||||||
|
import { vibrateIfPossible } from "$lib/utils";
|
||||||
import type { SelectData } from "@gradio/utils";
|
import type { SelectData } from "@gradio/utils";
|
||||||
import type { ComfyCheckboxNode } from "$lib/nodes/widgets";
|
import type { ComfyCheckboxNode } from "$lib/nodes/widgets";
|
||||||
|
|
||||||
@@ -25,7 +26,7 @@
|
|||||||
|
|
||||||
function onSelect(e: CustomEvent<SelectData>) {
|
function onSelect(e: CustomEvent<SelectData>) {
|
||||||
$nodeValue = e.detail.selected
|
$nodeValue = e.detail.selected
|
||||||
navigator.vibrate(20)
|
vibrateIfPossible(20)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
import { type WidgetLayout } from "$lib/stores/layoutStates";
|
import { type WidgetLayout } from "$lib/stores/layoutStates";
|
||||||
import { get, writable, type Writable } from "svelte/store";
|
import { get, writable, type Writable } from "svelte/store";
|
||||||
import { isDisabled } from "./utils"
|
import { isDisabled } from "./utils"
|
||||||
import { clamp, getSafetensorsMetadata } from '$lib/utils';
|
import { clamp, getSafetensorsMetadata, vibrateIfPossible } from '$lib/utils';
|
||||||
export let widget: WidgetLayout | null = null;
|
export let widget: WidgetLayout | null = null;
|
||||||
export let isMobile: boolean = false;
|
export let isMobile: boolean = false;
|
||||||
let node: ComfyComboNode | null = null;
|
let node: ComfyComboNode | null = null;
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
function onFocus() {
|
function onFocus() {
|
||||||
// console.warn("FOCUS")
|
// console.warn("FOCUS")
|
||||||
if (listOpen) {
|
if (listOpen) {
|
||||||
navigator.vibrate(20)
|
vibrateIfPossible(20)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@
|
|||||||
|
|
||||||
function handleSelect(index: number) {
|
function handleSelect(index: number) {
|
||||||
// console.warn("SEL", index)
|
// console.warn("SEL", index)
|
||||||
navigator.vibrate(20)
|
vibrateIfPossible(20)
|
||||||
const item = $valuesForCombo[index]
|
const item = $valuesForCombo[index]
|
||||||
activeIndex = index;
|
activeIndex = index;
|
||||||
$nodeValue = item.value
|
$nodeValue = item.value
|
||||||
|
|||||||
36
src/lib/widgets/ComfyUI.grammar
Normal file
36
src/lib/widgets/ComfyUI.grammar
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
@top Program { expression* }
|
||||||
|
|
||||||
|
@skip {} {
|
||||||
|
BlockComment { "/*" (blockCommentContent | blockCommentNewline)* blockCommentEnd }
|
||||||
|
}
|
||||||
|
|
||||||
|
@skip { space | LineComment | BlockComment }
|
||||||
|
|
||||||
|
@local tokens {
|
||||||
|
blockCommentEnd { "*/" }
|
||||||
|
blockCommentNewline { "\n" }
|
||||||
|
@else blockCommentContent
|
||||||
|
}
|
||||||
|
|
||||||
|
expression {
|
||||||
|
Identifier |
|
||||||
|
String |
|
||||||
|
Boolean |
|
||||||
|
Application { "(" expression* ")" }
|
||||||
|
}
|
||||||
|
|
||||||
|
@tokens {
|
||||||
|
Identifier { $[a-zA-Z_\-0-9]+ }
|
||||||
|
|
||||||
|
String { '"' (!["\\] | "\\" _)* '"' }
|
||||||
|
|
||||||
|
Boolean { "#t" | "#f" }
|
||||||
|
|
||||||
|
LineComment { "//" ![\n]* }
|
||||||
|
|
||||||
|
space { $[ \t\n\r]+ }
|
||||||
|
|
||||||
|
"(" ")"
|
||||||
|
}
|
||||||
|
|
||||||
|
@detectDelim
|
||||||
3
src/lib/widgets/ComfyUI.grammar.d.ts
vendored
Normal file
3
src/lib/widgets/ComfyUI.grammar.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
import { LRParser } from "@lezer/lr"
|
||||||
|
|
||||||
|
export declare const parser: LRParser
|
||||||
@@ -110,6 +110,16 @@
|
|||||||
showMobileLightbox(images, selectedImage, { thumbs: images });
|
showMobileLightbox(images, selectedImage, { thumbs: images });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onClickedSingle(e: CustomEvent<GradioSelectData>) {
|
||||||
|
const images = $nodeValue.map(comfyBoxImageToComfyURL)
|
||||||
|
if (isMobile) {
|
||||||
|
showMobileLightbox(images, 0, { thumbs: images });
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ImageViewer.instance.showModal(images, 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function onClicked(e: CustomEvent<HTMLImageElement>) {
|
function onClicked(e: CustomEvent<HTMLImageElement>) {
|
||||||
if (isMobile) {
|
if (isMobile) {
|
||||||
showMobileLightbox_(e.detail, $selected_image)
|
showMobileLightbox_(e.detail, $selected_image)
|
||||||
@@ -136,6 +146,7 @@
|
|||||||
value={url}
|
value={url}
|
||||||
show_label={widget.attrs.title != ""}
|
show_label={widget.attrs.title != ""}
|
||||||
label={widget.attrs.title}
|
label={widget.attrs.title}
|
||||||
|
on:select={onClickedSingle}
|
||||||
bind:imageWidth={$imageWidth}
|
bind:imageWidth={$imageWidth}
|
||||||
bind:imageHeight={$imageHeight}
|
bind:imageHeight={$imageHeight}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { type WidgetLayout } from "$lib/stores/layoutStates";
|
import { type WidgetLayout } from "$lib/stores/layoutStates";
|
||||||
import { Range } from "$lib/components/gradio/form";
|
import { Range } from "$lib/components/gradio/form";
|
||||||
import { get, type Writable } from "svelte/store";
|
import { get, type Writable } from "svelte/store";
|
||||||
import { debounce } from "$lib/utils";
|
import { debounce, vibrateIfPossible } from "$lib/utils";
|
||||||
import interfaceState from "$lib/stores/interfaceState";
|
import interfaceState from "$lib/stores/interfaceState";
|
||||||
import { isDisabled } from "./utils"
|
import { isDisabled } from "./utils"
|
||||||
export let widget: WidgetLayout | null = null;
|
export let widget: WidgetLayout | null = null;
|
||||||
@@ -96,7 +96,7 @@
|
|||||||
lastDisplayValue = option;
|
lastDisplayValue = option;
|
||||||
canVibrate = false;
|
canVibrate = false;
|
||||||
setTimeout(() => { canVibrate = true }, 30)
|
setTimeout(() => { canVibrate = true }, 30)
|
||||||
navigator.vibrate(10)
|
vibrateIfPossible(10)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
import { get, type Writable, writable } from "svelte/store";
|
import { get, type Writable, writable } from "svelte/store";
|
||||||
import { isDisabled } from "./utils"
|
import { isDisabled } from "./utils"
|
||||||
import type { SelectData } from "@gradio/utils";
|
import type { SelectData } from "@gradio/utils";
|
||||||
import { clamp } from "$lib/utils";
|
import { clamp, vibrateIfPossible } from "$lib/utils";
|
||||||
import type { ComfyRadioNode } from "$lib/nodes/widgets";
|
import type { ComfyRadioNode } from "$lib/nodes/widgets";
|
||||||
|
|
||||||
export let widget: WidgetLayout | null = null;
|
export let widget: WidgetLayout | null = null;
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
function onSelect(e: CustomEvent<SelectData>) {
|
function onSelect(e: CustomEvent<SelectData>) {
|
||||||
node.setValue(e.detail.value)
|
node.setValue(e.detail.value)
|
||||||
node.index = e.detail.index as number
|
node.index = e.detail.index as number
|
||||||
navigator.vibrate(20)
|
vibrateIfPossible(20)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ import {
|
|||||||
indentOnInput,
|
indentOnInput,
|
||||||
syntaxHighlighting,
|
syntaxHighlighting,
|
||||||
defaultHighlightStyle,
|
defaultHighlightStyle,
|
||||||
foldKeymap
|
foldKeymap,
|
||||||
|
LRLanguage, LanguageSupport, indentNodeProp, foldNodeProp, foldInside, delimitedIndent
|
||||||
} from "@codemirror/language";
|
} from "@codemirror/language";
|
||||||
import { history, defaultKeymap, historyKeymap } from "@codemirror/commands";
|
import { history, defaultKeymap, historyKeymap } from "@codemirror/commands";
|
||||||
import {
|
import {
|
||||||
@@ -27,8 +28,26 @@ import {
|
|||||||
type CompletionSource, autocompletion, CompletionContext, startCompletion,
|
type CompletionSource, autocompletion, CompletionContext, startCompletion,
|
||||||
currentCompletions, completionStatus, completeFromList, acceptCompletion
|
currentCompletions, completionStatus, completeFromList, acceptCompletion
|
||||||
} from "@codemirror/autocomplete"
|
} from "@codemirror/autocomplete"
|
||||||
|
import { styleTags, tags as t } from "@lezer/highlight"
|
||||||
import DanbooruTags from "$lib/DanbooruTags";
|
import DanbooruTags from "$lib/DanbooruTags";
|
||||||
|
|
||||||
|
import { parser } from "./ComfyUI.grammar"
|
||||||
|
|
||||||
|
export const comfyUILanguage = LRLanguage.define({
|
||||||
|
name: "ComfyUI",
|
||||||
|
parser: parser.configure({
|
||||||
|
props: [
|
||||||
|
styleTags({
|
||||||
|
LineComment: t.lineComment,
|
||||||
|
BlockComment: t.blockComment,
|
||||||
|
})
|
||||||
|
]
|
||||||
|
}),
|
||||||
|
languageData: {
|
||||||
|
commentTokens: { line: "//", block: { open: "/*", close: "*/" } },
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
export const basicSetup: Extension = /*@__PURE__*/ (() => [
|
export const basicSetup: Extension = /*@__PURE__*/ (() => [
|
||||||
lineNumbers(),
|
lineNumbers(),
|
||||||
highlightSpecialChars(),
|
highlightSpecialChars(),
|
||||||
@@ -43,6 +62,7 @@ export const basicSetup: Extension = /*@__PURE__*/ (() => [
|
|||||||
crosshairCursor(),
|
crosshairCursor(),
|
||||||
EditorView.lineWrapping,
|
EditorView.lineWrapping,
|
||||||
DanbooruTags.getCompletionExt(),
|
DanbooruTags.getCompletionExt(),
|
||||||
|
new LanguageSupport(comfyUILanguage),
|
||||||
|
|
||||||
keymap.of([
|
keymap.of([
|
||||||
...closeBracketsKeymap,
|
...closeBracketsKeymap,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import ComfyApp, { type SerializedAppState } from "$lib/components/ComfyApp";
|
import ComfyApp, { type SerializedAppState } from "$lib/components/ComfyApp";
|
||||||
import workflowState, { ComfyBoxWorkflow } from "$lib/stores/workflowState";
|
import workflowState, { ComfyBoxWorkflow } from "$lib/stores/workflowState";
|
||||||
|
import { vibrateIfPossible } from "$lib/utils";
|
||||||
|
|
||||||
import { Link, Toolbar } from "framework7-svelte"
|
import { Link, Toolbar } from "framework7-svelte"
|
||||||
|
|
||||||
@@ -11,7 +12,7 @@
|
|||||||
$: workflow = $workflowState.activeWorkflow;
|
$: workflow = $workflowState.activeWorkflow;
|
||||||
|
|
||||||
function queuePrompt() {
|
function queuePrompt() {
|
||||||
navigator.vibrate(20)
|
vibrateIfPossible(20)
|
||||||
app.runDefaultQueueAction()
|
app.runDefaultQueueAction()
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import ComfyApp, { type SerializedAppState } from "$lib/components/ComfyApp";
|
import ComfyApp, { type SerializedAppState } from "$lib/components/ComfyApp";
|
||||||
import queueState from "$lib/stores/queueState";
|
import queueState from "$lib/stores/queueState";
|
||||||
import workflowState, { ComfyBoxWorkflow } from "$lib/stores/workflowState";
|
import workflowState, { ComfyBoxWorkflow } from "$lib/stores/workflowState";
|
||||||
import { getNodeInfo } from "$lib/utils"
|
import { getNodeInfo, vibrateIfPossible } from "$lib/utils"
|
||||||
import { LayoutTextSidebarReverse, Image, Grid } from "svelte-bootstrap-icons";
|
import { LayoutTextSidebarReverse, Image, Grid } from "svelte-bootstrap-icons";
|
||||||
|
|
||||||
import { Link, Toolbar } from "framework7-svelte"
|
import { Link, Toolbar } from "framework7-svelte"
|
||||||
@@ -21,12 +21,12 @@
|
|||||||
$: workflow = $workflowState.activeWorkflow;
|
$: workflow = $workflowState.activeWorkflow;
|
||||||
|
|
||||||
function queuePrompt() {
|
function queuePrompt() {
|
||||||
navigator.vibrate(20)
|
vibrateIfPossible(20)
|
||||||
app.runDefaultQueueAction()
|
app.runDefaultQueueAction()
|
||||||
}
|
}
|
||||||
|
|
||||||
async function refreshCombos() {
|
async function refreshCombos() {
|
||||||
navigator.vibrate(20)
|
vibrateIfPossible(20)
|
||||||
await app.refreshComboInNodes()
|
await app.refreshComboInNodes()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
if (!fileInput)
|
if (!fileInput)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
navigator.vibrate(20)
|
vibrateIfPossible(20)
|
||||||
app.querySave()
|
app.querySave()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
if (!fileInput)
|
if (!fileInput)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
navigator.vibrate(20)
|
vibrateIfPossible(20)
|
||||||
fileInput.value = null;
|
fileInput.value = null;
|
||||||
fileInput.click();
|
fileInput.click();
|
||||||
}
|
}
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function doSaveLocal(): void {
|
function doSaveLocal(): void {
|
||||||
navigator.vibrate(20)
|
vibrateIfPossible(20)
|
||||||
app.saveStateToLocalStorage();
|
app.saveStateToLocalStorage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,12 +34,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function refreshCombos() {
|
async function refreshCombos() {
|
||||||
navigator.vibrate(20)
|
vibrateIfPossible(20)
|
||||||
await app.refreshComboInNodes()
|
await app.refreshComboInNodes()
|
||||||
}
|
}
|
||||||
|
|
||||||
function doSaveLocal(): void {
|
function doSaveLocal(): void {
|
||||||
navigator.vibrate(20)
|
vibrateIfPossible(20)
|
||||||
app.saveStateToLocalStorage();
|
app.saveStateToLocalStorage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
import workflowState, { ComfyBoxWorkflow, type WorkflowInstID } from "$lib/stores/workflowState";
|
import workflowState, { ComfyBoxWorkflow, type WorkflowInstID } from "$lib/stores/workflowState";
|
||||||
import { onMount } from "svelte";
|
import { onMount } from "svelte";
|
||||||
import interfaceState from "$lib/stores/interfaceState";
|
import interfaceState from "$lib/stores/interfaceState";
|
||||||
|
import { vibrateIfPossible } from "$lib/utils";
|
||||||
import { f7 } from 'framework7-svelte';
|
import { f7 } from 'framework7-svelte';
|
||||||
import { XCircle } from 'svelte-bootstrap-icons';
|
import { XCircle } from 'svelte-bootstrap-icons';
|
||||||
|
|
||||||
@@ -31,7 +32,7 @@
|
|||||||
if (!fileInput)
|
if (!fileInput)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
navigator.vibrate(20)
|
vibrateIfPossible(20);
|
||||||
fileInput.value = null;
|
fileInput.value = null;
|
||||||
fileInput.click();
|
fileInput.click();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import removeConsole from 'vite-plugin-svelte-console-remover';
|
|||||||
import glsl from 'vite-plugin-glsl';
|
import glsl from 'vite-plugin-glsl';
|
||||||
import { execSync } from "child_process"
|
import { execSync } from "child_process"
|
||||||
import { visualizer } from "rollup-plugin-visualizer";
|
import { visualizer } from "rollup-plugin-visualizer";
|
||||||
|
import { lezer } from "@lezer/generator/rollup"
|
||||||
|
|
||||||
const isProduction = process.env.NODE_ENV === "production";
|
const isProduction = process.env.NODE_ENV === "production";
|
||||||
console.log("Production build: " + isProduction)
|
console.log("Production build: " + isProduction)
|
||||||
@@ -31,6 +32,7 @@ export default defineConfig({
|
|||||||
isProduction && removeConsole(),
|
isProduction && removeConsole(),
|
||||||
glsl(),
|
glsl(),
|
||||||
svelte(),
|
svelte(),
|
||||||
|
lezer(),
|
||||||
visualizer(),
|
visualizer(),
|
||||||
viteStaticCopy({
|
viteStaticCopy({
|
||||||
targets: [
|
targets: [
|
||||||
|
|||||||
Reference in New Issue
Block a user