sd-text-fix / ui /src /types.ts
Kazzze's picture
Update to current version
2a261b0 verified
Raw History Blame Contribute Delete
5.12 kB
/** How the new text is drawn. The server keeps the same names (text_fix/web.py, LOOK_DEFAULTS). */
export interface Look {
font: string
color: string
ownColor: boolean
size: number
fill: number
matchWeight: boolean
weight: number
uneven: number
seed: number
shading: number
opacity: number
soften: number
shiftX: number
shiftY: number
/** A second color for the lower part of each line. */
twoColors: boolean
color2: string
/** 0: the two colors meet at a sharp edge; 1: one runs into the other. */
split: number
/** Width of the outline, in letter heights; 0 for none. */
outline: number
outlineColor: string
/** How dark the cast shadow is; 0 for none. */
shadow: number
shadowColor: string
shadowX: number
shadowY: number
shadowBlur: number
effect: Effect
effectStrength: number
/** How much the letters follow the folds of the surface. */
relief: number
}
export type Effect = 'none' | 'embroidery' | 'stencil' | 'neon' | 'engraving'
/** The settings of the model pass that are kept between sessions. */
export interface Model {
strength: number
steps: number
cfg: number
sampler: string
resolution: number
padding: number
/** How many passes, each with a seed of its own, to choose from. */
variants: number
/** Leave the tags that ask for text out of the prompt, and put "text" in the negative. */
cleanPrompt: boolean
/** The ControlNet model that guides the pass by the edges of the letters; empty for none. */
guide: string
guideWeight: number
}
/** The variants of the last model pass. */
export interface Variants {
count: number
chosen: number
seeds: number[]
/** The image version they belong to, for their addresses. */
version: number
}
export type View = 'result' | 'image' | 'compare'
export type Point = [number, number]
/** How a selection was made: one of the found lines, or a click; and the clicks that extended it.
* The server turns it back into the selection, on the same image, as often as it is asked. */
export interface Recipe {
found?: number
at?: Point
reach?: number
extend?: Point[]
/** Several lines taken as one block. */
join?: Recipe[]
/** The place for the new text, set by hand with the handles. */
shape?: { corners: Point[]; bend: number }
/** Brush strokes: more to erase with the letters. */
paint?: Stroke[]
/** The new text written along this line, drawn by hand, instead of where the old text was. */
path?: Point[]
/** The new letters bent by hand: 3 rows x 4 columns of moves, in pixels. */
warp?: Point[][]
}
export interface Stroke {
points: Point[]
radius: number
}
/** A selection as the page draws it. */
export interface Shape {
outline: Point[]
quad: Point[]
/** Where the handles stand: the corners as the text reads, and how far the middle is lifted. */
corners: Point[]
bend: number
color: string
width: number
height: number
/** The new text follows a path drawn by hand: the corner handles do not apply. */
path?: boolean
/** Where the points of the hand warp stand before they are moved: 3 rows x 4 columns. */
grid?: Point[][]
}
export interface FontMatch {
name: string
distance: number
}
/** One selected line and what it should say. */
export interface Item {
key: string
recipe: Recipe
shape: Shape
text: string
/** The old letters go and nothing is written in their place. */
erase?: boolean
}
export interface SessionInfo {
session: string
width: number
height: number
name: string
found: Shape[]
prompt: string
negative: string
history: number
version: number
}
export interface Settings {
look: Look
model: Model
reach: number
showFound: boolean
/** How the text is looked for: by looks, or with a detector ("auto": the light one when it is here). */
search: Search
/** Put what the old letters say into the text field of a new line. */
readOld: boolean
}
export type Search = 'auto' | 'looks' | 'light' | 'full'
/** The detector's models on the server. */
export interface Models {
onnx: boolean
ready: { light: boolean; full: boolean }
/** Bytes still to fetch for each detector. */
missing: { light: number; full: number }
download: { running: boolean; done: number; total: number; current: string; error: string }
/** The search that actually runs now. */
inUse: 'looks' | 'light' | 'full'
folder: string
}
export interface Options {
fonts: string[]
samplers: string[]
/** The ControlNet models the host has; empty when it has none. */
controlnets?: string[]
/** Looks saved under a name. */
presets?: Record<string, Look>
models?: Models
canBlend: boolean
host: 'a1111' | 'comfyui'
settings: Settings
defaults: { look: Look; model: Model }
}
export type Mode = 'new' | 'add' | 'extend' | 'brush' | 'path' | 'warp'
export interface Status {
text: string
tone: 'info' | 'success' | 'warning' | 'error'
}