Skip to content

Phase 33 slice A: viewer modules on the redesign's tokens - #263

Merged
vicmaster merged 3 commits into
masterfrom
phase-33-slice-a
Nov 24, 2026
Merged

vicmaster merged 3 commits into
masterfrom
phase-33-slice-a

Conversation

@vicmaster

Copy link
Copy Markdown
Owner

First slice of Phase 33, which ports the viewer to the redesigned screens. This slice builds the foundation the later slices stand on. The page bodies keep their current markup and change only through the new tokens, so the visible change is the colours, the type and the sidebar.

What changed

  • src/viewer.ts is now src/viewer/. There is one module each for the server and routes, tokens, shared CSS, shared components and each page, and each page's browser script is a function in client/. src/viewer.ts keeps only re-exports, so index.ts, the standalone viewer and the tests import from the same path as before. Template strings stay, and no dependency is added.
  • The viewer's colours, type and depth come from the design. src/viewer/tokens.ts holds the "Viewer redesign" project's design system, light and dark. A new test fails if any token drifts from the committed design system, or if a colour literal appears anywhere else in src/viewer/.
  • The chrome follows the system's light or dark setting. Until now it was dark only. The preview's own Dark switch for canvases is unchanged.
  • Fonts come from the font cache. A new route, GET /assets/fonts/<file>, serves the cached Inter and Space Grotesk files with an immutable cache header, and the viewer warms them in the background when it starts. With nothing cached, the pages fall back to the system font with no error.
  • The sidebar, tabs, menu and dialog are built once in components.ts and work by keyboard: arrow keys in tab lists and menus, Escape to close, and focus that stays inside a dialog. The new sidebar is on the project and archive pages now. The tabs, menu and dialog are wired into pages in slices C and D.
  • Every value written into a page script goes through scriptJson. This fixes the project id the project page inlined into its script unescaped.
  • A security problem found while writing the spec is recorded as a follow-up in VISION.md. The viewer allows cross-origin requests on the routes that archive, delete and post comments. It needs its own change.

Changed on purpose

  • The sidebar shows the "framesmith" wordmark without the grid mark, as the design does. The grid mark stays as the favicon, now stroked in the design system's accent.
  • The detail page's toolbar buttons are unchanged in this slice. The shared button styles are kept off that page until slice C moves its toolbar onto them.

Tests

  • New: test/unit/test-viewer-tokens.ts covers token drift and the colour-literal scan, and was shown to fail on a changed token and on an added literal. test/unit/test-viewer-routes.ts checks every route's status and content type, the font route, and its refusal of names outside the cache. test/browser/test-viewer-components.ts checks tabs, menu and dialog by keyboard. It also checks that no page scrolls sideways at 390px, that the drawer opens and closes, that the inspector stacks at 700px and the toolbar wraps at 600px, the offline font fallback, and that Inter loads from the cache.
  • Rewritten for the new sidebar: test-viewer-sidebar.ts, test-viewer-logo-favicon.ts and the sidebar half of test-archive-view.ts. Each still checks the same behaviour: workspace labels, one link per project, which one is current, the counts, the Archive link and its count.
  • Results: the unit tier passes 97/97, the test type-check is clean, and all three viewer browser tests pass.

Verification

An independent verifier compared the old viewer.ts against the new modules. Every route, page and script behaves as before apart from the intended changes. It also found the font route safe against path traversal. Its six minor findings are fixed in the second commit: two untested acceptance cases, the shared button styles reaching the detail toolbar, a hard-coded font format, an overstated comment, and leftover blank lines. The docs audit found no doc text made false by this slice; its one addition, the font route in the README's route list, is in.

Phase 33 slice A. src/viewer.ts becomes src/viewer/ (server, tokens, styles,
components, pages, client scripts) and re-exports what the tests import. The
viewer's colours, type and depth now come from the "Viewer redesign" design
system, follow the system's light or dark setting, and a test fails if they
drift or a colour literal appears outside tokens.ts. Fonts are served from the
font cache. The sidebar, tabs, menu and dialog are built once and work by
keyboard. Page bodies keep their markup until slices B to E rebuild them.
Test the offline font fallback and the 720px and 640px detail breakpoints, keep the shared component CSS off the detail page until slice C, derive the @font-face format from the file, and list the font route in the README.
@vicmaster
vicmaster merged commit 19871a0 into master Nov 24, 2026
3 checks passed
@vicmaster
vicmaster deleted the phase-33-slice-a branch November 24, 2026 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant