solid-map-gl 1.1.26 → 1.2.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/LICENSE +1 -1
- package/README.md +3 -3
- package/dist/cjs/index.css +1 -0
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/esm/index.css +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/index/components/Camera/index.d.ts +15 -0
- package/dist/index/components/Camera/index.jsx +49 -0
- package/dist/{types → index}/components/Control/index.d.ts +2 -2
- package/dist/{source → index}/components/Control/index.jsx +8 -6
- package/dist/{types → index}/components/Fog/index.d.ts +2 -2
- package/dist/index/components/Fog/index.jsx +21 -0
- package/dist/{types → index}/components/Image/index.d.ts +1 -2
- package/dist/{source → index}/components/Image/index.jsx +8 -10
- package/dist/{types → index}/components/Layer/index.d.ts +3 -3
- package/dist/{source → index}/components/Layer/index.jsx +28 -23
- package/dist/{types → index}/components/MapGL/index.d.ts +22 -5
- package/dist/{source → index}/components/MapGL/index.jsx +62 -36
- package/dist/{types → index}/components/Marker/index.d.ts +2 -2
- package/dist/{source → index}/components/Marker/index.jsx +6 -5
- package/dist/{types → index}/components/Popup/index.d.ts +2 -2
- package/dist/{source → index}/components/Popup/index.jsx +7 -6
- package/dist/{types → index}/components/Sky/index.d.ts +2 -2
- package/dist/index/components/Sky/index.jsx +22 -0
- package/dist/index/components/Source/index.d.ts +10 -0
- package/dist/index/components/Source/index.jsx +72 -0
- package/dist/{types → index}/components/Terrain/index.d.ts +2 -2
- package/dist/index/components/Terrain/index.jsx +23 -0
- package/dist/{types → index}/events.d.ts +0 -0
- package/dist/{source → index}/events.js +0 -0
- package/dist/index/index.d.ts +12 -0
- package/dist/index/index.jsx +11 -0
- package/dist/index/styles.d.ts +56 -0
- package/dist/index/styles.js +121 -0
- package/package.json +22 -14
- package/dist/esm/styles.css +0 -1
- package/dist/source/components/Fog/index.jsx +0 -21
- package/dist/source/components/Sky/index.jsx +0 -22
- package/dist/source/components/Source/index.jsx +0 -32
- package/dist/source/components/Terrain/index.jsx +0 -23
- package/dist/source/index.jsx +0 -10
- package/dist/types/components/Source/index.d.ts +0 -8
- package/dist/types/index.d.ts +0 -11
|
@@ -1,27 +1,37 @@
|
|
|
1
|
-
import { createSignal, createEffect, onMount, onCleanup, createContext, useContext, useTransition, createUniqueId, untrack, } from 'solid-js';
|
|
1
|
+
import { createSignal, createEffect, onMount, onCleanup, createContext, useContext, useTransition, createUniqueId, untrack, on, } from 'solid-js';
|
|
2
2
|
import { mapEvents } from '../../events';
|
|
3
|
+
import { vectorStyleList } from '../../styles';
|
|
3
4
|
import mapboxgl from 'mapbox-gl';
|
|
4
5
|
import 'mapbox-gl/dist/mapbox-gl.css';
|
|
5
|
-
const [pending, start] = useTransition();
|
|
6
|
-
const [transitionType, setTransitionType] = createSignal('flyTo');
|
|
7
6
|
const MapContext = createContext();
|
|
8
|
-
|
|
9
|
-
const
|
|
7
|
+
/** Provides the Mapbox Map Object */
|
|
8
|
+
export const useMap = () => useContext(MapContext);
|
|
9
|
+
/** Creates a new Map Container */
|
|
10
|
+
export const MapGL = props => {
|
|
10
11
|
let map;
|
|
11
12
|
let mapRef;
|
|
13
|
+
let containerRef;
|
|
12
14
|
props.id = props.id || createUniqueId();
|
|
13
|
-
|
|
15
|
+
const [mapRoot, setMapRoot] = createSignal();
|
|
16
|
+
const [pending, start] = useTransition();
|
|
17
|
+
const [transitionType, setTransitionType] = createSignal('flyTo');
|
|
18
|
+
onMount(async () => {
|
|
14
19
|
map = new mapboxgl.Map({
|
|
15
20
|
...props.options,
|
|
21
|
+
style: vectorStyleList[props.options?.style] ||
|
|
22
|
+
props.options?.style || { version: 8, sources: {}, layers: [] },
|
|
16
23
|
container: mapRef,
|
|
17
24
|
interactive: !!props.onViewportChange,
|
|
18
|
-
bounds: props.viewport
|
|
19
|
-
center: props.viewport
|
|
20
|
-
zoom: props.viewport
|
|
21
|
-
pitch: props.viewport
|
|
22
|
-
bearing: props.viewport
|
|
23
|
-
fitBoundsOptions: { padding: props.viewport
|
|
25
|
+
bounds: props.viewport?.bounds,
|
|
26
|
+
center: props.viewport?.center,
|
|
27
|
+
zoom: props.viewport?.zoom || null,
|
|
28
|
+
pitch: props.viewport?.pitch || null,
|
|
29
|
+
bearing: props.viewport?.bearing || null,
|
|
30
|
+
fitBoundsOptions: { padding: props.viewport?.padding },
|
|
24
31
|
});
|
|
32
|
+
map.container = containerRef;
|
|
33
|
+
await map.once('styledata');
|
|
34
|
+
setMapRoot(map);
|
|
25
35
|
});
|
|
26
36
|
onCleanup(() => map.remove());
|
|
27
37
|
// Hook up events
|
|
@@ -40,16 +50,27 @@ const MapGL = props => {
|
|
|
40
50
|
createEffect(() => (map.showCollisionBoxes = props.showCollisionBoxes));
|
|
41
51
|
createEffect(() => (map.showOverdrawInspector = props.showOverdrawInspector));
|
|
42
52
|
createEffect(() => (map.getCanvas().style.cursor = props.cursorStyle));
|
|
43
|
-
// Update map style
|
|
44
|
-
createEffect(prev => {
|
|
45
|
-
prev !== props.options.style && map.setStyle(props.options.style);
|
|
46
|
-
}, props.options.style);
|
|
47
|
-
// Update projection
|
|
48
|
-
createEffect(prev => {
|
|
49
|
-
prev !== props.options.projection &&
|
|
50
|
-
map.setProjection(props.options.projection);
|
|
51
|
-
}, props.options.projection);
|
|
52
53
|
createEffect(() => setTransitionType(props.transitionType));
|
|
54
|
+
// Update projection
|
|
55
|
+
createEffect(on(() => props.options?.projection, proj => map.setProjection(proj), { defer: true }));
|
|
56
|
+
// Update map style
|
|
57
|
+
createEffect(on(() => props.options?.style, style => {
|
|
58
|
+
const oldStyle = map.getStyle();
|
|
59
|
+
const oldLayers = oldStyle.layers.filter(l => l.id.startsWith('cl-'));
|
|
60
|
+
const oldSources = Object.keys(oldStyle.sources)
|
|
61
|
+
.filter(s => s.startsWith('cl-'))
|
|
62
|
+
.reduce((obj, key) => ({ ...obj, [key]: oldStyle.sources[key] }), {});
|
|
63
|
+
map.setStyle(vectorStyleList[style] ||
|
|
64
|
+
style || { version: 8, sources: {}, layers: [] });
|
|
65
|
+
map.once('styledata', () => {
|
|
66
|
+
const newStyle = map.getStyle();
|
|
67
|
+
map.setStyle({
|
|
68
|
+
...newStyle,
|
|
69
|
+
sources: { ...newStyle.sources, ...oldSources },
|
|
70
|
+
layers: [...newStyle.layers, ...oldLayers],
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
}, { defer: true }));
|
|
53
74
|
// Hook up viewport events
|
|
54
75
|
createEffect(() => {
|
|
55
76
|
const viewport = {
|
|
@@ -58,17 +79,18 @@ const MapGL = props => {
|
|
|
58
79
|
zoom: map.getZoom(),
|
|
59
80
|
pitch: map.getPitch(),
|
|
60
81
|
bearing: map.getBearing(),
|
|
61
|
-
padding: props.viewport
|
|
62
|
-
bounds: props.viewport
|
|
82
|
+
padding: props.viewport?.padding,
|
|
83
|
+
bounds: props.viewport?.bounds,
|
|
63
84
|
};
|
|
64
85
|
const callMove = event => {
|
|
65
86
|
if (event.originalEvent)
|
|
66
|
-
props.onViewportChange
|
|
87
|
+
props.onViewportChange &&
|
|
88
|
+
props.onViewportChange({ ...viewport, id: props.id });
|
|
67
89
|
setTransitionType('jumpTo');
|
|
68
90
|
};
|
|
69
91
|
const callEnd = event => {
|
|
70
92
|
if (event.originalEvent)
|
|
71
|
-
props.onViewportChange(viewport);
|
|
93
|
+
props.onViewportChange && props.onViewportChange(viewport);
|
|
72
94
|
setTransitionType(props.transitionType);
|
|
73
95
|
};
|
|
74
96
|
map.on('move', callMove).on('moveend', callEnd);
|
|
@@ -76,20 +98,23 @@ const MapGL = props => {
|
|
|
76
98
|
});
|
|
77
99
|
// Update boundaries
|
|
78
100
|
createEffect(prev => {
|
|
79
|
-
if (props.viewport
|
|
101
|
+
if (props.viewport?.bounds != prev)
|
|
80
102
|
props.onViewportChange({
|
|
81
103
|
...props.viewport,
|
|
82
|
-
...map.cameraForBounds(props.viewport
|
|
83
|
-
padding: props.viewport
|
|
104
|
+
...map.cameraForBounds(props.viewport?.bounds, {
|
|
105
|
+
padding: props.viewport?.padding,
|
|
84
106
|
}),
|
|
85
107
|
});
|
|
86
|
-
return props.viewport
|
|
87
|
-
}, props.viewport
|
|
108
|
+
return props.viewport?.bounds;
|
|
109
|
+
}, props.viewport?.bounds);
|
|
88
110
|
// Update Viewport
|
|
89
111
|
createEffect(() => {
|
|
90
|
-
if (props.id === props.viewport
|
|
112
|
+
if (props.id === props.viewport?.id)
|
|
91
113
|
return;
|
|
92
|
-
const viewport = {
|
|
114
|
+
const viewport = {
|
|
115
|
+
...props.viewport,
|
|
116
|
+
padding: props.viewport?.padding || 0,
|
|
117
|
+
};
|
|
93
118
|
switch (untrack(transitionType)) {
|
|
94
119
|
case 'easeTo':
|
|
95
120
|
map.stop().easeTo(viewport);
|
|
@@ -112,9 +137,10 @@ const MapGL = props => {
|
|
|
112
137
|
});
|
|
113
138
|
}
|
|
114
139
|
});
|
|
115
|
-
return (<MapContext.Provider value={
|
|
116
|
-
{
|
|
117
|
-
|
|
140
|
+
return (<MapContext.Provider value={mapRoot}>
|
|
141
|
+
<section ref={containerRef} style={{ position: 'absolute', 'z-index': 1 }}>
|
|
142
|
+
{props.children || null}
|
|
143
|
+
</section>
|
|
144
|
+
<div ref={mapRef} class={props.class || null} classList={props.classList || null} style={{ height: '100%', width: '100%', ...props.style }}/>
|
|
118
145
|
</MapContext.Provider>);
|
|
119
146
|
};
|
|
120
|
-
export { MapGL as default, useMap };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Component } from 'solid-js';
|
|
2
2
|
import type { MarkerSpecification } from 'mapbox-gl/src/style-spec/types.js';
|
|
3
3
|
import type { LngLatLike } from 'mapbox-gl/src/geo/lng_lat.js';
|
|
4
|
-
declare const Marker: Component<{
|
|
4
|
+
export declare const Marker: Component<{
|
|
5
5
|
options?: MarkerSpecification;
|
|
6
6
|
lnglat: LngLatLike;
|
|
7
|
+
children?: any;
|
|
7
8
|
}>;
|
|
8
|
-
export default Marker;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { onCleanup, createEffect } from 'solid-js';
|
|
2
2
|
import { useMap } from '../MapGL';
|
|
3
3
|
import mapboxgl from 'mapbox-gl';
|
|
4
|
-
const Marker = props => {
|
|
4
|
+
export const Marker = props => {
|
|
5
5
|
const map = useMap();
|
|
6
6
|
let marker = null;
|
|
7
7
|
// Add Marker
|
|
8
|
-
|
|
8
|
+
createEffect(() => {
|
|
9
|
+
if (!map())
|
|
10
|
+
return;
|
|
9
11
|
marker = new mapboxgl.Marker(props.options)
|
|
10
12
|
.setLngLat(props.lnglat)
|
|
11
13
|
.setPopup(props.children
|
|
@@ -16,7 +18,6 @@ const Marker = props => {
|
|
|
16
18
|
// Remove Marker
|
|
17
19
|
onCleanup(() => marker.remove());
|
|
18
20
|
// Update Position
|
|
19
|
-
createEffect(() => marker.setLngLat(props.lnglat));
|
|
21
|
+
createEffect(() => marker && marker.setLngLat(props.lnglat));
|
|
20
22
|
return <></>;
|
|
21
23
|
};
|
|
22
|
-
export default Marker;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Component } from 'solid-js';
|
|
2
2
|
import type { PopupSpecification } from 'mapbox-gl/src/style-spec/types.js';
|
|
3
3
|
import type { LngLatLike } from 'mapbox-gl/src/geo/lng_lat.js';
|
|
4
|
-
declare const Popup: Component<{
|
|
4
|
+
export declare const Popup: Component<{
|
|
5
5
|
options?: PopupSpecification;
|
|
6
6
|
lnglat: LngLatLike;
|
|
7
|
+
children?: any;
|
|
7
8
|
}>;
|
|
8
|
-
export default Popup;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { onCleanup, createEffect } from 'solid-js';
|
|
2
2
|
import { useMap } from '../MapGL';
|
|
3
3
|
import mapboxgl from 'mapbox-gl';
|
|
4
|
-
const Popup = props => {
|
|
4
|
+
export const Popup = props => {
|
|
5
5
|
const map = useMap();
|
|
6
6
|
let popup = null;
|
|
7
7
|
// Add Popup
|
|
8
|
-
|
|
8
|
+
createEffect(() => {
|
|
9
|
+
if (!map())
|
|
10
|
+
return;
|
|
9
11
|
popup = new mapboxgl.Popup(props.options)
|
|
10
12
|
.setLngLat(props.lnglat)
|
|
11
13
|
.setDOMContent(<div>{props.children}</div>)
|
|
@@ -14,9 +16,8 @@ const Popup = props => {
|
|
|
14
16
|
// Remove Popup
|
|
15
17
|
onCleanup(() => popup.remove());
|
|
16
18
|
// Update Position
|
|
17
|
-
createEffect(() => popup.setLngLat(props.lnglat));
|
|
19
|
+
createEffect(() => popup && popup.setLngLat(props.lnglat));
|
|
18
20
|
// Update Content
|
|
19
|
-
createEffect(() => popup.setDOMContent(<div>{props.children}</div>));
|
|
21
|
+
createEffect(() => popup && popup.setDOMContent(<div>{props.children}</div>));
|
|
20
22
|
return <></>;
|
|
21
23
|
};
|
|
22
|
-
export default Popup;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Component } from 'solid-js';
|
|
2
2
|
import type { StyleSpecification } from 'mapbox-gl/src/style-spec/types.js';
|
|
3
|
-
declare const Sky: Component<{
|
|
3
|
+
export declare const Sky: Component<{
|
|
4
4
|
style: StyleSpecification;
|
|
5
5
|
visible?: boolean;
|
|
6
|
+
children?: any;
|
|
6
7
|
}>;
|
|
7
|
-
export default Sky;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { onCleanup, createEffect } from 'solid-js';
|
|
2
|
+
import { useMap } from '../MapGL';
|
|
3
|
+
export const Sky = props => {
|
|
4
|
+
const map = useMap();
|
|
5
|
+
const layerId = '_sky';
|
|
6
|
+
// Add Sky Layer
|
|
7
|
+
createEffect(() => {
|
|
8
|
+
if (!map())
|
|
9
|
+
return;
|
|
10
|
+
map().getLayer(layerId) && map().addLayer({ ...props.style, id: layerId });
|
|
11
|
+
});
|
|
12
|
+
// Remove Sky Layer
|
|
13
|
+
onCleanup(() => map().getLayer(layerId) && map().removeLayer(layerId));
|
|
14
|
+
// Update Visibility
|
|
15
|
+
createEffect(() => {
|
|
16
|
+
if (!map())
|
|
17
|
+
return;
|
|
18
|
+
props.visible !== undefined &&
|
|
19
|
+
map().setLayoutProperty(layerId, 'visibility', props.visible ? 'visible' : 'none');
|
|
20
|
+
});
|
|
21
|
+
return props.children;
|
|
22
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Component } from 'solid-js';
|
|
2
|
+
import type { SourceSpecification } from 'mapbox-gl/src/style-spec/types.js';
|
|
3
|
+
export declare const useSourceId: () => string;
|
|
4
|
+
export declare const Source: Component<{
|
|
5
|
+
/** @optional Source ID for referencing non nexted Layers */
|
|
6
|
+
id?: string;
|
|
7
|
+
/** @see https://docs.mapbox.com/mapbox-gl-js/style-spec/sources/ */
|
|
8
|
+
source: SourceSpecification;
|
|
9
|
+
children?: any;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { onCleanup, createEffect, createContext, useContext, createUniqueId, } from 'solid-js';
|
|
2
|
+
import { useMap } from '../MapGL';
|
|
3
|
+
import { rasterStyleList } from '../../styles';
|
|
4
|
+
const SourceContext = createContext();
|
|
5
|
+
export const useSourceId = () => useContext(SourceContext);
|
|
6
|
+
export const Source = props => {
|
|
7
|
+
const map = useMap();
|
|
8
|
+
props.id = props.id || createUniqueId();
|
|
9
|
+
const lookup = url => rasterStyleList[url]
|
|
10
|
+
? {
|
|
11
|
+
...props.source,
|
|
12
|
+
url: '',
|
|
13
|
+
tiles: [
|
|
14
|
+
rasterStyleList[url][0].replace('{apikey}', props.source.apikey),
|
|
15
|
+
],
|
|
16
|
+
attribution: rasterStyleList[url][1],
|
|
17
|
+
}
|
|
18
|
+
: props.source;
|
|
19
|
+
// Add Source
|
|
20
|
+
createEffect(() => {
|
|
21
|
+
if (!map())
|
|
22
|
+
return;
|
|
23
|
+
const source = lookup(props.source.url);
|
|
24
|
+
source.tiles &&
|
|
25
|
+
(source.tiles = ['a', 'b', 'c'].map(i => source.tiles[0].replace('{s}', i)));
|
|
26
|
+
!map().getSource(props.id) && map().addSource(props.id, source);
|
|
27
|
+
});
|
|
28
|
+
// Remove Source
|
|
29
|
+
onCleanup(() => {
|
|
30
|
+
map()
|
|
31
|
+
.getStyle()
|
|
32
|
+
.layers.forEach(layer => layer.source === props.id && map().removeLayer(layer.id));
|
|
33
|
+
map().getSource(props.id) && map().removeSource(props.id);
|
|
34
|
+
});
|
|
35
|
+
// Update
|
|
36
|
+
createEffect(() => {
|
|
37
|
+
if (!map())
|
|
38
|
+
return;
|
|
39
|
+
const source = map().getSource(props.id);
|
|
40
|
+
if (!source)
|
|
41
|
+
return;
|
|
42
|
+
// Update GeoJSON Data
|
|
43
|
+
if (props.source.type === 'geojson' && props.source.data)
|
|
44
|
+
source.setData(props.source.data);
|
|
45
|
+
// Update Image URL
|
|
46
|
+
if (props.source.type === 'image' &&
|
|
47
|
+
(props.source.url || props.source.coordinates))
|
|
48
|
+
source.updateImage(props.source.url, props.source.coordinates);
|
|
49
|
+
// Update Vector URL or Tiles
|
|
50
|
+
if (props.source.type === 'vector' &&
|
|
51
|
+
(props.source.url || props.source.tiles))
|
|
52
|
+
props.source.url
|
|
53
|
+
? source.setUrl(props.source.url)
|
|
54
|
+
: source.setTiles(props.source.tiles);
|
|
55
|
+
// Update Raster URL or Tiles
|
|
56
|
+
if (props.source.type === 'raster' &&
|
|
57
|
+
(props.source.url || props.source.tiles)) {
|
|
58
|
+
const src = lookup(props.source.url);
|
|
59
|
+
src.tiles &&
|
|
60
|
+
(src.tiles = ['a', 'b', 'c'].map(i => src.tiles[0].replace('{s}', i)));
|
|
61
|
+
source._tileJSONRequest?.cancel();
|
|
62
|
+
source.url = src.url;
|
|
63
|
+
source.scheme = src.scheme;
|
|
64
|
+
source._options = { ...source._options, ...src };
|
|
65
|
+
map().style._sourceCaches[`other:${props.id}`]?.clearTiles();
|
|
66
|
+
source.load();
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
return (<SourceContext.Provider value={props.id}>
|
|
70
|
+
{props.children}
|
|
71
|
+
</SourceContext.Provider>);
|
|
72
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Component } from 'solid-js';
|
|
2
2
|
import type { TerrainSpecification } from 'mapbox-gl/src/style-spec/types.js';
|
|
3
|
-
declare const Terrain: Component<{
|
|
3
|
+
export declare const Terrain: Component<{
|
|
4
4
|
style: TerrainSpecification;
|
|
5
5
|
visible?: boolean;
|
|
6
|
+
children?: any;
|
|
6
7
|
}>;
|
|
7
|
-
export default Terrain;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { onCleanup, createEffect } from 'solid-js';
|
|
2
|
+
import { useMap } from '../MapGL';
|
|
3
|
+
import { useSourceId } from '../Source';
|
|
4
|
+
export const Terrain = props => {
|
|
5
|
+
const map = useMap();
|
|
6
|
+
const sourceId = useSourceId();
|
|
7
|
+
// Add Terrain Layer
|
|
8
|
+
createEffect(() => {
|
|
9
|
+
if (!map())
|
|
10
|
+
return;
|
|
11
|
+
map().setTerrain({ ...props.style, source: sourceId });
|
|
12
|
+
});
|
|
13
|
+
// Remove Terrain Layer
|
|
14
|
+
onCleanup(() => map().setTerrain(null));
|
|
15
|
+
// Update Visibility
|
|
16
|
+
createEffect(() => {
|
|
17
|
+
if (!map())
|
|
18
|
+
return;
|
|
19
|
+
props.visible !== undefined &&
|
|
20
|
+
map().setTerrain(props.visible ? props.style : null);
|
|
21
|
+
});
|
|
22
|
+
return props.children;
|
|
23
|
+
};
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { MapGL as default, useMap } from './components/MapGL';
|
|
2
|
+
export { Source, useSourceId } from './components/Source';
|
|
3
|
+
export { Layer } from './components/Layer';
|
|
4
|
+
export { Fog } from './components/Fog';
|
|
5
|
+
export { Sky } from './components/Sky';
|
|
6
|
+
export { Terrain } from './components/Terrain';
|
|
7
|
+
export { Control } from './components/Control';
|
|
8
|
+
export { Marker } from './components/Marker';
|
|
9
|
+
export { Popup } from './components/Popup';
|
|
10
|
+
export { Image } from './components/Image';
|
|
11
|
+
export { Camera } from './components/Camera';
|
|
12
|
+
export type { Viewport } from './components/MapGL';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { MapGL as default, useMap } from './components/MapGL';
|
|
2
|
+
export { Source, useSourceId } from './components/Source';
|
|
3
|
+
export { Layer } from './components/Layer';
|
|
4
|
+
export { Fog } from './components/Fog';
|
|
5
|
+
export { Sky } from './components/Sky';
|
|
6
|
+
export { Terrain } from './components/Terrain';
|
|
7
|
+
export { Control } from './components/Control';
|
|
8
|
+
export { Marker } from './components/Marker';
|
|
9
|
+
export { Popup } from './components/Popup';
|
|
10
|
+
export { Image } from './components/Image';
|
|
11
|
+
export { Camera } from './components/Camera';
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export declare const vectorStyleList: {
|
|
2
|
+
'mb:light': string;
|
|
3
|
+
'mb:dark': string;
|
|
4
|
+
'mb:streets': string;
|
|
5
|
+
'mb:outdoor': string;
|
|
6
|
+
'mb:sat': string;
|
|
7
|
+
'mb:sat-streets': string;
|
|
8
|
+
'mb:nav': string;
|
|
9
|
+
'mb:nav-night': string;
|
|
10
|
+
'mb:basic': string;
|
|
11
|
+
'mb:monochrome': string;
|
|
12
|
+
'mb:leshine': string;
|
|
13
|
+
'mb:icecream': string;
|
|
14
|
+
'mb:cali': string;
|
|
15
|
+
'mb:northstar': string;
|
|
16
|
+
'mb:mineral': string;
|
|
17
|
+
'mb:moonlight': string;
|
|
18
|
+
'mb:frank': string;
|
|
19
|
+
'mb:minimo': string;
|
|
20
|
+
'mb:decimal': string;
|
|
21
|
+
'mb:standard': string;
|
|
22
|
+
'mb:blueprint': string;
|
|
23
|
+
'mb:bubble': string;
|
|
24
|
+
'mb:pencil': string;
|
|
25
|
+
'mb:swiss-ski': string;
|
|
26
|
+
'mb:vintage': string;
|
|
27
|
+
'mb:whaam': string;
|
|
28
|
+
'mb:neon': string;
|
|
29
|
+
'mb:camoflauge': string;
|
|
30
|
+
'mb:emerald': string;
|
|
31
|
+
'mb:runner': string;
|
|
32
|
+
'mb:x-ray': string;
|
|
33
|
+
};
|
|
34
|
+
export declare const rasterStyleList: {
|
|
35
|
+
'osm:org': string[];
|
|
36
|
+
'osm:human': string[];
|
|
37
|
+
'osm:cycle': string[];
|
|
38
|
+
'carto:voyager': string[];
|
|
39
|
+
'carto:positron': string[];
|
|
40
|
+
'carto:dark': string[];
|
|
41
|
+
'open:topo': string[];
|
|
42
|
+
'stamen:toner': string[];
|
|
43
|
+
'stamen:toner-lite': string[];
|
|
44
|
+
'stamen:watercolor': string[];
|
|
45
|
+
'stamen:terrain': string[];
|
|
46
|
+
'tf:cycle': string[];
|
|
47
|
+
'tf:trans': string[];
|
|
48
|
+
'tf:trans-dark': string[];
|
|
49
|
+
'tf:landscape': string[];
|
|
50
|
+
'tf:outdoors': string[];
|
|
51
|
+
'tf:neighbourhood': string[];
|
|
52
|
+
'tf:spinal': string[];
|
|
53
|
+
'tf:pioneer': string[];
|
|
54
|
+
'tf:atlas': string[];
|
|
55
|
+
'tf:mobile': string[];
|
|
56
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
const mapBase = 'mapbox://styles/mapbox';
|
|
2
|
+
const gitBase = 'https://raw.githubusercontent.com';
|
|
3
|
+
export const vectorStyleList = {
|
|
4
|
+
'mb:light': `${mapBase}/light-v10`,
|
|
5
|
+
'mb:dark': `${mapBase}/dark-v10`,
|
|
6
|
+
'mb:streets': `${mapBase}/streets-v11`,
|
|
7
|
+
'mb:outdoor': `${mapBase}/outdoors-v11`,
|
|
8
|
+
'mb:sat': `${mapBase}/satellite-v9`,
|
|
9
|
+
'mb:sat-streets': `${mapBase}/satellite-streets-v11`,
|
|
10
|
+
'mb:nav': `${mapBase}/navigation-guidance-day-v4`,
|
|
11
|
+
'mb:nav-night': `${mapBase}/navigation-guidance-night-v4`,
|
|
12
|
+
'mb:basic': `${mapBase}/cjf4m44iw0uza2spb3q0a7s41`,
|
|
13
|
+
'mb:monochrome': `${mapBase}/cjv6rzz4j3m4b1fqcchuxclhb`,
|
|
14
|
+
'mb:leshine': `${mapBase}/cjcunv5ae262f2sm9tfwg8i0w`,
|
|
15
|
+
'mb:icecream': `${mapBase}/cj7t3i5yj0unt2rmt3y4b5e32`,
|
|
16
|
+
'mb:cali': `${mapBase}/cjerxnqt3cgvp2rmyuxbeqme7`,
|
|
17
|
+
'mb:northstar': `${mapBase}/cj44mfrt20f082snokim4ungi`,
|
|
18
|
+
'mb:mineral': `${mapBase}/cjtep62gq54l21frr1whf27ak`,
|
|
19
|
+
'mb:moonlight': `${mapBase}/cj3kbeqzo00022smj7akz3o1e`,
|
|
20
|
+
'mb:frank': `${mapBase}-map-design/ckshxkppe0gge18nz20i0nrwq`,
|
|
21
|
+
'mb:minimo': `${mapBase}-map-design/cksjc2nsq1bg117pnekb655h1`,
|
|
22
|
+
'mb:decimal': `${mapBase}-map-design/ck4014y110wt61ctt07egsel6`,
|
|
23
|
+
'mb:standard': `${mapBase}-map-design/ckr0svm3922ki18qntevm857n`,
|
|
24
|
+
'mb:blueprint': `${mapBase}-map-design/cks97e1e37nsd17nzg7p0308g`,
|
|
25
|
+
'mb:bubble': `${mapBase}-map-design/cksysy2nl62zp17quosctdtcc`,
|
|
26
|
+
'mb:pencil': `${mapBase}-map-design/cks9iema71es417mlrft4go2k`,
|
|
27
|
+
'mb:swiss-ski': `${gitBase}/mapbox/mapbox-gl-swiss-ski-style/master/cij1zoclj002y8rkkdjl69psd.json`,
|
|
28
|
+
'mb:vintage': `${gitBase}/mapbox/mapbox-gl-vintage-style/master/cif5p01n202nisaktvljx9mv3.json`,
|
|
29
|
+
'mb:whaam': `${gitBase}/mapbox/mapbox-gl-whaam-style/master/cii8323c8004w0nlvtss3dbm2.json`,
|
|
30
|
+
'mb:neon': `${gitBase}/NatEvatt/awesome-mapbox-gl-styles/master/styles/Neon/style.json`,
|
|
31
|
+
'mb:camoflauge': `${gitBase}/jingsam/mapbox-gl-styles/master/Camouflage.json`,
|
|
32
|
+
'mb:emerald': `${gitBase}/jingsam/mapbox-gl-styles/master/Emerald.json`,
|
|
33
|
+
'mb:runner': `${gitBase}/jingsam/mapbox-gl-styles/master/Runner.json`,
|
|
34
|
+
'mb:x-ray': `${gitBase}/jingsam/mapbox-gl-styles/master/X-ray.json`,
|
|
35
|
+
};
|
|
36
|
+
export const rasterStyleList = {
|
|
37
|
+
'osm:org': [
|
|
38
|
+
'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
|
|
39
|
+
'Map © <a href="https://www.openstreetmap.org"><em>OpenStreetMap</em></a>',
|
|
40
|
+
],
|
|
41
|
+
'osm:human': [
|
|
42
|
+
'https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png',
|
|
43
|
+
'Map © <a href="http://hot.openstreetmap.org"><em>Humanitarian OpenStreetMap Team</em></a>',
|
|
44
|
+
],
|
|
45
|
+
'osm:cycle': [
|
|
46
|
+
'https://{s}.tile-cyclosm.openstreetmap.fr/cyclosm/{z}/{x}/{y}.png',
|
|
47
|
+
'Maps © <a href="https://www.cyclosm.org" target="_blank"><em>CyclOSM</em></a>, Data © <a href="http://www.openstreetmap.org/copyright" target="_blank"><em>OpenStreetMap</em></a>',
|
|
48
|
+
],
|
|
49
|
+
'carto:voyager': [
|
|
50
|
+
'https://{s}.basemaps.cartocdn.com/rastertiles/voyager_labels_under/{z}/{x}/{y}.png',
|
|
51
|
+
'Maps © <a href="https://carto.com/attribution"><em>Carto</em></a>',
|
|
52
|
+
],
|
|
53
|
+
'carto:positron': [
|
|
54
|
+
'https://{s}.basemaps.cartocdn.com/rastertiles/light_all/{z}/{x}/{y}.png',
|
|
55
|
+
'Maps © <a href="https://carto.com/attribution"><em>Carto</em></a>',
|
|
56
|
+
],
|
|
57
|
+
'carto:dark': [
|
|
58
|
+
'https://{s}.basemaps.cartocdn.com/rastertiles/dark_all/{z}/{x}/{y}.png',
|
|
59
|
+
'Maps © <a href="https://carto.com/attribution"><em>Carto</em></a>',
|
|
60
|
+
],
|
|
61
|
+
'open:topo': [
|
|
62
|
+
'https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png',
|
|
63
|
+
'Maps © <a href="https://opentopomap.org/credits"><em>OpenTopoMap</em></a>, Data © <a href="http://www.openstreetmap.org/copyright" target="_blank"><em>OpenStreetMap</em></a>',
|
|
64
|
+
],
|
|
65
|
+
'stamen:toner': [
|
|
66
|
+
'https://stamen-tiles-{s}.a.ssl.fastly.net/toner/{z}/{x}/{y}.png',
|
|
67
|
+
'Maps © <a href="https://stamen.com" target="_blank"><em>Stamen Design</em></a>, Data © <a href="http://www.openstreetmap.org/copyright" target="_blank"><em>OpenStreetMap</em></a>',
|
|
68
|
+
],
|
|
69
|
+
'stamen:toner-lite': [
|
|
70
|
+
'https://stamen-tiles-{s}.a.ssl.fastly.net/toner-lite/{z}/{x}/{y}.png',
|
|
71
|
+
'Maps © <a href="https://stamen.com" target="_blank"><em>Stamen Design</em></a>, Data © <a href="http://www.openstreetmap.org/copyright" target="_blank"><em>OpenStreetMap</em></a>',
|
|
72
|
+
],
|
|
73
|
+
'stamen:watercolor': [
|
|
74
|
+
'https://stamen-tiles-{s}.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.jpg',
|
|
75
|
+
'Maps © <a href="https://stamen.com" target="_blank"><em>Stamen Design</em></a>, Data © <a href="http://www.openstreetmap.org/copyright" target="_blank"><em>OpenStreetMap</em></a>',
|
|
76
|
+
],
|
|
77
|
+
'stamen:terrain': [
|
|
78
|
+
'https://stamen-tiles-{s}.a.ssl.fastly.net/terrain/{z}/{x}/{y}.jpg',
|
|
79
|
+
'Maps © <a href="https://stamen.com" target="_blank"><em>Stamen Design</em></a>, Data © <a href="http://www.openstreetmap.org/copyright" target="_blank"><em>OpenStreetMap</em></a>',
|
|
80
|
+
],
|
|
81
|
+
'tf:cycle': [
|
|
82
|
+
'https://{s}.tile.thunderforest.com/cycle/{z}/{x}/{y}@2x.png?apikey={apikey}',
|
|
83
|
+
'Maps © <a href="https://thunderforest.com" target="_blank"><em>Thunderforest</em></a>, Data © <a href="http://www.openstreetmap.org/copyright" target="_blank"><em>OpenStreetMap</em></a>',
|
|
84
|
+
],
|
|
85
|
+
'tf:trans': [
|
|
86
|
+
'https://{s}.tile.thunderforest.com/transport/{z}/{x}/{y}.png?apikey={apikey}',
|
|
87
|
+
'Maps © <a href="https://thunderforest.com" target="_blank"><em>Thunderforest</em></a>, Data © <a href="http://www.openstreetmap.org/copyright" target="_blank"><em>OpenStreetMap</em></a>',
|
|
88
|
+
],
|
|
89
|
+
'tf:trans-dark': [
|
|
90
|
+
'https://{s}.tile.thunderforest.com/transport-dark/{z}/{x}/{y}.png?apikey={apikey}',
|
|
91
|
+
'Maps © <a href="https://thunderforest.com" target="_blank"><em>Thunderforest</em></a>, Data © <a href="http://www.openstreetmap.org/copyright" target="_blank"><em>OpenStreetMap</em></a>',
|
|
92
|
+
],
|
|
93
|
+
'tf:landscape': [
|
|
94
|
+
'https://{s}.tile.thunderforest.com/landscape/{z}/{x}/{y}.png?apikey={apikey}',
|
|
95
|
+
'Maps © <a href="https://thunderforest.com" target="_blank"><em>Thunderforest</em></a>, Data © <a href="http://www.openstreetmap.org/copyright" target="_blank"><em>OpenStreetMap</em></a>',
|
|
96
|
+
],
|
|
97
|
+
'tf:outdoors': [
|
|
98
|
+
'https://{s}.tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey={apikey}',
|
|
99
|
+
'Maps © <a href="https://thunderforest.com" target="_blank"><em>Thunderforest</em></a>, Data © <a href="http://www.openstreetmap.org/copyright" target="_blank"><em>OpenStreetMap</em></a>',
|
|
100
|
+
],
|
|
101
|
+
'tf:neighbourhood': [
|
|
102
|
+
'https://{s}.tile.thunderforest.com/neighbourhood/{z}/{x}/{y}.png?apikey={apikey}',
|
|
103
|
+
'Maps © <a href="https://thunderforest.com" target="_blank"><em>Thunderforest</em></a>, Data © <a href="http://www.openstreetmap.org/copyright" target="_blank"><em>OpenStreetMap</em></a>',
|
|
104
|
+
],
|
|
105
|
+
'tf:spinal': [
|
|
106
|
+
'https://{s}.tile.thunderforest.com/spinal-map/{z}/{x}/{y}.png?apikey={apikey}',
|
|
107
|
+
'Maps © <a href="https://thunderforest.com" target="_blank"><em>Thunderforest</em></a>, Data © <a href="http://www.openstreetmap.org/copyright" target="_blank"><em>OpenStreetMap</em></a>',
|
|
108
|
+
],
|
|
109
|
+
'tf:pioneer': [
|
|
110
|
+
'https://{s}.tile.thunderforest.com/pioneer/{z}/{x}/{y}.png?apikey={apikey}',
|
|
111
|
+
'Maps © <a href="https://thunderforest.com" target="_blank"><em>Thunderforest</em></a>, Data © <a href="http://www.openstreetmap.org/copyright" target="_blank"><em>OpenStreetMap</em></a>',
|
|
112
|
+
],
|
|
113
|
+
'tf:atlas': [
|
|
114
|
+
'https://{s}.tile.thunderforest.com/atlas/{z}/{x}/{y}.png?apikey={apikey}',
|
|
115
|
+
'Maps © <a href="https://thunderforest.com" target="_blank"><em>Thunderforest</em></a>, Data © <a href="http://www.openstreetmap.org/copyright" target="_blank"><em>OpenStreetMap</em></a>',
|
|
116
|
+
],
|
|
117
|
+
'tf:mobile': [
|
|
118
|
+
'https://{s}.tile.thunderforest.com/mobile-atlas/{z}/{x}/{y}.png?apikey={apikey}',
|
|
119
|
+
'Maps © <a href="https://thunderforest.com" target="_blank"><em>Thunderforest</em></a>, Data © <a href="http://www.openstreetmap.org/copyright" target="_blank"><em>OpenStreetMap</em></a>',
|
|
120
|
+
],
|
|
121
|
+
};
|