Repository navigation
v2.0.0
This is a major version bump. The library went a long time without updates while Mapbox GL JS,
MapLibre GL JS, and SolidJS all moved forward β bringing it current required breaking some things
on purpose rather than silently.
Breaking Changes
-
Default map container styling changed.
<MapGL>'s container div used to default to
position: absolute; inset: 0; z-index: -1(full-bleed, behind sibling content) unless you
suppliedclass/classList/style, in which case the entire default was dropped. It now
defaults to a plain, in-flowwidth: 100%; height: 100%, and a suppliedclass/classList/
stylelayers on top of that minimal default instead of replacing it outright.
Migrate: if you relied on the map auto-filling a positioned ancestor as a full-bleed
background layer, add that explicitly:<MapGL style={{ position: "absolute", inset: 0, "z-index": -1 }} ... />. If you already supplied your ownclass/style, check it doesn't
conflict with the new additivewidth: 100%; height: 100%default. -
window.MapLibglobal removed.MapGLused to stash whichever library it loaded on
window.MapLib(never documented, but reachable). The active library (and anisMapLibreflag)
is now exposed through Solid context instead. Migrate: replacewindow.MapLib.SomeClass
reads withctx.mapLib.SomeClass, whereconst [ctx] = useMapContext()βctx.mapLiband
ctx.isMapLibreare new keys alongside the existingctx.map. -
Peer dependency ranges are now enforced.
mapbox-glandsolid-jsused to be unbounded
("*"). Now:mapbox-gl: ^3.0.0,maplibre-gl: ^4.0.0 || ^5.0.0 || ^6.0.0(added as a
first-class peer instead of only usable viamapLib),solid-js: ^1.8.0 <2.0.0. Both
mapbox-gl/maplibre-glare marked optional inpeerDependenciesMeta, since a consumer only
ever needs one. Migrate: if you're pinned tomapbox-glv1.x/v2.x, upgrade alongside
solid-map-glor stay on the last pre-upgrade version. Peer-dependency mismatches are warnings,
not install-blocking errors, under npm 7+/pnpm/yarn β a newer major than declared will still
install, just with a warning. -
configprop no longer throws on MapLibre β it silently no-ops instead. Passingconfig
while using MapLibre used to throwTypeError: map.setConfigProperty is not a functionfrom
inside a reactive effect. It's now feature-detected and ignored (with adebug()log if
debug/debugEventsis enabled), since MapLibre has no equivalent to Mapbox's Standard Style
config system. Migrate: nothing required. -
Draw'sshowLength/showAreaprops now actually work. These props existed but did
nothing β the custom draw modes that read them were imported but never wired intoDraw's
modesmap. They now produce real, live length/area labels while drawing lines, polygons, and
rectangles.Drawalso registers four extra opt-in modes with no built-in equivalent:
multi_point,radius,rectangle,rectangle_assisted(activate via
draw.changeMode(...)). Migrate: if you were already passingshowLength/showArea
(previously inert), your drawn UI will now show measurement labels β remove the props if you
don't want that. -
Atmosphere'sstyleprop shape now distinguishes MapboxFogfrom MapLibreSky.
styleis now typed asFogSpecification | MapLibreSky, andAtmospherebranches on
ctx.isMapLibreto callmap.setFog(...)(Mapbox) ormap.setSky(...)(MapLibre) with the
correct shape. Migrate: Mapbox-only users see no change. MapLibre users who were passing
Mapbox-shapedFogproperties (previously inert) need to switch to MapLibre'sskyproperty
names (sky-color,horizon-color,fog-color,atmosphere-blend, ...). -
Controltype="traffic"/type="language"removed from the documentedtypeunion.
These were documented but never implemented β passing either value threwnew undefined(...)
at runtime. Docs now only list implementedtypes (navigation,scale,attribution,
fullscreen,geolocate,logo,terrain). Migrate: use thecustomprop with a
manually-constructed instance, e.g.<Control custom={new MapboxTraffic()} />.
Fixed
Terrain's MapLibre-specific DEM defaults now actually take effect β the flag they branched on
(isMapLibre) was never set, so everyTerrainsilently used Mapbox's DEM source regardless of
which library was active.Lightis no longer dropped on a base-style swap (e.g. togglingmb:darkβmb:light, or
dark-mode auto-switching).Source's cachedgetSource()handle no longer goes stale after a base-style swap β every
reactive update now fetches a fresh handle instead of mutating a detachedStyle's source
object.Source's reactivedata/url/tilesupdates are no longer silently dropped when the source
happens to be mid-tiling at the instant the effect runs.- Restoring app layers after a base-style swap no longer clobbers another layer sharing the same
beforeType/beforeIdanchor (an off-by-one ininsertLayers). Drawon MapLibre: keyboard shortcuts (Delete/Backspace/1/2/3) and native-looking control
styling now work β both were silently broken becausemapbox-gl-drawreads Mapbox's CSS class
names internally. Mouse-driven drawing itself was unaffected either way.
Added
DeckOverlaycomponent for integrating deck.gl layers on top of the map. You supply the
overlay class (MapboxOverlay/MapLibreOverlay);solid-map-glnever imports@deck.gl/*
itself, not even as an optional peer.- Expanded
configprop support for the full Mapbox Standard/Standard Satellite schema (3D
toggles, theme, ~20 color overrides). - TypeDoc-generated API reference, committed under
docs/api/.
Changed (non-breaking)
- Deep
mapbox-gl/src/...type imports replaced withmapbox-gl's own public top-level types;
@types/mapbox-gldropped (it had become an empty stub). Only affects unsupported deep imports
of solid-map-gl's own internals, not normalimport MapGL, { Viewport } from "solid-map-gl"
usage. import.meta.env.VITE_MAPBOX_ACCESS_TOKEN/VITE_VECTOR_API_KEY/VITE_RASTER_API_KEY
auto-detection is now guarded so non-Vite bundlers no longer crash when no explicit
apikey/accessTokenis passed.- Build output (
dist/) structure changed: moved fromrollup-preset-solidto
tsup-preset-solid.dist/is now three flat, fully bundled files instead of the old
per-file source tree. The publicsolid-map-glentry point and itsexportsconditions are
unaffected β only undocumented deep imports likesolid-map-gl/dist/esm/...could break.
mapbox-gl.css's import is now left external for the consumer's own bundler to resolve. - Live examples moved from ~30 separately hand-maintained external StackBlitz projects into
examples/in this repo, linked viastackblitz.com/fork/github/...instead.