Repository navigation
Phase 33 slice A: viewer modules on the redesign's tokens - #263
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.tsis nowsrc/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 inclient/.src/viewer.tskeeps only re-exports, soindex.ts, the standalone viewer and the tests import from the same path as before. Template strings stay, and no dependency is added.src/viewer/tokens.tsholds 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 insrc/viewer/.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.components.tsand 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.scriptJson. This fixes the project id the project page inlined into its script unescaped.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
Tests
test/unit/test-viewer-tokens.tscovers 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.tschecks every route's status and content type, the font route, and its refusal of names outside the cache.test/browser/test-viewer-components.tschecks 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.test-viewer-sidebar.ts,test-viewer-logo-favicon.tsand the sidebar half oftest-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.Verification
An independent verifier compared the old
viewer.tsagainst 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.