Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
45 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
ff08660
Merge main
AustinMroz Dec 3, 2025
52daf4e
Revert to primevue, fix test
AustinMroz Dec 3, 2025
ad70768
Revert vitest changes, clear browser snapshots
AustinMroz Dec 3, 2025
4b4b90d
[automated] Update test expectations
invalid-email-address Dec 3, 2025
a84fd7a
Empty commit to trigger tests
AustinMroz Dec 4, 2025
0b5ded8
Merge main
AustinMroz Dec 5, 2025
a2391e6
[automated] Update test expectations
invalid-email-address Dec 5, 2025
5b6d835
Empty commit to force tests
AustinMroz Dec 5, 2025
939090f
nits
AustinMroz Dec 5, 2025
26e6aec
Further nits
AustinMroz Dec 6, 2025
1fa618c
Merge main
AustinMroz Dec 6, 2025
1ddf364
[automated] Update test expectations
invalid-email-address Dec 6, 2025
cfb579b
Remove global seed tests
AustinMroz Dec 6, 2025
d25cd39
Merge remote-tracking branch 'origin/main' into austin/vue-control-af…
AustinMroz Dec 9, 2025
679a1da
[automated] Update test expectations
invalid-email-address Dec 10, 2025
70f6d5b
merge: main into austin/vue-control-after-generate
christian-byrne Dec 11, 2025
ed25f72
Merge branch 'main' into austin/vue-control-after-generate
AustinMroz Dec 13, 2025
488922a
fix: restore executeNumberControls calls removed in merge
christian-byrne Dec 13, 2025
9553233
fix: remove space-y-1 causing extra margin on number inputs
christian-byrne Dec 13, 2025
437880c
[automated] Update test expectations
invalid-email-address Dec 13, 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
Prev Previous commit
Next Next commit
nits
  • Loading branch information
AustinMroz committed Dec 5, 2025
commit 939090f3a070392e55bb83d27e8fe4ee600cc60b
23 changes: 4 additions & 19 deletions src/composables/graph/useGraphNodeManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,8 @@ 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,
SafeControlWidget,
ControlWidgetOptions
} from '@/types/simplifiedWidget'
import type { WidgetValue, SafeControlWidget } from '@/types/simplifiedWidget'
import { validateControlOption } from '@/types/simplifiedWidget'

import type {
LGraph,
Expand Down Expand Up @@ -87,26 +84,14 @@ 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))
value: validateControlOption(cagWidget.value),
update: (value) => (cagWidget.value = validateControlOption(value))
}
}

