mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-21 07:14:11 +00:00
feat: support custom display hints for Vue widget lookup
This commit is contained in:
@@ -152,7 +152,7 @@ const processedWidgets = computed((): ProcessedWidget[] => {
|
||||
if (!shouldRenderAsVue(widget)) continue
|
||||
|
||||
const vueComponent =
|
||||
getComponent(widget.type, widget.name) ||
|
||||
getComponent(widget.type, widget.name, widget.options?.display) ||
|
||||
(widget.isDOMWidget ? WidgetDOM : WidgetLegacy)
|
||||
|
||||
const { slotMetadata, options } = widget
|
||||
|
||||
@@ -72,7 +72,8 @@ export const useFloatWidget = () => {
|
||||
/** @deprecated Use step2 instead. The 10x value is a legacy implementation. */
|
||||
step: step * 10.0,
|
||||
step2: step,
|
||||
precision
|
||||
precision,
|
||||
display: inputSpec.display
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -63,7 +63,8 @@ export const useIntWidget = () => {
|
||||
/** @deprecated Use step2 instead. The 10x value is a legacy implementation. */
|
||||
step: step * 10,
|
||||
step2: step,
|
||||
precision: 0
|
||||
precision: 0,
|
||||
display: inputSpec.display
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -42,7 +42,12 @@ const zNumericInputOptions = zBaseInputOptions.extend({
|
||||
step: z.number().optional(),
|
||||
/** Note: Many node authors are using INT/FLOAT to pass list of INT/FLOAT. */
|
||||
default: z.union([z.number(), z.array(z.number())]).optional(),
|
||||
display: z.enum(['slider', 'number', 'knob']).optional()
|
||||
/**
|
||||
* Display hint for widget rendering.
|
||||
* Built-in values: 'slider', 'number', 'knob'
|
||||
* Extensions can register custom values via getCustomVueWidgets hook.
|
||||
*/
|
||||
display: z.string().optional()
|
||||
})
|
||||
|
||||
export const zIntInputOptions = zNumericInputOptions.extend({
|
||||
|
||||
6
src/types/litegraph-augmentation.d.ts
vendored
6
src/types/litegraph-augmentation.d.ts
vendored
@@ -40,6 +40,12 @@ declare module '@/lib/litegraph/src/types/widgets' {
|
||||
|
||||
/** If the widget is hidden, this will be set to true. */
|
||||
hidden?: boolean
|
||||
|
||||
/**
|
||||
* Display hint from Python node definition for custom widget rendering.
|
||||
* Extensions can use this to render widgets with custom Vue components.
|
||||
*/
|
||||
display?: string
|
||||
}
|
||||
|
||||
interface IBaseWidget {
|
||||
|
||||
Reference in New Issue
Block a user