The home page shows at once

It was blank until every module had loaded and the page's examples had
been run, a fuzzer's report among them (about a second of work): first
paint came 1.3 seconds into a repeat visit and about 3 into a first one.

- The assembler draws the home page once, in Node, with the app's own
  homeView, and puts it inside #app. The browser paints it with the
  HTML and the stylesheet.
- When the app has loaded it draws the page again, with its controls,
  and puts it in the prerendered one's place; the fuzzer's reports and
  the proof's counts are copied from the prerendered page, not worked
  out again.
- The prerendered page shows only on the home address: the page's first
  inline script marks it before the first paint, and without the mark it
  stays hidden, so an embed or a problem's address never shows it. That
  script changed, and its hash in docs/Caddyfile with it.

Served locally, first paint is at 0.1 to 0.2 seconds and the page with
its controls at 0.2 to 0.3; both were at 1.2 to 1.4.
This commit is contained in:
alexm committed 2026-11-13 07:28:38 -05:00
1 parent 7000662539
commit 5202c96318
12 files changed
+154 -19

No files matched your search

+4 -1
View File
@@ -18,7 +18,9 @@
<link rel="stylesheet" href="./styles/course/tokens.css">
<link rel="stylesheet" href="./styles/course/kit.css">
<link rel="stylesheet" href="./styles/course/asm86.css">
<script>try { var t = localStorage.getItem("pplus.theme"); if (t === "light" || t === "dark") document.documentElement.setAttribute("data-theme", t); } catch (e) { }</script>
<!-- before the first paint: whether the address is the home page, whose prerendered copy (scripts/assemble-page.mjs)
shows only then, and the reader's theme -->
<script>try { if (/^(#\/?(#.*)?)?$/.test(location.hash)) document.documentElement.setAttribute("data-home", ""); var t = localStorage.getItem("pplus.theme"); if (t === "light" || t === "dark") document.documentElement.setAttribute("data-theme", t); } catch (e) { }</script>
<link rel="icon"
href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><style>rect{fill:%23f6c453}text{fill:%2316191f}@media (prefers-color-scheme:dark){rect{fill:%230e1117}text{fill:%23f0c05a}}</style><rect width='16' height='16' rx='3'/><text x='8' y='12' font-size='8' text-anchor='middle' font-family='monospace' font-weight='700'>P+</text></svg>">
</head>
@@ -28,6 +30,7 @@
<!-- replaced as soon as the app starts; shown only if it has not after a few seconds (styles.css, .boot-note) -->
<p class="boot-note">Programming+ did not start. It has to be served by a web server (<code>pixi run dev</code>,
or the site), not opened as a file, and its scripts must be allowed to run. Reload to try again.</p>
<!--prerendered-home-->
</div>
<!-- pplus-core's modules (core/, a git submodule built into core/dist): the app imports them as #core/... -->
<script type="importmap">{ "imports": { "#core/": "./core/dist/" } }</script>