Use vSuite's shared tokens instead of a hand copy (after #117, vJournal#90) #118

Merged
CrowderSoup merged 2 commits from claude/shared-tokens into main 2026-11-17 23:25:03 +00:00
Owner

The vTodo half of step 1 of vSuite Frame Design (the vJournal note). It's audit item 6: vTodo's colours were a hand copy of vJournal's, with a note to keep them in step.

Merge order:

  • After #117. This branch is built on it, and so on #114–#116. It needs #116's theme.js, which always sets data-theme to light or dark. Without that, the shared tokens would follow the device even when you'd picked Light.
  • After vJournal#90, whose packages/theme this copies (commit 812cd411). If #90 changes before it merges, run the script again.

What changes

  • static/vendor/vsuite-theme/ holds tokens.css and frame.css from vJournal's packages/theme. SOURCE.json records the vJournal commit and each file's sha256.
  • base.html loads them before app.css.
  • app.css drops the 28 shared tokens: colours, shadows, --font-read and --font-mono, and the whole dark block. What's left is vTodo's own names (--bg, --surface, --accent, --font-sans: var(--font-ui), …) and layout (radii, column widths, --panel-w). --sidebar-w stays at vTodo's 264px until the frame step moves it to the shared 272px.
  • scripts/vsuite_theme.py:
    • uv run python scripts/vsuite_theme.py ../vJournal copies from a vJournal checkout. It refuses if packages/theme has uncommitted changes there.
    • --check verifies the copy.
  • tests/test_vsuite_theme.py, which runs in the normal suite, fails if:
    • a copied file was edited by hand;
    • app.css defines a shared token again (apart from --sidebar-w, listed with its reason);
    • the shared tokens stop loading before app.css.
  • frame.css comes along. It's unused until vTodo moves to the shared frame, and every class in it is frame-.

Why a pinned copy and not a live link: vJournal's repo isn't publicly fetchable, so vTodo's CI can't pull it. A pinned copy with checksums also means a vJournal theme change never breaks a vTodo build unannounced. You update it on purpose.

Checked

  • Nothing looks different. I hashed the computed colour, background, border colour, shadow and font of every element on My work, the board and Settings, in light and in dark. All six were identical before (this change stashed) and after.
  • Auto / Light / Dark behave as before.
  • Full suite: 810 passed, browser tests included.

🤖 Generated with Claude Code

The vTodo half of step 1 of **vSuite Frame Design** (the vJournal note). It's audit item 6: vTodo's colours were a hand copy of vJournal's, with a note to keep them in step. **Merge order:** - **After #117.** This branch is built on it, and so on #114–#116. It needs #116's `theme.js`, which always sets `data-theme` to `light` or `dark`. Without that, the shared tokens would follow the device even when you'd picked Light. - **After vJournal#90**, whose `packages/theme` this copies (commit `812cd411`). If #90 changes before it merges, run the script again. ## What changes - **`static/vendor/vsuite-theme/`** holds `tokens.css` and `frame.css` from vJournal's `packages/theme`. **`SOURCE.json`** records the vJournal commit and each file's sha256. - **`base.html`** loads them before `app.css`. - **`app.css`** drops the 28 shared tokens: colours, shadows, `--font-read` and `--font-mono`, and the whole dark block. What's left is vTodo's own names (`--bg`, `--surface`, `--accent`, `--font-sans: var(--font-ui)`, …) and layout (radii, column widths, `--panel-w`). `--sidebar-w` stays at vTodo's 264px until the frame step moves it to the shared 272px. - **`scripts/vsuite_theme.py`**: - `uv run python scripts/vsuite_theme.py ../vJournal` copies from a vJournal checkout. It refuses if `packages/theme` has uncommitted changes there. - `--check` verifies the copy. - **`tests/test_vsuite_theme.py`**, which runs in the normal suite, fails if: - a copied file was edited by hand; - `app.css` defines a shared token again (apart from `--sidebar-w`, listed with its reason); - the shared tokens stop loading before `app.css`. - `frame.css` comes along. It's unused until vTodo moves to the shared frame, and every class in it is `frame-`. Why a pinned copy and not a live link: vJournal's repo isn't publicly fetchable, so vTodo's CI can't pull it. A pinned copy with checksums also means a vJournal theme change never breaks a vTodo build unannounced. You update it on purpose. ## Checked - **Nothing looks different.** I hashed the computed colour, background, border colour, shadow and font of every element on My work, the board and Settings, in light and in dark. All six were identical before (this change stashed) and after. - Auto / Light / Dark behave as before. - Full suite: 810 passed, browser tests included. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
My work: a New task button.
All checks were successful
tests / pytest (push) Successful in 1m50s
abd10942fd
My work is where vTodo opens, but it had no way to add a task. It now has
the same New task button as List, Board and Calendar. The task goes in the
active workspace, which the panel names ("New task in Personal"), and the
answer is My work's list, so the page stays put.

