Extract @trails-cool/map-core package from Planner

New renderer-agnostic package with zero dependencies:
- Tile configs (base layers, overlay layers)
- Color palettes (surface, highway, smoothness, tracktype, cycleway,
  bikeroute, elevation, maxspeed) — 8 color maps + 3 color functions
- POI category definitions (9 categories with Overpass queries, icons,
  colors, profile mappings)
- Z-index layering constants
- Snap distance constant

Updated 15 consuming files to import from @trails-cool/map-core.
Deleted poi-categories.ts and z-index.ts from the Planner (fully moved).
packages/map re-exports tile configs from map-core for backwards compat.

All 117 tests pass, no user-facing changes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ullrich Schäfer 2026-04-12 22:28:14 +02:00
parent cd939ccf07
commit 60b94b5789
No known key found for this signature in database
GPG key ID: A32FF691A0F752D9
33 changed files with 339 additions and 257 deletions

View file

@ -1,45 +1,45 @@
## 1. Package Setup
- [ ] 1.1 Create `packages/map-core/` with `package.json`, `tsconfig.json`, add to pnpm workspace and Turborepo pipeline
- [ ] 1.2 Create `src/index.ts` with re-exports for all modules
- [x] 1.1 Create `packages/map-core/` with `package.json`, `tsconfig.json`, add to pnpm workspace and Turborepo pipeline
- [x] 1.2 Create `src/index.ts` with re-exports for all modules
## 2. Tile Definitions
- [ ] 2.1 Move `baseLayers` and `TileLayerConfig` from `packages/map/src/layers.ts` to `packages/map-core/src/tiles.ts`
- [ ] 2.2 Move `overlayLayers` and `OverlayLayerConfig` to `packages/map-core/src/tiles.ts`
- [ ] 2.3 Update `packages/map/src/layers.ts` to re-export from `@trails-cool/map-core`
- [ ] 2.4 Update `packages/map/src/index.ts` exports
- [x] 2.1 Move `baseLayers` and `TileLayerConfig` from `packages/map/src/layers.ts` to `packages/map-core/src/tiles.ts`
- [x] 2.2 Move `overlayLayers` and `OverlayLayerConfig` to `packages/map-core/src/tiles.ts`
- [x] 2.3 Update `packages/map/src/layers.ts` to re-export from `@trails-cool/map-core`
- [x] 2.4 Update `packages/map/src/index.ts` exports
## 3. Color Palettes
- [ ] 3.1 Extract `SURFACE_COLORS`, `DEFAULT_SURFACE_COLOR` from `ColoredRoute.tsx` to `map-core/src/colors/surface.ts`
- [ ] 3.2 Extract `HIGHWAY_COLORS`, `DEFAULT_HIGHWAY_COLOR` to `map-core/src/colors/highway.ts`
- [ ] 3.3 Extract `SMOOTHNESS_COLORS`, `DEFAULT_SMOOTHNESS_COLOR` to `map-core/src/colors/smoothness.ts`
- [ ] 3.4 Extract `TRACKTYPE_COLORS`, `DEFAULT_TRACKTYPE_COLOR` to `map-core/src/colors/tracktype.ts`
- [ ] 3.5 Extract `CYCLEWAY_COLORS`, `DEFAULT_CYCLEWAY_COLOR` to `map-core/src/colors/cycleway.ts`
- [ ] 3.6 Extract `BIKEROUTE_COLORS`, `DEFAULT_BIKEROUTE_COLOR` to `map-core/src/colors/bikeroute.ts`
- [ ] 3.7 Extract `elevationColor()`, `routeGradeColor()` to `map-core/src/colors/elevation.ts`
- [ ] 3.8 Extract `maxspeedColor()` to `map-core/src/colors/maxspeed.ts`
- [ ] 3.9 Create `map-core/src/colors/index.ts` re-exporting all color maps and functions
- [ ] 3.10 Update `ColoredRoute.tsx` to import from `@trails-cool/map-core`
- [ ] 3.11 Update `ElevationChart.tsx` to import from `@trails-cool/map-core`
- [x] 3.1 Extract `SURFACE_COLORS`, `DEFAULT_SURFACE_COLOR` from `ColoredRoute.tsx` to `map-core/src/colors/surface.ts`
- [x] 3.2 Extract `HIGHWAY_COLORS`, `DEFAULT_HIGHWAY_COLOR` to `map-core/src/colors/highway.ts`
- [x] 3.3 Extract `SMOOTHNESS_COLORS`, `DEFAULT_SMOOTHNESS_COLOR` to `map-core/src/colors/smoothness.ts`
- [x] 3.4 Extract `TRACKTYPE_COLORS`, `DEFAULT_TRACKTYPE_COLOR` to `map-core/src/colors/tracktype.ts`
- [x] 3.5 Extract `CYCLEWAY_COLORS`, `DEFAULT_CYCLEWAY_COLOR` to `map-core/src/colors/cycleway.ts`
- [x] 3.6 Extract `BIKEROUTE_COLORS`, `DEFAULT_BIKEROUTE_COLOR` to `map-core/src/colors/bikeroute.ts`
- [x] 3.7 Extract `elevationColor()`, `routeGradeColor()` to `map-core/src/colors/elevation.ts`
- [x] 3.8 Extract `maxspeedColor()` to `map-core/src/colors/maxspeed.ts`
- [x] 3.9 Create `map-core/src/colors/index.ts` re-exporting all color maps and functions
- [x] 3.10 Update `ColoredRoute.tsx` to import from `@trails-cool/map-core`
- [x] 3.11 Update `ElevationChart.tsx` to import from `@trails-cool/map-core`
## 4. POI Categories
- [ ] 4.1 Move `PoiCategory` type and `poiCategories` array from `poi-categories.ts` to `map-core/src/poi.ts`
- [ ] 4.2 Move `getCategoriesForProfile()` and `profileOverlayDefaults` to `map-core/src/poi.ts`
- [ ] 4.3 Update Planner imports: `PoiPanel.tsx`, `use-pois.ts`, `use-profile-defaults.ts`, `poi-categories.test.ts`
- [ ] 4.4 Move POI snap distance constant to `map-core/src/snap.ts`
- [x] 4.1 Move `PoiCategory` type and `poiCategories` array from `poi-categories.ts` to `map-core/src/poi.ts`
- [x] 4.2 Move `getCategoriesForProfile()` and `profileOverlayDefaults` to `map-core/src/poi.ts`
- [x] 4.3 Update Planner imports: `PoiPanel.tsx`, `use-pois.ts`, `use-profile-defaults.ts`, `poi-categories.test.ts`
- [x] 4.4 Move POI snap distance constant to `map-core/src/snap.ts`
## 5. Z-Index Constants
- [ ] 5.1 Move all z-index constants from `z-index.ts` to `map-core/src/z-index.ts`
- [ ] 5.2 Update Planner imports: `PlannerMap.tsx`, `PoiPanel.tsx`, `RouteInteraction.tsx`
- [x] 5.1 Move all z-index constants from `z-index.ts` to `map-core/src/z-index.ts`
- [x] 5.2 Update Planner imports: `PlannerMap.tsx`, `PoiPanel.tsx`, `RouteInteraction.tsx`
## 6. Verification
- [ ] 6.1 Run `pnpm typecheck` — all packages compile
- [ ] 6.2 Run `pnpm lint` — no import errors
- [ ] 6.3 Run `pnpm test` — all existing tests pass (update import paths in test files)
- [ ] 6.4 Run `pnpm test:e2e` — no regressions
- [ ] 6.5 Verify `map-core` has zero dependencies in its `package.json`
- [x] 6.1 Run `pnpm typecheck` — all packages compile
- [x] 6.2 Run `pnpm lint` — no import errors
- [x] 6.3 Run `pnpm test` — all existing tests pass (update import paths in test files)
- [x] 6.4 Run `pnpm test:e2e` — no regressions
- [x] 6.5 Verify `map-core` has zero dependencies in its `package.json`