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
fix(webv2): one connected-field note and a bounded seed mode trigger
Josh Corbett4abd9575c9de
diff --git a/invokeai/frontend/webv2/public/locales/en.json b/invokeai/frontend/webv2/public/locales/en.jsonindex 3641b49f4b..6525e0d4b3 100644--- a/invokeai/frontend/webv2/public/locales/en.json+++ b/invokeai/frontend/webv2/public/locales/en.json@@ -1407,8 +1407,8 @@"nodeType": "Type: {{type}}","nodeVersion": "Version: {{version}}","nodeClassification": "Classification: {{classification}}",- "seedModeTooltip": "Seed mode. Applies between queued runs of the workflow; a loop inside one run reuses that run's seed.",- "seedProvidedByConnection": "Provided by connection.",+ "seedModeTooltip": "Applies between queued runs of the workflow; a loop inside one run reuses that run's seed.",+ "providedByConnection": "Provided by connection.","iterationOutputs": "Iteration outputs","finalOutputs": "Final outputs","forLoopValidationFailed": "For loop validation failed",diff --git a/invokeai/frontend/webv2/src/features/generation/ui/shared/SeedControls.tsx b/invokeai/frontend/webv2/src/features/generation/ui/shared/SeedControls.tsxindex 11d76b223e..afdef847cc 100644--- a/invokeai/frontend/webv2/src/features/generation/ui/shared/SeedControls.tsx+++ b/invokeai/frontend/webv2/src/features/generation/ui/shared/SeedControls.tsx@@ -1,4 +1,4 @@-/* oxlint-disable react-perf/jsx-no-new-function-as-prop */+/* oxlint-disable react-perf/jsx-no-new-function-as-prop, react-perf/jsx-no-jsx-as-prop */import type { SeedMode, SeedSubmissionPlan } from '@features/generation/core/seed';import type { LucideIcon } from 'lucide-react';@@ -23,8 +23,8 @@ const SEED_MODE_ICONS: Record<SeedMode, LucideIcon> = {export interface SeedModeMenuProps {value: SeedMode;onChange: (mode: SeedMode) => void;- /** Trigger tooltip; the mode label unless the host has more to say about what a step is. */- tooltip?: string;+ /** A second tooltip line for hosts that need to say what one step means (a queued run, not a loop pass). */+ description?: string;/** Class for the portaled menu content, for hosts whose key handling must skip it (xyflow's `nokey`). */contentClassName?: string;}@@ -34,7 +34,7 @@ export interface SeedModeMenuProps {* toggle because the choice has four answers, and each needs a line of* explanation the first time it is read.*/-export const SeedModeMenu = ({ contentClassName, onChange, tooltip, value }: SeedModeMenuProps) => {+export const SeedModeMenu = ({ contentClassName, description, onChange, value }: SeedModeMenuProps) => {const { t } = useTranslation();// Shared ids let the tooltip ride the menu trigger without wrapping it// (wrapping `Menu.Trigger` swallows the anchor ref — see RoutingControl).@@ -42,15 +42,31 @@ export const SeedModeMenu = ({ contentClassName, onChange, tooltip, value }: Seeconst triggerIds = useMemo(() => ({ trigger: triggerId }), [triggerId]);const label = t('widgets.generate.seedMode.label');const valueLabel = t(`widgets.generate.seedMode.${value}`);+ const accessibleName = `${label}: ${valueLabel}`;return (<Menu.Root ids={triggerIds} positioning={SEED_MODE_MENU_POSITIONING}>- <Tooltip content={tooltip ?? label} ids={triggerIds}>+ {/* The visible label may truncate in a dense row; the full name always reads here and in the tooltip. */}+ <Tooltip+ content={+ description ? (+ <Stack gap="0.5">+ <Text>{accessibleName}</Text>+ <Text color="fg.subtle">{description}</Text>+ </Stack>+ ) : (+ accessibleName+ )+ }+ ids={triggerIds}+ ><Menu.Trigger asChild>- <Button aria-label={`${label}: ${valueLabel}`} flexShrink={0} gap="1" size="xs" variant="outline">- <Icon as={SEED_MODE_ICONS[value]} boxSize="3.5" color="fg.muted" />- {valueLabel}- <Icon as={ChevronDownIcon} boxSize="3" color="fg.muted" />+ <Button aria-label={accessibleName} flexShrink={0} gap="1" maxW="9rem" minW="0" size="xs" variant="outline">+ <Icon as={SEED_MODE_ICONS[value]} boxSize="3.5" color="fg.muted" flexShrink={0} />+ <Text as="span" minW="0" truncate>+ {valueLabel}+ </Text>+ <Icon as={ChevronDownIcon} boxSize="3" color="fg.muted" flexShrink={0} /></Button></Menu.Trigger></Tooltip>diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsxindex f23d4eaf7c..6414281a5a 100644--- a/invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx+++ b/invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx@@ -289,12 +289,12 @@ const NodeFooter = ({ canUseCache, node }: { canUseCache: boolean; node: Workflo};/** The upstream node owns the seed now; the local mode waits for a disconnect. A leaf so only this row subscribes to i18n. */-const SeedProvidedByConnectionNote = () => {+const ProvidedByConnectionNote = () => {const { t } = useTranslation();return (<Text color="fg.subtle" fontSize="2xs" mt="0.5">- {t('nodes.seedProvidedByConnection')}+ {t('nodes.providedByConnection')}</Text>);};@@ -452,7 +452,7 @@ const InputFieldRow = ({/></Box>) : isConnected && isSeedInputField(template) ? (- <SeedProvidedByConnectionNote />+ <ProvidedByConnectionNote />) : null}{invalidReason ? <Field.ErrorText fontSize="2xs">{invalidReason}</Field.ErrorText> : null}</Field.Root>diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.browser.test.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.browser.test.tsxindex 11fb43a4a3..e1ef1906a9 100644--- a/invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.browser.test.tsx+++ b/invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.browser.test.tsx@@ -713,6 +713,14 @@ describe('WorkflowFieldInput seed inputs', () => {await renderField(SEED_TEMPLATE, 42, onChange, undefined, { onSeedModeChange, seedMode: 'fixed' });expect(seedInput()?.disabled).toBe(false);+ // Without i18n the label is the long key, which stands in for a long translation: the+ // trigger stays bounded and truncates, its accessible name stays whole, and the number+ // input keeps a usable width beside it.+ expect(modeTrigger()?.getAttribute('aria-label')).toBe(+ 'widgets.generate.seedMode.label: widgets.generate.seedMode.fixed'+ );+ expect(modeTrigger()?.getBoundingClientRect().width).toBeLessThanOrEqual(144);+ expect(seedInput()?.getBoundingClientRect().width).toBeGreaterThan(80);// xyflow reads `.nokey` to leave a control's keys alone; the trigger and the portaled menu both need it,// or arrows nudge the node and Backspace deletes it while the menu is in use.expect(modeTrigger()?.closest('.nokey')).not.toBeNull();diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsxindex 4a263686bf..c2d64007d7 100644--- a/invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx+++ b/invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx@@ -247,7 +247,7 @@ const SeedInput = ({<NumericInput {...props} describedBy={plan ? previewId : undefined} disabled={seedMode === 'random'} /><SeedModeMenucontentClassName="nokey"- tooltip={t('nodes.seedModeTooltip')}+ description={t('nodes.seedModeTooltip')}value={seedMode}onChange={onSeedModeChange}/>diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/linear/NodeFieldControl.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/linear/NodeFieldControl.tsxindex 362134abca..9703fb9773 100644--- a/invokeai/frontend/webv2/src/features/workflow/ui/linear/NodeFieldControl.tsx+++ b/invokeai/frontend/webv2/src/features/workflow/ui/linear/NodeFieldControl.tsx@@ -16,6 +16,7 @@ import {import { FieldLabel, IconButton, Tooltip } from '@platform/ui';import { RotateCcwIcon } from 'lucide-react';import { useCallback, useMemo, useState, type ChangeEvent } from 'react';+import { useTranslation } from 'react-i18next';/*** One exposed node field, shared by the Linear UI's view mode and the form@@ -47,6 +48,7 @@ export const NodeFieldControl = ({isLabelEditable?: boolean;projectGraph: ProjectGraphState;}) => {+ const { t } = useTranslation();const { editGraph } = useProjectGraphCommands();const { fieldName, instance, invocationNode, nodeContext, nodeId, template } = useNodeFieldBinding(element,@@ -167,7 +169,7 @@ export const NodeFieldControl = ({) : null}{isConnected ? (<Text color="fg.subtle" fontSize="2xs">- Driven by a graph connection.+ {t('nodes.providedByConnection')}</Text>) : (<WorkflowFieldInput