updateVar(spec, e.detail)}
+ />
{/if}
{/if}
@@ -233,32 +253,32 @@
{#if spec.type === "string"}
updateWorkflowAttribute(spec, e.detail)}
on:input={(e) => updateWorkflowAttribute(spec, e.detail)}
label={spec.name}
max_lines={1}
/>
{:else if spec.type === "boolean"}
- updateWorkflowAttribute(spec, e.detail)}
- label={spec.name}
- />
+ updateWorkflowAttribute(spec, e.detail)}
+ label={spec.name}
+ />
{:else if spec.type === "number"}
- updateWorkflowAttribute(spec, e.detail)}
- />
+ updateWorkflowAttribute(spec, e.detail)}
+ />
{:else if spec.type === "enum"}
- updateWorkflowAttribute(spec, e.detail)}
- />
+ updateWorkflowAttribute(spec, e.detail)}
+ />
{/if}
{/if}
diff --git a/src/lib/components/ComfyUIPane.svelte b/src/lib/components/ComfyUIPane.svelte
index b9a95b1..a6b7415 100644
--- a/src/lib/components/ComfyUIPane.svelte
+++ b/src/lib/components/ComfyUIPane.svelte
@@ -69,7 +69,7 @@
}
async function onRightClick(e) {
- if ($uiState.uiEditMode === "disabled")
+ if (!$uiState.uiUnlocked)
return;
e.preventDefault();
diff --git a/src/lib/components/ComfyUnlockUIButton.svelte b/src/lib/components/ComfyUnlockUIButton.svelte
new file mode 100644
index 0000000..b1a1f83
--- /dev/null
+++ b/src/lib/components/ComfyUnlockUIButton.svelte
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
diff --git a/src/lib/components/WidgetContainer.svelte b/src/lib/components/WidgetContainer.svelte
index 261e414..8b3478e 100644
--- a/src/lib/components/WidgetContainer.svelte
+++ b/src/lib/components/WidgetContainer.svelte
@@ -40,7 +40,8 @@
propsChanged = null;
}
- $: showHandles = $uiState.uiEditMode === "widgets" // TODO
+ $: showHandles = $uiState.uiUnlocked
+ && $uiState.uiEditMode === "widgets" // TODO
&& zIndex > 1
&& !$layoutState.isMenuOpen
@@ -61,12 +62,12 @@
{/key}
{:else if widget && widget.node}
- {@const edit = $uiState.uiEditMode === "widgets" && zIndex > 1}
+ {@const edit = $uiState.uiUnlocked && $uiState.uiEditMode === "widgets" && zIndex > 1}
{#key $attrsChanged}
{#key $propsChanged}
diff --git a/src/lib/stores/layoutState.ts b/src/lib/stores/layoutState.ts
index b6a9433..58660f1 100644
--- a/src/lib/stores/layoutState.ts
+++ b/src/lib/stores/layoutState.ts
@@ -39,15 +39,18 @@ export type Attributes = {
}
export type AttributesSpec = {
+ id?: number, // for svelte keyed each
name: string,
type: string,
location: "widget" | "nodeProps" | "nodeVars" | "workflow"
editable: boolean,
+ defaultValue?: any,
values?: string[],
hidden?: boolean,
validNodeTypes?: string[],
+ canShow?: (arg: IDragItem | LGraphNode) => boolean,
serialize?: (arg: any) => string,
deserialize?: (arg: string) => any,
}
@@ -86,18 +89,22 @@ const ALL_ATTRIBUTES: AttributesSpecList = [
type: "enum",
location: "widget",
editable: true,
- values: ["horizontal", "vertical"]
+ values: ["horizontal", "vertical"],
+ defaultValue: "vertical",
+ canShow: (di: IDragItem) => di.type === "container"
},
{
name: "flexGrow",
type: "number",
location: "widget",
+ defaultValue: 100,
editable: true
},
{
name: "classes",
type: "string",
location: "widget",
+ defaultValue: "",
editable: true,
},
{
@@ -105,7 +112,20 @@ const ALL_ATTRIBUTES: AttributesSpecList = [
type: "enum",
location: "widget",
editable: true,
- values: ["block", "hidden"]
+ values: ["block", "hidden"],
+ defaultValue: "block",
+ canShow: (di: IDragItem) => di.type === "container"
+ },
+
+ // Container variants
+ {
+ name: "variant",
+ type: "enum",
+ location: "widget",
+ editable: true,
+ values: ["block", "accordion", "tabs"],
+ defaultValue: "block",
+ canShow: (di: IDragItem) => di.type === "container"
},
]
},
@@ -156,6 +176,7 @@ const ALL_ATTRIBUTES: AttributesSpecList = [
location: "nodeProps",
editable: true,
validNodeTypes: ["ui/button"],
+ defaultValue: "bang"
},
// Workflow
@@ -163,11 +184,21 @@ const ALL_ATTRIBUTES: AttributesSpecList = [
name: "defaultSubgraph",
type: "string",
location: "workflow",
- editable: true
+ editable: true,
+ defaultValue: ""
}
]
}
];
+
+let i = 0;
+for (const cat of Object.values(ALL_ATTRIBUTES)) {
+ for (const val of Object.values(cat.specs)) {
+ val.id = i;
+ i += 1;
+ }
+}
+
export { ALL_ATTRIBUTES };
export interface IDragItem {
diff --git a/src/lib/stores/uiState.ts b/src/lib/stores/uiState.ts
index ba9396c..a7c3cc6 100644
--- a/src/lib/stores/uiState.ts
+++ b/src/lib/stores/uiState.ts
@@ -2,13 +2,14 @@ import { writable } from 'svelte/store';
import type { Readable, Writable } from 'svelte/store';
import type ComfyApp from "$lib/components/ComfyApp"
-export type UIEditMode = "disabled" | "widgets" | "containers" | "layout";
+export type UIEditMode = "widgets" | "containers" | "layout";
export type UIState = {
app: ComfyApp,
nodesLocked: boolean,
graphLocked: boolean,
autoAddUI: boolean,
+ uiUnlocked: boolean,
uiEditMode: UIEditMode,
}
@@ -19,7 +20,8 @@ const store: WritableUIStateStore = writable(
graphLocked: false,
nodesLocked: false,
autoAddUI: true,
- uiEditMode: "disabled",
+ uiUnlocked: false,
+ uiEditMode: "widgets"
})
const uiStateStore: WritableUIStateStore =