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
Further nits
  • Loading branch information
AustinMroz committed Dec 6, 2025
commit 26e6aec1287f734171684feb13c983276459ed22
6 changes: 3 additions & 3 deletions src/composables/graph/useGraphNodeManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import type { InputSpec } from '@/schemas/nodeDef/nodeDefSchemaV2'
import { isDOMWidget } from '@/scripts/domWidget'
import { useNodeDefStore } from '@/stores/nodeDefStore'
import type { WidgetValue, SafeControlWidget } from '@/types/simplifiedWidget'
import { validateControlOption } from '@/types/simplifiedWidget'
import { normalizeControlOption } from '@/types/simplifiedWidget'

import type {
LGraph,
Expand Down Expand Up @@ -90,8 +90,8 @@ function getControlWidget(widget: IBaseWidget): SafeControlWidget | undefined {
)
if (!cagWidget) return
return {
value: validateControlOption(cagWidget.value),
update: (value) => (cagWidget.value = validateControlOption(value))
value: normalizeControlOption(cagWidget.value),
update: (value) => (cagWidget.value = normalizeControlOption(value))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import { NumberControlMode } from '../composables/useStepperControl'

type ControlOption = {
description: string
icon?: string
mode: NumberControlMode
icon?: string
text?: string
title: string
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import InputNumber from 'primevue/inputnumber'
import { computed, useSlots } from 'vue'
import { computed } from 'vue'

import type { SimplifiedWidget } from '@/types/simplifiedWidget'
import { cn } from '@/utils/tailwindUtil'
Expand Down Expand Up @@ -68,8 +68,6 @@ const buttonTooltip = computed(() => {
}
return null
})

const slots = useSlots()
</script>

<template>
Expand All @@ -94,7 +92,7 @@ const slots = useSlots()
class: cn(
'[&>input]:bg-transparent [&>input]:border-0',
'[&>input]:truncate [&>input]:min-w-[4ch]',
slots.default && '[&>input]:pr-7'
$slots.default && '[&>input]:pr-7'
)
},
decrementButton: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,8 @@ const filteredProps = computed(() =>
filterWidgetProps(widget.options, STANDARD_EXCLUDED_PROPS)
)

// Get the precision value for proper number formatting
const precision = computed(() => {
const p = widget.options?.precision
// Treat negative or non-numeric precision as undefined
return typeof p === 'number' && p >= 0 ? p : undefined
})
const p = widget.options?.precision
const precision = typeof p === 'number' && p >= 0 ? p : undefined

// Calculate the step value based on precision or widget options
const stepValue = useNumberStepCalculation(widget.options, precision, true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could be a utility function instead of a composable for now.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script setup lang="ts">
import { noop } from 'es-toolkit'
import { inject } from 'vue'

import type { SimplifiedWidget } from '@/types/simplifiedWidget'
Expand Down Expand Up @@ -30,8 +29,9 @@ const hideLayoutField = inject<boolean>('hideLayoutField', false)
<div class="relative min-w-0 flex-1">
<div
class="cursor-default min-w-0 rounded-lg space-y-1 focus-within:ring ring-component-node-widget-background-highlighted transition-all"
@pointerdown.stop="noop"
@pointermove.stop="noop"
@pointerdown.stop
@pointermove.stop
@pointerup.stop
>
<slot />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const addMultiSelectWidget = (
widget.linkedWidgets = addValueControlWidgets(
node,
widget,
undefined,
'fixed',
undefined,
transformInputSpecV2ToV1(inputSpec)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export const useFloatWidget = () => {
const controlWidget = addValueControlWidget(
node,
widget,
'randomize',
'fixed',
undefined,
undefined,
transformInputSpecV2ToV1(inputSpec)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { computed } from 'vue'
import type { Ref } from 'vue'
import { computed, toValue } from 'vue'
import type { MaybeRefOrGetter } from 'vue'

interface NumberWidgetOptions {
step2?: number
Expand All @@ -12,25 +12,24 @@ interface NumberWidgetOptions {
*/
export function useNumberStepCalculation(
options: NumberWidgetOptions | undefined,
precision: Ref<number | undefined>,
precisionArg: MaybeRefOrGetter<number | undefined>,
returnUndefinedForDefault = false
) {
return computed(() => {
const precision = toValue(precisionArg)
// Use step2 (correct input spec value) instead of step (legacy 10x value)
if (options?.step2 !== undefined) {
return Number(options.step2)
}

if (precision.value === undefined) {
if (precision === undefined) {
return returnUndefinedForDefault ? undefined : 0
}

if (precision.value === 0) return 1
if (precision === 0) return 1

// For precision > 0, step = 1 / (10^precision)
const step = 1 / Math.pow(10, precision.value)
return returnUndefinedForDefault
? step
: Number(step.toFixed(precision.value))
const step = 1 / Math.pow(10, precision)
return returnUndefinedForDefault ? step : Number(step.toFixed(precision))
})
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { computed, onMounted, onUnmounted, ref } from 'vue'
import type { Ref } from 'vue'

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

import { numberControlRegistry } from '../services/NumberControlRegistry'
Expand Down Expand Up @@ -60,12 +59,11 @@ export function useStepperControl(
) {
const controlMode = ref<NumberControlMode>(convertToEnum(defaultValue))
const controlId = Symbol('numberControl')
const globalSeedStore = useGlobalSeedStore()

const applyControl = () => {
const { min = 0, max = 1000000, step2, step = 1, onChange } = options
const safeMax = Math.min(1125899906842624, max)
const safeMin = Math.max(-1125899906842624, min)
const safeMax = Math.min(2 ** 50, max)
const safeMin = Math.max(-(2 ** 50), min)
Comment on lines +65 to +66
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Consider using Number.MAX_SAFE_INTEGER for clarity.

The safe bounds use 2 ** 50, which is within JavaScript's safe integer range but less explicit than the standard constant.

Apply this diff:

-    const safeMax = Math.min(2 ** 50, max)
-    const safeMin = Math.max(-(2 ** 50), min)
+    const safeMax = Math.min(Number.MAX_SAFE_INTEGER, max)
+    const safeMin = Math.max(-Number.MAX_SAFE_INTEGER, min)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const safeMax = Math.min(2 ** 50, max)
const safeMin = Math.max(-(2 ** 50), min)
const safeMax = Math.min(Number.MAX_SAFE_INTEGER, max)
const safeMin = Math.max(-Number.MAX_SAFE_INTEGER, min)
🤖 Prompt for AI Agents
In src/renderer/extensions/vueNodes/widgets/composables/useStepperControl.ts
around lines 65-66, replace the hardcoded 2 ** 50 bounds with the standard
constants: set safeMax using Math.min(Number.MAX_SAFE_INTEGER, max) and set
safeMin using Math.max(Number.MIN_SAFE_INTEGER, min) so the intent is explicit
and uses built-in safe-integer constants.

// Use step2 if available (widget context), otherwise use step as-is (direct API usage)
const actualStep = step2 !== undefined ? step2 : step

Expand All @@ -83,10 +81,6 @@ export function useStepperControl(
case NumberControlMode.RANDOMIZE:
newValue = Math.floor(Math.random() * (safeMax - safeMin + 1)) + safeMin
break
case NumberControlMode.LINK_TO_GLOBAL:
// Use global seed value, constrained by min/max
newValue = Math.max(min, Math.min(safeMax, globalSeedStore.globalSeed))
break
default:
return
}
Expand Down
15 changes: 0 additions & 15 deletions src/scripts/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,6 @@ export async function addStylesheet(

export { downloadBlob } from '@/base/common/downloadUtil'

if (typeof window !== 'undefined') {
import('@/base/common/downloadUtil')
.then((module) => {
const fn = (
module as {
downloadBlob?: typeof import('@/base/common/downloadUtil').downloadBlob
}
).downloadBlob
if (typeof fn === 'function') {
;(window as any).downloadBlob = fn
}
})
.catch(() => {})
}

export function uploadFile(accept: string) {
return new Promise<File>((resolve, reject) => {
const input = document.createElement('input')
Expand Down
16 changes: 0 additions & 16 deletions src/stores/globalSeedStore.ts

This file was deleted.

11 changes: 7 additions & 4 deletions src/types/simplifiedWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,18 @@ const CONTROL_OPTIONS = [
] 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
function isControlOption(val: WidgetValue): val is ControlOptions {
return CONTROL_OPTIONS.includes(val as ControlOptions)
}

export function normalizeControlOption(val: WidgetValue): ControlOptions {
if (isControlOption(val)) return val
return 'randomize'
}

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

export interface SimplifiedWidget<
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createPinia, setActivePinia } from 'pinia'
import { setActivePinia } from 'pinia'
import { createTestingPinia } from '@pinia/testing'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { ref } from 'vue'

Expand Down Expand Up @@ -31,7 +32,7 @@ vi.mock(

describe('useStepperControl', () => {
beforeEach(() => {
setActivePinia(createPinia())
setActivePinia(createTestingPinia())
vi.clearAllMocks()
})

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createPinia, setActivePinia } from 'pinia'
import { setActivePinia } from 'pinia'
import { createTestingPinia } from '@pinia/testing'
import { beforeEach, describe, expect, it, vi } from 'vitest'

import {
Expand Down Expand Up @@ -36,8 +37,7 @@ vi.mock('@/platform/settings/settingStore', () => ({

describe('widgetRegistry', () => {
beforeEach(() => {
// Create a fresh pinia and activate it for each test
setActivePinia(createPinia())
setActivePinia(createTestingPinia())
vi.clearAllMocks()
})
describe('getComponent', () => {
Expand Down
61 changes: 0 additions & 61 deletions tests-ui/tests/stores/globalSeedStore.test.ts

This file was deleted.