Expand Down
12 changes: 7 additions & 5 deletions src/locales/en/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -1912,16 +1912,18 @@
"placeholderUnknown": "Select media..."
},
"numberControl": {
"controlHeaderBefore": "Automatically update the value",
"controlHeaderAfter": "AFTER",
"controlHeaderBefore2": "BEFORE",
"controlHeaderEnd": "running the workflow:",
"header" : {
"prefix": "Automatically update the value",
"after": "AFTER",
"before": "BEFORE",
"postfix": "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",
"increment": "Increment Value",
"incrementDesc": "Adds 1 to the value number",
"decrement": "Decrement Value",
"decrementDesc": "Subtracts 1 from the value number",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import { useDialogService } from '@/services/dialogService'
import { NumberControlMode } from '../composables/useStepperControl'

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

const popover = ref()
Expand Down Expand Up @@ -91,30 +91,26 @@ const handleEditSettings = () => {
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') }}
{{ $t('widgets.numberControl.header.prefix') }}
<span class="text-base-foreground font-medium">
{{
widgetControlMode === 'before'
? $t('widgets.numberControl.controlHeaderBefore2')
: $t('widgets.numberControl.controlHeaderAfter')
? $t('widgets.numberControl.header.before')
: $t('widgets.numberControl.header.after')
}}
</span>
{{ $t('widgets.numberControl.controlHeaderEnd') }}
{{ $t('widgets.numberControl.header.postfix') }}
</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"
>
Expand All @@ -131,7 +127,6 @@ const handleEditSettings = () => {
</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"
Expand All @@ -152,19 +147,14 @@ const handleEditSettings = () => {
</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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,6 @@ const buttonTooltip = computed(() => {
})

const slots = useSlots()

const inputClass = computed(() =>
cn(
'[&>input]:bg-transparent [&>input]:border-0',
'[&>input]:truncate [&>input]:min-w-[4ch]',
slots.default && '[&>input]:pr-7'
)
)
</script>

<template>
Expand All @@ -99,7 +91,11 @@ const inputClass = computed(() =>
:show-buttons="!buttonsDisabled"
:pt="{
root: {
class: inputClass
class: cn(
'[&>input]:bg-transparent [&>input]:border-0',
'[&>input]:truncate [&>input]:min-w-[4ch]',
slots.default && '[&>input]:pr-7'
)
},
decrementButton: {
class: 'w-8 border-0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { defineAsyncComponent, ref } from 'vue'

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

import { useControlButtonIcon } from '../composables/useControlButtonIcon'
import type { NumberControlMode } from '../composables/useStepperControl'
import { useStepperControl } from '../composables/useStepperControl'
import WidgetInputNumberInput from './WidgetInputNumberInput.vue'
Expand All @@ -15,7 +14,6 @@ const NumberControlPopover = defineAsyncComponent(

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

const modelValue = defineModel<number>({ default: 0 })
Expand All @@ -25,7 +23,7 @@ const handleControlChange = (newValue: number) => {
modelValue.value = newValue
}

const { controlMode } = useStepperControl(
const { controlMode, controlButtonIcon } = useStepperControl(
modelValue,
{
...props.widget.options,
Expand All @@ -34,8 +32,6 @@ const { controlMode } = useStepperControl(
props.widget.controlWidget!.value
)

const controlButtonIcon = useControlButtonIcon(controlMode)

const setControlMode = (mode: NumberControlMode) => {
controlMode.value = mode
props.widget.controlWidget!.update(mode)
Expand All @@ -50,8 +46,7 @@ const togglePopover = (event: Event) => {
<div class="relative grid grid-cols-subgrid">
<WidgetInputNumberInput
v-model="modelValue"
:widget="widget"
:readonly="readonly"
:widget
class="grid grid-cols-subgrid col-span-2"
>
<Button
Expand All @@ -65,7 +60,7 @@ const togglePopover = (event: Event) => {
</WidgetInputNumberInput>
<NumberControlPopover
ref="popover"
:control-mode="controlMode"
:control-mode
@update:control-mode="setControlMode"
/>
</div>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { onMounted, onUnmounted, ref } from 'vue'
import { computed, onMounted, onUnmounted, ref } from 'vue'
import type { Ref } from 'vue'

import { useGlobalSeedStore } from '@/stores/globalSeedStore'
import type { ControlWidgetOptions } from '@/types/simplifiedWidget'
import type { ControlOptions } from '@/types/simplifiedWidget'

import { numberControlRegistry } from '../services/NumberControlRegistry'

Expand All @@ -22,7 +22,7 @@ interface StepperControlOptions {
onChange?: (value: number) => void
}

function convertToEnum(str?: ControlWidgetOptions): NumberControlMode {
function convertToEnum(str?: ControlOptions): NumberControlMode {
switch (str) {
case 'fixed':
return NumberControlMode.FIXED
Expand All @@ -36,10 +36,27 @@ function convertToEnum(str?: ControlWidgetOptions): NumberControlMode {
return NumberControlMode.RANDOMIZE
}

function useControlButtonIcon(controlMode: Ref<NumberControlMode>) {
return computed(() => {
switch (controlMode.value) {
case NumberControlMode.INCREMENT:
return 'pi pi-plus'
case NumberControlMode.DECREMENT:
return 'pi pi-minus'
case NumberControlMode.FIXED:
return 'icon-[lucide--pencil-off]'
case NumberControlMode.LINK_TO_GLOBAL:
return 'pi pi-link'
default:
return 'icon-[lucide--shuffle]'
}
})
}

export function useStepperControl(
modelValue: Ref<number>,
options: StepperControlOptions,
defaultValue?: ControlWidgetOptions
defaultValue?: ControlOptions
) {
const controlMode = ref<NumberControlMode>(convertToEnum(defaultValue))
const controlId = Symbol('numberControl')
Expand Down Expand Up @@ -90,9 +107,11 @@ export function useStepperControl(
onUnmounted(() => {
numberControlRegistry.unregister(controlId)
})
const controlButtonIcon = useControlButtonIcon(controlMode)

return {
controlMode,
applyControl
applyControl,
controlButtonIcon,
controlMode
}
}
21 changes: 15 additions & 6 deletions src/types/simplifiedWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,22 @@ export type WidgetValue =
| void
| File[]

export type ControlWidgetOptions =
| 'fixed'
| 'increment'
| 'decrement'
| 'randomize'
const CONTROL_OPTIONS = [
'fixed',
'increment',
'decrement',
'randomize'
] as const
export type ControlOptions = (typeof CONTROL_OPTIONS)[number]

export function validateControlOption(val: unknown): ControlOptions {
if (CONTROL_OPTIONS.includes(val as ControlOptions))
return val as ControlOptions
return 'randomize'
}

export type SafeControlWidget = {
value: ControlWidgetOptions
value: ControlOptions
update: (value: unknown) => void
}

Expand Down