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
|
||||
|
||||
- `git`
|
||||
- `pnpm`
|
||||
- An installation of vanilla [ComfyUI](https://github.com/comfyanonymous/ComfyUI) for the backend
|
||||
|
||||
### 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:
|
||||
|
||||
```
|
||||
|
||||
59
bin/serve.py
59
bin/serve.py
@@ -2,15 +2,19 @@
|
||||
|
||||
import http.server
|
||||
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.
|
||||
Be sure you've started ComfyUI already using this command:
|
||||
|
||||
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.
|
||||
@@ -19,33 +23,34 @@ Serving at http://localhost:{PORT}...
|
||||
# Hopefully this will cover everything.
|
||||
class HttpRequestHandler(http.server.SimpleHTTPRequestHandler):
|
||||
extensions_map = {
|
||||
'': 'application/octet-stream',
|
||||
'.manifest': 'text/cache-manifest',
|
||||
'.html': 'text/html',
|
||||
'.png': 'image/png',
|
||||
'.jpg': 'image/jpg',
|
||||
'.jpeg': 'image/jpeg',
|
||||
'.gif': 'image/gif',
|
||||
'.svg': 'image/svg+xml',
|
||||
'.css': 'text/css',
|
||||
'.js': 'application/x-javascript',
|
||||
'.mjs': 'application/x-javascript',
|
||||
'.cjs': 'application/x-javascript',
|
||||
'.wasm': 'application/wasm',
|
||||
'.json': 'application/json',
|
||||
'.xml': 'application/xml',
|
||||
'.xml': 'application/xml',
|
||||
'.pdf': 'application/pdf',
|
||||
'.webp': 'image/webp',
|
||||
'.avif': 'image/avif',
|
||||
'.heic': 'image/heic',
|
||||
'.heif': 'image/heif',
|
||||
'.mp3': 'audio/mpeg',
|
||||
'.mp4': 'video/mp4',
|
||||
'.m4v': 'video/mp4'
|
||||
"": "application/octet-stream",
|
||||
".manifest": "text/cache-manifest",
|
||||
".html": "text/html",
|
||||
".png": "image/png",
|
||||
".jpg": "image/jpg",
|
||||
".jpeg": "image/jpeg",
|
||||
".gif": "image/gif",
|
||||
".svg": "image/svg+xml",
|
||||
".css": "text/css",
|
||||
".js": "application/x-javascript",
|
||||
".mjs": "application/x-javascript",
|
||||
".cjs": "application/x-javascript",
|
||||
".wasm": "application/wasm",
|
||||
".json": "application/json",
|
||||
".xml": "application/xml",
|
||||
".xml": "application/xml",
|
||||
".pdf": "application/pdf",
|
||||
".webp": "image/webp",
|
||||
".avif": "image/avif",
|
||||
".heic": "image/heic",
|
||||
".heif": "image/heif",
|
||||
".mp3": "audio/mpeg",
|
||||
".mp4": "video/mp4",
|
||||
".m4v": "video/mp4",
|
||||
}
|
||||
|
||||
httpd = socketserver.TCPServer(("localhost", PORT), HttpRequestHandler)
|
||||
|
||||
httpd = socketserver.TCPServer((args.listen, args.port), HttpRequestHandler)
|
||||
|
||||
try:
|
||||
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"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@floating-ui/core": "^1.2.6",
|
||||
"@floating-ui/dom": "^1.2.8",
|
||||
"@floating-ui/core": "^1.3.1",
|
||||
"@floating-ui/dom": "^1.4.2",
|
||||
"@zerodevx/svelte-toast": "^0.9.3",
|
||||
"eslint": "^8.37.0",
|
||||
"eslint": "^8.43.0",
|
||||
"eslint-config-prettier": "^8.8.0",
|
||||
"eslint-plugin-svelte3": "^4.0.0",
|
||||
"happy-dom": "^9.18.3",
|
||||
"jsdom": "^22.0.0",
|
||||
"prettier": "^2.8.7",
|
||||
"prettier-plugin-svelte": "^2.10.0",
|
||||
"rollup-plugin-visualizer": "^5.9.0",
|
||||
"sass": "^1.61.0",
|
||||
"svelte": "^3.59.0",
|
||||
"svelte-check": "^3.2.0",
|
||||
"happy-dom": "^9.20.3",
|
||||
"jsdom": "^22.1.0",
|
||||
"prettier": "^2.8.8",
|
||||
"prettier-plugin-svelte": "^2.10.1",
|
||||
"rollup-plugin-visualizer": "^5.9.2",
|
||||
"sass": "^1.63.6",
|
||||
"svelte": "^4.0.0",
|
||||
"svelte-check": "^3.4.4",
|
||||
"svelte-dnd-action": "^0.9.22",
|
||||
"typescript": "^5.0.3",
|
||||
"vite": "^4.3.8",
|
||||
"typescript": "^5.1.3",
|
||||
"vite": "^4.3.9",
|
||||
"vite-plugin-glsl": "^1.1.2",
|
||||
"vite-plugin-static-copy": "^0.14.0",
|
||||
"vite-plugin-svelte-console-remover": "^1.0.10",
|
||||
"vite-tsconfig-paths": "^4.0.8",
|
||||
"vite-tsconfig-paths": "^4.2.0",
|
||||
"vitest": "^0.27.3"
|
||||
},
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"@codemirror/autocomplete": "^6.3.0",
|
||||
"@codemirror/commands": "^6.1.2",
|
||||
"@codemirror/language": "^6.6.0",
|
||||
"@codemirror/lint": "^6.0.0",
|
||||
"@codemirror/search": "^6.2.2",
|
||||
"@codemirror/state": "^6.1.2",
|
||||
"@codemirror/view": "^6.4.1",
|
||||
"@codemirror/autocomplete": "^6.8.0",
|
||||
"@codemirror/commands": "^6.2.4",
|
||||
"@codemirror/language": "^6.8.0",
|
||||
"@codemirror/lint": "^6.2.2",
|
||||
"@codemirror/search": "^6.5.0",
|
||||
"@codemirror/state": "^6.2.1",
|
||||
"@codemirror/view": "^6.13.2",
|
||||
"@dogagenc/svelte-markdown": "^0.2.4",
|
||||
"@gradio/accordion": "workspace:*",
|
||||
"@gradio/atoms": "workspace:*",
|
||||
@@ -65,6 +65,9 @@
|
||||
"@gradio/theme": "workspace:*",
|
||||
"@gradio/upload": "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/nodes-basic": "workspace:*",
|
||||
"@litegraph-ts/nodes-events": "workspace:*",
|
||||
@@ -72,32 +75,32 @@
|
||||
"@litegraph-ts/nodes-math": "workspace:*",
|
||||
"@litegraph-ts/nodes-strings": "workspace:*",
|
||||
"@litegraph-ts/tsconfig": "workspace:*",
|
||||
"@sveltejs/vite-plugin-svelte": "^2.1.1",
|
||||
"@sveltejs/vite-plugin-svelte": "^2.4.2",
|
||||
"@tsconfig/svelte": "^4.0.1",
|
||||
"@types/dompurify": "^3.0.2",
|
||||
"canvas-to-svg": "^1.0.3",
|
||||
"cm6-theme-basic-dark": "^0.2.0",
|
||||
"cm6-theme-basic-light": "^0.2.0",
|
||||
"codemirror": "^6.0.1",
|
||||
"csv": "^6.3.0",
|
||||
"csv-parse": "^5.3.10",
|
||||
"csv": "^6.3.1",
|
||||
"csv-parse": "^5.4.0",
|
||||
"dompurify": "^3.0.3",
|
||||
"events": "^3.3.0",
|
||||
"framework7": "^8.0.3",
|
||||
"framework7-svelte": "^8.0.3",
|
||||
"framework7": "^8.1.0",
|
||||
"framework7-svelte": "^8.1.0",
|
||||
"img-comparison-slider": "^8.0.0",
|
||||
"marked": "^5.0.3",
|
||||
"marked": "^5.1.0",
|
||||
"pollen-css": "^4.6.2",
|
||||
"radix-icons-svelte": "^1.2.1",
|
||||
"style-mod": "^4.0.3",
|
||||
"svelte-bootstrap-icons": "^2.3.1",
|
||||
"svelte-feather-icons": "^4.0.0",
|
||||
"svelte-floating-ui": "^1.5.2",
|
||||
"svelte-preprocess": "^5.0.3",
|
||||
"svelte-select": "^5.5.3",
|
||||
"svelte-splitpanes": "^0.7.13",
|
||||
"svelte-feather-icons": "^4.0.1",
|
||||
"svelte-floating-ui": "^1.5.3",
|
||||
"svelte-preprocess": "^5.0.4",
|
||||
"svelte-select": "^5.6.1",
|
||||
"svelte-splitpanes": "^0.7.15",
|
||||
"svelte-tiny-virtual-list": "^2.0.5",
|
||||
"tailwindcss": "^3.3.1",
|
||||
"tailwindcss": "^3.3.2",
|
||||
"typed-emitter": "github:andywer/typed-emitter",
|
||||
"uuid": "^9.0.0",
|
||||
"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 { flip } from 'svelte/animate';
|
||||
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 { isHidden } from "$lib/widgets/utils";
|
||||
import { handleContainerConsider, handleContainerFinalize } from "./utils";
|
||||
@@ -56,7 +56,7 @@
|
||||
};
|
||||
|
||||
function handleClick(e: CustomEvent<boolean>) {
|
||||
navigator.vibrate(20)
|
||||
vibrateIfPossible(20)
|
||||
$isOpen = e.detail
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
>
|
||||
<WidgetContainer {layoutState} dragItem={item} zIndex={zIndex+1} {isMobile} />
|
||||
{#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}
|
||||
</div>
|
||||
{/each}
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
>
|
||||
<WidgetContainer {layoutState} dragItem={item} zIndex={zIndex+1} {isMobile} />
|
||||
{#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}
|
||||
</div>
|
||||
{/each}
|
||||
|
||||
@@ -336,7 +336,7 @@
|
||||
✕
|
||||
</button>
|
||||
{#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}
|
||||
</button>
|
||||
{/each}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
export let mode: ComfyPaneMode = "none";
|
||||
export let showSwitcher: boolean = false;
|
||||
|
||||
const MODES: [ComfyPaneMode, typeof SvelteComponent][] = [
|
||||
const MODES: [ComfyPaneMode, typeof SvelteComponent<any>][] = [
|
||||
["properties", Sliders2],
|
||||
["templates", BoxSeam],
|
||||
["queue", LayoutTextSidebarReverse]
|
||||
|
||||
@@ -197,7 +197,7 @@
|
||||
<div class="template-desc">{item.template.metadata.description}</div>
|
||||
</div>
|
||||
{#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}
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
import {cubicIn} from 'svelte/easing';
|
||||
import { flip } from 'svelte/animate';
|
||||
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 { isHidden } from "$lib/widgets/utils";
|
||||
import { handleContainerConsider, handleContainerFinalize } from "./utils";
|
||||
@@ -62,7 +62,7 @@
|
||||
}
|
||||
|
||||
function handleSelect() {
|
||||
navigator.vibrate(20)
|
||||
vibrateIfPossible(20)
|
||||
}
|
||||
|
||||
function _startDrag(e: MouseEvent | TouchEvent) {
|
||||
@@ -112,7 +112,7 @@
|
||||
</label>
|
||||
<WidgetContainer {layoutState} dragItem={item} zIndex={zIndex+1} {isMobile} />
|
||||
{#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}
|
||||
</Block>
|
||||
</div>
|
||||
|
||||
@@ -73,7 +73,7 @@ function convertEntry(entry: QueueEntry, status: QueueUIEntryStatus): QueueUIEnt
|
||||
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) {
|
||||
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 {
|
||||
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 { get, type Writable, writable } from "svelte/store";
|
||||
import { isDisabled } from "./utils"
|
||||
import { vibrateIfPossible } from "$lib/utils";
|
||||
import type { ComfyButtonNode } from "$lib/nodes/widgets";
|
||||
|
||||
export let widget: WidgetLayout | null = null;
|
||||
@@ -24,7 +25,7 @@
|
||||
|
||||
function onClick(e: MouseEvent) {
|
||||
node.onClick();
|
||||
navigator.vibrate(20)
|
||||
vibrateIfPossible(20)
|
||||
}
|
||||
|
||||
const style = {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
import { Checkbox } from "@gradio/form";
|
||||
import { get, type Writable, writable } from "svelte/store";
|
||||
import { isDisabled } from "./utils"
|
||||
import { vibrateIfPossible } from "$lib/utils";
|
||||
import type { SelectData } from "@gradio/utils";
|
||||
import type { ComfyCheckboxNode } from "$lib/nodes/widgets";
|
||||
|
||||
@@ -25,7 +26,7 @@
|
||||
|
||||
function onSelect(e: CustomEvent<SelectData>) {
|
||||
$nodeValue = e.detail.selected
|
||||
navigator.vibrate(20)
|
||||
vibrateIfPossible(20)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
import { type WidgetLayout } from "$lib/stores/layoutStates";
|
||||
import { get, writable, type Writable } from "svelte/store";
|
||||
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 isMobile: boolean = false;
|
||||
let node: ComfyComboNode | null = null;
|
||||
@@ -70,7 +70,7 @@
|
||||
function onFocus() {
|
||||
// console.warn("FOCUS")
|
||||
if (listOpen) {
|
||||
navigator.vibrate(20)
|
||||
vibrateIfPossible(20)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
|
||||
function handleSelect(index: number) {
|
||||
// console.warn("SEL", index)
|
||||
navigator.vibrate(20)
|
||||
vibrateIfPossible(20)
|
||||
const item = $valuesForCombo[index]
|
||||
activeIndex = index;
|
||||
$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 });
|
||||
}
|
||||
|
||||
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>) {
|
||||
if (isMobile) {
|
||||
showMobileLightbox_(e.detail, $selected_image)
|
||||
@@ -136,6 +146,7 @@
|
||||
value={url}
|
||||
show_label={widget.attrs.title != ""}
|
||||
label={widget.attrs.title}
|
||||
on:select={onClickedSingle}
|
||||
bind:imageWidth={$imageWidth}
|
||||
bind:imageHeight={$imageHeight}
|
||||
/>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { type WidgetLayout } from "$lib/stores/layoutStates";
|
||||
import { Range } from "$lib/components/gradio/form";
|
||||
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 { isDisabled } from "./utils"
|
||||
export let widget: WidgetLayout | null = null;
|
||||
@@ -96,7 +96,7 @@
|
||||
lastDisplayValue = option;
|
||||
canVibrate = false;
|
||||
setTimeout(() => { canVibrate = true }, 30)
|
||||
navigator.vibrate(10)
|
||||
vibrateIfPossible(10)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import { get, type Writable, writable } from "svelte/store";
|
||||
import { isDisabled } from "./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";
|
||||
|
||||
export let widget: WidgetLayout | null = null;
|
||||
@@ -34,7 +34,7 @@
|
||||
function onSelect(e: CustomEvent<SelectData>) {
|
||||
node.setValue(e.detail.value)
|
||||
node.index = e.detail.index as number
|
||||
navigator.vibrate(20)
|
||||
vibrateIfPossible(20)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -14,7 +14,8 @@ import {
|
||||
indentOnInput,
|
||||
syntaxHighlighting,
|
||||
defaultHighlightStyle,
|
||||
foldKeymap
|
||||
foldKeymap,
|
||||
LRLanguage, LanguageSupport, indentNodeProp, foldNodeProp, foldInside, delimitedIndent
|
||||
} from "@codemirror/language";
|
||||
import { history, defaultKeymap, historyKeymap } from "@codemirror/commands";
|
||||
import {
|
||||
@@ -27,8 +28,26 @@ import {
|
||||
type CompletionSource, autocompletion, CompletionContext, startCompletion,
|
||||
currentCompletions, completionStatus, completeFromList, acceptCompletion
|
||||
} from "@codemirror/autocomplete"
|
||||
import { styleTags, tags as t } from "@lezer/highlight"
|
||||
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__*/ (() => [
|
||||
lineNumbers(),
|
||||
highlightSpecialChars(),
|
||||
@@ -43,6 +62,7 @@ export const basicSetup: Extension = /*@__PURE__*/ (() => [
|
||||
crosshairCursor(),
|
||||
EditorView.lineWrapping,
|
||||
DanbooruTags.getCompletionExt(),
|
||||
new LanguageSupport(comfyUILanguage),
|
||||
|
||||
keymap.of([
|
||||
...closeBracketsKeymap,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script lang="ts">
|
||||
import ComfyApp, { type SerializedAppState } from "$lib/components/ComfyApp";
|
||||
import workflowState, { ComfyBoxWorkflow } from "$lib/stores/workflowState";
|
||||
import { vibrateIfPossible } from "$lib/utils";
|
||||
|
||||
import { Link, Toolbar } from "framework7-svelte"
|
||||
|
||||
@@ -11,7 +12,7 @@
|
||||
$: workflow = $workflowState.activeWorkflow;
|
||||
|
||||
function queuePrompt() {
|
||||
navigator.vibrate(20)
|
||||
vibrateIfPossible(20)
|
||||
app.runDefaultQueueAction()
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import ComfyApp, { type SerializedAppState } from "$lib/components/ComfyApp";
|
||||
import queueState from "$lib/stores/queueState";
|
||||
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 { Link, Toolbar } from "framework7-svelte"
|
||||
@@ -21,12 +21,12 @@
|
||||
$: workflow = $workflowState.activeWorkflow;
|
||||
|
||||
function queuePrompt() {
|
||||
navigator.vibrate(20)
|
||||
vibrateIfPossible(20)
|
||||
app.runDefaultQueueAction()
|
||||
}
|
||||
|
||||
async function refreshCombos() {
|
||||
navigator.vibrate(20)
|
||||
vibrateIfPossible(20)
|
||||
await app.refreshComboInNodes()
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
if (!fileInput)
|
||||
return;
|
||||
|
||||
navigator.vibrate(20)
|
||||
vibrateIfPossible(20)
|
||||
app.querySave()
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
if (!fileInput)
|
||||
return;
|
||||
|
||||
navigator.vibrate(20)
|
||||
vibrateIfPossible(20)
|
||||
fileInput.value = null;
|
||||
fileInput.click();
|
||||
}
|
||||
@@ -52,7 +52,7 @@
|
||||
}
|
||||
|
||||
function doSaveLocal(): void {
|
||||
navigator.vibrate(20)
|
||||
vibrateIfPossible(20)
|
||||
app.saveStateToLocalStorage();
|
||||
}
|
||||
|
||||
|
||||
@@ -34,12 +34,12 @@
|
||||
}
|
||||
|
||||
async function refreshCombos() {
|
||||
navigator.vibrate(20)
|
||||
vibrateIfPossible(20)
|
||||
await app.refreshComboInNodes()
|
||||
}
|
||||
|
||||
function doSaveLocal(): void {
|
||||
navigator.vibrate(20)
|
||||
vibrateIfPossible(20)
|
||||
app.saveStateToLocalStorage();
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import workflowState, { ComfyBoxWorkflow, type WorkflowInstID } from "$lib/stores/workflowState";
|
||||
import { onMount } from "svelte";
|
||||
import interfaceState from "$lib/stores/interfaceState";
|
||||
import { vibrateIfPossible } from "$lib/utils";
|
||||
import { f7 } from 'framework7-svelte';
|
||||
import { XCircle } from 'svelte-bootstrap-icons';
|
||||
|
||||
@@ -31,7 +32,7 @@
|
||||
if (!fileInput)
|
||||
return;
|
||||
|
||||
navigator.vibrate(20)
|
||||
vibrateIfPossible(20);
|
||||
fileInput.value = null;
|
||||
fileInput.click();
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import removeConsole from 'vite-plugin-svelte-console-remover';
|
||||
import glsl from 'vite-plugin-glsl';
|
||||
import { execSync } from "child_process"
|
||||
import { visualizer } from "rollup-plugin-visualizer";
|
||||
import { lezer } from "@lezer/generator/rollup"
|
||||
|
||||
const isProduction = process.env.NODE_ENV === "production";
|
||||
console.log("Production build: " + isProduction)
|
||||
@@ -31,6 +32,7 @@ export default defineConfig({
|
||||
isProduction && removeConsole(),
|
||||
glsl(),
|
||||
svelte(),
|
||||
lezer(),
|
||||
visualizer(),
|
||||
viteStaticCopy({
|
||||
targets: [
|
||||
|
||||
Reference in New Issue
Block a user