Add host-extension slot seam for wrapping deployments#88
Open
benvinegar wants to merge 1 commit into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
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.window.sideshow.registerSlot(name, Component)stores registrations in acreateStore, 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).HostContext(theme signal + setter, theme list, active session id, base path).sideshow:readyis dispatched after the runtime is published and the app is rendered, so a deferred host bundle knows when to register.headHtmlAppOption — 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.tsxis the whole contract;App.tsxadds<Slot name="account"/>;main.tsxcallsannounceHostReady()post-render;server/app.tsgains the optionalheadHtml.minor).🤖 Generated with Claude Code