catcrafts.net/interfaces/Catcrafts-Views.cppm
Jorijn van der Graaf 13a12c2a2c Migrate to crafter-build project.cpp and restructure views
- Replace project.json + run.sh with a C++ project.cpp build descriptor
  (crafter-build), targeting wasm32-wasip1 with the Crafter.Graphics dep
- Add Catcrafts-Views implementation; drop Catcrafts-Component
- Add catcrafts-head.js (sets <title>/<link> tags at runtime)
- Update Blog/Root/main modules, README, and favicon

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-18 23:27:41 +02:00

27 lines
1 KiB
C++

/*
catcrafts.net
Copyright (C) 2026 Catcrafts
The source code of this website is made available for viewing purposes only.
No permission is granted to copy, modify, distribute, or create derivative works.
*/
export module Catcrafts:Views;
import Crafter.Graphics;
import std;
using namespace Crafter;
export namespace Catcrafts {
// Builds the persistent page chrome (header / <main id="main"> / footer)
// under <body>. Owns the root element for the page's lifetime so its
// children don't get yanked out of the DOM. Must be called from main()
// — the Crafter.Graphics Dom bridge is only safe to use after wasm
// instantiation hands control to user code.
void InitializePage();
// Per-render scratch ref to the <main> content container created by
// InitializePage(). Looking it up fresh on every call costs one
// document.getElementById; in return we don't have to thread a long-lived
// reference across module boundaries.
inline Dom::HtmlElementPtr MainContent() { return Dom::HtmlElementPtr("main"); }
}