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.

feat(ui): read text that names no size at the md 12px size

Josh Corbettc25a918a7581
diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/editor/CurrentImageFlowNode.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/editor/CurrentImageFlowNode.tsx
index 841e89cc70..52373b11bf 100644
--- a/invokeai/frontend/webv2/src/features/workflow/ui/editor/CurrentImageFlowNode.tsx
+++ b/invokeai/frontend/webv2/src/features/workflow/ui/editor/CurrentImageFlowNode.tsx
@@ -40,7 +40,9 @@ const CurrentImageEditorNode = ({ data, selected }: NodeProps<CurrentImageFlowNo
{...getWorkflowNodeShellProps({ selected })}
>
<Flex {...getWorkflowNodeHeaderProps()}>
- <Text fontWeight="700">{node.data.label || 'Current Image'}</Text>
+ <Text fontSize="lg" fontWeight="700">
+ {node.data.label || 'Current Image'}
+ </Text>
{progressImage ? (
<Text color="brand.solid" data-node-status-indicator="true" fontSize="xs" ms="auto">
generating…
@@ -83,6 +85,7 @@ const CurrentImageSnapshotNode = ({ data, selected }: NodeProps<CurrentImageFlow
data-workflow-export-node-title="true"
data-workflow-export-static-node-content="true"
flex="1"
+ fontSize="lg"
fontWeight="700"
minW="0"
text={node.data.label || 'Current Image'}
diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx
index 6ab67ac8d9..22849a3e6a 100644
--- a/invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx
+++ b/invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx
@@ -275,6 +275,7 @@ const NodeTitle = ({
<MiddleTruncate
data-workflow-export-node-title="true"
data-workflow-export-static-node-content="true"
+ fontSize="lg"
fontWeight="700"
minW="0"
text={title}
@@ -296,6 +297,7 @@ const NodeTitle = ({
return (
<MiddleTruncate
+ fontSize="lg"
fontWeight="700"
minW="0"
text={title}
@@ -965,12 +967,15 @@ const ExpandedInvocationNode = ({ data, selected }: NodeProps<InvocationFlowNode
<MiddleTruncate
data-workflow-export-node-title="true"
data-workflow-export-static-node-content="true"
+ fontSize="lg"
fontWeight="700"
minW="0"
text={node.data.label || node.data.type}
/>
) : (
- <Text fontWeight="700">{node.data.label || node.data.type}</Text>
+ <Text fontSize="lg" fontWeight="700">
+ {node.data.label || node.data.type}
+ </Text>
)}
{!isWorkflowImageExport ? (
<Text color="fg.subtle" fontSize="xs">
diff --git a/invokeai/frontend/webv2/src/platform/ui/theme/BaseText.browser.test.tsx b/invokeai/frontend/webv2/src/platform/ui/theme/BaseText.browser.test.tsx
new file mode 100644
index 0000000000..c619081690
--- /dev/null
+++ b/invokeai/frontend/webv2/src/platform/ui/theme/BaseText.browser.test.tsx
@@ -0,0 +1,50 @@
+import { ChakraProvider, Text } from '@chakra-ui/react';
+import { system } from '@theme/system';
+import { act } from 'react';
+import { createRoot, type Root } from 'react-dom/client';
+import { afterEach, describe, expect, it } from 'vitest';
+
+import { TYPE_SCALE } from './scale';
+
+let host: HTMLDivElement | null = null;
+let root: Root | null = null;
+(globalThis as typeof globalThis & { IS_REACT_ACT_ENVIRONMENT: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
+
+afterEach(async () => {
+ await act(() => root?.unmount());
+ host?.remove();
+ host = null;
+ root = null;
+});
+
+const rem = (value: string) => `${Number.parseFloat(value) * 16}px`;
+
+const renderText = async (fontSize?: 'lg' | 'xl') => {
+ host = document.createElement('div');
+ document.body.append(host);
+ root = createRoot(host);
+ await act(() => {
+ root?.render(
+ <ChakraProvider value={system}>
+ <Text data-testid="text" fontSize={fontSize}>
+ Text
+ </Text>
+ </ChakraProvider>
+ );
+ });
+
+ return getComputedStyle(host.querySelector('[data-testid="text"]')!);
+};
+
+describe('base text', () => {
+ it('renders text that names no size at the md font size', async () => {
+ expect((await renderText()).fontSize).toBe(rem(TYPE_SCALE.md.fontSize));
+ });
+
+ // Text that sets only a font size keeps leading in proportion to it rather than inheriting a fixed line height.
+ it.each([undefined, 'lg', 'xl'] as const)('keeps proportional line height for %s text', async (fontSize) => {
+ const style = await renderText(fontSize);
+
+ expect(Number.parseFloat(style.lineHeight)).toBeCloseTo(Number.parseFloat(style.fontSize) * 1.5, 1);
+ });
+});
diff --git a/invokeai/frontend/webv2/src/platform/ui/theme/system.ts b/invokeai/frontend/webv2/src/platform/ui/theme/system.ts
index 866f03ee9d..ad090f75db 100644
--- a/invokeai/frontend/webv2/src/platform/ui/theme/system.ts
+++ b/invokeai/frontend/webv2/src/platform/ui/theme/system.ts
@@ -268,6 +268,9 @@ const config = defineConfig({
fontFamily: 'body',
margin: 0,
overflow: 'hidden',
+ // Text that names no size reads at the workbench's working size, as controls do. Only the size: the md text
+ // style's line height is absolute and would be inherited as-is by larger text, while html's unitless 1.5 scales.
+ fontSize: 'md',
},
// Exclude editable comboboxes from arrow cursors. Keep role values unquoted while SamOptions assertions match
// quoted markup.
diff --git a/invokeai/frontend/webv2/src/workbench/components/WorkbenchUnavailableScreen.tsx b/invokeai/frontend/webv2/src/workbench/components/WorkbenchUnavailableScreen.tsx
index f834b39940..978693dd5e 100644
--- a/invokeai/frontend/webv2/src/workbench/components/WorkbenchUnavailableScreen.tsx
+++ b/invokeai/frontend/webv2/src/workbench/components/WorkbenchUnavailableScreen.tsx
@@ -99,7 +99,16 @@ export const WorkbenchUnavailableScreen = ({
return (
<Flex align="center" bg="bg" color="fg" h="100vh" justify="center" p="6" w="100vw">
- <Box borderColor="border.subtle" borderRadius="xl" borderWidth="1px" maxW="2xl" p="6" shadow="sm" w="full">
+ <Box
+ borderColor="border.subtle"
+ borderRadius="xl"
+ borderWidth="1px"
+ maxW="2xl"
+ p="6"
+ shadow="sm"
+ textStyle="xl"
+ w="full"
+ >
<Stack gap="5">
<Stack gap="2">
<Heading size="3xl">{t('shell.backendUnavailable.title')}</Heading>
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/MissingFontsDialog.tsx b/invokeai/frontend/webv2/src/workbench/widgets/canvas/MissingFontsDialog.tsx
index 68a4176843..659ef0ddfb 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/MissingFontsDialog.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/MissingFontsDialog.tsx
@@ -183,7 +183,9 @@ const RecoveryRow = ({ group, engine }: { group: FontGroup; engine: CanvasEngine
: (catalog.data?.items ?? []);
return (
<Stack borderWidth="1px" borderRadius="md" p="3" gap="2">
- <Text fontWeight="medium">{group.fontRef.label}</Text>
+ <Text fontSize="lg" fontWeight="medium">
+ {group.fontRef.label}
+ </Text>
<Text color="fg.muted" fontSize="md">
{t('fonts.missing.layers', { count: group.count })}
</Text>
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageIndexProgress.tsx b/invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageIndexProgress.tsx
index 34bf6b9e1c..504d6f0c07 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageIndexProgress.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageIndexProgress.tsx
@@ -49,7 +49,9 @@ export const ImageIndexProgressPanel = ({
return (
<Stack align="center" gap="2" maxW="sm" textAlign="center" w="full">
- <Text fontWeight="semibold">Indexing gallery</Text>
+ <Text fontSize="xl" fontWeight="semibold">
+ Indexing gallery
+ </Text>
<Text color="fg.muted" fontSize="lg">
Images and videos are being embedded so they can be mapped. The map appears here on its own once enough of them
are done — you can keep working in the meantime.
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapWidgetView.tsx b/invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapWidgetView.tsx
index afee3bbe35..f94387dc3e 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapWidgetView.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapWidgetView.tsx
@@ -290,7 +290,9 @@ const CenteredMessage = ({
}) => (
<Center h="full" p="6">
<Stack align="center" gap="2" maxW="sm" textAlign="center">
- <Text fontWeight="semibold">{title}</Text>
+ <Text fontSize="xl" fontWeight="semibold">
+ {title}
+ </Text>
<Text color="fg.muted" fontSize="lg">
{detail}
</Text>