isaachwf commited on
Commit
008947a
·
verified ·
1 Parent(s): 6330aff

Sync from GitHub via hub-sync

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .dockerignore +22 -0
  2. .gitattributes +1 -0
  3. .gitignore +0 -7
  4. AGENTS.md +259 -0
  5. Dockerfile +46 -0
  6. README.md +116 -105
  7. app.py +3 -915
  8. backend/__init__.py +1 -0
  9. backend/main.py +121 -0
  10. backend/schemas.py +133 -0
  11. cities_data.py +18 -13
  12. create_map_poster.py +71 -691
  13. docs/huggingface_deployment.md +82 -0
  14. frontend/.gitignore +24 -0
  15. frontend/.oxlintrc.json +8 -0
  16. frontend/e2e/editor.spec.ts +30 -0
  17. frontend/index.html +13 -0
  18. frontend/package.json +35 -0
  19. frontend/playwright.config.ts +8 -0
  20. frontend/pnpm-lock.yaml +1767 -0
  21. public/IMG_2953.JPG → frontend/public/sample-poster.webp +2 -2
  22. frontend/public/style-previews/autumn.webp +0 -0
  23. frontend/public/style-previews/blueprint.webp +0 -0
  24. frontend/public/style-previews/contrast_zones.webp +0 -0
  25. frontend/public/style-previews/copper_patina.webp +0 -0
  26. frontend/public/style-previews/feature_based.webp +0 -0
  27. frontend/public/style-previews/forest.webp +0 -0
  28. frontend/public/style-previews/gradient_roads.webp +0 -0
  29. frontend/public/style-previews/japanese_ink.webp +0 -0
  30. frontend/public/style-previews/midnight_blue.webp +0 -0
  31. frontend/public/style-previews/monochrome_blue.webp +0 -0
  32. frontend/public/style-previews/neon_cyberpunk.webp +0 -0
  33. frontend/public/style-previews/noir.webp +0 -0
  34. frontend/public/style-previews/ocean.webp +0 -0
  35. frontend/public/style-previews/pastel_dream.webp +0 -0
  36. frontend/public/style-previews/sunset.webp +0 -0
  37. frontend/public/style-previews/terracotta.webp +0 -0
  38. frontend/public/style-previews/warm_beige.webp +0 -0
  39. frontend/src/App.css +113 -0
  40. frontend/src/App.test.tsx +49 -0
  41. frontend/src/App.tsx +256 -0
  42. frontend/src/api.ts +58 -0
  43. frontend/src/components/MapViewport.tsx +62 -0
  44. frontend/src/index.css +13 -0
  45. frontend/src/main.tsx +10 -0
  46. frontend/src/test/setup.ts +4 -0
  47. frontend/src/types.ts +76 -0
  48. frontend/tsconfig.app.json +26 -0
  49. frontend/tsconfig.json +7 -0
  50. frontend/tsconfig.node.json +23 -0
.dockerignore ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .git
2
+ .github
3
+ .venv
4
+ __pycache__
5
+ *.py[cod]
6
+ .coverage
7
+ htmlcov
8
+ .pytest_cache
9
+ .ruff_cache
10
+ cache
11
+ posters
12
+ /public
13
+ tests
14
+ tools
15
+ docs
16
+ frontend/node_modules
17
+ frontend/dist
18
+ frontend/test-results
19
+ frontend/playwright-report
20
+ *.log
21
+ .env
22
+ .env.*
.gitattributes CHANGED
@@ -37,3 +37,4 @@ fonts/HYWenRunSongYunU.ttf filter=lfs diff=lfs merge=lfs -text
37
  *.png filter=lfs diff=lfs merge=lfs -text
38
  *.JPG filter=lfs diff=lfs merge=lfs -text
39
  *.jpg filter=lfs diff=lfs merge=lfs -text
 
 
37
  *.png filter=lfs diff=lfs merge=lfs -text
38
  *.JPG filter=lfs diff=lfs merge=lfs -text
39
  *.jpg filter=lfs diff=lfs merge=lfs -text
40
+ frontend/public/sample-poster.webp filter=lfs diff=lfs merge=lfs -text
.gitignore DELETED
@@ -1,7 +0,0 @@
1
- cache/
2
- posters/
3
- __pycache__/
4
- *.pyc
5
- .DS_Store
6
- .env
7
- *.log
 
 
 
 
 
 
 
 
AGENTS.md ADDED
@@ -0,0 +1,259 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AGENTS.md - City Map Poster Generator
2
+
3
+ This file provides essential information for agentic coding agents working in the maptoposter repository.
4
+
5
+ ## Project Overview
6
+
7
+ A Python-based web application that generates beautiful, minimalist map posters for any place in the world. The product UI is React/Vite over FastAPI, while OSMnx and Matplotlib power the map pipeline.
8
+
9
+ **Tech Stack:**
10
+ - Python 3.12+
11
+ - React + Vite (primary web UI)
12
+ - FastAPI (application/API layer)
13
+ - OSMnx (street network analysis)
14
+ - Matplotlib (map rendering)
15
+ - GeoPandas (geospatial data)
16
+ - Nominatim (geocoding)
17
+
18
+ ## Build/Test/Lint Commands
19
+
20
+ ### Environment Setup
21
+ ```bash
22
+ # Install dependencies with uv
23
+ uv sync --all-groups
24
+ corepack pnpm --dir frontend install --frozen-lockfile
25
+ ```
26
+
27
+ ### Running the Application
28
+ ```bash
29
+ # Start the API
30
+ uv run python app.py
31
+
32
+ # Start the frontend dev server in another terminal
33
+ corepack pnpm --dir frontend dev
34
+
35
+ # Or use the restart script (handles port conflicts)
36
+ bash restart.sh
37
+
38
+ # Development UI: http://localhost:5173
39
+ # Production-style UI/API: http://localhost:7860 after building frontend
40
+ ```
41
+
42
+ ### Running Tests
43
+ ```bash
44
+ # Run the full pytest suite
45
+ uv run pytest
46
+
47
+ # Run individual test functions
48
+ uv run pytest test_logic.py -k "china_hierarchy or manual_coordinates"
49
+ ```
50
+
51
+ ### Development Utilities
52
+ ```bash
53
+ # Verify city data integrity
54
+ uv run python verify_data.py
55
+
56
+ # Create map poster directly (CLI)
57
+ uv run python create_map_poster.py --city "Beijing" --theme japanese_ink --output-format png
58
+ ```
59
+
60
+ ## Code Style Guidelines
61
+
62
+ ### General Principles
63
+ - **Bilingual Support**: All user-facing text should support both English (en) and Chinese (cn)
64
+ - **File Encoding**: Use UTF-8 encoding with BOM for Chinese characters: `# -*- coding: utf-8 -*-`
65
+ - **Function Documentation**: Use docstrings for all public functions
66
+ - **Error Handling**: Provide meaningful error messages in both languages when possible
67
+
68
+ ### Import Organization
69
+ ```python
70
+ # Standard library imports first
71
+ import os
72
+ import json
73
+ import sys
74
+ from datetime import datetime
75
+
76
+ # Third-party imports next
77
+ from fastapi import FastAPI
78
+ import osmnx as ox
79
+ import matplotlib.pyplot as plt
80
+ import pandas as pd
81
+ import numpy as np
82
+ from geopy.geocoders import Nominatim
83
+
84
+ # Local imports last
85
+ from cities_data import get_countries, get_provinces, get_cities
86
+ from create_map_poster import generate_map_poster
87
+ ```
88
+
89
+ ### Naming Conventions
90
+ - **Files**: `snake_case.py` (e.g., `cities_data.py`, `test_logic.py`)
91
+ - **Variables/Functions**: `snake_case` (e.g., `get_available_themes()`, `motorway_color`)
92
+ - **Constants**: `UPPER_SNAKE_CASE` (e.g., `THEMES_DIR`, `LAYER_KEYS`)
93
+ - **Classes**: `PascalCase` (rare in this codebase, but follow convention if used)
94
+
95
+ ### Type Hints
96
+ ```python
97
+ def generate_output_filename(city: str, theme_name: str, output_format: str) -> str:
98
+ """Generate unique output filename with city, theme, and datetime."""
99
+ pass
100
+
101
+ def get_theme_choices(lang: str = "en") -> list[tuple[str, str]]:
102
+ """Return a list of (Display Name, Internal Name) tuples for themes."""
103
+ pass
104
+ ```
105
+
106
+ ### String Patterns
107
+ - **Language Keys**: Use `lang="en"` or `lang="cn"` parameters
108
+ - **Layer Constants**: Define parallel arrays for different languages
109
+ ```python
110
+ LAYERS_EN = ["Motorway", "Primary Roads", "Secondary Roads", "Water", "Parks"]
111
+ LAYERS_CN = ["高速公路", "主干道", "次干道", "水域", "公园"]
112
+ LAYER_KEYS = ["motorway", "primary", "secondary", "water", "parks"]
113
+ ```
114
+
115
+ ### Data Structures
116
+ - **City Hierarchy**: Use tuples for display/internal name pairs: `[("Display Name", "internal_name"), ...]`
117
+ - **Theme Files**: JSON format with descriptive names: `{"name": "Theme Name", "bg": "#FFFFFF", ...}`
118
+ - **Coordinates**: Use `(lat, lon)` tuple format
119
+
120
+ ## Directory Structure
121
+
122
+ ```
123
+ maptoposter/
124
+ ├── app.py # FastAPI + built frontend entry point
125
+ ├── Dockerfile # Hugging Face production container
126
+ ├── create_map_poster.py # Core poster generation logic
127
+ ├── cities_data.py # City/province/district data management
128
+ ├── test_logic.py # Test suite for data logic
129
+ ├── verify_data.py # Data integrity verification
130
+ ├── backend/ # FastAPI schemas and endpoints
131
+ ├── frontend/ # React/Vite editor
132
+ ├── docs/ # Deployment and maintenance guides
133
+ ├── .github/workflows/ # Validation and Space publishing
134
+ ├── src/maptoposter/ # Typed core, cache, renderer, resources
135
+ ├── themes/ # JSON theme configuration files
136
+ ├── fonts/ # Font files (Chinese and English)
137
+ ├── posters/ # Generated poster outputs
138
+ ├── public/ # Static assets and demo images
139
+ └── restart.sh # Development restart script
140
+ ```
141
+
142
+ ## Common Patterns
143
+
144
+ ### Language Support
145
+ ```python
146
+ def translate(text: str, lang: str = "en") -> str:
147
+ """Simple translation wrapper."""
148
+ translations = {
149
+ "en": {"City": "City", "Theme": "Theme"},
150
+ "cn": {"City": "城市", "Theme": "主题"}
151
+ }
152
+ return translations.get(lang, {}).get(text, text)
153
+ ```
154
+
155
+ ### File Path Handling
156
+ ```python
157
+ THEMES_DIR = "themes"
158
+ FONTS_DIR = "fonts"
159
+ POSTERS_DIR = "posters"
160
+
161
+ # Always check existence
162
+ if not os.path.exists(THEMES_DIR):
163
+ return []
164
+ ```
165
+
166
+ ### FastAPI Endpoint Patterns
167
+ ```python
168
+ @app.get("/api/v1/health")
169
+ def health() -> dict[str, str]:
170
+ """Return service readiness and version information."""
171
+ return {"status": "ok", "version": __version__}
172
+ ```
173
+
174
+ ## Testing Guidelines
175
+
176
+ ### Test Structure
177
+ - Use pytest tests with focused fixtures and mocks
178
+ - Group related tests in modules/functions (e.g., `test_china_hierarchy()`)
179
+ - Test both data integrity and coordinate retrieval
180
+ - Include Chinese characters in test data
181
+
182
+ ### Test Execution
183
+ ```bash
184
+ # Run all tests
185
+ uv run pytest
186
+
187
+ # The exact count grows with the maintained suite; require zero failures.
188
+ ```
189
+
190
+ ## Error Handling
191
+
192
+ ### Common Patterns
193
+ ```python
194
+ # File not found handling
195
+ if not os.path.exists(font_path):
196
+ print(f"⚠ Font not found: {font_path}")
197
+ continue
198
+
199
+ # API error handling
200
+ try:
201
+ result = geocoder.geocode(city)
202
+ except Exception as e:
203
+ print(f"⚠ Geocoding failed for {city}: {e}")
204
+ return None
205
+
206
+ # Data validation
207
+ assert len(provinces) > 30, f"Expected >30 provinces, found {len(provinces)}"
208
+ ```
209
+
210
+ ## Performance Considerations
211
+
212
+ - **Caching**: OSMnx caching is enabled: `ox.settings.use_cache = True`
213
+ - **Large Cities**: Be aware that Beijing/Shanghai may have centering issues
214
+ - **Small Cities**: Some layers may be empty due to missing OSM data
215
+ - **Memory**: Clear matplotlib figures after generation to prevent memory leaks
216
+
217
+ ## Font Management
218
+
219
+ The project supports both English and Chinese fonts:
220
+ - **English**: Goudy Old Style (Regular, Bold)
221
+ - **Chinese**: HYWenRunSongYunU.ttf
222
+
223
+ Always verify font availability before use:
224
+ ```python
225
+ if os.path.exists(font_path):
226
+ font = FontProperties(fname=font_path)
227
+ else:
228
+ print(f"⚠ Font not found: {font_path}")
229
+ font = None
230
+ ```
231
+
232
+ ## Theme Development
233
+
234
+ Themes are JSON files in the `themes/` directory with the following structure:
235
+ ```json
236
+ {
237
+ "name": "Theme Display Name",
238
+ "description": "Brief description",
239
+ "bg": "#FFFFFF",
240
+ "text": "#000000",
241
+ "water": "#E0E0E0",
242
+ "parks": "#F0F0F0",
243
+ "road_motorway": "#FF0000",
244
+ "road_primary": "#333333",
245
+ "road_secondary": "#666666",
246
+ "road_tertiary": "#999999",
247
+ "road_residential": "#CCCCCC",
248
+ "road_default": "#888888"
249
+ }
250
+ ```
251
+
252
+ ## Development Notes
253
+
254
+ - **Port Management**: Default port is 7860. Use `restart.sh` to handle conflicts
255
+ - **Output Directory**: Generated posters go to `posters/` (auto-created if needed)
256
+ - **Debugging**: Use print statements with emoji indicators for important events
257
+ - **Code Organization**: Keep API routes in `backend/`, UI code in `frontend/`, and domain logic in `src/maptoposter/`
258
+ - **Deployment**: GitHub `main` is mirrored to the Docker Space only after CI validation
259
+ - **Dependencies**: The project uses `uv` for dependency management. Lock file is `uv.lock`
Dockerfile ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM node:22-bookworm-slim AS frontend-builder
2
+
3
+ WORKDIR /build/frontend
4
+ RUN corepack enable
5
+
6
+ COPY frontend/package.json frontend/pnpm-lock.yaml ./
7
+ RUN corepack pnpm install --frozen-lockfile
8
+
9
+ COPY frontend/ ./
10
+ RUN corepack pnpm build
11
+
12
+
13
+ FROM python:3.12-slim-bookworm AS runtime
14
+
15
+ COPY --from=ghcr.io/astral-sh/uv:0.12.7 /uv /uvx /bin/
16
+
17
+ ENV PYTHONUNBUFFERED=1 \
18
+ PYTHONDONTWRITEBYTECODE=1 \
19
+ UV_COMPILE_BYTECODE=1 \
20
+ UV_LINK_MODE=copy \
21
+ PATH="/app/.venv/bin:$PATH" \
22
+ MPLCONFIGDIR=/tmp/matplotlib \
23
+ XDG_CACHE_HOME=/data/.cache \
24
+ MAPTOPOSTER_CACHE_DIR=/data/cache \
25
+ MAPTOPOSTER_OUTPUT_DIR=/data/posters \
26
+ MAPTOPOSTER_USER_AGENT="MapToPoster/0.2 (+https://huggingface.co/spaces/isaachwf/MapToPoster)"
27
+
28
+ WORKDIR /app
29
+
30
+ COPY pyproject.toml uv.lock README.md ./
31
+ COPY src/ ./src/
32
+ COPY backend/ ./backend/
33
+ COPY app.py create_map_poster.py cities_data.py ./
34
+ COPY themes/ ./themes/
35
+ COPY fonts/ ./fonts/
36
+
37
+ RUN uv sync --frozen --no-dev --no-editable \
38
+ && mkdir -p /data/cache /data/posters /data/.cache /tmp/matplotlib \
39
+ && chown -R 1000:1000 /app /data /tmp/matplotlib
40
+
41
+ COPY --from=frontend-builder --chown=1000:1000 /build/frontend/dist ./frontend/dist
42
+
43
+ USER 1000:1000
44
+ EXPOSE 7860
45
+
46
+ CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1", "--proxy-headers", "--forwarded-allow-ips", "*"]
README.md CHANGED
@@ -3,165 +3,176 @@ title: MapToPoster
3
  emoji: 🗺️
4
  colorFrom: indigo
5
  colorTo: purple
6
- sdk: gradio
7
- sdk_version: 5.12.0
8
  python_version: 3.12
9
- app_file: app.py
10
  pinned: false
11
  ---
12
 
13
- # 🌆 城市地图海报生成器 | City Map Poster Generator
14
 
15
- <p align="center">
16
- <a href="#中文"><b>中文</b></a> | <a href="#english"><b>English</b></a>
17
- </p>
18
 
19
- <p align="center">
20
- <a href="https://huggingface.co/spaces/isaachwf/MapToPoster">
21
- <img src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-yellow" alt="Hugging Face Spaces">
22
- </a>
23
- </p>
24
 
25
- ---
26
 
27
  ## 中文
28
 
