@mapmap/maps 0.10.1 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/llms-sdk.txt CHANGED
@@ -25,6 +25,12 @@ height. A bare `<div id="map">` resolves to 0px and MapLibre renders an
25
25
  invisible canvas with no error. Fix: `#map { height: 100vh; }`. The SDK
26
26
  console.errors `[container-zero-height]` when it detects this.
27
27
 
28
+ GOTCHA (Tailwind v4 / CSS cascade layers): maplibre-gl.css is UNLAYERED,
29
+ so `.maplibregl-map { position: relative }` beats layered utilities like
30
+ `absolute`/`inset-0` on the container and collapses it to 0px height.
31
+ Style the map container's position/size with inline styles (or import
32
+ maplibre-gl.css into a CSS layer), never with layered utility classes.
33
+
28
34
  ## Get an API key (self-serve, no account)
29
35
 
30
36
  curl -X POST https://api.mapmap.ai/v1/keys \
@@ -98,6 +104,25 @@ the tip, a `dot` at its centre; `label` draws below with a white halo and
98
104
  `text-optional: true`. They survive `setStyle` and are fully removed —
99
105
  layer, source and registered images — by `clear()`/`destroy()`.
100
106
 
107
+ ## Geocoding (search box, reverse lookup)
108
+
109
+ import { Geocoder } from "@mapmap/maps";
110
+ const geocoder = new Geocoder(map); // or { baseUrl, apiKey } without a map
111
+ // Forward: free-text → GeocodeHit[], best first. Bias to the map centre.
112
+ const hits = await geocoder.geocode("tate modern", { bias: map.map.getCenter(), limit: 5 });
113
+ // hit: { lngLat: [lng, lat], name, kind, street, city, postcode,
114
+ // categories?, details? (opening_hours, phone, website…), id?, raw }
115
+ // Reverse: point → nearest hits. First-party filters:
116
+ await geocoder.reverse(evt.lngLat, { kinds: ["poi"] }); // what did the user tap
117
+ await geocoder.reverse(centre, { categories: ["cafe"] }); // nearest cafés
118
+ await geocoder.reverse(centre, { name: "Lloyds", categories: ["bank"] });
119
+
120
+ A 501 error means the deployment has no geocoding backend (self-host
121
+ without one) — the thrown message says so. Pure helpers `buildGeocodeUrl`
122
+ / `buildReverseGeocodeUrl` / `parseGeocodeResponse` exist for manual
123
+ fetches; like `buildRouteUrl`, the URL does NOT embed the API key — add
124
+ the `Authorization: Bearer snk_…` header yourself.
125
+
101
126
  ## Markers, clustering, store finder
102
127
 
103
128
  import { PlacesLayer } from "@mapmap/maps";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mapmap/maps",
3
- "version": "0.10.1",
3
+ "version": "0.11.1",
4
4
  "description": "MapMap Maps SDK \u2014 a thin, well-typed MapLibre GL JS wrapper that drops a MapMap-branded map with signed territory tiles and OSRM-compatible truck/ADR routing into any web app.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": "Mapmap AI Ltd",
@@ -44,7 +44,7 @@
44
44
  "pmtiles": "^4.3.0",
45
45
  "tsup": "^8.3.5",
46
46
  "typescript": "^5.7.2",
47
- "vitest": "^2.1.8"
47
+ "vitest": "^4.1.10"
48
48
  },
49
49
  "keywords": [
50
50
  "map",
@@ -67,4 +67,4 @@
67
67
  "engines": {
68
68
  "node": ">=18"
69
69
  }
70
- }
70
+ }