Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

perf(ui): move the dot grid into a theme layer style

Josh Corbett37123d6922e9
diff --git a/invokeai/frontend/webv2/src/platform/ui/theme/system.ts b/invokeai/frontend/webv2/src/platform/ui/theme/system.ts
index 816ad755ad..39e815151e 100644
--- a/invokeai/frontend/webv2/src/platform/ui/theme/system.ts
+++ b/invokeai/frontend/webv2/src/platform/ui/theme/system.ts
@@ -315,6 +315,19 @@ const config = defineConfig({
to: { transform: 'translateX(300%)' },
},
},
+ layerStyles: {
+ // The inset dot-grid surface behind previews and the loading splash.
+ dotGrid: {
+ value: {
+ backgroundColor: 'bg.inset',
+ backgroundImage: 'radial-gradient(circle, currentColor 1px, transparent 1.5px)',
+ backgroundPosition: 'center',
+ backgroundRepeat: 'repeat',
+ backgroundSize: '24px 24px',
+ color: 'fg.grid',
+ },
+ },
+ },
tokens: {
// Use arrow cursors for controls and pointer for links.
cursor: {
diff --git a/invokeai/frontend/webv2/src/workbench/components/WorkbenchSplashScreen.tsx b/invokeai/frontend/webv2/src/workbench/components/WorkbenchSplashScreen.tsx
index db8d9ea4e5..3a48620942 100644
--- a/invokeai/frontend/webv2/src/workbench/components/WorkbenchSplashScreen.tsx
+++ b/invokeai/frontend/webv2/src/workbench/components/WorkbenchSplashScreen.tsx
@@ -2,7 +2,6 @@ import splashImageUrl from '@assets/SplashImage.webp';
import { Box, Flex, Heading, HStack, Spinner, Text, VStack } from '@chakra-ui/react';
import { APP_VERSION } from '@platform/runtime/appMetadata';
import { InvokeMark } from '@platform/ui/InvokeMark';
-import { previewGridCss } from '@workbench/widgets/preview/PreviewStage';
import { useTranslation } from 'react-i18next';
const splashImageStyle = { backgroundPosition: 'center', backgroundSize: 'cover' } as const;
@@ -11,17 +10,7 @@ export const WorkbenchSplashScreen = ({ messageKey = 'splash.loadingWorkspace' }
const { t } = useTranslation();
return (
- <Flex
- align="center"
- aria-busy="true"
- backgroundColor="bg.inset"
- color="fg.grid"
- css={previewGridCss}
- h="100vh"
- justify="center"
- role="status"
- w="100vw"
- >
+ <Flex align="center" aria-busy="true" h="100vh" justify="center" layerStyle="dotGrid" role="status" w="100vw">
<Box
position="relative"
bg="bg"
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewStage.tsx b/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewStage.tsx
index ae05e583e7..55b61133b6 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewStage.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewStage.tsx
@@ -7,13 +7,6 @@ import { Box, Flex, type BoxProps, type FlexProps, type SystemStyleObject } from
* supplies bordered, shadowed media geometry.
*/
-export const previewGridCss = {
- backgroundImage: 'radial-gradient(circle, currentColor 1px, transparent 1.5px)',
- backgroundPosition: 'center',
- backgroundRepeat: 'repeat',
- backgroundSize: '24px 24px',
-} as const;
-
export const getFittedFrameCss = (width: number, height: number): SystemStyleObject => ({
// The cue gallery thumbnails give when a touch hold arms their drag; only a draggable frame is ever armed.
'&[data-drag-armed=true]': { filter: 'saturate(0)' },
@@ -55,11 +48,9 @@ export const PreviewStage = ({
}) => (
<Flex
align="center"
- backgroundColor="bg.inset"
- color="fg.grid"
containerType="size"
- css={previewGridCss}
justify="center"
+ layerStyle="dotGrid"
p={padding}
pb={paddingBottom}
position="relative"