29
- 为全球任何城市生成精美、简约的地图海报。该项目基于 [originalankur/maptoposter](https://github.com/originalankur/maptoposter) 开发。
30
-
31
- > **🚀 在线体验**:[Hugging Face Space](https://huggingface.co/spaces/isaachwf/MapToPoster)(受限于服务器资源,生成速度很慢。。。)
32
 
33
- <p align="center">
34
- <img src="posters/beijing_japanese_ink_20260121_211625.png" width="300">
35
- <img src="posters/shanghai_ocean_20260121_215944.png" width="300">
36
- </p>
37
 
38
- ### ⚠️ 注意事项与局限性
 
 
 
 
 
 
 
39
 
40
- - **特大城市**(如北京):可能会出现中心定位不准的问题。
41
- - **小城市**:由于 OpenStreetMap 数据缺失,部分图层元素可能无法显示。
42
- - **生成速度**:由于使用国外服务器资源(OSM/Nominatim)且渲染方式较基础,下载和渲染速度可能较慢。
43
 
44
- ### ✨ 特性
45
 
46
- - **🎨 丰富主题**:内置 17+ 种精心设计的主题(从极简黑白到赛博朋克)。
47
- - **🔍 智能选择**:支持级联选择(国家 → 省份 → 城市)或直接搜索。
48
- - **⚙️ 高度自定义**:
49
- - 调整地图半径(从 4km 街道级到 30km 都市圈)。
50
- - 各种输出比例(A4, 方形等,通过宽/高设置)。
51
- - **图层控制**:自由选择显示高速、主干道、次干道、水域或公园。
52
- - **🖼️ 多格式导出**:支持 PNG(高清打印)、SVG(矢量编辑)和 PDF。
53
- - **🖱️ 交互界面**:基于 Gradio 的现代化 Web UI,支持实时预览。
54
 
55
- ### 界面预览
56
 
57
- <p align="center">
58
- <img src="public/image.png" width="800" alt="Web UI Preview">
59
- </p>
60
 
61
- ### 🚀 快速开始
62
-
63
- #### 安装
 
64
 
65
- 推荐使用 `uv` 管理项目:
66
 
67
- ```bash
68
- # 同步环境及依赖
69
- uv sync
70
  ```
71
 
72
- #### 启动 Web UI
73
 
74
- ```bash
 
 
 
75
  uv run python app.py
76
  ```
77
- 启动后在浏览器打开 [http://localhost:7860](http://localhost:7860)。
78
-
79
- > **提示**:如果遇到端口冲突,可以使用 `bash restart.sh` 脚本自动清理旧进程并重启服务。
80
 
81
- ### 🖼️ 示例展示
82
 
83
- | 国家 | 城市 | 主题 | 海报预览 |
84
- |:---:|:---:|:---:|:---:|
85
- | 中国 | 丽江 | japanese_ink | <img src="posters/丽江_japanese_ink_20260121_200317.png" width="200"> |
86
- | 中国 | 北京 | japanese_ink | <img src="posters/beijing_japanese_ink_20260121_211625.png" width="200"> |
87
- | 中国 | 广州 | pastel_dream | <img src="posters/guangzhou_pastel_dream_20260121_213223.png" width="200"> |
88
- | 中国 | 桂林 | forest | <img src="posters/guilin_forest_20260121_205822.png" width="200"> |
89
- | 中国 | 香港 | ocean | <img src="posters/hong_kong_ocean_20260121_211146.png" width="200"> |
90
- | 中国 | 上海 | ocean | <img src="posters/shanghai_ocean_20260121_215944.png" width="200"> |
91
 
92
- ---
 
 
 
93
 
94
- 如果你觉得这个项目对你有帮助,欢迎打赏两毛钱~太感谢啦~
95
 
96
- <p align="left">
97
- <img src="public/IMG_2953.JPG" width="200" alt="Donate">
98
- </p>
99
 
100
- ---
 
 
 
 
 
 
 
101
 
102
- ## English
103
 
104
- Generate beautiful, minimalist map posters for any city in the world. This project is developed based on [originalankur/maptoposter](https://github.com/originalankur/maptoposter).
 
 
 
105
 
106
- > **🚀 Live Demo**: [Hugging Face Space](https://huggingface.co/spaces/isaachwf/MapToPoster) (Note: Rendering is slow due to limited server resources).
 
 
 
 
 
 
 
 
 
107
 
108
- ### ⚠️ Limitations & Disclaimer
109
 
110
- - **Large Metros** (e.g., Beijing): Positioning might not perfectly center on the downtown area.
111
- - **Small Cities**: Some layers might be empty due to missing data in OpenStreetMap.
112
- - **Performance**: Downloads and rendering can be slow as it relies on external APIs (OSM/Nominatim) and basic rendering methods.
113
 
114
- ### ✨ Features
115
 
116
- - **🎨 Diverse Themes**: 17+ pre-designed themes (ranging from minimalist B&W to Cyberpunk).
117
- - **🔍 Smart Selection**: Cascading selection (Country → Province → City).
118
- - **⚙️ Highly Customizable**:
119
- - Adjustable map radius (4km street-level to 30km metro area).
120
- - custom dimensions (width/height in inches).
121
- - **Layer Control**: Toggle Motorways, Primary roads, Secondary roads, Water, and Parks.
122
- - **🖼️ Multi-format Export**: Supports PNG (High-res), SVG (Vector), and PDF.
123
- - **🖱️ Interactive UI**: Modern Web UI built with Gradio with real-time preview.
124
 
125
- ### 🖥️ UI Preview
126
 
127
- <p align="center">
128
- <img src="public/image.png" width="800" alt="Web UI Preview">
129
- </p>
130
 
131
- ### 🚀 Quick Start
132
 
133
- #### Installation
134
 
135
- Recommended: Use `uv` for environment management:
136
 
137
- ```bash
138
- uv sync
 
139
  ```
140
 
141
- #### Launch Web UI
142
 
143
- ```bash
144
  uv run python app.py
 
145
  ```
146
- Open [http://localhost:7860](http://localhost:7860) in your browser.
147
 
148
- > **Tip**: If you encounter port conflicts, you can use the `bash restart.sh` script to automatically clear old processes and restart the service.
 
 
149
 
150
- ### 🖼️ Examples
 
 
 
151
 
152
- | Country | City | Theme | Poster |
153
- |:---:|:---:|:---:|:---:|
154
- | China | Lijiang | japanese_ink | <img src="posters/丽江_japanese_ink_20260121_200317.png" width="200"> |
155
- | China | Beijing | japanese_ink | <img src="posters/beijing_japanese_ink_20260121_211625.png" width="200"> |
156
- | China | Guangzhou | pastel_dream | <img src="posters/guangzhou_pastel_dream_20260121_213223.png" width="200"> |
157
- | China | Shanghai | ocean | <img src="posters/shanghai_ocean_20260121_215944.png" width="200"> |
 
 
 
 
 
 
 
 
 
 
 
158
 
159
- ---
160
 
161
- ### 🛠️ Technical Details
162
 
163
- - **Data Source**: © OpenStreetMap contributors
164
- - **Geocoding**: Nominatim
165
- - **Rendering**: OSMnx & Matplotlib
166
 
 
167
 
 
 
3
  emoji: 🗺️
4
  colorFrom: indigo
5
  colorTo: purple
6
+ sdk: docker
7
+ app_port: 7860
8
  python_version: 3.12
 
9
  pinned: false
10
  ---
11
 
12
+ # MapToPoster
13
 
14
+ **把任何地方变成一张地图艺术海报。 / Turn any place into a piece of art.**
 
 
15
 
16
+ [中文](#中文) · [English](#english) · [在线体验 / Live demo](https://huggingface.co/spaces/isaachwf/MapToPoster)
 
 
 
 
17
 
18
+ ![MapToPoster sample](frontend/public/sample-poster.webp)
19
 
20
  ## 中文
21
 
22
+ MapToPoster 是一个地图海报编辑器。你可以搜索城市、街区、校园或坐标,在交互地图中调整取景范围,再编辑主题、版式、文字、图层和纸张比例,最后导出 PNG、SVG 或 PDF。
 
 
23
 
24
+ ### 主要功能
 
 
 
25
 
26
+ - 搜索全球地点,也支持直接输入 `纬度, 经度`。
27
+ - 使用 MapLibre 交互调整中心点、缩放和海报边界。
28
+ - 内置 17 套 JSON 主题和 5 种排版布局。
29
+ - 自定义标题、副标题、说明文字、坐标、字距、对齐和分隔线。
30
+ - 控制高速、主干道、次干道、住宅道路、水域和公园图层。
31
+ - 支持 3:4、4:5、2:3、1:1、9:16、A4 和 A3。
32
+ - 快速低分辨率预览,以及 300 DPI PNG、SVG、PDF 导出。
33
+ - 中国行政区优先使用本地数据,其余位置通过 Nominatim 搜索。
34
 
35
+ ### 在线版本
 
 
36
 
37
+ 最新版部署在 [Hugging Face Space](https://huggingface.co/spaces/isaachwf/MapToPoster),使用免费的 CPU Basic 硬件。免费实例闲置后会休眠,第一次访问可能需要等待唤醒。
38
 
39
+ 地图数据和地理编码缓存位于容器的 `/data` 目录。免费硬件没有永久磁盘,Space 重启后缓存会被清空,但不会影响功能,只会让下一次生成重新下载 OpenStreetMap 数据。
 
 
 
 
 
 
 
40
 
41
+ ### 本地开发
42
 
43
+ 项目要求 Python 3.12+、[uv](https://docs.astral.sh/uv/) 和 Node.js 22+。前端依赖由 pnpm 管理。
 
 
44
 
45
+ ```powershell
46
+ uv sync --all-groups
47
+ corepack pnpm --dir frontend install --frozen-lockfile
48
+ ```
49
 
50
+ 在两个终端中启动 API 和前端开发服务器:
51
 
52
+ ```powershell
53
+ uv run python app.py
54
+ corepack pnpm --dir frontend dev
55
  ```
56
 
57
+ 打开 <http://localhost:5173>。FastAPI 位于 <http://localhost:7860>。
58
 
59
+ 生产模式本地运行:
60
+
61
+ ```powershell
62
+ corepack pnpm --dir frontend build
63
  uv run python app.py
64
  ```
 
 
 
65
 
66
+ 此时打开 <http://localhost:7860>,FastAPI 会直接提供构建后的 React 页面。
67
 
68
+ ### Docker
 
 
 
 
 
 
 
69
 
70
+ ```bash
71
+ docker build -t maptoposter .
72
+ docker run --rm -p 7860:7860 maptoposter
73
+ ```
74
 
75
+ Docker 镜像使用 Node 多阶段构建前端,并以非 root 用户运行单个 Uvicorn worker。详细部署、凭据和回滚说明见 [Hugging Face 部署文档](docs/huggingface_deployment.md)。
76
 
77
+ ### 测试
 
 
78
 
79
+ ```powershell
80
+ uv run pytest
81
+ uv run ruff check src backend tests app.py create_map_poster.py
82
+ uv run pyright
83
+ corepack pnpm --dir frontend test
84
+ corepack pnpm --dir frontend lint
85
+ corepack pnpm --dir frontend build
86
+ ```
87
 
88
+ ### CLI 与 API
89
 
90
+ ```powershell
91
+ uv run maptoposter --help
92
+ uv run maptoposter --city "Beijing" --theme japanese_ink --output-format png
93
+ ```
94
 
95
+ ```text
96
+ GET /api/v1/health
97
+ GET /api/v1/styles
98
+ GET /api/v1/layouts
99
+ GET /api/v1/sizes
100
+ GET /api/v1/locations/search?q=Paris
101
+ POST /api/v1/map-data/prepare
102
+ POST /api/v1/posters/preview
103
+ POST /api/v1/posters/export
104
+ ```
105
 
106
+ ## English
107
 
108
+ MapToPoster is a map-poster editor for cities, neighbourhoods, campuses, and meaningful coordinates. Frame a place in the interactive map, customize its style and typography, then export a print-ready poster.
 
 
109
 
110
+ ### Features
111
 
112
+ - Search worldwide locations or enter `latitude, longitude` directly.
113
+ - Pan and zoom an interactive MapLibre viewport to frame the poster.
114
+ - Choose from 17 JSON themes and five layout presets.
115
+ - Edit titles, subtitles, captions, coordinates, tracking, alignment, and dividers.
116
+ - Toggle motorway, primary, secondary, residential, water, and park layers.
117
+ - Use 3:4, 4:5, 2:3, 1:1, 9:16, A4, and A3 size presets.
118
+ - Generate quick previews and export 300 DPI PNG, SVG, or PDF files.
119
+ - Resolve Chinese administrative areas locally before contacting Nominatim.
120
 
121
+ ### Hosted application
122
 
123
+ The latest `main` build runs on the free [Hugging Face Space](https://huggingface.co/spaces/isaachwf/MapToPoster). Free CPU Basic instances sleep after inactivity, so the first visit may need time to wake the application.
 
 
124
 
125
+ Map and geocoding caches use `/data` inside the container. Free hardware does not provide persistent disk storage: a restart clears the cache, but the application remains functional and downloads the required OpenStreetMap data again.
126
 
127
+ ### Local development
128
 
129
+ The project requires Python 3.12+, [uv](https://docs.astral.sh/uv/), and Node.js 22+. pnpm manages the frontend dependencies.
130
 
131
+ ```powershell
132
+ uv sync --all-groups
133
+ corepack pnpm --dir frontend install --frozen-lockfile
134
  ```
135
 
136
+ Start the API and frontend development server in separate terminals:
137
 
138
+ ```powershell
139
  uv run python app.py
140
+ corepack pnpm --dir frontend dev
141
  ```
 
142
 
143
+ Open <http://localhost:5173>. The API runs at <http://localhost:7860>.
144
+
145
+ For a production-style local run:
146
 
147
+ ```powershell
148
+ corepack pnpm --dir frontend build
149
+ uv run python app.py
150
+ ```
151
 
152
+ Open <http://localhost:7860>; FastAPI serves the built React application directly.
153
+
154
+ ### Architecture
155
+
156
+ ```text
157
+ React + TypeScript editor
158
+ ↓ JSON / image bytes
159
+ FastAPI application layer (backend/)
160
+ ↓ PosterConfig / MapDataRef
161
+ MapToPoster core (src/maptoposter/)
162
+ ├── local and Nominatim geocoding
163
+ ├── OSM acquisition and GeoPackage cache
164
+ ├── typed themes, layouts, typography, and viewport models
165
+ └── network-free Matplotlib renderer
166
+ ↓
167
+ PNG / SVG / PDF
168
+ ```
169
 
170
+ ### Deployment
171
 
172
+ Every push to GitHub `main` runs the Python checks, frontend checks, and a Linux Docker smoke test. A successful workflow mirrors the repository to the Hugging Face Space `main` branch. Deployment and rollback instructions are in [docs/huggingface_deployment.md](docs/huggingface_deployment.md).
173
 
174
+ ## Data and licensing
 
 
175
 
176
+ Roads, water, parks, and external geocoding results come from OpenStreetMap services. Provide an identifiable `MAPTOPOSTER_USER_AGENT` for non-Docker deployments and respect the upstream usage policies. Data completeness varies by location, and large viewports can take longer to prepare.
177
 
178
+ See [LICENSE](LICENSE) for the project license and review the bundled font licenses before redistributing them. Map data and derived geometries are © OpenStreetMap contributors.
app.py CHANGED
@@ -1,918 +1,6 @@
1
- # -*- coding: utf-8 -*-
2
- """
3
- Gradio Web Interface for City Map Poster Generator
4
- """
5
 
6
- import os
7
- import json
8
- import tempfile
9
 
10
- # Monkey-patch gradio_client bug before importing gradio
11
- # Fix for: TypeError: argument of type 'bool' is not iterable
12
- # and APIInfoParseError: Cannot parse schema True
13
- try:
14
- import gradio_client.utils as client_utils
15
-
16
- # Patch _json_schema_to_python_type to handle boolean schemas
17
- _original_json_schema_to_python_type = client_utils._json_schema_to_python_type
18
-
19
- def _patched_json_schema_to_python_type(schema, defs):
20
- # Handle boolean schema (e.g., additionalProperties: true/false)
21
- if schema is True:
22
- return "Any"
23
- if schema is False:
24
- return "None"
25
- return _original_json_schema_to_python_type(schema, defs)
26
-
27
- client_utils._json_schema_to_python_type = _patched_json_schema_to_python_type
28
- except Exception as e:
29
- print(f"Warning: Could not patch gradio_client: {e}")
30
-
31
- import gradio as gr
32
-
33
- # Import from the main module
34
- from cities_data import (
35
- get_countries,
36
- get_provinces,
37
- get_cities,
38
- get_districts,
39
- translate,
40
- get_country_key,
41
- )
42
-
43
-
44
- # --- Constants ---
45
- THEMES_DIR = "themes"
46
- FONTS_DIR = "fonts"
47
- POSTERS_DIR = "posters"
48
-
49
- # Layer Constants
50
- LAYERS_EN = ["Motorway", "Primary Roads", "Secondary Roads", "Water", "Parks"]
51
- LAYERS_CN = ["高速公路", "主干道", "次干道", "水域", "公园"]
52
- LAYER_KEYS = ["motorway", "primary", "secondary", "water", "parks"]
53
-
54
-
55
- def get_available_themes():
56
- """Scans the themes directory and returns a list of available theme names."""
57
- if not os.path.exists(THEMES_DIR):
58
- return []
59
-
60
- themes = []
61
- for file in sorted(os.listdir(THEMES_DIR)):
62
- if file.endswith(".json"):
63
- theme_name = file[:-5]
64
- themes.append(theme_name)
65
- return themes
66
-
67
-
68
- def get_theme_choices(lang="en"):
69
- """Return a list of (Display Name, Internal Name) tuples for themes."""
70
- internal_names = get_available_themes()
71
- choices = []
72
-
73
- for internal_name in internal_names:
74
- theme_info = load_theme_info(internal_name)
75
- if theme_info:
76
- proper_name = theme_info.get("name", internal_name)
77
- display_name = translate(proper_name, lang)
78
- choices.append((display_name, internal_name))
79
- else:
80
- choices.append((internal_name, internal_name))
81
-
82
- return choices
83
-
84
-
85
- def load_theme_info(theme_name):
86
- """Load theme details for preview."""
87
- theme_file = os.path.join(THEMES_DIR, f"{theme_name}.json")
88
- if os.path.exists(theme_file):
89
- with open(theme_file, "r") as f:
90
- return json.load(f)
91
- return None
92
-
93
-
94
- def get_theme_preview_html(theme_name, lang="en"):
95
- """Generate HTML preview for a theme."""
96
- theme = load_theme_info(theme_name)
97
- lang_code = "en" if lang == "English" else "cn"
98
-
99
- if not theme:
100
- return f"<p>{'Theme load failed' if lang_code == 'en' else '主题加载失败'}</p>"
101
-
102
- # Translated labels
103
- labels = {
104
- "bg": "Background" if lang_code == "en" else "背景",
105
- "text": "Text" if lang_code == "en" else "文字",
106
- "motorway": "Motorway" if lang_code == "en" else "高速公路",
107
- "primary": "Primary Road" if lang_code == "en" else "主干道",
108
- "secondary": "Secondary Road" if lang_code == "en" else "次干道",
109
- "water": "Water" if lang_code == "en" else "水域",
110
- "parks": "Parks" if lang_code == "en" else "公园",
111
- }
112
-
113
- # Create color swatches
114
- colors = [
115
- (labels["bg"], theme.get("bg", "#FFFFFF")),
116
- (labels["text"], theme.get("text", "#000000")),
117
- (labels["motorway"], theme.get("road_motorway", "#000000")),
118
- (labels["primary"], theme.get("road_primary", "#333333")),
119
- (labels["secondary"], theme.get("road_secondary", "#666666")),
120
- (labels["water"], theme.get("water", "#C0C0C0")),
121
- (labels["parks"], theme.get("parks", "#F0F0F0")),
122
- ]
123
-
124
- display_name = translate(theme.get("name", theme_name), lang_code)
125
- description = theme.get("description", "")
126
- # Optional: translate description if we really want to, but might be too much work
127
-
128
- html = f"""
129
- <div style="padding: 12px; background: {theme.get("bg", "#FFFFFF")}; border-radius: 8px; border: 1px solid #ddd;">
130
- <h4 style="color: {theme.get("text", "#000000")}; margin: 0 0 8px 0; font-size: 14px;">
131
- {display_name}
132
- </h4>
133
- <p style="color: {theme.get("text", "#000000")}; opacity: 0.7; margin: 0 0 12px 0; font-size: 12px;">
134
- {description}
135
- </p>
136
- <div style="display: flex; flex-wrap: wrap; gap: 6px;">
137
- """
138
-
139
- for label, color in colors:
140
- html += f"""
141
- <div style="display: flex; align-items: center; gap: 4px;">
142
- <div style="width: 20px; height: 20px; background: {color}; border-radius: 4px; border: 1px solid #ccc;"></div>
143
- <span style="font-size: 10px; color: {theme.get("text", "#000")}; opacity: 0.8;">{label}</span>
144
- </div>
145
- """
146
-
147
- html += "</div></div>"
148
- return html
149
-
150
-
151
- def generate_poster(
152
- location_mode,
153
- custom_lat,
154
- custom_lon,
155
- custom_city_name,
156
- custom_country_name,
157
- country_display,
158
- province,
159
- city_dropdown,
160
- district_dropdown,
161
- theme_name,
162
- distance,
163
- width,
164
- height,
165
- output_format,
166
- no_crop,
167
- show_text,
168
- poster_lang,
169
- layers_selection,
170
- progress=gr.Progress(),
171
- ):
172
- """
173
- Generate the map poster with given parameters.
174
- """
175
- # Import here to avoid circular imports and ensure THEME is set correctly
176
- import create_map_poster as cmp
177
-
178
- # Decode layer selection
179
- show_motorway = any(x in ["Motorway", "高速公路"] for x in layers_selection)
180
- show_primary = any(x in ["Primary Roads", "主干道"] for x in layers_selection)
181
- show_secondary = any(x in ["Secondary Roads", "次干道"] for x in layers_selection)
182
- show_water = any(x in ["Water", "水域"] for x in layers_selection)
183
- show_parks = any(x in ["Parks", "公园"] for x in layers_selection)
184
-
185
- # Determine display names based on poster_lang
186
- lang_code = "en" if poster_lang == "English" else "cn"
187
- actual_distance = distance
188
- display_city = ""
189
- display_country = ""
190
- coords = None
191
-
192
- progress(0.1, desc="正在加载主题...")
193
- # Load theme
194
- cmp.THEME = cmp.load_theme(theme_name)
195
-
196
- if location_mode == "自定义坐标" or location_mode == "Custom Coordinates":
197
- lat_val = float(custom_lat)
198
- lon_val = float(custom_lon)
199
-
200
- # Basic validation: Latitude must be between -90 and 90
201
- if lat_val < -90 or lat_val > 90:
202
- return None, f"❌ 纬度超出范围 (-90 到 90)。你是否填反了经纬度?(当前填入: {lat_val})"
203
-
204
- coords = (lat_val, lon_val)
205
- display_city = custom_city_name if custom_city_name else ""
206
- display_country = custom_country_name if custom_country_name else ""
207
-
208
- # Determine output filename component
209
- selected_location = display_city
210
-
211
- else:
212
- # Standard Dropdown Logic
213
- # Parse country
214
- # Since we now use (Display, Value) tuples where Value is the key,
215
- # country_display is likely already the key. get_country_key remains for safety.
216
- selected_country = get_country_key(country_display)
217
-
218
- # Use dropdown selection
219
- # If district is selected and isn't "整个城市", use its coordinates
220
- selected_location = (
221
- district_dropdown
222
- if (district_dropdown and district_dropdown != city_dropdown)
223
- else city_dropdown
224
- )
225
-
226
- # Detect if we are selecting an entire province
227
- is_whole_province = False
228
- if selected_country == "中国" and selected_location:
229
- if selected_location.endswith("_WHOLE"):
230
- is_whole_province = True
231
- selected_location = selected_location.replace("_WHOLE", "")
232
-
233
- if not selected_location:
234
- return None, "❌ 请选择城市或区县名称"
235
-
236
- if not selected_country:
237
- return None, "❌ 请选择国家"
238
-
239
- # For whole province, we might want to override the distance if it's too small
240
- if is_whole_province:
241
- # A province is much larger than a city. Default 10km is way too small.
242
- # We'll use a larger default or just trust the user if they've slid it up,
243
- # but let's ensure it's at least 150km for a province.
244
- if distance < 100000:
245
- actual_distance = 200000 # 200km default for province
246
- print(
247
- f"Whole province detected ({selected_location}). Increasing distance to {actual_distance}m"
248
- )
249
-
250
- if selected_country == "中国" and lang_code == "cn":
251
- if is_whole_province:
252
- display_city = selected_location
253
- display_country = "中国"
254
- # Hierarchical logic for China (Chinese language)
255
- elif district_dropdown and district_dropdown != city_dropdown:
256
- # Case 3 & 4: District selected
257
- display_city = district_dropdown
258
- if province == city_dropdown:
259
- # Case 3: District of Municipality
260
- display_country = f"中国 {province}"
261
- else:
262
- # Case 4: District of Regular City
263
- display_country = f"中国 {province} {city_dropdown}"
264
- else:
265
- # Case 1 & 2: City selected (or "Whole City")
266
- display_city = city_dropdown
267
- if province == city_dropdown:
268
- # Case 1: Municipality
269
- display_country = "中国"
270
- else:
271
- # Case 2: Regular City
272
- display_country = f"中国 {province}"
273
- else:
274
- # Standard logic for International or English posters
275
- display_city = translate(selected_location, lang_code)
276
- display_country = translate(selected_country, lang_code)
277
-
278
- progress(0.2, desc="正在获取坐标...")
279
-
280
- try:
281
- # We search coordinates using the selection
282
- # CMP might need the "original" names if OSM behaves better with them
283
- # For China, "广州" is better than "Guangzhou" for geopy sometimes, but geopy is usually good.
284
- # Let's ensure we use the 'original' internal key if possible for best OSM matching
285
- # However, for cities, we don't have a strict key map like for countries.
286
- # We can try to translate to CN if it's a Chinese city.
287
- search_city = selected_location
288
- search_country = selected_country
289
- # Use city as parent if searching for a district, otherwise use province
290
- search_parent = (
291
- city_dropdown
292
- if (district_dropdown and district_dropdown != city_dropdown)
293
- else province
294
- )
295
-
296
- coords = cmp.get_coordinates(
297
- search_city, search_country, parent=search_parent
298
- )
299
- except Exception as e:
300
- return None, f"❌ 无法找到城市坐标: {str(e)}"
301
-
302
- progress(0.3, desc="正在生成海报...")
303
-
304
- # Generate output filename (using English/Slugified names)
305
- en_city = translate(selected_location, "en")
306
- temp_dir = tempfile.gettempdir()
307
- output_file = cmp.generate_output_filename(
308
- en_city, theme_name, output_format, directory=temp_dir
309
- )
310
-
311
- try:
312
- # Wrap the generator to yield status updates and final result
313
- for status in cmp.create_poster(
314
- display_city, # Pass translated names for display
315
- display_country,
316
- coords,
317
- actual_distance,
318
- output_file,
319
- output_format,
320
- width=width,
321
- height=height,
322
- no_crop=no_crop,
323
- show_text=show_text,
324
- show_motorway=show_motorway,
325
- show_primary=show_primary,
326
- show_secondary=show_secondary,
327
- show_water=show_water,
328
- show_parks=show_parks,
329
- ):
330
- # Translate common status messages if possible
331
- status_display = status
332
- if lang_code == "cn":
333
- if "Downloading street network" in status:
334
- status_display = "正在下载街道数据..."
335
- elif "Downloading features" in status:
336
- status_display = "正在下载水域和公园数据..."
337
- elif "Rendering map" in status:
338
- status_display = "正在渲染地图..."
339
- elif "Applying road styles" in status:
340
- status_display = "正在应用样式..."
341
- elif "Saving to" in status:
342
- status_display = "正在保存海报..."
343
- elif "Done" in status:
344
- status_display = "完成!"
345
-
346
- yield None, f"⏳ {status_display}", None
347
-
348
- progress(1.0, desc="完成!")
349
-
350
- yield output_file, f"✅ 海报生成成功!保存至: {output_file}", output_file
351
-
352
- except Exception as e:
353
- import traceback
354
-
355
- traceback.print_exc()
356
- yield None, f"❌ 生成失败: {str(e)}", None
357
-
358
-
359
- def update_provinces(country, lang="en"):
360
- """Update province dropdown based on country selection and language."""
361
- # country is the internal key
362
- lang_code = "en" if lang == "English" else "cn"
363
- provinces = get_provinces(country, lang_code)
364
- if provinces:
365
- return gr.update(choices=provinces, value=provinces[0][1], visible=True)
366
- return gr.update(choices=[], value=None, visible=False)
367
-
368
-
369
- def update_cities(country, province, lang="en"):
370
- """Update city dropdown based on province selection and language."""
371
- # country and province are internal keys
372
- lang_code = "en" if lang == "English" else "cn"
373
- cities = get_cities(country, province, lang_code)
374
- if cities:
375
- # For China, if it's a municipality, get_cities returns [province_name]
376
- # We should automatically trigger update_districts then.
377
- return gr.update(choices=cities, value=cities[0][1])
378
- return gr.update(choices=[], value=None)
379
-
380
-
381
- def update_districts(country, province, city, lang="en"):
382
- """Update district dropdown based on city selection."""
383
- if country != "中国" or not city or city.endswith("_WHOLE"):
384
- return gr.update(choices=[], value=None, visible=False)
385
-
386
- lang_code = "en" if lang == "English" else "cn"
387
- districts = get_districts(country, province, city, lang_code)
388
- if districts:
389
- return gr.update(choices=districts, value=districts[0][1], visible=True)
390
- return gr.update(choices=[], value=None, visible=False)
391
-
392
-
393
- def on_theme_change(theme_name, lang="en"):
394
- """Update theme preview when theme changes."""
395
- return get_theme_preview_html(theme_name, lang)
396
-
397
-
398
- # --- Build Gradio Interface ---
399
- def create_interface():
400
- """Create and return the Gradio interface."""
401
-
402
- # Get initial data (Default English)
403
- # Get initial data (Default English)
404
- default_lang_code = "cn"
405
- default_lang_radio = "中文"
406
- countries = get_countries(default_lang_code)
407
- theme_choices = get_theme_choices(default_lang_code)
408
-
409
- default_country_key = "中国"
410
- default_provinces = get_provinces(default_country_key, default_lang_code)
411
- default_province_key = default_provinces[0][1] if default_provinces else None
412
- default_cities = (
413
- get_cities(default_country_key, default_province_key, default_lang_code)
414
- if default_province_key
415
- else []
416
- )
417
- default_city_key = default_cities[0][1] if default_cities else None
418
-
419
- # Handle district initialization carefully to avoid "Value not in choices" error
420
- default_districts = (
421
- get_districts(
422
- default_country_key,
423
- default_province_key,
424
- default_city_key,
425
- default_lang_code,
426
- )
427
- if default_city_key
428
- else []
429
- )
430
- default_district_key = default_districts[0][1] if default_districts else None
431
-
432
- default_theme = theme_choices[0][1] if theme_choices else "feature_based"
433
- default_theme = theme_choices[0][1] if theme_choices else "feature_based"
434
-
435
- with gr.Blocks(
436
- title="城市地图海报生成器",
437
- theme=gr.themes.Default(),
438
- css="""
439
- .header-title {
440
- text-align: center;
441
- font-size: 2em;
442
- font-weight: bold;
443
- margin-bottom: 0.5em;
444
- background: linear-gradient(135deg, #FF8C00 0%, #FFA500 100%);
445
- -webkit-background-clip: text;
446
- -webkit-text-fill-color: transparent;
447
- background-clip: text;
448
- }
449
- .header-subtitle {
450
- text-align: center;
451
- color: #666;
452
- margin-bottom: 1.5em;
453
- }
454
- .section-title {
455
- font-weight: 600;
456
- font-size: 1.1em;
457
- margin-bottom: 0.5em;
458
- color: #333;
459
- }
460
- .output-image {
461
- border-radius: 12px;
462
- box-shadow: 0 4px 12px rgba(0,0,0,0.1);
463
- }
464
- """,
465
- ) as demo:
466
- # Header
467
- gr.HTML("""
468
- <div class="header-title">城市地图海报生成器</div>
469
- <div class="header-subtitle">选择任意城市,自定义主题风格,生成精美地图海报</div>
470
-
471
- <div style="max-width: 800px; margin: 0 auto 20px auto; padding: 12px; background: #fff5f5; border: 1px solid #feb2b2; border-radius: 8px; text-align: left; font-size: 13px; line-height: 1.6; color: #c53030;">
472
- <b>⚠️ 注意!</b><br>
473
- • <b>特大城市</b>(如北京): 当城市面积过大时,中心定位可能不准。<br>
474
- • <b>省级行政区生成超级慢!</b>: 正在优化中。<br>
475
- • <b>地点中英文不完善</b> : 由于地点中英文翻译数据量过大,未能显示完善。<br>
476
- • <b>小城市</b> : 由于 OpenStreetMap 数据缺失,部分图层(如公园/水域)可能无法显示。<br>
477
- • <b>生成速度</b> : 国外地点使用国外服务器数据且渲染逻辑较基础,下载和生成速度可能较慢。<br>
478
- • <b>数据来源</b> : © OpenStreetMap contributors
479
- </div>
480
- """)
481
-
482
- with gr.Row():
483
- # Left Column - Controls
484
- with gr.Column(scale=1):
485
- # City Selection Section
486
- gr.HTML('<div class="section-title">📍 城市选择</div>')
487
-
488
- lang_radio = gr.Radio(
489
- choices=["中文", "English"],
490
- value="中文",
491
- label="海报语言",
492
- info="选择海报及界面的显示语言",
493
- )
494
-
495
- location_mode = gr.Radio(
496
- choices=["城市选择", "自定义坐标"],
497
- value="城市选择",
498
- label="定位方式",
499
- info="选择通过列表选择城市或输入自定义经纬度",
500
- )
501
-
502
- with gr.Group(visible=True) as city_selection_group:
503
- country_dropdown = gr.Dropdown(
504
- choices=countries,
505
- value=default_country_key,
506
- label="选择国家",
507
- interactive=True,
508
- )
509
-
510
- province_dropdown = gr.Dropdown(
511
- choices=default_provinces,
512
- value=default_province_key,
513
- label="选择省份/州",
514
- interactive=True,
515
- )
516
-
517
- city_dropdown = gr.Dropdown(
518
- choices=default_cities,
519
- value=default_city_key,
520
- label="选择城市",
521
- interactive=True,
522
- )
523
-
524
- district_dropdown = gr.Dropdown(
525
- choices=default_districts,
526
- value=default_district_key,
527
- label="选择区县",
528
- interactive=True,
529
- visible=(default_country_key == "中国" and default_district_key is not None),
530
- )
531
-
532
- with gr.Group(visible=False) as custom_coords_group:
533
- custom_coords_info = gr.Markdown(
534
- "💡 **填写指南**:\n"
535
- "- **纬度 (Latitude)**: 南北向坐标,范围 -90 至 90 (中国约 18~53)。\n"
536
- "- **经度 (Longitude)**: 东西向坐标,范围 -180 至 180 (中国约 73~135)。\n\n"
537
- "您可以访问 [坐标拾取系统](https://map.jiqrxx.com/jingweidu/) 获取精确数值。"
538
- )
539
- with gr.Row():
540
- custom_lat = gr.Number(
541
- label="纬度 (Latitude)", value=None, precision=6
542
- )
543
- custom_lon = gr.Number(
544
- label="经度 (Longitude)", value=None, precision=6
545
- )
546
- custom_city_name = gr.Textbox(
547
- label="主标题 (Main Title)", placeholder="如: Shanghai 或 '我们的家'"
548
- )
549
- custom_country_name = gr.Textbox(
550
- label="副标题 (Subtitle)",
551
- placeholder="如: China 或 '2024.10.20'",
552
- value="",
553
- )
554
-
555
- gr.HTML("<hr style='margin: 20px 0; border-color: #eee;'>")
556
-
557
- # Theme Section
558
- gr.HTML('<div class="section-title">🎨 主题风格</div>')
559
-
560
- theme_dropdown = gr.Dropdown(
561
- choices=theme_choices,
562
- value=default_theme,
563
- label="选择主题",
564
- interactive=True,
565
- )
566
-
567
- theme_preview = gr.HTML(
568
- value=get_theme_preview_html(default_theme, default_lang_radio),
569
- label="主题预览",
570
- )
571
-
572
- gr.HTML("<hr style='margin: 20px 0; border-color: #eee;'>")
573
-
574
- # Parameters Section
575
- gr.HTML('<div class="section-title">⚙️ 参数设置</div>')
576
-
577
- distance_slider = gr.Slider(
578
- minimum=4000,
579
- maximum=30000,
580
- value=10000,
581
- step=1000,
582
- label="地图范围 (米)",
583
- info="4000-6000: 小城区 | 8000-12000: 中等城市 | 15000+: 大都市 (范围越大生成越慢)",
584
- )
585
-
586
- with gr.Row():
587
- width_input = gr.Number(
588
- value=12.0, label="宽度 (英寸)", minimum=6, maximum=24
589
- )
590
- height_input = gr.Number(
591
- value=16.0, label="高度 (英寸)", minimum=8, maximum=32
592
- )
593
-
594
- format_radio = gr.Radio(
595
- choices=["png", "svg", "pdf"],
596
- value="png",
597
- label="输出格式",
598
- info="PNG: 适合打印 | SVG: 矢量图 | PDF: 文档",
599
- )
600
-
601
- no_crop_checkbox = gr.Checkbox(
602
- value=False,
603
- label="保留边距 (不裁剪)",
604
- info="勾选后保留海报边缘背景",
605
- )
606
-
607
- show_text_checkbox = gr.Checkbox(
608
- value=True,
609
- label="显示文字",
610
- info="在海报上显示城市名和经纬度",
611
- )
612
-
613
- layers_checkbox = gr.CheckboxGroup(
614
- choices=LAYERS_EN,
615
- value=LAYERS_EN,
616
- label="图层显示",
617
- info="选择需要显示的地图元素",
618
- )
619
-
620
- # Generate Button
621
- generate_btn = gr.Button("🚀 生成海报", variant="primary", size="lg")
622
-
623
- # Right Column - Output
624
- with gr.Column(scale=1):
625
- gr.HTML('<div class="section-title">🖼️ 生成结果</div>')
626
-
627
- output_image = gr.Image(
628
- label="海报预览",
629
- type="filepath",
630
- elem_classes=["output-image"],
631
- height=600,
632
- interactive=False,
633
- )
634
-
635
- output_status = gr.Textbox(label="状态", interactive=False)
636
-
637
- download_btn = gr.DownloadButton(label="📥 下载海报", visible=False)
638
- poster_state = gr.State()
639
-
640
- # --- Event Handlers ---
641
-
642
- # Language change -> update all dropdowns
643
- def on_lang_change(
644
- lang,
645
- current_country,
646
- current_province,
647
- current_city,
648
- current_district,
649
- current_theme,
650
- current_layers,
651
- ):
652
- lang_code = "en" if lang == "English" else "cn"
653
- new_countries = get_countries(lang_code)
654
-
655
- # Use keys to maintain selection
656
- new_provinces = get_provinces(current_country, lang_code)
657
- new_cities = (
658
- get_cities(current_country, current_province, lang_code)
659
- if current_province
660
- else []
661
- )
662
- new_districts = (
663
- get_districts(
664
- current_country, current_province, current_city, lang_code
665
- )
666
- if current_city
667
- else []
668
- )
669
-
670
- # Ensure district value is valid for new choices
671
- valid_district = None
672
- if new_districts:
673
- if any(v == current_district for d, v in new_districts):
674
- valid_district = current_district
675
- else:
676
- valid_district = new_districts[0][1]
677
-
678
- # Themes
679
- new_theme_choices = get_theme_choices(lang_code)
680
- new_preview = get_theme_preview_html(current_theme, lang)
681
-
682
- # Layers
683
- map_en_to_key = dict(zip(LAYERS_EN, LAYER_KEYS))
684
- map_cn_to_key = dict(zip(LAYERS_CN, LAYER_KEYS))
685
- map_key_to_en = dict(zip(LAYER_KEYS, LAYERS_EN))
686
- map_key_to_cn = dict(zip(LAYER_KEYS, LAYERS_CN))
687
-
688
- current_keys = []
689
- for x in current_layers:
690
- if x in map_en_to_key:
691
- current_keys.append(map_en_to_key[x])
692
- elif x in map_cn_to_key:
693
- current_keys.append(map_cn_to_key[x])
694
-
695
- target_map = map_key_to_en if lang == "English" else map_key_to_cn
696
- new_layer_choices = LAYERS_EN if lang == "English" else LAYERS_CN
697
- new_layer_values = [target_map[k] for k in current_keys if k in target_map]
698
-
699
- return (
700
- gr.update(
701
- choices=new_countries,
702
- value=current_country,
703
- label="Select Country" if lang == "English" else "选择国家",
704
- ),
705
- gr.update(
706
- choices=new_provinces,
707
- value=current_province,
708
- label="Select Province/State"
709
- if lang == "English"
710
- else "选择省份/州",
711
- ),
712
- gr.update(
713
- choices=new_cities,
714
- value=current_city,
715
- label="Select City" if lang == "English" else "选择城市",
716
- ),
717
- gr.update(
718
- choices=new_districts,
719
- value=valid_district,
720
- visible=(current_country == "中国" and valid_district is not None),
721
- label="Select District" if lang == "English" else "选择区县",
722
- ),
723
- gr.update(
724
- choices=new_theme_choices,
725
- label="Select Theme" if lang == "English" else "选择主题",
726
- ),
727
- new_preview,
728
- gr.update(
729
- choices=new_layer_choices,
730
- value=new_layer_values,
731
- label="Layers" if lang == "English" else "图层显示",
732
- ),
733
- gr.update(
734
- label="Map Range (m)" if lang == "English" else "地图范围 (米)",
735
- info="4000-6000: Small | 8000-12000: Medium | 15000+: Large"
736
- if lang == "English"
737
- else "4000-6000: 小城区 | 8000-12000: 中等城市 | 15000+: 大都市 (范围越大生成越慢)",
738
- ),
739
- gr.update(label="Width (inch)" if lang == "English" else "宽度 (英寸)"),
740
- gr.update(
741
- label="Height (inch)" if lang == "English" else "高度 (英寸)"
742
- ),
743
- gr.update(
744
- label="Format" if lang == "English" else "输出格式",
745
- info="PNG: Print | SVG: Vector | PDF: Doc"
746
- if lang == "English"
747
- else "PNG: 适合打印 | SVG: 矢量图 | PDF: 文档",
748
- ),
749
- gr.update(
750
- label="No Crop (Keep Margins)"
751
- if lang == "English"
752
- else "保留边距 (不裁剪)",
753
- info="Keep background margins"
754
- if lang == "English"
755
- else "勾选后保留海报边缘背景",
756
- ),
757
- gr.update(
758
- label="Show Text" if lang == "English" else "显示文字",
759
- info="Show city name and coordinates on poster"
760
- if lang == "English"
761
- else "在海报上显示城市名和经纬度",
762
- ),
763
- gr.update(
764
- value="🚀 Generate Poster" if lang == "English" else "🚀 生成海报"
765
- ),
766
- gr.update(
767
- label="📥 Download Poster" if lang == "English" else "📥 下载海报"
768
- ),
769
- gr.update(
770
- label="Main Title" if lang == "English" else "主标题 (Main Title)",
771
- placeholder="e.g. Shanghai or 'Our Home'" if lang == "English" else "如: Shanghai 或 '我们的家'"
772
- ),
773
- gr.update(
774
- label="Subtitle" if lang == "English" else "副标题 (Subtitle)",
775
- placeholder="e.g. China or '2024.10.20'" if lang == "English" else "如: China 或 '2024.10.20'"
776
- ),
777
- gr.update(
778
- value="💡 **Guide**:\n"
779
- "- **Latitude**: North-South, range -90 to 90 (China: ~18~53).\n"
780
- "- **Longitude**: East-West, range -180 to 180 (China: ~73~135).\n\n"
781
- "Use [Coordinate Picker](https://map.jiqrxx.com/jingweidu/) to find exact values."
782
- if lang == "English" else
783
- "💡 **填写指南**:\n"
784
- "- **纬度 (Latitude)**: 南北向坐标,范围 -90 至 90 (中国约 18~53)。\n"
785
- "- **经度 (Longitude)**: 东西向坐标,范围 -180 至 180 (中国约 73~135)。\n\n"
786
- "您可以访问 [坐标拾取系统](https://map.jiqrxx.com/jingweidu/) 获取精确数值。"
787
- )
788
- )
789
-
790
- lang_radio.change(
791
- fn=on_lang_change,
792
- inputs=[
793
- lang_radio,
794
- country_dropdown,
795
- province_dropdown,
796
- city_dropdown,
797
- district_dropdown,
798
- theme_dropdown,
799
- layers_checkbox,
800
- ],
801
- outputs=[
802
- country_dropdown,
803
- province_dropdown,
804
- city_dropdown,
805
- district_dropdown,
806
- theme_dropdown,
807
- theme_preview,
808
- layers_checkbox,
809
- distance_slider,
810
- width_input,
811
- height_input,
812
- format_radio,
813
- no_crop_checkbox,
814
- show_text_checkbox,
815
- generate_btn,
816
- download_btn,
817
- custom_city_name,
818
- custom_country_name,
819
- custom_coords_info,
820
- ],
821
- )
822
-
823
- def toggle_location_mode(mode):
824
- is_custom = mode in ["自定义坐标", "Custom Coordinates"]
825
- return {
826
- city_selection_group: gr.update(visible=not is_custom),
827
- custom_coords_group: gr.update(visible=is_custom),
828
- }
829
-
830
- location_mode.change(
831
- fn=toggle_location_mode,
832
- inputs=[location_mode],
833
- outputs=[city_selection_group, custom_coords_group],
834
- )
835
-
836
- # Country change -> update provinces
837
- country_dropdown.change(
838
- fn=update_provinces,
839
- inputs=[country_dropdown, lang_radio],
840
- outputs=[province_dropdown],
841
- )
842
-
843
- # Province change -> update cities
844
- province_dropdown.change(
845
- fn=update_cities,
846
- inputs=[country_dropdown, province_dropdown, lang_radio],
847
- outputs=[city_dropdown],
848
- ).then( # Update districts after city changes
849
- fn=update_districts,
850
- inputs=[country_dropdown, province_dropdown, city_dropdown, lang_radio],
851
- outputs=[district_dropdown],
852
- )
853
-
854
- # City change -> update districts
855
- city_dropdown.change(
856
- fn=update_districts,
857
- inputs=[country_dropdown, province_dropdown, city_dropdown, lang_radio],
858
- outputs=[district_dropdown],
859
- )
860
-
861
- # Theme change -> update preview
862
- theme_dropdown.change(
863
- fn=on_theme_change,
864
- inputs=[theme_dropdown, lang_radio],
865
- outputs=[theme_preview],
866
- )
867
-
868
- # Generate button click
869
- def on_generate_complete(filepath, status):
870
- """Handle generate completion - show download button if successful."""
871
- if filepath and os.path.exists(filepath):
872
- return filepath, status, gr.update(visible=True, value=filepath)
873
- return filepath, status, gr.update(visible=False)
874
-
875
- generate_btn.click(
876
- fn=generate_poster,
877
- inputs=[
878
- location_mode,
879
- custom_lat,
880
- custom_lon,
881
- custom_city_name,
882
- custom_country_name,
883
- country_dropdown,
884
- province_dropdown,
885
- city_dropdown,
886
- district_dropdown,
887
- theme_dropdown,
888
- distance_slider,
889
- width_input,
890
- height_input,
891
- format_radio,
892
- no_crop_checkbox,
893
- show_text_checkbox,
894
- lang_radio,
895
- layers_checkbox,
896
- ],
897
- outputs=[output_image, output_status, poster_state],
898
- ).then(
899
- fn=on_generate_complete,
900
- inputs=[poster_state, output_status],
901
- outputs=[output_image, output_status, download_btn],
902
- )
903
-
904
- # Footer
905
- gr.HTML("""
906
- <div style="text-align: center; margin-top: 24px; padding: 20px; color: #666; font-size: 13px; border-top: 1px solid #eee;">
907
- <p>项目地址: <a href="https://github.com/IsaacHuo/maptoposter" target="_blank" style="color: #764ba2; text-decoration: none; font-weight: bold;">GitHub - IsaacHuo/maptoposter</a></p>
908
- <p>✨ 欢迎提 <b>Issue</b> 和 <b>PR</b> | 鸣谢:该项目基于 <a href="https://github.com/originalankur/maptoposter" target="_blank" style="color: #666;">originalankur/maptoposter</a> 开发</p>
909
- </div>
910
- """)
911
-
912
- return demo
913
-
914
-
915
- # --- Main Entry ---
916
  if __name__ == "__main__":
917
- demo = create_interface()
918
- demo.launch(server_name="0.0.0.0", server_port=7860, ssr_mode=False)
 
1
+ """Production MapToPoster web entry point."""
 
 
 
2
 
3
+ from backend.main import run
 
 
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  if __name__ == "__main__":
6
+ run()
 
backend/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ """MapToPoster FastAPI application package."""
backend/main.py ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """FastAPI product backend for MapToPoster."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import os
6
+ from dataclasses import asdict
7
+ from pathlib import Path
8
+
9
+ from fastapi import FastAPI, HTTPException, Query
10
+ from fastapi.middleware.cors import CORSMiddleware
11
+ from fastapi.responses import Response
12
+ from fastapi.staticfiles import StaticFiles
13
+
14
+ from maptoposter import __version__
15
+ from maptoposter.export import generate_output_filename
16
+ from maptoposter.geocoding import GeocodingError
17
+ from maptoposter.layouts import LAYOUTS
18
+ from maptoposter.map_data import MapDataError
19
+ from maptoposter.models import SIZE_PRESETS, ExportConfig, OutputFormat
20
+ from maptoposter.service import PosterService
21
+ from maptoposter.themes import list_themes, load_style
22
+
23
+ from .schemas import ExportRequest, LocationSchema, PosterRequest, PreviewRequest
24
+
25
+ app = FastAPI(title="MapToPoster API", version=__version__)
26
+ app.add_middleware(
27
+ CORSMiddleware,
28
+ allow_origins=os.getenv("MAPTOPOSTER_CORS_ORIGINS", "http://localhost:5173").split(","),
29
+ allow_credentials=False,
30
+ allow_methods=["GET", "POST"],
31
+ allow_headers=["*"],
32
+ )
33
+ service = PosterService()
34
+
35
+
36
+ @app.get("/api/v1/health")
37
+ def health() -> dict[str, str]:
38
+ return {"status": "ok", "version": __version__}
39
+
40
+
41
+ @app.get("/api/v1/styles")
42
+ def styles() -> list[dict[str, object]]:
43
+ return [asdict(load_style(name)) for name in list_themes()]
44
+
45
+
46
+ @app.get("/api/v1/layouts")
47
+ def layouts() -> list[dict[str, str]]:
48
+ return [{"id": preset.value, "name": preset.value.replace("_", " ").title()} for preset in LAYOUTS]
49
+
50
+
51
+ @app.get("/api/v1/sizes")
52
+ def sizes() -> list[dict[str, object]]:
53
+ return [
54
+ {"id": preset.value, "width_in": dimensions[0], "height_in": dimensions[1]}
55
+ for preset, dimensions in SIZE_PRESETS.items()
56
+ ]
57
+
58
+
59
+ @app.get("/api/v1/locations/search", response_model=list[LocationSchema])
60
+ def search_locations(q: str = Query(min_length=1, max_length=200), lang: str = "en"):
61
+ try:
62
+ return [LocationSchema.from_core(item) for item in service.search_places(q, lang)]
63
+ except (ValueError, GeocodingError) as exc:
64
+ raise HTTPException(status_code=502 if isinstance(exc, GeocodingError) else 400, detail=str(exc)) from exc
65
+
66
+
67
+ @app.post("/api/v1/map-data/prepare")
68
+ def prepare_map(request: PosterRequest) -> dict[str, object]:
69
+ try:
70
+ reference = service.prepare_map(request.to_core())
71
+ return {"map_data_id": reference.cache_key, "cache_hit": reference.cache_hit}
72
+ except (ValueError, MapDataError) as exc:
73
+ raise HTTPException(status_code=502 if isinstance(exc, MapDataError) else 400, detail=str(exc)) from exc
74
+
75
+
76
+ @app.post("/api/v1/posters/preview")
77
+ def preview(request: PreviewRequest) -> Response:
78
+ try:
79
+ content = service.render_preview(request.map_data_id, request.poster.to_core())
80
+ return Response(content, media_type="image/png", headers={"Cache-Control": "no-store"})
81
+ except (ValueError, MapDataError) as exc:
82
+ raise HTTPException(status_code=404 if isinstance(exc, MapDataError) else 400, detail=str(exc)) from exc
83
+
84
+
85
+ @app.post("/api/v1/posters/export")
86
+ def export(request: ExportRequest) -> Response:
87
+ try:
88
+ poster = request.poster.to_core()
89
+ output_format = OutputFormat(request.format)
90
+ content = service.export_poster(
91
+ request.map_data_id,
92
+ poster,
93
+ ExportConfig(output_format=output_format, dpi=request.dpi),
94
+ )
95
+ filename = Path(
96
+ generate_output_filename(
97
+ poster.typography.title or poster.location.display_name,
98
+ poster.style.id,
99
+ output_format,
100
+ directory=Path("."),
101
+ include_time=False,
102
+ )
103
+ ).name
104
+ return Response(
105
+ content,
106
+ media_type={"png": "image/png", "svg": "image/svg+xml", "pdf": "application/pdf"}[request.format],
107
+ headers={"Content-Disposition": f'attachment; filename="{filename}"'},
108
+ )
109
+ except (ValueError, MapDataError) as exc:
110
+ raise HTTPException(status_code=404 if isinstance(exc, MapDataError) else 400, detail=str(exc)) from exc
111
+
112
+
113
+ def run() -> None:
114
+ import uvicorn
115
+
116
+ uvicorn.run("backend.main:app", host="0.0.0.0", port=7860, reload=False)
117
+
118
+
119
+ _frontend_dist = Path(__file__).resolve().parents[1] / "frontend" / "dist"
120
+ if _frontend_dist.is_dir():
121
+ app.mount("/", StaticFiles(directory=_frontend_dist, html=True), name="frontend")
backend/schemas.py ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Public API schemas and conversion to the Python core."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from pydantic import BaseModel, Field
6
+
7
+ from maptoposter.models import (
8
+ BBox,
9
+ Coordinate,
10
+ LayerConfig,
11
+ LayoutConfig,
12
+ LayoutPreset,
13
+ Location,
14
+ MapConfig,
15
+ MapViewport,
16
+ PosterConfig,
17
+ PosterSize,
18
+ SizePreset,
19
+ TypographyConfig,
20
+ )
21
+ from maptoposter.themes import load_style
22
+
23
+
24
+ class LocationSchema(BaseModel):
25
+ display_name: str
26
+ latitude: float
27
+ longitude: float
28
+ country: str = ""
29
+ region: str = ""
30
+ country_code: str = ""
31
+ provider: str = "manual"
32
+
33
+ @classmethod
34
+ def from_core(cls, location: Location) -> LocationSchema:
35
+ return cls(
36
+ display_name=location.display_name,
37
+ latitude=location.coordinate.latitude,
38
+ longitude=location.coordinate.longitude,
39
+ country=location.country,
40
+ region=location.region,
41
+ country_code=location.country_code,
42
+ provider=location.provider,
43
+ )
44
+
45
+ def to_core(self) -> Location:
46
+ return Location(
47
+ self.display_name,
48
+ Coordinate(self.latitude, self.longitude),
49
+ self.country,
50
+ self.region,
51
+ self.country_code,
52
+ self.provider,
53
+ )
54
+
55
+
56
+ class BBoxSchema(BaseModel):
57
+ west: float
58
+ south: float
59
+ east: float
60
+ north: float
61
+
62
+
63
+ class TypographySchema(BaseModel):
64
+ title: str = ""
65
+ subtitle: str = ""
66
+ caption: str = ""
67
+ coordinates: str = ""
68
+ font_family: str = "auto"
69
+ title_size: float = 54
70
+ subtitle_size: float = 22
71
+ caption_size: float = 14
72
+ coordinate_size: float = 12
73
+ letter_spacing: float = 0.08
74
+ line_height: float = 1.15
75
+ alignment: str = "center"
76
+ show_coordinates: bool = True
77
+ show_divider: bool = True
78
+
79
+
80
+ class LayerSchema(BaseModel):
81
+ motorway: bool = True
82
+ primary: bool = True
83
+ secondary: bool = True
84
+ residential: bool = True
85
+ water: bool = True
86
+ parks: bool = True
87
+
88
+
89
+ class SizeSchema(BaseModel):
90
+ preset: SizePreset = SizePreset.THREE_FOUR
91
+ width_in: float | None = None
92
+ height_in: float | None = None
93
+
94
+
95
+ class PosterRequest(BaseModel):
96
+ location: LocationSchema
97
+ bbox: BBoxSchema
98
+ distance_m: float = Field(default=10_000, ge=100, le=250_000)
99
+ zoom: float | None = None
100
+ network_type: str = "all"
101
+ style_id: str = "japanese_ink"
102
+ colors: dict[str, str] = Field(default_factory=dict)
103
+ typography: TypographySchema = Field(default_factory=TypographySchema)
104
+ layout: LayoutPreset = LayoutPreset.CLASSIC
105
+ layers: LayerSchema = Field(default_factory=LayerSchema)
106
+ size: SizeSchema = Field(default_factory=SizeSchema)
107
+
108
+ def to_core(self) -> PosterConfig:
109
+ location = self.location.to_core()
110
+ bbox = BBox(**self.bbox.model_dump())
111
+ style = load_style(self.style_id).with_colors(**self.colors)
112
+ return PosterConfig(
113
+ location=location,
114
+ map=MapConfig(
115
+ MapViewport(location.coordinate, bbox, self.zoom, self.distance_m),
116
+ network_type=self.network_type,
117
+ ),
118
+ style=style,
119
+ typography=TypographyConfig(**self.typography.model_dump()),
120
+ layout=LayoutConfig(self.layout),
121
+ layers=LayerConfig(**self.layers.model_dump()),
122
+ size=PosterSize(**self.size.model_dump()),
123
+ )
124
+
125
+
126
+ class PreviewRequest(BaseModel):
127
+ map_data_id: str = Field(pattern=r"^[0-9a-f]{64}$")
128
+ poster: PosterRequest
129
+
130
+
131
+ class ExportRequest(PreviewRequest):
132
+ format: str = Field(default="png", pattern=r"^(png|svg|pdf)$")
133
+ dpi: int = Field(default=300, ge=72, le=600)
cities_data.py CHANGED
@@ -1,16 +1,15 @@
1
  import json
2
- import os
 
 
3
 
4
- CHINA_DATA_DIR = os.path.join(
5
- os.path.dirname(os.path.abspath(__file__)), "public", "china-city-data"
6
- )
7
  _CHINA_INFO_CACHE = None
8
 
9
 
10
  def _load_china_info():
11
  global _CHINA_INFO_CACHE
12
  if _CHINA_INFO_CACHE is None:
13
- info_path = os.path.join(CHINA_DATA_DIR, "info.json")
14
  try:
15
  with open(info_path, "r", encoding="utf-8") as f:
16
  _CHINA_INFO_CACHE = json.load(f)
@@ -1019,6 +1018,7 @@ CITY_CENTERS = {
1019
  }
1020
 
1021
 
 
1022
  def get_manual_coordinates(name, parent_adcode=None):
1023
  """Return manual coordinates if available, else None."""
1024
  if not name:
@@ -1042,6 +1042,7 @@ def get_manual_coordinates(name, parent_adcode=None):
1042
  return None
1043
 
1044
 
 
1045
  def get_china_adcode(name, parent_adcode=None):
1046
  """Search for adcode by name in local China data."""
1047
  if not name:
@@ -1058,6 +1059,11 @@ def get_china_adcode(name, parent_adcode=None):
1058
  for p in china_entry.get("children", []):
1059
  if p["name"] == search_name or p["name"].rstrip("省").rstrip("市") == search_name:
1060
  return p["adcode"]
 
 
 
 
 
1061
  else:
1062
  parent_entry = info.get(str(parent_adcode))
1063
  if parent_entry:
@@ -1155,11 +1161,6 @@ def get_cities(country_name, province_name, lang="en"):
1155
  """Return list of (Display, Key) tuples for cities."""
1156
  country_key = get_country_key(country_name)
1157
  all_choices = []
1158
-
1159
- # Add "Whole Province" option for China
1160
- if country_key == "中国":
1161
- whole_province_display = "整个省" if lang == "cn" else "Whole Province"
1162
- all_choices.append((whole_province_display, province_name + "_WHOLE"))
1163
 
1164
  # Try local China GeoJSON data (info.json)
1165
  if country_key == "中国":
@@ -1173,8 +1174,10 @@ def get_cities(country_name, province_name, lang="en"):
1173
  p_entry.get("children")
1174
  and p_entry["children"][0].get("level") == "district"
1175
  ):
1176
- all_choices.append((translate(province_name, lang), province_name))
1177
- return all_choices
 
 
1178
 
1179
  for c in p_entry.get("children", []):
1180
  name = c["name"]
@@ -1198,7 +1201,9 @@ def get_cities(country_name, province_name, lang="en"):
1198
  break
1199
 
1200
  if province_key in CITIES[country_key]:
1201
- start_idx = len(all_choices)
 
 
1202
  for c_name in CITIES[country_key][province_key]:
1203
  display = translate(c_name, lang)
1204
  all_choices.append((display, c_name))
 
1
  import json
2
+ from functools import lru_cache
3
+
4
+ from maptoposter.paths import CHINA_DATA_DIR
5
 
 
 
 
6
  _CHINA_INFO_CACHE = None
7
 
8
 
9
  def _load_china_info():
10
  global _CHINA_INFO_CACHE
11
  if _CHINA_INFO_CACHE is None:
12
+ info_path = CHINA_DATA_DIR / "info.json"
13
  try:
14
  with open(info_path, "r", encoding="utf-8") as f:
15
  _CHINA_INFO_CACHE = json.load(f)
 
1018
  }
1019
 
1020
 
1021
+ @lru_cache(maxsize=4096)
1022
  def get_manual_coordinates(name, parent_adcode=None):
1023
  """Return manual coordinates if available, else None."""
1024
  if not name:
 
1042
  return None
1043
 
1044
 
1045
+ @lru_cache(maxsize=4096)
1046
  def get_china_adcode(name, parent_adcode=None):
1047
  """Search for adcode by name in local China data."""
1048
  if not name:
 
1059
  for p in china_entry.get("children", []):
1060
  if p["name"] == search_name or p["name"].rstrip("省").rstrip("市") == search_name:
1061
  return p["adcode"]
1062
+ # Fallback: find city-level entries when only the city name is known.
1063
+ for entry in info.values():
1064
+ for child in entry.get("children", []):
1065
+ if child["name"] == search_name:
1066
+ return child["adcode"]
1067
  else:
1068
  parent_entry = info.get(str(parent_adcode))
1069
  if parent_entry:
 
1161
  """Return list of (Display, Key) tuples for cities."""
1162
  country_key = get_country_key(country_name)
1163
  all_choices = []
 
 
 
 
 
1164
 
1165
  # Try local China GeoJSON data (info.json)
1166
  if country_key == "中国":
 
1174
  p_entry.get("children")
1175
  and p_entry["children"][0].get("level") == "district"
1176
  ):
1177
+ return [(translate(province_name, lang), province_name)]
1178
+
1179
+ whole_province_display = "整个省" if lang == "cn" else "Whole Province"
1180
+ all_choices.append((whole_province_display, province_name + "_WHOLE"))
1181
 
1182
  for c in p_entry.get("children", []):
1183
  name = c["name"]
 
1201
  break
1202
 
1203
  if province_key in CITIES[country_key]:
1204
+ if country_key == "中国" and not all_choices:
1205
+ whole_province_display = "整个省" if lang == "cn" else "Whole Province"
1206
+ all_choices.append((whole_province_display, province_name + "_WHOLE"))
1207
  for c_name in CITIES[country_key][province_key]:
1208
  display = translate(c_name, lang)
1209
  all_choices.append((display, c_name))
create_map_poster.py CHANGED
@@ -1,302 +1,41 @@
1
- import osmnx as ox
2
- import pandas as pd
3
- import matplotlib.pyplot as plt
4
- from matplotlib.font_manager import FontProperties
5
- import matplotlib.colors as mcolors
6
- import numpy as np
7
- from geopy.geocoders import Nominatim
8
- import time
9
- import json
10
- import os
11
- from datetime import datetime
12
- import argparse
13
-
14
- # Explicitly enable caching
15
- ox.settings.use_cache = True
16
-
17
- THEMES_DIR = "themes"
18
- FONTS_DIR = "fonts"
19
- POSTERS_DIR = "posters"
20
-
21
-
22
- def load_fonts():
23
- """
24
- Load fonts for both English (Goudy Old Style) and Chinese (HYWenRunSongYunU).
25
- """
26
- fonts = {
27
- "en_bold": os.path.join(FONTS_DIR, "GoudyOldStyle-Bold.ttf"),
28
- "en_regular": os.path.join(FONTS_DIR, "GoudyOldStyle-Regular.ttf"),
29
- "cn": os.path.join(FONTS_DIR, "HYWenRunSongYunU.ttf"),
30
- }
31
-
32
- # Verify fonts exist
33
- available_fonts = {}
34
- for key, path in fonts.items():
35
- if os.path.exists(path):
36
- available_fonts[key] = path
37
- else:
38
- print(f"⚠ Font not found: {path}")
39
-
40
- return available_fonts if available_fonts else None
41
 
 
 
42
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  FONTS = load_fonts()
44
 
45
 
46
- def generate_output_filename(city, theme_name, output_format, directory=POSTERS_DIR):
47
- """
48
- Generate unique output filename with city, theme, and datetime.
49
- """
50
- if not os.path.exists(directory):
51
- os.makedirs(directory)
52
-
53
- timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
54
- city_slug = city.lower().replace(" ", "_")
55
- ext = output_format.lower()
56
- filename = f"{city_slug}_{theme_name}_{timestamp}.{ext}"
57
- return os.path.join(directory, filename)
58
-
59
-
60
  def get_available_themes():
61
- """
62
- Scans the themes directory and returns a list of available theme names.
63
- """
64
- if not os.path.exists(THEMES_DIR):
65
- os.makedirs(THEMES_DIR)
66
- return []
67
-
68
- themes = []
69
- for file in sorted(os.listdir(THEMES_DIR)):
70
- if file.endswith(".json"):
71
- theme_name = file[:-5] # Remove .json extension
72
- themes.append(theme_name)
73
- return themes
74
-
75
-
76
- def load_theme(theme_name="feature_based"):
77
- """
78
- Load theme from JSON file in themes directory.
79
- """
80
- theme_file = os.path.join(THEMES_DIR, f"{theme_name}.json")
81
-
82
- if not os.path.exists(theme_file):
83
- print(
84
- f"⚠ Theme file '{theme_file}' not found. Using default feature_based theme."
85
- )
86
- # Fallback to embedded default theme
87
- return {
88
- "name": "Feature-Based Shading",
89
- "bg": "#FFFFFF",
90
- "text": "#000000",
91
- "gradient_color": "#FFFFFF",
92
- "water": "#C0C0C0",
93
- "parks": "#F0F0F0",
94
- "road_motorway": "#0A0A0A",
95
- "road_primary": "#1A1A1A",
96
- "road_secondary": "#2A2A2A",
97
- "road_tertiary": "#3A3A3A",
98
- "road_residential": "#4A4A4A",
99
- "road_default": "#3A3A3A",
100
- }
101
-
102
- with open(theme_file, "r") as f:
103
- theme = json.load(f)
104
- print(f"✓ Loaded theme: {theme.get('name', theme_name)}")
105
- if "description" in theme:
106
- print(f" {theme['description']}")
107
- return theme
108
-
109
-
110
- # Load theme (can be changed via command line or input)
111
- THEME = None # Will be loaded later
112
-
113
-
114
- def create_gradient_fade(ax, color, location="bottom", zorder=10):
115
- """
116
- Creates a fade effect at the top or bottom of the map.
117
- """
118
- vals = np.linspace(0, 1, 256).reshape(-1, 1)
119
- gradient = np.hstack((vals, vals))
120
-
121
- rgb = mcolors.to_rgb(color)
122
- my_colors = np.zeros((256, 4))
123
- my_colors[:, 0] = rgb[0]
124
- my_colors[:, 1] = rgb[1]
125
- my_colors[:, 2] = rgb[2]
126
-
127
- if location == "bottom":
128
- my_colors[:, 3] = np.linspace(1, 0, 256)
129
- extent_y_start = 0
130
- extent_y_end = 0.25
131
- else:
132
- my_colors[:, 3] = np.linspace(0, 1, 256)
133
- extent_y_start = 0.75
134
- extent_y_end = 1.0
135
-
136
- custom_cmap = mcolors.ListedColormap(my_colors)
137
-
138
- xlim = ax.get_xlim()
139
- ylim = ax.get_ylim()
140
- y_range = ylim[1] - ylim[0]
141
-
142
- y_bottom = ylim[0] + y_range * extent_y_start
143
- y_top = ylim[0] + y_range * extent_y_end
144
-
145
- ax.imshow(
146
- gradient,
147
- extent=[xlim[0], xlim[1], y_bottom, y_top],
148
- aspect="auto",
149
- cmap=custom_cmap,
150
- zorder=zorder,
151
- origin="lower",
152
- )
153
 
154
 
155
- def get_edge_colors_by_type(
156
- G, show_motorway=True, show_primary=True, show_secondary=True
157
- ):
158
- """
159
- Assigns colors to edges based on road type hierarchy.
160
- Returns a list of colors corresponding to each edge in the graph.
161
- If a layer is hidden, returns 'none' for that edge.
162
- """
163
- edge_colors = []
164
-
165
- for u, v, data in G.edges(data=True):
166
- # Get the highway type (can be a list or string)
167
- highway = data.get("highway", "unclassified")
168
-
169
- # Handle list of highway types (take the first one)
170
- if isinstance(highway, list):
171
- highway = highway[0] if highway else "unclassified"
172
-
173
- # Assign color based on road type
174
- if highway in ["motorway", "motorway_link"]:
175
- color = THEME["road_motorway"] if show_motorway else "none"
176
- elif highway in ["trunk", "trunk_link", "primary", "primary_link"]:
177
- color = THEME["road_primary"] if show_primary else "none"
178
- elif highway in ["secondary", "secondary_link"]:
179
- color = THEME["road_secondary"] if show_secondary else "none"
180
- elif highway in ["tertiary", "tertiary_link"]:
181
- color = (
182
- THEME["road_tertiary"] if show_secondary else "none"
183
- ) # Group tertiary with secondary
184
- elif highway in [
185
- "residential",
186
- "living_street",
187
- "unclassified",
188
- "service",
189
- "road",
190
- ]:
191
- color = THEME["road_residential"]
192
- elif highway in ["path", "footway", "track", "cycleway", "pedestrian"]:
193
- # Use residential color or a lighter version if defined, for now residential
194
- color = THEME["road_residential"]
195
- else:
196
- color = THEME["road_default"]
197
-
198
- edge_colors.append(color)
199
-
200
- return edge_colors
201
-
202
-
203
- def get_edge_widths_by_type(G):
204
- """
205
- Assigns line widths to edges based on road type.
206
- Major roads get thicker lines.
207
- """
208
- edge_widths = []
209
-
210
- for u, v, data in G.edges(data=True):
211
- highway = data.get("highway", "unclassified")
212
-
213
- if isinstance(highway, list):
214
- highway = highway[0] if highway else "unclassified"
215
-
216
- # Assign width based on road importance (increased for visibility)
217
- if highway in ["motorway", "motorway_link"]:
218
- width = 1.6
219
- elif highway in ["trunk", "trunk_link", "primary", "primary_link"]:
220
- width = 1.3
221
- elif highway in ["secondary", "secondary_link"]:
222
- width = 1.0
223
- elif highway in ["tertiary", "tertiary_link"]:
224
- width = 0.8
225
- elif highway in [
226
- "residential",
227
- "living_street",
228
- "unclassified",
229
- "service",
230
- "road",
231
- ]:
232
- width = 0.8
233
- elif highway in ["path", "footway", "track", "cycleway", "pedestrian"]:
234
- width = 0.5
235
- else:
236
- width = 0.6
237
-
238
- edge_widths.append(width)
239
-
240
- return edge_widths
241
-
242
-
243
- def has_chinese(text):
244
- """Check if a string contains any Chinese characters."""
245
- if not text:
246
- return False
247
- for char in text:
248
- if "\u4e00" <= char <= "\u9fff":
249
- return True
250
- return False
251
-
252
-
253
- def get_coordinates(city, country, parent=None):
254
- """
255
- Fetches coordinates for a given city and country.
256
- First checks for manual overrides in cities_data, then falls back to geopy.
257
- """
258
- from cities_data import get_manual_coordinates, get_china_adcode
259
-
260
- # For China, try local data first
261
- if country == "中国":
262
- parent_adcode = None
263
- if parent:
264
- parent_adcode = get_china_adcode(parent)
265
-
266
- # Fallback if parent is already a city/province name and get_china_adcode failed
267
- # (though it shouldn't for these inputs)
268
- if not parent_adcode:
269
- # Try looking up parent as a direct child of China
270
- parent_adcode = get_china_adcode(parent, 100000)
271
-
272
- # Try finding city in province
273
- manual_coords = get_manual_coordinates(city, parent_adcode)
274
- if manual_coords:
275
- print(f"✓ Using local coordinate data for {city}: {manual_coords}")
276
- return manual_coords
277
-
278
- # Fallback: if city has its own children (like districts), it might be a city level entry
279
- # but manual_coordinates requires a parent.
280
- # Actually, get_manual_coordinates handles hardcoded ones too.
281
- # Let's try looking it up as a province if parent_adcode is 100000
282
- manual_coords = get_manual_coordinates(city, 100000)
283
- if manual_coords:
284
- return manual_coords
285
-
286
- print(f"Looking up coordinates for {city}, {country} via Nominatim...")
287
- geolocator = Nominatim(user_agent="city_map_poster", timeout=10)
288
-
289
- # Add a small delay to respect Nominatim's usage policy
290
- time.sleep(1)
291
-
292
- location = geolocator.geocode(f"{city}, {country}")
293
-
294
- if location:
295
- print(f"✓ Found: {location.address}")
296
- print(f"✓ Coordinates: {location.latitude}, {location.longitude}")
297
- return (location.latitude, location.longitude)
298
- else:
299
- raise ValueError(f"Could not find coordinates for {city}, {country}")
300
 
301
 
302
  def create_poster(
@@ -315,356 +54,30 @@ def create_poster(
315
  show_secondary=True,
316
  show_water=True,
317
  show_parks=True,
 
 
318
  ):
319
- msg = f"Generating map for {city}, {country}..."
320
- print(f"\n{msg}")
321
- yield msg
322
-
323
- # Calculate non-square distances to match figure aspect ratio
324
- # dist is the vertical (North-South) half-distance
325
- dist_ns = dist
326
- dist_ew = dist * (width / height)
327
-
328
- # Progress bar for data fetching
329
- # Note: tqdm writes to stderr, we will just yield status updates for the UI
330
-
331
- # 1. Fetch Street Network
332
- # Detect if we are doing a "Whole Province" (large area)
333
- # If the bounding box is very large, we should limit the road types to avoid timeouts
334
- is_large_area = False
335
- if dist > 50000: # Over 50km half-width is likely a province or large region
336
- is_large_area = True
337
- print(f"Large area detected (dist={dist}m). Fetching major roads only.")
338
- yield "Large region detected. Fetching major roads only to avoid timeout..."
339
-
340
- import math
341
-
342
- lat, lon = point
343
- delta_lat = dist_ns / 111320.0
344
- delta_lon = dist_ew / (111320.0 * math.cos(math.radians(lat)))
345
-
346
- north, south = max(lat + delta_lat, lat - delta_lat), min(lat + delta_lat, lat - delta_lat)
347
- west, east = min(lon - delta_lon, lon + delta_lon), max(lon - delta_lon, lon + delta_lon)
348
-
349
- bbox = (west, south, east, north)
350
-
351
- if is_large_area:
352
- # Use custom filter for major roads only
353
- custom_filter = '["highway"~"motorway|trunk|primary|secondary"]'
354
- yield "Downloading major road network..."
355
- G = ox.graph_from_bbox(bbox, custom_filter=custom_filter, network_type="drive")
356
- else:
357
- yield "Downloading street network..."
358
- G = ox.graph_from_bbox(bbox, network_type="all")
359
-
360
- # 2. Fetch Water and Parks in one request
361
- yield "Downloading features (water, parks)..."
362
- tags = {
363
- "natural": ["water", "wood", "scrub"],
364
- "waterway": ["riverbank", "dock"],
365
- "leisure": ["park", "garden", "nature_reserve"],
366
- "landuse": [
367
- "forest",
368
- "grass",
369
- "cemetery",
370
- "recreation_ground",
371
- "village_green",
372
- ],
373
- }
374
-
375
- water_polys = None
376
- water_lines = None
377
- parks = None
378
-
379
- try:
380
- features = ox.features_from_bbox(bbox, tags=tags)
381
-
382
- # Separate features and simplify geometries for faster rendering
383
- if features is not None and not features.empty:
384
- # Safe mask creation for Water
385
- water_mask = pd.Series(False, index=features.index)
386
- if "natural" in features.columns:
387
- water_mask |= features["natural"].isin(["water"])
388
- if "waterway" in features.columns:
389
- water_mask |= features["waterway"].notna()
390
-
391
- water = features[water_mask]
392
-
393
- if not water.empty:
394
- # Water Polygons (Lakes, Wide Rivers)
395
- water_polys = water[
396
- water.geometry.type.isin(["Polygon", "MultiPolygon"])
397
- ]
398
- if not water_polys.empty:
399
- # Fix invalid geometries if any, then simplify
400
- water_polys.geometry = water_polys.geometry.apply(lambda g: g.buffer(0) if not g.is_valid else g)
401
- water_polys.geometry = water_polys.geometry.simplify(
402
- tolerance=0.00001, preserve_topology=True
403
- )
404
- # Filter out any that became empty after simplification
405
- water_polys = water_polys[~water_polys.geometry.is_empty]
406
-
407
- # Water Lines (Rivers, Streams represented as lines)
408
- water_lines = water[
409
- water.geometry.type.isin(["LineString", "MultiLineString"])
410
- ]
411
- else:
412
- water_polys, water_lines = None, None # No water features found
413
-
414
- # Green space/Parks features
415
- park_mask = pd.Series(False, index=features.index)
416
- if "leisure" in features.columns:
417
- park_mask |= features["leisure"].notna()
418
- if "landuse" in features.columns:
419
- park_mask |= features["landuse"].isin(
420
- [
421
- "forest",
422
- "grass",
423
- "cemetery",
424
- "recreation_ground",
425
- "village_green",
426
- ]
427
- )
428
- if "natural" in features.columns:
429
- park_mask |= features["natural"].isin(["wood", "scrub"])
430
-
431
- parks = features[park_mask]
432
- if not parks.empty:
433
- parks = parks[parks.geometry.type.isin(["Polygon", "MultiPolygon"])]
434
- # Fix invalid geometries, then simplify
435
- if not parks.empty:
436
- parks.geometry = parks.geometry.apply(lambda g: g.buffer(0) if not g.is_valid else g)
437
- parks.geometry = parks.geometry.simplify(
438
- tolerance=0.00001, preserve_topology=True
439
- )
440
- # Filter empty
441
- parks = parks[~parks.geometry.is_empty]
442
- else:
443
- parks = None
444
- else:
445
- parks = None # No park features found
446
- else:
447
- water_polys, water_lines, parks = None, None, None
448
- except Exception as e:
449
- print(f"Warning: Could not fetch features: {e}")
450
- water_polys, water_lines, parks = None, None, None
451
-
452
- print("✓ All data downloaded successfully!")
453
- yield "Data downloaded. Rendering map..."
454
-
455
- # 2. Setup Plot
456
- print("Rendering map...")
457
- fig, ax = plt.subplots(figsize=(width, height), facecolor=THEME["bg"])
458
- ax.set_facecolor(THEME["bg"])
459
- ax.set_position([0, 0, 1, 1])
460
-
461
- # 3. Plot Layers
462
- # Layer 1: Polygons (filter to only plot polygon/multipolygon geometries, not points)
463
- # Layer 1: Water (Polygons and Lines)
464
- if show_water:
465
- if water_polys is not None and not water_polys.empty:
466
- water_polys.plot(
467
- ax=ax, facecolor=THEME["water"], edgecolor="none", zorder=1
468
- )
469
-
470
- if water_lines is not None and not water_lines.empty:
471
- # Plot water lines (rivers) with some thickness
472
- water_lines.plot(ax=ax, color=THEME["water"], linewidth=2.0, zorder=1)
473
-
474
- if show_parks and parks is not None and not parks.empty:
475
- # Filter to only polygon/multipolygon geometries to avoid point features showing as dots
476
- parks_polys = parks[parks.geometry.type.isin(["Polygon", "MultiPolygon"])]
477
- if not parks_polys.empty:
478
- parks_polys.plot(
479
- ax=ax, facecolor=THEME["parks"], edgecolor="none", zorder=2
480
- )
481
-
482
- # Layer 2: Roads with hierarchy coloring
483
- print("Applying road hierarchy colors...")
484
- yield "Applying road styles..."
485
- edge_colors = get_edge_colors_by_type(
486
- G,
487
  show_motorway=show_motorway,
488
  show_primary=show_primary,
489
  show_secondary=show_secondary,
 
 
490
  )
491
- edge_widths = get_edge_widths_by_type(G)
492
-
493
- ox.plot_graph(
494
- G,
495
- ax=ax,
496
- bgcolor=THEME["bg"],
497
- node_size=0,
498
- edge_color=edge_colors,
499
- edge_linewidth=edge_widths,
500
- show=False,
501
- close=False,
502
- )
503
-
504
- # Enforce equal aspect ratio to prevent compression/distortion
505
- ax.set_aspect("equal")
506
- # Set explicit limits based on calculated bbox to match figure aspect ratio
507
- ax.set_xlim(west, east)
508
- ax.set_ylim(south, north)
509
-
510
- # Layer 3: Gradients (Top and Bottom)
511
- create_gradient_fade(ax, THEME["gradient_color"], location="bottom", zorder=10)
512
- create_gradient_fade(ax, THEME["gradient_color"], location="top", zorder=10)
513
-
514
- # 4. Typography
515
- is_chinese = has_chinese(city)
516
-
517
- if FONTS:
518
- if is_chinese:
519
- # Chinese styling
520
- font_path = FONTS.get("cn") or FONTS.get("en_bold")
521
- font_main_base = FontProperties(fname=font_path)
522
- font_sub_base = FontProperties(fname=font_path)
523
- font_coords = FontProperties(fname=font_path, size=14)
524
-
525
- display_city = city
526
- display_country = country
527
- else:
528
- # English styling (Original)
529
- font_path_bold = FONTS.get("en_bold")
530
- font_path_reg = FONTS.get("en_regular")
531
- font_main_base = FontProperties(fname=font_path_bold)
532
- font_sub_base = FontProperties(fname=font_path_reg)
533
- font_coords = FontProperties(fname=font_path_reg, size=14)
534
-
535
- # Spaced and uppercase for English
536
- display_city = " ".join(list(city.upper()))
537
- display_country = country.upper()
538
- else:
539
- # Fallback to system fonts
540
- font_main_base = FontProperties(family="serif", weight="bold")
541
- font_sub_base = FontProperties(family="serif")
542
- font_coords = FontProperties(family="monospace", size=14)
543
-
544
- if is_chinese:
545
- display_city = city
546
- display_country = country
547
- else:
548
- display_city = " ".join(list(city.upper()))
549
- display_country = country.upper()
550
-
551
- # Dynamically adjust font size
552
- base_font_size = 60 if not is_chinese else 54
553
- city_char_count = len(city)
554
- if not is_chinese and city_char_count > 10:
555
- scale_factor = 10 / city_char_count
556
- adjusted_font_size = max(base_font_size * scale_factor, 24)
557
- elif is_chinese and city_char_count > 6:
558
- scale_factor = 6 / city_char_count
559
- adjusted_font_size = max(base_font_size * scale_factor, 32)
560
- else:
561
- adjusted_font_size = base_font_size
562
-
563
- font_main = font_main_base.copy()
564
- font_main.set_size(adjusted_font_size)
565
-
566
- font_sub = font_sub_base.copy()
567
- font_sub.set_size(22)
568
-
569
- # --- BOTTOM TEXT ---
570
- if show_text:
571
- # Title
572
- if display_city:
573
- ax.text(
574
- 0.5,
575
- 0.14,
576
- display_city,
577
- transform=ax.transAxes,
578
- color=THEME["text"],
579
- ha="center",
580
- fontproperties=font_main,
581
- zorder=11,
582
- )
583
-
584
- # Subtitle
585
- if display_country:
586
- ax.text(
587
- 0.5,
588
- 0.10,
589
- display_country,
590
- transform=ax.transAxes,
591
- color=THEME["text"],
592
- ha="center",
593
- fontproperties=font_sub,
594
- zorder=11,
595
- )
596
-
597
- # Decorative separator line (only show if both exist)
598
- if display_city and display_country:
599
- ax.plot(
600
- [0.4, 0.6],
601
- [0.125, 0.125],
602
- transform=ax.transAxes,
603
- color=THEME["text"],
604
- linewidth=1,
605
- zorder=11,
606
- )
607
-
608
- # Coordinates (Third line, smaller)
609
- # Only show if there is at least a title or subtitle, or if specifically desired
610
- if display_city or display_country:
611
- lat, lon = point
612
- coords_text = (
613
- f"{lat:.4f}° N / {lon:.4f}° E"
614
- if lat >= 0
615
- else f"{abs(lat):.4f}° S / {lon:.4f}° E"
616
- )
617
- if lon < 0:
618
- coords_text = coords_text.replace("E", "W")
619
-
620
- ax.text(
621
- 0.5,
622
- 0.07,
623
- coords_text,
624
- transform=ax.transAxes,
625
- color=THEME["text"],
626
- alpha=0.7,
627
- ha="center",
628
- fontproperties=font_coords,
629
- zorder=11,
630
- )
631
-
632
- # --- ATTRIBUTION (bottom right) ---
633
- attr_font = font_sub_base.copy()
634
- attr_font.set_size(8)
635
-
636
- ax.text(
637
- 0.98,
638
- 0.02,
639
- "© OpenStreetMap contributors",
640
- transform=ax.transAxes,
641
- color=THEME["text"],
642
- alpha=0.5,
643
- ha="right",
644
- va="bottom",
645
- fontproperties=attr_font,
646
- zorder=11,
647
- )
648
-
649
- # 5. Save
650
- print(f"Saving to {output_file}...")
651
- yield f"Saving to {output_file}..."
652
-
653
- fmt = output_format.lower()
654
- save_kwargs = dict(facecolor=THEME["bg"], pad_inches=0.05)
655
-
656
- if not no_crop:
657
- save_kwargs["bbox_inches"] = "tight"
658
-
659
- # DPI matters mainly for raster formats
660
- if fmt == "png":
661
- save_kwargs["dpi"] = 300
662
-
663
- plt.savefig(output_file, format=fmt, **save_kwargs)
664
-
665
- plt.close()
666
- print(f"✓ Done! Poster saved as {output_file}")
667
- yield "Done!"
668
 
669
 
670
  def print_examples():
@@ -677,47 +90,23 @@ Usage:
677
  python create_map_poster.py --city <city> --country <country> [options]
678
 
679
  Examples:
680
- # Iconic grid patterns
681
- python create_map_poster.py -c "New York" -C "USA" -t noir -d 12000 # Manhattan grid
682
- python create_map_poster.py -c "Barcelona" -C "Spain" -t warm_beige -d 8000 # Eixample district grid
683
-
684
- # Waterfront & canals
685
- python create_map_poster.py -c "Venice" -C "Italy" -t blueprint -d 4000 # Canal network
686
- python create_map_poster.py -c "Amsterdam" -C "Netherlands" -t ocean -d 6000 # Concentric canals
687
- python create_map_poster.py -c "Dubai" -C "UAE" -t midnight_blue -d 15000 # Palm & coastline
688
-
689
- # Radial patterns
690
- python create_map_poster.py -c "Paris" -C "France" -t pastel_dream -d 10000 # Haussmann boulevards
691
- python create_map_poster.py -c "Moscow" -C "Russia" -t noir -d 12000 # Ring roads
692
-
693
- # Organic old cities
694
- python create_map_poster.py -c "Tokyo" -C "Japan" -t japanese_ink -d 15000 # Dense organic streets
695
- python create_map_poster.py -c "Marrakech" -C "Morocco" -t terracotta -d 5000 # Medina maze
696
- python create_map_poster.py -c "Rome" -C "Italy" -t warm_beige -d 8000 # Ancient street layout
697
-
698
- # Coastal cities
699
- python create_map_poster.py -c "San Francisco" -C "USA" -t sunset -d 10000 # Peninsula grid
700
- python create_map_poster.py -c "Sydney" -C "Australia" -t ocean -d 12000 # Harbor city
701
- python create_map_poster.py -c "Mumbai" -C "India" -t contrast_zones -d 18000 # Coastal peninsula
702
-
703
- # River cities
704
- python create_map_poster.py -c "London" -C "UK" -t noir -d 15000 # Thames curves
705
- python create_map_poster.py -c "Budapest" -C "Hungary" -t copper_patina -d 8000 # Danube split
706
-
707
- # List themes
708
  python create_map_poster.py --list-themes
709
 
710
  Options:
711
  --city, -c City name (required)
712
  --country, -C Country name (required)
713
  --theme, -t Theme name (default: feature_based)
714
- --distance, -d Map radius in meters (default: 29000)
715
  --list-themes List all available themes
716
 
717
  Distance guide:
718
- 4000-6000m Small/dense cities (Venice, Amsterdam old center)
719
- 8000-12000m Medium cities, focused downtown (Paris, Barcelona)
720
- 15000-20000m Large metros, full city view (Tokyo, Mumbai)
721
 
722
  Available themes can be found in the 'themes/' directory.
723
  Generated posters are saved to 'posters/' directory.
@@ -734,15 +123,9 @@ def list_themes():
734
  print("\nAvailable Themes:")
735
  print("-" * 60)
736
  for theme_name in available_themes:
737
- theme_path = os.path.join(THEMES_DIR, f"{theme_name}.json")
738
- try:
739
- with open(theme_path, "r") as f:
740
- theme_data = json.load(f)
741
- display_name = theme_data.get("name", theme_name)
742
- description = theme_data.get("description", "")
743
- except Exception:
744
- display_name = theme_name
745
- description = ""
746
  print(f" {theme_name}")
747
  print(f" {display_name}")
748
  if description:
@@ -750,7 +133,8 @@ def list_themes():
750
  print()
751
 
752
 
753
- if __name__ == "__main__":
 
754
  parser = argparse.ArgumentParser(
755
  description="Generate beautiful map posters for any city",
756
  formatter_class=argparse.RawDescriptionHelpFormatter,
@@ -798,9 +182,7 @@ Examples:
798
  action="store_true",
799
  help="Do not crop the image to the data extent (keeps background)",
800
  )
801
- parser.add_argument(
802
- "--list-themes", action="store_true", help="List all available themes"
803
- )
804
  parser.add_argument(
805
  "--format",
806
  "-f",
@@ -811,23 +193,19 @@ Examples:
811
 
812
  args = parser.parse_args()
813
 
814
- # If no arguments provided, show examples
815
  if len(os.sys.argv) == 1:
816
  print_examples()
817
  os.sys.exit(0)
818
 
819
- # List themes if requested
820
  if args.list_themes:
821
  list_themes()
822
  os.sys.exit(0)
823
 
824
- # Validate required arguments
825
  if not args.city or not args.country:
826
  print("Error: --city and --country are required.\n")
827
  print_examples()
828
  os.sys.exit(1)
829
 
830
- # Validate theme exists
831
  available_themes = get_available_themes()
832
  if args.theme not in available_themes:
833
  print(f"Error: Theme '{args.theme}' not found.")
@@ -838,16 +216,13 @@ Examples:
838
  print("City Map Poster Generator")
839
  print("=" * 50)
840
 
841
- # Load theme
842
- THEME = load_theme(args.theme)
843
 
844
- # Get coordinates and generate poster
845
  try:
846
  coords = get_coordinates(args.city, args.country)
847
  output_file = generate_output_filename(args.city, args.theme, args.format)
848
 
849
- # Iterate over the generator to execute it
850
- for status in create_poster(
851
  args.city,
852
  args.country,
853
  coords,
@@ -857,8 +232,9 @@ Examples:
857
  width=args.width,
858
  height=args.height,
859
  no_crop=args.no_crop,
 
 
860
  ):
861
- # We already print inside the function, but we act as a consumer here
862
  pass
863
 
864
  print("\n" + "=" * 50)
@@ -871,3 +247,7 @@ Examples:
871
 
872
  traceback.print_exc()
873
  os.sys.exit(1)
 
 
 
 
 
1
+ """CLI and backward-compatible façade for map poster generation."""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
+ import argparse
4
+ import os
5
 
6
+ from maptoposter.fonts import load_fonts
7
+ from maptoposter.rendering import (
8
+ create_poster as _create_poster,
9
+ )
10
+ from maptoposter.rendering import (
11
+ generate_output_filename,
12
+ get_coordinates,
13
+ )
14
+ from maptoposter.rendering import (
15
+ get_edge_colors_by_type as _get_edge_colors_by_type,
16
+ )
17
+ from maptoposter.themes import list_themes as _list_theme_names
18
+ from maptoposter.themes import load_theme
19
+
20
+ THEME = None
21
  FONTS = load_fonts()
22
 
23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  def get_available_themes():
25
+ """Scans the themes directory and returns a list of available theme names."""
26
+ return list(_list_theme_names())
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
 
29
+ def get_edge_colors_by_type(G, show_motorway=True, show_primary=True, show_secondary=True):
30
+ """Backward-compatible wrapper using the active global theme."""
31
+ active_theme = THEME if THEME is not None else load_theme()
32
+ return _get_edge_colors_by_type(
33
+ G,
34
+ active_theme,
35
+ show_motorway=show_motorway,
36
+ show_primary=show_primary,
37
+ show_secondary=show_secondary,
38
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
 
40
 
41
  def create_poster(
 
54
  show_secondary=True,
55
  show_water=True,
56
  show_parks=True,
57
+ theme=None,
58
+ theme_name="feature_based",
59
  ):
60
+ """Create a poster while preserving the historical function signature."""
61
+ active_theme = theme if theme is not None else THEME
62
+ yield from _create_poster(
63
+ city,
64
+ country,
65
+ point,
66
+ dist,
67
+ output_file,
68
+ output_format,
69
+ theme=active_theme,
70
+ theme_name=theme_name,
71
+ width=width,
72
+ height=height,
73
+ no_crop=no_crop,
74
+ show_text=show_text,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  show_motorway=show_motorway,
76
  show_primary=show_primary,
77
  show_secondary=show_secondary,
78
+ show_water=show_water,
79
+ show_parks=show_parks,
80
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
 
82
 
83
  def print_examples():
 
90
  python create_map_poster.py --city <city> --country <country> [options]
91
 
92
  Examples:
93
+ python create_map_poster.py -c "New York" -C "USA" -t noir -d 12000
94
+ python create_map_poster.py -c "Barcelona" -C "Spain" -t warm_beige -d 8000
95
+ python create_map_poster.py -c "Venice" -C "Italy" -t blueprint -d 4000
96
+ python create_map_poster.py -c "Tokyo" -C "Japan" -t japanese_ink -d 15000
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
  python create_map_poster.py --list-themes
98
 
99
  Options:
100
  --city, -c City name (required)
101
  --country, -C Country name (required)
102
  --theme, -t Theme name (default: feature_based)
103
+ --distance, -d Map radius in meters (default: 10000)
104
  --list-themes List all available themes
105
 
106
  Distance guide:
107
+ 4000-6000m Small/dense cities
108
+ 8000-12000m Medium cities, focused downtown
109
+ 15000-20000m Large metros, full city view
110
 
111
  Available themes can be found in the 'themes/' directory.
112
  Generated posters are saved to 'posters/' directory.
 
123
  print("\nAvailable Themes:")
124
  print("-" * 60)
125
  for theme_name in available_themes:
126
+ theme_data = load_theme(theme_name, verbose=False)
127
+ display_name = theme_data.get("name", theme_name)
128
+ description = theme_data.get("description", "")
 
 
 
 
 
 
129
  print(f" {theme_name}")
130
  print(f" {display_name}")
131
  if description:
 
133
  print()
134
 
135
 
136
+ def main():
137
+ """Run the command-line poster generator."""
138
  parser = argparse.ArgumentParser(
139
  description="Generate beautiful map posters for any city",
140
  formatter_class=argparse.RawDescriptionHelpFormatter,
 
182
  action="store_true",
183
  help="Do not crop the image to the data extent (keeps background)",
184
  )
185
+ parser.add_argument("--list-themes", action="store_true", help="List all available themes")
 
 
186
  parser.add_argument(
187
  "--format",
188
  "-f",
 
193
 
194
  args = parser.parse_args()
195
 
 
196
  if len(os.sys.argv) == 1:
197
  print_examples()
198
  os.sys.exit(0)
199
 
 
200
  if args.list_themes:
201
  list_themes()
202
  os.sys.exit(0)
203
 
 
204
  if not args.city or not args.country:
205
  print("Error: --city and --country are required.\n")
206
  print_examples()
207
  os.sys.exit(1)
208
 
 
209
  available_themes = get_available_themes()
210
  if args.theme not in available_themes:
211
  print(f"Error: Theme '{args.theme}' not found.")
 
216
  print("City Map Poster Generator")
217
  print("=" * 50)
218
 
219
+ theme = load_theme(args.theme)
 
220
 
 
221
  try:
222
  coords = get_coordinates(args.city, args.country)
223
  output_file = generate_output_filename(args.city, args.theme, args.format)
224
 
225
+ for _ in create_poster(
 
226
  args.city,
227
  args.country,
228
  coords,
 
232
  width=args.width,
233
  height=args.height,
234
  no_crop=args.no_crop,
235
+ theme=theme,
236
+ theme_name=args.theme,
237
  ):
 
238
  pass
239
 
240
  print("\n" + "=" * 50)
 
247
 
248
  traceback.print_exc()
249
  os.sys.exit(1)
250
+
251
+
252
+ if __name__ == "__main__":
253
+ main()
docs/huggingface_deployment.md ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Hugging Face 部署与维护 / Deployment and operations
2
+
3
+ ## 中文
4
+
5
+ ### 部署结构
6
+
7
+ - GitHub 仓库 `IsaacHuo/maptoposter` 的 `main` 是唯一源码来源。
8
+ - `.github/workflows/publish-hugging-face.yml` 先运行 Python、前端和 Docker 检查。
9
+ - 所有检查通过后,官方 `huggingface/hub-sync` Action 将文件镜像到 `isaachwf/MapToPoster`。
10
+ - Hugging Face 根据 README 元数据以 Docker SDK 构建,并暴露容器的 7860 端口。
11
+
12
+ `hub-sync` 是文件镜像而不是 Git 强推。它会同步删除 GitHub 已移除的文件,同时排除 `.git/` 和 `.github/`,因此两个仓库不需要共享 Git 历史。
13
+
14
+ ### 首次配置凭据
15
+
16
+ 1. 打开 <https://huggingface.co/settings/tokens>。
17
+ 2. 创建一个单独的 fine-grained Token,只授予 `isaachwf/MapToPoster` 写权限。
18
+ 3. 打开 GitHub 仓库的 **Settings → Secrets and variables → Actions**。
19
+ 4. 新建 Repository Secret,名称必须是 `HF_TOKEN`,值为刚创建的 Token。
20
+ 5. 不要把 Token 写入代码、`.env`、提交记录、Issue 或聊天消息。
21
+
22
+ Token 只用于 GitHub Actions 发布。删除或轮换 Token 后,应立即更新同名 GitHub Secret。
23
+
24
+ ### 发布
25
+
26
+ 正常发布只需要将已验证的提交推送到 GitHub `main`:
27
+
28
+ ```bash
29
+ git push origin main
30
+ ```
31
+
32
+ 工作流的 `validate` job 失败时,`publish` job 不会运行,线上 Space 保持原版本。工作流也支持在 GitHub Actions 页面手动运行。
33
+
34
+ ### 环境和存储
35
+
36
+ 容器默认使用:
37
+
38
+ ```text
39
+ MAPTOPOSTER_CACHE_DIR=/data/cache
40
+ MAPTOPOSTER_OUTPUT_DIR=/data/posters
41
+ MPLCONFIGDIR=/tmp/matplotlib
42
+ ```
43
+
44
+ CPU Basic 的磁盘是临时磁盘。Factory reboot、重新部署或平台重启可能清除 `/data`。当前应用只把可重新生成的 OSM/地理编码缓存放在那里,因此无需数据迁移。
45
+
46
+ ### 验证
47
+
48
+ 发布完成后检查:
49
+
50
+ 1. Space 设置仍显示 `cpu-basic`,运行阶段为 `RUNNING`,SDK 为 Docker。
51
+ 2. `GET https://isaachwf-maptoposter.hf.space/api/v1/health` 返回 `status: ok`。
52
+ 3. 首页加载 React 编辑器,样式缩略图和交互地图正常。
53
+ 4. 搜索“北京”,用小范围视口完成地图准备和预览。
54
+ 5. 分别下载 PNG、SVG 和 PDF,确认文件非空且 Content-Type 正确。
55
+
56
+ ### 回滚
57
+
58
+ GitHub `main` 是源码真相,不直接修改 Space 仓库进行长期修复。
59
+
60
+ 1. 使用 `git revert <bad-commit>` 创建回滚提交,不重写 `main` 历史。
61
+ 2. 在本地运行完整检查。
62
+ 3. 将回滚提交推送到 `main`,等待自动镜像完成。
63
+
64
+ 如果 Space 构建失败,旧容器通常仍会保留或显示构建错误。不要删除或重新创建 Space;先从构建日志修复 Docker 问题,再推送修复提交。
65
+
66
+ ## English
67
+
68
+ ### Deployment model
69
+
70
+ GitHub `IsaacHuo/maptoposter` `main` is the single source of truth. The publish workflow validates Python, the frontend, and the Linux container before the official `huggingface/hub-sync` Action mirrors repository files to `isaachwf/MapToPoster`. Hugging Face then builds the Docker Space and exposes port 7860.
71
+
72
+ The sync action mirrors files rather than force-pushing Git history. It propagates deletions and excludes `.git/` and `.github/`, so the GitHub repository and Space can retain independent histories.
73
+
74
+ ### One-time credentials
75
+
76
+ Create a fine-grained token at <https://huggingface.co/settings/tokens> with write access limited to `isaachwf/MapToPoster`. Save it as a GitHub Actions repository secret named `HF_TOKEN`. Never store the token in source files, environment files, commits, issues, or chat messages.
77
+
78
+ ### Release and rollback
79
+
80
+ A push to GitHub `main` starts validation and publishes only after every check succeeds. To roll back, revert the faulty GitHub commit and push the revert to `main`; do not rewrite `main` or maintain a manual fork of the Space source.
81
+
82
+ Free CPU Basic storage is ephemeral. `/data/cache` and `/data/posters` contain only reproducible runtime files and may be cleared during rebuilds or restarts.
frontend/.gitignore ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Logs
2
+ logs
3
+ *.log
4
+ npm-debug.log*
5
+ yarn-debug.log*
6
+ yarn-error.log*
7
+ pnpm-debug.log*
8
+ lerna-debug.log*
9
+
10
+ node_modules
11
+ dist
12
+ dist-ssr
13
+ *.local
14
+
15
+ # Editor directories and files
16
+ .vscode/*
17
+ !.vscode/extensions.json
18
+ .idea
19
+ .DS_Store
20
+ *.suo
21
+ *.ntvs*
22
+ *.njsproj
23
+ *.sln
24
+ *.sw?
frontend/.oxlintrc.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "$schema": "./node_modules/oxlint/configuration_schema.json",
3
+ "plugins": ["react", "typescript", "oxc"],
4
+ "rules": {
5
+ "react/rules-of-hooks": "error",
6
+ "react/only-export-components": ["warn", { "allowConstantExport": true }]
7
+ }
8
+ }
frontend/e2e/editor.spec.ts ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { test, expect } from '@playwright/test'
2
+
3
+ test('editor has a real canvas and responsive controls', async ({ page }) => {
4
+ const styles = [
5
+ ['japanese_ink', 'Japanese Ink', '#f6f4ef', '#111111'],
6
+ ['noir', 'Noir', '#0d0d0f', '#f4f1ea'],
7
+ ['ocean', 'Ocean', '#edf7fb', '#1a3547'],
8
+ ['forest', 'Forest', '#edf3eb', '#263b2b'],
9
+ ['terracotta', 'Terracotta', '#f7eee7', '#4b2d23'],
10
+ ].map(([id, name, background, text]) => ({
11
+ id, name, description: '', preview: `/style-previews/${id}.webp`, background, text,
12
+ water: '#d8d5cf', parks: '#e6e3dd', road_motorway: '#111111', road_primary: '#222222',
13
+ road_secondary: '#333333', road_tertiary: '#444444', road_residential: '#555555', road_default: '#444444', gradient: '#ffffff',
14
+ }))
15
+ await page.route('**/api/v1/styles', async (route) => route.fulfill({ json: styles }))
16
+ await page.route('**/api/v1/map-data/prepare', async (route) => route.fulfill({ json: { map_data_id: 'a'.repeat(64), cache_hit: true } }))
17
+ await page.route('**/api/v1/posters/preview', async (route) => route.fulfill({ status: 200, path: 'public/sample-poster.webp' }))
18
+ await page.goto('/')
19
+ await expect(page.getByText('MapToPoster')).toBeVisible()
20
+ await expect(page.getByAltText(/Poster preview/)).toBeVisible()
21
+ await page.getByRole('main').getByRole('button', { name: 'Zoom in' }).click()
22
+ await expect(page.getByText('92%')).toBeVisible()
23
+ await expect(page.locator('.preview-status')).toContainText('Preview updated', { timeout: 5000 })
24
+ await page.getByRole('button', { name: /Export options/ }).click()
25
+ await expect(page.getByText('SVG · Vector')).toBeVisible()
26
+ await page.screenshot({ path: 'test-results/editor-desktop.png', fullPage: true })
27
+ await page.getByRole('button', { name: /Export options/ }).click()
28
+ await page.setViewportSize({ width: 390, height: 844 })
29
+ await page.screenshot({ path: 'test-results/editor-mobile.png', fullPage: true })
30
+ })
frontend/index.html ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <meta name="theme-color" content="#f4f5f7" />
7
+ <title>MapToPoster — Turn any place into a piece of art</title>
8
+ </head>
9
+ <body>
10
+ <div id="root"></div>
11
+ <script type="module" src="/src/main.tsx"></script>
12
+ </body>
13
+ </html>
frontend/package.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "frontend",
3
+ "private": true,
4
+ "version": "0.0.0",
5
+ "packageManager": "pnpm@11.24.0",
6
+ "type": "module",
7
+ "scripts": {
8
+ "dev": "vite",
9
+ "build": "tsc -b && vite build",
10
+ "lint": "oxlint",
11
+ "test": "vitest run",
12
+ "test:e2e": "playwright test",
13
+ "preview": "vite preview"
14
+ },
15
+ "dependencies": {
16
+ "lucide-react": "^1.35.0",
17
+ "maplibre-gl": "^6.6.0",
18
+ "react": "^19.2.8",
19
+ "react-dom": "^19.2.8"
20
+ },
21
+ "devDependencies": {
22
+ "@playwright/test": "^1.62.1",
23
+ "@testing-library/jest-dom": "^7.0.1",
24
+ "@testing-library/react": "^16.3.3",
25
+ "@types/node": "^24.13.3",
26
+ "@types/react": "^19.2.18",
27
+ "@types/react-dom": "^19.2.4",
28
+ "@vitejs/plugin-react": "^6.1.0",
29
+ "jsdom": "^30.0.1",
30
+ "oxlint": "^1.79.0",
31
+ "typescript": "~6.0.2",
32
+ "vite": "^8.2.2",
33
+ "vitest": "^4.1.11"
34
+ }
35
+ }
frontend/playwright.config.ts ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ import { defineConfig, devices } from '@playwright/test'
2
+
3
+ export default defineConfig({
4
+ testDir: './e2e',
5
+ webServer: { command: 'pnpm dev --host 127.0.0.1', port: 5173, reuseExistingServer: true },
6
+ use: { baseURL: 'http://127.0.0.1:5173', trace: 'on-first-retry' },
7
+ projects: [{ name: 'chromium', use: { ...devices['Desktop Chrome'], launchOptions: { executablePath: 'C:/Program Files/Google/Chrome/Application/chrome.exe' } } }],
8
+ })
frontend/pnpm-lock.yaml ADDED
@@ -0,0 +1,1767 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ lockfileVersion: '9.0'
2
+
3
+ settings:
4
+ autoInstallPeers: true
5
+ excludeLinksFromLockfile: false
6
+
7
+ importers:
8
+
9
+ .:
10
+ dependencies:
11
+ lucide-react:
12
+ specifier: ^1.35.0
13
+ version: 1.35.0(react@19.2.8)
14
+ maplibre-gl:
15
+ specifier: ^6.6.0
16
+ version: 6.6.0
17
+ react:
18
+ specifier: ^19.2.8
19
+ version: 19.2.8
20
+ react-dom:
21
+ specifier: ^19.2.8
22
+ version: 19.2.8(react@19.2.8)
23
+ devDependencies:
24
+ '@playwright/test':
25
+ specifier: ^1.62.1
26
+ version: 1.62.1
27
+ '@testing-library/jest-dom':
28
+ specifier: ^7.0.1
29
+ version: 7.0.1(@testing-library/dom@10.4.1)(vitest@4.1.11(@types/node@24.13.3)(jsdom@30.0.1)(vite@8.2.2(@types/node@24.13.3)))
30
+ '@testing-library/react':
31
+ specifier: ^16.3.3
32
+ version: 16.3.3(@testing-library/dom@10.4.1)(@types/react-dom@19.2.5(@types/react@19.2.18))(@types/react@19.2.18)(react-dom@19.2.8(react@19.2.8))(react@19.2.8)
33
+ '@types/node':
34
+ specifier: ^24.13.3
35
+ version: 24.13.3
36
+ '@types/react':
37
+ specifier: ^19.2.18
38
+ version: 19.2.18
39
+ '@types/react-dom':
40
+ specifier: ^19.2.4
41
+ version: 19.2.5(@types/react@19.2.18)
42
+ '@vitejs/plugin-react':
43
+ specifier: ^6.1.0
44
+ version: 6.1.1(vite@8.2.2(@types/node@24.13.3))
45
+ jsdom:
46
+ specifier: ^30.0.1
47
+ version: 30.0.1
48
+ oxlint:
49
+ specifier: ^1.79.0
50
+ version: 1.80.0
51
+ typescript:
52
+ specifier: ~6.0.2
53
+ version: 6.0.3
54
+ vite:
55
+ specifier: ^8.2.2
56
+ version: 8.2.2(@types/node@24.13.3)
57
+ vitest:
58
+ specifier: ^4.1.11
59
+ version: 4.1.11(@types/node@24.13.3)(jsdom@30.0.1)(vite@8.2.2(@types/node@24.13.3))
60
+
61
+ packages:
62
+
63
+ '@adobe/css-tools@4.5.0':
64
+ resolution: {integrity: sha512-6OzddxPio9UiWTCemp4N8cYLV2ZN1ncRnV1cVGtve7dhPOtRkleRyx32GQCYSwDYgaHU3USMm84tNsvKzRCa1Q==}
65
+
66
+ '@asamuzakjp/css-color@6.0.7':
67
+ resolution: {integrity: sha512-vC/bk1Lz7Tn/EfU9/apOTBk80/8dyGyWMowPoV1tJ52muDGsDqt2HPT2klrFUiY60MQmQv9q8yIht15JnBgDGw==}
68
+ engines: {node: ^22.13.0 || >=24.0.0}
69
+
70
+ '@asamuzakjp/dom-selector@8.3.2':
71
+ resolution: {integrity: sha512-93Z1N+BQNXysodoicpOIyNh2drHfz/CTf9nnT0FEx72GJcIiwgydD7tGAr78j41LsYn3hlRn+LdGPuBLn1Bl8Q==}
72
+ engines: {node: ^22.13.0 || >=24.0.0}
73
+
74
+ '@babel/code-frame@7.29.7':
75
+ resolution: {integrity: sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==}
76
+ engines: {node: '>=6.9.0'}
77
+
78
+ '@babel/helper-validator-identifier@7.29.7':
79
+ resolution: {integrity: sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==}
80
+ engines: {node: '>=6.9.0'}
81
+
82
+ '@babel/runtime@7.29.7':
83
+ resolution: {integrity: sha512-Nq8OhGWiZIZGV6hLHoyAKLLcJihP/xFeBMGJoUrxTX2psI8dCifzLhZISFb+VWS3wFMRDmCGw5R+dOySCqPLhw==}
84
+ engines: {node: '>=6.9.0'}
85
+
86
+ '@bramus/specificity@2.4.2':
87
+ resolution: {integrity: sha512-ctxtJ/eA+t+6q2++vj5j7FYX3nRu311q1wfYH3xjlLOsczhlhxAg2FWNUXhpGvAw3BWo1xBcvOV6/YLc2r5FJw==}
88
+ hasBin: true
89
+
90
+ '@csstools/color-helpers@6.1.1':
91
+ resolution: {integrity: sha512-gLNsunvwf3mCi5u5o46/Z/JcJMnhbHSaZ69rkgPzNM3J4s8hWwpPUQB6/tt0EDFyCiWzxANlx+2LJwpYj4zS1w==}
92
+ engines: {node: '>=20.19.0'}
93
+
94
+ '@csstools/css-calc@3.3.0':
95
+ resolution: {integrity: sha512-c5ihYsPkdG6JCkU2zTMm4+k6r7RXuGxtWYhu5DHMIiF1FHzrfmHL5so11AoFpUv/tu61xfcmT4AmKoFfMPoqdQ==}
96
+ engines: {node: '>=20.19.0'}
97
+ peerDependencies:
98
+ '@csstools/css-parser-algorithms': ^4.0.0
99
+ '@csstools/css-tokenizer': ^4.0.0
100
+
101
+ '@csstools/css-color-parser@4.2.1':
102
+ resolution: {integrity: sha512-YpAJZhaHplYQkG8ib+/Fx5Y0eF2lVWi3tIvMJA6i39TLyUNp2439cifzW8VMjhlqrBjHzK5hVGugRRm2zTKI/A==}
103
+ engines: {node: '>=20.19.0'}
104
+ peerDependencies:
105
+ '@csstools/css-parser-algorithms': ^4.0.0
106
+ '@csstools/css-tokenizer': ^4.0.0
107
+
108
+ '@csstools/css-parser-algorithms@4.0.0':
109
+ resolution: {integrity: sha512-+B87qS7fIG3L5h3qwJ/IFbjoVoOe/bpOdh9hAjXbvx0o8ImEmUsGXN0inFOnk2ChCFgqkkGFQ+TpM5rbhkKe4w==}
110
+ engines: {node: '>=20.19.0'}
111
+ peerDependencies:
112
+ '@csstools/css-tokenizer': ^4.0.0
113
+
114
+ '@csstools/css-syntax-patches-for-csstree@1.1.9':
115
+ resolution: {integrity: sha512-iGGw4OsAYsS6pD29MdJ2bX/nJx65a04ZZiw6x+VwWlP2DdXf6f++Zmuv/OzALpdyfVhjbduIIF2cXM7HWBIe9A==}
116
+ peerDependencies:
117
+ css-tree: ^3.2.1
118
+ peerDependenciesMeta:
119
+ css-tree:
120
+ optional: true
121
+
122
+ '@csstools/css-tokenizer@4.0.0':
123
+ resolution: {integrity: sha512-QxULHAm7cNu72w97JUNCBFODFaXpbDg+dP8b/oWFAZ2MTRppA3U00Y2L1HqaS4J6yBqxwa/Y3nMBaxVKbB/NsA==}
124
+ engines: {node: '>=20.19.0'}
125
+
126
+ '@exodus/bytes@1.15.1':
127
+ resolution: {integrity: sha512-S6mL0yNB/Abt9Ei4tq8gDhcczc4S3+vQ4ra7vxnAf+YHC02srtqxKKZghx2Dq6p0e66THKwR6r8N6P95wEty7Q==}
128
+ engines: {node: ^20.19.0 || ^22.12.0 || >=24.0.0}
129
+ peerDependencies:
130
+ '@noble/hashes': ^1.8.0 || ^2.0.0
131
+ peerDependenciesMeta:
132
+ '@noble/hashes':
133
+ optional: true
134
+
135
+ '@jridgewell/sourcemap-codec@1.6.0':
136
+ resolution: {integrity: sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==}
137
+
138
+ '@mapbox/jsonlint-lines-primitives@2.0.3':
139
+ resolution: {integrity: sha512-0SElaV0uMxEnxzBhhX9WTuPyUeMsAN/SS0i16tjuba4/mio63MG9khjC1a0JAiPGXAwvwm4UfHJURCN7nyudQg==}
140
+ engines: {node: '>= 22'}
141
+
142
+ '@mapbox/point-geometry@1.1.0':
143
+ resolution: {integrity: sha512-YGcBz1cg4ATXDCM/71L9xveh4dynfGmcLDqufR+nQQy3fKwsAZsWd/x4621/6uJaeB9mwOHE6hPeDgXz9uViUQ==}
144
+
145
+ '@mapbox/tiny-sdf@2.2.0':
146
+ resolution: {integrity: sha512-LVL4wgI9YAum5V+LNVQO6QgFBPw7/MIIY4XJPNsPDMrjEwcE+JfKk1LuIl8GnF197ejVdC9QdPaxrx5gfgdGXg==}
147
+
148
+ '@mapbox/unitbezier@1.0.0':
149
+ resolution: {integrity: sha512-fqd515fjBmANKGGsQ286E2Wvj/XvDFpGzwJxq4CI6jMQue6Oy04uCKp+JWKF00xRTmk6cEu1jPJ9p3xqH8YWqQ==}
150
+
151
+ '@mapbox/vector-tile@3.0.0':
152
+ resolution: {integrity: sha512-Qf10S1uIHMk20ri/IVBnpS+esUEkVaR5Hftmz88jTInrpmWgPGJfPe3LVjjlE77trLx8tH6qjTG7uWH9hIq/0Q==}
153
+
154
+ '@maplibre/geojson-vt@6.1.1':
155
+ resolution: {integrity: sha512-FVMOcmSP/yqol45t7StApEyTL5/vmqBCuFhH9n+fFuINenhaX+YgHHIt1yJ86S8kln3uJLcMvmEU2cfn6E2eCQ==}
156
+
157
+ '@maplibre/maplibre-gl-style-spec@26.4.1':
158
+ resolution: {integrity: sha512-I/qcIKVFHFSg1Meu/eqHrkSTjIez0gCsSaK56TNPutM3TkE61aSq6F1cZ4Kg4KiNs3cpViLtubDjfyRcQCdEJQ==}
159
+ hasBin: true
160
+
161
+ '@maplibre/mlt@1.2.0':
162
+ resolution: {integrity: sha512-g45M8gEI4sMO3X9ib4K7n3ZKFf0qQOL+NMkHCnEK51lOrYFHiEssOuZncx1+miIgi1IEE2NcbRMcq8RBkL+QHA==}
163
+
164
+ '@maplibre/vt-pbf@4.3.2':
165
+ resolution: {integrity: sha512-j6p0AdjvAR19Z3XaCysle7A4ZSo08tYOzxD0Y9NQylwPAkwJJeYub5b2eVucdeDh7erhv69DahoLOevDRERRUw==}
166
+
167
+ '@oxc-project/types@0.147.0':
168
+ resolution: {integrity: sha512-IJ3s6ltHLp45S0bh7phkX+gJO7A1Wuz2EaqpAhb8WjqDwbzMiWKHhyyT42tskaWjEYXtHtVCPpnBJVT9+dcRLg==}
169
+
170
+ '@oxlint/binding-android-arm-eabi@1.80.0':
171
+ resolution: {integrity: sha512-RM3Plj+biQpxa5d1GOOX6ciDlcUROmm4OZ/pLTpitkQt2mJv4jhtY4cbgaetOm5UKWZe05/TGQ6o1Vl8EOHkrA==}
172
+ engines: {node: ^20.19.0 || >=22.12.0}
173
+ cpu: [arm]
174
+ os: [android]
175
+
176
+ '@oxlint/binding-android-arm64@1.80.0':
177
+ resolution: {integrity: sha512-YlO5JEf0Yr2bUUlu8O8daVcUxtcGGbcSmyV7E7nSbJbfAdxTE0PFPwgnIlw7wXJaTYjb+qs5hI5q3jxUkI7cAw==}
178
+ engines: {node: ^20.19.0 || >=22.12.0}
179
+ cpu: [arm64]
180
+ os: [android]
181
+
182
+ '@oxlint/binding-darwin-arm64@1.80.0':
183
+ resolution: {integrity: sha512-BULDOyO3AhsmdWfQeIUCykDt3dd7XZBGLhp1eIh56skRv01O+cNjNPwXMIbeW1x4+pxcln5if72wcRgViVo7PA==}
184
+ engines: {node: ^20.19.0 || >=22.12.0}
185
+ cpu: [arm64]
186
+ os: [darwin]
187
+
188
+ '@oxlint/binding-darwin-x64@1.80.0':
189
+ resolution: {integrity: sha512-YJ4JzLw7N5TDSQFlA0hAQGHvnDZgyypm1yunObVWcWiF9KM7eGCJKYKLgTC2Fi/57OdnBhbj4OkzPGdFQJ6HyA==}
190
+ engines: {node: ^20.19.0 || >=22.12.0}
191
+ cpu: [x64]
192
+ os: [darwin]
193
+
194
+ '@oxlint/binding-freebsd-x64@1.80.0':
195
+ resolution: {integrity: sha512-AYUIk5QnL0s8oWAYsREZwkRYy1SupJTXALo93J1TgzHywxQtdM99FecRMQ87MXEdPQ0j1TmEpeeq3fGNkpvMqg==}
196
+ engines: {node: ^20.19.0 || >=22.12.0}
197
+ cpu: [x64]
198
+ os: [freebsd]
199
+
200
+ '@oxlint/binding-linux-arm-gnueabihf@1.80.0':
201
+ resolution: {integrity: sha512-9hBZVANupQ89W9dXyE0n8doCyaW5pDyGn3y6XlIMPZ+rIKuyqkr3SNUXmVJIhuvUq0NBU3RBiSXXE69l4XI6KA==}
202
+ engines: {node: ^20.19.0 || >=22.12.0}
203
+ cpu: [arm]
204
+ os: [linux]
205
+
206
+ '@oxlint/binding-linux-arm-musleabihf@1.80.0':
207
+ resolution: {integrity: sha512-SvS2uKqzY+pbfuvAHzH4338R6Zwo805GAwrIMVvK1KxoOWCIjZUdfzTCvilD7z6JK91v011+zYMryabhDo2AsQ==}
208
+ engines: {node: ^20.19.0 || >=22.12.0}
209
+ cpu: [arm]
210
+ os: [linux]
211
+
212
+ '@oxlint/binding-linux-arm64-gnu@1.80.0':
213
+ resolution: {integrity: sha512-tCLadyqRVL3pQTRPNg7cjXKvcvS4fbyXeQHhKk5BTJ1oftQln5/yIIWbu/Xom/DX41zv2P9QGt6+D/TtQVtY3A==}
214
+ engines: {node: ^20.19.0 || >=22.12.0}
215
+ cpu: [arm64]
216
+ os: [linux]
217
+ libc: [glibc]
218
+
219
+ '@oxlint/binding-linux-arm64-musl@1.80.0':
220
+ resolution: {integrity: sha512-XfpCNRlOPcLlJl4Bn/FUhjqlR6BVavEykERBf/MV7YA9VZDa5g5znVqYhyviMafcxS9Pe/i/kPvHNO0U6svEHQ==}
221
+ engines: {node: ^20.19.0 || >=22.12.0}
222
+ cpu: [arm64]
223
+ os: [linux]
224
+ libc: [musl]
225
+
226
+ '@oxlint/binding-linux-ppc64-gnu@1.80.0':
227
+ resolution: {integrity: sha512-3I4yMwcFG9NeO8ioY6JBBuKsIm5GL/x7MATt1S4tVWaxPu5HcJ+XnLUbcVBTxG8q2Wu56HSj+NmXQiVYb1lp6A==}
228
+ engines: {node: ^20.19.0 || >=22.12.0}
229
+ cpu: [ppc64]
230
+ os: [linux]
231
+ libc: [glibc]
232
+
233
+ '@oxlint/binding-linux-riscv64-gnu@1.80.0':
234
+ resolution: {integrity: sha512-E1wAKymkpe1/E8helzBKdm81OBOF+ezxRyXRMEuik3ZpWDER5CPOKZwF66RsdwW98uwZv8UTFremUQtC1CzdJA==}
235
+ engines: {node: ^20.19.0 || >=22.12.0}
236
+ cpu: [riscv64]
237
+ os: [linux]
238
+ libc: [glibc]
239
+
240
+ '@oxlint/binding-linux-riscv64-musl@1.80.0':
241
+ resolution: {integrity: sha512-+gLRGD4sIo3+VA++iham5UxD9tKSoJ/VOrROCEXIcknrYtQg6iIQgvjN0cpiRF7N6UYC7pJbvHJlDnMge5LRpQ==}
242
+ engines: {node: ^20.19.0 || >=22.12.0}
243
+ cpu: [riscv64]
244
+ os: [linux]
245
+ libc: [musl]
246
+
247
+ '@oxlint/binding-linux-s390x-gnu@1.80.0':
248
+ resolution: {integrity: sha512-aR0PrzHj9leW3NmzBAAP4EzdoBNoJcs9sjnIQPIwyRnBGYrRbXUIpEB5Q39AqK3PLY5JK5uEhDQDiUa1QSAstw==}
249
+ engines: {node: ^20.19.0 || >=22.12.0}
250
+ cpu: [s390x]
251
+ os: [linux]
252
+ libc: [glibc]
253
+
254
+ '@oxlint/binding-linux-x64-gnu@1.80.0':
255
+ resolution: {integrity: sha512-vSVh5cSo3Xxs6ghBCcFJlpbkbENzDog1qXtoXLa/HC3aCrR4XO76GZbXmQoCPHnu99nQpdCeC3H9tdNICfDh7A==}
256
+ engines: {node: ^20.19.0 || >=22.12.0}
257
+ cpu: [x64]
258
+ os: [linux]
259
+ libc: [glibc]
260
+
261
+ '@oxlint/binding-linux-x64-musl@1.80.0':
262
+ resolution: {integrity: sha512-FfzBXpNQ8u7/ZI/p8bl73MeZ508Ax3hxWp3SiJpEFiC+BB9XcXy5FAZHTLKDPSzrUpxQZSZJAVdDmuJp/+HDBQ==}
263
+ engines: {node: ^20.19.0 || >=22.12.0}
264
+ cpu: [x64]
265
+ os: [linux]
266
+ libc: [musl]
267
+
268
+ '@oxlint/binding-openharmony-arm64@1.80.0':
269
+ resolution: {integrity: sha512-zMzbkumtmprCgRwoYNzcB3iC39fXdJIMLMU33KdCjEGLlJGOEt1+LwQ4LF8ndLzAEKVz4BR0y3V6Xrkk3Nm3yA==}
270
+ engines: {node: ^20.19.0 || >=22.12.0}
271
+ cpu: [arm64]
272
+ os: [openharmony]
273
+
274
+ '@oxlint/binding-win32-arm64-msvc@1.80.0':
275
+ resolution: {integrity: sha512-ib6iRcrXsk4t1fm3iKcwksyWh1ZkZXC/2mEzakl0ai2+6HZunf1WWMZ/xP9EJAvw9g9K4UVTC3NF/+G2qLrbTQ==}
276
+ engines: {node: ^20.19.0 || >=22.12.0}
277
+ cpu: [arm64]
278
+ os: [win32]
279
+
280
+ '@oxlint/binding-win32-ia32-msvc@1.80.0':
281
+ resolution: {integrity: sha512-xhRWBMpLxZvgKAH6+DJZmpP+W8Y8UdQOSU1JfxSWNXsaBaRGW77j+1hCuNHlzj7OH4SPN8fYd1q0o2qrDtoVyw==}
282
+ engines: {node: ^20.19.0 || >=22.12.0}
283
+ cpu: [ia32]
284
+ os: [win32]
285
+
286
+ '@oxlint/binding-win32-x64-msvc@1.80.0':
287
+ resolution: {integrity: sha512-yAnO7lwBYQnz2pcfBPIGQQZWIX5zd5R/1aAKIF3oE+TVj7IhoHcROjOkz3sRDngzqhfPKfFaXqug5j5rE5dn6Q==}
288
+ engines: {node: ^20.19.0 || >=22.12.0}
289
+ cpu: [x64]
290
+ os: [win32]
291
+
292
+ '@playwright/test@1.62.1':
293
+ resolution: {integrity: sha512-DTcUc8qii+cpHvtOwggMtBRMjKZHXYWdw8syRYu2vtzuq4Wxphqq4NfCs5Zt44L6mA8rfDfj+PHnxFc/FeK6mQ==}
294
+ engines: {node: '>=20'}
295
+ hasBin: true
296
+
297
+ '@rolldown/binding-android-arm-eabi@1.2.6':
298
+ resolution: {integrity: sha512-b+jTcARdTiFLI6jB4a5XjTm0RWd6KcRfQj/I2356fxUZemiho9zQLxo0RtCuMDAyKcLo6cEltkgbQp6d1+sjjQ==}
299
+ engines: {node: ^20.19.0 || >=22.12.0}
300
+ cpu: [arm]
301
+ os: [android]
302
+
303
+ '@rolldown/binding-android-arm64@1.2.6':
304
+ resolution: {integrity: sha512-lkWU8ZJaRk9q3CIEY1Tc7vIFALp3Xw5NfGJo2hQg5oIqNgxWi1zI+IiDEK3r70BF5Dzol1tcXsnzsRc8NLhG+Q==}
305
+ engines: {node: ^20.19.0 || >=22.12.0}
306
+ cpu: [arm64]
307
+ os: [android]
308
+
309
+ '@rolldown/binding-darwin-arm64@1.2.6':
310
+ resolution: {integrity: sha512-dgR56NYnvAszm7Ob1B2/Vn0e8bUQYZH2UjVaMMtMVOCKFSfjhfLmuA/9+O+F+ajUdG6B/bSssrKW6JJYASa8jA==}
311
+ engines: {node: ^20.19.0 || >=22.12.0}
312
+ cpu: [arm64]
313
+ os: [darwin]
314
+
315
+ '@rolldown/binding-darwin-x64@1.2.6':
316
+ resolution: {integrity: sha512-vpVxFvUCFioJqug7OTvqptkc4yb8UX0AwfDmJpaR/0sWz+BUmqSVAf7c8JkUgnN8YLspb4a/N6NhTyMAmdyQ7Q==}
317
+ engines: {node: ^20.19.0 || >=22.12.0}
318
+ cpu: [x64]
319
+ os: [darwin]
320
+
321
+ '@rolldown/binding-freebsd-x64@1.2.6':
322
+ resolution: {integrity: sha512-h1wG6Y6K3JlRswxsI64qQJqBAy4vrLuHgRbc8CZMGSWTOFRY6ghMApM1NKzB2I0n5xV1fjkE18SuVl2QpLeNpA==}
323
+ engines: {node: ^20.19.0 || >=22.12.0}
324
+ cpu: [x64]
325
+ os: [freebsd]
326
+
327
+ '@rolldown/binding-linux-arm-gnueabihf@1.2.6':
328
+ resolution: {integrity: sha512-tbCiqub0q2MVWJKgF5PoAlNWCtQydiOYSLIkd8sByqK/6MMYLJRcSXSYodqYtd0O+Fw7QaVmKKlS4oL94YRZ0w==}
329
+ engines: {node: ^20.19.0 || >=22.12.0}
330
+ cpu: [arm]
331
+ os: [linux]
332
+
333
+ '@rolldown/binding-linux-arm64-gnu@1.2.6':
334
+ resolution: {integrity: sha512-oxK9+baEBPhZG5HB4URY+uU04zJWeZlH6Tb9rB5DK4DF9XR1uXNLXt5Q5ZsugTKayNCNLhkcwz/ye74hRI98dg==}
335
+ engines: {node: ^20.19.0 || >=22.12.0}
336
+ cpu: [arm64]
337
+ os: [linux]
338
+ libc: [glibc]
339
+
340
+ '@rolldown/binding-linux-arm64-musl@1.2.6':
341
+ resolution: {integrity: sha512-muWCk27FVBEZtv0MsK8gnfSmgczA8KQ0uRVJbTABKhkRfQc38aUrcb7fhi3BNiyseFmgcRsoMfQsSNJ+DbZdSw==}
342
+ engines: {node: ^20.19.0 || >=22.12.0}
343
+ cpu: [arm64]
344
+ os: [linux]
345
+ libc: [musl]
346
+
347
+ '@rolldown/binding-linux-ppc64-gnu@1.2.6':
348
+ resolution: {integrity: sha512-eWDoSfU7Co2qj3vgB3Dt4lj1mG6CoWbcJQkRMP3XJplyCMtuaq3LHvPFjS9QIPvMGWVadJC04Xiy0IdcVPtnwQ==}
349
+ engines: {node: ^20.19.0 || >=22.12.0}
350
+ cpu: [ppc64]
351
+ os: [linux]
352
+ libc: [glibc]
353
+
354
+ '@rolldown/binding-linux-s390x-gnu@1.2.6':
355
+ resolution: {integrity: sha512-2bWNjRSIayvupRKxXUY2tWG9fYdoUlTqWywHRvE8Eq3GvuQ+f2HeIkve697fIt+IQs/PV8yFsdWuhp1aJ1PdnA==}
356
+ engines: {node: ^20.19.0 || >=22.12.0}
357
+ cpu: [s390x]
358
+ os: [linux]
359
+ libc: [glibc]
360
+
361
+ '@rolldown/binding-linux-x64-gnu@1.2.6':
362
+ resolution: {integrity: sha512-KekI0gS0wLxe1UBSQSjenBVwou/JkcQPDzBPICGZjxUv9k3RteHDPBQaiOicZUFKRIH2wKEimGwVpnJsbPzu7w==}
363
+ engines: {node: ^20.19.0 || >=22.12.0}
364
+ cpu: [x64]
365
+ os: [linux]
366
+ libc: [glibc]
367
+
368
+ '@rolldown/binding-linux-x64-musl@1.2.6':
369
+ resolution: {integrity: sha512-TvtPnfVr+HtyGiDmPK4VWmlNm7QhNNAcK5Q9A7aOXsI8545yCyaoMaicXrFZ72JzeYjaUVk7yT243zT0jzjFKQ==}
370
+ engines: {node: ^20.19.0 || >=22.12.0}
371
+ cpu: [x64]
372
+ os: [linux]
373
+ libc: [musl]
374
+
375
+ '@rolldown/binding-openharmony-arm64@1.2.6':
376
+ resolution: {integrity: sha512-iOo0VEay2XFhaCcH0sps5XIimkSuOnNaZrf6+ZkoSOQBJPKNU48RkmJv0/lSpipexu5P+ouFgafe5IGr/DiQfg==}
377
+ engines: {node: ^20.19.0 || >=22.12.0}
378
+ cpu: [arm64]
379
+ os: [openharmony]
380
+
381
+ '@rolldown/binding-win32-arm64-msvc@1.2.6':
382
+ resolution: {integrity: sha512-y5NTmmasMS455JlOCO4ZM9krIchv3Mvm1crL1iUPGOPgEzSkves9n0SdC5Sjz6+qWDFhd8/JpfWMH8NSWNHe+A==}
383
+ engines: {node: ^20.19.0 || >=22.12.0}
384
+ cpu: [arm64]
385
+ os: [win32]
386
+
387
+ '@rolldown/binding-win32-x64-msvc@1.2.6':
388
+ resolution: {integrity: sha512-np8iZSLfXlAD4kWhiyq/u0Yt8oZDtRQ8lGhQaCXo2rl37KNjeU0GjJuwr4P3oeZ++ROfofsKNBqR5LTO8aXyWQ==}
389
+ engines: {node: ^20.19.0 || >=22.12.0}
390
+ cpu: [x64]
391
+ os: [win32]
392
+
393
+ '@rolldown/pluginutils@1.0.1':
394
+ resolution: {integrity: sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==}
395
+
396
+ '@standard-schema/spec@1.1.0':
397
+ resolution: {integrity: sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==}
398
+
399
+ '@testing-library/dom@10.4.1':
400
+ resolution: {integrity: sha512-o4PXJQidqJl82ckFaXUeoAW+XysPLauYI43Abki5hABd853iMhitooc6znOnczgbTYmEP6U6/y1ZyKAIsvMKGg==}
401
+ engines: {node: '>=18'}
402
+
403
+ '@testing-library/jest-dom@7.0.1':
404
+ resolution: {integrity: sha512-oMDTC3oA+6CXSO2JZnvOI7CA6oVub6kij5ggk9ohwye5slmkwxYDXcPOVxgMw/RQlticjtO0C1RZkR97HgrWMw==}
405
+ engines: {node: '>=22', npm: '>=6', yarn: '>=1'}
406
+ peerDependencies:
407
+ '@testing-library/dom': '>=10 <11'
408
+ vitest: '>= 0.32'
409
+ peerDependenciesMeta:
410
+ vitest:
411
+ optional: true
412
+
413
+ '@testing-library/react@16.3.3':
414
+ resolution: {integrity: sha512-Uo193NgQbPMz6lrrhtRQQFcMC6Re/ELLFbbuVL30WDlZxlpZf9/lMHTAVxPRLw1q1iu9OJmR1c2BLiENRstdBg==}
415
+ engines: {node: '>=18'}
416
+ peerDependencies:
417
+ '@testing-library/dom': ^10.0.0
418
+ '@types/react': ^18.0.0 || ^19.0.0
419
+ '@types/react-dom': ^18.0.0 || ^19.0.0
420
+ react: ^18.0.0 || ^19.0.0
421
+ react-dom: ^18.0.0 || ^19.0.0
422
+ peerDependenciesMeta:
423
+ '@types/react':
424
+ optional: true
425
+ '@types/react-dom':
426
+ optional: true
427
+
428
+ '@types/aria-query@5.0.4':
429
+ resolution: {integrity: sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==}
430
+
431
+ '@types/chai@5.2.3':
432
+ resolution: {integrity: sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==}
433
+
434
+ '@types/deep-eql@4.0.2':
435
+ resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==}
436
+
437
+ '@types/estree@1.0.9':
438
+ resolution: {integrity: sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==}
439
+
440
+ '@types/geojson@7946.0.16':
441
+ resolution: {integrity: sha512-6C8nqWur3j98U6+lXDfTUWIfgvZU+EumvpHKcYjujKH7woYyLj2sUmff0tRhrqM7BohUw7Pz3ZB1jj2gW9Fvmg==}
442
+
443
+ '@types/node@24.13.3':
444
+ resolution: {integrity: sha512-Dh8vAsV36ig5wa9OX4pXvMc9D3Veibfw2wix0CUwYODLD8nkj9UsLjASr49nPg+2eKzxhBV+v7L8pXvT4e639Q==}
445
+
446
+ '@types/react-dom@19.2.5':
447
+ resolution: {integrity: sha512-fMPwH9v7r/pp43yUd2/Mbiex5KouJwwR3dzHkhLREUC6764VyDsqxhAxv6OFEYR1RhjOyD1naqba8ECDBe7ZQg==}
448
+ peerDependencies:
449
+ '@types/react': ^19.2.0
450
+
451
+ '@types/react@19.2.18':
452
+ resolution: {integrity: sha512-AnzbBERsrLKtk2XSfTbYRLjQPdy116Sty4q+T+Bp3IC4l6jNBvreVPAHmpq9qhXQM7CXZPjLVmGMw9sy+hxQ3w==}
453
+
454
+ '@vitejs/plugin-react@6.1.1':
455
+ resolution: {integrity: sha512-yxLaQV9gkhS8ezJqCM6+ndU7mDY6gqAg75NQ+0IjwEI8IYOmQCgkRwHKVSfWXW076DsqMo0Dk+0FK1U+M5RgFw==}
456
+ engines: {node: ^20.19.0 || >=22.12.0}
457
+ peerDependencies:
458
+ '@rolldown/plugin-babel': ^0.1.7 || ^0.2.0
459
+ babel-plugin-react-compiler: ^1.0.0
460
+ oxc-transform-react: ^0.145.0
461
+ vite: ^8.0.0
462
+ peerDependenciesMeta:
463
+ '@rolldown/plugin-babel':
464
+ optional: true
465
+ babel-plugin-react-compiler:
466
+ optional: true
467
+ oxc-transform-react:
468
+ optional: true
469
+
470
+ '@vitest/expect@4.1.11':
471
+ resolution: {integrity: sha512-VX2x5vNJXET47KAFzwERI+KRMtTTCSWTfSMKsW7JsUsXV4psq++e3DvZpuTDOpHcxytiDs6p2nhVb2tVDiiUYw==}
472
+
473
+ '@vitest/mocker@4.1.11':
474
+ resolution: {integrity: sha512-2XJVD55d1o5AZous5CCGKS74g/riOj9odEt2bQpCVZeblHyHdnMeFl4jl0XjU21stf4mbjUkew2eXQZt65g5CQ==}
475
+ peerDependencies:
476
+ msw: ^2.4.9
477
+ vite: ^6.0.0 || ^7.0.0 || ^8.0.0
478
+ peerDependenciesMeta:
479
+ msw:
480
+ optional: true
481
+ vite:
482
+ optional: true
483
+
484
+ '@vitest/pretty-format@4.1.11':
485
+ resolution: {integrity: sha512-yiZzPbGTS9Sr/JpFl8zHrcIkAofNbFV6k21vIgQN/cY/oxZeXhJv5sc/MBJ5jFKWmWs+oJHw0UXLZjmf931+Vw==}
486
+
487
+ '@vitest/runner@4.1.11':
488
+ resolution: {integrity: sha512-LztvUgdwMNJMIkj3hQnnxiC2Xy1zNxq928W/xhjCLaNCzqTZOudjwbQf6v9IntZGPw132i2Lq2rgTRZHD3JHNw==}
489
+
490
+ '@vitest/snapshot@4.1.11':
491
+ resolution: {integrity: sha512-pN7ikn1ON7h8ee4gIAp4AzyK+zBtJPzVbqOgu5LCEh4VaJVbPQcgYQYJIMGQPXVeJJq1fnfazis7a5pFNPahog==}
492
+
493
+ '@vitest/spy@4.1.11':
494
+ resolution: {integrity: sha512-apNa/prQy2qCeywhnixOHPRCgGNhvg7T4Dapfl1GahLp/R+uhBm5cPyFoNVyqsNd2h1nJxL6BqqdIjiABL60YA==}
495
+
496
+ '@vitest/utils@4.1.11':
497
+ resolution: {integrity: sha512-zTCVGpyFsGWBhllOyKlTw/vnr6D9qxsfSDyfbyZmTyjHw5N/VuvzHpHoQjm2ZJzn4RJgx5w4r7V0er69CmLgPQ==}
498
+
499
+ ansi-regex@5.0.1:
500
+ resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==}
501
+ engines: {node: '>=8'}
502
+
503
+ ansi-styles@5.2.0:
504
+ resolution: {integrity: sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==}
505
+ engines: {node: '>=10'}
506
+
507
+ aria-query@5.3.0:
508
+ resolution: {integrity: sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==}
509
+
510
+ aria-query@5.3.2:
511
+ resolution: {integrity: sha512-COROpnaoap1E2F000S62r6A60uHZnmlvomhfyT2DlTcrY1OrBKn2UhH7qn5wTC9zMvD0AY7csdPSNwKP+7WiQw==}
512
+ engines: {node: '>= 0.4'}
513
+
514
+ assertion-error@2.0.1:
515
+ resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==}
516
+ engines: {node: '>=12'}
517
+
518
+ bidi-js@1.0.3:
519
+ resolution: {integrity: sha512-RKshQI1R3YQ+n9YJz2QQ147P66ELpa1FQEg20Dk8oW9t2KgLbpDLLp9aGZ7y8WHSshDknG0bknqGw5/tyCs5tw==}
520
+
521
+ chai@6.2.2:
522
+ resolution: {integrity: sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg==}
523
+ engines: {node: '>=18'}
524
+
525
+ convert-source-map@2.0.0:
526
+ resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==}
527
+
528
+ css-tree@3.2.1:
529
+ resolution: {integrity: sha512-X7sjQzceUhu1u7Y/ylrRZFU2FS6LRiFVp6rKLPg23y3x3c3DOKAwuXGDp+PAGjh6CSnCjYeAul8pcT8bAl+lSA==}
530
+ engines: {node: ^10 || ^12.20.0 || ^14.13.0 || >=15.0.0}
531
+
532
+ css.escape@1.5.1:
533
+ resolution: {integrity: sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg==}
534
+
535
+ csstype@3.2.3:
536
+ resolution: {integrity: sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==}
537
+
538
+ data-urls@7.0.0:
539
+ resolution: {integrity: sha512-23XHcCF+coGYevirZceTVD7NdJOqVn+49IHyxgszm+JIiHLoB2TkmPtsYkNWT1pvRSGkc35L6NHs0yHkN2SumA==}
540
+ engines: {node: ^20.19.0 || ^22.12.0 || >=24.0.0}
541
+
542
+ decimal.js@10.6.0:
543
+ resolution: {integrity: sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==}
544
+
545
+ dequal@2.0.3:
546
+ resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==}
547
+ engines: {node: '>=6'}
548
+
549
+ detect-libc@2.1.2:
550
+ resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==}
551
+ engines: {node: '>=8'}
552
+
553
+ dom-accessibility-api@0.5.16:
554
+ resolution: {integrity: sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==}
555
+
556
+ dom-accessibility-api@0.6.3:
557
+ resolution: {integrity: sha512-7ZgogeTnjuHbo+ct10G9Ffp0mif17idi0IyWNVA/wcwcm7NPOD/WEHVP3n7n3MhXqxoIYm8d6MuZohYWIZ4T3w==}
558
+
559
+ earcut@3.2.3:
560
+ resolution: {integrity: sha512-vnS4AVwp1KHAF13i1vp1/2D5evWy3k5u/iW/B81QVsUZtV8cv2tU0b2VNFlqvh4kYwrFMDdjPCfAmfyJW9y14Q==}
561
+
562
+ entities@8.0.0:
563
+ resolution: {integrity: sha512-zwfzJecQ/Uej6tusMqwAqU/6KL2XaB2VZ2Jg54Je6ahNBGNH6Ek6g3jjNCF0fG9EWQKGZNddNjU5F1ZQn/sBnA==}
564
+ engines: {node: '>=20.19.0'}
565
+
566
+ es-module-lexer@2.3.2:
567
+ resolution: {integrity: sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw==}
568
+
569
+ estree-walker@3.0.3:
570
+ resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==}
571
+
572
+ expect-type@1.4.0:
573
+ resolution: {integrity: sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==}
574
+ engines: {node: '>=12.0.0'}
575
+
576
+ fdir@6.5.0:
577
+ resolution: {integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==}
578
+ engines: {node: '>=12.0.0'}
579
+ peerDependencies:
580
+ picomatch: ^3 || ^4
581
+ peerDependenciesMeta:
582
+ picomatch:
583
+ optional: true
584
+
585
+ fsevents@2.3.2:
586
+ resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==}
587
+ engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
588
+ os: [darwin]
589
+
590
+ fsevents@2.3.3:
591
+ resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==}
592
+ engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
593
+ os: [darwin]
594
+
595
+ gl-matrix@3.4.4:
596
+ resolution: {integrity: sha512-latSnyDNt/8zYUB6VIJ6PCh2jBjJX6gnDsoCZ7LyW7GkqrD51EWwa9qCoGixj8YqBtETQK/xY7OmpTF8xz1DdQ==}
597
+
598
+ html-encoding-sniffer@6.0.0:
599
+ resolution: {integrity: sha512-CV9TW3Y3f8/wT0BRFc1/KAVQ3TUHiXmaAb6VW9vtiMFf7SLoMd1PdAc4W3KFOFETBJUb90KatHqlsZMWV+R9Gg==}
600
+ engines: {node: ^20.19.0 || ^22.12.0 || >=24.0.0}
601
+
602
+ indent-string@4.0.0:
603
+ resolution: {integrity: sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==}
604
+ engines: {node: '>=8'}
605
+
606
+ is-potential-custom-element-name@1.0.1:
607
+ resolution: {integrity: sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==}
608
+
609
+ js-tokens@4.0.0:
610
+ resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}
611
+
612
+ jsdom@30.0.1:
613
+ resolution: {integrity: sha512-52v7mUVUfNQVYYqE1lcdaymWL0njO7lTLUog6ZvW2U5KsbiLk/GnZlVJ+qx0xfNJZ6Gn+KSpPNE52vurbxZwrA==}
614
+ engines: {node: ^22.22.2 || ^24.15.0 || >=26.0.0}
615
+ peerDependencies:
616
+ canvas: ^3.2.3
617
+ peerDependenciesMeta:
618
+ canvas:
619
+ optional: true
620
+
621
+ json-stringify-pretty-compact@4.0.0:
622
+ resolution: {integrity: sha512-3CNZ2DnrpByG9Nqj6Xo8vqbjT4F6N+tb4Gb28ESAZjYZ5yqvmc56J+/kuIwkaAMOyblTQhUW7PxMkUb8Q36N3Q==}
623
+
624
+ kdbush@4.1.0:
625
+ resolution: {integrity: sha512-e9vurzrXJQrFX6ckpHP3bvj5l+9CnYzkxDNnNQ1h2QTqdWsUAJgXiKdGNcOa1EY85dU8KbQ+z/FdQdB7P+9yfQ==}
626
+
627
+ lightningcss-android-arm64@1.33.0:
628
+ resolution: {integrity: sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==}
629
+ engines: {node: '>= 12.0.0'}
630
+ cpu: [arm64]
631
+ os: [android]
632
+
633
+ lightningcss-darwin-arm64@1.33.0:
634
+ resolution: {integrity: sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==}
635
+ engines: {node: '>= 12.0.0'}
636
+ cpu: [arm64]
637
+ os: [darwin]
638
+
639
+ lightningcss-darwin-x64@1.33.0:
640
+ resolution: {integrity: sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==}
641
+ engines: {node: '>= 12.0.0'}
642
+ cpu: [x64]
643
+ os: [darwin]
644
+
645
+ lightningcss-freebsd-x64@1.33.0:
646
+ resolution: {integrity: sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==}
647
+ engines: {node: '>= 12.0.0'}
648
+ cpu: [x64]
649
+ os: [freebsd]
650
+
651
+ lightningcss-linux-arm-gnueabihf@1.33.0:
652
+ resolution: {integrity: sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==}
653
+ engines: {node: '>= 12.0.0'}
654
+ cpu: [arm]
655
+ os: [linux]
656
+
657
+ lightningcss-linux-arm64-gnu@1.33.0:
658
+ resolution: {integrity: sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==}
659
+ engines: {node: '>= 12.0.0'}
660
+ cpu: [arm64]
661
+ os: [linux]
662
+ libc: [glibc]
663
+
664
+ lightningcss-linux-arm64-musl@1.33.0:
665
+ resolution: {integrity: sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==}
666
+ engines: {node: '>= 12.0.0'}
667
+ cpu: [arm64]
668
+ os: [linux]
669
+ libc: [musl]
670
+
671
+ lightningcss-linux-x64-gnu@1.33.0:
672
+ resolution: {integrity: sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==}
673
+ engines: {node: '>= 12.0.0'}
674
+ cpu: [x64]
675
+ os: [linux]
676
+ libc: [glibc]
677
+
678
+ lightningcss-linux-x64-musl@1.33.0:
679
+ resolution: {integrity: sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==}
680
+ engines: {node: '>= 12.0.0'}
681
+ cpu: [x64]
682
+ os: [linux]
683
+ libc: [musl]
684
+
685
+ lightningcss-win32-arm64-msvc@1.33.0:
686
+ resolution: {integrity: sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==}
687
+ engines: {node: '>= 12.0.0'}
688
+ cpu: [arm64]
689
+ os: [win32]
690
+
691
+ lightningcss-win32-x64-msvc@1.33.0:
692
+ resolution: {integrity: sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==}
693
+ engines: {node: '>= 12.0.0'}
694
+ cpu: [x64]
695
+ os: [win32]
696
+
697
+ lightningcss@1.33.0:
698
+ resolution: {integrity: sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==}
699
+ engines: {node: '>= 12.0.0'}
700
+
701
+ lru-cache@11.5.2:
702
+ resolution: {integrity: sha512-4pfM1Ff0x50o0tQwb5ucw/RzNyD0/YJME6IVcStalZuMWxdt3sR3huStTtxz4PUmvZfRguvDejasvQ2kifR11g==}
703
+ engines: {node: 20 || >=22}
704
+
705
+ lucide-react@1.35.0:
706
+ resolution: {integrity: sha512-yXCCWxGFYT6bLIPYC4SY6fPQPRs/d797rRIue+J9XP2Td6vQvD53gaQRBCnIVT1kTQRHtAtxlfOQNWAuIF8ELg==}
707
+ peerDependencies:
708
+ react: ^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0
709
+
710
+ lz-string@1.5.0:
711
+ resolution: {integrity: sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==}
712
+ hasBin: true
713
+
714
+ magic-string@0.30.21:
715
+ resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==}
716
+
717
+ maplibre-gl@6.6.0:
718
+ resolution: {integrity: sha512-EQql6eZYPhbHvJpqY4AwoiuLkUfXFRBHk67S8mDtzNo1F/jAo7xAxunIzO7gJ1vwTcPMgrK9b64dqKHvnkTlDQ==}
719
+ engines: {node: '>=16.14.0', npm: '>=8.1.0'}
720
+
721
+ mdn-data@2.27.1:
722
+ resolution: {integrity: sha512-9Yubnt3e8A0OKwxYSXyhLymGW4sCufcLG6VdiDdUGVkPhpqLxlvP5vl1983gQjJl3tqbrM731mjaZaP68AgosQ==}
723
+
724
+ min-indent@1.0.1:
725
+ resolution: {integrity: sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==}
726
+ engines: {node: '>=4'}
727
+
728
+ minimist@1.2.8:
729
+ resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==}
730
+
731
+ murmurhash-js@1.0.0:
732
+ resolution: {integrity: sha512-TvmkNhkv8yct0SVBSy+o8wYzXjE4Zz3PCesbfs8HiCXXdcTuocApFv11UWlNFWKYsP2okqrhb7JNlSm9InBhIw==}
733
+
734
+ nanoid@3.3.18:
735
+ resolution: {integrity: sha512-DTg4MJbGMWkfi6VZFdNt2/caMbQy4Ou+Op/hJQvGEWcnVfoA1QA+xzRKAzw9jD6+GVOOeYr/mIcuDSdug6F6+w==}
736
+ engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
737
+ hasBin: true
738
+
739
+ obug@2.1.4:
740
+ resolution: {integrity: sha512-4a+OsYv9UktOJKE+l1A4OufDgdRF9PifWj+tJnHURo/P+WOxpG4GzUFL9qCalmWauao6ogiG+QvnCovwPoyAWA==}
741
+ engines: {node: '>=12.20.0'}
742
+
743
+ oxlint@1.80.0:
744
+ resolution: {integrity: sha512-5nTiSps4qdbCWLbxzuO00alHkEO2exR9YMN/ig6QXWrLsYSG0KaObOAM+l6oU2LcKPWoSAGYbkZIGEu1ViiWKA==}
745
+ engines: {node: ^20.19.0 || >=22.12.0}
746
+ hasBin: true
747
+ peerDependencies:
748
+ oxlint-tsgolint: '>=7.0.2001'
749
+ vite-plus: '*'
750
+ peerDependenciesMeta:
751
+ oxlint-tsgolint:
752
+ optional: true
753
+ vite-plus:
754
+ optional: true
755
+
756
+ parse5@8.0.1:
757
+ resolution: {integrity: sha512-z1e/HMG90obSGeidlli3hj7cbocou0/wa5HacvI3ASx34PecNjNQeaHNo5WIZpWofN9kgkqV1q5YvXe3F0FoPw==}
758
+
759
+ pathe@2.0.3:
760
+ resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==}
761
+
762
+ pbf@5.1.2:
763
+ resolution: {integrity: sha512-mnvGdvOrIvJOBGUEdGkrVXjN8E/VkIJCkf2eS1DH2yv82ORUlLttmDt0rWY38yYZmVwciZwBUvHM20qxBZf40w==}
764
+ hasBin: true
765
+
766
+ picocolors@1.1.1:
767
+ resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==}
768
+
769
+ picomatch@4.0.7:
770
+ resolution: {integrity: sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==}
771
+ engines: {node: '>=12'}
772
+
773
+ playwright-core@1.62.1:
774
+ resolution: {integrity: sha512-wPYSwEBJY9GHraISXqyqtx0na0LpO3XEX7jNDhntbex7tzUS7kLnZsOlFruFJB4Hi/rhDMjXGqHewDZ68nYZVw==}
775
+ engines: {node: '>=20'}
776
+ hasBin: true
777
+
778
+ playwright@1.62.1:
779
+ resolution: {integrity: sha512-0M+L3LAD8/nm554LOla9Ayx0j0tmFZ0FBcoQ7F1VuVHpM/XpiC8RcDzBQB8W5+hA8L22THxELzeF+2WcUzvcLg==}
780
+ engines: {node: '>=20'}
781
+ hasBin: true
782
+
783
+ postcss@8.5.26:
784
+ resolution: {integrity: sha512-u82N74LFzG8ca+dD8puPnplTXoGH4fTPpVGuIbt36G3qvNlkvfD0lEAZSxaly3KX8TS/L1A1gsCEmvKmBcVbkQ==}
785
+ engines: {node: ^10 || ^12 || >=14}
786
+
787
+ potpack@2.1.0:
788
+ resolution: {integrity: sha512-pcaShQc1Shq0y+E7GqJqvZj8DTthWV1KeHGdi0Z6IAin2Oi3JnLCOfwnCo84qc+HAp52wT9nK9H7FAJp5a44GQ==}
789
+
790
+ pretty-format@27.5.1:
791
+ resolution: {integrity: sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==}
792
+ engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0}
793
+
794
+ protocol-buffers-schema@3.6.1:
795
+ resolution: {integrity: sha512-VG2K63Igkiv9p76tk1lilczEK1cT+kCjKtkdhw1dQZV3k3IXJbd3o6Ho8b9zJZaHSnT2hKe4I+ObmX9w6m5SmQ==}
796
+
797
+ punycode@2.3.1:
798
+ resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==}
799
+ engines: {node: '>=6'}
800
+
801
+ quickselect@3.0.0:
802
+ resolution: {integrity: sha512-XdjUArbK4Bm5fLLvlm5KpTFOiOThgfWWI4axAZDWg4E/0mKdZyI9tNEfds27qCi1ze/vwTR16kvmmGhRra3c2g==}
803
+
804
+ react-dom@19.2.8:
805
+ resolution: {integrity: sha512-rVprimfGBG3DR+Tq0IQG2DT5PxKth1WIGDmj5yPmlzr4YBe7uyE+Du4oVqTDXZSHGGGXRtTJEGSSePyQCMBglQ==}
806
+ peerDependencies:
807
+ react: ^19.2.8
808
+
809
+ react-is@17.0.2:
810
+ resolution: {integrity: sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==}
811
+
812
+ react@19.2.8:
813
+ resolution: {integrity: sha512-PWaYA1L/q9u2u7xYQi+Y3L3Yfnie7XyLeaJICV1MGD6LprsBxcAqGjYyr0eY3p+QdsA+x/Irkt4Qif8D63+Sbw==}
814
+ engines: {node: '>=0.10.0'}
815
+
816
+ redent@3.0.0:
817
+ resolution: {integrity: sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==}
818
+ engines: {node: '>=8'}
819
+
820
+ require-from-string@2.0.2:
821
+ resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==}
822
+ engines: {node: '>=0.10.0'}
823
+
824
+ resolve-protobuf-schema@2.1.0:
825
+ resolution: {integrity: sha512-kI5ffTiZWmJaS/huM8wZfEMer1eRd7oJQhDuxeCLe3t7N7mX3z94CN0xPxBQxFYQTSNz9T0i+v6inKqSdK8xrQ==}
826
+
827
+ rolldown@1.2.6:
828
+ resolution: {integrity: sha512-vMM4q3aixf46GiF1Kok8jDPFsEpXgFWGjUHXNkNHNm+Y2adXAG2dbX91jkti3i0ZRsOlcmbuzAz1poObSHCmUA==}
829
+ engines: {node: ^20.19.0 || >=22.12.0}
830
+ hasBin: true
831
+
832
+ saxes@6.0.0:
833
+ resolution: {integrity: sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==}
834
+ engines: {node: '>=v12.22.7'}
835
+
836
+ scheduler@0.27.0:
837
+ resolution: {integrity: sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==}
838
+
839
+ siginfo@2.0.0:
840
+ resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==}
841
+
842
+ source-map-js@1.2.1:
843
+ resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==}
844
+ engines: {node: '>=0.10.0'}
845
+
846
+ stackback@0.0.2:
847
+ resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==}
848
+
849
+ std-env@4.2.0:
850
+ resolution: {integrity: sha512-oCUKSupKTHX53EyjDtuZQ64pjLJ6yYCtpmEw0goYxtjG9KpbRe8KAsl2tBUGU9DyMcJ0RwJ8GqJAFzMXcXW1Rw==}
851
+
852
+ strip-indent@3.0.0:
853
+ resolution: {integrity: sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==}
854
+ engines: {node: '>=8'}
855
+
856
+ symbol-tree@3.2.4:
857
+ resolution: {integrity: sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==}
858
+
859
+ tinybench@2.9.0:
860
+ resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==}
861
+
862
+ tinyexec@1.3.0:
863
+ resolution: {integrity: sha512-QKAl9m8gWWGHV8jZcPeym6j+XULi6tOf1mT83WYJ4Lk2ytW/uwAWkrP0uFsdoYMdueVJ0qs26wZ+23xeB4ibNQ==}
864
+ engines: {node: '>=18'}
865
+
866
+ tinyglobby@0.2.17:
867
+ resolution: {integrity: sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==}
868
+ engines: {node: '>=12.0.0'}
869
+
870
+ tinyqueue@3.0.0:
871
+ resolution: {integrity: sha512-gRa9gwYU3ECmQYv3lslts5hxuIa90veaEcxDYuu3QGOIAEM2mOZkVHp48ANJuu1CURtRdHKUBY5Lm1tHV+sD4g==}
872
+
873
+ tinyrainbow@3.1.1:
874
+ resolution: {integrity: sha512-yau8yJdTt989Mm0Bd/236QnzEiPf2xLLTqUZRUJOo/3CB078LSwzei343DgtJVmfJKJE3TMINY1u42SQsP6mXw==}
875
+ engines: {node: '>=14.0.0'}
876
+
877
+ tldts-core@7.4.11:
878
+ resolution: {integrity: sha512-CW3WN2rIIE/Of21mulhgnGOwoDyEFNygyIBOONSdyAuSATgMMUCpLeUlB+E8sAwA5xRV9hYPl+kyZ9citHCaKg==}
879
+
880
+ tldts@7.4.11:
881
+ resolution: {integrity: sha512-aBiNayCfTQxuIJBm06M+xR14cYaYlDlSXZbgsnKzKNxDKUVq7KFwTjwBSsb7m9Y5xO8WfPnBc63WaYFMTGlvqw==}
882
+ hasBin: true
883
+
884
+ tough-cookie@6.0.2:
885
+ resolution: {integrity: sha512-exgYmnmL/sJpR3upZfXG5PoatXQii55xAiXGXzY+sROLZ/Y+SLcp9PgJNI9Vz37HpQ74WvDcLT8eqm+kV3FzrA==}
886
+ engines: {node: '>=16'}
887
+
888
+ tr46@6.0.0:
889
+ resolution: {integrity: sha512-bLVMLPtstlZ4iMQHpFHTR7GAGj2jxi8Dg0s2h2MafAE4uSWF98FC/3MomU51iQAMf8/qDUbKWf5GxuvvVcXEhw==}
890
+ engines: {node: '>=20'}
891
+
892
+ typescript@6.0.3:
893
+ resolution: {integrity: sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==}
894
+ engines: {node: '>=14.17'}
895
+ hasBin: true
896
+
897
+ undici-types@7.18.2:
898
+ resolution: {integrity: sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w==}
899
+
900
+ undici@8.10.0:
901
+ resolution: {integrity: sha512-HvltHd7avK13QIw/oLe4qoOLyoVSoafqJ2jYOrtMRBkbYT31eiBQ8O0ehRKZiEZCMEyLFQNIADpgCWC5fALvYQ==}
902
+ engines: {node: '>=22.19.0'}
903
+
904
+ vite@8.2.2:
905
+ resolution: {integrity: sha512-cFKLV/PRgAUlIRm5WjMjJ86jrftzpqcgH+Us+DS8mI3CDNiH30Whrz8uHL3+MOLPAgqbMBAqWdAHAphOAM+z/Q==}
906
+ engines: {node: ^20.19.0 || >=22.12.0}
907
+ hasBin: true
908
+ peerDependencies:
909
+ '@types/node': ^20.19.0 || >=22.12.0
910
+ '@vitejs/devtools': ^0.4.0 || ^0.5.0
911
+ esbuild: ^0.27.0 || ^0.28.0
912
+ jiti: '>=1.21.0'
913
+ less: ^4.0.0
914
+ sass: ^1.70.0
915
+ sass-embedded: ^1.70.0
916
+ stylus: '>=0.54.8'
917
+ sugarss: ^5.0.0
918
+ terser: ^5.16.0
919
+ tsx: ^4.8.1
920
+ yaml: ^2.4.2
921
+ peerDependenciesMeta:
922
+ '@types/node':
923
+ optional: true
924
+ '@vitejs/devtools':
925
+ optional: true
926
+ esbuild:
927
+ optional: true
928
+ jiti:
929
+ optional: true
930
+ less:
931
+ optional: true
932
+ sass:
933
+ optional: true
934
+ sass-embedded:
935
+ optional: true
936
+ stylus:
937
+ optional: true
938
+ sugarss:
939
+ optional: true
940
+ terser:
941
+ optional: true
942
+ tsx:
943
+ optional: true
944
+ yaml:
945
+ optional: true
946
+
947
+ vitest@4.1.11:
948
+ resolution: {integrity: sha512-fhACrNXUidIbGSBr5FlbuBkO7VWC1ZyLl0DO4CU2DrQoAPxX84Ysxs+HeGQpii5lZWV1Q4gBZTTu49mF+A6Edw==}
949
+ engines: {node: ^20.0.0 || ^22.0.0 || >=24.0.0}
950
+ hasBin: true
951
+ peerDependencies:
952
+ '@edge-runtime/vm': '*'
953
+ '@opentelemetry/api': ^1.9.0
954
+ '@types/node': ^20.0.0 || ^22.0.0 || >=24.0.0
955
+ '@vitest/browser-playwright': 4.1.11
956
+ '@vitest/browser-preview': 4.1.11
957
+ '@vitest/browser-webdriverio': 4.1.11
958
+ '@vitest/coverage-istanbul': 4.1.11
959
+ '@vitest/coverage-v8': 4.1.11
960
+ '@vitest/ui': 4.1.11
961
+ happy-dom: '*'
962
+ jsdom: '*'
963
+ vite: ^6.0.0 || ^7.0.0 || ^8.0.0
964
+ peerDependenciesMeta:
965
+ '@edge-runtime/vm':
966
+ optional: true
967
+ '@opentelemetry/api':
968
+ optional: true
969
+ '@types/node':
970
+ optional: true
971
+ '@vitest/browser-playwright':
972
+ optional: true
973
+ '@vitest/browser-preview':
974
+ optional: true
975
+ '@vitest/browser-webdriverio':
976
+ optional: true
977
+ '@vitest/coverage-istanbul':
978
+ optional: true
979
+ '@vitest/coverage-v8':
980
+ optional: true
981
+ '@vitest/ui':
982
+ optional: true
983
+ happy-dom:
984
+ optional: true
985
+ jsdom:
986
+ optional: true
987
+
988
+ w3c-xmlserializer@5.0.0:
989
+ resolution: {integrity: sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==}
990
+ engines: {node: '>=18'}
991
+
992
+ webidl-conversions@8.0.1:
993
+ resolution: {integrity: sha512-BMhLD/Sw+GbJC21C/UgyaZX41nPt8bUTg+jWyDeg7e7YN4xOM05YPSIXceACnXVtqyEw/LMClUQMtMZ+PGGpqQ==}
994
+ engines: {node: '>=20'}
995
+
996
+ whatwg-mimetype@5.0.0:
997
+ resolution: {integrity: sha512-sXcNcHOC51uPGF0P/D4NVtrkjSU2fNsm9iog4ZvZJsL3rjoDAzXZhkm2MWt1y+PUdggKAYVoMAIYcs78wJ51Cw==}
998
+ engines: {node: '>=20'}
999
+
1000
+ whatwg-url@16.0.1:
1001
+ resolution: {integrity: sha512-1to4zXBxmXHV3IiSSEInrreIlu02vUOvrhxJJH5vcxYTBDAx51cqZiKdyTxlecdKNSjj8EcxGBxNf6Vg+945gw==}
1002
+ engines: {node: ^20.19.0 || ^22.12.0 || >=24.0.0}
1003
+
1004
+ whatwg-url@17.1.0:
1005
+ resolution: {integrity: sha512-3GeworPmc2ZfEEHP7lEbUfBX/L75wdEsi0rLNhXcXxnoN5jyq0SL5gCy06SGW2cyTIZdTvWIDQNQoza++vKeaw==}
1006
+ engines: {node: ^22.14.0 || >=24.0.0}
1007
+
1008
+ why-is-node-running@2.3.0:
1009
+ resolution: {integrity: sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==}
1010
+ engines: {node: '>=8'}
1011
+ hasBin: true
1012
+
1013
+ xml-name-validator@5.0.0:
1014
+ resolution: {integrity: sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==}
1015
+ engines: {node: '>=18'}
1016
+
1017
+ xmlchars@2.2.0:
1018
+ resolution: {integrity: sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==}
1019
+
1020
+ snapshots:
1021
+
1022
+ '@adobe/css-tools@4.5.0': {}
1023
+
1024
+ '@asamuzakjp/css-color@6.0.7':
1025
+ dependencies:
1026
+ '@csstools/css-calc': 3.3.0(@csstools/css-parser-algorithms@4.0.0(@csstools/css-tokenizer@4.0.0))(@csstools/css-tokenizer@4.0.0)
1027
+ '@csstools/css-color-parser': 4.2.1(@csstools/css-parser-algorithms@4.0.0(@csstools/css-tokenizer@4.0.0))(@csstools/css-tokenizer@4.0.0)
1028
+ '@csstools/css-parser-algorithms': 4.0.0(@csstools/css-tokenizer@4.0.0)
1029
+ '@csstools/css-tokenizer': 4.0.0
1030
+ lru-cache: 11.5.2
1031
+
1032
+ '@asamuzakjp/dom-selector@8.3.2':
1033
+ dependencies:
1034
+ bidi-js: 1.0.3
1035
+ css-tree: 3.2.1
1036
+ is-potential-custom-element-name: 1.0.1
1037
+ lru-cache: 11.5.2
1038
+
1039
+ '@babel/code-frame@7.29.7':
1040
+ dependencies:
1041
+ '@babel/helper-validator-identifier': 7.29.7
1042
+ js-tokens: 4.0.0
1043
+ picocolors: 1.1.1
1044
+
1045
+ '@babel/helper-validator-identifier@7.29.7': {}
1046
+
1047
+ '@babel/runtime@7.29.7': {}
1048
+
1049
+ '@bramus/specificity@2.4.2':
1050
+ dependencies:
1051
+ css-tree: 3.2.1
1052
+
1053
+ '@csstools/color-helpers@6.1.1': {}
1054
+
1055
+ '@csstools/css-calc@3.3.0(@csstools/css-parser-algorithms@4.0.0(@csstools/css-tokenizer@4.0.0))(@csstools/css-tokenizer@4.0.0)':
1056
+ dependencies:
1057
+ '@csstools/css-parser-algorithms': 4.0.0(@csstools/css-tokenizer@4.0.0)
1058
+ '@csstools/css-tokenizer': 4.0.0
1059
+
1060
+ '@csstools/css-color-parser@4.2.1(@csstools/css-parser-algorithms@4.0.0(@csstools/css-tokenizer@4.0.0))(@csstools/css-tokenizer@4.0.0)':
1061
+ dependencies:
1062
+ '@csstools/color-helpers': 6.1.1
1063
+ '@csstools/css-calc': 3.3.0(@csstools/css-parser-algorithms@4.0.0(@csstools/css-tokenizer@4.0.0))(@csstools/css-tokenizer@4.0.0)
1064
+ '@csstools/css-parser-algorithms': 4.0.0(@csstools/css-tokenizer@4.0.0)
1065
+ '@csstools/css-tokenizer': 4.0.0
1066
+
1067
+ '@csstools/css-parser-algorithms@4.0.0(@csstools/css-tokenizer@4.0.0)':
1068
+ dependencies:
1069
+ '@csstools/css-tokenizer': 4.0.0
1070
+
1071
+ '@csstools/css-syntax-patches-for-csstree@1.1.9(css-tree@3.2.1)':
1072
+ optionalDependencies:
1073
+ css-tree: 3.2.1
1074
+
1075
+ '@csstools/css-tokenizer@4.0.0': {}
1076
+
1077
+ '@exodus/bytes@1.15.1': {}
1078
+
1079
+ '@jridgewell/sourcemap-codec@1.6.0': {}
1080
+
1081
+ '@mapbox/jsonlint-lines-primitives@2.0.3': {}
1082
+
1083
+ '@mapbox/point-geometry@1.1.0': {}
1084
+
1085
+ '@mapbox/tiny-sdf@2.2.0': {}
1086
+
1087
+ '@mapbox/unitbezier@1.0.0': {}
1088
+
1089
+ '@mapbox/vector-tile@3.0.0':
1090
+ dependencies:
1091
+ '@mapbox/point-geometry': 1.1.0
1092
+ '@types/geojson': 7946.0.16
1093
+ pbf: 5.1.2
1094
+
1095
+ '@maplibre/geojson-vt@6.1.1':
1096
+ dependencies:
1097
+ kdbush: 4.1.0
1098
+
1099
+ '@maplibre/maplibre-gl-style-spec@26.4.1':
1100
+ dependencies:
1101
+ '@mapbox/jsonlint-lines-primitives': 2.0.3
1102
+ '@mapbox/unitbezier': 1.0.0
1103
+ json-stringify-pretty-compact: 4.0.0
1104
+ minimist: 1.2.8
1105
+ quickselect: 3.0.0
1106
+ tinyqueue: 3.0.0
1107
+
1108
+ '@maplibre/mlt@1.2.0':
1109
+ dependencies:
1110
+ '@mapbox/point-geometry': 1.1.0
1111
+
1112
+ '@maplibre/vt-pbf@4.3.2':
1113
+ dependencies:
1114
+ '@mapbox/point-geometry': 1.1.0
1115
+ '@types/geojson': 7946.0.16
1116
+ pbf: 5.1.2
1117
+
1118
+ '@oxc-project/types@0.147.0': {}
1119
+
1120
+ '@oxlint/binding-android-arm-eabi@1.80.0':
1121
+ optional: true
1122
+
1123
+ '@oxlint/binding-android-arm64@1.80.0':
1124
+ optional: true
1125
+
1126
+ '@oxlint/binding-darwin-arm64@1.80.0':
1127
+ optional: true
1128
+
1129
+ '@oxlint/binding-darwin-x64@1.80.0':
1130
+ optional: true
1131
+
1132
+ '@oxlint/binding-freebsd-x64@1.80.0':
1133
+ optional: true
1134
+
1135
+ '@oxlint/binding-linux-arm-gnueabihf@1.80.0':
1136
+ optional: true
1137
+
1138
+ '@oxlint/binding-linux-arm-musleabihf@1.80.0':
1139
+ optional: true
1140
+
1141
+ '@oxlint/binding-linux-arm64-gnu@1.80.0':
1142
+ optional: true
1143
+
1144
+ '@oxlint/binding-linux-arm64-musl@1.80.0':
1145
+ optional: true
1146
+
1147
+ '@oxlint/binding-linux-ppc64-gnu@1.80.0':
1148
+ optional: true
1149
+
1150
+ '@oxlint/binding-linux-riscv64-gnu@1.80.0':
1151
+ optional: true
1152
+
1153
+ '@oxlint/binding-linux-riscv64-musl@1.80.0':
1154
+ optional: true
1155
+
1156
+ '@oxlint/binding-linux-s390x-gnu@1.80.0':
1157
+ optional: true
1158
+
1159
+ '@oxlint/binding-linux-x64-gnu@1.80.0':
1160
+ optional: true
1161
+
1162
+ '@oxlint/binding-linux-x64-musl@1.80.0':
1163
+ optional: true
1164
+
1165
+ '@oxlint/binding-openharmony-arm64@1.80.0':
1166
+ optional: true
1167
+
1168
+ '@oxlint/binding-win32-arm64-msvc@1.80.0':
1169
+ optional: true
1170
+
1171
+ '@oxlint/binding-win32-ia32-msvc@1.80.0':
1172
+ optional: true
1173
+
1174
+ '@oxlint/binding-win32-x64-msvc@1.80.0':
1175
+ optional: true
1176
+
1177
+ '@playwright/test@1.62.1':
1178
+ dependencies:
1179
+ playwright: 1.62.1
1180
+
1181
+ '@rolldown/binding-android-arm-eabi@1.2.6':
1182
+ optional: true
1183
+
1184
+ '@rolldown/binding-android-arm64@1.2.6':
1185
+ optional: true
1186
+
1187
+ '@rolldown/binding-darwin-arm64@1.2.6':
1188
+ optional: true
1189
+
1190
+ '@rolldown/binding-darwin-x64@1.2.6':
1191
+ optional: true
1192
+
1193
+ '@rolldown/binding-freebsd-x64@1.2.6':
1194
+ optional: true
1195
+
1196
+ '@rolldown/binding-linux-arm-gnueabihf@1.2.6':
1197
+ optional: true
1198
+
1199
+ '@rolldown/binding-linux-arm64-gnu@1.2.6':
1200
+ optional: true
1201
+
1202
+ '@rolldown/binding-linux-arm64-musl@1.2.6':
1203
+ optional: true
1204
+
1205
+ '@rolldown/binding-linux-ppc64-gnu@1.2.6':
1206
+ optional: true
1207
+
1208
+ '@rolldown/binding-linux-s390x-gnu@1.2.6':
1209
+ optional: true
1210
+
1211
+ '@rolldown/binding-linux-x64-gnu@1.2.6':
1212
+ optional: true
1213
+
1214
+ '@rolldown/binding-linux-x64-musl@1.2.6':
1215
+ optional: true
1216
+
1217
+ '@rolldown/binding-openharmony-arm64@1.2.6':
1218
+ optional: true
1219
+
1220
+ '@rolldown/binding-win32-arm64-msvc@1.2.6':
1221
+ optional: true
1222
+
1223
+ '@rolldown/binding-win32-x64-msvc@1.2.6':
1224
+ optional: true
1225
+
1226
+ '@rolldown/pluginutils@1.0.1': {}
1227
+
1228
+ '@standard-schema/spec@1.1.0': {}
1229
+
1230
+ '@testing-library/dom@10.4.1':
1231
+ dependencies:
1232
+ '@babel/code-frame': 7.29.7
1233
+ '@babel/runtime': 7.29.7
1234
+ '@types/aria-query': 5.0.4
1235
+ aria-query: 5.3.0
1236
+ dom-accessibility-api: 0.5.16
1237
+ lz-string: 1.5.0
1238
+ picocolors: 1.1.1
1239
+ pretty-format: 27.5.1
1240
+
1241
+ '@testing-library/jest-dom@7.0.1(@testing-library/dom@10.4.1)(vitest@4.1.11(@types/node@24.13.3)(jsdom@30.0.1)(vite@8.2.2(@types/node@24.13.3)))':
1242
+ dependencies:
1243
+ '@adobe/css-tools': 4.5.0
1244
+ '@testing-library/dom': 10.4.1
1245
+ aria-query: 5.3.2
1246
+ css.escape: 1.5.1
1247
+ dom-accessibility-api: 0.6.3
1248
+ picocolors: 1.1.1
1249
+ redent: 3.0.0
1250
+ optionalDependencies:
1251
+ vitest: 4.1.11(@types/node@24.13.3)(jsdom@30.0.1)(vite@8.2.2(@types/node@24.13.3))
1252
+
1253
+ '@testing-library/react@16.3.3(@testing-library/dom@10.4.1)(@types/react-dom@19.2.5(@types/react@19.2.18))(@types/react@19.2.18)(react-dom@19.2.8(react@19.2.8))(react@19.2.8)':
1254
+ dependencies:
1255
+ '@babel/runtime': 7.29.7
1256
+ '@testing-library/dom': 10.4.1
1257
+ react: 19.2.8
1258
+ react-dom: 19.2.8(react@19.2.8)
1259
+ optionalDependencies:
1260
+ '@types/react': 19.2.18
1261
+ '@types/react-dom': 19.2.5(@types/react@19.2.18)
1262
+
1263
+ '@types/aria-query@5.0.4': {}
1264
+
1265
+ '@types/chai@5.2.3':
1266
+ dependencies:
1267
+ '@types/deep-eql': 4.0.2
1268
+ assertion-error: 2.0.1
1269
+
1270
+ '@types/deep-eql@4.0.2': {}
1271
+
1272
+ '@types/estree@1.0.9': {}
1273
+
1274
+ '@types/geojson@7946.0.16': {}
1275
+
1276
+ '@types/node@24.13.3':
1277
+ dependencies:
1278
+ undici-types: 7.18.2
1279
+
1280
+ '@types/react-dom@19.2.5(@types/react@19.2.18)':
1281
+ dependencies:
1282
+ '@types/react': 19.2.18
1283
+
1284
+ '@types/react@19.2.18':
1285
+ dependencies:
1286
+ csstype: 3.2.3
1287
+
1288
+ '@vitejs/plugin-react@6.1.1(vite@8.2.2(@types/node@24.13.3))':
1289
+ dependencies:
1290
+ '@rolldown/pluginutils': 1.0.1
1291
+ vite: 8.2.2(@types/node@24.13.3)
1292
+
1293
+ '@vitest/expect@4.1.11':
1294
+ dependencies:
1295
+ '@standard-schema/spec': 1.1.0
1296
+ '@types/chai': 5.2.3
1297
+ '@vitest/spy': 4.1.11
1298
+ '@vitest/utils': 4.1.11
1299
+ chai: 6.2.2
1300
+ tinyrainbow: 3.1.1
1301
+
1302
+ '@vitest/mocker@4.1.11(vite@8.2.2(@types/node@24.13.3))':
1303
+ dependencies:
1304
+ '@vitest/spy': 4.1.11
1305
+ estree-walker: 3.0.3
1306
+ magic-string: 0.30.21
1307
+ optionalDependencies:
1308
+ vite: 8.2.2(@types/node@24.13.3)
1309
+
1310
+ '@vitest/pretty-format@4.1.11':
1311
+ dependencies:
1312
+ tinyrainbow: 3.1.1
1313
+
1314
+ '@vitest/runner@4.1.11':
1315
+ dependencies:
1316
+ '@vitest/utils': 4.1.11
1317
+ pathe: 2.0.3
1318
+
1319
+ '@vitest/snapshot@4.1.11':
1320
+ dependencies:
1321
+ '@vitest/pretty-format': 4.1.11
1322
+ '@vitest/utils': 4.1.11
1323
+ magic-string: 0.30.21
1324
+ pathe: 2.0.3
1325
+
1326
+ '@vitest/spy@4.1.11': {}
1327
+
1328
+ '@vitest/utils@4.1.11':
1329
+ dependencies:
1330
+ '@vitest/pretty-format': 4.1.11
1331
+ convert-source-map: 2.0.0
1332
+ tinyrainbow: 3.1.1
1333
+
1334
+ ansi-regex@5.0.1: {}
1335
+
1336
+ ansi-styles@5.2.0: {}
1337
+
1338
+ aria-query@5.3.0:
1339
+ dependencies:
1340
+ dequal: 2.0.3
1341
+
1342
+ aria-query@5.3.2: {}
1343
+
1344
+ assertion-error@2.0.1: {}
1345
+
1346
+ bidi-js@1.0.3:
1347
+ dependencies:
1348
+ require-from-string: 2.0.2
1349
+
1350
+ chai@6.2.2: {}
1351
+
1352
+ convert-source-map@2.0.0: {}
1353
+
1354
+ css-tree@3.2.1:
1355
+ dependencies:
1356
+ mdn-data: 2.27.1
1357
+ source-map-js: 1.2.1
1358
+
1359
+ css.escape@1.5.1: {}
1360
+
1361
+ csstype@3.2.3: {}
1362
+
1363
+ data-urls@7.0.0:
1364
+ dependencies:
1365
+ whatwg-mimetype: 5.0.0
1366
+ whatwg-url: 16.0.1
1367
+ transitivePeerDependencies:
1368
+ - '@noble/hashes'
1369
+
1370
+ decimal.js@10.6.0: {}
1371
+
1372
+ dequal@2.0.3: {}
1373
+
1374
+ detect-libc@2.1.2: {}
1375
+
1376
+ dom-accessibility-api@0.5.16: {}
1377
+
1378
+ dom-accessibility-api@0.6.3: {}
1379
+
1380
+ earcut@3.2.3: {}
1381
+
1382
+ entities@8.0.0: {}
1383
+
1384
+ es-module-lexer@2.3.2: {}
1385
+
1386
+ estree-walker@3.0.3:
1387
+ dependencies:
1388
+ '@types/estree': 1.0.9
1389
+
1390
+ expect-type@1.4.0: {}
1391
+
1392
+ fdir@6.5.0(picomatch@4.0.7):
1393
+ optionalDependencies:
1394
+ picomatch: 4.0.7
1395
+
1396
+ fsevents@2.3.2:
1397
+ optional: true
1398
+
1399
+ fsevents@2.3.3:
1400
+ optional: true
1401
+
1402
+ gl-matrix@3.4.4: {}
1403
+
1404
+ html-encoding-sniffer@6.0.0:
1405
+ dependencies:
1406
+ '@exodus/bytes': 1.15.1
1407
+ transitivePeerDependencies:
1408
+ - '@noble/hashes'
1409
+
1410
+ indent-string@4.0.0: {}
1411
+
1412
+ is-potential-custom-element-name@1.0.1: {}
1413
+
1414
+ js-tokens@4.0.0: {}
1415
+
1416
+ jsdom@30.0.1:
1417
+ dependencies:
1418
+ '@asamuzakjp/css-color': 6.0.7
1419
+ '@asamuzakjp/dom-selector': 8.3.2
1420
+ '@bramus/specificity': 2.4.2
1421
+ '@csstools/css-syntax-patches-for-csstree': 1.1.9(css-tree@3.2.1)
1422
+ '@exodus/bytes': 1.15.1
1423
+ css-tree: 3.2.1
1424
+ data-urls: 7.0.0
1425
+ decimal.js: 10.6.0
1426
+ html-encoding-sniffer: 6.0.0
1427
+ is-potential-custom-element-name: 1.0.1
1428
+ lru-cache: 11.5.2
1429
+ parse5: 8.0.1
1430
+ saxes: 6.0.0
1431
+ symbol-tree: 3.2.4
1432
+ tough-cookie: 6.0.2
1433
+ undici: 8.10.0
1434
+ w3c-xmlserializer: 5.0.0
1435
+ webidl-conversions: 8.0.1
1436
+ whatwg-mimetype: 5.0.0
1437
+ whatwg-url: 17.1.0
1438
+ xml-name-validator: 5.0.0
1439
+ transitivePeerDependencies:
1440
+ - '@noble/hashes'
1441
+
1442
+ json-stringify-pretty-compact@4.0.0: {}
1443
+
1444
+ kdbush@4.1.0: {}
1445
+
1446
+ lightningcss-android-arm64@1.33.0:
1447
+ optional: true
1448
+
1449
+ lightningcss-darwin-arm64@1.33.0:
1450
+ optional: true
1451
+
1452
+ lightningcss-darwin-x64@1.33.0:
1453
+ optional: true
1454
+
1455
+ lightningcss-freebsd-x64@1.33.0:
1456
+ optional: true
1457
+
1458
+ lightningcss-linux-arm-gnueabihf@1.33.0:
1459
+ optional: true
1460
+
1461
+ lightningcss-linux-arm64-gnu@1.33.0:
1462
+ optional: true
1463
+
1464
+ lightningcss-linux-arm64-musl@1.33.0:
1465
+ optional: true
1466
+
1467
+ lightningcss-linux-x64-gnu@1.33.0:
1468
+ optional: true
1469
+
1470
+ lightningcss-linux-x64-musl@1.33.0:
1471
+ optional: true
1472
+
1473
+ lightningcss-win32-arm64-msvc@1.33.0:
1474
+ optional: true
1475
+
1476
+ lightningcss-win32-x64-msvc@1.33.0:
1477
+ optional: true
1478
+
1479
+ lightningcss@1.33.0:
1480
+ dependencies:
1481
+ detect-libc: 2.1.2
1482
+ optionalDependencies:
1483
+ lightningcss-android-arm64: 1.33.0
1484
+ lightningcss-darwin-arm64: 1.33.0
1485
+ lightningcss-darwin-x64: 1.33.0
1486
+ lightningcss-freebsd-x64: 1.33.0
1487
+ lightningcss-linux-arm-gnueabihf: 1.33.0
1488
+ lightningcss-linux-arm64-gnu: 1.33.0
1489
+ lightningcss-linux-arm64-musl: 1.33.0
1490
+ lightningcss-linux-x64-gnu: 1.33.0
1491
+ lightningcss-linux-x64-musl: 1.33.0
1492
+ lightningcss-win32-arm64-msvc: 1.33.0
1493
+ lightningcss-win32-x64-msvc: 1.33.0
1494
+
1495
+ lru-cache@11.5.2: {}
1496
+
1497
+ lucide-react@1.35.0(react@19.2.8):
1498
+ dependencies:
1499
+ react: 19.2.8
1500
+
1501
+ lz-string@1.5.0: {}
1502
+
1503
+ magic-string@0.30.21:
1504
+ dependencies:
1505
+ '@jridgewell/sourcemap-codec': 1.6.0
1506
+
1507
+ maplibre-gl@6.6.0:
1508
+ dependencies:
1509
+ '@mapbox/point-geometry': 1.1.0
1510
+ '@mapbox/tiny-sdf': 2.2.0
1511
+ '@mapbox/unitbezier': 1.0.0
1512
+ '@mapbox/vector-tile': 3.0.0
1513
+ '@maplibre/geojson-vt': 6.1.1
1514
+ '@maplibre/maplibre-gl-style-spec': 26.4.1
1515
+ '@maplibre/mlt': 1.2.0
1516
+ '@maplibre/vt-pbf': 4.3.2
1517
+ '@types/geojson': 7946.0.16
1518
+ earcut: 3.2.3
1519
+ gl-matrix: 3.4.4
1520
+ kdbush: 4.1.0
1521
+ murmurhash-js: 1.0.0
1522
+ pbf: 5.1.2
1523
+ potpack: 2.1.0
1524
+ quickselect: 3.0.0
1525
+ tinyqueue: 3.0.0
1526
+
1527
+ mdn-data@2.27.1: {}
1528
+
1529
+ min-indent@1.0.1: {}
1530
+
1531
+ minimist@1.2.8: {}
1532
+
1533
+ murmurhash-js@1.0.0: {}
1534
+
1535
+ nanoid@3.3.18: {}
1536
+
1537
+ obug@2.1.4: {}
1538
+
1539
+ oxlint@1.80.0:
1540
+ optionalDependencies:
1541
+ '@oxlint/binding-android-arm-eabi': 1.80.0
1542
+ '@oxlint/binding-android-arm64': 1.80.0
1543
+ '@oxlint/binding-darwin-arm64': 1.80.0
1544
+ '@oxlint/binding-darwin-x64': 1.80.0
1545
+ '@oxlint/binding-freebsd-x64': 1.80.0
1546
+ '@oxlint/binding-linux-arm-gnueabihf': 1.80.0
1547
+ '@oxlint/binding-linux-arm-musleabihf': 1.80.0
1548
+ '@oxlint/binding-linux-arm64-gnu': 1.80.0
1549
+ '@oxlint/binding-linux-arm64-musl': 1.80.0
1550
+ '@oxlint/binding-linux-ppc64-gnu': 1.80.0
1551
+ '@oxlint/binding-linux-riscv64-gnu': 1.80.0
1552
+ '@oxlint/binding-linux-riscv64-musl': 1.80.0
1553
+ '@oxlint/binding-linux-s390x-gnu': 1.80.0
1554
+ '@oxlint/binding-linux-x64-gnu': 1.80.0
1555
+ '@oxlint/binding-linux-x64-musl': 1.80.0
1556
+ '@oxlint/binding-openharmony-arm64': 1.80.0
1557
+ '@oxlint/binding-win32-arm64-msvc': 1.80.0
1558
+ '@oxlint/binding-win32-ia32-msvc': 1.80.0
1559
+ '@oxlint/binding-win32-x64-msvc': 1.80.0
1560
+
1561
+ parse5@8.0.1:
1562
+ dependencies:
1563
+ entities: 8.0.0
1564
+
1565
+ pathe@2.0.3: {}
1566
+
1567
+ pbf@5.1.2:
1568
+ dependencies:
1569
+ resolve-protobuf-schema: 2.1.0
1570
+
1571
+ picocolors@1.1.1: {}
1572
+
1573
+ picomatch@4.0.7: {}
1574
+
1575
+ playwright-core@1.62.1: {}
1576
+
1577
+ playwright@1.62.1:
1578
+ dependencies:
1579
+ playwright-core: 1.62.1
1580
+ optionalDependencies:
1581
+ fsevents: 2.3.2
1582
+
1583
+ postcss@8.5.26:
1584
+ dependencies:
1585
+ nanoid: 3.3.18
1586
+ picocolors: 1.1.1
1587
+ source-map-js: 1.2.1
1588
+
1589
+ potpack@2.1.0: {}
1590
+
1591
+ pretty-format@27.5.1:
1592
+ dependencies:
1593
+ ansi-regex: 5.0.1
1594
+ ansi-styles: 5.2.0
1595
+ react-is: 17.0.2
1596
+
1597
+ protocol-buffers-schema@3.6.1: {}
1598
+
1599
+ punycode@2.3.1: {}
1600
+
1601
+ quickselect@3.0.0: {}
1602
+
1603
+ react-dom@19.2.8(react@19.2.8):
1604
+ dependencies:
1605
+ react: 19.2.8
1606
+ scheduler: 0.27.0
1607
+
1608
+ react-is@17.0.2: {}
1609
+
1610
+ react@19.2.8: {}
1611
+
1612
+ redent@3.0.0:
1613
+ dependencies:
1614
+ indent-string: 4.0.0
1615
+ strip-indent: 3.0.0
1616
+
1617
+ require-from-string@2.0.2: {}
1618
+
1619
+ resolve-protobuf-schema@2.1.0:
1620
+ dependencies:
1621
+ protocol-buffers-schema: 3.6.1
1622
+
1623
+ rolldown@1.2.6:
1624
+ dependencies:
1625
+ '@oxc-project/types': 0.147.0
1626
+ '@rolldown/pluginutils': 1.0.1
1627
+ optionalDependencies:
1628
+ '@rolldown/binding-android-arm-eabi': 1.2.6
1629
+ '@rolldown/binding-android-arm64': 1.2.6
1630
+ '@rolldown/binding-darwin-arm64': 1.2.6
1631
+ '@rolldown/binding-darwin-x64': 1.2.6
1632
+ '@rolldown/binding-freebsd-x64': 1.2.6
1633
+ '@rolldown/binding-linux-arm-gnueabihf': 1.2.6
1634
+ '@rolldown/binding-linux-arm64-gnu': 1.2.6
1635
+ '@rolldown/binding-linux-arm64-musl': 1.2.6
1636
+ '@rolldown/binding-linux-ppc64-gnu': 1.2.6
1637
+ '@rolldown/binding-linux-s390x-gnu': 1.2.6
1638
+ '@rolldown/binding-linux-x64-gnu': 1.2.6
1639
+ '@rolldown/binding-linux-x64-musl': 1.2.6
1640
+ '@rolldown/binding-openharmony-arm64': 1.2.6
1641
+ '@rolldown/binding-win32-arm64-msvc': 1.2.6
1642
+ '@rolldown/binding-win32-x64-msvc': 1.2.6
1643
+
1644
+ saxes@6.0.0:
1645
+ dependencies:
1646
+ xmlchars: 2.2.0
1647
+
1648
+ scheduler@0.27.0: {}
1649
+
1650
+ siginfo@2.0.0: {}
1651
+
1652
+ source-map-js@1.2.1: {}
1653
+
1654
+ stackback@0.0.2: {}
1655
+
1656
+ std-env@4.2.0: {}
1657
+
1658
+ strip-indent@3.0.0:
1659
+ dependencies:
1660
+ min-indent: 1.0.1
1661
+
1662
+ symbol-tree@3.2.4: {}
1663
+
1664
+ tinybench@2.9.0: {}
1665
+
1666
+ tinyexec@1.3.0: {}
1667
+
1668
+ tinyglobby@0.2.17:
1669
+ dependencies:
1670
+ fdir: 6.5.0(picomatch@4.0.7)
1671
+ picomatch: 4.0.7
1672
+
1673
+ tinyqueue@3.0.0: {}
1674
+
1675
+ tinyrainbow@3.1.1: {}
1676
+
1677
+ tldts-core@7.4.11: {}
1678
+
1679
+ tldts@7.4.11:
1680
+ dependencies:
1681
+ tldts-core: 7.4.11
1682
+
1683
+ tough-cookie@6.0.2:
1684
+ dependencies:
1685
+ tldts: 7.4.11
1686
+
1687
+ tr46@6.0.0:
1688
+ dependencies:
1689
+ punycode: 2.3.1
1690
+
1691
+ typescript@6.0.3: {}
1692
+
1693
+ undici-types@7.18.2: {}
1694
+
1695
+ undici@8.10.0: {}
1696
+
1697
+ vite@8.2.2(@types/node@24.13.3):
1698
+ dependencies:
1699
+ lightningcss: 1.33.0
1700
+ picomatch: 4.0.7
1701
+ postcss: 8.5.26
1702
+ rolldown: 1.2.6
1703
+ tinyglobby: 0.2.17
1704
+ optionalDependencies:
1705
+ '@types/node': 24.13.3
1706
+ fsevents: 2.3.3
1707
+
1708
+ vitest@4.1.11(@types/node@24.13.3)(jsdom@30.0.1)(vite@8.2.2(@types/node@24.13.3)):
1709
+ dependencies:
1710
+ '@vitest/expect': 4.1.11
1711
+ '@vitest/mocker': 4.1.11(vite@8.2.2(@types/node@24.13.3))
1712
+ '@vitest/pretty-format': 4.1.11
1713
+ '@vitest/runner': 4.1.11
1714
+ '@vitest/snapshot': 4.1.11
1715
+ '@vitest/spy': 4.1.11
1716
+ '@vitest/utils': 4.1.11
1717
+ es-module-lexer: 2.3.2
1718
+ expect-type: 1.4.0
1719
+ magic-string: 0.30.21
1720
+ obug: 2.1.4
1721
+ pathe: 2.0.3
1722
+ picomatch: 4.0.7
1723
+ std-env: 4.2.0
1724
+ tinybench: 2.9.0
1725
+ tinyexec: 1.3.0
1726
+ tinyglobby: 0.2.17
1727
+ tinyrainbow: 3.1.1
1728
+ vite: 8.2.2(@types/node@24.13.3)
1729
+ why-is-node-running: 2.3.0
1730
+ optionalDependencies:
1731
+ '@types/node': 24.13.3
1732
+ jsdom: 30.0.1
1733
+ transitivePeerDependencies:
1734
+ - msw
1735
+
1736
+ w3c-xmlserializer@5.0.0:
1737
+ dependencies:
1738
+ xml-name-validator: 5.0.0
1739
+
1740
+ webidl-conversions@8.0.1: {}
1741
+
1742
+ whatwg-mimetype@5.0.0: {}
1743
+
1744
+ whatwg-url@16.0.1:
1745
+ dependencies:
1746
+ '@exodus/bytes': 1.15.1
1747
+ tr46: 6.0.0
1748
+ webidl-conversions: 8.0.1
1749
+ transitivePeerDependencies:
1750
+ - '@noble/hashes'
1751
+
1752
+ whatwg-url@17.1.0:
1753
+ dependencies:
1754
+ '@exodus/bytes': 1.15.1
1755
+ tr46: 6.0.0
1756
+ webidl-conversions: 8.0.1
1757
+ transitivePeerDependencies:
1758
+ - '@noble/hashes'
1759
+
1760
+ why-is-node-running@2.3.0:
1761
+ dependencies:
1762
+ siginfo: 2.0.0
1763
+ stackback: 0.0.2
1764
+
1765
+ xml-name-validator@5.0.0: {}
1766
+
1767
+ xmlchars@2.2.0: {}
public/IMG_2953.JPG → frontend/public/sample-poster.webp RENAMED
File without changes
frontend/public/style-previews/autumn.webp ADDED
frontend/public/style-previews/blueprint.webp ADDED
frontend/public/style-previews/contrast_zones.webp ADDED
frontend/public/style-previews/copper_patina.webp ADDED
frontend/public/style-previews/feature_based.webp ADDED
frontend/public/style-previews/forest.webp ADDED
frontend/public/style-previews/gradient_roads.webp ADDED
frontend/public/style-previews/japanese_ink.webp ADDED
frontend/public/style-previews/midnight_blue.webp ADDED
frontend/public/style-previews/monochrome_blue.webp ADDED
frontend/public/style-previews/neon_cyberpunk.webp ADDED
frontend/public/style-previews/noir.webp ADDED
frontend/public/style-previews/ocean.webp ADDED
frontend/public/style-previews/pastel_dream.webp ADDED
frontend/public/style-previews/sunset.webp ADDED
frontend/public/style-previews/terracotta.webp ADDED
frontend/public/style-previews/warm_beige.webp ADDED
frontend/src/App.css ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ :root {
2
+ --page: #f4f5f7; --surface: #fff; --poster: #f6f4ef; --text: #17191d; --muted: #6f7785;
3
+ --subtle: #8c95a3; --border: #d9dee6; --border-soft: #e8ebef; --accent: #3479df;
4
+ --export: #405a78; --success: #2a8d62; --danger: #b42318; --header: 58px; --sidebar: 345px;
5
+ --poster-shadow: 0 10px 24px rgba(24,29,35,.18);
6
+ }
7
+ .app-shell { width: 100vw; height: 100vh; overflow: hidden; background: var(--page); }
8
+ .topbar { position: fixed; z-index: 40; inset: 0 0 auto 0; height: var(--header); background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 18px 0 22px; }
9
+ .brand { color: var(--text); text-decoration: none; font-size: 21px; font-weight: 650; letter-spacing: -.04em; }
10
+ .topbar-tools, .export-group { display: flex; align-items: center; position: relative; }
11
+ .topbar-tools { gap: 5px; }
12
+ button { border: 0; background: transparent; cursor: pointer; }
13
+ button:disabled { cursor: not-allowed; opacity: .38; }
14
+ .icon-button { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 4px; }
15
+ .icon-button:hover, .quiet-button:hover { background: var(--page); }
16
+ .quiet-button { height: 34px; padding: 0 10px; display: flex; align-items: center; gap: 7px; border-radius: 4px; font-size: 13px; }
17
+ .export-group { margin-left: 9px; color: #fff; }
18
+ .export-primary, .export-toggle { height: 36px; color: #fff; background: var(--export); display: flex; align-items: center; justify-content: center; }
19
+ .export-primary { gap: 7px; min-width: 91px; padding: 0 14px; border-radius: 5px 0 0 5px; font-size: 13px; font-weight: 600; }
20
+ .export-toggle { width: 32px; border-left: 1px solid rgba(255,255,255,.2); border-radius: 0 5px 5px 0; }
21
+ .export-primary:hover, .export-toggle:hover { background: #324b66; }
22
+ .export-menu { position: absolute; z-index: 80; right: 0; top: 43px; width: 190px; padding: 5px; border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 10px 28px rgba(25,32,45,.15); background: #fff; color: var(--text); }
23
+ .export-menu button { width: 100%; padding: 9px 10px; text-align: left; border-radius: 4px; font-size: 13px; }
24
+ .export-menu button:hover { background: var(--page); }
25
+ .sidebar { position: fixed; z-index: 20; left: 0; top: var(--header); bottom: 0; width: var(--sidebar); overflow-y: auto; background: var(--surface); border-right: 1px solid var(--border); }
26
+ .editor-section { border-bottom: 1px solid var(--border-soft); }
27
+ .section-heading { width: 100%; height: 52px; padding: 0 18px; display: flex; justify-content: space-between; align-items: center; font-weight: 620; font-size: 14px; background: #fff; }
28
+ .section-heading:hover { background: #fafbfc; }
29
+ .section-content { padding: 0 18px 18px; }
30
+ .search-box { display: flex; align-items: center; height: 38px; gap: 7px; padding-left: 10px; border: 1px solid var(--border); border-radius: 4px; background: #fff; }
31
+ .search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(52,121,223,.1); }
32
+ .search-box input { min-width: 0; flex: 1; border: 0; outline: 0; color: var(--text); font-size: 13px; }
33
+ .search-box .icon-button { width: 28px; height: 28px; }
34
+ .search-submit { align-self: stretch; padding: 0 10px; border-left: 1px solid var(--border); color: var(--accent); font-size: 12px; font-weight: 600; }
35
+ .search-results { position: relative; z-index: 30; max-height: 180px; margin-top: 5px; overflow: auto; border: 1px solid var(--border); border-radius: 4px; box-shadow: 0 6px 15px rgba(20,28,40,.1); }
36
+ .search-results button { width: 100%; display: flex; gap: 8px; padding: 9px; text-align: left; background: #fff; border-bottom: 1px solid var(--border-soft); }
37
+ .search-results button:hover { background: var(--page); }
38
+ .search-results span, .selected-place > span:last-child { min-width: 0; display: grid; gap: 2px; }
39
+ .search-results strong, .selected-place strong { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
40
+ .search-results small, .selected-place small { color: var(--muted); font-size: 11px; }
41
+ .selected-place { display: flex; align-items: center; gap: 9px; margin: 11px 0; padding: 9px; border: 1px solid var(--border-soft); border-radius: 4px; }
42
+ .selected-place .pin { width: 30px; height: 30px; flex: none; display: grid; place-items: center; color: var(--accent); background: #edf4ff; border-radius: 50%; }
43
+ .map-viewport { width: 100%; height: 176px; overflow: hidden; border: 1px solid var(--border); border-radius: 4px; }
44
+ .field-help { margin: 8px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
45
+ .style-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
46
+ .style-card { position: relative; min-width: 0; padding: 4px; border: 1px solid var(--border); border-radius: 5px; text-align: left; font-size: 10px; background: #fff; }
47
+ .style-card:hover { border-color: #9fbce5; }
48
+ .style-card.is-selected { border: 2px solid var(--accent); padding: 3px; }
49
+ .style-card > span:last-of-type { display: block; padding: 6px 2px 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
50
+ .style-card b { position: absolute; right: -5px; top: -5px; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: #fff; }
51
+ .style-preview { position: relative; display: block; width: 100%; aspect-ratio: 1.28; overflow: hidden; border-radius: 2px; }
52
+ .style-preview img { width: 100%; height: 100%; object-fit: cover; }
53
+ .style-preview i { position: absolute; left: 10%; width: 85%; height: 1px; background: currentColor; opacity: .6; transform: rotate(-17deg); }
54
+ .style-preview i:nth-of-type(1) { top: 25%; }.style-preview i:nth-of-type(2) { top: 50%; transform: rotate(13deg); }.style-preview i:nth-of-type(3) { top: 70%; transform: rotate(-4deg); }
55
+ .subheading { margin: 19px 0 8px; display: flex; justify-content: space-between; font-size: 12px; font-weight: 650; }
56
+ .subheading button { color: var(--accent); font-size: 11px; }
57
+ .color-list { display: grid; gap: 2px; }
58
+ .color-field { min-height: 36px; display: flex; align-items: center; justify-content: space-between; font-size: 12px; }
59
+ .color-control { display: flex; align-items: center; gap: 7px; }
60
+ .color-control input { width: 24px; height: 24px; padding: 0; border: 1px solid var(--border); border-radius: 4px; background: #fff; }
61
+ .color-control code { width: 60px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, monospace; font-size: 10px; }
62
+ .field, .range-field { display: grid; gap: 6px; color: var(--muted); font-size: 11px; }
63
+ .field input, .field select { width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: 4px; background: #fff; color: var(--text); font-size: 12px; }
64
+ .style-grid + .field { margin-top: 12px; }
65
+ .form-stack { display: grid; gap: 12px; }.two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
66
+ .range-field > span { display: flex; justify-content: space-between; }.range-field input { accent-color: var(--accent); }
67
+ .check-field { display: flex; align-items: center; gap: 8px; font-size: 12px; }.check-field input { accent-color: var(--accent); }
68
+ .choice-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
69
+ .choice-grid button { height: 72px; display: grid; place-items: center; gap: 3px; border: 1px solid var(--border); border-radius: 4px; background: #fff; font-size: 10px; text-transform: capitalize; }
70
+ .choice-grid button.is-selected, .size-grid button.is-selected { border: 2px solid var(--accent); color: var(--accent); }
71
+ .layout-glyph { width: 29px; height: 38px; position: relative; border: 1px solid currentColor; opacity: .8; }
72
+ .layout-glyph::before, .layout-glyph::after { content: ''; position: absolute; height: 2px; background: currentColor; }
73
+ .layout-glyph::before { left: 5px; right: 5px; bottom: 9px; }.layout-glyph::after { left: 8px; right: 8px; bottom: 5px; }
74
+ .layout-glyph.editorial::before, .layout-glyph.editorial::after, .layout-glyph.minimal::before, .layout-glyph.minimal::after, .layout-glyph.bottom_left::before, .layout-glyph.bottom_left::after { left: 3px; right: 11px; }
75
+ .layout-glyph.centered::before { bottom: 20px; }.layout-glyph.centered::after { bottom: 15px; }
76
+ .toggle-list { display: grid; }.toggle-list label { height: 39px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border-soft); font-size: 12px; text-transform: capitalize; }.toggle-list input { accent-color: var(--accent); }
77
+ .size-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }.size-grid button { min-height: 68px; display: grid; place-items: center; align-content: center; gap: 4px; border: 1px solid var(--border); border-radius: 4px; background: #fff; font-size: 10px; }
78
+ .size-shape { width: 19px; height: 25px; border: 1px solid currentColor; }.size-shape[data-ratio="1:1"] { height: 19px; }.size-shape[data-ratio="4:5"] { height: 24px; }.size-shape[data-ratio="2:3"] { height: 28px; }.size-shape[data-ratio="9:16"] { width: 16px; height: 28px; }
79
+ .workspace { position: fixed; inset: var(--header) 0 0 var(--sidebar); display: grid; grid-template-rows: minmax(0, 1fr) 30px 58px; background: var(--page); }
80
+ .canvas-stage { min-height: 0; overflow: auto; display: grid; place-items: center; padding: 30px; }
81
+ .poster-frame { position: relative; height: min(700px, calc(100vh - 190px)); max-width: 72%; background: var(--poster); border: 8px solid var(--poster); outline: 1px solid rgba(0,0,0,.65); box-shadow: var(--poster-shadow); transform-origin: center; transition: transform .16s ease, aspect-ratio .2s ease; }
82
+ .poster-frame img { width: 100%; height: 100%; display: block; object-fit: contain; background: var(--poster); }
83
+ .preview-loading { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; color: var(--text); background: rgba(246,244,239,.78); font-size: 12px; backdrop-filter: blur(2px); }
84
+ .preview-status { display: flex; align-items: center; justify-content: flex-end; gap: 6px; padding-right: 20px; color: var(--muted); font-size: 11px; }.preview-status.success { color: var(--success); }.preview-status.error { color: var(--danger); }
85
+ .canvas-toolbar { height: 58px; display: flex; align-items: center; justify-content: center; gap: 8px; border-top: 1px solid var(--border); background: rgba(255,255,255,.95); }
86
+ .tool-group { height: 34px; display: flex; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; background: #fff; }.tool-group button { width: 34px; display: grid; place-items: center; border-right: 1px solid var(--border-soft); }.tool-group button:last-child { border-right: 0; }.zoom-controls output { width: 52px; display: grid; place-items: center; font-size: 11px; }
87
+ .fit-button { height: 34px; padding: 0 15px; border: 1px solid var(--border); border-radius: 4px; background: #fff; font-size: 11px; }
88
+ .mobile-tabs, .mobile-sheet { display: none; }
89
+ .spin { animation: spin .9s linear infinite; } @keyframes spin { to { transform: rotate(360deg); } }
90
+
91
+ @media (max-width: 900px) and (min-width: 768px) { :root { --sidebar: 310px; }.style-grid { grid-template-columns: repeat(2,1fr); }.poster-frame { max-width: 85%; } }
92
+
93
+ @media (max-width: 767px) {
94
+ .app-shell { display: flex; flex-direction: column; height: auto; min-height: 100vh; overflow: visible; padding-bottom: 64px; }
95
+ .topbar { position: sticky; height: 62px; padding: 0 14px 0 18px; }.brand { font-size: 19px; }.desktop-only { display: none !important; }.export-group { margin: 0; }
96
+ .sidebar { display: none; }
97
+ .workspace { position: static; display: contents; }
98
+ .canvas-stage { height: 55vh; min-height: 420px; padding: 30px 24px 18px; overflow: hidden; order: 1; }
99
+ .poster-frame { height: min(49vh, 550px); max-width: calc(100vw - 56px); border-width: 6px; }
100
+ .preview-loading { font-size: 11px; }
101
+ .mobile-tabs { position: sticky; z-index: 25; top: 62px; display: grid; grid-template-columns: repeat(6, minmax(54px, 1fr)); height: 68px; overflow-x: auto; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: #fff; order: 2; }
102
+ .mobile-tabs button { position: relative; min-width: 54px; display: grid; place-content: center; justify-items: center; gap: 4px; color: var(--muted); font-size: 10px; }
103
+ .mobile-tabs button.is-active { color: var(--accent); }.mobile-tabs button.is-active::after { content: ''; position: absolute; left: 14px; right: 14px; bottom: 0; height: 2px; background: var(--accent); }
104
+ .mobile-sheet { display: block; padding: 18px 20px 24px; border-top: 1px solid var(--border); background: #fff; order: 3; }
105
+ .mobile-sheet-heading { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 16px; }.mobile-sheet-heading strong { font-size: 16px; }.mobile-sheet-heading span { color: var(--muted); font-size: 11px; }
106
+ .mobile-sheet .style-grid { display: flex; overflow-x: auto; padding: 2px 2px 9px; scroll-snap-type: x mandatory; }.mobile-sheet .style-card { min-width: 104px; scroll-snap-align: start; }
107
+ .mobile-sheet .map-viewport { height: 220px; }.mobile-sheet .section-content { padding: 0; }
108
+ .preview-status { min-height: 42px; justify-content: center; padding: 0 18px; border-top: 1px solid var(--border-soft); background: #fff; text-align: center; order: 4; }
109
+ .canvas-toolbar { position: static; z-index: 30; width: 100%; height: 60px; order: 5; }
110
+ .style-grid { grid-template-columns: repeat(3,1fr); }.choice-grid { grid-template-columns: repeat(3,1fr); }.size-grid { grid-template-columns: repeat(4,1fr); }
111
+ }
112
+
113
+ @media (max-width: 390px) { .mobile-tabs { grid-template-columns: repeat(6, 58px); }.choice-grid { grid-template-columns: repeat(2,1fr); }.size-grid { grid-template-columns: repeat(3,1fr); }.export-primary { min-width: 82px; }.canvas-stage { padding-left: 15px; padding-right: 15px; } }
frontend/src/App.test.tsx ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { fireEvent, render, screen, waitFor } from '@testing-library/react'
2
+ import { describe, expect, it, vi } from 'vitest'
3
+ import App from './App'
4
+
5
+ vi.mock('./components/MapViewport', () => ({
6
+ MapViewport: () => <div data-testid="map-viewport">map</div>,
7
+ }))
8
+ vi.mock('./api', () => ({
9
+ getStyles: vi.fn().mockResolvedValue([
10
+ { id: 'japanese_ink', name: 'Japanese Ink', description: '', preview: '', background: '#fff', text: '#111', water: '#ddd', parks: '#eee', road_motorway: '#111', road_primary: '#222', road_secondary: '#333', road_tertiary: '#444', road_residential: '#555', road_default: '#444', gradient: '#fff' },
11
+ { id: 'ocean', name: 'Ocean', description: '', preview: '', background: '#fff', text: '#111', water: '#ace', parks: '#eee', road_motorway: '#111', road_primary: '#222', road_secondary: '#333', road_tertiary: '#444', road_residential: '#555', road_default: '#444', gradient: '#fff' },
12
+ ]),
13
+ prepareMap: vi.fn().mockResolvedValue({ map_data_id: 'a'.repeat(64), cache_hit: true }),
14
+ renderPreview: vi.fn().mockResolvedValue(new Blob(['png'], { type: 'image/png' })),
15
+ searchPlaces: vi.fn().mockResolvedValue([{ display_name: 'Paris, France', latitude: 48.8566, longitude: 2.3522, country: 'France', region: 'Ile-de-France', country_code: 'fr', provider: 'fake' }]),
16
+ exportPoster: vi.fn(),
17
+ }))
18
+
19
+ describe('editor shell', () => {
20
+ it('loads styles and exposes product controls', async () => {
21
+ render(<App />)
22
+ expect(screen.getByText('MapToPoster')).toBeInTheDocument()
23
+ expect(screen.getAllByRole('button', { name: /Export/i })[0]).toBeInTheDocument()
24
+ await waitFor(() => expect(screen.getAllByText('Japanese Ink').length).toBeGreaterThan(0))
25
+ fireEvent.click(screen.getAllByText('Ocean')[0])
26
+ expect(screen.getAllByText('Ocean').length).toBeGreaterThan(0)
27
+ })
28
+
29
+ it('supports mobile-style panel switching and search selection', async () => {
30
+ render(<App />)
31
+ await waitFor(() => expect(screen.getAllByText('Japanese Ink').length).toBeGreaterThan(0))
32
+ fireEvent.click(screen.getAllByRole('button', { name: /Location/i })[0])
33
+ const search = screen.getAllByRole('textbox', { name: 'Search a place' })[0]
34
+ fireEvent.change(search, { target: { value: 'Paris' } })
35
+ fireEvent.submit(search.closest('form')!)
36
+ await waitFor(() => expect(screen.getAllByText('Paris, France').length).toBeGreaterThan(0))
37
+ fireEvent.click(screen.getAllByText('Paris, France')[0])
38
+ expect(screen.getAllByText('Paris, France').length).toBeGreaterThan(0)
39
+ })
40
+
41
+ it('changes zoom and fit state', () => {
42
+ render(<App />)
43
+ expect(screen.getAllByText('82%').length).toBeGreaterThan(0)
44
+ fireEvent.click(screen.getAllByRole('button', { name: 'Zoom in' })[0])
45
+ expect(screen.getAllByText('92%').length).toBeGreaterThan(0)
46
+ fireEvent.click(screen.getAllByRole('button', { name: 'Fit' })[0])
47
+ expect(screen.getAllByText('82%').length).toBeGreaterThan(0)
48
+ })
49
+ })
frontend/src/App.tsx ADDED
@@ -0,0 +1,256 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
2
+ import {
3
+ Check, ChevronDown, ChevronRight, Download, Expand, Layers3, LayoutTemplate,
4
+ LoaderCircle, MapPin, Minus, Move, Palette, Plus, Redo2, Search, SlidersHorizontal,
5
+ Type, Undo2, X,
6
+ } from 'lucide-react'
7
+ import { exportPoster, getStyles, prepareMap, renderPreview, searchPlaces } from './api'
8
+ import { MapViewport } from './components/MapViewport'
9
+ import type { BBox, LayerState, LocationResult, PosterRequest, PreviewPhase, StylePreset, Typography } from './types'
10
+ import './App.css'
11
+
12
+ const DEFAULT_LOCATION: LocationResult = {
13
+ display_name: 'Beijing Forestry University', latitude: 40.0012, longitude: 116.3482,
14
+ country: 'China', region: 'Beijing', country_code: 'cn', provider: 'default',
15
+ }
16
+ const DEFAULT_BBOX: BBox = { west: 116.292, south: 39.955, east: 116.405, north: 40.047 }
17
+ const DEFAULT_TYPE: Typography = {
18
+ title: 'BEIJING FORESTRY UNIVERSITY', subtitle: 'BEIJING', caption: '2023 — 2027', coordinates: '',
19
+ font_family: 'auto', title_size: 46, subtitle_size: 17, caption_size: 13, coordinate_size: 11,
20
+ letter_spacing: 0.08, line_height: 1.15, alignment: 'center', show_coordinates: true, show_divider: true,
21
+ }
22
+ const DEFAULT_LAYERS: LayerState = {
23
+ motorway: true, primary: true, secondary: true, residential: true, water: true, parks: true,
24
+ }
25
+ const PANEL_IDS = ['location', 'style', 'layout', 'type', 'layers', 'size'] as const
26
+ type PanelId = typeof PANEL_IDS[number]
27
+ const SIZE_OPTIONS = ['3:4', '4:5', '2:3', '1:1', '9:16', 'A4', 'A3']
28
+ const LAYOUT_OPTIONS = ['classic', 'editorial', 'minimal', 'bottom_left', 'centered']
29
+ const panelMeta = {
30
+ location: ['Location', MapPin], style: ['Style', Palette], layout: ['Layout', LayoutTemplate],
31
+ type: ['Type', Type], layers: ['Layers', Layers3], size: ['Size', SlidersHorizontal],
32
+ } as const
33
+
34
+ function extentFor(location: LocationResult): BBox {
35
+ const latSpan = 0.09
36
+ const lonSpan = latSpan / Math.max(Math.cos(location.latitude * Math.PI / 180), 0.25)
37
+ return {
38
+ west: Math.max(-179.999, location.longitude - lonSpan / 2), south: Math.max(-89.99, location.latitude - latSpan / 2),
39
+ east: Math.min(179.999, location.longitude + lonSpan / 2), north: Math.min(89.99, location.latitude + latSpan / 2),
40
+ }
41
+ }
42
+
43
+ function Section({ id, title, open, onToggle, children }: { id: PanelId; title: string; open: boolean; onToggle: () => void; children: React.ReactNode }) {
44
+ return <section className={`editor-section editor-section-${id} ${open ? 'is-open' : ''}`}>
45
+ <button className="section-heading" type="button" onClick={onToggle} aria-expanded={open}>
46
+ <span>{title}</span>{open ? <ChevronDown size={17} /> : <ChevronRight size={17} />}
47
+ </button>
48
+ {open && <div className="section-content">{children}</div>}
49
+ </section>
50
+ }
51
+
52
+ function ColorField({ label, value, onChange }: { label: string; value: string; onChange: (value: string) => void }) {
53
+ return <label className="color-field">
54
+ <span>{label}</span><span className="color-control"><input type="color" value={value} onChange={(event) => onChange(event.target.value)} /><code>{value.toUpperCase()}</code></span>
55
+ </label>
56
+ }
57
+
58
+ export default function App() {
59
+ const [activePanel, setActivePanel] = useState<PanelId>('style')
60
+ const [openPanels, setOpenPanels] = useState<Set<PanelId>>(new Set(['location', 'style', 'type']))
61
+ const [location, setLocation] = useState(DEFAULT_LOCATION)
62
+ const [bbox, setBBox] = useState(DEFAULT_BBOX)
63
+ const [mapZoom, setMapZoom] = useState<number | null>(null)
64
+ const [searchQuery, setSearchQuery] = useState('')
65
+ const [searchResults, setSearchResults] = useState<LocationResult[]>([])
66
+ const [searching, setSearching] = useState(false)
67
+ const [styles, setStyles] = useState<StylePreset[]>([])
68
+ const [styleId, setStyleId] = useState('japanese_ink')
69
+ const [customColors, setCustomColors] = useState<Record<string, string>>({})
70
+ const [typography, setTypography] = useState(DEFAULT_TYPE)
71
+ const [layout, setLayout] = useState('classic')
72
+ const [layers, setLayers] = useState(DEFAULT_LAYERS)
73
+ const [size, setSize] = useState('3:4')
74
+ const [mapDataId, setMapDataId] = useState('')
75
+ const [preparedSignature, setPreparedSignature] = useState('')
76
+ const [previewUrl, setPreviewUrl] = useState('/sample-poster.webp')
77
+ const [previewPhase, setPreviewPhase] = useState<PreviewPhase>('idle')
78
+ const [statusText, setStatusText] = useState('Preparing map data…')
79
+ const [error, setError] = useState('')
80
+ const [canvasZoom, setCanvasZoom] = useState(82)
81
+ const [exportOpen, setExportOpen] = useState(false)
82
+ const [exporting, setExporting] = useState(false)
83
+ const previewObjectUrl = useRef<string | null>(null)
84
+
85
+ const selectedStyle = styles.find((style) => style.id === styleId)
86
+ const effectiveColors = useMemo(() => selectedStyle ? {
87
+ background: selectedStyle.background, text: selectedStyle.text, water: selectedStyle.water, parks: selectedStyle.parks,
88
+ road_motorway: selectedStyle.road_motorway, road_primary: selectedStyle.road_primary,
89
+ road_secondary: selectedStyle.road_secondary, road_tertiary: selectedStyle.road_tertiary,
90
+ road_residential: selectedStyle.road_residential, road_default: selectedStyle.road_default,
91
+ gradient: selectedStyle.gradient, ...customColors,
92
+ } : customColors, [customColors, selectedStyle])
93
+
94
+ const poster = useMemo<PosterRequest>(() => ({
95
+ location, bbox, distance_m: 10_000, zoom: mapZoom, network_type: 'all', style_id: styleId,
96
+ colors: customColors, typography, layout, layers, size: { preset: size },
97
+ }), [bbox, customColors, layers, layout, location, mapZoom, size, styleId, typography])
98
+ const dataSignature = useMemo(() => JSON.stringify({ location, bbox, network: poster.network_type }), [bbox, location, poster.network_type])
99
+ const prepareRequest = useMemo(() => ({
100
+ location, bbox, distance_m: 10_000, zoom: mapZoom, network_type: 'all' as const,
101
+ style_id: 'japanese_ink', colors: {}, typography: DEFAULT_TYPE, layout: 'classic', layers: DEFAULT_LAYERS, size: { preset: '3:4' },
102
+ }), [bbox, location, mapZoom])
103
+
104
+ useEffect(() => {
105
+ const controller = new AbortController()
106
+ getStyles(controller.signal).then((items) => {
107
+ setStyles(items)
108
+ setStyleId((current) => items.some((item) => item.id === current) ? current : items[0]?.id ?? current)
109
+ }).catch((reason: Error) => { if (reason.name !== 'AbortError') setError(reason.message) })
110
+ return () => controller.abort()
111
+ }, [])
112
+
113
+ useEffect(() => {
114
+ const controller = new AbortController()
115
+ const timer = window.setTimeout(() => {
116
+ setPreviewPhase('preparing'); setStatusText('Loading streets and landscape…'); setError('')
117
+ prepareMap(prepareRequest, controller.signal).then((result) => {
118
+ setMapDataId(result.map_data_id); setPreparedSignature(dataSignature)
119
+ setStatusText(result.cache_hit ? 'Map data loaded from cache' : 'Map data ready')
120
+ }).catch((reason: Error) => {
121
+ if (reason.name !== 'AbortError') { setPreviewPhase('error'); setError(reason.message); setStatusText('Could not load map data') }
122
+ })
123
+ }, 650)
124
+ return () => { window.clearTimeout(timer); controller.abort() }
125
+ }, [dataSignature, prepareRequest])
126
+
127
+ useEffect(() => {
128
+ if (!mapDataId || preparedSignature !== dataSignature) return
129
+ const controller = new AbortController()
130
+ const timer = window.setTimeout(() => {
131
+ setPreviewPhase('rendering'); setStatusText('Updating preview…'); setError('')
132
+ renderPreview(mapDataId, poster, controller.signal).then((blob) => {
133
+ if (previewObjectUrl.current) URL.revokeObjectURL(previewObjectUrl.current)
134
+ const url = URL.createObjectURL(blob)
135
+ previewObjectUrl.current = url; setPreviewUrl(url); setPreviewPhase('success'); setStatusText('Preview updated')
136
+ }).catch((reason: Error) => {
137
+ if (reason.name !== 'AbortError') { setPreviewPhase('error'); setError(reason.message); setStatusText('Preview failed') }
138
+ })
139
+ }, 250)
140
+ return () => { window.clearTimeout(timer); controller.abort() }
141
+ }, [dataSignature, mapDataId, poster, preparedSignature])
142
+
143
+ useEffect(() => () => { if (previewObjectUrl.current) URL.revokeObjectURL(previewObjectUrl.current) }, [])
144
+
145
+ const runSearch = async (event: React.FormEvent) => {
146
+ event.preventDefault()
147
+ const query = searchQuery.trim()
148
+ if (!query) return
149
+ setSearching(true); setError('')
150
+ try { setSearchResults(await searchPlaces(query)) }
151
+ catch (reason) { setError(reason instanceof Error ? reason.message : 'Search failed') }
152
+ finally { setSearching(false) }
153
+ }
154
+
155
+ const chooseLocation = (result: LocationResult) => {
156
+ setLocation(result); setBBox(extentFor(result)); setMapZoom(null); setSearchResults([]); setSearchQuery('')
157
+ setTypography((current) => ({ ...current, subtitle: result.region || result.country || current.subtitle }))
158
+ }
159
+
160
+ const updateColor = (key: string, value: string) => setCustomColors((current) => ({ ...current, [key]: value }))
161
+ const togglePanel = (id: PanelId) => {
162
+ setActivePanel(id)
163
+ setOpenPanels((current) => { const next = new Set(current); if (next.has(id)) next.delete(id); else next.add(id); return next })
164
+ }
165
+ const updateViewport = useCallback((nextBBox: BBox, zoom: number) => {
166
+ const rounded = Object.fromEntries(Object.entries(nextBBox).map(([key, value]) => [key, Number(value.toFixed(6))])) as BBox
167
+ setBBox((current) => {
168
+ const unchanged = (Object.keys(rounded) as (keyof BBox)[]).every((key) => Math.abs(current[key] - rounded[key]) < 0.00001)
169
+ return unchanged ? current : rounded
170
+ })
171
+ setMapZoom((current) => current !== null && Math.abs(current - zoom) < 0.01 ? current : Number(zoom.toFixed(2)))
172
+ }, [])
173
+
174
+ const download = async (format: 'png' | 'svg' | 'pdf', dpi: number) => {
175
+ if (!mapDataId || preparedSignature !== dataSignature) { setError('Wait for the map data to finish loading before export.'); return }
176
+ setExporting(true); setExportOpen(false); setError('')
177
+ try {
178
+ const result = await exportPoster(mapDataId, poster, format, dpi)
179
+ const url = URL.createObjectURL(result.blob)
180
+ const link = document.createElement('a'); link.href = url; link.download = result.filename; link.click()
181
+ window.setTimeout(() => URL.revokeObjectURL(url), 1000)
182
+ } catch (reason) { setError(reason instanceof Error ? reason.message : 'Export failed') }
183
+ finally { setExporting(false) }
184
+ }
185
+
186
+ const panelContent: Record<PanelId, React.ReactNode> = {
187
+ location: <>
188
+ <form className="search-box" onSubmit={runSearch}>
189
+ <Search size={16} /><input value={searchQuery} onChange={(event) => setSearchQuery(event.target.value)} placeholder="Search a place…" aria-label="Search a place" />
190
+ {searchQuery && <button type="button" className="icon-button" onClick={() => { setSearchQuery(''); setSearchResults([]) }} aria-label="Clear search"><X size={15} /></button>}
191
+ <button className="search-submit" type="submit" disabled={searching}>{searching ? <LoaderCircle className="spin" size={15} /> : 'Search'}</button>
192
+ </form>
193
+ {searchResults.length > 0 && <div className="search-results">{searchResults.map((result) => <button key={`${result.latitude}-${result.longitude}-${result.display_name}`} onClick={() => chooseLocation(result)}>
194
+ <MapPin size={15} /><span><strong>{result.display_name}</strong><small>{[result.region, result.country].filter(Boolean).join(', ')}</small></span>
195
+ </button>)}</div>}
196
+ <div className="selected-place"><span className="pin"><MapPin size={17} /></span><span><strong>{location.display_name}</strong><small>{location.latitude.toFixed(4)}° / {location.longitude.toFixed(4)}°</small></span></div>
197
+ <MapViewport longitude={location.longitude} latitude={location.latitude} bbox={bbox} onViewportChange={updateViewport} />
198
+ <p className="field-help">Drag or zoom to set the exact area used by the poster.</p>
199
+ </>,
200
+ style: <>
201
+ <div className="style-grid">{styles.slice(0, 6).map((style) => <button key={style.id} className={`style-card ${style.id === styleId ? 'is-selected' : ''}`} onClick={() => { setStyleId(style.id); setCustomColors({}) }} title={style.description}>
202
+ <span className="style-preview" style={{ backgroundColor: style.background, color: style.road_primary }}>{style.preview && <img src={style.preview} alt="" onError={(event) => { event.currentTarget.style.display = 'none' }} />}<i /><i /><i /></span>
203
+ <span>{style.name}</span>{style.id === styleId && <b><Check size={12} /></b>}
204
+ </button>)}</div>
205
+ {styles.length > 6 && <label className="field"><span>More styles</span><select value={styleId} onChange={(event) => { setStyleId(event.target.value); setCustomColors({}) }}>{styles.map((style) => <option key={style.id} value={style.id}>{style.name}</option>)}</select></label>}
206
+ <div className="subheading"><span>Customize</span>{Object.keys(customColors).length > 0 && <button onClick={() => setCustomColors({})}>Reset</button>}</div>
207
+ <div className="color-list">
208
+ <ColorField label="Background" value={effectiveColors.background ?? '#ffffff'} onChange={(value) => updateColor('background', value)} />
209
+ <ColorField label="Text" value={effectiveColors.text ?? '#17191d'} onChange={(value) => updateColor('text', value)} />
210
+ <ColorField label="Water" value={effectiveColors.water ?? '#c9c6bf'} onChange={(value) => updateColor('water', value)} />
211
+ <ColorField label="Parks" value={effectiveColors.parks ?? '#eae7e1'} onChange={(value) => updateColor('parks', value)} />
212
+ <ColorField label="Major roads" value={effectiveColors.road_primary ?? '#222222'} onChange={(value) => updateColor('road_primary', value)} />
213
+ <ColorField label="Minor roads" value={effectiveColors.road_residential ?? '#777777'} onChange={(value) => updateColor('road_residential', value)} />
214
+ </div>
215
+ </>,
216
+ layout: <div className="choice-grid">{LAYOUT_OPTIONS.map((value) => <button key={value} className={layout === value ? 'is-selected' : ''} onClick={() => setLayout(value)}><span className={`layout-glyph ${value}`} /><strong>{value.replace('_', ' ')}</strong></button>)}</div>,
217
+ type: <div className="form-stack">
218
+ <label className="field"><span>Title</span><input value={typography.title} onChange={(event) => setTypography({ ...typography, title: event.target.value })} /></label>
219
+ <label className="field"><span>Subtitle</span><input value={typography.subtitle} onChange={(event) => setTypography({ ...typography, subtitle: event.target.value })} /></label>
220
+ <label className="field"><span>Caption</span><input value={typography.caption} onChange={(event) => setTypography({ ...typography, caption: event.target.value })} /></label>
221
+ <div className="two-fields"><label className="field"><span>Title size</span><input type="number" min="12" max="120" value={typography.title_size} onChange={(event) => setTypography({ ...typography, title_size: Number(event.target.value) })} /></label><label className="field"><span>Alignment</span><select value={typography.alignment} onChange={(event) => setTypography({ ...typography, alignment: event.target.value as Typography['alignment'] })}><option>left</option><option>center</option><option>right</option></select></label></div>
222
+ <label className="range-field"><span>Letter spacing <output>{Math.round(typography.letter_spacing * 100)}%</output></span><input type="range" min="0" max="0.3" step="0.01" value={typography.letter_spacing} onChange={(event) => setTypography({ ...typography, letter_spacing: Number(event.target.value) })} /></label>
223
+ <label className="check-field"><input type="checkbox" checked={typography.show_coordinates} onChange={(event) => setTypography({ ...typography, show_coordinates: event.target.checked })} />Show coordinates</label>
224
+ <label className="check-field"><input type="checkbox" checked={typography.show_divider} onChange={(event) => setTypography({ ...typography, show_divider: event.target.checked })} />Show divider</label>
225
+ </div>,
226
+ layers: <div className="toggle-list">{Object.entries(layers).map(([key, value]) => <label key={key}><span>{key.replace('_', ' ')}</span><input type="checkbox" checked={value} onChange={(event) => setLayers({ ...layers, [key]: event.target.checked })} /></label>)}</div>,
227
+ size: <><div className="size-grid">{SIZE_OPTIONS.map((value) => <button key={value} className={size === value ? 'is-selected' : ''} onClick={() => setSize(value)}><span className="size-shape" data-ratio={value} />{value}</button>)}</div><p className="field-help">Preview is optimized for speed. Export uses the selected print ratio and DPI.</p></>,
228
+ }
229
+
230
+ return <div className="app-shell">
231
+ <header className="topbar">
232
+ <a className="brand" href="/">MapToPoster</a>
233
+ <div className="topbar-tools"><button className="desktop-only icon-button" disabled aria-label="Undo"><Undo2 size={18} /></button><button className="desktop-only icon-button" disabled aria-label="Redo"><Redo2 size={18} /></button><button className="desktop-only quiet-button"><Layers3 size={17} /> Layers</button>
234
+ <div className="export-group"><button className="export-primary" onClick={() => download('png', 300)} disabled={exporting}>{exporting ? <LoaderCircle className="spin" size={16} /> : <Download size={16} />}<span>Export</span></button><button className="export-toggle" onClick={() => setExportOpen(!exportOpen)} aria-label="Export options"><ChevronDown size={15} /></button>
235
+ {exportOpen && <div className="export-menu"><button onClick={() => download('png', 150)}>PNG · Preview</button><button onClick={() => download('png', 300)}>PNG · Print 300 DPI</button><button onClick={() => download('svg', 300)}>SVG · Vector</button><button onClick={() => download('pdf', 300)}>PDF · Print</button></div>}
236
+ </div>
237
+ </div>
238
+ </header>
239
+
240
+ <aside className="sidebar">{PANEL_IDS.map((id) => <Section key={id} id={id} title={panelMeta[id][0]} open={openPanels.has(id)} onToggle={() => togglePanel(id)}>{panelContent[id]}</Section>)}</aside>
241
+
242
+ <nav className="mobile-tabs" aria-label="Editor panels">{PANEL_IDS.map((id) => { const Icon = panelMeta[id][1]; return <button key={id} className={activePanel === id ? 'is-active' : ''} onClick={() => setActivePanel(id)}><Icon size={19} /><span>{panelMeta[id][0]}</span></button> })}</nav>
243
+ <section className="mobile-sheet"><div className="mobile-sheet-heading"><strong>{panelMeta[activePanel][0]}</strong><span>Poster settings</span></div>{panelContent[activePanel]}</section>
244
+
245
+ <main className="workspace">
246
+ <div className="canvas-stage">
247
+ <div className="poster-frame" style={{ transform: `scale(${canvasZoom / 100})`, aspectRatio: size === '1:1' ? '1 / 1' : size === '4:5' ? '4 / 5' : size === '2:3' ? '2 / 3' : size === '9:16' ? '9 / 16' : size === 'A4' || size === 'A3' ? '210 / 297' : '3 / 4' }}>
248
+ <img src={previewUrl} alt={`Poster preview for ${location.display_name}`} />
249
+ {(previewPhase === 'preparing' || previewPhase === 'rendering') && <div className="preview-loading"><LoaderCircle className="spin" /><span>{statusText}</span></div>}
250
+ </div>
251
+ </div>
252
+ <div className={`preview-status ${previewPhase}`} role="status">{previewPhase === 'success' ? <Check size={15} /> : previewPhase === 'error' ? <X size={15} /> : <LoaderCircle className={previewPhase === 'idle' ? '' : 'spin'} size={15} />}<span>{error || statusText}</span></div>
253
+ <div className="canvas-toolbar"><div className="tool-group"><button aria-label="Pan"><Move size={17} /></button><button aria-label="Fit canvas" onClick={() => setCanvasZoom(82)}><Expand size={17} /></button></div><div className="tool-group zoom-controls"><button onClick={() => setCanvasZoom((value) => Math.max(35, value - 10))} aria-label="Zoom out"><Minus size={16} /></button><output>{canvasZoom}%</output><button onClick={() => setCanvasZoom((value) => Math.min(140, value + 10))} aria-label="Zoom in"><Plus size={16} /></button></div><button className="fit-button" onClick={() => setCanvasZoom(82)}>Fit</button></div>
254
+ </main>
255
+ </div>
256
+ }
frontend/src/api.ts ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import type { LocationResult, PosterRequest, StylePreset } from './types'
2
+
3
+ const API_ROOT = import.meta.env.VITE_API_URL ?? '/api/v1'
4
+
5
+ async function readError(response: Response): Promise<string> {
6
+ try {
7
+ const payload = await response.json() as { detail?: string }
8
+ return payload.detail ?? `Request failed (${response.status})`
9
+ } catch {
10
+ return `Request failed (${response.status})`
11
+ }
12
+ }
13
+
14
+ async function expectJson<T>(response: Response): Promise<T> {
15
+ if (!response.ok) throw new Error(await readError(response))
16
+ return response.json() as Promise<T>
17
+ }
18
+
19
+ export async function getStyles(signal?: AbortSignal): Promise<StylePreset[]> {
20
+ return expectJson(await fetch(`${API_ROOT}/styles`, { signal }))
21
+ }
22
+
23
+ export async function searchPlaces(query: string, signal?: AbortSignal): Promise<LocationResult[]> {
24
+ const params = new URLSearchParams({ q: query, lang: navigator.language.startsWith('zh') ? 'zh' : 'en' })
25
+ return expectJson(await fetch(`${API_ROOT}/locations/search?${params}`, { signal }))
26
+ }
27
+
28
+ export async function prepareMap(poster: PosterRequest, signal?: AbortSignal): Promise<{ map_data_id: string; cache_hit: boolean }> {
29
+ return expectJson(await fetch(`${API_ROOT}/map-data/prepare`, {
30
+ method: 'POST',
31
+ headers: { 'Content-Type': 'application/json' },
32
+ body: JSON.stringify(poster),
33
+ signal,
34
+ }))
35
+ }
36
+
37
+ export async function renderPreview(mapDataId: string, poster: PosterRequest, signal?: AbortSignal): Promise<Blob> {
38
+ const response = await fetch(`${API_ROOT}/posters/preview`, {
39
+ method: 'POST',
40
+ headers: { 'Content-Type': 'application/json' },
41
+ body: JSON.stringify({ map_data_id: mapDataId, poster }),
42
+ signal,
43
+ })
44
+ if (!response.ok) throw new Error(await readError(response))
45
+ return response.blob()
46
+ }
47
+
48
+ export async function exportPoster(mapDataId: string, poster: PosterRequest, format: 'png' | 'svg' | 'pdf', dpi: number): Promise<{ blob: Blob; filename: string }> {
49
+ const response = await fetch(`${API_ROOT}/posters/export`, {
50
+ method: 'POST',
51
+ headers: { 'Content-Type': 'application/json' },
52
+ body: JSON.stringify({ map_data_id: mapDataId, poster, format, dpi }),
53
+ })
54
+ if (!response.ok) throw new Error(await readError(response))
55
+ const disposition = response.headers.get('Content-Disposition') ?? ''
56
+ const filename = disposition.match(/filename="?([^";]+)"?/i)?.[1] ?? `maptoposter.${format}`
57
+ return { blob: await response.blob(), filename }
58
+ }
frontend/src/components/MapViewport.tsx ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useEffect, useRef } from 'react'
2
+ import { AttributionControl, Map, NavigationControl, type Map as MapLibreMap } from 'maplibre-gl'
3
+ import 'maplibre-gl/dist/maplibre-gl.css'
4
+ import type { BBox } from '../types'
5
+
6
+ type Props = {
7
+ longitude: number
8
+ latitude: number
9
+ bbox: BBox
10
+ onViewportChange: (bbox: BBox, zoom: number) => void
11
+ }
12
+
13
+ const tileUrl = import.meta.env.VITE_MAP_TILE_URL ?? 'https://tile.openstreetmap.org/{z}/{x}/{y}.png'
14
+
15
+ export function MapViewport({ longitude, latitude, bbox, onViewportChange }: Props) {
16
+ const container = useRef<HTMLDivElement>(null)
17
+ const mapRef = useRef<MapLibreMap | null>(null)
18
+
19
+ useEffect(() => {
20
+ const element = container.current
21
+ if (!element) return
22
+ let map: MapLibreMap | null = null
23
+ const mount = () => {
24
+ if (map || element.clientWidth === 0 || element.clientHeight === 0) return
25
+ map = new Map({
26
+ container: element,
27
+ center: [longitude, latitude],
28
+ zoom: 10.8,
29
+ attributionControl: false,
30
+ style: {
31
+ version: 8,
32
+ sources: { osm: { type: 'raster', tiles: [tileUrl], tileSize: 256, attribution: '© OpenStreetMap contributors' } },
33
+ layers: [{ id: 'osm', type: 'raster', source: 'osm' }],
34
+ },
35
+ })
36
+ map.addControl(new NavigationControl({ showCompass: false }), 'top-right')
37
+ map.addControl(new AttributionControl({ compact: true }), 'bottom-right')
38
+ map.fitBounds([[bbox.west, bbox.south], [bbox.east, bbox.north]], { padding: 14, animate: false })
39
+ map.on('moveend', () => {
40
+ if (!map) return
41
+ const bounds = map.getBounds()
42
+ onViewportChange({ west: bounds.getWest(), south: bounds.getSouth(), east: bounds.getEast(), north: bounds.getNorth() }, map.getZoom())
43
+ })
44
+ mapRef.current = map
45
+ }
46
+ mount()
47
+ const observer = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(mount)
48
+ observer?.observe(element)
49
+ return () => { observer?.disconnect(); map?.remove(); mapRef.current = null }
50
+ }, [bbox.east, bbox.north, bbox.south, bbox.west, latitude, longitude, onViewportChange])
51
+
52
+ useEffect(() => {
53
+ const map = mapRef.current
54
+ if (!map) return
55
+ const center = map.getCenter()
56
+ if (Math.abs(center.lng - longitude) > 0.01 || Math.abs(center.lat - latitude) > 0.01) {
57
+ map.fitBounds([[bbox.west, bbox.south], [bbox.east, bbox.north]], { padding: 14, duration: 450 })
58
+ }
59
+ }, [bbox.east, bbox.north, bbox.south, bbox.west, latitude, longitude])
60
+
61
+ return <div className="map-viewport" ref={container} aria-label="Interactive map viewport" />
62
+ }
frontend/src/index.css ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ :root {
2
+ font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
3
+ color: #17191d;
4
+ background: #f4f5f7;
5
+ font-synthesis: none;
6
+ text-rendering: optimizeLegibility;
7
+ }
8
+ * { box-sizing: border-box; }
9
+ html, body, #root { width: 100%; min-width: 320px; min-height: 100%; margin: 0; }
10
+ button, input, select { font: inherit; }
11
+ button { color: inherit; }
12
+ button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid #3479df; outline-offset: 1px; }
13
+ @media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }
frontend/src/main.tsx ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ import { StrictMode } from 'react'
2
+ import { createRoot } from 'react-dom/client'
3
+ import './index.css'
4
+ import App from './App.tsx'
5
+
6
+ createRoot(document.getElementById('root')!).render(
7
+ <StrictMode>
8
+ <App />
9
+ </StrictMode>,
10
+ )
frontend/src/test/setup.ts ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ import '@testing-library/jest-dom/vitest'
2
+
3
+ Object.defineProperty(URL, 'createObjectURL', { writable: true, value: () => 'blob:preview' })
4
+ Object.defineProperty(URL, 'revokeObjectURL', { writable: true, value: () => undefined })
frontend/src/types.ts ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ export type LocationResult = {
2
+ display_name: string
3
+ latitude: number
4
+ longitude: number
5
+ country: string
6
+ region: string
7
+ country_code: string
8
+ provider: string
9
+ }
10
+
11
+ export type BBox = {
12
+ west: number
13
+ south: number
14
+ east: number
15
+ north: number
16
+ }
17
+
18
+ export type StylePreset = {
19
+ id: string
20
+ name: string
21
+ description: string
22
+ preview: string
23
+ background: string
24
+ text: string
25
+ water: string
26
+ parks: string
27
+ road_motorway: string
28
+ road_primary: string
29
+ road_secondary: string
30
+ road_tertiary: string
31
+ road_residential: string
32
+ road_default: string
33
+ gradient: string
34
+ }
35
+
36
+ export type Typography = {
37
+ title: string
38
+ subtitle: string
39
+ caption: string
40
+ coordinates: string
41
+ font_family: string
42
+ title_size: number
43
+ subtitle_size: number
44
+ caption_size: number
45
+ coordinate_size: number
46
+ letter_spacing: number
47
+ line_height: number
48
+ alignment: 'left' | 'center' | 'right'
49
+ show_coordinates: boolean
50
+ show_divider: boolean
51
+ }
52
+
53
+ export type LayerState = {
54
+ motorway: boolean
55
+ primary: boolean
56
+ secondary: boolean
57
+ residential: boolean
58
+ water: boolean
59
+ parks: boolean
60
+ }
61
+
62
+ export type PosterRequest = {
63
+ location: LocationResult
64
+ bbox: BBox
65
+ distance_m: number
66
+ zoom: number | null
67
+ network_type: 'all' | 'drive' | 'walk' | 'bike'
68
+ style_id: string
69
+ colors: Record<string, string>
70
+ typography: Typography
71
+ layout: string
72
+ layers: LayerState
73
+ size: { preset: string; width_in?: number; height_in?: number }
74
+ }
75
+
76
+ export type PreviewPhase = 'idle' | 'preparing' | 'rendering' | 'success' | 'error'
frontend/tsconfig.app.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "compilerOptions": {
3
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
4
+ "target": "es2023",
5
+ "lib": ["ES2023", "DOM"],
6
+ "module": "esnext",
7
+ "types": ["vite/client"],
8
+ "allowArbitraryExtensions": true,
9
+ "skipLibCheck": true,
10
+
11
+ /* Bundler mode */
12
+ "moduleResolution": "bundler",
13
+ "allowImportingTsExtensions": true,
14
+ "verbatimModuleSyntax": true,
15
+ "moduleDetection": "force",
16
+ "noEmit": true,
17
+ "jsx": "react-jsx",
18
+
19
+ /* Linting */
20
+ "noUnusedLocals": true,
21
+ "noUnusedParameters": true,
22
+ "erasableSyntaxOnly": true,
23
+ "noFallthroughCasesInSwitch": true
24
+ },
25
+ "include": ["src"]
26
+ }
frontend/tsconfig.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "files": [],
3
+ "references": [
4
+ { "path": "./tsconfig.app.json" },
5
+ { "path": "./tsconfig.node.json" }
6
+ ]
7
+ }
frontend/tsconfig.node.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "compilerOptions": {
3
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
4
+ "target": "es2023",
5
+ "lib": ["ES2023"],
6
+ "types": ["node"],
7
+ "skipLibCheck": true,
8
+
9
+ /* Bundler mode */
10
+ "module": "nodenext",
11
+ "allowImportingTsExtensions": true,
12
+ "verbatimModuleSyntax": true,
13
+ "moduleDetection": "force",
14
+ "noEmit": true,
15
+
16
+ /* Linting */
17
+ "noUnusedLocals": true,
18
+ "noUnusedParameters": true,
19
+ "erasableSyntaxOnly": true,
20
+ "noFallthroughCasesInSwitch": true
21
+ },
22
+ "include": ["vite.config.ts"]
23
+ }