import type { DocSystemTheme } from '../doc-system-styles.js'; import type { Doc } from './docs.js'; import type { ProjectLinks, LinkItem } from '../../doc-browser.js'; import { type AccessibilityMode, type ExampleBakes } from '../render.js'; declare global { var Bun: any; } export interface GenerateSiteConfig { docs: Doc[]; /** whether the site serves `/llms.txt`, which the 404 page then points to */ llmsTxt?: boolean; /** `SiteConfig.aliases`: { alias path -> slug } (board #3513) */ aliases?: Record; /** `SiteConfig.themeFile`, for the settings menu's theme editor */ themeFile?: string; /** `SiteConfig.themePresets`: the settings menu offers the Style submenu */ themePresets?: boolean; /** `SiteConfig.theme`: the theme editor's starting base colours */ theme?: DocSystemTheme; /** web fonts the saved theme (`themeFile`) uses; each must pass `allowedFontUrl` */ themeFonts?: string[]; /** `SiteConfig.searchPlaceholder` */ searchPlaceholder?: string; /** `SiteConfig.accessibility` (#3521) */ accessibility?: AccessibilityMode; /** * Mirrors `SiteConfig.liveExamples`. The static highlighter needs it so it skips the * fences that will become live examples — a highlighted block hands the example markup * where it expected source. See `doc-system/example-policy.ts`. */ liveExamples?: 'auto' | 'opt-in' | 'no-code'; /** directory to write pages into (the served web root, e.g. ./docs) */ outputDir: string; /** `SiteConfig.strict`: a build warning raised here fails the build */ strict?: boolean; projectName?: string; /** * URL of the volume manifest (`/epub-volumes.json`). Print reads the default volume's * cover from it; omitted when the site has no ePub or opted out with `printCover: false`. */ bookVolumes?: string; /** * The ePubs this build makes (`listEpubVolumes`), for the "Download ePub" menu entry. * `[]` says the site makes none, which removes the entry; leave it unset only if you do * not know (the entry then links to the name derived from `projectName`, as it used to). */ ebooks?: Array<{ title: string; url: string; }>; /** site-level description, used as a fallback when a doc has none */ description?: string; /** , default 'en' */ lang?: string; /** favicon href, default /favicon.svg */ favicon?: string; /** default og:image (per-page overridable via doc metadata) */ ogImage?: string; /** * What the site is, for its structured data (#3565). `'documentation'` (default): pages are * `TechArticle`s. `'book'`: pages are `Chapter`s of a `Book`, and link the previous and next * page in reading order. */ kind?: 'documentation' | 'book'; /** the default author, for structured data; a page's own `author` wins */ author?: string; /** when each page's source last changed (ISO), keyed by `Doc.path`: see page-dates.ts */ modified?: Map; projectLinks?: ProjectLinks; /** brand mark left of the title: icon name, image URL, or inline */ logo?: string; /** header-bar links (rendered as real for no-JS, upgraded on hydration) */ navbarLinks?: LinkItem[]; /** translation table (TSV) for the settings menu's language picker */ localizedStrings?: string; /** URL the localization table is written to / loaded from (default /localized-strings.txt) */ localizedUrl?: string; /** absolute site origin for canonical/og URLs, e.g. https://ui.tosijs.net */ baseUrl?: string; /** * URL prefix the site is served under, default '/'. Set to '/' for a * GitHub project page without a custom domain; every root-relative URL the * generator emits is rewritten under it. */ basePath?: string; /** URL the component fetches the corpus from (default /docs.json) */ docsUrl?: string; /** path to the IIFE bundle script (default /iife.js) — the CDN/classic-script path */ scriptUrl?: string; /** * Cache-busting stamp appended as `?v=` to the CLASSIC assets: the IIFE ` (favicon, analytics, etc.) */ headExtra?: string; } /** * A section's disclosure toggle. A real button BESIDE the link, not a `` around it: * a link inside a summary is a control inside a control, which a screen reader announces as * one and loses the other (axe `nested-interactive`, #3520). Named by the section title, so * it reads "Components, expanded, button". The hydrated nav builds the same markup. */ export declare function navToggleHtml(title: string, listId: string, open: boolean): string; /** * Prefix a root-relative path with basePath. No-op for '/', empty, protocol- * relative (`//…`), or absolute (`https://…`) URLs. * * Used ONLY for *metadata* URLs now (canonical, og:url, og:image, sitemap) — they * legitimately need the real absolute origin+path. *Functional* URLs go through * `relativeUrl` instead, so the artifact is mount-agnostic. See `relativeUrl`. */ /** * Depth of a page below the site root: 0 for the root index (served at the mount * root), 1 for every `/slug/` page. The generator only ever emits a flat `/slug/` * tree (see `pathForSlug`), so a non-root page is always exactly one directory deep. */ export declare function pageDepth(slug: string): number; /** * Rewrite a root-relative *functional* URL (asset ref, nav / content link) to be * relative to a page at `depth`, so ONE build works at ANY mount point — a GitHub * project page under `/repo`, a custom-domain root, or a moved mount — with no * `basePath` rebuild. Relative URLs resolve against wherever the page is actually * served, so `basePath` is deliberately NOT applied here: a page at `/repo/x/` * gets `../styles.css` → `/repo/styles.css`, the same page at `/x/` gets it at * `/styles.css`. External (`https://…`, `//…`) and already-relative refs pass * through untouched. (Metadata URLs still use `withBase` — they need the absolute * origin.) See issue #25; the runtime/SPA-navigation half is issue #16. */ export declare function relativeUrl(depth: number, p: string): string; /** * The header `logo` as every page can use it (#3926). A relative image path (`favicon.svg`, * `img/mark.png`, `./mark.png`) names a file at the site root, but the header is drawn on pages * at `/x/` and `/x/y/`, where the browser resolved it against the page and fetched `/x/favicon.svg`. * It is made root-absolute here, with `basePath`, once for every page: the client navigates * between pages without reloading, so a per-page relative path would go stale. Icon names, * inline SVG, root-absolute paths, `data:` and full URLs pass through. */ export declare function siteLogo(logo: string | undefined, basePath?: string): string | undefined; export declare function withStamp(url: string, stamp?: string): string; /** * Rewrite the relative `href`/`src` references in rendered page HTML, written for a page at * `fromPath` ('/' or '/slug/'), so they reach the same files from a page at `depth`. Rooted * (`/x`), external, `#`, `?` and `data:`-style references are left alone. */ export declare function rebaseRelativeRefs(html: string, fromPath: string, depth: number): string; export declare function generateSite(config: GenerateSiteConfig): Promise; export declare function notFoundHtml(homeHtml: string, slugMap: Record, config: Pick): string;