Skip to content

Add host-extension slot seam for wrapping deployments#88

Open
benvinegar wants to merge 1 commit into
mainfrom
host-extension-slot-seam
Open

Add host-extension slot seam for wrapping deployments#88
benvinegar wants to merge 1 commit into
mainfrom
host-extension-slot-seam

Conversation

@benvinegar

Copy link
Copy Markdown
Member

What

Adds a small, generic seam so a wrapping deployment (e.g. a hosted SaaS) can render its own UI inside the viewer chrome without forking the viewer — and without shipping a second copy of Solid (the single-runtime rule). Self-hosted deployments register no slots and behave exactly as before.

How

  • Runtime global — the viewer publishes its own Solid instance as window.__SIDESHOW_SOLID__ ({ ...solid-js, web, store }), the stable contract a host bundle compiles against so it shares the viewer's runtime instead of bundling its own.
  • Reactive slot registrywindow.sideshow.registerSlot(name, Component) stores registrations in a createStore, so late/async registration after boot still renders. Each named slot renders via <Dynamic> inside the viewer's root owner, so theme/context/signals are shared. One slot is wired today: account (topbar right).
  • Shared context — slot components receive a small HostContext (theme signal + setter, theme list, active session id, base path).
  • Readiness eventsideshow:ready is dispatched after the runtime is published and the app is rendered, so a deferred host bundle knows when to register.
  • headHtml AppOption — generalizes the existing __SIDESHOW_BASE_PATH__ head injection so a host can load a companion bundle / set globals. Documented as deployment-controlled (inserted verbatim).

All inert for self-hosters: no slots registered → the global is an unused handle and the chrome is unchanged.

Notes

  • viewer/src/host.tsx is the whole contract; App.tsx adds <Slot name="account"/>; main.tsx calls announceHostReady() post-render; server/app.ts gains the optional headHtml.
  • Changeset included (minor).
  • Reviewed by multiple independent passes; viewer typechecks + builds with the seam present in the bundle.

🤖 Generated with Claude Code

Publish the viewer's own Solid runtime as window.__SIDESHOW_SOLID__ and a
reactive slot registry (window.sideshow.registerSlot). Registered components
render into named chrome slots (account, in the topbar) inside the viewer's
root owner, so theme/context/signals are shared and host bundles never ship a
second Solid copy. Dispatch sideshow:ready once both are live so deferred host
bundles know when to register. Generalize the head injection into a headHtml
AppOption for loading a companion bundle. All inert for self-hosters.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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