Skip to content

feat(visimer): add "Edit here" callouts to the inline playground (#2952) - #15

Merged
inkeep-oss-sync[bot] merged 1 commit into
mainfrom
copybara/sync
Jul 28, 2026
Merged

feat(visimer): add "Edit here" callouts to the inline playground (#2952)#15
inkeep-oss-sync[bot] merged 1 commit into
mainfrom
copybara/sync

Conversation

@inkeep-oss-sync

Copy link
Copy Markdown

Copybara-translated 1 Inkeep OSS change. Rebase-merge this PR so the prepared commit lands directly on public main.

* feat(visimer): add hand-drawn "Edit here" callouts to the inline playground

Two Caveat/terracotta nudges flank the playground card on the landing page:
"Edit here" above the source pane, "or edit here" below the preview. Same
visual voice as the navbar's existing "Leave a star!" hint.

Both live in the padding bands of a wrapper around the card, not inside it,
so they never cover the editor or intercept a click (pointer-events: none).
Anchoring the source callout top-left and the preview callout bottom-right
means one placement reads correctly in both layouts: with side-by-side panes
each arrow lands over its own column, and with stacked panes the source pane
is on top and the preview below.

* feat(visimer): aim the playground callouts at the content, not the chrome

The callouts sat in the page margin outside the card, so both arrows stopped
at chrome: "Edit here" landed on the preset pill row and "or edit here" on an
empty stretch of canvas. Each one now lives in the pane it describes.

"Edit here" sits in the code pane's flow directly under the last line, with
its left padding clearing the line-number gutter so the arrow tips up into the
code text. Letting the editor size to its content instead of filling the pane
is what keeps it tucked under short presets like flowchart rather than
stranded at the pane floor; flex-shrink pulls it back up for tall presets like
classDiagram, which scroll internally instead of pushing the callout out of
view. The stacked layout's code row grows by the callout's height so the
amount of visible code on phones is unchanged.

"or edit here" pins to the canvas's bottom-left, the corner the zoom controls
leave free, and aims up-right at the diagram the canvas keeps centred.

Both are scoped to the inline demo via .pg-inline-pane, since /playground
shares .pg-code-pane, .demo-cm and .pg-grid and is deliberately untouched.

* feat(visimer): centre the playground callouts on their pane's content

Both arrows hugged the left edge of their pane, so "Edit here" pointed at the
line-number gutter rather than at the code.

Each callout is now a 1fr / auto / 1fr grid: the arrow sits in the centre
column and the label hangs off to one side without pulling it off-centre, so
the label's width no longer decides where the arrow lands. Each arrow is
redrawn with its tip on the viewBox's horizontal centre and its tail sweeping
out towards its own label, which makes the centring exact rather than offset
by however far the tip sat from the middle of its box.

The source callout insets by the gutter width so it centres on the code text
column instead of the pane, and the preview callout spans the canvas so it
centres under the diagram. Nothing is painted right of the preview arrow, so
the corner zoom controls stay clear.

Measured across all 36 preset and viewport combinations: the source tip lands
within 5px of the code column's centre and the preview tip on the canvas
centre exactly.

* refactor(visimer): tidy the callout styles after local review

Three cleanups from the local review pass:

Merge the two .pg-callout-arrow rules into one and drop its `flex: none`.
That declaration was left over from when the callout was a flex row; the
arrow is a grid item now, and `flex` only applies to flex items, so it had
stopped doing anything. The width and height stay: the SVG carries no
width/height attributes of its own.

Reword the contrast comment. It claimed the label sat in WCAG's "large text"
bracket, which is wrong: that bracket needs font-weight 700 and the label is
600. The measured ratios were right, so the comment now just states them as a
legibility rationale and notes these callouts are decorative (aria-hidden),
which puts them outside SC 1.4.3 entirely.

Hoist the static `stroke` object to module scope, alongside the existing
kw/str/ident/cmt constants it matches.

GitOrigin-RevId: 340bbc7a57d62c868c8b87ba9bd7352de3ebc674
@inkeep-oss-sync
inkeep-oss-sync Bot merged commit aea08b3 into main Jul 28, 2026
@inkeep-oss-sync
inkeep-oss-sync Bot deleted the copybara/sync branch July 28, 2026 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant