/** * @module The route inventory the visual harness captures. * * Static routes only — parameterised ones (`/recipes/{id}`) need seeded data, * and the surfaces this restructure touches hardest (settings, the app shell, * every empty state) are all reachable without it. Extracted from each app's * `www/index.ts` router config; re-check when routes are added. * * Every app uses `useHash: true`, so a route is reached by setting * `location.hash` to `#!` — no server-side routing, which is why the * harness can serve `www/` as plain static files. */ export interface AppSpec { /** Directory name under `apps/`, also the screenshot folder name. */ name: string /** Directory served, relative to `apps/`. Defaults to `/www`. */ root?: string /** Build command and its cwd, relative to `apps/`. Defaults to `civ build`. */ build?: { cwd: string; cmd: string[] } /** Static routes, as written in the router config. */ routes: string[] /** * Extra theme sheets to capture alongside the default, via `?theme=`. * Only the gallery serves these; an app ships one theme. */ themes?: string[] /** * Take the route list from the page's own `globalThis.__ROUTES__` instead of * the array above. The gallery grows a route per specimen, and a hand-kept * copy of that list would be stale the first time one was added. */ discoverRoutes?: boolean /** * Selectors hidden before each shot. * * Only for surfaces this restructure cannot affect and that never render * identically twice — a WebGL canvas laying out its own labels. Do **not** * mask Civility components to quiet them down: dynamic *text* (a build id, * a `timeAgo()` string) still diffs as a small obvious blob, whereas masking * would hide the styling regressions this harness exists to catch. */ mask?: string[] } export const APPS: AppSpec[] = [ { name: 'cook', routes: [ '/', '/list', '/settings', '/settings/sync', '/about', '/recipe/new', '/foods', ], }, { name: 'fit', routes: [ '/', '/library', '/history', '/settings', '/settings/sync', '/settings/about', ], }, { name: 'maps', routes: [ '/', '/search', '/bookmarks', '/settings', '/settings/sync', '/settings/downloads', '/settings/about', ], // maplibre-gl re-lays out its country labels on every load, so the map // canvas jitters a pixel or two between otherwise identical runs. mask: ['#map', '.mini-map'], }, { name: 'music', routes: [ '/', '/search', '/memos', '/settings', '/settings/sync', '/settings/about', ], }, { name: 'notes', routes: [ '/', '/search', '/collections', '/settings', '/settings/sync', '/settings/about', ], }, { name: 'photos', routes: ['/', '/albums', '/settings', '/settings/sync'], }, { // Not an app: the component gallery, rendered from local `packages/ui` // source. This is the only place the component rewrite is visible before a // release, since `@inro/ui` cannot be resolved locally from an app. name: 'gallery', root: 'civility/packages/ui/gallery/dist', build: { cwd: 'civility/packages/ui', cmd: ['deno', 'task', 'gallery'], }, routes: ['/'], discoverRoutes: true, // `eink` is the framework's own proof that the token contract is complete; // capturing it means a regression in that contract is visible, not // theoretical. themes: ['eink', 'dark', 'bubbly', 'b-side', 'free-to-play'], }, ] /** Colour schemes, driven through CDP's `prefers-color-scheme` emulation. */ export const SCHEMES = ['light', 'dark'] as const /** * Viewports. These are PWAs whose layout diverges sharply at the landmark * breakpoints — a desktop-only baseline would miss the bottom bar entirely, * and a mobile-only one would miss the nav rail. */ export const VIEWPORTS = { mobile: { width: 414, height: 896 }, desktop: { width: 1280, height: 900 }, } as const export type Scheme = typeof SCHEMES[number] export type ViewportName = keyof typeof VIEWPORTS