@trackunit/react-map-adapter-mapbox 0.0.117-alpha-12adfed37e0.0 → 0.0.117
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 +20 -0
- package/index.cjs.js +4 -0
- package/index.esm.js +1 -0
- package/package.json +3 -3
- package/src/index.d.ts +1 -0
- package/src/mapbox-map-csp-directives.d.ts +1 -0
package/README.md
CHANGED
|
@@ -13,6 +13,7 @@ npm install @trackunit/react-map @trackunit/react-map-adapter-mapbox
|
|
|
13
13
|
| Export | Role |
|
|
14
14
|
| --- | --- |
|
|
15
15
|
| `mapboxAdapter` | Factory that returns adapter config for `useMap` (from `@trackunit/react-map`) |
|
|
16
|
+
| `mapboxMapCspDirectives` | Factory returning Mapbox GL JS runtime CSP requirements for IrisX app manifests |
|
|
16
17
|
| `MapboxConfig` | Configuration type (access token, theme, language, etc.) |
|
|
17
18
|
| `MapboxAdapterInstance` | Low-level instance factory (advanced use) |
|
|
18
19
|
| `MapboxRenderer` | Internal renderer used by the adapter (advanced or testing) |
|
|
@@ -27,6 +28,25 @@ Important for styles: Import Mapbox GL CSS once in your app entry (for example `
|
|
|
27
28
|
import "mapbox-gl/dist/mapbox-gl.css";
|
|
28
29
|
```
|
|
29
30
|
|
|
31
|
+
## IrisX apps
|
|
32
|
+
|
|
33
|
+
Trackunit does not provide a Mapbox access token. Supply the app's own public token through `mapboxAdapter({ accessToken })`.
|
|
34
|
+
|
|
35
|
+
The IrisX iframe Content Security Policy blocks Mapbox GL JS unless the app declares the adapter's runtime requirements:
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import { mapboxMapCspDirectives } from "@trackunit/react-map-adapter-mapbox";
|
|
39
|
+
|
|
40
|
+
const irisAppManifest = {
|
|
41
|
+
// ...
|
|
42
|
+
cspHeader: {
|
|
43
|
+
...mapboxMapCspDirectives(),
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Use the exported directives instead of copying host lists. Add any origins required by custom styles or tile sources without removing the adapter values.
|
|
49
|
+
|
|
30
50
|
## Cross-provider parity
|
|
31
51
|
|
|
32
52
|
Where Mapbox GL lacks a capability the Google Maps adapter gets natively, this adapter emulates it so consumers see identical behaviour regardless of provider. The clearest case is geodesic arcs: Google draws great-circle edges natively, while Mapbox renders Mercator straight lines, so this adapter densifies edges with `densifyGeodesicFeatures` from `@trackunit/react-map-adapter-shared` to match. Provider gaps are closed inside the adapter — never pushed up to application code.
|
package/index.cjs.js
CHANGED
|
@@ -2928,6 +2928,10 @@ const useMapboxAccessTokenOverride = (accessToken) => {
|
|
|
2928
2928
|
}, [accessToken]);
|
|
2929
2929
|
};
|
|
2930
2930
|
|
|
2931
|
+
Object.defineProperty(exports, "mapboxMapCspDirectives", {
|
|
2932
|
+
enumerable: true,
|
|
2933
|
+
get: function () { return reactMapAdapterShared.mapboxMapCspDirectives; }
|
|
2934
|
+
});
|
|
2931
2935
|
exports.MapboxAdapterInstance = MapboxAdapterInstance;
|
|
2932
2936
|
exports.MapboxRenderer = MapboxRenderer;
|
|
2933
2937
|
exports.mapboxAdapter = mapboxAdapter;
|
package/index.esm.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { canPatchAdaptiveMarker, canPatchAdaptiveViewport, canPatchMarkerInPlace, getAdaptiveDomFeatureIds, buildAdaptiveSymbolStyleFn, extractPointCoordinates, resolveCircleSymbolDefaults, resolveSymbolDescriptor, mergeAntimeridianFeatures, densifyGeodesicFeatures, LAYER_FADE_DURATION_MS, patchPortalDescriptors, buildAdaptiveDomRenderFn, extractSourceData, collectFeatureIdSet, removeGoneIndexedMarkers, createSymbolDotElement, createDefaultClusterElement, createClusterPinElement, fadeInElement, buildAdaptiveDomEntries, attachSafeAreaHoverListeners, resolveSelectedStyle, resolveHoveredStyle, MAP_CURSORS, geometryTypeToShapeType, INITIAL_MAP_STATE, DEFAULT_MAP_APPEARANCE, computeInitialState, cameraStateEquals, isEventOfType, getEffectiveRestrictBounds, DEFAULT_ZOOM, DEFAULT_CENTER, defineAdapter } from '@trackunit/react-map-adapter-shared';
|
|
2
|
+
export { mapboxMapCspDirectives } from '@trackunit/react-map-adapter-shared';
|
|
2
3
|
import { validateBbox, validatePosition } from '@trackunit/geo-json-utils';
|
|
3
4
|
import { isEqual } from 'es-toolkit';
|
|
4
5
|
import mapboxgl from 'mapbox-gl';
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-map-adapter-mapbox",
|
|
3
|
-
"version": "0.0.117
|
|
3
|
+
"version": "0.0.117",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=24.x"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@trackunit/react-map-adapter-shared": "0.0.129
|
|
11
|
-
"@trackunit/geo-json-utils": "1.15.47
|
|
10
|
+
"@trackunit/react-map-adapter-shared": "0.0.129",
|
|
11
|
+
"@trackunit/geo-json-utils": "1.15.47",
|
|
12
12
|
"mapbox-gl": "^3.18.1",
|
|
13
13
|
"supercluster": "^8.0.1",
|
|
14
14
|
"es-toolkit": "^1.39.10",
|
package/src/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { mapboxMapCspDirectives } from "@trackunit/react-map-adapter-shared";
|