19 Commits

Author SHA1 Message Date
595410adac Apt update in cont
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2024-02-26 20:33:14 +03:00
8c0912ec66 Git install in cont
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2024-02-26 20:32:04 +03:00
ffa73b8419 Drop alpine
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2024-02-26 20:29:49 +03:00
8674db6523 Drop corepack
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2024-02-26 20:27:39 +03:00
f58ba2d54d Another libc compat. Alpine latest
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2024-02-26 20:26:42 +03:00
04aa72aafe Libc compat
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2024-02-26 20:25:01 +03:00
afbd240779 Initial Woodpecker conf
Some checks failed
ci/woodpecker/manual/woodpecker Pipeline failed
2024-02-26 20:21:15 +03:00
space-nuko
abd31401f0 Merge pull request #148 from haze/hb/vibrateIfPossible
`vibrateIfPossible`: fixes iOS safari uncaught exceptions & etc
2023-08-25 23:43:22 -05:00
haze
2f48f96830 Update CheckboxWidget.svelte 2023-08-25 15:26:15 -04:00
Haze Booth
63d51e9119 Introduce vibrateIfPossible into the utils package. This will check if the browser
has support for vibrating. This fixes a number of bugs for iOS safari & friends.
2023-08-24 12:02:22 -04:00
space-nuko
6f02912d2e Merge pull request #125 from space-nuko/restore-params2
Upgrade Svelte and dependency versions
2023-07-07 09:49:39 -05:00
space-nuko
3b49bac47b Merge pull request #126 from space-nuko/server-args
Add arguments to serve.py
2023-07-07 09:49:27 -05:00
space-nuko
33ed379a98 Add arguments to serve.py 2023-07-07 09:12:28 -05:00
space-nuko
c817231241 Upgrade dependencies 2023-07-07 09:11:30 -05:00
space-nuko
2c7566e8e6 migration to Svelte 4 2023-06-22 13:30:20 -05:00
space-nuko
c875f9c4f6 Code editor language support 2023-06-20 02:09:10 -05:00
space-nuko
43ed176502 Show lightbox when clicking StaticImage 2023-06-20 02:08:08 -05:00
space-nuko
228ea20dcb Merge pull request #120 from space-nuko/previews
Minor fixes
2023-06-20 00:16:06 -05:00
space-nuko
f24eb23991 Merge pull request #115 from space-nuko/previews
Latent previews
2023-06-07 10:58:29 -05:00
27 changed files with 1423 additions and 377 deletions

11
.woodpecker.yml Normal file
View File

@@ -0,0 +1,11 @@
steps:
- name: Prepare
image: node:18-slim
commands:
- apt-get update -y
- apt-get install -yy git
- corepack enable
- corepack prepare pnpm@latest --activate
- pnpm install --frozen-lockfile
- pnpm prebuild
- pnpm build

View File

@@ -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:
``` ```

View File

@@ -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)

View File

@@ -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

File diff suppressed because it is too large Load Diff

View File

@@ -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}

View File

@@ -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}

View File

@@ -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}

View File

@@ -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]

View File

@@ -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>

View File

@@ -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>

View File

@@ -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

View File

@@ -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);
}
}

View File

@@ -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 = {

View File

@@ -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>

View File

@@ -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

View 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
View File

@@ -0,0 +1,3 @@
import { LRParser } from "@lezer/lr"
export declare const parser: LRParser

View File

@@ -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}
/> />

View File

@@ -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>

View File

@@ -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>

View File

@@ -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,

View File

@@ -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>

View File

@@ -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();
} }

View File

@@ -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();
} }

View File

@@ -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();
} }

View File

@@ -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: [