Compare commits

...

3 commits

Author SHA1 Message Date
44bc6207a9 feat(ui): polish pass - visual refresh, dark mode, smoother map, mobile sheet
Visual
- Design tokens (spacing, radius, type, motion) with a dark theme that follows
  prefers-color-scheme; map palette in theme.ts (exports/print stay light)
- Segmented controls (language, colour scheme), switches, styled slider/select,
  icon buttons, cards, focus rings, hover/active states, reduced-motion support
- Info panel card with animation, tooltip that stays on screen, grouped zoom buttons

Map
- Redraws batched per animation frame; animated zoom/fit, pan inertia,
  trackpad pinch, pointer cursor and outline for the hovered building
- Hovering a legend row highlights that category on the map

Loading & feedback
- Progress bar + "Loading n/m" pill; status line with icons, collapsible
  basemap failure details, success messages fade
- A newer load supersedes one in flight; a failed buildings query is reported
  immediately instead of after the basemap retries

Convenience
- Keyboard: +/- zoom, 0 fit, arrows pan, Esc closes
- Legend All/None, double-click or Alt-click to show only one category
- Settings and last location remembered; #lat,lon,radius in the URL to share,
  copy-link button, "my location" button
- Mobile: full-screen map with a draggable bottom sheet

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 12:01:08 +01:00
5a3ee9ab86 refactor: render the UI with Preact and signals
- Sidebar, legend, status, info panel and tooltip are Preact components (src/components)
- App state that the UI or map depends on is held in @preact/signals; the map redraws
  through a signal effect, pan/zoom still redraw directly
- Classification is a computed signal (buildings) instead of manual classifyAll calls
- index.html is just a mount point; CSS is imported from main.tsx

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 11:41:17 +01:00
4f9c11039b refactor: split into TypeScript modules built with Vite
- Move the single-file app into src/ as typed ES modules
- Vite for dev server and minified production build (bun run dev / build)
- oxfmt/oxlint config; rename useName -> ruianUseName (hooks lint false positive)
- Fix horizontal overflow in the sidebar (range input default margin)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 11:32:26 +01:00
37 changed files with 4281 additions and 756 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
node_modules/
dist/

12
.oxfmtrc.json Normal file
View file

@ -0,0 +1,12 @@
{
"$schema": "./node_modules/oxfmt/configuration_schema.json",
"semi": false,
"singleQuote": true,
"printWidth": 100,
"sortTailwindcss": {
"stylesheet": "./src/index.css"
},
"ignorePatterns": [
"bun.lock"
]
}

32
.oxlintrc.json Normal file
View file

@ -0,0 +1,32 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": [
"typescript",
"oxc",
"unicorn",
"import",
"vitest"
],
"categories": {
"correctness": "error",
"suspicious": "warn",
"perf": "warn"
},
"env": {
"browser": true,
"es2024": true
},
"ignorePatterns": [
"dist"
],
"rules": {
"import/no-unassigned-import": [
"warn",
{
"allow": [
"**/*.css"
]
}
]
}
}

375
bun.lock Normal file
View file

