diff --git a/invokeai/frontend/web/src/features/parameters/components/Parameters/Canvas/MaskAdjustment/ParamMaskBlurMethod.tsx b/invokeai/frontend/web/src/features/parameters/components/Parameters/Canvas/MaskAdjustment/ParamMaskBlurMethod.tsx index b45dc8b884..fa20dcdbcc 100644 --- a/invokeai/frontend/web/src/features/parameters/components/Parameters/Canvas/MaskAdjustment/ParamMaskBlurMethod.tsx +++ b/invokeai/frontend/web/src/features/parameters/components/Parameters/Canvas/MaskAdjustment/ParamMaskBlurMethod.tsx @@ -6,7 +6,7 @@ import IAIMantineSelect from 'common/components/IAIMantineSelect'; import { setMaskBlurMethod } from 'features/parameters/store/generationSlice'; import { useTranslation } from 'react-i18next'; -export type MaskBlurMethods = 'box' | 'gaussian'; +type MaskBlurMethods = 'box' | 'gaussian'; const maskBlurMethods: SelectItem[] = [ { label: 'Box Blur', value: 'box' }, diff --git a/invokeai/frontend/web/src/features/parameters/store/generationSlice.ts b/invokeai/frontend/web/src/features/parameters/store/generationSlice.ts index 33a76da4e6..0173391833 100644 --- a/invokeai/frontend/web/src/features/parameters/store/generationSlice.ts +++ b/invokeai/frontend/web/src/features/parameters/store/generationSlice.ts @@ -4,12 +4,13 @@ import { roundToMultiple } from 'common/util/roundDownToMultiple'; import { configChanged } from 'features/system/store/configSlice'; import { clamp } from 'lodash-es'; import { ImageDTO } from 'services/api/types'; -import { MaskBlurMethods } from '../components/Parameters/Canvas/MaskAdjustment/ParamMaskBlurMethod'; + import { clipSkipMap } from '../types/constants'; import { CfgScaleParam, HeightParam, MainModelParam, + MaskBlurMethodParam, NegativePromptParam, OnnxModelParam, PositivePromptParam, @@ -35,7 +36,7 @@ export interface GenerationState { negativePrompt: NegativePromptParam; scheduler: SchedulerParam; maskBlur: number; - maskBlurMethod: MaskBlurMethods; + maskBlurMethod: MaskBlurMethodParam; seed: SeedParam; seedWeights: string; shouldFitToWidthHeight: boolean; @@ -196,7 +197,7 @@ export const generationSlice = createSlice({ setMaskBlur: (state, action: PayloadAction) => { state.maskBlur = action.payload; }, - setMaskBlurMethod: (state, action: PayloadAction) => { + setMaskBlurMethod: (state, action: PayloadAction) => { state.maskBlurMethod = action.payload; }, setTileSize: (state, action: PayloadAction) => { diff --git a/invokeai/frontend/web/src/features/parameters/types/parameterSchemas.ts b/invokeai/frontend/web/src/features/parameters/types/parameterSchemas.ts index ac799ac600..5221bf64a9 100644 --- a/invokeai/frontend/web/src/features/parameters/types/parameterSchemas.ts +++ b/invokeai/frontend/web/src/features/parameters/types/parameterSchemas.ts @@ -385,6 +385,21 @@ export const isValidSDXLRefinerStart = ( val: unknown ): val is SDXLRefinerStartParam => zSDXLRefinerstart.safeParse(val).success; +/** + * Zod schema for a mask blur method parameter + */ +export const zMaskBlurMethod = z.enum(['box', 'gaussian']); +/** + * Type alias for mask blur method parameter, inferred from its zod schema + */ +export type MaskBlurMethodParam = z.infer; +/** + * Validates/type-guards a value as a mask blur method parameter + */ +export const isValidMaskBlurMethod = ( + val: unknown +): val is MaskBlurMethodParam => zMaskBlurMethod.safeParse(val).success; + // /** // * Zod schema for BaseModelType // */