Commit graph

4 commits

Author SHA1 Message Date
Tolaria
c7a3fe9412 feat(action-points): add zensical.toml kill switch + perf + legibility
Feature flag:
- [project.extra.action_points] enabled (default true) in zensical.toml.
- overrides/main.html exposes it as window.TOA_ACTION_POINTS_ENABLED in
  <head>, before extra_javascript loads.
- extra.js bails at the top of the IIFE when the flag is false: no
  storage, no nav badges, no heading pills, no confetti, no per-click
  work. Checkboxes fall back to Material's read-only tasklist.
  Verified inert when disabled (0 badges/pills/canvases, no localStorage,
  no JS errors).

Perf:
- In-memory write-through cache for the parsed store: a single toggle
  went from 15 localStorage JSON.parse reads to 0.
- updateNavBadges() updates badges in place (reuse span, only write on
  change) instead of removing+rebuilding every badge each toggle, which
  forced a full Material nav relayout. JS/toggle ~0.37->0.26ms,
  layout delta ~0.73->0.63ms.

Legibility:
- Override -webkit-text-fill-color (headings set it; pseudo-elements
  inherit it and it beats `color`) to #fff on completed green pills and
  nav badges, so the count/checkmark is white on green. h2 text color
  itself untouched.
2026-06-03 23:46:14 +08:00
Tolaria
fbc488cc95 perf(action-points): pool confetti into one shared canvas + single rAF
Each section/page completion previously appended a new full-viewport
(100vw x 100vh, z-index 99999) canvas with its own requestAnimationFrame
loop. Completing several sections in a row stacked multiple fullscreen
layers, each independently repainting the whole viewport at 60fps — the
real cause of click-induced slowdown (the change handler itself is ~1ms).

Now: one shared canvas, one rAF loop, particles pooled across completions.
The loop stops and the canvas is removed once no particles remain, so
there is no idle fullscreen compositing layer. Resize keeps it sized.

Verified live: 1 canvas after two back-to-back section completions,
0 canvases after the animation ends, green pills still white-on-green.
2026-06-03 23:17:44 +08:00
Tolaria
69f69be5e4 fix(action-points): correct nav badges, first-load totals, legibility
- Fix nav badge mis-targeting: scope to .md-nav--primary, skip #anchor
  (TOC) links so 'On this page' entries no longer show the page total;
  detect active-leaf sections via md-nav__item--nested instead of the
  secondary (TOC) nav, so the active page gets its own badge.
- Add build-time totals manifest (main.py -> docs/javascripts/toa-totals.json)
  so nav badges show correct totals on first load before a user has
  visited each page. Fetched once, browser-cached, zero runtime cost.
  Wired into CI before zensical build.
- Exclude fenced code blocks when counting tasks, so the Markdown
  reference doc's example checkboxes don't produce a phantom 0/3 badge.
- Force white text (#fff !important) on completed green pills/badges,
  incl. badge-inside-complete-link, to beat the nav link's green color.
- Convert prose practice/strategy steps into interactive tasklist items.
- Add action-points PRD under planning/.
2026-06-03 23:03:17 +08:00
Tolaria
d399f510b7 feat: port zensical source content from pages branch 2026-06-03 17:32:27 +08:00