Something went wrong. Try again.
Tools for building Offline-first Web Apps
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144/** * @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 `#!<route>` — 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 `<name>/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=<name>`. * 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