Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
23fdbe4
add control_after_generate ui
christian-byrne Oct 4, 2025
f853cb9
don't use forEach
christian-byrne Oct 5, 2025
57025df
seed widget
christian-byrne Oct 8, 2025
cfaeed1
seed widget2
christian-byrne Oct 12, 2025
04bd165
handle legacy step value
christian-byrne Oct 21, 2025
6acc7b0
feat: update NumberControlPopover with semantic design tokens
christian-byrne Nov 13, 2025
29af785
fix test
christian-byrne Nov 14, 2025
c18df9c
Fix display of controled widget values
AustinMroz Nov 25, 2025
abe600b
Revert useGraphNodeManager changes
AustinMroz Nov 25, 2025
fcf9a32
Merge origin/main
AustinMroz Nov 25, 2025
895a458
Swap NumberInputs to rekka ui to embed control
AustinMroz Nov 27, 2025
613fe12
Persist control widget value
AustinMroz Nov 27, 2025
94ade0a
[automated] Update test expectations
invalid-email-address Nov 27, 2025
0fb7466
Test fixes and nits
AustinMroz Nov 27, 2025
95b95ed
Merge branch 'main' into austin/vue-control-after-generate
christian-byrne Nov 30, 2025
69715b2
[automated] Update test expectations
invalid-email-address Nov 30, 2025
7dd2f52
Add max and mins from litegraph implementation
AustinMroz Dec 1, 2025
307771b
Merge 8e006bb8a306^
AustinMroz Dec 3, 2025
bbcb3b4
Merge main
AustinMroz Dec 3, 2025
ec07416
[automated] Update test expectations
invalid-email-address Dec 3, 2025
b5419f7
Empty commit to force tests to rerun
AustinMroz Dec 3, 2025
6d2f976
Fix number precision
AustinMroz Dec 3, 2025
9348995
[automated] Update test expectations
invalid-email-address Dec 3, 2025
9723e2b
Merge main
AustinMroz Dec 3, 2025
bb5c884
[automated] Update test expectations
invalid-email-address Dec 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 31 additions & 2 deletions src/composables/graph/useGraphNodeManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ import type { NodeId } from '@/renderer/core/layout/types'
import type { InputSpec } from '@/schemas/nodeDef/nodeDefSchemaV2'
import { isDOMWidget } from '@/scripts/domWidget'
import { useNodeDefStore } from '@/stores/nodeDefStore'
import type { WidgetValue } from '@/types/simplifiedWidget'
import type {
WidgetValue,
SafeControlWidget,
ControlWidgetOptions
} from '@/types/simplifiedWidget'

