Remove circular dependencies in frontend

This commit is contained in:
Kaspar Emanuel 2022-12-14 22:34:25 +00:00 committed by blessedcoolant
parent 2a2f38a016
commit 392c0725f3
131 changed files with 917 additions and 220 deletions

View File

@ -8,6 +8,8 @@
"build": "tsc && vite build", "build": "tsc && vite build",
"build-dev": "tsc && vite build -m development", "build-dev": "tsc && vite build -m development",
"preview": "vite preview", "preview": "vite preview",
"madge": "madge --circular src/main.tsx",
"lint": "eslint src/",
"postinstall": "patch-package" "postinstall": "patch-package"
}, },
"dependencies": { "dependencies": {
@ -58,6 +60,7 @@
"eslint": "^8.23.0", "eslint": "^8.23.0",
"eslint-plugin-prettier": "^4.2.1", "eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-hooks": "^4.6.0",
"madge": "^5.0.1",
"patch-package": "^6.5.0", "patch-package": "^6.5.0",
"postinstall-postinstall": "^2.1.0", "postinstall-postinstall": "^2.1.0",
"sass": "^1.55.0", "sass": "^1.55.0",
@ -67,5 +70,15 @@
"vite": "^3.0.7", "vite": "^3.0.7",
"vite-plugin-eslint": "^1.8.1", "vite-plugin-eslint": "^1.8.1",
"vite-tsconfig-paths": "^3.5.2" "vite-tsconfig-paths": "^3.5.2"
},
"madge": {
"detectiveOptions": {
"ts": {
"skipTypeImports": true
},
"tsx": {
"skipTypeImports": true
}
}
} }
} }

View File

