solid-map-gl 1.13.0 → 2.0.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 +157 -30
- package/dist/index.d.ts +489 -0
- package/dist/index.js +11 -0
- package/dist/index.jsx +2320 -0
- package/package.json +46 -35
- package/dist/esm/index.js +0 -2
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/styles.css +0 -1
- package/dist/source/components/Atmosphere/index.jsx +0 -13
- package/dist/source/components/Camera/index.jsx +0 -108
- package/dist/source/components/Control/index.jsx +0 -33
- package/dist/source/components/Draw/drawingStyles.jsx +0 -225
- package/dist/source/components/Draw/index.jsx +0 -52
- package/dist/source/components/Draw/modes/line_string.js +0 -43
- package/dist/source/components/Draw/modes/measurements.js +0 -76
- package/dist/source/components/Draw/modes/multi_point.js +0 -37
- package/dist/source/components/Draw/modes/point.js +0 -25
- package/dist/source/components/Draw/modes/polygon.js +0 -25
- package/dist/source/components/Draw/modes/radius.js +0 -138
- package/dist/source/components/Draw/modes/rectangle.js +0 -118
- package/dist/source/components/Draw/modes/rectangle_assisted.js +0 -233
- package/dist/source/components/Image/index.jsx +0 -135
- package/dist/source/components/Layer/index.jsx +0 -125
- package/dist/source/components/Layer3D/index.jsx +0 -330
- package/dist/source/components/Light/index.jsx +0 -10
- package/dist/source/components/MapGL/index.jsx +0 -273
- package/dist/source/components/MapProvider/index.jsx +0 -9
- package/dist/source/components/Marker/index.jsx +0 -57
- package/dist/source/components/Popup/index.jsx +0 -38
- package/dist/source/components/Source/index.jsx +0 -89
- package/dist/source/components/Terrain/index.jsx +0 -30
- package/dist/source/events.js +0 -78
- package/dist/source/index.jsx +0 -14
- package/dist/source/mapStyles.js +0 -116
- package/dist/source/styles.js +0 -62
- package/dist/types/components/Atmosphere/index.d.ts +0 -8
- package/dist/types/components/Camera/index.d.ts +0 -54
- package/dist/types/components/Control/index.d.ts +0 -15
- package/dist/types/components/Draw/drawingStyles.d.ts +0 -20
- package/dist/types/components/Draw/index.d.ts +0 -16
- package/dist/types/components/Draw/modes/line_string.d.ts +0 -2
- package/dist/types/components/Draw/modes/multi_point.d.ts +0 -2
- package/dist/types/components/Draw/modes/point.d.ts +0 -2
- package/dist/types/components/Draw/modes/polygon.d.ts +0 -2
- package/dist/types/components/Draw/modes/radius.d.ts +0 -2
- package/dist/types/components/Draw/modes/rectangle.d.ts +0 -2
- package/dist/types/components/Draw/modes/rectangle_assisted.d.ts +0 -18
- package/dist/types/components/Image/index.d.ts +0 -28
- package/dist/types/components/Layer/index.d.ts +0 -32
- package/dist/types/components/Layer3D/index.d.ts +0 -22
- package/dist/types/components/Light/index.d.ts +0 -8
- package/dist/types/components/MapGL/index.d.ts +0 -96
- package/dist/types/components/MapProvider/index.d.ts +0 -11
- package/dist/types/components/Marker/index.d.ts +0 -28
- package/dist/types/components/Popup/index.d.ts +0 -18
- package/dist/types/components/Source/index.d.ts +0 -13
- package/dist/types/components/Terrain/index.d.ts +0 -7
- package/dist/types/events.d.ts +0 -103
- package/dist/types/index.d.ts +0 -16
- package/dist/types/mapStyles.d.ts +0 -2
- package/dist/types/styles.d.ts +0 -2
package/README.md
CHANGED
|
@@ -1,39 +1,166 @@
|
|
|
1
|
-
|
|
2
|
-
description: >-
|
|
3
|
-
Solid Map GL provides Mapbox & MapLibre functionality within SolidJS
|
|
4
|
-
applications
|
|
5
|
-
cover: docs/docs/header.png
|
|
6
|
-
coverY: -136.56381942189023
|
|
7
|
-
layout: landing
|
|
8
|
-
---
|
|
1
|
+
[](https://gis-hub.gitbook.io/solid-map-gl)
|
|
9
2
|
|
|
10
|
-
#
|
|
3
|
+
# SolidJS Component Library for Mapbox GL & MapLibre GL
|
|
4
|
+
|
|
5
|
+
[](https://github.com/GIShub4/solid-map-gl/actions/workflows/ci.yml)
|
|
6
|
+
[](https://codecov.io/gh/GIShub4/solid-map-gl)
|
|
7
|
+
[](https://www.npmjs.com/package/solid-map-gl)
|
|
8
|
+
[](https://www.npmjs.com/package/solid-map-gl)
|
|
9
|
+
[](LICENSE/)
|
|
11
10
|
|
|
12
11
|
[SolidJS](https://www.solidjs.com/) Component Library for [Mapbox GL JS](https://github.com/mapbox/mapbox-gl-js) and [MapLibre GL.](https://maplibre.org/projects/maplibre-gl-js/) Both libraries render interactive maps from vector tiles and Map styles using WebGL. This project is intended to be as close as possible to the [Mapbox GL JS API.](https://docs.mapbox.com/mapbox-gl-js/api/)
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
## Documentation & Examples
|
|
14
|
+
|
|
15
|
+
[](https://gis-hub.gitbook.io/solid-map-gl)
|
|
16
|
+
|
|
17
|
+
## Getting Started
|
|
18
|
+
|
|
19
|
+
#### [Mapbox GL](https://gis-hub.gitbook.io/solid-map-gl/start#existing-project)
|
|
20
|
+
|
|
21
|
+
```shell
|
|
22
|
+
pnpm add mapbox-gl solid-map-gl
|
|
23
|
+
yarn add mapbox-gl solid-map-gl
|
|
24
|
+
npm i mapbox-gl solid-map-gl
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
#### [MapLibre](https://gis-hub.gitbook.io/solid-map-gl/start#with-maplibre-project)
|
|
28
|
+
|
|
29
|
+
```shell
|
|
30
|
+
pnpm create solid && pnpm i
|
|
31
|
+
# Install MapLibre package and placeholder Mapbox package
|
|
32
|
+
pnpm add solid-map-gl maplibre-gl mapbox-gl@npm:empty-npm-package@1.0.0
|
|
33
|
+
pnpm dev
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
#### [Solid Start](https://gis-hub.gitbook.io/solid-map-gl/start#solid-start)
|
|
37
|
+
|
|
38
|
+
```shell
|
|
39
|
+
pnpm create solid && pnpm i
|
|
40
|
+
pnpm add mapbox-gl solid-map-gl
|
|
41
|
+
pnpm dev
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
> [!CAUTION]
|
|
45
|
+
> If you use `vite` and get the error `'mapbox-gl.js' does not provide an export named 'default'`,
|
|
46
|
+
> add this to your `vite.config.ts`:
|
|
47
|
+
>
|
|
48
|
+
> ```ts
|
|
49
|
+
> optimizeDeps: { include: ['mapbox-gl'] }
|
|
50
|
+
> ```
|
|
51
|
+
|
|
52
|
+
## Components
|
|
53
|
+
|
|
54
|
+
| [Component](https://gis-hub.gitbook.io/solid-map-gl/components) | Description |
|
|
55
|
+
| --------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
|
|
56
|
+
| [MapGL](https://gis-hub.gitbook.io/solid-map-gl/components/mapgl) | Represents map on the page |
|
|
57
|
+
| [Source](https://gis-hub.gitbook.io/solid-map-gl/components/source) | [Sources](https://docs.mapbox.com/mapbox-gl-js/api/#sources) specify the geographic features to be rendered on the map |
|
|
58
|
+
| [Layer](https://gis-hub.gitbook.io/solid-map-gl/components/layer) | [Layers](https://docs.mapbox.com/mapbox-gl-js/style-spec/#layers) specify the `Sources` |
|
|
59
|
+
| [Layer3D](https://gis-hub.gitbook.io/solid-map-gl/components/layer3d) | Component for [BabylonJS](https://www.babylonjs.com/) or [ThreeJS](https://threejs.org/) |
|
|
60
|
+
| [Atmosphere](https://gis-hub.gitbook.io/solid-map-gl/components/atmosphere) | Specify the Atmosphere |
|
|
61
|
+
| [Light](https://gis-hub.gitbook.io/solid-map-gl/components/light) | Specify the Light Source |
|
|
62
|
+
| [Terrain](https://gis-hub.gitbook.io/solid-map-gl/components/terrain) | Specify the Terrain |
|
|
63
|
+
| [Image](https://gis-hub.gitbook.io/solid-map-gl/components/image) | Adds an image to the map style |
|
|
64
|
+
| [Popup](https://gis-hub.gitbook.io/solid-map-gl/components/popup) | Component for [Mapbox GL JS Popup](https://docs.mapbox.com/mapbox-gl-js/api/#popup) |
|
|
65
|
+
| [Marker](https://gis-hub.gitbook.io/solid-map-gl/components/marker) | Component for [Mapbox GL JS Marker](https://docs.mapbox.com/mapbox-gl-js/api/#marker) |
|
|
66
|
+
| [Control](https://gis-hub.gitbook.io/solid-map-gl/components/control) | Represents the map's control |
|
|
67
|
+
| [Camera](https://gis-hub.gitbook.io/solid-map-gl/components/camera) | Map's camera view |
|
|
68
|
+
| [Draw](https://gis-hub.gitbook.io/solid-map-gl/components/draw) | Draw Control view |
|
|
69
|
+
| [DeckOverlay](https://gis-hub.gitbook.io/solid-map-gl/components/deckoverlay) | Adds a [deck.gl](https://deck.gl/) overlay on top of the map |
|
|
70
|
+
|
|
71
|
+
## Usage with [Mapbox](https://docs.mapbox.com/mapbox-gl-js/guides/)
|
|
72
|
+
|
|
73
|
+
Pass the _Mapbox access token_ via `<MapGL> options` or `.env` file as `VITE_MAPBOX_ACCESS_TOKEN`
|
|
74
|
+
|
|
75
|
+
```jsx
|
|
76
|
+
import { render } from "solid-js/web";
|
|
77
|
+
import { Component, createSignal } from "solid-js";
|
|
78
|
+
import MapGL, { Viewport, Source, Layer } from "solid-map-gl";
|
|
79
|
+
import 'mapbox-gl/dist/mapbox-gl.css'
|
|
80
|
+
|
|
81
|
+
const App: Component = () => {
|
|
82
|
+
const [viewport, setViewport] = createSignal({
|
|
83
|
+
center: [-122.45, 37.78],
|
|
84
|
+
zoom: 11,
|
|
85
|
+
} as Viewport);
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<MapGL
|
|
89
|
+
options={{ style: "mb:light" }}
|
|
90
|
+
viewport={viewport()}
|
|
91
|
+
onViewportChange={(evt: Viewport) => setViewport(evt)}
|
|
92
|
+
>
|
|
93
|
+
<Source
|
|
94
|
+
source={{
|
|
95
|
+
type: "geojson",
|
|
96
|
+
data: "https://docs.mapbox.com/mapbox-gl-js/assets/earthquakes.geojson",
|
|
97
|
+
}}
|
|
98
|
+
>
|
|
99
|
+
<Layer
|
|
100
|
+
style={{
|
|
101
|
+
type: "circle",
|
|
102
|
+
paint: {
|
|
103
|
+
"circle-radius": 8,
|
|
104
|
+
"circle-color": "red",
|
|
105
|
+
},
|
|
106
|
+
}}
|
|
107
|
+
/>
|
|
108
|
+
</Source>
|
|
109
|
+
</MapGL>
|
|
110
|
+
);
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
render(() => <App />, document.getElementById("app")!);
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Usage with [MapLibre](https://maplibre.org/maplibre-gl-js-docs/api/)
|
|
117
|
+
|
|
118
|
+
Install MapLibre package and placeholder Mapbox package
|
|
119
|
+
|
|
120
|
+
```shell
|
|
121
|
+
pnpm add solid-map-gl maplibre-gl mapbox-gl@npm:empty-npm-package@1.0.0
|
|
122
|
+
yarn add solid-map-gl maplibre-gl mapbox-gl@npm:empty-npm-package@1.0.0
|
|
123
|
+
npm i solid-map-gl maplibre-gl mapbox-gl@npm:empty-npm-package@1.0.0
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
```jsx
|
|
127
|
+
import { render } from "solid-js/web";
|
|
128
|
+
import { Component, createSignal } from "solid-js";
|
|
129
|
+
import MapGL, { Viewport } from "solid-map-gl";
|
|
130
|
+
import * as maplibre from 'maplibre-gl'
|
|
131
|
+
import 'maplibre-gl/dist/maplibre-gl.css'
|
|
17
132
|
|
|
18
|
-
|
|
19
|
-
[
|
|
20
|
-
|
|
133
|
+
const App: Component = () => {
|
|
134
|
+
const [viewport, setViewport] = createSignal({
|
|
135
|
+
center: [-122.45, 37.78],
|
|
136
|
+
zoom: 11,
|
|
137
|
+
} as Viewport);
|
|
21
138
|
|
|
22
|
-
|
|
139
|
+
return (
|
|
140
|
+
<MapGL
|
|
141
|
+
mapLib={maplibre} // <- Pass MapLibre package here
|
|
142
|
+
options={{ style: 'https://demotiles.maplibre.org/style.json' }}
|
|
143
|
+
viewport={viewport()}
|
|
144
|
+
onViewportChange={(evt: Viewport) => setViewport(evt)}
|
|
145
|
+
/>
|
|
146
|
+
);
|
|
147
|
+
};
|
|
23
148
|
|
|
24
|
-
|
|
149
|
+
render(() => <App />, document.getElementById("app")!);
|
|
150
|
+
```
|
|
25
151
|
|
|
26
|
-
|
|
152
|
+
## Roadmap
|
|
27
153
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
154
|
+
- [x] Basic Mapbox GL Functionality
|
|
155
|
+
- [x] Include Map Controls
|
|
156
|
+
- [x] Include Fog, Sky, and Terrain
|
|
157
|
+
- [x] Include Popup and Markers
|
|
158
|
+
- [x] Minify bundle & reduce size
|
|
159
|
+
- [x] Add basemap switching
|
|
160
|
+
- [x] Include event handling
|
|
161
|
+
- [x] Sync Maps
|
|
162
|
+
- [x] Add MapLibre support
|
|
163
|
+
- [x] Add debug functionality
|
|
164
|
+
- [x] Add draw functionality
|
|
165
|
+
- [x] Add 3D Layer support
|
|
166
|
+
- [x] Add deck.gl support
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,489 @@
|
|
|
1
|
+
import { Component, JSX, ParentComponent, VoidComponent } from 'solid-js';
|
|
2
|
+
import { MapMouseEvent, MapTouchEvent, MapWheelEvent, MapDataEvent, MapBoxZoomEvent, LngLatLike, LngLatBounds, PaddingOptions, MapboxOptions, StyleSpecification, SourceSpecification, CustomLayerInterface, FilterSpecification, FogSpecification, NavigationControlOptions, ScaleControlOptions, AttributionControlOptions, FullscreenControlOptions, GeolocateControlOptions, MarkerOptions, PopupOptions, StyleImageInterface, Map as Map$1, LightSpecification } from 'mapbox-gl';
|
|
3
|
+
|
|
4
|
+
type mapEventTypes = {
|
|
5
|
+
onMouseDown?: (event: MapMouseEvent) => void;
|
|
6
|
+
onMouseUp?: (event: MapMouseEvent) => void;
|
|
7
|
+
onMouseOver?: (event: MapMouseEvent) => void;
|
|
8
|
+
onMouseOut?: (event: MapMouseEvent) => void;
|
|
9
|
+
onMouseMove?: (event: MapMouseEvent) => void;
|
|
10
|
+
onMouseEnter?: (event: MapMouseEvent) => void;
|
|
11
|
+
onMouseLeave?: (event: MapMouseEvent) => void;
|
|
12
|
+
onPreClick?: (event: MapMouseEvent) => void;
|
|
13
|
+
onClick?: (event: MapMouseEvent) => void;
|
|
14
|
+
onDblClick?: (event: MapMouseEvent) => void;
|
|
15
|
+
onContextMenu?: (event: MapMouseEvent) => void;
|
|
16
|
+
onTouchStart?: (event: MapTouchEvent) => void;
|
|
17
|
+
onTouchEnd?: (event: MapTouchEvent) => void;
|
|
18
|
+
onTouchCancel?: (event: MapTouchEvent) => void;
|
|
19
|
+
onTouchMove?: (event: MapTouchEvent) => void;
|
|
20
|
+
onWheel?: (event: MapWheelEvent) => void;
|
|
21
|
+
onResize?: () => void;
|
|
22
|
+
onRemove?: () => void;
|
|
23
|
+
onMoveStart?: (event: DragEvent) => void;
|
|
24
|
+
onMove?: (event: MapMouseEvent | MapTouchEvent) => void;
|
|
25
|
+
onMoveEnd?: (event: DragEvent) => void;
|
|
26
|
+
onDragStart?: (event: DragEvent) => void;
|
|
27
|
+
onDrag?: (event: MapMouseEvent | MapTouchEvent) => void;
|
|
28
|
+
onDragEnd?: (event: DragEvent) => void;
|
|
29
|
+
onZoomStart?: (event: MapMouseEvent | MapTouchEvent) => void;
|
|
30
|
+
onZoom?: (event: MapMouseEvent | MapTouchEvent) => void;
|
|
31
|
+
onZoomEnd?: (event: MapMouseEvent | MapTouchEvent) => void;
|
|
32
|
+
onRotateStart?: (event: MapMouseEvent | MapTouchEvent) => void;
|
|
33
|
+
onRotate?: (event: MapMouseEvent | MapTouchEvent) => void;
|
|
34
|
+
onRotatEnd?: (event: MapMouseEvent | MapTouchEvent) => void;
|
|
35
|
+
onPitchStart?: (event: MapDataEvent) => void;
|
|
36
|
+
onPitch?: (event: MapDataEvent) => void;
|
|
37
|
+
onPitchEnd?: (event: MapDataEvent) => void;
|
|
38
|
+
onBoxZoomStart?: (event: MapBoxZoomEvent) => void;
|
|
39
|
+
onBoxZoomEnd?: (event: MapBoxZoomEvent) => void;
|
|
40
|
+
onBoxZoomCancel?: (event: MapBoxZoomEvent) => void;
|
|
41
|
+
onWebglContextLost?: () => void;
|
|
42
|
+
onWebglContextRestored?: () => void;
|
|
43
|
+
onLoad?: (event: any) => void;
|
|
44
|
+
onRender?: () => void;
|
|
45
|
+
onIdle?: () => void;
|
|
46
|
+
onError?: (error: string) => void;
|
|
47
|
+
onData?: (event: MapDataEvent) => void;
|
|
48
|
+
onStyleData?: (event: MapDataEvent) => void;
|
|
49
|
+
onSourceData?: (event: MapDataEvent) => void;
|
|
50
|
+
onDataLoading?: (event: MapDataEvent) => void;
|
|
51
|
+
onStyleDataLoading?: (event: MapDataEvent) => void;
|
|
52
|
+
onSourceDataLoading?: (event: MapDataEvent) => void;
|
|
53
|
+
onStyleImageMissing?: (event: MapDataEvent) => void;
|
|
54
|
+
};
|
|
55
|
+
type layerEventTypes = {
|
|
56
|
+
onMouseDown?: (event: MapMouseEvent) => void;
|
|
57
|
+
/** called when the mouse button is pressed down on the layer */
|
|
58
|
+
onMouseUp?: (event: MapMouseEvent) => void;
|
|
59
|
+
/** called when the mouse button is released after a mouse down event on the layer */
|
|
60
|
+
onMouseOver?: (event: MapMouseEvent) => void;
|
|
61
|
+
/** called when the mouse enters the layer */
|
|
62
|
+
onMouseOut?: (event: MapMouseEvent) => void;
|
|
63
|
+
/** called when the mouse leaves the layer */
|
|
64
|
+
onMouseMove?: (event: MapMouseEvent) => void;
|
|
65
|
+
/** called when the mouse is moved over the layer */
|
|
66
|
+
onMouseEnter?: (event: MapMouseEvent) => void;
|
|
67
|
+
/** called when the mouse enters the layer */
|
|
68
|
+
onMouseLeave?: (event: MapMouseEvent) => void;
|
|
69
|
+
/** called when the mouse leaves the layer */
|
|
70
|
+
onClick?: (event: MapMouseEvent) => void;
|
|
71
|
+
/** called when the layer is clicked */
|
|
72
|
+
onDblClick?: (event: MapMouseEvent) => void;
|
|
73
|
+
/** called when the layer is double-clicked */
|
|
74
|
+
onContextMenu?: (event: MapMouseEvent) => void;
|
|
75
|
+
/** called when the context menu is triggered on the layer */
|
|
76
|
+
onTouchStart?: (event: MapTouchEvent) => void;
|
|
77
|
+
/** called when a touch event is started on the layer */
|
|
78
|
+
onTouchEnd?: (event: MapTouchEvent) => void;
|
|
79
|
+
/** called when a touch event is ended on the layer */
|
|
80
|
+
onTouchCancel?: (event: MapTouchEvent) => void;
|
|
81
|
+
};
|
|
82
|
+
type drawEventTypes = {
|
|
83
|
+
onCreate?: (event: Object) => void;
|
|
84
|
+
/** called when a feature is created */
|
|
85
|
+
onDelete?: (event: Object) => void;
|
|
86
|
+
/** called when a feature is deleted */
|
|
87
|
+
onCombine?: (event: Object) => void;
|
|
88
|
+
/** called when features are combined */
|
|
89
|
+
onUncombine?: (event: Object) => void;
|
|
90
|
+
/** called when features are uncombined */
|
|
91
|
+
onUpdate?: (event: Object) => void;
|
|
92
|
+
/** called when a feature is updated */
|
|
93
|
+
onSelectionchange?: (event: Object) => void;
|
|
94
|
+
/** called when the selected features change */
|
|
95
|
+
onModechange?: (event: Object) => void;
|
|
96
|
+
/** called when the draw mode changes */
|
|
97
|
+
onRender?: (event: Object) => void;
|
|
98
|
+
/** called when the draw canvas is re-rendered */
|
|
99
|
+
onActionable?: (event: Object) => void;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
type Map = mapboxgl.Map & {
|
|
103
|
+
debug: boolean;
|
|
104
|
+
debugEvents: boolean;
|
|
105
|
+
sourceIdList: string[];
|
|
106
|
+
layerIdList: string[];
|
|
107
|
+
/** Whether this map instance is backed by MapLibre GL JS rather than Mapbox GL JS */
|
|
108
|
+
isMapLibre: boolean;
|
|
109
|
+
};
|
|
110
|
+
type Viewport = {
|
|
111
|
+
id?: string;
|
|
112
|
+
point?: {
|
|
113
|
+
x: number;
|
|
114
|
+
y: number;
|
|
115
|
+
};
|
|
116
|
+
center?: LngLatLike;
|
|
117
|
+
bounds?: LngLatBounds;
|
|
118
|
+
zoom?: number;
|
|
119
|
+
pitch?: number;
|
|
120
|
+
bearing?: number;
|
|
121
|
+
padding?: PaddingOptions;
|
|
122
|
+
inTransit?: boolean;
|
|
123
|
+
};
|
|
124
|
+
type Props$b = {
|
|
125
|
+
/** ID for the map container element */
|
|
126
|
+
id?: string;
|
|
127
|
+
/** Map Container CSS Style */
|
|
128
|
+
style?: JSX.CSSProperties;
|
|
129
|
+
/** Map Container CSS Class */
|
|
130
|
+
class?: string;
|
|
131
|
+
/** SolidJS Class List for Map Container */
|
|
132
|
+
classList?: {
|
|
133
|
+
[k: string]: boolean | undefined;
|
|
134
|
+
};
|
|
135
|
+
/** Current Map View */
|
|
136
|
+
viewport?: Viewport;
|
|
137
|
+
/** Mapbox Options
|
|
138
|
+
* @see https://docs.mapbox.com/mapbox-gl-js/api/map/#map-parameters
|
|
139
|
+
*/
|
|
140
|
+
options?: MapboxOptions;
|
|
141
|
+
/** Mapbox Standard / Standard Satellite style configuration — Mapbox-only, no-op on MapLibre.
|
|
142
|
+
* @see https://docs.mapbox.com/mapbox-gl-js/guides/styles/#configure-a-style
|
|
143
|
+
*/
|
|
144
|
+
config?: {
|
|
145
|
+
id?: string;
|
|
146
|
+
lightPreset?: "dawn" | "day" | "dusk" | "night" | string;
|
|
147
|
+
showPlaceLabels?: boolean;
|
|
148
|
+
showRoadLabels?: boolean;
|
|
149
|
+
showPointOfInterestLabels?: boolean;
|
|
150
|
+
showTransitLabels?: boolean;
|
|
151
|
+
showRoadsAndTransit?: boolean;
|
|
152
|
+
showLandmarkIcons?: boolean;
|
|
153
|
+
showLandmarkIconLabels?: boolean;
|
|
154
|
+
showPedestrianRoads?: boolean;
|
|
155
|
+
show3dObjects?: boolean;
|
|
156
|
+
show3dBuildings?: boolean;
|
|
157
|
+
show3dTrees?: boolean;
|
|
158
|
+
show3dLandmarks?: boolean;
|
|
159
|
+
show3dFacades?: boolean;
|
|
160
|
+
showAdminBoundaries?: boolean;
|
|
161
|
+
showIndoor?: boolean;
|
|
162
|
+
showIndoorLabels?: boolean;
|
|
163
|
+
theme?: "default" | "faded" | "monochrome" | "custom" | string;
|
|
164
|
+
themeData?: string;
|
|
165
|
+
colorModePointOfInterestLabels?: "default" | "single" | string;
|
|
166
|
+
backgroundPointOfInterestLabels?: "circle" | "none" | string;
|
|
167
|
+
densityPointOfInterestLabels?: 1 | 2 | 3 | 4 | 5 | number;
|
|
168
|
+
fuelingStationModePointOfInterestLabels?: string;
|
|
169
|
+
colorPlaceLabels?: string;
|
|
170
|
+
colorRoadLabels?: string;
|
|
171
|
+
colorCommercial?: string;
|
|
172
|
+
colorEducation?: string;
|
|
173
|
+
colorMedical?: string;
|
|
174
|
+
colorIndustrial?: string;
|
|
175
|
+
colorGreenspace?: string;
|
|
176
|
+
colorWater?: string;
|
|
177
|
+
colorLand?: string;
|
|
178
|
+
colorAdminBoundaries?: string;
|
|
179
|
+
colorPointOfInterestLabels?: string;
|
|
180
|
+
colorMotorways?: string;
|
|
181
|
+
colorTrunks?: string;
|
|
182
|
+
colorRoads?: string;
|
|
183
|
+
colorBuildings?: string;
|
|
184
|
+
colorBuildingHighlight?: string;
|
|
185
|
+
colorBuildingSelect?: string;
|
|
186
|
+
colorPlaceLabelHighlight?: string;
|
|
187
|
+
colorPlaceLabelSelect?: string;
|
|
188
|
+
colorIndoorLabelSelect?: string;
|
|
189
|
+
colorIndoorLabelHighlight?: string;
|
|
190
|
+
font?: string[];
|
|
191
|
+
[key: string]: boolean | string | number | string[];
|
|
192
|
+
};
|
|
193
|
+
/** Type for pan, move and zoom transitions */
|
|
194
|
+
transitionType?: "flyTo" | "easeTo" | "jumpTo" | string;
|
|
195
|
+
/** Event listener for Viewport updates */
|
|
196
|
+
onViewportChange?: (viewport: Viewport) => void;
|
|
197
|
+
/** Event listener for User Interaction */
|
|
198
|
+
onUserInteraction?: (user: boolean) => void;
|
|
199
|
+
/** Displays Map Tile Borders */
|
|
200
|
+
showTileBoundaries?: boolean;
|
|
201
|
+
/** Displays Wireframe if Terrain is visible */
|
|
202
|
+
showTerrainWireframe?: boolean;
|
|
203
|
+
/** Displays Borders if Padding is set */
|
|
204
|
+
showPadding?: boolean;
|
|
205
|
+
/** Displays Label Collision Boxes */
|
|
206
|
+
showCollisionBoxes?: boolean;
|
|
207
|
+
/** Displays all feature outlines even if normally not drawn by style rules */
|
|
208
|
+
showOverdrawInspector?: boolean;
|
|
209
|
+
/** Mouse Cursor Style */
|
|
210
|
+
cursorStyle?: string;
|
|
211
|
+
darkStyle?: StyleSpecification | string;
|
|
212
|
+
/** Called with (prevStyle, nextStyle) on every base style change. Return false to skip
|
|
213
|
+
* mapbox-gl's diff attempt and go straight to a full rebuild — useful when you already know a
|
|
214
|
+
* given style pair can never diff (e.g. Standard vs Standard Satellite, whose sprite/glyphs
|
|
215
|
+
* always differ), to avoid the wasted diff pass and its "Unimplemented ... Rebuilding the style
|
|
216
|
+
* from scratch" console warnings. Defaults to always attempting the diff (mapbox-gl's own
|
|
217
|
+
* default), so existing consumers see no behavior change unless they opt in. */
|
|
218
|
+
shouldDiffStyle?: (prevStyle: any, nextStyle: any) => boolean;
|
|
219
|
+
disableResize?: boolean;
|
|
220
|
+
mapLib?: any;
|
|
221
|
+
apikey?: string;
|
|
222
|
+
debug?: boolean;
|
|
223
|
+
debugEvents?: boolean;
|
|
224
|
+
ref?: HTMLDivElement;
|
|
225
|
+
/** Children within the Map Container */
|
|
226
|
+
children?: any;
|
|
227
|
+
} & mapEventTypes;
|
|
228
|
+
/** Creates a new Map Container */
|
|
229
|
+
declare const MapGL: Component<Props$b>;
|
|
230
|
+
|
|
231
|
+
type MapContextState = {
|
|
232
|
+
map: Map | null;
|
|
233
|
+
/** The resolved Mapbox/MapLibre module in use — replaces the old `window.MapLib` global */
|
|
234
|
+
mapLib: any;
|
|
235
|
+
isMapLibre: boolean;
|
|
236
|
+
};
|
|
237
|
+
declare const useMapContext: () => [MapContextState];
|
|
238
|
+
declare const MapProvider: ParentComponent<{
|
|
239
|
+
map?: Map;
|
|
240
|
+
mapLib?: any;
|
|
241
|
+
isMapLibre?: boolean;
|
|
242
|
+
}>;
|
|
243
|
+
|
|
244
|
+
declare const useSourceId: () => string;
|
|
245
|
+
type Props$a = {
|
|
246
|
+
/** @optional Source ID for referencing non nexted Layers */
|
|
247
|
+
id?: string;
|
|
248
|
+
/** @see https://docs.mapbox.com/mapbox-gl-js/style-spec/sources/ */
|
|
249
|
+
source: SourceSpecification;
|
|
250
|
+
/** The map layers associated with this source */
|
|
251
|
+
children?: any;
|
|
252
|
+
};
|
|
253
|
+
declare const Source: Component<Props$a>;
|
|
254
|
+
|
|
255
|
+
type FlatLayerStyle = Record<string, any>;
|
|
256
|
+
type Props$9 = {
|
|
257
|
+
id?: string;
|
|
258
|
+
/** A string that uniquely identifies the layer. If not provided, a unique ID will be generated. */
|
|
259
|
+
style?: FlatLayerStyle;
|
|
260
|
+
/** A Mapbox Style Specification object that defines the visual appearance of the layer. */
|
|
261
|
+
customLayer?: CustomLayerInterface;
|
|
262
|
+
/** An object that implements the `CustomLayerInterface` interface, which allows you to create custom layers using WebGL. */
|
|
263
|
+
filter?: FilterSpecification;
|
|
264
|
+
/** A Mapbox filter specification that defines which features of the layer to include or exclude from the layer. */
|
|
265
|
+
visible?: boolean;
|
|
266
|
+
/** A boolean that determines whether the layer is visible or not. */
|
|
267
|
+
sourceId?: string;
|
|
268
|
+
/** A string that specifies the ID of the source that the layer uses for its data. */
|
|
269
|
+
slot?: "bottom" | "middle" | "top" | string;
|
|
270
|
+
/** A string that specifies the slot to which the layer belongs. */
|
|
271
|
+
beforeType?: "background" | "fill" | "line" | "symbol" | "raster" | "circle" | "fill-extrusion" | "heatmap" | "hillshade" | "sky" | string;
|
|
272
|
+
/** A string that specifies the type of layer before which the current layer should be inserted. */
|
|
273
|
+
beforeId?: string;
|
|
274
|
+
/** A string that specifies the ID of the layer before which the current layer should be inserted. */
|
|
275
|
+
featureState?: {
|
|
276
|
+
id: number | string;
|
|
277
|
+
state: Record<string, any>;
|
|
278
|
+
};
|
|
279
|
+
/** An object that specifies the state of a feature in the layer. The object consists of an ID (either a number or a string) and an object containing the state. */
|
|
280
|
+
children?: any;
|
|
281
|
+
} & layerEventTypes;
|
|
282
|
+
declare const Layer: Component<Props$9>;
|
|
283
|
+
|
|
284
|
+
declare global {
|
|
285
|
+
interface Window {
|
|
286
|
+
BABYLON?: any;
|
|
287
|
+
THREE?: any;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
type Props$8 = {
|
|
291
|
+
id?: string;
|
|
292
|
+
origin?: [number, number, number?];
|
|
293
|
+
defaultLight?: boolean;
|
|
294
|
+
babylon?: boolean;
|
|
295
|
+
onAdd?: (scene: any, map: any, gl: any) => void;
|
|
296
|
+
onRender?: (gl: any, matrix: any) => void;
|
|
297
|
+
children?: JSX.Element | JSX.Element[];
|
|
298
|
+
/** A string that specifies the type of layer before which the current layer should be inserted. */
|
|
299
|
+
beforeId?: string;
|
|
300
|
+
disableProjectionMatrix?: boolean;
|
|
301
|
+
};
|
|
302
|
+
declare const useScene: () => any;
|
|
303
|
+
declare const Layer3D: Component<Props$8>;
|
|
304
|
+
|
|
305
|
+
/** MapLibre's `sky` style-spec object — a genuinely different shape from Mapbox's `Fog`,
|
|
306
|
+
* not a variant of it. */
|
|
307
|
+
interface MapLibreSky {
|
|
308
|
+
"sky-color"?: string;
|
|
309
|
+
"sky-horizon-blend"?: number;
|
|
310
|
+
"horizon-color"?: string;
|
|
311
|
+
"horizon-fog-blend"?: number;
|
|
312
|
+
"fog-color"?: string;
|
|
313
|
+
"fog-ground-blend"?: number;
|
|
314
|
+
"atmosphere-blend"?: number;
|
|
315
|
+
}
|
|
316
|
+
interface AtmosphereProps {
|
|
317
|
+
/** Fog (Mapbox) or Sky (MapLibre) Specification — shape depends on the active base library */
|
|
318
|
+
style?: FogSpecification | MapLibreSky;
|
|
319
|
+
}
|
|
320
|
+
declare const Atmosphere: VoidComponent<AtmosphereProps>;
|
|
321
|
+
|
|
322
|
+
interface TerrainSpecification {
|
|
323
|
+
source?: string;
|
|
324
|
+
exaggeration?: number | undefined;
|
|
325
|
+
}
|
|
326
|
+
declare const Terrain: VoidComponent<TerrainSpecification>;
|
|
327
|
+
|
|
328
|
+
type ControlType = "navigation" | "scale" | "attribution" | "fullscreen" | "geolocate" | "logo" | "terrain";
|
|
329
|
+
type Props$7 = {
|
|
330
|
+
type?: ControlType;
|
|
331
|
+
options?: NavigationControlOptions | ScaleControlOptions | AttributionControlOptions | FullscreenControlOptions | GeolocateControlOptions | object;
|
|
332
|
+
custom?: any;
|
|
333
|
+
position?: "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
334
|
+
};
|
|
335
|
+
declare const Control: VoidComponent<Props$7>;
|
|
336
|
+
|
|
337
|
+
type Props$6 = {
|
|
338
|
+
/** The geographical location to place the marker */
|
|
339
|
+
lngLat: LngLatLike;
|
|
340
|
+
/** Options for the Mapbox GL JS marker */
|
|
341
|
+
options?: MarkerOptions;
|
|
342
|
+
/** Options for the Mapbox GL JS popup that is associated with the marker */
|
|
343
|
+
popup?: PopupOptions;
|
|
344
|
+
/** Whether the marker's associated popup should be open */
|
|
345
|
+
showPopup?: boolean;
|
|
346
|
+
/** Whether the marker is draggable */
|
|
347
|
+
draggable?: boolean;
|
|
348
|
+
/** A function that is called when the marker's associated popup is opened */
|
|
349
|
+
onOpen?: () => void;
|
|
350
|
+
/** A function that is called when the marker's associated popup is closed */
|
|
351
|
+
onClose?: () => void;
|
|
352
|
+
/** A function that is called when the marker starts being dragged */
|
|
353
|
+
onDragStart?: () => void;
|
|
354
|
+
/** A function that is called when the marker stops being dragged */
|
|
355
|
+
onDragEnd?: () => void;
|
|
356
|
+
/** A function that is called when the marker is being dragged */
|
|
357
|
+
onDrag?: (lngLat: number[]) => void;
|
|
358
|
+
/** The content to be displayed in the marker's associated popup */
|
|
359
|
+
children?: any;
|
|
360
|
+
};
|
|
361
|
+
declare const Marker: Component<Props$6>;
|
|
362
|
+
|
|
363
|
+
type Props$5 = {
|
|
364
|
+
/** Options for configuring the popup */
|
|
365
|
+
options?: PopupOptions;
|
|
366
|
+
/** Flag for tracking the mouse pointer */
|
|
367
|
+
trackPointer?: boolean;
|
|
368
|
+
/** Longitude and latitude for the popup */
|
|
369
|
+
lngLat?: LngLatLike;
|
|
370
|
+
/** Callback for when the popup is opened */
|
|
371
|
+
onOpen?: () => void;
|
|
372
|
+
/** Callback for when the popup is closed */
|
|
373
|
+
onClose?: () => void;
|
|
374
|
+
/** Children to display within the popup */
|
|
375
|
+
children?: any;
|
|
376
|
+
};
|
|
377
|
+
declare const Popup: Component<Props$5>;
|
|
378
|
+
|
|
379
|
+
type StyleImageMetadata = NonNullable<Parameters<Map$1['addImage']>[2]>;
|
|
380
|
+
declare const patternList: string[];
|
|
381
|
+
type Color = `#${string}` | `rgb(${number}, ${number}, ${number})` | `rgba(${number}, ${number}, ${number}, ${number})` | `hsl(${number}, ${number}%, ${number}%)` | `hsla(${number}, ${number}%, ${number}%, ${number})`;
|
|
382
|
+
type Props$4 = {
|
|
383
|
+
id: string;
|
|
384
|
+
/** The unique identifier for the image. */
|
|
385
|
+
source?: HTMLImageElement | ImageBitmap | ImageData | SVGElement | {
|
|
386
|
+
width: number;
|
|
387
|
+
height: number;
|
|
388
|
+
data: Uint8Array | Uint8ClampedArray;
|
|
389
|
+
} | StyleImageInterface | string;
|
|
390
|
+
/** The image to be used for the image component. */
|
|
391
|
+
options?: StyleImageMetadata & {
|
|
392
|
+
fill?: Color;
|
|
393
|
+
stroke?: Color;
|
|
394
|
+
transform?: string;
|
|
395
|
+
};
|
|
396
|
+
/** The options for the image */
|
|
397
|
+
pattern?: {
|
|
398
|
+
type: string;
|
|
399
|
+
color: Color;
|
|
400
|
+
background: Color;
|
|
401
|
+
lineWith: number;
|
|
402
|
+
};
|
|
403
|
+
};
|
|
404
|
+
declare const MGL_Image: VoidComponent<Props$4>;
|
|
405
|
+
|
|
406
|
+
/** Options for rotating the globe. */
|
|
407
|
+
interface RotateGlobeOptions {
|
|
408
|
+
/** The number of seconds per revolution. */
|
|
409
|
+
secPerRev?: number;
|
|
410
|
+
/** The maximum zoom level for spinning the globe. */
|
|
411
|
+
maxSpinZoom?: number;
|
|
412
|
+
/** The zoom level at which the spinning slows down. */
|
|
413
|
+
slowSpinZoom?: number;
|
|
414
|
+
}
|
|
415
|
+
/** Options for rotating the viewport. */
|
|
416
|
+
interface RotateViewportOptions {
|
|
417
|
+
/** The number of seconds per revolution. */
|
|
418
|
+
secPerRev?: number;
|
|
419
|
+
/** The pitch angle in degrees. */
|
|
420
|
+
pitch?: number;
|
|
421
|
+
/** The center of rotation. */
|
|
422
|
+
around?: LngLatLike;
|
|
423
|
+
}
|
|
424
|
+
/** Props for the component. */
|
|
425
|
+
type Props$3 = {
|
|
426
|
+
/** Whether to rotate the globe. */
|
|
427
|
+
rotateGlobe?: boolean | RotateGlobeOptions;
|
|
428
|
+
/** Whether to rotate the viewport. */
|
|
429
|
+
rotateViewport?: boolean | RotateViewportOptions;
|
|
430
|
+
/** Whether to reverse the rotation direction. */
|
|
431
|
+
reverse?: boolean;
|
|
432
|
+
/** Whether to reset the rotation when stopped. */
|
|
433
|
+
resetWhenStopped?: boolean;
|
|
434
|
+
/** Translation options. */
|
|
435
|
+
translate?: {
|
|
436
|
+
/** The type of translation. */
|
|
437
|
+
type?: 'line' | 'sphere';
|
|
438
|
+
/** The starting position. */
|
|
439
|
+
start: [number, number, number];
|
|
440
|
+
/** The ending position. */
|
|
441
|
+
end: [number, number, number];
|
|
442
|
+
/** The target position. */
|
|
443
|
+
target: LngLatLike;
|
|
444
|
+
/** The ending target position. */
|
|
445
|
+
targetEnd?: LngLatLike;
|
|
446
|
+
/** The easing function to use. */
|
|
447
|
+
easing?: 'in' | 'out' | 'inOut';
|
|
448
|
+
/** Whether to loop the translation. */
|
|
449
|
+
loop?: boolean;
|
|
450
|
+
/** The duration of the translation in milliseconds. */
|
|
451
|
+
duration: number;
|
|
452
|
+
};
|
|
453
|
+
/** The children to render. */
|
|
454
|
+
children?: any;
|
|
455
|
+
};
|
|
456
|
+
declare const Camera: Component<Props$3>;
|
|
457
|
+
|
|
458
|
+
type Props$2 = {
|
|
459
|
+
/** Light Specifications */
|
|
460
|
+
style: LightSpecification;
|
|
461
|
+
};
|
|
462
|
+
declare const Light: VoidComponent<Props$2>;
|
|
463
|
+
|
|
464
|
+
type Props$1 = {
|
|
465
|
+
/** Draw Library */
|
|
466
|
+
lib: any;
|
|
467
|
+
/** Draw Options */
|
|
468
|
+
options?: object;
|
|
469
|
+
/** Draw Control Position */
|
|
470
|
+
position?: "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
471
|
+
/** Draw Control Instance */
|
|
472
|
+
getInstance?: (object: any) => void;
|
|
473
|
+
showLength?: boolean;
|
|
474
|
+
showArea?: boolean;
|
|
475
|
+
} & drawEventTypes;
|
|
476
|
+
declare const Draw: VoidComponent<Props$1>;
|
|
477
|
+
|
|
478
|
+
type Props = {
|
|
479
|
+
/** The deck.gl overlay class matching the active base library — `MapboxOverlay` from
|
|
480
|
+
* `@deck.gl/mapbox` for Mapbox, `MapLibreOverlay` from `@deck.gl/maplibre` for MapLibre.
|
|
481
|
+
* solid-map-gl never imports either package itself; you supply the class. */
|
|
482
|
+
overlay: new (props: any) => any;
|
|
483
|
+
/** Props forwarded to the deck.gl overlay, e.g. `{ layers, interleaved }` */
|
|
484
|
+
props?: any;
|
|
485
|
+
};
|
|
486
|
+
/** Adds a deck.gl overlay control to the map, forwarding `props` reactively via `setProps`. */
|
|
487
|
+
declare const DeckOverlay: VoidComponent<Props>;
|
|
488
|
+
|
|
489
|
+
export { Atmosphere, Camera, type Color, Control, DeckOverlay, Draw, MGL_Image as Image, Layer, Layer3D, Light, type MapLibreSky, MapProvider, Marker, Popup, Source, Terrain, type Viewport, MapGL as default, patternList, useMapContext, useScene, useSourceId };
|