import type {
LGraph,
Expand All @@ -47,6 +51,7 @@ export interface SafeWidgetData {
spec?: InputSpec
slotMetadata?: WidgetSlotMetadata
isDOMWidget?: boolean
controlWidget?: SafeControlWidget
}

export interface VueNodeData {
Expand Down Expand Up @@ -82,6 +87,29 @@ export interface GraphNodeManager {
cleanup(): void
}

function validateControlWidgetValue(val: unknown): ControlWidgetOptions {
//TODO: Is there a way to do this without repeating?
switch (val) {
case 'fixed':
return 'fixed'
case 'increment':
return 'increment'
case 'decrement':
return 'decrement'
}
return 'randomize'
}
function getControlWidget(widget: IBaseWidget): SafeControlWidget | undefined {
const cagWidget = widget.linkedWidgets?.find(
(w) => w.name == 'control_after_generate'
)
if (!cagWidget) return
return {
value: validateControlWidgetValue(cagWidget.value),
update: (value) => (cagWidget.value = validateControlWidgetValue(value))
}
}

export function safeWidgetMapper(
node: LGraphNode,
slotMetadata: Map<string, WidgetSlotMetadata>
Expand Down Expand Up @@ -114,7 +142,8 @@ export function safeWidgetMapper(
callback: widget.callback,
spec,
slotMetadata: slotInfo,
isDOMWidget: isDOMWidget(widget)
isDOMWidget: isDOMWidget(widget),
controlWidget: getControlWidget(widget)
}
} catch (error) {
return {
Expand Down
16 changes: 16 additions & 0 deletions src/locales/en/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -1910,6 +1910,22 @@
"placeholderVideo": "Select video...",
"placeholderModel": "Select model...",
"placeholderUnknown": "Select media..."
},
"numberControl": {
"controlHeaderBefore": "Automatically update the value",
"controlHeaderAfter": "AFTER",
"controlHeaderBefore2": "BEFORE",
"controlHeaderEnd": "running the workflow:",
"linkToGlobal": "Link to",
"linkToGlobalSeed": "Global Value",
"linkToGlobalDesc": "Unique value linked to the Global Value's control setting",
"randomize": "Randomize Value",
"randomizeDesc": "Shuffles the value randomly after each generation",
"increment": "Increment Value",
"incrementDesc": "Adds 1 to the value number",
"decrement": "Decrement Value",
"decrementDesc": "Subtracts 1 from the value number",
"editSettings": "Edit control settings"
}
},
"widgetFileUpload": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ const processedWidgets = computed((): ProcessedWidget[] => {
label: widget.label,
options: widgetOptions,
callback: widget.callback,
spec: widget.spec
spec: widget.spec,
controlWidget: widget.controlWidget
}

function updateHandler(value: WidgetValue) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
<script setup lang="ts">
import Button from 'primevue/button'
import Popover from 'primevue/popover'
import ToggleSwitch from 'primevue/toggleswitch'
import { computed, ref } from 'vue'

import { useSettingStore } from '@/platform/settings/settingStore'
import { useDialogService } from '@/services/dialogService'

import { NumberControlMode } from '../composables/useStepperControl'

type ControlOption = {
mode: NumberControlMode
icon?: string
title: string
description: string
text?: string
}

const popover = ref()
const settingStore = useSettingStore()
const dialogService = useDialogService()

const toggle = (event: Event) => {
popover.value.toggle(event)
}
defineExpose({ toggle })

const ENABLE_LINK_TO_GLOBAL = false

const controlOptions: ControlOption[] = [
...(ENABLE_LINK_TO_GLOBAL
? ([
{
mode: NumberControlMode.LINK_TO_GLOBAL,
icon: 'pi pi-link',
title: 'linkToGlobal',
description: 'linkToGlobalDesc'
} satisfies ControlOption
] as ControlOption[])
: []),
{
mode: NumberControlMode.RANDOMIZE,
icon: 'icon-[lucide--shuffle]',
title: 'randomize',
description: 'randomizeDesc'
},
{
mode: NumberControlMode.INCREMENT,
text: '+1',
title: 'increment',
description: 'incrementDesc'
},
{
mode: NumberControlMode.DECREMENT,
text: '-1',
title: 'decrement',
description: 'decrementDesc'
}
]

const widgetControlMode = computed(() =>
settingStore.get('Comfy.WidgetControlMode')
)

const props = defineProps<{
controlMode: NumberControlMode
}>()

const emit = defineEmits<{
'update:controlMode': [mode: NumberControlMode]
}>()

const handleToggle = (mode: NumberControlMode) => {
if (props.controlMode === mode) return
emit('update:controlMode', mode)
}

const isActive = (mode: NumberControlMode) => {
return props.controlMode === mode
}

const handleEditSettings = () => {
popover.value.hide()
dialogService.showSettingsDialog()
}
</script>

<template>
<Popover
ref="popover"
class="bg-interface-panel-surface border border-interface-stroke rounded-lg"
>
<!-- Responsive width with proper constraints -->
<div class="w-113 max-w-md p-4 space-y-4">
<!-- Header text with semantic tokens -->
<div class="text-sm text-muted-foreground leading-tight">
{{ $t('widgets.numberControl.controlHeaderBefore') }}
<span class="text-base-foreground font-medium">
{{
widgetControlMode === 'before'
? $t('widgets.numberControl.controlHeaderBefore2')
: $t('widgets.numberControl.controlHeaderAfter')
}}
</span>
{{ $t('widgets.numberControl.controlHeaderEnd') }}
</div>

<!-- Control options with proper spacing -->
<div class="space-y-2">
<div
v-for="option in controlOptions"
:key="option.mode"
class="flex items-center justify-between py-2 gap-7"
>
<div class="flex items-center gap-2 flex-1 min-w-0">
<!-- Icon container with semantic background -->
<div
class="flex items-center justify-center w-8 h-8 rounded-lg flex-shrink-0 bg-secondary-background border border-border-subtle"
>
<i
v-if="option.icon"
:class="option.icon"
class="text-base text-base-foreground"
/>
<span
v-if="option.text"
class="text-xs font-normal text-base-foreground"
>
{{ option.text }}
</span>
</div>

<!-- Text content with proper semantic colors -->
<div class="flex flex-col gap-0.5 min-w-0 flex-1">
<div
class="text-sm font-normal text-base-foreground leading-tight"
>
<span v-if="option.mode === NumberControlMode.LINK_TO_GLOBAL">
{{ $t('widgets.numberControl.linkToGlobal') }}
<em>{{ $t('widgets.numberControl.linkToGlobalSeed') }}</em>
</span>
<span v-else>
{{ $t(`widgets.numberControl.${option.title}`) }}
</span>
</div>
<div
class="text-sm font-normal text-muted-foreground leading-tight"
>
{{ $t(`widgets.numberControl.${option.description}`) }}
</div>
</div>
</div>

<!-- Toggle switch with proper sizing -->
<ToggleSwitch
:model-value="isActive(option.mode)"
class="flex-shrink-0"
@update:model-value="handleToggle(option.mode)"
/>
</div>
</div>

<!-- Divider using semantic border -->
<div class="border-t border-border-subtle"></div>

<!-- Settings button with semantic styling -->
<Button
class="w-full bg-secondary-background hover:bg-secondary-background-hover border-0 rounded-lg p-2 text-sm"
@click="handleEditSettings"
>
<div class="flex items-center justify-center gap-1">
<i class="pi pi-cog text-xs text-muted-foreground" />
<span class="font-normal text-base-foreground">{{
$t('widgets.numberControl.editSettings')
}}</span>
</div>
</Button>
</div>
</Popover>
</template>
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
<script setup lang="ts">
import { computed } from 'vue'

import type { SimplifiedWidget } from '@/types/simplifiedWidget'

import WidgetInputNumberInput from './WidgetInputNumberInput.vue'
import WidgetInputNumberSlider from './WidgetInputNumberSlider.vue'
import WidgetInputNumberWithControl from './WidgetInputNumberWithControl.vue'

defineProps<{
const props = defineProps<{
widget: SimplifiedWidget<number>
}>()

const modelValue = defineModel<number>({ default: 0 })

const hasControlAfterGenerate = computed(() => {
return !!props.widget.controlWidget
})
</script>

<template>
<component
:is="
widget.type === 'slider'
? WidgetInputNumberSlider
: WidgetInputNumberInput
hasControlAfterGenerate
? WidgetInputNumberWithControl
: widget.type === 'slider'
? WidgetInputNumberSlider
: WidgetInputNumberInput
"
v-model="modelValue"
:widget="widget"
Expand Down
Loading