import { html, unsafeHTML } from '@elenajs/core'; import { LitroPage } from '@beatzball/litro/adapter/elena/page'; import { definePageData } from '@beatzball/litro'; import { getGlobalData } from 'litro:content'; import { siteConfig } from '../server/starlight.config.js'; import { starlightHead } from '../src/route-meta.js'; // Re-exporting child components prevents Rollup from tree-shaking // the side-effect (.define() calls), ensuring SSR can expand them. export { StarlightPage } from '../src/components/starlight-page.js'; export { LitroCardGrid } from '../src/components/litro-card-grid.js'; export { LitroCard } from '../src/components/litro-card.js'; export { LitroBadge } from '../src/components/litro-badge.js'; export interface SplashData { siteTitle: string; description: string; nav: Array<{ label: string; href: string }>; features: Array<{ title: string; description: string; icon?: string }>; } export const pageData = definePageData(async (_event) => { const metadata = await getGlobalData(); return { siteTitle: String(metadata.title ?? siteConfig.title), description: String(metadata.description ?? siteConfig.description), nav: siteConfig.nav, features: [ { icon: '\u{1F4C4}', title: 'Docs', description: 'Structured documentation with sidebar, TOC, and prev/next navigation.' }, { icon: '\u270D\uFE0F', title: 'Blog', description: 'Write posts in Markdown. Tags, dates, and listing pages auto-generated.' }, { icon: '\u{1F3A8}', title: 'Theming', description: 'Light and dark mode via CSS custom properties. Zero JavaScript required.' }, { icon: '\u26A1', title: 'Static', description: 'Pre-rendered to plain HTML. Deploy to any CDN with no server required.' }, ], } satisfies SplashData; }); export const routeMeta = { head: starlightHead, title: '{{projectName}}', }; export class SplashPage extends LitroPage { static override tagName = 'page-home'; render() { const data = this.serverData as SplashData | null; const siteTitle = data?.siteTitle ?? '{{projectName}}'; const description = data?.description ?? ''; const nav = data?.nav ?? []; const features = data?.features ?? []; const descHtml = description ? `
${description}
` : ''; const cardsHtml = features.map(f => `