import { defineToolbarApp } from 'astro/toolbar'; import { icon } from "../assets/bag-of-tricks"; import imgSrc from '../assets/chamber.png'; const DTB_TOKEN = 'vtbot-inspection-chamber'; const VTBAG_REOPEN = '#vtbag-ui-reopen'; export default defineToolbarApp({ init(canvas, app) { createVtbotWindow(); document.addEventListener('astro:after-swap', createVtbotWindow); app.addEventListener('placement-updated', (evt) => { const windowElement = canvas.querySelector('astro-dev-toolbar-window'); windowElement && (windowElement.placement = evt instanceof CustomEvent && evt.detail.placement); }); function createVtbotWindow() { const astroWindow = document.createElement('astro-dev-toolbar-window'); astroWindow.insertAdjacentHTML('beforeend', `
The Bag offers reusable components, tips & tricks plus detailed info about Astro's view transitions and the View Transition API in general.
Visit The Bag's Website and star the Github project to support this work.
Put your view transitions through their paces!
If you see this text, bad things happened. If you got here in a web-container, like e.g. Stackblitz, try to open the preview of your project in a new tab. If this does not help, please file a bug report with the related errors from the browser's console.
You notice a little sign near the Inspection Chamber's power button:
<InspectionChamber /> component.';
button.textContent = 'Switch to standby mode';
button.addEventListener('click', () => {
top!.sessionStorage.setItem('vtbag-ui-standby', 'true');
top!.location.reload();
});
} else if (top!.sessionStorage.getItem(DTB_TOKEN) === 'true') {
status.textContent = 'Chamber was activated via Dev Toolbar.';
button.textContent = 'Turn off';
button.addEventListener('click', () => {
top!.sessionStorage.removeItem(DTB_TOKEN);
top!.location.reload();
});
} else {
status.textContent = 'There is an Inspection Chamber here.';
button.textContent = 'Power up';
button.addEventListener('click', () => {
top!.sessionStorage.removeItem('vtbag-ui-closed'); // ??
top!.sessionStorage.setItem(DTB_TOKEN, 'true');
top!.location.reload();
});
}
}
});
}
});