|
| 1 | +--- |
| 2 | +/** |
| 3 | + * Standalone interrupt prompt preview page. |
| 4 | + * Renders a single FlowDrop interrupt prompt component. |
| 5 | + * Loaded in an iframe from the docs site for style isolation. |
| 6 | + * Query params (parsed client-side): |
| 7 | + * ?type=confirmation — interrupt type (confirmation|choice|text_input|form|review) |
| 8 | + * ?theme=dark — color theme (dark|light) |
| 9 | + */ |
| 10 | +--- |
| 11 | + |
| 12 | +<!doctype html> |
| 13 | +<html lang="en" data-theme="dark"> |
| 14 | + <head> |
| 15 | + <meta charset="UTF-8" /> |
| 16 | + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
| 17 | + <title>Interrupt Preview</title> |
| 18 | + <style is:global> |
| 19 | + *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; } |
| 20 | + html, body { width: 100%; height: 100%; overflow: auto; } |
| 21 | + body { font-family: system-ui, sans-serif; background: #0a0a0f; color: #c0c0d8; } |
| 22 | + #preview { width: 100%; } |
| 23 | + #loading { |
| 24 | + display: flex; |
| 25 | + align-items: center; |
| 26 | + justify-content: center; |
| 27 | + height: 100%; |
| 28 | + color: #7a7a9a; |
| 29 | + font-size: 0.875rem; |
| 30 | + } |
| 31 | + .hidden { display: none !important; } |
| 32 | + |
| 33 | + /* Skin tokens for dark mode */ |
| 34 | + [data-theme='dark'] { |
| 35 | + --fd-background: #13131a; |
| 36 | + --fd-foreground: #c0c0d8; |
| 37 | + --fd-muted: #1a1a28; |
| 38 | + --fd-muted-foreground: #7a7a9a; |
| 39 | + --fd-card: #1a1a28; |
| 40 | + --fd-card-foreground: #e8e8f0; |
| 41 | + --fd-border: #2a2a3a; |
| 42 | + --fd-border-muted: #1e1e2a; |
| 43 | + --fd-border-strong: #3a3a55; |
| 44 | + --fd-header: #1a1a25; |
| 45 | + --fd-layout-background: #0a0a0f; |
| 46 | + --fd-primary: #6c63ff; |
| 47 | + --fd-primary-hover: #7c74ff; |
| 48 | + --fd-primary-foreground: #ffffff; |
| 49 | + --fd-primary-muted: rgba(108, 99, 255, 0.15); |
| 50 | + --fd-subtle: rgba(108, 99, 255, 0.08); |
| 51 | + --fd-scrollbar-thumb: #2a2a3a; |
| 52 | + --fd-scrollbar-track: #13131a; |
| 53 | + --fd-backdrop: rgba(19, 19, 26, 0.9); |
| 54 | + --fd-success: #22c55e; |
| 55 | + --fd-success-muted: rgba(34, 197, 94, 0.12); |
| 56 | + --fd-success-foreground: #ffffff; |
| 57 | + --fd-error: #ef4444; |
| 58 | + --fd-error-muted: rgba(239, 68, 68, 0.12); |
| 59 | + --fd-error-foreground: #ffffff; |
| 60 | + --fd-warning: #f59e0b; |
| 61 | + } |
| 62 | + </style> |
| 63 | + </head> |
| 64 | + <body> |
| 65 | + <div id="loading">Loading...</div> |
| 66 | + <div id="preview" class="hidden"></div> |
| 67 | + |
| 68 | + <script> |
| 69 | + (async () => { |
| 70 | + const params = new URLSearchParams(window.location.search); |
| 71 | + const interruptType = params.get('type') || 'confirmation'; |
| 72 | + |
| 73 | + const loadingEl = document.getElementById('loading'); |
| 74 | + const previewEl = document.getElementById('preview'); |
| 75 | + |
| 76 | + try { |
| 77 | + const { mount } = await import('svelte'); |
| 78 | + const { default: InterruptPreviewRenderer } = await import('../components/InterruptPreviewRenderer.svelte'); |
| 79 | + const { interruptPreviewData } = await import('../mocks/interrupt-preview-data'); |
| 80 | + |
| 81 | + const data = interruptPreviewData[interruptType] || interruptPreviewData['confirmation']; |
| 82 | + |
| 83 | + loadingEl.classList.add('hidden'); |
| 84 | + previewEl.classList.remove('hidden'); |
| 85 | + |
| 86 | + mount(InterruptPreviewRenderer, { |
| 87 | + target: previewEl, |
| 88 | + props: { type: interruptType, data } |
| 89 | + }); |
| 90 | + } catch (err) { |
| 91 | + console.error('Interrupt preview failed:', err); |
| 92 | + loadingEl.textContent = 'Failed to load preview'; |
| 93 | + } |
| 94 | + })(); |
| 95 | + </script> |
| 96 | + </body> |
| 97 | +</html> |
0 commit comments