| Sean McCullough | 4337aa7 | 2025-06-27 23:41:33 +0000 | [diff] [blame] | 1 | /** |
| 2 | * Demo module for sketch-app-shell component |
| 3 | */ |
| 4 | |
| 5 | import { DemoModule } from "./demo-framework/types"; |
| 6 | import { demoUtils } from "./demo-fixtures/index"; |
| 7 | |
| 8 | const demo: DemoModule = { |
| 9 | title: "Sketch App Shell Demo", |
| 10 | description: |
| 11 | "Full sketch application shell with chat, diff, and terminal views", |
| 12 | imports: ["../sketch-app-shell"], |
| 13 | styles: ["/src/sketch-app-shell.css"], |
| 14 | |
| 15 | setup: async (container: HTMLElement) => { |
| 16 | // Mock the service worker for data services |
| 17 | const { worker } = await import("./mocks/browser"); |
| 18 | await worker.start(); |
| 19 | |
| 20 | // Create demo sections |
| 21 | const mainSection = demoUtils.createDemoSection( |
| 22 | "Sketch App Shell", |
| 23 | "Interactive sketch application shell with multiple view modes", |
| 24 | ); |
| 25 | |
| 26 | // Create the app shell |
| 27 | const appShell = document.createElement("sketch-app-shell") as any; |
| 28 | |
| 29 | // Set up the shell to be contained within the demo |
| 30 | appShell.style.cssText = ` |
| 31 | border: 1px solid #d1d9e0; |
| 32 | overflow: hidden; |
| 33 | display: block; |
| 34 | `; |
| 35 | |
| 36 | // Assemble the demo |
| 37 | mainSection.appendChild(appShell); |
| 38 | |
| 39 | container.appendChild(mainSection); |
| 40 | |
| 41 | // Wait a bit for the component to initialize |
| 42 | await demoUtils.delay(100); |
| 43 | }, |
| 44 | |
| 45 | cleanup: async () => { |
| 46 | // Clean up any global state if needed |
| 47 | console.log("Cleaning up sketch-app-shell demo"); |
| 48 | }, |
| 49 | }; |
| 50 | |
| 51 | export default demo; |