}\n}`,
"project-board": `page ProjectBoardExample {\n state tasks = [{label:"Review designs"},{label:"Build the dashboard"},{label:"Test accessibility"}]\n view {
Project workspace
}\n}`,
};
for (const e of examples) {
const old = join(pagesDir, "templates", e.slug + ".wrn");
if (existsSync(old)) unlinkSync(old);
}
const css = readFileSync(join(exampleRoot, "app/styles/workspace-preview.css"), "utf8");
for (const e of examples) {
const source =
extra[e.slug] || readFileSync(join(exampleRoot, "examples", e.slug + ".wrn"), "utf8");
const at = source.lastIndexOf("\n }");
let rendered;
if (at >= 0)
rendered =
source.slice(0, at) +
codePanel(source) +
`Page styles · copy with the example
Explore complete layouts, interact with the controls, and copy the source.
${cards(examples.map((e) => ({ ...e, href: "/preview/" + e.slug })))}`,
),
);
const templateGroups = [
{
slug: "dashboards",
title: "Dashboards & admin",
icon: "layout-dashboard",
description: "Analytics and account operations with meaningful metrics.",
heading: "Workspace performance",
body: ``,
},
{
slug: "commerce",
title: "Commerce",
icon: "shopping-bag",
description: "A product collection with a working shopping bag.",
heading: "Everyday essentials",
body: `
Thoughtfully made tools for your desk.
Shopping bag: {bag} items
`,
},
{
slug: "marketing",
title: "Marketing websites",
icon: "sparkles",
description: "A SaaS landing page with benefits, pricing, and a clear next step.",
heading: "Make room for your best work.",
body: `
One calm workspace for projects, notes, and the people behind them.
`,
},
{
slug: "productivity",
title: "Productivity",
icon: "list-checks",
description: "A planning workspace for priorities, deadlines, and notes.",
heading: "Your week, in focus",
body: ``,
},
];
write(
"templates.wrn",
page(
"Templates",
"Templates",
`Start a product
Templates for your next idea
Four starting points with complete layouts and copyable source. Examples demonstrate controls; templates combine them into a product page.
${cards(templateGroups.map((e) => ({ ...e, href: "/templates/" + e.slug })))}`,
),
);
for (const t of templateGroups) {
const source = `page ${t.slug.replace(/-/g, "")}Template {
state bag: number = 0
view {
Real sections with live previews and complete source code.
${cards(blockCards)}`,
),
);
write("blocks/index.wrn", page("BlocksIndex", "UI blocks", cards(blockCards)));
// Update internal guides to point to the moved block documentation.
for (const directory of [pagesDir, join(pagesDir, "components")])
for (const file of readdirSync(directory).filter((f) => f.endsWith(".wrn"))) {
const path = join(directory, file);
let text = readFileSync(path, "utf8");
for (const c of blockComponents)
text = text.replaceAll("/components/" + slugOf(c.name), "/blocks/" + slugOf(c.name));
if (text !== readFileSync(path, "utf8")) writeFileSync(path, text);
}
}