feat(docs): export database documentation as standalone HTML

This commit is contained in:
Fernando Possebon authored and GitHub committed 2026-08-08 11:04:16 +08:00
1 parent efd0c381ad
commit 63498da121
59 files changed
+4374 -237

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
import { readFileSync } from "node:fs";
const IMPORT_STATEMENT = '@import "./tokens.css";';
/**
* Reads the desktop stylesheet the way the browser assembles it: globals.css
* with its `@import "./tokens.css"` replaced, in place, by the imported file.
*
* Design tokens live in tokens.css so the standalone documentation export can
* reuse them without pulling in the app shell. Assertions about declaration
* order are assertions about the cascade, so a spec that reads only globals.css
* sees half the stylesheet and draws the wrong conclusion.
*/
export function readCascadeCss(): string {
const globals = readFileSync(new URL("../globals.css", import.meta.url), "utf8");
const tokens = readFileSync(new URL("../tokens.css", import.meta.url), "utf8");
if (!globals.includes(IMPORT_STATEMENT)) {
// Failing loudly beats returning globals.css alone: a silent half-stylesheet
// would resurface as an unrelated-looking assertion failure somewhere else.
throw new Error(`globals.css no longer pulls in tokens.css with \`${IMPORT_STATEMENT}\``);
}
return globals.replace(IMPORT_STATEMENT, tokens);
}
@@ -1,7 +1,8 @@
import { readFileSync } from "node:fs";
import { describe, expect, it } from "vitest";
import { readCascadeCss } from "./cascadeCss";
const globalsCss = readFileSync(new URL("../globals.css", import.meta.url), "utf8");
const globalsCss = readCascadeCss();
const dialogContentSource = readFileSync(new URL("../../components/ui/dialog/DialogContent.vue", import.meta.url), "utf8");
const dialogScrollContentSource = readFileSync(new URL("../../components/ui/dialog/DialogScrollContent.vue", import.meta.url), "utf8");
const dialogOverlaySource = readFileSync(new URL("../../components/ui/dialog/DialogOverlay.vue", import.meta.url), "utf8");