feat: enhance Comfy API handling and add tests for branded non-Z diffusion models

This commit is contained in:
syntaxbullet
2026-07-09 21:56:25 +02:00
parent c3a75cf0d6
commit 317a7bbf5f
11 changed files with 532 additions and 37 deletions

View File

@@ -1,5 +1,5 @@
import { Check, CaretDown } from "@phosphor-icons/react";
import { forwardRef, useEffect, useRef, useState, type CSSProperties, type ForwardedRef } from "react";
import { useEffect, useRef, useState, type CSSProperties, type RefObject } from "react";
import { createPortal } from "react-dom";
export type BottomControlSelectOption<TValue extends string> = {
@@ -85,7 +85,7 @@ export function BottomControlSelectMenu<TValue extends string>({ value, options,
</button>
{open && placement === "inline" ? (
<SelectOptions
ref={menuRef}
menuRef={menuRef}
options={options}
value={value}
onValueChange={onValueChange}
@@ -96,7 +96,7 @@ export function BottomControlSelectMenu<TValue extends string>({ value, options,
) : open ? (
createPortal(
<SelectOptions
ref={menuRef}
menuRef={menuRef}
options={options}
value={value}
onValueChange={onValueChange}
@@ -113,6 +113,7 @@ export function BottomControlSelectMenu<TValue extends string>({ value, options,
}
type SelectOptionsProps<TValue extends string> = {
menuRef: RefObject<HTMLDivElement | null>;
options: readonly BottomControlSelectOption<TValue>[];
value: TValue;
className: string;
@@ -122,12 +123,9 @@ type SelectOptionsProps<TValue extends string> = {
setOpen: (open: boolean) => void;
};
const SelectOptions = forwardRef(function SelectOptions<TValue extends string>(
{ options, value, className, style, onValueChange, setOpen, ...props }: SelectOptionsProps<TValue>,
ref: ForwardedRef<HTMLDivElement>,
) {
function SelectOptions<TValue extends string>({ menuRef, options, value, className, style, onValueChange, setOpen, ...props }: SelectOptionsProps<TValue>) {
return (
<div ref={ref} className={className} style={style} role="listbox" aria-label={props["aria-label"]}>
<div ref={menuRef} className={className} style={style} role="listbox" aria-label={props["aria-label"]}>
{options.map((option) => {
const selected = option.value === value;
return (
@@ -149,4 +147,4 @@ const SelectOptions = forwardRef(function SelectOptions<TValue extends string>(
})}
</div>
);
});
}