From dc62c8ce59b86761b0d81995d6c49840c914791a Mon Sep 17 00:00:00 2001 From: sayomaki Date: Wed, 12 Aug 2026 15:09:18 +0800 Subject: [PATCH] feat: add larger hover display for rune thumbnails in stepper Hovering over rune thumbnails in the stepper now shows a bigger preview of the rune Co-authored-by: Claude Opus 4.8 +
+ {alt ? ( + <> + + {` ${alt}`} + + ) : null} + {alt +
+ + ); +} + /** * renderNode renders a serialized Stepper AST node to a React ReactNode. */ @@ -860,14 +877,23 @@ function renderNode( const src = readNodeProp(node, part.image); if (typeof src !== "string" || !src.startsWith("data:")) return null; const alt = part.altProp === undefined ? undefined : readNodeProp(node, part.altProp); + const altText = alt == null ? "" : String(alt); return ( - {alt + interactionKind="hover" + placement="bottom" + usePortal={popoverDepth === 0} + lazy + popoverClassName="stepper-popover" + content={} + > + {altText} + ); } return null; diff --git a/src/web/stepper/src/styles.ts b/src/web/stepper/src/styles.ts index 801e73f..52f495e 100644 --- a/src/web/stepper/src/styles.ts +++ b/src/web/stepper/src/styles.ts @@ -62,6 +62,19 @@ const STEPPER_CSS = ` border-radius: 3px; } +/* The same thumbnail enlarged, shown in the hover popover so an opaque value (e.g. a rune) is + * actually legible while the inline copy stays at text height. A fixed width (not max-width) forces + * a low-resolution thumbnail to scale up rather than render at its small intrinsic size. */ +.sa-substituter .stepper-opaque-thumbnail-large, +.stepper-popover .stepper-opaque-thumbnail-large { + display: block; + width: min(200px, 50vw); + height: auto; + margin-top: 6px; + border-radius: 3px; + image-rendering: auto; +} + .sa-substituter .stepper-mu-term, .stepper-popover .stepper-mu-term { font-weight: bold;