Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
Make the Try it demo a viewport-sized workspace (#4579)
Maximilian Roos1ec56f307308
diff --git a/docs/src/pages/try-it.astro b/docs/src/pages/try-it.astroindex ae586640f..94178a276 100644--- a/docs/src/pages/try-it.astro+++ b/docs/src/pages/try-it.astro@@ -11,7 +11,7 @@ const launchUrl = `${server}/launch?snapshot=${encodeURIComponent(snapshot)}`;<StarlightPagefrontmatter={{- title: 'Try it',+ title: 'Try Worktrunk in a demo shell',description: 'Try Worktrunk in a demo shell',editUrl: false,tableOfContents: false,@@ -19,11 +19,8 @@ const launchUrl = `${server}/launch?snapshot=${encodeURIComponent(snapshot)}`;head: [{ tag: 'meta', attrs: { name: 'robots', content: 'noindex' } }],}}>- <p>- Try Worktrunk in a demo shell- </p>- <p>- <a href={launchUrl}>Open the full-page demo</a>+ <p class="wt-try-it-link">+ <a href={launchUrl}>Open the full-page demo in Demoshell</a></p><div class="wt-try-it" data-server={server} data-snapshot={snapshot}>@@ -31,22 +28,26 @@ const launchUrl = `${server}/launch?snapshot=${encodeURIComponent(snapshot)}`;<p><a href={launchUrl}>Open the demo</a></p></noscript></div>- <p class="wt-try-it-credit">- Powered by <a href="https://demoshell.com">Demoshell</a>.- </p></StarlightPage><style>- /* The embed fills its container, so the container needs a definite height:- room for the terminal with the guide stacked under it. */+ .wt-try-it-link {+ margin-block-start: 0;+ }++ /* The workspace uses the main pane's width while the title stays in the docs rail. */.wt-try-it {- height: 640px;+ height: var(--wt-workspace-height, max(420px, calc(100svh - 16rem)));+ /* Keep Demoshell's attribution badge clear of the guide controls. */+ padding-block-end: 2rem;}- .wt-try-it-credit {- font-size: var(--sl-text-sm);- color: var(--sl-color-gray-3);- text-align: right;+ :global(html:has(.wt-try-it) main) {+ padding-block-end: 0;+ }++ :global(html:has(.wt-try-it) main footer) {+ display: none;}</style>@@ -54,6 +55,24 @@ const launchUrl = `${server}/launch?snapshot=${encodeURIComponent(snapshot)}`;const target = document.querySelector('.wt-try-it');const currentTheme = () => (document.documentElement.dataset.theme === 'dark' ? 'dark' : 'light');+ const fitWorkspace = () => {+ const { top } = target.getBoundingClientRect();+ const panel = target.closest('.content-panel');+ const panelStyle = getComputedStyle(panel);+ const left = target.closest('.main-pane').getBoundingClientRect().left+ + parseFloat(panelStyle.paddingInlineStart);+ const rightPadding = parseFloat(panelStyle.paddingInlineEnd);+ const bottomPadding = parseFloat(panelStyle.paddingBlockEnd);+ target.style.marginInlineStart = `${left - target.parentElement.getBoundingClientRect().left}px`;+ target.style.width = `${document.documentElement.clientWidth - left - rightPadding}px`;+ const documentTop = top + window.scrollY;+ target.style.setProperty('--wt-workspace-height', `${Math.max(420, window.innerHeight - documentTop - bottomPadding)}px`);+ };+ fitWorkspace();+ window.addEventListener('resize', fitWorkspace);+ // The heading can wrap or change height when its display font loads.+ new ResizeObserver(fitWorkspace).observe(document.querySelector('h1'));+try {const { default: Demoshell } = await import(`${target.dataset.server}/embed/demoshell-embed.js`);const demo = await Demoshell.mount(target, {diff --git a/docs/src/styles/custom.css b/docs/src/styles/custom.cssindex b21c0d988..4e0ffcfad 100644--- a/docs/src/styles/custom.css+++ b/docs/src/styles/custom.css@@ -704,7 +704,7 @@ figure.demo img {}@media (min-width: 72rem) {- html:has(.wt-home) .main-pane {+ html:has(.wt-home, .wt-try-it) .main-pane {--sl-content-margin-inline: auto 0;width: min(calc(100% - var(--sl-sidebar-width)),@@ -728,7 +728,7 @@ figure.demo img {[data-has-toc] .right-sidebar-container,[data-has-sidebar][data-has-toc] .main-pane,- html:has(.wt-home) .main-pane {+ html:has(.wt-home, .wt-try-it) .main-pane {flex-basis: 100%;width: 100%;}