Skip to content

feat(hub-ui): add a dev-served playground with HMR - #225

Merged
antfu merged 4 commits into
mainfrom
feat/hub-ui-dev-playground
Aug 14, 2026
Merged

feat(hub-ui): add a dev-served playground with HMR#225
antfu merged 4 commits into
mainfrom
feat/hub-ui-dev-playground

Conversation

@antfubot

@antfubot antfubot commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds packages/hub-ui/playground/ — a dev-served playground for @devframes/hub-ui, mounting a bare, headless hub instance (RPC/WS/__connection.json, no UI slot) and hub-ui's own DockStandalone/DockEmbedded straight from source, so every .vue/.ts file under src/client hot-reloads instantly instead of requiring a build. Run with pnpm --filter @devframes/hub-ui dev.
    • hub-plugin.ts hand-rolls the small middleware slice needed rather than reusing @devframes/vite/hub, since that package already carries an optional peer dependency on @devframes/hub-ui — pulling it in here would create a cyclic workspace dependency.
    • main.ts supports both the full-page standalone viewer (default) and the floating embedded dock (?embedded) over sample host content.
    • Mounts the real @devframes/plugin-git devframe — the dock bar shows this very checkout's actual commit history, branches, and status. It's the one built-in plugin that doesn't itself depend on @devframes/vite (every other plugin does), so it's the only one that doesn't reintroduce that same cyclic dependency one hop further out.
    • seed.ts seeds sample commands, messages, a no-renderer dock entry, a "Playground Tools" group collapsing the Git dock, and a "Ping" action dock whose client script (client-scripts/ping-action.ts) runs on click — exercising the grouped-dock popover and the action-dock mechanism, alongside the fallback-view dock.
  • Fixes @devframes/hub-ui's Storybook preview: it never imported @unocss/reset/tailwind.css, the Tailwind preflight scripts/build-css.ts prepends to the shipped shadow-root stylesheet. Without it, stories inherited raw browser defaults instead of the reset real dock content ships with — visibly, a text-variant ActionButton (e.g. Confirm's "Cancel") rendered as a native gray button instead of plain text. Now imported first, matching the production build's [reset, ...] order.

This PR was created with the help of an agent.

Mounts a bare, headless hub instance and hub-ui's own DockStandalone/
DockEmbedded straight from source, so the client Vue components hot-reload
during development instead of requiring a build.

Run with `pnpm --filter @devframes/hub-ui dev`.
Storybook's preview never imported '@unocss/reset/tailwind.css', the same
reset scripts/build-css.ts prepends to the shipped shadow-root stylesheet -
unlike real dock content, stories inherited raw browser defaults (e.g. a
text-variant ActionButton rendering as a native gray button). Import it
first, matching the production build's [reset, ...] order.
@netlify

netlify Bot commented Aug 14, 2026

Copy link
Copy Markdown

Deploy Preview for devfra ready!

Name Link
🔨 Latest commit 47b3ab8
🔍 Latest deploy log https://app.netlify.com/projects/devfra/deploys/6a7ec21c232712000853a81f
😎 Deploy Preview https://deploy-preview-225--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.

…yground

Mounts two tiny static devframes (Alpha/Beta, devframes.ts) via initHub's
devframes option, so the playground's dock bar has real mounted content
to switch between rather than only client-only entries. Both collapse
under a new "Playground Tools" group dock, alongside a "Ping" action dock
whose client script runs on click - exercising the grouped-dock popover
and the action-dock mechanism the playground didn't previously touch.

Declares playground/client-scripts/*.ts as a knip entry - action dock
scripts are loaded by their runtime URL string, not a static import.
Replaces the two hand-rolled static "Alpha"/"Beta" devframes with the real
`@devframes/plugin-git` dashboard - the playground now shows this very
checkout's actual commit history, branches, and status instead of placeholder
pages.

`@devframes/plugin-git` is the one built-in plugin that doesn't itself depend
on `@devframes/vite` - every other plugin does, and mounting one of those here
would reintroduce the cyclic workspace dependency `hub-plugin.ts` already
avoids by hand-rolling its hub middleware, just one hop further out.
@antfu
antfu merged commit 59eef9b into main Aug 14, 2026
6 of 12 checks passed
@antfu
antfu deleted the feat/hub-ui-dev-playground branch August 14, 2026 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants