@tenphi/starlight 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/theme/defaults.ts","../src/theme/index.ts","../src/integration.ts"],"sourcesContent":["import type {\n ThemeTokens,\n TypographyPreset,\n TypographyPresets,\n} from \"@tenphi/docs\";\n\nexport const DEFAULT_THEME_TOKENS = {\n $gap: \"0.5rem\",\n $radius: \"6px\",\n \"$card-radius\": \"10px\",\n \"$border-width\": \"1px\",\n \"$outline-width\": \"2px\",\n \"$outline-offset\": \"2px\",\n \"$layout-width\": \"87.5rem\",\n \"$content-width\": \"58rem\",\n \"$sidebar-width\": \"17.5rem\",\n \"$control-height\": \"2.5rem\",\n} satisfies ThemeTokens;\n\nconst BODY_FONT =\n \"'Onest Variable', Onest, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif\";\nconst MONO_FONT =\n \"'JetBrains Mono Variable', 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace\";\n\nexport const DEFAULT_TYPOGRAPHY_PRESETS: Record<string, TypographyPreset> = {\n body: {\n fontFamily: BODY_FONT,\n fontSize: \"1rem\",\n lineHeight: 1.75,\n letterSpacing: \"0\",\n fontWeight: 400,\n boldFontWeight: 650,\n },\n heading: {\n fontFamily: BODY_FONT,\n fontSize: \"1rem\",\n lineHeight: 1.2,\n letterSpacing: \"-0.018em\",\n fontWeight: 650,\n boldFontWeight: 750,\n },\n h1: heading(\"3rem\", 1.08, \"-0.035em\"),\n h2: heading(\"2rem\", 1.15, \"-0.025em\"),\n h3: heading(\"1.5rem\", 1.2, \"-0.015em\"),\n h4: heading(\"1.25rem\", 1.25, \"-0.01em\"),\n h5: heading(\"1.125rem\", 1.3, \"0\"),\n h6: heading(\"1rem\", 1.35, \"0\"),\n small: {\n fontFamily: \"var(--body-font-family)\",\n fontSize: \"0.875rem\",\n lineHeight: 1.5,\n letterSpacing: \"0\",\n fontWeight: 400,\n boldFontWeight: 700,\n },\n code: {\n fontFamily: MONO_FONT,\n fontSize: \"0.875rem\",\n lineHeight: 1.6,\n letterSpacing: \"0\",\n fontWeight: 400,\n boldFontWeight: 700,\n },\n};\n\nexport function resolveThemeTokens(tokens: ThemeTokens = {}): ThemeTokens {\n return { ...DEFAULT_THEME_TOKENS, ...tokens };\n}\n\nexport function resolveTypographyPresets(\n presets: TypographyPresets = {},\n): Record<string, TypographyPreset> {\n const body = DEFAULT_TYPOGRAPHY_PRESETS.body;\n if (!body) throw new Error(\"The body typography preset is required.\");\n const names = new Set([\n ...Object.keys(DEFAULT_TYPOGRAPHY_PRESETS),\n ...Object.keys(presets),\n ]);\n return Object.fromEntries(\n [...names].map((name) => [\n name,\n {\n ...(DEFAULT_TYPOGRAPHY_PRESETS[name] ?? body),\n ...(presets[name] ?? {}),\n },\n ]),\n );\n}\n\nfunction heading(\n fontSize: string,\n lineHeight: number,\n letterSpacing: string,\n): TypographyPreset {\n return {\n fontFamily: \"var(--heading-font-family)\",\n fontSize,\n lineHeight,\n letterSpacing,\n fontWeight: \"var(--heading-font-weight)\",\n boldFontWeight: \"var(--heading-bold-font-weight)\",\n };\n}\n","import {\n apcaContrast,\n glaze,\n okhslToLinearSrgb,\n relativeLuminanceFromLinearRgb,\n variantToOkhsl,\n type GlazeColorValue,\n type ResolvedColorVariant,\n} from \"@tenphi/glaze\";\nimport type {\n BrandConfig,\n DocsDiagnostic,\n ThemeConfig,\n ThemeTokens,\n TypographyPreset,\n} from \"@tenphi/docs\";\nimport { resolveThemeTokens, resolveTypographyPresets } from \"./defaults.js\";\n\nexport interface ResolvedDocsTheme {\n css: string;\n colors: {\n surface: Record<string, string>;\n surface2: Record<string, string>;\n surface3: Record<string, string>;\n text: Record<string, string>;\n textSoft: Record<string, string>;\n accentText: Record<string, string>;\n accentSurface: Record<string, string>;\n accentSurfaceText: Record<string, string>;\n focus: Record<string, string>;\n };\n tokens: ThemeTokens;\n presets: Record<string, TypographyPreset>;\n contrast: {\n light: number;\n dark: number;\n lightContrast: number;\n darkContrast: number;\n };\n diagnostics: DocsDiagnostic[];\n}\n\nexport function resolveDocsTheme(theme: ThemeConfig = {}): ResolvedDocsTheme {\n const brand = normalizeBrand(theme.brand);\n const authoredTarget = brand.contrast?.apca ?? 45;\n const normalTarget = Array.isArray(authoredTarget)\n ? authoredTarget[0]\n : authoredTarget;\n const highTarget = Array.isArray(authoredTarget)\n ? authoredTarget[1]\n : normalTarget + 15;\n const glazeOptions = {\n autoFlip: true,\n ...(theme.contrastLevel !== undefined\n ? { contrastLevel: theme.contrastLevel }\n : {}),\n } as const;\n const surfaceFrom = theme.palette?.surface ?? \"#ffffff\";\n const surface = glaze.color({\n from: surfaceFrom,\n mode: \"auto\",\n // Near-white brand surfaces can carry a numerically large OKHSL\n // saturation that becomes vivid when tone-inverted. Preserve the authored\n // light surface, but keep dark chrome in the neutral-surface range.\n darkSaturation: 0.35,\n });\n const surface2 = glaze.color(\n {\n from: surfaceFrom,\n base: surface,\n tone: [\"-2\", \"-4\"],\n mode: \"auto\",\n darkSaturation: 0.35,\n },\n glazeOptions,\n );\n const surface3 = glaze.color(\n {\n from: surfaceFrom,\n base: surface,\n tone: [\"-4\", \"-8\"],\n mode: \"auto\",\n darkSaturation: 0.35,\n },\n glazeOptions,\n );\n const text = glaze.color(\n {\n from: theme.palette?.text ?? \"#20232a\",\n base: surface,\n role: \"text\",\n contrast: { apca: [75, 90] },\n mode: \"auto\",\n },\n glazeOptions,\n );\n const textSoft = glaze.color(\n {\n from: theme.palette?.textSoft ?? \"#626875\",\n base: surface,\n role: \"text\",\n contrast: { apca: [60, 75] },\n mode: \"auto\",\n },\n glazeOptions,\n );\n const accentText = glaze.color(\n {\n from: brand.from,\n base: surface,\n role: \"text\",\n contrast: { apca: authoredTarget },\n mode: \"auto\",\n },\n glazeOptions,\n );\n const focus = glaze.color(\n {\n from: brand.from,\n base: surface,\n role: \"border\",\n contrast: { apca: authoredTarget },\n mode: \"auto\",\n },\n glazeOptions,\n );\n const accentSurface = glaze.color({ from: brand.from, mode: \"fixed\" });\n const accentSurfaceText = glaze.color({\n from: \"#ffffff\",\n base: accentSurface,\n role: \"text\",\n contrast: { apca: 60 },\n mode: \"auto\",\n });\n\n const resolvedSurface = surface.resolve();\n const resolvedAccent = accentText.resolve();\n const scores = {\n light: score(resolvedAccent.light, resolvedSurface.light),\n dark: score(resolvedAccent.dark, resolvedSurface.dark),\n lightContrast: score(\n resolvedAccent.lightContrast,\n resolvedSurface.lightContrast,\n ),\n darkContrast: score(\n resolvedAccent.darkContrast,\n resolvedSurface.darkContrast,\n ),\n };\n const diagnostics: DocsDiagnostic[] = [];\n for (const [scheme, measured] of Object.entries(scores)) {\n const required = scheme.includes(\"Contrast\") ? highTarget : normalTarget;\n if (measured + 0.05 < required) {\n diagnostics.push({\n code: \"DOCS_BRAND_CONTRAST_UNMET\",\n severity: \"error\",\n message: `Brand contrast in ${scheme} is Lc ${measured.toFixed(1)}; required Lc ${required}.`,\n hint: `Authored color: ${String(brand.from)}.`,\n });\n }\n }\n const outputOptions = { modes: { highContrast: true } } as const;\n const colors = {\n surface: surface.json(outputOptions),\n surface2: surface2.json(outputOptions),\n surface3: surface3.json(outputOptions),\n text: text.json(outputOptions),\n textSoft: textSoft.json(outputOptions),\n accentText: accentText.json(outputOptions),\n accentSurface: accentSurface.json(outputOptions),\n accentSurfaceText: accentSurfaceText.json(outputOptions),\n focus: focus.json(outputOptions),\n };\n return {\n css: themeCss(colors, theme),\n colors,\n tokens: resolveThemeTokens(theme.tokens),\n presets: resolveTypographyPresets(theme.presets),\n contrast: scores,\n diagnostics,\n };\n}\n\nfunction normalizeBrand(\n brand: BrandConfig | undefined,\n): Exclude<BrandConfig, GlazeColorValue> & { from: GlazeColorValue } {\n if (typeof brand === \"object\" && brand !== null && \"from\" in brand)\n return brand;\n return { from: brand ?? \"#315efb\" };\n}\n\nfunction score(\n foreground: ResolvedColorVariant,\n background: ResolvedColorVariant,\n): number {\n return Math.abs(apcaContrast(luminance(foreground), luminance(background)));\n}\n\nfunction luminance(variant: ResolvedColorVariant): number {\n const { h, s, l } = variantToOkhsl(variant);\n return relativeLuminanceFromLinearRgb(\n okhslToLinearSrgb(h, s, l, variant.pastel),\n );\n}\n\nfunction themeCss(\n colors: ResolvedDocsTheme[\"colors\"],\n theme: ThemeConfig,\n): string {\n const tokens = resolveThemeTokens(theme.tokens);\n const presets = resolveTypographyPresets(theme.presets);\n const designDeclarations = [\n ...Object.entries(tokens).map(\n ([name, value]) => `${tokenProperty(name)}:${String(value)}`,\n ),\n ...Object.entries(presets).flatMap(([name, preset]) =>\n Object.entries(preset).map(\n ([property, value]) =>\n `--${kebab(name)}-${kebab(property)}:${String(value)}`,\n ),\n ),\n ].join(\";\");\n const declarations = (mode: string): string =>\n [\n `--td-surface:${colors.surface[mode]}`,\n `--td-surface-2:${colors.surface2[mode]}`,\n `--td-surface-3:${colors.surface3[mode]}`,\n `--td-text:${colors.text[mode]}`,\n `--td-text-soft:${colors.textSoft[mode]}`,\n `--td-accent-text:${colors.accentText[mode]}`,\n `--td-accent-surface:${colors.accentSurface[mode]}`,\n `--td-accent-surface-text:${colors.accentSurfaceText[mode]}`,\n `--td-focus:${colors.focus[mode]}`,\n \"--td-surface-2-hover:color-mix(in oklab,var(--td-text) 3%,var(--td-surface-2))\",\n \"--td-surface-2-pressed:color-mix(in oklab,var(--td-text) 9%,var(--td-surface-2))\",\n \"--td-surface-3-hover:color-mix(in oklab,var(--td-text) 3%,var(--td-surface-3))\",\n \"--td-surface-3-pressed:color-mix(in oklab,var(--td-text) 9%,var(--td-surface-3))\",\n \"--td-border:color-mix(in oklab,var(--td-text) 18%,var(--td-surface))\",\n \"--td-border-strong:color-mix(in oklab,var(--td-text) 34%,var(--td-surface))\",\n \"--td-shadow:color-mix(in oklab,var(--td-text) 16%,transparent)\",\n \"--td-overlay:color-mix(in oklab,var(--td-text) 58%,transparent)\",\n ].join(\";\");\n return [\n `:root{${designDeclarations};${declarations(\"dark\")}}`,\n `:root[data-theme=light]{${declarations(\"light\")}}`,\n `@media(prefers-color-scheme:light){:root:not([data-theme]){${declarations(\"light\")}}}`,\n `@media(prefers-contrast:more){:root{${declarations(\"darkContrast\")}}:root[data-theme=light]{${declarations(\"lightContrast\")}}@media(prefers-color-scheme:light){:root:not([data-theme]){${declarations(\"lightContrast\")}}}}`,\n `:root[data-contrast=more]{${declarations(\"darkContrast\")}}`,\n `:root[data-theme=light][data-contrast=more]{${declarations(\"lightContrast\")}}`,\n ].join(\"\\n\");\n}\n\nfunction tokenProperty(name: string): string {\n if (name.startsWith(\"--\")) return name;\n return `--${name.replace(/^\\$/, \"\")}`;\n}\n\nfunction kebab(value: string): string {\n return value\n .replace(/([a-z0-9])([A-Z])/g, \"$1-$2\")\n .replace(/[^a-zA-Z0-9_-]/g, \"-\")\n .toLowerCase();\n}\n","import { existsSync } from \"node:fs\";\nimport { cp, mkdir, readFile } from \"node:fs/promises\";\nimport { createRequire } from \"node:module\";\nimport { dirname, extname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport starlight from \"./starlight-runtime.js\";\nimport {\n createDocsGraph,\n assertValidDocs,\n type DocsConfig,\n type NavigationItem,\n} from \"@tenphi/docs\";\nimport {\n configure,\n type ConfigTokens,\n type Styles,\n type TypographyPreset,\n} from \"@tenphi/tasty/core\";\nimport { tastyIntegration } from \"@tenphi/tasty/ssr/astro\";\nimport type { AstroIntegration, HookParameters } from \"astro\";\nimport {\n resolveNavigationLayout,\n type ResolvedNavigationLayout,\n} from \"./navigation.js\";\nimport { resolveDocsTheme } from \"./theme/index.js\";\n\nconst packageRequire = createRequire(import.meta.url);\nconst starlightRoot = dirname(packageRequire.resolve(\"@astrojs/starlight\"));\nconst tastyStaticMiddleware = packageRequire.resolve(\n \"@tenphi/tasty/ssr/astro-middleware-static\",\n);\n\nexport interface CookbookOptions {\n config?: DocsConfig;\n root?: string;\n}\n\nexport default function cookbook(\n options: CookbookOptions = {},\n): AstroIntegration {\n const docsTheme = resolveDocsTheme(options.config?.theme);\n if (\n docsTheme.diagnostics.some((diagnostic) => diagnostic.severity === \"error\")\n ) {\n throw new Error(\n docsTheme.diagnostics.map((diagnostic) => diagnostic.message).join(\"\\n\"),\n );\n }\n configureTastyTheme(options.config?.theme, docsTheme);\n const cssPath = fileURLToPath(new URL(\"./styles.css\", import.meta.url));\n const searchClientPath = fileURLToPath(\n new URL(\"./client/search.js\", import.meta.url),\n );\n const appearanceClientPath = fileURLToPath(\n new URL(\"./client/appearance.js\", import.meta.url),\n );\n const headerPath = fileURLToPath(\n new URL(\"./overrides/Header.astro\", import.meta.url),\n );\n const sidebarPath = fileURLToPath(\n new URL(\"./overrides/Sidebar.astro\", import.meta.url),\n );\n const components = {\n Header: headerPath,\n Sidebar: sidebarPath,\n ...options.config?.components?.overrides,\n };\n const navigation = resolveNavigationLayout(options.config?.navigation);\n const inner = [\n tastyIntegration({ islands: false }),\n starlight({\n title: options.config?.site?.title ?? \"Documentation\",\n ...(options.config?.site?.description\n ? { description: options.config.site.description }\n : {}),\n customCss: [\"virtual:cookbook/theme.css\", cssPath],\n ...(options.config?.search?.enabled === false ? { pagefind: false } : {}),\n components,\n sidebar: starlightSidebar(navigation),\n }),\n ] satisfies AstroIntegration[];\n let projectRoot = options.root;\n let graphConfig = options.config;\n let graph: Awaited<ReturnType<typeof createDocsGraph>> | undefined;\n let usingStarlight = false;\n\n async function loadGraph(refresh = false) {\n if (!graph || refresh) {\n graph = await createDocsGraph({\n ...(projectRoot ? { root: projectRoot } : {}),\n ...(graphConfig ? { config: graphConfig } : {}),\n });\n assertValidDocs(graph);\n }\n return graph;\n }\n\n return {\n name: \"cookbook\",\n hooks: {\n \"astro:config:setup\": async (context) => {\n if (\n context.config.integrations.some(\n (integration) => integration.name === \"@astrojs/starlight\",\n )\n ) {\n throw new Error(\n \"Cookbook already includes Starlight. Remove the direct @astrojs/starlight integration before continuing.\",\n );\n }\n projectRoot ??= fileURLToPath(context.config.root);\n const base = options.config?.build?.base ?? context.config.base;\n graphConfig = {\n ...options.config,\n build: { ...options.config?.build, base },\n };\n usingStarlight = hasContentConfig(context.config.srcDir);\n context.updateConfig({\n base,\n output: \"static\",\n vite: {\n ssr: {\n external: [\"@tenphi/docs\"],\n },\n plugins: [\n virtualDocsPlugin(\n docsTheme.css,\n () => ({\n entries: graph?.entries ?? [],\n routes: graph?.routes ?? [],\n site: graph?.config.site ?? options.config?.site ?? {},\n base: graph?.config.build.base ?? base,\n search:\n graph?.config.search.enabled ??\n options.config?.search?.enabled ??\n true,\n }),\n navigation,\n ),\n ],\n resolve: {\n alias: [\n {\n find: \"@astrojs/starlight\",\n replacement: starlightRoot,\n },\n {\n find: \"@tenphi/tasty/ssr/astro-middleware-static\",\n replacement: tastyStaticMiddleware,\n },\n ],\n },\n },\n });\n await callInner(inner.slice(0, 1), \"astro:config:setup\", context);\n\n if (!usingStarlight) {\n graph = await createDocsGraph({\n root: projectRoot,\n config: graphConfig,\n });\n assertValidDocs(graph);\n if (graph.config.search.enabled) {\n context.injectScript(\n \"page\",\n `import ${JSON.stringify(searchClientPath)};`,\n );\n }\n context.injectScript(\n \"page\",\n `import ${JSON.stringify(appearanceClientPath)};`,\n );\n context.injectRoute({\n pattern: \"[...route]\",\n entrypoint: new URL(\"./routes/DocsPage.astro\", import.meta.url),\n prerender: true,\n });\n return;\n }\n\n // Starlight inserts its own follow-up integrations immediately after\n // itself. Give it a temporary real position so Astro processes those\n // once, after this composite integration, rather than re-visiting us.\n const starlightIntegration = inner[1];\n if (starlightIntegration) {\n const selfIndex = context.config.integrations.findIndex(\n (integration) => integration.name === \"cookbook\",\n );\n context.config.integrations.splice(\n selfIndex + 1,\n 0,\n starlightIntegration,\n );\n try {\n await callInner(\n [starlightIntegration],\n \"astro:config:setup\",\n context,\n );\n } finally {\n const placeholderIndex =\n context.config.integrations.indexOf(starlightIntegration);\n if (placeholderIndex >= 0)\n context.config.integrations.splice(placeholderIndex, 1);\n }\n }\n },\n \"astro:config:done\": async (context) => {\n await callInner(\n usingStarlight ? inner : inner.slice(0, 1),\n \"astro:config:done\",\n context,\n );\n },\n \"astro:server:setup\": async ({ server }) => {\n let assets = docsAssetMap(await loadGraph());\n server.middlewares.use(async (request, response, next) => {\n if (request.method !== \"GET\" && request.method !== \"HEAD\") {\n next();\n return;\n }\n const pathname = requestPath(request.url);\n if (!pathname.includes(\"/_tasty-assets/\")) {\n next();\n return;\n }\n let asset = assets.get(pathname);\n if (!asset) {\n try {\n assets = docsAssetMap(await loadGraph(true));\n } catch {\n next();\n return;\n }\n asset = assets.get(pathname);\n }\n if (!asset?.sourcePath) {\n next();\n return;\n }\n try {\n const body = await readFile(asset.sourcePath);\n response.statusCode = 200;\n response.setHeader(\"Content-Type\", assetContentType(pathname));\n response.setHeader(\"Content-Length\", body.byteLength);\n response.setHeader(\"Cache-Control\", \"no-cache\");\n response.end(request.method === \"HEAD\" ? undefined : body);\n } catch {\n next();\n }\n });\n },\n \"astro:build:start\": async (context) => {\n await loadGraph();\n await callInner(\n usingStarlight ? inner : inner.slice(0, 1),\n \"astro:build:start\",\n context,\n );\n },\n \"astro:build:done\": async (context) => {\n await callInner(\n usingStarlight ? inner : inner.slice(0, 1),\n \"astro:build:done\",\n context,\n );\n if (!graph) return;\n const output = fileURLToPath(context.dir);\n for (const asset of graph.assets) {\n if (!asset.sourcePath || !asset.publicPath) continue;\n const target = join(output, asset.publicPath.replace(/^\\//, \"\"));\n await mkdir(dirname(target), { recursive: true });\n await cp(asset.sourcePath, target);\n }\n if (!usingStarlight && graph.config.search.enabled) {\n const { close, createIndex } = await import(\"pagefind\");\n const created = await createIndex({\n rootSelector: \"[data-pagefind-body]\",\n });\n if (!created.index || created.errors.length > 0) {\n throw new Error(\n `Pagefind failed to start: ${created.errors.join(\"; \")}`,\n );\n }\n const indexed = await created.index.addDirectory({ path: output });\n if (indexed.errors.length > 0) {\n throw new Error(\n `Pagefind failed to index the site: ${indexed.errors.join(\"; \")}`,\n );\n }\n const written = await created.index.writeFiles({\n outputPath: join(output, \"pagefind\"),\n });\n await close();\n if (written.errors.length > 0) {\n throw new Error(\n `Pagefind failed to write the index: ${written.errors.join(\"; \")}`,\n );\n }\n }\n },\n },\n };\n}\n\nfunction docsAssetMap(graph: Awaited<ReturnType<typeof createDocsGraph>>) {\n return new Map(\n graph.assets.flatMap((asset) =>\n asset.publicPath && asset.sourcePath\n ? [[asset.publicPath, asset] as const]\n : [],\n ),\n );\n}\n\nfunction requestPath(url: string | undefined): string {\n try {\n return decodeURIComponent(new URL(url ?? \"/\", \"http://localhost\").pathname);\n } catch {\n return \"\";\n }\n}\n\nfunction assetContentType(pathname: string): string {\n switch (extname(pathname).toLowerCase()) {\n case \".avif\":\n return \"image/avif\";\n case \".gif\":\n return \"image/gif\";\n case \".jpeg\":\n case \".jpg\":\n return \"image/jpeg\";\n case \".png\":\n return \"image/png\";\n case \".svg\":\n return \"image/svg+xml\";\n case \".webp\":\n return \"image/webp\";\n default:\n return \"application/octet-stream\";\n }\n}\n\nfunction configureTastyTheme(\n theme: DocsConfig[\"theme\"],\n resolved: ReturnType<typeof resolveDocsTheme>,\n): void {\n const tokens = Object.fromEntries(\n Object.entries(resolved.tokens).filter(([name]) => name.startsWith(\"$\")),\n ) as ConfigTokens;\n Object.assign(tokens, {\n \"#surface\": \"var(--td-surface)\",\n \"#surface-2\": \"var(--td-surface-2)\",\n \"#surface-3\": \"var(--td-surface-3)\",\n \"#text\": \"var(--td-text)\",\n \"#text-soft\": \"var(--td-text-soft)\",\n \"#border\": \"var(--td-border)\",\n \"#border-strong\": \"var(--td-border-strong)\",\n \"#accent-text\": \"var(--td-accent-text)\",\n \"#accent-surface\": \"var(--td-accent-surface)\",\n \"#accent-surface-text\": \"var(--td-accent-surface-text)\",\n \"#focus\": \"var(--td-focus)\",\n } satisfies ConfigTokens);\n\n const globalStyles = anatomyStyles(theme?.styles);\n configure({\n ...(theme?.states ? { states: theme.states } : {}),\n units: {\n x: \"var(--gap)\",\n r: \"var(--radius)\",\n cr: \"var(--card-radius)\",\n bw: \"var(--border-width)\",\n },\n tokens,\n presets: resolved.presets as Record<string, TypographyPreset>,\n ...(globalStyles ? { globalStyles } : {}),\n });\n}\n\nfunction anatomyStyles(\n styles: Record<string, unknown> | undefined,\n): Record<string, Styles> | undefined {\n if (!styles) return undefined;\n return Object.fromEntries(\n Object.entries(styles)\n .filter((entry): entry is [string, Styles] => isRecord(entry[1]))\n .map(([name, value]) => [`[data-tasty-anatomy=\"${name}\"]`, value]),\n );\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction starlightSidebar(layout: ResolvedNavigationLayout): unknown[] {\n const fallback = layout.items?.length\n ? layout.items.map(starlightSidebarItem)\n : [{ autogenerate: { directory: \"\" } }];\n if (!layout.sectioned) return fallback;\n\n return [\n ...(layout.fallbackSidebarGroup !== undefined\n ? [\n {\n label: \"Documentation\",\n items: (layout.items ?? []).map(starlightSidebarItem),\n },\n ]\n : []),\n ...layout.tabs.flatMap((tab) =>\n tab.items !== undefined\n ? [{ label: tab.label, items: tab.items.map(starlightSidebarItem) }]\n : [],\n ),\n ];\n}\n\nfunction starlightSidebarItem(item: NavigationItem): unknown {\n if (typeof item === \"string\") return { slug: routeToSlug(item) };\n if (\"items\" in item) {\n return {\n label: item.label,\n items: item.items.map(starlightSidebarItem),\n };\n }\n if (\"autogenerate\" in item) {\n return {\n label: item.label,\n items: [\n {\n autogenerate: {\n directory: routeToSlug(item.autogenerate.directory, false),\n },\n },\n ],\n };\n }\n return { label: item.label, link: item.link };\n}\n\nfunction routeToSlug(route: string, rootAsIndex = true): string {\n const slug = route.replace(/^\\/+|\\/+$/g, \"\");\n return slug || (rootAsIndex ? \"index\" : \"\");\n}\n\nexport function tastyStarlight(\n config: Parameters<typeof starlight>[0],\n): AstroIntegration {\n return starlight(config);\n}\n\nasync function callInner<K extends keyof AstroIntegration[\"hooks\"]>(\n integrations: AstroIntegration[],\n hook: K,\n context: HookParameters<K>,\n): Promise<void> {\n for (const integration of integrations) {\n const handler = integration.hooks[hook];\n if (typeof handler === \"function\") {\n await (handler as (value: HookParameters<K>) => void | Promise<void>)(\n context,\n );\n }\n }\n}\n\nfunction virtualDocsPlugin(\n css: string,\n getContent: () => unknown,\n layout: ResolvedNavigationLayout,\n) {\n const themeId = \"\\0virtual:cookbook/theme.css\";\n const configId = \"\\0virtual:cookbook/config\";\n const layoutId = \"\\0virtual:cookbook/layout\";\n return {\n name: \"cookbook-theme\",\n resolveId(id: string) {\n if (id === \"virtual:cookbook/theme.css\") return themeId;\n if (id === \"virtual:cookbook/config\") return configId;\n if (id === \"virtual:cookbook/layout\") return layoutId;\n return undefined;\n },\n load(id: string) {\n if (id === themeId) return css;\n if (id === configId) {\n return `export const content = ${JSON.stringify(getContent())};`;\n }\n if (id === layoutId) {\n return `export const layout = ${JSON.stringify(layout)};`;\n }\n return undefined;\n },\n };\n}\n\nfunction hasContentConfig(srcDir: URL): boolean {\n const source = fileURLToPath(srcDir);\n return [\n \"content.config.ts\",\n \"content.config.mts\",\n \"content.config.js\",\n \"content.config.mjs\",\n \"content/config.ts\",\n ].some((path) => existsSync(join(source, path)));\n}\n"],"mappings":";;;;;;;;;;;;AAMA,MAAa,uBAAuB;CAClC,MAAM;CACN,SAAS;CACT,gBAAgB;CAChB,iBAAiB;CACjB,kBAAkB;CAClB,mBAAmB;CACnB,iBAAiB;CACjB,kBAAkB;CAClB,kBAAkB;CAClB,mBAAmB;AACrB;AAEA,MAAM,YACJ;AAIF,MAAa,6BAA+D;CAC1E,MAAM;EACJ,YAAY;EACZ,UAAU;EACV,YAAY;EACZ,eAAe;EACf,YAAY;EACZ,gBAAgB;CAClB;CACA,SAAS;EACP,YAAY;EACZ,UAAU;EACV,YAAY;EACZ,eAAe;EACf,YAAY;EACZ,gBAAgB;CAClB;CACA,IAAI,Q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OAAO,UACT,OAAO,yBAAyB,KAAK,UAAU,MAAM,EAAE;EAG3D;CACF;AACF;AAEA,SAAS,iBAAiB,QAAsB;CAC9C,MAAM,SAAS,cAAc,MAAM;CACnC,OAAO;EACL;EACA;EACA;EACA;EACA;CACF,CAAC,CAAC,MAAM,SAAS,WAAW,KAAK,QAAQ,IAAI,CAAC,CAAC;AACjD"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/theme/defaults.ts","../src/theme/index.ts","../src/theme/tasty-config.ts","../src/components/component-styles.ts","../src/components/tasty-states.js","../src/integration.ts"],"sourcesContent":["import type {\n ThemeTokens,\n TypographyPreset,\n TypographyPresets,\n} from \"@tenphi/docs\";\n\nexport const DEFAULT_THEME_TOKENS = {\n $gap: \"0.5rem\",\n $radius: \"6px\",\n \"$card-radius\": \"10px\",\n \"$border-width\": \"1px\",\n \"$outline-width\": \"2px\",\n \"$outline-offset\": \"2px\",\n \"$layout-width\": \"87.5rem\",\n \"$content-width\": \"58rem\",\n \"$sidebar-width\": \"17.5rem\",\n \"$control-height\": \"2.5rem\",\n} satisfies ThemeTokens;\n\nconst BODY_FONT =\n \"'Onest Variable', Onest, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif\";\nconst MONO_FONT =\n \"'JetBrains Mono Variable', 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace\";\n\nexport const DEFAULT_TYPOGRAPHY_PRESETS: Record<string, TypographyPreset> = {\n body: {\n fontFamily: BODY_FONT,\n fontSize: \"1rem\",\n lineHeight: 1.65,\n letterSpacing: \"-0.006em\",\n fontWeight: 420,\n boldFontWeight: 640,\n },\n heading: {\n fontFamily: BODY_FONT,\n fontSize: \"1rem\",\n lineHeight: 1.15,\n letterSpacing: \"-0.025em\",\n fontWeight: 640,\n boldFontWeight: 720,\n },\n h1: heading(\"clamp(2.5rem, 5vw, 3.25rem)\", 1.05, \"-0.045em\"),\n h2: heading(\"clamp(1.75rem, 3vw, 2.125rem)\", 1.1, \"-0.035em\"),\n h3: heading(\"1.5rem\", 1.15, \"-0.025em\"),\n h4: heading(\"1.25rem\", 1.2, \"-0.018em\"),\n h5: heading(\"1.125rem\", 1.25, \"-0.012em\"),\n h6: heading(\"1rem\", 1.3, \"-0.006em\"),\n navigation: {\n fontFamily: \"var(--body-font-family)\",\n fontSize: \"0.9375rem\",\n lineHeight: 1.4,\n letterSpacing: \"-0.006em\",\n fontWeight: 540,\n boldFontWeight: 650,\n },\n small: {\n fontFamily: \"var(--body-font-family)\",\n fontSize: \"0.875rem\",\n lineHeight: 1.45,\n letterSpacing: \"-0.002em\",\n fontWeight: 420,\n boldFontWeight: 650,\n },\n code: {\n fontFamily: MONO_FONT,\n fontSize: \"0.875rem\",\n lineHeight: 1.65,\n letterSpacing: \"0\",\n fontWeight: 400,\n boldFontWeight: 650,\n },\n};\n\nexport function resolveThemeTokens(tokens: ThemeTokens = {}): ThemeTokens {\n return { ...DEFAULT_THEME_TOKENS, ...tokens };\n}\n\nexport function resolveTypographyPresets(\n presets: TypographyPresets = {},\n): Record<string, TypographyPreset> {\n const body = DEFAULT_TYPOGRAPHY_PRESETS.body;\n if (!body) throw new Error(\"The body typography preset is required.\");\n const names = new Set([\n ...Object.keys(DEFAULT_TYPOGRAPHY_PRESETS),\n ...Object.keys(presets),\n ]);\n return Object.fromEntries(\n [...names].map((name) => [\n name,\n {\n ...(DEFAULT_TYPOGRAPHY_PRESETS[name] ?? body),\n ...(presets[name] ?? {}),\n },\n ]),\n );\n}\n\nfunction heading(\n fontSize: string,\n lineHeight: number,\n letterSpacing: string,\n): TypographyPreset {\n return {\n fontFamily: \"var(--heading-font-family)\",\n fontSize,\n lineHeight,\n letterSpacing,\n fontWeight: \"var(--heading-font-weight)\",\n boldFontWeight: \"var(--heading-bold-font-weight)\",\n };\n}\n","import {\n apcaContrast,\n glaze,\n okhslToLinearSrgb,\n relativeLuminanceFromLinearRgb,\n variantToOkhsl,\n type GlazeColorValue,\n type ResolvedColorVariant,\n} from \"@tenphi/glaze\";\nimport type {\n BrandConfig,\n DocsDiagnostic,\n ThemeConfig,\n ThemeTokens,\n TypographyPreset,\n} from \"@tenphi/docs\";\nimport { resolveThemeTokens, resolveTypographyPresets } from \"./defaults.js\";\n\nexport interface ResolvedDocsTheme {\n colors: {\n surface: Record<string, string>;\n surface2: Record<string, string>;\n surface3: Record<string, string>;\n text: Record<string, string>;\n textSoft: Record<string, string>;\n accentText: Record<string, string>;\n accentSurface: Record<string, string>;\n accentSurfaceText: Record<string, string>;\n focus: Record<string, string>;\n shadow: Record<string, string>;\n };\n tokens: ThemeTokens;\n presets: Record<string, TypographyPreset>;\n contrast: {\n light: number;\n dark: number;\n lightContrast: number;\n darkContrast: number;\n };\n diagnostics: DocsDiagnostic[];\n}\n\nexport function resolveDocsTheme(theme: ThemeConfig = {}): ResolvedDocsTheme {\n const brand = normalizeBrand(theme.brand);\n const authoredTarget = brand.contrast?.apca ?? 45;\n const normalTarget = Array.isArray(authoredTarget)\n ? authoredTarget[0]\n : authoredTarget;\n const highTarget = Array.isArray(authoredTarget)\n ? authoredTarget[1]\n : normalTarget + 15;\n const glazeOptions = {\n autoFlip: true,\n ...(theme.contrastLevel !== undefined\n ? { contrastLevel: theme.contrastLevel }\n : {}),\n } as const;\n const surfaceFrom = theme.palette?.surface ?? \"#ffffff\";\n const surface = glaze.color({\n from: surfaceFrom,\n mode: \"auto\",\n // Near-white brand surfaces can carry a numerically large OKHSL\n // saturation that becomes vivid as the ramp moves away from white. Reduce\n // saturation along the light ramp and keep dark chrome nearly neutral.\n darkSaturation: 0.35,\n });\n const surface2 = glaze.color(\n {\n from: surfaceFrom,\n base: surface,\n tone: \"-2\",\n mode: \"auto\",\n saturationFactor: 0.9,\n darkSaturation: 0.325,\n },\n glazeOptions,\n );\n const surface3 = glaze.color(\n {\n from: surfaceFrom,\n base: surface2,\n tone: \"-2\",\n mode: \"auto\",\n saturationFactor: 0.8,\n darkSaturation: 0.3,\n },\n glazeOptions,\n );\n const text = glaze.color(\n {\n from: theme.palette?.text ?? \"#20232a\",\n base: surface,\n role: \"text\",\n contrast: { apca: [75, 90] },\n mode: \"auto\",\n },\n glazeOptions,\n );\n const textSoft = glaze.color(\n {\n from: theme.palette?.textSoft ?? \"#626875\",\n base: surface,\n role: \"text\",\n contrast: { apca: [60, 75] },\n mode: \"auto\",\n },\n glazeOptions,\n );\n const accentText = glaze.color(\n {\n from: brand.from,\n base: surface,\n role: \"text\",\n contrast: { apca: authoredTarget },\n mode: \"auto\",\n },\n glazeOptions,\n );\n const focus = glaze.color(\n {\n from: brand.from,\n base: surface,\n role: \"border\",\n contrast: { apca: authoredTarget },\n mode: \"auto\",\n },\n glazeOptions,\n );\n const accentSurface = glaze.color({ from: brand.from, mode: \"fixed\" });\n const accentSurfaceText = glaze.color({\n from: \"#ffffff\",\n base: accentSurface,\n role: \"text\",\n contrast: { apca: 60 },\n mode: \"auto\",\n });\n const resolvedSurface = surface.resolve();\n const resolvedAccent = accentText.resolve();\n const shadowTheme = glaze(\n {\n hue: variantToOkhsl(resolvedSurface.light).h,\n saturation: variantToOkhsl(resolvedSurface.light).s * 100,\n darkHue: variantToOkhsl(resolvedSurface.dark).h,\n darkSaturation: variantToOkhsl(resolvedSurface.dark).s * 100,\n },\n undefined,\n glazeOptions,\n );\n shadowTheme.colors({\n surface: {\n from: surfaceFrom,\n mode: \"auto\",\n darkSaturation: 0.35,\n },\n text: {\n from: theme.palette?.text ?? \"#20232a\",\n base: \"surface\",\n role: \"text\",\n contrast: { apca: [75, 90] },\n mode: \"auto\",\n },\n shadow: {\n type: \"shadow\",\n bg: \"surface\",\n fg: \"text\",\n intensity: [12, 20],\n tuning: { alphaMax: 0.28 },\n },\n });\n\n const scores = {\n light: score(resolvedAccent.light, resolvedSurface.light),\n dark: score(resolvedAccent.dark, resolvedSurface.dark),\n lightContrast: score(\n resolvedAccent.lightContrast,\n resolvedSurface.lightContrast,\n ),\n darkContrast: score(\n resolvedAccent.darkContrast,\n resolvedSurface.darkContrast,\n ),\n };\n const diagnostics: DocsDiagnostic[] = [];\n for (const [scheme, measured] of Object.entries(scores)) {\n const required = scheme.includes(\"Contrast\") ? highTarget : normalTarget;\n if (measured + 0.05 < required) {\n diagnostics.push({\n code: \"DOCS_BRAND_CONTRAST_UNMET\",\n severity: \"error\",\n message: `Brand contrast in ${scheme} is Lc ${measured.toFixed(1)}; required Lc ${required}.`,\n hint: `Authored color: ${String(brand.from)}.`,\n });\n }\n }\n const outputOptions = { modes: { highContrast: true } } as const;\n const shadow = shadowTheme.json(outputOptions).shadow;\n if (!shadow) throw new Error(\"The Glaze shadow token failed to resolve.\");\n const colors = {\n surface: surface.json(outputOptions),\n surface2: surface2.json(outputOptions),\n surface3: surface3.json(outputOptions),\n text: text.json(outputOptions),\n textSoft: textSoft.json(outputOptions),\n accentText: accentText.json(outputOptions),\n accentSurface: accentSurface.json(outputOptions),\n accentSurfaceText: accentSurfaceText.json(outputOptions),\n focus: focus.json(outputOptions),\n shadow,\n };\n return {\n colors,\n tokens: resolveThemeTokens(theme.tokens),\n presets: resolveTypographyPresets(theme.presets),\n contrast: scores,\n diagnostics,\n };\n}\n\nfunction normalizeBrand(\n brand: BrandConfig | undefined,\n): Exclude<BrandConfig, GlazeColorValue> & { from: GlazeColorValue } {\n if (typeof brand === \"object\" && brand !== null && \"from\" in brand)\n return brand;\n return { from: brand ?? \"#315efb\" };\n}\n\nfunction score(\n foreground: ResolvedColorVariant,\n background: ResolvedColorVariant,\n): number {\n return Math.abs(apcaContrast(luminance(foreground), luminance(background)));\n}\n\nfunction luminance(variant: ResolvedColorVariant): number {\n const { h, s, l } = variantToOkhsl(variant);\n return relativeLuminanceFromLinearRgb(\n okhslToLinearSrgb(h, s, l, variant.pastel),\n );\n}\n","import type { ConfigTokens } from \"@tenphi/tasty/core\";\nimport type { ResolvedDocsTheme } from \"./index.js\";\n\nexport const TASTY_UNITS = {\n x: \"var(--gap)\",\n r: \"var(--radius)\",\n cr: \"var(--card-radius)\",\n bw: \"var(--border-width)\",\n} as const;\n\n// Token states are emitted on :root already. Keep these as ordinary state\n// selectors so Tasty attaches them to that root instead of generating an\n// impossible descendant `:root ... :root` selector.\nconst LIGHT =\n \"theme=light | (@media(prefers-color-scheme: light) & :not([data-theme]))\";\nconst HIGH_CONTRAST =\n \"contrast=more | (@media(prefers-contrast: more) & :not([data-contrast]))\";\n\nexport function tastyTokens(theme: ResolvedDocsTheme): ConfigTokens {\n const tokens = Object.fromEntries(\n Object.entries(theme.tokens).filter(([name]) => name.startsWith(\"$\")),\n ) as ConfigTokens;\n\n Object.assign(tokens, {\n \"#surface\": colorStates(theme.colors.surface),\n \"#surface-2\": colorStates(theme.colors.surface2),\n \"#surface-3\": colorStates(theme.colors.surface3),\n \"#surface-2-hover\": mix(\"#text\", 3, \"#surface-2\"),\n \"#surface-2-pressed\": mix(\"#text\", 9, \"#surface-2\"),\n \"#surface-3-hover\": mix(\"#text\", 3, \"#surface-3\"),\n \"#surface-3-pressed\": mix(\"#text\", 9, \"#surface-3\"),\n \"#text\": colorStates(theme.colors.text),\n \"#text-soft\": colorStates(theme.colors.textSoft),\n \"#border\": mix(\"#text\", 18, \"#surface\"),\n \"#border-strong\": mix(\"#text\", 34, \"#surface\"),\n \"#accent-text\": colorStates(theme.colors.accentText),\n \"#accent-surface\": colorStates(theme.colors.accentSurface),\n \"#accent-surface-text\": colorStates(theme.colors.accentSurfaceText),\n \"#focus\": colorStates(theme.colors.focus),\n \"#shadow\": colorStates(theme.colors.shadow),\n \"#overlay\": mix(\"#text\", 58, \"transparent\"),\n } satisfies ConfigTokens);\n\n return tokens;\n}\n\nfunction colorStates(colors: Record<string, string>) {\n return {\n \"\": colors.dark,\n [LIGHT]: colors.light,\n [HIGH_CONTRAST]: colors.darkContrast,\n [`(${LIGHT}) & (${HIGH_CONTRAST})`]: colors.lightContrast,\n };\n}\n\nfunction mix(foreground: string, percentage: number, background: string) {\n return `color-mix(in oklab, ${foreground} ${percentage}%, ${background})`;\n}\n","import { mergeStyles, type Styles } from \"@tenphi/tasty/core\";\nimport {\n COOKBOOK_COMPONENT_NAMES,\n type ComponentStyleConfig,\n type ComponentStylesConfig,\n type CookbookComponentName,\n} from \"@tenphi/docs\";\n\n// Astro can load the integration and renderer through separate module graphs.\n// Keep their component configuration on the shared process global.\nconst sharedConfiguration = globalThis as typeof globalThis & {\n __tenphiCookbookComponentStyles?: ComponentStylesConfig;\n};\nconst cookbookComponentNames = new Set<string>(COOKBOOK_COMPONENT_NAMES);\n\nexport function configureComponentStyles(\n styles: ComponentStylesConfig | undefined,\n): void {\n sharedConfiguration.__tenphiCookbookComponentStyles = styles ?? {};\n}\n\nexport function resolveComponentStyles(\n name: CookbookComponentName,\n defaults: Styles,\n): Styles {\n const configured = sharedConfiguration.__tenphiCookbookComponentStyles?.[\n name\n ] as ComponentStyleConfig | undefined;\n if (!configured) return defaults;\n if (isModeConfig(configured)) {\n const styles = configured.styles as Styles;\n return configured.mode === \"replace\"\n ? styles\n : mergeStyles(defaults, styles);\n }\n return mergeStyles(defaults, configured as Styles);\n}\n\nexport function resolveComponentStyleOverride(\n name: CookbookComponentName,\n): { mode: \"extend\" | \"replace\"; styles: Styles } | undefined {\n const configured = sharedConfiguration.__tenphiCookbookComponentStyles?.[\n name\n ] as ComponentStyleConfig | undefined;\n if (!configured) return undefined;\n if (isModeConfig(configured)) {\n return { mode: configured.mode, styles: configured.styles as Styles };\n }\n return { mode: \"extend\", styles: configured as Styles };\n}\n\n/** Preserve custom anatomy names from the pre-component style API. */\nexport function resolveLegacyAnatomyStyles(\n styles: ComponentStylesConfig | undefined,\n): Record<string, Styles> | undefined {\n if (!styles) return undefined;\n const entries = Object.entries(styles)\n .filter(\n (entry): entry is [string, ComponentStyleConfig] =>\n !cookbookComponentNames.has(entry[0]) && entry[1] !== undefined,\n )\n .map(([name, value]) => [\n `[data-tasty-anatomy=\"${name}\"]`,\n isModeConfig(value) ? value.styles : value,\n ]);\n return entries.length\n ? (Object.fromEntries(entries) as Record<string, Styles>)\n : undefined;\n}\n\nfunction isModeConfig(\n value: ComponentStyleConfig,\n): value is Extract<ComponentStyleConfig, { mode: string }> {\n return (\n \"mode\" in value &&\n (value.mode === \"extend\" || value.mode === \"replace\") &&\n \"styles\" in value\n );\n}\n","import { configure } from \"@tenphi/tasty\";\n\nexport const cookbookStates = {\n \"@mobile\": \"@media(w < 50rem)\",\n \"@desktop\": \"@media(w >= 50rem)\",\n \"@small\": \"@media(w <= 40rem)\",\n \"@shell-mobile\": \"@media(w <= 48rem)\",\n \"@shell-desktop\": \"@media(w > 48rem)\",\n \"@narrow-layout\": \"@media(w < 72rem)\",\n \"@medium-layout\": \"@media(w >= 50rem) & @media(w < 72rem)\",\n \"@reduced-motion\": \"@media(prefers-reduced-motion: reduce)\",\n};\n\nlet configured = false;\n\n/** Configure aliases in the renderer's Tasty module before styles are parsed. */\nexport function configureCookbookStates() {\n if (configured) return;\n configure({ states: cookbookStates });\n configured = true;\n}\n","import { existsSync } from \"node:fs\";\nimport { cp, mkdir, readFile } from \"node:fs/promises\";\nimport { createRequire } from \"node:module\";\nimport { dirname, extname, join } from \"node:path\";\nimport { fileURLToPath, pathToFileURL } from \"node:url\";\nimport starlight from \"./starlight-runtime.js\";\nimport {\n createDocsGraph,\n assertValidDocs,\n type DocsConfig,\n type NavigationItem,\n} from \"@tenphi/docs\";\nimport {\n configure,\n type ConfigTokens,\n type Styles,\n type TypographyPreset,\n} from \"@tenphi/tasty/core\";\nimport { tastyIntegration } from \"@tenphi/tasty/ssr/astro\";\nimport type { AstroIntegration, HookParameters } from \"astro\";\nimport {\n resolveNavigationLayout,\n type ResolvedNavigationLayout,\n} from \"./navigation.js\";\nimport { resolveDocsTheme } from \"./theme/index.js\";\nimport { TASTY_UNITS, tastyTokens } from \"./theme/tasty-config.js\";\nimport {\n configureComponentStyles,\n resolveLegacyAnatomyStyles,\n} from \"./components/component-styles.js\";\nimport { cookbookStates } from \"./components/tasty-states.js\";\n\nconst packageRequire = createRequire(import.meta.url);\nconst starlightRoot = dirname(packageRequire.resolve(\"@astrojs/starlight\"));\nconst tastyStaticMiddleware = packageRequire.resolve(\n \"@tenphi/tasty/ssr/astro-middleware-static\",\n);\nconst tastyExtractStaticMiddleware = packageRequire.resolve(\n \"@tenphi/tasty/ssr/astro-middleware-extract-static\",\n);\nconst astroReactServer = packageRequire.resolve(\"@astrojs/react/server.js\");\nconst astroReactClient = packageRequire.resolve(\"@astrojs/react/client.js\");\nconst astroReactIntegration = packageRequire.resolve(\"@astrojs/react\");\nconst importNative = new Function(\"specifier\", \"return import(specifier)\") as (\n specifier: string,\n) => Promise<{ default: () => AstroIntegration }>;\n\nexport interface CookbookOptions {\n config?: DocsConfig;\n root?: string;\n}\n\nexport default function cookbook(\n options: CookbookOptions = {},\n): AstroIntegration {\n const docsTheme = resolveDocsTheme(options.config?.theme);\n if (\n docsTheme.diagnostics.some((diagnostic) => diagnostic.severity === \"error\")\n ) {\n throw new Error(\n docsTheme.diagnostics.map((diagnostic) => diagnostic.message).join(\"\\n\"),\n );\n }\n configureTastyTheme(options.config?.theme, docsTheme);\n configureComponentStyles(options.config?.theme?.styles);\n const searchClientPath = fileURLToPath(\n new URL(\"./client/search.js\", import.meta.url),\n );\n const appearanceClientPath = fileURLToPath(\n new URL(\"./client/appearance.js\", import.meta.url),\n );\n const headerPath = fileURLToPath(\n new URL(\"./overrides/Header.astro\", import.meta.url),\n );\n const sidebarPath = fileURLToPath(\n new URL(\"./overrides/Sidebar.astro\", import.meta.url),\n );\n const mobileMenuFooterPath = fileURLToPath(\n new URL(\"./overrides/MobileMenuFooter.astro\", import.meta.url),\n );\n const themeSelectPath = fileURLToPath(\n new URL(\"./overrides/ThemeSelect.astro\", import.meta.url),\n );\n const components = {\n Header: headerPath,\n Sidebar: sidebarPath,\n MobileMenuFooter: mobileMenuFooterPath,\n ThemeSelect: themeSelectPath,\n ...options.config?.components?.overrides,\n };\n const navigation = resolveNavigationLayout(options.config?.navigation);\n // Tasty 3.6's integration shape is structurally compatible with Astro 7;\n // its published helper type still models `site` as URL-only.\n const tasty = tastyIntegration({\n islands: false,\n css: { mode: \"extract\" },\n }) as unknown as AstroIntegration;\n const starlightIntegration = starlight({\n title: options.config?.site?.title ?? \"Documentation\",\n ...(options.config?.site?.description\n ? { description: options.config.site.description }\n : {}),\n ...(options.config?.search?.enabled === false ? { pagefind: false } : {}),\n components,\n sidebar: starlightSidebar(navigation),\n });\n let inner: AstroIntegration[] = [tasty, starlightIntegration];\n let projectRoot = options.root;\n let graphConfig = options.config;\n let graph: Awaited<ReturnType<typeof createDocsGraph>> | undefined;\n let usingStarlight = false;\n\n async function loadGraph(refresh = false) {\n if (!graph || refresh) {\n graph = await createDocsGraph({\n ...(projectRoot ? { root: projectRoot } : {}),\n ...(graphConfig ? { config: graphConfig } : {}),\n });\n assertValidDocs(graph);\n }\n return graph;\n }\n\n return {\n name: \"cookbook\",\n hooks: {\n \"astro:config:setup\": async (context) => {\n const react = (\n await importNative(pathToFileURL(astroReactIntegration).href)\n ).default();\n inner = [react, tasty, starlightIntegration];\n if (\n context.config.integrations.some(\n (integration) => integration.name === \"@astrojs/starlight\",\n )\n ) {\n throw new Error(\n \"Cookbook already includes Starlight. Remove the direct @astrojs/starlight integration before continuing.\",\n );\n }\n projectRoot ??= fileURLToPath(context.config.root);\n const base = options.config?.build?.base ?? context.config.base;\n graphConfig = {\n ...options.config,\n build: { ...options.config?.build, base },\n };\n usingStarlight = hasContentConfig(context.config.srcDir);\n context.updateConfig({\n base,\n output: \"static\",\n vite: {\n ssr: {\n external: [\n \"@tenphi/docs\",\n \"react\",\n \"react-dom\",\n \"react-dom/server\",\n ],\n },\n plugins: [\n virtualDocsPlugin(async () => {\n const loaded = await loadGraph();\n return {\n entries: loaded.entries,\n routes: loaded.routes,\n site: documentedSite(loaded),\n base: loaded.config.build.base,\n search: loaded.config.search.enabled,\n };\n }, navigation),\n ],\n resolve: {\n alias: [\n {\n find: \"@astrojs/starlight\",\n replacement: starlightRoot,\n },\n {\n find: \"@tenphi/tasty/ssr/astro-middleware-static\",\n replacement: tastyStaticMiddleware,\n },\n {\n find: \"@tenphi/tasty/ssr/astro-middleware-extract-static\",\n replacement: tastyExtractStaticMiddleware,\n },\n {\n find: \"@astrojs/react/server.js\",\n replacement: astroReactServer,\n },\n {\n find: \"@astrojs/react/client.js\",\n replacement: astroReactClient,\n },\n ],\n },\n },\n });\n await callInner(inner.slice(0, 2), \"astro:config:setup\", context);\n\n if (!usingStarlight) {\n graph = await createDocsGraph({\n root: projectRoot,\n config: graphConfig,\n });\n assertValidDocs(graph);\n if (graph.config.search.enabled) {\n context.injectScript(\n \"page\",\n `import ${JSON.stringify(searchClientPath)};`,\n );\n }\n context.injectScript(\n \"page\",\n `import ${JSON.stringify(appearanceClientPath)};`,\n );\n context.injectRoute({\n pattern: \"[...route]\",\n entrypoint: new URL(\"./routes/DocsPage.astro\", import.meta.url),\n prerender: true,\n });\n return;\n }\n\n // Starlight inserts its own follow-up integrations immediately after\n // itself. Give it a temporary real position so Astro processes those\n // once, after this composite integration, rather than re-visiting us.\n const starlightWithPlugins = inner[2];\n if (starlightWithPlugins) {\n const selfIndex = context.config.integrations.findIndex(\n (integration) => integration.name === \"cookbook\",\n );\n context.config.integrations.splice(\n selfIndex + 1,\n 0,\n starlightWithPlugins,\n );\n try {\n await callInner(\n [starlightWithPlugins],\n \"astro:config:setup\",\n context,\n );\n } finally {\n const placeholderIndex =\n context.config.integrations.indexOf(starlightWithPlugins);\n if (placeholderIndex >= 0)\n context.config.integrations.splice(placeholderIndex, 1);\n }\n }\n },\n \"astro:config:done\": async (context) => {\n await callInner(\n usingStarlight ? inner : inner.slice(0, 2),\n \"astro:config:done\",\n context,\n );\n },\n \"astro:server:setup\": async ({ server }) => {\n let assets = docsAssetMap(await loadGraph());\n server.middlewares.use(async (request, response, next) => {\n if (request.method !== \"GET\" && request.method !== \"HEAD\") {\n next();\n return;\n }\n const pathname = requestPath(request.url);\n if (!pathname.includes(\"/_tasty-assets/\")) {\n next();\n return;\n }\n let asset = assets.get(pathname);\n if (!asset) {\n try {\n assets = docsAssetMap(await loadGraph(true));\n } catch {\n next();\n return;\n }\n asset = assets.get(pathname);\n }\n if (!asset?.sourcePath) {\n next();\n return;\n }\n try {\n const body = await readFile(asset.sourcePath);\n response.statusCode = 200;\n response.setHeader(\"Content-Type\", assetContentType(pathname));\n response.setHeader(\"Content-Length\", body.byteLength);\n response.setHeader(\"Cache-Control\", \"no-cache\");\n response.end(request.method === \"HEAD\" ? undefined : body);\n } catch {\n next();\n }\n });\n },\n \"astro:build:start\": async (context) => {\n await loadGraph();\n await callInner(\n usingStarlight ? inner : inner.slice(0, 2),\n \"astro:build:start\",\n context,\n );\n },\n \"astro:build:done\": async (context) => {\n await callInner(\n usingStarlight ? inner : inner.slice(0, 2),\n \"astro:build:done\",\n context,\n );\n if (!graph) return;\n const output = fileURLToPath(context.dir);\n for (const asset of graph.assets) {\n if (!asset.sourcePath || !asset.publicPath) continue;\n const target = join(output, asset.publicPath.replace(/^\\//, \"\"));\n await mkdir(dirname(target), { recursive: true });\n await cp(asset.sourcePath, target);\n }\n if (!usingStarlight && graph.config.search.enabled) {\n const { close, createIndex } = await import(\"pagefind\");\n const created = await createIndex({\n rootSelector: \"[data-pagefind-body]\",\n });\n if (!created.index || created.errors.length > 0) {\n throw new Error(\n `Pagefind failed to start: ${created.errors.join(\"; \")}`,\n );\n }\n const indexed = await created.index.addDirectory({ path: output });\n if (indexed.errors.length > 0) {\n throw new Error(\n `Pagefind failed to index the site: ${indexed.errors.join(\"; \")}`,\n );\n }\n const written = await created.index.writeFiles({\n outputPath: join(output, \"pagefind\"),\n });\n await close();\n if (written.errors.length > 0) {\n throw new Error(\n `Pagefind failed to write the index: ${written.errors.join(\"; \")}`,\n );\n }\n }\n },\n },\n };\n}\n\nfunction docsAssetMap(graph: Awaited<ReturnType<typeof createDocsGraph>>) {\n return new Map(\n graph.assets.flatMap((asset) =>\n asset.publicPath && asset.sourcePath\n ? [[asset.publicPath, asset] as const]\n : [],\n ),\n );\n}\n\nfunction documentedSite(\n graph: Awaited<ReturnType<typeof createDocsGraph>>,\n): Awaited<ReturnType<typeof createDocsGraph>>[\"config\"][\"site\"] {\n if (graph.config.site.version) return graph.config.site;\n const packages = new Set(\n graph.entries.flatMap((entry) =>\n entry.package?.resolved ? [entry.package.resolved] : [],\n ),\n );\n if (packages.size !== 1) return graph.config.site;\n const resolved = packages.values().next().value;\n if (!resolved) return graph.config.site;\n const separator = resolved.lastIndexOf(\"@\");\n if (separator <= 0 || separator === resolved.length - 1)\n return graph.config.site;\n return { ...graph.config.site, version: resolved.slice(separator + 1) };\n}\n\nfunction requestPath(url: string | undefined): string {\n try {\n return decodeURIComponent(new URL(url ?? \"/\", \"http://localhost\").pathname);\n } catch {\n return \"\";\n }\n}\n\nfunction assetContentType(pathname: string): string {\n switch (extname(pathname).toLowerCase()) {\n case \".avif\":\n return \"image/avif\";\n case \".gif\":\n return \"image/gif\";\n case \".jpeg\":\n case \".jpg\":\n return \"image/jpeg\";\n case \".png\":\n return \"image/png\";\n case \".svg\":\n return \"image/svg+xml\";\n case \".webp\":\n return \"image/webp\";\n default:\n return \"application/octet-stream\";\n }\n}\n\nfunction configureTastyTheme(\n theme: DocsConfig[\"theme\"],\n resolved: ReturnType<typeof resolveDocsTheme>,\n): void {\n const tokens = tastyTokens(resolved) as ConfigTokens;\n const globalStyles = resolveLegacyAnatomyStyles(theme?.styles);\n\n configure({\n states: {\n ...cookbookStates,\n ...theme?.states,\n },\n units: TASTY_UNITS,\n tokens,\n presets: resolved.presets as Record<string, TypographyPreset>,\n ...(globalStyles\n ? { globalStyles: globalStyles as Record<string, Styles> }\n : {}),\n });\n}\n\nfunction starlightSidebar(layout: ResolvedNavigationLayout): unknown[] {\n const fallback = layout.items?.length\n ? layout.items.map(starlightSidebarItem)\n : [{ autogenerate: { directory: \"\" } }];\n if (!layout.sectioned) return fallback;\n\n return [\n ...(layout.fallbackSidebarGroup !== undefined\n ? [\n {\n label: \"Documentation\",\n items: (layout.items ?? []).map(starlightSidebarItem),\n },\n ]\n : []),\n ...layout.tabs.flatMap((tab) =>\n tab.items !== undefined\n ? [{ label: tab.label, items: tab.items.map(starlightSidebarItem) }]\n : [],\n ),\n ];\n}\n\nfunction starlightSidebarItem(item: NavigationItem): unknown {\n if (typeof item === \"string\") return { slug: routeToSlug(item) };\n if (\"items\" in item) {\n return {\n label: item.label,\n items: item.items.map(starlightSidebarItem),\n };\n }\n if (\"autogenerate\" in item) {\n return {\n label: item.label,\n items: [\n {\n autogenerate: {\n directory: routeToSlug(item.autogenerate.directory, false),\n },\n },\n ],\n };\n }\n return { label: item.label, link: item.link };\n}\n\nfunction routeToSlug(route: string, rootAsIndex = true): string {\n const slug = route.replace(/^\\/+|\\/+$/g, \"\");\n return slug || (rootAsIndex ? \"index\" : \"\");\n}\n\nexport function tastyStarlight(\n config: Parameters<typeof starlight>[0],\n): AstroIntegration {\n return starlight(config);\n}\n\nasync function callInner<K extends keyof AstroIntegration[\"hooks\"]>(\n integrations: AstroIntegration[],\n hook: K,\n context: HookParameters<K>,\n): Promise<void> {\n for (const integration of integrations) {\n const handler = integration.hooks[hook];\n if (typeof handler === \"function\") {\n await (handler as (value: HookParameters<K>) => void | Promise<void>)(\n context,\n );\n }\n }\n}\n\nfunction virtualDocsPlugin(\n getContent: () => unknown | Promise<unknown>,\n layout: ResolvedNavigationLayout,\n) {\n const configId = \"\\0virtual:cookbook/config\";\n const layoutId = \"\\0virtual:cookbook/layout\";\n return {\n name: \"cookbook-data\",\n resolveId(id: string) {\n if (id === \"virtual:cookbook/config\") return configId;\n if (id === \"virtual:cookbook/layout\") return layoutId;\n return undefined;\n },\n async load(id: string) {\n if (id === configId) {\n return `export const content = ${JSON.stringify(await getContent())};`;\n }\n if (id === layoutId) {\n return `export const layout = ${JSON.stringify(layout)};`;\n }\n return undefined;\n },\n };\n}\n\nfunction hasContentConfig(srcDir: URL): boolean {\n const source = fileURLToPath(srcDir);\n return [\n \"content.config.ts\",\n \"content.config.mts\",\n \"content.config.js\",\n \"content.config.mjs\",\n \"content/config.ts\",\n ].some((path) => existsSync(join(source, path)));\n}\n"],"mappings":";;;;;;;;;;;;;AAMA,MAAa,uBAAuB;CAClC,MAAM;CACN,SAAS;CACT,gBAAgB;CAChB,iBAAiB;CACjB,kBAAkB;CAClB,mBAAmB;CACnB,iBAAiB;CACjB,kBAAkB;CAClB,kBAAkB;CAClB,mBAAmB;AACrB;AAEA,MAAM,YACJ;AAIF,MAAa,6BAA+D;CAC1E,MAAM;EACJ,YAAY;EACZ,UAAU;EACV,YAAY;EACZ,eAAe;EACf,YAAY;EACZ,gBAAgB;CAClB;CACA,SAAS;EACP,YAAY;EACZ,UAAU;EACV,YAAY;EACZ,eAAe;EACf,YAAY;EACZ,gBAAgB;CAClB;CACA,IAAI,QAAQ,+BAA+B,MAAM,UAAU;CAC3D,IAAI,QAAQ,iCAAiC,KAAK,UAAU;CAC5D,IAAI,QAAQ,UAAU,MAAM,UAAU;CACtC,IAAI,QAAQ,WAAW,KAAK,UAAU;CACtC,IAAI,QAAQ,YAAY,MAAM,UAAU;CACxC,IAAI,QAAQ,QAAQ,KAAK,UAAU;CACnC,YAAY;EACV,YAAY;EACZ,UAAU;EACV,YAAY;EACZ,eAAe;EACf,YAAY;EACZ,gBAAgB;CAClB;CACA,OAAO;EACL,YAAY;EACZ,UAAU;EACV,YAAY;EACZ,eAAe;EACf,YAAY;EACZ,gBAAgB;CAClB;CACA,MAAM;EACJ,YAAY;EACZ,UAAU;EACV,YAAY;EACZ,eAAe;EACf,YAAY;EACZ,gBAAgB;CAClB;AACF;AAEA,SAAgB,mBAAmB,SAAsB,CAAC,GAAgB;CACxE,OAAO;EAAE,GAAG;EAAsB,GAAG;CAAO;AAC9C;AAEA,SAAgB,yBACd,UAA6B,CAAC,GACI;CAClC,MAAM,OAAO,2BAA2B;CACxC,IAAI,CAAC,MAAM,MAAM,IAAI,MAAM,yCAAyC;CACpE,MAAM,wBAAQ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E;CAC/D,IAAI,WAAW,MACb,OAAO;EACL,OAAO,KAAK;EACZ,OAAO,KAAK,MAAM,IAAI,oBAAoB;CAC5C;CAEF,IAAI,kBAAkB,MACpB,OAAO;EACL,OAAO,KAAK;EACZ,OAAO,CACL,EACE,cAAc,EACZ,WAAW,YAAY,KAAK,aAAa,WAAW,KAAK,EAC3D,EACF,CACF;CACF;CAEF,OAAO;EAAE,OAAO,KAAK;EAAO,MAAM,KAAK;CAAK;AAC9C;AAEA,SAAS,YAAY,OAAe,cAAc,MAAc;CAE9D,OADa,MAAM,QAAQ,cAAc,EAC/B,MAAM,cAAc,UAAU;AAC1C;AAEA,SAAgB,eACd,QACkB;CAClB,OAAO,UAAU,MAAM;AACzB;AAEA,eAAe,UACb,cACA,MACA,SACe;CACf,KAAK,MAAM,eAAe,cAAc;EACtC,MAAM,UAAU,YAAY,MAAM;EAClC,IAAI,OAAO,YAAY,YACrB,MAAO,QACL,OACF;CAEJ;AACF;AAEA,SAAS,kBACP,YACA,QACA;CACA,MAAM,WAAW;CACjB,MAAM,WAAW;CACjB,OAAO;EACL,MAAM;EACN,UAAU,IAAY;GACpB,IAAI,OAAO,2BAA2B,OAAO;GAC7C,IAAI,OAAO,2BAA2B,OAAO;EAE/C;EACA,MAAM,KAAK,IAAY;GACrB,IAAI,OAAO,UACT,OAAO,0BAA0B,KAAK,UAAU,MAAM,WAAW,CAAC,EAAE;GAEtE,IAAI,OAAO,UACT,OAAO,yBAAyB,KAAK,UAAU,MAAM,EAAE;EAG3D;CACF;AACF;AAEA,SAAS,iBAAiB,QAAsB;CAC9C,MAAM,SAAS,cAAc,MAAM;CACnC,OAAO;EACL;EACA;EACA;EACA;EACA;CACF,CAAC,CAAC,MAAM,SAAS,WAAW,KAAK,QAAQ,IAAI,CAAC,CAAC;AACjD"}
@@ -5,8 +5,17 @@ import Search from "virtual:starlight/components/Search";
5
5
  import SiteTitle from "virtual:starlight/components/SiteTitle";
6
6
  import SocialIcons from "virtual:starlight/components/SocialIcons";
7
7
  import ThemeSelect from "virtual:starlight/components/ThemeSelect";
8
+ import { content } from "virtual:cookbook/config";
8
9
  import { layout } from "virtual:cookbook/layout";
9
10
  import { activeNavigationTab, navigationPath } from "../navigation.js";
11
+ import GlobalStyles from "../components/GlobalStyles.js";
12
+ import PackageVersion from "../components/PackageVersion.astro";
13
+ import {
14
+ StarlightHeaderRoot,
15
+ TopNavigationRoot,
16
+ } from "../components/LayoutComponents.js";
17
+ import "@fontsource-variable/onest/wght.css";
18
+ import "@fontsource-variable/jetbrains-mono/wght.css";
10
19
 
11
20
  const shouldRenderSearch =
12
21
  config.pagefind ||
@@ -20,12 +29,22 @@ function tabHref(link: string): string {
20
29
  }
21
30
  ---
22
31
 
23
- <div class:list={["td-header", { "td-header--with-tabs": layout.tabs.length }]}>
32
+ <GlobalStyles />
33
+ <StarlightHeaderRoot
34
+ className={`td-header${layout.tabs.length ? " td-header--with-tabs" : ""}`}
35
+ data-tasty-anatomy="StarlightHeader"
36
+ >
24
37
  <div class="td-header__primary">
25
- <div class="td-header__title"><SiteTitle /></div>
38
+ <div class="td-header__title">
39
+ <SiteTitle />
40
+ <PackageVersion version={content.site.version} />
41
+ </div>
26
42
  <div class="td-header__search print:hidden">
27
43
  {shouldRenderSearch && <Search />}
28
44
  </div>
45
+ <div class="td-header__mobile-theme md:sl-hidden print:hidden">
46
+ <ThemeSelect />
47
+ </div>
29
48
  <div class="td-header__tools sl-hidden md:sl-flex print:hidden">
30
49
  <div class="td-header__social"><SocialIcons /></div>
31
50
  <ThemeSelect />
@@ -34,7 +53,11 @@ function tabHref(link: string): string {
34
53
  </div>
35
54
  {
36
55
  layout.tabs.length > 0 && (
37
- <nav class="td-top-tabs print:hidden" aria-label="Primary">
56
+ <TopNavigationRoot
57
+ className="td-top-tabs print:hidden"
58
+ aria-label="Primary"
59
+ data-tasty-anatomy="TopNavigation"
60
+ >
38
61
  {layout.tabs.map((tab, index) => (
39
62
  <a
40
63
  href={tabHref(tab.link)}
@@ -43,7 +66,7 @@ function tabHref(link: string): string {
43
66
  {tab.label}
44
67
  </a>
45
68
  ))}
46
- </nav>
69
+ </TopNavigationRoot>
47
70
  )
48
71
  }
49
- </div>
72
+ </StarlightHeaderRoot>
@@ -0,0 +1,15 @@
1
+ ---
2
+ import LanguageSelect from "virtual:starlight/components/LanguageSelect";
3
+ import SocialIcons from "virtual:starlight/components/SocialIcons";
4
+ import { MobileMenuFooterRoot } from "../components/LayoutComponents.js";
5
+ ---
6
+
7
+ <MobileMenuFooterRoot
8
+ className="td-mobile-preferences sl-flex"
9
+ data-tasty-anatomy="MobileMenuFooter"
10
+ >
11
+ <div class="td-mobile-preferences__social">
12
+ <SocialIcons />
13
+ </div>
14
+ <LanguageSelect />
15
+ </MobileMenuFooterRoot>
@@ -0,0 +1,69 @@
1
+ ---
2
+ import Icon from "@astrojs/starlight/user-components/Icon.astro";
3
+ import { ThemeSelectRoot } from "../components/LayoutComponents.js";
4
+ ---
5
+
6
+ <ThemeSelectRoot data-tasty-anatomy="ThemeSelect">
7
+ <label>
8
+ <span class="sr-only">{Astro.locals.t("themeSelect.accessibleLabel")}</span>
9
+ <Icon name="laptop" class="label-icon" />
10
+ <select autocomplete="off">
11
+ <option value="dark">{Astro.locals.t("themeSelect.dark")}</option>
12
+ <option value="light">{Astro.locals.t("themeSelect.light")}</option>
13
+ <option value="auto" selected>{Astro.locals.t("themeSelect.auto")}</option
14
+ >
15
+ </select>
16
+ </label>
17
+ </ThemeSelectRoot>
18
+
19
+ <script is:inline>
20
+ StarlightThemeProvider.updatePickers();
21
+ </script>
22
+
23
+ <script>
24
+ type Theme = "auto" | "dark" | "light";
25
+
26
+ const storageKey = "starlight-theme";
27
+ const parseTheme = (theme: unknown): Theme =>
28
+ theme === "auto" || theme === "dark" || theme === "light" ? theme : "auto";
29
+ const loadTheme = (): Theme =>
30
+ parseTheme(
31
+ typeof localStorage !== "undefined" && localStorage.getItem(storageKey),
32
+ );
33
+ const storeTheme = (theme: Theme): void => {
34
+ if (typeof localStorage !== "undefined") {
35
+ localStorage.setItem(
36
+ storageKey,
37
+ theme === "light" || theme === "dark" ? theme : "",
38
+ );
39
+ }
40
+ };
41
+ const preferredScheme = (): Theme =>
42
+ matchMedia("(prefers-color-scheme: light)").matches ? "light" : "dark";
43
+ const updateTheme = (theme: Theme): void => {
44
+ StarlightThemeProvider.updatePickers(theme);
45
+ document.documentElement.dataset.theme =
46
+ theme === "auto" ? preferredScheme() : theme;
47
+ storeTheme(theme);
48
+ };
49
+
50
+ matchMedia("(prefers-color-scheme: light)").addEventListener("change", () => {
51
+ if (loadTheme() === "auto") updateTheme("auto");
52
+ });
53
+
54
+ class CookbookThemeSelect extends HTMLElement {
55
+ constructor() {
56
+ super();
57
+ updateTheme(loadTheme());
58
+ this.querySelector("select")?.addEventListener("change", (event) => {
59
+ if (event.currentTarget instanceof HTMLSelectElement) {
60
+ updateTheme(parseTheme(event.currentTarget.value));
61
+ }
62
+ });
63
+ }
64
+ }
65
+
66
+ if (!customElements.get("starlight-theme-select")) {
67
+ customElements.define("starlight-theme-select", CookbookThemeSelect);
68
+ }
69
+ </script>
@@ -4,9 +4,23 @@ import { content } from "virtual:cookbook/config";
4
4
  import { layout } from "virtual:cookbook/layout";
5
5
  import MobileNavigationTabs from "../components/MobileNavigationTabs.astro";
6
6
  import NavigationTree from "../components/NavigationTree.astro";
7
+ import GlobalStyles from "../components/GlobalStyles.js";
8
+ import PackageVersion from "../components/PackageVersion.astro";
9
+ import {
10
+ AppearanceControlRoot,
11
+ DocsArticleRoot,
12
+ DocsLayoutRoot,
13
+ DocsSidebarRoot,
14
+ SearchDialogRoot,
15
+ SearchTriggerRoot,
16
+ SkipLinkRoot,
17
+ StandaloneHeaderRoot,
18
+ TopNavigationRoot,
19
+ VisuallyHiddenRoot,
20
+ } from "../components/LayoutComponents.js";
7
21
  import { activeNavigationTab, navigationItemsForPath } from "../navigation.js";
8
- import "virtual:cookbook/theme.css";
9
- import "../styles.css";
22
+ import "@fontsource-variable/onest/wght.css";
23
+ import "@fontsource-variable/jetbrains-mono/wght.css";
10
24
 
11
25
  export const prerender = true;
12
26
 
@@ -49,41 +63,57 @@ const navigationItems =
49
63
  }
50
64
  </head>
51
65
  <body class="td-shell">
52
- <a class="td-skip" href="#main-content">Skip to content</a>
53
- <header
54
- class="td-shell__header"
66
+ <GlobalStyles />
67
+ <SkipLinkRoot
68
+ className="td-skip"
69
+ href="#main-content"
70
+ data-tasty-anatomy="SkipLink"
71
+ >
72
+ Skip to content
73
+ </SkipLinkRoot>
74
+ <StandaloneHeaderRoot
75
+ className="td-shell__header"
55
76
  data-tasty-anatomy="Header"
56
77
  data-docs-base={base}
57
78
  >
58
79
  <div class="td-shell__header-primary">
59
- <a href={withBase("/")}>{site.title ?? "Documentation"}</a>
80
+ <div class="td-shell__brand">
81
+ <a href={withBase("/")}>{site.title ?? "Documentation"}</a>
82
+ <PackageVersion version={site.version} />
83
+ </div>
60
84
  <div class="td-shell__actions">
61
- <label class="td-appearance-control" title="Color theme">
62
- <span class="td-visually-hidden">Color theme</span>
85
+ <AppearanceControlRoot
86
+ className="td-appearance-control"
87
+ title="Color theme"
88
+ data-tasty-anatomy="AppearanceControl"
89
+ >
90
+ <VisuallyHiddenRoot>Color theme</VisuallyHiddenRoot>
63
91
  <select data-docs-theme aria-label="Color theme">
64
92
  <option value="system">System theme</option>
65
93
  <option value="light">Light theme</option>
66
94
  <option value="dark">Dark theme</option>
67
95
  </select>
68
- </label>
69
- <label
70
- class="td-appearance-control td-appearance-control--contrast"
96
+ </AppearanceControlRoot>
97
+ <AppearanceControlRoot
98
+ className="td-appearance-control td-appearance-control--contrast"
71
99
  title="Contrast"
100
+ data-tasty-anatomy="AppearanceControl"
72
101
  >
73
- <span class="td-visually-hidden">Contrast</span>
102
+ <VisuallyHiddenRoot>Contrast</VisuallyHiddenRoot>
74
103
  <select data-docs-contrast aria-label="Contrast">
75
104
  <option value="system">System contrast</option>
76
105
  <option value="normal">Normal contrast</option>
77
106
  <option value="more">High contrast</option>
78
107
  </select>
79
- </label>
108
+ </AppearanceControlRoot>
80
109
  {
81
110
  search && (
82
- <button
111
+ <SearchTriggerRoot
83
112
  type="button"
84
113
  data-docs-search-open
85
114
  aria-haspopup="dialog"
86
115
  aria-keyshortcuts="Control+K"
116
+ data-tasty-anatomy="SearchTrigger"
87
117
  >
88
118
  <span>Search</span>
89
119
  <kbd data-docs-search-shortcut>
@@ -92,14 +122,18 @@ const navigationItems =
92
122
  <kbd>K</kbd>
93
123
  </>
94
124
  </kbd>
95
- </button>
125
+ </SearchTriggerRoot>
96
126
  )
97
127
  }
98
128
  </div>
99
129
  </div>
100
130
  {
101
131
  layout.tabs.length > 0 && (
102
- <nav class="td-top-tabs" aria-label="Primary">
132
+ <TopNavigationRoot
133
+ className="td-top-tabs"
134
+ aria-label="Primary"
135
+ data-tasty-anatomy="TopNavigation"
136
+ >
103
137
  {layout.tabs.map((tab, index) => (
104
138
  <a
105
139
  href={tab.link.startsWith("/") ? withBase(tab.link) : tab.link}
@@ -108,15 +142,18 @@ const navigationItems =
108
142
  {tab.label}
109
143
  </a>
110
144
  ))}
111
- </nav>
145
+ </TopNavigationRoot>
112
146
  )
113
147
  }
114
- </header>
115
- <div class="td-shell__layout">
116
- <nav
117
- class="td-shell__nav"
148
+ </StandaloneHeaderRoot>
149
+ <DocsLayoutRoot
150
+ className="td-shell__layout"
151
+ data-tasty-anatomy="DocsLayout"
152
+ >
153
+ <DocsSidebarRoot
154
+ className="td-shell__nav"
118
155
  aria-label="Documentation"
119
- data-tasty-anatomy="Sidebar"
156
+ data-tasty-anatomy="DocsSidebar"
120
157
  >
121
158
  <MobileNavigationTabs base={base} currentPath={entry.route} />
122
159
  <NavigationTree
@@ -125,20 +162,24 @@ const navigationItems =
125
162
  current={entry.route}
126
163
  base={base}
127
164
  />
128
- </nav>
129
- <main
165
+ </DocsSidebarRoot>
166
+ <DocsArticleRoot
130
167
  id="main-content"
131
- class="td-shell__main"
168
+ className="td-shell__main"
132
169
  data-pagefind-body
133
- data-tasty-anatomy="Article"
170
+ data-tasty-anatomy="DocsArticle"
134
171
  >
135
172
  <h1>{entry.title}</h1>
136
173
  <div set:html={html} />
137
- </main>
138
- </div>
174
+ </DocsArticleRoot>
175
+ </DocsLayoutRoot>
139
176
  {
140
177
  search && (
141
- <dialog data-docs-search aria-labelledby="td-search-title">
178
+ <SearchDialogRoot
179
+ data-docs-search
180
+ aria-labelledby="td-search-title"
181
+ data-tasty-anatomy="SearchDialog"
182
+ >
142
183
  <form method="dialog">
143
184
  <button aria-label="Close search">Close</button>
144
185
  </form>
@@ -149,7 +190,7 @@ const navigationItems =
149
190
  </label>
150
191
  <div data-docs-search-status aria-live="polite" />
151
192
  <ul data-docs-search-results />
152
- </dialog>
193
+ </SearchDialogRoot>
153
194
  )
154
195
  }
155
196
  </body>
package/package.json CHANGED
@@ -1,10 +1,9 @@
1
1
  {
2
2
  "name": "@tenphi/starlight",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "Astro and Starlight renderer for Cookbook",
5
5
  "type": "module",
6
6
  "sideEffects": [
7
- "./dist/styles.css",
8
7
  "./dist/client/*.js"
9
8
  ],
10
9
  "exports": {
@@ -20,10 +19,6 @@
20
19
  "types": "./dist/components-public.d.ts",
21
20
  "import": "./dist/components.js"
22
21
  },
23
- "./styles": {
24
- "types": "./dist/styles.d.ts",
25
- "default": "./dist/styles.css"
26
- },
27
22
  "./client/*": "./dist/client/*.js"
28
23
  },
29
24
  "files": [
@@ -50,14 +45,16 @@
50
45
  "license": "MIT",
51
46
  "dependencies": {
52
47
  "@astrojs/markdown-remark": "^7.2.4",
48
+ "@astrojs/react": "^5.0.3",
53
49
  "@astrojs/starlight": "^0.41.10",
54
50
  "@fontsource-variable/jetbrains-mono": "^5.3.0",
55
51
  "@fontsource-variable/onest": "^5.3.0",
56
- "@tenphi/docs": "0.4.0",
52
+ "@tenphi/docs": "0.6.0",
57
53
  "@tenphi/glaze": "2.0.0",
58
- "@tenphi/tasty": "3.4.0",
54
+ "@tenphi/tasty": "3.6.0",
59
55
  "pagefind": "^1.5.2",
60
56
  "react": "^18.3.1 || ^19.0.0",
57
+ "react-dom": "^18.3.1 || ^19.0.0",
61
58
  "tsx": "^4.20.6"
62
59
  },
63
60
  "peerDependencies": {