maplibre-gl-components 0.12.2 → 0.14.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.
Files changed (47) hide show
  1. package/README.md +26 -1
  2. package/dist/{ControlGrid-CcOIR0lI.js → ControlGrid-C50dMHKH.js} +26623 -24668
  3. package/dist/{ControlGrid-BHj06tuI.cjs → ControlGrid-CeBx0eSA.cjs} +616 -593
  4. package/dist/{deflate-BeG874Ez.js → deflate-2UPB1DER.js} +1 -1
  5. package/dist/{deflate-Buv4KFPQ.cjs → deflate-DE_6Tu1v.cjs} +1 -1
  6. package/dist/{geotiff-CY9Ly-G7.js → geotiff-Bm1hERxI.js} +8 -8
  7. package/dist/{geotiff-D9Jxidvv.cjs → geotiff-CqKxlcxH.cjs} +2 -2
  8. package/dist/index-B3hAiB3W.js +4 -0
  9. package/dist/{index-CkoU3LUr.js → index-BOzG2jBO.js} +2 -2
  10. package/dist/{index-ChPRo5p6.cjs → index-BcQIUorP.cjs} +1 -1
  11. package/dist/{index-CsAfY_en.cjs → index-wUaULgz-.cjs} +1 -1
  12. package/dist/index.cjs +3819 -1
  13. package/dist/index.mjs +19540 -180
  14. package/dist/{jpeg-K5f1PGmj.cjs → jpeg-DOGSyqmU.cjs} +1 -1
  15. package/dist/{jpeg-DxFhLjr0.js → jpeg-Oi0NUa0d.js} +1 -1
  16. package/dist/{lerc-DBi1jyo4.cjs → lerc-ClKCnxkg.cjs} +1 -1
  17. package/dist/{lerc-BKz5PmNT.js → lerc-GEl3vfh2.js} +2 -2
  18. package/dist/{lzw-_5PJSl3d.js → lzw-BWnPY6Nd.js} +1 -1
  19. package/dist/{lzw-1pa4hURZ.cjs → lzw-CdNKcZyA.cjs} +1 -1
  20. package/dist/maplibre-gl-components.css +1 -1
  21. package/dist/{packbits-D8NpPMS2.cjs → packbits-DA_gKBrr.cjs} +1 -1
  22. package/dist/{packbits-DB0-GTif.js → packbits-N4O0lK34.js} +1 -1
  23. package/dist/{raw-DaYOG1dh.js → raw-C_7LFtVe.js} +1 -1
  24. package/dist/{raw-Ady0oBU-.cjs → raw-DjO0R23L.cjs} +1 -1
  25. package/dist/react.cjs +1 -1
  26. package/dist/react.mjs +4 -4
  27. package/dist/types/index.d.ts +6 -1
  28. package/dist/types/index.d.ts.map +1 -1
  29. package/dist/types/lib/addControlGrid.d.ts.map +1 -1
  30. package/dist/types/lib/core/Basemap.d.ts.map +1 -1
  31. package/dist/types/lib/core/ChoroplethControl.d.ts +105 -0
  32. package/dist/types/lib/core/ChoroplethControl.d.ts.map +1 -0
  33. package/dist/types/lib/core/ColorbarGuiControl.d.ts +79 -0
  34. package/dist/types/lib/core/ColorbarGuiControl.d.ts.map +1 -0
  35. package/dist/types/lib/core/ControlGrid.d.ts.map +1 -1
  36. package/dist/types/lib/core/HtmlGuiControl.d.ts +68 -0
  37. package/dist/types/lib/core/HtmlGuiControl.d.ts.map +1 -0
  38. package/dist/types/lib/core/LegendGuiControl.d.ts +69 -0
  39. package/dist/types/lib/core/LegendGuiControl.d.ts.map +1 -0
  40. package/dist/types/lib/core/PrintControl.d.ts +46 -1
  41. package/dist/types/lib/core/PrintControl.d.ts.map +1 -1
  42. package/dist/types/lib/core/types.d.ts +408 -1
  43. package/dist/types/lib/core/types.d.ts.map +1 -1
  44. package/dist/{webimage-CI-Xhwi8.cjs → webimage-BtstXjHv.cjs} +1 -1
  45. package/dist/{webimage-B65eRBzD.js → webimage-DkvnM6pZ.js} +1 -1
  46. package/package.json +4 -2
  47. package/dist/index-Bhn2Pjz_.js +0 -4
package/README.md CHANGED
@@ -29,6 +29,7 @@ Legend, colorbar, basemap switcher, terrain toggle, search, vector data loader,
29
29
  - **MinimapControl** - Inset overview map showing the current viewport extent with optional click-to-navigate
30
30
  - **ControlGrid** - Collapsible toolbar grid that hosts any combination of built-in and plugin controls
31
31
  - **addControlGrid** - One-call convenience function to add all default controls with customization
32
+ - **Three.js Integration** - Re-exported helpers (`MapScene`, `SceneTransform`, `Sun`, `Creator`) from `@dvt3d/maplibre-three-plugin`
32
33
  - **Zoom-based Visibility** - Show/hide components at specific zoom levels with `minzoom`/`maxzoom`
33
34
  - **React Support** - First-class React components and hooks
34
35
  - **TypeScript** - Full type definitions included
@@ -1316,6 +1317,8 @@ interface PrintControlOptions {
1316
1317
  quality?: number; // JPEG quality 0-1 (default: 0.92)
1317
1318
  filename?: string; // Default filename without extension (default: 'map-export')
1318
1319
  title?: string; // Optional title rendered on the image
1320
+ includeNorthArrow?: boolean; // Include north arrow in export (default: false)
1321
+ includeScaleBar?: boolean; // Include scale bar in export (default: false)
1319
1322
  titleFontSize?: number; // Title font size in pixels (default: 24)
1320
1323
  titleFontColor?: string; // Title font color (default: '#333333')
1321
1324
  titleBackground?: string; // Title background (default: 'rgba(255,255,255,0.8)')
@@ -1354,6 +1357,8 @@ const printControl = new PrintControl({
1354
1357
  filename: "my-map",
1355
1358
  format: "png",
1356
1359
  title: "My Map Title",
1360
+ includeNorthArrow: true,
1361
+ includeScaleBar: true,
1357
1362
  });
1358
1363
  map.addControl(printControl, "top-right");
1359
1364
 
@@ -1367,6 +1372,8 @@ const dataUrl = await printControl.exportMap({
1367
1372
  format: "jpeg",
1368
1373
  quality: 0.95,
1369
1374
  title: "Custom Title",
1375
+ includeNorthArrow: true,
1376
+ includeScaleBar: true,
1370
1377
  });
1371
1378
 
1372
1379
  // Export as PDF (requires jspdf)
@@ -1377,6 +1384,7 @@ await printControl.exportMap({ format: "pdf" });
1377
1384
 
1378
1385
  - Export as PNG, JPEG, or PDF
1379
1386
  - Optional title overlay rendered on the exported image
1387
+ - Optional north arrow and scale bar overlays in exported output
1380
1388
  - Customizable filename, quality, and export size
1381
1389
  - Copy to clipboard (PNG/JPEG only)
1382
1390
  - PDF export with auto landscape/portrait detection, fitted to A4 page
@@ -1473,6 +1481,7 @@ interface ControlGridOptions {
1473
1481
  gap?: number; // Gap between cells in pixels (default: 6)
1474
1482
  basemapStyleUrl?: string; // Basemap style URL for SwipeControl
1475
1483
  excludeLayers?: string[]; // Layer patterns to exclude from SwipeControl
1484
+ streetViewOptions?: Partial<StreetViewControlOptions>; // Optional API keys and StreetView config overrides
1476
1485
  backgroundColor?: string;
1477
1486
  padding?: number;
1478
1487
  borderRadius?: number;
@@ -1484,6 +1493,17 @@ interface ControlGridOptions {
1484
1493
 
1485
1494
  **Available default controls:** `fullscreen`, `globe`, `north`, `terrain`, `search`, `viewState`, `inspect`, `vectorDataset`, `basemap`, `cogLayer`, `minimap`, `measure`, `bookmark`, `print`, `zarrLayer`, `pmtilesLayer`, `stacLayer`, `stacSearch`, `addVector`, `geoEditor`, `lidar`, `planetaryComputer`, `gaussianSplat`, `streetView`, `swipe`, `usgsLidar`
1486
1495
 
1496
+ **StreetView env setup (for `streetView` default control):**
1497
+
1498
+ ```bash
1499
+ # .env
1500
+ VITE_GOOGLE_MAPS_API_KEY=your_google_maps_api_key
1501
+ VITE_MAPILLARY_ACCESS_TOKEN=your_mapillary_access_token
1502
+ ```
1503
+
1504
+ `ControlGrid` auto-reads these values for the built-in `streetView` control. You can also override explicitly with `streetViewOptions`.
1505
+ Mapillary viewer CSS is bundled by `maplibre-gl-components`, so no extra `mapillary-js` CSS import is needed.
1506
+
1487
1507
  ```typescript
1488
1508
  // Methods
1489
1509
  controlGrid.addControl(control) // Add a control to the grid
@@ -1513,6 +1533,11 @@ const controlGrid = new ControlGrid({
1513
1533
  collapsible: true,
1514
1534
  collapsed: true,
1515
1535
  basemapStyleUrl: "https://basemaps.cartocdn.com/gl/positron-gl-style/style.json",
1536
+ streetViewOptions: {
1537
+ // Optional explicit override (otherwise auto-read from VITE_* env vars)
1538
+ googleApiKey: import.meta.env.VITE_GOOGLE_MAPS_API_KEY,
1539
+ mapillaryAccessToken: import.meta.env.VITE_MAPILLARY_ACCESS_TOKEN,
1540
+ },
1516
1541
  defaultControls: [
1517
1542
  "globe", "fullscreen", "north", "terrain", "search",
1518
1543
  "viewState", "inspect", "basemap", "measure", "bookmark",
@@ -1875,7 +1900,7 @@ See the [examples](./examples/) directory for complete working examples:
1875
1900
  - **Minimap Control Example** - Inset overview map with viewport rectangle
1876
1901
  - **Control Grid Example** - ControlGrid with all built-in and plugin controls
1877
1902
  - **addControlGrid Example** - One-call convenience function with all default controls
1878
-
1903
+ - **Three.js Plugin Example** - Integrate `MapScene` from maplibre-three-plugin with a rotating 3D object
1879
1904
 
1880
1905
  ## Development
1881
1906