solid-map-gl 1.1.28 → 1.2.2

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 (44) hide show
  1. package/README.md +13 -7
  2. package/dist/{esm/styles.css → cjs/index.css} +0 -0
  3. package/dist/cjs/index.js +2 -0
  4. package/dist/cjs/index.js.map +1 -0
  5. package/dist/esm/index.css +1 -0
  6. package/dist/esm/index.js +1 -1
  7. package/dist/esm/index.js.map +1 -1
  8. package/dist/index/components/Camera/index.d.ts +16 -0
  9. package/dist/index/components/Camera/index.jsx +49 -0
  10. package/dist/{types → index}/components/Control/index.d.ts +2 -2
  11. package/dist/{source → index}/components/Control/index.jsx +6 -6
  12. package/dist/{types → index}/components/Fog/index.d.ts +2 -2
  13. package/dist/index/components/Fog/index.jsx +17 -0
  14. package/dist/{types → index}/components/Image/index.d.ts +1 -2
  15. package/dist/{source → index}/components/Image/index.jsx +4 -10
  16. package/dist/{types → index}/components/Layer/index.d.ts +2 -2
  17. package/dist/{source → index}/components/Layer/index.jsx +26 -28
  18. package/dist/{types → index}/components/MapGL/index.d.ts +22 -5
  19. package/dist/index/components/MapGL/index.jsx +149 -0
  20. package/dist/{types → index}/components/Marker/index.d.ts +2 -2
  21. package/dist/{source → index}/components/Marker/index.jsx +4 -5
  22. package/dist/{types → index}/components/Popup/index.d.ts +2 -2
  23. package/dist/{source → index}/components/Popup/index.jsx +5 -6
  24. package/dist/{types → index}/components/Sky/index.d.ts +2 -2
  25. package/dist/index/components/Sky/index.jsx +18 -0
  26. package/dist/index/components/Source/index.d.ts +10 -0
  27. package/dist/index/components/Source/index.jsx +68 -0
  28. package/dist/{types → index}/components/Terrain/index.d.ts +2 -2
  29. package/dist/index/components/Terrain/index.jsx +19 -0
  30. package/dist/{types → index}/events.d.ts +0 -0
  31. package/dist/{source → index}/events.js +0 -0
  32. package/dist/index/index.d.ts +12 -0
  33. package/dist/index/index.jsx +11 -0
  34. package/dist/index/styles.d.ts +56 -0
  35. package/dist/index/styles.js +121 -0
  36. package/package.json +16 -14
  37. package/dist/source/components/Fog/index.jsx +0 -21
  38. package/dist/source/components/MapGL/index.jsx +0 -139
  39. package/dist/source/components/Sky/index.jsx +0 -22
  40. package/dist/source/components/Source/index.jsx +0 -32
  41. package/dist/source/components/Terrain/index.jsx +0 -23
  42. package/dist/source/index.jsx +0 -10
  43. package/dist/types/components/Source/index.d.ts +0 -8
  44. package/dist/types/index.d.ts +0 -11
