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
feat(webv2): add feature hint popover component
joshistoast6c74f0935545
diff --git a/invokeai/frontend/webv2/public/locales/en.json b/invokeai/frontend/webv2/public/locales/en.jsonindex b9430df38d..830496197d 100644--- a/invokeai/frontend/webv2/public/locales/en.json+++ b/invokeai/frontend/webv2/public/locales/en.json@@ -168,6 +168,8 @@"canceled": "Canceled","clear": "Clear","clearSearch": "Clear search",+ "dontShowMeThese": "Don't show me these",+ "learnMore": "Learn more","noSchedulersFound": "No schedulers found","openSelector": "Open selector","searchSchedulers": "Search schedulers…",@@ -511,6 +513,197 @@"searchPlaceholder": "Search hotkeys","title": "Hotkeys"},+ "hints": {+ "aspectRatio": {+ "heading": "Aspect Ratio",+ "paragraphs": [+ "The aspect ratio of the dimensions of the image generated.",+ "An image size (in number of pixels) equivalent to 512x512 is recommended for SD1.5 models and a size equivalent to 1024x1024 is recommended for SDXL models."+ ]+ },+ "batchCount": {+ "heading": "Iterations",+ "paragraphs": [+ "The number of images to generate.",+ "If Dynamic Prompts is enabled, each of the prompts will be generated this many times."+ ]+ },+ "cfgRescale": {+ "heading": "CFG Rescale Multiplier",+ "paragraphs": [+ "Rescale multiplier for CFG guidance, used for models trained using zero-terminal SNR (ztsnr).",+ "Suggested value of 0.7 for these models."+ ]+ },+ "cfgScale": {+ "heading": "CFG Scale",+ "paragraphs": [+ "Controls how much the prompt influences the generation process.",+ "High CFG Scale values can result in over-saturation and distorted generation results."+ ]+ },+ "clipSkip": {+ "heading": "CLIP Skip",+ "paragraphs": [+ "How many layers of the CLIP model to skip.",+ "Certain models are better suited to be used with CLIP Skip."+ ]+ },+ "colorCompensation": {+ "heading": "Color Compensation",+ "paragraphs": ["Adjust the input image to reduce color shifts during inpainting or img2img (SDXL Only)."]+ },+ "concepts": {+ "heading": "LoRA",+ "paragraphs": ["Lightweight models that are used in conjunction with base models."]+ },+ "creativity": {+ "heading": "Creativity",+ "paragraphs": [+ "Creativity controls the amount of freedom granted to the model when adding details. Low creativity stays close to the original image, while high creativity allows for more change. When using a prompt, high creativity increases the influence of the prompt."+ ]+ },+ "guidance": {+ "heading": "Guidance",+ "paragraphs": [+ "Controls how much the prompt influences the generation process.",+ "High guidance values can result in over-saturation and high or low guidance may result in distorted generation results. Guidance only applies to FLUX DEV models."+ ]+ },+ "height": {+ "heading": "Height",+ "paragraphs": ["Height of the generated image. Must be a multiple of 8."]+ },+ "imageInfluence": {+ "heading": "Denoising Strength",+ "paragraphs": [+ "Controls how much the generated image varies from the raster layers.",+ "Lower strength stays closer to the combined visible raster layers. Higher strength relies more on the global prompt.",+ "When there are no raster layers with visible content, this setting is ignored."+ ]+ },+ "model": {+ "heading": "Model",+ "paragraphs": [+ "Model used for generation. Different models are trained to specialize in producing different aesthetic results and content."+ ]+ },+ "negativePrompt": {+ "heading": "Negative Prompt",+ "paragraphs": [+ "The generation process avoids the concepts in the negative prompt. Use this to exclude qualities or objects from the output.",+ "Supports Compel syntax and embeddings."+ ]+ },+ "pidMode": {+ "heading": "PiD Decode (Super-Resolution Decoder)",+ "paragraphs": [+ "PiD replaces the standard VAE decode with NVIDIA's Pixel Diffusion Decoder, a diffusion-based 4x super-resolution decoder. It requires a PiD decoder model and a Gemma-2 caption encoder.",+ "Fit: generate at your chosen resolution, PiD decodes it 4x, then downscales back to that size - extra detail at the same output size, and it composites onto the canvas (works for Image to Image too).",+ "Native (4x): your dimensions are the 4x target. Generation runs at a quarter of them (e.g. 512 -> 2048) and PiD's full 4x output is used directly. The PiD decoders are trained for 2K output (512px sources), with 2K-to-4K variants for 4K.",+ "Because PiD's diffusion decode reconstructs detail, you can usually lower the generation Steps to save time. 'Scale Before Processing' must be set to None while PiD is enabled."+ ]+ },+ "positivePrompt": {+ "heading": "Positive Prompt",+ "paragraphs": [+ "Guides the generation process. You may use any words or phrases.",+ "Compel and Dynamic Prompts syntaxes and embeddings."+ ]+ },+ "referenceImage": {+ "heading": "Global Reference Image",+ "paragraphs": ["Applies a reference image to influence the entire generation."]+ },+ "referenceImageWeight": {+ "heading": "Reference Image Weight",+ "paragraphs": [+ "How strongly this reference image steers the generation.",+ "Lower weight treats it as a loose suggestion; higher weight holds the output closer to the reference."+ ]+ },+ "scheduler": {+ "heading": "Scheduler",+ "paragraphs": [+ "Scheduler used during the generation process.",+ "Each scheduler defines how to iteratively add noise to an image or how to update a sample based on a model's output."+ ]+ },+ "seamlessTiling": {+ "heading": "Seamless Tiling",+ "paragraphs": [+ "Generates an image that tiles without visible seams.",+ "Enable each axis independently to tile horizontally, vertically, or both."+ ]+ },+ "seed": {+ "heading": "Seed",+ "paragraphs": [+ "Controls the starting noise used for generation.",+ "Disable the \"Random\" option to produce identical results with the same generation settings."+ ]+ },+ "steps": {+ "heading": "Steps",+ "paragraphs": [+ "Number of steps that will be performed in each generation.",+ "Higher step counts will typically create better images but will require more generation time."+ ]+ },+ "structure": {+ "heading": "Structure",+ "paragraphs": [+ "Structure controls how closely the output image will keep to the layout of the original. Low structure allows major changes, while high structure strictly maintains the original composition and layout."+ ]+ },+ "tileControlNet": {+ "heading": "ControlNet",+ "paragraphs": [+ "ControlNets provide guidance to the generation process, helping create images with controlled composition, structure, or style, depending on the model selected."+ ]+ },+ "tileOverlap": {+ "heading": "Tile Overlap",+ "paragraphs": [+ "Controls the overlap between adjacent tiles during upscaling. Higher overlap values help reduce visible seams between tiles but use more memory.",+ "The default value of 128 works well for most cases, but you can adjust based on your specific needs and memory constraints."+ ]+ },+ "tileSize": {+ "heading": "Tile Size",+ "paragraphs": [+ "Controls the size of tiles used during the upscaling process. Larger tiles use more memory but may produce better results.",+ "SD1.5 models default to 768, while SDXL models default to 1024. Reduce tile size if you encounter memory issues."+ ]+ },+ "upscaleModel": {+ "heading": "Upscale Model",+ "paragraphs": [+ "The upscale model scales the image to the output size before details are added. Any supported upscale model may be used, but some are specialized for different kinds of images, like photos or line drawings."+ ]+ },+ "upscaleScale": {+ "heading": "Scale",+ "paragraphs": [+ "Scale controls the output image size, and is based on a multiple of the input image resolution. For example a 2x upscale on a 1024x1024 image would produce a 2048 x 2048 output."+ ]+ },+ "vae": {+ "heading": "VAE",+ "paragraphs": ["Model used for translating AI output into the final image."]+ },+ "vaePrecision": {+ "heading": "VAE Precision",+ "paragraphs": [+ "The precision used during VAE encoding and decoding.",+ "Fp16/Half precision is more efficient, at the expense of minor image variations."+ ]+ },+ "width": {+ "heading": "Width",+ "paragraphs": ["Width of the generated image. Must be a multiple of 8."]+ }+ },"models": {"accessToken": "Access Token","accessTokenForDownload": "Access token for this download",@@ -850,6 +1043,8 @@"sectionsLabel": "Launchpad sections"},"settings": {+ "informationalPopoversDisabled": "Informational popovers disabled",+ "informationalPopoversDisabledDesc": "Re-enable them under Settings, in the Behavior section.","title": "Settings","descriptionGlobal": "Global preferences for this single-user install. Project settings apply only to the active project.","descriptionUser": "Preferences for the signed-in user. Project settings apply only to the active project.",diff --git a/invokeai/frontend/webv2/src/platform/ui/hints/FeatureHint.browser.test.tsx b/invokeai/frontend/webv2/src/platform/ui/hints/FeatureHint.browser.test.tsxnew file mode 100644index 0000000000..662fc3d437--- /dev/null+++ b/invokeai/frontend/webv2/src/platform/ui/hints/FeatureHint.browser.test.tsx@@ -0,0 +1,150 @@+import { ChakraProvider, Text } from '@chakra-ui/react';+import { system } from '@theme/system';+import { createInstance } from 'i18next';+import { act } from 'react';+import { createRoot, type Root } from 'react-dom/client';+import { I18nextProvider, initReactI18next } from 'react-i18next';+import { afterEach, describe, expect, it, vi } from 'vitest';+import { userEvent } from 'vitest/browser';++import type { FeatureHintsAdapter } from './hintsContext';++import { FeatureHint } from './FeatureHint';+import { FeatureHintsProvider } from './hintsContext';++const i18n = createInstance();+void i18n.use(initReactI18next).init({+ fallbackLng: 'en',+ initAsync: false,+ lng: 'en',+ resources: {+ en: {+ translation: {+ common: { dontShowMeThese: "Don't show me these", learnMore: 'Learn more' },+ hints: {+ clipSkip: {+ heading: 'CLIP Skip',+ paragraphs: ['How many layers of the CLIP model to skip.', 'Some models suit CLIP Skip better.'],+ },+ },+ },+ },+ },+});++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 settle = (ms: number): Promise<void> =>+ act(async () => {+ await new Promise<void>((resolve) => {+ globalThis.setTimeout(resolve, ms);+ });+ });++const render = async (adapter: FeatureHintsAdapter) => {+ host = document.createElement('div');+ document.body.append(host);+ root = createRoot(host);++ await act(() => {+ root?.render(+ <ChakraProvider value={system}>+ <I18nextProvider i18n={i18n}>+ <FeatureHintsProvider adapter={adapter}>+ {/*+ Inset and shrink-wrapped on purpose: the mouse starts at the+ viewport origin, so a full-width trigger at (0,0) would already+ contain the pointer and `pointerenter` would never fire.+ */}+ <FeatureHint hint="clipSkip">+ <Text display="inline-block" m="120px">+ CLIP skip+ </Text>+ </FeatureHint>+ </FeatureHintsProvider>+ </I18nextProvider>+ </ChakraProvider>+ );+ });++ return host.querySelector<HTMLElement>('[data-part="trigger"]') ?? (host.firstElementChild as HTMLElement);+};++/** The card portals out of the host, so assert against the whole document. */+const cardText = (): string =>+ document.querySelector('[data-scope="hover-card"][data-part="content"]')?.textContent ?? '';++describe('FeatureHint', () => {+ it('renders the child untouched and mounts no popper while hints are off', async () => {+ const trigger = await render({ enabled: false, onDisable: vi.fn() });++ expect(trigger.textContent).toBe('CLIP skip');+ expect(trigger.getAttribute('data-scope')).toBeNull();+ expect(document.querySelector('[data-scope="hover-card"]')).toBeNull();+ });++ it('keeps the trigger out of the tab order so wrapping labels adds no tab stops', async () => {+ const trigger = await render({ enabled: true, onDisable: vi.fn() });++ expect(trigger.getAttribute('data-scope')).toBe('hover-card');+ expect(trigger.hasAttribute('tabindex')).toBe(false);+ expect(trigger.getAttribute('role')).toBeNull();+ });++ it('opens the card with its heading and paragraphs on hover', async () => {+ const trigger = await render({ enabled: true, onDisable: vi.fn() });++ await act(async () => {+ await userEvent.hover(trigger);+ });+ // Guard against a false pass from an instantly-open card.+ expect(cardText()).toBe('');+ await settle(900);++ expect(cardText()).toContain('CLIP Skip');+ expect(cardText()).toContain('How many layers of the CLIP model to skip.');+ expect(cardText()).toContain('Some models suit CLIP Skip better.');+ });++ it('turns hints off from the card', async () => {+ const onDisable = vi.fn();+ const trigger = await render({ enabled: true, onDisable });++ await act(async () => {+ await userEvent.hover(trigger);+ });+ await settle(900);++ const dismiss = [...document.querySelectorAll('button')].find(+ (button) => button.textContent === "Don't show me these"+ );++ expect(dismiss).toBeDefined();+ await act(() => {+ dismiss?.click();+ });++ expect(onDisable).toHaveBeenCalledTimes(1);+ });++ it('omits the dismiss action when the host cannot persist preferences', async () => {+ const trigger = await render({ enabled: true, onDisable: null });++ await act(async () => {+ await userEvent.hover(trigger);+ });+ await settle(900);++ expect(cardText()).toContain('CLIP Skip');+ expect(cardText()).not.toContain("Don't show me these");+ });+});diff --git a/invokeai/frontend/webv2/src/platform/ui/hints/FeatureHint.tsx b/invokeai/frontend/webv2/src/platform/ui/hints/FeatureHint.tsxnew file mode 100644index 0000000000..82af2d5319--- /dev/null+++ b/invokeai/frontend/webv2/src/platform/ui/hints/FeatureHint.tsx@@ -0,0 +1,105 @@+import type { ReactElement } from 'react';++import { Heading, HoverCard, HStack, Icon, Link, Portal, Separator, Spacer, Stack, Text } from '@chakra-ui/react';+import { Button } from '@platform/ui/Button';+import { ExternalLinkIcon } from 'lucide-react';+import { useMemo } from 'react';+import { useTranslation } from 'react-i18next';++import { DEFAULT_HINT_PLACEMENT, getFeatureHint, type FeatureHintId } from './hintRegistry';+import { useFeatureHints } from './hintsContext';++/** Long enough that hints stay out of the way while a user works a panel. */+const OPEN_DELAY = 600;+/** Long enough to let the pointer travel from the label into the card's links. */+const CLOSE_DELAY = 300;++const readParagraphs = (value: unknown): string[] =>+ Array.isArray(value) ? value.filter((entry): entry is string => typeof entry === 'string') : [];++const HintCard = ({ hint, onDisable }: { hint: FeatureHintId; onDisable: (() => void) | null }) => {+ const { t } = useTranslation();+ const { href } = getFeatureHint(hint);+ const heading = t(`hints.${hint}.heading`);+ const paragraphs = readParagraphs(t(`hints.${hint}.paragraphs`, { returnObjects: true }));++ // Padding belongs to the `hoverCard` content recipe, not here.+ return (+ <Stack gap="1.5">+ <Heading fontSize="xs" fontWeight="600">+ {heading}+ </Heading>+ <Separator />+ {paragraphs.map((paragraph) => (+ <Text key={paragraph} color="fg.muted" fontSize="xs" lineHeight="1.45">+ {paragraph}+ </Text>+ ))}+ {(onDisable || href) && (+ <>+ <Separator />+ <HStack gap="2" minH="4">+ {onDisable && (+ <Button color="fg.subtle" fontSize="2xs" h="auto" px="0" size="2xs" variant="plain" onClick={onDisable}>+ {t('common.dontShowMeThese')}+ </Button>+ )}+ <Spacer />+ {href && (+ <Link fontSize="2xs" gap="1" href={href} rel="noreferrer" target="_blank">+ {t('common.learnMore')}+ <Icon as={ExternalLinkIcon} boxSize="3" />+ </Link>+ )}+ </HStack>+ </>+ )}+ </Stack>+ );+};++export interface FeatureHintProps {+ hint: FeatureHintId;+ /** Becomes the hover target verbatim — it gains data attributes, not a wrapper. */+ children: ReactElement;+}++/**+ * Attaches an informational hint card to a control, opened by hovering the+ * child. Copy lives in the `hints.*` i18n namespace; {@link getFeatureHint}+ * supplies the optional support link.+ *+ * The child is the trigger via `asChild`, and zag builds trigger props with+ * `normalize.element` rather than `normalize.button` — so wrapping a field+ * label adds pointer/focus handlers and `data-*` attributes but no `tabindex`+ * and no role. Labels stay out of the tab order and keep click-to-focus.+ *+ * When hints are turned off the child renders untouched, with no popper mounted.+ */+export const FeatureHint = ({ children, hint }: FeatureHintProps) => {+ const { enabled, onDisable } = useFeatureHints();+ const positioning = useMemo(+ () => ({ gutter: 8, placement: getFeatureHint(hint).placement ?? DEFAULT_HINT_PLACEMENT }),+ [hint]+ );++ if (!enabled) {+ return children;+ }++ return (+ <HoverCard.Root closeDelay={CLOSE_DELAY} lazyMount openDelay={OPEN_DELAY} positioning={positioning} unmountOnExit>+ <HoverCard.Trigger asChild>{children}</HoverCard.Trigger>+ <Portal>+ <HoverCard.Positioner>+ <HoverCard.Content>+ <HoverCard.Arrow>+ <HoverCard.ArrowTip />+ </HoverCard.Arrow>+ <HintCard hint={hint} onDisable={onDisable} />+ </HoverCard.Content>+ </HoverCard.Positioner>+ </Portal>+ </HoverCard.Root>+ );+};diff --git a/invokeai/frontend/webv2/src/platform/ui/hints/hintRegistry.test.ts b/invokeai/frontend/webv2/src/platform/ui/hints/hintRegistry.test.tsnew file mode 100644index 0000000000..78b06ecfc9--- /dev/null+++ b/invokeai/frontend/webv2/src/platform/ui/hints/hintRegistry.test.ts@@ -0,0 +1,56 @@+import { describe, expect, it } from 'vitest';++import { FEATURE_HINTS } from './hintRegistry';++/**+ * Keeps the registry and the `hints.*` catalog in step in BOTH directions. The+ * component builds its keys by template literal, so the generic+ * `translationKeys.test.ts` scanner cannot see them — a heading that never got+ * written would otherwise surface to users as the literal string+ * `hints.tileOverlap.heading`.+ *+ * The legacy frontend drifted exactly this way: 85 feature ids, 84 catalog+ * entries, and a `hrf` key that resolved to nothing.+ */++const enModules = import.meta.glob('../../../../public/locales/en.json', { eager: true, import: 'default' });+const en = Object.values(enModules)[0] as Record<string, unknown>;+const catalog = (en.hints ?? {}) as Record<string, { heading?: unknown; paragraphs?: unknown }>;++const registryIds = Object.keys(FEATURE_HINTS).sort();++describe('feature hint registry', () => {+ it('reads a non-empty catalog', () => {+ // A broken glob would make every other assertion vacuously pass.+ expect(registryIds.length).toBeGreaterThan(20);+ expect(Object.keys(catalog).length).toBeGreaterThan(20);+ });++ it('gives every registered hint a heading and at least one paragraph', () => {+ const incomplete = registryIds.filter((id) => {+ const entry = catalog[id];++ return (+ typeof entry?.heading !== 'string' ||+ entry.heading.length === 0 ||+ !Array.isArray(entry.paragraphs) ||+ entry.paragraphs.length === 0 ||+ entry.paragraphs.some((paragraph) => typeof paragraph !== 'string' || paragraph.length === 0)+ );+ });++ expect(incomplete).toEqual([]);+ });++ it('registers every catalog entry, so no copy is unreachable', () => {+ expect(Object.keys(catalog).sort()).toEqual(registryIds);+ });++ it('points every "learn more" link at an absolute https URL', () => {+ const bad = Object.entries(FEATURE_HINTS)+ .filter(([, definition]) => 'href' in definition && !definition.href.startsWith('https://'))+ .map(([id]) => id);++ expect(bad).toEqual([]);+ });+});diff --git a/invokeai/frontend/webv2/src/platform/ui/hints/hintRegistry.ts b/invokeai/frontend/webv2/src/platform/ui/hints/hintRegistry.tsnew file mode 100644index 0000000000..91af36043a--- /dev/null+++ b/invokeai/frontend/webv2/src/platform/ui/hints/hintRegistry.ts@@ -0,0 +1,72 @@+import type { HoverCard } from '@chakra-ui/react';++type HintPlacement = NonNullable<NonNullable<HoverCard.RootProps['positioning']>['placement']>;++interface HintDefinition {+ /** Support article opened by the card's "Learn more" link. */+ href?: string;+ /**+ * Overrides {@link DEFAULT_HINT_PLACEMENT}. Nothing needs it today — the+ * popper flips on its own when a panel is docked against the far edge — but+ * a control whose card would cover its own value can pin itself here.+ */+ placement?: HintPlacement;+}++/** Cards sit beside the panel rather than over the control they explain. */+export const DEFAULT_HINT_PLACEMENT: HintPlacement = 'right';++const SUPPORT_ADVANCED_SETTINGS = 'https://support.invoke.ai/support/solutions/articles/151000178161-advanced-settings';+const SUPPORT_CONCEPTS = 'https://support.invoke.ai/support/solutions/articles/151000159072';++/**+ * Every hint the workbench can attach to a control. Prose lives in the `hints.*`+ * i18n namespace — this table carries only what a translator should not own.+ * `hintRegistry.test.ts` proves the two stay in step in both directions.+ */+export const FEATURE_HINTS = {+ aspectRatio: {},+ batchCount: { href: 'https://support.invoke.ai/support/solutions/articles/151000159073' },+ cfgRescale: { href: SUPPORT_ADVANCED_SETTINGS },+ cfgScale: { href: 'https://www.youtube.com/watch?v=1OeHEJrsTpI' },+ clipSkip: { href: SUPPORT_ADVANCED_SETTINGS },+ colorCompensation: {},+ concepts: { href: SUPPORT_CONCEPTS },+ creativity: {},+ guidance: {},+ height: {},+ imageInfluence: {+ href: 'https://support.invoke.ai/support/solutions/articles/151000094998-image-to-image',+ },+ model: {+ href: 'https://support.invoke.ai/support/solutions/articles/151000096601-what-is-a-model-which-should-i-use-',+ },+ negativePrompt: {},+ pidMode: { href: 'https://github.com/nv-tlabs/PiD' },+ positivePrompt: {+ href: 'https://support.invoke.ai/support/solutions/articles/151000096606-tips-on-crafting-prompts',+ },+ referenceImage: {+ href: 'https://support.invoke.ai/support/solutions/articles/151000159340-global-and-regional-reference-images-ip-adapters-',+ },+ referenceImageWeight: {},+ scheduler: { href: 'https://www.youtube.com/watch?v=1OeHEJrsTpI' },+ seamlessTiling: { href: SUPPORT_ADVANCED_SETTINGS },+ seed: {+ href: 'https://support.invoke.ai/support/solutions/articles/151000096684-what-is-a-seed-how-do-i-use-it-to-recreate-the-same-image-',+ },+ steps: {},+ structure: {},+ tileControlNet: { href: 'https://support.invoke.ai/support/solutions/articles/151000105880' },+ tileOverlap: {},+ tileSize: {},+ upscaleModel: {},+ upscaleScale: {},+ vae: { href: SUPPORT_ADVANCED_SETTINGS },+ vaePrecision: { href: SUPPORT_ADVANCED_SETTINGS },+ width: {},+} as const satisfies Record<string, HintDefinition>;++export type FeatureHintId = keyof typeof FEATURE_HINTS;++export const getFeatureHint = (id: FeatureHintId): HintDefinition => FEATURE_HINTS[id];diff --git a/invokeai/frontend/webv2/src/platform/ui/hints/hintsContext.tsx b/invokeai/frontend/webv2/src/platform/ui/hints/hintsContext.tsxnew file mode 100644index 0000000000..fed7eada59--- /dev/null+++ b/invokeai/frontend/webv2/src/platform/ui/hints/hintsContext.tsx@@ -0,0 +1,32 @@+import type { ReactNode } from 'react';++import { createContext, use } from 'react';++/**+ * Feature hints' host port. Platform may not import Workbench, so the enabled+ * preference and the "turn these off" command are pushed in from App — the same+ * direction `I18nController` and `ThemeController` feed their platform+ * singletons. Not a test seam; no second adapter is expected.+ */+export interface FeatureHintsAdapter {+ enabled: boolean;+ /** Turns hints off from inside a card; null when the host cannot persist preferences. */+ onDisable: (() => void) | null;+}++/**+ * Inert by default: a tree with no provider renders exactly as it did before+ * hints existed, so unit tests and isolated browser tests need no setup.+ */+const DEFAULT_FEATURE_HINTS_ADAPTER: FeatureHintsAdapter = {+ enabled: false,+ onDisable: null,+};++const FeatureHintsContext = createContext<FeatureHintsAdapter>(DEFAULT_FEATURE_HINTS_ADAPTER);++export const FeatureHintsProvider = ({ adapter, children }: { adapter: FeatureHintsAdapter; children: ReactNode }) => (+ <FeatureHintsContext value={adapter}>{children}</FeatureHintsContext>+);++export const useFeatureHints = (): FeatureHintsAdapter => use(FeatureHintsContext);diff --git a/invokeai/frontend/webv2/src/platform/ui/hints/index.ts b/invokeai/frontend/webv2/src/platform/ui/hints/index.tsnew file mode 100644index 0000000000..b5c396b7ec--- /dev/null+++ b/invokeai/frontend/webv2/src/platform/ui/hints/index.ts@@ -0,0 +1,6 @@+// Published as the deep specifier `@platform/ui/hints`, deliberately absent from+// the `@platform/ui` barrel: that barrel sits near its `maxDirectImporters`+// budget, and every hint call site would otherwise count against it.+export * from './FeatureHint';+export * from './hintRegistry';+export * from './hintsContext';diff --git a/invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts b/invokeai/frontend/webv2/src/platform/ui/theme/recipes.tsindex 1f70119d2d..1e3dba83e9 100644--- a/invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts+++ b/invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts@@ -27,6 +27,37 @@ export const tooltipSlotRecipe = defineSlotRecipe({},});+/**+ * Feature hint cards. Same raised surface as the tooltip so the two read as one+ * family, one step wider for prose. Extends Chakra's default recipe: the arrow+ * slots derive `--arrow-background` from `--hovercard-bg`, so replacing the base+ * wholesale would render the arrow unfilled.+ *+ * The content owns its padding — cards must not add their own, or the two stack.+ * Chakra's `md` default (20px) reads as a dialog rather than an annotation, so+ * these default to `xs`.+ */+export const hoverCardSlotRecipe = defineSlotRecipe({+ ...chakraSlotRecipes.hoverCard,+ base: {+ ...chakraSlotRecipes.hoverCard.base,+ content: {+ ...chakraSlotRecipes.hoverCard.base?.content,+ '--hovercard-bg': 'colors.bg.muted',+ borderColor: 'border.emphasized',+ borderWidth: '1px',+ boxShadow: 'lg',+ color: 'fg',+ maxWidth: '18rem',+ },+ arrowTip: {+ ...chakraSlotRecipes.hoverCard.base?.arrowTip,+ borderColor: 'border.emphasized',+ },+ },+ defaultVariants: { size: 'xs' },+});+export const tabsSlotRecipe = defineSlotRecipe({...chakraSlotRecipes.tabs,base: {diff --git a/invokeai/frontend/webv2/src/platform/ui/theme/system.ts b/invokeai/frontend/webv2/src/platform/ui/theme/system.tsindex 86c4f8963d..5b39b6f29d 100644--- a/invokeai/frontend/webv2/src/platform/ui/theme/system.ts+++ b/invokeai/frontend/webv2/src/platform/ui/theme/system.ts@@ -5,6 +5,7 @@ import {colorPickerSlotRecipe,comboboxSlotRecipe,dialogSlotRecipe,+ hoverCardSlotRecipe,inputRecipe,menuSlotRecipe,numberInputSlotRecipe,@@ -288,6 +289,7 @@ const config = defineConfig({colorPicker: colorPickerSlotRecipe,combobox: comboboxSlotRecipe,dialog: dialogSlotRecipe,+ hoverCard: hoverCardSlotRecipe,menu: menuSlotRecipe,numberInput: numberInputSlotRecipe,progressCircle: progressCircleSlotRecipe,