diff --git a/TODO.md b/TODO.md index 36597f7..19a5629 100644 --- a/TODO.md +++ b/TODO.md @@ -140,7 +140,17 @@ bird photo appears in a browser. ## Phase 3 — WebUI -- [ ] React + TS + Vite + TanStack Query/Router, built on the dev machine, served as static files by Caddy +Scaffolding done — see [`web/README.md`](web/README.md). Typechecks, builds, +and the System page reads live data through the Vite proxy. + +- [x] React 19 + TS + Vite + TanStack Query/Router, built on the dev machine, served as static files by Caddy +- [x] Three themes as design tokens, `data-theme` on ``, no flash of the wrong theme +- [x] `npm run check:contrast` — asserts WCAG AA across all three themes; caught three failing `--border-strong` values on its first run +- [x] i18n de/en with a build-time-complete catalogue +- [x] Auth shell: provider, login form with TOTP field, `RequireAuth` — **written, deliberately not enforcing** (no endpoints yet, and no dev bypass on purpose) +- [x] System page on live `/health` — the end-to-end proof browser → proxy → FastAPI → Postgres +- [ ] Wire `RequireAuth` into `router.tsx` and delete the "not enforced" banner, once `/auth/*` exists +- [ ] ESLint (skipped during scaffolding; `tsc --noEmit` covers the important cases for now) - [ ] Virtualised gallery grid; filters for date range, taxon, device, tag, reviewed, kept - [ ] Observation editor — `captures` 1—n `observations`, so a photo can hold two species or none - [ ] Taxon autocomplete; seed `taxa` with 60–80 Central European garden species incl. GBIF keys, `name_de` + `name_en`, `is_local_common` ranking first diff --git a/web/.gitignore b/web/.gitignore new file mode 100644 index 0000000..4609e81 --- /dev/null +++ b/web/.gitignore @@ -0,0 +1,4 @@ +node_modules/ +dist/ +*.local +.vite/ diff --git a/web/README.md b/web/README.md new file mode 100644 index 0000000..83aa6fb --- /dev/null +++ b/web/README.md @@ -0,0 +1,114 @@ +# poorBird web + +Phase 3 scaffolding: shell, themes, i18n and the auth plumbing. Built on the +dev machine and shipped to the server as static files — nothing here runs on +the server (SPEC §6). + +```bash +cd web +npm install +npm run dev # http://localhost:5173 +``` + +The dev server proxies `/api` to `http://127.0.0.1:8090`, so start the API +too (see [`../server/README.md`](../server/README.md)). Both must be running +or the System page shows "cannot reach the server", which is the honest +answer rather than a blank screen. + +| Script | Does | +|---|---| +| `npm run dev` | Vite dev server with HMR | +| `npm run build` | typecheck, then production bundle into `dist/` | +| `npm run typecheck` | `tsc --noEmit` on its own | +| `npm run check:contrast` | assert WCAG contrast for all three themes | + +> On Windows, Vite binds IPv6 `localhost`. Use `http://localhost:5173`, not +> `http://127.0.0.1:5173`. + +--- + +## What is real and what is not + +Only `GET /api/v1/health` exists on the server today, so only the **System** +page shows live data. It is the end-to-end proof: browser → Vite proxy → +FastAPI → PostgreSQL. + +Gallery and Devices render an honest empty state. They are deliberately not +filled with mock rows — fake data hides exactly the layout problems that real +data exposes, and Phase 2 is what brings real captures. + +**Authentication is built but not enforced.** `/auth/session`, `/auth/login` +and `/auth/logout` are Phase 3 server work and do not exist yet. So: + +- `AuthProvider` and `RequireAuth` are written and typechecked +- `router.tsx` does **not** wrap routes in `RequireAuth` yet, and says why +- a banner in the layout states plainly that sign-in is not enforced +- **there is no development bypass**, on purpose — a bypass that works is the + kind of code that survives into production, and an auth bypass that works is + the worst possible bug + +Wiring it up when the endpoints land is three lines in `router.tsx` plus +deleting the banner. + +--- + +## Conventions + +**No user-facing string literal in a component. Ever.** Every one goes +through `useT()`. `src/i18n/en.ts` defines the key set; `de.ts` is typed as +`Catalogue`, so a missing or misspelled German key fails `npm run build` +rather than showing English to a German user at runtime. + +**No colour literal outside `src/styles/tokens.css`.** Components reference +tokens, which is what makes a fourth theme a single CSS block. Run +`npm run check:contrast` after touching any colour — it caught three failing +`--border-strong` values the first time it ran. + +**Themes** are `data-theme` on ``: `light`, `dark`, `blue` (dark navy). +An inline script in `index.html` applies the stored choice before first paint +to avoid a flash of the wrong theme; it must stay in sync with +`theme/ThemeProvider.tsx` — same storage key, same attribute, same default. +Once accounts exist, `users.theme` becomes the source of truth and +localStorage stays as the pre-login default. + +--- + +## Layout + +``` +src/ + main.tsx providers, in order + router.tsx the whole route table, one flat file + i18n/ en.ts (source of truth), de.ts (typed against it) + theme/ data-theme on + auth/ provider, login form, route guard (not wired yet) + lib/api.ts the only place that calls fetch + components/ layout and shared pieces + pages/ one per route + styles/ tokens.css (themes), global.css (everything else) +scripts/check-contrast.mjs +``` + +--- + +## Notes on the stack + +**TypeScript is strict**, including `noUncheckedIndexedAccess` and +`verbatimModuleSyntax`. Learning TypeScript with the checks off teaches a +different language than the one everyone else writes. The error messages say +what to do. + +**i18n is hand-written, not `react-i18next`.** Two languages and a few hundred +strings do not need a library, and the typed catalogue gives compile-time +completeness that i18next does not provide by default. If real plural grammar +is ever needed, ICU MessageFormat is the upgrade and the call sites keep their +shape. + +**TanStack Router with code-based routes**, per SPEC §6, rather than the +file-based convention — one visible route table, no codegen step. Its payoff +is that `` is typechecked, so a typo in a path is a build +error instead of a 404 found later. + +**No ESLint yet.** `tsc --noEmit` catches the important class of mistakes; +ESLint is worth adding but its flat-config setup is a distraction during +scaffolding. diff --git a/web/index.html b/web/index.html new file mode 100644 index 0000000..386eec5 --- /dev/null +++ b/web/index.html @@ -0,0 +1,34 @@ + + + + + + + poorBird + + + +
+ + + diff --git a/web/package-lock.json b/web/package-lock.json new file mode 100644 index 0000000..1f3871e --- /dev/null +++ b/web/package-lock.json @@ -0,0 +1,2039 @@ +{ + "name": "poorbird-web", + "version": "0.1.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "poorbird-web", + "version": "0.1.0", + "dependencies": { + "@tanstack/react-query": "^5.62.0", + "@tanstack/react-router": "^1.95.0", + "react": "^19.0.0", + "react-dom": "^19.0.0" + }, + "devDependencies": { + "@types/react": "^19.0.0", + "@types/react-dom": "^19.0.0", + "@vitejs/plugin-react": "^4.3.4", + "typescript": "^5.7.0", + "vite": "^6.0.0" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz", + "integrity": "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.29.7", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.7.tgz", + "integrity": "sha512-locTkQyKvwIEgBzVrn8693ebc97F2U8ZHjbXwDXJ5Fn2TCpNwTlKcaKLkdHop5c/icOFE7qt7Q9JC5hnKNa6Gg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.7.tgz", + "integrity": "sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.7", + "@babel/generator": "^7.29.7", + "@babel/helper-compilation-targets": "^7.29.7", + "@babel/helper-module-transforms": "^7.29.7", + "@babel/helpers": "^7.29.7", + "@babel/parser": "^7.29.7", + "@babel/template": "^7.29.7", + "@babel/traverse": "^7.29.7", + "@babel/types": "^7.29.7", + "@jridgewell/remapping": "^2.3.5", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/generator": { + "version": "7.29.8", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.8.tgz", + "integrity": "sha512-gZbepsdh3WDtgZKWL+vTPh71LSBrm/Y4/QDZBVCcYfmeTEEuoOYwlSy+G1StfJg+/Zy550u/3TATbm7qDbbMtg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.29.8", + "@babel/types": "^7.29.8", + "@jridgewell/gen-mapping": "^0.3.12", + "@jridgewell/trace-mapping": "^0.3.28", + "jsesc": "^3.0.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.29.7.tgz", + "integrity": "sha512-wem6WaBj4NaVYVdNhLPPVacES6ZJ+KBBfSkTMD3YZxbP3rm3Di85tJU5ljaUNhaOynt+Aj0xruhYuzQBt8n71g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.29.7", + "@babel/helper-validator-option": "^7.29.7", + "browserslist": "^4.24.0", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-globals": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.29.7.tgz", + "integrity": "sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.29.7.tgz", + "integrity": "sha512-ejHwrQQYcm9xnTivShn2IDOlIzInN34AXskvq9QicvCtEzq1Vzclu/tKF8Jq1Cg8JG2GL6/EmjgsCT7lXepE3g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.29.7", + "@babel/types": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.29.7.tgz", + "integrity": "sha512-UPUVSyXbOh627KiCIGQSgwWzGeBKLkaJ9PJEdrngIwMSzxLR4jS4+f1f1jb7VzBbg8nFLaYotvVPFCTqdrmTAg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-module-imports": "^7.29.7", + "@babel/helper-validator-identifier": "^7.29.7", + "@babel/traverse": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-plugin-utils": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.29.7.tgz", + "integrity": "sha512-G7sHYigPY17oO5SYWnfD/0MTBwVR781S/JI643e/JhUYgVgWE/61SoW3NH9KWUKyKq5LVh3npif99Wkt6j86Jw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz", + "integrity": "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz", + "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.29.7.tgz", + "integrity": "sha512-N9ZErrD+yW5geCDtBqnOoxmR8+tNKiGuxKlDpuJxfsqpa2dFcexaziGAE/qoHLiDDreVNMupxGmSoNlyvsA3gw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.29.7.tgz", + "integrity": "sha512-1k2lAGRMfHTcwuNYcCNUmaUffmQv8KWMfh2iJUUeRlwlwH4FdNG7mfPI10NPfLHJFThE4Tyr4mv7kTNZOiPuBg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/template": "^7.29.7", + "@babel/types": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.29.9", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.9.tgz", + "integrity": "sha512-CjXrNHTnvqBVqHgdBysY3vk2T8tpJHb5/RMeHJBTyVa9xgugCB0CJTx/3oO8RV2QRQP391RWpB7D6hLjm8V9uA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.29.8" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/plugin-transform-react-jsx-self": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.29.7.tgz", + "integrity": "sha512-TL0hMc9xzy86VD31nUiwzd5otRAcyEPcsegCxolO0PvcXuH1v0kECe/UIznYFihpkvU5wg/jk4v0TTEFfm53fw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-react-jsx-source": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.29.7.tgz", + "integrity": "sha512-06IyK09H3wi4cGbhDBwp5gUGo0IKtnYa8tyTiephirPCK6fbobVGiXMMI5zLQ4aKEYP3wZ3ArU44o+8KMrSG/Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/template": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.29.7.tgz", + "integrity": "sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.7", + "@babel/parser": "^7.29.7", + "@babel/types": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.29.8", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.8.tgz", + "integrity": "sha512-I5z7H3bf/41ktsNVLtpN0wAa336HkqIHQ5BuPLEhTkt1jVSyZpeNKIzTgEWmlxjdg81R0IgUCcaE+Ok3NvrfZg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.7", + "@babel/generator": "^7.29.8", + "@babel/helper-globals": "^7.29.7", + "@babel/parser": "^7.29.8", + "@babel/template": "^7.29.7", + "@babel/types": "^7.29.8", + "debug": "^4.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.29.8", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.8.tgz", + "integrity": "sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.29.7", + "@babel/helper-validator-identifier": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz", + "integrity": "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.12.tgz", + "integrity": "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.12.tgz", + "integrity": "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.12.tgz", + "integrity": "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz", + "integrity": "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.12.tgz", + "integrity": "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.12.tgz", + "integrity": "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.12.tgz", + "integrity": "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.12.tgz", + "integrity": "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.12.tgz", + "integrity": "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.12.tgz", + "integrity": "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.12.tgz", + "integrity": "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.12.tgz", + "integrity": "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.12.tgz", + "integrity": "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.12.tgz", + "integrity": "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.12.tgz", + "integrity": "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz", + "integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.12.tgz", + "integrity": "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.12.tgz", + "integrity": "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.12.tgz", + "integrity": "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.12.tgz", + "integrity": "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.12.tgz", + "integrity": "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.12.tgz", + "integrity": "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.12.tgz", + "integrity": "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.12.tgz", + "integrity": "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz", + "integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/remapping": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", + "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", + "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@napi-rs/lzma-linux-x64-gnu": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-x64-gnu/-/lzma-linux-x64-gnu-1.5.1.tgz", + "integrity": "sha512-oTXEIha4SsuXdTA4Iyskj0kpdx2yVXdhd75c2v3xGrHFfVMsbhTPZU/nMPL4sWKo4pBHm3aucLaqGlF696dTyQ==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@rolldown/pluginutils": { + "version": "1.0.0-beta.27", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.27.tgz", + "integrity": "sha512-+d0F4MKMCbeVUJwG96uQ4SgAznZNSq93I3V+9NHA4OpvqG8mRCpGdKmK8l/dl02h2CCDHwW2FqilnTyDcAnqjA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.63.4.tgz", + "integrity": "sha512-I+BSHzTAhKN2n7ZwGZsegGcZjDpLqFOMAtJz/u6uFGe0pUFbq56dEHjqJV/ZUdRJtNXNxA+hREUatZBvMR3Oiw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.63.4.tgz", + "integrity": "sha512-pu3BdjS2LtEzRu2elmGzS3fIeWSZy4BMDIaLNwjorO76+k2d0LMluijhsDx3KQyQBQ/lLUZCQA9/s6csvUfuhw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.63.4.tgz", + "integrity": "sha512-xfSrj9MHnWK9GaSqT9U0ImHtH/N8WZlHLx4cZHiuLcqs640hvZ3hLPd5UR2AZS57FaE8HrRUSpltbZdWRxHiDA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.63.4.tgz", + "integrity": "sha512-bqU99PLJb/dqb3S0GIMdeuyAEETSUgZBoqXYd3Sd+WCsV+MmPhnN6JrotWyir31+QgH7EvvE5/mwGJlEoci8Fw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.63.4.tgz", + "integrity": "sha512-JinsFZ5G40oXQb+sUuiA5x689vhr6dDYK0H0NL+rwKdL6CqnmYN8PE4ZwfRSoIjrCxqTQG/SLfTtSvHeGxoVlw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.63.4.tgz", + "integrity": "sha512-GAdA4UxpiNm27cLHr2GqXBpAD0x9FqwYBY7/YSP0Ss0/PNi4k8gbviqpIpYbVSRBaS2ZcegXEzgTQMbRNCwxCw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.63.4.tgz", + "integrity": "sha512-qDd6NoA1znaLjp4jR5U/KWCdLAKDJNB8W9ChbbDaKbo0xA+Atln5HK6LFCZ4oJQpemtRZA288DCirFRjrspptw==", + "cpu": [ + "arm" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.63.4.tgz", + "integrity": "sha512-WtB5Tz5KTNINb8ZA+8sQ7bmjuS1JrRT7YverYIhUGdWWDlpzVWmIwuZE+jidkEXUn1l0zrEkaIMa8dHF3NGcsA==", + "cpu": [ + "arm" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.63.4.tgz", + "integrity": "sha512-VcQ3L1tjnkKzWjryAVaFhHEWcqOfICX9uxVVoDzm2t0DpgKRHd2zOpVrJc0xsWeBZcBFyYROCIBdyR/fS174pg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.63.4.tgz", + "integrity": "sha512-6+ZQX6P5s0cMDN2Ypb8Lbm2+/sZYmZjdaYny992ujUU9UKi/4CWoJWsl1pNvjWJHNHGK51m+jKGLlh1ylb2ifQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-gnu": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.63.4.tgz", + "integrity": "sha512-D72ZnvkFkBXOfzMMQLcwfPLyGkKb7HZ9/mf97B7v6/P5Lbv4oFOtSY/uHbS8lH6uKUOxoKiuokdb50XZSzzbJw==", + "cpu": [ + "loong64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-musl": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.63.4.tgz", + "integrity": "sha512-piU6BxeqA3O9KSu3kRCIQQtNqFFaTu21SEV4FwaRZowpnj3bLaWPZHw+xFqCs0XlJ+aOH3PTRWGoglH+mKA/OA==", + "cpu": [ + "loong64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-gnu": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.63.4.tgz", + "integrity": "sha512-/5PGpHwqt2EEEOUs1XwzubE/ucr0dWDQ+to3zqi4Ds7EWpwtQ79wXc4JBoxqj/OwpawTsKWzJxHfSuBOq3DrWA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-musl": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.63.4.tgz", + "integrity": "sha512-cX3beZDLWt7G2oJF+nhChiT+qtaihs+S2xi7ziGmVB+2pwPng6D0Ed0HmElQOgv2UsUmSJJLGwpBao/3TDx3VA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.63.4.tgz", + "integrity": "sha512-1uz2mGWHyptR7DgHHrlbdRAjXK7v7elGZ9lMja910/RP+ZYbX6xAmCiU9UZSX4hqmgtHMv6lr5l3kq1HIOpcag==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.63.4.tgz", + "integrity": "sha512-nLS8topojxyz7SRpKR2IODRpQ0XPZ+xaOXvT3+hqK/Uy8Lo5HFgkkIBiIrCu5tL5YqzTvgovGw55PwpahTAGig==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.63.4.tgz", + "integrity": "sha512-gs7DRKotr3l3q+jGPQBjH0ng1FjlEDm5ueQrkw5JtQvtLyEIcLASqAEaor56BhkKRzk+IcQzrcanBdb/bBQn8g==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.63.4.tgz", + "integrity": "sha512-791ET7W17NnScOZM7h4dX5hYspxE28htPFsb1awY/NRR8+PRNkS53e475rDdxXXDrP+kwnCcNWg9CX5ztn/Aqw==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.63.4.tgz", + "integrity": "sha512-iwZQRcmj7g88g3tzefIrQY7qvmuA/cfYwhrDtTBhsmukO4U2huVO5W+86XacUMRvdSFVAc6kZUZy21JaRwiB9w==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-openbsd-x64": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.63.4.tgz", + "integrity": "sha512-dVHFp9gRWrdTpnqQuGfCwd7hOQDatK1VCP2iWhLY/cGrOQs/ucFzJ6A5SRqbXX12ZDI8EUuejSM5kwg+ja7Png==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ] + }, + "node_modules/@rollup/rollup-openharmony-arm64": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.63.4.tgz", + "integrity": "sha512-t3NlauOW6gxZVVFcBEnO62Cb4wbyDFL416gTg1uFI/2tgqYQlf69FbSE115Ajre9I+c26Lk4mcmdFUsS/DGifQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.63.4.tgz", + "integrity": "sha512-xWuIaSye5FWZF8+UYtVEcHtRJDN5kN9Kfgxx3Kq8XIov9KSKbc1fiqQCm90SKrgQbUXZelbnUhnlUJmfSE7P9A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.63.4.tgz", + "integrity": "sha512-9ALJJUOg/ZflMJepVo2PlgsGxSaxN7SQ4Z8GoZfVlarWr6r3rkHUNsd/zAio7p4YMtChSMXPionxej4Hkf6CXQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-gnu": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.63.4.tgz", + "integrity": "sha512-blj9z5qx/Pv4WU0W1NMFDB97e0JH5ed+aZGywW8WCvp/NhWX/4PFAq5uu6Q0AebNn+Vo6KzUYDT++JzTT5ojlQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.63.4.tgz", + "integrity": "sha512-Erx822VRBwLa124shbj+wNXe//BOgMEctDV0m1aqTQdNO1S69DgNUCFKC1RCeZfixs1J31l6igk1ziyXErbigQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@tanstack/history": { + "version": "1.162.4", + "resolved": "https://registry.npmjs.org/@tanstack/history/-/history-1.162.4.tgz", + "integrity": "sha512-utTS5L2OkeYUzXGohL1Z8sefu1GLNOJcxe8Hd6iIdc/Xo1K1nDB2JEp4iSFhvYh33xKC9V91TxrS8qfrpoKobQ==", + "license": "MIT", + "engines": { + "node": ">=20.19" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + } + }, + "node_modules/@tanstack/query-core": { + "version": "5.103.1", + "resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.103.1.tgz", + "integrity": "sha512-rms8HqTGp6zA00dM+cUQ2eBcgzNJefuu5CAMB37i/6MiGT1zulPOytCFu2a0qjLqVR2n1jENPj9woqFQNuCzWA==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + } + }, + "node_modules/@tanstack/react-query": { + "version": "5.103.1", + "resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.103.1.tgz", + "integrity": "sha512-rmAPPApNEK17VXRJhtE1rja53n23VV5w30C0saCgJhhX+EpdUnVqMGV/s5nnzV43X75KTHKzuoiuxSzGTBIkag==", + "license": "MIT", + "dependencies": { + "@tanstack/query-core": "5.103.1" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + }, + "peerDependencies": { + "react": "^18 || ^19" + } + }, + "node_modules/@tanstack/react-router": { + "version": "1.170.38", + "resolved": "https://registry.npmjs.org/@tanstack/react-router/-/react-router-1.170.38.tgz", + "integrity": "sha512-iHM9b0aDJbuvftmkiQXawzoqsdV68p2Re2safbVLCnxafe+iLKV++2i3hI/BMAP6uR92/Mjw94JKJJfD7pbwHQ==", + "license": "MIT", + "dependencies": { + "@tanstack/history": "1.162.4", + "@tanstack/react-store": "^0.11.0", + "@tanstack/router-core": "1.171.32", + "isbot": "^5.1.22" + }, + "engines": { + "node": ">=20.19" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + }, + "peerDependencies": { + "react": ">=18.0.0 || >=19.0.0", + "react-dom": ">=18.0.0 || >=19.0.0" + } + }, + "node_modules/@tanstack/react-store": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/@tanstack/react-store/-/react-store-0.11.1.tgz", + "integrity": "sha512-HaIGKI3YLmjBYIvy5DFDY23oNaYZIsTZfngey07Uh5iLVJgM3bIGCnZeOFOqzjFld9JHWcaHJnasD/bKoGKwJQ==", + "license": "MIT", + "dependencies": { + "@tanstack/store": "0.11.1", + "use-sync-external-store": "^1.6.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/@tanstack/router-core": { + "version": "1.171.32", + "resolved": "https://registry.npmjs.org/@tanstack/router-core/-/router-core-1.171.32.tgz", + "integrity": "sha512-X86Jqk3vB2KJcUfS6oLi7B7yxbaa59QEhZRPPP1fRx3k+Jw/Fu1UYVBcRtdwK/OccQnrlQdVoKvNO3QXmyEBOw==", + "license": "MIT", + "dependencies": { + "@tanstack/history": "1.162.4", + "cookie-es": "^3.0.0", + "seroval": "^1.6.2", + "seroval-plugins": "^1.6.2" + }, + "engines": { + "node": ">=20.19" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + } + }, + "node_modules/@tanstack/store": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/@tanstack/store/-/store-0.11.1.tgz", + "integrity": "sha512-mzTOBhypOuDJAy/D8n2MfUZ1HFkXnmSETviRyhqEC8LUE7/IZQExOTxMANj3KjTofYTkFNpBY67qaVrT41YccA==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + } + }, + "node_modules/@types/babel__core": { + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", + "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "node_modules/@types/babel__generator": { + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.27.0.tgz", + "integrity": "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__template": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", + "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__traverse": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.28.0.tgz", + "integrity": "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.28.2" + } + }, + "node_modules/@types/estree": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/react": { + "version": "19.3.0", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.3.0.tgz", + "integrity": "sha512-N0rFCuH9YoxG9/m61l9MfpJKfmLOVU0em7ipIz6TRgSSkvReLB9vL85GB+yr8Bs5leqpvg96JSwF4ZS1s4viQg==", + "dev": true, + "license": "MIT", + "dependencies": { + "csstype": "^3.2.2" + } + }, + "node_modules/@types/react-dom": { + "version": "19.3.0", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.3.0.tgz", + "integrity": "sha512-ZI7bU42mZXXKHn/qNLEw2IrbiINU7X5+vfgdixBHkCNpYWXjKgfQ/P+uyGb5CjOLB9UcnTeg3rylQtV2hym44Q==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "@types/react": "^19.3.0" + } + }, + "node_modules/@vitejs/plugin-react": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.7.0.tgz", + "integrity": "sha512-gUu9hwfWvvEDBBmgtAowQCojwZmJ5mcLn3aufeCsitijs3+f2NsrPtlAWIR6OPiqljl96GVCUbLe0HyqIpVaoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.28.0", + "@babel/plugin-transform-react-jsx-self": "^7.27.1", + "@babel/plugin-transform-react-jsx-source": "^7.27.1", + "@rolldown/pluginutils": "1.0.0-beta.27", + "@types/babel__core": "^7.20.5", + "react-refresh": "^0.17.0" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "peerDependencies": { + "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" + } + }, + "node_modules/baseline-browser-mapping": { + "version": "2.11.25", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.25.tgz", + "integrity": "sha512-gMmEShwwq7FJqMwvfRwvCl00v4kN+KOfJqXn+f4nrufak5gNHJOksd/60Dvjuz7sI8Y5WiSFBa8FEYr+zoyqCw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "baseline-browser-mapping": "dist/cli.cjs" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/browserslist": { + "version": "4.29.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.29.0.tgz", + "integrity": "sha512-3GSvyjvDI4Dur1Meg2BekJquu5uF+9R9a1+5M1Mde192eZoXbeXjzgOsgqPS2V8D5wrrip0gR5Hf/GhWQ9ZzaA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "baseline-browser-mapping": "^2.11.23", + "caniuse-lite": "^1.0.30001810", + "electron-to-chromium": "^1.5.427", + "node-releases": "^2.0.55", + "update-browserslist-db": "^1.3.3" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001810", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001810.tgz", + "integrity": "sha512-TITQPUkaz+aVk5GL6NhOdwk1aEaNTSDPsGFWrTuhKGtjTF70jL/Oht2W4c6rXUe5fu7Ie19VIahAXHIIiWWNeg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "CC-BY-4.0" + }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true, + "license": "MIT" + }, + "node_modules/cookie-es": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/cookie-es/-/cookie-es-3.1.1.tgz", + "integrity": "sha512-UaXxwISYJPTr9hwQxMFYZ7kNhSXboMXP+Z3TRX6f1/NyaGPfuNUZOWP1pUEb75B2HjfklIYLVRfWiFZJyC6Npg==", + "license": "MIT" + }, + "node_modules/csstype": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", + "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/electron-to-chromium": { + "version": "1.5.433", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.433.tgz", + "integrity": "sha512-5lCAbyZBjtmUt/RAGHRqrL2q0oEFRThDAsZHHDn9XHa89Qw7gMYOeSicBTy+AHfvo0r6vwsZvqNJTQIQy1BLzA==", + "dev": true, + "license": "ISC" + }, + "node_modules/esbuild": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz", + "integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.25.12", + "@esbuild/android-arm": "0.25.12", + "@esbuild/android-arm64": "0.25.12", + "@esbuild/android-x64": "0.25.12", + "@esbuild/darwin-arm64": "0.25.12", + "@esbuild/darwin-x64": "0.25.12", + "@esbuild/freebsd-arm64": "0.25.12", + "@esbuild/freebsd-x64": "0.25.12", + "@esbuild/linux-arm": "0.25.12", + "@esbuild/linux-arm64": "0.25.12", + "@esbuild/linux-ia32": "0.25.12", + "@esbuild/linux-loong64": "0.25.12", + "@esbuild/linux-mips64el": "0.25.12", + "@esbuild/linux-ppc64": "0.25.12", + "@esbuild/linux-riscv64": "0.25.12", + "@esbuild/linux-s390x": "0.25.12", + "@esbuild/linux-x64": "0.25.12", + "@esbuild/netbsd-arm64": "0.25.12", + "@esbuild/netbsd-x64": "0.25.12", + "@esbuild/openbsd-arm64": "0.25.12", + "@esbuild/openbsd-x64": "0.25.12", + "@esbuild/openharmony-arm64": "0.25.12", + "@esbuild/sunos-x64": "0.25.12", + "@esbuild/win32-arm64": "0.25.12", + "@esbuild/win32-ia32": "0.25.12", + "@esbuild/win32-x64": "0.25.12" + } + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/isbot": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/isbot/-/isbot-5.2.2.tgz", + "integrity": "sha512-iQcBXcd+Rv/pkubRyGh2utW2j1oPG5hZY6TUhVPpqK4G+o3IbxpJNx04hgksjc/N7GK5pEorUxDeg31cFgEk/w==", + "license": "Unlicense", + "engines": { + "node": ">=18" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/jsesc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "dev": true, + "license": "MIT", + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, + "license": "MIT", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/nanoid": { + "version": "3.3.19", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.19.tgz", + "integrity": "sha512-Y2tUNy4ouw6tq5oDSKeQYGOyhkUBhNOcGV/02KC+6kd9eDGqdZd++mjMiIDilrBYvjEnCYvVtsuHCuP+okSfug==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/node-releases": { + "version": "2.0.56", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.56.tgz", + "integrity": "sha512-x0InOIyzgdk+eyaWaRJFH5snEtiImgBgblZ2CyPrLmqqcuMQkEvcDPHbzqbD8eDsSeJbVOjn+crzyzHaM4D+/A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/postcss": { + "version": "8.5.28", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.28.tgz", + "integrity": "sha512-RRuzqDtt5Y9h3quz5hWhK+TPnsmVs6WwSU6LkJMeY4HstUEDuYTG8UJSdawMRzmzAtV+KEoG8N3Qg2qLy5vM/A==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.18", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/react": { + "version": "19.3.0", + "resolved": "https://registry.npmjs.org/react/-/react-19.3.0.tgz", + "integrity": "sha512-E8LUcbtBWt20bbl2YoHfx4ZDBdxVTfOKtCZn9cDSJ4l6/nuoApcpIBcj47t2wZoVX8g2ZHuMHbiShgCR1T5Sog==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "19.3.0", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.3.0.tgz", + "integrity": "sha512-JDk8dgif51OjFoDE70+OT9ICyYr+69HlmihNwp1+Nsfbna3t5sIiCa9ZJktDmQ4/1b/rn26hIAR2uYXDMr5r0Q==", + "license": "MIT", + "dependencies": { + "scheduler": "^0.28.0" + }, + "peerDependencies": { + "react": "^19.3.0" + } + }, + "node_modules/react-refresh": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.17.0.tgz", + "integrity": "sha512-z6F7K9bV85EfseRCp2bzrpyQ0Gkw1uLoCel9XBVWPg/TjRj94SkJzUTGfOa4bs7iJvBWtQG0Wq7wnI0syw3EBQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/rollup": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.63.4.tgz", + "integrity": "sha512-4U0liVayNIoLp3GFl1FcI8561WepLnZ1rqfraGh7S9B3Ur5F9S283y8Futii7RUU2C/97tOBmBy7nYvhoiOpbQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.9" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@napi-rs/lzma-linux-x64-gnu": "1.5.1", + "@rollup/rollup-android-arm-eabi": "4.63.4", + "@rollup/rollup-android-arm64": "4.63.4", + "@rollup/rollup-darwin-arm64": "4.63.4", + "@rollup/rollup-darwin-x64": "4.63.4", + "@rollup/rollup-freebsd-arm64": "4.63.4", + "@rollup/rollup-freebsd-x64": "4.63.4", + "@rollup/rollup-linux-arm-gnueabihf": "4.63.4", + "@rollup/rollup-linux-arm-musleabihf": "4.63.4", + "@rollup/rollup-linux-arm64-gnu": "4.63.4", + "@rollup/rollup-linux-arm64-musl": "4.63.4", + "@rollup/rollup-linux-loong64-gnu": "4.63.4", + "@rollup/rollup-linux-loong64-musl": "4.63.4", + "@rollup/rollup-linux-ppc64-gnu": "4.63.4", + "@rollup/rollup-linux-ppc64-musl": "4.63.4", + "@rollup/rollup-linux-riscv64-gnu": "4.63.4", + "@rollup/rollup-linux-riscv64-musl": "4.63.4", + "@rollup/rollup-linux-s390x-gnu": "4.63.4", + "@rollup/rollup-linux-x64-gnu": "4.63.4", + "@rollup/rollup-linux-x64-musl": "4.63.4", + "@rollup/rollup-openbsd-x64": "4.63.4", + "@rollup/rollup-openharmony-arm64": "4.63.4", + "@rollup/rollup-win32-arm64-msvc": "4.63.4", + "@rollup/rollup-win32-ia32-msvc": "4.63.4", + "@rollup/rollup-win32-x64-gnu": "4.63.4", + "@rollup/rollup-win32-x64-msvc": "4.63.4", + "fsevents": "~2.3.2" + } + }, + "node_modules/scheduler": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.28.0.tgz", + "integrity": "sha512-juorfCmIkIw8tT+p5BXSm6PJjQF/ycEYmKyzURCIt/RaZIhL+PulbQ9Yu2z1HdOJDdqDTlxA1+xKBmHXJsczAw==", + "license": "MIT" + }, + "node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/seroval": { + "version": "1.6.7", + "resolved": "https://registry.npmjs.org/seroval/-/seroval-1.6.7.tgz", + "integrity": "sha512-AeDcLh0yO2SFm9W71essgnSzLV9DI8ZH0x0knXn2DMnUZj728mpLbxjlbB6IqKCmqh8JA3cEqRyGoNkt584JcQ==", + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/seroval-plugins": { + "version": "1.6.7", + "resolved": "https://registry.npmjs.org/seroval-plugins/-/seroval-plugins-1.6.7.tgz", + "integrity": "sha512-4Nk35ttD3DTDJW4hgw5StsVAPeU6qnDFnULAouw6tQ7oLTV/ICXrWpsXo2EE52eSP2joUMazbVf52mFEcADqRw==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "seroval": "^1.0" + } + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/update-browserslist-db": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.3.3.tgz", + "integrity": "sha512-pJ2sYawQS0R/WI928Gj5GlPhTGzbMelq0+4INtSYNDV9ErKJcX6xjGWkoG/VnB3dpUm00zALaqkrUD77pO5TDQ==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "escalade": "^3.2.0", + "picocolors": "^1.1.1" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/use-sync-external-store": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.7.0.tgz", + "integrity": "sha512-6L+EeigHMQhdaIPNIFUKwfWJSwWFQ8gJbJ2DLOs5sDIegTwR9fRxvnM3uciHKjIZhFz+KAv2emhWMRvDmMcY8A==", + "license": "MIT", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/vite": { + "version": "6.4.3", + "resolved": "https://registry.npmjs.org/vite/-/vite-6.4.3.tgz", + "integrity": "sha512-NTKlcQjlAK7MlQoyb6LgaqHc8sso/pVyUJYWMws3jg21uTJw/LddqIFPcPqP6PzpgbIcZyKI85sFE4HBrQDA8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "^0.25.0", + "fdir": "^6.4.4", + "picomatch": "^4.0.2", + "postcss": "^8.5.3", + "rollup": "^4.34.9", + "tinyglobby": "^0.2.13" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", + "jiti": ">=1.21.0", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "sass-embedded": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true, + "license": "ISC" + } + } +} diff --git a/web/package.json b/web/package.json new file mode 100644 index 0000000..02b39f9 --- /dev/null +++ b/web/package.json @@ -0,0 +1,26 @@ +{ + "name": "poorbird-web", + "private": true, + "version": "0.1.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc --noEmit && vite build", + "typecheck": "tsc --noEmit", + "preview": "vite preview", + "check:contrast": "node scripts/check-contrast.mjs" + }, + "dependencies": { + "@tanstack/react-query": "^5.62.0", + "@tanstack/react-router": "^1.95.0", + "react": "^19.0.0", + "react-dom": "^19.0.0" + }, + "devDependencies": { + "@types/react": "^19.0.0", + "@types/react-dom": "^19.0.0", + "@vitejs/plugin-react": "^4.3.4", + "typescript": "^5.7.0", + "vite": "^6.0.0" + } +} diff --git a/web/scripts/check-contrast.mjs b/web/scripts/check-contrast.mjs new file mode 100644 index 0000000..fd2cd81 --- /dev/null +++ b/web/scripts/check-contrast.mjs @@ -0,0 +1,126 @@ +/* Assert WCAG contrast for every theme in tokens.css. + * + * Colour contrast is the classic silently-regressing property: you nudge one + * hex value, it still "looks fine" on your monitor, and the muted text is now + * unreadable for someone else. So it gets a test rather than a promise. + * + * No dependencies -- run with `npm run check:contrast`. + */ + +import { readFileSync } from "node:fs"; +import { fileURLToPath } from "node:url"; +import { dirname, join } from "node:path"; + +const here = dirname(fileURLToPath(import.meta.url)); +const css = readFileSync(join(here, "..", "src", "styles", "tokens.css"), "utf8"); + +/** Extract custom properties per theme from the stylesheet. */ +function parseThemes(source) { + const themes = {}; + const blockRe = /([^{}]+)\{([^}]*)\}/g; + let match; + while ((match = blockRe.exec(source)) !== null) { + const selectors = match[1] + .replace(/\/\*[\s\S]*?\*\//g, "") + .split(",") + .map((s) => s.trim()); + const body = match[2]; + + const props = {}; + const propRe = /(--[\w-]+)\s*:\s*([^;]+);/g; + let prop; + while ((prop = propRe.exec(body)) !== null) { + props[prop[1]] = prop[2].trim(); + } + + for (const selector of selectors) { + const named = selector.match(/\[data-theme="([\w-]+)"\]/); + if (named) { + themes[named[1]] = { ...(themes[named[1]] ?? {}), ...props }; + } + } + } + return themes; +} + +function toLinear(channel) { + const c = channel / 255; + return c <= 0.04045 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4); +} + +function luminance(hex) { + const clean = hex.replace("#", "").trim(); + if (!/^[0-9a-fA-F]{6}$/.test(clean)) return null; + const r = parseInt(clean.slice(0, 2), 16); + const g = parseInt(clean.slice(2, 4), 16); + const b = parseInt(clean.slice(4, 6), 16); + return 0.2126 * toLinear(r) + 0.7152 * toLinear(g) + 0.0722 * toLinear(b); +} + +function contrast(fg, bg) { + const a = luminance(fg); + const b = luminance(bg); + if (a === null || b === null) return null; + const [hi, lo] = a > b ? [a, b] : [b, a]; + return (hi + 0.05) / (lo + 0.05); +} + +/* Each pair: [foreground token, background token, minimum ratio]. + * 4.5 is WCAG AA for body text; 3.0 is AA for large text and for the + * boundaries of interactive components. */ +const PAIRS = [ + ["--text", "--bg", 4.5], + ["--text", "--surface", 4.5], + ["--text", "--surface-raised", 4.5], + ["--text-muted", "--bg", 4.5], + ["--text-muted", "--surface", 4.5], + ["--accent", "--bg", 4.5], + ["--accent", "--surface", 4.5], + ["--text-inverse", "--accent", 4.5], + ["--success", "--surface", 4.5], + ["--warning", "--surface", 4.5], + ["--danger", "--surface", 4.5], + ["--border-strong", "--surface", 3.0], +]; + +const themes = parseThemes(css); +const names = Object.keys(themes); + +if (names.length === 0) { + console.error("no themes found in tokens.css - has the file moved?"); + process.exit(1); +} + +let failures = 0; +let checked = 0; + +for (const name of names) { + const tokens = themes[name]; + console.log(`\n ${name}`); + for (const [fgToken, bgToken, min] of PAIRS) { + const fg = tokens[fgToken]; + const bg = tokens[bgToken]; + if (!fg || !bg) { + console.log(` ? ${fgToken} on ${bgToken} - token missing`); + failures++; + continue; + } + const ratio = contrast(fg, bg); + if (ratio === null) { + console.log(` ? ${fgToken} on ${bgToken} - not a plain hex colour`); + continue; + } + checked++; + const ok = ratio >= min; + if (!ok) failures++; + const mark = ok ? "ok " : "FAIL"; + console.log( + ` ${mark} ${fgToken} on ${bgToken} ${ratio.toFixed(2)}:1 (need ${min})` + ); + } +} + +console.log( + `\n${checked} pairs checked across ${names.length} themes, ${failures} failure(s)\n` +); +process.exit(failures > 0 ? 1 : 0); diff --git a/web/src/auth/AuthProvider.tsx b/web/src/auth/AuthProvider.tsx new file mode 100644 index 0000000..1506d72 --- /dev/null +++ b/web/src/auth/AuthProvider.tsx @@ -0,0 +1,122 @@ +/* The authentication shell. + * + * IMPORTANT, and deliberate: none of the endpoints this talks to exist yet. + * Phase 3 builds /auth/session, /auth/login and /auth/logout on the server. + * Until then `useAuth()` reports "anonymous" and is written but + * NOT wired into the router -- see router.tsx. + * + * There is no development bypass here on purpose. A bypass is the kind of + * code that survives into production because it works, and an auth bypass + * that works is the worst possible bug. The app is simply ungated until the + * real thing lands, which is visible and hard to forget. + * + * TOTP is part of the shape from the start (TODO 3.0): optional per user, + * enforced for admins. Retrofitting it later would mean reopening the login + * flow, the session model, the user model and the audit log at once. + */ + +import { useQuery, useQueryClient } from "@tanstack/react-query"; +import { createContext, useCallback, useContext, useMemo } from "react"; +import type { ReactNode } from "react"; + +import { ApiError, apiGet, apiPost } from "../lib/api"; + +export type Role = "admin" | "editor" | "viewer"; + +export interface User { + id: number; + username: string; + role: Role; + locale: string; + theme: string; +} + +export interface Credentials { + username: string; + password: string; + /** Six digits, when the account has TOTP enabled. */ + totp?: string; +} + +export type AuthState = + | { status: "loading" } + /** The server has no auth endpoints yet. Distinct from "signed out". */ + | { status: "unavailable" } + | { status: "anonymous" } + | { status: "authenticated"; user: User }; + +interface AuthValue { + state: AuthState; + signIn: (credentials: Credentials) => Promise; + signOut: () => Promise; + /** Convenience for `state.status === "authenticated" && role check`. */ + can: (...roles: Role[]) => boolean; +} + +const AuthContext = createContext(null); + +function useSessionQuery() { + return useQuery({ + queryKey: ["auth", "session"], + queryFn: async () => { + try { + return await apiGet("/auth/session"); + } catch (error) { + // 401 is the normal "not signed in" answer, not a failure. + if (error instanceof ApiError && error.status === 401) return null; + throw error; + } + }, + retry: false, + staleTime: 60_000, + }); +} + +export function AuthProvider({ children }: { children: ReactNode }) { + const queryClient = useQueryClient(); + const query = useSessionQuery(); + + const state = useMemo(() => { + if (query.isPending) return { status: "loading" }; + if (query.error?.isMissingEndpoint) return { status: "unavailable" }; + if (query.data) return { status: "authenticated", user: query.data }; + return { status: "anonymous" }; + }, [query.isPending, query.error, query.data]); + + const signIn = useCallback( + async (credentials: Credentials) => { + const user = await apiPost("/auth/login", credentials); + queryClient.setQueryData(["auth", "session"], user); + }, + [queryClient] + ); + + const signOut = useCallback(async () => { + await apiPost("/auth/logout"); + queryClient.setQueryData(["auth", "session"], null); + // Anything cached under the old identity must not be shown to the next one. + await queryClient.invalidateQueries(); + }, [queryClient]); + + const can = useCallback( + (...roles: Role[]) => state.status === "authenticated" && roles.includes(state.user.role), + [state] + ); + + const value = useMemo(() => ({ state, signIn, signOut, can }), [ + state, + signIn, + signOut, + can, + ]); + + return {children}; +} + +export function useAuth(): AuthValue { + const value = useContext(AuthContext); + if (value === null) { + throw new Error("useAuth must be used inside "); + } + return value; +} diff --git a/web/src/auth/LoginPage.tsx b/web/src/auth/LoginPage.tsx new file mode 100644 index 0000000..fe01deb --- /dev/null +++ b/web/src/auth/LoginPage.tsx @@ -0,0 +1,93 @@ +import { useState } from "react"; +import type { FormEvent } from "react"; + +import { useT } from "../i18n/I18nProvider"; +import { ApiError } from "../lib/api"; +import { useAuth } from "./AuthProvider"; + +/* The sign-in form. Fully built, and currently talking to an endpoint that + * does not exist -- a 404 is reported honestly rather than dressed up as + * "wrong password". The TOTP field is present from the start because the + * policy is decided (TODO 3.0). */ +export function LoginPage() { + const t = useT(); + const { signIn } = useAuth(); + + const [username, setUsername] = useState(""); + const [password, setPassword] = useState(""); + const [totp, setTotp] = useState(""); + const [busy, setBusy] = useState(false); + const [error, setError] = useState(null); + + async function onSubmit(event: FormEvent) { + event.preventDefault(); + setBusy(true); + setError(null); + try { + await signIn({ username, password, totp: totp || undefined }); + } catch (cause) { + if (cause instanceof ApiError && cause.isMissingEndpoint) { + setError(t("auth.unavailable")); + } else { + setError(t("auth.failed")); + } + } finally { + setBusy(false); + } + } + + return ( +
+
+

{t("auth.signIn")}

+ + + + + + + + {error !== null && ( +

+ {error} +

+ )} + + +
+
+ ); +} diff --git a/web/src/auth/RequireAuth.tsx b/web/src/auth/RequireAuth.tsx new file mode 100644 index 0000000..9d49344 --- /dev/null +++ b/web/src/auth/RequireAuth.tsx @@ -0,0 +1,43 @@ +import type { ReactNode } from "react"; + +import { useT } from "../i18n/I18nProvider"; +import { LoginPage } from "./LoginPage"; +import { useAuth } from "./AuthProvider"; +import type { Role } from "./AuthProvider"; + +/* Route guard. Written now, wired in when Phase 3 lands the endpoints -- + * see router.tsx for why it is not used yet. + * + * This is the client-side half only. It decides what to *render*; it is not + * access control. The server authorises every request independently, and the + * image bytes go through the auth-checked handoff (SPEC 3.3), because an + * unguessable URL is not access control either. */ +export function RequireAuth({ + children, + roles, +}: { + children: ReactNode; + /** When given, the signed-in user must hold one of these roles. */ + roles?: Role[]; +}) { + const t = useT(); + const { state, can } = useAuth(); + + if (state.status === "loading") { + return

{t("common.loading")}

; + } + + if (state.status === "unavailable" || state.status === "anonymous") { + return ; + } + + if (roles !== undefined && !can(...roles)) { + return ( +
+

{t("common.error")}

+
+ ); + } + + return <>{children}; +} diff --git a/web/src/components/AppLayout.tsx b/web/src/components/AppLayout.tsx new file mode 100644 index 0000000..026ba86 --- /dev/null +++ b/web/src/components/AppLayout.tsx @@ -0,0 +1,59 @@ +import { Link, Outlet } from "@tanstack/react-router"; + +import { useAuth } from "../auth/AuthProvider"; +import { useT } from "../i18n/I18nProvider"; +import { LanguageSwitcher } from "./LanguageSwitcher"; +import { ThemeSwitcher } from "./ThemeSwitcher"; + +export function AppLayout() { + const t = useT(); + const { state } = useAuth(); + + return ( +
+
+ +
+ + {/* Visible for as long as the app is ungated. It disappears by + deleting this block when RequireAuth is wired into the router. */} + {state.status !== "authenticated" && ( +

+ {t("auth.notEnforced")} +

+ )} + +
+ +
+
+ ); +} diff --git a/web/src/components/EmptyState.tsx b/web/src/components/EmptyState.tsx new file mode 100644 index 0000000..bdaa300 --- /dev/null +++ b/web/src/components/EmptyState.tsx @@ -0,0 +1,21 @@ +import type { ReactNode } from "react"; + +/** An empty list that explains itself. Used wherever a feature is real but + * has no data yet, which during Phase 3 is most of them. */ +export function EmptyState({ + title, + body, + action, +}: { + title: string; + body: string; + action?: ReactNode; +}) { + return ( +
+

{title}

+

{body}

+ {action} +
+ ); +} diff --git a/web/src/components/LanguageSwitcher.tsx b/web/src/components/LanguageSwitcher.tsx new file mode 100644 index 0000000..586baa7 --- /dev/null +++ b/web/src/components/LanguageSwitcher.tsx @@ -0,0 +1,28 @@ +import { LOCALES, useI18n } from "../i18n/I18nProvider"; +import type { Locale } from "../i18n/I18nProvider"; + +const LABEL: Record = { + de: "lang.de", + en: "lang.en", +}; + +export function LanguageSwitcher() { + const { locale, setLocale, t } = useI18n(); + + return ( + + ); +} diff --git a/web/src/components/ThemeSwitcher.tsx b/web/src/components/ThemeSwitcher.tsx new file mode 100644 index 0000000..aaea568 --- /dev/null +++ b/web/src/components/ThemeSwitcher.tsx @@ -0,0 +1,31 @@ +import { useT } from "../i18n/I18nProvider"; +import { THEMES, useTheme } from "../theme/ThemeProvider"; +import type { Theme } from "../theme/ThemeProvider"; + +const LABEL: Record = { + light: "theme.light", + dark: "theme.dark", + blue: "theme.blue", +}; + +export function ThemeSwitcher() { + const t = useT(); + const { theme, setTheme } = useTheme(); + + return ( + + ); +} diff --git a/web/src/i18n/I18nProvider.tsx b/web/src/i18n/I18nProvider.tsx new file mode 100644 index 0000000..fd3d58b --- /dev/null +++ b/web/src/i18n/I18nProvider.tsx @@ -0,0 +1,96 @@ +/* A small typed translator instead of a library. + * + * Two languages and a few hundred strings do not need i18next, and the + * hand-written catalogue buys something i18next does not give by default: + * a missing German string fails the build rather than falling back silently + * to English in front of the user. + * + * If this ever needs plurals with real grammar, ICU MessageFormat or + * react-i18next is the upgrade path and the call sites do not change shape. + */ + +import { createContext, useCallback, useContext, useEffect, useMemo, useState } from "react"; +import type { ReactNode } from "react"; + +import { de } from "./de"; +import { en } from "./en"; +import type { Catalogue, TranslationKey } from "./en"; + +export const LOCALES = ["de", "en"] as const; +export type Locale = (typeof LOCALES)[number]; + +const CATALOGUES: Record = { de, en }; +const STORAGE_KEY = "poorbird.locale"; + +/** Values substituted into `{placeholders}`. */ +export type TranslationVars = Record; + +export type Translate = (key: TranslationKey, vars?: TranslationVars) => string; + +interface I18nValue { + locale: Locale; + setLocale: (locale: Locale) => void; + t: Translate; +} + +const I18nContext = createContext(null); + +function isLocale(value: unknown): value is Locale { + return typeof value === "string" && (LOCALES as readonly string[]).includes(value); +} + +function initialLocale(): Locale { + try { + const stored = localStorage.getItem(STORAGE_KEY); + if (isLocale(stored)) return stored; + } catch { + // Private mode or blocked storage. Fall through to the browser setting. + } + return navigator.language.toLowerCase().startsWith("de") ? "de" : "en"; +} + +function interpolate(template: string, vars?: TranslationVars): string { + if (!vars) return template; + return template.replace(/\{(\w+)\}/g, (whole, name: string) => { + const value = vars[name]; + // Leaving the placeholder visible beats printing "undefined" at a user. + return value === undefined ? whole : String(value); + }); +} + +export function I18nProvider({ children }: { children: ReactNode }) { + const [locale, setLocaleState] = useState(initialLocale); + + useEffect(() => { + document.documentElement.lang = locale; + try { + localStorage.setItem(STORAGE_KEY, locale); + } catch { + // Not worth telling the user about; the choice just will not persist. + } + }, [locale]); + + const setLocale = useCallback((next: Locale) => setLocaleState(next), []); + + const t = useCallback( + (key, vars) => interpolate(CATALOGUES[locale][key], vars), + [locale] + ); + + const value = useMemo(() => ({ locale, setLocale, t }), [locale, setLocale, t]); + + return {children}; +} + +export function useI18n(): I18nValue { + const value = useContext(I18nContext); + if (value === null) { + throw new Error("useI18n must be used inside "); + } + return value; +} + +/** Shorthand for the common case: `const t = useT()`. */ +export function useT(): Translate { + return useI18n().t; +} diff --git a/web/src/i18n/de.ts b/web/src/i18n/de.ts new file mode 100644 index 0000000..880ab12 --- /dev/null +++ b/web/src/i18n/de.ts @@ -0,0 +1,74 @@ +import type { Catalogue } from "./en"; + +/* Typed as Catalogue, so a missing or misspelled key fails `npm run build`. + * That is the whole reason this file is hand-written rather than loaded as + * JSON at runtime: a missing German string should never reach a browser. */ +export const de: Catalogue = { + "app.name": "poorBird", + "app.tagline": "Gartenvogel-Kamera", + + "nav.gallery": "Galerie", + "nav.devices": "Geräte", + "nav.system": "System", + + "common.loading": "Wird geladen…", + "common.retry": "Erneut versuchen", + "common.error": "Etwas ist schiefgelaufen", + "common.notMeasured": "—", + "common.yes": "Ja", + "common.no": "Nein", + + "theme.label": "Design", + "theme.light": "Hell", + "theme.dark": "Dunkel", + "theme.blue": "Blau", + + "lang.label": "Sprache", + "lang.en": "Englisch", + "lang.de": "Deutsch", + + "auth.notEnforced": + "Die Anmeldung ist noch nicht aktiv — die Auth-Endpunkte kommen in Phase 3.", + "auth.signIn": "Anmelden", + "auth.username": "Benutzername", + "auth.password": "Passwort", + "auth.totp": "Bestätigungscode", + "auth.totpHint": "Sechs Ziffern aus deiner Authenticator-App", + "auth.signingIn": "Anmeldung läuft…", + "auth.failed": "Anmeldung fehlgeschlagen. Benutzername und Passwort prüfen.", + "auth.unavailable": + "Den Anmelde-Endpunkt gibt es noch nicht. Diese Seite ist die Hülle dafür.", + + "gallery.title": "Galerie", + "gallery.empty.title": "Noch keine Aufnahmen", + "gallery.empty.body": + "Die Kamera hat noch nichts hochgeladen. Der Upload kommt in Phase 2; bis dahin bleibt diese Liste leer.", + + "devices.title": "Geräte", + "devices.empty.title": "Keine Geräte registriert", + "devices.empty.body": + "Eine Kamera erscheint hier, sobald sie sich registriert hat. Das kommt in Phase 2.", + + "system.title": "System", + "system.status": "Status", + "system.status.ok": "In Ordnung", + "system.status.degraded": "Eingeschränkt", + "system.version": "Version", + "system.uptime": "Laufzeit", + "system.database": "Datenbank", + "system.database.ok": "Verbunden", + "system.database.down": "Nicht erreichbar", + "system.devices": "Geräte", + "system.captures": "Aufnahmen", + "system.lastBackup": "Letzte Sicherung", + "system.lastBackup.never": "Nie", + "system.disk": "Bildspeicher", + "system.disk.free": "{free} frei von {total}", + "system.disk.unavailable": "Pfad nicht verfügbar", + "system.enrollSecret": "Registrierungs-Secret", + "system.enrollSecret.set": "Konfiguriert", + "system.enrollSecret.unset": "Nicht gesetzt", + "system.unreachable.title": "Server nicht erreichbar", + "system.unreachable.body": + "Die API hat nicht geantwortet. Läuft sie auf Port 8090?", +}; diff --git a/web/src/i18n/en.ts b/web/src/i18n/en.ts new file mode 100644 index 0000000..c14a633 --- /dev/null +++ b/web/src/i18n/en.ts @@ -0,0 +1,80 @@ +/* English is the source of truth for the key set. + * + * `as const` makes TypeScript remember every literal key, which is what lets + * de.ts be checked for completeness at build time. Add a key here first. + */ +export const en = { + "app.name": "poorBird", + "app.tagline": "Garden bird camera", + + "nav.gallery": "Gallery", + "nav.devices": "Devices", + "nav.system": "System", + + "common.loading": "Loading…", + "common.retry": "Try again", + "common.error": "Something went wrong", + "common.notMeasured": "—", + "common.yes": "Yes", + "common.no": "No", + + "theme.label": "Theme", + "theme.light": "Light", + "theme.dark": "Dark", + "theme.blue": "Blue", + + "lang.label": "Language", + "lang.en": "English", + "lang.de": "German", + + "auth.notEnforced": + "Sign-in is not enforced yet — the auth endpoints arrive in Phase 3.", + "auth.signIn": "Sign in", + "auth.username": "Username", + "auth.password": "Password", + "auth.totp": "Authentication code", + "auth.totpHint": "Six digits from your authenticator app", + "auth.signingIn": "Signing in…", + "auth.failed": "Sign-in failed. Check your username and password.", + "auth.unavailable": + "The sign-in endpoint does not exist yet. This screen is the shell it will use.", + + "gallery.title": "Gallery", + "gallery.empty.title": "No captures yet", + "gallery.empty.body": + "The camera has not uploaded anything. Ingest arrives in Phase 2; until then this list stays empty.", + + "devices.title": "Devices", + "devices.empty.title": "No devices enrolled", + "devices.empty.body": + "A camera appears here after it enrolls. Enrollment arrives in Phase 2.", + + "system.title": "System", + "system.status": "Status", + "system.status.ok": "Healthy", + "system.status.degraded": "Degraded", + "system.version": "Version", + "system.uptime": "Uptime", + "system.database": "Database", + "system.database.ok": "Connected", + "system.database.down": "Unreachable", + "system.devices": "Devices", + "system.captures": "Captures", + "system.lastBackup": "Last backup", + "system.lastBackup.never": "Never", + "system.disk": "Image storage", + "system.disk.free": "{free} free of {total}", + "system.disk.unavailable": "Path not available", + "system.enrollSecret": "Enrollment secret", + "system.enrollSecret.set": "Configured", + "system.enrollSecret.unset": "Not set", + "system.unreachable.title": "Cannot reach the server", + "system.unreachable.body": + "The API did not respond. Is it running on port 8090?", +} as const; + +/** Every valid translation key. A typo in `t("...")` is a compile error. */ +export type TranslationKey = keyof typeof en; + +/** The shape every other language must fill completely. */ +export type Catalogue = Record; diff --git a/web/src/lib/api.ts b/web/src/lib/api.ts new file mode 100644 index 0000000..6a39efe --- /dev/null +++ b/web/src/lib/api.ts @@ -0,0 +1,95 @@ +/* The one place that talks to the server. + * + * Same-origin by design: in development Vite proxies /api to port 8090, in + * production Caddy serves this bundle and the API from the same hostname. + * That means session cookies behave identically in both, and there is no CORS + * configuration anywhere. + */ + +export class ApiError extends Error { + readonly status: number; + readonly body: unknown; + + constructor(status: number, message: string, body: unknown) { + super(message); + this.name = "ApiError"; + this.status = status; + this.body = body; + } + + /** True when the endpoint is simply not built yet (Phase 2 / Phase 3). */ + get isMissingEndpoint(): boolean { + return this.status === 404; + } +} + +async function request(path: string, init?: RequestInit): Promise { + let response: Response; + try { + response = await fetch(`/api/v1${path}`, { + credentials: "same-origin", + headers: { Accept: "application/json", ...init?.headers }, + ...init, + }); + } catch (cause) { + // fetch only rejects on a network-level failure: server down, DNS, CORS. + throw new ApiError(0, `Cannot reach the server: ${String(cause)}`, null); + } + + const text = await response.text(); + let body: unknown = null; + if (text.length > 0) { + try { + body = JSON.parse(text); + } catch { + body = text; + } + } + + if (!response.ok) { + throw new ApiError(response.status, `${response.status} ${response.statusText}`, body); + } + return body as T; +} + +export function apiGet(path: string): Promise { + return request(path); +} + +export function apiPost(path: string, payload?: unknown): Promise { + return request(path, { + method: "POST", + headers: payload === undefined ? {} : { "Content-Type": "application/json" }, + body: payload === undefined ? undefined : JSON.stringify(payload), + }); +} + +/* --- response types --------------------------------------------------- + * These mirror the server. Keep them in step with the FastAPI handlers; + * generating them from /openapi.json is a worthwhile upgrade once there are + * more than a handful. */ + +export interface HealthResponse { + status: "ok" | "degraded"; + version: string; + uptime_s: number; + database: { + ok: boolean; + error: string | null; + devices?: number; + captures?: number; + last_backup_at?: string | null; + }; + disk: { + available: boolean; + path: string; + total_bytes?: number; + free_bytes?: number; + used_pct?: number | null; + }; + enroll_secret_configured: boolean; +} + +export function getHealth(): Promise { + return apiGet("/health"); +} diff --git a/web/src/main.tsx b/web/src/main.tsx new file mode 100644 index 0000000..39f01ee --- /dev/null +++ b/web/src/main.tsx @@ -0,0 +1,43 @@ +import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; +import { RouterProvider } from "@tanstack/react-router"; +import { StrictMode } from "react"; +import { createRoot } from "react-dom/client"; + +import { AuthProvider } from "./auth/AuthProvider"; +import { I18nProvider } from "./i18n/I18nProvider"; +import { router } from "./router"; +import "./styles/tokens.css"; +import "./styles/global.css"; +import { ThemeProvider } from "./theme/ThemeProvider"; + +const queryClient = new QueryClient({ + defaultOptions: { + queries: { + // A garden bird camera is not a trading desk. Refetching on every + // window focus is noise. + refetchOnWindowFocus: false, + staleTime: 30_000, + retry: 1, + }, + }, +}); + +const container = document.getElementById("root"); +if (container === null) { + throw new Error("#root is missing from index.html"); +} + +createRoot(container).render( + + + + + {/* AuthProvider needs the query client, so it sits inside it. */} + + + + + + + +); diff --git a/web/src/pages/DevicesPage.tsx b/web/src/pages/DevicesPage.tsx new file mode 100644 index 0000000..72ae82f --- /dev/null +++ b/web/src/pages/DevicesPage.tsx @@ -0,0 +1,13 @@ +import { EmptyState } from "../components/EmptyState"; +import { useT } from "../i18n/I18nProvider"; + +export function DevicesPage() { + const t = useT(); + + return ( +
+

{t("devices.title")}

+ +
+ ); +} diff --git a/web/src/pages/GalleryPage.tsx b/web/src/pages/GalleryPage.tsx new file mode 100644 index 0000000..bb49355 --- /dev/null +++ b/web/src/pages/GalleryPage.tsx @@ -0,0 +1,16 @@ +import { EmptyState } from "../components/EmptyState"; +import { useT } from "../i18n/I18nProvider"; + +/* The gallery. Phase 2 gives it something to show; until /captures exists + * there is nothing to fetch, so this is honestly empty rather than filled + * with fake rows that would hide layout problems. */ +export function GalleryPage() { + const t = useT(); + + return ( +
+

{t("gallery.title")}

+ +
+ ); +} diff --git a/web/src/pages/SystemPage.tsx b/web/src/pages/SystemPage.tsx new file mode 100644 index 0000000..f28d0e8 --- /dev/null +++ b/web/src/pages/SystemPage.tsx @@ -0,0 +1,141 @@ +import { useQuery } from "@tanstack/react-query"; + +import { useT } from "../i18n/I18nProvider"; +import { getHealth } from "../lib/api"; +import type { HealthResponse } from "../lib/api"; +import type { Translate } from "../i18n/I18nProvider"; + +/* The only page wired to real data at Phase 3, because /health is the only + * endpoint that exists. That makes it the end-to-end proof: browser -> + * Vite proxy -> FastAPI -> PostgreSQL and back. */ + +function formatBytes(bytes: number | undefined): string { + if (bytes === undefined) return "—"; + const units = ["B", "KB", "MB", "GB", "TB"]; + let value = bytes; + let unit = 0; + while (value >= 1024 && unit < units.length - 1) { + value /= 1024; + unit += 1; + } + return `${value.toFixed(value < 10 && unit > 0 ? 1 : 0)} ${units[unit]}`; +} + +function formatUptime(seconds: number): string { + const s = Math.floor(seconds); + if (s < 60) return `${s}s`; + const m = Math.floor(s / 60); + if (m < 60) return `${m}m ${s % 60}s`; + const h = Math.floor(m / 60); + if (h < 24) return `${h}h ${m % 60}m`; + return `${Math.floor(h / 24)}d ${h % 24}h`; +} + +function Row({ label, children }: { label: string; children: React.ReactNode }) { + return ( +
+
{label}
+
{children}
+
+ ); +} + +function HealthDetail({ health, t }: { health: HealthResponse; t: Translate }) { + const dbOk = health.database.ok; + return ( + <> +
+
+ + + {health.status === "ok" ? t("system.status.ok") : t("system.status.degraded")} + + + + {health.version} + + {formatUptime(health.uptime_s)} + + {health.enroll_secret_configured ? ( + t("system.enrollSecret.set") + ) : ( + {t("system.enrollSecret.unset")} + )} + +
+
+ +
+
+ + + {dbOk ? t("system.database.ok") : t("system.database.down")} + + {health.database.error !== null && ( +
{health.database.error}
+ )} +
+ {health.database.devices ?? "—"} + {health.database.captures ?? "—"} + + {health.database.last_backup_at ? ( + new Date(health.database.last_backup_at).toLocaleString() + ) : ( + /* Not an error yet -- backups are Phase 5 and blocked on the + NAS protocol question. It becomes an alarm then, not now. */ + {t("system.lastBackup.never")} + )} + +
+
+ +
+
+ + {health.disk.available ? ( + <> + {t("system.disk.free", { + free: formatBytes(health.disk.free_bytes), + total: formatBytes(health.disk.total_bytes), + })} +
{health.disk.path}
+ + ) : ( + {t("system.disk.unavailable")} + )} +
+
+
+ + ); +} + +export function SystemPage() { + const t = useT(); + const { data, error, isPending, refetch } = useQuery({ + queryKey: ["health"], + queryFn: getHealth, + refetchInterval: 15_000, + retry: false, + }); + + return ( +
+

{t("system.title")}

+ + {isPending &&

{t("common.loading")}

} + + {error !== null && !isPending && ( +
+

{t("system.unreachable.title")}

+

{t("system.unreachable.body")}

+ +
+ )} + + {data !== undefined && } +
+ ); +} diff --git a/web/src/router.tsx b/web/src/router.tsx new file mode 100644 index 0000000..95c067a --- /dev/null +++ b/web/src/router.tsx @@ -0,0 +1,58 @@ +/* Routes, defined in code rather than by file convention. + * + * One file, flat, so the whole route table is visible at once. TanStack + * Router's value here is that is type-checked: a typo in + * a path is a build error, not a 404 you find later. + */ + +import { + createRootRoute, + createRoute, + createRouter, +} from "@tanstack/react-router"; + +import { AppLayout } from "./components/AppLayout"; +import { DevicesPage } from "./pages/DevicesPage"; +import { GalleryPage } from "./pages/GalleryPage"; +import { SystemPage } from "./pages/SystemPage"; + +const rootRoute = createRootRoute({ component: AppLayout }); + +/* NOT GATED YET. + * + * Once Phase 3 lands /auth/session, /auth/login and /auth/logout, wrap these + * components in (and pass `roles={["admin"]}` for the device + * and system routes, per SPEC 3.1). The component is written and waiting in + * auth/RequireAuth.tsx. + * + * Doing it now would leave the app unusable behind a login form that cannot + * succeed, so instead it is ungated and says so in a banner. */ +const galleryRoute = createRoute({ + getParentRoute: () => rootRoute, + path: "/", + component: GalleryPage, +}); + +const devicesRoute = createRoute({ + getParentRoute: () => rootRoute, + path: "/devices", + component: DevicesPage, +}); + +const systemRoute = createRoute({ + getParentRoute: () => rootRoute, + path: "/system", + component: SystemPage, +}); + +const routeTree = rootRoute.addChildren([galleryRoute, devicesRoute, systemRoute]); + +export const router = createRouter({ routeTree }); + +/* Teaches TypeScript about this specific router, which is what makes + * paths checked. Without it, `to` is just a string. */ +declare module "@tanstack/react-router" { + interface Register { + router: typeof router; + } +} diff --git a/web/src/styles/global.css b/web/src/styles/global.css new file mode 100644 index 0000000..62cced8 --- /dev/null +++ b/web/src/styles/global.css @@ -0,0 +1,360 @@ +/* Base styles. Every colour is a token from tokens.css -- no literals here, + * so adding a theme never means touching this file. */ + +*, +*::before, +*::after { + box-sizing: border-box; +} + +html, +body, +#root { + height: 100%; +} + +body { + margin: 0; + background: var(--bg); + color: var(--text); + font-family: var(--font-sans); + font-size: var(--text-base); + line-height: 1.5; + -webkit-font-smoothing: antialiased; +} + +a { + color: var(--accent); +} + +code, +.mono-small { + font-family: var(--font-mono); +} + +.mono-small { + font-size: var(--text-xs); + color: var(--text-muted); + word-break: break-all; +} + +.muted { + color: var(--text-muted); +} + +.warn { + color: var(--warning); +} + +.visually-hidden { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip-path: inset(50%); + white-space: nowrap; +} + +/* --- shell ----------------------------------------------------------- */ + +.app { + display: flex; + flex-direction: column; + min-height: 100%; +} + +.header { + display: flex; + align-items: center; + gap: var(--space-5); + height: var(--header-height); + padding: 0 var(--space-4); + background: var(--surface); + border-bottom: 1px solid var(--border); +} + +.brand { + display: inline-flex; + align-items: center; + gap: var(--space-2); + color: var(--text); + font-weight: 600; + text-decoration: none; + white-space: nowrap; +} + +.brand-mark { + width: 12px; + height: 12px; + border-radius: 50%; + background: var(--accent); +} + +.nav { + display: flex; + gap: var(--space-1); + flex: 1; + min-width: 0; + overflow-x: auto; +} + +.nav-link { + padding: var(--space-2) var(--space-3); + border-radius: var(--radius); + color: var(--text-muted); + text-decoration: none; + white-space: nowrap; + transition: background var(--transition), color var(--transition); +} + +.nav-link:hover { + background: var(--surface-sunken); + color: var(--text); +} + +.nav-link.is-active { + background: var(--accent-subtle); + color: var(--accent); +} + +.header-tools { + display: flex; + gap: var(--space-2); +} + +.banner { + margin: 0; + padding: var(--space-2) var(--space-4); + background: var(--accent-subtle); + color: var(--text); + border-bottom: 1px solid var(--border); + font-size: var(--text-sm); +} + +.main { + flex: 1; + width: 100%; + max-width: 1100px; + margin: 0 auto; + padding: var(--space-6) var(--space-4); +} + +.page-title { + margin: 0 0 var(--space-5); + font-size: var(--text-2xl); + font-weight: 650; + letter-spacing: -0.01em; +} + +.centered-page { + display: grid; + place-items: center; + min-height: 60vh; + padding: var(--space-4); +} + +/* --- surfaces -------------------------------------------------------- */ + +.card { + background: var(--surface); + border: 1px solid var(--border); + border-radius: var(--radius-lg); + box-shadow: var(--shadow); + padding: var(--space-5); + margin-bottom: var(--space-4); +} + +.rows { + margin: 0; + display: grid; + gap: var(--space-4); +} + +.row { + display: grid; + grid-template-columns: minmax(140px, 220px) 1fr; + gap: var(--space-4); + align-items: baseline; +} + +.row-label { + color: var(--text-muted); + font-size: var(--text-sm); +} + +.row-value { + margin: 0; + min-width: 0; +} + +.pill { + display: inline-block; + padding: 2px var(--space-2); + border-radius: 999px; + font-size: var(--text-xs); + font-weight: 600; + border: 1px solid currentcolor; +} + +.pill-ok { + color: var(--success); +} +.pill-warn { + color: var(--warning); +} +.pill-danger { + color: var(--danger); +} + +.empty-state { + background: var(--surface); + border: 1px dashed var(--border-strong); + border-radius: var(--radius-lg); + padding: var(--space-7) var(--space-5); + text-align: center; +} + +.empty-title { + margin: 0 0 var(--space-2); + font-size: var(--text-lg); +} + +.empty-body { + margin: 0 auto; + max-width: 46ch; + color: var(--text-muted); +} + +.alert { + padding: var(--space-3); + border-radius: var(--radius); + font-size: var(--text-sm); + margin: 0; +} + +.alert-danger { + color: var(--danger); + border: 1px solid var(--danger); + background: transparent; +} + +/* --- controls -------------------------------------------------------- */ + +.field { + display: grid; + gap: var(--space-1); +} + +.field-label { + font-size: var(--text-sm); + color: var(--text-muted); +} + +.field-hint { + font-size: var(--text-xs); + color: var(--text-muted); +} + +.input, +.select { + width: 100%; + padding: var(--space-2) var(--space-3); + background: var(--surface-raised); + color: var(--text); + border: 1px solid var(--border-strong); + border-radius: var(--radius); + font: inherit; + font-size: var(--text-sm); +} + +.select { + width: auto; +} + +.input:focus-visible, +.select:focus-visible, +.button:focus-visible, +.nav-link:focus-visible, +.brand:focus-visible { + outline: 2px solid var(--accent); + outline-offset: 2px; +} + +.button { + padding: var(--space-2) var(--space-4); + background: var(--surface-raised); + color: var(--text); + border: 1px solid var(--border-strong); + border-radius: var(--radius); + font: inherit; + font-size: var(--text-sm); + font-weight: 550; + cursor: pointer; + transition: background var(--transition), border-color var(--transition); +} + +.button:hover:not(:disabled) { + border-color: var(--accent); +} + +.button:disabled { + opacity: 0.6; + cursor: default; +} + +.button-primary { + background: var(--accent); + border-color: var(--accent); + color: var(--text-inverse); +} + +.button-primary:hover:not(:disabled) { + background: var(--accent-hover); + border-color: var(--accent-hover); +} + +.login-card { + width: min(380px, 100%); + display: grid; + gap: var(--space-4); + margin: 0; +} + +.login-title { + margin: 0; + font-size: var(--text-xl); +} + +/* --- small screens ---------------------------------------------------- */ + +@media (max-width: 640px) { + .header { + flex-wrap: wrap; + height: auto; + padding: var(--space-3) var(--space-4); + gap: var(--space-3); + } + + .nav { + order: 3; + width: 100%; + } + + .row { + grid-template-columns: 1fr; + gap: var(--space-1); + } + + .main { + padding: var(--space-5) var(--space-4); + } +} + +@media (prefers-reduced-motion: reduce) { + * { + transition-duration: 0.01ms !important; + animation-duration: 0.01ms !important; + } +} diff --git a/web/src/styles/tokens.css b/web/src/styles/tokens.css new file mode 100644 index 0000000..f5ce30e --- /dev/null +++ b/web/src/styles/tokens.css @@ -0,0 +1,126 @@ +/* Design tokens. + * + * Three themes, selected by `data-theme` on : light, dark, blue. + * Components never write a colour literal -- they reference a token, so a + * fourth theme is a block in this file and nothing else. + * + * Contrast: every text/background pair below meets WCAG AA (>= 4.5:1 for body + * text, >= 3:1 for large text and UI borders). `npm run check:contrast` + * asserts it -- run it after touching any colour here, because this is + * exactly the kind of thing that regresses silently. + */ + +:root { + /* --- shape and space (theme-independent) --- */ + --radius-sm: 4px; + --radius: 8px; + --radius-lg: 14px; + + --space-1: 4px; + --space-2: 8px; + --space-3: 12px; + --space-4: 16px; + --space-5: 24px; + --space-6: 32px; + --space-7: 48px; + + --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, + "Helvetica Neue", Arial, sans-serif; + --font-mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, + "Liberation Mono", monospace; + + --text-xs: 0.75rem; + --text-sm: 0.875rem; + --text-base: 1rem; + --text-lg: 1.125rem; + --text-xl: 1.5rem; + --text-2xl: 2rem; + + --transition: 120ms ease; + --header-height: 56px; +} + +/* --- light ---------------------------------------------------------- */ +:root, +[data-theme="light"] { + color-scheme: light; + + --bg: #f6f8fb; + --surface: #ffffff; + --surface-raised: #ffffff; + --surface-sunken: #eef2f7; + /* --border is decorative (dividers, card edges) and is exempt from the + contrast rule. --border-strong bounds interactive controls -- inputs, + focus rings -- so WCAG 1.4.11 wants 3:1 against the surface behind it. */ + --border: #dde3ec; + --border-strong: #848f9e; + + --text: #14202e; + --text-muted: #56677d; + --text-inverse: #ffffff; + + --accent: #1257c4; + --accent-hover: #0e46a0; + --accent-subtle: #e4edfb; + + --success: #17724a; + --warning: #8a5a00; + --danger: #b3242c; + + --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 4px 12px rgb(16 24 40 / 8%); + --overlay: rgb(16 24 40 / 40%); +} + +/* --- dark (neutral) ------------------------------------------------- */ +[data-theme="dark"] { + color-scheme: dark; + + --bg: #121417; + --surface: #191c21; + --surface-raised: #21252b; + --surface-sunken: #0d0f12; + --border: #2e343c; + --border-strong: #656d7a; + + --text: #e8eaed; + --text-muted: #a3adba; + --text-inverse: #10141a; + + --accent: #6ba1ff; + --accent-hover: #8bb6ff; + --accent-subtle: #1b2534; + + --success: #3dd68c; + --warning: #f0b429; + --danger: #ff6b71; + + --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 8px 24px rgb(0 0 0 / 40%); + --overlay: rgb(0 0 0 / 60%); +} + +/* --- blue (dark navy) ----------------------------------------------- */ +[data-theme="blue"] { + color-scheme: dark; + + --bg: #0b1220; + --surface: #111c2e; + --surface-raised: #17253b; + --surface-sunken: #070d17; + --border: #22344f; + --border-strong: #5a7196; + + --text: #e6edf7; + --text-muted: #9fb3ce; + --text-inverse: #0b1220; + + --accent: #4c8dff; + --accent-hover: #6ba1ff; + --accent-subtle: #152740; + + --success: #3dd68c; + --warning: #f0b429; + --danger: #f2545b; + + --shadow: 0 1px 2px rgb(0 0 0 / 45%), 0 8px 28px rgb(3 8 18 / 55%); + --overlay: rgb(4 9 18 / 65%); +} diff --git a/web/src/theme/ThemeProvider.tsx b/web/src/theme/ThemeProvider.tsx new file mode 100644 index 0000000..d767112 --- /dev/null +++ b/web/src/theme/ThemeProvider.tsx @@ -0,0 +1,64 @@ +/* Theme selection. + * + * The chosen theme is written to `data-theme` on , which is what + * tokens.css keys off. Persistence is localStorage for now; once accounts + * exist (Phase 3) the server-side `users.theme` column becomes the source of + * truth and this stays as the pre-login default and the first-paint value. + * + * The flash-of-wrong-theme is prevented by an inline script in index.html, + * which runs before React and before first paint. Keep the storage key and + * the attribute name in sync with that script. + */ + +import { createContext, useCallback, useContext, useEffect, useMemo, useState } from "react"; +import type { ReactNode } from "react"; + +export const THEMES = ["light", "dark", "blue"] as const; +export type Theme = (typeof THEMES)[number]; + +const STORAGE_KEY = "poorbird.theme"; + +interface ThemeValue { + theme: Theme; + setTheme: (theme: Theme) => void; +} + +const ThemeContext = createContext(null); + +function isTheme(value: unknown): value is Theme { + return typeof value === "string" && (THEMES as readonly string[]).includes(value); +} + +function initialTheme(): Theme { + // The inline script has already decided and applied one; read it back so + // React and the DOM never disagree. + const applied = document.documentElement.getAttribute("data-theme"); + if (isTheme(applied)) return applied; + return "blue"; +} + +export function ThemeProvider({ children }: { children: ReactNode }) { + const [theme, setThemeState] = useState(initialTheme); + + useEffect(() => { + document.documentElement.setAttribute("data-theme", theme); + try { + localStorage.setItem(STORAGE_KEY, theme); + } catch { + // Blocked storage: the theme applies, it just will not be remembered. + } + }, [theme]); + + const setTheme = useCallback((next: Theme) => setThemeState(next), []); + const value = useMemo(() => ({ theme, setTheme }), [theme, setTheme]); + + return {children}; +} + +export function useTheme(): ThemeValue { + const value = useContext(ThemeContext); + if (value === null) { + throw new Error("useTheme must be used inside "); + } + return value; +} diff --git a/web/tsconfig.json b/web/tsconfig.json new file mode 100644 index 0000000..e2e474f --- /dev/null +++ b/web/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "target": "ES2022", + "lib": ["ES2022", "DOM", "DOM.Iterable"], + "module": "ESNext", + "moduleResolution": "bundler", + "jsx": "react-jsx", + + /* Strict on purpose. Learning TypeScript with the checks off teaches you + a different language than the one everyone else is writing. */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedIndexedAccess": true, + + /* Requires `import type { X }` for type-only imports. The error message + says exactly what to do, and it keeps types out of the JS bundle. */ + "verbatimModuleSyntax": true, + + "skipLibCheck": true, + "noEmit": true, + "isolatedModules": true, + "types": ["vite/client"] + }, + "include": ["src", "vite.config.ts"] +} diff --git a/web/vite.config.ts b/web/vite.config.ts new file mode 100644 index 0000000..3c20636 --- /dev/null +++ b/web/vite.config.ts @@ -0,0 +1,24 @@ +import react from "@vitejs/plugin-react"; +import { defineConfig } from "vite"; + +export default defineConfig({ + plugins: [react()], + server: { + port: 5173, + // The dev server proxies the API so the browser only ever talks to one + // origin. No CORS config on the server, and cookies behave the same in + // development as they will in production behind Caddy. + proxy: { + "/api": { + target: "http://127.0.0.1:8090", + changeOrigin: true, + }, + }, + }, + build: { + // Caddy serves this directory as static files. Nothing here runs on the + // server; the whole app is built on the dev machine (SPEC 6). + outDir: "dist", + sourcemap: true, + }, +});