@@ -0,0 +1,149 @@
1
+ import { createSignal, createEffect, onMount, onCleanup, createContext, useContext, useTransition, createUniqueId, untrack, on, } from 'solid-js';
2
+ import { mapEvents } from '../../events';
3
+ import { vectorStyleList } from '../../styles';
4
+ import mapboxgl from 'mapbox-gl';
5
+ import 'mapbox-gl/dist/mapbox-gl.css';
6
+ const MapContext = createContext();
7
+ /** Provides the Mapbox Map Object */
8
+ export const useMap = () => useContext(MapContext);
9
+ /** Creates a new Map Container */
10
+ export const MapGL = props => {
11
+ let map;
12
+ let mapRef;
13
+ let containerRef;
14
+ props.id = props.id || createUniqueId();
15
+ const [mapRoot, setMapRoot] = createSignal();
16
+ const [pending, start] = useTransition();
17
+ const [transitionType, setTransitionType] = createSignal('flyTo');
18
+ onMount(() => {
19
+ map = new mapboxgl.Map({
20
+ ...props.options,
21
+ style: vectorStyleList[props.options?.style] ||
22
+ props.options?.style || { version: 8, sources: {}, layers: [] },
23
+ container: mapRef || 'map',
24
+ interactive: !!props.onViewportChange,
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 },
31
+ });
32
+ map.container = containerRef;
33
+ map.once('styledata').then(() => setMapRoot(map));
34
+ onCleanup(() => map.remove());
35
+ // Hook up events
36
+ createEffect(() => mapEvents.forEach(item => {
37
+ if (props[item]) {
38
+ const event = item.slice(2).toLowerCase();
39
+ const callback = e => props[item](e);
40
+ map.on(event, callback);
41
+ onCleanup(() => map.off(event, callback));
42
+ }
43
+ }));
44
+ // Update debug features
45
+ createEffect(() => {
46
+ map.showTileBoundaries = props.showTileBoundaries;
47
+ map.showTerrainWireframe = props.showTerrainWireframe;
48
+ map.showPadding = props.showPadding;
49
+ map.showCollisionBoxes = props.showCollisionBoxes;
50
+ map.showOverdrawInspector = props.showOverdrawInspector;
51
+ });
52
+ // Update cursor
53
+ createEffect(() => (map.getCanvas().style.cursor = props.cursorStyle));
54
+ //Update transition type
55
+ createEffect(() => setTransitionType(props.transitionType));
56
+ // Update projection
57
+ createEffect(on(() => props.options?.projection, proj => map.setProjection(proj), { defer: true }));
58
+ // Update map style
59
+ createEffect(on(() => props.options?.style, style => {
60
+ const oldStyle = map.getStyle();
61
+ const oldLayers = oldStyle.layers.filter(l => l.id.startsWith('cl-'));
62
+ const oldSources = Object.keys(oldStyle.sources)
63
+ .filter(s => s.startsWith('cl-'))
64
+ .reduce((obj, key) => ({ ...obj, [key]: oldStyle.sources[key] }), {});
65
+ map.setStyle(vectorStyleList[style] ||
66
+ style || { version: 8, sources: {}, layers: [] });
67
+ map.once('styledata', () => {
68
+ const newStyle = map.getStyle();
69
+ map.setStyle({
70
+ ...newStyle,
71
+ sources: { ...newStyle.sources, ...oldSources },
72
+ layers: [...newStyle.layers, ...oldLayers],
73
+ });
74
+ });
75
+ }, { defer: true }));
76
+ // Hook up viewport events
77
+ createEffect(() => {
78
+ const viewport = {
79
+ id: null,
80
+ center: map.getCenter(),
81
+ zoom: map.getZoom(),
82
+ pitch: map.getPitch(),
83
+ bearing: map.getBearing(),
84
+ padding: props.viewport?.padding,
85
+ bounds: props.viewport?.bounds,
86
+ };
87
+ const callMove = event => {
88
+ if (event.originalEvent)
89
+ props.onViewportChange &&
90
+ props.onViewportChange({ ...viewport, id: props.id });
91
+ setTransitionType('jumpTo');
92
+ };
93
+ const callEnd = event => {
94
+ if (event.originalEvent)
95
+ props.onViewportChange && props.onViewportChange(viewport);
96
+ setTransitionType(props.transitionType);
97
+ };
98
+ map.on('move', callMove).on('moveend', callEnd);
99
+ onCleanup(() => map.off('move', callMove).off('moveend', callEnd));
100
+ });
101
+ // Update boundaries
102
+ createEffect(prev => {
103
+ if (props.viewport?.bounds != prev)
104
+ props.onViewportChange({
105
+ ...props.viewport,
106
+ ...map.cameraForBounds(props.viewport?.bounds, {
107
+ padding: props.viewport?.padding,
108
+ }),
109
+ });
110
+ return props.viewport?.bounds;
111
+ }, props.viewport?.bounds);
112
+ // Update Viewport
113
+ createEffect(() => {
114
+ if (props.id === props.viewport?.id)
115
+ return;
116
+ const viewport = {
117
+ ...props.viewport,
118
+ padding: props.viewport?.padding || 0,
119
+ };
120
+ switch (untrack(transitionType)) {
121
+ case 'easeTo':
122
+ map.stop().easeTo(viewport);
123
+ case 'jumpTo':
124
+ map.stop().jumpTo(viewport);
125
+ default:
126
+ map.stop().flyTo(viewport);
127
+ }
128
+ });
129
+ let index = 0;
130
+ createEffect(() => {
131
+ if (props.triggerResize) {
132
+ index = 0;
133
+ window.requestAnimationFrame(function loop() {
134
+ if (index < 15) {
135
+ index++;
136
+ window.requestAnimationFrame(loop);
137
+ start(() => map.resize());
138
+ }
139
+ });
140
+ }
141
+ });
142
+ });
143
+ return (<MapContext.Provider value={mapRoot}>
144
+ <section ref={containerRef} style={{ position: 'absolute', 'z-index': 1 }}>
145
+ {mapRoot() ? props.children : null}
146
+ </section>
147
+ <div id='map' ref={mapRef} class={props.class || null} classList={props.classList || null} style={{ height: '100%', width: '100%', ...props.style }}/>
148
+ </MapContext.Provider>);
149
+ };
@@ -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,11 @@
1
- import { onMount, onCleanup, createEffect } from 'solid-js';
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
- onMount(async () => {
8
+ createEffect(() => {
9
9
  marker = new mapboxgl.Marker(props.options)
10
10
  .setLngLat(props.lnglat)
11
11
  .setPopup(props.children
@@ -16,7 +16,6 @@ const Marker = props => {
16
16
  // Remove Marker
17
17
  onCleanup(() => marker.remove());
18
18
  // Update Position
19
- createEffect(() => marker.setLngLat(props.lnglat));
19
+ createEffect(() => marker && marker.setLngLat(props.lnglat));
20
20
  return <></>;
21
21
  };
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,11 @@
1
- import { onMount, onCleanup, createEffect } from 'solid-js';
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
- onMount(async () => {
8
+ createEffect(() => {
9
9
  popup = new mapboxgl.Popup(props.options)
10
10
  .setLngLat(props.lnglat)
11
11
  .setDOMContent(<div>{props.children}</div>)
@@ -14,9 +14,8 @@ const Popup = props => {
14
14
  // Remove Popup
15
15
  onCleanup(() => popup.remove());
16
16
  // Update Position
17
- createEffect(() => popup.setLngLat(props.lnglat));
17
+ createEffect(() => popup && popup.setLngLat(props.lnglat));
18
18
  // Update Content
19
- createEffect(() => popup.setDOMContent(<div>{props.children}</div>));
19
+ createEffect(() => popup && popup.setDOMContent(<div>{props.children}</div>));
20
20
  return <></>;
21
21
  };
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,18 @@
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
+ map().getLayer(layerId) && map().addLayer({ ...props.style, id: layerId });
9
+ });
10
+ // Remove Sky Layer
11
+ onCleanup(() => map().getLayer(layerId) && map().removeLayer(layerId));
12
+ // Update Visibility
13
+ createEffect(() => {
14
+ props.visible !== undefined &&
15
+ map().setLayoutProperty(layerId, 'visibility', props.visible ? 'visible' : 'none');
16
+ });
17
+ return props.children;
18
+ };
@@ -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,68 @@
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
+ const source = lookup(props.source.url);
22
+ source.tiles &&
23
+ (source.tiles = ['a', 'b', 'c'].map(i => source.tiles[0].replace('{s}', i)));
24
+ !map().getSource(props.id) && map().addSource(props.id, source);
25
+ });
26
+ // Remove Source
27
+ onCleanup(() => {
28
+ map()
29
+ .getStyle()
30
+ .layers.forEach(layer => layer.source === props.id && map().removeLayer(layer.id));
31
+ map().getSource(props.id) && map().removeSource(props.id);
32
+ });
33
+ // Update
34
+ createEffect(() => {
35
+ const source = map().getSource(props.id);
36
+ if (!source)
37
+ return;
38
+ // Update GeoJSON Data
39
+ if (props.source.type === 'geojson' && props.source.data)
40
+ source.setData(props.source.data);
41
+ // Update Image URL
42
+ if (props.source.type === 'image' &&
43
+ (props.source.url || props.source.coordinates))
44
+ source.updateImage(props.source.url, props.source.coordinates);
45
+ // Update Vector URL or Tiles
46
+ if (props.source.type === 'vector' &&
47
+ (props.source.url || props.source.tiles))
48
+ props.source.url
49
+ ? source.setUrl(props.source.url)
50
+ : source.setTiles(props.source.tiles);
51
+ // Update Raster URL or Tiles
52
+ if (props.source.type === 'raster' &&
53
+ (props.source.url || props.source.tiles)) {
54
+ const src = lookup(props.source.url);
55
+ src.tiles &&
56
+ (src.tiles = ['a', 'b', 'c'].map(i => src.tiles[0].replace('{s}', i)));
57
+ source._tileJSONRequest?.cancel();
58
+ source.url = src.url;
59
+ source.scheme = src.scheme;
60
+ source._options = { ...source._options, ...src };
61
+ map().style._sourceCaches[`other:${props.id}`]?.clearTiles();
62
+ source.load();
63
+ }
64
+ });
65
+ return (<SourceContext.Provider value={props.id}>
66
+ {props.children}
67
+ </SourceContext.Provider>);
68
+ };
@@ -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,19 @@
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
+ map().setTerrain({ ...props.style, source: sourceId });
10
+ });
11
+ // Remove Terrain Layer
12
+ onCleanup(() => map().setTerrain(null));
13
+ // Update Visibility
14
+ createEffect(() => {
15
+ props.visible !== undefined &&
16
+ map().setTerrain(props.visible ? props.style : null);
17
+ });
18
+ return props.children;
19
+ };
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 &copy; <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 &copy; <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 &copy; <a href="https://www.cyclosm.org" target="_blank"><em>CyclOSM</em></a>, Data &copy; <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 &copy; <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 &copy; <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 &copy; <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 &copy; <a href="https://opentopomap.org/credits"><em>OpenTopoMap</em></a>, Data &copy; <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 &copy; <a href="https://stamen.com" target="_blank"><em>Stamen Design</em></a>, Data &copy; <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 &copy; <a href="https://stamen.com" target="_blank"><em>Stamen Design</em></a>, Data &copy; <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 &copy; <a href="https://stamen.com" target="_blank"><em>Stamen Design</em></a>, Data &copy; <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 &copy; <a href="https://stamen.com" target="_blank"><em>Stamen Design</em></a>, Data &copy; <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 &copy; <a href="https://thunderforest.com" target="_blank"><em>Thunderforest</em></a>, Data &copy; <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 &copy; <a href="https://thunderforest.com" target="_blank"><em>Thunderforest</em></a>, Data &copy; <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 &copy; <a href="https://thunderforest.com" target="_blank"><em>Thunderforest</em></a>, Data &copy; <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 &copy; <a href="https://thunderforest.com" target="_blank"><em>Thunderforest</em></a>, Data &copy; <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 &copy; <a href="https://thunderforest.com" target="_blank"><em>Thunderforest</em></a>, Data &copy; <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 &copy; <a href="https://thunderforest.com" target="_blank"><em>Thunderforest</em></a>, Data &copy; <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 &copy; <a href="https://thunderforest.com" target="_blank"><em>Thunderforest</em></a>, Data &copy; <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 &copy; <a href="https://thunderforest.com" target="_blank"><em>Thunderforest</em></a>, Data &copy; <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 &copy; <a href="https://thunderforest.com" target="_blank"><em>Thunderforest</em></a>, Data &copy; <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 &copy; <a href="https://thunderforest.com" target="_blank"><em>Thunderforest</em></a>, Data &copy; <a href="http://www.openstreetmap.org/copyright" target="_blank"><em>OpenStreetMap</em></a>',
120
+ ],
121
+ };
package/package.json CHANGED
@@ -1,9 +1,8 @@
1
1
  {
2
- "version": "1.1.28",
2
+ "version": "1.2.2",
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.",
6
- "homepage": "https://determined-mirzakhani-29bbc7.netlify.app",
7
6
  "author": "kaihuebner",
8
7
  "contributors": [
9
8
  {
@@ -18,26 +17,30 @@
18
17
  "mapbox-gl",
19
18
  "mapbox-gl-js",
20
19
  "mapbox",
21
- "solidjs",
22
- "solidhack",
23
- "best_ecosystem"
20
+ "solidjs"
24
21
  ],
25
22
  "license": "MIT",
26
23
  "type": "module",
27
24
  "files": [
28
25
  "dist"
29
26
  ],
27
+ "source": "dist/index/index.jsx",
30
28
  "main": "dist/esm/index.js",
31
29
  "module": "dist/esm/index.js",
32
30
  "types": "dist/types/index.d.ts",
33
31
  "exports": {
34
32
  ".": {
35
- "solid": "./dist/source/index.jsx",
36
- "default": "./dist/esm/index.js"
33
+ "solid": "./dist/index/index.jsx",
34
+ "default": "./dist/esm/index.js",
35
+ "import": "./dist/esm/index.js",
36
+ "browser": "./dist/esm/index.js",
37
+ "require": "./dist/cjs/index.js",
38
+ "node": "./dist/cjs/index.js"
37
39
  }
38
40
  },
39
41
  "scripts": {
40
42
  "build": "rollup -c",
43
+ "watch": "rollup -c -w",
41
44
  "test": "vitest"
42
45
  },
43
46
  "repository": {
@@ -49,20 +52,19 @@
49
52
  "not ie 11"
50
53
  ],
51
54
  "dependencies": {
52
- "mapbox-gl": "^2.8.0",
53
- "solid-js": "^1.3.14"
55
+ "mapbox-gl": "^2.8.2",
56
+ "solid-js": "1.4.2"
54
57
  },
55
58
  "devDependencies": {
56
- "canvas": "^2.9.1",
57
59
  "jsdom": "^19.0.0",
58
- "rollup": "^2.70.1",
60
+ "rollup": "^2.74.1",
59
61
  "rollup-plugin-import-css": "^3.0.3",
60
62
  "rollup-plugin-uglify": "^6.0.4",
61
63
  "rollup-preset-solid": "^1.4.0",
62
64
  "solid-testing-library": "^0.3.0",
63
- "typescript": "^4.6.3",
64
- "vite": "^2.9.1",
65
+ "typescript": "^4.6.4",
66
+ "vite": "^2.9.9",
65
67
  "vite-plugin-solid": "^2.2.6",
66
- "vitest": "^0.9.3"
68
+ "vitest": "^0.12.9"
67
69
  }
68
70
  }