Adapted theme from stable-diffusion-webui-ux
This commit is contained in:
@@ -42,7 +42,7 @@
|
||||
|
||||
{#if container && children}
|
||||
{#key $attrsChanged}
|
||||
<div class="container {container.attrs.direction} {container.attrs.classes} {classes.join(' ')}"
|
||||
<div class="container {container.attrs.direction} {container.attrs.classes} {classes.join(' ')} z-index{zIndex}"
|
||||
class:hide-block={container.attrs.blockVariant === "hidden"}
|
||||
class:selected={$uiState.uiEditMode !== "disabled" && $layoutState.currentSelection.includes(container.id)}
|
||||
class:root-container={zIndex === 0}
|
||||
@@ -69,7 +69,7 @@
|
||||
on:finalize="{handleFinalize}"
|
||||
>
|
||||
{#each children.filter(item => item.id !== SHADOW_PLACEHOLDER_ITEM_ID) as item(item.id)}
|
||||
{@const hidden = item?.node?.properties?.hidden}
|
||||
{@const hidden = item?.attrs?.hidden}
|
||||
<div class="animation-wrapper"
|
||||
class:hidden={hidden}
|
||||
animate:flip={{duration:flipDurationMs}}>
|
||||
@@ -140,6 +140,18 @@
|
||||
.container {
|
||||
display: flex;
|
||||
|
||||
> :global(*) {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
> :global(.padded) {
|
||||
padding: 10px 12px 0px 10px;
|
||||
|
||||
&:last-child {
|
||||
padding-bottom: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
:global(.block) {
|
||||
height: fit-content;
|
||||
}
|
||||
@@ -214,7 +226,7 @@
|
||||
|
||||
.animation-wrapper {
|
||||
position: relative;
|
||||
flex-grow: 1;
|
||||
flex-grow: 100;
|
||||
}
|
||||
|
||||
.handle-widget:hover {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import { get } from "svelte/store";
|
||||
import { Pane, Splitpanes } from 'svelte-splitpanes';
|
||||
import { Button } from "@gradio/button";
|
||||
import { BlockTitle } from "@gradio/atoms";
|
||||
import ComfyUIPane from "./ComfyUIPane.svelte";
|
||||
import ComfyApp, { type SerializedAppState } from "./ComfyApp";
|
||||
import { Checkbox } from "@gradio/form"
|
||||
@@ -222,7 +223,9 @@
|
||||
<Checkbox label="Lock Nodes" bind:value={$uiState.nodesLocked}/>
|
||||
<Checkbox label="Disable Interaction" bind:value={$uiState.graphLocked}/>
|
||||
<Checkbox label="Auto-Add UI" bind:value={$uiState.autoAddUI}/>
|
||||
<label for="enable-ui-editing">Enable UI Editing</label>
|
||||
<label class="label" for="enable-ui-editing">
|
||||
<BlockTitle>Enable UI Editing</BlockTitle>
|
||||
</label>
|
||||
<select id="enable-ui-editing" name="enable-ui-editing" bind:value={$uiState.uiEditMode}>
|
||||
<option value="disabled">Disabled</option>
|
||||
<option value="widgets">Widgets</option>
|
||||
@@ -326,4 +329,8 @@
|
||||
display: flex;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
label.label > :global(span) {
|
||||
top: 20%;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -90,6 +90,7 @@
|
||||
<TextBox
|
||||
value={target.attrs[spec.name]}
|
||||
on:change={(e) => updateAttribute(spec, e.detail)}
|
||||
on:input={(e) => updateAttribute(spec, e.detail)}
|
||||
label={spec.name}
|
||||
max_lines={1}
|
||||
/>
|
||||
@@ -107,6 +108,7 @@
|
||||
value={target.attrs[spec.name]}
|
||||
step={1}
|
||||
on:change={(e) => updateAttribute(spec, e.currentTarget.valueAsNumber)}
|
||||
on:input={(e) => updateAttribute(spec, e.currentTarget.valueAsNumber)}
|
||||
/>
|
||||
</label>
|
||||
{:else if spec.type === "enum"}
|
||||
@@ -133,6 +135,7 @@
|
||||
<TextBox
|
||||
value={node.properties[spec.name]}
|
||||
on:change={(e) => updateProperty(spec, e.detail)}
|
||||
on:input={(e) => updateAttribute(spec, e.detail)}
|
||||
label={spec.name}
|
||||
max_lines={1}
|
||||
/>
|
||||
@@ -151,6 +154,7 @@
|
||||
value={node.properties[spec.name]}
|
||||
step={1}
|
||||
on:change={(e) => updateProperty(spec, e.currentTarget.valueAsNumber)}
|
||||
on:input={(e) => updateProperty(spec, e.currentTarget.valueAsNumber)}
|
||||
/>
|
||||
</div>
|
||||
</label>
|
||||
|
||||
@@ -68,11 +68,11 @@
|
||||
class:edit={edit}
|
||||
class:selected={$uiState.uiEditMode !== "disabled" && $layoutState.currentSelection.includes(widget.id)}
|
||||
class:is-executing={$queueState.runningNodeId && $queueState.runningNodeId == widget.node.id}
|
||||
class:hidden={widget.node.properties.hidden}
|
||||
class:hidden={widget.attrs.hidden}
|
||||
>
|
||||
<svelte:component this={widget.node.svelteComponentType} {widget} />
|
||||
</div>
|
||||
{#if widget.node.properties.hidden && edit}
|
||||
{#if widget.attrs.hidden && edit}
|
||||
<div class="handle handle-hidden" class:hidden={!edit} style="z-index: {zIndex+100}"/>
|
||||
{/if}
|
||||
{#if showHandles}
|
||||
|
||||
@@ -3,12 +3,12 @@ import ComfyGraphNode from "./ComfyGraphNode";
|
||||
import { Watch } from "@litegraph-ts/nodes-basic";
|
||||
import type { SerializedPrompt } from "$lib/components/ComfyApp";
|
||||
|
||||
export interface ComfyAfterQueuedAction extends Record<any, any> {
|
||||
export interface ComfyAfterQueuedEventProperties extends Record<any, any> {
|
||||
prompt: SerializedPrompt
|
||||
}
|
||||
|
||||
export class ComfyAfterQueuedAction extends ComfyGraphNode {
|
||||
override properties: ComfyCopyActionProperties = {
|
||||
export class ComfyAfterQueuedEvent extends ComfyGraphNode {
|
||||
override properties: ComfyAfterQueuedEventProperties = {
|
||||
prompt: null
|
||||
}
|
||||
|
||||
@@ -41,8 +41,8 @@ export class ComfyAfterQueuedAction extends ComfyGraphNode {
|
||||
}
|
||||
|
||||
LiteGraph.registerNodeType({
|
||||
class: ComfyAfterQueuedAction,
|
||||
title: "Comfy.AfterQueuedAction",
|
||||
class: ComfyAfterQueuedEvent,
|
||||
title: "Comfy.AfterQueuedEvent",
|
||||
desc: "Triggers a 'bang' event when a prompt is queued.",
|
||||
type: "actions/after_queued"
|
||||
})
|
||||
|
||||
@@ -15,7 +15,6 @@ import type { FileData as GradioFileData } from "@gradio/upload";
|
||||
import queueState from "$lib/stores/queueState";
|
||||
|
||||
export interface ComfyWidgetProperties extends Record<string, any> {
|
||||
hidden?: boolean,
|
||||
defaultValue: any
|
||||
}
|
||||
|
||||
@@ -60,7 +59,6 @@ export abstract class ComfyWidgetNode<T = any> extends ComfyGraphNode {
|
||||
constructor(name: string, value: T) {
|
||||
const color = LGraphCanvas.node_colors["blue"]
|
||||
super(name)
|
||||
this.setProperty("hidden", false)
|
||||
this.value = writable(value)
|
||||
this.color ||= color.color
|
||||
this.bgColor ||= color.bgColor
|
||||
@@ -215,7 +213,6 @@ export abstract class ComfyWidgetNode<T = any> extends ComfyGraphNode {
|
||||
override onConfigure(o: SerializedLGraphNode) {
|
||||
this.value.set((o as any).comfyValue);
|
||||
this.shownOutputProperties = (o as any).shownOutputProperties;
|
||||
this.setProperty("hidden", false)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ export type AttributesSpec = {
|
||||
editable: boolean,
|
||||
|
||||
values?: string[],
|
||||
hidden?: boolean
|
||||
}
|
||||
|
||||
export type AttributesCategorySpec = {
|
||||
@@ -47,6 +48,12 @@ const ALL_ATTRIBUTES: AttributesSpecList = [
|
||||
location: "widget",
|
||||
editable: true,
|
||||
},
|
||||
{
|
||||
name: "hidden",
|
||||
type: "boolean",
|
||||
location: "widget",
|
||||
editable: true
|
||||
},
|
||||
{
|
||||
name: "direction",
|
||||
type: "enum",
|
||||
@@ -72,12 +79,6 @@ const ALL_ATTRIBUTES: AttributesSpecList = [
|
||||
{
|
||||
categoryName: "behavior",
|
||||
specs: [
|
||||
{
|
||||
name: "hidden",
|
||||
type: "boolean",
|
||||
location: "nodeProps",
|
||||
editable: true
|
||||
},
|
||||
{
|
||||
name: "min",
|
||||
type: "number",
|
||||
@@ -106,7 +107,8 @@ export type Attributes = {
|
||||
title: string,
|
||||
showTitle: boolean,
|
||||
classes: string,
|
||||
blockVariant?: "block" | "hidden"
|
||||
blockVariant?: "block" | "hidden",
|
||||
hidden?: boolean
|
||||
}
|
||||
|
||||
export interface IDragItem {
|
||||
@@ -353,7 +355,9 @@ function groupItems(dragItems: IDragItem[], attrs: Partial<Attributes> = {}): Co
|
||||
index = indexFound
|
||||
}
|
||||
|
||||
const container = addContainer(parent as ContainerLayout, attrs, index)
|
||||
const title = dragItems.length <= 1 ? "" : "Group";
|
||||
|
||||
const container = addContainer(parent as ContainerLayout, { title, ...attrs }, index)
|
||||
|
||||
for (const item of dragItems) {
|
||||
moveItem(item, container)
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="wrapper gr-button">
|
||||
<div class="wrapper gradio-button">
|
||||
{#if node !== null}
|
||||
<Button on:click={onClick} variant="primary" {style}>
|
||||
{widget.attrs.title}
|
||||
@@ -36,7 +36,7 @@
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
<style lang="scss">
|
||||
.wrapper {
|
||||
padding: 2px;
|
||||
width: 100%;
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="wrapper gr-combo" class:updated={werePropsChanged}>
|
||||
<div class="wrapper comfy-combo" class:updated={werePropsChanged}>
|
||||
{#key $propsChanged}
|
||||
{#if node !== null && nodeValue !== null}
|
||||
<label>
|
||||
@@ -75,6 +75,7 @@
|
||||
items={node.properties.values}
|
||||
disabled={node.properties.values.length === 0}
|
||||
clearable={false}
|
||||
showChevron={true}
|
||||
on:change
|
||||
on:select
|
||||
on:filter
|
||||
|
||||
@@ -44,14 +44,14 @@
|
||||
}
|
||||
|
||||
</script>
|
||||
<div class="wrapper comfy-gallery-widget gr-gallery" bind:this={element}>
|
||||
<div class="wrapper comfy-gallery-widget gradio-gallery" bind:this={element}>
|
||||
{#if widget && node && nodeValue}
|
||||
<Block variant="solid" padding={false}>
|
||||
<div class="padding">
|
||||
<Gallery
|
||||
bind:value={$nodeValue}
|
||||
label={widget.attrs.title}
|
||||
show_label={true}
|
||||
show_label={widget.attrs.title !== ""}
|
||||
{style}
|
||||
root={""}
|
||||
root_url={""}
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="wrapper gr-range">
|
||||
<div class="wrapper gradio-slider">
|
||||
{#if node !== null && option !== null}
|
||||
<Range
|
||||
bind:value={option}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="wrapper gr-textbox">
|
||||
<div class="wrapper gradio-textbox">
|
||||
{#if node !== null && nodeValue !== null}
|
||||
<TextBox
|
||||
bind:value={$nodeValue}
|
||||
|
||||
Reference in New Issue
Block a user