solid-map-gl 1.3.7 → 1.4.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/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/styles.css +2 -1
- package/dist/source/components/Atmosphere/index.jsx +1 -3
- package/dist/source/components/Control/index.jsx +23 -21
- package/dist/source/components/Image/index.jsx +10 -10
- package/dist/source/components/Layer/index.jsx +16 -16
- package/dist/source/components/MapGL/index.jsx +23 -9
- package/dist/source/components/Marker/index.jsx +16 -8
- package/dist/source/components/Popup/index.jsx +9 -5
- package/dist/source/components/Source/index.jsx +7 -7
- package/dist/source/components/Terrain/index.jsx +12 -6
- package/dist/types/components/MapGL/index.d.ts +2 -0
- package/dist/types/mapStyles.d.ts +2 -101
- package/package.json +9 -7
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { onCleanup, createEffect } from 'solid-js';
|
|
2
2
|
import { useMap } from '../MapGL';
|
|
3
|
-
import mapboxgl from 'mapbox-gl';
|
|
4
3
|
export const Popup = props => {
|
|
5
4
|
const map = useMap();
|
|
6
5
|
let popup = null;
|
|
7
6
|
// Add Popup
|
|
8
|
-
createEffect(() => {
|
|
9
|
-
|
|
7
|
+
createEffect(async () => {
|
|
8
|
+
const mapLib = map().isMapLibre
|
|
9
|
+
? await import('maplibre-gl')
|
|
10
|
+
: await import('mapbox-gl');
|
|
11
|
+
if (popup)
|
|
12
|
+
return;
|
|
13
|
+
popup = new mapLib.Popup(props.options)
|
|
10
14
|
.setLngLat(props.lngLat)
|
|
11
15
|
.setDOMContent(<div>{props.children}</div>)
|
|
12
16
|
.addTo(map());
|
|
@@ -14,8 +18,8 @@ export const Popup = props => {
|
|
|
14
18
|
// Remove Popup
|
|
15
19
|
onCleanup(() => popup.remove());
|
|
16
20
|
// Update Position
|
|
17
|
-
createEffect(() => popup
|
|
21
|
+
createEffect(() => popup?.setLngLat(props.lngLat));
|
|
18
22
|
// Update Content
|
|
19
|
-
createEffect(() => popup
|
|
23
|
+
createEffect(() => popup?.setDOMContent(<div>{props.children}</div>));
|
|
20
24
|
return <></>;
|
|
21
25
|
};
|
|
@@ -21,13 +21,6 @@ export const Source = props => {
|
|
|
21
21
|
}
|
|
22
22
|
: props.source;
|
|
23
23
|
};
|
|
24
|
-
// Add Source
|
|
25
|
-
createEffect(() => {
|
|
26
|
-
const source = lookup(props.source.url);
|
|
27
|
-
source.tiles &&
|
|
28
|
-
(source.tiles = ['a', 'b', 'c'].map(i => source.tiles[0].replace('{s}', i)));
|
|
29
|
-
!map().getSource(props.id) && map().addSource(props.id, source);
|
|
30
|
-
});
|
|
31
24
|
// Remove Source
|
|
32
25
|
onCleanup(() => {
|
|
33
26
|
map()
|
|
@@ -67,6 +60,13 @@ export const Source = props => {
|
|
|
67
60
|
source.load();
|
|
68
61
|
}
|
|
69
62
|
});
|
|
63
|
+
// Add Source
|
|
64
|
+
createEffect(() => {
|
|
65
|
+
const source = lookup(props.source.url);
|
|
66
|
+
source.tiles &&
|
|
67
|
+
(source.tiles = ['a', 'b', 'c'].map(i => source.tiles[0].replace('{s}', i)));
|
|
68
|
+
!map().getSource(props.id) && map().addSource(props.id, source);
|
|
69
|
+
});
|
|
70
70
|
return (<SourceContext.Provider value={props.id}>
|
|
71
71
|
{props.children}
|
|
72
72
|
</SourceContext.Provider>);
|
|
@@ -8,12 +8,18 @@ export const Terrain = props => {
|
|
|
8
8
|
createEffect(() => {
|
|
9
9
|
if (!sourceId) {
|
|
10
10
|
sourceId = createUniqueId();
|
|
11
|
-
map().addSource(sourceId,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
map().addSource(sourceId, map().isMapLibre
|
|
12
|
+
? {
|
|
13
|
+
type: 'raster-dem',
|
|
14
|
+
url: 'https://demotiles.maplibre.org/terrain-tiles/tiles.json',
|
|
15
|
+
tileSize: 256,
|
|
16
|
+
}
|
|
17
|
+
: {
|
|
18
|
+
type: 'raster-dem',
|
|
19
|
+
url: 'mapbox://mapbox.terrain-rgb',
|
|
20
|
+
tileSize: 512,
|
|
21
|
+
maxzoom: 14,
|
|
22
|
+
});
|
|
17
23
|
}
|
|
18
24
|
map().setTerrain({
|
|
19
25
|
exaggeration: props.exaggeration || 1,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Component } from 'solid-js';
|
|
2
2
|
import 'mapbox-gl/dist/mapbox-gl.css';
|
|
3
|
+
import 'maplibre-gl/dist/maplibre-gl.css';
|
|
3
4
|
import type { MapboxOptions } from 'mapbox-gl/src/ui/map';
|
|
4
5
|
import type { LngLatLike } from 'mapbox-gl/src/geo/lng_lat.js';
|
|
5
6
|
import type { LngLatBounds } from 'mapbox-gl/src/geo/lng_lat_bounds.js';
|
|
@@ -52,6 +53,7 @@ export declare const MapGL: Component<{
|
|
|
52
53
|
cursorStyle?: string;
|
|
53
54
|
darkStyle?: StyleSpecification | string;
|
|
54
55
|
disableResize?: boolean;
|
|
56
|
+
asMapLibre?: boolean;
|
|
55
57
|
debug?: boolean;
|
|
56
58
|
ref?: HTMLDivElement;
|
|
57
59
|
/** Children within the Map Container */
|
|
@@ -1,101 +1,2 @@
|
|
|
1
|
-
export declare const vectorStyleList:
|
|
2
|
-
|
|
3
|
-
light: string;
|
|
4
|
-
dark: string;
|
|
5
|
-
street: string;
|
|
6
|
-
outdoor: string;
|
|
7
|
-
sat: string;
|
|
8
|
-
sat_street: string;
|
|
9
|
-
nav: string;
|
|
10
|
-
nav_night: string;
|
|
11
|
-
basic: string;
|
|
12
|
-
monochrome: string;
|
|
13
|
-
leshine: string;
|
|
14
|
-
icecream: string;
|
|
15
|
-
cali: string;
|
|
16
|
-
northstar: string;
|
|
17
|
-
mineral: string;
|
|
18
|
-
moonlight: string;
|
|
19
|
-
frank: string;
|
|
20
|
-
minimo: string;
|
|
21
|
-
decimal: string;
|
|
22
|
-
standard: string;
|
|
23
|
-
blueprint: string;
|
|
24
|
-
bubble: string;
|
|
25
|
-
pencil: string;
|
|
26
|
-
swiss_ski: string;
|
|
27
|
-
vintage: string;
|
|
28
|
-
whaam: string;
|
|
29
|
-
neon: string;
|
|
30
|
-
camoflauge: string;
|
|
31
|
-
emerald: string;
|
|
32
|
-
runner: string;
|
|
33
|
-
x_ray: string;
|
|
34
|
-
};
|
|
35
|
-
esri: {
|
|
36
|
-
blueprint: string;
|
|
37
|
-
charted_territory: string;
|
|
38
|
-
colored_pencil: string;
|
|
39
|
-
community: string;
|
|
40
|
-
mid_century: string;
|
|
41
|
-
modern_antique: string;
|
|
42
|
-
nat_geo: string;
|
|
43
|
-
newspaper: string;
|
|
44
|
-
open_street_map: string;
|
|
45
|
-
light_gray_canvas: string;
|
|
46
|
-
dark_gray_canvas: string;
|
|
47
|
-
human_geo_light: string;
|
|
48
|
-
human_geo_dark: string;
|
|
49
|
-
world_navigation: string;
|
|
50
|
-
world_street: string;
|
|
51
|
-
world_street_night: string;
|
|
52
|
-
world_terrain: string;
|
|
53
|
-
world_terrain_hybrid: string;
|
|
54
|
-
world_topographic: string;
|
|
55
|
-
chromium: string;
|
|
56
|
-
dreamcatcher: string;
|
|
57
|
-
seahaven: string;
|
|
58
|
-
sangria: string;
|
|
59
|
-
mercurial: string;
|
|
60
|
-
imagery: string;
|
|
61
|
-
imagery_hybrid: string;
|
|
62
|
-
firefly: string;
|
|
63
|
-
firefly_hybrid: string;
|
|
64
|
-
oceans: string;
|
|
65
|
-
};
|
|
66
|
-
};
|
|
67
|
-
export declare const rasterStyleList: {
|
|
68
|
-
osm: {
|
|
69
|
-
org: string;
|
|
70
|
-
human: string;
|
|
71
|
-
cycle: string;
|
|
72
|
-
topo: string;
|
|
73
|
-
_copy: string;
|
|
74
|
-
};
|
|
75
|
-
carto: {
|
|
76
|
-
voyager: string;
|
|
77
|
-
positron: string;
|
|
78
|
-
dark: string;
|
|
79
|
-
_copy: string;
|
|
80
|
-
};
|
|
81
|
-
stamen: {
|
|
82
|
-
toner: string;
|
|
83
|
-
toner_lite: string;
|
|
84
|
-
watercolor: string;
|
|
85
|
-
terrain: string;
|
|
86
|
-
_copy: string;
|
|
87
|
-
};
|
|
88
|
-
tf: {
|
|
89
|
-
cycle: string;
|
|
90
|
-
trans: string;
|
|
91
|
-
trans_dark: string;
|
|
92
|
-
landscape: string;
|
|
93
|
-
outdoors: string;
|
|
94
|
-
neighbourhood: string;
|
|
95
|
-
spinal: string;
|
|
96
|
-
pioneer: string;
|
|
97
|
-
atlas: string;
|
|
98
|
-
mobile: string;
|
|
99
|
-
_copy: string;
|
|
100
|
-
};
|
|
101
|
-
};
|
|
1
|
+
export declare const vectorStyleList: object;
|
|
2
|
+
export declare const rasterStyleList: object;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.4.0",
|
|
3
3
|
"name": "solid-map-gl",
|
|
4
4
|
"description": "Solid Component Library for Mapbox GL JS",
|
|
5
5
|
"info": "Solid Component Library for Mapbox GL JS. Mapbox GL JS is a JavaScript library that renders interactive maps from vector tiles and Mapbox styles using WebGL. This project is intended to be as close as possible to the Mapbox GL JS API.",
|
|
@@ -51,20 +51,22 @@
|
|
|
51
51
|
],
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"jsdom": "^20.0.0",
|
|
54
|
-
"mapbox-gl": "^2.
|
|
55
|
-
"
|
|
54
|
+
"mapbox-gl": "^2.10.0",
|
|
55
|
+
"maplibre-gl": "^2.4.0",
|
|
56
|
+
"rollup": "^2.79.0",
|
|
56
57
|
"rollup-plugin-import-css": "^3.0.3",
|
|
57
58
|
"rollup-plugin-uglify": "^6.0.4",
|
|
58
59
|
"rollup-preset-solid": "^1.4.0",
|
|
59
|
-
"solid-js": "^1.4
|
|
60
|
+
"solid-js": "^1.5.4",
|
|
60
61
|
"solid-testing-library": "^0.3.0",
|
|
61
|
-
"typescript": "^4.
|
|
62
|
-
"vite": "^3.0
|
|
62
|
+
"typescript": "^4.8.2",
|
|
63
|
+
"vite": "^3.1.0",
|
|
63
64
|
"vite-plugin-solid": "^2.3.0",
|
|
64
|
-
"vitest": "^0.
|
|
65
|
+
"vitest": "^0.23.1"
|
|
65
66
|
},
|
|
66
67
|
"peerDependencies": {
|
|
67
68
|
"mapbox-gl": "^2.9.2",
|
|
69
|
+
"maplibre-gl": "^2.4.0",
|
|
68
70
|
"solid-js": "^1.4.8"
|
|
69
71
|
}
|
|
70
72
|
}
|