@mappedin/mappedin-js 6.0.1-beta.8 → 6.1.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 +103 -7
- package/THIRD_PARTY_LICENSES.txt +8901 -21568
- package/lib/esm/GLTFExporter-AEIYURV6.js +2 -0
- package/lib/esm/GLTFExporter-AEIYURV6.js.map +7 -0
- package/lib/esm/GLTFLoader-YNJUYSBY.js +2 -0
- package/lib/esm/GLTFLoader-YNJUYSBY.js.map +7 -0
- package/lib/esm/chunk-C5ID5LHV.js +938 -0
- package/lib/esm/chunk-C5ID5LHV.js.map +7 -0
- package/lib/esm/chunk-DBCMQGTD.js +3820 -0
- package/lib/esm/chunk-DBCMQGTD.js.map +7 -0
- package/lib/esm/chunk-KYQ66GHT.js +2048 -0
- package/lib/esm/chunk-KYQ66GHT.js.map +7 -0
- package/lib/esm/chunk-RIFXMIJM.js +2 -0
- package/lib/esm/chunk-RIFXMIJM.js.map +7 -0
- package/lib/esm/chunk-ROCNZJLL.js +2 -0
- package/lib/esm/chunk-ROCNZJLL.js.map +7 -0
- package/lib/esm/fonts/roboto-regular.ttf +0 -0
- package/lib/esm/index.css +2 -1
- package/lib/esm/index.css.map +7 -0
- package/lib/esm/index.d.ts +27257 -25092
- package/lib/esm/index.js +2 -1
- package/lib/esm/index.js.map +7 -0
- package/lib/esm/inspector-2XETNHYZ.css +2 -0
- package/lib/esm/inspector-2XETNHYZ.css.map +7 -0
- package/lib/esm/inspector-J5CSSXEZ.js +483 -0
- package/lib/esm/inspector-J5CSSXEZ.js.map +7 -0
- package/lib/esm/internal-HTTM4ECA.js +2 -0
- package/lib/esm/internal-HTTM4ECA.js.map +7 -0
- package/lib/esm/internal-R5XTRV7Q.css +2 -0
- package/lib/esm/internal-R5XTRV7Q.css.map +7 -0
- package/lib/esm/roboto-regular-R5KXKW73.js +2 -0
- package/lib/esm/roboto-regular-R5KXKW73.js.map +7 -0
- package/lib/esm/text3d-AXM5ZHCS.css +2 -0
- package/lib/esm/text3d-AXM5ZHCS.css.map +7 -0
- package/lib/esm/text3d-FUGEPZHU.js +253 -0
- package/lib/esm/text3d-FUGEPZHU.js.map +7 -0
- package/lib/esm/workers/collision-worker.csp.js +23 -0
- package/lib/esm/workers/maplibre-worker.csp.js +2 -0
- package/lib/index-rn.js +4306 -0
- package/lib/index.css +2 -1
- package/package.json +24 -21
- package/lib/esm/GLTFExporter-U3XL4636.js +0 -1
- package/lib/esm/GLTFLoader-ZZSMTZWM.js +0 -1
- package/lib/esm/browser-SVJVJINJ.js +0 -1
- package/lib/esm/chunk-2VWRFWQ6.js +0 -1
- package/lib/esm/chunk-5CLC3TYJ.js +0 -1
- package/lib/esm/chunk-I372TFYZ.js +0 -1
- package/lib/esm/chunk-U7HFWTFB.js +0 -1
- package/lib/esm/chunk-VSK4OUQK.js +0 -1
- package/lib/esm/chunk-W7UWRYFM.js +0 -1
- package/lib/esm/inspector-NAPYOCFK.js +0 -1
- package/lib/esm/inspector-OZDC5DPH.css +0 -1
- package/lib/esm/internal-A5US4PAC.js +0 -1
- package/lib/esm/outdoor-context-v4-2KWM7FT2.js +0 -1
package/README.md
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
# Mappedin
|
|
1
|
+
# Mappedin JS
|
|
2
2
|
|
|
3
3
|
## Resources
|
|
4
4
|
|
|
5
5
|
- [Mappedin Developer Portal](https://developer.mappedin.com)
|
|
6
|
-
- [Releases and Roadmap](https://developer.mappedin.com/
|
|
7
|
-
- [Getting Started Guide](https://developer.mappedin.com/web/
|
|
8
|
-
- [
|
|
9
|
-
- [
|
|
6
|
+
- [Releases and Roadmap](https://developer.mappedin.com/docs/roadmap)
|
|
7
|
+
- [Getting Started Guide](https://developer.mappedin.com/web-sdk/getting-started)
|
|
8
|
+
- [Migration Guide](https://developer.mappedin.com/web-sdk/migration-guide)
|
|
9
|
+
- [API Reference](https://developer.mappedin.com/web-sdk/api-reference)
|
|
10
|
+
- [Demo Keys & Maps](https://developer.mappedin.com/docs/demo-keys-and-maps)
|
|
10
11
|
- [License](https://info.mappedin.com/terms/sdk)
|
|
11
12
|
|
|
12
13
|
## Usage
|
|
@@ -32,7 +33,7 @@ async function init() {
|
|
|
32
33
|
});
|
|
33
34
|
const mapContainer = document.getElementById('app');
|
|
34
35
|
const map = await show3dMap(mapContainer, mapData);
|
|
35
|
-
map.Labels.
|
|
36
|
+
map.Labels.__EXPERIMENTAL__all();
|
|
36
37
|
map.on('click', event => {
|
|
37
38
|
const { coordinate } = event;
|
|
38
39
|
const { latitude, longitude } = coordinate;
|
|
@@ -42,4 +43,99 @@ async function init() {
|
|
|
42
43
|
init();
|
|
43
44
|
```
|
|
44
45
|
|
|
45
|
-
For full documentation, read our [Getting Started guide on the Developer Portal](https://developer.mappedin.com/web/
|
|
46
|
+
For full documentation, read our [Getting Started guide on the Developer Portal](https://developer.mappedin.com/web-sdk/getting-started).
|
|
47
|
+
|
|
48
|
+
### Content Security Policy (CSP) Support
|
|
49
|
+
|
|
50
|
+
The SDK provides solutions for applications that use a strict Content Security Policy.
|
|
51
|
+
|
|
52
|
+
#### Minimum Required CSP Rules
|
|
53
|
+
|
|
54
|
+
The following CSP directives are the minimum requirements to run the SDK:
|
|
55
|
+
|
|
56
|
+
| Purpose | CSP Directive | Required Value | Notes |
|
|
57
|
+
| ---------------------- | ------------- | ---------------------- | -------------------------------------------------------------------- |
|
|
58
|
+
| **Images & Textures** | `img-src` | `*.mappedin.com data:` | Required for loading map textures and images |
|
|
59
|
+
| **API & Font Loading** | `connect-src` | `*.mappedin.com data:` | `*.mappedin.com` for map data; `data:` only needed for default fonts |
|
|
60
|
+
| **Web Workers** | `worker-src` | `'self' blob:` | Enables collision detection and MapLibre workers |
|
|
61
|
+
|
|
62
|
+
**Example minimum CSP header:**
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
Content-Security-Policy: img-src *.mappedin.com data:; connect-src *.mappedin.com data:; worker-src 'self' blob:;
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**Alternative for strict CSP environments:**
|
|
69
|
+
If your CSP does not allow `blob:`, you can set up a transparent proxy on your server that forwards requests from `https://YOUR.DOMAIN/mappedin-web-redirector/*` to `https://cdn.mappedin.com/web2/release/*`. This removes the need for additional CSP rules while maintaining functionality.
|
|
70
|
+
|
|
71
|
+
#### Web Worker CSP Solution
|
|
72
|
+
|
|
73
|
+
If your CSP blocks `blob:` URLs or `unsafe-eval` directives (affecting web workers), you can host worker scripts externally:
|
|
74
|
+
|
|
75
|
+
```javascript
|
|
76
|
+
import { setWorkerUrl } from '@mappedin/mappedin-js';
|
|
77
|
+
|
|
78
|
+
// Call this before initializing any maps
|
|
79
|
+
setWorkerUrl('/path/to/workers');
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
This function configures both the MapLibre and collision detection workers to load from external URLs. To set this up:
|
|
83
|
+
|
|
84
|
+
1. Copy the worker files from `node_modules/@mappedin/mappedin-js/lib/esm/workers/` to your web server
|
|
85
|
+
2. Call `setWorkerUrl` with the base URL path to these files
|
|
86
|
+
3. Ensure your CSP allows scripts from this location
|
|
87
|
+
|
|
88
|
+
Example in a build script:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# Copy worker files to your public directory
|
|
92
|
+
cp -r node_modules/@mappedin/mappedin-js/lib/esm/workers ./public/mappedin-workers
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
```javascript
|
|
96
|
+
// In your JavaScript
|
|
97
|
+
setWorkerUrl('/mappedin-workers');
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
#### CSS Injection CSP Solution
|
|
101
|
+
|
|
102
|
+
If your CSP blocks inline styles (`style-src 'unsafe-inline'`), use external CSS loading instead:
|
|
103
|
+
|
|
104
|
+
1. Load the SDK's CSS with a `<link>` tag in your HTML
|
|
105
|
+
2. Disable automatic style injection in `show3dMap` options
|
|
106
|
+
|
|
107
|
+
```html
|
|
108
|
+
<!-- In your HTML file -->
|
|
109
|
+
<link rel="stylesheet" href="/path/to/mappedin-js/index.css" />
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
```javascript
|
|
113
|
+
// In your JavaScript
|
|
114
|
+
const mapView = await show3dMap(element, venue, {
|
|
115
|
+
injectStyles: false, // Disable automatic style injection
|
|
116
|
+
});
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
For your build process:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# Copy CSS file to your public directory
|
|
123
|
+
cp node_modules/@mappedin/mappedin-js/lib/index.css ./public/
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
#### Text3D Worker CSP Solution (Optional)
|
|
127
|
+
|
|
128
|
+
If you use Text3D features (like `labelAll()`) in a CSP-restricted environment, you'll need to disable the Text3D worker if you don't want see error message:
|
|
129
|
+
|
|
130
|
+
```javascript
|
|
131
|
+
import { disableText3DWorker } from '@mappedin/mappedin-js';
|
|
132
|
+
// After initializing your map
|
|
133
|
+
disableText3DWorker();
|
|
134
|
+
|
|
135
|
+
// Now you can use Text3D features without errors or warnings
|
|
136
|
+
mapView.Text3D.labelAll();
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
This disables the worker and processes text on the main thread instead, allowing Text3D to work in CSP environments that block worker creation.
|
|
140
|
+
|
|
141
|
+
You can apply any combination of these solutions based on your specific CSP restrictions and SDK feature usage.
|