The button clears the workspace the panel was last pointed at, so opening
a Chores task from My work and then clicking New task doesn't file the new
one in Chores.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Serve htmx, EasyMDE and oat from vTodo, and draw the editor with vJournal's icons.
All checks were successful
tests / pytest (push) Successful in 1m23s
3e2f788df0
The page loaded four things from other people's servers: oat from unpkg
with no version (so any new release would change how vTodo looks),
htmx from unpkg, EasyMDE from jsdelivr, and Font Awesome from
bootstrapcdn, which EasyMDE fetched for its toolbar. They're now pinned
copies in static/vendor/, like vJournal serves its own.

The notes and comment editors drop Font Awesome for the toolbar vJournal's
editor has, with the same icons from packages/theme: bold, italic, heading,
bullets, checkbox, link, code.

Browser tests no longer need a stand-in for unpkg's htmx.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Theme: Auto, Light or Dark, and Auto follows the device.
All checks were successful
tests / pytest (push) Successful in 1m21s
92afde8520
The user menu had one "Dark mode" / "Light mode" button. Pressing it once
saved a choice for good: there was no way back to following the device,
and a device switching to dark at sunset didn't change vTodo. vJournal
always follows the device.

The menu now has a three-way switch, Auto, Light and Dark, with Auto the
default. Auto tracks the device as it changes. The browser's theme-color
follows too, so the phone's status bar matches the page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Turn the Content Security Policy on: scripts are vTodo's own files only.
All checks were successful
tests / pytest (push) Successful in 1m5s
1ef9bcdbfc
settings.py had a policy under CONTENT_SECURITY_POLICY["DIRECTIVES"],
django-csp's name and shape, but Django 6's built-in middleware reads
SECURE_CSP and wasn't installed. Production sent no policy at all.

Now ContentSecurityPolicyMiddleware is on, with script-src 'self' and
nothing else: no CDNs (static/vendor/ has them) and no 'unsafe-inline', so
markup that gets injected can't run code. object-src 'none', base-uri
'self', frame-ancestors 'none'. Inline style="" is still allowed. There's
no form-action, because sign-in and MCP OAuth consent redirect off-site.

That meant taking the code out of the templates:
- The theme bootstrap moves to static/theme.js, still loaded before the
  page draws.
- onclick=, onchange= and hx-on::after-request become data-* attributes
  (data-close-panel, data-opens-panel, data-closes-panel, data-new-task,
  data-theme-choice, data-confirm, data-submit-on-change,
  data-load-saved-view, data-reset-after), handled once in app.js.
- htmx-config turns off allowEval and its injected indicator styles.

tests/test_csp.py checks the header and fails if any template brings back
an inline script, an on*= handler or hx-on. A browser test walks the pages
and the task panel and fails on any CSP violation. Playwright waits are
written as functions, since a string expression is eval'd in the page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Use vSuite's shared tokens instead of a hand copy.
All checks were successful
tests / pytest (push) Successful in 1m53s
b29e55baa0
app.css copied vJournal's colours, type stacks and shadows by hand, with a
note to keep the two in step. They now come from vJournal's packages/theme
(vJournal#90), copied into static/vendor/vsuite-theme/ with the commit and
each file's sha256 in SOURCE.json, and loaded before app.css. app.css keeps
only vTodo's own names (--bg, --accent, ...) and layout.

- scripts/vsuite_theme.py ../vJournal updates the copy; --check checks it.
- tests/test_vsuite_theme.py fails if the copy was edited by hand, or if
  app.css defines a shared token again. --sidebar-w stays vTodo's 264px
  until vTodo moves to the shared frame.
- frame.css comes along, unused until then (every class is frame-).

Dark follows data-theme, which static/theme.js always sets, so Auto, Light
and Dark behave as before. Nothing looks different: the computed colours,
borders, shadows and fonts of every element on My work, the board and
Settings, light and dark, are the same before and after.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CrowderSoup deleted branch claude/shared-tokens 2026-11-17 23:25:03 +00:00
Sign in to join this conversation.
No description provided.