Skip to content

feat(hub): add render-only visibility to dock entry base declaration#136

Merged
antfu merged 1 commit into
mainfrom
huge-clouds-warn
Jul 24, 2026
Merged

feat(hub): add render-only visibility to dock entry base declaration#136
antfu merged 1 commit into
mainfrom
huge-clouds-warn

Conversation

@antfubot

Copy link
Copy Markdown
Collaborator

Summary

Adds a visibility field alongside when on the dock entry base declaration (DevframeDockEntryBase) — a whenexpr-typed, render-only counterpart to when.

  • visibility hides only the entry's own dock-bar button. The entry stays registered and fully reachable: docks.activate()/switchEntry() by id, RPC lookups, and anything else that walks the raw entry list (e.g. the subTabs frame-nav adapter) keep working exactly as if it were visible.
  • when remains the general relevance switch for the entry as a whole; visibility is a narrower carve-out for entries that must stay in the model without a dock-bar button of their own.
  • The canonical use case is a shared-frame subTabs anchor: the anchor iframe must stay registered to keep driving the postMessage nav loop, but only its synthesized member tabs should render as dock-bar buttons — set visibility: 'false' on the anchor to hide just its own button.

Changes

  • packages/hub/src/types/docks.ts — new DevframeDockEntryBase.visibility?: string, cross-referenced from DevframeViewIframe.subTabs's doc comment.
  • packages/hub/src/define.tsdefineDockEntry type-checks visibility the same way as when (compile-time whenexpr syntax validation).
  • packages/devframe/src/types/devframe.ts — mirrored onto DevframeDockDefaults (definition-level dock defaults consumed by mountDevframe).
  • packages/hub/src/node/mount-devframe.ts — doc comment update.
  • docs/guide/when-clauses.md — new section documenting the field and the subTabs use case.
  • Tests: mount-devframe.test.ts (default/override round-trip) and host.test.ts (proves a visibility: 'false' entry stays in docks.entries, has state, and is activatable via switchEntry).

This PR was created with the help of an AI agent.

Adds a whenexpr-typed `visibility` field alongside `when` on
`DevframeDockEntryBase`. It hides only the entry's own dock-bar button
while leaving the entry registered and fully reachable (activation, RPC
lookups, frame-nav, etc.) — useful for a shared-frame `subTabs` anchor
that should surface only its synthesized member tabs, not its own button.

`when` remains the general relevance switch for an entry as a whole;
`visibility` is a narrower render-only carve-out with the same syntax
and the same type-safety in `defineDockEntry`.
@netlify

netlify Bot commented Jul 24, 2026

Copy link
Copy Markdown

Deploy Preview for devfra ready!

Name Link
🔨 Latest commit 2e08090
🔍 Latest deploy log https://app.netlify.com/projects/devfra/deploys/6a631b7e9d8dc400083f2daf
😎 Deploy Preview https://deploy-preview-136--devfra.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@antfu
antfu merged commit c359ac1 into main Jul 24, 2026
6 of 12 checks passed
@antfu
antfu deleted the huge-clouds-warn branch July 24, 2026 08:01
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