@apexara/map 1.1.1 → 1.3.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
@@ -6,6 +6,20 @@ A thin, opinionated Angular wrapper around [Mapbox GL JS](https://docs.mapbox.co
6
6
  - **Mapbox GL**: 3.x
7
7
  - **SSR-safe**: every browser-only call no-ops on the server.
8
8
 
9
+ ## Changes since v1.2.0
10
+
11
+ None to the package's code: 1.3.0 ships the same code as 1.2.0, the first version released with `npm run deploy`
12
+ (RELEASING.md).
13
+
14
+ Four entry points, so a page loads only what it uses:
15
+
16
+ | Import from | Holds | Loads |
17
+ | --- | --- | --- |
18
+ | `@apexara/map` | `<apex-map>`, `MapboxService`, `MapUserLocationLayer`, `apexMapPinchZoom`, the 1.0 utilities | Angular, mapbox-gl (~2 MB) |
19
+ | `@apexara/map/config` | `provideMap`, `MAP_CONFIG`, `MapStyles` | `@angular/core` only |
20
+ | `@apexara/map/search` | `MapboxSearchService` (address autocomplete) | Angular, no mapbox-gl |
21
+ | `@apexara/map/geo` | `MapGeometryUtil`, `MapColorUtil`, `MapSearchResponseUtil`, `MapStaticImageUtil`, `MapGeolocationUtil` | nothing: no Angular, no mapbox-gl |
22
+
9
23
  ---
10
24
 
11
25
  ## Table of contents
@@ -26,11 +40,18 @@ A thin, opinionated Angular wrapper around [Mapbox GL JS](https://docs.mapbox.co
26
40
  - [Events](#events)
27
41
  - [Images & icons](#images--icons)
28
42
  - [Teardown](#teardown)
43
+ - [Polygon draw](#polygon-draw)
44
+ - [User location](#user-location)
45
+ - [Pinch zoom over overlays](#pinch-zoom-over-overlays)
29
46
  - [Utilities](#utilities)
47
+ - [Geometry: `@apexara/map/geo`](#geometry-apexaramapgeo)
48
+ - [Address search: `@apexara/map/search`](#address-search-apexaramapsearch)
49
+ - [Static images](#static-images)
30
50
  - [Types & tokens](#types--tokens)
31
51
  - [Recipes](#recipes)
32
52
  - [SSR notes](#ssr-notes)
33
53
  - [Troubleshooting](#troubleshooting)
54
+ - [Changes since v1.1.1](#changes-since-v111)
34
55
 
35
56
  ---
36
57
 
@@ -234,9 +255,35 @@ async addMyLayers(): Promise<void> {
234
255
  - `getCenter()` / `getZoom()` — imperative reads; prefer the signals.
235
256
  - `getViewportPolygon()` — the current viewport as a closed GeoJSON ring (`[sw, se, ne, nw, sw]`).
236
257
  - `moveCenter([lng, lat], zoom = 13)` — animated `flyTo`.
237
- - `fitBounds(bounds, padding = 40)` — animated `fitBounds`.
258
+ - `fitBounds(bounds, options?, eventData?)` — animated `fitBounds`. A number is the padding (default 40) of a one-second
259
+ slide, as in 1.0. An options object (`padding` as a number or per side, `maxZoom`, `duration`, `animate: false`, …)
260
+ lays over those same defaults.
261
+ - `flyTo(options, eventData?)`, `easeTo(options, eventData?)`, `jumpTo(options, eventData?)` — mapbox's camera calls
262
+ with every option (`duration`, `curve`, `offset`, …).
263
+ - `resize(eventData?)` — have mapbox re-read its container's size, e.g. from a `ResizeObserver`. The resize fires
264
+ `movestart` / `moveend`, which carry `eventData`. A no-op before the map exists.
238
265
  - `project(lngLat)` — geographic → pixel coordinates.
239
- - `setStyle(styleUrl)` — swap the base style. **Re-apply your custom sources/layers after `styledata` — Mapbox drops them during the swap.**
266
+ - `isPointOnScreen(lngLat, insets = 0)` — whether the point projects inside the canvas, `insets` pixels in from its
267
+ edges (one number, or `{ top, right, bottom, left }`, a side left out being 0). `false` before the map exists.
268
+ - `setStyle(styleUrl, options?)` — swap the base style. `{ diff: false }` rebuilds the style from scratch: use it when
269
+ mapbox's diff keeps one of your sources and the rebuild then throws on it. **Re-apply your custom sources/layers after
270
+ `styledata` — Mapbox drops them during the swap.**
271
+
272
+ `eventData` is copied by mapbox onto the move's `movestart` / `moveend`, which is how a listener tells the app's own
273
+ moves from the reader's:
274
+
275
+ ```ts
276
+ const PROGRAMMATIC_MOVE = { programmaticMove: true };
277
+
278
+ map.fitBounds(bounds, { padding: 60, maxZoom: 15, animate: false }, PROGRAMMATIC_MOVE);
279
+ map.flyTo({ center: [-80.84, 35.22], zoom: 14, duration: 900, curve: 1.2 }, PROGRAMMATIC_MOVE);
280
+ map.on('moveend', (event: { programmaticMove?: boolean }) => {
281
+ if (!event.programmaticMove) { /* the reader moved the map */ }
282
+ });
283
+ ```
284
+
285
+ The map is shared: `activeContainer()` is the container showing it now, and `isShownIn(element)` says whether that is
286
+ `element` or something inside it. A consumer whose container is not the active one should leave the camera alone.
240
287
 
241
288
  ### Sources
242
289
 
@@ -256,6 +303,17 @@ map.removeSource('stops');
256
303
  map.hasSource('stops'); // boolean
257
304
  ```
258
305
 
306
+ `data` takes any GeoJSON (a collection, a single `Feature`, a geometry) or a URL.
307
+
308
+ `upsertSource(config)` adds the source, or replaces the data of the one already under `config.id` in place (its other
309
+ options stay). It returns `true` when it added it, so the caller adds the layers that draw it only once:
310
+
311
+ ```ts
312
+ if (map.upsertSource({ id: 'drawn', data: collection })) {
313
+ map.addLayer({ id: 'drawn-fill', type: 'fill', source: 'drawn', paint: { 'fill-opacity': 0.12 } });
314
+ }
315
+ ```
316
+
259
317
  ### Layers
260
318
 
261
319
  ```ts
@@ -278,8 +336,12 @@ map.toggleLayerVisibility('tiles');
278
336
  map.getLayerIds(); // all layer ids in the current style
279
337
  map.hasLayer('stops-circles');
280
338
  map.safeRemoveLayer('stops-circles');
339
+ map.moveLayer('stops-circles'); // to the top
340
+ map.moveLayer('stops-circles', 'road-label'); // just under another layer
281
341
  ```
282
342
 
343
+ `moveLayer` no-ops when the layer is missing.
344
+
283
345
  ### Filters, paint, layout
284
346
 
285
347
  ```ts
@@ -326,6 +388,14 @@ map.on('click', 'clusters', async (e: mapboxgl.MapMouseEvent) => {
326
388
 
327
389
  `getClusterProperties(sourceId, clusterId, limit = 10000, offset = 0)` rejects if the source is missing or not clustered.
328
390
 
391
+ `getClusterExpansionZoom(sourceId, clusterId)` resolves the zoom at which the cluster splits, to ease into it. It rejects
392
+ the same way, and when mapbox answers with no zoom:
393
+
394
+ ```ts
395
+ const zoom = await map.getClusterExpansionZoom('stops', props.cluster_id);
396
+ map.easeTo({ center: clusterCenter, zoom });
397
+ ```
398
+
329
399
  ### Events
330
400
 
331
401
  `on` supports both the raw two-arg form and the layer-scoped three-arg form:
@@ -336,7 +406,12 @@ map.on('mouseenter', 'stops-circles', () => { /* ... */ });
336
406
  map.off('click', 'stops-circles', handler);
337
407
  ```
338
408
 
339
- `getRenderedFeatures(point, { layers })` queries what's drawn under a screen point.
409
+ `getRenderedFeatures(geometry?, { layers, filter })` queries what's drawn under a screen point, inside a
410
+ `[corner, corner]` box, or across the whole viewport when `geometry` is `undefined`; `filter` is a mapbox expression:
411
+
412
+ ```ts
413
+ const stillShown = map.getRenderedFeatures(undefined, { layers: ['pins'], filter: ['==', ['get', 'id'], selectedId] });
414
+ ```
340
415
 
341
416
  `getFeatureProperties<T>(event)` is a convenience to pull typed `properties` off the first feature in an event.
342
417
 
@@ -366,6 +441,67 @@ map.replaceImage('price-pill', pixels, {
366
441
  (`pixelRatio`, `sdf`, `stretchX` / `stretchY`, `content`). Re-register after a `setStyle` that replaces the style: the
367
442
  runtime images go with it.
368
443
 
444
+ ### Polygon draw
445
+
446
+ `enableDrawPolygon(options?)` mounts `@mapbox/mapbox-gl-draw` (no UI of its own) in `draw_polygon` mode and locks the
447
+ map's gestures so the view holds still. The reader clicks corners and double-clicks (or clicks the first corner) to
448
+ close the shape, which arrives on `polygonCreate`.
449
+
450
+ - `{ keepPanZoom: true }` leaves drag, wheel and pinch zoom on (a click still adds a corner on a moving map, and a map
451
+ that will not pan reads as broken); box zoom, double-click zoom (it closes the shape) and keyboard stay locked.
452
+ - `finishDrawPolygon()` closes the shape in progress, as a double-click would, e.g. from a "Done" button. It arrives on
453
+ `polygonCreate` when it has three corners or more. Draw mode stays until `disableDrawPolygon()`.
454
+ - `disableDrawPolygon()` removes the control and every drawn shape and gives the gestures back as they were.
455
+ - `clearDrawnPolygons()` removes the drawn shapes and stays in draw mode.
456
+
457
+ ```ts
458
+ map.polygonCreate.subscribe((polygon) => this.scope.set(polygon));
459
+ map.enableDrawPolygon({ keepPanZoom: true });
460
+ // "Done" button:
461
+ map.finishDrawPolygon();
462
+ ```
463
+
464
+ ### User location
465
+
466
+ `MapUserLocationLayer` puts the reader's location on the map as a dot and flies to it. It is not injectable: a map
467
+ surface builds one with its `MapboxService`. The dot's look and the zoom it flies to are the consumer's: `style` and
468
+ `zoom` are required and have no default.
469
+
470
+ ```ts
471
+ import { MapUserLocationLayer } from '@apexara/map';
472
+
473
+ const me = new MapUserLocationLayer(map, {
474
+ zoom: 14,
475
+ style: { circleRadius: 8, circleColor: '#1f6feb', strokeColor: '#ffffff', strokeWidth: 3 },
476
+ });
477
+
478
+ await me.init(); // one read of the location, draws the dot; the camera stays
479
+ await me.locate(); // flies to it, reading it first when none is known yet
480
+ me.repaint(); // after a style swap
481
+ me.destroy(); // on teardown; the location is kept
482
+ ```
483
+
484
+ `init` and `locate` resolve to a `MapLocateResult` (`located` with `position`, `denied`, or `unavailable`) and never
485
+ reject. `location` is a signal of the last `[lng, lat]` read. Options: `style` (`circleRadius`, `circleColor`,
486
+ `strokeColor`, `strokeWidth`, all required), `zoom` (required), `sourceId` (`'user-location'`) and `layerId`
487
+ (`'user-location-dot'`).
488
+
489
+ ### Pinch zoom over overlays
490
+
491
+ A trackpad pinch arrives as ctrl+wheel. Over anything laid on the map (a card, the map's buttons, a legend) it zooms the
492
+ whole page. `apexMapPinchZoom` hands it to the map under it instead, the same as a pinch over the map itself:
493
+
494
+ ```html
495
+ <div class="map-page" apexMapPinchZoom>
496
+ <apex-map />
497
+ <aside class="legend">…</aside>
498
+ </div>
499
+ ```
500
+
501
+ Put it on the overlay itself or on a container holding the map and its overlays. It acts only while the shared map is
502
+ shown inside that element (or inside the element an anchored card is positioned in), only over the map's own box, and
503
+ only while the map's wheel zoom is on.
504
+
369
505
  ### Teardown
370
506
 
371
507
  The shared map is never destroyed. `deactivate(container)` takes it off `container`: it moves back to the container
@@ -394,11 +530,125 @@ const ring = calculateViewportPolygonFromCenter([-80.84, 35.22], 0.5);
394
530
 
395
531
  - `flattenCoords(arr)` — flatten any GeoJSON coordinate nesting into `[lng, lat][]`. Takes a geometry's
396
532
  `coordinates` as they are (`Position`, `Position[]`, `Position[][]`, `Position[][][]`), no cast needed.
397
- - `calculateBounds(coords)` — `[[minLng, minLat], [maxLng, maxLat]]`, compatible with `LngLatBoundsLike`.
533
+ - `calculateBounds(coords, options?)` — `[[minLng, minLat], [maxLng, maxLat]]`, compatible with `LngLatBoundsLike`.
534
+ `{ wrapAntimeridian: true }` frames a shape across ±180° by its narrower side (see `MapGeometryUtil.boundsOf`).
398
535
  - `calculateViewportPolygonFromCenter(center, radiusKm = 0.5)` — a closed square ring around `center`.
399
536
 
400
537
  ---
401
538
 
539
+ ## Geometry: `@apexara/map/geo`
540
+
541
+ `MapGeometryUtil` is plain math with no runtime imports, so a server, a list page without a map or a worker can use it.
542
+ Every point is `[lng, lat]`.
543
+
544
+ ```ts
545
+ import { MapGeometryUtil } from '@apexara/map/geo';
546
+
547
+ MapGeometryUtil.milesBetween([-80.84, 35.22], [-78.64, 35.78], 2); // 129.66: haversine, rounded when decimals are given
548
+ MapGeometryUtil.hasLocation(lng, lat); // finite, and not the 0, 0 of a missing location
549
+ MapGeometryUtil.boundsAround(center, 2 * MapGeometryUtil.METRES_PER_MILE); // [[w, s], [e, n]] reaching that far
550
+ MapGeometryUtil.circleRing(center, 1609.344); // closed 64-segment ring, for a GeoJSON Polygon
551
+ MapGeometryUtil.cameraForBounds(bounds, frame.getBoundingClientRect(), 40); // { center, zoom } | null, no map needed
552
+ MapGeometryUtil.boundsOf(featureCollection, { wrapAntimeridian: true }); // [[w, s], [e, n]] | null
553
+ MapGeometryUtil.containsBounds(outer, inner, 0.001); // outer covers inner, forgiving 0.1% of its span
554
+ MapGeometryUtil.sameOuterRing(previous, next); // same outer ring, point for point
555
+ ```
556
+
557
+ - `boundsOf(geoJson, options?)` takes any GeoJSON (a collection, a feature, a geometry, a geometry collection) and walks
558
+ its positions in place, with no flat copy: a state's hundreds of thousands of points cost no allocation. Features with
559
+ no geometry are skipped; no position at all gives `null`. With `wrapAntimeridian` it also measures longitudes on
560
+ 0–360 and keeps the narrower span, so the Aleutians frame as `[[172, 51], [190, 53]]` rather than the whole planet
561
+ (mapbox wraps an east past 180 itself).
562
+ - `cameraForBounds(bounds, size, padding = 0, maxZoom = 22)` — the Web Mercator centre and zoom fitting a box in a
563
+ frame before any map exists (mapbox's own needs one), e.g. for `MapInitOptions`. `null` when the padding leaves no
564
+ room; a box with no area stops at `maxZoom`.
565
+ - `boundsAround` and `circleRing` measure a degree as 111,320 m, with longitude narrowing by the cosine of the latitude,
566
+ so a circle and the box framing it always agree.
567
+ - `forEachPosition(coordinates, visit)` — calls `visit` with every position at any nesting, as the arrays they are
568
+ (`flattenCoords` is built on it).
569
+ - `containsBounds(outer, inner, tolerance = 0)` — whether `outer` covers all of `inner`, edges included. `tolerance`
570
+ forgives a miss up to that share of `inner`'s span per axis, for a box framed to the other's edge where rounding can
571
+ leave it a hair short.
572
+ - `sameOuterRing(first, second)` — whether two polygons' outer rings match point for point (holes are not compared; two
573
+ `null`s match). Use it as the `equal` of a signal holding `getViewportPolygon()`, so an unmoved camera is no change:
574
+
575
+ ```ts
576
+ const viewport = signal<Position[][] | null>(null, { equal: (first, second) => MapGeometryUtil.sameOuterRing(first, second) });
577
+ ```
578
+
579
+ `MapColorUtil.toMapboxColor(cssColor)` turns `#rrggbbaa` and `#rgba`, which mapbox's style parser rejects, into
580
+ `rgba(r, g, b, a)` with the alpha to three places, and leaves any other value as it is. Use it on a paint colour read from
581
+ a CSS custom property:
582
+
583
+ ```ts
584
+ const fill = MapColorUtil.toMapboxColor(getComputedStyle(document.documentElement).getPropertyValue('--area-fill').trim());
585
+ ```
586
+
587
+ `MapGeolocationUtil.locate(options?)` is one read of the browser's location as a promise that always resolves:
588
+ `{ status: 'located', position: [lng, lat] }`, `{ status: 'denied' }` (the reader refused) or
589
+ `{ status: 'unavailable' }` (no geolocation, a timeout, an error). `options` are the browser's `maximumAge`, `timeout`
590
+ and `enableHighAccuracy`.
591
+
592
+ ---
593
+
594
+ ## Address search: `@apexara/map/search`
595
+
596
+ `MapboxSearchService` is address autocomplete over the Mapbox Search Box API, with the token from `provideMap`. It does
597
+ not load mapbox-gl, so an address field costs no map.
598
+
599
+ ```ts
600
+ import { MapboxSearchService } from '@apexara/map/search';
601
+
602
+ private readonly search = inject(MapboxSearchService);
603
+
604
+ const suggestions = await this.search.suggest(term, { types: 'address', country: 'us', limit: 6 });
605
+ const place = await this.search.retrieve(suggestions[0].mapboxId); // the only call with lat / lon
606
+ ```
607
+
608
+ - The filters are the app's choice: `types`, `country` and `limit` are sent only when given, and each one left out
609
+ takes Mapbox's default. The package sets none.
610
+ - Billed per session: `suggest` calls share one session token until a `retrieve` ends it, and the next `suggest` starts
611
+ a new one. Retrieve on a pick, not on every keystroke.
612
+ - A `MapSearchResult` is `{ mapboxId, name, fullAddress, city, region, postcode, lat, lon }`: `name` is the street line
613
+ for an address, `region` and `postcode` carry Mapbox's own names (`region` is its `region_code`, e.g. `NC`), and
614
+ `lat` / `lon` are `null` on a suggestion. A field Mapbox did not send is `''`.
615
+ - Quiet on failure: an error status, a network error or the 5-second timeout give `[]` / `null`. `isAvailable` is
616
+ `false` with no token or on the server, and then nothing is requested.
617
+ - It calls `fetch`, never `HttpClient`, so an app's interceptors cannot send its own credentials to api.mapbox.com.
618
+
619
+ `MapSearchResponseUtil` (in `@apexara/map/geo`) is the parser it uses, for code that calls Mapbox itself:
620
+ `localityOf(context)` reads `city`, `region` and `postcode` from a `context` (Search Box and Geocoding v6 share the
621
+ shape), `resultOf(suggestion)` and `placeOf(mapboxId, feature)` build results.
622
+
623
+ ---
624
+
625
+ ## Static images
626
+
627
+ `MapStaticImageUtil.url(options)` (in `@apexara/map/geo`) builds a Mapbox Static Images URL: a style rendered as one
628
+ still, e.g. a placeholder while the live map is held back.
629
+
630
+ ```ts
631
+ import { MapStaticImageUtil } from '@apexara/map/geo';
632
+ import { MapStyles } from '@apexara/map/config';
633
+
634
+ const still = MapStaticImageUtil.url({
635
+ accessToken: environment.mapboxToken,
636
+ style: MapStyles.LightV11,
637
+ center: [-80.84, 35.22],
638
+ zoom: 11,
639
+ width: 800,
640
+ height: 600,
641
+ retina: true,
642
+ attribution: false,
643
+ logo: false,
644
+ });
645
+ ```
646
+
647
+ `style` is a hosted style (`mapbox://styles/<owner>/<id>` or `<owner>/<id>`). Options left out take mapbox's defaults
648
+ (bearing and pitch 0, attribution and logo shown); width and height go up to 1280.
649
+
650
+ ---
651
+
402
652
  ## Types & tokens
403
653
 
404
654
  ```ts
@@ -412,18 +662,45 @@ import {
412
662
 
413
663
  // The map itself (loads mapbox-gl).
414
664
  import {
665
+ type MapDrawOptions,
666
+ type MapEventData,
667
+ type MapFeatureQuery,
668
+ type MapFitOptions,
415
669
  type MapImageOptions,
416
670
  type MapImageSource,
417
671
  type MapInitOptions,
672
+ type MapInsets,
673
+ type MapQueryGeometry,
674
+ type MapStyleOptions,
675
+ type MapUserLocationConfig,
676
+ type MapUserLocationStyle,
418
677
  type SourceConfig,
419
678
  } from '@apexara/map';
679
+
680
+ // No runtime imports.
681
+ import {
682
+ type MapBounds,
683
+ type MapBoundsOptions,
684
+ type MapCamera,
685
+ type MapLngLat,
686
+ type MapLocateResult,
687
+ type MapSearchResult,
688
+ type MapStaticImageOptions,
689
+ } from '@apexara/map/geo';
420
690
  ```
421
691
 
422
692
  `@apexara/map` re-exports everything `@apexara/map/config` holds (one token, not a copy), so 1.0.0 imports keep working.
423
693
 
424
694
  - `MapStyles` — enum of common Mapbox-hosted styles (`Streets`, `Sat`, `DarkV11`, `LightV11`, `OutdoorsV12`).
425
695
  - `MapInitOptions` — shape accepted by `MapboxService.init` (the component builds this for you).
426
- - `SourceConfig` — shape accepted by `addSource` (GeoJSON + clustering flags).
696
+ - `SourceConfig` — shape accepted by `addSource` / `upsertSource` (any GeoJSON or a URL, + clustering flags).
697
+ - `MapFitOptions` — `fitBounds` options (mapbox's `EasingOptions`); `MapEventData` — what camera calls pass on to the
698
+ move's events.
699
+ - `MapQueryGeometry` / `MapFeatureQuery` — what `getRenderedFeatures` takes; `MapInsets` — `isPointOnScreen`'s insets.
700
+ - `MapStyleOptions` (`diff`), `MapDrawOptions` (`keepPanZoom`), `MapUserLocationConfig` / `MapUserLocationStyle` (the
701
+ dot's look, required).
702
+ - `MapLngLat` (`[lng, lat]`), `MapBounds` (`[[w, s], [e, n]]`), `MapCamera`, `MapLocateResult`, `MapSearchResult`,
703
+ `MapStaticImageOptions` — from `@apexara/map/geo`.
427
704
  - `MapImageSource` / `MapImageOptions` — what `replaceImage` accepts (the image and `addImage`'s options).
428
705
  - `MapConfig` / `MAP_CONFIG` — root-level token, usually set via `provideMap`.
429
706
 
@@ -491,6 +768,32 @@ map.setStyle(MapStyles.DarkV11);
491
768
  - **Sources/layers disappear after `setStyle`** — Mapbox replaces the entire style. Re-add them in a `styledata` listener.
492
769
  - **`setFeatureState` does nothing** — the source was added without `generateId: true` and features have no numeric `id`.
493
770
  - **Cluster expand rejects** — the `sourceId` either doesn't exist or was added without `clustered: true`.
771
+ - **`setStyle` throws "There is already a source with ID …"** — mapbox's diff kept a source your rebuild adds again.
772
+ Pass `{ diff: false }`.
773
+
774
+ ---
775
+
776
+ ## Changes since v1.1.1
777
+
778
+ Additions only; every 1.1.1 call works as before.
779
+
780
+ - **Two new entry points.** `@apexara/map/geo` (no runtime imports): `MapGeometryUtil`, `MapColorUtil`,
781
+ `MapSearchResponseUtil`, `MapStaticImageUtil`, `MapGeolocationUtil`, `MapApiConfig` and their types.
782
+ `@apexara/map/search` (no mapbox-gl): `MapboxSearchService`, whose `suggest` filters are the app's to pass. A
783
+ `MapSearchResult` names its parts as Mapbox does: `city`, `region`, `postcode`.
784
+ - **Camera.** `fitBounds` also takes an options object and event data; new `flyTo`, `easeTo`, `jumpTo` and
785
+ `resize` with event data; `isPointOnScreen(lngLat, insets?)`; `isShownIn(element)`.
786
+ - **Clusters.** `getClusterExpansionZoom(sourceId, clusterId)`.
787
+ - **Style.** `setStyle(styleUrl, { diff })`.
788
+ - **Sources and layers.** `upsertSource(config)`; `SourceConfig.data` and `updateSource` take any GeoJSON;
789
+ `moveLayer(id, beforeId?)`; `getRenderedFeatures` takes a box, no geometry (the whole viewport) and a `filter`.
790
+ - **Polygon draw.** `enableDrawPolygon({ keepPanZoom })` and `finishDrawPolygon()`.
791
+ - **Bounds.** `calculateBounds(coords, { wrapAntimeridian })`. `calculateBounds` and `flattenCoords` now run on
792
+ `MapGeometryUtil`; their answers for valid coordinates are unchanged. `MapGeometryUtil.containsBounds` and
793
+ `sameOuterRing` compare boxes and rings.
794
+ - **Colours.** `MapColorUtil.toMapboxColor` turns the hex forms mapbox rejects (`#rrggbbaa`, `#rgba`) into `rgba(...)`.
795
+ - **New pieces.** `MapUserLocationLayer` (the location dot, in the app's own `style`, and the fly to it at the app's
796
+ own `zoom`) and the `apexMapPinchZoom` directive.
494
797
 
495
798
  ---
496
799