@unmap/sdk 0.7.0 → 0.9.0

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/README.md CHANGED
@@ -33,13 +33,14 @@ await unmap.router.isochrone([-114.07, 51.05], { minutes: [10, 20] })
33
33
  | `key` | `string` | Required. |
34
34
  | `gateway` | `string` | API base URL. Defaults to `https://api.unmap.dev`. |
35
35
  | `container` | `string \| HTMLElement` | Mount a map here. Omit for geocoding and routing only. |
36
- | `style` | `string` | `calgary` (default), `montreal`, `iqaluit`, or a full style URL. |
37
- | `flavor` | `string` | `base` (default), `muted`, `outdoor`, `decimal`, `blueprint`, `blush`, `orchid`, `canopy`, `lagoon`, or `<style>-<mode>`. |
38
- | `mode` | `string` | `light` or `dark`. Overrides the mode half of `flavor`. |
36
+ | `style` | `string` | `base` (default), `muted`, `outdoor`, `blueprint`, `blush`, `orchid`, `canopy`, `lagoon`, `tropic`, `sunset`, `bold`, `pastel`, or a full style URL. |
37
+ | `flavor` | `string` | Older spelling of `style`: a style name, read only when `style` is omitted. |
38
+ | `mode` | `string` | `light` or `dark`. Selects the mode of the named style. |
39
39
  | `lang` | `string` | Label language, e.g. `fr`. Omit to follow the browser's `Accept-Language`. |
