Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .agents/skills/codeatlas-ui/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -2025,7 +2025,7 @@ Variables: `--ca-map-bearing`
| `engine?` | `"maplibre" \| "mapbox"` | `'maplibre'` | `"maplibre"` (default, no token) or `"mapbox"` (needs `accessToken`). The matching package is a peer you install. |
| `accessToken?` | `string` | | Mapbox access token. Required for `engine="mapbox"`. |
| `styles` | `MapStyles` | | Basemap style per color scheme. The map switches style when `colorScheme.resolved` changes, without being recreated. |
| `layers?` | `unknown[]` | | deck.gl layers drawn interleaved in the map. Needs `@deck.gl/core` and `@deck.gl/mapbox`. Replace the array to update. |
| `layers?` | `unknown[]` | | deck.gl layers drawn interleaved in the map. Needs `@deck.gl/core` plus `@deck.gl/maplibre` (`engine="maplibre"`) or `@deck.gl/mapbox` (`engine="mapbox"`). Replace the array to update. |
| `fit?` | `MapBounds` | | Bounds to fit, with `padding`. Changing it fits again. |
| `padding?` | `Partial<MapPadding>` | | Pixels covered by UI on each side (a sidebar, a bottom sheet), kept clear when fitting. Each side defaults to the active `PageFrame`'s `stageInsets`, or 0 without one. |
| `center?` | `[number, number]` | | |
Expand Down
5 changes: 0 additions & 5 deletions .changeset/map-maplibre-5.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/map-maplibre-6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@codeatlasdev/ui": patch
---

`@codeatlasdev/ui/map`: `MapStage` works with `maplibre-gl` 6, so the peer range is `^5.0.0 || ^6.0.0` again and you can take the fix for the critical attribution-sanitizer XSS in `maplibre-gl` 6.4.0 and earlier (GHSA-jrc7-96c5-q579, fixed in 6.4.1). With `engine="maplibre"` the deck.gl `layers` now go through `MapLibreOverlay` from the new optional peer `@deck.gl/maplibre` (`~9.4.0`, which supports `maplibre-gl` 4.5.1, 5 and 6) instead of `MapboxOverlay`, which throws `Cannot read properties of undefined (reading 'height')` on every frame there. `engine="mapbox"` keeps `@deck.gl/mapbox`. Install `@deck.gl/maplibre` instead of `@deck.gl/mapbox` when you use `maplibre-gl`. On `maplibre-gl` 6 the app must also call `setWorkerUrl` once (Vite: `import workerUrl from "maplibre-gl/dist/maplibre-gl-worker.mjs?worker&url"`), as MapLibre's v6 migration guide requires for every bundler; the Map page shows it.
38 changes: 18 additions & 20 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@
"@deck.gl/core": "9.4.0",
"@deck.gl/layers": "9.4.0",
"@deck.gl/mapbox": "9.4.0",
"@deck.gl/maplibre": "9.4.0",
"@fontsource-variable/inter": "5.3.0",
"@fontsource-variable/jetbrains-mono": "5.3.0",
"@happy-dom/global-registrator": "21.0.1",
Expand All @@ -186,7 +187,7 @@
"esbuild": "0.28.2",
"happy-dom": "21.0.4",
"magic-string": "1.4.3",
"maplibre-gl": "5.24.0",
"maplibre-gl": "6.16.0",
"playwright": "1.64.0",
"png-to-ico": "3.0.2",
"shiki": "4.5.0",
Expand All @@ -210,10 +211,11 @@
"typescript": ">=5.0.0",
"@resvg/resvg-js": "^2.6.0",
"png-to-ico": "^3.0.0",
"maplibre-gl": "^5.0.0",
"maplibre-gl": "^5.0.0 || ^6.0.0",
"mapbox-gl": "^3.0.0",
"@deck.gl/core": "~9.4.0",
"@deck.gl/mapbox": "~9.4.0"
"@deck.gl/mapbox": "~9.4.0",
"@deck.gl/maplibre": "~9.4.0"
},
"publishConfig": {
"registry": "https://registry.npmjs.org",
Expand Down Expand Up @@ -258,6 +260,9 @@
},
"@deck.gl/mapbox": {
"optional": true
},
"@deck.gl/maplibre": {
"optional": true
}
}
}
2 changes: 1 addition & 1 deletion packages/ui/scripts/size-limit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const ENTRIES: Entry[] = [
name: "./map",
js: `export * from "./map/index.js";`,
requires: "map/index.js",
external: ["maplibre-gl", "mapbox-gl", "@deck.gl/core", "@deck.gl/mapbox"],
external: ["maplibre-gl", "mapbox-gl", "@deck.gl/core", "@deck.gl/mapbox", "@deck.gl/maplibre"],
},
{
name: "./sound",
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/src/lib/map/MapStage.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
accessToken?: string;
/** Basemap style per color scheme. The map switches style when `colorScheme.resolved` changes, without being recreated. */
styles: MapStyles;
/** deck.gl layers drawn interleaved in the map. Needs `@deck.gl/core` and `@deck.gl/mapbox`. Replace the array to update. */
/** deck.gl layers drawn interleaved in the map. Needs `@deck.gl/core` plus `@deck.gl/maplibre` (`engine="maplibre"`) or `@deck.gl/mapbox` (`engine="mapbox"`). Replace the array to update. */
layers?: unknown[];
/** Bounds to fit, with `padding`. Changing it fits again. */
fit?: MapBounds;
Expand Down Expand Up @@ -137,7 +137,7 @@
return;
}
let cancelled = false;
loadDeckOverlay(current)
loadDeckOverlay(current, engine)
.then((o) => {
if (cancelled) return o.finalize();
overlay = o;
Expand Down
6 changes: 5 additions & 1 deletion packages/ui/src/lib/map/MapStage.test.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
// Harness: MapStage + MapControls with an offline style per scheme, exposing the map handle.
import MapStage from './MapStage.svelte';
import MapControls from './MapControls.svelte';
import type { Map as GlMap } from 'maplibre-gl';
import { setWorkerUrl, type Map as GlMap } from 'maplibre-gl';
// maplibre-gl 6 ships its worker as a separate module and cannot find it once a bundler moves the
// package: the app wires it once (`setWorkerUrl`), as every bundler recipe in its docs does.
import workerUrl from 'maplibre-gl/dist/maplibre-gl-worker.mjs?worker&url';
setWorkerUrl(workerUrl);

let { onready, ...rest }: { onready?: (m: GlMap) => void; [k: string]: unknown } = $props();

Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/lib/map/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @codeatlasdev/ui/map: needs the optional peers `maplibre-gl` or `mapbox-gl`, and for deck.gl
// layers `@deck.gl/core` + `@deck.gl/mapbox`.
// layers `@deck.gl/core` + `@deck.gl/maplibre` (maplibre-gl) or `@deck.gl/mapbox` (mapbox-gl).
export type { Rgba } from "./color.js";
export { rgbaCss, tokenColor } from "./color.js";
export { default as MapControls } from "./MapControls.svelte";
Expand Down
Loading