@ -0,0 +1,375 @@
{
"lockfileVersion": 1,
"configVersion": 0,
"workspaces": {
"": {
"name": "building-use-map",
"dependencies": {
"@preact/signals": "^2.11.4",
"preact": "^11.2.0",
},
"devDependencies": {
"@preact/preset-vite": "^2.10.6",
"oxfmt": "^0.77.0",
"oxlint": "^1.92.0",
"typescript": "^7.0.2",
"vite": "^8.3.6",
},
},
},
"packages": {
"@babel/code-frame": ["@babel/code-frame@7.29.7", "", { "dependencies": { "@babel/helper-validator-identifier": "^7.29.7", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" } }, "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw=="],
"@babel/compat-data": ["@babel/compat-data@7.29.7", "", {}, "sha512-locTkQyKvwIEgBzVrn8693ebc97F2U8ZHjbXwDXJ5Fn2TCpNwTlKcaKLkdHop5c/icOFE7qt7Q9JC5hnKNa6Gg=="],
"@babel/core": ["@babel/core@7.29.13", "", { "dependencies": { "@babel/code-frame": "^7.29.7", "@babel/generator": "^7.29.13", "@babel/helper-compilation-targets": "^7.29.13", "@babel/helper-module-transforms": "^7.29.13", "@babel/helpers": "^7.29.13", "@babel/parser": "^7.29.13", "@babel/template": "^7.29.7", "@babel/traverse": "^7.29.13", "@babel/types": "^7.29.11", "@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" } }, "sha512-j1nvOQCZYSgp7HLmisnCXFTpVvFODiijQ9QHkORfGKWH6YDtskTEeCJS7eV545GZ9UBzrq0e2xsOd5QQ5PjIqw=="],
"@babel/generator": ["@babel/generator@7.29.13", "", { "dependencies": { "@babel/parser": "^7.29.13", "@babel/types": "^7.29.11", "@jridgewell/gen-mapping": "^0.3.12", "@jridgewell/trace-mapping": "^0.3.28", "jsesc": "^3.0.2" } }, "sha512-T5FRo+RzVHvGjWOuF1Ljc44b+NXAOazodHkGUHp4I3zCkQ4/sNVJm56h1S278LMR0bY5xBhztGziSbli8zObIw=="],
"@babel/helper-annotate-as-pure": ["@babel/helper-annotate-as-pure@7.29.7", "", { "dependencies": { "@babel/types": "^7.29.7" } }, "sha512-OoK6239jHPuSQOoS0kfTVKn0b/rVTk0seKq4Gd2UMLtmOVLjDC0ki3e+c90Trqv2gMfvJFqkiljrr568+qddiw=="],
"@babel/helper-compilation-targets": ["@babel/helper-compilation-targets@7.29.13", "", { "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" } }, "sha512-8WxJ4/Vmes3ghacj8VOJy3NW8eyHiFY/4thU/LSBuBE470+igjR/j1ZTNn8fV5VdNrLx6iXUwig526UdOvfP0w=="],
"@babel/helper-globals": ["@babel/helper-globals@7.29.7", "", {}, "sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA=="],
"@babel/helper-module-imports": ["@babel/helper-module-imports@7.29.7", "", { "dependencies": { "@babel/traverse": "^7.29.7", "@babel/types": "^7.29.7" } }, "sha512-ejHwrQQYcm9xnTivShn2IDOlIzInN34AXskvq9QicvCtEzq1Vzclu/tKF8Jq1Cg8JG2GL6/EmjgsCT7lXepE3g=="],
"@babel/helper-module-transforms": ["@babel/helper-module-transforms@7.29.13", "", { "dependencies": { "@babel/helper-module-imports": "^7.29.7", "@babel/helper-validator-identifier": "^7.29.7", "@babel/traverse": "^7.29.13" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-/U96wOz+SCoZ7Da/8kjDGltcNY280JPQcRNPK0Hk3PTbdpaiBDQImtC6JsbVwb1HGMr3usZQU2WsWVjhYNmRzw=="],
"@babel/helper-plugin-utils": ["@babel/helper-plugin-utils@7.29.7", "", {}, "sha512-G7sHYigPY17oO5SYWnfD/0MTBwVR781S/JI643e/JhUYgVgWE/61SoW3NH9KWUKyKq5LVh3npif99Wkt6j86Jw=="],
"@babel/helper-string-parser": ["@babel/helper-string-parser@7.29.13", "", {}, "sha512-fWegr+WsEsiMVW4KUNdIIzzMTZSzNiqhy0//6+2MRi2d5NFNsL/AYwBQW8eBnRbTBVRnDVzjaJEUqKaCWjMMdQ=="],
"@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.29.7", "", {}, "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg=="],
"@babel/helper-validator-option": ["@babel/helper-validator-option@7.29.7", "", {}, "sha512-N9ZErrD+yW5geCDtBqnOoxmR8+tNKiGuxKlDpuJxfsqpa2dFcexaziGAE/qoHLiDDreVNMupxGmSoNlyvsA3gw=="],
"@babel/helpers": ["@babel/helpers@7.29.13", "", { "dependencies": { "@babel/template": "^7.29.7", "@babel/types": "^7.29.11" } }, "sha512-laoRpD/kO/iA4CDlgJbixHekg7oPvWALK0PQyK3Ob2I2njZRvVAD77RfWCIImtqWCq6KijoBoZK7bp/HlTWASQ=="],
"@babel/parser": ["@babel/parser@7.29.13", "", { "dependencies": { "@babel/types": "^7.29.11" }, "bin": "./bin/babel-parser.js" }, "sha512-fJM50YYjlTiBhgdkGmC1tBpv+FMAyo4annf2X6Aks+0yRlaiVkYW/3f07xAfVVkYIoZ9fFZp+mEThUFnuybhkQ=="],
"@babel/plugin-syntax-jsx": ["@babel/plugin-syntax-jsx@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-TSu8+mHCoEaaCDEZ0I3+6mvTBYR4PCxQwf2z9/r5Tbztv6NaLR3B9thGTTxX2WGuGHJqRiAbKPeGTJ5XWXVg6A=="],
"@babel/plugin-transform-react-jsx": ["@babel/plugin-transform-react-jsx@7.29.7", "", { "dependencies": { "@babel/helper-annotate-as-pure": "^7.29.7", "@babel/helper-module-imports": "^7.29.7", "@babel/helper-plugin-utils": "^7.29.7", "@babel/plugin-syntax-jsx": "^7.29.7", "@babel/types": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-WsZulLVBUHXVj2cUcPVx6UE21TpalB6bHbSFErKT0Ib++ax24jjXe73FqlWvdylFOjiuPHYi6VCcgRad1ItN+A=="],
"@babel/plugin-transform-react-jsx-development": ["@babel/plugin-transform-react-jsx-development@7.29.7", "", { "dependencies": { "@babel/plugin-transform-react-jsx": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-Xfy3UVMF04+ypnFbkhvfqtmvwfe92qwQdbGZVonhE+6v35GzlofmOnA1szaZqzb9xYWr0nl1e5EMmzi0DNON1g=="],
"@babel/template": ["@babel/template@7.29.7", "", { "dependencies": { "@babel/code-frame": "^7.29.7", "@babel/parser": "^7.29.7", "@babel/types": "^7.29.7" } }, "sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg=="],
"@babel/traverse": ["@babel/traverse@7.29.13", "", { "dependencies": { "@babel/code-frame": "^7.29.7", "@babel/generator": "^7.29.13", "@babel/helper-globals": "^7.29.7", "@babel/parser": "^7.29.13", "@babel/template": "^7.29.7", "@babel/types": "^7.29.11", "debug": "^4.3.1" } }, "sha512-0ve0xMlFA73dgY1oyJRY6RoW+/bncdcOQqg6jjYcVfXBK90OdLXjm9R6lmRetdZVrPjXkKIoMVBqYFPjcAlZ4Q=="],
"@babel/types": ["@babel/types@7.29.11", "", { "dependencies": { "@babel/helper-string-parser": "^7.29.11", "@babel/helper-validator-identifier": "^7.29.7" } }, "sha512-WCsemW40Cpc6gouC1SrY6PBaZ+oLRlEVY9XBvZBI7il/HyUrb2nJ505wE1MHEFyDZNnrWDEuy4jL50WVHfTTSQ=="],
"@jridgewell/gen-mapping": ["@jridgewell/gen-mapping@0.3.13", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA=="],
"@jridgewell/remapping": ["@jridgewell/remapping@2.3.5", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ=="],
"@jridgewell/resolve-uri": ["@jridgewell/resolve-uri@3.1.2", "", {}, "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw=="],
"@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.6.0", "", {}, "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw=="],
"@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.31", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="],
"@oxc-project/types": ["@oxc-project/types@0.156.0", "", {}, "sha512-1Duyg48TdJNdyhEB8Xn1L36bT9Pv6GUtlKjHxOys8xkaF/rQq3XJE+bAurSK/AgIz5mGFsb77cn9Pb20+WCScw=="],
"@oxfmt/binding-android-arm-eabi": ["@oxfmt/binding-android-arm-eabi@0.77.0", "", { "os": "android", "cpu": "arm" }, "sha512-zmPiuOvkuu0csMx4U3gdMunIFWNcWulzikFMdAPBzLazVAA3LhdHzv9yzgUgAckv/zje5vz4XJcseNQKdSsWMw=="],
"@oxfmt/binding-android-arm64": ["@oxfmt/binding-android-arm64@0.77.0", "", { "os": "android", "cpu": "arm64" }, "sha512-shXOIK9sj3bvt4H6K47qFWNKaYBwEhzj97iUwoLGyyRDrXt1OdAAuCiupCinG1i7ETL81knjEKeB+JmhOOfPew=="],
"@oxfmt/binding-darwin-arm64": ["@oxfmt/binding-darwin-arm64@0.77.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-lrTX0I54buv9CW2leEWchWLdfcrblZ5Rj8uAilKzBEyWif8CTN6zBHdFc12K1b6U2cnlvOFBd1LxdLdqLKX2EA=="],
"@oxfmt/binding-darwin-x64": ["@oxfmt/binding-darwin-x64@0.77.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-SD44K3x/Im8EsOtdHxjVmTBi0cafAaunRpCeq+w91tkD2keqYagR8oAvxkJHUK+KPg5NQk7JZqQnzGHnVEBrDw=="],
"@oxfmt/binding-freebsd-x64": ["@oxfmt/binding-freebsd-x64@0.77.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-N+gUflsCx3FAVkxi5sxGlL5LwO+7pv5NexHJufBqPyl3BcPv1rXpfwqhL/Vj+XfshfoxMFTBbzrbJgGVaPVkAw=="],
"@oxfmt/binding-linux-arm-gnueabihf": ["@oxfmt/binding-linux-arm-gnueabihf@0.77.0", "", { "os": "linux", "cpu": "arm" }, "sha512-DXGwP8818IUZ4cxcfugg9PXqnI6fVCWIqgCgBoUKdl/QhJF4Po+lucJBrnrX/b5BNKwVMc3xSrvbI9rl8+RrBA=="],
"@oxfmt/binding-linux-arm-musleabihf": ["@oxfmt/binding-linux-arm-musleabihf@0.77.0", "", { "os": "linux", "cpu": "arm" }, "sha512-HUiJTgdV10PkCW41nHqVYYlW8Uc+39YBOoluZLfJE2MBPKVTNElhL+vpdSEuVaCGhGkzOGR6XyxM37gu31L1Qw=="],
"@oxfmt/binding-linux-arm64-gnu": ["@oxfmt/binding-linux-arm64-gnu@0.77.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-+w3V07y6yy8FdACnGtzgDsG/CHgA0Y/W2/bzZuPYgvBAa23Lap/nmvyNQmCiGKkSaChTPlY7QpIShGGAC7IGEQ=="],
"@oxfmt/binding-linux-arm64-musl": ["@oxfmt/binding-linux-arm64-musl@0.77.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-FASxWQAuLW4WXFViDa77ybd3Y1lbkBx5DTtL4OGl+pL64/ymtydTFvJM0xz/0vnCirNzPUDAI6TiTBDGsFbEVg=="],
"@oxfmt/binding-linux-ppc64-gnu": ["@oxfmt/binding-linux-ppc64-gnu@0.77.0", "", { "os": "linux", "cpu": "ppc64" }, "sha512-WRdlgZahG35zCieq7Po7QU8mBgkFAIdEpgS5p3vVZrHt0FXTbFgzqC7xeBCceh9gpFGgr4VWblULNnU8gdw0DA=="],
"@oxfmt/binding-linux-riscv64-gnu": ["@oxfmt/binding-linux-riscv64-gnu@0.77.0", "", { "os": "linux", "cpu": "none" }, "sha512-CVzNO94x/UzQe/INVUu9qt5X1MjLEooqwc/5VcQ88eyLXiEIIsjubpPQgwEMKwfWtAA5hnpFL2GF74zSdCg07Q=="],
"@oxfmt/binding-linux-riscv64-musl": ["@oxfmt/binding-linux-riscv64-musl@0.77.0", "", { "os": "linux", "cpu": "none" }, "sha512-NrCcVheqL0kRUi9gptqjkQhxSFayotM+zycC3lSOSrsf5SroZq49u66ShyuZkHCCzKPHB0AT0pL/s+ET9R3qQQ=="],
"@oxfmt/binding-linux-s390x-gnu": ["@oxfmt/binding-linux-s390x-gnu@0.77.0", "", { "os": "linux", "cpu": "s390x" }, "sha512-LWDQ9T/Bo/kt/q223j9fYLiNTkUYyuMkk7ZrIsIAV7l19MmuKxgd/1tZ8xhoUuVIdsyET7sJrQ6X/vRG6V+bZQ=="],
"@oxfmt/binding-linux-x64-gnu": ["@oxfmt/binding-linux-x64-gnu@0.77.0", "", { "os": "linux", "cpu": "x64" }, "sha512-5JbOT3ucC/2kROUjyyOW06FjXO8trPjYb+kE7E7cLxmpGAnw0jjeU4Tjg4C8H9JR1MZ2oH4fXE1NqLNZ89ISnw=="],
"@oxfmt/binding-linux-x64-musl": ["@oxfmt/binding-linux-x64-musl@0.77.0", "", { "os": "linux", "cpu": "x64" }, "sha512-/q9p495bmmKtxqWlIrNiJ15hoddgk/jPvJwMW6Nh796UgVRMTCKD7yI+AAL7/7xWlC3+2ls5l1RPywuV4lOdlw=="],
"@oxfmt/binding-openharmony-arm64": ["@oxfmt/binding-openharmony-arm64@0.77.0", "", { "os": "none", "cpu": "arm64" }, "sha512-tmN3OEI38xXr48UeAkQMAX1jMHszVHv4I9lzh44DKrMlIFxEU0aBYl3Zs7PzRBuJOLR7h77m6bUlCh0E06MVXw=="],
"@oxfmt/binding-win32-arm64-msvc": ["@oxfmt/binding-win32-arm64-msvc@0.77.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-v//nJMk72xRT+/9QB9mJWEPV3/5XncMvxtYQAYbAsv5VcxLlRcbj2n2srQSERglVcTft4jI3MK30ceCoRcDTJg=="],
"@oxfmt/binding-win32-ia32-msvc": ["@oxfmt/binding-win32-ia32-msvc@0.77.0", "", { "os": "win32", "cpu": "ia32" }, "sha512-D3SMXWBkVogzAlzd3RfMaFuHOTdPpRDFT+jVbtXszWwck9PCK4hYoRoncjuAjWZuWzRFND3/Mk91qFvJyoJbLA=="],
"@oxfmt/binding-win32-x64-msvc": ["@oxfmt/binding-win32-x64-msvc@0.77.0", "", { "os": "win32", "cpu": "x64" }, "sha512-2vyyODjP1Sb830rTVgfFqZoIUYF8uYdGx9S/Usih+Av6gQ9QyxXzwEGXS7poxfsxxQftZW1IbcFlhvQkeDRekQ=="],
"@oxlint/binding-android-arm-eabi": ["@oxlint/binding-android-arm-eabi@1.92.0", "", { "os": "android", "cpu": "arm" }, "sha512-k3Sd4ixQfiOrybv1gT+AMI81HSdtAFsiCFx+xXxWdFkmKW2HNrSiOfwn20o5nl/ggwbzU1oNLDeU/fRPinTVZQ=="],
"@oxlint/binding-android-arm64": ["@oxlint/binding-android-arm64@1.92.0", "", { "os": "android", "cpu": "arm64" }, "sha512-OZzgEuiTSG11QkBWdXEguiLOT6lL09KtfcC/BmvUQWBAjU5eVyBxIAsmWAXv8L85/eT6RE0GBEWTEFBAbYE74g=="],
"@oxlint/binding-darwin-arm64": ["@oxlint/binding-darwin-arm64@1.92.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-We6XS7tIqxgUoany6uyGjj7mNsh/mwf4Gt9gUzhxG65NKo2Ow9s6tDfrVuI0FVg8n3YmpW5PBx80qFxiLwAfsA=="],
"@oxlint/binding-darwin-x64": ["@oxlint/binding-darwin-x64@1.92.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-jKJWijmi6AxAZcXXWA6R/NLVZHxoRTbIMnV8znsHzeiVfuEefYcyR8SJGfbBPmkG+kveLFRcBGw0fBrjLqtGmQ=="],
"@oxlint/binding-freebsd-x64": ["@oxlint/binding-freebsd-x64@1.92.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-wkw01wvJPM8/4jh+MV3cp11859VuBc94N2q5uOzcBgdGIRAqMCg1O0W/+xsZ1fsInvuUcv2Xo4nd1nzcKhi9kg=="],
"@oxlint/binding-linux-arm-gnueabihf": ["@oxlint/binding-linux-arm-gnueabihf@1.92.0", "", { "os": "linux", "cpu": "arm" }, "sha512-Elm6nW308MzmR8knvk0tPqQ4XE+PGKztjXv7kVZTRLkhBQZRXHUQoBLc4E30fiIuF6gkZO5f3EpJtQc4Ok/fXw=="],
"@oxlint/binding-linux-arm-musleabihf": ["@oxlint/binding-linux-arm-musleabihf@1.92.0", "", { "os": "linux", "cpu": "arm" }, "sha512-oylpBAoeogddjhTlSPsXrzGq/aeJsvaULz/hYXvWtGn/Wt8LPLC7gFhucCicbRnzEKsShrZxIA0KyHmtFNnijQ=="],
"@oxlint/binding-linux-arm64-gnu": ["@oxlint/binding-linux-arm64-gnu@1.92.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-/EWOI0wwY+74UGvC93TldpoNP8moIcidVUPbUSoX16/SEdF7ah209yxSQia4+9JdCRWYA3+yQMofXMgWKk/16Q=="],
"@oxlint/binding-linux-arm64-musl": ["@oxlint/binding-linux-arm64-musl@1.92.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-9Se7Zuazr104yc2PaluriJW2rqvtaN6FSi9MSjQgZGeYb6LKvEcJ586tpjek0l7hNQNoir8MID7OENPH6juN1w=="],
"@oxlint/binding-linux-ppc64-gnu": ["@oxlint/binding-linux-ppc64-gnu@1.92.0", "", { "os": "linux", "cpu": "ppc64" }, "sha512-88IAchs204I/xxAbAo3NRyz1m/29tn8jUAPvc4tK4FzrT2PLwZertd93ANF6231vwbAhYiD5gl0cX8Po5xsjWQ=="],
"@oxlint/binding-linux-riscv64-gnu": ["@oxlint/binding-linux-riscv64-gnu@1.92.0", "", { "os": "linux", "cpu": "none" }, "sha512-KtFdVdkfvBGcsrmnbjYJ9/XTDABnaniiwnptAcAm0pkaR2zhZ3sr/Xy+N1Xbz1Yq5Jegu7SoeNv9caTP0b5OTA=="],
"@oxlint/binding-linux-riscv64-musl": ["@oxlint/binding-linux-riscv64-musl@1.92.0", "", { "os": "linux", "cpu": "none" }, "sha512-V43CO5FPgHtwHup4H5+dIdwzZX2FhREQGsSBZx8V1UyFEAul0Q13qviKqZfSMM6G41CGtCekVpJGGOxW5v1y8Q=="],
"@oxlint/binding-linux-s390x-gnu": ["@oxlint/binding-linux-s390x-gnu@1.92.0", "", { "os": "linux", "cpu": "s390x" }, "sha512-WooxeACzGH5q34olo7JgAk7XbVkTUNfwhR/TzmhwVs/y1p2R7ZWJo14hiyxiGcoYZR1iBnbBFHectADqb/KSog=="],
"@oxlint/binding-linux-x64-gnu": ["@oxlint/binding-linux-x64-gnu@1.92.0", "", { "os": "linux", "cpu": "x64" }, "sha512-lW2pLF1oFvNN780YUCtDyoUm8oFzZGJNcOFe9RtLMX5v5+FcWfAQvHUMMPF8H8kJB0HAi3dFmWDWLa5VPuY9mw=="],
"@oxlint/binding-linux-x64-musl": ["@oxlint/binding-linux-x64-musl@1.92.0", "", { "os": "linux", "cpu": "x64" }, "sha512-2BJAAB/eqPn7iD7mFVfs+1ZVUogAYOMCTaUgjAvbtNGg2ppCDE7gcv/9VSO6GCDybdFUqlcyeyjn9hRpl1ZHog=="],
"@oxlint/binding-openharmony-arm64": ["@oxlint/binding-openharmony-arm64@1.92.0", "", { "os": "none", "cpu": "arm64" }, "sha512-iLtjNqqa/2IV5qu/3rrkpVd42Ia3yeCn4fSZoEr+m5FoGHtZvAV6J6YuU3lewg5Rg5ORGvwhdgN+7gNzwkl7tA=="],
"@oxlint/binding-win32-arm64-msvc": ["@oxlint/binding-win32-arm64-msvc@1.92.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-ryxiR3ZqB0OJzydMu+bVC3R7ZtoU7X1rI8sEgTBCCvQvgVwoCwqSFlfmhgiZ+9wZ4IdTsFeu9tdiF9KtRCbSHQ=="],
"@oxlint/binding-win32-ia32-msvc": ["@oxlint/binding-win32-ia32-msvc@1.92.0", "", { "os": "win32", "cpu": "ia32" }, "sha512-DaE9OChj4nsdEST32BP7saGu8WtjOinTy/eS88dZ0TvTfDV26ebRDhsI1rL9OKXfO+DgehzhAQMqdPr2jgfcFw=="],
"@oxlint/binding-win32-x64-msvc": ["@oxlint/binding-win32-x64-msvc@1.92.0", "", { "os": "win32", "cpu": "x64" }, "sha512-0AyhqX0ciFuEnHIL+B4PIMMX3s/IpGHNEbbUqwsNhSrzWUSlEOPw/q7qFnRsEJfiKedcqVfUE/aXYuSMtpiFyw=="],
"@preact/preset-vite": ["@preact/preset-vite@2.10.6", "", { "dependencies": { "@babel/plugin-transform-react-jsx": "^7.27.1", "@babel/plugin-transform-react-jsx-development": "^7.27.1", "@prefresh/vite": "^2.4.11", "@rollup/pluginutils": "^5.0.0", "babel-plugin-transform-hook-names": "^1.0.2", "debug": "^4.4.3", "magic-string": "^0.30.21", "picocolors": "^1.1.1", "vite-prerender-plugin": "^0.5.8", "zimmerframe": "^1.1.4" }, "peerDependencies": { "@babel/core": "7.x", "vite": "2.x || 3.x || 4.x || 5.x || 6.x || 7.x || 8.x" } }, "sha512-ZZ5RIT2ZVXg8UxRA8VZpoT8CdpDG7RFIqOT4bELqNBp85+HKvQBbgmh3gsoW1UOQXx26TLe+ZRNKI7q281Kckw=="],
"@preact/signals": ["@preact/signals@2.11.4", "", { "dependencies": { "@preact/signals-core": "^1.14.5" }, "peerDependencies": { "preact": ">= 10.25.0 || >=11.0.0-0" } }, "sha512-Rb+5RPo9gWSaHtzJeauhHxiC8KP/IF2DEPkHPEOGOnuy2wnJzRqyeLRankUCYd6ADqtxS6GnWGv6Ie343d8aYw=="],
"@preact/signals-core": ["@preact/signals-core@1.14.5", "", {}, "sha512-vcRv7Ityz5JVmeiVqIluLFzT/PDS/AlhHUpw3/aUWqcVUs6bDGIPXE/6RSC4evBNWYvnniozg5Syfj33al3gkg=="],
"@prefresh/babel-plugin": ["@prefresh/babel-plugin@0.5.4", "", { "peerDependencies": { "@babel/core": "^7.0.0 || ^8.0.0" } }, "sha512-GSwqHGVem7AjnOKAkmLNbAExqZZFddf9S3ySOwowGEsJR8vwNKJ7Z/262fov5wra8LkDVSmFw3CjMGRdLoCmRA=="],
"@prefresh/core": ["@prefresh/core@1.5.11", "", { "peerDependencies": { "preact": "^10.0.0 || ^11.0.0-0" } }, "sha512-Ml00PP8jeHaADxfQqxUs4+M5JS+T5J26UnvPVfsrmlpGw2I3e9XtM0DMeuzkmvg+Tn7VdHSMpLBrDPG0iHoDqQ=="],
"@prefresh/utils": ["@prefresh/utils@1.2.1", "", {}, "sha512-vq/sIuN5nYfYzvyayXI4C2QkprfNaHUQ9ZX+3xLD8nL3rWyzpxOm1+K7RtMbhd+66QcaISViK7amjnheQ/4WZw=="],
"@prefresh/vite": ["@prefresh/vite@2.4.12", "", { "dependencies": { "@babel/core": "^7.22.1", "@prefresh/babel-plugin": "^0.5.2", "@prefresh/core": "^1.5.0", "@prefresh/utils": "^1.2.0", "@rollup/pluginutils": "^4.2.1" }, "peerDependencies": { "preact": "^10.4.0 || ^11.0.0-0", "vite": ">=2.0.0" } }, "sha512-FY1fzXpUjiuosznMV0YM7XAOPZjB5FIdWS0W24+XnlxYkt9hNAwwsiKYn+cuTEoMtD/ZVazS5QVssBr9YhpCQA=="],
"@rolldown/binding-android-arm-eabi": ["@rolldown/binding-android-arm-eabi@1.2.16", "", { "os": "android", "cpu": "arm" }, "sha512-ia3DwAs0OsMGS7+IConptSiyk9pEXkOx/AbJ2n/lAGxH3QkWQus1t8d7gnAT38FCU2sQu8lUbeR6AiZFv4JxaA=="],
"@rolldown/binding-android-arm64": ["@rolldown/binding-android-arm64@1.2.16", "", { "os": "android", "cpu": "arm64" }, "sha512-kx5wBiMB6E7TEvpl2B9gjLU004BkvEm2Dr941BFjx/SontPwSzNuQUIoVKxHHoSjpFIfHMmcguyLOtyn0hObRg=="],
"@rolldown/binding-darwin-arm64": ["@rolldown/binding-darwin-arm64@1.2.16", "", { "os": "darwin", "cpu": "arm64" }, "sha512-qslZrXnKJU4cUpjoAmtAo/KQM9e2IRMlmpig6Zpwj+8KWxW8v+nkAf9216Bsek9lOC1jvg2yCjygCFo2f83msQ=="],
"@rolldown/binding-darwin-x64": ["@rolldown/binding-darwin-x64@1.2.16", "", { "os": "darwin", "cpu": "x64" }, "sha512-FdF+y48ND13eAyM2mQn+85kvAqNlvRWROy2rhgA463X/0Gv4vGtazZtfaF1mRBLscYvtOlh4QnLjOWiFzX69OQ=="],
"@rolldown/binding-freebsd-x64": ["@rolldown/binding-freebsd-x64@1.2.16", "", { "os": "freebsd", "cpu": "x64" }, "sha512-ddjqFM5e95AgLbUPtKIS7V1KTVlA0RUgCVr5mn+/IEhsdy3pr+Vuj/HZ7nlMN2FyxIwUktOH1LEPIQXO1v9y1Q=="],
"@rolldown/binding-linux-arm-gnueabihf": ["@rolldown/binding-linux-arm-gnueabihf@1.2.16", "", { "os": "linux", "cpu": "arm" }, "sha512-tHdKWbFkFBI687iim3LIyIvyL7j66VvQYkDPss5Stn/qyE2tWkR1YD0dXmXPFKKqT/o5ZEJVsaRsWS2meQwGOA=="],
"@rolldown/binding-linux-arm64-gnu": ["@rolldown/binding-linux-arm64-gnu@1.2.16", "", { "os": "linux", "cpu": "arm64" }, "sha512-FJiLGAblPBMlBEdbOqw6kW6QcXDWAf/oJu7gYs9ZJZwmg+K+/zjFLxPTIY9izJUzxzc24FHvmseyA0IvJSl17w=="],
"@rolldown/binding-linux-arm64-musl": ["@rolldown/binding-linux-arm64-musl@1.2.16", "", { "os": "linux", "cpu": "arm64" }, "sha512-hrJpblMsrQ58U9veWpbXzkhV5zStunds6HWLprqq1qauvgBr1E6P+24kLj6lSLI9vjRn/RYpjprhkHQPKGWpNg=="],
"@rolldown/binding-linux-ppc64-gnu": ["@rolldown/binding-linux-ppc64-gnu@1.2.16", "", { "os": "linux", "cpu": "ppc64" }, "sha512-qJd/dC6j6CwLG9/s/RP2nb1RZ0GIgj7Ioj7x/SYa3RzjVrlzrmH0fhIOpfvqQDeIsdP0loi+kHaMhJzY1PBIaA=="],
"@rolldown/binding-linux-s390x-gnu": ["@rolldown/binding-linux-s390x-gnu@1.2.16", "", { "os": "linux", "cpu": "s390x" }, "sha512-Vx7Xg5uUJuNcujJjI70OICaH0EYj80BtOLZTSN7uOYg8QOLlyKnaG0IW7Fn/J0IpJsaKzmDKMhOQv1JBM9m9vg=="],
"@rolldown/binding-linux-x64-gnu": ["@rolldown/binding-linux-x64-gnu@1.2.16", "", { "os": "linux", "cpu": "x64" }, "sha512-TNKhgE3uJTsTzatUSSYt0Kgo+Oa2uSlSjz4r1aEIea7HX6ULBym4fAlYUhG1i6pjNf2njfCUAfKwr6C3E9Xg1w=="],
"@rolldown/binding-linux-x64-musl": ["@rolldown/binding-linux-x64-musl@1.2.16", "", { "os": "linux", "cpu": "x64" }, "sha512-7chXdpjXZ8qG0+mIxECN3cT9kvhZ3/oZhMX6Pp876P7CDrIy8nJswva6Mq357JR7eYXfuskwZxMeV1SzoZdHrA=="],
"@rolldown/binding-openharmony-arm64": ["@rolldown/binding-openharmony-arm64@1.2.16", "", { "os": "none", "cpu": "arm64" }, "sha512-Kwjt+7uNTJK5/MDkGWGVO2KQPnj8yAV75dMpfwyHZrJSXWHrniOB0aUEWlVYf3H1hOqFLIStLdM5QXq6bnKmOQ=="],
"@rolldown/binding-win32-arm64-msvc": ["@rolldown/binding-win32-arm64-msvc@1.2.16", "", { "os": "win32", "cpu": "arm64" }, "sha512-/LH6WfjDRXXJz/p5xl4TmU+jpcnwcxbKEQBW/GZE0JHfN0lGIyTtsUEGaQ/q/GikkGJ2yLKe6pwm7AnEWO8pdw=="],
"@rolldown/binding-win32-x64-msvc": ["@rolldown/binding-win32-x64-msvc@1.2.16", "", { "os": "win32", "cpu": "x64" }, "sha512-1lv1KvX0Z871zfk7vw+dnXMMnHNyDwMzWG8Kv3HxDXMOhzCX4SHc7HK319fInP0i+0p9D8brkfzL7pJOaGl+tw=="],
"@rolldown/pluginutils": ["@rolldown/pluginutils@1.0.1", "", {}, "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw=="],
"@rollup/pluginutils": ["@rollup/pluginutils@5.5.1", "", { "dependencies": { "@types/estree": "^1.0.0", "estree-walker": "^2.0.2", "picomatch": "^4.0.2" }, "peerDependencies": { "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" }, "optionalPeers": ["rollup"] }, "sha512-P9ZvnfouRu4MSC+ilERaw6FmZs8zqKhpHxEs4aGDGWQAMzQGXnhvCSvoNwokfNvdt7t3Y5Y4p6gStQgezeIqug=="],
"@types/estree": ["@types/estree@1.0.10", "", {}, "sha512-lTyOMnOcmRBzdCv6/4zUZCrEhV0xrqQiUZBZtVcbmLHBXKLnN8q89v/wKRF/Q0HbwVsqbIG3o5HDoFl9sduM+g=="],
"@typescript/typescript-aix-ppc64": ["@typescript/typescript-aix-ppc64@7.0.2", "", { "os": "aix", "cpu": "ppc64" }, "sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ=="],
"@typescript/typescript-darwin-arm64": ["@typescript/typescript-darwin-arm64@7.0.2", "", { "os": "darwin", "cpu": "arm64" }, "sha512-gowzar9MwS/aRWp6f3a4KUqzRjAZjOsmGNCM6LcTgXum+dBfgsBVMN+AgvOCCbguXyick6LJhpBszxMebJ8syA=="],
"@typescript/typescript-darwin-x64": ["@typescript/typescript-darwin-x64@7.0.2", "", { "os": "darwin", "cpu": "x64" }, "sha512-SZ9xZInqApNlNGc9s0W1VSsktYSOe9cFqNOIqmN1Gs8SmkjKZYFt017G4VwPxASInODuAdbTW7sXiFUf893RgA=="],
"@typescript/typescript-freebsd-arm64": ["@typescript/typescript-freebsd-arm64@7.0.2", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-W5NH4y/J0plIIS5b2xvTEkU7JFxyqdMAOgf+Ilhl0vHQXKO5dZoxd+C/jEtq56c4F3wk71RB4BMRQ2XdI+bwYQ=="],
"@typescript/typescript-freebsd-x64": ["@typescript/typescript-freebsd-x64@7.0.2", "", { "os": "freebsd", "cpu": "x64" }, "sha512-UMGDx5sTpzNw3WiPebH7l90IWfJggEd+egHt/q6p7/Cm3zqoV7VxkGXt+3DxPIw8CcmvAB0j3sVVfbhX+M4Tpw=="],
"@typescript/typescript-linux-arm": ["@typescript/typescript-linux-arm@7.0.2", "", { "os": "linux", "cpu": "arm" }, "sha512-gffT3xPz9sR7j/YJExkyPntrI0P2EP9XbOyWzth2/Gs0RstK+90RBcO0ncXoXy/beYll1SXw846Nf2zdnEz0QQ=="],
"@typescript/typescript-linux-arm64": ["@typescript/typescript-linux-arm64@7.0.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-Qh4eU4/y3yDjnfjjyPYihMj5/ODIlmt+Bzu17OI+fiSRDW57QmU5SiN63exPRNJPKUzcc1INa1NXdrJ+MqHjUQ=="],
"@typescript/typescript-linux-loong64": ["@typescript/typescript-linux-loong64@7.0.2", "", { "os": "linux", "cpu": "none" }, "sha512-uEHck9i8hoAzXPiYRib1O7miOnz23SxIeVl6F4LXox+qov1K35jHcEW6VHKvZI+pyvl7fZEP4MCU5LYvIq1GuQ=="],
"@typescript/typescript-linux-mips64el": ["@typescript/typescript-linux-mips64el@7.0.2", "", { "os": "linux", "cpu": "none" }, "sha512-R4KvAMnE43W5Qeqb0Ly56O3mWMWIAgsMyz36DCaycd5nbg/9kzm0liw3JocfRqyJY0KPmzFjbswozXyW0DnIYA=="],
"@typescript/typescript-linux-ppc64": ["@typescript/typescript-linux-ppc64@7.0.2", "", { "os": "linux", "cpu": "ppc64" }, "sha512-DORx5b3sd/4S7eayxm4FQv+A7CrkUIGRaHiwI8oiHTAI1fAPWhF4J0vAlkC8biAlHSVVwxMQ3tjZ2/DVbnQiiA=="],
"@typescript/typescript-linux-riscv64": ["@typescript/typescript-linux-riscv64@7.0.2", "", { "os": "linux", "cpu": "none" }, "sha512-wf0jqEDOjrPRnKwYRyyJDRo11KMbvMFrU+q4zqKyChODBzvlkbhNQfKvLxQCcwTpdDaXSHZTVuh0JoCrKCUMHQ=="],
"@typescript/typescript-linux-s390x": ["@typescript/typescript-linux-s390x@7.0.2", "", { "os": "linux", "cpu": "s390x" }, "sha512-IkwJc3L7yhytWd/ewjyxNDfOmswCm9GWMJT/ue/dU4aZNbwZeYAetq42VyLmsmSjvoX7z74X6ZaYCtzAr0EuGw=="],
"@typescript/typescript-linux-x64": ["@typescript/typescript-linux-x64@7.0.2", "", { "os": "linux", "cpu": "x64" }, "sha512-EYdf2cNg7rgCWJnxCdJ+F3V39O8ihb37eHAu1LK8oAFizgTQbPOK7zHHXbPt8rX24COqODXeI3sIf0fCXG7H/A=="],
"@typescript/typescript-netbsd-arm64": ["@typescript/typescript-netbsd-arm64@7.0.2", "", { "os": "none", "cpu": "arm64" }, "sha512-+polYF4MF04aPpO5FTkHran9yUQDSXqy5GiSDKpsll5jy3l3+g9QLhpf39T+ePtefhXLOGrLl0QIjkQP6VnelA=="],
"@typescript/typescript-netbsd-x64": ["@typescript/typescript-netbsd-x64@7.0.2", "", { "os": "none", "cpu": "x64" }, "sha512-8YIT0EHM/3dq10ZOVF/A7pc/YSMtbcecct4rWtexrnSCHOPcpC2KTLXfTCR6vDpnSiY12heNb1GiN/wu+T/FyA=="],
"@typescript/typescript-openbsd-arm64": ["@typescript/typescript-openbsd-arm64@7.0.2", "", { "os": "openbsd", "cpu": "arm64" }, "sha512-APT8+ClYnuYm1u9+kgGXoMj2VzWzcymwh2gNSQVySHfkRDGOTVkoWLjCmOQSaO+PoqQ57B0flRp9SA+7GnnkzQ=="],
"@typescript/typescript-openbsd-x64": ["@typescript/typescript-openbsd-x64@7.0.2", "", { "os": "openbsd", "cpu": "x64" }, "sha512-yX7s+Q0Dln0Dt9tEzZsAjXXR/+ytBM7AlglaqyeMPxQszJ1JhlJdZ6jLA+IzldHtflX81em7lDao1xXu+aRRkg=="],
"@typescript/typescript-sunos-x64": ["@typescript/typescript-sunos-x64@7.0.2", "", { "os": "sunos", "cpu": "x64" }, "sha512-dLJDGaLZ1D4HPQn62u1n8mBDkJREwMsAkCdkwd4Ieqw+x3TUyTsqY0YiBCtE6H6OzzgGk3iuZ3vFWRS+E8/d1g=="],
"@typescript/typescript-win32-arm64": ["@typescript/typescript-win32-arm64@7.0.2", "", { "os": "win32", "cpu": "arm64" }, "sha512-Gyl1Vy6OsWesLzmq+EP0Fb7b4Nid5232AvcA2SFcdYreldpNtYFFofPjnt62y9hQy7VTaZp65ICJjuAQRaVcIQ=="],
"@typescript/typescript-win32-x64": ["@typescript/typescript-win32-x64@7.0.2", "", { "os": "win32", "cpu": "x64" }, "sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g=="],
"babel-plugin-transform-hook-names": ["babel-plugin-transform-hook-names@1.0.2", "", { "peerDependencies": { "@babel/core": "^7.12.10" } }, "sha512-5gafyjyyBTTdX/tQQ0hRgu4AhNHG/hqWi0ZZmg2xvs2FgRkJXzDNKBZCyoYqgFkovfDrgM8OoKg8karoUvWeCw=="],
"baseline-browser-mapping": ["baseline-browser-mapping@2.11.35", "", { "bin": { "baseline-browser-mapping": "dist/cli.cjs" } }, "sha512-GNk8KX52CHqeNKGk8+7tZnQab/2k1t/BgrUHPKNdijzpEhF1saPQZHVKb6m5loSAxB39gyrTYw34Qf9CQ3u1qQ=="],
"boolbase": ["boolbase@1.0.0", "", {}, "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww=="],
"browserslist": ["browserslist@4.29.5", "", { "dependencies": { "baseline-browser-mapping": "^2.11.33", "caniuse-lite": "^1.0.30001819", "electron-to-chromium": "^1.5.464", "node-releases": "^2.0.60", "update-browserslist-db": "^1.3.4" }, "bin": { "browserslist": "cli.js" } }, "sha512-khTmKu5NGYTotqcYo8Bew2k4RAE9PuXRSFRXG2lQBrCEQHyeQ/vX6gKMxfokwywBsLiXZMnHsmWMG1pnO8J7uQ=="],
"caniuse-lite": ["caniuse-lite@1.0.30001823", "", {}, "sha512-TQ5s/djDjNk1axreUW+4rULH+BmdCMLiJkhaXnO5wqivG7tITkSUj4ItIdzqdZHKaXcHAV8dhH3JxOM7/7bwqw=="],
"convert-source-map": ["convert-source-map@2.0.0", "", {}, "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg=="],
"css-select": ["css-select@5.2.2", "", { "dependencies": { "boolbase": "^1.0.0", "css-what": "^6.1.0", "domhandler": "^5.0.2", "domutils": "^3.0.1", "nth-check": "^2.0.1" } }, "sha512-TizTzUddG/xYLA3NXodFM0fSbNizXjOKhqiQQwvhlspadZokn1KDy0NZFS0wuEubIYAV5/c1/lAr0TaaFXEXzw=="],
"css-what": ["css-what@6.2.2", "", {}, "sha512-u/O3vwbptzhMs3L1fQE82ZSLHQQfto5gyZzwteVIEyeaY5Fc7R4dapF/BvRoSYFeqfBk4m0V1Vafq5Pjv25wvA=="],
"debug": ["debug@4.4.3", "", { "dependencies": { "ms": "^2.1.3" }, "peerDependencies": { "supports-color": "*" }, "optionalPeers": ["supports-color"] }, "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA=="],
"detect-libc": ["detect-libc@2.1.2", "", {}, "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ=="],
"dom-serializer": ["dom-serializer@2.0.0", "", { "dependencies": { "domelementtype": "^2.3.0", "domhandler": "^5.0.2", "entities": "^4.2.0" } }, "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg=="],
"domelementtype": ["domelementtype@2.3.0", "", {}, "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw=="],
"domhandler": ["domhandler@5.0.3", "", { "dependencies": { "domelementtype": "^2.3.0" } }, "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w=="],
"domutils": ["domutils@3.2.2", "", { "dependencies": { "dom-serializer": "^2.0.0", "domelementtype": "^2.3.0", "domhandler": "^5.0.3" } }, "sha512-6kZKyUajlDuqlHKVX1w7gyslj9MPIXzIFiz/rGu35uC1wMi+kMhQwGhl4lt9unC9Vb9INnY9Z3/ZA3+FhASLaw=="],
"electron-to-chromium": ["electron-to-chromium@1.5.478", "", {}, "sha512-pftG+ma5Lm8O6/p45bhYT6StBN5ziQymaRzmCZwFl8DwWHKPPD93FdOmP1aqftcepolQYvrcyTLa17kE8Yf+jg=="],
"entities": ["entities@4.5.0", "", {}, "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw=="],
"escalade": ["escalade@3.2.0", "", {}, "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA=="],
"estree-walker": ["estree-walker@2.0.2", "", {}, "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w=="],
"fdir": ["fdir@6.5.0", "", { "peerDependencies": { "picomatch": "^3 || ^4" }, "optionalPeers": ["picomatch"] }, "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg=="],
"fsevents": ["fsevents@2.3.3", "", { "os": "darwin" }, "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw=="],
"gensync": ["gensync@1.0.0-beta.2", "", {}, "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg=="],
"he": ["he@1.2.0", "", { "bin": { "he": "bin/he" } }, "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw=="],
"js-tokens": ["js-tokens@4.0.0", "", {}, "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="],
"jsesc": ["jsesc@3.1.0", "", { "bin": { "jsesc": "bin/jsesc" } }, "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA=="],
"json5": ["json5@2.2.3", "", { "bin": { "json5": "lib/cli.js" } }, "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg=="],
"kolorist": ["kolorist@1.8.0", "", {}, "sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ=="],
"lightningcss": ["lightningcss@1.33.0", "", { "dependencies": { "detect-libc": "^2.0.3" }, "optionalDependencies": { "lightningcss-android-arm64": "1.33.0", "lightningcss-darwin-arm64": "1.33.0", "lightningcss-darwin-x64": "1.33.0", "lightningcss-freebsd-x64": "1.33.0", "lightningcss-linux-arm-gnueabihf": "1.33.0", "lightningcss-linux-arm64-gnu": "1.33.0", "lightningcss-linux-arm64-musl": "1.33.0", "lightningcss-linux-x64-gnu": "1.33.0", "lightningcss-linux-x64-musl": "1.33.0", "lightningcss-win32-arm64-msvc": "1.33.0", "lightningcss-win32-x64-msvc": "1.33.0" } }, "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA=="],
"lightningcss-android-arm64": ["lightningcss-android-arm64@1.33.0", "", { "os": "android", "cpu": "arm64" }, "sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg=="],
"lightningcss-darwin-arm64": ["lightningcss-darwin-arm64@1.33.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg=="],
"lightningcss-darwin-x64": ["lightningcss-darwin-x64@1.33.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ=="],
"lightningcss-freebsd-x64": ["lightningcss-freebsd-x64@1.33.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg=="],
"lightningcss-linux-arm-gnueabihf": ["lightningcss-linux-arm-gnueabihf@1.33.0", "", { "os": "linux", "cpu": "arm" }, "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ=="],
"lightningcss-linux-arm64-gnu": ["lightningcss-linux-arm64-gnu@1.33.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg=="],
"lightningcss-linux-arm64-musl": ["lightningcss-linux-arm64-musl@1.33.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ=="],
"lightningcss-linux-x64-gnu": ["lightningcss-linux-x64-gnu@1.33.0", "", { "os": "linux", "cpu": "x64" }, "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg=="],
"lightningcss-linux-x64-musl": ["lightningcss-linux-x64-musl@1.33.0", "", { "os": "linux", "cpu": "x64" }, "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw=="],
"lightningcss-win32-arm64-msvc": ["lightningcss-win32-arm64-msvc@1.33.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA=="],
"lightningcss-win32-x64-msvc": ["lightningcss-win32-x64-msvc@1.33.0", "", { "os": "win32", "cpu": "x64" }, "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA=="],
"lru-cache": ["lru-cache@5.1.1", "", { "dependencies": { "yallist": "^3.0.2" } }, "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w=="],
"magic-string": ["magic-string@0.30.21", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.5" } }, "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ=="],
"ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="],
"nanoid": ["nanoid@3.3.20", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ=="],
"node-html-parser": ["node-html-parser@6.1.13", "", { "dependencies": { "css-select": "^5.1.0", "he": "1.2.0" } }, "sha512-qIsTMOY4C/dAa5Q5vsobRpOOvPfC4pB61UVW2uSwZNUp0QU/jCekTal1vMmbO0DgdHeLUJpv/ARmDqErVxA3Sg=="],
"node-releases": ["node-releases@2.0.63", "", {}, "sha512-6li2QanLsAXpIH2R6j77MzRyvOyrvdTqlKtO4CgBdHGNvN99ZZfyxszHc5o5+IZBWD5u6Hzwg83JoGXmqZNG9Q=="],
"nth-check": ["nth-check@2.1.1", "", { "dependencies": { "boolbase": "^1.0.0" } }, "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w=="],
"oxfmt": ["oxfmt@0.77.0", "", { "dependencies": { "tinypool": "2.2.0" }, "optionalDependencies": { "@oxfmt/binding-android-arm-eabi": "0.77.0", "@oxfmt/binding-android-arm64": "0.77.0", "@oxfmt/binding-darwin-arm64": "0.77.0", "@oxfmt/binding-darwin-x64": "0.77.0", "@oxfmt/binding-freebsd-x64": "0.77.0", "@oxfmt/binding-linux-arm-gnueabihf": "0.77.0", "@oxfmt/binding-linux-arm-musleabihf": "0.77.0", "@oxfmt/binding-linux-arm64-gnu": "0.77.0", "@oxfmt/binding-linux-arm64-musl": "0.77.0", "@oxfmt/binding-linux-ppc64-gnu": "0.77.0", "@oxfmt/binding-linux-riscv64-gnu": "0.77.0", "@oxfmt/binding-linux-riscv64-musl": "0.77.0", "@oxfmt/binding-linux-s390x-gnu": "0.77.0", "@oxfmt/binding-linux-x64-gnu": "0.77.0", "@oxfmt/binding-linux-x64-musl": "0.77.0", "@oxfmt/binding-openharmony-arm64": "0.77.0", "@oxfmt/binding-win32-arm64-msvc": "0.77.0", "@oxfmt/binding-win32-ia32-msvc": "0.77.0", "@oxfmt/binding-win32-x64-msvc": "0.77.0" }, "peerDependencies": { "@astrojs/compiler-rs": "^0.5.0", "svelte": "^5.0.0", "vite-plus": "*" }, "optionalPeers": ["@astrojs/compiler-rs", "svelte", "vite-plus"], "bin": { "oxfmt": "bin/oxfmt" } }, "sha512-3bPDJwLZf4i6dOaQS+6GOI/YUFTHNif7qw4nknbZyzdB0uws57tD8jA/GLGC9J7kjyf6d/eVWm73b43VeMUqGw=="],
"oxlint": ["oxlint@1.92.0", "", { "optionalDependencies": { "@oxlint/binding-android-arm-eabi": "1.92.0", "@oxlint/binding-android-arm64": "1.92.0", "@oxlint/binding-darwin-arm64": "1.92.0", "@oxlint/binding-darwin-x64": "1.92.0", "@oxlint/binding-freebsd-x64": "1.92.0", "@oxlint/binding-linux-arm-gnueabihf": "1.92.0", "@oxlint/binding-linux-arm-musleabihf": "1.92.0", "@oxlint/binding-linux-arm64-gnu": "1.92.0", "@oxlint/binding-linux-arm64-musl": "1.92.0", "@oxlint/binding-linux-ppc64-gnu": "1.92.0", "@oxlint/binding-linux-riscv64-gnu": "1.92.0", "@oxlint/binding-linux-riscv64-musl": "1.92.0", "@oxlint/binding-linux-s390x-gnu": "1.92.0", "@oxlint/binding-linux-x64-gnu": "1.92.0", "@oxlint/binding-linux-x64-musl": "1.92.0", "@oxlint/binding-openharmony-arm64": "1.92.0", "@oxlint/binding-win32-arm64-msvc": "1.92.0", "@oxlint/binding-win32-ia32-msvc": "1.92.0", "@oxlint/binding-win32-x64-msvc": "1.92.0" }, "peerDependencies": { "oxlint-tsgolint": ">=7.0.2005", "vite-plus": "*" }, "optionalPeers": ["oxlint-tsgolint", "vite-plus"], "bin": { "oxlint": "bin/oxlint" } }, "sha512-y9iRiRwVjVFqzKNXZJ9bT/GYRdf+F9Gy+a1Yju2Aq3xqqa4FJYXHI8VrxlpzxKDvkYRohvJX42m/eH+qkQPOFw=="],
"picocolors": ["picocolors@1.1.1", "", {}, "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="],
"picomatch": ["picomatch@4.0.7", "", {}, "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA=="],
"postcss": ["postcss@8.5.32", "", { "dependencies": { "nanoid": "^3.3.20", "picocolors": "^1.1.1", "source-map-js": "^1.2.2" } }, "sha512-LJlKCCAUFKOuZxipUdYw1NzIITEsPcgyOG9LkvRJvuKj/bRzbuRY0ARXvL0pWGpsZvn8jku+LMep2eU0seHp8g=="],
"preact": ["preact@11.2.0", "", { "peerDependencies": { "preact-render-to-string": ">=6.7.0" }, "optionalPeers": ["preact-render-to-string"] }, "sha512-/HfHI/7N84e6GrWBJ3J280z3mLaRJiDcSvj/A+y/4AbLnND/1UlGHe1sR6oYuTGwId0nP7dqDU9OnLxMPZ7xBg=="],
"rolldown": ["rolldown@1.2.16", "", { "dependencies": { "@oxc-project/types": "=0.156.0", "@rolldown/pluginutils": "^1.0.0" }, "optionalDependencies": { "@rolldown/binding-android-arm-eabi": "1.2.16", "@rolldown/binding-android-arm64": "1.2.16", "@rolldown/binding-darwin-arm64": "1.2.16", "@rolldown/binding-darwin-x64": "1.2.16", "@rolldown/binding-freebsd-x64": "1.2.16", "@rolldown/binding-linux-arm-gnueabihf": "1.2.16", "@rolldown/binding-linux-arm64-gnu": "1.2.16", "@rolldown/binding-linux-arm64-musl": "1.2.16", "@rolldown/binding-linux-ppc64-gnu": "1.2.16", "@rolldown/binding-linux-s390x-gnu": "1.2.16", "@rolldown/binding-linux-x64-gnu": "1.2.16", "@rolldown/binding-linux-x64-musl": "1.2.16", "@rolldown/binding-openharmony-arm64": "1.2.16", "@rolldown/binding-win32-arm64-msvc": "1.2.16", "@rolldown/binding-win32-x64-msvc": "1.2.16" }, "bin": { "rolldown": "./bin/cli.mjs" } }, "sha512-bWvlMpFKiTfDKfnK7FC2MPgPeWCf/Kpwsq49ApdW+FQaBZb6O6dZ4MAPbPUjp7hYQrw/RobqCzn64BRrQecGHw=="],
"semver": ["semver@6.3.2", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-GYrCADwpu6yV5OAvchkQ27Z5wwMxWAEMg5NNWjyHh/5DboFFqbdbvYNIvZouQpxXyeMPoTOh0vdPYKlf0ZswdQ=="],
"simple-code-frame": ["simple-code-frame@1.3.0", "", { "dependencies": { "kolorist": "^1.6.0" } }, "sha512-MB4pQmETUBlNs62BBeRjIFGeuy/x6gGKh7+eRUemn1rCFhqo7K+4slPqsyizCbcbYLnaYqaoZ2FWsZ/jN06D8w=="],
"source-map": ["source-map@0.7.6", "", {}, "sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ=="],
"source-map-js": ["source-map-js@1.2.2", "", {}, "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw=="],
"stack-trace": ["stack-trace@1.0.0", "", {}, "sha512-H6D7134xi6qONvh7ZHKgviXf+rd3vhGBSvebPZCaUkd8zvQ+7PtDw6CljPTe4cXWNf2IKZGNqw6VJXSb9IgBpA=="],
"tinyglobby": ["tinyglobby@0.2.17", "", { "dependencies": { "fdir": "^6.5.0", "picomatch": "^4.0.4" } }, "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g=="],
"tinypool": ["tinypool@2.2.0", "", {}, "sha512-jBrmx4lYmaC9k/mgPbylxs7kBUxHtD8256up+HjLaDFfXScKJQyil+SWXSvhAtT7XHo+yTVlpB81PGmHP8oLSQ=="],
"typescript": ["typescript@7.0.2", "", { "optionalDependencies": { "@typescript/typescript-aix-ppc64": "7.0.2", "@typescript/typescript-darwin-arm64": "7.0.2", "@typescript/typescript-darwin-x64": "7.0.2", "@typescript/typescript-freebsd-arm64": "7.0.2", "@typescript/typescript-freebsd-x64": "7.0.2", "@typescript/typescript-linux-arm": "7.0.2", "@typescript/typescript-linux-arm64": "7.0.2", "@typescript/typescript-linux-loong64": "7.0.2", "@typescript/typescript-linux-mips64el": "7.0.2", "@typescript/typescript-linux-ppc64": "7.0.2", "@typescript/typescript-linux-riscv64": "7.0.2", "@typescript/typescript-linux-s390x": "7.0.2", "@typescript/typescript-linux-x64": "7.0.2", "@typescript/typescript-netbsd-arm64": "7.0.2", "@typescript/typescript-netbsd-x64": "7.0.2", "@typescript/typescript-openbsd-arm64": "7.0.2", "@typescript/typescript-openbsd-x64": "7.0.2", "@typescript/typescript-sunos-x64": "7.0.2", "@typescript/typescript-win32-arm64": "7.0.2", "@typescript/typescript-win32-x64": "7.0.2" }, "bin": { "tsc": "bin/tsc" } }, "sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA=="],
"update-browserslist-db": ["update-browserslist-db@1.3.4", "", { "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.1" }, "peerDependencies": { "browserslist": ">= 4.21.0" }, "bin": { "update-browserslist-db": "cli.js" } }, "sha512-t8wonIOdQyOjtPd2VktlBu6QjTVTks6v8bSi7kd0r2Vll8TK1JYDZtRRdbmCHOAMphkZgrzK+L+vXK4pyZ8t4A=="],
"vite": ["vite@8.3.6", "", { "dependencies": { "lightningcss": "^1.33.0", "picomatch": "^4.0.7", "postcss": "^8.5.32", "rolldown": "~1.2.16", "tinyglobby": "^0.2.17" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "@vitejs/devtools": "^0.7.1 || ^0.8.0", "esbuild": "^0.27.0 || ^0.28.0", "jiti": ">=1.21.0", "less": "^4.0.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "@vitejs/devtools", "esbuild", "jiti", "less", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-UI7dK29NnS54Fk+mmo7o+jI6U8Fp7hDl+X5Q1k45WH+d4dSlbLVUETGQ+hfkNgvLQGyoElPj837nZyv4MBc0VA=="],
"vite-prerender-plugin": ["vite-prerender-plugin@0.5.14", "", { "dependencies": { "kolorist": "^1.8.0", "magic-string": "0.x >= 0.26.0", "node-html-parser": "^6.1.12", "simple-code-frame": "^1.3.0", "source-map": "^0.7.4", "stack-trace": "^1.0.0-pre2" }, "peerDependencies": { "vite": "5.x || 6.x || 7.x || 8.x" } }, "sha512-X2w9AS1OhwEUec9HSryGAmEnEQJGhW6eFoiCVJv8BfOTVpM8SOjk75cEw/IC28APDHZudeIRbP8Sp7wfABq+Aw=="],
"yallist": ["yallist@3.1.1", "", {}, "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g=="],
"zimmerframe": ["zimmerframe@1.1.5", "", {}, "sha512-msJxIvYDYcoNL+PJsu+7qmpDWsYmAxTY+2TNYXXF0hzBzBk0BMecOqDOG/EckUoKCuKwObfbugIl8QpqHDXeFA=="],
"@prefresh/vite/@rollup/pluginutils": ["@rollup/pluginutils@4.2.1", "", { "dependencies": { "estree-walker": "^2.0.1", "picomatch": "^2.2.2" } }, "sha512-iKnFXr7NkdZAIHiIWE+BX5ULi/ucVFYWD6TbAV+rZctiRTY2PL6tsIKhoIOaoskiWAkgu+VsbXgUVDNLHf+InQ=="],
"@prefresh/vite/@rollup/pluginutils/picomatch": ["picomatch@2.3.2", "", {}, "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA=="],
}
}

28
package.json Normal file
View file

@ -0,0 +1,28 @@
{
"name": "building-use-map",
"version": "1.0.0",
"description": "Building-use map for Czechia (RÚIAN)",
"repository": {
"type": "git",
"url": "https://git.hangerthem.com/HangerThem/building-use-map.git"
},
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview",
"typecheck": "tsc"
},
"dependencies": {
"@preact/signals": "^2.11.4",
"preact": "^11.2.0"
},
"devDependencies": {
"@preact/preset-vite": "^2.10.6",
"oxfmt": "^0.77.0",
"oxlint": "^1.92.0",
"typescript": "^7.0.2",
"vite": "^8.3.6"
},
"private": true
}

135
src/actions.ts Normal file
View file

@ -0,0 +1,135 @@
import { batch } from '@preact/signals'
import { fetchArea } from './fetch'
import { D2R } from './geo'
import { t } from './i18n'
import { writeHash } from './persist'
import { fitView } from './render'
import {
base,
busy,
hidden,
lastLoc,
locating,
locText,
progress,
radius,
rawBuildings,
S,
sel,
status,
toast,
type Status,
} from './state'
import type { AreaData, LatLon } from './types'
import { errMsg } from './util'
export function setStatus(fn: () => string, cls?: Status['cls'], details?: string[]) {
status.value = { fn, cls, details }
}
let toastTimer: ReturnType<typeof setTimeout> | undefined
export function showToast(fn: () => string) {
clearTimeout(toastTimer)
toast.value = { fn, id: Date.now() }
toastTimer = setTimeout(() => (toast.value = null), 2400)
}
export function applyData(d: AreaData, lon: number, lat: number) {
S.center = [lon, lat]
S.K = Math.cos(lat * D2R)
S.loaded = true
// fitView inside the batch so the map redraw triggered by the new data uses the new view
batch(() => {
rawBuildings.value = d.buildings
base.value = d.base
sel.value = null
hidden.value = new Set()
fitView()
})
}
let loadSeq = 0
/** Load an area from ČÚZK. A newer call supersedes one still in flight. */
export async function liveLoad(p: LatLon, quietFallback: boolean): Promise<boolean> {
const my = ++loadSeq
const current = () => my === loadSeq
batch(() => {
busy.value = true
progress.value = { done: 0, total: 0 }
setStatus(() => t('st_loading'))
})
try {
const r = radius.value
const d = await fetchArea(p.lon, p.lat, r, (done, total) => {
if (current()) progress.value = { done, total }
})
if (!current()) return false
if (!d.buildings.length) {
setStatus(() => t('st_none'), 'err')
return false
}
applyData(d, p.lon, p.lat)
writeHash(p, r)
lastLoc.value = { lat: p.lat, lon: p.lon }
const loc = `${p.lat.toFixed(5)}, ${p.lon.toFixed(5)}`,
n = d.buildings.length,
fails = d.fails
if (fails.length)
setStatus(() => t('st_loaded', loc, n) + ' ' + t('st_baseFail', fails.length), 'warn', fails)
else setStatus(() => t('st_loaded', loc, n), 'ok')
return true
} catch (e) {
if (!current()) return false
const msg = errMsg(e)
setStatus(() => (quietFallback ? t('st_fallback', msg) : t('st_err', msg)), 'err')
return false
} finally {
if (current())
batch(() => {
busy.value = false
progress.value = null
})
}
}
const inCzechia = (p: LatLon) => p.lat >= 48 && p.lat <= 52 && p.lon >= 12 && p.lon <= 19
/** Load the area around the device's position. */
export function locate() {
if (!('geolocation' in navigator)) {
setStatus(() => t('geo_unavailable'), 'err')
return
}
locating.value = true
setStatus(() => t('locating'))
navigator.geolocation.getCurrentPosition(
(pos) => {
locating.value = false
const p = { lat: pos.coords.latitude, lon: pos.coords.longitude }
if (!inCzechia(p)) {
setStatus(() => t('geo_outside'), 'err')
return
}
locText.value = `${p.lat.toFixed(6)}, ${p.lon.toFixed(6)}`
liveLoad(p, false)
},
(err) => {
locating.value = false
setStatus(
() => t(err.code === err.PERMISSION_DENIED ? 'geo_denied' : 'geo_unavailable'),
'err',
)
},
{ enableHighAccuracy: true, timeout: 15000, maximumAge: 60000 },
)
}
export async function copyLink() {
try {
await navigator.clipboard.writeText(location.href)
showToast(() => t('linkCopied'))
} catch {
// clipboard blocked (e.g. insecure context): let the user copy it manually
window.prompt(t('copyLink'), location.href)
}
}

53
src/basemap.ts Normal file
View file

@ -0,0 +1,53 @@
import type { BaseColor } from './theme'
/* ================= basemap styles ================= */
/** ZABAGED layer ids on the ČÚZK MapServer. */
export const ZAB_LAYERS = {
road: 79,
street: 84,
track: 83,
path: 82,
rail: 75,
stream: 93,
water: 132,
green: 134,
garden: 135,
cemetery: 116,
parking: 123,
}
export type BaseKey = keyof typeof ZAB_LAYERS
/** Colours are palette keys (theme.ts), so the basemap follows light/dark mode. */
interface PolyStyle {
k: BaseKey
t: 'poly'
fill: BaseColor
stroke?: BaseColor
}
/** m: width in true metres, min: minimum width in px */
interface LineStyle {
k: BaseKey
t: 'line'
c: BaseColor
m: number
min: number
dash?: number[]
}
export type BaseStyle = PolyStyle | LineStyle
// Drawn in this order (later entries on top)
export const BASE: BaseStyle[] = [
{ k: 'garden', t: 'poly', fill: 'garden' },
{ k: 'green', t: 'poly', fill: 'green' },
{ k: 'cemetery', t: 'poly', fill: 'cemetery', stroke: 'cemeteryEdge' },
{ k: 'parking', t: 'poly', fill: 'parking', stroke: 'parkingEdge' },
{ k: 'water', t: 'poly', fill: 'water', stroke: 'waterEdge' },
{ k: 'stream', t: 'line', c: 'stream', m: 2, min: 1.2 },
{ k: 'path', t: 'line', c: 'path', m: 1, min: 0.8, dash: [2, 3] },
{ k: 'track', t: 'line', c: 'track', m: 2, min: 1, dash: [6, 4] },
{ k: 'rail', t: 'line', c: 'rail', m: 3, min: 1.2, dash: [8, 4] },
{ k: 'street', t: 'line', c: 'streetCasing', m: 7, min: 2.4 },
{ k: 'street', t: 'line', c: 'street', m: 5, min: 1.8 },
{ k: 'road', t: 'line', c: 'roadCasing', m: 11, min: 3.6 },
{ k: 'road', t: 'line', c: 'road', m: 8.5, min: 2.8 },
]

38
src/building.ts Normal file
View file

@ -0,0 +1,38 @@
import type { Building, Ring } from './types'
type Num = number | string | null | undefined
export function mkBuilding(
cp: Num,
use: Num,
flats: Num,
floors: Num,
area: Num,
done: number | null | undefined,
rings: Ring[],
): Building {
let x0 = 1e18,
y0 = 1e18,
x1 = -1e18,
y1 = -1e18
for (const r of rings)
for (const p of r) {
if (p[0] < x0) x0 = p[0]
if (p[0] > x1) x1 = p[0]
if (p[1] < y0) y0 = p[1]
if (p[1] > y1) y1 = p[1]
}
const year = done != null && isFinite(done) ? new Date(done).getUTCFullYear() : null
return {
cp: (cp || '').toString().trim(),
use: use == null ? 0 : +use,
flats: flats == null ? null : +flats,
floors: floors == null ? null : +floors,
area: area == null ? null : +area,
year,
rings,
bb: [x0, y0, x1, y1],
cat: 'other',
sc: 'other',
}
}

204
src/categories.ts Normal file
View file

@ -0,0 +1,204 @@
import { t, tKey, ruianUseName } from './i18n'
import { computed } from '@preact/signals'
import { mixMin, mode, rawBuildings } from './state'
import type { Building } from './types'
/* ================= categories ================= */
// Simple scheme: key, colour, show house number
type SimpleDef = [key: string, color: string, nums: 0 | 1]
export const SIMPLE: SimpleDef[] = [
['res', '#000000', 0],
['unit', '#d62728', 1],
['rec', '#2ca02c', 1],
['mix', '#ff8c00', 1],
['civic', '#1f5fbf', 1],
['assem', '#4fb3e8', 1],
['shop', '#e377c2', 1],
['hotel', '#e8c000', 1],
['office', '#17808a', 1],
['ind', '#7b3294', 1],
['agri', '#8c564b', 0],
['tech', '#4d4d4d', 0],
['garage', '#d9b77e', 0],
['other', '#bdbdbd', 0],
]
const SIMPLE_COLOR: Record<string, string> = Object.fromEntries(SIMPLE.map((c) => [c[0], c[1]]))
export const SIMPLE_NUMS: Record<string, boolean> = Object.fromEntries(
SIMPLE.map((c) => [c[0], !!c[2]]),
)
const SIMPLE_ORDER = [
'other',
'garage',
'agri',
'tech',
'ind',
'office',
'hotel',
'shop',
'assem',
'civic',
'res',
'unit',
'rec',
'mix',
]
const USE_CAT: Record<number, string> = {
1: 'ind',
2: 'agri',
4: 'agri',
5: 'civic',
6: 'unit',
7: 'res',
8: 'rec',
9: 'assem',
10: 'shop',
11: 'hotel',
12: 'ind',
13: 'agri',
14: 'office',
15: 'civic',
16: 'tech',
17: 'tech',
18: 'garage',
19: 'other',
20: 'other',
21: 'other',
}
// Detailed scheme: one entry per RÚIAN use code
const DETAIL_COLOR: Record<string, string> = {
u1: '#7b3294',
u2: '#8c564b',
u3: '#ff9896',
u4: '#556b2f',
u5: '#1f5fbf',
u6: '#d62728',
u7: '#000000',
u8: '#2ca02c',
u9: '#4fb3e8',
u10: '#e377c2',
u11: '#e8c000',
u12: '#b39ddb',
u13: '#bc8f6f',
u14: '#17808a',
u15: '#3949ab',
u16: '#4d4d4d',
u17: '#7f7f3f',
u18: '#d9b77e',
u19: '#bdbdbd',
u20: '#26c6da',
u21: '#a5d6a7',
uw: '#607d8b',
u0: '#e3e3e3',
mix: '#ff8c00',
}
const DETAIL_ORDER = [
'u0',
'uw',
'u19',
'u18',
'u21',
'u20',
'u13',
'u2',
'u4',
'u16',
'u17',
'u12',
'u1',
'u14',
'u10',
'u11',
'u9',
'u15',
'u5',
'u7',
'u6',
'u3',
'u8',
'mix',
]
const DETAIL_LIST = [
'u7',
'u6',
'u3',
'u8',
'mix',
'u5',
'u15',
'u9',
'u10',
'u11',
'u14',
'u1',
'u12',
'u2',
'u13',
'u4',
'u16',
'u17',
'u18',
'u20',
'u21',
'u19',
'uw',
'u0',
]
export function simpleKey(use: number, flats: number | null): string {
const f = flats || 0
if (use === 3) return f >= 4 ? 'unit' : 'res' // generic dwelling
const base = USE_CAT[use] || 'other'
if (base === 'res' || base === 'unit' || base === 'rec') return base
if (mixMin.value > 0 && f >= mixMin.value && base !== 'garage' && base !== 'agri') return 'mix'
return base
}
export function detailKey(use: number, sk: string): string {
if (sk === 'mix') return 'mix'
if (use >= 1 && use <= 21) return 'u' + use
if (use >= 22 && use <= 29) return 'uw'
return 'u0'
}
/**
* Buildings with `sc`/`cat` set for the current colour mode and mixed-use rule.
* Categories are written onto the building objects (so a selected building stays the same object);
* a new array is returned so dependants see a change.
*/
export const buildings = computed(() => {
const list = rawBuildings.value,
m = mode.value
for (const b of list) {
b.sc = simpleKey(b.use, b.flats)
b.cat = m === 'simple' ? b.sc : detailKey(b.use, b.sc)
}
return list.slice()
})
/**
* Category of a building in the current mode. Reading `buildings` first makes sure the
* classification is up to date and subscribes the caller to mode / mixed-use changes.
*/
export function catOf(b: Building): string {
// oxlint-disable-next-line no-unused-expressions
buildings.value
return b.cat
}
export const catColor = (key: string): string =>
(mode.value === 'simple' ? SIMPLE_COLOR[key] : DETAIL_COLOR[key]) || '#bdbdbd'
export function catLabel(key: string): string {
if (mode.value === 'simple') return tKey('cat.' + key)
if (key === 'mix') return t('cat.mix')
if (key === 'uw') return ruianUseName('w')
if (key === 'u0') return ruianUseName(0)
return key.slice(1) + ' · ' + ruianUseName(+key.slice(1))
}
export const catList = () => (mode.value === 'simple' ? SIMPLE.map((c) => c[0]) : DETAIL_LIST)
export const catOrder = () => (mode.value === 'simple' ? SIMPLE_ORDER : DETAIL_ORDER)
export function isDark(hex: string): boolean {
const n = parseInt(hex.slice(1), 16),
r = n >> 16,
g = (n >> 8) & 255,
b = n & 255
return 0.299 * r + 0.587 * g + 0.114 * b < 140
}

27
src/components/App.tsx Normal file
View file

@ -0,0 +1,27 @@
import { useSignalEffect } from '@preact/signals'
import { useEffect } from 'preact/hooks'
import { lang, t } from '../i18n'
import { attachKeyboard } from '../interaction'
import { toast } from '../state'
import { MapView } from './MapView'
import { Sidebar } from './Sidebar'
export function App() {
useSignalEffect(() => {
document.documentElement.lang = lang.value
document.title = t('title') + ' – RÚIAN'
})
useEffect(attachKeyboard, [])
const tst = toast.value
return (
<div id="app">
<Sidebar />
<MapView />
{tst && (
<div class="toast" key={tst.id} role="status">
{tst.fn()}
</div>
)}
</div>
)
}

View file

@ -0,0 +1,56 @@
import { catColor, catLabel, catOf } from '../categories'
import { m2ll } from '../geo'
import { ruianUseName, t } from '../i18n'
import { sel } from '../state'
import { Icon } from './ui/Icon'
const DASH = '—'
const orDash = (v: number | null, unit = '') => (v == null ? DASH : v + unit)
/** Details of the selected building. */
export function InfoPanel() {
const b = sel.value
if (!b) return null
const cat = catOf(b),
ll = m2ll((b.bb[0] + b.bb[2]) / 2, (b.bb[1] + b.bb[3]) / 2)
const title = b.cp ? t('hn', b.cp) : t('nohn')
return (
// key: replay the entry animation when another building is selected
<div id="info" class="card info" key={title + b.bb.join()} role="dialog" aria-label={title}>
<div class="info-head">
<span class="sw" style={{ background: catColor(cat) }} />
<div>
<b>{title}</b>
<div class="info-cat">{catLabel(cat)}</div>
</div>
<button
type="button"
class="icon-btn x"
title={t('close')}
aria-label={t('close')}
onClick={() => (sel.value = null)}
>
<Icon name="close" />
</button>
</div>
<dl>
<dt>{t('i_use')}</dt>
<dd>
{ruianUseName(b.use) || DASH} <span class="muted">({b.use || '?'})</span>
</dd>
<dt>{t('i_flats')}</dt>
<dd>{orDash(b.flats)}</dd>
<dt>{t('i_floors')}</dt>
<dd>{orDash(b.floors)}</dd>
<dt>{t('i_area')}</dt>
<dd>{orDash(b.area, ' m²')}</dd>
<dt>{t('i_done')}</dt>
<dd>{orDash(b.year)}</dd>
<dt>{t('i_pos')}</dt>
<dd class="mono">
{ll[1].toFixed(6)}, {ll[0].toFixed(6)}
</dd>
</dl>
</div>
)
}

65
src/components/Legend.tsx Normal file
View file

@ -0,0 +1,65 @@
import { catColor, catLabel, catList } from '../categories'
import { t } from '../i18n'
import { counts } from '../render'
import { focusCat, hidden } from '../state'
function toggle(key: string) {
const next = new Set(hidden.value)
if (next.has(key)) next.delete(key)
else next.add(key)
hidden.value = next
}
/** Show only `key`; doing it again on the same category shows everything. */
function only(key: string) {
const others = catList().filter((k) => k !== key)
const alreadyOnly = !hidden.value.has(key) && others.every((k) => hidden.value.has(k))
hidden.value = alreadyOnly ? new Set() : new Set(others)
}
/**
* Category list with counts; categories absent from the loaded area are not shown.
* Hovering a row highlights that category on the map.
*/
export function Legend() {
const cnt = counts(),
hid = hidden.value
const rows = catList().filter((k) => cnt[k])
return (
<div id="legend" onMouseLeave={() => (focusCat.value = null)}>
{rows.map((key) => {
const on = !hid.has(key)
return (
<label
key={key}
class={on ? 'leg' : 'leg off'}
title={t('onlyHint')}
onMouseEnter={() => (focusCat.value = on ? key : null)}
onClick={(e) => {
if (!e.altKey) return
e.preventDefault() // keep the checkbox from toggling as well
only(key)
}}
onDblClick={(e) => {
e.preventDefault()
only(key)
}}
>
<input
type="checkbox"
checked={on}
onChange={() => {
toggle(key)
focusCat.value = null
}}
onFocus={() => (focusCat.value = on ? key : null)}
onBlur={() => (focusCat.value = null)}
/>
<span class="sw" style={{ background: catColor(key) }} />
<span class="lbl">{catLabel(key)}</span>
<span class="n">{cnt[key]}</span>
</label>
)
})}
</div>
)
}

View file

@ -0,0 +1,25 @@
import { t } from '../i18n'
import { progress } from '../state'
import { Icon } from './ui/Icon'
/** Progress bar along the top of the map and a small pill while data is loading. */
export function LoadingOverlay() {
const p = progress.value
const known = !!p && p.total > 0
return (
<div class={p ? 'loading on' : 'loading'} aria-hidden={!p}>
<div class="bar">
<span
class={known ? '' : 'indet'}
style={known ? { width: `${(p.done / p.total) * 100}%` } : undefined}
/>
</div>
{p && (
<div class="pill-float">
<Icon name="spinner" />
{known ? t('loadingPill', p.done, p.total) : t('loadingStart')}
</div>
)}
</div>
)
}

112
src/components/MapView.tsx Normal file
View file

@ -0,0 +1,112 @@
import { effect } from '@preact/signals'
import { useEffect, useRef } from 'preact/hooks'
import { catColor, catLabel, catOf } from '../categories'
import { t } from '../i18n'
import { attachPointer, resize, zoomBy, zoomFit } from '../interaction'
import { draw, drawScene, requestDraw, trackScene } from '../render'
import { hover, S, vp } from '../state'
import { LIGHT } from '../theme'
import { InfoPanel } from './InfoPanel'
import { LoadingOverlay } from './LoadingOverlay'
import { Icon } from './ui/Icon'
/** Height of the map covered by the mobile bottom sheet (CSS variable --sheet-cover). */
const sheetCover = () =>
parseFloat(getComputedStyle(document.documentElement).getPropertyValue('--sheet-cover')) || 0
export function MapView() {
const stage = useRef<HTMLElement>(null),
canvas = useRef<HTMLCanvasElement>(null)
useEffect(() => {
const s = stage.current!,
cv = canvas.current!
vp.ctx = cv.getContext('2d')
const detach = attachPointer(cv)
const onResize = () => resize(s, cv, sheetCover())
const ro = new ResizeObserver(onResize)
ro.observe(s)
onResize()
// Redraw (once per frame) whenever a signal the drawing reads changes: data, layers,
// mode, selection, hover, legend focus, theme. Pan and zoom request redraws themselves.
const stopDrawing = effect(() => {
trackScene()
requestDraw()
})
// print the map in the light palette, without hover/selection overlays
const beforePrint = () => {
if (vp.ctx) drawScene(vp.ctx, vp.W, vp.H, S.view, vp.DPR, { pal: LIGHT })
}
window.addEventListener('beforeprint', beforePrint)
window.addEventListener('afterprint', draw)
return () => {
stopDrawing()
ro.disconnect()
detach()
window.removeEventListener('beforeprint', beforePrint)
window.removeEventListener('afterprint', draw)
vp.ctx = null
}
}, [])
return (
<main id="stage" ref={stage}>
<canvas id="cv" ref={canvas} role="img" aria-label={t('mapLabel')} />
<LoadingOverlay />
<div class="zoom" role="group">
<button
type="button"
class="map-btn"
title={t('zoomIn')}
aria-label={t('zoomIn')}
onClick={() => zoomBy(1.6)}
>
<Icon name="plus" />
</button>
<button
type="button"
class="map-btn"
title={t('zoomOut')}
aria-label={t('zoomOut')}
onClick={() => zoomBy(1 / 1.6)}
>
<Icon name="minus" />
</button>
<button
type="button"
class="map-btn"
title={t('fit')}
aria-label={t('fit')}
onClick={zoomFit}
>
<Icon name="fit" />
</button>
</div>
<Tooltip />
<InfoPanel />
</main>
)
}
/** Hover label; flips to the other side of the cursor near the right/bottom edge. */
function Tooltip() {
const h = hover.value
if (!h) return null
const cat = catOf(h.b)
const flipX = h.x > vp.W - 240,
flipY = h.y > vp.H - 60
return (
<div
id="tip"
style={{
left: flipX ? undefined : h.x + 14,
right: flipX ? vp.W - h.x + 14 : undefined,
top: flipY ? undefined : h.y + 16,
bottom: flipY ? vp.H - h.y + 12 : undefined,
}}
>
<span class="sw" style={{ background: catColor(cat) }} />
<b>{h.b.cp ? t('hn', h.b.cp) : t('nohn')}</b> {catLabel(cat)}
</div>
)
}

332
src/components/Sidebar.tsx Normal file
View file

@ -0,0 +1,332 @@
import { batch } from '@preact/signals'
import { useRef, useState } from 'preact/hooks'
import { copyLink, liveLoad, locate, setStatus } from '../actions'
import { buildings, catList } from '../categories'
import { exportCsv, exportPng, exportSvg } from '../export'
import { parseLoc } from '../geo'
import { lang, t } from '../i18n'
import {
busy,
hidden,
lastLoc,
locating,
locText,
mixMin,
mode,
radius,
rawBuildings,
sheetOpen,
showBase,
showNums,
} from '../state'
import type { Mode } from '../types'
import { Legend } from './Legend'
import { StatusLine } from './StatusLine'
import { Icon, type IconName } from './ui/Icon'
import { Segmented } from './ui/Segmented'
import { Switch } from './ui/Switch'
export function Sidebar() {
const aside = useRef<HTMLElement>(null)
return (
<aside ref={aside} class={sheetOpen.value ? 'panel open' : 'panel'}>
<SheetHandle aside={aside} />
<div class="panel-scroll">
<Header />
<section class="card">
<LocationForm />
<StatusLine />
</section>
<LayersSection />
<section>
<h2>{t('display')}</h2>
<DisplayOptions />
</section>
<section>
<h2>{t('export')}</h2>
<ExportButtons />
</section>
<details class="about">
<summary>
<Icon name="info" />
{t('about')}
<Icon name="chevron" class="icon chev" />
</summary>
{/* the note contains <br> line breaks and comes only from our own translations */}
<p class="note" dangerouslySetInnerHTML={{ __html: t('note') }} />
<p class="note">{t('shortcuts')}</p>
</details>
</div>
</aside>
)
}
/** Drag handle of the mobile bottom sheet: tap to toggle, drag to open/close. Hidden on desktop. */
function SheetHandle({ aside }: { aside: { current: HTMLElement | null } }) {
const start = useRef<{ y: number; open: boolean } | null>(null)
const setDrag = (px: number | null) => {
const el = aside.current
if (!el) return
el.classList.toggle('dragging', px !== null)
el.style.setProperty('--drag', px === null ? '0px' : px + 'px')
}
return (
<button
type="button"
class="sheet-handle"
aria-label={t('panel')}
aria-expanded={sheetOpen.value}
onPointerDown={(e) => {
e.currentTarget.setPointerCapture(e.pointerId)
start.current = { y: e.clientY, open: sheetOpen.value }
}}
onPointerMove={(e) => {
if (!start.current) return
const dy = e.clientY - start.current.y
if (Math.abs(dy) > 4) setDrag(dy)
}}
onPointerUp={(e) => {
const s = start.current
start.current = null
if (!s) return
const dy = e.clientY - s.y
setDrag(null)
if (Math.abs(dy) <= 4) sheetOpen.value = !s.open // a tap
else sheetOpen.value = dy < 0
}}
onPointerCancel={() => {
start.current = null
setDrag(null)
}}
>
<span />
</button>
)
}
function Header() {
return (
<header class="head">
<div>
<h1>{t('title')}</h1>
<p class="sub">{t('subtitle')}</p>
</div>
<Segmented
size="sm"
label={t('lang')}
value={lang.value}
onChange={(v) => (lang.value = v)}
options={[
{ value: 'cs', label: 'CS' },
{ value: 'en', label: 'EN' },
]}
/>
</header>
)
}
function LocationForm() {
const load = () => {
const p = parseLoc(locText.value)
if (!p) setStatus(() => t('st_badLoc'), 'err')
else liveLoad(p, false)
}
const r = radius.value,
pct = ((r - 100) / (700 - 100)) * 100
return (
<>
<label class="field-label" for="loc">
{t('locLabel')}
</label>
<div class="input-group">
<input
id="loc"
type="text"
value={locText.value}
spellcheck={false}
autocomplete="off"
onInput={(e) => (locText.value = e.currentTarget.value)}
onFocus={(e) => {
sheetOpen.value = true
e.currentTarget.select()
}}
onKeyDown={(e) => {
if (e.key === 'Enter') load()
}}
/>
<button
type="button"
class="icon-btn"
title={t('locate')}
aria-label={t('locate')}
disabled={locating.value}
onClick={locate}
>
<Icon name={locating.value ? 'spinner' : 'locate'} />
</button>
</div>
<div class="range-head">
<label class="field-label" for="radius">
{t('radius')}
</label>
<output class="badge" for="radius">
{r} m
</output>
</div>
<input
id="radius"
type="range"
min={100}
max={700}
step={50}
value={r}
style={{ '--fill': pct + '%' }}
onInput={(e) => (radius.value = +e.currentTarget.value)}
/>
<div class="row">
<button type="button" class="btn primary grow" onClick={load}>
{busy.value && <Icon name="spinner" />}
{t('load')}
</button>
<button
type="button"
class="btn ghost square"
title={t('copyLink')}
aria-label={t('copyLink')}
disabled={!lastLoc.value}
onClick={copyLink}
>
<Icon name="link" />
</button>
</div>
</>
)
}
function LayersSection() {
const n = buildings.value.length
const setAll = (show: boolean) => (hidden.value = show ? new Set() : new Set(catList()))
return (
<section>
<div class="sec-head">
<h2>
{t('layers')}
{n > 0 && <span class="pill">{t('nBuildings', n)}</span>}
</h2>
{n > 0 && (
<div class="sec-actions">
<button type="button" class="link" onClick={() => setAll(true)}>
{t('all')}
</button>
<button type="button" class="link" onClick={() => setAll(false)}>
{t('none')}
</button>
</div>
)}
</div>
<Legend />
</section>
)
}
function DisplayOptions() {
return (
<div class="stack">
<div>
<span class="field-label" id="colormode-label">
{t('colorMode')}
</span>
<Segmented<Mode>
label={t('colorMode')}
value={mode.value}
onChange={(m) =>
batch(() => {
mode.value = m
hidden.value = new Set() // category keys differ between modes
})
}
options={[
{ value: 'simple', label: t('modeSimple').split(' – ')[0] },
{ value: 'detailed', label: t('modeDetailed').split(' – ')[0] },
]}
/>
<p class="hint">
{(mode.value === 'simple' ? t('modeSimple') : t('modeDetailed')).split(' – ')[1]}
</p>
</div>
<div>
<label class="field-label" for="mixrule">
{t('mixLabel')}
</label>
<div class="select">
<select
id="mixrule"
value={String(mixMin.value)}
onChange={(e) => (mixMin.value = +e.currentTarget.value)}
>
<option value="1">{t('mix1')}</option>
<option value="2">{t('mix2')}</option>
<option value="0">{t('mix0')}</option>
</select>
<Icon name="chevron" />
</div>
</div>
<div class="switches">
<Switch checked={showBase.value} onChange={(v) => (showBase.value = v)}>
{t('optBase')}
</Switch>
<Switch checked={showNums.value} onChange={(v) => (showNums.value = v)}>
{t('optNums')}
</Switch>
</div>
</div>
)
}
function ExportButtons() {
const ready = rawBuildings.value.length > 0
return (
<div class="exp">
<ExportButton icon="image" label="PNG" run={exportPng} disabled={!ready} />
<ExportButton icon="vector" label="SVG" run={exportSvg} disabled={!ready} />
<ExportButton icon="table" label={t('csv')} run={exportCsv} disabled={!ready} />
<ExportButton icon="print" label={t('print')} run={() => window.print()} confirm={false} />
</div>
)
}
function ExportButton({
icon,
label,
run,
disabled,
confirm = true,
}: {
icon: IconName
label: string
run: () => void
disabled?: boolean
confirm?: boolean
}) {
const [done, setDone] = useState(false)
return (
<button
type="button"
class={done ? 'btn ghost done' : 'btn ghost'}
disabled={disabled}
onClick={() => {
run()
if (!confirm) return
setDone(true)
setTimeout(() => setDone(false), 1600)
}}
>
<Icon name={done ? 'check' : icon} />
{done ? t('saved') : label}
</button>
)
}

View file

@ -0,0 +1,49 @@
import { useEffect, useState } from 'preact/hooks'
import { t } from '../i18n'
import { busy, locating, status } from '../state'
import { Icon, type IconName } from './ui/Icon'
/** Status of the last action; success messages fade to muted after a few seconds. */
export function StatusLine() {
const st = status.value
const [faded, setFaded] = useState(false)
useEffect(() => {
setFaded(false)
if (st?.cls !== 'ok') return
const id = setTimeout(() => setFaded(true), 5000)
return () => clearTimeout(id)
}, [st])
if (!st) return null
const working = busy.value || locating.value
const icon: IconName =
st.cls === 'err' || st.cls === 'warn'
? 'alert'
: st.cls === 'ok'
? 'check'
: working
? 'spinner'
: 'info'
return (
<div
id="status"
class={`status ${st.cls ?? 'info'}${faded ? ' faded' : ''}`}
role="status"
aria-live="polite"
>
<Icon name={icon} />
<div class="status-body">
<span class="status-text">{st.fn()}</span>
{st.details && st.details.length > 0 && (
<details>
<summary>{t('details')}</summary>
<ul>
{st.details.map((d) => (
<li key={d}>{d}</li>
))}
</ul>
</details>
)}
</div>
</div>
)
}

View file

@ -0,0 +1,95 @@
import type { SVGAttributes } from 'preact'
/* Small inline icon set (24×24, stroked with currentColor) – no icon font or dependency. */
const P = {
download: (
<>
<path d="M12 4v11m0 0-4.5-4.5M12 15l4.5-4.5" />
<path d="M5 20h14" />
</>
),
image: (
<>
<rect x="3" y="4" width="18" height="16" rx="2" />
<circle cx="9" cy="10" r="1.6" />
<path d="m21 16-5-5-9 9" />
</>
),
vector: (
<>
<path d="M5 19 12 5l7 14" />
<circle cx="12" cy="5" r="1.8" />
<circle cx="5" cy="19" r="1.8" />
<circle cx="19" cy="19" r="1.8" />
</>
),
table: (
<>
<rect x="3" y="4" width="18" height="16" rx="2" />
<path d="M3 10h18M3 15h18M10 4v16" />
</>
),
print: (
<>
<path d="M7 9V3h10v6" />
<rect x="3" y="9" width="18" height="8" rx="2" />
<path d="M7 14h10v7H7z" />
</>
),
locate: (
<>
<circle cx="12" cy="12" r="4" />
<path d="M12 2v3M12 19v3M2 12h3M19 12h3" />
</>
),
link: (
<>
<path d="M10 14a4.5 4.5 0 0 0 6.4 0l3-3a4.5 4.5 0 0 0-6.4-6.4L11.5 6" />
<path d="M14 10a4.5 4.5 0 0 0-6.4 0l-3 3a4.5 4.5 0 0 0 6.4 6.4l1.5-1.4" />
</>
),
plus: <path d="M12 5v14M5 12h14" />,
minus: <path d="M5 12h14" />,
fit: <path d="M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5" />,
close: <path d="m6 6 12 12M18 6 6 18" />,
chevron: <path d="m6 9 6 6 6-6" />,
check: <path d="m5 12.5 4.5 4.5L19 7" />,
alert: (
<>
<circle cx="12" cy="12" r="9" />
<path d="M12 7.5v5.5M12 16.5h.01" />
</>
),
info: (
<>
<circle cx="12" cy="12" r="9" />
<path d="M12 11v5.5M12 7.5h.01" />
</>
),
spinner: <path d="M12 3a9 9 0 1 0 9 9" />,
}
export type IconName = keyof typeof P
export function Icon({
name,
size = 16,
...rest
}: { name: IconName; size?: number } & SVGAttributes<SVGSVGElement>) {
return (
<svg
class={name === 'spinner' ? 'icon spin' : 'icon'}
width={size}
height={size}
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width={2}
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
{...rest}
>
{P[name]}
</svg>
)
}

View file

@ -0,0 +1,61 @@
import { useRef } from 'preact/hooks'
export interface SegOption<T extends string> {
value: T
label: string
}
/** Segmented control: a radio group of buttons with roving focus and arrow-key navigation. */
export function Segmented<T extends string>({
options,
value,
onChange,
label,
size = 'md',
}: {
options: SegOption<T>[]
value: T
onChange: (v: T) => void
label: string
size?: 'sm' | 'md'
}) {
const root = useRef<HTMLDivElement>(null)
const idx = Math.max(
0,
options.findIndex((o) => o.value === value),
)
const move = (d: number) => {
const next = (idx + d + options.length) % options.length
onChange(options[next].value)
root.current?.querySelectorAll<HTMLButtonElement>('button')[next]?.focus()
}
return (
<div
ref={root}
class={`seg seg-${size}`}
role="radiogroup"
aria-label={label}
style={{ '--n': options.length, '--i': idx }}
onKeyDown={(e) => {
if (e.key === 'ArrowRight' || e.key === 'ArrowDown') move(1)
else if (e.key === 'ArrowLeft' || e.key === 'ArrowUp') move(-1)
else return
e.preventDefault()
}}
>
<span class="seg-thumb" aria-hidden="true" />
{options.map((o) => (
<button
key={o.value}
type="button"
role="radio"
aria-checked={o.value === value}
tabIndex={o.value === value ? 0 : -1}
onClick={() => onChange(o.value)}
>
{o.label}
</button>
))}
</div>
)
}

View file

@ -0,0 +1,25 @@
import type { ComponentChildren } from 'preact'
/** A checkbox presented as an on/off switch. */
export function Switch({
checked,
onChange,
children,
}: {
checked: boolean
onChange: (v: boolean) => void
children: ComponentChildren
}) {
return (
<label class="switch">
<input
type="checkbox"
role="switch"
checked={checked}
onChange={(e) => onChange(e.currentTarget.checked)}
/>
<span class="switch-track" aria-hidden="true" />
<span class="switch-label">{children}</span>
</label>
)
}

103
src/export.ts Normal file
View file

@ -0,0 +1,103 @@
import { BASE } from './basemap'
import { buildings, catColor, catLabel, catOrder } from './categories'
import { m2ll } from './geo'
import { ruianUseName } from './i18n'
import { drawLegend, drawScene, legendLayout, pxPerMeter } from './render'
import { base, hidden, S, showBase, vp } from './state'
import { LIGHT } from './theme'
import type { Ring } from './types'
/* ================= export ================= */
function download(blob: Blob, name: string) {
const a = document.createElement('a')
a.href = URL.createObjectURL(blob)
a.download = name
document.body.appendChild(a)
a.click()
a.remove()
setTimeout(() => URL.revokeObjectURL(a.href), 4000)
}
export function exportPng() {
if (!S.loaded) return
const { W, H } = vp,
r = 2,
lh = legendLayout(W).h
const oc = document.createElement('canvas')
oc.width = W * r
oc.height = (H + lh) * r
const c = oc.getContext('2d')!
drawScene(c, W, H, S.view, r, {})
drawLegend(c, H, W, r)
oc.toBlob((b) => {
if (b) download(b, 'building-use-map.png')
}, 'image/png')
}
export function exportSvg() {
if (!S.loaded) return
const { W, H } = vp,
v = S.view,
ppm = pxPerMeter(v)
const sx = (x: number) => ((x - v.cx) * v.s + W / 2).toFixed(1),
sy = (y: number) => (H / 2 - (y - v.cy) * v.s).toFixed(1)
const d = (rings: Ring[], close: boolean) =>
rings
.map((r) => 'M' + r.map((p) => sx(p[0]) + ' ' + sy(p[1])).join('L') + (close ? 'Z' : ''))
.join('')
const { e, colW, rows, h: lh } = legendLayout(W)
let o = ''
o += `<svg xmlns="http://www.w3.org/2000/svg" width="${W}" height="${H + lh}" viewBox="0 0 ${W} ${H + lh}"><defs><clipPath id="c"><rect width="${W}" height="${H}"/></clipPath></defs>`
o += `<rect width="${W}" height="${H}" fill="${LIGHT.bg}"/><g clip-path="url(#c)" stroke-linejoin="round" stroke-linecap="round">`
if (showBase.value)
for (const st of BASE) {
const rings = base.value[st.k]
if (!rings || !rings.length) continue
if (st.t === 'poly')
o += `<path d="${d(rings, true)}" fill="${LIGHT.base[st.fill]}" fill-rule="evenodd"${st.stroke ? ` stroke="${LIGHT.base[st.stroke]}" stroke-width="1"` : ''}/>`
else
o += `<path d="${d(rings, false)}" fill="none" stroke="${LIGHT.base[st.c]}" stroke-width="${Math.max(st.min, st.m * ppm).toFixed(1)}"${st.dash ? ` stroke-dasharray="${st.dash.map((x) => x * Math.max(1, ppm / 2)).join(' ')}"` : ''}/>`
}
for (const key of catOrder()) {
if (hidden.value.has(key)) continue
const rings: Ring[] = []
for (const b of buildings.value) if (b.cat === key) for (const r of b.rings) rings.push(r)
if (rings.length)
o += `<path d="${d(rings, true)}" fill="${catColor(key)}" fill-rule="evenodd" stroke="${key === 'res' || key === 'u7' ? '#ffffff88' : '#00000088'}" stroke-width=".5"/>`
}
o += '</g>'
o += `<rect y="${H}" width="${W}" height="${lh}" fill="#fff"/><g font-family="system-ui,sans-serif" font-size="12">`
e.forEach((it, i) => {
const c = Math.floor(i / rows),
rr = i % rows,
x = 14 + c * colW,
y = H + 14 + rr * 20
o += `<rect x="${x}" y="${y - 6}" width="18" height="12" fill="${it.color}" stroke="${it.border || '#555'}"/><text x="${x + 26}" y="${y + 4}">${it.label.replace(/&/g, '&amp;').replace(/</g, '&lt;')}</text>`
})
o += '</g></svg>'
download(new Blob([o], { type: 'image/svg+xml' }), 'building-use-map.svg')
}
export function exportCsv() {
if (!S.loaded) return
const q = (s: unknown) => '"' + String(s).replace(/"/g, '""') + '"'
let o =
'house_no,ruian_use_code,ruian_use,category,flats,floors,built_up_area_m2,completed,lat,lon\n'
for (const b of buildings.value) {
const ll = m2ll((b.bb[0] + b.bb[2]) / 2, (b.bb[1] + b.bb[3]) / 2)
o +=
[
q(b.cp),
b.use,
q(ruianUseName(b.use)),
q(catLabel(b.cat)),
b.flats ?? '',
b.floors ?? '',
b.area ?? '',
b.year ?? '',
ll[1].toFixed(6),
ll[0].toFixed(6),
].join(',') + '\n'
}
download(new Blob(['' + o], { type: 'text/csv;charset=utf-8' }), 'buildings.csv') // BOM so Excel reads UTF-8
}

165
src/fetch.ts Normal file
View file

@ -0,0 +1,165 @@
import { ZAB_LAYERS, type BaseKey } from './basemap'
import { mkBuilding } from './building'
import { D2R } from './geo'
import type { AreaData, BaseData, Ring } from './types'
import { errMsg, sleep } from './util'
/* ================= fetching from ČÚZK ================= */
const RUIAN = 'https://ags.cuzk.cz/arcgis/rest/services/RUIAN/MapServer/3/query'
const ZAB = 'https://ags.cuzk.cz/arcgis/rest/services/ZABAGED_POLOHOPIS/MapServer/'
interface Feature {
attributes?: Record<string, unknown>
geometry?: { rings?: Ring[]; paths?: Ring[] }
}
interface QueryResult {
features?: Feature[]
exceededTransferLimit?: boolean
error?: { message?: string }
}
type Settled<T> = { ok: true; v: T } | { ok: false; e: unknown }
async function query(
url: string,
fields: string,
env: string,
offset?: number,
): Promise<QueryResult> {
const p: Record<string, string> = {
geometry: env,
geometryType: 'esriGeometryEnvelope',
inSR: '4326',
outSR: '3857',
spatialRel: 'esriSpatialRelIntersects',
where: '1=1',
outFields: fields,
returnGeometry: 'true',
geometryPrecision: '1',
maxAllowableOffset: '0.3',
f: 'json',
}
if (offset) {
p.resultOffset = String(offset)
p.resultRecordCount = '1000'
}
// No AbortSignal / fetch options: some embedded viewers proxy fetch through postMessage and cannot clone them.
const url2 = url + '?' + new URLSearchParams(p)
let timer: ReturnType<typeof setTimeout> | undefined
const timeout = new Promise<never>((_, rej) => {
timer = setTimeout(() => rej(new Error('timed out after 45 s')), 45000)
})
try {
const res = await Promise.race([fetch(url2), timeout])
if (!res.ok) throw new Error('HTTP ' + res.status)
const j = (await Promise.race([res.json(), timeout])) as QueryResult
if (j.error) throw new Error(j.error.message || 'service error')
return j
} finally {
clearTimeout(timer)
}
}
async function queryAll(url: string, fields: string, env: string): Promise<Feature[]> {
let out: Feature[] = [],
off = 0
for (let page = 0; page < 12; page++) {
let j: QueryResult
try {
j = await query(url, fields, env, off)
} catch (e) {
if (off > 0) break
throw e
}
const f = j.features || []
out = out.concat(f)
if (!j.exceededTransferLimit || !f.length) break
off += f.length
}
return out
}
const lowerKeys = (o: Record<string, unknown> | undefined): Record<string, unknown> =>
Object.fromEntries(Object.entries(o || {}).map(([k, v]) => [k.toLowerCase(), v]))
const ringsOf = (f: Feature): Ring[] => (f.geometry && (f.geometry.rings || f.geometry.paths)) || []
/** Run async tasks, at most n at a time. */
async function pool<T>(tasks: (() => Promise<T>)[], n: number): Promise<Settled<T>[]> {
const out = Array.from({ length: tasks.length }) as Settled<T>[]
let i = 0
await Promise.all(
Array.from({ length: Math.min(n, tasks.length) }, async () => {
while (i < tasks.length) {
const k = i++
try {
out[k] = { ok: true, v: await tasks[k]() }
} catch (e) {
out[k] = { ok: false, e }
}
}
}),
)
return out
}
/** Retry, then try an explicit field instead of an empty field list. */
async function baseLayer(id: number, env: string): Promise<Feature[]> {
let last: unknown
for (const fields of ['', 'objectid', '']) {
try {
return await queryAll(ZAB + id + '/query', fields, env)
} catch (e) {
last = e
await sleep(500)
}
}
throw last
}
export async function fetchArea(
lon: number,
lat: number,
radius: number,
onProgress?: (done: number, total: number) => void,
): Promise<AreaData> {
const dLat = (radius * 1.1) / 111320,
dLon = (radius * 1.1) / (111320 * Math.cos(lat * D2R))
const env = [lon - dLon, lat - dLat, lon + dLon, lat + dLat].map((v) => v.toFixed(6)).join(',')
const fields = 'cisladomovni,zpusobvyuzitikod,pocetbytu,pocetpodlazi,zastavenaplocha,dokonceni'
const keys = Object.keys(ZAB_LAYERS) as BaseKey[]
const total = keys.length + 1
let done = 0
const tick = () => onProgress?.(++done, total)
// Buildings and basemap layers load in parallel (4 requests at a time overall). If the
// buildings query fails there is nothing to show, so fail right away instead of waiting
// for the basemap retries.
const buildingsP = queryAll(RUIAN, fields, env).finally(tick)
const basesP = pool(
keys.map((k) => () => baseLayer(ZAB_LAYERS[k], env).finally(tick)),
3,
)
const features = await buildingsP
const res = await basesP
const base: BaseData = {},
fails: string[] = []
keys.forEach((k, i) => {
const r = res[i]
if (r.ok) base[k] = r.v.flatMap(ringsOf)
else {
base[k] = []
fails.push(k + ': ' + errMsg(r.e))
}
})
type N = number | null
const buildings = features
.map((f) => {
const a = lowerKeys(f.attributes)
return mkBuilding(
a.cisladomovni as string | null,
a.zpusobvyuzitikod as N,
a.pocetbytu as N,
a.pocetpodlazi as N,
a.zastavenaplocha as N,
a.dokonceni as N,
ringsOf(f),
)
})
.filter((b) => b.rings.length)
return { buildings, base, fails }
}

25
src/geo.ts Normal file
View file

@ -0,0 +1,25 @@
import type { LatLon } from './types'
/* ================= geometry helpers ================= */
export const R = 6378137,
D2R = Math.PI / 180
/** Web Mercator metres → [lon, lat] */
export const m2ll = (x: number, y: number): [number, number] => [
x / R / D2R,
(2 * Math.atan(Math.exp(y / R)) - Math.PI / 2) / D2R,
]
/* ================= location parsing ================= */
export function parseLoc(text: string): LatLon | null {
text = (text || '').trim()
const m = text.match(/[?&]x=(-?\d+(?:\.\d+)?)/),
n = text.match(/[?&]y=(-?\d+(?:\.\d+)?)/)
if (m && n) return { lon: +m[1], lat: +n[1] }
const nums = (text.match(/-?\d+(?:\.\d+)?/g) || []).map(Number)
if (nums.length >= 2) {
const [a, b] = nums
if (a >= 48 && a <= 52 && b >= 12 && b <= 19) return { lat: a, lon: b }
if (b >= 48 && b <= 52 && a >= 12 && a <= 19) return { lat: b, lon: a }
}
return null
}

258
src/i18n.ts Normal file
View file

@ -0,0 +1,258 @@
import { persisted } from './persist'
/* ================= i18n ================= */
export type Lang = 'en' | 'cs'
const en = {
title: 'Building-use map',
subtitle: 'Czechia · RÚIAN buildings over ZABAGED roads & rivers (ČÚZK)',
locLabel: 'Location – Mapy.com link, “lat, lon”, or “lon, lat”',
radius: 'Radius',
load: 'Load area',
layers: 'Layers',
display: 'Display',
colorMode: 'Colour scheme',
modeSimple: 'Simple – grouped categories',
modeDetailed: 'Detailed – one colour per use code',
mixLabel: 'Mixed-use rule',
mix1: 'Non-residential use with ≥ 1 flat',
mix2: 'Non-residential use with ≥ 2 flats',
mix0: 'Off',
optBase: 'Roads, rivers, green areas',
optNums: 'House numbers when zoomed in',
export: 'Export',
csv: 'CSV table',
print: 'Print / PDF',
note: 'Colours come from the registered use (způsob využití) in RÚIAN. RÚIAN has no “mixed” class, so orange marks buildings whose registered use is non-residential (shop, civic, technical…) but which also have flats. Apartment blocks with shops on the ground floor are still registered as apartment buildings and stay red.<br><br>Data © ČÚZK (RÚIAN, ZABAGED). Drag to pan, scroll or pinch to zoom, click a building for details.',
nBuildings: (n: number) => `${n} buildings`,
st_loading: 'Loading buildings and basemap from ČÚZK…',
st_progress: (n: number, m: number) => `Loading from ČÚZK… ${n}/${m} requests done`,
st_loaded: (loc: string, n: number) => `${loc}: ${n} buildings.`,
st_baseFail: (n: number) => `${n} basemap layer(s) could not be loaded`,
st_none: 'No buildings found here (outside Czechia, or an empty area).',
st_badLoc: 'Could not read a location. Paste a Mapy.com link or "50.8171, 14.9687".',
st_err: (e: string) =>
`Could not load data from ČÚZK: ${e}\nThe service may be down, you may be offline, or this page is running somewhere that blocks requests to other sites (some embedded viewers do). Opening the file directly in a browser or hosting it yourself works.`,
st_fallback: (e: string) =>
`Showing the built-in example area (Chrastava centre) because live data could not be loaded: ${e}`,
st_init: 'Loading live data…',
hn: (n: string) => `č.p. ${n}`,
nohn: 'No house number',
i_cat: 'Category',
i_use: 'RÚIAN use',
i_flats: 'Flats',
i_floors: 'Floors',
i_area: 'Built-up area',
i_done: 'Completed',
i_pos: 'Position',
b_water: 'River / water',
b_green: 'Green area / garden',
b_road: 'Main road',
b_street: 'Street',
zoomIn: 'Zoom in (+)',
zoomOut: 'Zoom out (−)',
fit: 'Fit area (0)',
close: 'Close',
lang: 'Language',
area: 'Area',
locate: 'Use my location',
locating: 'Finding your location…',
geo_denied: 'Location access was denied.',
geo_unavailable: 'Your location is not available.',
geo_outside: 'Your location is outside Czechia.',
copyLink: 'Copy link to this area',
linkCopied: 'Link copied to clipboard',
details: 'Details',
about: 'About the data',
all: 'All',
none: 'None',
onlyHint: 'Alt-click or double-click to show only this category',
loadingPill: (n: number, m: number) => `Loading ${n}/${m}`,
loadingStart: 'Connecting…',
panel: 'Show or hide the panel',
saved: 'Saved',
shortcuts: 'Shortcuts: + / − zoom · 0 fit · arrow keys pan · Esc close',
mapLabel: 'Map of building use',
'cat.res': 'Residential – family house',
'cat.unit': 'Unit housing – apartment building',
'cat.rec': 'Recreational / garden house (chata)',
'cat.mix': 'Mixed – non-residential use + flats',
'cat.civic': 'Public / civic (admin, school, health…)',
'cat.assem': 'Assembly (church, hall, club)',
'cat.shop': 'Commercial – shop',
'cat.hotel': 'Accommodation',
'cat.office': 'Administration / office',
'cat.ind': 'Industrial / production / storage',
'cat.agri': 'Agricultural',
'cat.tech': 'Technical / transport',
'cat.garage': 'Garage',
'cat.other': 'Other / outbuilding / shed',
use: {
1: 'Industrial building',
2: 'Farmstead',
3: 'Dwelling (generic)',
4: 'Forestry building',
5: 'Civic amenity building',
6: 'Apartment building',
7: 'Family house',
8: 'Family recreation building (chata)',
9: 'Assembly building',
10: 'Shop',
11: 'Accommodation building',
12: 'Production & storage',
13: 'Agricultural building',
14: 'Administration building',
15: 'Civic facilities building',
16: 'Technical facilities building',
17: 'Transport building',
18: 'Garage',
19: 'Other building',
20: 'Multi-purpose building',
21: 'Greenhouse',
w: 'Water structures (dams, weirs…)',
0: 'No registered use',
} as Record<string, string>,
}
type Dict = typeof en
export type MsgKey = Exclude<keyof Dict, 'use'>
type Args<K extends MsgKey> = Dict[K] extends (...a: infer P) => string ? P : []
const cs: Dict = {
title: 'Mapa využití budov',
subtitle: 'Česko · budovy z RÚIAN nad silnicemi a vodními toky ZABAGED (ČÚZK)',
locLabel: 'Poloha – odkaz z Mapy.com, „šířka, délka“ nebo „délka, šířka“',
radius: 'Poloměr',
load: 'Načíst oblast',
layers: 'Vrstvy',
display: 'Zobrazení',
colorMode: 'Barevné schéma',
modeSimple: 'Jednoduché – sloučené kategorie',
modeDetailed: 'Podrobné – každý druh využití zvlášť',
mixLabel: 'Pravidlo pro smíšené využití',
mix1: 'Nebytové využití s ≥ 1 bytem',
mix2: 'Nebytové využití s ≥ 2 byty',
mix0: 'Vypnuto',
optBase: 'Silnice, řeky, zeleň',
optNums: 'Čísla popisná při přiblížení',
export: 'Export',
csv: 'Tabulka CSV',
print: 'Tisk / PDF',
note: 'Barvy vycházejí ze způsobu využití zapsaného v RÚIAN. RÚIAN nemá třídu „smíšený“, proto oranžová označuje budovy, jejichž zapsané využití je nebytové (obchod, občanská vybavenost, technické…), ale které mají i byty. Bytové domy s obchodem v přízemí jsou v registru vedeny jako bytové domy, a zůstávají proto červené.<br><br>Data © ČÚZK (RÚIAN, ZABAGED). Tažením posouváte mapu, kolečkem nebo štípnutím přibližujete, kliknutím na budovu zobrazíte podrobnosti.',
nBuildings: (n) => `${n} budov`,
st_loading: 'Načítám budovy a podklad z ČÚZK…',
st_progress: (n, m) => `Načítání z ČÚZK… hotovo ${n}/${m} dotazů`,
st_loaded: (loc, n) => `${loc}: ${n} budov.`,
st_baseFail: (n) => `Nepodařilo se načíst vrstev podkladu: ${n}`,
st_none: 'Na tomto místě nejsou žádné budovy (mimo Česko, nebo prázdná oblast).',
st_badLoc: 'Polohu se nepodařilo přečíst. Vložte odkaz z Mapy.com nebo „50.8171, 14.9687“.',
st_err: (e) =>
`Data z ČÚZK se nepodařilo načíst: ${e}\nSlužba může být nedostupná, můžete být offline, nebo stránka běží v prostředí, které blokuje požadavky na jiné weby (některé vestavěné prohlížeče). Otevření souboru přímo v prohlížeči nebo vlastní hosting funguje.`,
st_fallback: (e) =>
`Zobrazen vestavěný příklad (centrum Chrastavy), protože se živá data nepodařilo načíst: ${e}`,
st_init: 'Načítám živá data…',
hn: (n) => `č.p. ${n}`,
nohn: 'Bez čísla popisného',
i_cat: 'Kategorie',
i_use: 'Využití v RÚIAN',
i_flats: 'Byty',
i_floors: 'Podlaží',
i_area: 'Zastavěná plocha',
i_done: 'Dokončeno',
i_pos: 'Poloha',
b_water: 'Řeka / voda',
b_green: 'Zeleň / zahrady',
b_road: 'Silnice',
b_street: 'Ulice',
zoomIn: 'Přiblížit (+)',
zoomOut: 'Oddálit (−)',
fit: 'Celá oblast (0)',
close: 'Zavřít',
lang: 'Jazyk',
area: 'Oblast',
locate: 'Použít moji polohu',
locating: 'Zjišťuji vaši polohu…',
geo_denied: 'Přístup k poloze byl zamítnut.',
geo_unavailable: 'Poloha není k dispozici.',
geo_outside: 'Vaše poloha je mimo Česko.',
copyLink: 'Kopírovat odkaz na tuto oblast',
linkCopied: 'Odkaz zkopírován do schránky',
details: 'Podrobnosti',
about: 'O datech',
all: 'Vše',
none: 'Nic',
onlyHint: 'Alt+kliknutím nebo dvojklikem zobrazíte jen tuto kategorii',
loadingPill: (n, m) => `Načítání ${n}/${m}`,
loadingStart: 'Připojuji…',
panel: 'Zobrazit nebo skrýt panel',
saved: 'Uloženo',
shortcuts: 'Zkratky: + / − přiblížení · 0 celá oblast · šipky posun · Esc zavřít',
mapLabel: 'Mapa využití budov',
'cat.res': 'Bydlení – rodinný dům',
'cat.unit': 'Bytové domy',
'cat.rec': 'Rekreace / zahrádkářské chaty',
'cat.mix': 'Smíšené – nebytové využití + byty',
'cat.civic': 'Veřejné / občanská vybavenost (úřady, školy, zdravotnictví…)',
'cat.assem': 'Shromažďování (kostel, sál, klub)',
'cat.shop': 'Obchod',
'cat.hotel': 'Ubytování',
'cat.office': 'Administrativa / kanceláře',
'cat.ind': 'Průmysl / výroba / sklady',
'cat.agri': 'Zemědělství',
'cat.tech': 'Technické / doprava',
'cat.garage': 'Garáž',
'cat.other': 'Ostatní / hospodářské budovy / kůlny',
use: {
1: 'Průmyslový objekt',
2: 'Zemědělská usedlost',
3: 'Objekt k bydlení',
4: 'Objekt lesního hospodářství',
5: 'Objekt občanské vybavenosti',
6: 'Bytový dům',
7: 'Rodinný dům',
8: 'Stavba pro rodinnou rekreaci',
9: 'Stavba pro shromažďování většího počtu osob',
10: 'Stavba pro obchod',
11: 'Stavba ubytovacího zařízení',
12: 'Stavba pro výrobu a skladování',
13: 'Zemědělská stavba',
14: 'Stavba pro administrativu',
15: 'Stavba občanského vybavení',
16: 'Stavba technického vybavení',
17: 'Stavba pro dopravu',
18: 'Garáž',
19: 'Jiná stavba',
20: 'Víceúčelová stavba',
21: 'Skleník',
w: 'Vodní stavby (přehrady, jezy…)',
0: 'Bez zapsaného využití',
},
}
const L: Record<Lang, Dict> = { en, cs }
function detectLang(): Lang {
const prefs =
navigator.languages && navigator.languages.length
? navigator.languages
: [navigator.language || 'en']
return String(prefs[0] || 'en')
.toLowerCase()
.startsWith('cs')
? 'cs'
: 'en'
}
/** Current UI language (remembered). Components that call t() re-render when it changes. */
export const lang = persisted<Lang>('lang', detectLang(), (v) => v === 'cs' || v === 'en')
/** Translate a known message key; function-valued messages take typed arguments. */
export function t<K extends MsgKey>(k: K, ...a: Args<K>): string {
const v = L[lang.value][k] !== undefined ? L[lang.value][k] : L.en[k]
return typeof v === 'function' ? (v as (...x: unknown[]) => string)(...a) : (v as string)
}
/** Translate a key built at runtime (e.g. 'cat.' + key); falls back to the key itself. */
export function tKey(k: string): string {
const get = (d: Dict) => (d as unknown as Record<string, unknown>)[k]
const v = get(L[lang.value]) !== undefined ? get(L[lang.value]) : get(L.en)
return typeof v === 'function' ? v() : v === undefined ? k : String(v)
}
export const ruianUseName = (u: number | string): string =>
L[lang.value].use[u] || L.en.use[u] || ''

17
src/index.html Normal file
View file

@ -0,0 +1,17 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Building-use map – Czechia (RÚIAN)</title>
<!--
Vite entry page; the UI is rendered by Preact (src/components). `bun run dev` for development, `bun run build` writes the minified app to dist/ (serve it as static files).
Data: live queries to the public ČÚZK ArcGIS services (RÚIAN buildings, ZABAGED roads/water/green), © ČÚZK.
A small built-in example area is used as a fallback when the live service cannot be reached.
-->
</head>
<body>
<div id="root"></div>
<script type="module" src="./main.tsx"></script>
</body>
</html>

289
src/interaction.ts Normal file
View file

@ -0,0 +1,289 @@
import { buildings } from './categories'
import { draw, fitTarget, requestDraw } from './render'
import { hidden, hover, S, sel, sheetOpen, vp } from './state'
import type { Building, Point, Ring, View } from './types'
const reducedMotion = () =>
typeof matchMedia === 'function' && matchMedia('(prefers-reduced-motion: reduce)').matches
/* ================= hit testing ================= */
function inRing(x: number, y: number, ring: Ring): boolean {
let inside = false
for (let i = 0, j = ring.length - 1; i < ring.length; j = i++) {
const a = ring[i],
b = ring[j]
if (a[1] > y !== b[1] > y && x < ((b[0] - a[0]) * (y - a[1])) / (b[1] - a[1]) + a[0])
inside = !inside
}
return inside
}
function pick(px: number, py: number): Building | null {
const v = S.view,
x = (px - vp.W / 2) / v.s + v.cx,
y = (vp.H / 2 - py) / v.s + v.cy,
pad = 2 / v.s
const list = buildings.value,
hid = hidden.value
for (let i = list.length - 1; i >= 0; i--) {
const b = list[i]
if (
hid.has(b.cat) ||
x < b.bb[0] - pad ||
x > b.bb[2] + pad ||
y < b.bb[1] - pad ||
y > b.bb[3] + pad
)
continue
let hit = false
for (const r of b.rings) if (inRing(x, y, r)) hit = !hit
if (hit) return b
}
return null
}
/* ================= view animation ================= */
const MIN_S = 0.02,
MAX_S = 40
const clampS = (s: number) => Math.min(Math.max(s, MIN_S), MAX_S)
let anim = 0
/** Stop any running zoom animation or pan inertia. */
function stopMotion() {
if (anim) cancelAnimationFrame(anim)
anim = 0
}
const easeOutCubic = (k: number) => 1 - (1 - k) ** 3
/** Animate the view to `to` (scale interpolated logarithmically so zooming feels even). */
export function animateTo(to: View, ms = 240) {
stopMotion()
if (reducedMotion()) {
S.view = to
requestDraw()
return
}
const from = { ...S.view },
t0 = performance.now()
const step = (now: number) => {
const k = Math.min(1, (now - t0) / ms),
e = easeOutCubic(k)
S.view = {
cx: from.cx + (to.cx - from.cx) * e,
cy: from.cy + (to.cy - from.cy) * e,
s: from.s * (to.s / from.s) ** e,
}
draw()
anim = k < 1 ? requestAnimationFrame(step) : 0
}
anim = requestAnimationFrame(step)
}
/** View after zooming by factor f around screen point (px, py). */
function zoomedView(px: number, py: number, f: number): View {
const v = S.view,
ns = clampS(v.s * f)
const x = (px - vp.W / 2) / v.s + v.cx,
y = (vp.H / 2 - py) / v.s + v.cy
return { cx: x - (px - vp.W / 2) / ns, cy: y + (py - vp.H / 2) / ns, s: ns }
}
/** Immediate zoom (wheel, pinch). */
function zoomAt(px: number, py: number, f: number) {
stopMotion()
S.view = zoomedView(px, py, f)
requestDraw()
}
/** Animated zoom around the centre of the map (buttons, keyboard). */
export const zoomBy = (f: number) => animateTo(zoomedView(vp.W / 2, vp.H / 2, f))
export function zoomFit() {
const v = fitTarget()
if (v) animateTo(v, 320)
}
/** Animated pan by a fraction of the canvas size. */
function panBy(fx: number, fy: number) {
const v = S.view
animateTo({ ...v, cx: v.cx + (fx * vp.W) / v.s, cy: v.cy - (fy * vp.H) / v.s }, 200)
}
/** Match the canvas backing store to the stage size and redraw. */
export function resize(stage: HTMLElement, cv: HTMLCanvasElement, insetB: number) {
const r = stage.getBoundingClientRect()
vp.DPR = Math.min(window.devicePixelRatio || 1, 3)
const oldW = vp.W
vp.W = Math.max(1, Math.floor(r.width))
vp.H = Math.max(1, Math.floor(r.height))
vp.insetB = insetB
cv.width = vp.W * vp.DPR
cv.height = vp.H * vp.DPR
if (S.loaded && !oldW) {
const v = fitTarget() // data arrived before the canvas had a size
if (v) S.view = v
}
draw() // synchronously: resizing the canvas has just cleared it
}
/* ================= pointer ================= */
/** Pointer/wheel handling on the map canvas. Returns a cleanup function. */
export function attachPointer(cv: HTMLCanvasElement): () => void {
const ptrs = new Map<number, Point>()
let dragMoved = 0,
lastPinch = 0
// recent pointer positions for pan inertia
let trail: { x: number; y: number; t: number }[] = []
const setHover = (b: Building | null, x: number, y: number) => {
hover.value = b ? { b, x, y } : null
cv.classList.toggle('over', !!b)
}
const down = (e: PointerEvent) => {
stopMotion()
cv.setPointerCapture(e.pointerId)
ptrs.set(e.pointerId, [e.offsetX, e.offsetY])
dragMoved = 0
trail = [{ x: e.offsetX, y: e.offsetY, t: e.timeStamp }]
cv.classList.add('drag')
if (ptrs.size === 2) {
const [a, b] = [...ptrs.values()]
lastPinch = Math.hypot(a[0] - b[0], a[1] - b[1])
}
}
const move = (e: PointerEvent) => {
const prev = ptrs.get(e.pointerId)
if (prev) {
ptrs.set(e.pointerId, [e.offsetX, e.offsetY])
if (ptrs.size === 1) {
const dx = e.offsetX - prev[0],
dy = e.offsetY - prev[1]
dragMoved += Math.abs(dx) + Math.abs(dy)
S.view.cx -= dx / S.view.s
S.view.cy += dy / S.view.s
trail.push({ x: e.offsetX, y: e.offsetY, t: e.timeStamp })
if (trail.length > 8) trail.shift()
requestDraw()
if (dragMoved > 3) setHover(null, 0, 0)
} else if (ptrs.size === 2) {
const [a, b] = [...ptrs.values()],
d = Math.hypot(a[0] - b[0], a[1] - b[1])
if (lastPinch) zoomAt((a[0] + b[0]) / 2, (a[1] + b[1]) / 2, d / lastPinch)
lastPinch = d
dragMoved = 99
trail = []
}
return
}
if (e.pointerType === 'touch') return // no hover on touch
setHover(pick(e.offsetX, e.offsetY), e.offsetX, e.offsetY)
}
const end = (e: PointerEvent) => {
const had = ptrs.delete(e.pointerId)
cv.classList.remove('drag')
lastPinch = 0
if (!had || e.type !== 'pointerup') return
if (dragMoved < 5) {
sel.value = pick(e.offsetX, e.offsetY)
return
}
if (ptrs.size === 0) fling(e.timeStamp)
}
/** Keep panning after a quick drag, slowing down with friction. */
const fling = (now: number) => {
const recent = trail.filter((p) => now - p.t < 80)
if (recent.length < 2 || reducedMotion()) return
const a = recent[0],
b = recent[recent.length - 1],
dt = Math.max(1, b.t - a.t)
let vx = (b.x - a.x) / dt,
vy = (b.y - a.y) / dt // px per ms
if (Math.hypot(vx, vy) < 0.15) return
let last = performance.now()
const step = (t: number) => {
const ms = Math.min(32, t - last)
last = t
S.view.cx -= (vx * ms) / S.view.s
S.view.cy += (vy * ms) / S.view.s
const decay = 0.994 ** ms
vx *= decay
vy *= decay
draw()
anim = Math.hypot(vx, vy) > 0.02 ? requestAnimationFrame(step) : 0
}
stopMotion()
anim = requestAnimationFrame(step)
}
const leave = () => setHover(null, 0, 0)
const wheel = (e: WheelEvent) => {
e.preventDefault()
const dy = e.deltaMode === 1 ? e.deltaY * 16 : e.deltaY // Firefox may report lines
// trackpad pinch arrives as ctrl+wheel with small deltas
zoomAt(e.offsetX, e.offsetY, Math.exp(-dy * (e.ctrlKey ? 0.01 : 0.0015)))
}
cv.addEventListener('pointerdown', down)
cv.addEventListener('pointermove', move)
cv.addEventListener('pointerup', end)
cv.addEventListener('pointercancel', end)
cv.addEventListener('pointerleave', leave)
cv.addEventListener('wheel', wheel, { passive: false })
return () => {
stopMotion()
cv.removeEventListener('pointerdown', down)
cv.removeEventListener('pointermove', move)
cv.removeEventListener('pointerup', end)
cv.removeEventListener('pointercancel', end)
cv.removeEventListener('pointerleave', leave)
cv.removeEventListener('wheel', wheel)
}
}
/* ================= keyboard ================= */
const isTyping = (el: EventTarget | null) =>
el instanceof HTMLElement &&
(el.isContentEditable || ['INPUT', 'SELECT', 'TEXTAREA'].includes(el.tagName))
function onKey(e: KeyboardEvent) {
if (e.defaultPrevented || e.metaKey || e.ctrlKey || e.altKey) return
if (e.key === 'Escape') {
if (sel.value) sel.value = null
else if (sheetOpen.value) sheetOpen.value = false
else return
e.preventDefault()
return
}
if (isTyping(e.target)) return
switch (e.key) {
case '+':
case '=':
zoomBy(1.5)
break
case '-':
case '_':
zoomBy(1 / 1.5)
break
case '0':
zoomFit()
break
case 'ArrowLeft':
panBy(-0.2, 0)
break
case 'ArrowRight':
panBy(0.2, 0)
break
case 'ArrowUp':
panBy(0, -0.2)
break
case 'ArrowDown':
panBy(0, 0.2)
break
default:
return
}
e.preventDefault()
}
/** Global map shortcuts (ignored while typing in a form field). Returns a cleanup function. */
export function attachKeyboard(): () => void {
window.addEventListener('keydown', onKey)
return () => window.removeEventListener('keydown', onKey)
}

38
src/main.tsx Normal file
View file

@ -0,0 +1,38 @@
import { render } from 'preact'
import { applyData, liveLoad, setStatus } from './actions'
import { App } from './components/App'
import { parseLoc } from './geo'
import { t } from './i18n'
import { isOwnHash, readHash } from './persist'
import { loadSample } from './sample-data'
import { DEFAULT_LOC, lastLoc, locText, radius } from './state'
import type { LatLon } from './types'
import './style.css'
const fmt = (p: LatLon) => `${p.lat.toFixed(6)}, ${p.lon.toFixed(6)}`
/** Load the location in the URL hash (shared link), if any. Returns false if there is none. */
function loadFromHash(): boolean {
const h = readHash()
if (!h) return false
if (h.r && h.r >= 100 && h.r <= 700) radius.value = h.r
locText.value = fmt(h)
liveLoad(h, true)
return true
}
render(<App />, document.getElementById('root')!)
// Show the built-in example immediately, then replace it with live data:
// shared link → last visited area → default location.
applyData(loadSample(), 14.968678, 50.8171633)
setStatus(() => t('st_init'))
if (!loadFromHash()) {
const last = lastLoc.value
if (last) locText.value = fmt(last)
const p = last ?? parseLoc(DEFAULT_LOC)
if (p) liveLoad(p, true)
}
window.addEventListener('hashchange', () => {
if (!isOwnHash()) loadFromHash()
})

51
src/persist.ts Normal file
View file

@ -0,0 +1,51 @@
import { effect, signal, type Signal } from '@preact/signals'
import type { LatLon } from './types'
const PREFIX = 'bum-'
function read(key: string): unknown {
try {
const raw = localStorage.getItem(PREFIX + key)
if (raw == null) return undefined
try {
return JSON.parse(raw)
} catch {
return raw // older versions stored plain strings (e.g. the language)
}
} catch {
return undefined // storage blocked
}
}
/** A signal whose value is restored from and saved to localStorage. */
export function persisted<T>(key: string, initial: T, valid: (v: unknown) => boolean): Signal<T> {
const stored = read(key)
const s = signal<T>(stored !== undefined && valid(stored) ? (stored as T) : initial)
effect(() => {
const v = s.value
try {
localStorage.setItem(PREFIX + key, JSON.stringify(v))
} catch {}
})
return s
}
/* ================= shareable URL: #lat,lon,radius ================= */
export function readHash(hash = location.hash): (LatLon & { r?: number }) | null {
const m = hash.match(/^#(-?\d+(?:\.\d+)?),(-?\d+(?:\.\d+)?)(?:,(\d+))?$/)
if (!m) return null
const lat = +m[1],
lon = +m[2],
r = m[3] ? +m[3] : undefined
if (lat < 48 || lat > 52 || lon < 12 || lon > 19) return null
return { lat, lon, r }
}
let written = ''
export function writeHash(p: LatLon, r: number) {
const h = `#${p.lat.toFixed(5)},${p.lon.toFixed(5)},${r}`
written = h
if (location.hash !== h) history.replaceState(null, '', h)
}
/** True if the current hash is the one this page wrote itself (not a new link). */
export const isOwnHash = () => location.hash === written

305
src/render.ts Normal file
View file

@ -0,0 +1,305 @@
import { computed } from '@preact/signals'
import { BASE } from './basemap'
import { buildings, catColor, catLabel, catList, catOrder, isDark, SIMPLE_NUMS } from './categories'
import { t } from './i18n'
import {
base,
focusCat,
hidden,
hover,
rawBuildings,
S,
sel,
showBase,
showNums,
vp,
} from './state'
import { LIGHT, palette, type MapPalette } from './theme'
import type { Building, Ring, View } from './types'
/* ================= view ================= */
/** View that fits all loaded buildings into the canvas, or null if there is nothing to fit. */
export function fitTarget(): View | null {
const list = rawBuildings.value // bounding boxes do not depend on classification
if (!list.length) return null
let x0 = 1e18,
y0 = 1e18,
x1 = -1e18,
y1 = -1e18
for (const b of list) {
x0 = Math.min(x0, b.bb[0])
y0 = Math.min(y0, b.bb[1])
x1 = Math.max(x1, b.bb[2])
y1 = Math.max(y1, b.bb[3])
}
const w = Math.max(x1 - x0, 50),
h = Math.max(y1 - y0, 50)
// keep the area clear of the mobile bottom sheet: fit into the visible height and
// shift the centre up by half the covered strip
const visH = Math.max(1, vp.H - vp.insetB),
s = Math.min(vp.W / w, visH / h) * 0.94
return { cx: (x0 + x1) / 2, cy: (y0 + y1) / 2 - vp.insetB / 2 / s, s }
}
export function fitView() {
const v = fitTarget()
if (v) S.view = v
}
/** Screen px per true metre. */
export const pxPerMeter = (v: View) => v.s / S.K
/* ================= drawing ================= */
function niceScale(v: View) {
for (const m of [5, 10, 20, 50, 100, 200, 500, 1000]) {
const px = m * pxPerMeter(v)
if (px >= 70) return { m, px }
}
return { m: 1000, px: 1000 * pxPerMeter(v) }
}
const hoverBuilding = computed(() => hover.value?.b ?? null)
interface SceneOpts {
pal?: MapPalette
/** draw on-screen-only overlays: selection, hover outline, legend focus dimming */
live?: boolean
/** px at the bottom covered by UI (mobile sheet); the scale bar sits above it */
insetB?: number
}
export function drawScene(
ctx: CanvasRenderingContext2D,
W: number,
H: number,
v: View,
r: number,
{ pal = LIGHT, live = false, insetB = 0 }: SceneOpts = {},
) {
const list = buildings.value,
hid = hidden.value,
focus = live ? focusCat.value : null
ctx.save()
ctx.setTransform(r, 0, 0, r, 0, 0)
ctx.beginPath()
ctx.rect(0, 0, W, H)
ctx.clip()
ctx.fillStyle = pal.bg
ctx.fillRect(0, 0, W, H)
const sx = (x: number) => (x - v.cx) * v.s + W / 2,
sy = (y: number) => H / 2 - (y - v.cy) * v.s
const ppm = pxPerMeter(v)
const path = (rings: Ring[], close: boolean) => {
ctx.beginPath()
for (const ring of rings) {
for (let i = 0; i < ring.length; i++) {
const p = ring[i]
if (i) ctx.lineTo(sx(p[0]), sy(p[1]))
else ctx.moveTo(sx(p[0]), sy(p[1]))
}
if (close) ctx.closePath()
}
}
const outline = (b: Building, outer: string, w: number, inner?: string) => {
path(b.rings, true)
ctx.strokeStyle = outer
ctx.lineWidth = w
ctx.stroke()
if (inner) {
ctx.strokeStyle = inner
ctx.lineWidth = 1
ctx.stroke()
}
}
ctx.lineJoin = 'round'
ctx.lineCap = 'round'
if (showBase.value) {
const bmap = base.value
for (const st of BASE) {
const rings = bmap[st.k]
if (!rings || !rings.length) continue
if (st.t === 'poly') {
path(rings, true)
ctx.fillStyle = pal.base[st.fill]
ctx.fill('evenodd')
if (st.stroke) {
ctx.strokeStyle = pal.base[st.stroke]
ctx.lineWidth = 1
ctx.stroke()
}
} else {
path(rings, false)
ctx.strokeStyle = pal.base[st.c]
ctx.lineWidth = Math.max(st.min, st.m * ppm)
ctx.setLineDash(st.dash ? st.dash.map((d) => d * Math.max(1, ppm / 2)) : [])
ctx.stroke()
ctx.setLineDash([])
}
}
}
for (const key of catOrder()) {
if (hid.has(key)) continue
const rings: Ring[] = []
for (const b of list) if (b.cat === key) for (const rg of b.rings) rings.push(rg)
if (!rings.length) continue
// while a legend row is hovered, other categories fade back
ctx.globalAlpha = focus && focus !== key ? 0.18 : 1
path(rings, true)
ctx.fillStyle = catColor(key)
ctx.fill('evenodd')
ctx.strokeStyle = key === 'res' || key === 'u7' ? pal.outlineOnDark : pal.outlineOnLight
ctx.lineWidth = 0.5
ctx.stroke()
}
ctx.globalAlpha = 1
if (showNums.value && ppm >= 1.5) {
const all = ppm >= 3.2
ctx.textAlign = 'center'
ctx.textBaseline = 'middle'
ctx.font = `${Math.min(12, Math.max(8, ppm * 2.2))}px system-ui,sans-serif`
for (const b of list) {
if (!b.cp || hid.has(b.cat) || (focus && focus !== b.cat) || !(all || SIMPLE_NUMS[b.sc]))
continue
const cx = sx((b.bb[0] + b.bb[2]) / 2),
cy = sy((b.bb[1] + b.bb[3]) / 2)
if (cx < -20 || cy < -20 || cx > W + 20 || cy > H + 20) continue
const dark = isDark(catColor(b.cat)),
txt = b.cp.split(',')[0]
if (!dark) {
ctx.lineWidth = 2.5
ctx.strokeStyle = 'rgba(255,255,255,.8)'
ctx.strokeText(txt, cx, cy)
}
ctx.fillStyle = dark ? '#fff' : '#111'
ctx.fillText(txt, cx, cy)
}
}
if (live) {
const hb = hoverBuilding.value,
sb = sel.value
if (hb && hb !== sb && !hid.has(hb.cat)) outline(hb, pal.hover, 1.5)
if (sb) outline(sb, pal.selOuter, 3, pal.selInner)
}
// scale bar
const sc = niceScale(v),
bx = 16,
by = H - 18 - insetB
ctx.fillStyle = pal.furnitureBg
ctx.beginPath()
ctx.roundRect(bx - 8, by - 22, sc.px + 16, 32, 6)
ctx.fill()
ctx.strokeStyle = pal.furnitureInk
ctx.fillStyle = pal.furnitureInk
ctx.lineWidth = 2
ctx.beginPath()
ctx.moveTo(bx, by - 4)
ctx.lineTo(bx, by)
ctx.lineTo(bx + sc.px, by)
ctx.lineTo(bx + sc.px, by - 4)
ctx.stroke()
ctx.font = '11px system-ui,sans-serif'
ctx.textAlign = 'center'
ctx.textBaseline = 'bottom'
ctx.fillText(sc.m >= 1000 ? sc.m / 1000 + ' km' : sc.m + ' m', bx + sc.px / 2, by - 5)
// north arrow
ctx.beginPath()
ctx.moveTo(24, 44)
ctx.lineTo(24, 16)
ctx.moveTo(24, 16)
ctx.lineTo(20, 24)
ctx.moveTo(24, 16)
ctx.lineTo(28, 24)
ctx.lineWidth = 1.5
ctx.stroke()
ctx.textBaseline = 'top'
ctx.fillText('N', 24, 46)
ctx.restore()
}
/* ================= export legend ================= */
interface LegendEntry {
color: string
label: string
border?: string
}
export function counts(): Record<string, number> {
const c: Record<string, number> = {}
for (const b of buildings.value) c[b.cat] = (c[b.cat] || 0) + 1
return c
}
function legendEntries(): LegendEntry[] {
const cnt = counts(),
e: LegendEntry[] = []
for (const k of catList())
if (cnt[k]) e.push({ color: catColor(k), label: `${catLabel(k)} (${cnt[k]})` })
if (showBase.value)
e.push(
{ color: LIGHT.base.water, label: t('b_water') },
{ color: LIGHT.base.green, label: t('b_green') },
{ color: LIGHT.base.road, label: t('b_road') },
{ color: LIGHT.base.street, label: t('b_street'), border: LIGHT.base.streetCasing },
)
return e
}
export function legendLayout(W: number) {
const e = legendEntries(),
colW = Math.max(240, Math.floor(W / Math.max(1, Math.floor(W / 300))))
const cols = Math.max(1, Math.floor(W / colW)),
rows = Math.ceil(e.length / cols)
return { e, colW, rows, h: rows * 20 + 16 }
}
export function drawLegend(ctx: CanvasRenderingContext2D, y0: number, W: number, r: number) {
const { e, colW, rows, h } = legendLayout(W)
ctx.save()
ctx.setTransform(r, 0, 0, r, 0, 0)
ctx.fillStyle = '#fff'
ctx.fillRect(0, y0, W, h)
ctx.font = '12px system-ui,sans-serif'
ctx.textAlign = 'left'
ctx.textBaseline = 'middle'
e.forEach((it, i) => {
const c = Math.floor(i / rows),
rr = i % rows,
x = 14 + c * colW,
y = y0 + 14 + rr * 20
ctx.fillStyle = it.color
ctx.fillRect(x, y - 6, 18, 12)
ctx.strokeStyle = it.border || '#555'
ctx.lineWidth = 1
ctx.strokeRect(x + 0.5, y - 5.5, 17, 11)
ctx.fillStyle = '#111'
ctx.fillText(it.label, x + 26, y)
})
ctx.restore()
}
/** Redraw the on-screen map now. */
export function draw() {
if (vp.W && vp.ctx)
drawScene(vp.ctx, vp.W, vp.H, S.view, vp.DPR, { pal: palette(), live: true, insetB: vp.insetB })
}
/**
* Read every signal the on-screen map depends on. MapView runs this inside an effect so the
* map redraws when any of them changes; the redraw itself happens in requestDraw's frame.
*/
export const trackScene = () => [
buildings.value,
base.value,
hidden.value,
showBase.value,
showNums.value,
sel.value,
hoverBuilding.value,
focusCat.value,
palette(),
]
let frame = 0
/** Schedule a redraw for the next animation frame (at most one per frame). */
export function requestDraw() {
if (frame) return
frame = requestAnimationFrame(() => {
frame = 0
draw()
})
}

View file

@ -1,411 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Building-use map – Czechia (RÚIAN)</title>
<!--
Single-file app, no dependencies. Open it locally or host it as a static file.
Data: live queries to the public ČÚZK ArcGIS services (RÚIAN buildings, ZABAGED roads/water/green), © ČÚZK.
A small built-in example area is used as a fallback when the live service cannot be reached.
-->
<style>
:root{--bg:#f5f2ea;--ink:#1d1d1f;--mut:#666;--line:#d8d4c8;--acc:#1f5fbf}
*{box-sizing:border-box}
html,body{height:100%;margin:0}
body{font:14px/1.4 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;color:var(--ink);background:#fff}
#app{display:grid;grid-template-columns:340px 1fr;height:100%}
aside{overflow:auto;border-right:1px solid var(--line);padding:14px 14px 24px;background:#fbfaf6}
.head{display:flex;gap:8px;align-items:flex-start;justify-content:space-between}
h1{font-size:17px;margin:0 0 2px}
h1 small{display:block;font-weight:400;color:var(--mut);font-size:12px;margin-top:2px}
#lang{width:auto;padding:4px 6px;font-size:12px;flex:none}
h2{font-size:12px;text-transform:uppercase;letter-spacing:.06em;color:var(--mut);margin:18px 0 6px}
label{display:block;font-size:12px;color:var(--mut);margin:10px 0 3px}
input[type=text],select{width:100%;padding:7px 8px;border:1px solid #c9c5b8;border-radius:6px;font:inherit;background:#fff}
input[type=range]{width:100%}
.row{display:flex;gap:8px;margin-top:10px}
button{font:inherit;padding:7px 10px;border-radius:6px;border:1px solid var(--acc);background:var(--acc);color:#fff;cursor:pointer}
button.ghost{background:#fff;color:var(--acc)}
button:disabled{opacity:.5;cursor:default}
.row button{flex:1}
#status{margin-top:10px;font-size:12px;min-height:16px;color:var(--mut);white-space:pre-wrap}
#status.err{color:#b3261e}
#status.ok{color:#1b6e2a}
.leg{display:flex;align-items:center;gap:8px;padding:3px 0;cursor:pointer;user-select:none;color:var(--ink);font-size:14px;margin:0}
.leg input{margin:0}
.sw{width:18px;height:12px;border:1px solid #555;border-radius:2px;flex:none}
.leg .n{margin-left:auto;color:var(--mut);font-variant-numeric:tabular-nums}
.leg.off{opacity:.4}
.chk{display:flex;gap:8px;align-items:center;margin:6px 0;color:var(--ink);font-size:13px}
.chk input{margin:0}
.exp{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.note{font-size:11.5px;color:var(--mut);margin-top:14px}
main{position:relative;min-width:0;min-height:0;background:var(--bg)}
canvas{position:absolute;inset:0;width:100%;height:100%;touch-action:none;cursor:grab}
canvas.drag{cursor:grabbing}
#tip{position:absolute;pointer-events:none;background:rgba(20,20,20,.9);color:#fff;padding:5px 8px;border-radius:5px;font-size:12px;display:none;max-width:260px;z-index:3}
#info{position:absolute;left:12px;bottom:12px;background:#fff;border:1px solid var(--line);border-radius:8px;padding:10px 12px;font-size:13px;max-width:300px;display:none;box-shadow:0 2px 10px rgba(0,0,0,.12);z-index:3}
#info b{font-size:14px}
#info dl{margin:6px 0 0;display:grid;grid-template-columns:auto 1fr;gap:2px 10px}
#info dt{color:var(--mut)}
#info dd{margin:0}
#info .x{position:absolute;top:4px;right:8px;cursor:pointer;color:var(--mut)}
.zoom{position:absolute;right:12px;top:12px;display:flex;flex-direction:column;gap:6px;z-index:3}
.zoom button{width:34px;height:34px;padding:0;background:#fff;color:var(--ink);border:1px solid #bbb;font-size:18px}
@media (max-width:820px){
#app{grid-template-columns:1fr;grid-template-rows:auto 1fr}
aside{max-height:46vh;border-right:0;border-bottom:1px solid var(--line)}
main{min-height:54vh}
}
@media print{
aside,.zoom,#tip,#info{display:none!important}
#app{display:block}
main{height:100vh}
}
</style>
</head>
<body>
<div id="app">
<aside>
<div class="head">
<h1><span data-i18n="title">Building-use map</span> <small data-i18n="subtitle"></small></h1>
<select id="lang" aria-label="Language"><option value="cs">CS</option><option value="en">EN</option></select>
</div>
<label for="loc" data-i18n="locLabel"></label>
<input id="loc" type="text" value="https://mapy.com/en/turisticka?l=0&x=14.9686780&y=50.8171633&z=16.762" spellcheck="false">
<label for="radius"><span data-i18n="radius"></span> <output id="rv">300 m</output></label>
<input id="radius" type="range" min="100" max="700" step="50" value="300">
<div class="row"><button id="load" data-i18n="load"></button></div>
<div id="status"></div>
<h2><span data-i18n="layers"></span> <span id="total" style="text-transform:none;letter-spacing:0"></span></h2>
<div id="legend"></div>
<h2 data-i18n="display"></h2>
<label for="colormode" data-i18n="colorMode"></label>
<select id="colormode">
<option value="simple" data-i18n="modeSimple"></option>
<option value="detailed" data-i18n="modeDetailed"></option>
</select>
<label for="mixrule" data-i18n="mixLabel"></label>
<select id="mixrule">
<option value="1" data-i18n="mix1"></option>
<option value="2" data-i18n="mix2"></option>
<option value="0" data-i18n="mix0"></option>
</select>
<label class="chk"><input type="checkbox" id="optBase" checked> <span data-i18n="optBase"></span></label>
<label class="chk"><input type="checkbox" id="optNums" checked> <span data-i18n="optNums"></span></label>
<h2 data-i18n="export"></h2>
<div class="exp">
<button id="expPng" class="ghost">PNG</button>
<button id="expSvg" class="ghost">SVG</button>
<button id="expCsv" class="ghost" data-i18n="csv"></button>
<button id="expPrint" class="ghost" data-i18n="print"></button>
</div>
<p class="note" id="note"></p>
</aside>
<main id="stage">
<canvas id="cv"></canvas>
<div class="zoom"><button id="zin">+</button><button id="zout">−</button><button id="zfit" style="font-size:13px">⤢</button></div>
<div id="tip"></div>
<div id="info"></div>
</main>
</div>
<script>
(() => {
'use strict';
/* ================= i18n ================= */
const L = {
en: {
title: 'Building-use map',
subtitle: 'Czechia · RÚIAN buildings over ZABAGED roads & rivers (ČÚZK)',
locLabel: 'Location – Mapy.com link, “lat, lon”, or “lon, lat”',
radius: 'Radius', load: 'Load area', layers: 'Layers', display: 'Display',
colorMode: 'Colour scheme', modeSimple: 'Simple – grouped categories', modeDetailed: 'Detailed – one colour per use code',
mixLabel: 'Mixed-use rule', mix1: 'Non-residential use with ≥ 1 flat', mix2: 'Non-residential use with ≥ 2 flats', mix0: 'Off',
optBase: 'Roads, rivers, green areas', optNums: 'House numbers when zoomed in',
export: 'Export', csv: 'CSV table', print: 'Print / PDF',
note: 'Colours come from the registered use (způsob využití) in RÚIAN. RÚIAN has no “mixed” class, so orange marks buildings whose registered use is non-residential (shop, civic, technical…) but which also have flats. Apartment blocks with shops on the ground floor are still registered as apartment buildings and stay red.<br><br>Data © ČÚZK (RÚIAN, ZABAGED). Drag to pan, scroll or pinch to zoom, click a building for details.',
nBuildings: n => `· ${n} buildings`,
st_loading: 'Loading buildings and basemap from ČÚZK…',
st_progress: (n, m) => `Loading from ČÚZK… ${n}/${m} requests done`,
st_loaded: (loc, n) => `${loc}: ${n} buildings.`,
st_baseFail: n => `${n} basemap layer(s) failed:`,
st_none: 'No buildings found here (outside Czechia, or an empty area).',
st_badLoc: 'Could not read a location. Paste a Mapy.com link or "50.8171, 14.9687".',
st_err: e => `Could not load data from ČÚZK: ${e}\nThe service may be down, you may be offline, or this page is running somewhere that blocks requests to other sites (some embedded viewers do). Opening the file directly in a browser or hosting it yourself works.`,
st_fallback: e => `Showing the built-in example area (Chrastava centre) because live data could not be loaded: ${e}`,
st_init: 'Loading live data…',
hn: n => `č.p. ${n}`, nohn: 'No house number',
i_cat: 'Category', i_use: 'RÚIAN use', i_flats: 'Flats', i_floors: 'Floors', i_area: 'Built-up area', i_done: 'Completed', i_pos: 'Position',
b_water: 'River / water', b_green: 'Green area / garden', b_road: 'Main road', b_street: 'Street',
zoomIn: 'Zoom in', zoomOut: 'Zoom out', fit: 'Fit', close: 'Close',
'cat.res': 'Residential – family house', 'cat.unit': 'Unit housing – apartment building',
'cat.rec': 'Recreational / garden house (chata)', 'cat.mix': 'Mixed – non-residential use + flats',
'cat.civic': 'Public / civic (admin, school, health…)', 'cat.assem': 'Assembly (church, hall, club)',
'cat.shop': 'Commercial – shop', 'cat.hotel': 'Accommodation', 'cat.office': 'Administration / office',
'cat.ind': 'Industrial / production / storage', 'cat.agri': 'Agricultural', 'cat.tech': 'Technical / transport',
'cat.garage': 'Garage', 'cat.other': 'Other / outbuilding / shed',
use: { 1:'Industrial building', 2:'Farmstead', 3:'Dwelling (generic)', 4:'Forestry building', 5:'Civic amenity building',
6:'Apartment building', 7:'Family house', 8:'Family recreation building (chata)', 9:'Assembly building',
10:'Shop', 11:'Accommodation building', 12:'Production & storage', 13:'Agricultural building',
14:'Administration building', 15:'Civic facilities building', 16:'Technical facilities building',
17:'Transport building', 18:'Garage', 19:'Other building', 20:'Multi-purpose building', 21:'Greenhouse',
w:'Water structures (dams, weirs…)', 0:'No registered use' },
},
cs: {
title: 'Mapa využití budov',
subtitle: 'Česko · budovy z RÚIAN nad silnicemi a vodními toky ZABAGED (ČÚZK)',
locLabel: 'Poloha – odkaz z Mapy.com, „šířka, délka“ nebo „délka, šířka“',
radius: 'Poloměr', load: 'Načíst oblast', layers: 'Vrstvy', display: 'Zobrazení',
colorMode: 'Barevné schéma', modeSimple: 'Jednoduché – sloučené kategorie', modeDetailed: 'Podrobné – každý druh využití zvlášť',
mixLabel: 'Pravidlo pro smíšené využití', mix1: 'Nebytové využití s ≥ 1 bytem', mix2: 'Nebytové využití s ≥ 2 byty', mix0: 'Vypnuto',
optBase: 'Silnice, řeky, zeleň', optNums: 'Čísla popisná při přiblížení',
export: 'Export', csv: 'Tabulka CSV', print: 'Tisk / PDF',
note: 'Barvy vycházejí ze způsobu využití zapsaného v RÚIAN. RÚIAN nemá třídu „smíšený“, proto oranžová označuje budovy, jejichž zapsané využití je nebytové (obchod, občanská vybavenost, technické…), ale které mají i byty. Bytové domy s obchodem v přízemí jsou v registru vedeny jako bytové domy, a zůstávají proto červené.<br><br>Data © ČÚZK (RÚIAN, ZABAGED). Tažením posouváte mapu, kolečkem nebo štípnutím přibližujete, kliknutím na budovu zobrazíte podrobnosti.',
nBuildings: n => `· ${n} budov`,
st_loading: 'Načítám budovy a podklad z ČÚZK…',
st_progress: (n, m) => `Načítání z ČÚZK… hotovo ${n}/${m} dotazů`,
st_loaded: (loc, n) => `${loc}: ${n} budov.`,
st_baseFail: n => `Nepodařilo se načíst vrstev podkladu: ${n}`,
st_none: 'Na tomto místě nejsou žádné budovy (mimo Česko, nebo prázdná oblast).',
st_badLoc: 'Polohu se nepodařilo přečíst. Vložte odkaz z Mapy.com nebo „50.8171, 14.9687“.',
st_err: e => `Data z ČÚZK se nepodařilo načíst: ${e}\nSlužba může být nedostupná, můžete být offline, nebo stránka běží v prostředí, které blokuje požadavky na jiné weby (některé vestavěné prohlížeče). Otevření souboru přímo v prohlížeči nebo vlastní hosting funguje.`,
st_fallback: e => `Zobrazen vestavěný příklad (centrum Chrastavy), protože se živá data nepodařilo načíst: ${e}`,
st_init: 'Načítám živá data…',
hn: n => `č.p. ${n}`, nohn: 'Bez čísla popisného',
i_cat: 'Kategorie', i_use: 'Využití v RÚIAN', i_flats: 'Byty', i_floors: 'Podlaží', i_area: 'Zastavěná plocha', i_done: 'Dokončeno', i_pos: 'Poloha',
b_water: 'Řeka / voda', b_green: 'Zeleň / zahrady', b_road: 'Silnice', b_street: 'Ulice',
zoomIn: 'Přiblížit', zoomOut: 'Oddálit', fit: 'Celá oblast', close: 'Zavřít',
'cat.res': 'Bydlení – rodinný dům', 'cat.unit': 'Bytové domy',
'cat.rec': 'Rekreace / zahrádkářské chaty', 'cat.mix': 'Smíšené – nebytové využití + byty',
'cat.civic': 'Veřejné / občanská vybavenost (úřady, školy, zdravotnictví…)', 'cat.assem': 'Shromažďování (kostel, sál, klub)',
'cat.shop': 'Obchod', 'cat.hotel': 'Ubytování', 'cat.office': 'Administrativa / kanceláře',
'cat.ind': 'Průmysl / výroba / sklady', 'cat.agri': 'Zemědělství', 'cat.tech': 'Technické / doprava',
'cat.garage': 'Garáž', 'cat.other': 'Ostatní / hospodářské budovy / kůlny',
use: { 1:'Průmyslový objekt', 2:'Zemědělská usedlost', 3:'Objekt k bydlení', 4:'Objekt lesního hospodářství',
5:'Objekt občanské vybavenosti', 6:'Bytový dům', 7:'Rodinný dům', 8:'Stavba pro rodinnou rekreaci',
9:'Stavba pro shromažďování většího počtu osob', 10:'Stavba pro obchod', 11:'Stavba ubytovacího zařízení',
12:'Stavba pro výrobu a skladování', 13:'Zemědělská stavba', 14:'Stavba pro administrativu',
15:'Stavba občanského vybavení', 16:'Stavba technického vybavení', 17:'Stavba pro dopravu', 18:'Garáž',
19:'Jiná stavba', 20:'Víceúčelová stavba', 21:'Skleník',
w:'Vodní stavby (přehrady, jezy…)', 0:'Bez zapsaného využití' },
},
};
function detectLang() {
let saved = null;
try { saved = localStorage.getItem('bum-lang'); } catch (e) {}
if (saved === 'cs' || saved === 'en') return saved;
const prefs = (navigator.languages && navigator.languages.length ? navigator.languages : [navigator.language || 'en']);
return String(prefs[0] || 'en').toLowerCase().startsWith('cs') ? 'cs' : 'en';
}
let lang = detectLang();
const t = (k, ...a) => { const v = (L[lang][k] !== undefined ? L[lang][k] : L.en[k]); return typeof v === 'function' ? v(...a) : (v === undefined ? k : v); };
const useName = u => (L[lang].use[u] || L.en.use[u] || '');
/* ================= geometry helpers ================= */
const R = 6378137, D2R = Math.PI / 180;
const m2ll = (x, y) => [x / R / D2R, (2 * Math.atan(Math.exp(y / R)) - Math.PI / 2) / D2R];
/* ================= categories ================= */
// Simple scheme: key, colour, show house number
const SIMPLE = [
['res', '#000000', 0], ['unit', '#d62728', 1], ['rec', '#2ca02c', 1], ['mix', '#ff8c00', 1],
['civic', '#1f5fbf', 1], ['assem', '#4fb3e8', 1], ['shop', '#e377c2', 1], ['hotel', '#e8c000', 1],
['office', '#17808a', 1], ['ind', '#7b3294', 1], ['agri', '#8c564b', 0], ['tech', '#4d4d4d', 0],
['garage', '#d9b77e', 0], ['other', '#bdbdbd', 0],
];
const SIMPLE_COLOR = Object.fromEntries(SIMPLE.map(c => [c[0], c[1]]));
const SIMPLE_NUMS = Object.fromEntries(SIMPLE.map(c => [c[0], !!c[2]]));
const SIMPLE_ORDER = ['other', 'garage', 'agri', 'tech', 'ind', 'office', 'hotel', 'shop', 'assem', 'civic', 'res', 'unit', 'rec', 'mix'];
const USE_CAT = {1:'ind',2:'agri',4:'agri',5:'civic',6:'unit',7:'res',8:'rec',9:'assem',10:'shop',11:'hotel',12:'ind',
13:'agri',14:'office',15:'civic',16:'tech',17:'tech',18:'garage',19:'other',20:'other',21:'other'};
// Detailed scheme: one entry per RÚIAN use code
const DETAIL_COLOR = {
u1:'#7b3294', u2:'#8c564b', u3:'#ff9896', u4:'#556b2f', u5:'#1f5fbf', u6:'#d62728', u7:'#000000', u8:'#2ca02c',
u9:'#4fb3e8', u10:'#e377c2', u11:'#e8c000', u12:'#b39ddb', u13:'#bc8f6f', u14:'#17808a', u15:'#3949ab',
u16:'#4d4d4d', u17:'#7f7f3f', u18:'#d9b77e', u19:'#bdbdbd', u20:'#26c6da', u21:'#a5d6a7', uw:'#607d8b',
u0:'#e3e3e3', mix:'#ff8c00',
};
const DETAIL_ORDER = ['u0', 'uw', 'u19', 'u18', 'u21', 'u20', 'u13', 'u2', 'u4', 'u16', 'u17', 'u12', 'u1', 'u14', 'u10',
'u11', 'u9', 'u15', 'u5', 'u7', 'u6', 'u3', 'u8', 'mix'];
const DETAIL_LIST = ['u7', 'u6', 'u3', 'u8', 'mix', 'u5', 'u15', 'u9', 'u10', 'u11', 'u14', 'u1', 'u12', 'u2', 'u13', 'u4',
'u16', 'u17', 'u18', 'u20', 'u21', 'u19', 'uw', 'u0'];
function simpleKey(use, flats) {
const f = flats || 0;
if (use === 3) return f >= 4 ? 'unit' : 'res'; // generic dwelling
const base = USE_CAT[use] || 'other';
if (base === 'res' || base === 'unit' || base === 'rec') return base;
if (S.mixMin > 0 && f >= S.mixMin && base !== 'garage' && base !== 'agri') return 'mix';
return base;
}
function detailKey(use, sk) {
if (sk === 'mix') return 'mix';
if (use >= 1 && use <= 21) return 'u' + use;
if (use >= 22 && use <= 29) return 'uw';
return 'u0';
}
const catColor = key => (S.mode === 'simple' ? SIMPLE_COLOR[key] : DETAIL_COLOR[key]) || '#bdbdbd';
function catLabel(key) {
if (S.mode === 'simple') return t('cat.' + key);
if (key === 'mix') return t('cat.mix');
if (key === 'uw') return useName('w');
if (key === 'u0') return useName(0);
return key.slice(1) + ' · ' + useName(+key.slice(1));
}
const catList = () => (S.mode === 'simple' ? SIMPLE.map(c => c[0]) : DETAIL_LIST);
const catOrder = () => (S.mode === 'simple' ? SIMPLE_ORDER : DETAIL_ORDER);
function isDark(hex) {
const n = parseInt(hex.slice(1), 16), r = n >> 16, g = (n >> 8) & 255, b = n & 255;
return (0.299 * r + 0.587 * g + 0.114 * b) < 140;
}
/* ================= basemap styles ================= */
const BASE = [
{ k: 'garden', t: 'poly', fill: '#e6efd6' },
{ k: 'green', t: 'poly', fill: '#cfe4bd' },
{ k: 'cemetery', t: 'poly', fill: '#c9d9bd', stroke: '#9bb08a' },
{ k: 'parking', t: 'poly', fill: '#e2e2e2', stroke: '#c4c4c4' },
{ k: 'water', t: 'poly', fill: '#a8cfe8', stroke: '#7fb2d6' },
{ k: 'stream', t: 'line', c: '#7fb2d6', m: 2, min: 1.2 },
{ k: 'path', t: 'line', c: '#b58b5a', m: 1, min: .8, dash: [2, 3] },
{ k: 'track', t: 'line', c: '#c9a16b', m: 2, min: 1, dash: [6, 4] },
{ k: 'rail', t: 'line', c: '#666666', m: 3, min: 1.2, dash: [8, 4] },
{ k: 'street', t: 'line', c: '#9a9a9a', m: 7, min: 2.4 },
{ k: 'street', t: 'line', c: '#ffffff', m: 5, min: 1.8 },
{ k: 'road', t: 'line', c: '#b8862f', m: 11, min: 3.6 },
{ k: 'road', t: 'line', c: '#ffe08a', m: 8.5, min: 2.8 },
];
const ZAB_LAYERS = { road: 79, street: 84, track: 83, path: 82, rail: 75, stream: 93, water: 132,
green: 134, garden: 135, cemetery: 116, parking: 123 };
/* ================= state ================= */
const S = {
buildings: [], base: {}, K: 0.63, center: [14.9687, 50.8172],
view: { cx: 0, cy: 0, s: 1 }, hidden: new Set(), mixMin: 1, mode: 'simple', showBase: true, showNums: true,
sel: null, loaded: false, status: null,
};
const $ = id => document.getElementById(id);
const cv = $('cv'), ctx0 = cv.getContext('2d');
let W = 0, H = 0, DPR = 1;
function classifyAll() {
for (const b of S.buildings) {
b.sc = simpleKey(b.use, b.flats);
b.cat = S.mode === 'simple' ? b.sc : detailKey(b.use, b.sc);
}
}
/* ================= location parsing ================= */
function parseLoc(text) {
text = (text || '').trim();
const m = text.match(/[?&]x=(-?\d+(?:\.\d+)?)/), n = text.match(/[?&]y=(-?\d+(?:\.\d+)?)/);
if (m && n) return { lon: +m[1], lat: +n[1] };
const nums = (text.match(/-?\d+(?:\.\d+)?/g) || []).map(Number);
if (nums.length >= 2) {
const [a, b] = nums;
if (a >= 48 && a <= 52 && b >= 12 && b <= 19) return { lat: a, lon: b };
if (b >= 48 && b <= 52 && a >= 12 && a <= 19) return { lat: b, lon: a };
}
return null;
}
/* ================= fetching from ČÚZK ================= */
const RUIAN = 'https://ags.cuzk.cz/arcgis/rest/services/RUIAN/MapServer/3/query';
const ZAB = 'https://ags.cuzk.cz/arcgis/rest/services/ZABAGED_POLOHOPIS/MapServer/';
async function query(url, fields, env, offset) {
const p = { geometry: env, geometryType: 'esriGeometryEnvelope', inSR: '4326', outSR: '3857',
spatialRel: 'esriSpatialRelIntersects', where: '1=1', outFields: fields, returnGeometry: 'true',
geometryPrecision: '1', maxAllowableOffset: '0.3', f: 'json' };
if (offset) { p.resultOffset = String(offset); p.resultRecordCount = '1000'; }
// No AbortSignal / fetch options: some embedded viewers proxy fetch through postMessage and cannot clone them.
const url2 = url + '?' + new URLSearchParams(p);
let timer;
const timeout = new Promise((_, rej) => { timer = setTimeout(() => rej(new Error('timed out after 45 s')), 45000); });
try {
const res = await Promise.race([fetch(url2), timeout]);
if (!res.ok) throw new Error('HTTP ' + res.status);
const j = await Promise.race([res.json(), timeout]);
if (j.error) throw new Error(j.error.message || 'service error');
return j;
} finally { clearTimeout(timer); }
}
async function queryAll(url, fields, env) {
let out = [], off = 0;
for (let page = 0; page < 12; page++) {
let j;
try { j = await query(url, fields, env, off); }
catch (e) { if (off > 0) break; throw e; }
const f = j.features || [];
out = out.concat(f);
if (!j.exceededTransferLimit || !f.length) break;
off += f.length;
}
return out;
}
const lowerKeys = o => Object.fromEntries(Object.entries(o || {}).map(([k, v]) => [k.toLowerCase(), v]));
const ringsOf = f => (f.geometry && (f.geometry.rings || f.geometry.paths)) || [];
const sleep = ms => new Promise(r => setTimeout(r, ms));
async function pool(tasks, n) { // run async tasks, at most n at a time
const out = new Array(tasks.length); let i = 0;
await Promise.all(Array.from({ length: Math.min(n, tasks.length) }, async () => {
while (i < tasks.length) { const k = i++; try { out[k] = { ok: true, v: await tasks[k]() }; } catch (e) { out[k] = { ok: false, e }; } }
}));
return out;
}
async function baseLayer(id, env) { // retry, then try an explicit field instead of an empty field list
let last;
for (const fields of ['', 'objectid', '']) {
try { return await queryAll(ZAB + id + '/query', fields, env); } catch (e) { last = e; await sleep(500); }
}
throw last;
}
async function fetchArea(lon, lat, radius, onProgress) {
const dLat = radius * 1.1 / 111320, dLon = radius * 1.1 / (111320 * Math.cos(lat * D2R));
const env = [lon - dLon, lat - dLat, lon + dLon, lat + dLat].map(v => v.toFixed(6)).join(',');
const fields = 'cisladomovni,zpusobvyuzitikod,pocetbytu,pocetpodlazi,zastavenaplocha,dokonceni';
const keys = Object.keys(ZAB_LAYERS);
const tasks = [() => queryAll(RUIAN, fields, env), ...keys.map(k => () => baseLayer(ZAB_LAYERS[k], env))];
let done = 0;
const res = await pool(tasks.map(fn => async () => { try { return await fn(); } finally { if (onProgress) onProgress(++done, tasks.length); } }), 4);
if (!res[0].ok) throw res[0].e;
const base = {}, fails = [];
keys.forEach((k, i) => {
const r = res[i + 1];
if (r.ok) base[k] = r.v.map(ringsOf).flat();
else { base[k] = []; fails.push(k + ': ' + (r.e && r.e.message ? r.e.message : r.e)); }
});
const buildings = res[0].v.map(f => {
const a = lowerKeys(f.attributes);
return mkBuilding(a.cisladomovni, a.zpusobvyuzitikod, a.pocetbytu, a.pocetpodlazi, a.zastavenaplocha,
a.dokonceni, ringsOf(f));
}).filter(b => b.rings.length);
return { buildings, base, fails };
}
function mkBuilding(cp, use, flats, floors, area, done, rings) {
let x0 = 1e18, y0 = 1e18, x1 = -1e18, y1 = -1e18;
for (const r of rings) for (const p of r) {
if (p[0] < x0) x0 = p[0]; if (p[0] > x1) x1 = p[0];
if (p[1] < y0) y0 = p[1]; if (p[1] > y1) y1 = p[1];
}
const year = (done != null && isFinite(done)) ? new Date(done).getUTCFullYear() : null;
return { cp: (cp || '').toString().trim(), use: use == null ? 0 : +use, flats: flats == null ? null : +flats,
floors: floors == null ? null : +floors, area: area == null ? null : +area, year, rings,
bb: [x0, y0, x1, y1], cat: 'other', sc: 'other' };
}
import { mkBuilding } from './building'
import type { AreaData, BaseData, Ring } from './types'
/* ================= built-in example (offline fallback) ================= */
const SAMPLE_B = String.raw`1665796,6588401
@ -875,7 +469,7 @@ const SAMPLE_B = String.raw`1665796,6588401
47;3;6;4;829,1097 -20,-10 -5,10 -2,-1 -2,4 -10,-5 -3,4 -3,6 -2,4 39,6 8,-18
60;7;1;2;828,849 -8,8 10,11 9,10 8,-7 -1,-1 10,-9 -5,-6 -5,5 -5,-5 0,1 -4,-3 -3,3 -6,-7
56;7;1;2;785,1266 12,2 0,-2 2,-10 0,0 -12,-2 -2,12
53;7;1;2;774,1265 11,1 2,-12 -12,-1 0,0 -1,10 0,2`;
53;7;1;2;774,1265 11,1 2,-12 -12,-1 0,0 -1,10 0,2`
const SAMPLE_BASE = String.raw`#road
568,722 42,-109 106,-196 16,-22 46,-51 7,-10 8,-22 6,-40 9,-39 11,-24 16,-27 67,-76 14,-25 24,-59 11,-46 15,-117 40,-184 99,-157 152,-230 32,-57 47,-105 6,-29 0,-29 -27,-95 -5,-37 5,-28 9,-14 15,-9 66,-21 27,-12 25,-18 19,-18 24,-40 113,-237 19,-32 28,-41 79,-91 27,-35 30,-56 14,-38
93,-20 -25,-18 -16,-7 -30,-5 -21,4 -31,16 -31,23 -62,65
@ -1211,358 +805,47 @@ const SAMPLE_BASE = String.raw`#road
#parking
403,892 5,-8 8,-3 52,4 -2,-18 -50,-5 -2,8 -20,12 9,10
23,80 -21,55 6,2 -9,22 -5,-2 -6,13 -37,-14 -17,46 -1,7 4,5 61,26 21,-5 8,-10 43,-126 -47,-19
1126,625 -93,-61 -13,-16 -15,22 16,0 9,5 -1,10 63,41 28,9 6,-10`;
1126,625 -93,-61 -13,-16 -15,22 16,0 9,5 -1,10 63,41 28,9 6,-10`
function decodeRing(s, ox, oy) {
let px = 0, py = 0; const pts = [];
// Rings are delta-encoded relative to the origin on the first line of SAMPLE_B.
function decodeRing(s: string, ox: number, oy: number): Ring {
let px = 0,
py = 0
const pts: Ring = []
for (const tok of s.split(' ')) {
const [dx, dy] = tok.split(','); px += +dx; py += +dy; pts.push([ox + px, oy + py]);
const [dx, dy] = tok.split(',')
px += +dx
py += +dy
pts.push([ox + px, oy + py])
}
return pts;
return pts
}
function loadSample() {
const lines = SAMPLE_B.trim().split('\n');
const [ox, oy] = lines[0].split(',').map(Number);
const buildings = lines.slice(1).map(l => {
const [cp, use, flats, floors, geom] = l.split(';');
return mkBuilding(cp, +use, flats === '' ? null : +flats, floors === '' ? null : +floors, null, null,
geom.split('|').map(r => decodeRing(r, ox, oy)));
});
const base = {}; let cur = null;
export function loadSample(): AreaData {
const lines = SAMPLE_B.trim().split('\n')
const [ox, oy] = lines[0].split(',').map(Number)
const buildings = lines.slice(1).map((l) => {
const [cp, use, flats, floors, geom] = l.split(';')
return mkBuilding(
cp,
+use,
flats === '' ? null : +flats,
floors === '' ? null : +floors,
null,
null,
geom.split('|').map((r) => decodeRing(r, ox, oy)),
)
})
const base: BaseData = {}
let cur: string | null = null
for (const l of SAMPLE_BASE.split('\n')) {
const t2 = l.trim(); if (!t2) continue;
if (t2[0] === '#') { cur = t2.slice(1); base[cur] = []; continue; }
base[cur].push(decodeRing(t2, ox, oy));
}
return { buildings, base, fails: [] };
}
/* ================= applying data ================= */
function applyData(d, lon, lat) {
S.buildings = d.buildings; S.base = d.base; S.center = [lon, lat];
S.K = Math.cos(lat * D2R); S.sel = null; $('info').style.display = 'none';
classifyAll(); fitView(); S.loaded = true; S.hidden.clear(); buildLegend(); draw();
}
function fitView() {
if (!S.buildings.length) return;
let x0 = 1e18, y0 = 1e18, x1 = -1e18, y1 = -1e18;
for (const b of S.buildings) { x0 = Math.min(x0, b.bb[0]); y0 = Math.min(y0, b.bb[1]); x1 = Math.max(x1, b.bb[2]); y1 = Math.max(y1, b.bb[3]); }
const w = Math.max(x1 - x0, 50), h = Math.max(y1 - y0, 50);
S.view = { cx: (x0 + x1) / 2, cy: (y0 + y1) / 2, s: Math.min(W / w, H / h) * 0.94 };
}
const pxPerMeter = v => v.s / S.K; // screen px per true metre
/* ================= drawing ================= */
function niceScale(v) {
for (const m of [5, 10, 20, 50, 100, 200, 500, 1000]) { const px = m * pxPerMeter(v); if (px >= 70) return { m, px }; }
return { m: 1000, px: 1000 * pxPerMeter(v) };
}
function drawScene(ctx, W, H, v, r, opts) {
opts = opts || {};
ctx.save();
ctx.setTransform(r, 0, 0, r, 0, 0);
ctx.beginPath(); ctx.rect(0, 0, W, H); ctx.clip();
ctx.fillStyle = '#f5f2ea'; ctx.fillRect(0, 0, W, H);
const sx = x => (x - v.cx) * v.s + W / 2, sy = y => H / 2 - (y - v.cy) * v.s;
const ppm = pxPerMeter(v);
const path = (rings, close) => {
ctx.beginPath();
for (const ring of rings) {
for (let i = 0; i < ring.length; i++) { const p = ring[i]; if (i) ctx.lineTo(sx(p[0]), sy(p[1])); else ctx.moveTo(sx(p[0]), sy(p[1])); }
if (close) ctx.closePath();
}
};
ctx.lineJoin = 'round'; ctx.lineCap = 'round';
if (S.showBase) {
for (const st of BASE) {
const rings = S.base[st.k]; if (!rings || !rings.length) continue;
if (st.t === 'poly') {
path(rings, true); ctx.fillStyle = st.fill; ctx.fill('evenodd');
if (st.stroke) { ctx.strokeStyle = st.stroke; ctx.lineWidth = 1; ctx.stroke(); }
} else {
path(rings, false); ctx.strokeStyle = st.c; ctx.lineWidth = Math.max(st.min, st.m * ppm);
ctx.setLineDash(st.dash ? st.dash.map(d => d * Math.max(1, ppm / 2)) : []); ctx.stroke(); ctx.setLineDash([]);
}
const t2 = l.trim()
if (!t2) continue
if (t2[0] === '#') {
cur = t2.slice(1)
base[cur] = []
continue
}
if (cur !== null) base[cur].push(decodeRing(t2, ox, oy))
}
for (const key of catOrder()) {
if (S.hidden.has(key)) continue;
const rings = [];
for (const b of S.buildings) if (b.cat === key) for (const rg of b.rings) rings.push(rg);
if (!rings.length) continue;
path(rings, true);
ctx.fillStyle = catColor(key); ctx.fill('evenodd');
ctx.strokeStyle = (key === 'res' || key === 'u7') ? 'rgba(255,255,255,.55)' : 'rgba(0,0,0,.55)'; ctx.lineWidth = .5; ctx.stroke();
}
if (S.showNums && ppm >= 1.5) {
const all = ppm >= 3.2;
ctx.textAlign = 'center'; ctx.textBaseline = 'middle';
ctx.font = `${Math.min(12, Math.max(8, ppm * 2.2))}px system-ui,sans-serif`;
for (const b of S.buildings) {
if (!b.cp || S.hidden.has(b.cat) || !(all || SIMPLE_NUMS[b.sc])) continue;
const cx = sx((b.bb[0] + b.bb[2]) / 2), cy = sy((b.bb[1] + b.bb[3]) / 2);
if (cx < -20 || cy < -20 || cx > W + 20 || cy > H + 20) continue;
const dark = isDark(catColor(b.cat)), txt = b.cp.split(',')[0];
if (!dark) { ctx.lineWidth = 2.5; ctx.strokeStyle = 'rgba(255,255,255,.8)'; ctx.strokeText(txt, cx, cy); }
ctx.fillStyle = dark ? '#fff' : '#111'; ctx.fillText(txt, cx, cy);
}
}
if (opts.sel && S.sel) {
path(S.sel.rings, true); ctx.strokeStyle = '#ffcc00'; ctx.lineWidth = 3; ctx.stroke();
ctx.strokeStyle = '#000'; ctx.lineWidth = 1; ctx.stroke();
}
const sc = niceScale(v), bx = 16, by = H - 18;
ctx.fillStyle = 'rgba(245,242,234,.85)'; ctx.fillRect(bx - 6, by - 20, sc.px + 12, 30);
ctx.strokeStyle = '#000'; ctx.lineWidth = 2; ctx.beginPath(); ctx.moveTo(bx, by); ctx.lineTo(bx + sc.px, by); ctx.stroke();
ctx.fillStyle = '#000'; ctx.font = '11px system-ui,sans-serif'; ctx.textAlign = 'center'; ctx.textBaseline = 'bottom';
ctx.fillText(sc.m >= 1000 ? sc.m / 1000 + ' km' : sc.m + ' m', bx + sc.px / 2, by - 4);
ctx.beginPath(); ctx.moveTo(24, 44); ctx.lineTo(24, 16); ctx.moveTo(24, 16); ctx.lineTo(20, 24); ctx.moveTo(24, 16); ctx.lineTo(28, 24);
ctx.lineWidth = 1.5; ctx.stroke(); ctx.textBaseline = 'top'; ctx.fillText('N', 24, 46);
ctx.restore();
return { buildings, base, fails: [] }
}
function counts() { const c = {}; for (const b of S.buildings) c[b.cat] = (c[b.cat] || 0) + 1; return c; }
function legendEntries() {
const cnt = counts(), e = [];
for (const k of catList()) if (cnt[k]) e.push({ color: catColor(k), label: `${catLabel(k)} (${cnt[k]})` });
if (S.showBase) e.push({ color: '#a8cfe8', label: t('b_water') }, { color: '#cfe4bd', label: t('b_green') },
{ color: '#ffe08a', label: t('b_road') }, { color: '#ffffff', label: t('b_street'), border: '#9a9a9a' });
return e;
}
function legendLayout(W) {
const e = legendEntries(), colW = Math.max(240, Math.floor(W / Math.max(1, Math.floor(W / 300))));
const cols = Math.max(1, Math.floor(W / colW)), rows = Math.ceil(e.length / cols);
return { e, colW, rows, h: rows * 20 + 16 };
}
function drawLegend(ctx, y0, W, r) {
const { e, colW, rows, h } = legendLayout(W);
ctx.save(); ctx.setTransform(r, 0, 0, r, 0, 0);
ctx.fillStyle = '#fff'; ctx.fillRect(0, y0, W, h);
ctx.font = '12px system-ui,sans-serif'; ctx.textAlign = 'left'; ctx.textBaseline = 'middle';
e.forEach((it, i) => {
const c = Math.floor(i / rows), rr = i % rows, x = 14 + c * colW, y = y0 + 14 + rr * 20;
ctx.fillStyle = it.color; ctx.fillRect(x, y - 6, 18, 12);
ctx.strokeStyle = it.border || '#555'; ctx.lineWidth = 1; ctx.strokeRect(x + .5, y - 5.5, 17, 11);
ctx.fillStyle = '#111'; ctx.fillText(it.label, x + 26, y);
});
ctx.restore();
}
function draw() { if (W) drawScene(ctx0, W, H, S.view, DPR, { sel: true }); }
/* ================= sidebar legend ================= */
function buildLegend() {
const box = $('legend'); box.innerHTML = '';
for (const key of catList()) {
const row = document.createElement('label'); row.className = 'leg'; row.dataset.key = key;
row.innerHTML = '<input type="checkbox"><span class="sw"></span><span class="lbl"></span><span class="n">0</span>';
const inp = row.querySelector('input'); inp.checked = !S.hidden.has(key); row.classList.toggle('off', S.hidden.has(key));
row.querySelector('.sw').style.background = catColor(key);
row.querySelector('.lbl').textContent = catLabel(key);
inp.addEventListener('change', e => {
if (e.target.checked) S.hidden.delete(key); else S.hidden.add(key);
row.classList.toggle('off', !e.target.checked); draw();
});
box.appendChild(row);
}
updateCounts();
}
function updateCounts() {
const cnt = counts();
document.querySelectorAll('#legend .leg').forEach(r => {
const n = cnt[r.dataset.key] || 0; r.querySelector('.n').textContent = n; r.style.display = n ? '' : 'none';
});
$('total').textContent = S.buildings.length ? t('nBuildings', S.buildings.length) : '';
}
/* ================= hit testing & interaction ================= */
function inRing(x, y, ring) {
let inside = false;
for (let i = 0, j = ring.length - 1; i < ring.length; j = i++) {
const a = ring[i], b = ring[j];
if ((a[1] > y) !== (b[1] > y) && x < (b[0] - a[0]) * (y - a[1]) / (b[1] - a[1]) + a[0]) inside = !inside;
}
return inside;
}
function pick(px, py) {
const v = S.view, x = (px - W / 2) / v.s + v.cx, y = (H / 2 - py) / v.s + v.cy, pad = 2 / v.s;
for (let i = S.buildings.length - 1; i >= 0; i--) {
const b = S.buildings[i];
if (S.hidden.has(b.cat) || x < b.bb[0] - pad || x > b.bb[2] + pad || y < b.bb[1] - pad || y > b.bb[3] + pad) continue;
let hit = false; for (const r of b.rings) if (inRing(x, y, r)) hit = !hit;
if (hit) return b;
}
return null;
}
const desc = b => `${b.cp ? t('hn', b.cp) : t('nohn')} – ${catLabel(b.cat)}`;
function showInfo(b) {
const el = $('info');
if (!b) { el.style.display = 'none'; return; }
const ll = m2ll((b.bb[0] + b.bb[2]) / 2, (b.bb[1] + b.bb[3]) / 2), dash = '—';
el.innerHTML = `<span class="x" title="${t('close')}">✕</span><b>${b.cp ? t('hn', b.cp) : t('nohn')}</b>
<dl><dt>${t('i_cat')}</dt><dd>${catLabel(b.cat)}</dd>
<dt>${t('i_use')}</dt><dd>${useName(b.use) || dash} (${b.use || '?'})</dd>
<dt>${t('i_flats')}</dt><dd>${b.flats == null ? dash : b.flats}</dd>
<dt>${t('i_floors')}</dt><dd>${b.floors == null ? dash : b.floors}</dd>
<dt>${t('i_area')}</dt><dd>${b.area == null ? dash : b.area + ' m²'}</dd>
<dt>${t('i_done')}</dt><dd>${b.year == null ? dash : b.year}</dd>
<dt>${t('i_pos')}</dt><dd>${ll[1].toFixed(6)}, ${ll[0].toFixed(6)}</dd></dl>`;
el.style.display = 'block';
el.querySelector('.x').onclick = () => { S.sel = null; el.style.display = 'none'; draw(); };
}
const ptrs = new Map(); let dragMoved = 0, lastPinch = 0;
cv.addEventListener('pointerdown', e => {
cv.setPointerCapture(e.pointerId); ptrs.set(e.pointerId, [e.offsetX, e.offsetY]); dragMoved = 0; cv.classList.add('drag');
if (ptrs.size === 2) { const [a, b] = [...ptrs.values()]; lastPinch = Math.hypot(a[0] - b[0], a[1] - b[1]); }
});
cv.addEventListener('pointermove', e => {
const prev = ptrs.get(e.pointerId);
if (prev) {
ptrs.set(e.pointerId, [e.offsetX, e.offsetY]);
if (ptrs.size === 1) {
const dx = e.offsetX - prev[0], dy = e.offsetY - prev[1]; dragMoved += Math.abs(dx) + Math.abs(dy);
S.view.cx -= dx / S.view.s; S.view.cy += dy / S.view.s; draw(); $('tip').style.display = 'none';
} else if (ptrs.size === 2) {
const [a, b] = [...ptrs.values()], d = Math.hypot(a[0] - b[0], a[1] - b[1]);
if (lastPinch) zoomAt((a[0] + b[0]) / 2, (a[1] + b[1]) / 2, d / lastPinch); lastPinch = d; dragMoved = 99;
}
return;
}
const b = pick(e.offsetX, e.offsetY), tip = $('tip');
if (b) { tip.textContent = desc(b); tip.style.left = (e.offsetX + 14) + 'px'; tip.style.top = (e.offsetY + 14) + 'px'; tip.style.display = 'block'; }
else tip.style.display = 'none';
});
const endPtr = e => {
const had = ptrs.delete(e.pointerId); cv.classList.remove('drag'); lastPinch = 0;
if (had && dragMoved < 5 && e.type === 'pointerup') { S.sel = pick(e.offsetX, e.offsetY); showInfo(S.sel); draw(); }
};
cv.addEventListener('pointerup', endPtr); cv.addEventListener('pointercancel', endPtr);
cv.addEventListener('pointerleave', () => { $('tip').style.display = 'none'; });
cv.addEventListener('wheel', e => { e.preventDefault(); zoomAt(e.offsetX, e.offsetY, Math.exp(-e.deltaY * 0.0015)); }, { passive: false });
function zoomAt(px, py, f) {
const v = S.view, ns = Math.min(Math.max(v.s * f, 0.02), 40);
const x = (px - W / 2) / v.s + v.cx, y = (H / 2 - py) / v.s + v.cy;
v.s = ns; v.cx = x - (px - W / 2) / ns; v.cy = y + (py - H / 2) / ns; draw();
}
$('zin').onclick = () => zoomAt(W / 2, H / 2, 1.5);
$('zout').onclick = () => zoomAt(W / 2, H / 2, 1 / 1.5);
$('zfit').onclick = () => { fitView(); draw(); };
function resize() {
const r = $('stage').getBoundingClientRect(); DPR = Math.min(window.devicePixelRatio || 1, 3);
const oldW = W; W = Math.max(1, Math.floor(r.width)); H = Math.max(1, Math.floor(r.height));
cv.width = W * DPR; cv.height = H * DPR;
if (S.loaded && !oldW) fitView();
draw();
}
new ResizeObserver(resize).observe($('stage'));
/* ================= language ================= */
// status is stored as a function so it can be re-rendered when the language changes
function setStatus(fn, cls) { S.status = { fn, cls }; renderStatus(); }
function renderStatus() { const s = $('status'); if (!S.status) { s.textContent = ''; s.className = ''; return; } s.textContent = S.status.fn(); s.className = S.status.cls || ''; }
function applyLang() {
document.documentElement.lang = lang;
document.querySelectorAll('[data-i18n]').forEach(el => { el.textContent = t(el.dataset.i18n); });
$('note').innerHTML = t('note');
$('zin').title = t('zoomIn'); $('zout').title = t('zoomOut'); $('zfit').title = t('fit');
$('lang').value = lang;
document.title = t('title') + ' – RÚIAN';
buildLegend(); renderStatus(); if (S.sel) showInfo(S.sel); draw();
}
$('lang').onchange = e => { lang = e.target.value; try { localStorage.setItem('bum-lang', lang); } catch (x) {} applyLang(); };
/* ================= controls ================= */
$('radius').oninput = e => { $('rv').textContent = e.target.value + ' m'; };
$('optBase').onchange = e => { S.showBase = e.target.checked; draw(); };
$('optNums').onchange = e => { S.showNums = e.target.checked; draw(); };
$('mixrule').onchange = e => { S.mixMin = +e.target.value; classifyAll(); updateCounts(); buildLegend(); draw(); };
$('colormode').onchange = e => { S.mode = e.target.value; S.hidden.clear(); classifyAll(); buildLegend(); draw(); };
async function liveLoad(p, quietFallback) {
const btn = $('load'); btn.disabled = true; setStatus(() => t('st_loading'));
try {
const d = await fetchArea(p.lon, p.lat, +$('radius').value, (n, m) => setStatus(() => t('st_progress', n, m)));
if (!d.buildings.length) { setStatus(() => t('st_none'), 'err'); return false; }
applyData(d, p.lon, p.lat);
const loc = `${p.lat.toFixed(5)}, ${p.lon.toFixed(5)}`, n = d.buildings.length, fails = d.fails;
setStatus(() => t('st_loaded', loc, n) + (fails.length ? '\n' + t('st_baseFail', fails.length) + '\n' + fails.join('\n') : ''),
fails.length ? 'err' : 'ok');
return true;
} catch (e) {
const msg = e && e.message ? e.message : String(e);
setStatus(() => quietFallback ? t('st_fallback', msg) : t('st_err', msg), 'err');
return false;
} finally { btn.disabled = false; }
}
$('load').onclick = () => {
const p = parseLoc($('loc').value);
if (!p) { setStatus(() => t('st_badLoc'), 'err'); return; }
liveLoad(p, false);
};
$('loc').addEventListener('keydown', e => { if (e.key === 'Enter') $('load').click(); });
/* ================= export ================= */
function download(blob, name) {
const a = document.createElement('a'); a.href = URL.createObjectURL(blob); a.download = name;
document.body.appendChild(a); a.click(); a.remove(); setTimeout(() => URL.revokeObjectURL(a.href), 4000);
}
$('expPng').onclick = () => {
if (!S.loaded) return; const r = 2, lh = legendLayout(W).h;
const oc = document.createElement('canvas'); oc.width = W * r; oc.height = (H + lh) * r;
const c = oc.getContext('2d'); drawScene(c, W, H, S.view, r, {}); drawLegend(c, H, W, r);
oc.toBlob(b => download(b, 'building-use-map.png'), 'image/png');
};
$('expSvg').onclick = () => {
if (!S.loaded) return;
const v = S.view, sx = x => ((x - v.cx) * v.s + W / 2).toFixed(1), sy = y => (H / 2 - (y - v.cy) * v.s).toFixed(1), ppm = pxPerMeter(v);
const d = (rings, close) => rings.map(r => 'M' + r.map(p => sx(p[0]) + ' ' + sy(p[1])).join('L') + (close ? 'Z' : '')).join('');
const { e, colW, rows, h: lh } = legendLayout(W); let o = '';
o += `<svg xmlns="http://www.w3.org/2000/svg" width="${W}" height="${H + lh}" viewBox="0 0 ${W} ${H + lh}"><defs><clipPath id="c"><rect width="${W}" height="${H}"/></clipPath></defs>`;
o += `<rect width="${W}" height="${H}" fill="#f5f2ea"/><g clip-path="url(#c)" stroke-linejoin="round" stroke-linecap="round">`;
if (S.showBase) for (const st of BASE) {
const rings = S.base[st.k]; if (!rings || !rings.length) continue;
if (st.t === 'poly') o += `<path d="${d(rings, true)}" fill="${st.fill}" fill-rule="evenodd"${st.stroke ? ` stroke="${st.stroke}" stroke-width="1"` : ''}/>`;
else o += `<path d="${d(rings, false)}" fill="none" stroke="${st.c}" stroke-width="${Math.max(st.min, st.m * ppm).toFixed(1)}"${st.dash ? ` stroke-dasharray="${st.dash.map(x => x * Math.max(1, ppm / 2)).join(' ')}"` : ''}/>`;
}
for (const key of catOrder()) {
if (S.hidden.has(key)) continue;
const rings = []; for (const b of S.buildings) if (b.cat === key) for (const r of b.rings) rings.push(r);
if (rings.length) o += `<path d="${d(rings, true)}" fill="${catColor(key)}" fill-rule="evenodd" stroke="${(key === 'res' || key === 'u7') ? '#ffffff88' : '#00000088'}" stroke-width=".5"/>`;
}
o += '</g>';
o += `<rect y="${H}" width="${W}" height="${lh}" fill="#fff"/><g font-family="system-ui,sans-serif" font-size="12">`;
e.forEach((it, i) => {
const c = Math.floor(i / rows), rr = i % rows, x = 14 + c * colW, y = H + 14 + rr * 20;
o += `<rect x="${x}" y="${y - 6}" width="18" height="12" fill="${it.color}" stroke="${it.border || '#555'}"/><text x="${x + 26}" y="${y + 4}">${it.label.replace(/&/g, '&amp;').replace(/</g, '&lt;')}</text>`;
});
o += '</g></svg>';
download(new Blob([o], { type: 'image/svg+xml' }), 'building-use-map.svg');
};
$('expCsv').onclick = () => {
if (!S.loaded) return;
const q = s => '"' + String(s).replace(/"/g, '""') + '"';
let o = 'house_no,ruian_use_code,ruian_use,category,flats,floors,built_up_area_m2,completed,lat,lon\n';
for (const b of S.buildings) {
const ll = m2ll((b.bb[0] + b.bb[2]) / 2, (b.bb[1] + b.bb[3]) / 2);
o += [q(b.cp), b.use, q(useName(b.use)), q(catLabel(b.cat)), b.flats ?? '', b.floors ?? '', b.area ?? '', b.year ?? '', ll[1].toFixed(6), ll[0].toFixed(6)].join(',') + '\n';
}
download(new Blob(['' + o], { type: 'text/csv;charset=utf-8' }), 'buildings.csv');
};
$('expPrint').onclick = () => window.print();
/* ================= start ================= */
applyLang();
resize();
{ // show the built-in example immediately, then replace it with live data for the default location
const d = loadSample(); applyData(d, 14.968678, 50.8171633);
setStatus(() => t('st_init'));
const p = parseLoc($('loc').value);
if (p) liveLoad(p, true);
}
})();
</script>
</body>
</html>

73
src/state.ts Normal file
View file

@ -0,0 +1,73 @@
import { signal } from '@preact/signals'
import { persisted } from './persist'
import type { BaseData, Building, LatLon, Mode, View } from './types'
/* ================= reactive state =================
* Everything the UI or the map drawing depends on is a signal: components re-render and the
* map redraws (see MapView) when they change. Pan/zoom state is plain data and redraws directly.
*/
/** Buildings as loaded, before classification. */
export const rawBuildings = signal<Building[]>([])
export const base = signal<BaseData>({})
// The classified list is `buildings` in categories.ts.
/* user settings, remembered between visits */
export const mode = persisted<Mode>('mode', 'simple', (v) => v === 'simple' || v === 'detailed')
/** Minimum flats for a non-residential building to count as mixed use (0 = off). */
export const mixMin = persisted('mixMin', 1, (v) => v === 0 || v === 1 || v === 2)
export const showBase = persisted('showBase', true, (v) => typeof v === 'boolean')
export const showNums = persisted('showNums', true, (v) => typeof v === 'boolean')
export const radius = persisted('radius', 300, (v) => typeof v === 'number' && v >= 100 && v <= 700)
/** Last successfully loaded location; restored on the next visit. */
export const lastLoc = persisted<LatLon | null>(
'lastLoc',
null,
(v) => !!v && typeof (v as LatLon).lat === 'number' && typeof (v as LatLon).lon === 'number',
)
export const hidden = signal<ReadonlySet<string>>(new Set())
/** Legend category being hovered/focused; the map fades the other categories. */
export const focusCat = signal<string | null>(null)
export const sel = signal<Building | null>(null)
/** Building under the pointer and where to show the tooltip. */
export const hover = signal<{ b: Building; x: number; y: number } | null>(null)
export const DEFAULT_LOC = 'https://mapy.com/en/turisticka?l=0&x=14.9686780&y=50.8171633&z=16.762'
/** Text of the location field. */
export const locText = signal(DEFAULT_LOC)
export const busy = signal(false)
export const locating = signal(false)
/** Requests finished / total while loading from ČÚZK; null when idle. */
export const progress = signal<{ done: number; total: number } | null>(null)
export interface Status {
fn: () => string // a function so it is re-rendered in the current language
cls?: 'ok' | 'warn' | 'err'
details?: string[]
}
export const status = signal<Status | null>(null)
/** Short confirmation message shown at the bottom of the screen. */
export const toast = signal<{ fn: () => string; id: number } | null>(null)
/** Mobile bottom sheet expanded. */
export const sheetOpen = signal(false)
/* ================= non-reactive view state ================= */
export const S = {
K: 0.63, // cos(latitude): Mercator metres → true metres
center: [14.9687, 50.8172] as [number, number],
view: { cx: 0, cy: 0, s: 1 } as View,
loaded: false,
}
/**
* Canvas size in CSS pixels, device pixel ratio and 2D context; set by MapView.
* insetB: height covered by the mobile bottom sheet, kept clear when fitting the view.
*/
export const vp = {
W: 0,
H: 0,
DPR: 1,
insetB: 0,
ctx: null as CanvasRenderingContext2D | null,
}

1005
src/style.css Normal file

File diff suppressed because it is too large Load diff

105
src/theme.ts Normal file
View file

@ -0,0 +1,105 @@
import { signal } from '@preact/signals'
/* ================= colour theme =================
* The UI chrome follows prefers-color-scheme via CSS variables (style.css). The map canvas
* can't read CSS, so its colours live here. Building fill colours are the same in both
* themes (they carry meaning); only the basemap and the map furniture change.
* Exports (PNG/SVG/print) always use LIGHT so they stay printable.
*/
const mq = typeof matchMedia === 'function' ? matchMedia('(prefers-color-scheme: dark)') : undefined
export const dark = signal(!!mq?.matches)
mq?.addEventListener('change', (e) => (dark.value = e.matches))
export type BaseColor =
| 'garden'
| 'green'
| 'cemetery'
| 'cemeteryEdge'
| 'parking'
| 'parkingEdge'
| 'water'
| 'waterEdge'
| 'stream'
| 'path'
| 'track'
| 'rail'
| 'streetCasing'
| 'street'
| 'roadCasing'
| 'road'
export interface MapPalette {
bg: string
base: Record<BaseColor, string>
/** building outline on dark fills (family houses) and on all other fills */
outlineOnDark: string
outlineOnLight: string
hover: string
selOuter: string
selInner: string
/** scale bar and north arrow */
furnitureBg: string
furnitureInk: string
}
export const LIGHT: MapPalette = {
bg: '#f5f2ea',
base: {
garden: '#e6efd6',
green: '#cfe4bd',
cemetery: '#c9d9bd',
cemeteryEdge: '#9bb08a',
parking: '#e2e2e2',
parkingEdge: '#c4c4c4',
water: '#a8cfe8',
waterEdge: '#7fb2d6',
stream: '#7fb2d6',
path: '#b58b5a',
track: '#c9a16b',
rail: '#666666',
streetCasing: '#9a9a9a',
street: '#ffffff',
roadCasing: '#b8862f',
road: '#ffe08a',
},
outlineOnDark: 'rgba(255,255,255,.55)',
outlineOnLight: 'rgba(0,0,0,.55)',
hover: 'rgba(20,20,20,.9)',
selOuter: '#ffcc00',
selInner: '#000',
furnitureBg: 'rgba(245,242,234,.85)',
furnitureInk: '#000',
}
export const DARK: MapPalette = {
bg: '#1c1e22',
base: {
garden: '#232d22',
green: '#263826',
cemetery: '#28332a',
cemeteryEdge: '#3f5240',
parking: '#2a2c31',
parkingEdge: '#3a3d43',
water: '#1d3850',
waterEdge: '#2c5676',
stream: '#3b6e98',
path: '#806544',
track: '#86704c',
rail: '#8b8e94',
streetCasing: '#121316',
street: '#4b4f57',
roadCasing: '#17130a',
road: '#a2802f',
},
outlineOnDark: 'rgba(255,255,255,.7)',
outlineOnLight: 'rgba(0,0,0,.6)',
hover: 'rgba(255,255,255,.95)',
selOuter: '#ffcc00',
selInner: '#000',
furnitureBg: 'rgba(28,30,34,.85)',
furnitureInk: '#e6e6e6',
}
/** Palette for the on-screen map (reads `dark`, so a theme change redraws). */
export const palette = () => (dark.value ? DARK : LIGHT)

40
src/types.ts Normal file
View file

@ -0,0 +1,40 @@
/** Web Mercator (EPSG:3857) coordinates in metres. */
export type Point = [number, number]
export type Ring = Point[]
/** [minX, minY, maxX, maxY] */
export type BBox = [number, number, number, number]
export type Mode = 'simple' | 'detailed'
export interface Building {
cp: string // house number (číslo popisné), may be empty
use: number // RÚIAN use code (způsob využití)
flats: number | null
floors: number | null
area: number | null // built-up area in m²
year: number | null // year of completion
rings: Ring[]
bb: BBox
cat: string // category key in the current colour mode
sc: string // category key in the simple scheme
}
/** Basemap geometries keyed by layer name (road, water, …). */
export type BaseData = Record<string, Ring[]>
export interface AreaData {
buildings: Building[]
base: BaseData
fails: string[]
}
export interface View {
cx: number
cy: number
s: number
}
export interface LatLon {
lat: number
lon: number
}

4
src/util.ts Normal file
View file

@ -0,0 +1,4 @@
export const sleep = (ms: number) => new Promise<void>((r) => setTimeout(r, ms))
export const errMsg = (e: unknown): string =>
e && (e as Error).message ? (e as Error).message : String(e)

1
src/vite-env.d.ts vendored Normal file
View file

@ -0,0 +1 @@
/// <reference types="vite/client" />

24
tsconfig.json Normal file
View file

@ -0,0 +1,24 @@
{
"compilerOptions": {
"target": "ES2022",
"lib": [
"ES2022",
"DOM",
"DOM.Iterable"
],
"module": "ESNext",
"moduleResolution": "bundler",
"types": [],
"strict": true,
"noEmit": true,
"isolatedModules": true,
"verbatimModuleSyntax": true,
"skipLibCheck": true,
"jsx": "react-jsx",
"jsxImportSource": "preact"
},
"include": [
"src",
"vite.config.ts"
]
}

13
vite.config.ts Normal file
View file

@ -0,0 +1,13 @@
import preact from '@preact/preset-vite'
import { defineConfig } from 'vite'
export default defineConfig({
plugins: [preact()],
root: 'src',
// relative asset URLs so dist/ works from any sub-path
base: './',
build: {
outDir: '../dist',
emptyOutDir: true,
},
})