(null)
const names = Object.keys(presets)
if (naming !== null) {
const done = () => {
void savePreset(naming)
setNaming(null)
}
return (
setNaming(event.target.value)}
onKeyDown={(event) => {
if (event.key === 'Enter') done()
if (event.key === 'Escape') setNaming(null)
}}
className="h-8"
/>
Save
setNaming(null)} aria-label="Cancel">
)
}
return (
setNaming(names.includes(preset) ? preset : '')}>
Save
{names.includes(preset) && (
void deletePreset(preset)} aria-label="Delete the preset">
)}
)
}
function Letters() {
const options = useStore((state) => state.options)
const look = useStore((state) => state.look)
const setLook = useStore((state) => state.setLook)
const items = useStore((state) => state.items)
const active = useStore((state) => state.active)
const matches = useStore((state) => state.matches)
const matching = useStore((state) => state.matching)
const matchFonts = useStore((state) => state.matchFonts)
const fonts = options?.fonts ?? [look.font]
const target = items.find((item) => item.key === active) ?? items[items.length - 1]
const shown = matches && target && matches.key === target.key ? matches.fonts : null
return (
setLook({ font })}
options={fonts}
renderOption={(font) => {font} }
/>
target && void matchFonts(target.key)}
>
{matching ? : } Match
{shown && shown.length > 0 && (
{shown.map((match, index) => (
setLook({ font: match.name })}
>
{index + 1}. {match.name}
))}
)}
setLook({ twoColors })}
/>
{look.twoColors && (
setLook({ color2 })} />
setLook({ split })}
min={0}
max={1}
step={0.05}
format={percent}
/>
)}
setLook({ size })}
min={0.5}
max={2}
step={0.01}
format={fixed(2)}
/>
setLook({ fill })}
min={0}
max={1}
step={0.05}
format={percent}
/>
setLook({ matchWeight })}
/>
setLook({ weight })}
min={-1}
max={1}
step={0.05}
format={fixed(2)}
disabled={look.matchWeight}
/>
setLook({ uneven })}
min={0}
max={1}
step={0.05}
format={percent}
/>
setLook({ seed: (look.seed + 1) % 1000 })}
>
{look.seed}
)
}
function OutlineAndShadow() {
const look = useStore((state) => state.look)
const setLook = useStore((state) => state.setLook)
return (
0 || look.shadow > 0}>
setLook({ outlineColor })} />
setLook({ outline })}
min={0}
max={0.3}
step={0.005}
format={fixed(3)}
/>
setLook({ shadowColor })} />
setLook({ shadow })}
min={0}
max={1}
step={0.05}
format={percent}
/>
setLook({ shadowX })}
min={-0.5}
max={0.5}
step={0.01}
format={fixed(2)}
disabled={!look.shadow}
/>
setLook({ shadowY })}
min={-0.5}
max={0.5}
step={0.01}
format={fixed(2)}
disabled={!look.shadow}
/>
setLook({ shadowBlur })}
min={0}
max={0.5}
step={0.01}
format={fixed(2)}
disabled={!look.shadow}
/>
)
}
function Material() {
const look = useStore((state) => state.look)
const setLook = useStore((state) => state.setLook)
const label = EFFECTS.find((effect) => effect.value === look.effect)?.label ?? 'Paint'
return (
setLook({ effect: EFFECTS.find((effect) => effect.label === chosen)?.value ?? 'none' })}
options={EFFECTS.map((effect) => effect.label)}
/>
setLook({ effectStrength })}
min={0}
max={1}
step={0.05}
format={percent}
disabled={look.effect === 'none'}
/>
)
}
function Surface() {
const look = useStore((state) => state.look)
const setLook = useStore((state) => state.setLook)
return (
setLook({ shiftX: 0, shiftY: 0 })}
>
Place
)
}
>
setLook({ shading })}
min={0}
max={1}
step={0.05}
format={percent}
/>
setLook({ relief })}
min={0}
max={1}
step={0.05}
format={percent}
/>
setLook({ opacity })}
min={0.3}
max={1}
step={0.01}
format={percent}
/>
setLook({ soften })}
min={0}
max={3}
step={0.1}
format={(value) => `${value.toFixed(1)} px`}
/>
setLook({ shiftX })}
min={-2}
max={2}
step={0.02}
format={fixed(2)}
/>
setLook({ shiftY })}
min={-2}
max={2}
step={0.02}
format={fixed(2)}
/>
)
}
function ModelPass() {
const options = useStore((state) => state.options)
const model = useStore((state) => state.model)
const setModel = useStore((state) => state.setModel)
const prompt = useStore((state) => state.prompt)
const negative = useStore((state) => state.negative)
const setPrompt = useStore((state) => state.setPrompt)
const setNegative = useStore((state) => state.setNegative)
if (options && !options.canBlend) {
return (
In ComfyUI the model pass belongs to the workflow: feed the node's image and mask outputs to an
inpainting pass at a denoise of 0.25 to 0.35. What you select and type here is kept in the node.
)
}
const samplers = options?.samplers.length ? options.samplers : [model.sampler]
const controlnets = options?.controlnets ?? []
const guide = model.guide && controlnets.includes(model.guide) ? model.guide : OFF
return (
setModel({ strength })}
min={0.05}
max={0.6}
step={0.01}
format={fixed(2)}
/>
{controlnets.length > 0 && (
<>
setModel({ guide: chosen === OFF ? '' : chosen })}
options={[OFF, ...controlnets]}
/>
{model.guide && (
setModel({ guideWeight })}
min={0.1}
max={1.5}
step={0.05}
format={fixed(2)}
/>
)}
>
)}
setModel({ variants })}
min={1}
max={4}
step={1}
/>
setModel({ cleanPrompt })}
/>
setModel({ sampler })} options={samplers} />
setModel({ steps })} min={4} max={60} step={1} />
setModel({ cfg })} min={1} max={15} step={0.5} />
setModel({ resolution })}
min={512}
max={1536}
step={64}
/>
setModel({ padding })}
min={16}
max={256}
step={8}
format={(value) => `${value} px`}
/>
)
}
/** Everything that is set rather than clicked: the texts, the look, the model pass. */
export function SidePanel() {
const options = useStore((state) => state.options)
const session = useStore((state) => state.session)
const items = useStore((state) => state.items)
const blending = useStore((state) => state.blending)
const blend = useStore((state) => state.blend)
const ready = !!session && items.some((item) => item.text.trim() || item.erase)
return (
{options?.canBlend !== false && (
void blend()}>
{blending ? : }
Blend in with the model
Ctrl + Enter
)}
)
}