Queue beginnings
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
import { BuiltInSlotShape, LGraph, LGraphCanvas, LGraphNode, LiteGraph, NodeMode, type MouseEventExt, type Vector2, type Vector4 } from "@litegraph-ts/core";
|
import { BuiltInSlotShape, LGraph, LGraphCanvas, LGraphNode, LiteGraph, NodeMode, type MouseEventExt, type Vector2, type Vector4 } from "@litegraph-ts/core";
|
||||||
import type ComfyApp from "./components/ComfyApp";
|
import type ComfyApp from "./components/ComfyApp";
|
||||||
|
import queueState from "./stores/queueState";
|
||||||
|
import { get } from "svelte/store";
|
||||||
|
|
||||||
export default class ComfyGraphCanvas extends LGraphCanvas {
|
export default class ComfyGraphCanvas extends LGraphCanvas {
|
||||||
app: ComfyApp
|
app: ComfyApp
|
||||||
@@ -30,8 +32,10 @@ export default class ComfyGraphCanvas extends LGraphCanvas {
|
|||||||
): void {
|
): void {
|
||||||
super.drawNodeShape(node, ctx, size, fgColor, bgColor, selected, mouseOver);
|
super.drawNodeShape(node, ctx, size, fgColor, bgColor, selected, mouseOver);
|
||||||
|
|
||||||
|
let state = get(queueState);
|
||||||
|
|
||||||
let color = null;
|
let color = null;
|
||||||
if (node.id === +this.app.runningNodeId) {
|
if (node.id === +state.runningNodeId) {
|
||||||
color = "#0f0";
|
color = "#0f0";
|
||||||
} else if (this.app.dragOverNode && node.id === this.app.dragOverNode.id) {
|
} else if (this.app.dragOverNode && node.id === this.app.dragOverNode.id) {
|
||||||
color = "dodgerblue";
|
color = "dodgerblue";
|
||||||
@@ -68,9 +72,9 @@ export default class ComfyGraphCanvas extends LGraphCanvas {
|
|||||||
ctx.strokeStyle = fgColor;
|
ctx.strokeStyle = fgColor;
|
||||||
ctx.globalAlpha = 1;
|
ctx.globalAlpha = 1;
|
||||||
|
|
||||||
if (this.app.progress) {
|
if (state.progress) {
|
||||||
ctx.fillStyle = "green";
|
ctx.fillStyle = "green";
|
||||||
ctx.fillRect(0, 0, size[0] * (this.app.progress.value / this.app.progress.max), 6);
|
ctx.fillRect(0, 0, size[0] * (state.progress.value / state.progress.max), 6);
|
||||||
ctx.fillStyle = bgColor;
|
ctx.fillStyle = bgColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,12 @@ type PromptRequestBody = {
|
|||||||
|
|
||||||
export type QueueItemType = "queue" | "history";
|
export type QueueItemType = "queue" | "history";
|
||||||
|
|
||||||
|
export type ComfyAPIQueueStatus = {
|
||||||
|
exec_info: {
|
||||||
|
queue_remaining: number | "X";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default class ComfyAPI extends EventTarget {
|
export default class ComfyAPI extends EventTarget {
|
||||||
private registered: Set<string> = new Set<string>();
|
private registered: Set<string> = new Set<string>();
|
||||||
|
|
||||||
|
|||||||
@@ -13,10 +13,14 @@
|
|||||||
import { LGraph, LGraphNode } from "@litegraph-ts/core";
|
import { LGraph, LGraphNode } from "@litegraph-ts/core";
|
||||||
import LightboxModal from "./LightboxModal.svelte";
|
import LightboxModal from "./LightboxModal.svelte";
|
||||||
import { Block } from "@gradio/atoms";
|
import { Block } from "@gradio/atoms";
|
||||||
|
import ComfyQueue from "./ComfyQueue.svelte";
|
||||||
|
import type { ComfyAPIStatus } from "$lib/api";
|
||||||
|
import queueState from "$lib/stores/queueState";
|
||||||
|
|
||||||
let app: ComfyApp = undefined;
|
let app: ComfyApp = undefined;
|
||||||
let imageViewer: ImageViewer;
|
let imageViewer: ImageViewer;
|
||||||
let uiPane: ComfyUIPane = undefined;
|
let uiPane: ComfyUIPane = undefined;
|
||||||
|
let queue: ComfyQueue = undefined;
|
||||||
let mainElem: HTMLDivElement;
|
let mainElem: HTMLDivElement;
|
||||||
let containerElem: HTMLDivElement;
|
let containerElem: HTMLDivElement;
|
||||||
let nodesLocked: boolean = false;
|
let nodesLocked: boolean = false;
|
||||||
@@ -124,6 +128,10 @@
|
|||||||
app.eventBus.on("autosave", doAutosave);
|
app.eventBus.on("autosave", doAutosave);
|
||||||
app.eventBus.on("restored", doRestore);
|
app.eventBus.on("restored", doRestore);
|
||||||
|
|
||||||
|
app.api.addEventListener("status", (ev: CustomEvent) => {
|
||||||
|
queueState.statusUpdated(ev.detail as ComfyAPIStatus);
|
||||||
|
});
|
||||||
|
|
||||||
await app.setup();
|
await app.setup();
|
||||||
refreshView();
|
refreshView();
|
||||||
|
|
||||||
@@ -160,7 +168,7 @@
|
|||||||
</Pane>
|
</Pane>
|
||||||
<Pane bind:size={sidebarSize}>
|
<Pane bind:size={sidebarSize}>
|
||||||
<div class="sidebar-wrapper pane-wrapper">
|
<div class="sidebar-wrapper pane-wrapper">
|
||||||
Sidebar
|
<ComfyQueue bind:this={queue} />
|
||||||
</div>
|
</div>
|
||||||
</Pane>
|
</Pane>
|
||||||
</Splitpanes>
|
</Splitpanes>
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import type ComfyGraphNode from "$lib/ComfyGraphNode";
|
|||||||
import type { WidgetStateStore, WidgetUIState } from "$lib/stores/widgetState";
|
import type { WidgetStateStore, WidgetUIState } from "$lib/stores/widgetState";
|
||||||
import * as widgets from "$lib/widgets/index"
|
import * as widgets from "$lib/widgets/index"
|
||||||
import type ComfyWidget from "$lib/widgets/ComfyWidget";
|
import type ComfyWidget from "$lib/widgets/ComfyWidget";
|
||||||
|
import queueState from "$lib/stores/queueState";
|
||||||
|
|
||||||
LiteGraph.catch_exceptions = false;
|
LiteGraph.catch_exceptions = false;
|
||||||
|
|
||||||
@@ -70,9 +71,7 @@ export default class ComfyApp {
|
|||||||
nodeOutputs: Record<string, any> = {};
|
nodeOutputs: Record<string, any> = {};
|
||||||
eventBus: TypedEmitter<ComfyAppEvents> = new EventEmitter() as TypedEmitter<ComfyAppEvents>;
|
eventBus: TypedEmitter<ComfyAppEvents> = new EventEmitter() as TypedEmitter<ComfyAppEvents>;
|
||||||
|
|
||||||
runningNodeId: number | null = null;
|
|
||||||
dragOverNode: LGraphNode | null = null;
|
dragOverNode: LGraphNode | null = null;
|
||||||
progress: Progress | null = null;
|
|
||||||
shiftDown: boolean = false;
|
shiftDown: boolean = false;
|
||||||
selectedGroupMoving: boolean = false;
|
selectedGroupMoving: boolean = false;
|
||||||
|
|
||||||
@@ -366,7 +365,7 @@ export default class ComfyApp {
|
|||||||
* Handles updates from the API socket
|
* Handles updates from the API socket
|
||||||
*/
|
*/
|
||||||
private addApiUpdateHandlers() {
|
private addApiUpdateHandlers() {
|
||||||
this.api.addEventListener("status", ({ detail }: CustomEvent) => {
|
this.api.addEventListener("status", ({ detail: ComfyAPIStatus }: CustomEvent) => {
|
||||||
// this.ui.setStatus(detail);
|
// this.ui.setStatus(detail);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -379,13 +378,12 @@ export default class ComfyApp {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.api.addEventListener("progress", ({ detail }: CustomEvent) => {
|
this.api.addEventListener("progress", ({ detail }: CustomEvent) => {
|
||||||
this.progress = detail;
|
queueState.progressUpdated(detail);
|
||||||
this.lGraph.setDirtyCanvas(true, false);
|
this.lGraph.setDirtyCanvas(true, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.api.addEventListener("executing", ({ detail }: CustomEvent) => {
|
this.api.addEventListener("executing", ({ detail }: CustomEvent) => {
|
||||||
this.progress = null;
|
queueState.executingUpdated(detail);
|
||||||
this.runningNodeId = detail;
|
|
||||||
this.lGraph.setDirtyCanvas(true, false);
|
this.lGraph.setDirtyCanvas(true, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onDestroy } from "svelte";
|
import { onDestroy } from "svelte";
|
||||||
|
import { get } from "svelte/store"
|
||||||
import { Block, BlockTitle } from "@gradio/atoms";
|
import { Block, BlockTitle } from "@gradio/atoms";
|
||||||
import { Move } from 'radix-icons-svelte';
|
import { Move } from 'radix-icons-svelte';
|
||||||
import ComboWidget from "$lib/widgets/ComboWidget.svelte";
|
import ComboWidget from "$lib/widgets/ComboWidget.svelte";
|
||||||
import RangeWidget from "$lib/widgets/RangeWidget.svelte";
|
import RangeWidget from "$lib/widgets/RangeWidget.svelte";
|
||||||
import TextWidget from "$lib/widgets/TextWidget.svelte";
|
import TextWidget from "$lib/widgets/TextWidget.svelte";
|
||||||
import widgetState, { type WidgetUIState } from "$lib/stores/widgetState";
|
import widgetState, { type WidgetDrawState, type WidgetUIState } from "$lib/stores/widgetState";
|
||||||
|
import queueState from "$lib/stores/queueState";
|
||||||
|
|
||||||
import { dndzone, SHADOW_ITEM_MARKER_PROPERTY_NAME } from 'svelte-dnd-action';
|
import { dndzone, SHADOW_ITEM_MARKER_PROPERTY_NAME } from 'svelte-dnd-action';
|
||||||
|
|
||||||
@@ -14,8 +16,10 @@
|
|||||||
import {cubicIn} from 'svelte/easing';
|
import {cubicIn} from 'svelte/easing';
|
||||||
import { flip } from 'svelte/animate';
|
import { flip } from 'svelte/animate';
|
||||||
import ComfyApp from "./ComfyApp";
|
import ComfyApp from "./ComfyApp";
|
||||||
|
import type { LGraphNode } from "@litegraph-ts/core";
|
||||||
|
import type { DragItem } from "./ComfyUIPane";
|
||||||
|
|
||||||
export let dragItems = [];
|
export let dragItems: DragItem[] = [];
|
||||||
let dragDisabled = true;
|
let dragDisabled = true;
|
||||||
const flipDurationMs = 200;
|
const flipDurationMs = 200;
|
||||||
|
|
||||||
@@ -42,6 +46,13 @@
|
|||||||
|
|
||||||
onDestroy(unsubscribe);
|
onDestroy(unsubscribe);
|
||||||
|
|
||||||
|
$: if ($queueState.runningNodeId) {
|
||||||
|
for (let dragItem of dragItems) {
|
||||||
|
dragItem.isNodeExecuting = $queueState.runningNodeId === dragItem.node.id;
|
||||||
|
}
|
||||||
|
dragItems = dragItems;
|
||||||
|
}
|
||||||
|
|
||||||
function getComponentForWidgetState(item: WidgetUIState): any {
|
function getComponentForWidgetState(item: WidgetUIState): any {
|
||||||
let ctor: any = null;
|
let ctor: any = null;
|
||||||
|
|
||||||
@@ -76,12 +87,12 @@
|
|||||||
{#each dragItems as dragItem(dragItem.id)}
|
{#each dragItems as dragItem(dragItem.id)}
|
||||||
{@const node = dragItem.node}
|
{@const node = dragItem.node}
|
||||||
{@const id = node.id}
|
{@const id = node.id}
|
||||||
<div class="animation-wrapper" animate:flip={{duration:flipDurationMs}}>
|
<div class="animation-wrapper" class:is-executing={dragItem.isNodeExecuting} animate:flip={{duration:flipDurationMs}}>
|
||||||
<Block>
|
<Block>
|
||||||
<div class="handle" on:mousedown={startDrag} on:touchstart={startDrag} on:mouseup={stopDrag} on:touchend={stopDrag}>
|
<div class="handle" on:mousedown={startDrag} on:touchstart={startDrag} on:mouseup={stopDrag} on:touchend={stopDrag}>
|
||||||
<Move/>
|
<Move/>
|
||||||
</div>
|
</div>
|
||||||
<label for={id}>
|
<label for={String(id)}>
|
||||||
<BlockTitle>{node.title}</BlockTitle>
|
<BlockTitle>{node.title}</BlockTitle>
|
||||||
</label>
|
</label>
|
||||||
{#each $widgetState[id] as item}
|
{#each $widgetState[id] as item}
|
||||||
@@ -105,6 +116,10 @@
|
|||||||
width: 33%;
|
width: 33%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.is-executing :global(.block) {
|
||||||
|
border: 5px dashed var(--color-green-600) !important;
|
||||||
|
}
|
||||||
|
|
||||||
.handle {
|
.handle {
|
||||||
cursor: grab;
|
cursor: grab;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|||||||
83
src/lib/components/ComfyQueue.svelte
Normal file
83
src/lib/components/ComfyQueue.svelte
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import queueState from "$lib/stores/queueState";
|
||||||
|
import ProgressBar from "./ProgressBar.svelte";
|
||||||
|
|
||||||
|
function getNodeInfo(nodeId: number): string {
|
||||||
|
let app = (window as any).app;
|
||||||
|
if (!app)
|
||||||
|
return String(nodeId);
|
||||||
|
|
||||||
|
const title = app.lGraph.getNodeById(nodeId)?.title || String(nodeId);
|
||||||
|
return title + " (" + nodeId + ")"
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="queue">
|
||||||
|
<div class="bottom">
|
||||||
|
{#if $queueState.runningNodeId || $queueState.progress}
|
||||||
|
<div class="node-name">
|
||||||
|
<span>Node: {getNodeInfo($queueState.runningNodeId)}</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<ProgressBar value={$queueState.progress?.value} max={$queueState.progress?.max} />
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
{#if typeof $queueState.queueRemaining === "number" && $queueState.queueRemaining > 0}
|
||||||
|
<div class="queue-remaining in-progress">
|
||||||
|
<div>
|
||||||
|
Queued prompts: {$queueState.queueRemaining}.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
|
<div class="queue-remaining done">
|
||||||
|
<div>
|
||||||
|
Nothing queued.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.queue-remaining {
|
||||||
|
height: 5em;
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
border: 5px solid #CCC;
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.node-name {
|
||||||
|
border: 5px solid #CCC;
|
||||||
|
background-color: var(--color-red-300);
|
||||||
|
padding: 0.2em;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom {
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
padding: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.in-progress {
|
||||||
|
background-color: var(--secondary-300);
|
||||||
|
}
|
||||||
|
.done {
|
||||||
|
background-color: var(--color-grey-200);
|
||||||
|
}
|
||||||
|
|
||||||
|
.queue-item {
|
||||||
|
height: 1.5em;
|
||||||
|
width: 10em;
|
||||||
|
text-align: center;
|
||||||
|
border: 1px solid black;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -6,11 +6,7 @@
|
|||||||
import type { SerializedPanes } from "./ComfyApp"
|
import type { SerializedPanes } from "./ComfyApp"
|
||||||
import ComfyPane from "./ComfyPane.svelte";
|
import ComfyPane from "./ComfyPane.svelte";
|
||||||
import widgetState, { type WidgetUIState } from "$lib/stores/widgetState";
|
import widgetState, { type WidgetUIState } from "$lib/stores/widgetState";
|
||||||
|
import type { DragItem } from "./ComfyUIPane";
|
||||||
type DragItem = {
|
|
||||||
id: number,
|
|
||||||
node: LGraphNode
|
|
||||||
}
|
|
||||||
|
|
||||||
export let app: ComfyApp;
|
export let app: ComfyApp;
|
||||||
let dragConfigured: boolean = false;
|
let dragConfigured: boolean = false;
|
||||||
@@ -84,7 +80,7 @@
|
|||||||
|
|
||||||
// Put everything left over into other columns
|
// Put everything left over into other columns
|
||||||
if (Object.keys(nodeIdToDragItem).length > 0) {
|
if (Object.keys(nodeIdToDragItem).length > 0) {
|
||||||
console.warn("Extra panels without ordering found", nodeIdToDragItem)
|
console.warn("Extra panels without ordering found", nodeIdToDragItem, panels)
|
||||||
for (const nodeId in nodeIdToDragItem) {
|
for (const nodeId in nodeIdToDragItem) {
|
||||||
const dragItem = nodeIdToDragItem[nodeId];
|
const dragItem = nodeIdToDragItem[nodeId];
|
||||||
const paneIndex = findLeastPopulatedPaneIndex();
|
const paneIndex = findLeastPopulatedPaneIndex();
|
||||||
|
|||||||
7
src/lib/components/ComfyUIPane.ts
Normal file
7
src/lib/components/ComfyUIPane.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import type { LGraphNode } from "@litegraph-ts/core"
|
||||||
|
|
||||||
|
export type DragItem = {
|
||||||
|
id: number,
|
||||||
|
node: LGraphNode,
|
||||||
|
isNodeExecuting?: boolean
|
||||||
|
}
|
||||||
46
src/lib/components/ProgressBar.svelte
Normal file
46
src/lib/components/ProgressBar.svelte
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
export let value: number | null = null;
|
||||||
|
export let max: number | null = null;
|
||||||
|
export let classes: string = "";
|
||||||
|
export let styles: string = "";
|
||||||
|
let percent: number = 0;
|
||||||
|
let text: string = ""
|
||||||
|
|
||||||
|
$: if (value && max) {
|
||||||
|
percent = (value / max) * 100;
|
||||||
|
text = percent.toFixed(1) + "%";
|
||||||
|
} else {
|
||||||
|
percent = 0
|
||||||
|
text = "??.?%"
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="progress {classes}" style={styles}>
|
||||||
|
<div class="bar" style="width: {percent}%;">
|
||||||
|
<span class="label">{text}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.progress {
|
||||||
|
text-align: center;
|
||||||
|
background-color: lightgrey;
|
||||||
|
padding: 3px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bar {
|
||||||
|
background-color: #B3D8A9;
|
||||||
|
height: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
font-size: .9em;
|
||||||
|
position: absolute;
|
||||||
|
margin: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
53
src/lib/stores/queueState.ts
Normal file
53
src/lib/stores/queueState.ts
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
import type { ComfyAPIQueueStatus } from "$lib/api";
|
||||||
|
import type { Progress } from "$lib/components/ComfyApp";
|
||||||
|
import { writable, type Writable } from "svelte/store";
|
||||||
|
|
||||||
|
export type QueueItem = {
|
||||||
|
name: string
|
||||||
|
}
|
||||||
|
|
||||||
|
type QueueStateOps = {
|
||||||
|
statusUpdated: (status: ComfyAPIQueueStatus) => void,
|
||||||
|
executingUpdated: (runningNodeId: string | null) => void,
|
||||||
|
progressUpdated: (progress: Progress | null) => void
|
||||||
|
}
|
||||||
|
|
||||||
|
export type QueueState = {
|
||||||
|
queueRemaining: number | "X" | null;
|
||||||
|
runningNodeId: number | null;
|
||||||
|
progress: Progress | null
|
||||||
|
}
|
||||||
|
type WritableQueueStateStore = Writable<QueueState> & QueueStateOps;
|
||||||
|
|
||||||
|
const store: Writable<QueueState> = writable({ queueRemaining: null, runningNodeId: null, progress: null })
|
||||||
|
|
||||||
|
function statusUpdated(status: ComfyAPIQueueStatus) {
|
||||||
|
store.update((s) => {
|
||||||
|
s.queueRemaining = status.exec_info.queue_remaining;
|
||||||
|
return s
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function executingUpdated(runningNodeId: string | null) {
|
||||||
|
store.update((s) => {
|
||||||
|
s.progress = null;
|
||||||
|
s.runningNodeId = parseInt(runningNodeId);
|
||||||
|
return s
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function progressUpdated(progress: Progress | null) {
|
||||||
|
store.update((s) => {
|
||||||
|
s.progress = progress;
|
||||||
|
return s
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const queueStateStore: WritableQueueStateStore =
|
||||||
|
{
|
||||||
|
...store,
|
||||||
|
statusUpdated,
|
||||||
|
executingUpdated,
|
||||||
|
progressUpdated
|
||||||
|
}
|
||||||
|
export default queueStateStore;
|
||||||
@@ -11,6 +11,10 @@ export type WidgetUIState = {
|
|||||||
isVirtual: boolean
|
isVirtual: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type WidgetDrawState = {
|
||||||
|
isNodeExecuting: boolean
|
||||||
|
}
|
||||||
|
|
||||||
type NodeID = number;
|
type NodeID = number;
|
||||||
|
|
||||||
type WidgetStateOps = {
|
type WidgetStateOps = {
|
||||||
@@ -24,7 +28,7 @@ type WidgetStateOps = {
|
|||||||
export type WidgetStateStore = Record<NodeID, WidgetUIState[]>;
|
export type WidgetStateStore = Record<NodeID, WidgetUIState[]>;
|
||||||
type WritableWidgetStateStore = Writable<WidgetStateStore> & WidgetStateOps;
|
type WritableWidgetStateStore = Writable<WidgetStateStore> & WidgetStateOps;
|
||||||
|
|
||||||
const store: Writable<Record<NodeID, WidgetUIState[]>> = writable({})
|
const store: Writable<WidgetStateStore> = writable({})
|
||||||
|
|
||||||
function clear() {
|
function clear() {
|
||||||
store.set({})
|
store.set({})
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { WidgetUIState } from "$lib/stores/widgetState";
|
import type { WidgetDrawState, WidgetUIState } from "$lib/stores/widgetState";
|
||||||
import { BlockTitle } from "@gradio/atoms";
|
import { BlockTitle } from "@gradio/atoms";
|
||||||
import { Dropdown } from "@gradio/form";
|
import { Dropdown } from "@gradio/form";
|
||||||
import Select from 'svelte-select';
|
import Select from 'svelte-select';
|
||||||
|
|||||||
Reference in New Issue
Block a user