40
- | `theme` | `string` | A `ut1.` theme code from [unmap.dev/create](https://unmap.dev/create). |
40
+ | `theme` | `string` | A theme code (`u…` or `ut1.`) from [unmap.dev/create](https://unmap.dev/create). |
41
41
  | `center` | `[lng, lat]` | Initial centre. |
42
42
  | `zoom` | `number` | Initial zoom. |
43
+ | `controls` | `boolean \| { position }` | Zoom and compass buttons. `true` by default; `false` for a bare canvas. |
43
44
 
44
45
  The instance exposes `.map` (MapLibre GL `Map`, only with a `container`), `.geocoder`
45
46
  (`@unmap/geocoding`), and `.router` (`@unmap/routing`). Everything from those two packages and
@@ -52,6 +53,15 @@ MapLibre's CSS is needed for controls, attribution, markers, and popups. Import
52
53
  transitive dependency; under pnpm's strict layout add it as a direct dependency so the import
53
54
  resolves.
54
55
 
56
+ ## Web worker
57
+
58
+ MapLibre 6 parses tiles in a module worker and locates it through `import.meta.url`, which does not
59
+ reliably resolve inside a bundler's module graph. Bundler users make a one-time `setWorkerUrl()`
60
+ call after copying `maplibre-gl-worker.mjs` and `maplibre-gl-shared.mjs` into their own `public/`.
61
+ Skip it and the map never finishes loading, with no error thrown and no failed request — see
62
+ [@unmap/maps](https://www.npmjs.com/package/@unmap/maps#web-worker) for the script and the call, or
63
+ [the quickstart](https://unmap.dev/docs/quickstart#if-the-map-never-finishes-loading).
64
+
55
65
  ## Docs
56
66
 
57
67
  - [Quickstart](https://unmap.dev/docs/quickstart) and [Overview](https://unmap.dev/docs/overview)
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Map } from '@unmap/maps';
2
- export { DEMO_CITIES, DemoCity, Map, STYLE_NAMES, StyleInput, StyleName, UnmapMapOptions, createMap, maplibregl, unmapStyle } from '@unmap/maps';
1
+ import { Map, UnmapMapOptions, UnmapControlsOptions } from '@unmap/maps';
2
+ export { DEMO_CITIES, DemoCity, Map, Projection, STYLE_NAMES, StyleInput, StyleName, UnmapControlsOptions, UnmapMapOptions, createMap, maplibregl, unmapStyle } from '@unmap/maps';
3
3
  import { Geocoder } from '@unmap/geocoding';
4
4
  export * from '@unmap/geocoding';
5
5
  import { Router } from '@unmap/routing';
@@ -18,8 +18,12 @@ interface UnmapOptions {
18
18
  lang?: string;
19
19
  /** Compact `ut1.` theme code from unmap.dev/create. Wins over the path style on the gateway. */
20
20
  theme?: string;
21
+ /** `"globe"` or `"mercator"`. See `@unmap/maps` `UnmapMapOptions.projection`. */
22
+ projection?: UnmapMapOptions["projection"];
21
23
  center?: [number, number];
22
24
  zoom?: number;
25
+ /** On-map controls. `true` (the default) adds zoom and compass buttons; `false` adds none. */
26
+ controls?: boolean | UnmapControlsOptions;
23
27
  }
24
28
  /**
25
29
  * One Stripe-style key, the whole platform. With a `container` you get a rendered map;
package/dist/index.js CHANGED
@@ -1,5 +1,7 @@
1
1
  // src/index.ts
2
- import { createMap } from "@unmap/maps";
2
+ import {
3
+ createMap
4
+ } from "@unmap/maps";
3
5
  import { Geocoder } from "@unmap/geocoding";
4
6
  import { Router } from "@unmap/routing";
5
7
  export * from "@unmap/geocoding";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { createMap, type Map as MaplibreMap, type UnmapMapOptions } from \"@unmap/maps\";\nimport { Geocoder } from \"@unmap/geocoding\";\nimport { Router } from \"@unmap/routing\";\n\nexport * from \"@unmap/geocoding\";\nexport * from \"@unmap/routing\";\nexport { createMap, unmapStyle, DEMO_CITIES, STYLE_NAMES, maplibregl } from \"@unmap/maps\";\nexport type { Map, UnmapMapOptions, DemoCity, StyleName, StyleInput } from \"@unmap/maps\";\n\nexport interface UnmapOptions {\n key: string;\n gateway?: string;\n /** If provided, a map is mounted in this container. */\n container?: string | HTMLElement;\n style?: string;\n flavor?: string;\n /** \"light\" or \"dark\". Selects the mode half of the named style. */\n mode?: string;\n /** Label language, e.g. \"fr\". Omit to follow the request's Accept-Language. */\n lang?: string;\n /** Compact `ut1.` theme code from unmap.dev/create. Wins over the path style on the gateway. */\n theme?: string;\n center?: [number, number];\n zoom?: number;\n}\n\n/**\n * One Stripe-style key, the whole platform. With a `container` you get a rendered map;\n * `geocoder` and `router` are always available.\n *\n * const map = new Unmap({ key: \"um_live_...\", container: \"#map\", center: [-75.69, 45.42] });\n */\nexport class Unmap {\n readonly geocoder: Geocoder;\n readonly router: Router;\n readonly map?: MaplibreMap;\n\n constructor(opts: UnmapOptions) {\n this.geocoder = new Geocoder(opts);\n this.router = new Router(opts);\n if (opts.container) {\n this.map = createMap({ ...opts, container: opts.container } as UnmapMapOptions);\n }\n }\n}\n"],"mappings":";AAAA,SAAS,iBAAgE;AACzE,SAAS,gBAAgB;AACzB,SAAS,cAAc;AAEvB,cAAc;AACd,cAAc;AACd,SAAS,aAAAA,YAAW,YAAY,aAAa,aAAa,kBAAkB;AA0BrE,IAAM,QAAN,MAAY;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,MAAoB;AAC9B,SAAK,WAAW,IAAI,SAAS,IAAI;AACjC,SAAK,SAAS,IAAI,OAAO,IAAI;AAC7B,QAAI,KAAK,WAAW;AAClB,WAAK,MAAM,UAAU,EAAE,GAAG,MAAM,WAAW,KAAK,UAAU,CAAoB;AAAA,IAChF;AAAA,EACF;AACF;","names":["createMap"]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import {\n createMap,\n type Map as MaplibreMap,\n type UnmapControlsOptions,\n type UnmapMapOptions,\n} from \"@unmap/maps\";\nimport { Geocoder } from \"@unmap/geocoding\";\nimport { Router } from \"@unmap/routing\";\n\nexport * from \"@unmap/geocoding\";\nexport * from \"@unmap/routing\";\nexport { createMap, unmapStyle, DEMO_CITIES, STYLE_NAMES, maplibregl } from \"@unmap/maps\";\nexport type {\n Map,\n UnmapMapOptions,\n UnmapControlsOptions,\n DemoCity,\n StyleName,\n StyleInput,\n Projection,\n} from \"@unmap/maps\";\n\nexport interface UnmapOptions {\n key: string;\n gateway?: string;\n /** If provided, a map is mounted in this container. */\n container?: string | HTMLElement;\n style?: string;\n flavor?: string;\n /** \"light\" or \"dark\". Selects the mode half of the named style. */\n mode?: string;\n /** Label language, e.g. \"fr\". Omit to follow the request's Accept-Language. */\n lang?: string;\n /** Compact `ut1.` theme code from unmap.dev/create. Wins over the path style on the gateway. */\n theme?: string;\n /** `\"globe\"` or `\"mercator\"`. See `@unmap/maps` `UnmapMapOptions.projection`. */\n projection?: UnmapMapOptions[\"projection\"];\n center?: [number, number];\n zoom?: number;\n /** On-map controls. `true` (the default) adds zoom and compass buttons; `false` adds none. */\n controls?: boolean | UnmapControlsOptions;\n}\n\n/**\n * One Stripe-style key, the whole platform. With a `container` you get a rendered map;\n * `geocoder` and `router` are always available.\n *\n * const map = new Unmap({ key: \"um_live_...\", container: \"#map\", center: [-75.69, 45.42] });\n */\nexport class Unmap {\n readonly geocoder: Geocoder;\n readonly router: Router;\n readonly map?: MaplibreMap;\n\n constructor(opts: UnmapOptions) {\n this.geocoder = new Geocoder(opts);\n this.router = new Router(opts);\n if (opts.container) {\n this.map = createMap({ ...opts, container: opts.container } as UnmapMapOptions);\n }\n }\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,OAIK;AACP,SAAS,gBAAgB;AACzB,SAAS,cAAc;AAEvB,cAAc;AACd,cAAc;AACd,SAAS,aAAAA,YAAW,YAAY,aAAa,aAAa,kBAAkB;AAsCrE,IAAM,QAAN,MAAY;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,MAAoB;AAC9B,SAAK,WAAW,IAAI,SAAS,IAAI;AACjC,SAAK,SAAS,IAAI,OAAO,IAAI;AAC7B,QAAI,KAAK,WAAW;AAClB,WAAK,MAAM,UAAU,EAAE,GAAG,MAAM,WAAW,KAAK,UAAU,CAAoB;AAAA,IAChF;AAAA,EACF;AACF;","names":["createMap"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unmap/sdk",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "description": "One key, the whole unmap platform: map + geocoder + router",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -40,10 +40,10 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "maplibre-gl": "^6.7.0",
43
- "@unmap/maps": "0.7.0",
44
- "@unmap/geocoding": "0.7.0",
45
- "@unmap/routing": "0.7.0",
46
- "@unmap/core": "0.7.0"
43
+ "@unmap/maps": "0.9.0",
44
+ "@unmap/geocoding": "0.9.0",
45
+ "@unmap/routing": "0.9.0",
46
+ "@unmap/core": "0.9.0"
47
47
  },
48
48
  "devDependencies": {
49
49
  "tsup": "^8.3.0",