Skip to content

Host pill format chooser#4616

Open
christse wants to merge 4 commits intomainfrom
host-pill-format-chooser
Open

Host pill format chooser#4616
christse wants to merge 4 commits intomainfrom
host-pill-format-chooser

Conversation

@christse
Copy link
Copy Markdown

@christse christse commented May 1, 2026

Demo

https://screen.studio/share/vCKDCvxI

Summary

New format selector for the code-mode preview + playground: a single morphing pill with drag-to-select, hover preview, and compact mode for narrow panels. Also wires the synthetic "Form" pill (auto-generated standard view) all the way through to the renderer.

Highlights

  • PillFormatChooser — single morphing capsule, drag commits live across buttons, synthetic-click suppression so drag-to-different-format actually sticks. Compact mode (icon-only, instant tooltips) flips on automatically when the parent narrows; flips back when it grows.
  • "Form" pill renders the auto-generated standard view — same mechanism interact mode's "Toggle Standard View" uses (baseCardRef as the renderer's @codeRef). Previously the pill rendered blank.
  • Form pill = editing-mode header@onFinishEditing now treats 'form' like 'edit', so the green CardHeader bar + X-to-finish-editing show up just like interact mode.
  • Centering shell rework.card-renderer-format-chooser is now a full-width flex shell with pointer-events: none; the dark capsule + radius lives on the chooser itself. Required so compact-mode detection has an honest available-width signal (a width: max-content parent was creating a stuck-compact loop).

Test plan

  • Code-mode preview, card with custom edit template: chooser shows Form pill; selecting it renders the auto-generated standard view (not blank), with green editing header.
  • Drag across the chooser; releasing on a different button keeps that format.
  • Narrow the preview panel until the chooser flips to compact icon-only; hover any button → format-name tooltip appears instantly above. Widen the panel → chooser restores icon+text without sticking.
  • Drag in compact mode → tooltip follows the active button.
  • Existing format-chooser tests still pass (the new chooser keeps the data-test-format-chooser="<fmt>" selectors).

Known follow-ups

  • Tests outlined earlier in the design discussion — at minimum the drag-suppress-trailing-click integration test and the form→standard-view acceptance test.

@christse christse requested a review from burieberry May 1, 2026 14:03
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 1, 2026

Preview deployments

Host Test Results

    1 files  ±0      1 suites  ±0   1h 56m 53s ⏱️ - 1m 39s
2 562 tests ±0  2 538 ✅  - 1  15 💤 ±0  0 ❌ ±0  9 🔥 +1 
2 581 runs  ±0  2 548 ✅  - 2  15 💤 ±0  9 ❌ +1  9 🔥 +1 

Results for commit 76f3ca3. ± Comparison against earlier commit 1aca5fb.

Realm Server Test Results

    1 files  ± 0      1 suites  ±0   18m 5s ⏱️ + 2m 6s
1 212 tests +39  1 212 ✅ +39  0 💤 ±0  0 ❌ ±0 
1 284 runs  +39  1 284 ✅ +39  0 💤 ±0  0 ❌ ±0 

Results for commit 76f3ca3. ± Comparison against earlier commit 1aca5fb.

christse and others added 4 commits May 1, 2026 19:04
New PillFormatChooser component for the floating chrome bar: a single
morphing capsule pill that follows the active format with drag-to-select
across buttons, an outlined-gray hover preview that sits over the
hovered button without committing, and compact mode (icon-only +
tooltips) when the parent shrinks. Drag commits live on each crossing,
so releasing on a different button keeps the dragged-to selection (the
trailing synthetic click on the press-start button is suppressed).

Format chooser wiring for "Form" (the auto-generated standard view):
- 'form' is a synthetic chooser option inserted after 'edit' when the
  card has a custom edit template. It was reaching the renderer
  unrouted, so the preview rendered blank.
- preview-panel and playground translate 'form' at the renderer
  boundary: format='edit' + codeRef=baseCardRef, the same mechanism
  interact mode's "Toggle Standard View" uses via stack-item's
  defaultCodeRef. The chooser highlight still sits on 'form'.

Layout: card-renderer-format-chooser is now a full-width centering
shell (left/right: 0; flex; justify-content: center; pointer-events:
none on the shell, auto on the chooser) so the chooser's compact-mode
detection has an honest "available width" signal. The dark capsule +
border-radius now lives on the chooser itself.
The header's green bar + X-to-finish-editing is driven by
@onFinishEditing being non-null. Previously only 'edit' triggered it;
'form' was treated as a non-editing format → grey header.

Treat 'form' as edit-mode for the header in both preview-panel and
playground-panel: onFinishEditing returns to isolated/default, and
onEdit (the pencil) hides while in either editing format. This matches
the visual treatment of interact mode's "Toggle Standard View".
@burieberry burieberry force-pushed the host-pill-format-chooser branch from 1aca5fb to 76f3ca3 Compare May 1, 2026 23:05
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.

2 participants