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
refactor(webv2): centralize workflow node chrome shared with manager previews
joshistoasta860ea12a51d
diff --git a/invokeai/frontend/webv2/performance/browser-baseline.json b/invokeai/frontend/webv2/performance/browser-baseline.jsonindex 852b15cd80..81c43aa197 100644--- a/invokeai/frontend/webv2/performance/browser-baseline.json+++ b/invokeai/frontend/webv2/performance/browser-baseline.json@@ -25,12 +25,12 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 112.39999999850988,+ "domContentLoadedMedianMs": 112,"id": "launchpad","layoutAckMedianMs": 0,"layoutReturnSwitchMedianMs": 0,"layoutSwitchMedianMs": 0,- "loadMedianMs": 112.5,+ "loadMedianMs": 112.10000000149012,"longestTaskMaxMs": 68,"owner": "app","projectSwitchMedianMs": 0,@@ -43,9 +43,9 @@"largestAssetRawBytes": 746569,"otherRawBytes": 141340,"requestCount": 37,- "scriptRawBytes": 1612864,+ "scriptRawBytes": 1612773,"scriptRequestCount": 33,- "totalRawBytes": 1780027+ "totalRawBytes": 1779936},"resourceLimits": {"cssRawBytes": 2181,@@ -54,11 +54,11 @@"largestAssetRawBytes": 754035,"otherRawBytes": 142754,"requestCount": 37,- "scriptRawBytes": 1628993,+ "scriptRawBytes": 1628901,"scriptRequestCount": 33,- "totalRawBytes": 1797828+ "totalRawBytes": 1797736},- "routeReadyMedianMs": 245.29999999701977,+ "routeReadyMedianMs": 252.79999999701977,"scriptSourceOwnerSet": "launchpad-static","stateProfile": "empty"},@@ -85,13 +85,13 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 109.10000000149012,+ "domContentLoadedMedianMs": 110.39999999850988,"id": "launchpad","layoutAckMedianMs": 0,"layoutReturnSwitchMedianMs": 0,"layoutSwitchMedianMs": 0,- "loadMedianMs": 109.29999999701977,- "longestTaskMaxMs": 71,+ "loadMedianMs": 110.39999999850988,+ "longestTaskMaxMs": 65,"owner": "app","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:launchpad",@@ -103,9 +103,9 @@"largestAssetRawBytes": 746569,"otherRawBytes": 141340,"requestCount": 37,- "scriptRawBytes": 1612864,+ "scriptRawBytes": 1612773,"scriptRequestCount": 33,- "totalRawBytes": 1780027+ "totalRawBytes": 1779936},"resourceLimits": {"cssRawBytes": 2181,@@ -114,11 +114,11 @@"largestAssetRawBytes": 754035,"otherRawBytes": 142754,"requestCount": 37,- "scriptRawBytes": 1628993,+ "scriptRawBytes": 1628901,"scriptRequestCount": 33,- "totalRawBytes": 1797828+ "totalRawBytes": 1797736},- "routeReadyMedianMs": 262.19999999552965,+ "routeReadyMedianMs": 263.6000000014901,"scriptSourceOwnerSet": "launchpad-static","stateProfile": "representative"},@@ -145,15 +145,15 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 114.20000000298023,+ "domContentLoadedMedianMs": 111.69999999552965,"id": "editor-minimal","layoutAckMedianMs": 0,"layoutReturnSwitchMedianMs": 0,"layoutSwitchMedianMs": 0,- "loadMedianMs": 114.29999999701977,- "longestTaskMaxMs": 87,+ "loadMedianMs": 111.79999999701977,+ "longestTaskMaxMs": 90,"owner": "workbench",- "projectSwitchMedianMs": 34,+ "projectSwitchMedianMs": 32.399999998509884,"readyMark": "invokeai:ready:widget:center:preview","remediationTicket": "deepen-widget-registry-loading","resourceBaseline": {@@ -162,10 +162,10 @@"imageRawBytes": 156376,"largestAssetRawBytes": 746569,"otherRawBytes": 141340,- "requestCount": 113,- "scriptRawBytes": 3075255,- "scriptRequestCount": 108,- "totalRawBytes": 3398794+ "requestCount": 112,+ "scriptRawBytes": 3074967,+ "scriptRequestCount": 107,+ "totalRawBytes": 3398506},"resourceLimits": {"cssRawBytes": 2181,@@ -173,12 +173,12 @@"imageRawBytes": 157940,"largestAssetRawBytes": 754035,"otherRawBytes": 142754,- "requestCount": 113,- "scriptRawBytes": 3106008,- "scriptRequestCount": 108,- "totalRawBytes": 3432782+ "requestCount": 112,+ "scriptRawBytes": 3105717,+ "scriptRequestCount": 107,+ "totalRawBytes": 3432492},- "routeReadyMedianMs": 646.2999999970198,+ "routeReadyMedianMs": 643.5,"scriptSourceOwnerSet": "editor-minimal-static","stateProfile": "empty"},@@ -205,15 +205,15 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 114.40000000596046,+ "domContentLoadedMedianMs": 111,"id": "editor-minimal","layoutAckMedianMs": 0,"layoutReturnSwitchMedianMs": 0,"layoutSwitchMedianMs": 0,- "loadMedianMs": 114.5,- "longestTaskMaxMs": 182,+ "loadMedianMs": 111.09999999403954,+ "longestTaskMaxMs": 180,"owner": "workbench",- "projectSwitchMedianMs": 51.399999998509884,+ "projectSwitchMedianMs": 51.30000000447035,"readyMark": "invokeai:ready:widget:center:preview","remediationTicket": "deepen-widget-registry-loading","resourceBaseline": {@@ -222,10 +222,10 @@"imageRawBytes": 156376,"largestAssetRawBytes": 746569,"otherRawBytes": 141340,- "requestCount": 113,- "scriptRawBytes": 3075255,- "scriptRequestCount": 108,- "totalRawBytes": 3398794+ "requestCount": 112,+ "scriptRawBytes": 3074967,+ "scriptRequestCount": 107,+ "totalRawBytes": 3398506},"resourceLimits": {"cssRawBytes": 2181,@@ -233,12 +233,12 @@"imageRawBytes": 157940,"largestAssetRawBytes": 754035,"otherRawBytes": 142754,- "requestCount": 113,- "scriptRawBytes": 3106008,- "scriptRequestCount": 108,- "totalRawBytes": 3432782+ "requestCount": 112,+ "scriptRawBytes": 3105717,+ "scriptRequestCount": 107,+ "totalRawBytes": 3432492},- "routeReadyMedianMs": 435.79999999701977,+ "routeReadyMedianMs": 437.5,"scriptSourceOwnerSet": "editor-minimal-static","stateProfile": "representative"},@@ -265,13 +265,13 @@"scriptRequestCount": 6,"totalRawBytes": 290719},- "domContentLoadedMedianMs": 110.29999999701977,+ "domContentLoadedMedianMs": 108.5,"id": "editor-canvas",- "layoutAckMedianMs": 2.100000001490116,- "layoutReturnSwitchMedianMs": 36.29999999701977,- "layoutSwitchMedianMs": 65.5,- "loadMedianMs": 110.5,- "longestTaskMaxMs": 91,+ "layoutAckMedianMs": 2.7000000029802322,+ "layoutReturnSwitchMedianMs": 35.399999998509884,+ "layoutSwitchMedianMs": 66.59999999403954,+ "loadMedianMs": 108.60000000149012,+ "longestTaskMaxMs": 87,"owner": "canvas","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:canvas",@@ -282,10 +282,10 @@"imageRawBytes": 156376,"largestAssetRawBytes": 746569,"otherRawBytes": 141340,- "requestCount": 119,- "scriptRawBytes": 3363095,- "scriptRequestCount": 114,- "totalRawBytes": 3686634+ "requestCount": 118,+ "scriptRawBytes": 3362807,+ "scriptRequestCount": 113,+ "totalRawBytes": 3686346},"resourceLimits": {"cssRawBytes": 2181,@@ -293,12 +293,12 @@"imageRawBytes": 157940,"largestAssetRawBytes": 754035,"otherRawBytes": 142754,- "requestCount": 119,- "scriptRawBytes": 3396726,- "scriptRequestCount": 114,- "totalRawBytes": 3723501+ "requestCount": 118,+ "scriptRawBytes": 3396436,+ "scriptRequestCount": 113,+ "totalRawBytes": 3723210},- "routeReadyMedianMs": 996.5,+ "routeReadyMedianMs": 982.1999999955297,"scriptSourceOwnerSet": "editor-canvas-static","stateProfile": "empty"},@@ -325,13 +325,13 @@"scriptRequestCount": 6,"totalRawBytes": 290719},- "domContentLoadedMedianMs": 106.79999999701977,+ "domContentLoadedMedianMs": 108.60000000149012,"id": "editor-canvas",- "layoutAckMedianMs": 2.5,- "layoutReturnSwitchMedianMs": 34.69999999552965,- "layoutSwitchMedianMs": 168.60000000149012,- "loadMedianMs": 106.89999999850988,- "longestTaskMaxMs": 326,+ "layoutAckMedianMs": 2.2000000029802322,+ "layoutReturnSwitchMedianMs": 35.5,+ "layoutSwitchMedianMs": 169,+ "loadMedianMs": 108.70000000298023,+ "longestTaskMaxMs": 329,"owner": "canvas","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:canvas",@@ -342,10 +342,10 @@"imageRawBytes": 156376,"largestAssetRawBytes": 746569,"otherRawBytes": 141340,- "requestCount": 119,- "scriptRawBytes": 3363095,- "scriptRequestCount": 114,- "totalRawBytes": 3686634+ "requestCount": 118,+ "scriptRawBytes": 3362807,+ "scriptRequestCount": 113,+ "totalRawBytes": 3686346},"resourceLimits": {"cssRawBytes": 2181,@@ -353,12 +353,12 @@"imageRawBytes": 157940,"largestAssetRawBytes": 754035,"otherRawBytes": 142754,- "requestCount": 119,- "scriptRawBytes": 3396726,- "scriptRequestCount": 114,- "totalRawBytes": 3723501+ "requestCount": 118,+ "scriptRawBytes": 3396436,+ "scriptRequestCount": 113,+ "totalRawBytes": 3723210},- "routeReadyMedianMs": 1184.7999999970198,+ "routeReadyMedianMs": 1181,"scriptSourceOwnerSet": "editor-canvas-static","stateProfile": "representative"},@@ -369,10 +369,10 @@"imageRawBytes": 0,"largestAssetRawBytes": 173980,"otherRawBytes": 0,- "requestCount": 8,- "scriptRawBytes": 360334,- "scriptRequestCount": 7,- "totalRawBytes": 375747+ "requestCount": 7,+ "scriptRawBytes": 360788,+ "scriptRequestCount": 6,+ "totalRawBytes": 376201},"activatedResourceLimits": {"cssRawBytes": 15568,@@ -380,18 +380,18 @@"imageRawBytes": 0,"largestAssetRawBytes": 175720,"otherRawBytes": 0,- "requestCount": 8,- "scriptRawBytes": 363938,- "scriptRequestCount": 7,- "totalRawBytes": 379505+ "requestCount": 7,+ "scriptRawBytes": 364396,+ "scriptRequestCount": 6,+ "totalRawBytes": 379964},- "domContentLoadedMedianMs": 106.79999999701977,+ "domContentLoadedMedianMs": 112.90000000596046,"id": "editor-workflow",- "layoutAckMedianMs": 2,- "layoutReturnSwitchMedianMs": 31.200000002980232,- "layoutSwitchMedianMs": 82,- "loadMedianMs": 107,- "longestTaskMaxMs": 84,+ "layoutAckMedianMs": 2.100000001490116,+ "layoutReturnSwitchMedianMs": 32.100000001490116,+ "layoutSwitchMedianMs": 83.29999999701977,+ "loadMedianMs": 113.10000000149012,+ "longestTaskMaxMs": 91,"owner": "workflow","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:workflow",@@ -402,10 +402,10 @@"imageRawBytes": 156376,"largestAssetRawBytes": 746569,"otherRawBytes": 141340,- "requestCount": 121,- "scriptRawBytes": 3435589,- "scriptRequestCount": 115,- "totalRawBytes": 3774541+ "requestCount": 119,+ "scriptRawBytes": 3435755,+ "scriptRequestCount": 113,+ "totalRawBytes": 3774707},"resourceLimits": {"cssRawBytes": 17748,@@ -413,12 +413,12 @@"imageRawBytes": 157940,"largestAssetRawBytes": 754035,"otherRawBytes": 142754,- "requestCount": 121,- "scriptRawBytes": 3469945,- "scriptRequestCount": 115,- "totalRawBytes": 3812287+ "requestCount": 119,+ "scriptRawBytes": 3470113,+ "scriptRequestCount": 113,+ "totalRawBytes": 3812455},- "routeReadyMedianMs": 1004.2999999970198,+ "routeReadyMedianMs": 1004,"scriptSourceOwnerSet": "editor-workflow-static","stateProfile": "empty"},@@ -429,10 +429,10 @@"imageRawBytes": 0,"largestAssetRawBytes": 173980,"otherRawBytes": 0,- "requestCount": 8,- "scriptRawBytes": 360334,- "scriptRequestCount": 7,- "totalRawBytes": 375747+ "requestCount": 7,+ "scriptRawBytes": 360788,+ "scriptRequestCount": 6,+ "totalRawBytes": 376201},"activatedResourceLimits": {"cssRawBytes": 15568,@@ -440,18 +440,18 @@"imageRawBytes": 0,"largestAssetRawBytes": 175720,"otherRawBytes": 0,- "requestCount": 8,- "scriptRawBytes": 363938,- "scriptRequestCount": 7,- "totalRawBytes": 379505+ "requestCount": 7,+ "scriptRawBytes": 364396,+ "scriptRequestCount": 6,+ "totalRawBytes": 379964},- "domContentLoadedMedianMs": 108.89999999850988,+ "domContentLoadedMedianMs": 105.60000000149012,"id": "editor-workflow",- "layoutAckMedianMs": 2.399999998509884,- "layoutReturnSwitchMedianMs": 39.600000001490116,- "layoutSwitchMedianMs": 122.69999999552965,- "loadMedianMs": 108.90000000596046,- "longestTaskMaxMs": 332,+ "layoutAckMedianMs": 2.2999999970197678,+ "layoutReturnSwitchMedianMs": 40.399999998509884,+ "layoutSwitchMedianMs": 126.89999999850988,+ "loadMedianMs": 105.80000000447035,+ "longestTaskMaxMs": 323,"owner": "workflow","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:workflow",@@ -462,10 +462,10 @@"imageRawBytes": 156376,"largestAssetRawBytes": 746569,"otherRawBytes": 141340,- "requestCount": 121,- "scriptRawBytes": 3435589,- "scriptRequestCount": 115,- "totalRawBytes": 3774541+ "requestCount": 119,+ "scriptRawBytes": 3435755,+ "scriptRequestCount": 113,+ "totalRawBytes": 3774707},"resourceLimits": {"cssRawBytes": 17748,@@ -473,12 +473,12 @@"imageRawBytes": 157940,"largestAssetRawBytes": 754035,"otherRawBytes": 142754,- "requestCount": 121,- "scriptRawBytes": 3469945,- "scriptRequestCount": 115,- "totalRawBytes": 3812287+ "requestCount": 119,+ "scriptRawBytes": 3470113,+ "scriptRequestCount": 113,+ "totalRawBytes": 3812455},- "routeReadyMedianMs": 1144.6000000014901,+ "routeReadyMedianMs": 1134.9000000059605,"scriptSourceOwnerSet": "editor-workflow-static","stateProfile": "representative"},@@ -505,13 +505,13 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 109.40000000596046,+ "domContentLoadedMedianMs": 106.89999999850988,"id": "editor-gallery","layoutAckMedianMs": 0,"layoutReturnSwitchMedianMs": 0,- "layoutSwitchMedianMs": 23.30000000447035,- "loadMedianMs": 109.5,- "longestTaskMaxMs": 85,+ "layoutSwitchMedianMs": 22.700000002980232,+ "loadMedianMs": 106.89999999850988,+ "longestTaskMaxMs": 86,"owner": "gallery","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:gallery",@@ -522,10 +522,10 @@"imageRawBytes": 156376,"largestAssetRawBytes": 746569,"otherRawBytes": 141340,- "requestCount": 113,- "scriptRawBytes": 3075255,- "scriptRequestCount": 108,- "totalRawBytes": 3398794+ "requestCount": 112,+ "scriptRawBytes": 3074967,+ "scriptRequestCount": 107,+ "totalRawBytes": 3398506},"resourceLimits": {"cssRawBytes": 2181,@@ -533,12 +533,12 @@"imageRawBytes": 157940,"largestAssetRawBytes": 754035,"otherRawBytes": 142754,- "requestCount": 113,- "scriptRawBytes": 3106008,- "scriptRequestCount": 108,- "totalRawBytes": 3432782+ "requestCount": 112,+ "scriptRawBytes": 3105717,+ "scriptRequestCount": 107,+ "totalRawBytes": 3432492},- "routeReadyMedianMs": 1220,+ "routeReadyMedianMs": 1214,"scriptSourceOwnerSet": "editor-minimal-static","stateProfile": "empty"},@@ -565,13 +565,13 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 108.5,+ "domContentLoadedMedianMs": 108.10000000149012,"id": "editor-gallery","layoutAckMedianMs": 0,"layoutReturnSwitchMedianMs": 0,- "layoutSwitchMedianMs": 82.60000000149012,- "loadMedianMs": 108.59999999403954,- "longestTaskMaxMs": 160,+ "layoutSwitchMedianMs": 84.60000000149012,+ "loadMedianMs": 108.19999999552965,+ "longestTaskMaxMs": 162,"owner": "gallery","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:gallery",@@ -582,10 +582,10 @@"imageRawBytes": 156376,"largestAssetRawBytes": 746569,"otherRawBytes": 141340,- "requestCount": 113,- "scriptRawBytes": 3075255,- "scriptRequestCount": 108,- "totalRawBytes": 3398794+ "requestCount": 112,+ "scriptRawBytes": 3074967,+ "scriptRequestCount": 107,+ "totalRawBytes": 3398506},"resourceLimits": {"cssRawBytes": 2181,@@ -593,12 +593,12 @@"imageRawBytes": 157940,"largestAssetRawBytes": 754035,"otherRawBytes": 142754,- "requestCount": 113,- "scriptRawBytes": 3106008,- "scriptRequestCount": 108,- "totalRawBytes": 3432782+ "requestCount": 112,+ "scriptRawBytes": 3105717,+ "scriptRequestCount": 107,+ "totalRawBytes": 3432492},- "routeReadyMedianMs": 1412.5999999940395,+ "routeReadyMedianMs": 1420.7999999970198,"scriptSourceOwnerSet": "editor-minimal-static","stateProfile": "representative"}@@ -3296,7 +3296,6 @@"source:src/features/workflow/ui/editor/flowAdapters.ts","source:src/features/workflow/ui/editor/flowInstanceStore.ts","source:src/features/workflow/ui/editor/handleTooltip.ts",- "source:src/features/workflow/ui/editor/nodeChrome.ts","source:src/features/workflow/ui/editor/performanceConstants.ts","source:src/features/workflow/ui/editor/selectionStore.ts","source:src/features/workflow/ui/editor/useEraser.tsx",@@ -3337,6 +3336,7 @@"source:src/features/workflow/ui/linear/WorkflowLinearPanel.tsx","source:src/features/workflow/ui/linear/formBuilderDnd.ts","source:src/features/workflow/ui/linear/formElementMeta.ts",+ "source:src/features/workflow/ui/nodeChrome.tsx","source:src/features/workflow/ui/pendingLibraryWorkflowLoadRuntime.ts","source:src/features/workflow/ui/useProjectGraphCommands.ts","source:src/features/workflow/ui/workflowTransfer.ts",diff --git a/invokeai/frontend/webv2/src/features/nodes/ui/detail/NodePreviewCard.tsx b/invokeai/frontend/webv2/src/features/nodes/ui/detail/NodePreviewCard.tsxindex 10483708dd..8201d348fc 100644--- a/invokeai/frontend/webv2/src/features/nodes/ui/detail/NodePreviewCard.tsx+++ b/invokeai/frontend/webv2/src/features/nodes/ui/detail/NodePreviewCard.tsx@@ -6,49 +6,34 @@ import type {InvocationTemplate,} from '@features/workflow/contracts';-import { Box, Flex, Icon, Stack, Text } from '@chakra-ui/react';-import { getWorkflowNodeChromeProps, WORKFLOW_NODE_DENSITY } from '@features/workflow/preview';-import { getFieldTypeColor, getFieldTypeLabel, isModelFieldType } from '@features/workflow/utility';+import { Box, Flex, Stack, Text } from '@chakra-ui/react';+import {+ getWorkflowNodeBodyProps,+ getWorkflowNodeHeaderProps,+ getWorkflowNodeShellProps,+ WORKFLOW_NODE_DENSITY,+ WorkflowNodeHandleDot,+ WorkflowNodeInfoIcon,+} from '@features/workflow/preview';+import { getFieldTypeLabel } from '@features/workflow/utility';import { Tooltip } from '@platform/ui';import { MiddleTruncate } from '@platform/ui/MiddleTruncate';-import { InfoIcon } from 'lucide-react';import { useTranslation } from 'react-i18next';/*** A read-only, static rendering of a single node — the same visual language as* the editor's `InvocationFlowNode` (titled header, output rows above input- * rows, colored field handles) but with none of its editor coupling. The real- * node depends on ReactFlow context (`Handle`, `useStore`) and the workbench- * dispatch; the Launchpad mounts neither, so this previews the node's shape- * from just its `InvocationTemplate`. Handles are drawn as plain dots, fields- * are labels only (no value controls), and nothing is interactive.+ * rows, colored field handles), shared via the workflow feature's node chrome+ * helpers, but with none of its editor coupling. The real node depends on+ * ReactFlow context (`Handle`, `useStore`) and the workbench dispatch; the+ * Launchpad mounts neither, so this previews the node's shape from just its+ * `InvocationTemplate`. Handles are drawn as plain dots, fields are labels+ * only (no value controls), and nothing is interactive.*/const sortByUiOrder = <T extends { uiOrder?: number | null }>(templates: T[]): T[] =>[...templates].sort((a, b) => (a.uiOrder ?? Number.MAX_SAFE_INTEGER) - (b.uiOrder ?? Number.MAX_SAFE_INTEGER));-/** A static stand-in for a ReactFlow connection handle, tinted and shaped by field type. */-const HandleDot = ({ side, type }: { side: 'left' | 'right'; type: FieldType }) => {- const color = getFieldTypeColor(type);- const isFilled = type.cardinality === 'SINGLE';- const isAngular = isModelFieldType(type) || type.batch;-- return (- <Box- bg={isFilled ? color : 'bg.muted'}- borderColor={color}- borderRadius={isAngular ? 'xs' : 'full'}- borderWidth={isFilled ? '0' : '2px'}- boxShadow="0 0 0 1.5px {colors.bg.muted}"- boxSize="3"- position="absolute"- top="50%"- transform={`translate(${side === 'left' ? '-50%' : '50%'}, -50%)${type.batch ? ' rotate(45deg)' : ''}`}- {...(side === 'left' ? { left: '0' } : { right: '0' })}- />- );-};-const FieldTooltip = ({description,direction,@@ -88,7 +73,7 @@ const OutputRow = ({ template }: { template: FieldOutputTemplate }) => (/></Flex></Tooltip>- <HandleDot side="right" type={template.type} />+ <WorkflowNodeHandleDot side="right" type={template.type} /></Box>);@@ -107,7 +92,7 @@ const InputRow = ({ template }: { template: FieldInputTemplate }) => () : null}</Text></Tooltip>- {template.input !== 'direct' ? <HandleDot side="left" type={template.type} /> : null}+ {template.input !== 'direct' ? <WorkflowNodeHandleDot side="left" type={template.type} /> : null}</Box>);@@ -132,30 +117,16 @@ export const NodePreviewCard = ({ template }: { template: InvocationTemplate })const hasFields = inputTemplates.length > 0 || outputTemplates.length > 0;return (- <Box bg="bg" fontSize="xs" rounded="lg" w="full" {...getWorkflowNodeChromeProps({ selected: false })}>- <Flex- align="center"- bg="bg.subtle"- borderBottomWidth="1px"- borderColor="border.subtle"- borderTopRadius="lg"- gap="2"- pe="2"- ps="2.5"- py={WORKFLOW_NODE_DENSITY.headerPaddingY}- >+ <Box w="full" {...getWorkflowNodeShellProps({ selected: false })}>+ <Flex {...getWorkflowNodeHeaderProps()}><MiddleTruncate fontWeight="700" minW="0" text={template.title} /><Box flex="1" />- <Tooltip content={<NodeInfoTooltip template={template} />} positioning={{ placement: 'top-end' }} showArrow>- <Icon- aria-label={t('nodes.nodeDetailsAria', { title: template.title })}- as={InfoIcon}- boxSize="3.5"- color="fg.subtle"- />- </Tooltip>+ <WorkflowNodeInfoIcon+ content={<NodeInfoTooltip template={template} />}+ label={t('nodes.nodeDetailsAria', { title: template.title })}+ /></Flex>- <Stack bg="bg.muted" borderBottomRadius="lg" gap="0" py={WORKFLOW_NODE_DENSITY.bodyPaddingY}>+ <Stack gap="0" {...getWorkflowNodeBodyProps()}>{hasFields ? (<>{outputTemplates.map((output) => (diff --git a/invokeai/frontend/webv2/src/features/workflow/preview.ts b/invokeai/frontend/webv2/src/features/workflow/preview.tsindex a07f117100..5cf7a72582 100644--- a/invokeai/frontend/webv2/src/features/workflow/preview.ts+++ b/invokeai/frontend/webv2/src/features/workflow/preview.ts@@ -1,2 +1,10 @@export { documentToPreviewGraph, GraphPreviewDialog, GraphPreviewFlow } from './ui/graph-preview';-export { getWorkflowNodeChromeProps, WORKFLOW_NODE_DENSITY } from './ui/editor/nodeChrome';+export {+ getWorkflowNodeBodyProps,+ getWorkflowNodeChromeProps,+ getWorkflowNodeHeaderProps,+ getWorkflowNodeShellProps,+ WORKFLOW_NODE_DENSITY,+ WorkflowNodeHandleDot,+ WorkflowNodeInfoIcon,+} from './ui/nodeChrome';diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/editor/ConnectorFlowNode.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/editor/ConnectorFlowNode.tsxindex 691f3ec239..b02618a929 100644--- a/invokeai/frontend/webv2/src/features/workflow/ui/editor/ConnectorFlowNode.tsx+++ b/invokeai/frontend/webv2/src/features/workflow/ui/editor/ConnectorFlowNode.tsx@@ -2,12 +2,11 @@ import type { FieldType } from '@features/workflow/contracts';import { Box, Flex } from '@chakra-ui/react';import {- CONNECTOR_INPUT_HANDLE,- CONNECTOR_OUTPUT_HANDLE,- getFieldTypeColor,- getFieldTypeLabel,- isModelFieldType,-} from '@features/workflow/utility';+ getWorkflowNodeChromeProps,+ getWorkflowNodeHandleStyle,+ WORKFLOW_NODE_HANDLE_SIZE,+} from '@features/workflow/ui/nodeChrome';+import { CONNECTOR_INPUT_HANDLE, CONNECTOR_OUTPUT_HANDLE, getFieldTypeLabel } from '@features/workflow/utility';import { Tooltip } from '@platform/ui';import { Handle, Position, type NodeProps } from '@xyflow/react';import { memo, useMemo } from 'react';@@ -15,37 +14,17 @@ import { memo, useMemo } from 'react';import type { ConnectorFlowNode as ConnectorFlowNodeType } from './flowAdapters';import { getHandleTypeTooltip } from './handleTooltip';-import { getWorkflowNodeChromeProps } from './nodeChrome';--const HANDLE_SIZE = 12;-type HandleSide = 'left' | 'right';+/** An untyped ("any") connector end: a plain grid-tinted dot rather than a field-typed handle. */const genericHandleStyle: React.CSSProperties = {background: 'var(--wb-flow-grid)',- border: '1px solid var(--chakra-colors-bg)',- height: HANDLE_SIZE,- width: HANDLE_SIZE,-};--const typedHandleStyle = (type: FieldType, side: HandleSide): React.CSSProperties => {- const color = getFieldTypeColor(type);- const isFilled = type.cardinality === 'SINGLE';- const isAngular = isModelFieldType(type) || type.batch;- const centeredDiamondTransform = `translate(${side === 'left' ? '-' : ''}50%, -50%) rotate(45deg)`;-- return {- background: isFilled ? color : 'var(--xy-background-color)',- border: isFilled ? 'none' : `3px solid ${color}`,- borderRadius: isAngular ? 3 : '50%',- boxShadow: '0 0 0 1px var(--xy-background-color)',- height: HANDLE_SIZE,- transform: type.batch ? centeredDiamondTransform : undefined,- width: HANDLE_SIZE,- };+ border: '1px solid var(--xy-background-color)',+ height: WORKFLOW_NODE_HANDLE_SIZE,+ width: WORKFLOW_NODE_HANDLE_SIZE,};-const getConnectorHandleStyle = (type: FieldType | null, side: HandleSide): React.CSSProperties =>- type ? typedHandleStyle(type, side) : genericHandleStyle;+const getConnectorHandleStyle = (type: FieldType | null, side: 'left' | 'right'): React.CSSProperties =>+ type ? getWorkflowNodeHandleStyle(type, side) : genericHandleStyle;const getConnectorTitle = (inputType: FieldType | null, outputType: FieldType | null): string => {const inputLabel = inputType ? getFieldTypeLabel(inputType) : 'Any input';@@ -57,11 +36,11 @@ const getConnectorTitle = (inputType: FieldType | null, outputType: FieldType |const ConnectorFlowNodeComponent = ({ data, selected }: NodeProps<ConnectorFlowNodeType>) => {const node = data.documentNode;const inputHandleStyle = useMemo(- () => ({ ...getConnectorHandleStyle(data.inputFieldType, 'left'), left: -HANDLE_SIZE / 2 }),+ () => ({ ...getConnectorHandleStyle(data.inputFieldType, 'left'), left: -WORKFLOW_NODE_HANDLE_SIZE / 2 }),[data.inputFieldType]);const outputHandleStyle = useMemo(- () => ({ ...getConnectorHandleStyle(data.outputFieldType, 'right'), right: -HANDLE_SIZE / 2 }),+ () => ({ ...getConnectorHandleStyle(data.outputFieldType, 'right'), right: -WORKFLOW_NODE_HANDLE_SIZE / 2 }),[data.outputFieldType]);diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/editor/CurrentImageFlowNode.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/editor/CurrentImageFlowNode.tsxindex eff2d15a3a..d2d9ff17e0 100644--- a/invokeai/frontend/webv2/src/features/workflow/ui/editor/CurrentImageFlowNode.tsx+++ b/invokeai/frontend/webv2/src/features/workflow/ui/editor/CurrentImageFlowNode.tsx@@ -3,6 +3,7 @@ import type { NodeProps } from '@xyflow/react';import { Box, Flex, Text } from '@chakra-ui/react';import { useProgressImage } from '@features/queue/react';+import { getWorkflowNodeHeaderProps, getWorkflowNodeShellProps } from '@features/workflow/ui/nodeChrome';import { useWorkflowProjectSelector } from '@features/workflow/ui/WorkflowUiContext';import { StreamingImageFrame } from '@platform/ui/streaming-image/StreamingImageFrame';import {@@ -13,8 +14,6 @@ import { memo } from 'react';import type { CurrentImageFlowNode as CurrentImageFlowNodeType } from './flowAdapters';-import { getWorkflowNodeChromeProps } from './nodeChrome';-/*** The legacy `current_image` UI node: a live monitor inside the graph. Shows* the in-flight denoising preview while a run executes, and the most recently@@ -34,8 +33,8 @@ const CurrentImageFlowNodeComponent = ({ data, selected }: NodeProps<CurrentImagconst latestImage = getLatestImage(galleryValues);return (- <Box bg="bg" fontSize="xs" overflow="hidden" rounded="lg" w="20rem" {...getWorkflowNodeChromeProps({ selected })}>- <Flex align="center" bg="bg.subtle" borderBottomWidth="1px" borderColor="border.subtle" px="3" py="1.5">+ <Box overflow="hidden" w="20rem" {...getWorkflowNodeShellProps({ selected })}>+ <Flex {...getWorkflowNodeHeaderProps()}><Text fontWeight="700">{node.data.label || 'Current Image'}</Text>{progressImage ? (<Text color="brand.solid" fontSize="2xs" ms="auto">diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsxindex 805ff7b7c5..8cfc369f68 100644--- a/invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx+++ b/invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx@@ -1,72 +1,45 @@/* oxlint-disable react-perf/jsx-no-new-object-as-prop, react-perf/jsx-no-new-function-as-prop, react-perf/jsx-no-new-array-as-prop, react-perf/jsx-no-jsx-as-prop */-import type {- FieldInputTemplate,- FieldOutputTemplate,- FieldType,- WorkflowInvocationNode,-} from '@features/workflow/contracts';+import type { FieldInputTemplate, FieldOutputTemplate, WorkflowInvocationNode } from '@features/workflow/contracts';import type { WorkflowNodeExecutionState as NodeExecutionState } from '@features/workflow/ui/contracts';import { Box, Checkbox, Field, Flex, HStack, Icon, IconButton, Image, Input, Stack, Text } from '@chakra-ui/react';import { FieldDescriptionPopover } from '@features/workflow/ui/fields/FieldDescriptionPopover';import { WorkflowFieldInput } from '@features/workflow/ui/fields/WorkflowFieldInput';+import {+ getWorkflowNodeBodyProps,+ getWorkflowNodeHandleStyle,+ getWorkflowNodeHeaderProps,+ getWorkflowNodeShellProps,+ WORKFLOW_NODE_DENSITY,+ WorkflowNodeInfoIcon,+} from '@features/workflow/ui/nodeChrome';import { useProjectGraphCommands } from '@features/workflow/ui/useProjectGraphCommands';import { useWorkflowNodeExecutionState } from '@features/workflow/ui/WorkflowUiContext';import {cloneWorkflowFieldDefault,- getFieldTypeColor,getFieldTypeLabel,getWorkflowFieldInvalidReason,isDirectInputField,isExposableField,isWorkflowFieldValueDefault,- isModelFieldType,} from '@features/workflow/utility';import { Tooltip } from '@platform/ui';import { MiddleTruncate } from '@platform/ui/MiddleTruncate';import { Handle, Position, useStore, type NodeProps } from '@xyflow/react';-import {- ChevronDownIcon,- ChevronRightIcon,- InfoIcon,- PinIcon,- PinOffIcon,- RotateCcwIcon,- TriangleAlertIcon,-} from 'lucide-react';+import { ChevronDownIcon, ChevronRightIcon, PinIcon, PinOffIcon, RotateCcwIcon, TriangleAlertIcon } from 'lucide-react';import { memo, useState, type ChangeEvent, type KeyboardEvent } from 'react';import { useTranslation } from 'react-i18next';import type { InvocationFlowNode as InvocationFlowNodeType, InvocationNodeTemplateView } from './flowAdapters';import { getHandleTypeTooltip } from './handleTooltip';-import { getWorkflowNodeChromeProps, WORKFLOW_NODE_DENSITY } from './nodeChrome';const NODE_WIDTH = '18rem';-const HANDLE_SIZE = 12;-type HandleSide = 'left' | 'right';/** Row padding-x in px; inline handles sit in the label rows, so they pull back out past it. */const ROW_PADDING_X = 12;/** Below this viewport zoom, field content renders as skeleton bars (ComfyUI-style) for performance/readability. */const CONTENT_VISIBILITY_ZOOM = 0.4;-const handleStyle = (type: FieldType, side: HandleSide): React.CSSProperties => {- const color = getFieldTypeColor(type);- const isFilled = type.cardinality === 'SINGLE';- const isAngular = isModelFieldType(type) || type.batch;- const centeredDiamondTransform = `translate(${side === 'left' ? '-' : ''}50%, -50%) rotate(45deg)`;-- return {- background: isFilled ? color : 'var(--xy-background-color)',- border: isFilled ? 'none' : `3px solid ${color}`,- borderRadius: isAngular ? 3 : '50%',- boxShadow: '0 0 0 1.5px var(--xy-background-color)',- height: HANDLE_SIZE,- transform: type.batch ? centeredDiamondTransform : undefined,- width: HANDLE_SIZE,- };-};-/** True while the viewport is zoomed out far enough that field content is unreadable noise. */const useIsZoomedOut = (): boolean => useStore((state) => state.transform[2] < CONTENT_VISIBILITY_ZOOM);@@ -103,13 +76,7 @@ const NodeShell = ({const isInvalid = isMissing || hasMissingRequiredInput;return (- <Box- bg="bg"- fontSize="xs"- rounded="lg"- w={NODE_WIDTH}- {...getWorkflowNodeChromeProps({ invalid: isInvalid, running: isRunning, selected })}- >+ <Box w={NODE_WIDTH} {...getWorkflowNodeShellProps({ invalid: isInvalid, running: isRunning, selected })}>{children}</Box>);@@ -256,27 +223,17 @@ const NodeInfoTooltipContent = ({);};-const NodeInfoButton = ({+const NodeInfoIcon = ({node,template,}: {node: WorkflowInvocationNode;template: InvocationNodeTemplateView['template'];}) => (- <Tooltip+ <WorkflowNodeInfoIconcontent={<NodeInfoTooltipContent node={node} template={template} />}- positioning={{ placement: 'top-end' }}- showArrow- >- <IconButton- aria-label={`Show details for ${node.data.label || template.title}`}- className="nodrag"- size="2xs"- variant="ghost"- >- <Icon as={InfoIcon} boxSize="3.5" />- </IconButton>- </Tooltip>+ label={`Show details for ${node.data.label || template.title}`}+ />);const NodeFooter = ({ canUseCache, node }: { canUseCache: boolean; node: WorkflowInvocationNode }) => {@@ -364,7 +321,7 @@ const InputFieldRow = ({<Handleid={template.name}position={Position.Left}- style={{ ...handleStyle(template.type, 'left'), left: -ROW_PADDING_X, top: '50%' }}+ style={{ ...getWorkflowNodeHandleStyle(template.type, 'left'), left: -ROW_PADDING_X, top: '50%' }}type="target"/></Tooltip>@@ -387,7 +344,7 @@ const InputFieldRow = ({<Handleid={template.name}position={Position.Left}- style={{ ...handleStyle(template.type, 'left'), left: -ROW_PADDING_X, top: '50%' }}+ style={{ ...getWorkflowNodeHandleStyle(template.type, 'left'), left: -ROW_PADDING_X, top: '50%' }}type="target"/></Tooltip>@@ -493,7 +450,7 @@ const OutputFieldRow = ({ isSkeleton, template }: { isSkeleton: boolean; templat<Handleid={template.name}position={Position.Right}- style={{ ...handleStyle(template.type, 'right'), right: -ROW_PADDING_X, top: '50%' }}+ style={{ ...getWorkflowNodeHandleStyle(template.type, 'right'), right: -ROW_PADDING_X, top: '50%' }}type="source"/></Tooltip>@@ -535,7 +492,7 @@ const HiddenHandles = ({key={outputTemplate.name}id={outputTemplate.name}position={Position.Right}- style={{ ...handleStyle(outputTemplate.type, 'right'), opacity: 0, right: 0, top: -14 }}+ style={{ ...getWorkflowNodeHandleStyle(outputTemplate.type, 'right'), opacity: 0, right: 0, top: -14 }}type="source"/>))}@@ -545,7 +502,7 @@ const HiddenHandles = ({key={inputTemplate.name}id={inputTemplate.name}position={Position.Left}- style={{ ...handleStyle(inputTemplate.type, 'left'), left: 0, opacity: 0, top: -14 }}+ style={{ ...getWorkflowNodeHandleStyle(inputTemplate.type, 'left'), left: 0, opacity: 0, top: -14 }}type="target"/>) : null@@ -578,15 +535,11 @@ const CompactHiddenHandles = ({const CompactNodeBody = ({ inputCount, outputCount }: { inputCount: number; outputCount: number }) => (<Flexalign="center"- bg="bg.muted"- borderBottomRadius="lg"- borderTopWidth="1px"- borderColor="border.subtle"color="fg.muted"fontSize="2xs"gap="2"px={WORKFLOW_NODE_DENSITY.rowPaddingX}- py={WORKFLOW_NODE_DENSITY.bodyPaddingY}+ {...getWorkflowNodeBodyProps()}><Text>{inputCount} input{inputCount === 1 ? '' : 's'}@@ -608,22 +561,13 @@ const CompactInvocationNode = ({ data, selected }: NodeProps<InvocationFlowNodeTreturn (<NodeShell isMissing={!templateView} selected={selected ?? false}>- <Flex- align="center"- bg="bg.subtle"- borderBottomWidth="1px"- borderColor="border.subtle"- borderTopRadius="lg"- gap="1"- px="3"- py={WORKFLOW_NODE_DENSITY.headerPaddingY}- >+ <Flex {...getWorkflowNodeHeaderProps()}><MiddleTruncate fontSize="sm" fontWeight="700" minW="0" text={title} /></Flex>{templateView ? (<CompactNodeBody inputCount={inputTemplates.length} outputCount={outputTemplates.length} />) : (- <Text bg="bg.muted" borderBottomRadius="lg" color="fg.subtle" fontSize="2xs" px="3" py="2">+ <Text color="fg.subtle" fontSize="2xs" px="3" {...getWorkflowNodeBodyProps()} py="2">Unknown node type. Select for details.</Text>)}@@ -674,23 +618,12 @@ const ExpandedInvocationNode = ({ data, selected }: NodeProps<InvocationFlowNodereturn (<NodeShell hasMissingRequiredInput={isMissingRequiredInput} isRunning={isRunning} selected={selected ?? false}>- <Flex- align="center"- bg="bg.subtle"- borderBottomWidth={isOpen ? '1px' : '0'}- borderColor="border.subtle"- borderTopRadius="lg"- borderBottomRadius={isOpen ? 'none' : 'lg'}- gap="1"- ps="1.5"- pe="2"- py={WORKFLOW_NODE_DENSITY.headerPaddingY}- >+ {/* The collapse chevron carries its own hit padding, so the header pulls its start padding in. */}+ <Flex {...getWorkflowNodeHeaderProps({ roundedBottom: !isOpen })} gap="1" ps="1"><IconButtonaria-label={isOpen ? 'Collapse node' : 'Expand node'}className="nodrag"- ms="2"- size="xs"+ size="2xs"variant="ghost"onClick={() => editGraph({ isOpen: !isOpen, nodeId: node.id, type: 'setNodeIsOpen' })}>@@ -702,7 +635,7 @@ const ExpandedInvocationNode = ({ data, selected }: NodeProps<InvocationFlowNode<><NodeTitle node={node} title={node.data.label || template.title} /><Box flex="1" />- <NodeInfoButton node={node} template={template} />+ <NodeInfoIcon node={node} template={template} /></>)}</Flex>@@ -713,11 +646,7 @@ const ExpandedInvocationNode = ({ data, selected }: NodeProps<InvocationFlowNode<HiddenHandles inputTemplates={inputTemplates} outputTemplates={outputTemplates} /></>) : isOpen ? (- <Box- bg="bg.muted"- borderBottomRadius={withFooter || withOutputPreview ? 'none' : 'lg'}- py={WORKFLOW_NODE_DENSITY.bodyPaddingY}- >+ <Box {...getWorkflowNodeBodyProps({ roundedBottom: !withFooter && !withOutputPreview })}>{outputTemplates.map((outputTemplate) => (<OutputFieldRow key={outputTemplate.name} isSkeleton={isZoomedOut} template={outputTemplate} />))}diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/editor/NotesFlowNode.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/editor/NotesFlowNode.tsxindex 8fed383fb7..0ba9780ebb 100644--- a/invokeai/frontend/webv2/src/features/workflow/ui/editor/NotesFlowNode.tsx+++ b/invokeai/frontend/webv2/src/features/workflow/ui/editor/NotesFlowNode.tsx@@ -1,13 +1,12 @@import type { NodeProps } from '@xyflow/react';import { Box, Input, Textarea } from '@chakra-ui/react';+import { getWorkflowNodeChromeProps } from '@features/workflow/ui/nodeChrome';import { useProjectGraphCommands } from '@features/workflow/ui/useProjectGraphCommands';import { memo, useCallback, type ChangeEvent } from 'react';import type { NotesFlowNode as NotesFlowNodeType } from './flowAdapters';-import { getWorkflowNodeChromeProps } from './nodeChrome';-const NotesFlowNodeComponent = ({ data, selected }: NodeProps<NotesFlowNodeType>) => {const { editGraph } = useProjectGraphCommands();const node = data.documentNode;diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/editor/nodeChrome.ts b/invokeai/frontend/webv2/src/features/workflow/ui/editor/nodeChrome.tsdeleted file mode 100644index f9e413f80f..0000000000--- a/invokeai/frontend/webv2/src/features/workflow/ui/editor/nodeChrome.ts+++ /dev/null@@ -1,29 +0,0 @@-import type { BoxProps } from '@chakra-ui/react';--const NODE_HOVER_RING = '0 0 0 2px {colors.accent.solid/50}, {shadows.md}';-const NODE_RUNNING_RING = '0 0 0 2px {colors.brand.solid/70}, 0 0 10px {colors.brand.solid/50}';-const NODE_SELECTED_RING = '0 0 0 2px {colors.accent.solid}, {shadows.md}';--/** Shared spacing keeps editable workflow nodes aligned with their manager previews. */-export const WORKFLOW_NODE_DENSITY = {- bodyPaddingY: '1',- headerPaddingY: '1.5',- rowPaddingX: '3',- rowPaddingY: '0.5',-} as const;--export const getWorkflowNodeChromeProps = ({- invalid = false,- running = false,- selected,-}: {- invalid?: boolean;- running?: boolean;- selected: boolean;-}): BoxProps => ({- borderColor: invalid ? 'red.solid' : running ? 'brand.solid' : 'border.emphasized',- borderWidth: '1px',- shadow: selected ? NODE_SELECTED_RING : running ? NODE_RUNNING_RING : 'sm',- transition: 'border-color var(--wb-motion-duration-fast) ease, box-shadow var(--wb-motion-duration-fast) ease',- _hover: selected ? undefined : { shadow: NODE_HOVER_RING },-});diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/flowTheme.ts b/invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/flowTheme.tsindex 15c9eb1eb0..dcf72d379e 100644--- a/invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/flowTheme.ts+++ b/invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/flowTheme.ts@@ -1,6 +1,7 @@import type { SystemStyleObject } from '@chakra-ui/react';import type { WorkbenchThemeId } from '@theme/themes';+import { WORKFLOW_NODE_SURFACE_TOKEN } from '@features/workflow/ui/nodeChrome';import { THEMES_BY_ID } from '@theme/themes';/**@@ -8,10 +9,12 @@ import { THEMES_BY_ID } from '@theme/themes';* so every flow renderer (workflow editor, graph preview) applies these* Chakra-token-backed `--xy-*` override vars on its wrapper — they inherit* into `.react-flow` and outrank the colorMode defaults. `--wb-flow-grid` is- * ours, consumed by `<Background color>` and preview handles.+ * ours, consumed by `<Background color>` and preview handles; `--wb-node-surface`+ * feeds the node-body token to inline-styled field handles.*/export const flowThemeCss: SystemStyleObject = {'--wb-flow-grid': '{colors.fg.grid}',+ '--wb-node-surface': `{colors.${WORKFLOW_NODE_SURFACE_TOKEN}}`,'--xy-attribution-background-color': 'transparent','--xy-background-color': '{colors.bg}','--xy-connectionline-stroke': '{colors.accent.solid}',diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/linear/FormBuilderTab.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/linear/FormBuilderTab.tsxindex 6d2ff3fca2..5d533bf8b7 100644--- a/invokeai/frontend/webv2/src/features/workflow/ui/linear/FormBuilderTab.tsx+++ b/invokeai/frontend/webv2/src/features/workflow/ui/linear/FormBuilderTab.tsx@@ -27,9 +27,9 @@ import {type WorkflowFormElement,} from '@features/workflow/contracts';import { useInvocationTemplatesSelector, type InvocationTemplatesSnapshot } from '@features/workflow/react';-import { getWorkflowNodeChromeProps } from '@features/workflow/ui/editor/nodeChrome';import { requestNodeSelection, workflowSelectionStore } from '@features/workflow/ui/editor/selectionStore';import { FieldDescriptionPopover } from '@features/workflow/ui/fields/FieldDescriptionPopover';+import { getWorkflowNodeChromeProps } from '@features/workflow/ui/nodeChrome';import { useProjectGraphCommands } from '@features/workflow/ui/useProjectGraphCommands';import { useWorkflowHostCommands } from '@features/workflow/ui/WorkflowUiContext';import { getFormChildren, getResolvedWorkflowEdges, getWorkflowFieldInvalidReason } from '@features/workflow/utility';diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/nodeChrome.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/nodeChrome.tsxnew file mode 100644index 0000000000..78b570d281--- /dev/null+++ b/invokeai/frontend/webv2/src/features/workflow/ui/nodeChrome.tsx@@ -0,0 +1,157 @@+import type { BoxProps, FlexProps } from '@chakra-ui/react';+import type { FieldType } from '@features/workflow/contracts';+import type { CSSProperties, ReactNode } from 'react';++import { Box, Icon } from '@chakra-ui/react';+import { getFieldTypeColor, isModelFieldType } from '@features/workflow/utility';+import { Tooltip } from '@platform/ui';+import { InfoIcon } from 'lucide-react';++/**+ * The single source of the workflow-node visual language. Every surface that+ * draws a node — the editor's flow nodes, the node manager's static preview+ * cards, the form builder — styles it from here so the renderings cannot+ * drift apart.+ */++const NODE_HOVER_RING = '0 0 0 2px {colors.accent.solid/50}, {shadows.md}';+const NODE_RUNNING_RING = '0 0 0 2px {colors.brand.solid/70}, 0 0 10px {colors.brand.solid/50}';+const NODE_SELECTED_RING = '0 0 0 2px {colors.accent.solid}, {shadows.md}';++/** The node body surface. `flowThemeCss` bridges it to `--wb-node-surface` for inline xyflow styles. */+export const WORKFLOW_NODE_SURFACE_TOKEN = 'bg.muted';++/** Shared spacing keeps editable workflow nodes aligned with their manager previews. */+export const WORKFLOW_NODE_DENSITY = {+ bodyPaddingY: '1',+ headerGap: '2',+ headerPaddingEnd: '2',+ headerPaddingStart: '2.5',+ headerPaddingY: '1.5',+ rowPaddingX: '3',+ rowPaddingY: '0.5',+} as const;++export const getWorkflowNodeChromeProps = ({+ invalid = false,+ running = false,+ selected,+}: {+ invalid?: boolean;+ running?: boolean;+ selected: boolean;+}): BoxProps => ({+ borderColor: invalid ? 'red.solid' : running ? 'brand.solid' : 'border.emphasized',+ borderWidth: '1px',+ shadow: selected ? NODE_SELECTED_RING : running ? NODE_RUNNING_RING : 'sm',+ transition: 'border-color var(--wb-motion-duration-fast) ease, box-shadow var(--wb-motion-duration-fast) ease',+ _hover: selected ? undefined : { shadow: NODE_HOVER_RING },+});++/** The node surface itself: chrome plus background, radius, and base type size. */+export const getWorkflowNodeShellProps = (state: {+ invalid?: boolean;+ running?: boolean;+ selected: boolean;+}): BoxProps => ({+ bg: 'bg',+ fontSize: 'xs',+ rounded: 'lg',+ ...getWorkflowNodeChromeProps(state),+});++/** Titled header strip. `roundedBottom` for collapsed nodes where nothing renders beneath it. */+export const getWorkflowNodeHeaderProps = ({ roundedBottom = false }: { roundedBottom?: boolean } = {}): FlexProps => ({+ alignItems: 'center',+ bg: 'bg.subtle',+ borderBottomRadius: roundedBottom ? 'lg' : undefined,+ borderBottomWidth: roundedBottom ? '0' : '1px',+ borderColor: 'border.subtle',+ borderTopRadius: 'lg',+ gap: WORKFLOW_NODE_DENSITY.headerGap,+ pe: WORKFLOW_NODE_DENSITY.headerPaddingEnd,+ ps: WORKFLOW_NODE_DENSITY.headerPaddingStart,+ py: WORKFLOW_NODE_DENSITY.headerPaddingY,+});++/**+ * Field-row body. The header above supplies the divider, so the body draws no+ * top border. Inferred (not `BoxProps`) so it spreads into `Stack`/`Flex`+ * without tripping over the conflicting HTML `direction` prop types.+ */+export const getWorkflowNodeBodyProps = ({ roundedBottom = true }: { roundedBottom?: boolean } = {}) => ({+ bg: WORKFLOW_NODE_SURFACE_TOKEN,+ borderBottomRadius: roundedBottom ? ('lg' as const) : ('none' as const),+ py: WORKFLOW_NODE_DENSITY.bodyPaddingY,+});++export const WORKFLOW_NODE_HANDLE_SIZE = 12;+/** Raw px (equal to `radii.xs`) so the inline xyflow flavor renders identically to the Chakra one. */+const HANDLE_ANGULAR_RADIUS = 2;+const HANDLE_BORDER_WIDTH = 2;+const HANDLE_RING_WIDTH = 1.5;++/**+ * One visual grammar for field handles: filled = single cardinality,+ * angular = model/batch types, diamond = batch.+ */+const getHandleVisual = (type: FieldType) => ({+ color: getFieldTypeColor(type),+ isAngular: isModelFieldType(type) || type.batch,+ isDiamond: Boolean(type.batch),+ isFilled: type.cardinality === 'SINGLE',+});++/**+ * Inline-CSS flavor for xyflow `<Handle>`s, which live outside Chakra's style+ * pipeline. xyflow's own `.react-flow__handle-left/right` CSS centers the+ * handle on its `left`/`right` coordinate via `translate(∓50%, -50%)`; the+ * diamond transform must restate that centering before rotating, so it needs+ * the side.+ */+export const getWorkflowNodeHandleStyle = (type: FieldType, side: 'left' | 'right'): CSSProperties => {+ const visual = getHandleVisual(type);++ return {+ background: visual.isFilled ? visual.color : 'var(--wb-node-surface)',+ border: visual.isFilled ? 'none' : `${HANDLE_BORDER_WIDTH}px solid ${visual.color}`,+ borderRadius: visual.isAngular ? HANDLE_ANGULAR_RADIUS : '50%',+ boxShadow: `0 0 0 ${HANDLE_RING_WIDTH}px var(--wb-node-surface)`,+ height: WORKFLOW_NODE_HANDLE_SIZE,+ transform: visual.isDiamond ? `translate(${side === 'left' ? '-' : ''}50%, -50%) rotate(45deg)` : undefined,+ width: WORKFLOW_NODE_HANDLE_SIZE,+ };+};++/**+ * Static stand-in for a connection handle in non-flow contexts (manager preview+ * cards): same size, tint, and shape rules as the editor handles, centered on+ * the node border.+ */+export const WorkflowNodeHandleDot = ({ side, type }: { side: 'left' | 'right'; type: FieldType }) => {+ const visual = getHandleVisual(type);++ return (+ <Box+ bg={visual.isFilled ? visual.color : WORKFLOW_NODE_SURFACE_TOKEN}+ borderColor={visual.color}+ borderRadius={visual.isAngular ? `${HANDLE_ANGULAR_RADIUS}px` : 'full'}+ borderWidth={visual.isFilled ? '0' : `${HANDLE_BORDER_WIDTH}px`}+ boxShadow={`0 0 0 ${HANDLE_RING_WIDTH}px {colors.${WORKFLOW_NODE_SURFACE_TOKEN}}`}+ boxSize={`${WORKFLOW_NODE_HANDLE_SIZE}px`}+ position="absolute"+ top="50%"+ transform={`translate(${side === 'left' ? '-50%' : '50%'}, -50%)${visual.isDiamond ? ' rotate(45deg)' : ''}`}+ {...(side === 'left' ? { left: '0' } : { right: '0' })}+ />+ );+};++const INFO_TOOLTIP_POSITIONING = { placement: 'top-end' } as const;++/** The quiet header info affordance: a `fg.subtle` icon whose tooltip carries the node details. */+export const WorkflowNodeInfoIcon = ({ content, label }: { content: ReactNode; label: string }) => (+ <Tooltip content={content} positioning={INFO_TOOLTIP_POSITIONING} showArrow>+ <Icon aria-label={label} as={InfoIcon} boxSize="3.5" color="fg.subtle" />+ </Tooltip>+);