diff --git a/invokeai/frontend/web/knip.ts b/invokeai/frontend/web/knip.ts index 0f7c8c2354..a47edbf6b4 100644 --- a/invokeai/frontend/web/knip.ts +++ b/invokeai/frontend/web/knip.ts @@ -4,16 +4,9 @@ const config: KnipConfig = { ignore: [ // This file is only used during debugging 'src/app/store/middleware/debugLoggerMiddleware.ts', - // These are old schemas, used in migrations. Needs cleanup. - 'src/features/nodes/types/v2/**/*', - 'src/features/nodes/types/v1/**/*', - // We don't want to check the public folder - contains images and translations - 'public/**/*', ], - compilers: { - // - svg: () => '', - }, + ignoreDependencies: ['@storybook/addon-docs', '@storybook/blocks', '@storybook/test', 'public/.*'], + ignoreBinaries: ['only-allow'], }; export default config; diff --git a/invokeai/frontend/web/src/app/store/enhancers/reduxRemember/errors.ts b/invokeai/frontend/web/src/app/store/enhancers/reduxRemember/errors.ts index 0ce113fc39..9704c49cf2 100644 --- a/invokeai/frontend/web/src/app/store/enhancers/reduxRemember/errors.ts +++ b/invokeai/frontend/web/src/app/store/enhancers/reduxRemember/errors.ts @@ -3,7 +3,7 @@ import { parseify } from 'common/util/serialize'; import { PersistError, RehydrateError } from 'redux-remember'; import { serializeError } from 'serialize-error'; -export type StorageErrorArgs = { +type StorageErrorArgs = { key: string; /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ // any is correct value?: any; diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/index.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/index.ts index 1c93140c03..bf1cafc866 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/index.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/index.ts @@ -1,4 +1,4 @@ -import type { ListenerEffect, TypedStartListening, UnknownAction } from '@reduxjs/toolkit'; +import type { TypedStartListening } from '@reduxjs/toolkit'; import { createListenerMiddleware } from '@reduxjs/toolkit'; import { addBulkDownloadListeners } from 'app/store/middleware/listenerMiddleware/listeners/bulkDownload'; import { addGalleryImageClickedListener } from 'app/store/middleware/listenerMiddleware/listeners/galleryImageClicked'; @@ -70,12 +70,10 @@ import { addWorkflowLoadRequestedListener } from './listeners/workflowLoadReques export const listenerMiddleware = createListenerMiddleware(); -export type AppStartListening = TypedStartListening; +type AppStartListening = TypedStartListening; export const startAppListening = listenerMiddleware.startListening as AppStartListening; -export type AppListenerEffect = ListenerEffect; - /** * The RTK listener middleware is a lightweight alternative sagas/observables. * diff --git a/invokeai/frontend/web/src/app/store/store.ts b/invokeai/frontend/web/src/app/store/store.ts index 19670aa29f..b538a3eaeb 100644 --- a/invokeai/frontend/web/src/app/store/store.ts +++ b/invokeai/frontend/web/src/app/store/store.ts @@ -185,7 +185,6 @@ export const createStore = (uniqueStoreKey?: string, persist = true) => }, }); -export type AppGetState = ReturnType['getState']>; export type RootState = ReturnType['getState']>; // eslint-disable-next-line @typescript-eslint/no-explicit-any export type AppThunkDispatch = ThunkDispatch; diff --git a/invokeai/frontend/web/src/common/hooks/useSingleAndDoubleClick.ts b/invokeai/frontend/web/src/common/hooks/useSingleAndDoubleClick.ts index 38594369d3..7a02ae54ec 100644 --- a/invokeai/frontend/web/src/common/hooks/useSingleAndDoubleClick.ts +++ b/invokeai/frontend/web/src/common/hooks/useSingleAndDoubleClick.ts @@ -1,7 +1,7 @@ // https://stackoverflow.com/a/73731908 import { useCallback, useEffect, useState } from 'react'; -export type UseSingleAndDoubleClickOptions = { +type UseSingleAndDoubleClickOptions = { onSingleClick: () => void; onDoubleClick: () => void; latency?: number; diff --git a/invokeai/frontend/web/src/common/types.ts b/invokeai/frontend/web/src/common/types.ts index 29a411788d..f3037dcc2b 100644 --- a/invokeai/frontend/web/src/common/types.ts +++ b/invokeai/frontend/web/src/common/types.ts @@ -1,7 +1,5 @@ -export type JSONValue = string | number | boolean | null | JSONValue[] | { [key: string]: JSONValue }; +type JSONValue = string | number | boolean | null | JSONValue[] | { [key: string]: JSONValue }; export interface JSONObject { [k: string]: JSONValue; } - -export interface JSONArray extends Array {} diff --git a/invokeai/frontend/web/src/common/util/generateSeeds.ts b/invokeai/frontend/web/src/common/util/generateSeeds.ts index 450068cae8..c79685feda 100644 --- a/invokeai/frontend/web/src/common/util/generateSeeds.ts +++ b/invokeai/frontend/web/src/common/util/generateSeeds.ts @@ -1,7 +1,7 @@ import { NUMPY_RAND_MAX, NUMPY_RAND_MIN } from 'app/constants'; import { random } from 'lodash-es'; -export type GenerateSeedsArg = { +type GenerateSeedsArg = { count: number; start?: number; min?: number; diff --git a/invokeai/frontend/web/src/features/canvas/store/canvasTypes.ts b/invokeai/frontend/web/src/features/canvas/store/canvasTypes.ts index 14248cd750..82793bffd4 100644 --- a/invokeai/frontend/web/src/features/canvas/store/canvasTypes.ts +++ b/invokeai/frontend/web/src/features/canvas/store/canvasTypes.ts @@ -15,7 +15,7 @@ export type BoundingBoxScaleMethod = z.infer; export const isBoundingBoxScaleMethod = (v: unknown): v is BoundingBoxScaleMethod => zBoundingBoxScaleMethod.safeParse(v).success; -export type CanvasDrawingTool = 'brush' | 'eraser'; +type CanvasDrawingTool = 'brush' | 'eraser'; export type CanvasTool = CanvasDrawingTool | 'move' | 'colorPicker'; @@ -53,7 +53,7 @@ export type CanvasBaseLine = { clip?: IRect; }; -export type CanvasFillRect = { +type CanvasFillRect = { kind: 'fillRect'; layer: 'base'; x: number; @@ -63,7 +63,7 @@ export type CanvasFillRect = { color: RgbaColor; }; -export type CanvasEraseRect = { +type CanvasEraseRect = { kind: 'eraseRect'; layer: 'base'; x: number; @@ -72,7 +72,7 @@ export type CanvasEraseRect = { height: number; }; -export type CanvasObject = CanvasImage | CanvasBaseLine | CanvasMaskLine | CanvasFillRect | CanvasEraseRect; +type CanvasObject = CanvasImage | CanvasBaseLine | CanvasMaskLine | CanvasFillRect | CanvasEraseRect; export type CanvasLayerState = { objects: CanvasObject[]; @@ -83,11 +83,6 @@ export type CanvasLayerState = { }; }; -export type CanvasSession = { - sessionId: string; - boundingBox: IRect; -}; - // type guards export const isCanvasMaskLine = (obj: CanvasObject): obj is CanvasMaskLine => obj.kind === 'line' && obj.layer === 'mask'; diff --git a/invokeai/frontend/web/src/features/controlAdapters/components/ControlAdapterProcessorComponent.tsx b/invokeai/frontend/web/src/features/controlAdapters/components/ControlAdapterProcessorComponent.tsx index 8679e7aff3..2e37d88e27 100644 --- a/invokeai/frontend/web/src/features/controlAdapters/components/ControlAdapterProcessorComponent.tsx +++ b/invokeai/frontend/web/src/features/controlAdapters/components/ControlAdapterProcessorComponent.tsx @@ -17,7 +17,7 @@ import NormalBaeProcessor from './processors/NormalBaeProcessor'; import PidiProcessor from './processors/PidiProcessor'; import ZoeDepthProcessor from './processors/ZoeDepthProcessor'; -export type Props = { +type Props = { id: string; }; diff --git a/invokeai/frontend/web/src/features/modelManagerV2/store/modelManagerV2Slice.ts b/invokeai/frontend/web/src/features/modelManagerV2/store/modelManagerV2Slice.ts index 10f1be75ad..46f8979c8e 100644 --- a/invokeai/frontend/web/src/features/modelManagerV2/store/modelManagerV2Slice.ts +++ b/invokeai/frontend/web/src/features/modelManagerV2/store/modelManagerV2Slice.ts @@ -1,6 +1,6 @@ import type { PayloadAction } from '@reduxjs/toolkit'; import { createSlice } from '@reduxjs/toolkit'; -import type { PersistConfig, RootState } from 'app/store/store'; +import type { PersistConfig } from 'app/store/store'; type ModelManagerState = { _version: 1; @@ -42,8 +42,6 @@ export const modelManagerV2Slice = createSlice({ export const { setSelectedModelKey, setSearchTerm, setFilteredModelType, setSelectedModelMode } = modelManagerV2Slice.actions; -export const selectModelManagerSlice = (state: RootState) => state.modelmanagerV2; - /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ const migrateModelManagerState = (state: any): any => { if (!('_version' in state)) { diff --git a/invokeai/frontend/web/src/features/parameters/store/postprocessingSlice.ts b/invokeai/frontend/web/src/features/parameters/store/postprocessingSlice.ts index e014f60570..65a30ab4d0 100644 --- a/invokeai/frontend/web/src/features/parameters/store/postprocessingSlice.ts +++ b/invokeai/frontend/web/src/features/parameters/store/postprocessingSlice.ts @@ -3,7 +3,7 @@ import { createSlice } from '@reduxjs/toolkit'; import type { PersistConfig, RootState } from 'app/store/store'; import { z } from 'zod'; -export const zParamESRGANModelName = z.enum([ +const zParamESRGANModelName = z.enum([ 'RealESRGAN_x4plus.pth', 'RealESRGAN_x4plus_anime_6B.pth', 'ESRGAN_SRx4_DF2KOST_official-ff704c30.pth', @@ -18,7 +18,7 @@ export interface PostprocessingState { esrganModelName: ParamESRGANModelName; } -export const initialPostprocessingState: PostprocessingState = { +const initialPostprocessingState: PostprocessingState = { _version: 1, esrganModelName: 'RealESRGAN_x4plus.pth', }; @@ -38,7 +38,7 @@ export const { esrganModelNameChanged } = postprocessingSlice.actions; export const selectPostprocessingSlice = (state: RootState) => state.postprocessing; /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ -export const migratePostprocessingState = (state: any): any => { +const migratePostprocessingState = (state: any): any => { if (!('_version' in state)) { state._version = 1; } diff --git a/invokeai/frontend/web/src/features/parameters/types/parameterSchemas.ts b/invokeai/frontend/web/src/features/parameters/types/parameterSchemas.ts index 0fc912a6d6..e2cc277d6a 100644 --- a/invokeai/frontend/web/src/features/parameters/types/parameterSchemas.ts +++ b/invokeai/frontend/web/src/features/parameters/types/parameterSchemas.ts @@ -16,68 +16,68 @@ import { z } from 'zod'; */ // #region Positive prompt -export const zParameterPositivePrompt = z.string(); +const zParameterPositivePrompt = z.string(); export type ParameterPositivePrompt = z.infer; export const isParameterPositivePrompt = (val: unknown): val is ParameterPositivePrompt => zParameterPositivePrompt.safeParse(val).success; // #endregion // #region Negative prompt -export const zParameterNegativePrompt = z.string(); +const zParameterNegativePrompt = z.string(); export type ParameterNegativePrompt = z.infer; export const isParameterNegativePrompt = (val: unknown): val is ParameterNegativePrompt => zParameterNegativePrompt.safeParse(val).success; // #endregion // #region Positive style prompt (SDXL) -export const zParameterPositiveStylePromptSDXL = z.string(); +const zParameterPositiveStylePromptSDXL = z.string(); export type ParameterPositiveStylePromptSDXL = z.infer; export const isParameterPositiveStylePromptSDXL = (val: unknown): val is ParameterPositiveStylePromptSDXL => zParameterPositiveStylePromptSDXL.safeParse(val).success; // #endregion // #region Positive style prompt (SDXL) -export const zParameterNegativeStylePromptSDXL = z.string(); +const zParameterNegativeStylePromptSDXL = z.string(); export type ParameterNegativeStylePromptSDXL = z.infer; export const isParameterNegativeStylePromptSDXL = (val: unknown): val is ParameterNegativeStylePromptSDXL => zParameterNegativeStylePromptSDXL.safeParse(val).success; // #endregion // #region Steps -export const zParameterSteps = z.number().int().min(1); +const zParameterSteps = z.number().int().min(1); export type ParameterSteps = z.infer; export const isParameterSteps = (val: unknown): val is ParameterSteps => zParameterSteps.safeParse(val).success; // #endregion // #region CFG scale parameter -export const zParameterCFGScale = z.number().min(1); +const zParameterCFGScale = z.number().min(1); export type ParameterCFGScale = z.infer; export const isParameterCFGScale = (val: unknown): val is ParameterCFGScale => zParameterCFGScale.safeParse(val).success; // #endregion // #region CFG Rescale Multiplier -export const zParameterCFGRescaleMultiplier = z.number().gte(0).lt(1); +const zParameterCFGRescaleMultiplier = z.number().gte(0).lt(1); export type ParameterCFGRescaleMultiplier = z.infer; export const isParameterCFGRescaleMultiplier = (val: unknown): val is ParameterCFGRescaleMultiplier => zParameterCFGRescaleMultiplier.safeParse(val).success; // #endregion // #region Scheduler -export const zParameterScheduler = zSchedulerField; +const zParameterScheduler = zSchedulerField; export type ParameterScheduler = z.infer; export const isParameterScheduler = (val: unknown): val is ParameterScheduler => zParameterScheduler.safeParse(val).success; // #endregion // #region seed -export const zParameterSeed = z.number().int().min(0).max(NUMPY_RAND_MAX); +const zParameterSeed = z.number().int().min(0).max(NUMPY_RAND_MAX); export type ParameterSeed = z.infer; export const isParameterSeed = (val: unknown): val is ParameterSeed => zParameterSeed.safeParse(val).success; // #endregion // #region Width -export const zParameterWidth = z +const zParameterWidth = z .number() .min(64) .transform((val) => roundToMultiple(val, 8)); @@ -86,96 +86,81 @@ export const isParameterWidth = (val: unknown): val is ParameterWidth => zParame // #endregion // #region Height -export const zParameterHeight = zParameterWidth; +const zParameterHeight = zParameterWidth; export type ParameterHeight = z.infer; export const isParameterHeight = (val: unknown): val is ParameterHeight => zParameterHeight.safeParse(val).success; // #endregion // #region Aspect Ratio -export const zParameterAspectRatio = z.number().int().min(0).max(6); +const zParameterAspectRatio = z.number().int().min(0).max(6); export type ParameterAspectRatio = z.infer; -export const isParameterAspectRatio = (val: unknown): val is ParameterAspectRatio => - zParameterAspectRatio.safeParse(val).success; // #endregion // #region Model export const zParameterModel = zModelIdentifierWithBase; export type ParameterModel = z.infer; -export const isParameterModel = (val: unknown): val is ParameterModel => zParameterModel.safeParse(val).success; // #endregion // #region SDXL Refiner Model -export const zParameterSDXLRefinerModel = zModelIdentifierWithBase; +const zParameterSDXLRefinerModel = zModelIdentifierWithBase; export type ParameterSDXLRefinerModel = z.infer; -export const isParameterSDXLRefinerModel = (val: unknown): val is ParameterSDXLRefinerModel => - zParameterSDXLRefinerModel.safeParse(val).success; // #endregion // #region VAE Model export const zParameterVAEModel = zModelIdentifierWithBase; export type ParameterVAEModel = z.infer; -export const isParameterVAEModel = (val: unknown): val is ParameterVAEModel => - zParameterVAEModel.safeParse(val).success; // #endregion // #region LoRA Model -export const zParameterLoRAModel = zModelIdentifierWithBase; +const zParameterLoRAModel = zModelIdentifierWithBase; export type ParameterLoRAModel = z.infer; -export const isParameterLoRAModel = (val: unknown): val is ParameterLoRAModel => - zParameterLoRAModel.safeParse(val).success; // #endregion // #region ControlNet Model -export const zParameterControlNetModel = zModelIdentifierWithBase; -export type ParameterControlNetModel = z.infer; -export const isParameterControlNetModel = (val: unknown): val is ParameterControlNetModel => - zParameterControlNetModel.safeParse(val).success; +const zParameterControlNetModel = zModelIdentifierWithBase; +export type ParameterControlNetModel = z.infer; // #endregion // #region IP Adapter Model -export const zParameterIPAdapterModel = zModelIdentifierWithBase; +const zParameterIPAdapterModel = zModelIdentifierWithBase; export type ParameterIPAdapterModel = z.infer; -export const isParameterIPAdapterModel = (val: unknown): val is ParameterIPAdapterModel => - zParameterIPAdapterModel.safeParse(val).success; // #endregion // #region T2I Adapter Model -export const zParameterT2IAdapterModel = zModelIdentifierWithBase; +const zParameterT2IAdapterModel = zModelIdentifierWithBase; export type ParameterT2IAdapterModel = z.infer; -export const isParameterT2IAdapterModel = (val: unknown): val is ParameterT2IAdapterModel => - zParameterT2IAdapterModel.safeParse(val).success; // #endregion // #region Strength (l2l strength) -export const zParameterStrength = z.number().min(0).max(1); +const zParameterStrength = z.number().min(0).max(1); export type ParameterStrength = z.infer; export const isParameterStrength = (val: unknown): val is ParameterStrength => zParameterStrength.safeParse(val).success; // #endregion // #region Precision -export const zParameterPrecision = z.enum(['fp16', 'fp32']); +const zParameterPrecision = z.enum(['fp16', 'fp32']); export type ParameterPrecision = z.infer; export const isParameterPrecision = (val: unknown): val is ParameterPrecision => zParameterPrecision.safeParse(val).success; // #endregion // #region HRF Method -export const zParameterHRFMethod = z.enum(['ESRGAN', 'bilinear']); +const zParameterHRFMethod = z.enum(['ESRGAN', 'bilinear']); export type ParameterHRFMethod = z.infer; export const isParameterHRFMethod = (val: unknown): val is ParameterHRFMethod => zParameterHRFMethod.safeParse(val).success; // #endregion // #region HRF Enabled -export const zParameterHRFEnabled = z.boolean(); +const zParameterHRFEnabled = z.boolean(); export type ParameterHRFEnabled = z.infer; export const isParameterHRFEnabled = (val: unknown): val is boolean => zParameterHRFEnabled.safeParse(val).success && val !== null && val !== undefined; // #endregion // #region SDXL Refiner Positive Aesthetic Score -export const zParameterSDXLRefinerPositiveAestheticScore = z.number().min(1).max(10); +const zParameterSDXLRefinerPositiveAestheticScore = z.number().min(1).max(10); export type ParameterSDXLRefinerPositiveAestheticScore = z.infer; export const isParameterSDXLRefinerPositiveAestheticScore = ( val: unknown @@ -184,7 +169,7 @@ export const isParameterSDXLRefinerPositiveAestheticScore = ( // #endregion // #region SDXL Refiner Negative Aesthetic Score -export const zParameterSDXLRefinerNegativeAestheticScore = zParameterSDXLRefinerPositiveAestheticScore; +const zParameterSDXLRefinerNegativeAestheticScore = zParameterSDXLRefinerPositiveAestheticScore; export type ParameterSDXLRefinerNegativeAestheticScore = z.infer; export const isParameterSDXLRefinerNegativeAestheticScore = ( val: unknown @@ -193,28 +178,26 @@ export const isParameterSDXLRefinerNegativeAestheticScore = ( // #endregion // #region SDXL Refiner Start -export const zParameterSDXLRefinerStart = z.number().min(0).max(1); +const zParameterSDXLRefinerStart = z.number().min(0).max(1); export type ParameterSDXLRefinerStart = z.infer; export const isParameterSDXLRefinerStart = (val: unknown): val is ParameterSDXLRefinerStart => zParameterSDXLRefinerStart.safeParse(val).success; // #endregion // #region Mask Blur Method -export const zParameterMaskBlurMethod = z.enum(['box', 'gaussian']); +const zParameterMaskBlurMethod = z.enum(['box', 'gaussian']); export type ParameterMaskBlurMethod = z.infer; -export const isParameterMaskBlurMethod = (val: unknown): val is ParameterMaskBlurMethod => - zParameterMaskBlurMethod.safeParse(val).success; // #endregion // #region Canvas Coherence Mode -export const zParameterCanvasCoherenceMode = z.enum(['Gaussian Blur', 'Box Blur', 'Staged']); +const zParameterCanvasCoherenceMode = z.enum(['Gaussian Blur', 'Box Blur', 'Staged']); export type ParameterCanvasCoherenceMode = z.infer; export const isParameterCanvasCoherenceMode = (val: unknown): val is ParameterCanvasCoherenceMode => zParameterCanvasCoherenceMode.safeParse(val).success; // #endregion // #region LoRA weight -export const zLoRAWeight = z.number(); +const zLoRAWeight = z.number(); export type ParameterLoRAWeight = z.infer; export const isParameterLoRAWeight = (val: unknown): val is ParameterLoRAWeight => zLoRAWeight.safeParse(val).success; // #endregion diff --git a/invokeai/frontend/web/src/features/queue/store/queueSlice.ts b/invokeai/frontend/web/src/features/queue/store/queueSlice.ts index 340dff5104..a5750712c3 100644 --- a/invokeai/frontend/web/src/features/queue/store/queueSlice.ts +++ b/invokeai/frontend/web/src/features/queue/store/queueSlice.ts @@ -1,6 +1,5 @@ import type { PayloadAction } from '@reduxjs/toolkit'; import { createSlice } from '@reduxjs/toolkit'; -import type { RootState } from 'app/store/store'; export interface QueueState { listCursor: number | undefined; @@ -9,18 +8,16 @@ export interface QueueState { resumeProcessorOnEnqueue: boolean; } -export const initialQueueState: QueueState = { +const initialQueueState: QueueState = { listCursor: undefined, listPriority: undefined, selectedQueueItem: undefined, resumeProcessorOnEnqueue: true, }; -const initialState: QueueState = initialQueueState; - export const queueSlice = createSlice({ name: 'queue', - initialState, + initialState: initialQueueState, reducers: { listCursorChanged: (state, action: PayloadAction) => { state.listCursor = action.payload; @@ -32,25 +29,7 @@ export const queueSlice = createSlice({ state.listCursor = undefined; state.listPriority = undefined; }, - queueItemSelectionToggled: (state, action: PayloadAction) => { - if (state.selectedQueueItem === action.payload) { - state.selectedQueueItem = undefined; - } else { - state.selectedQueueItem = action.payload; - } - }, - resumeProcessorOnEnqueueChanged: (state, action: PayloadAction) => { - state.resumeProcessorOnEnqueue = action.payload; - }, }, }); -export const { - listCursorChanged, - listPriorityChanged, - listParamsReset, - queueItemSelectionToggled, - resumeProcessorOnEnqueueChanged, -} = queueSlice.actions; - -export const selectQueueSlice = (state: RootState) => state.queue; +export const { listCursorChanged, listPriorityChanged, listParamsReset } = queueSlice.actions; diff --git a/invokeai/frontend/web/src/features/sdxl/store/sdxlSlice.ts b/invokeai/frontend/web/src/features/sdxl/store/sdxlSlice.ts index efa5f1c8bd..88061a28f6 100644 --- a/invokeai/frontend/web/src/features/sdxl/store/sdxlSlice.ts +++ b/invokeai/frontend/web/src/features/sdxl/store/sdxlSlice.ts @@ -22,7 +22,7 @@ type SDXLState = { refinerStart: number; }; -export const initialSDXLState: SDXLState = { +const initialSDXLState: SDXLState = { _version: 1, positiveStylePrompt: '', negativeStylePrompt: '', @@ -89,7 +89,7 @@ export const { export const selectSdxlSlice = (state: RootState) => state.sdxl; /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ -export const migrateSDXLState = (state: any): any => { +const migrateSDXLState = (state: any): any => { if (!('_version' in state)) { state._version = 1; } diff --git a/invokeai/frontend/web/src/features/system/components/StickyScrollable.tsx b/invokeai/frontend/web/src/features/system/components/StickyScrollable.tsx index 073b7f5f89..9359731d5b 100644 --- a/invokeai/frontend/web/src/features/system/components/StickyScrollable.tsx +++ b/invokeai/frontend/web/src/features/system/components/StickyScrollable.tsx @@ -2,11 +2,11 @@ import { Flex, Heading } from '@invoke-ai/ui-library'; import type { PropsWithChildren } from 'react'; import { memo } from 'react'; -export type StickyScrollableHeadingProps = { +type StickyScrollableHeadingProps = { title: string; }; -export const StickyScrollableHeading = memo((props: StickyScrollableHeadingProps) => { +const StickyScrollableHeading = memo((props: StickyScrollableHeadingProps) => { return ( {props.title} @@ -16,9 +16,9 @@ export const StickyScrollableHeading = memo((props: StickyScrollableHeadingProps StickyScrollableHeading.displayName = 'StickyScrollableHeading'; -export type StickyScrollableContentProps = PropsWithChildren; +type StickyScrollableContentProps = PropsWithChildren; -export const StickyScrollableContent = memo((props: StickyScrollableContentProps) => { +const StickyScrollableContent = memo((props: StickyScrollableContentProps) => { return ( {props.children} diff --git a/invokeai/frontend/web/src/features/system/store/configSlice.ts b/invokeai/frontend/web/src/features/system/store/configSlice.ts index ded3241c5b..4e1b734a66 100644 --- a/invokeai/frontend/web/src/features/system/store/configSlice.ts +++ b/invokeai/frontend/web/src/features/system/store/configSlice.ts @@ -14,7 +14,7 @@ const baseDimensionConfig: NumericalParameterConfig = { coarseStep: 64, }; -export const initialConfigState: AppConfig = { +const initialConfigState: AppConfig = { shouldUpdateImagesOnConnect: false, shouldFetchMetadataFromApi: false, disabledTabs: [], diff --git a/invokeai/frontend/web/src/features/system/store/systemSlice.ts b/invokeai/frontend/web/src/features/system/store/systemSlice.ts index 589397e951..17ddec5471 100644 --- a/invokeai/frontend/web/src/features/system/store/systemSlice.ts +++ b/invokeai/frontend/web/src/features/system/store/systemSlice.ts @@ -24,7 +24,7 @@ import { import type { Language, SystemState } from './types'; -export const initialSystemState: SystemState = { +const initialSystemState: SystemState = { _version: 1, isConnected: false, shouldConfirmOnDelete: true, @@ -199,7 +199,7 @@ const isAnyServerError = isAnyOf(socketInvocationError, socketSessionRetrievalEr export const selectSystemSlice = (state: RootState) => state.system; /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ -export const migrateSystemState = (state: any): any => { +const migrateSystemState = (state: any): any => { if (!('_version' in state)) { state._version = 1; } diff --git a/invokeai/frontend/web/src/features/system/store/types.ts b/invokeai/frontend/web/src/features/system/store/types.ts index 3575501d86..c8790e0104 100644 --- a/invokeai/frontend/web/src/features/system/store/types.ts +++ b/invokeai/frontend/web/src/features/system/store/types.ts @@ -15,7 +15,7 @@ export type DenoiseProgress = { percentage: number; }; -export const zLanguage = z.enum([ +const zLanguage = z.enum([ 'ar', 'az', 'de', @@ -58,11 +58,3 @@ export interface SystemState { status: SystemStatus; shouldEnableInformationalPopovers: boolean; } - -export const STATUS_TRANSLATION_KEYS: Record = { - CONNECTED: 'common.statusConnected', - DISCONNECTED: 'common.statusDisconnected', - PROCESSING: 'common.statusProcessing', - ERROR: 'common.statusError', - LOADING_MODEL: 'common.statusLoadingModel', -}; diff --git a/invokeai/frontend/web/src/features/ui/components/InvokeTabs.tsx b/invokeai/frontend/web/src/features/ui/components/InvokeTabs.tsx index efff22bb02..c6682e33fc 100644 --- a/invokeai/frontend/web/src/features/ui/components/InvokeTabs.tsx +++ b/invokeai/frontend/web/src/features/ui/components/InvokeTabs.tsx @@ -85,8 +85,8 @@ const enabledTabsSelector = createMemoizedSelector(selectConfigSlice, (config) = tabs.filter((tab) => !config.disabledTabs.includes(tab.id)) ); -export const NO_GALLERY_PANEL_TABS: InvokeTabName[] = ['modelManager', 'queue']; -export const NO_OPTIONS_PANEL_TABS: InvokeTabName[] = ['modelManager', 'queue']; +const NO_GALLERY_PANEL_TABS: InvokeTabName[] = ['modelManager', 'queue']; +const NO_OPTIONS_PANEL_TABS: InvokeTabName[] = ['modelManager', 'queue']; const panelStyles: CSSProperties = { height: '100%', width: '100%' }; const GALLERY_MIN_SIZE_PX = 310; const GALLERY_MIN_SIZE_PCT = 20; diff --git a/invokeai/frontend/web/src/features/ui/store/uiSlice.ts b/invokeai/frontend/web/src/features/ui/store/uiSlice.ts index 32eb26673a..f9a4b94805 100644 --- a/invokeai/frontend/web/src/features/ui/store/uiSlice.ts +++ b/invokeai/frontend/web/src/features/ui/store/uiSlice.ts @@ -6,7 +6,7 @@ import { initialImageChanged } from 'features/parameters/store/generationSlice'; import type { InvokeTabName } from './tabMap'; import type { UIState } from './uiTypes'; -export const initialUIState: UIState = { +const initialUIState: UIState = { _version: 1, activeTab: 'txt2img', shouldShowImageDetails: false, @@ -60,7 +60,7 @@ export const { export const selectUiSlice = (state: RootState) => state.ui; /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ -export const migrateUIState = (state: any): any => { +const migrateUIState = (state: any): any => { if (!('_version' in state)) { state._version = 1; } diff --git a/invokeai/frontend/web/src/services/api/endpoints/boards.ts b/invokeai/frontend/web/src/services/api/endpoints/boards.ts index 8efda86737..106cfd59d3 100644 --- a/invokeai/frontend/web/src/services/api/endpoints/boards.ts +++ b/invokeai/frontend/web/src/services/api/endpoints/boards.ts @@ -1,11 +1,5 @@ import { ASSETS_CATEGORIES, IMAGE_CATEGORIES } from 'features/gallery/store/types'; -import type { - BoardDTO, - ListBoardsArg, - OffsetPaginatedResults_BoardDTO_, - OffsetPaginatedResults_ImageDTO_, - UpdateBoardArg, -} from 'services/api/types'; +import type { BoardDTO, OffsetPaginatedResults_ImageDTO_, UpdateBoardArg } from 'services/api/types'; import { getListImagesUrl } from 'services/api/util'; import type { ApiTagDescription } from '..'; @@ -24,26 +18,6 @@ export const boardsApi = api.injectEndpoints({ /** * Boards Queries */ - listBoards: build.query({ - query: (arg) => ({ url: buildBoardsUrl(), params: arg }), - providesTags: (result) => { - // any list of boards - const tags: ApiTagDescription[] = [{ type: 'Board', id: LIST_TAG }, 'FetchOnReconnect']; - - if (result) { - // and individual tags for each board - tags.push( - ...result.items.map(({ board_id }) => ({ - type: 'Board' as const, - id: board_id, - })) - ); - } - - return tags; - }, - }), - listAllBoards: build.query, void>({ query: () => ({ url: buildBoardsUrl(), @@ -134,7 +108,6 @@ export const boardsApi = api.injectEndpoints({ }); export const { - useListBoardsQuery, useListAllBoardsQuery, useGetBoardImagesTotalQuery, useGetBoardAssetsTotalQuery, diff --git a/invokeai/frontend/web/src/services/api/endpoints/images.ts b/invokeai/frontend/web/src/services/api/endpoints/images.ts index 1849e2fde4..672ba01c26 100644 --- a/invokeai/frontend/web/src/services/api/endpoints/images.ts +++ b/invokeai/frontend/web/src/services/api/endpoints/images.ts @@ -376,40 +376,6 @@ export const imagesApi = api.injectEndpoints({ } }, }), - /** - * Change an image's `session_id` association. - */ - changeImageSessionId: build.mutation({ - query: ({ imageDTO, session_id }) => ({ - url: buildImagesUrl(`i/${imageDTO.image_name}`), - method: 'PATCH', - body: { session_id }, - }), - async onQueryStarted({ imageDTO, session_id }, { dispatch, queryFulfilled }) { - /** - * Cache changes for `changeImageSessionId`: - * - *update* getImageDTO - */ - - // Store patches so we can undo if the query fails - const patches: PatchCollection[] = []; - - // *update* getImageDTO - patches.push( - dispatch( - imagesApi.util.updateQueryData('getImageDTO', imageDTO.image_name, (draft) => { - Object.assign(draft, { session_id }); - }) - ) - ); - - try { - await queryFulfilled; - } catch { - patches.forEach((patchResult) => patchResult.undo()); - } - }, - }), /** * Star a list of images. */ @@ -1336,13 +1302,10 @@ export const imagesApi = api.injectEndpoints({ export const { useGetIntermediatesCountQuery, useListImagesQuery, - useLazyListImagesQuery, useGetImageDTOQuery, useGetImageMetadataQuery, useGetImageWorkflowQuery, useLazyGetImageWorkflowQuery, - useDeleteImageMutation, - useDeleteImagesMutation, useUploadImageMutation, useClearIntermediatesMutation, useAddImagesToBoardMutation, @@ -1350,7 +1313,6 @@ export const { useAddImageToBoardMutation, useRemoveImageFromBoardMutation, useChangeImageIsIntermediateMutation, - useChangeImageSessionIdMutation, useDeleteBoardAndImagesMutation, useDeleteBoardMutation, useStarImagesMutation, diff --git a/invokeai/frontend/web/src/services/api/endpoints/models.ts b/invokeai/frontend/web/src/services/api/endpoints/models.ts index a236868b79..e7e63eeecc 100644 --- a/invokeai/frontend/web/src/services/api/endpoints/models.ts +++ b/invokeai/frontend/web/src/services/api/endpoints/models.ts @@ -66,50 +66,45 @@ type ScanFolderArg = operations['scan_for_models']['parameters']['query']; export type GetByAttrsArg = operations['get_model_records_by_attrs']['parameters']['query']; -export const mainModelsAdapter = createEntityAdapter({ +const mainModelsAdapter = createEntityAdapter({ selectId: (entity) => entity.key, sortComparer: (a, b) => a.name.localeCompare(b.name), }); export const mainModelsAdapterSelectors = mainModelsAdapter.getSelectors(undefined, getSelectorsOptions); -export const loraModelsAdapter = createEntityAdapter({ +const loraModelsAdapter = createEntityAdapter({ selectId: (entity) => entity.key, sortComparer: (a, b) => a.name.localeCompare(b.name), }); -export const loraModelsAdapterSelectors = loraModelsAdapter.getSelectors(undefined, getSelectorsOptions); -export const controlNetModelsAdapter = createEntityAdapter({ +const controlNetModelsAdapter = createEntityAdapter({ selectId: (entity) => entity.key, sortComparer: (a, b) => a.name.localeCompare(b.name), }); export const controlNetModelsAdapterSelectors = controlNetModelsAdapter.getSelectors(undefined, getSelectorsOptions); -export const ipAdapterModelsAdapter = createEntityAdapter({ +const ipAdapterModelsAdapter = createEntityAdapter({ selectId: (entity) => entity.key, sortComparer: (a, b) => a.name.localeCompare(b.name), }); export const ipAdapterModelsAdapterSelectors = ipAdapterModelsAdapter.getSelectors(undefined, getSelectorsOptions); -export const t2iAdapterModelsAdapter = createEntityAdapter({ +const t2iAdapterModelsAdapter = createEntityAdapter({ selectId: (entity) => entity.key, sortComparer: (a, b) => a.name.localeCompare(b.name), }); export const t2iAdapterModelsAdapterSelectors = t2iAdapterModelsAdapter.getSelectors(undefined, getSelectorsOptions); -export const textualInversionModelsAdapter = createEntityAdapter({ +const textualInversionModelsAdapter = createEntityAdapter({ selectId: (entity) => entity.key, sortComparer: (a, b) => a.name.localeCompare(b.name), }); -export const textualInversionModelsAdapterSelectors = textualInversionModelsAdapter.getSelectors( - undefined, - getSelectorsOptions -); -export const vaeModelsAdapter = createEntityAdapter({ +const vaeModelsAdapter = createEntityAdapter({ selectId: (entity) => entity.key, sortComparer: (a, b) => a.name.localeCompare(b.name), }); export const vaeModelsAdapterSelectors = vaeModelsAdapter.getSelectors(undefined, getSelectorsOptions); -export const anyModelConfigAdapter = createEntityAdapter({ +const anyModelConfigAdapter = createEntityAdapter({ selectId: (entity) => entity.key, sortComparer: (a, b) => a.name.localeCompare(b.name), }); -export const anyModelConfigAdapterSelectors = anyModelConfigAdapter.getSelectors(undefined, getSelectorsOptions); +const anyModelConfigAdapterSelectors = anyModelConfigAdapter.getSelectors(undefined, getSelectorsOptions); const buildProvidesTags = (tagType: (typeof tagTypes)[number]) => @@ -338,7 +333,6 @@ export const modelsApi = api.injectEndpoints({ }); export const { - useGetModelConfigByAttrsQuery, useGetModelConfigQuery, useGetMainModelsQuery, useGetControlNetModelsQuery, @@ -352,7 +346,6 @@ export const { useInstallModelMutation, useConvertMainModelsMutation, useSyncModelsMutation, - useScanModelsQuery, useLazyScanModelsQuery, useGetModelImportsQuery, useGetModelMetadataQuery, diff --git a/invokeai/frontend/web/src/services/api/endpoints/queue.ts b/invokeai/frontend/web/src/services/api/endpoints/queue.ts index 385aa8ad12..4775c293f8 100644 --- a/invokeai/frontend/web/src/services/api/endpoints/queue.ts +++ b/invokeai/frontend/web/src/services/api/endpoints/queue.ts @@ -314,10 +314,8 @@ export const { useResumeProcessorMutation, useClearQueueMutation, usePruneQueueMutation, - useGetCurrentQueueItemQuery, useGetQueueStatusQuery, useGetQueueItemQuery, - useGetNextQueueItemQuery, useListQueueItemsQuery, useCancelQueueItemMutation, useGetBatchStatusQuery, diff --git a/invokeai/frontend/web/src/services/api/endpoints/utilities.ts b/invokeai/frontend/web/src/services/api/endpoints/utilities.ts index 309dd2dc79..a2e2e47c70 100644 --- a/invokeai/frontend/web/src/services/api/endpoints/utilities.ts +++ b/invokeai/frontend/web/src/services/api/endpoints/utilities.ts @@ -28,5 +28,3 @@ export const utilitiesApi = api.injectEndpoints({ }), }), }); - -export const { useDynamicPromptsQuery } = utilitiesApi; diff --git a/invokeai/frontend/web/src/services/api/types.ts b/invokeai/frontend/web/src/services/api/types.ts index 314eb07bfa..c57d242f97 100644 --- a/invokeai/frontend/web/src/services/api/types.ts +++ b/invokeai/frontend/web/src/services/api/types.ts @@ -101,10 +101,6 @@ export const isT2IAdapterModelConfig = (config: AnyModelConfig): config is T2IAd return config.type === 't2i_adapter'; }; -export const isTextualInversionModelConfig = (config: AnyModelConfig): config is TextualInversionModelConfig => { - return config.type === 'embedding'; -}; - export const isNonRefinerMainModelConfig = (config: AnyModelConfig): config is MainModelConfig => { return config.type === 'main' && config.base !== 'sdxl-refiner'; };