@ -12,8 +12,7 @@
* 'gfpgan'. * 'gfpgan'.
*/ */
import { Category as GalleryCategory } from 'features/gallery/store/gallerySlice'; import { InvokeTabName } from 'features/tabs/tabMap';
import { InvokeTabName } from 'features/tabs/components/InvokeTabs';
import { IRect } from 'konva/lib/types'; import { IRect } from 'konva/lib/types';
/** /**

View File

@ -1,6 +1,6 @@
import { createAction } from '@reduxjs/toolkit'; import { createAction } from '@reduxjs/toolkit';
import { GalleryCategory } from 'features/gallery/store/gallerySlice'; import { GalleryCategory } from 'features/gallery/store/gallerySlice';
import { InvokeTabName } from 'features/tabs/components/InvokeTabs'; import { InvokeTabName } from 'features/tabs/tabMap';
import * as InvokeAI from 'app/invokeai'; import * as InvokeAI from 'app/invokeai';
/** /**

View File

@ -17,9 +17,9 @@ import {
modelChangeRequested, modelChangeRequested,
setIsProcessing, setIsProcessing,
} from 'features/system/store/systemSlice'; } from 'features/system/store/systemSlice';
import { InvokeTabName } from 'features/tabs/components/InvokeTabs'; import { InvokeTabName } from 'features/tabs/tabMap';
import * as InvokeAI from 'app/invokeai'; import * as InvokeAI from 'app/invokeai';
import { RootState } from 'app/store'; import type { RootState } from 'app/store';
/** /**
* Returns an object containing all functions which use `socketio.emit()`. * Returns an object containing all functions which use `socketio.emit()`.

View File

@ -39,7 +39,7 @@ import {
requestSystemConfig, requestSystemConfig,
} from './actions'; } from './actions';
import { addImageToStagingArea } from 'features/canvas/store/canvasSlice'; import { addImageToStagingArea } from 'features/canvas/store/canvasSlice';
import { tabMap } from 'features/tabs/components/InvokeTabs'; import { tabMap } from 'features/tabs/tabMap';
/** /**
* Returns an object containing listener callbacks for socketio events. * Returns an object containing listener callbacks for socketio events.

View File

@ -1,6 +1,4 @@
import { combineReducers, configureStore } from '@reduxjs/toolkit'; import { combineReducers, configureStore } from '@reduxjs/toolkit';
import { useDispatch, useSelector } from 'react-redux';
import type { TypedUseSelectorHook } from 'react-redux';
import { persistReducer } from 'redux-persist'; import { persistReducer } from 'redux-persist';
import storage from 'redux-persist/lib/storage'; // defaults to localStorage for web import storage from 'redux-persist/lib/storage'; // defaults to localStorage for web
@ -101,7 +99,3 @@ export const store = configureStore({
export type AppGetState = typeof store.getState; export type AppGetState = typeof store.getState;
export type RootState = ReturnType<typeof store.getState>; export type RootState = ReturnType<typeof store.getState>;
export type AppDispatch = typeof store.dispatch; export type AppDispatch = typeof store.dispatch;
// Use throughout your app instead of plain `useDispatch` and `useSelector`
export const useAppDispatch: () => AppDispatch = useDispatch;
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;

View File

@ -0,0 +1,6 @@
import { TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux';
import { AppDispatch, RootState } from './store';
// Use throughout your app instead of plain `useDispatch` and `useSelector`
export const useAppDispatch: () => AppDispatch = useDispatch;
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;

View File

@ -6,7 +6,7 @@ import {
Box, Box,
} from '@chakra-ui/react'; } from '@chakra-ui/react';
import { SystemState } from 'features/system/store/systemSlice'; import { SystemState } from 'features/system/store/systemSlice';
import { useAppSelector } from 'app/store'; import { useAppSelector } from 'app/storeHooks';
import { RootState } from 'app/store'; import { RootState } from 'app/store';
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import { ReactElement } from 'react'; import { ReactElement } from 'react';

View File

@ -5,7 +5,7 @@ import {
useEffect, useEffect,
KeyboardEvent, KeyboardEvent,
} from 'react'; } from 'react';
import { useAppDispatch, useAppSelector } from 'app/store'; import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import { FileRejection, useDropzone } from 'react-dropzone'; import { FileRejection, useDropzone } from 'react-dropzone';
import { useToast } from '@chakra-ui/react'; import { useToast } from '@chakra-ui/react';
import { ImageUploaderTriggerContext } from 'app/contexts/ImageUploaderTriggerContext'; import { ImageUploaderTriggerContext } from 'app/contexts/ImageUploaderTriggerContext';

View File

@ -4,11 +4,8 @@ import { SystemState } from 'features/system/store/systemSlice';
import { stringToSeedWeightsArray } from './seedWeightPairs'; import { stringToSeedWeightsArray } from './seedWeightPairs';
import randomInt from './randomInt'; import randomInt from './randomInt';
import { InvokeTabName } from 'features/tabs/components/InvokeTabs'; import { InvokeTabName } from 'features/tabs/tabMap';
import { import { CanvasState, isCanvasMaskLine } from 'features/canvas/store/canvasTypes';
CanvasState,
isCanvasMaskLine,
} from 'features/canvas/store/canvasTypes';
import generateMask from 'features/canvas/util/generateMask'; import generateMask from 'features/canvas/util/generateMask';
import openBase64ImageInTab from './openBase64ImageInTab'; import openBase64ImageInTab from './openBase64ImageInTab';
import { getCanvasBaseLayer } from 'features/canvas/util/konvaInstanceProvider'; import { getCanvasBaseLayer } from 'features/canvas/util/konvaInstanceProvider';

View File

@ -1,4 +1,4 @@
import { useAppDispatch, useAppSelector } from 'app/store'; import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import IAIAlertDialog from 'common/components/IAIAlertDialog'; import IAIAlertDialog from 'common/components/IAIAlertDialog';
import IAIButton from 'common/components/IAIButton'; import IAIButton from 'common/components/IAIButton';
import { clearCanvasHistory } from 'features/canvas/store/canvasSlice'; import { clearCanvasHistory } from 'features/canvas/store/canvasSlice';

View File

@ -1,7 +1,7 @@
import { useCallback, useRef } from 'react'; import { useCallback, useRef } from 'react';
import Konva from 'konva'; import Konva from 'konva';
import { Layer, Stage } from 'react-konva'; import { Layer, Stage } from 'react-konva';
import { useAppSelector } from 'app/store'; import { useAppSelector } from 'app/storeHooks';
import { import {
canvasSelector, canvasSelector,
isStagingSelector, isStagingSelector,

View File

@ -1,5 +1,5 @@
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import { useAppSelector } from 'app/store'; import { useAppSelector } from 'app/storeHooks';
import _ from 'lodash'; import _ from 'lodash';
import { Group, Rect } from 'react-konva'; import { Group, Rect } from 'react-konva';
import { canvasSelector } from '../store/canvasSelectors'; import { canvasSelector } from '../store/canvasSelectors';

View File

@ -2,7 +2,7 @@
import { useColorMode } from '@chakra-ui/react'; import { useColorMode } from '@chakra-ui/react';
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import { useAppSelector } from 'app/store'; import { useAppSelector } from 'app/storeHooks';
import _ from 'lodash'; import _ from 'lodash';
import { ReactNode, useCallback, useLayoutEffect, useState } from 'react'; import { ReactNode, useCallback, useLayoutEffect, useState } from 'react';
import { Group, Line as KonvaLine } from 'react-konva'; import { Group, Line as KonvaLine } from 'react-konva';

View File

@ -1,5 +1,6 @@
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import { RootState, useAppSelector } from 'app/store'; import { RootState } from 'app/store';
import { useAppSelector } from 'app/storeHooks';
import { GalleryState } from 'features/gallery/store/gallerySlice'; import { GalleryState } from 'features/gallery/store/gallerySlice';
import { ImageConfig } from 'konva/lib/shapes/Image'; import { ImageConfig } from 'konva/lib/shapes/Image';
import _ from 'lodash'; import _ from 'lodash';

View File

@ -1,5 +1,5 @@
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import { useAppSelector } from 'app/store'; import { useAppSelector } from 'app/storeHooks';
import { RectConfig } from 'konva/lib/shapes/Rect'; import { RectConfig } from 'konva/lib/shapes/Rect';
import { Rect } from 'react-konva'; import { Rect } from 'react-konva';
import { canvasSelector } from 'features/canvas/store/canvasSelectors'; import { canvasSelector } from 'features/canvas/store/canvasSelectors';

View File

@ -1,6 +1,6 @@
import { GroupConfig } from 'konva/lib/Group'; import { GroupConfig } from 'konva/lib/Group';
import { Group, Line } from 'react-konva'; import { Group, Line } from 'react-konva';
import { useAppSelector } from 'app/store'; import { useAppSelector } from 'app/storeHooks';
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import { canvasSelector } from 'features/canvas/store/canvasSelectors'; import { canvasSelector } from 'features/canvas/store/canvasSelectors';
import { isCanvasMaskLine } from '../store/canvasTypes'; import { isCanvasMaskLine } from '../store/canvasTypes';

View File

@ -1,5 +1,5 @@
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import { useAppSelector } from 'app/store'; import { useAppSelector } from 'app/storeHooks';
import _ from 'lodash'; import _ from 'lodash';
import { Group, Line, Rect } from 'react-konva'; import { Group, Line, Rect } from 'react-konva';
import { import {

View File

@ -1,6 +1,6 @@
import { Spinner } from '@chakra-ui/react'; import { Spinner } from '@chakra-ui/react';
import { useLayoutEffect, useRef } from 'react'; import { useLayoutEffect, useRef } from 'react';
import { useAppDispatch, useAppSelector } from 'app/store'; import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import { activeTabNameSelector } from 'features/options/store/optionsSelectors'; import { activeTabNameSelector } from 'features/options/store/optionsSelectors';
import { import {
resizeAndScaleCanvas, resizeAndScaleCanvas,

View File

@ -1,5 +1,5 @@
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import { useAppSelector } from 'app/store'; import { useAppSelector } from 'app/storeHooks';
import { GroupConfig } from 'konva/lib/Group'; import { GroupConfig } from 'konva/lib/Group';
import _ from 'lodash'; import _ from 'lodash';
import { Group, Rect } from 'react-konva'; import { Group, Rect } from 'react-konva';

View File

@ -1,6 +1,6 @@
import { ButtonGroup, Flex } from '@chakra-ui/react'; import { ButtonGroup, Flex } from '@chakra-ui/react';
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import { useAppDispatch, useAppSelector } from 'app/store'; import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import IAIIconButton from 'common/components/IAIIconButton'; import IAIIconButton from 'common/components/IAIIconButton';
import _ from 'lodash'; import _ from 'lodash';
import { useCallback } from 'react'; import { useCallback } from 'react';

View File

@ -1,5 +1,5 @@
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import { useAppSelector } from 'app/store'; import { useAppSelector } from 'app/storeHooks';
import _ from 'lodash'; import _ from 'lodash';
import { canvasSelector } from 'features/canvas/store/canvasSelectors'; import { canvasSelector } from 'features/canvas/store/canvasSelectors';
import IAICanvasStatusTextCursorPos from './IAICanvasStatusText/IAICanvasStatusTextCursorPos'; import IAICanvasStatusTextCursorPos from './IAICanvasStatusText/IAICanvasStatusTextCursorPos';

View File

@ -1,5 +1,5 @@
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import { useAppSelector } from 'app/store'; import { useAppSelector } from 'app/storeHooks';
import { canvasSelector } from 'features/canvas/store/canvasSelectors'; import { canvasSelector } from 'features/canvas/store/canvasSelectors';
import React from 'react'; import React from 'react';
import _ from 'lodash'; import _ from 'lodash';

View File

@ -2,7 +2,7 @@ import { createSelector } from '@reduxjs/toolkit';
import { GroupConfig } from 'konva/lib/Group'; import { GroupConfig } from 'konva/lib/Group';
import _ from 'lodash'; import _ from 'lodash';
import { Circle, Group } from 'react-konva'; import { Circle, Group } from 'react-konva';
import { useAppSelector } from 'app/store'; import { useAppSelector } from 'app/storeHooks';
import { canvasSelector } from 'features/canvas/store/canvasSelectors'; import { canvasSelector } from 'features/canvas/store/canvasSelectors';
import { rgbaColorToString } from 'features/canvas/util/colorToString'; import { rgbaColorToString } from 'features/canvas/util/colorToString';
import { import {

View File

@ -5,7 +5,7 @@ import { Vector2d } from 'konva/lib/types';
import _ from 'lodash'; import _ from 'lodash';
import { useCallback, useEffect, useRef, useState } from 'react'; import { useCallback, useEffect, useRef, useState } from 'react';
import { Group, Rect, Transformer } from 'react-konva'; import { Group, Rect, Transformer } from 'react-konva';
import { useAppDispatch, useAppSelector } from 'app/store'; import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import { import {
roundDownToMultiple, roundDownToMultiple,
roundToMultiple, roundToMultiple,

View File

@ -7,7 +7,7 @@ import {
setMaskColor, setMaskColor,
setShouldPreserveMaskedArea, setShouldPreserveMaskedArea,
} from 'features/canvas/store/canvasSlice'; } from 'features/canvas/store/canvasSlice';
import { useAppDispatch, useAppSelector } from 'app/store'; import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import _ from 'lodash'; import _ from 'lodash';
import IAIIconButton from 'common/components/IAIIconButton'; import IAIIconButton from 'common/components/IAIIconButton';
import { FaMask, FaTrash } from 'react-icons/fa'; import { FaMask, FaTrash } from 'react-icons/fa';

View File

@ -1,7 +1,7 @@
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import { useHotkeys } from 'react-hotkeys-hook'; import { useHotkeys } from 'react-hotkeys-hook';
import { FaRedo } from 'react-icons/fa'; import { FaRedo } from 'react-icons/fa';
import { useAppDispatch, useAppSelector } from 'app/store'; import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import IAIIconButton from 'common/components/IAIIconButton'; import IAIIconButton from 'common/components/IAIIconButton';
import { activeTabNameSelector } from 'features/options/store/optionsSelectors'; import { activeTabNameSelector } from 'features/options/store/optionsSelectors';
import { canvasSelector } from 'features/canvas/store/canvasSelectors'; import { canvasSelector } from 'features/canvas/store/canvasSelectors';

View File

@ -10,7 +10,7 @@ import {
setShouldShowIntermediates, setShouldShowIntermediates,
setShouldSnapToGrid, setShouldSnapToGrid,
} from 'features/canvas/store/canvasSlice'; } from 'features/canvas/store/canvasSlice';
import { useAppDispatch, useAppSelector } from 'app/store'; import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import _ from 'lodash'; import _ from 'lodash';
import IAIIconButton from 'common/components/IAIIconButton'; import IAIIconButton from 'common/components/IAIIconButton';
import { FaWrench } from 'react-icons/fa'; import { FaWrench } from 'react-icons/fa';

View File

@ -7,7 +7,7 @@ import {
setBrushSize, setBrushSize,
setTool, setTool,
} from 'features/canvas/store/canvasSlice'; } from 'features/canvas/store/canvasSlice';
import { useAppDispatch, useAppSelector } from 'app/store'; import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import _ from 'lodash'; import _ from 'lodash';
import IAIIconButton from 'common/components/IAIIconButton'; import IAIIconButton from 'common/components/IAIIconButton';
import { import {

View File

@ -8,7 +8,7 @@ import {
setLayer, setLayer,
setTool, setTool,
} from 'features/canvas/store/canvasSlice'; } from 'features/canvas/store/canvasSlice';
import { useAppDispatch, useAppSelector } from 'app/store'; import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import _ from 'lodash'; import _ from 'lodash';
import IAIIconButton from 'common/components/IAIIconButton'; import IAIIconButton from 'common/components/IAIIconButton';
import { import {

View File

@ -1,7 +1,7 @@
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import { useHotkeys } from 'react-hotkeys-hook'; import { useHotkeys } from 'react-hotkeys-hook';
import { FaUndo } from 'react-icons/fa'; import { FaUndo } from 'react-icons/fa';
import { useAppDispatch, useAppSelector } from 'app/store'; import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import IAIIconButton from 'common/components/IAIIconButton'; import IAIIconButton from 'common/components/IAIIconButton';
import { canvasSelector } from 'features/canvas/store/canvasSelectors'; import { canvasSelector } from 'features/canvas/store/canvasSelectors';

View File

@ -1,5 +1,5 @@
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import { useAppDispatch, useAppSelector } from 'app/store'; import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import { KonvaEventObject } from 'konva/lib/Node'; import { KonvaEventObject } from 'konva/lib/Node';
import _ from 'lodash'; import _ from 'lodash';
import { useCallback } from 'react'; import { useCallback } from 'react';

View File

@ -10,7 +10,7 @@ import {
setShouldSnapToGrid, setShouldSnapToGrid,
setTool, setTool,
} from 'features/canvas/store/canvasSlice'; } from 'features/canvas/store/canvasSlice';
import { useAppDispatch, useAppSelector } from 'app/store'; import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import { useRef } from 'react'; import { useRef } from 'react';
import { import {
canvasSelector, canvasSelector,

View File

@ -1,5 +1,5 @@
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import { useAppDispatch, useAppSelector } from 'app/store'; import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import { activeTabNameSelector } from 'features/options/store/optionsSelectors'; import { activeTabNameSelector } from 'features/options/store/optionsSelectors';
import Konva from 'konva'; import Konva from 'konva';
import { KonvaEventObject } from 'konva/lib/Node'; import { KonvaEventObject } from 'konva/lib/Node';

View File

@ -1,5 +1,5 @@
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import { useAppDispatch, useAppSelector } from 'app/store'; import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import { activeTabNameSelector } from 'features/options/store/optionsSelectors'; import { activeTabNameSelector } from 'features/options/store/optionsSelectors';
import Konva from 'konva'; import Konva from 'konva';
import { Vector2d } from 'konva/lib/types'; import { Vector2d } from 'konva/lib/types';

View File

@ -1,4 +1,4 @@
import { useAppDispatch } from 'app/store'; import { useAppDispatch } from 'app/storeHooks';
import { useCallback } from 'react'; import { useCallback } from 'react';
import { mouseLeftCanvas } from 'features/canvas/store/canvasSlice'; import { mouseLeftCanvas } from 'features/canvas/store/canvasSlice';

View File

@ -1,5 +1,5 @@
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import { useAppDispatch, useAppSelector } from 'app/store'; import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import { activeTabNameSelector } from 'features/options/store/optionsSelectors'; import { activeTabNameSelector } from 'features/options/store/optionsSelectors';
import Konva from 'konva'; import Konva from 'konva';
import _ from 'lodash'; import _ from 'lodash';

View File

@ -1,5 +1,5 @@
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import { useAppDispatch, useAppSelector } from 'app/store'; import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import Konva from 'konva'; import Konva from 'konva';
import { KonvaEventObject } from 'konva/lib/Node'; import { KonvaEventObject } from 'konva/lib/Node';
import _ from 'lodash'; import _ from 'lodash';

View File

@ -1,4 +1,4 @@
import { useAppDispatch } from 'app/store'; import { useAppDispatch } from 'app/storeHooks';
import Konva from 'konva'; import Konva from 'konva';
import _ from 'lodash'; import _ from 'lodash';
import { import {

View File

@ -1,7 +1,7 @@
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import { isEqual } from 'lodash'; import { isEqual } from 'lodash';
import { useAppDispatch, useAppSelector } from 'app/store'; import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import { RootState } from 'app/store'; import { RootState } from 'app/store';
import { import {
OptionsState, OptionsState,

View File

@ -1,4 +1,5 @@
import { RootState, useAppSelector } from 'app/store'; import { RootState } from 'app/store';
import { useAppSelector } from 'app/storeHooks';
import CurrentImageButtons from './CurrentImageButtons'; import CurrentImageButtons from './CurrentImageButtons';
import { MdPhoto } from 'react-icons/md'; import { MdPhoto } from 'react-icons/md';
import CurrentImagePreview from './CurrentImagePreview'; import CurrentImagePreview from './CurrentImagePreview';

View File

@ -1,7 +1,8 @@
import { IconButton, Image } from '@chakra-ui/react'; import { IconButton, Image } from '@chakra-ui/react';
import { useState } from 'react'; import { useState } from 'react';
import { FaAngleLeft, FaAngleRight } from 'react-icons/fa'; import { FaAngleLeft, FaAngleRight } from 'react-icons/fa';
import { RootState, useAppDispatch, useAppSelector } from 'app/store'; import { RootState } from 'app/store';
import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import { import {
GalleryCategory, GalleryCategory,
GalleryState, GalleryState,

View File

@ -14,15 +14,9 @@ import {
Flex, Flex,
} from '@chakra-ui/react'; } from '@chakra-ui/react';
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import { import { ChangeEvent, ReactElement, SyntheticEvent } from 'react';
ChangeEvent, import { cloneElement, forwardRef, useRef } from 'react';
cloneElement, import { useAppDispatch, useAppSelector } from 'app/storeHooks';
forwardRef,
ReactElement,
SyntheticEvent,
useRef,
} from 'react';
import { useAppDispatch, useAppSelector } from 'app/store';
import { deleteImage } from 'app/socketio/actions'; import { deleteImage } from 'app/socketio/actions';
import { RootState } from 'app/store'; import { RootState } from 'app/store';
import { import {

View File

@ -6,7 +6,7 @@ import {
Tooltip, Tooltip,
useToast, useToast,
} from '@chakra-ui/react'; } from '@chakra-ui/react';
import { useAppDispatch, useAppSelector } from 'app/store'; import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import { import {
setCurrentImage, setCurrentImage,
setShouldHoldGalleryOpen, setShouldHoldGalleryOpen,

View File

@ -12,7 +12,7 @@ import { useHotkeys } from 'react-hotkeys-hook';
import { MdPhotoLibrary } from 'react-icons/md'; import { MdPhotoLibrary } from 'react-icons/md';
import { BsPinAngle, BsPinAngleFill } from 'react-icons/bs'; import { BsPinAngle, BsPinAngleFill } from 'react-icons/bs';
import { requestImages } from 'app/socketio/actions'; import { requestImages } from 'app/socketio/actions';
import { useAppDispatch, useAppSelector } from 'app/store'; import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import IAIIconButton from 'common/components/IAIIconButton'; import IAIIconButton from 'common/components/IAIIconButton';
import { import {
selectNextImage, selectNextImage,
@ -41,7 +41,7 @@ import IAICheckbox from 'common/components/IAICheckbox';
import { setDoesCanvasNeedScaling } from 'features/canvas/store/canvasSlice'; import { setDoesCanvasNeedScaling } from 'features/canvas/store/canvasSlice';
import _ from 'lodash'; import _ from 'lodash';
import IAIButton from 'common/components/IAIButton'; import IAIButton from 'common/components/IAIButton';
import { InvokeTabName } from 'features/tabs/components/InvokeTabs'; import { InvokeTabName } from 'features/tabs/tabMap';
const GALLERY_SHOW_BUTTONS_MIN_WIDTH = 320; const GALLERY_SHOW_BUTTONS_MIN_WIDTH = 320;
const GALLERY_IMAGE_WIDTH_OFFSET = 40; const GALLERY_IMAGE_WIDTH_OFFSET = 40;
@ -55,6 +55,7 @@ const GALLERY_TAB_WIDTHS: Record<
unifiedCanvas: { galleryMinWidth: 200, galleryMaxWidth: 200 }, unifiedCanvas: { galleryMinWidth: 200, galleryMaxWidth: 200 },
nodes: { galleryMinWidth: 200, galleryMaxWidth: 500 }, nodes: { galleryMinWidth: 200, galleryMaxWidth: 500 },
postprocess: { galleryMinWidth: 200, galleryMaxWidth: 500 }, postprocess: { galleryMinWidth: 200, galleryMaxWidth: 500 },
training: { galleryMinWidth: 200, galleryMaxWidth: 500 },
}; };
const LIGHTBOX_GALLERY_WIDTH = 400; const LIGHTBOX_GALLERY_WIDTH = 400;

View File

@ -10,7 +10,7 @@ import {
import { ExternalLinkIcon } from '@chakra-ui/icons'; import { ExternalLinkIcon } from '@chakra-ui/icons';
import { memo } from 'react'; import { memo } from 'react';
import { IoArrowUndoCircleOutline } from 'react-icons/io5'; import { IoArrowUndoCircleOutline } from 'react-icons/io5';
import { useAppDispatch } from 'app/store'; import { useAppDispatch } from 'app/storeHooks';
import * as InvokeAI from 'app/invokeai'; import * as InvokeAI from 'app/invokeai';
import { import {
setCfgScale, setCfgScale,

View File

@ -1,5 +1,5 @@
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import { useAppSelector } from 'app/store'; import { useAppSelector } from 'app/storeHooks';
import { gallerySelector } from '../store/gallerySliceSelectors'; import { gallerySelector } from '../store/gallerySliceSelectors';
const selector = createSelector(gallerySelector, (gallery) => ({ const selector = createSelector(gallerySelector, (gallery) => ({

View File

@ -3,7 +3,7 @@ import type { PayloadAction } from '@reduxjs/toolkit';
import _, { clamp } from 'lodash'; import _, { clamp } from 'lodash';
import * as InvokeAI from 'app/invokeai'; import * as InvokeAI from 'app/invokeai';
import { IRect } from 'konva/lib/types'; import { IRect } from 'konva/lib/types';
import { InvokeTabName } from 'features/tabs/components/InvokeTabs'; import { InvokeTabName } from 'features/tabs/tabMap';
export type GalleryCategory = 'user' | 'result'; export type GalleryCategory = 'user' | 'result';

View File

@ -1,5 +1,6 @@
import { IconButton } from '@chakra-ui/react'; import { IconButton } from '@chakra-ui/react';
import { RootState, useAppDispatch, useAppSelector } from 'app/store'; import { RootState } from 'app/store';
import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import IAIIconButton from 'common/components/IAIIconButton'; import IAIIconButton from 'common/components/IAIIconButton';
import CurrentImageButtons from 'features/gallery/components/CurrentImageButtons'; import CurrentImageButtons from 'features/gallery/components/CurrentImageButtons';
import { imagesSelector } from 'features/gallery/components/CurrentImagePreview'; import { imagesSelector } from 'features/gallery/components/CurrentImagePreview';

View File

@ -1,6 +1,6 @@
import { Box, Flex } from '@chakra-ui/react'; import { Box, Flex } from '@chakra-ui/react';
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import { useAppDispatch, useAppSelector } from 'app/store'; import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import IAISlider from 'common/components/IAISlider'; import IAISlider from 'common/components/IAISlider';
import { canvasSelector } from 'features/canvas/store/canvasSelectors'; import { canvasSelector } from 'features/canvas/store/canvasSelectors';
import { setBoundingBoxDimensions } from 'features/canvas/store/canvasSlice'; import { setBoundingBoxDimensions } from 'features/canvas/store/canvasSlice';

View File

@ -1,6 +1,6 @@
import { Flex } from '@chakra-ui/react'; import { Flex } from '@chakra-ui/react';
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import { useAppDispatch, useAppSelector } from 'app/store'; import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import IAISelect from 'common/components/IAISelect'; import IAISelect from 'common/components/IAISelect';
import IAISlider from 'common/components/IAISlider'; import IAISlider from 'common/components/IAISlider';
import { canvasSelector } from 'features/canvas/store/canvasSelectors'; import { canvasSelector } from 'features/canvas/store/canvasSelectors';

View File

@ -1,5 +1,5 @@
import React, { ChangeEvent } from 'react'; import React, { ChangeEvent } from 'react';
import { useAppDispatch, useAppSelector } from '../../../../../app/store'; import { useAppDispatch, useAppSelector } from '../../../../../app/storeHooks';
import _ from 'lodash'; import _ from 'lodash';
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import IAISwitch from '../../../../../common/components/IAISwitch'; import IAISwitch from '../../../../../common/components/IAISwitch';

View File

@ -1,6 +1,6 @@
import { Flex } from '@chakra-ui/react'; import { Flex } from '@chakra-ui/react';
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import { useAppDispatch, useAppSelector } from 'app/store'; import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import IAISlider from 'common/components/IAISlider'; import IAISlider from 'common/components/IAISlider';
import { optionsSelector } from 'features/options/store/optionsSelectors'; import { optionsSelector } from 'features/options/store/optionsSelectors';
import { import {

View File

@ -1,7 +1,7 @@
import { Flex } from '@chakra-ui/react'; import { Flex } from '@chakra-ui/react';
import { RootState } from 'app/store'; import { RootState } from 'app/store';
import { useAppDispatch, useAppSelector } from 'app/store'; import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import { import {
FacetoolType, FacetoolType,

View File

@ -1,5 +1,6 @@
import { ChangeEvent } from 'react'; import { ChangeEvent } from 'react';
import { RootState, useAppDispatch, useAppSelector } from 'app/store'; import { RootState } from 'app/store';
import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import IAISwitch from 'common/components/IAISwitch'; import IAISwitch from 'common/components/IAISwitch';
import { setShouldRunFacetool } from 'features/options/store/optionsSlice'; import { setShouldRunFacetool } from 'features/options/store/optionsSlice';

View File

@ -1,9 +1,6 @@
import React, { ChangeEvent } from 'react'; import React, { ChangeEvent } from 'react';
import { import { RootState } from 'app/store';
RootState, import { useAppDispatch, useAppSelector } from 'app/storeHooks';
useAppDispatch,
useAppSelector,
} from 'app/store';
import IAISwitch from 'common/components/IAISwitch'; import IAISwitch from 'common/components/IAISwitch';
import { setShouldFitToWidthHeight } from 'features/options/store/optionsSlice'; import { setShouldFitToWidthHeight } from 'features/options/store/optionsSlice';

View File

@ -1,5 +1,6 @@
import React from 'react'; import React from 'react';
import { RootState, useAppDispatch, useAppSelector } from 'app/store'; import { RootState } from 'app/store';
import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import IAISlider from 'common/components/IAISlider'; import IAISlider from 'common/components/IAISlider';
import { setImg2imgStrength } from 'features/options/store/optionsSlice'; import { setImg2imgStrength } from 'features/options/store/optionsSlice';

View File

@ -1,10 +1,7 @@
import { Flex } from '@chakra-ui/react'; import { Flex } from '@chakra-ui/react';
import { ChangeEvent } from 'react'; import { ChangeEvent } from 'react';
import { import { RootState } from 'app/store';
RootState, import { useAppDispatch, useAppSelector } from 'app/storeHooks';
useAppDispatch,
useAppSelector,
} from 'app/store';
import IAISwitch from 'common/components/IAISwitch'; import IAISwitch from 'common/components/IAISwitch';
import { setHiresFix } from 'features/options/store/optionsSlice'; import { setHiresFix } from 'features/options/store/optionsSlice';

View File

@ -1,10 +1,7 @@
import { Flex } from '@chakra-ui/react'; import { Flex } from '@chakra-ui/react';
import { ChangeEvent } from 'react'; import { ChangeEvent } from 'react';
import { import { RootState } from 'app/store';
RootState, import { useAppDispatch, useAppSelector } from 'app/storeHooks';
useAppDispatch,
useAppSelector,
} from 'app/store';
import IAISwitch from 'common/components/IAISwitch'; import IAISwitch from 'common/components/IAISwitch';
import { setSeamless } from 'features/options/store/optionsSlice'; import { setSeamless } from 'features/options/store/optionsSlice';

View File

@ -1,9 +1,6 @@
import React from 'react'; import React from 'react';
import { import { RootState } from 'app/store';
RootState, import { useAppDispatch, useAppSelector } from 'app/storeHooks';
useAppDispatch,
useAppSelector,
} from 'app/store';
import IAINumberInput from 'common/components/IAINumberInput'; import IAINumberInput from 'common/components/IAINumberInput';
import { setPerlin } from 'features/options/store/optionsSlice'; import { setPerlin } from 'features/options/store/optionsSlice';

View File

@ -1,10 +1,8 @@
import React, { ChangeEvent } from 'react'; import { ChangeEvent } from 'react';
import React from 'react';
import { import { RootState } from 'app/store';
RootState, import { useAppDispatch, useAppSelector } from 'app/storeHooks';
useAppDispatch,
useAppSelector,
} from 'app/store';
import IAISwitch from 'common/components/IAISwitch'; import IAISwitch from 'common/components/IAISwitch';
import { setShouldRandomizeSeed } from 'features/options/store/optionsSlice'; import { setShouldRandomizeSeed } from 'features/options/store/optionsSlice';

View File

@ -1,10 +1,7 @@
import React from 'react'; import React from 'react';
import { NUMPY_RAND_MAX, NUMPY_RAND_MIN } from 'app/constants'; import { NUMPY_RAND_MAX, NUMPY_RAND_MIN } from 'app/constants';
import { import { RootState } from 'app/store';
RootState, import { useAppDispatch, useAppSelector } from 'app/storeHooks';
useAppDispatch,
useAppSelector,
} from 'app/store';
import IAINumberInput from 'common/components/IAINumberInput'; import IAINumberInput from 'common/components/IAINumberInput';
import { setSeed } from 'features/options/store/optionsSlice'; import { setSeed } from 'features/options/store/optionsSlice';

View File

@ -1,7 +1,8 @@
import { Button } from '@chakra-ui/react'; import { Button } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import { NUMPY_RAND_MAX, NUMPY_RAND_MIN } from 'app/constants'; import { NUMPY_RAND_MAX, NUMPY_RAND_MIN } from 'app/constants';
import { RootState, useAppDispatch, useAppSelector } from 'app/store'; import { RootState } from 'app/store';
import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import randomInt from 'common/util/randomInt'; import randomInt from 'common/util/randomInt';
import { setSeed } from 'features/options/store/optionsSlice'; import { setSeed } from 'features/options/store/optionsSlice';

View File

@ -1,9 +1,6 @@
import React from 'react'; import React from 'react';
import { import { RootState } from 'app/store';
RootState, import { useAppDispatch, useAppSelector } from 'app/storeHooks';
useAppDispatch,
useAppSelector,
} from 'app/store';
import IAINumberInput from 'common/components/IAINumberInput'; import IAINumberInput from 'common/components/IAINumberInput';
import { setThreshold } from 'features/options/store/optionsSlice'; import { setThreshold } from 'features/options/store/optionsSlice';

View File

@ -1,5 +1,5 @@
import { RootState } from 'app/store'; import { RootState } from 'app/store';
import { useAppDispatch, useAppSelector } from 'app/store'; import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import { import {
setUpscalingLevel, setUpscalingLevel,

View File

@ -1,5 +1,6 @@
import { ChangeEvent } from 'react'; import { ChangeEvent } from 'react';
import { RootState, useAppDispatch, useAppSelector } from 'app/store'; import { RootState } from 'app/store';
import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import IAISwitch from 'common/components/IAISwitch'; import IAISwitch from 'common/components/IAISwitch';
import { setShouldRunESRGAN } from 'features/options/store/optionsSlice'; import { setShouldRunESRGAN } from 'features/options/store/optionsSlice';

View File

@ -1,9 +1,6 @@
import React, { ChangeEvent } from 'react'; import React, { ChangeEvent } from 'react';
import { import { RootState } from 'app/store';
RootState, import { useAppDispatch, useAppSelector } from 'app/storeHooks';
useAppDispatch,
useAppSelector,
} from 'app/store';
import IAISwitch from 'common/components/IAISwitch'; import IAISwitch from 'common/components/IAISwitch';
import { setShouldGenerateVariations } from 'features/options/store/optionsSlice'; import { setShouldGenerateVariations } from 'features/options/store/optionsSlice';

View File

@ -1,9 +1,6 @@
import React, { ChangeEvent } from 'react'; import React, { ChangeEvent } from 'react';
import { import { RootState } from 'app/store';
RootState, import { useAppDispatch, useAppSelector } from 'app/storeHooks';
useAppDispatch,
useAppSelector,
} from 'app/store';
import IAIInput from 'common/components/IAIInput'; import IAIInput from 'common/components/IAIInput';
import { validateSeedWeights } from 'common/util/seedWeightPairs'; import { validateSeedWeights } from 'common/util/seedWeightPairs';
import { setSeedWeights } from 'features/options/store/optionsSlice'; import { setSeedWeights } from 'features/options/store/optionsSlice';

View File

@ -1,9 +1,6 @@
import React from 'react'; import React from 'react';
import { import { RootState } from 'app/store';
RootState, import { useAppDispatch, useAppSelector } from 'app/storeHooks';
useAppDispatch,
useAppSelector,
} from 'app/store';
import IAINumberInput from 'common/components/IAINumberInput'; import IAINumberInput from 'common/components/IAINumberInput';
import { setVariationAmount } from 'features/options/store/optionsSlice'; import { setVariationAmount } from 'features/options/store/optionsSlice';

View File

@ -1,5 +1,6 @@
import React, { ChangeEvent } from 'react'; import React, { ChangeEvent } from 'react';
import { RootState, useAppDispatch, useAppSelector } from 'app/store'; import { RootState } from 'app/store';
import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import IAICheckbox from 'common/components/IAICheckbox'; import IAICheckbox from 'common/components/IAICheckbox';
import { setShowAdvancedOptions } from 'features/options/store/optionsSlice'; import { setShowAdvancedOptions } from 'features/options/store/optionsSlice';

View File

@ -1,8 +1,8 @@
import React from 'react'; import React from 'react';
import { RootState, useAppDispatch, useAppSelector } from 'app/store'; import { RootState } from 'app/store';
import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import IAINumberInput from 'common/components/IAINumberInput'; import IAINumberInput from 'common/components/IAINumberInput';
import { setCfgScale } from 'features/options/store/optionsSlice'; import { setCfgScale } from 'features/options/store/optionsSlice';
import { inputWidth } from './MainOptions';
export default function MainCFGScale() { export default function MainCFGScale() {
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
@ -18,7 +18,7 @@ export default function MainCFGScale() {
max={200} max={200}
onChange={handleChangeCfgScale} onChange={handleChangeCfgScale}
value={cfgScale} value={cfgScale}
width={inputWidth} width="auto"
styleClass="main-option-block" styleClass="main-option-block"
textAlign="center" textAlign="center"
isInteger={false} isInteger={false}

View File

@ -1,6 +1,8 @@
import React, { ChangeEvent } from 'react'; import { ChangeEvent } from 'react';
import React from 'react';
import { HEIGHTS } from 'app/constants'; import { HEIGHTS } from 'app/constants';
import { RootState, useAppDispatch, useAppSelector } from 'app/store'; import { RootState } from 'app/store';
import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import IAISelect from 'common/components/IAISelect'; import IAISelect from 'common/components/IAISelect';
import { activeTabNameSelector } from 'features/options/store/optionsSelectors'; import { activeTabNameSelector } from 'features/options/store/optionsSelectors';
import { setHeight } from 'features/options/store/optionsSlice'; import { setHeight } from 'features/options/store/optionsSlice';

View File

@ -1,13 +1,13 @@
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import _ from 'lodash'; import _ from 'lodash';
import React from 'react'; import React from 'react';
import { RootState, useAppDispatch, useAppSelector } from 'app/store'; import type { RootState } from 'app/store';
import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import IAINumberInput from 'common/components/IAINumberInput'; import IAINumberInput from 'common/components/IAINumberInput';
import { import {
OptionsState, OptionsState,
setIterations, setIterations,
} from 'features/options/store/optionsSlice'; } from 'features/options/store/optionsSlice';
import { inputWidth } from './MainOptions';
const mainIterationsSelector = createSelector( const mainIterationsSelector = createSelector(
[(state: RootState) => state.options], [(state: RootState) => state.options],
@ -39,7 +39,7 @@ export default function MainIterations() {
max={9999} max={9999}
onChange={handleChangeIterations} onChange={handleChangeIterations}
value={iterations} value={iterations}
width={inputWidth} width="auto"
labelFontSize={0.5} labelFontSize={0.5}
styleClass="main-option-block" styleClass="main-option-block"
textAlign="center" textAlign="center"

View File

@ -1,6 +1,7 @@
import React, { ChangeEvent } from 'react'; import React, { ChangeEvent } from 'react';
import { SAMPLERS } from 'app/constants'; import { SAMPLERS } from 'app/constants';
import { RootState, useAppDispatch, useAppSelector } from 'app/store'; import { RootState } from 'app/store';
import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import IAISelect from 'common/components/IAISelect'; import IAISelect from 'common/components/IAISelect';
import { setSampler } from 'features/options/store/optionsSlice'; import { setSampler } from 'features/options/store/optionsSlice';

View File

@ -1,8 +1,8 @@
import React from 'react'; import React from 'react';
import { RootState, useAppDispatch, useAppSelector } from 'app/store'; import { RootState } from 'app/store';
import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import IAINumberInput from 'common/components/IAINumberInput'; import IAINumberInput from 'common/components/IAINumberInput';
import { setSteps } from 'features/options/store/optionsSlice'; import { setSteps } from 'features/options/store/optionsSlice';
import { inputWidth } from './MainOptions';
export default function MainSteps() { export default function MainSteps() {
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
@ -18,7 +18,7 @@ export default function MainSteps() {
step={1} step={1}
onChange={handleChangeSteps} onChange={handleChangeSteps}
value={steps} value={steps}
width={inputWidth} width="auto"
styleClass="main-option-block" styleClass="main-option-block"
textAlign="center" textAlign="center"
/> />

View File

@ -1,6 +1,7 @@
import React, { ChangeEvent } from 'react'; import React, { ChangeEvent } from 'react';
import { WIDTHS } from 'app/constants'; import { WIDTHS } from 'app/constants';
import { RootState, useAppDispatch, useAppSelector } from 'app/store'; import { RootState } from 'app/store';
import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import IAISelect from 'common/components/IAISelect'; import IAISelect from 'common/components/IAISelect';
import { activeTabNameSelector } from 'features/options/store/optionsSelectors'; import { activeTabNameSelector } from 'features/options/store/optionsSelectors';
import { setWidth } from 'features/options/store/optionsSlice'; import { setWidth } from 'features/options/store/optionsSlice';

View File

@ -1,5 +1,6 @@
import { Accordion, ExpandedIndex } from '@chakra-ui/react'; import { Accordion, ExpandedIndex } from '@chakra-ui/react';
import { RootState, useAppDispatch, useAppSelector } from 'app/store'; import { RootState } from 'app/store';
import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import { setOpenAccordions } from 'features/system/store/systemSlice'; import { setOpenAccordions } from 'features/system/store/systemSlice';
import InvokeAccordionItem, { import InvokeAccordionItem, {
InvokeAccordionItemProps, InvokeAccordionItemProps,

View File

@ -1,6 +1,7 @@
import { MdCancel } from 'react-icons/md'; import { MdCancel } from 'react-icons/md';
import { cancelProcessing } from 'app/socketio/actions'; import { cancelProcessing } from 'app/socketio/actions';
import { RootState, useAppDispatch, useAppSelector } from 'app/store'; import { RootState } from 'app/store';
import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import IAIIconButton, { import IAIIconButton, {
IAIIconButtonProps, IAIIconButtonProps,
} from 'common/components/IAIIconButton'; } from 'common/components/IAIIconButton';

View File

@ -2,7 +2,7 @@ import { useHotkeys } from 'react-hotkeys-hook';
import { FaPlay } from 'react-icons/fa'; import { FaPlay } from 'react-icons/fa';
import { readinessSelector } from 'app/selectors/readinessSelector'; import { readinessSelector } from 'app/selectors/readinessSelector';
import { generateImage } from 'app/socketio/actions'; import { generateImage } from 'app/socketio/actions';
import { useAppDispatch, useAppSelector } from 'app/store'; import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import IAIButton, { IAIButtonProps } from 'common/components/IAIButton'; import IAIButton, { IAIButtonProps } from 'common/components/IAIButton';
import IAIIconButton, { import IAIIconButton, {
IAIIconButtonProps, IAIIconButtonProps,

View File

@ -1,6 +1,7 @@
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import { FaRecycle } from 'react-icons/fa'; import { FaRecycle } from 'react-icons/fa';
import { RootState, useAppDispatch, useAppSelector } from 'app/store'; import { RootState } from 'app/store';
import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import IAIIconButton from 'common/components/IAIIconButton'; import IAIIconButton from 'common/components/IAIIconButton';
import { OptionsState, setShouldLoopback } from 'features/options/store/optionsSlice'; import { OptionsState, setShouldLoopback } from 'features/options/store/optionsSlice';

View File

@ -1,7 +1,7 @@
import InvokeButton from './InvokeButton'; import InvokeButton from './InvokeButton';
import CancelButton from './CancelButton'; import CancelButton from './CancelButton';
import LoopbackButton from './Loopback'; import LoopbackButton from './Loopback';
import { useAppSelector } from 'app/store'; import { useAppSelector } from 'app/storeHooks';
import { activeTabNameSelector } from 'features/options/store/optionsSelectors'; import { activeTabNameSelector } from 'features/options/store/optionsSelectors';
/** /**

View File

@ -1,6 +1,7 @@
import { FormControl, Textarea } from '@chakra-ui/react'; import { FormControl, Textarea } from '@chakra-ui/react';
import { ChangeEvent, KeyboardEvent, useRef } from 'react'; import { ChangeEvent, KeyboardEvent, useRef } from 'react';
import { RootState, useAppDispatch, useAppSelector } from 'app/store'; import { RootState } from 'app/store';
import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import { generateImage } from 'app/socketio/actions'; import { generateImage } from 'app/socketio/actions';
import { OptionsState, setPrompt } from 'features/options/store/optionsSlice'; import { OptionsState, setPrompt } from 'features/options/store/optionsSlice';

View File

@ -1,7 +1,7 @@
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import _ from 'lodash'; import _ from 'lodash';
import { RootState } from 'app/store'; import { RootState } from 'app/store';
import { tabMap } from 'features/tabs/components/InvokeTabs'; import { tabMap } from 'features/tabs/tabMap';
import { OptionsState } from './optionsSlice'; import { OptionsState } from './optionsSlice';
export const activeTabNameSelector = createSelector( export const activeTabNameSelector = createSelector(

View File

@ -4,7 +4,7 @@ import * as InvokeAI from 'app/invokeai';
import promptToString from 'common/util/promptToString'; import promptToString from 'common/util/promptToString';
import { seedWeightsToString } from 'common/util/seedWeightPairs'; import { seedWeightsToString } from 'common/util/seedWeightPairs';
import { FACETOOL_TYPES } from 'app/constants'; import { FACETOOL_TYPES } from 'app/constants';
import { InvokeTabName, tabMap } from 'features/tabs/components/InvokeTabs'; import { InvokeTabName, tabMap } from 'features/tabs/tabMap';
export type UpscalingLevel = 2 | 4; export type UpscalingLevel = 2 | 4;

View File

@ -1,5 +1,5 @@
import { emptyTempFolder } from 'app/socketio/actions'; import { emptyTempFolder } from 'app/socketio/actions';
import { useAppDispatch, useAppSelector } from 'app/store'; import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import IAIAlertDialog from 'common/components/IAIAlertDialog'; import IAIAlertDialog from 'common/components/IAIAlertDialog';
import IAIButton from 'common/components/IAIButton'; import IAIButton from 'common/components/IAIButton';
import { isStagingSelector } from 'features/canvas/store/canvasSelectors'; import { isStagingSelector } from 'features/canvas/store/canvasSelectors';

View File

@ -1,5 +1,5 @@
import { IconButton, Tooltip } from '@chakra-ui/react'; import { IconButton, Tooltip } from '@chakra-ui/react';
import { useAppDispatch, useAppSelector } from 'app/store'; import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import { RootState } from 'app/store'; import { RootState } from 'app/store';
import { errorSeen, setShouldShowLogViewer, SystemState } from 'features/system/store/systemSlice'; import { errorSeen, setShouldShowLogViewer, SystemState } from 'features/system/store/systemSlice';
import { useLayoutEffect, useRef, useState } from 'react'; import { useLayoutEffect, useRef, useState } from 'react';

View File

@ -1,7 +1,7 @@
import { Flex } from '@chakra-ui/react'; import { Flex } from '@chakra-ui/react';
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import { requestModelChange } from 'app/socketio/actions'; import { requestModelChange } from 'app/socketio/actions';
import { useAppDispatch, useAppSelector } from 'app/store'; import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import IAISelect from 'common/components/IAISelect'; import IAISelect from 'common/components/IAISelect';
import _ from 'lodash'; import _ from 'lodash';
import { ChangeEvent } from 'react'; import { ChangeEvent } from 'react';

View File

@ -1,7 +1,7 @@
import { Progress } from '@chakra-ui/react'; import { Progress } from '@chakra-ui/react';
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import { isEqual } from 'lodash'; import { isEqual } from 'lodash';
import { useAppSelector } from 'app/store'; import { useAppSelector } from 'app/storeHooks';
import { RootState } from 'app/store'; import { RootState } from 'app/store';
import { SystemState } from 'features/system/store/systemSlice'; import { SystemState } from 'features/system/store/systemSlice';

View File

@ -12,7 +12,8 @@ import { createSelector } from '@reduxjs/toolkit';
import _ from 'lodash'; import _ from 'lodash';
import { ModelStatus } from 'app/invokeai'; import { ModelStatus } from 'app/invokeai';
import { requestModelChange } from 'app/socketio/actions'; import { requestModelChange } from 'app/socketio/actions';
import { RootState, useAppDispatch, useAppSelector } from 'app/store'; import { RootState } from 'app/store';
import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import { SystemState } from 'features/system/store/systemSlice'; import { SystemState } from 'features/system/store/systemSlice';
type ModelListItemProps = { type ModelListItemProps = {

View File

@ -15,8 +15,9 @@ import {
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import _, { isEqual } from 'lodash'; import _, { isEqual } from 'lodash';
import { ChangeEvent, cloneElement, ReactElement } from 'react'; import { ChangeEvent, cloneElement, ReactElement } from 'react';
import { RootState, useAppDispatch, useAppSelector } from 'app/store'; import { RootState } from 'app/store';
import { persistor } from 'main'; import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import { persistor } from 'persistor';
import { import {
InProgressImageType, InProgressImageType,
setEnableImageDebugging, setEnableImageDebugging,

View File

@ -1,7 +1,8 @@
import { Text, Tooltip } from '@chakra-ui/react'; import { Text, Tooltip } from '@chakra-ui/react';
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import { isEqual } from 'lodash'; import { isEqual } from 'lodash';
import { RootState, useAppDispatch, useAppSelector } from 'app/store'; import { RootState } from 'app/store';
import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import { errorSeen, SystemState } from 'features/system/store/systemSlice'; import { errorSeen, SystemState } from 'features/system/store/systemSlice';
const systemSelector = createSelector( const systemSelector = createSelector(

View File

@ -1,5 +1,6 @@
import { useColorMode, VStack } from '@chakra-ui/react'; import { useColorMode, VStack } from '@chakra-ui/react';
import { RootState, useAppDispatch, useAppSelector } from 'app/store'; import { RootState } from 'app/store';
import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import { setCurrentTheme } from 'features/options/store/optionsSlice'; import { setCurrentTheme } from 'features/options/store/optionsSlice';
import IAIPopover from 'common/components/IAIPopover'; import IAIPopover from 'common/components/IAIPopover';
import IAIIconButton from 'common/components/IAIIconButton'; import IAIIconButton from 'common/components/IAIIconButton';

View File

@ -1,5 +1,5 @@
import { useToast } from '@chakra-ui/react'; import { useToast } from '@chakra-ui/react';
import { useAppDispatch, useAppSelector } from 'app/store'; import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import { useEffect } from 'react'; import { useEffect } from 'react';
import { toastQueueSelector } from 'features/system/store/systemSelectors'; import { toastQueueSelector } from 'features/system/store/systemSelectors';
import { clearToastQueue } from 'features/system/store/systemSlice'; import { clearToastQueue } from 'features/system/store/systemSlice';

View File

@ -1,5 +1,5 @@
import { MdPhotoLibrary } from 'react-icons/md'; import { MdPhotoLibrary } from 'react-icons/md';
import { useAppDispatch, useAppSelector } from 'app/store'; import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import IAIIconButton from 'common/components/IAIIconButton'; import IAIIconButton from 'common/components/IAIIconButton';
import { setShouldShowGallery } from 'features/gallery/store/gallerySlice'; import { setShouldShowGallery } from 'features/gallery/store/gallerySlice';
import { setDoesCanvasNeedScaling } from 'features/canvas/store/canvasSlice'; import { setDoesCanvasNeedScaling } from 'features/canvas/store/canvasSlice';

View File

@ -1,5 +1,6 @@
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import { RootState, useAppDispatch, useAppSelector } from 'app/store'; import { RootState } from 'app/store';
import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import IAIIconButton from 'common/components/IAIIconButton'; import IAIIconButton from 'common/components/IAIIconButton';
import { import {
OptionsState, OptionsState,

View File

@ -1,4 +1,5 @@
import { RootState, useAppSelector } from 'app/store'; import { RootState } from 'app/store';
import { useAppSelector } from 'app/storeHooks';
import ImageUploadButton from 'common/components/ImageUploaderButton'; import ImageUploadButton from 'common/components/ImageUploaderButton';
import CurrentImageDisplay from 'features/gallery/components/CurrentImageDisplay'; import CurrentImageDisplay from 'features/gallery/components/CurrentImageDisplay';
import InitImagePreview from './InitImagePreview'; import InitImagePreview from './InitImagePreview';

View File

@ -1,5 +1,6 @@
import { Image, useToast } from '@chakra-ui/react'; import { Image, useToast } from '@chakra-ui/react';
import { RootState, useAppDispatch, useAppSelector } from 'app/store'; import { RootState } from 'app/store';
import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import ImageUploaderIconButton from 'common/components/ImageUploaderIconButton'; import ImageUploaderIconButton from 'common/components/ImageUploaderIconButton';
import { clearInitialImage } from 'features/options/store/optionsSlice'; import { clearInitialImage } from 'features/options/store/optionsSlice';

View File

@ -1,6 +1,7 @@
import { Image } from '@chakra-ui/react'; import { Image } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import { RootState, useAppSelector } from 'app/store'; import { RootState } from 'app/store';
import { useAppSelector } from 'app/storeHooks';
export default function InitialImageOverlay() { export default function InitialImageOverlay() {
const initialImage = useAppSelector( const initialImage = useAppSelector(

View File

@ -5,7 +5,8 @@ import React, { ReactNode, useCallback, useEffect, useRef } from 'react';
import { useHotkeys } from 'react-hotkeys-hook'; import { useHotkeys } from 'react-hotkeys-hook';
import { BsPinAngle, BsPinAngleFill } from 'react-icons/bs'; import { BsPinAngle, BsPinAngleFill } from 'react-icons/bs';
import { CSSTransition } from 'react-transition-group'; import { CSSTransition } from 'react-transition-group';
import { RootState, useAppDispatch, useAppSelector } from 'app/store'; import { RootState } from 'app/store';
import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import { import {
OptionsState, OptionsState,
setOptionsPanelScrollPosition, setOptionsPanelScrollPosition,

View File

@ -2,7 +2,8 @@ import { Tab, TabPanel, TabPanels, Tabs, Tooltip } from '@chakra-ui/react';
import _ from 'lodash'; import _ from 'lodash';
import React, { ReactElement } from 'react'; import React, { ReactElement } from 'react';
import { useHotkeys } from 'react-hotkeys-hook'; import { useHotkeys } from 'react-hotkeys-hook';
import { RootState, useAppDispatch, useAppSelector } from 'app/store'; import { RootState } from 'app/store';
import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import NodesWIP from 'common/components/WorkInProgress/NodesWIP'; import NodesWIP from 'common/components/WorkInProgress/NodesWIP';
import { PostProcessingWIP } from 'common/components/WorkInProgress/PostProcessingWIP'; import { PostProcessingWIP } from 'common/components/WorkInProgress/PostProcessingWIP';
import ImageToImageIcon from 'common/icons/ImageToImageIcon'; import ImageToImageIcon from 'common/icons/ImageToImageIcon';
@ -20,8 +21,15 @@ import UnifiedCanvasWorkarea from './UnifiedCanvas/UnifiedCanvasWorkarea';
import UnifiedCanvasIcon from 'common/icons/UnifiedCanvasIcon'; import UnifiedCanvasIcon from 'common/icons/UnifiedCanvasIcon';
import TrainingWIP from 'common/components/WorkInProgress/Training'; import TrainingWIP from 'common/components/WorkInProgress/Training';
import TrainingIcon from 'common/icons/TrainingIcon'; import TrainingIcon from 'common/icons/TrainingIcon';
import { InvokeTabName } from 'features/tabs/tabMap';
export const tabDict = { export interface InvokeTabInfo {
title: ReactElement;
workarea: ReactElement;
tooltip: string;
}
export const tabDict: Record<InvokeTabName, InvokeTabInfo> = {
txt2img: { txt2img: {
title: <TextToImageIcon fill={'black'} boxSize={'2.5rem'} />, title: <TextToImageIcon fill={'black'} boxSize={'2.5rem'} />,
workarea: <TextToImageWorkarea />, workarea: <TextToImageWorkarea />,
@ -54,13 +62,6 @@ export const tabDict = {
}, },
}; };
// Array where index maps to the key of tabDict
export const tabMap = _.map(tabDict, (tab, key) => key);
// Use tabMap to generate a union type of tab names
const tabMapTypes = [...tabMap] as const;
export type InvokeTabName = typeof tabMapTypes[number];
export default function InvokeTabs() { export default function InvokeTabs() {
const activeTab = useAppSelector( const activeTab = useAppSelector(
(state: RootState) => state.options.activeTab (state: RootState) => state.options.activeTab

Some files were not shown because too many files have changed in this diff Show More