Application sidebar
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { ListIcon as List, ImageIcon as Image, SettingsIcon as Settings } from "svelte-feather-icons";
|
||||
import { onMount } from "svelte";
|
||||
import { get, writable, type Writable } from "svelte/store";
|
||||
import { Pane, Splitpanes } from 'svelte-splitpanes';
|
||||
@@ -17,6 +18,8 @@
|
||||
import LightboxModal from "./LightboxModal.svelte";
|
||||
import ComfyQueue from "./ComfyQueue.svelte";
|
||||
import ComfyProperties from "./ComfyProperties.svelte";
|
||||
import Sidebar from "./Sidebar.svelte";
|
||||
import SidebarItem from "./SidebarItem.svelte";
|
||||
import queueState from "$lib/stores/queueState";
|
||||
import ComfyUnlockUIButton from "./ComfyUnlockUIButton.svelte";
|
||||
import ComfyGraphView from "./ComfyGraphView.svelte";
|
||||
@@ -26,6 +29,7 @@
|
||||
import ComfyBoxStdPrompt from "$lib/ComfyBoxStdPrompt";
|
||||
import A1111PromptDisplay from "./A1111PromptDisplay.svelte";
|
||||
import type { A1111ParsedInfotext } from "$lib/parseA1111";
|
||||
import { TabItem, Tabs } from "@gradio/tabs";
|
||||
|
||||
export let app: ComfyApp = undefined;
|
||||
let alreadySetup: Writable<boolean> = writable(false);
|
||||
@@ -200,6 +204,8 @@
|
||||
let showModal: boolean = false;
|
||||
|
||||
$: showModal = $a1111Prompt != null
|
||||
|
||||
let selectedTab
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
@@ -222,86 +228,114 @@
|
||||
|
||||
<div id="main" class:dark={uiTheme === "gradio-dark"}>
|
||||
<div id="container" bind:this={containerElem}>
|
||||
<Splitpanes theme="comfy" on:resize={refreshView}>
|
||||
<Pane bind:size={propsSidebarSize}>
|
||||
<div class="sidebar-wrapper pane-wrapper">
|
||||
<ComfyProperties bind:this={props} />
|
||||
<Sidebar selected="generate">
|
||||
<SidebarItem id="generate" name="Generate" icon={Image}>
|
||||
<div id="comfy-content">
|
||||
<Splitpanes theme="comfy" on:resize={refreshView}>
|
||||
<Pane bind:size={propsSidebarSize}>
|
||||
<div class="sidebar-wrapper pane-wrapper">
|
||||
<ComfyProperties bind:this={props} />
|
||||
</div>
|
||||
</Pane>
|
||||
<Pane>
|
||||
<Splitpanes theme="comfy" on:resize={refreshView} horizontal="{true}">
|
||||
<Pane>
|
||||
<ComfyUIPane {app} />
|
||||
</Pane>
|
||||
<Pane bind:size={graphSize}>
|
||||
<ComfyGraphView {app} transitioning={graphTransitioning} />
|
||||
</Pane>
|
||||
</Splitpanes>
|
||||
</Pane>
|
||||
<Pane bind:size={queueSidebarSize}>
|
||||
<div class="sidebar-wrapper pane-wrapper">
|
||||
<ComfyQueue {app} />
|
||||
</div>
|
||||
</Pane>
|
||||
</Splitpanes>
|
||||
<div id="workflow-tabs">
|
||||
<div class="workflow-tab selected">
|
||||
txt2img
|
||||
<!-- <Image /> -->
|
||||
</div>
|
||||
<div class="workflow-tab">
|
||||
img2img
|
||||
<!-- <Image /> -->
|
||||
</div>
|
||||
<div class="workflow-tab">
|
||||
asdflkj
|
||||
<!-- <Image /> -->
|
||||
</div>
|
||||
<div class="workflow-tab">
|
||||
asdkajw
|
||||
<!-- <Image /> -->
|
||||
</div>
|
||||
</div>
|
||||
<div id="bottombar">
|
||||
<div class="bottombar-content">
|
||||
<div class="left">
|
||||
{#if $layoutState.attrs.queuePromptButtonName != ""}
|
||||
<Button variant="primary" disabled={!$alreadySetup} on:click={queuePrompt}>
|
||||
{$layoutState.attrs.queuePromptButtonName}
|
||||
</Button>
|
||||
{/if}
|
||||
<Button variant="secondary" disabled={!$alreadySetup} on:click={toggleGraph}>
|
||||
Toggle Graph
|
||||
</Button>
|
||||
<Button variant="secondary" disabled={!$alreadySetup} on:click={toggleProps}>
|
||||
Toggle Props
|
||||
</Button>
|
||||
<Button variant="secondary" disabled={!$alreadySetup} on:click={toggleQueue}>
|
||||
Toggle Queue
|
||||
</Button>
|
||||
<Button variant="secondary" disabled={!$alreadySetup} on:click={doSave}>
|
||||
Save
|
||||
</Button>
|
||||
<Button variant="secondary" disabled={!$alreadySetup} on:click={doSaveLocal}>
|
||||
Save Local
|
||||
</Button>
|
||||
<Button variant="secondary" disabled={!$alreadySetup} on:click={doLoad}>
|
||||
Load
|
||||
</Button>
|
||||
<Button variant="secondary" disabled={!$alreadySetup} on:click={doClear}>
|
||||
Clear
|
||||
</Button>
|
||||
<Button variant="secondary" disabled={!$alreadySetup} on:click={doLoadDefault}>
|
||||
Load Default
|
||||
</Button>
|
||||
<Button variant="secondary" disabled={!$alreadySetup} on:click={doRefreshCombos}>
|
||||
🔄
|
||||
</Button>
|
||||
<!-- <Checkbox label="Lock Nodes" bind:value={$uiState.nodesLocked}/>
|
||||
<Checkbox label="Disable Interaction" bind:value={$uiState.graphLocked}/> -->
|
||||
<span style="display: inline-flex !important">
|
||||
<Checkbox label="Auto-Add UI" bind:value={$uiState.autoAddUI}/>
|
||||
</span>
|
||||
<span class="label" for="ui-edit-mode">
|
||||
<BlockTitle>UI Edit mode</BlockTitle>
|
||||
<select id="ui-edit-mode" name="ui-edit-mode" bind:value={$uiState.uiEditMode}>
|
||||
<option value="widgets">Widgets</option>
|
||||
</select>
|
||||
</span>
|
||||
<span class="label" for="ui-theme">
|
||||
<BlockTitle>Theme</BlockTitle>
|
||||
<select id="ui-theme" name="ui-theme" bind:value={uiTheme}>
|
||||
<option value="gradio-dark">Gradio Dark</option>
|
||||
<option value="gradio-light">Gradio Light</option>
|
||||
<option value="anapnoe">Anapnoe</option>
|
||||
</select>
|
||||
</span>
|
||||
</div>
|
||||
<div class="right">
|
||||
<ComfyUnlockUIButton bind:toggled={$uiState.uiUnlocked} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Pane>
|
||||
<Pane>
|
||||
<Splitpanes theme="comfy" on:resize={refreshView} horizontal="{true}">
|
||||
<Pane>
|
||||
<ComfyUIPane {app} />
|
||||
</Pane>
|
||||
<Pane bind:size={graphSize}>
|
||||
<ComfyGraphView {app} transitioning={graphTransitioning} />
|
||||
</Pane>
|
||||
</Splitpanes>
|
||||
</Pane>
|
||||
<Pane bind:size={queueSidebarSize}>
|
||||
<div class="sidebar-wrapper pane-wrapper">
|
||||
<ComfyQueue {app} />
|
||||
</div>
|
||||
</Pane>
|
||||
</Splitpanes>
|
||||
</div>
|
||||
<div id="bottombar">
|
||||
<div class="left">
|
||||
{#if $layoutState.attrs.queuePromptButtonName != ""}
|
||||
<Button variant="primary" disabled={!$alreadySetup} on:click={queuePrompt}>
|
||||
{$layoutState.attrs.queuePromptButtonName}
|
||||
</Button>
|
||||
{/if}
|
||||
<Button variant="secondary" disabled={!$alreadySetup} on:click={toggleGraph}>
|
||||
Toggle Graph
|
||||
</Button>
|
||||
<Button variant="secondary" disabled={!$alreadySetup} on:click={toggleProps}>
|
||||
Toggle Props
|
||||
</Button>
|
||||
<Button variant="secondary" disabled={!$alreadySetup} on:click={toggleQueue}>
|
||||
Toggle Queue
|
||||
</Button>
|
||||
<Button variant="secondary" disabled={!$alreadySetup} on:click={doSave}>
|
||||
Save
|
||||
</Button>
|
||||
<Button variant="secondary" disabled={!$alreadySetup} on:click={doSaveLocal}>
|
||||
Save Local
|
||||
</Button>
|
||||
<Button variant="secondary" disabled={!$alreadySetup} on:click={doLoad}>
|
||||
Load
|
||||
</Button>
|
||||
<Button variant="secondary" disabled={!$alreadySetup} on:click={doClear}>
|
||||
Clear
|
||||
</Button>
|
||||
<Button variant="secondary" disabled={!$alreadySetup} on:click={doLoadDefault}>
|
||||
Load Default
|
||||
</Button>
|
||||
<Button variant="secondary" disabled={!$alreadySetup} on:click={doRefreshCombos}>
|
||||
🔄
|
||||
</Button>
|
||||
<!-- <Checkbox label="Lock Nodes" bind:value={$uiState.nodesLocked}/>
|
||||
<Checkbox label="Disable Interaction" bind:value={$uiState.graphLocked}/> -->
|
||||
<span style="display: inline-flex !important">
|
||||
<Checkbox label="Auto-Add UI" bind:value={$uiState.autoAddUI}/>
|
||||
</span>
|
||||
<span class="label" for="ui-edit-mode">
|
||||
<BlockTitle>UI Edit mode</BlockTitle>
|
||||
<select id="ui-edit-mode" name="ui-edit-mode" bind:value={$uiState.uiEditMode}>
|
||||
<option value="widgets">Widgets</option>
|
||||
</select>
|
||||
</span>
|
||||
<span class="label" for="ui-theme">
|
||||
<BlockTitle>Theme</BlockTitle>
|
||||
<select id="ui-theme" name="ui-theme" bind:value={uiTheme}>
|
||||
<option value="gradio-dark">Gradio Dark</option>
|
||||
<option value="gradio-light">Gradio Light</option>
|
||||
<option value="anapnoe">Anapnoe</option>
|
||||
</select>
|
||||
</span>
|
||||
</div>
|
||||
<div class="right">
|
||||
<ComfyUnlockUIButton bind:toggled={$uiState.uiUnlocked} />
|
||||
</div>
|
||||
</SidebarItem>
|
||||
<SidebarItem id="settings" name="Settings" icon={Settings}>
|
||||
</SidebarItem>
|
||||
</Sidebar>
|
||||
</div>
|
||||
<LightboxModal />
|
||||
<input bind:this={fileInput} id="comfy-file-input" type="file" accept=".json" on:change={loadWorkflow} />
|
||||
@@ -309,37 +343,123 @@
|
||||
<SvelteToast options={toastOptions} />
|
||||
|
||||
<style lang="scss">
|
||||
$bottom-bar-height: 70px;
|
||||
$top-bar-height: 3.5rem;
|
||||
$workflow-tabs-height: 2.5rem;
|
||||
$bottom-bar-height: 5rem;
|
||||
|
||||
#container {
|
||||
height: calc(100vh - $bottom-bar-height);
|
||||
height: 100vh;
|
||||
max-width: 100vw;
|
||||
display: grid;
|
||||
display: relative;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#comfy-content {
|
||||
grid-area: content;
|
||||
height: 100vh;
|
||||
height: calc(100vh - $bottom-bar-height - $workflow-tabs-height);
|
||||
}
|
||||
|
||||
#bottombar {
|
||||
padding-top: 0.5em;
|
||||
#workflow-tabs {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
gap: var(--layout-gap);
|
||||
padding-left: 1em;
|
||||
padding-right: 1em;
|
||||
margin-top: auto;
|
||||
overflow-x: auto;
|
||||
}
|
||||
/*
|
||||
#topbar {
|
||||
background: var(--neutral-900);
|
||||
height: 100%;
|
||||
flex-direction: column;
|
||||
float: left;
|
||||
position: sticky;
|
||||
top: 0px;
|
||||
padding: 0;
|
||||
width: 4rem;
|
||||
|
||||
.topbar-button {
|
||||
background: var(--neutral-800);
|
||||
color: var(--neutral-500);
|
||||
padding: 0.5rem;
|
||||
border-right: 3px solid transparent;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
|
||||
&:last-child {
|
||||
border-right: 1px solid var(--neutral-600);
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: var(--neutral-700);
|
||||
color: var(--neutral-300);
|
||||
}
|
||||
|
||||
&.selected {
|
||||
background: var(--neutral-700);
|
||||
color: var(--neutral-300);
|
||||
border-right-color: var(--primary-500);
|
||||
}
|
||||
}
|
||||
} */
|
||||
|
||||
#workflow-tabs {
|
||||
background: var(--neutral-800);
|
||||
.workflow-tab {
|
||||
background: var(--neutral-800);
|
||||
color: var(--neutral-500);
|
||||
padding: 0.5rem 1rem;
|
||||
border-top: 3px solid transparent;
|
||||
border-left: 1px solid var(--neutral-600);
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
|
||||
&:last-child {
|
||||
border-right: 1px solid var(--neutral-600);
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: var(--neutral-700);
|
||||
color: var(--neutral-300);
|
||||
}
|
||||
|
||||
&.selected {
|
||||
background: var(--neutral-700);
|
||||
color: var(--neutral-300);
|
||||
border-top-color: var(--primary-500);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#bottombar {
|
||||
background: var(--neutral-900);
|
||||
border-left: 2px solid var(--neutral-700);
|
||||
display: flex;
|
||||
width: 100%;
|
||||
gap: var(--layout-gap);
|
||||
overflow-x: hidden;
|
||||
flex-wrap: nowrap;
|
||||
height: $bottom-bar-height;
|
||||
|
||||
> .left {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
> .bottombar-content {
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
width: 100%;
|
||||
overflow-x: auto;
|
||||
margin: auto 0;
|
||||
padding-left: 1rem;
|
||||
|
||||
> .right {
|
||||
margin-left: auto
|
||||
> .left {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
> .right {
|
||||
margin-left: auto;
|
||||
margin-right: 1rem;
|
||||
padding-left: 1rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user