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.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
perf(ui): keep Invoke cluster styles inside their components
Josh Corbett6de673c24f20
diff --git a/invokeai/frontend/webv2/src/workbench/shell/topbar/InvokeButton.tsx b/invokeai/frontend/webv2/src/workbench/shell/topbar/InvokeButton.tsxindex 0c5385088d..833c4a2444 100644--- a/invokeai/frontend/webv2/src/workbench/shell/topbar/InvokeButton.tsx+++ b/invokeai/frontend/webv2/src/workbench/shell/topbar/InvokeButton.tsx@@ -13,12 +13,18 @@ import { useTranslation } from 'react-i18next';import type { InvocationState } from './useInvocationState';import { getInvokeIconMode } from './invokeButtonModel';-import { INVOKE_BUTTON_CSS } from './invokeClusterCss';import { HIDE_BELOW_HINT_WIDTH } from './topbarBreakpoints';import { TopbarShortcutKeys } from './TopbarShortcutKeys';import { useTopbarShortcutBinding } from './useTopbarShortcut';const TOOLTIP_CONTENT_PROPS = { p: '0' };++/**+ * Invoke sits on top of its attached neighbours with full control corners; the iterations field and routing button+ * each run a tail of their frame under those corners so they read as a continuing border, not a notch.+ * Doubled specificity outranks the attached Group's `!important` corner reset.+ */+const INVOKE_BUTTON_CSS = { '&&': { borderRadius: 'control !important' } } as const;/** The hint inherits the button's text color; its frame is that color, faded. */const SHORTCUT_BORDER = 'color-mix(in oklab, currentColor 40%, transparent)';diff --git a/invokeai/frontend/webv2/src/workbench/shell/topbar/IterationsField.tsx b/invokeai/frontend/webv2/src/workbench/shell/topbar/IterationsField.tsxindex dd4a74e257..693b42eb28 100644--- a/invokeai/frontend/webv2/src/workbench/shell/topbar/IterationsField.tsx+++ b/invokeai/frontend/webv2/src/workbench/shell/topbar/IterationsField.tsx@@ -6,9 +6,27 @@ import { useActiveProjectSelector, useWorkbenchCommands } from '@workbench/Workbimport { useCallback } from 'react';import { useTranslation } from 'react-i18next';-import { TAIL_UNDER_INVOKE_AFTER_CSS } from './invokeClusterCss';import { getBatchCount } from './useInvocationState';+/**+ * Invoke's rounded corners overlap this field, so its edge facing Invoke is hidden and a tail continues the frame+ * beneath them. The input is a replaced element, so the root carries the tail; it overlaps the input by 2px so the+ * opaque border rows join without a sub-pixel seam.+ */+const TAIL_UNDER_INVOKE_AFTER_CSS = {+ '& input': { borderInlineEndColor: 'transparent' },+ '&::after': {+ borderBlockWidth: '1px',+ content: '""',+ pointerEvents: 'none',+ position: 'absolute',+ borderColor: 'border',+ insetBlock: 0,+ insetInlineStart: 'calc(100% - 2px)',+ width: 'calc({radii.control} + 2px)',+ },+} as const;+export const IterationsField = () => {const { t } = useTranslation();const { batchCount, sourceId } = useActiveProjectSelector(diff --git a/invokeai/frontend/webv2/src/workbench/shell/topbar/RoutingControl.tsx b/invokeai/frontend/webv2/src/workbench/shell/topbar/RoutingControl.tsxindex a176b05a19..22d83f2ed3 100644--- a/invokeai/frontend/webv2/src/workbench/shell/topbar/RoutingControl.tsx+++ b/invokeai/frontend/webv2/src/workbench/shell/topbar/RoutingControl.tsx@@ -15,9 +15,32 @@ import { useTranslation } from 'react-i18next';import type { InvocationState } from './useInvocationState';-import { TAIL_UNDER_INVOKE_BEFORE_CSS } from './invokeClusterCss';import { RoutingDestinationSegments } from './RoutingDestinationSegments';+/**+ * Invoke's rounded corners overlap this button, so its edge facing Invoke stays a transparent 1px border (keeping the+ * content box centred) and a tail continues the frame beneath them. The tail inherits the surface so hover and active+ * states carry under the corners; it covers the edge column with its border rows but clips its fill off that column,+ * where the button's translucent fill would double.+ */+const TAIL_UNDER_INVOKE_BEFORE_CSS = {+ borderInlineStartColor: 'transparent',+ '&::before': {+ borderBlockWidth: '1px',+ content: '""',+ pointerEvents: 'none',+ position: 'absolute',+ backgroundClip: 'content-box',+ backgroundColor: 'inherit',+ borderBlockColor: 'inherit',+ // Offsets resolve inside the button's border; step out so the tail continues its rows and spans its edge column.+ insetBlock: '-1px',+ insetInlineEnd: '100%',+ paddingInlineEnd: '1px',+ width: 'calc({radii.control} + 2px)',+ },+} as const;+const MENU_POSITIONING = { placement: 'bottom-end' } as const;export const RoutingControl = ({ state }: { state: InvocationState }) => {diff --git a/invokeai/frontend/webv2/src/workbench/shell/topbar/invokeClusterCss.ts b/invokeai/frontend/webv2/src/workbench/shell/topbar/invokeClusterCss.tsdeleted file mode 100644index bfea27f0f6..0000000000--- a/invokeai/frontend/webv2/src/workbench/shell/topbar/invokeClusterCss.ts+++ /dev/null@@ -1,50 +0,0 @@-/**- * Invoke sits on top of its attached neighbours with full control corners. Each neighbour hides the edge facing- * Invoke (it would show in the corners as a bracket) and runs a tail of its frame under the button, so the corners- * reveal a continuing border instead of a notch.- */--/** Doubled specificity outranks the attached Group's `!important` corner reset. */-export const INVOKE_BUTTON_CSS = { '&&': { borderRadius: 'control !important' } } as const;--const TAIL = {- borderBlockWidth: '1px',- content: '""',- pointerEvents: 'none',- position: 'absolute',-} as const;--/**- * For the number input before Invoke. Its surface is a transparent outline input (a replaced element, so the root- * carries the tail); the tail overlaps the input by 2px so the opaque border rows join without a sub-pixel seam.- */-export const TAIL_UNDER_INVOKE_AFTER_CSS = {- '& input': { borderInlineEndColor: 'transparent' },- '&::after': {- ...TAIL,- borderColor: 'border',- insetBlock: 0,- insetInlineStart: 'calc(100% - 2px)',- width: 'calc({radii.control} + 2px)',- },-} as const;--/**- * For a button after Invoke; its edge stays as a transparent 1px border so the content box stays centred. The tail- * inherits the surface so hover and active states carry under the corners. It covers that edge column with its border- * rows (no mitred corner) but clips its fill off the column, where the button's translucent fill would double.- */-export const TAIL_UNDER_INVOKE_BEFORE_CSS = {- borderInlineStartColor: 'transparent',- '&::before': {- ...TAIL,- backgroundClip: 'content-box',- backgroundColor: 'inherit',- borderBlockColor: 'inherit',- // Offsets resolve inside the button's border; step out so the tail continues its rows and spans its edge column.- insetBlock: '-1px',- insetInlineEnd: '100%',- paddingInlineEnd: '1px',- width: 'calc({radii.control} + 2px)',- },-} as const;