solid-map-gl 1.10.3 → 1.10.5

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 CHANGED
@@ -1,2 +1,2 @@
1
- import{createComponent as e,use as t,effect as o,setAttribute as a,className as n,classList as r,style as i,memo as s,template as l}from"solid-js/web";import{createContext as c,useContext as p,createUniqueId as d,createSignal as m,onMount as g,createEffect as u,on as h,onCleanup as y,splitProps as w,untrack as b}from"solid-js";import{createStore as f}from"solid-js/store";const[v,x]=f({map:null}),k=c([v]),M=()=>p(k),L=t=>(t.map&&x("map",t.map),e(k.Provider,{value:[v],get children(){return t.children}})),$=["onMouseDown","onMouseUp","onMouseOver","onMouseOut","onMouseMove","onMouseEnter","onMouseLeave","onPreClick","onClick","onDblClick","onContextMenu","onTouchStart","onTouchEnd","onTouchCancel","onWheel","onResize","onRemove","onTouchMove","onMoveStart","onMove","onMoveEnd","onDragStart","onDrag","onDragEnd","onZoomStart","onZoom","onZoomEnd","onRotateStart","onRotate","onRotatEnd","onPitchStart","onPitch","onPitchEnd","onBoxZoomStart","onBoxZoomEnd","onBoxZoomCancel","onWebglContextLost","onWebglContextRestored","onLoad","onRender","onIdle","onError","onData","onStyleData","onSourceData","onDataLoading","onStyleDataLoading","onSourceDataLoading","onStyleImageMissing"],S=["onMouseDown","onMouseUp","onMouseOver","onMouseOut","onMouseMove","onMouseEnter","onMouseLeave","onClick","onDblClick","onContextMenu","onTouchStart","onTouchEnd","onTouchCancel"],j=["onCreate","onDelete","onCombine","onUncombine","onUpdate","onSelectionchange","onModechange","onRender","onActionable"],C="mapbox://styles/mapbox",z="https://raw.githubusercontent.com/",_="https://raw.githubusercontent.com/GIShub4/map-styles/main/",E="https://assets.vector.hereapi.com/styles/",I={mb:{light:`${C}/light-v11`,dark:`${C}/dark-v11`,street:`${C}/streets-v12`,outdoor:`${C}/outdoors-v12`,sat:`${C}/satellite-v9`,sat_street:`${C}/satellite-streets-v12`,nav:`${C}/navigation-guidance-day-v4`,nav_night:`${C}/navigation-guidance-night-v4`,basic:`${C}/cjf4m44iw0uza2spb3q0a7s41`,monochrome:`${C}/cjv6rzz4j3m4b1fqcchuxclhb`,leshine:`${C}/cjcunv5ae262f2sm9tfwg8i0w`,icecream:`${C}/cj7t3i5yj0unt2rmt3y4b5e32`,cali:`${C}/cjerxnqt3cgvp2rmyuxbeqme7`,northstar:`${C}/cj44mfrt20f082snokim4ungi`,mineral:`${C}/cjtep62gq54l21frr1whf27ak`,moonlight:`${C}/cj3kbeqzo00022smj7akz3o1e`,frank:`${C}-map-design/ckshxkppe0gge18nz20i0nrwq`,minimo:`${C}-map-design/cksjc2nsq1bg117pnekb655h1`,decimal:`${C}-map-design/ck4014y110wt61ctt07egsel6`,standard:`${C}-map-design/ckr0svm3922ki18qntevm857n`,blueprint:`${C}-map-design/cks97e1e37nsd17nzg7p0308g`,bubble:`${C}-map-design/cksysy2nl62zp17quosctdtcc`,pencil:`${C}-map-design/cks9iema71es417mlrft4go2k`,swiss_ski:`${z}mapbox/mapbox-gl-swiss-ski-style/master/cij1zoclj002y8rkkdjl69psd.json`,vintage:`${z}mapbox/mapbox-gl-vintage-style/master/cif5p01n202nisaktvljx9mv3.json`,whaam:`${z}mapbox/mapbox-gl-whaam-style/master/cii8323c8004w0nlvtss3dbm2.json`,neon:`${z}NatEvatt/awesome-mapbox-gl-styles/master/styles/Neon/style.json`,camoflauge:`${z}jingsam/mapbox-gl-styles/master/Camouflage.json`,emerald:`${z}jingsam/mapbox-gl-styles/master/Emerald.json`,runner:`${z}jingsam/mapbox-gl-styles/master/Runner.json`,x_ray:`${z}jingsam/mapbox-gl-styles/master/X-ray.json`},here:{base:`${E}berlin/base/mapbox/tilezen?apikey={apikey}`,day:`${E}berlin/day/mapbox/tilezen?apikey={apikey}`,night:`${E}berlin/night/mapbox/tilezen?apikey={apikey}`},esri:{blueprint:`${_}esri:blueprint.json`,charted_territory:`${_}esri:charted-territory.json`,colored_pencil:`${_}esri:colored-pencil.json`,community:`${_}esri:community.json`,mid_century:`${_}esri:mid-century.json`,modern_antique:`${_}esri:modern-antique.json`,nat_geo:`${_}esri:national-geographic.json`,newspaper:`${_}esri:newspaper.json`,open_street_map:`${_}esri:open-street-map.json`,light_gray_canvas:`${_}esri:light-gray-canvas.json`,dark_gray_canvas:`${_}esri:dark-gray-canvas.json`,human_geo_light:`${_}esri:human-geography-light.json`,human_geo_dark:`${_}esri:human-geography-dark.json`,world_navigation:`${_}esri:world-navigation.json`,world_street:`${_}esri:world-street.json`,world_street_night:`${_}esri:world-street-night.json`,world_terrain:`${_}esri:world-terrain.json`,world_terrain_hybrid:`${_}esri:world-terrain-hybrid.json`,world_topographic:`${_}esri:world-topographic.json`,chromium:`${_}esri:chromium.json`,dreamcatcher:`${_}esri:dreamcatcher.json`,seahaven:`${_}esri:seahaven.json`,sangria:`${_}esri:sangria.json`,mercurial:`${_}esri:mercurial.json`,imagery:`${_}esri:imagery.json`,imagery_hybrid:`${_}esri:imagery-hybrid.json`,firefly:`${_}esri:firefly.json`,firefly_hybrid:`${_}esri:firefly-hybrid.json`,oceans:`${_}esri:oceans.json`}},P="https://{s}.basemaps.cartocdn.com/rastertiles/",T="https://stamen-tiles-{s}.a.ssl.fastly.net/",O="https://{s}.tile.thunderforest.com/",A={osm:{org:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",human:"https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png",cycle:"https://{s}.tile-cyclosm.openstreetmap.fr/cyclosm/{z}/{x}/{y}.png",topo:"https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png",_copy:'<a href="https://www.openstreetmap.org/copyright" target="_blank">&copy; OpenStreetMap</a>'},carto:{voyager:`${P}voyager_labels_under/{z}/{x}/{y}{r}.png`,positron:`${P}light_all/{z}/{x}/{y}{r}.png`,dark:`${P}dark_all/{z}/{x}/{y}{r}.png`,_copy:'<a href="https://carto.com/attribution" target="_blank">&copy; Carto</a>'},stamen:{toner:`${T}toner/{z}/{x}/{y}{r}.png`,toner_lite:`${T}toner-lite/{z}/{x}/{y}{r}.png`,watercolor:`${T}watercolor/{z}/{x}/{y}.png`,terrain:`${T}terrain/{z}/{x}/{y}{r}.png`,_copy:'<a href="https://stamen.com/privacy-policy" target="_blank">&copy; Stamen Design</a>'},tf:{cycle:`${O}cycle/{z}/{x}/{y}{r}.png?apikey={apikey}`,trans:`${O}transport/{z}/{x}/{y}{r}.png?apikey={apikey}`,trans_dark:`${O}transport-dark/{z}/{x}/{y}{r}.png?apikey={apikey}`,landscape:`${O}landscape/{z}/{x}/{y}{r}.png?apikey={apikey}`,outdoors:`${O}outdoors/{z}/{x}/{y}{r}.png?apikey={apikey}`,neighbourhood:`${O}neighbourhood/{z}/{x}/{y}{r}.png?apikey={apikey}`,spinal:`${O}spinal-map/{z}/{x}/{y}{r}.png?apikey={apikey}`,pioneer:`${O}pioneer/{z}/{x}/{y}{r}.png?apikey={apikey}`,atlas:`${O}atlas/{z}/{x}/{y}{r}.png?apikey={apikey}`,mobile:`${O}mobile-atlas/{z}/{x}/{y}{r}.png?apikey={apikey}`,_copy:'<a href="https://thunderforest.com/privacy" target="_blank">&copy; Thunderforest</a>'}},D=l("<div>"),R=l=>{let c,p,w;l.id??=d();const[b,f]=m(null),[v,x]=m("undefined"!=typeof window&&window.matchMedia("(prefers-color-scheme: dark)").matches||"undefined"!=typeof document&&document.body.classList.contains("dark")),[k,M]=m(!1),S=(e,t)=>(l.debug||l.debugEvents)&&console.debug("%c[MapGL]","color: #0ea5e9",e,t||""),j=(e,t)=>{const o=v()&&t?t:e;return"string"==typeof o||o instanceof String?o?.split(":").reduce(((e,t)=>e&&e[t]),I)?.replace("{apikey}",l.apikey||import.meta.env.VITE_VECTOR_API_KEY)||o:o||{version:8,sources:{},layers:[]}};g((async()=>{let e=l.mapLib||await import("mapbox-gl");if(e.Map||(e=window.maplibregl||window.mapboxgl),"function"==typeof e.supported&&!e.supported())throw new Error("Mapbox GL not supported");S(`Map (v${e.version}) loading...`),c=new e.Map({accessToken:l.options?.accessToken||import.meta.env.VITE_MAPBOX_ACCESS_TOKEN,interactive:l.options?.interactive||!!l.onViewportChange,...l.options,...l.viewport,projection:l.options?.projection,container:p,style:j(l.options?.style,l.darkStyle),fitBoundsOptions:{padding:l.viewport?.padding}}),c.debug=l.debug,c.debugEvents=l.debugEvents,c.sourceIdList=[],c.layerIdList=[],window.MapLib=e,$.forEach((e=>{const t=l[e];if(t){const o=e.slice(2).toLowerCase();"function"==typeof t?c.on(o,(e=>{setTimeout((()=>{e.clickOnLayer||(t(e),l.debugEvents&&S(`Map '${o}' event:`,e))}),0)})):Object.keys(t).forEach((e=>{c.on(o,e,(a=>{setTimeout((()=>{a.clickOnLayer||(t[e](a),l.debugEvents&&S(`Map '${o}' event on '${e}':`,a))}),0)}))}))}})),c.once("load",(()=>{f(c),S("Map loaded"),["mousedown","touchstart","wheel"].forEach((e=>c.on(e,(e=>!e.rotate&&l.onUserInteraction?.(!0))))),["moveend","mouseup","touchend"].forEach((e=>c.on(e,(e=>!e.rotate&&l.onUserInteraction?.(!1)))));const e="undefined"!=typeof window&&window?.matchMedia("(prefers-color-scheme: dark)");e?.addEventListener("change",(()=>{x(e.matches),S("Set dark theme to:",e.matches?.toString())})),w=new MutationObserver((()=>{const e=document.body.classList.contains("dark");x(e),S("Set theme to:",e)})),w.observe(document.body,{attributes:!0}),c.on("move",(e=>{const t={...l.viewport,id:l.id,point:{x:e.originalEvent?.x,y:e.originalEvent?.y},center:l.viewport?.center?.lat?c.getCenter():[c.getCenter().lng,c.getCenter().lat],zoom:c.getZoom(),pitch:c.getPitch(),bearing:c.getBearing(),inTransit:!0,bounds:null};M(!0),!e.viewport&&l.onViewportChange?.(t)})),c.on("moveend",(e=>{!e.rotate&&l.onViewportChange?.({...l.viewport,inTransit:!1}),M(!1)}))}))})),u(h((()=>l.viewport),(e=>{if(l.id!==e?.id||k())return;const t={...e,...e.bounds?c.cameraForBounds(e.bounds,{padding:e?.padding}):null};c.stop()[l.transitionType||"flyTo"](t),S(`Update Viewport (${l.transitionType||"flyTo"}):`,t)}),{defer:!0})),u((()=>{const e=l.options?.projection;c&&e&&(c.setProjection(e),S("Set Projection to:",e))})),u((()=>{const e=l.cursorStyle;c&&e&&(c.getCanvas().style.cursor=e,S("Set Cursor to:",e))}));return u((e=>{const t=j(l.options?.style,l.darkStyle);if(c?.isStyleLoaded()&&e!==t){const e=c.getStyle(),o=e.layers.filter((e=>c.layerIdList.includes(e.id))),a=Object.keys(e.sources).filter((e=>c.sourceIdList.includes(e))).reduce(((t,o)=>({...t,[o]:e.sources[o]})),{});c.setStyle(t),c.once("styledata",(()=>{if(!o)return;const n=c.getStyle();var r,i;c.setStyle({...n,sources:{...n.sources,...a},layers:(r=n.layers,i=o,i.forEach((e=>{const t=r.findIndex((t=>e.metadata.smg.beforeType?t.type===e.metadata.smg.beforeType:t.id===e.metadata.smg.beforeId));r=-1===t?[...r,e]:[...r.slice(0,t),e,...r.slice(t+1)]})),r),fog:e.fog,terrain:e.terrain}),S("Set Mapstyle to:",t)}))}return t}),l.options?.style),["showTileBoundaries","showTerrainWireframe","showCollisionBoxes","showPadding","showOverdrawInspector"].forEach((e=>{u((()=>{const t=l[e];c&&t&&(c[e]=t,S(`Set ${e} to:`,t))}))})),y((()=>{w?.disconnect(),c?.remove(),S("Map removed")})),[(()=>{const e=D();return"function"==typeof p?t(p,e):p=e,o((t=>{const o=l.id,s=l?.class,c=l?.classList,p=l?.class||l?.classList?null:l.style||{position:"absolute",inset:0,"z-index":-1};return o!==t._v$&&a(e,"id",t._v$=o),s!==t._v$2&&n(e,t._v$2=s),t._v$3=r(e,c,t._v$3),t._v$4=i(e,p,t._v$4),t}),{_v$:void 0,_v$2:void 0,_v$3:void 0,_v$4:void 0}),e})(),s((()=>{const t=s((()=>!!b()));return()=>t()&&e(L,{get map(){return b()},get children(){return l.children}})})())]},V=c(),q=()=>p(V),Z=t=>{const[o]=M();t.id??=d();const a=(e,t)=>{o.map.debug&&console.debug("%c[MapGL]","color: #ec4899",e,t||"")},n=e=>{const o=e?.split(":").reduce(((e,t)=>e&&e[t]),A),a=o?{...t.source,url:"",tiles:[o.replace("{apikey}",t.source.apikey||import.meta.env.VITE_RASTER_API_KEY).replace("{r}",window.devicePixelRatio>1?"@2x":"")],attribution:A[e.split(":")[0]]._copy}:t.source;return a.tiles&&(a.tiles=["a","b","c"].map((e=>a.tiles[0].replace("{s}",e)))),a};o.map.addSource(t.id,n(t.source.url)),o.map.sourceIdList.push(t.id),a("Add Source:",t.id);const r=o.map.getSource(t.id);switch(t.source.type){case"geojson":u((()=>{const e=t.source.data;o.map.isSourceLoaded(t.id)&&(r.setData(e||{}),a("Update GeoJSON Data:",t.id))}));break;case"image":u((()=>{const e=t.source.url,n=t.source.coordinates;o.map.isSourceLoaded(t.id)&&(r.updateImage(e,n),a("Update Image Data:",t.id))}));break;case"vector":u((()=>{const e=t.source.url,n=t.source.tiles;o.map.isSourceLoaded(t.id)&&(e?r.setUrl(e):r.setTiles(n),a("Update Vector Data:",t.id))}));break;case"raster":u((()=>{const e=n(t.source.url);o.map.isSourceLoaded(t.id)&&(e.url?r.setUrl(e.url):r.setTiles(e.tiles),a("Update Raster Data:",t.id))}))}return y((()=>{o.map?.getStyle().layers.forEach((e=>e.source===t.id&&o.map.removeLayer(e.id))),o.map?.getSource(t.id)&&o.map?.removeSource(t.id),a("Remove Source:",t.id)})),e(V.Provider,{get value(){return t.id},get children(){return t.children}})},F=["id","type","filter","source","source-layer","minzoom","metadata","maxzoom","paint","layout"],U=["visibility","line-join","line-cap","line-miter-limit","line-round-limit","line-sort-key","circle-sort-key","symbol-avoid-edges","symbol-placement","symbol-sort-key","symbol-spacing","symbol-z-order","icon-allow-overlap","icon-anchor","icon-ignore-placement","icon-image","icon-keep-upright","icon-offset","icon-optional","icon-padding","icon-pitch-alignment","icon-rotate","icon-rotation-alignment","icon-size","icon-text-fit","icon-text-fit-padding","text-allow-overlap","text-anchor","text-field","text-font","text-ignore-placement","text-justify","text-keep-upright","text-letter-spacing","text-line-height","text-max-angle","text-max-width","text-offset","text-optional","text-padding","text-pitch-alignment","text-radial-offset","text-rotate","text-rotation-alignment","text-size","text-transform","text-variable-anchor","text-writing-mode"],W=(e={},t={})=>[...new Set([...Object.keys(e),...Object.keys(t)])].reduce(((o,a)=>{const n=e[a];return n!==t[a]&&o.push([a,n]),o}),[]),G=(e,t)=>(e.startsWith(t)||e.startsWith("icon")||e.startsWith("text")?"":t+"-")+e.replace(/[A-Z]/g,(e=>"-"+e.toLowerCase())),B=e=>{if(!e)return;let t={},o={},a={};return Object.entries(e).forEach((([n,r])=>{if(F.includes(n))a[n]=r;else{const a=G(n,e.type);U.includes(a)?t[a]=r:o[a]=r}})),e.paint&&Object.entries(e.paint).forEach((([t,a])=>o[G(t,e.type)]=a)),e.layout&&Object.entries(e.layout).forEach((([o,a])=>t[G(o,e.type)]=a)),{...a,paint:o,layout:t}},H=e=>{const[t]=M(),o=e.style?.source||q();e.id=e.id||e.customLayer?.id||d();const a=(e,o)=>{(t.map.debug||t.map.debugEvents)&&console.debug("%c[MapGL]","color: #10b981",e,o||"")};return t.map.addLayer(e.customLayer||{...B(e.style),id:e.id,source:o,metadata:{smg:{beforeType:e.beforeType,beforeId:e.beforeId}}},e.beforeType?t.map.getStyle().layers.find((t=>t.type===e.beforeType))?.id:e.beforeId),t.map.layerIdList.push(e.id),e.customLayer&&t.map.fire("load"),a("Add Layer:",e.id),S.forEach((o=>{if(e[o]){const n=o.slice(2).toLowerCase();t.map.on(n,e.id,(r=>{r.clickOnLayer=!0,e[o](r),t.map.debugEvent&&a(`Layer '${n}' event on '${e.id}':`,r)}))}})),u((o=>{const n=B(e.style);if(n!==o)return n.layout!==o?.layout&&W(n.layout,o?.layout).forEach((([o,a])=>t.map.setLayoutProperty(e.id,o,a,{validate:!1}))),n.paint!==o?.paint&&W(n.paint,o?.paint).forEach((([o,a])=>t.map.setPaintProperty(e.id,o,a,{validate:!1}))),n.minzoom===o?.minzoom&&n.maxzoom===o?.maxzoom||t.map.setLayerZoomRange(e.id,n.minzoom,n.maxzoom),n.filter!==o?.filter&&t.map.setFilter(e.id,n.filter,{validate:!1}),a("Update Layer Style:",e.id),n}),B(e.style)),u((o=>{if(e.visible!==o)return t.map.setLayoutProperty(e.id,"visibility",e.visible?"visible":"none",{validate:!1}),a(`Update Visibility (${e.id}):`,e.visible.toString()),e.visible}),e.visible),u((async()=>{e.filter&&(!t.map.isStyleLoaded()&&await t.map.once("styledata"),t.map.setFilter(e.id,e.filter),a(`Update Filter (${e.id}):`,e.filter))})),u((async()=>{e.featureState&&null!==e.featureState.id&&(!t.map.isStyleLoaded()&&await t.map.once("styledata"),t.map.removeFeatureState({source:o,sourceLayer:e.style["source-layer"]}),t.map.setFeatureState({source:o,sourceLayer:e.style["source-layer"],id:e.featureState.id},e.featureState.state))})),y((()=>t.map?.getLayer(e.id)&&t.map?.removeLayer(e.id))),e.children},N=e=>{const[t]=M();return g((async()=>{e.id=e.id||d();const o=window.MapLib.MercatorCoordinate.fromLngLat(e.origin?[e.origin[0],e.origin[1]]:[0,0],e.origin?e.origin[2]:0),a=o.meterInMercatorCoordinateUnits();let n=null,r=null,i=null;e.babylon?(r=await import("@babylonjs/core"),n=r.Matrix.Compose(new r.Vector3(a,a,a),r.Quaternion.FromEulerAngles(Math.PI/2,0,0),new r.Vector3(o.x,o.y,o.z))):(i=await import("three"),n={translateX:o.x,translateY:o.y,translateZ:o.z,rotateX:Math.PI/2,rotateY:0,rotateZ:0,scale:a}),t.map.addLayer({id:e.id,type:"custom",renderingMode:"3d",onAdd(t,o){if(e.babylon){const t=new r.Engine(o,!0,{useHighPrecisionMatrix:!0},!0);this.scene=new r.Scene(t),this.scene.autoClear=!1,this.scene.detachControl(),this.scene.beforeRender=()=>t.wipeCaches(!0),this.scene.activeCamera=new r.Camera("Camera",new r.Vector3,this.scene),e.defaultLight&&new r.HemisphericLight("Light",new r.Vector3(1,0,0),this.scene)}else this.camera=new i.Camera,this.scene=new i.Scene,e.defaultLight&&(this.light=new i.DirectionalLight(16777215),this.light.position.set(100,0,0).normalize(),this.scene.add(this.light)),this.renderer=new i.WebGLRenderer({canvas:t.getCanvas(),context:o,antialias:!0}),this.renderer.autoClear=!1;this.map=t,e.onAdd&&e.onAdd(this.scene,this.map,o)},render(o,a){if(e.babylon){this.scene.activeCamera.freezeProjectionMatrix(n.multiply(r.Matrix.FromArray(a)));const{x:e,y:t,z:o}=this.map.getFreeCameraOptions().position;this.scene.activeCamera.position=r.Vector3.TransformCoordinates(new r.Vector3(e,t,o),this.scene.activeCamera.getProjectionMatrix().clone().invert()),this.scene.render(!1)}else{const e=(new i.Matrix4).makeRotationAxis(new i.Vector3(1,0,0),n.rotateX),t=(new i.Matrix4).makeRotationAxis(new i.Vector3(0,1,0),n.rotateY),o=(new i.Matrix4).makeRotationAxis(new i.Vector3(0,0,1),n.rotateZ),r=(new i.Matrix4).fromArray(a),s=(new i.Matrix4).makeTranslation(n.translateX,n.translateY,n.translateZ).scale(new i.Vector3(n.scale,-n.scale,n.scale)).multiply(e).multiply(t).multiply(o);this.camera.projectionMatrix=r.multiply(s),this.renderer.resetState(),this.renderer.render(this.scene,this.camera)}e.onRender&&e.onRender(o,a),t.map.triggerRepaint()}})})),y((()=>{t.map.getLayer(e.id)&&t.map.removeLayer(e.id)})),null},X=e=>{const[t]=M();return u((()=>t.map.setFog(e.style||{}))),y((()=>t.map.setFog(null))),null},Y=e=>{const[t]=M();let o=q();return o||e?.source||(o=d(),t.map.addSource(o,{type:"raster-dem",url:t.map.isMapLibre?"https://demotiles.maplibre.org/terrain-tiles/tiles.json":"mapbox://mapbox.terrain-rgb",tileSize:t.map.isMapLibre?256:512,maxzoom:t.map.isMapLibre?void 0:14}),t.map.sourceIdList.push(o)),u((()=>{t.map.setTerrain({exaggeration:e.exaggeration||1,source:e?.source||o})})),y((()=>t.map?.setTerrain(null))),null},K=e=>{const[t]=M(),[o,a]=w(e,["position"]),[n,r]=m(null),i=new Map([["navigation",window.MapLib.NavigationControl],["scale",window.MapLib.ScaleControl],["attribution",window.MapLib.AttributionControl],["geolocate",window.MapLib.GeolocateControl],["fullscreen",window.MapLib.FullscreenControl],["logo",window.MapLib.LogoControl],["terrain",window.MapLib.TerrainControl]]);return u((()=>{b((()=>n()&&t.map.hasControl(n())&&t.map.removeControl(n()))),r(a.custom||new(i.get(a.type||"navigation"))(a.options))})),u((()=>{t.map.hasControl(n())&&t.map.removeControl(n()),t.map.addControl(n(),o.position)})),y((()=>{t.map.hasControl(n())&&t.map.removeControl(n())})),null},J=e=>{if(!e.lngLat)throw new Error("Marker - lngLat is required");const[t,o,a]=w(e,["lngLat","children","showPopup","draggable"],["popup","onOpen","onClose"]),[n]=M();let r=null,i=null;const s=t.lngLat;return u((()=>{n.map&&(i?.remove(),i=new window.MapLib.Popup({closeOnClick:!1,focusAfterOpen:!1,...o.popup}).on("open",(()=>o.onOpen?.())).on("close",(()=>o.onClose?.())),u((()=>{void 0!==t.children&&("string"==typeof t.children?i?.setHTML(t.children):i?.setDOMContent(t.children),r?.setPopup(i))})),u((()=>t.showPopup!==i?.isOpen()&&r?.togglePopup())))})),u((()=>{n.map&&(r?.remove(),r=new window.MapLib.Marker(a.options).on("dragstart",(()=>a.onDragStart?.())).on("dragend",(()=>a.onDragEnd?.())).on("drag",(()=>a.onDrag?.(r?.getLngLat().toArray()))).setPopup(i).setLngLat(s).addTo(n.map),u((()=>t.showPopup!==i?.isOpen()&&r?.togglePopup())))})),u((()=>r?.setLngLat(t.lngLat))),u((()=>r?.setDraggable(t.draggable))),y((()=>r?.remove())),null},Q=e=>{if(!e.trackPointer&&!e.lngLat)throw new Error("Popup - lngLat or trackPointer is required");const[t,o]=w(e,["lngLat","children","trackPointer"]),[a]=M();let n;return u((()=>{a.map&&(n?.remove(),n=new window.MAPLIB.Popup({closeOnClick:!1,focusAfterOpen:!1,...o.options}).on("open",(()=>o.onOpen?.())).on("close",(()=>o.onClose?.())).addTo(a.map),u((()=>t.trackPointer?n.trackPointer():n.setLngLat(t.lngLat))),u((()=>"string"==typeof t.children?n.setHTML(t.children):n.setDOMContent(t.children))))})),y((()=>n?.remove())),null},ee={diagonal_l:{size:20,path:"M20 0 0 20M-10 10 10-10M10 30 30 10"},diagonal_r:{size:20,path:"M0 0 20 20M30 10 10-10M10 30-10 10"},horizontal:{size:14,path:"M7 0V20"},vertical:{size:14,path:"M0 7H20"},cross:{size:18,path:"M9 0V18M0 9H18"},hash:{size:30,path:"M15 0 30 15 15 30 0 15Z"},chevron_h:{size:20,path:"M-5 5 0 10 10 0 20 10 25 5M0 30 10 20 20 30"},chevron_v:{size:20,path:"M5-5 10 0 0 10 10 20 5 25M25 15 20 10 25 5"},square:{size:20,path:"M8 8H12V12H8Z",fill:!0},hex:{size:50,path:"M0 0V50L50 25ZM50 0V50L0 25ZM25 0V50"},circle:{size:25,path:"M8 10A2.5 2.5 0 118.01 10M18 15A2.5 2.5 0 1018.01 15",fill:!0}},te=Object.keys(ee),oe=e=>{const[t]=M(),[o,a]=m({width:0,height:0}),n=(e,o)=>{t.map.debug&&console.debug("%c[MapGL]","color: #10b981",e,o||"")};y((()=>{t.map?.hasImage(e.id)&&t.map?.removeImage(e.id),n("Remove Image:",e.id)})),u((()=>{if(!e.id)throw new Error("Image - ID is required");if(!e.source&&!e.pattern)throw new Error("Image - Image or Pattern is required");const s=e.pattern?{pixelRatio:2,...e.options}:e.options;r(e.source||i(e.pattern),(r=>{const{width:i,height:l}=r;t.map&&!t.map.hasImage(e.id)&&t.map.addImage(e.id,r,s),!e.pattern&&b((()=>i===o().width&&l===o().height))?(t.map.updateImage(e.id,r),t.map.triggerRepaint()):(t.map.removeImage(e.id),t.map.addImage(e.id,r,s)),a({width:i,height:l}),n("Add Image:",e.id),t.map.on("style.load",(()=>{t.map.hasImage(e.id)||(t.map.addImage(e.id,r,s),n("Re-Add Image:",e.id))}))}))}));const r=(o,a)=>{if("string"==typeof o&&o?.trimStart().startsWith("<svg")&&(o=(new DOMParser).parseFromString(o,"image/svg+xml").childNodes[0]),o instanceof SVGElement&&(e.options?.fill&&o.setAttribute("fill",e.options.fill),e.options?.stroke&&o.setAttribute("stroke",e.options.stroke),o=(new XMLSerializer).serializeToString(o)),"string"!=typeof o)return a(o);t.map.loadImage(o,(async(t,n)=>{if(!t)return a(n);{"string"==typeof o&&o?.trimEnd().endsWith(".svg")&&(o=await(await fetch(o)).text(),(o=(new DOMParser).parseFromString(o,"image/svg+xml").childNodes[0]).setAttribute("fill",e.options.fill),o.setAttribute("stroke",e.options.stroke),o.setAttribute("transform",e.options.transform),o=(new XMLSerializer).serializeToString(o));const t=new Image;t.crossOrigin="Anonymous",t.onload=()=>{const e=document.createElement("canvas");e.width=Math.max(t.width,50),e.height=Math.max(t.height,50);const o=e.getContext("2d");return o.imageSmoothingEnabled=!0,o.drawImage(t,0,0,e.width,e.height),a(o.getImageData(0,0,e.width,e.height))},t.src=o.trimStart().startsWith("<svg")?"data:image/svg+xml;charset=utf-8,"+o:o}}))},i=e=>{const t=ee[e.type];return{width:t.size,height:t.size,data:new Uint8Array(t.size*t.size*4),onAdd:function(){let e=document.createElement("canvas");e.width=e.height=t.size,this.ctx=e.getContext("2d",{willReadFrequently:!0})},render:function(){return this.ctx.fillStyle=e.background||"transparent",this.ctx.fillRect(0,0,this.width,this.height),this.ctx.strokeStyle=this.ctx.fillStyle=e.color||"black",this.ctx.lineWidth=e.lineWith||1,this.ctx.stroke(new Path2D(t.path)),t.fill&&this.ctx.fill(new Path2D(t.path)),this.data=this.ctx.getImageData(0,0,this.width,this.height).data,!0}}};return null},ae={in:e=>e*e,out:e=>1-(1-e)*(1-e),inOut:e=>e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2},ne=e=>{const[t]=M();let o=.1,a=!1;const[n,r]=m(!1);["mousedown","touchstart","wheel"].forEach((e=>t.map.on(e,(e=>!e.rotate&&r(!0))))),["moveend","mouseup","touchend"].forEach((e=>t.map.on(e,(e=>!e.rotate&&r(!1)))));const i=()=>{e.translate&&window.requestAnimationFrame(i);const n=[e.translate.start,e.translate.end,e.translate.easing?ae[e.translate.easing](o):o];(async([e,o,a],n)=>{const r=t.map.getFreeCameraOptions();r.position=window.MapLib.MercatorCoordinate.fromLngLat([e,o],a),r.lookAtPoint(n),t.map.setFreeCameraOptions(r)})("line"===e.translate.type?((e,t,o)=>e.map(((a,n)=>(1-o)*e[n]+o*t[n])))(...n):((e,t,o)=>{const a=e.map(((o,a)=>e[a]*t[a])).reduce(((e,t)=>e+t)),n=Math.acos(a);return e.map(((a,r)=>Math.sin((1-o)*n)/Math.sin(n)*e[r]+Math.sin(o*n)/Math.sin(n)*t[r]))})(...n),e.translate.target),!e.translate.loop&&(o>1||o<0)&&(a=!a),o=a?o-.001:o+.001};u((()=>{e.translate&&window.requestAnimationFrame(i)}));const s={duration:1e3,easing:e=>e},l=()=>{if(n())return;const{secPerRev:o=120,maxSpinZoom:a=5,slowSpinZoom:r=3}=e.rotateGlobe,i=t.map.getZoom();if(i>a)return;let l=360/o;i>r&&(l*=(a-i)/(a-r));const c=t.map.getCenter();c.lng=e.reverse?c.lng+l:c.lng-l,t.map.easeTo({center:c,...s},{rotate:!0})},c=()=>{if(!e.rotateViewport||n())return;const o=e.rotateViewport,a=o?.secPerRev||60,r=e.reverse?t.map.getBearing()+360/a:t.map.getBearing()-360/a,i=o?.pitch||60,l=o?.around;t.map.easeTo({bearing:r,pitch:i,around:l,...s},{rotate:!0})},p=()=>e.rotateGlobe?l():c();let d;return t.map.on("moveend",p).on("dragend",p),u((()=>{null!=e.rotateGlobe&&(e.rotateGlobe?(d=t.map.getCenter(),l()):e.resetWhenStopped?t.map.stop().easeTo({center:d}):t.map.stop())})),u((()=>{null!=e.rotateViewport&&(e.rotateViewport?c():e.resetWhenStopped?t.map.stop().resetNorthPitch():t.map.stop())})),y((()=>t.map.off("moveend",p).off("dragend",p))),e.children},re=e=>{const[t]=M();return u((()=>t.map.setLight(e.style||{}))),y((()=>t.map?.setLight(null))),null},ie=e=>{const[t]=M(),o=new e.lib(e.options);t.map.addControl(o,e.position||"top-right"),e.getInstance&&e.getInstance(o);const a={};return j.forEach((o=>{if(e[o]){const n=`draw.${o.slice(2).toLowerCase()}`,r=t=>e[o](t);a[n]=r,t.map.on(n,r)}})),y((()=>{Object.keys(a).forEach((e=>t.map.off(e,a[e]))),t.map?.removeControl(o)})),null};export{X as Atmosphere,ne as Camera,K as Control,ie as Draw,oe as Image,H as Layer,N as Layer3D,re as Light,L as MapProvider,J as Marker,Q as Popup,Z as Source,Y as Terrain,R as default,te as patternList,M as useMapContext,q as useSourceId};
1
+ import{createComponent as e,use as t,insert as o,memo as a,effect as n,setAttribute as r,className as i,classList as s,style as l,template as p}from"solid-js/web";import{createContext as c,useContext as d,createSignal as m,onMount as g,createEffect as u,on as h,onCleanup as y,createUniqueId as b,splitProps as w,untrack as f}from"solid-js";import{createStore as v}from"solid-js/store";const[x,k]=v({map:null}),M=c([x]),L=()=>d(M),$=t=>(t.map&&k("map",t.map),e(M.Provider,{value:[x],get children(){return t.children}})),S=["onMouseDown","onMouseUp","onMouseOver","onMouseOut","onMouseMove","onMouseEnter","onMouseLeave","onPreClick","onClick","onDblClick","onContextMenu","onTouchStart","onTouchEnd","onTouchCancel","onWheel","onResize","onRemove","onTouchMove","onMoveStart","onMove","onMoveEnd","onDragStart","onDrag","onDragEnd","onZoomStart","onZoom","onZoomEnd","onRotateStart","onRotate","onRotatEnd","onPitchStart","onPitch","onPitchEnd","onBoxZoomStart","onBoxZoomEnd","onBoxZoomCancel","onWebglContextLost","onWebglContextRestored","onLoad","onRender","onIdle","onError","onData","onStyleData","onSourceData","onDataLoading","onStyleDataLoading","onSourceDataLoading","onStyleImageMissing"],j=["onMouseDown","onMouseUp","onMouseOver","onMouseOut","onMouseMove","onMouseEnter","onMouseLeave","onClick","onDblClick","onContextMenu","onTouchStart","onTouchEnd","onTouchCancel"],C=["onCreate","onDelete","onCombine","onUncombine","onUpdate","onSelectionchange","onModechange","onRender","onActionable"],z="mapbox://styles/mapbox",E="https://raw.githubusercontent.com/",_="https://raw.githubusercontent.com/GIShub4/map-styles/main/",I="https://assets.vector.hereapi.com/styles/",P={mb:{standard:`${z}/standard`,light:`${z}/light-v11`,dark:`${z}/dark-v11`,street:`${z}/streets-v12`,outdoor:`${z}/outdoors-v12`,sat:`${z}/satellite-v9`,sat_street:`${z}/satellite-streets-v12`,nav_base:`${z}/navigation-guidance-day-v4`,nav_base_night:`${z}/navigation-guidance-night-v4`,nav:`${z}/navigation-day-v1`,nav_night:`${z}/navigation-night-v1`,basic:`${z}/cjf4m44iw0uza2spb3q0a7s41`,monochrome:`${z}/cjv6rzz4j3m4b1fqcchuxclhb`,leshine:`${z}/cjcunv5ae262f2sm9tfwg8i0w`,icecream:`${z}/cj7t3i5yj0unt2rmt3y4b5e32`,cali:`${z}/cjerxnqt3cgvp2rmyuxbeqme7`,northstar:`${z}/cj44mfrt20f082snokim4ungi`,mineral:`${z}/cjtep62gq54l21frr1whf27ak`,moonlight:`${z}/cj3kbeqzo00022smj7akz3o1e`,frank:`${z}-map-design/ckshxkppe0gge18nz20i0nrwq`,minimo:`${z}-map-design/cksjc2nsq1bg117pnekb655h1`,decimal:`${z}-map-design/ck4014y110wt61ctt07egsel6`,stand:`${z}-map-design/ckr0svm3922ki18qntevm857n`,blueprint:`${z}-map-design/cks97e1e37nsd17nzg7p0308g`,bubble:`${z}-map-design/cksysy2nl62zp17quosctdtcc`,pencil:`${z}-map-design/cks9iema71es417mlrft4go2k`,swiss_ski:`${E}mapbox/mapbox-gl-swiss-ski-style/master/cij1zoclj002y8rkkdjl69psd.json`,vintage:`${E}mapbox/mapbox-gl-vintage-style/master/cif5p01n202nisaktvljx9mv3.json`,whaam:`${E}mapbox/mapbox-gl-whaam-style/master/cii8323c8004w0nlvtss3dbm2.json`,neon:`${E}NatEvatt/awesome-mapbox-gl-styles/master/styles/Neon/style.json`,camoflauge:`${E}jingsam/mapbox-gl-styles/master/Camouflage.json`,emerald:`${E}jingsam/mapbox-gl-styles/master/Emerald.json`,runner:`${E}jingsam/mapbox-gl-styles/master/Runner.json`,x_ray:`${E}jingsam/mapbox-gl-styles/master/X-ray.json`},here:{base:`${I}berlin/base/mapbox/tilezen?apikey={apikey}`,day:`${I}berlin/day/mapbox/tilezen?apikey={apikey}`,night:`${I}berlin/night/mapbox/tilezen?apikey={apikey}`},esri:{blueprint:`${_}esri:blueprint.json`,charted_territory:`${_}esri:charted-territory.json`,colored_pencil:`${_}esri:colored-pencil.json`,community:`${_}esri:community.json`,mid_century:`${_}esri:mid-century.json`,modern_antique:`${_}esri:modern-antique.json`,nat_geo:`${_}esri:national-geographic.json`,newspaper:`${_}esri:newspaper.json`,open_street_map:`${_}esri:open-street-map.json`,light_gray_canvas:`${_}esri:light-gray-canvas.json`,dark_gray_canvas:`${_}esri:dark-gray-canvas.json`,human_geo_light:`${_}esri:human-geography-light.json`,human_geo_dark:`${_}esri:human-geography-dark.json`,world_navigation:`${_}esri:world-navigation.json`,world_street:`${_}esri:world-street.json`,world_street_night:`${_}esri:world-street-night.json`,world_terrain:`${_}esri:world-terrain.json`,world_terrain_hybrid:`${_}esri:world-terrain-hybrid.json`,world_topographic:`${_}esri:world-topographic.json`,chromium:`${_}esri:chromium.json`,dreamcatcher:`${_}esri:dreamcatcher.json`,seahaven:`${_}esri:seahaven.json`,sangria:`${_}esri:sangria.json`,mercurial:`${_}esri:mercurial.json`,imagery:`${_}esri:imagery.json`,imagery_hybrid:`${_}esri:imagery-hybrid.json`,firefly:`${_}esri:firefly.json`,firefly_hybrid:`${_}esri:firefly-hybrid.json`,oceans:`${_}esri:oceans.json`}},T="https://{s}.basemaps.cartocdn.com/rastertiles/",O="https://stamen-tiles-{s}.a.ssl.fastly.net/",A="https://{s}.tile.thunderforest.com/",D={osm:{org:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",human:"https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png",cycle:"https://{s}.tile-cyclosm.openstreetmap.fr/cyclosm/{z}/{x}/{y}.png",topo:"https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png",_copy:'<a href="https://www.openstreetmap.org/copyright" target="_blank">&copy; OpenStreetMap</a>'},carto:{voyager:`${T}voyager_labels_under/{z}/{x}/{y}{r}.png`,positron:`${T}light_all/{z}/{x}/{y}{r}.png`,dark:`${T}dark_all/{z}/{x}/{y}{r}.png`,_copy:'<a href="https://carto.com/attribution" target="_blank">&copy; Carto</a>'},stamen:{toner:`${O}toner/{z}/{x}/{y}{r}.png`,toner_lite:`${O}toner-lite/{z}/{x}/{y}{r}.png`,watercolor:`${O}watercolor/{z}/{x}/{y}.png`,terrain:`${O}terrain/{z}/{x}/{y}{r}.png`,_copy:'<a href="https://stamen.com/privacy-policy" target="_blank">&copy; Stamen Design</a>'},tf:{cycle:`${A}cycle/{z}/{x}/{y}{r}.png?apikey={apikey}`,trans:`${A}transport/{z}/{x}/{y}{r}.png?apikey={apikey}`,trans_dark:`${A}transport-dark/{z}/{x}/{y}{r}.png?apikey={apikey}`,landscape:`${A}landscape/{z}/{x}/{y}{r}.png?apikey={apikey}`,outdoors:`${A}outdoors/{z}/{x}/{y}{r}.png?apikey={apikey}`,neighbourhood:`${A}neighbourhood/{z}/{x}/{y}{r}.png?apikey={apikey}`,spinal:`${A}spinal-map/{z}/{x}/{y}{r}.png?apikey={apikey}`,pioneer:`${A}pioneer/{z}/{x}/{y}{r}.png?apikey={apikey}`,atlas:`${A}atlas/{z}/{x}/{y}{r}.png?apikey={apikey}`,mobile:`${A}mobile-atlas/{z}/{x}/{y}{r}.png?apikey={apikey}`,_copy:'<a href="https://thunderforest.com/privacy" target="_blank">&copy; Thunderforest</a>'}};var R=p("<div>");const V=p=>{let c,d,b,w;const[f,v]=m(null),[x,k]=m("undefined"!=typeof window&&window.matchMedia("(prefers-color-scheme: dark)").matches||"undefined"!=typeof document&&document.body.classList.contains("dark")),[M,L]=m(!1),j=(e,t)=>(p.debug||p.debugEvents)&&console.debug("%c[MapGL]","color: #0ea5e9",e,t||""),C=(e,t)=>{const o=x()&&t?t:e;return("string"==typeof o||o instanceof String)&&o?.split(":").reduce(((e,t)=>e&&e[t]),P)?.replace("{apikey}",p.apikey||import.meta.env.VITE_VECTOR_API_KEY)||o};g((async()=>{let e=p.mapLib||await import("mapbox-gl");if(e.Map||(e=window.maplibregl||window.mapboxgl),"function"==typeof e.supported&&!e.supported())throw new Error("Mapbox GL not supported");j(`Map (v${e.version}) loading...`),c=new e.Map({accessToken:p.options?.accessToken||import.meta.env.VITE_MAPBOX_ACCESS_TOKEN,interactive:p.options?.interactive||!!p.onViewportChange,...p.options,...p.viewport,projection:p.options?.projection,container:d,style:C(p.options?.style,p.darkStyle),fitBoundsOptions:{padding:p.viewport?.padding}}),c.debug=p.debug,c.debugEvents=p.debugEvents,c.sourceIdList=[],c.layerIdList=[],window.MapLib=e,S.forEach((e=>{const t=p[e];if(t){const o=e.slice(2).toLowerCase();"function"==typeof t?c.on(o,(e=>{setTimeout((()=>{e.clickOnLayer||(t(e),p.debugEvents&&j(`Map '${o}' event:`,e))}),0)})):Object.keys(t).forEach((e=>{c.on(o,e,(a=>{setTimeout((()=>{a.clickOnLayer||(t[e](a),p.debugEvents&&j(`Map '${o}' event on '${e}':`,a))}),0)}))}))}})),c.once("load",(()=>{v(c),j("Map loaded"),["mousedown","touchstart","wheel"].forEach((e=>c.on(e,(e=>!e.rotate&&p.onUserInteraction?.(!0))))),["moveend","mouseup","touchend"].forEach((e=>c.on(e,(e=>!e.rotate&&p.onUserInteraction?.(!1)))));const e="undefined"!=typeof window&&window?.matchMedia("(prefers-color-scheme: dark)");e?.addEventListener("change",(()=>{k(e.matches),j("Set dark theme to:",e.matches?.toString())})),w=new MutationObserver((()=>{const e=document.body.classList.contains("dark");k(e),j("Set theme to:",e)})),w.observe(document.body,{attributes:!0}),p.disableResize||(b=new ResizeObserver((()=>{setTimeout((()=>{c?.resize()}),0),j("Map resized")})),b.observe(d)),u((()=>{for(const e in p.config){if(!e||"id"===e)continue;const t=p.config?.id||"basemap",o=p.config[e];c?.setConfigProperty(t,e,o),j(`Set Config (${t}:${e}) to:`,o)}})),c.on("move",(e=>{const t={...p.viewport,id:p.id,point:{x:e.originalEvent?.x,y:e.originalEvent?.y},center:p.viewport?.center?.lat?c.getCenter():[c.getCenter().lng,c.getCenter().lat],zoom:c.getZoom(),pitch:c.getPitch(),bearing:c.getBearing(),inTransit:!0,bounds:null};L(!0),!e.viewport&&p.onViewportChange?.(t)})),c.on("moveend",(e=>{!e.rotate&&p.onViewportChange?.({...p.viewport,inTransit:!1}),L(!1)}))}))})),u(h((()=>p.viewport),(e=>{if(p.id!==e?.id||M())return;const t={...e,...e.bounds?c.cameraForBounds(e.bounds,{bearing:e?.bearing,pitch:e?.pitch,padding:e?.padding}):null};c.stop()[p.transitionType||"flyTo"](t),j(`Update Viewport (${p.transitionType||"flyTo"}):`,t)}),{defer:!0})),u((()=>{const e=p.options?.projection;c&&e&&(c.setProjection(e),j("Set Projection to:",e))})),u((()=>{const e=p.cursorStyle;c&&e&&(c.getCanvas().style.cursor=e,j("Set Cursor to:",e))}));return u((e=>{const t=C(p.options?.style,p.darkStyle);if(c?.isStyleLoaded()&&e!==t){const e=c.getStyle(),o=e.layers.filter((e=>c.layerIdList.includes(e.id))),a=Object.keys(e.sources).filter((e=>c.sourceIdList.includes(e))).reduce(((t,o)=>({...t,[o]:e.sources[o]})),{});c.setStyle(t),c.once("styledata",(()=>{if(!o)return;const n=c.getStyle();var r,i;c.setStyle({...n,sources:{...n.sources,...a},layers:(r=n.layers,i=o,i.forEach((e=>{const t=r.findIndex((t=>e.metadata.smg.beforeType?t.type===e.metadata.smg.beforeType:t.id===e.metadata.smg.beforeId));r=-1===t?[...r,e]:[...r.slice(0,t),e,...r.slice(t+1)]})),r),fog:e.fog,terrain:e.terrain}),j("Set Mapstyle to:",t)}))}return t}),p.options?.style),["showTileBoundaries","showTerrainWireframe","showCollisionBoxes","showPadding","showOverdrawInspector"].forEach((e=>{u((()=>{const t=p[e];c&&t&&(c[e]=t,j(`Set ${e} to:`,t))}))})),y((()=>{b?.disconnect(),w?.disconnect(),c?.remove(),j("Map removed")})),E=R(),"function"==typeof d?t(d,E):d=E,o(E,(z=a((()=>!!f())),()=>z()&&e($,{get map(){return f()},get children(){var e=R();return e.style.setProperty("position","relative"),o(e,(()=>p.children)),e}}))),n((e=>{var t=p.id,o=p?.class,a=p?.classList,n=p?.class||p?.classList?null:p.style||{position:"absolute",inset:0,"z-index":-1};return t!==e.e&&r(E,"id",e.e=t),o!==e.t&&i(E,e.t=o),e.a=s(E,a,e.a),e.o=l(E,n,e.o),e}),{e:void 0,t:void 0,a:void 0,o:void 0}),E;var z,E},q=c(),Z=()=>d(q),F=t=>{const[o]=L();t.id??=b();const a=(e,t)=>{o.map.debug&&console.debug("%c[MapGL]","color: #ec4899",e,t||"")},n=e=>{const o=e?.split(":").reduce(((e,t)=>e&&e[t]),D),a=o?{...t.source,url:"",tiles:[o.replace("{apikey}",t.source.apikey||import.meta.env.VITE_RASTER_API_KEY).replace("{r}",window.devicePixelRatio>1?"@2x":"")],attribution:D[e.split(":")[0]]._copy}:t.source;return a.tiles&&(a.tiles=["a","b","c"].map((e=>a.tiles[0].replace("{s}",e)))),a};o.map.addSource(t.id,n(t.source.url)),o.map.sourceIdList.push(t.id),a("Add Source:",t.id);const r=o.map.getSource(t.id);switch(t.source.type){case"geojson":u((()=>{const e=t.source.data;o.map.isSourceLoaded(t.id)&&(r.setData(e||{}),a("Update GeoJSON Data:",t.id))}));break;case"image":u((()=>{const e=t.source.url,n=t.source.coordinates;o.map.isSourceLoaded(t.id)&&(r.updateImage(e,n),a("Update Image Data:",t.id))}));break;case"vector":u((()=>{const e=t.source.url,n=t.source.tiles;o.map.isSourceLoaded(t.id)&&(e?r.setUrl(e):r.setTiles(n),a("Update Vector Data:",t.id))}));break;case"raster":u((()=>{const e=n(t.source.url);o.map.isSourceLoaded(t.id)&&(e.url?r.setUrl(e.url):r.setTiles(e.tiles),a("Update Raster Data:",t.id))}))}return y((()=>{o.map?.getStyle().layers.forEach((e=>e.source===t.id&&o.map.removeLayer(e.id))),o.map?.getSource(t.id)&&o.map?.removeSource(t.id),a("Remove Source:",t.id)})),e(q.Provider,{get value(){return t.id},get children(){return t.children}})},U=["id","type","filter","source","source-layer","minzoom","metadata","maxzoom","paint","layout"],W=["visibility","line-join","line-cap","line-miter-limit","line-round-limit","line-sort-key","circle-sort-key","symbol-avoid-edges","symbol-placement","symbol-sort-key","symbol-spacing","symbol-z-order","icon-allow-overlap","icon-anchor","icon-ignore-placement","icon-image","icon-keep-upright","icon-offset","icon-optional","icon-padding","icon-pitch-alignment","icon-rotate","icon-rotation-alignment","icon-size","icon-text-fit","icon-text-fit-padding","text-allow-overlap","text-anchor","text-field","text-font","text-ignore-placement","text-justify","text-keep-upright","text-letter-spacing","text-line-height","text-max-angle","text-max-width","text-offset","text-optional","text-padding","text-pitch-alignment","text-radial-offset","text-rotate","text-rotation-alignment","text-size","text-transform","text-variable-anchor","text-writing-mode"],G=(e={},t={})=>[...new Set([...Object.keys(e),...Object.keys(t)])].reduce(((o,a)=>{const n=e[a];return n!==t[a]&&o.push([a,n]),o}),[]),B=(e,t)=>(e.startsWith(t)||e.startsWith("icon")||e.startsWith("text")?"":t+"-")+e.replace(/[A-Z]/g,(e=>"-"+e.toLowerCase())),H=e=>{if(!e)return;let t={},o={},a={};return Object.entries(e).forEach((([n,r])=>{if(U.includes(n))a[n]=r;else{const a=B(n,e.type);W.includes(a)?t[a]=r:o[a]=r}})),e.paint&&Object.entries(e.paint).forEach((([t,a])=>o[B(t,e.type)]=a)),e.layout&&Object.entries(e.layout).forEach((([o,a])=>t[B(o,e.type)]=a)),{...a,paint:o,layout:t}},N=e=>{const[t]=L(),o=e.style?.source||Z();e.id=e.id||e.customLayer?.id||b();const a=(e,o)=>{(t.map.debug||t.map.debugEvents)&&console.debug("%c[MapGL]","color: #10b981",e,o||"")};return t.map.addLayer(e.customLayer||{...H(e.style),id:e.id,source:o,slot:e.slot||"",metadata:{smg:{beforeType:e.beforeType,beforeId:e.beforeId}}},e.beforeType?t.map.getStyle().layers.find((t=>t.type===e.beforeType))?.id:e.beforeId),t.map.layerIdList.push(e.id),e.customLayer&&t.map.fire("load"),a("Add Layer:",e.id),j.forEach((o=>{if(e[o]){const n=o.slice(2).toLowerCase();t.map.on(n,e.id,(r=>{r.clickOnLayer=!0,e[o](r),t.map.debugEvent&&a(`Layer '${n}' event on '${e.id}':`,r)}))}})),u((o=>{const n=H(e.style);if(n!==o)return n.layout!==o?.layout&&G(n.layout,o?.layout).forEach((([o,a])=>t.map.setLayoutProperty(e.id,o,a,{validate:!1}))),n.paint!==o?.paint&&G(n.paint,o?.paint).forEach((([o,a])=>t.map.setPaintProperty(e.id,o,a,{validate:!1}))),n.minzoom===o?.minzoom&&n.maxzoom===o?.maxzoom||t.map.setLayerZoomRange(e.id,n.minzoom,n.maxzoom),n.filter!==o?.filter&&t.map.setFilter(e.id,n.filter,{validate:!1}),a("Update Layer Style:",e.id),n}),H(e.style)),u((o=>{if(e.visible!==o)return t.map.setLayoutProperty(e.id,"visibility",e.visible?"visible":"none",{validate:!1}),a(`Update Visibility (${e.id}):`,e.visible.toString()),e.visible}),e.visible),u((async()=>{e.filter&&(!t.map.isStyleLoaded()&&await t.map.once("styledata"),t.map.setFilter(e.id,e.filter),a(`Update Filter (${e.id}):`,e.filter))})),u((async()=>{e.featureState&&null!==e.featureState.id&&(!t.map.isStyleLoaded()&&await t.map.once("styledata"),t.map.removeFeatureState({source:o,sourceLayer:e.style["source-layer"]}),t.map.setFeatureState({source:o,sourceLayer:e.style["source-layer"],id:e.featureState.id},e.featureState.state))})),y((()=>t.map?.getLayer(e.id)&&t.map?.removeLayer(e.id))),e.children},X=e=>{const[t]=L();return g((async()=>{e.id=e.id||b();const o=window.MapLib.MercatorCoordinate.fromLngLat(e.origin?[e.origin[0],e.origin[1]]:[0,0],e.origin?e.origin[2]:0),a=o.meterInMercatorCoordinateUnits();let n=null,r=null,i=null;e.babylon?(r=await import("@babylonjs/core"),n=r.Matrix.Compose(new r.Vector3(a,a,a),r.Quaternion.FromEulerAngles(Math.PI/2,0,0),new r.Vector3(o.x,o.y,o.z))):(i=await import("three"),n={translateX:o.x,translateY:o.y,translateZ:o.z,rotateX:Math.PI/2,rotateY:0,rotateZ:0,scale:a}),t.map.addLayer({id:e.id,type:"custom",renderingMode:"3d",onAdd(t,o){if(e.babylon){const t=new r.Engine(o,!0,{useHighPrecisionMatrix:!0},!0);this.scene=new r.Scene(t),this.scene.autoClear=!1,this.scene.detachControl(),this.scene.beforeRender=()=>t.wipeCaches(!0),this.scene.activeCamera=new r.Camera("Camera",new r.Vector3,this.scene),e.defaultLight&&new r.HemisphericLight("Light",new r.Vector3(1,0,0),this.scene)}else this.camera=new i.Camera,this.scene=new i.Scene,e.defaultLight&&(this.light=new i.DirectionalLight(16777215),this.light.position.set(100,0,0).normalize(),this.scene.add(this.light)),this.renderer=new i.WebGLRenderer({canvas:t.getCanvas(),context:o,antialias:!0}),this.renderer.autoClear=!1;this.map=t,e.onAdd&&e.onAdd(this.scene,this.map,o)},render(o,a){if(e.babylon){this.scene.activeCamera.freezeProjectionMatrix(n.multiply(r.Matrix.FromArray(a)));const{x:e,y:t,z:o}=this.map.getFreeCameraOptions().position;this.scene.activeCamera.position=r.Vector3.TransformCoordinates(new r.Vector3(e,t,o),this.scene.activeCamera.getProjectionMatrix().clone().invert()),this.scene.render(!1)}else{const e=(new i.Matrix4).makeRotationAxis(new i.Vector3(1,0,0),n.rotateX),t=(new i.Matrix4).makeRotationAxis(new i.Vector3(0,1,0),n.rotateY),o=(new i.Matrix4).makeRotationAxis(new i.Vector3(0,0,1),n.rotateZ),r=(new i.Matrix4).fromArray(a),s=(new i.Matrix4).makeTranslation(n.translateX,n.translateY,n.translateZ).scale(new i.Vector3(n.scale,-n.scale,n.scale)).multiply(e).multiply(t).multiply(o);this.camera.projectionMatrix=r.multiply(s),this.renderer.resetState(),this.renderer.render(this.scene,this.camera)}e.onRender&&e.onRender(o,a),t.map.triggerRepaint()}})})),y((()=>{t.map.getLayer(e.id)&&t.map.removeLayer(e.id)})),null},Y=e=>{const[t]=L();return u((()=>t.map.setFog(e.style||{}))),y((()=>t.map.setFog(null))),null},K=e=>{const[t]=L();let o=Z();return o||e?.source||(o=b(),t.map.addSource(o,{type:"raster-dem",url:t.map.isMapLibre?"https://demotiles.maplibre.org/terrain-tiles/tiles.json":"mapbox://mapbox.terrain-rgb",tileSize:t.map.isMapLibre?256:512,maxzoom:t.map.isMapLibre?void 0:14}),t.map.sourceIdList.push(o)),u((()=>{t.map.setTerrain({exaggeration:e.exaggeration||1,source:e?.source||o})})),y((()=>t.map?.setTerrain(null))),null},J=e=>{const[t]=L(),[o,a]=w(e,["position"]),[n,r]=m(null),i=new Map([["navigation",window.MapLib.NavigationControl],["scale",window.MapLib.ScaleControl],["attribution",window.MapLib.AttributionControl],["geolocate",window.MapLib.GeolocateControl],["fullscreen",window.MapLib.FullscreenControl],["logo",window.MapLib.LogoControl],["terrain",window.MapLib.TerrainControl]]);return u((()=>{f((()=>n()&&t.map.hasControl(n())&&t.map.removeControl(n()))),r(a.custom||new(i.get(a.type||"navigation"))(a.options))})),u((()=>{t.map.hasControl(n())&&t.map.removeControl(n()),t.map.addControl(n(),o.position)})),y((()=>{t.map.hasControl(n())&&t.map.removeControl(n())})),null},Q=e=>{if(!e.lngLat)throw new Error("Marker - lngLat is required");const[t,o,a]=w(e,["lngLat","children","showPopup","draggable"],["popup","onOpen","onClose"]),[n]=L();let r=null,i=null;const s=t.lngLat;return u((()=>{n.map&&(i?.remove(),i=new window.MapLib.Popup({closeOnClick:!1,focusAfterOpen:!1,...o.popup}).on("open",(()=>o.onOpen?.())).on("close",(()=>o.onClose?.())),u((()=>{void 0!==t.children&&("string"==typeof t.children?i?.setHTML(t.children):i?.setDOMContent(t.children),r?.setPopup(i))})),u((()=>t.showPopup!==i?.isOpen()&&r?.togglePopup())))})),u((()=>{n.map&&(r?.remove(),r=new window.MapLib.Marker(a.options).on("dragstart",(()=>a.onDragStart?.())).on("dragend",(()=>a.onDragEnd?.())).on("drag",(()=>a.onDrag?.(r?.getLngLat().toArray()))).setPopup(i).setLngLat(s).addTo(n.map),u((()=>t.showPopup!==i?.isOpen()&&r?.togglePopup())))})),u((()=>r?.setLngLat(t.lngLat))),u((()=>r?.setDraggable(t.draggable))),y((()=>r?.remove())),null},ee=e=>{if(!e.trackPointer&&!e.lngLat)throw new Error("Popup - lngLat or trackPointer is required");const[t,o]=w(e,["lngLat","children","trackPointer"]),[a]=L();let n;return u((()=>{a.map&&(n?.remove(),n=new window.MAPLIB.Popup({closeOnClick:!1,focusAfterOpen:!1,...o.options}).on("open",(()=>o.onOpen?.())).on("close",(()=>o.onClose?.())).addTo(a.map),u((()=>t.trackPointer?n.trackPointer():n.setLngLat(t.lngLat))),u((()=>"string"==typeof t.children?n.setHTML(t.children):n.setDOMContent(t.children))))})),y((()=>n?.remove())),null},te={diagonal_l:{size:20,path:"M20 0 0 20M-10 10 10-10M10 30 30 10"},diagonal_r:{size:20,path:"M0 0 20 20M30 10 10-10M10 30-10 10"},horizontal:{size:14,path:"M7 0V20"},vertical:{size:14,path:"M0 7H20"},cross:{size:18,path:"M9 0V18M0 9H18"},hash:{size:30,path:"M15 0 30 15 15 30 0 15Z"},chevron_h:{size:20,path:"M-5 5 0 10 10 0 20 10 25 5M0 30 10 20 20 30"},chevron_v:{size:20,path:"M5-5 10 0 0 10 10 20 5 25M25 15 20 10 25 5"},square:{size:20,path:"M8 8H12V12H8Z",fill:!0},hex:{size:50,path:"M0 0V50L50 25ZM50 0V50L0 25ZM25 0V50"},circle:{size:25,path:"M8 10A2.5 2.5 0 118.01 10M18 15A2.5 2.5 0 1018.01 15",fill:!0}},oe=Object.keys(te),ae=e=>{const[t]=L(),[o,a]=m({width:0,height:0}),n=(e,o)=>{t.map.debug&&console.debug("%c[MapGL]","color: #10b981",e,o||"")};y((()=>{t.map?.hasImage(e.id)&&t.map?.removeImage(e.id),n("Remove Image:",e.id)})),u((()=>{if(!e.id)throw new Error("Image - ID is required");if(!e.source&&!e.pattern)throw new Error("Image - Image or Pattern is required");const s=e.pattern?{pixelRatio:2,...e.options}:e.options;r(e.source||i(e.pattern),(r=>{const{width:i,height:l}=r;t.map&&!t.map.hasImage(e.id)&&t.map.addImage(e.id,r,s),!e.pattern&&f((()=>i===o().width&&l===o().height))?(t.map.updateImage(e.id,r),t.map.triggerRepaint()):(t.map.removeImage(e.id),t.map.addImage(e.id,r,s)),a({width:i,height:l}),n("Add Image:",e.id),t.map.on("style.load",(()=>{t.map.hasImage(e.id)||(t.map.addImage(e.id,r,s),n("Re-Add Image:",e.id))}))}))}));const r=(o,a)=>{if("string"==typeof o&&o?.trimStart().startsWith("<svg")&&(o=(new DOMParser).parseFromString(o,"image/svg+xml").childNodes[0]),o instanceof SVGElement&&(e.options?.fill&&o.setAttribute("fill",e.options.fill),e.options?.stroke&&o.setAttribute("stroke",e.options.stroke),o=(new XMLSerializer).serializeToString(o)),"string"!=typeof o)return a(o);t.map.loadImage(o,(async(t,n)=>{if(!t)return a(n);{"string"==typeof o&&o?.trimEnd().endsWith(".svg")&&(o=await(await fetch(o)).text(),(o=(new DOMParser).parseFromString(o,"image/svg+xml").childNodes[0]).setAttribute("fill",e.options.fill),o.setAttribute("stroke",e.options.stroke),o.setAttribute("transform",e.options.transform),o=(new XMLSerializer).serializeToString(o));const t=new Image;t.crossOrigin="Anonymous",t.onload=()=>{const e=document.createElement("canvas");e.width=Math.max(t.width,50),e.height=Math.max(t.height,50);const o=e.getContext("2d");return o.imageSmoothingEnabled=!0,o.drawImage(t,0,0,e.width,e.height),a(o.getImageData(0,0,e.width,e.height))},t.src=o.trimStart().startsWith("<svg")?"data:image/svg+xml;charset=utf-8,"+o:o}}))},i=e=>{const t=te[e.type];return{width:t.size,height:t.size,data:new Uint8Array(t.size*t.size*4),onAdd:function(){let e=document.createElement("canvas");e.width=e.height=t.size,this.ctx=e.getContext("2d",{willReadFrequently:!0})},render:function(){return this.ctx.fillStyle=e.background||"transparent",this.ctx.fillRect(0,0,this.width,this.height),this.ctx.strokeStyle=this.ctx.fillStyle=e.color||"black",this.ctx.lineWidth=e.lineWith||1,this.ctx.stroke(new Path2D(t.path)),t.fill&&this.ctx.fill(new Path2D(t.path)),this.data=this.ctx.getImageData(0,0,this.width,this.height).data,!0}}};return null},ne={in:e=>e*e,out:e=>1-(1-e)*(1-e),inOut:e=>e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2},re=e=>{const[t]=L();let o=.1,a=!1;const[n,r]=m(!1);["mousedown","touchstart","wheel"].forEach((e=>t.map.on(e,(e=>!e.rotate&&r(!0))))),["moveend","mouseup","touchend"].forEach((e=>t.map.on(e,(e=>!e.rotate&&r(!1)))));const i=()=>{e.translate&&window.requestAnimationFrame(i);const n=[e.translate.start,e.translate.end,e.translate.easing?ne[e.translate.easing](o):o];(async([e,o,a],n)=>{const r=t.map.getFreeCameraOptions();r.position=window.MapLib.MercatorCoordinate.fromLngLat([e,o],a),r.lookAtPoint(n),t.map.setFreeCameraOptions(r)})("line"===e.translate.type?((e,t,o)=>e.map(((a,n)=>(1-o)*e[n]+o*t[n])))(...n):((e,t,o)=>{const a=e.map(((o,a)=>e[a]*t[a])).reduce(((e,t)=>e+t)),n=Math.acos(a);return e.map(((a,r)=>Math.sin((1-o)*n)/Math.sin(n)*e[r]+Math.sin(o*n)/Math.sin(n)*t[r]))})(...n),e.translate.target),!e.translate.loop&&(o>1||o<0)&&(a=!a),o=a?o-.001:o+.001};u((()=>{e.translate&&window.requestAnimationFrame(i)}));const s={duration:1e3,easing:e=>e},l=()=>{if(n())return;const{secPerRev:o=120,maxSpinZoom:a=5,slowSpinZoom:r=3}=e.rotateGlobe,i=t.map.getZoom();if(i>a)return;let l=360/o;i>r&&(l*=(a-i)/(a-r));const p=t.map.getCenter();p.lng=e.reverse?p.lng+l:p.lng-l,t.map.easeTo({center:p,...s},{rotate:!0})},p=()=>{if(!e.rotateViewport||n())return void t.map.stop();const o=e.rotateViewport,a=o?.secPerRev||60,r=e.reverse?t.map.getBearing()+360/a:t.map.getBearing()-360/a,i=o?.pitch||60,l=o?.around;t.map.easeTo({bearing:r,pitch:i,around:l,...s},{rotate:!0})},c=()=>e.rotateGlobe?l():p();let d;return t.map.on("moveend",c).on("dragend",c),u((()=>{null!=e.rotateGlobe&&(e.rotateGlobe?(d=t.map.getCenter(),l()):e.resetWhenStopped?t.map.stop().easeTo({center:d}):t.map.stop())})),u((()=>{null!=e.rotateViewport&&(e.rotateViewport?p():e.resetWhenStopped?t.map.stop().resetNorthPitch():t.map.stop())})),y((()=>t.map.off("moveend",c).off("dragend",c))),e.children},ie=e=>{const[t]=L();return u((()=>t.map.setLight(e.style||{}))),y((()=>t.map?.setLight(null))),null},se=e=>{const[t]=L(),o=new e.lib(e.options);t.map.addControl(o,e.position||"top-right"),e.getInstance&&e.getInstance(o);const a={};return C.forEach((o=>{if(e[o]){const n=`draw.${o.slice(2).toLowerCase()}`,r=t=>e[o](t);a[n]=r,t.map.on(n,r)}})),y((()=>{Object.keys(a).forEach((e=>t.map.off(e,a[e]))),t.map?.removeControl(o)})),null};export{Y as Atmosphere,re as Camera,J as Control,se as Draw,ae as Image,N as Layer,X as Layer3D,ie as Light,$ as MapProvider,Q as Marker,ee as Popup,F as Source,K as Terrain,V as default,oe as patternList,L as useMapContext,Z as useSourceId};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/components/MapProvider/index.tsx","../../src/events.ts","../../src/mapStyles.ts","../../src/components/MapGL/index.tsx","../../src/components/Source/index.tsx","../../src/styles.ts","../../src/components/Layer/index.tsx","../../src/components/Layer3D/index.tsx","../../src/components/Atmosphere/index.tsx","../../src/components/Terrain/index.tsx","../../src/components/Control/index.tsx","../../src/components/Marker/index.tsx","../../src/components/Popup/index.tsx","../../src/components/Image/index.tsx","../../src/components/Camera/index.tsx","../../src/components/Light/index.tsx","../../src/components/Draw/index.tsx"],"sourcesContent":["import { createContext, useContext, ParentComponent } from 'solid-js'\nimport { createStore } from 'solid-js/store'\nimport type { Map } from '../MapGL'\n\nconst [state, setState] = createStore({ map: null })\n\nexport const MapContext = createContext([state])\n\nexport const useMapContext = () => useContext(MapContext)\n\nexport const MapProvider: ParentComponent<{\n map?: Map\n}> = (props) => {\n props.map && setState('map', props.map)\n\n return (\n <MapContext.Provider value={[state]}>{props.children}</MapContext.Provider>\n )\n}\n","import type {\n MapMouseEvent,\n MapTouchEvent,\n MapWheelEvent,\n MapDataEvent,\n MapBoxZoomEvent,\n} from 'mapbox-gl'\n\ntype mapEventTypes = {\n onMouseDown?: (event: MapMouseEvent) => void\n onMouseUp?: (event: MapMouseEvent) => void\n onMouseOver?: (event: MapMouseEvent) => void\n onMouseOut?: (event: MapMouseEvent) => void\n onMouseMove?: (event: MapMouseEvent) => void\n onMouseEnter?: (event: MapMouseEvent) => void\n onMouseLeave?: (event: MapMouseEvent) => void\n onPreClick?: (event: MapMouseEvent) => void\n onClick?: (event: MapMouseEvent) => void\n onDblClick?: (event: MapMouseEvent) => void\n onContextMenu?: (event: MapMouseEvent) => void\n onTouchStart?: (event: MapTouchEvent) => void\n onTouchEnd?: (event: MapTouchEvent) => void\n onTouchCancel?: (event: MapTouchEvent) => void\n onTouchMove?: (event: MapTouchEvent) => void\n onWheel?: (event: MapWheelEvent) => void\n onResize?: () => void\n onRemove?: () => void\n onMoveStart?: (event: DragEvent) => void\n onMove?: (event: MapMouseEvent | MapTouchEvent) => void\n onMoveEnd?: (event: DragEvent) => void\n onDragStart?: (event: DragEvent) => void\n onDrag?: (event: MapMouseEvent | MapTouchEvent) => void\n onDragEnd?: (event: DragEvent) => void\n onZoomStart?: (event: MapMouseEvent | MapTouchEvent) => void\n onZoom?: (event: MapMouseEvent | MapTouchEvent) => void\n onZoomEnd?: (event: MapMouseEvent | MapTouchEvent) => void\n onRotateStart?: (event: MapMouseEvent | MapTouchEvent) => void\n onRotate?: (event: MapMouseEvent | MapTouchEvent) => void\n onRotatEnd?: (event: MapMouseEvent | MapTouchEvent) => void\n onPitchStart?: (event: MapDataEvent) => void\n onPitch?: (event: MapDataEvent) => void\n onPitchEnd?: (event: MapDataEvent) => void\n onBoxZoomStart?: (event: MapBoxZoomEvent) => void\n onBoxZoomEnd?: (event: MapBoxZoomEvent) => void\n onBoxZoomCancel?: (event: MapBoxZoomEvent) => void\n onWebglContextLost?: () => void\n onWebglContextRestored?: () => void\n onLoad?: (event: any) => void\n onRender?: () => void\n onIdle?: () => void\n onError?: (error: string) => void\n onData?: (event: MapDataEvent) => void\n onStyleData?: (event: MapDataEvent) => void\n onSourceData?: (event: MapDataEvent) => void\n onDataLoading?: (event: MapDataEvent) => void\n onStyleDataLoading?: (event: MapDataEvent) => void\n onSourceDataLoading?: (event: MapDataEvent) => void\n onStyleImageMissing?: (event: MapDataEvent) => void\n}\n\nconst mapEvents: string[] = [\n 'onMouseDown',\n 'onMouseUp',\n 'onMouseOver',\n 'onMouseOut',\n 'onMouseMove',\n 'onMouseEnter',\n 'onMouseLeave',\n 'onPreClick',\n 'onClick',\n 'onDblClick',\n 'onContextMenu',\n 'onTouchStart',\n 'onTouchEnd',\n 'onTouchCancel',\n 'onWheel',\n 'onResize',\n 'onRemove',\n 'onTouchMove',\n 'onMoveStart',\n 'onMove',\n 'onMoveEnd',\n 'onDragStart',\n 'onDrag',\n 'onDragEnd',\n 'onZoomStart',\n 'onZoom',\n 'onZoomEnd',\n 'onRotateStart',\n 'onRotate',\n 'onRotatEnd',\n 'onPitchStart',\n 'onPitch',\n 'onPitchEnd',\n 'onBoxZoomStart',\n 'onBoxZoomEnd',\n 'onBoxZoomCancel',\n 'onWebglContextLost',\n 'onWebglContextRestored',\n 'onLoad',\n 'onRender',\n 'onIdle',\n 'onError',\n 'onData',\n 'onStyleData',\n 'onSourceData',\n 'onDataLoading',\n 'onStyleDataLoading',\n 'onSourceDataLoading',\n 'onStyleImageMissing',\n]\n\ntype layerEventTypes = {\n onMouseDown?: (event: MapMouseEvent) => void\n /** called when the mouse button is pressed down on the layer */\n onMouseUp?: (event: MapMouseEvent) => void\n /** called when the mouse button is released after a mouse down event on the layer */\n onMouseOver?: (event: MapMouseEvent) => void\n /** called when the mouse enters the layer */\n onMouseOut?: (event: MapMouseEvent) => void\n /** called when the mouse leaves the layer */\n onMouseMove?: (event: MapMouseEvent) => void\n /** called when the mouse is moved over the layer */\n onMouseEnter?: (event: MapMouseEvent) => void\n /** called when the mouse enters the layer */\n onMouseLeave?: (event: MapMouseEvent) => void\n /** called when the mouse leaves the layer */\n onClick?: (event: MapMouseEvent) => void\n /** called when the layer is clicked */\n onDblClick?: (event: MapMouseEvent) => void\n /** called when the layer is double-clicked */\n onContextMenu?: (event: MapMouseEvent) => void\n /** called when the context menu is triggered on the layer */\n onTouchStart?: (event: MapTouchEvent) => void\n /** called when a touch event is started on the layer */\n onTouchEnd?: (event: MapTouchEvent) => void\n /** called when a touch event is ended on the layer */\n onTouchCancel?: (event: MapTouchEvent) => void\n /** called when a touch event is cancelled on the layer */\n}\n\nconst layerEvents: any[] = [\n 'onMouseDown',\n 'onMouseUp',\n 'onMouseOver',\n 'onMouseOut',\n 'onMouseMove',\n 'onMouseEnter',\n 'onMouseLeave',\n 'onClick',\n 'onDblClick',\n 'onContextMenu',\n 'onTouchStart',\n 'onTouchEnd',\n 'onTouchCancel',\n]\n\nconst drawEvents: any[] = [\n 'onCreate',\n 'onDelete',\n 'onCombine',\n 'onUncombine',\n 'onUpdate',\n 'onSelectionchange',\n 'onModechange',\n 'onRender',\n 'onActionable',\n]\n\ntype drawEventTypes = {\n onCreate?: (event: Object) => void\n /** called when a feature is created */\n onDelete?: (event: Object) => void\n /** called when a feature is deleted */\n onCombine?: (event: Object) => void\n /** called when features are combined */\n onUncombine?: (event: Object) => void\n /** called when features are uncombined */\n onUpdate?: (event: Object) => void\n /** called when a feature is updated */\n onSelectionchange?: (event: Object) => void\n /** called when the selected features change */\n onModechange?: (event: Object) => void\n /** called when the draw mode changes */\n onRender?: (event: Object) => void\n /** called when the draw canvas is re-rendered */\n onActionable?: (event: Object) => void\n /** called when the state of the draw controls changes */\n}\n\nexport { mapEvents, layerEvents, drawEvents }\nexport type { mapEventTypes, layerEventTypes, drawEventTypes }\n","const mapBase = 'mapbox://styles/mapbox'\nconst gitBase = 'https://raw.githubusercontent.com/'\nconst gishub = 'https://raw.githubusercontent.com/GIShub4/map-styles/main/'\nconst hereBase = 'https://assets.vector.hereapi.com/styles/'\n\nexport const vectorStyleList: object = {\n mb: {\n light: `${mapBase}/light-v11`,\n dark: `${mapBase}/dark-v11`,\n street: `${mapBase}/streets-v12`,\n outdoor: `${mapBase}/outdoors-v12`,\n sat: `${mapBase}/satellite-v9`,\n sat_street: `${mapBase}/satellite-streets-v12`,\n nav: `${mapBase}/navigation-guidance-day-v4`,\n nav_night: `${mapBase}/navigation-guidance-night-v4`,\n basic: `${mapBase}/cjf4m44iw0uza2spb3q0a7s41`,\n monochrome: `${mapBase}/cjv6rzz4j3m4b1fqcchuxclhb`,\n leshine: `${mapBase}/cjcunv5ae262f2sm9tfwg8i0w`,\n icecream: `${mapBase}/cj7t3i5yj0unt2rmt3y4b5e32`,\n cali: `${mapBase}/cjerxnqt3cgvp2rmyuxbeqme7`,\n northstar: `${mapBase}/cj44mfrt20f082snokim4ungi`,\n mineral: `${mapBase}/cjtep62gq54l21frr1whf27ak`,\n moonlight: `${mapBase}/cj3kbeqzo00022smj7akz3o1e`,\n frank: `${mapBase}-map-design/ckshxkppe0gge18nz20i0nrwq`,\n minimo: `${mapBase}-map-design/cksjc2nsq1bg117pnekb655h1`,\n decimal: `${mapBase}-map-design/ck4014y110wt61ctt07egsel6`,\n standard: `${mapBase}-map-design/ckr0svm3922ki18qntevm857n`,\n blueprint: `${mapBase}-map-design/cks97e1e37nsd17nzg7p0308g`,\n bubble: `${mapBase}-map-design/cksysy2nl62zp17quosctdtcc`,\n pencil: `${mapBase}-map-design/cks9iema71es417mlrft4go2k`,\n swiss_ski: `${gitBase}mapbox/mapbox-gl-swiss-ski-style/master/cij1zoclj002y8rkkdjl69psd.json`,\n vintage: `${gitBase}mapbox/mapbox-gl-vintage-style/master/cif5p01n202nisaktvljx9mv3.json`,\n whaam: `${gitBase}mapbox/mapbox-gl-whaam-style/master/cii8323c8004w0nlvtss3dbm2.json`,\n neon: `${gitBase}NatEvatt/awesome-mapbox-gl-styles/master/styles/Neon/style.json`,\n camoflauge: `${gitBase}jingsam/mapbox-gl-styles/master/Camouflage.json`,\n emerald: `${gitBase}jingsam/mapbox-gl-styles/master/Emerald.json`,\n runner: `${gitBase}jingsam/mapbox-gl-styles/master/Runner.json`,\n x_ray: `${gitBase}jingsam/mapbox-gl-styles/master/X-ray.json`,\n },\n here: {\n base: `${hereBase}berlin/base/mapbox/tilezen?apikey={apikey}`,\n day: `${hereBase}berlin/day/mapbox/tilezen?apikey={apikey}`,\n night: `${hereBase}berlin/night/mapbox/tilezen?apikey={apikey}`,\n },\n esri: {\n blueprint: `${gishub}esri:blueprint.json`,\n charted_territory: `${gishub}esri:charted-territory.json`,\n colored_pencil: `${gishub}esri:colored-pencil.json`,\n community: `${gishub}esri:community.json`,\n mid_century: `${gishub}esri:mid-century.json`,\n modern_antique: `${gishub}esri:modern-antique.json`,\n nat_geo: `${gishub}esri:national-geographic.json`,\n newspaper: `${gishub}esri:newspaper.json`,\n open_street_map: `${gishub}esri:open-street-map.json`,\n light_gray_canvas: `${gishub}esri:light-gray-canvas.json`,\n dark_gray_canvas: `${gishub}esri:dark-gray-canvas.json`,\n human_geo_light: `${gishub}esri:human-geography-light.json`,\n human_geo_dark: `${gishub}esri:human-geography-dark.json`,\n world_navigation: `${gishub}esri:world-navigation.json`,\n world_street: `${gishub}esri:world-street.json`,\n world_street_night: `${gishub}esri:world-street-night.json`,\n world_terrain: `${gishub}esri:world-terrain.json`,\n world_terrain_hybrid: `${gishub}esri:world-terrain-hybrid.json`,\n world_topographic: `${gishub}esri:world-topographic.json`,\n chromium: `${gishub}esri:chromium.json`,\n dreamcatcher: `${gishub}esri:dreamcatcher.json`,\n seahaven: `${gishub}esri:seahaven.json`,\n sangria: `${gishub}esri:sangria.json`,\n mercurial: `${gishub}esri:mercurial.json`,\n imagery: `${gishub}esri:imagery.json`,\n imagery_hybrid: `${gishub}esri:imagery-hybrid.json`,\n firefly: `${gishub}esri:firefly.json`,\n firefly_hybrid: `${gishub}esri:firefly-hybrid.json`,\n oceans: `${gishub}esri:oceans.json`,\n },\n}\nconst carto = 'https://{s}.basemaps.cartocdn.com/rastertiles/'\nconst stamen = 'https://stamen-tiles-{s}.a.ssl.fastly.net/'\nconst tf = 'https://{s}.tile.thunderforest.com/'\n\nexport const rasterStyleList: object = {\n osm: {\n org: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',\n human: 'https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png',\n cycle: 'https://{s}.tile-cyclosm.openstreetmap.fr/cyclosm/{z}/{x}/{y}.png',\n topo: 'https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png',\n _copy:\n '<a href=\"https://www.openstreetmap.org/copyright\" target=\"_blank\">&copy; OpenStreetMap</a>',\n },\n carto: {\n voyager: `${carto}voyager_labels_under/{z}/{x}/{y}{r}.png`,\n positron: `${carto}light_all/{z}/{x}/{y}{r}.png`,\n dark: `${carto}dark_all/{z}/{x}/{y}{r}.png`,\n _copy:\n '<a href=\"https://carto.com/attribution\" target=\"_blank\">&copy; Carto</a>',\n },\n stamen: {\n toner: `${stamen}toner/{z}/{x}/{y}{r}.png`,\n toner_lite: `${stamen}toner-lite/{z}/{x}/{y}{r}.png`,\n watercolor: `${stamen}watercolor/{z}/{x}/{y}.png`,\n terrain: `${stamen}terrain/{z}/{x}/{y}{r}.png`,\n _copy:\n '<a href=\"https://stamen.com/privacy-policy\" target=\"_blank\">&copy; Stamen Design</a>',\n },\n tf: {\n cycle: `${tf}cycle/{z}/{x}/{y}{r}.png?apikey={apikey}`,\n trans: `${tf}transport/{z}/{x}/{y}{r}.png?apikey={apikey}`,\n trans_dark: `${tf}transport-dark/{z}/{x}/{y}{r}.png?apikey={apikey}`,\n landscape: `${tf}landscape/{z}/{x}/{y}{r}.png?apikey={apikey}`,\n outdoors: `${tf}outdoors/{z}/{x}/{y}{r}.png?apikey={apikey}`,\n neighbourhood: `${tf}neighbourhood/{z}/{x}/{y}{r}.png?apikey={apikey}`,\n spinal: `${tf}spinal-map/{z}/{x}/{y}{r}.png?apikey={apikey}`,\n pioneer: `${tf}pioneer/{z}/{x}/{y}{r}.png?apikey={apikey}`,\n atlas: `${tf}atlas/{z}/{x}/{y}{r}.png?apikey={apikey}`,\n mobile: `${tf}mobile-atlas/{z}/{x}/{y}{r}.png?apikey={apikey}`,\n _copy:\n '<a href=\"https://thunderforest.com/privacy\" target=\"_blank\">&copy; Thunderforest</a>',\n },\n}\n","import {\n createSignal,\n createEffect,\n onMount,\n onCleanup,\n Component,\n createUniqueId,\n on,\n} from 'solid-js'\nimport { MapProvider } from '../MapProvider'\nimport { mapEvents } from '../../events'\nimport { vectorStyleList } from '../../mapStyles'\nimport type { mapEventTypes } from '../../events'\nimport type mapboxgl from 'mapbox-gl'\nimport type { MapboxOptions } from 'mapbox-gl/src/ui/map'\nimport type { LngLatLike } from 'mapbox-gl/src/geo/lng_lat.js'\nimport type { LngLatBounds } from 'mapbox-gl/src/geo/lng_lat_bounds.js'\nimport type { PaddingOptions } from 'mapbox-gl/src/geo/edge_insets.js'\nimport type { StyleSpecification } from 'mapbox-gl/src/style-spec/types.js'\nimport type { JSX } from 'solid-js'\n\ndeclare global {\n interface Window {\n MapLib?: any\n }\n}\n\nexport type Map = mapboxgl.Map & {\n debug: boolean\n debugEvents: boolean\n sourceIdList: string[]\n layerIdList: string[]\n}\n\nexport type Viewport = {\n id?: string\n point?: { x: number; y: number }\n center?: LngLatLike\n bounds?: LngLatBounds\n zoom?: number\n pitch?: number\n bearing?: number\n padding?: PaddingOptions\n inTransit?: boolean\n}\n\ntype Props = {\n /** ID for the map container element */\n id?: string\n /** Map Container CSS Style */\n style?: JSX.CSSProperties\n /** Map Container CSS Class */\n class?: string\n /** SolidJS Class List for Map Container */\n classList?: {\n [k: string]: boolean | undefined\n }\n /** Current Map View */\n viewport?: Viewport\n /** Mapbox Options\n * @see https://docs.mapbox.com/mapbox-gl-js/api/map/#map-parameters\n */\n options?: MapboxOptions\n /** Type for pan, move and zoom transitions */\n transitionType?: 'flyTo' | 'easeTo' | 'jumpTo'\n /** Event listener for Viewport updates */\n onViewportChange?: (viewport: Viewport) => void\n /** Event listener for User Interaction */\n onUserInteraction?: (user: boolean) => void\n /** Displays Map Tile Borders */\n showTileBoundaries?: boolean\n /** Displays Wireframe if Terrain is visible */\n showTerrainWireframe?: boolean\n /** Displays Borders if Padding is set */\n showPadding?: boolean\n /** Displays Label Collision Boxes */\n showCollisionBoxes?: boolean\n /** Displays all feature outlines even if normally not drawn by style rules */\n showOverdrawInspector?: boolean\n /** Mouse Cursor Style */\n cursorStyle?: string\n //** Dark Map Style */\n darkStyle?: StyleSpecification | string\n //** Disable automatic map resize */\n disableResize?: boolean\n //** MapLibre library */\n mapLib?: any\n //** APIkey for vector service */\n apikey?: string\n //** Debug Message Mode */\n debug?: boolean\n //** Debug Events */\n debugEvents?: boolean\n ref?: HTMLDivElement\n /** Children within the Map Container */\n children?: any\n} & mapEventTypes\n\n/** Creates a new Map Container */\nexport const MapGL: Component<Props> = (props) => {\n props.id ??= createUniqueId()\n\n let map: Map\n let mapRef: HTMLDivElement\n let resizeObserver: ResizeObserver\n let mutationObserver: MutationObserver\n\n const [mapLoaded, setMapLoaded] = createSignal(null)\n const [darkMode, setDarkMode] = createSignal(\n (typeof window !== 'undefined' &&\n window.matchMedia('(prefers-color-scheme: dark)').matches) ||\n (typeof document !== 'undefined' &&\n document.body.classList.contains('dark'))\n )\n const [internal, setInternal] = createSignal(false)\n\n const debug = (text, value?) =>\n (props.debug || props.debugEvents) &&\n console.debug('%c[MapGL]', 'color: #0ea5e9', text, value || '')\n\n const getStyle = (light, dark) => {\n const style = darkMode() && dark ? dark : light\n return typeof style === 'string' || style instanceof String\n ? style\n ?.split(':')\n .reduce((p, c) => p && p[c], vectorStyleList)\n ?.replace(\n '{apikey}',\n //@ts-ignore\n props.apikey || import.meta.env.VITE_VECTOR_API_KEY\n ) || style\n : style || { version: 8, sources: {}, layers: [] }\n }\n\n onMount(async () => {\n let mapLib = props.mapLib || (await import('mapbox-gl'))\n if (!mapLib.Map) mapLib = window['maplibregl'] || window['mapboxgl']\n\n if (typeof mapLib.supported === 'function' && !mapLib.supported())\n throw new Error('Mapbox GL not supported')\n\n debug(`Map (v${mapLib.version}) loading...`)\n map = new mapLib.Map({\n accessToken:\n //@ts-ignore\n props.options?.accessToken || import.meta.env.VITE_MAPBOX_ACCESS_TOKEN,\n interactive: props.options?.interactive || !!props.onViewportChange,\n ...props.options,\n ...props.viewport,\n projection: props.options?.projection,\n container: mapRef,\n style: getStyle(props.options?.style, props.darkStyle),\n fitBoundsOptions: { padding: props.viewport?.padding },\n } as MapboxOptions)\n\n map.debug = props.debug\n map.debugEvents = props.debugEvents\n map.sourceIdList = []\n map.layerIdList = []\n window.MapLib = mapLib\n\n // Hook up events\n mapEvents.forEach((item) => {\n const prop = props[item]\n if (prop) {\n const event = item.slice(2).toLowerCase()\n if (typeof prop === 'function') {\n map.on(event, (evt) => {\n setTimeout(() => {\n if (evt.clickOnLayer) return\n prop(evt)\n props.debugEvents && debug(`Map '${event}' event:`, evt)\n }, 0)\n })\n } else {\n Object.keys(prop).forEach((layerId) => {\n map.on(event as any, layerId, (evt) => {\n setTimeout(() => {\n if (evt.clickOnLayer) return\n prop[layerId](evt)\n props.debugEvents &&\n debug(`Map '${event}' event on '${layerId}':`, evt)\n }, 0)\n })\n })\n }\n }\n })\n\n map.once('load', () => {\n setMapLoaded(map)\n debug('Map loaded')\n\n // Handle User Interaction\n ;['mousedown', 'touchstart', 'wheel'].forEach((event) =>\n map.on(event, (evt) => !evt.rotate && props.onUserInteraction?.(true))\n )\n ;['moveend', 'mouseup', 'touchend'].forEach((event) =>\n map.on(event, (evt) => !evt.rotate && props.onUserInteraction?.(false))\n )\n\n // Listen to dark theme changes\n const darkTheme =\n typeof window !== 'undefined' &&\n window?.matchMedia('(prefers-color-scheme: dark)')\n darkTheme?.addEventListener('change', () => {\n setDarkMode(darkTheme.matches)\n debug('Set dark theme to:', darkTheme.matches?.toString())\n })\n mutationObserver = new MutationObserver(() => {\n const darkTheme = document.body.classList.contains('dark')\n setDarkMode(darkTheme)\n debug('Set theme to:', darkTheme)\n })\n mutationObserver.observe(document.body, { attributes: true })\n\n // Listen to map container size changes\n // if (!props.disableResize) {\n // resizeObserver = new ResizeObserver(() => {\n // map?.resize()\n // debug('Map resized')\n // })\n // resizeObserver.observe(mapRef as Element)\n // }\n\n // Update Viewport\n map.on('move', (event) => {\n const viewport: Viewport = {\n ...props.viewport,\n id: props.id,\n point: {\n x: (event as any).originalEvent?.x,\n y: (event as any).originalEvent?.y,\n },\n center: props.viewport?.center?.lat\n ? map.getCenter()\n : [map.getCenter().lng, map.getCenter().lat],\n zoom: map.getZoom(),\n pitch: map.getPitch(),\n bearing: map.getBearing(),\n inTransit: true,\n bounds: null,\n }\n setInternal(true)\n !event.viewport && props.onViewportChange?.(viewport)\n })\n\n map.on('moveend', (event) => {\n !event.rotate &&\n props.onViewportChange?.({ ...props.viewport, inTransit: false })\n setInternal(false)\n })\n })\n })\n\n // Hook up viewport event\n createEffect(\n on(\n () => props.viewport,\n (vp) => {\n if (props.id !== vp?.id || internal()) return\n const viewport = {\n ...vp,\n ...(vp.bounds\n ? map.cameraForBounds(vp.bounds, {\n padding: vp?.padding,\n })\n : null),\n }\n map.stop()[props.transitionType || 'flyTo'](viewport)\n debug(`Update Viewport (${props.transitionType || 'flyTo'}):`, viewport)\n },\n { defer: true }\n )\n )\n\n // Update Projection\n createEffect(() => {\n const proj = props.options?.projection\n if (!map || !proj) return\n map.setProjection(proj)\n debug('Set Projection to:', proj)\n })\n\n // Update Cursor\n createEffect(() => {\n const cur = props.cursorStyle\n if (!map || !cur) return\n map.getCanvas().style.cursor = cur\n debug('Set Cursor to:', cur)\n })\n\n const insertLayers = (list, layers) => {\n layers.forEach((layer) => {\n const index = list.findIndex((i) =>\n layer.metadata.smg.beforeType\n ? i.type === layer.metadata.smg.beforeType\n : i.id === layer.metadata.smg.beforeId\n )\n list =\n index === -1\n ? [...list, layer]\n : [...list.slice(0, index), layer, ...list.slice(index + 1)]\n })\n return list\n }\n\n // Update map style\n createEffect((prev) => {\n const style = getStyle(props.options?.style, props.darkStyle)\n if (map?.isStyleLoaded() && prev !== style) {\n const oldStyle = map.getStyle()\n const oldLayers = oldStyle.layers.filter((l) =>\n map.layerIdList.includes(l.id)\n )\n const oldSources = Object.keys(oldStyle.sources)\n .filter((s) => map.sourceIdList.includes(s))\n .reduce((obj, key) => ({ ...obj, [key]: oldStyle.sources[key] }), {})\n\n map.setStyle(style)\n map.once('styledata', () => {\n if (!oldLayers) return\n const newStyle = map.getStyle()\n map.setStyle({\n ...newStyle,\n sources: { ...newStyle.sources, ...oldSources },\n layers: insertLayers(newStyle.layers, oldLayers),\n fog: oldStyle.fog,\n terrain: oldStyle.terrain,\n })\n debug('Set Mapstyle to:', style)\n })\n }\n return style\n }, props.options?.style)\n\n // Update debug features\n ;[\n 'showTileBoundaries',\n 'showTerrainWireframe',\n 'showCollisionBoxes',\n 'showPadding',\n 'showOverdrawInspector',\n ].forEach((item) => {\n createEffect(() => {\n const prop = props[item]\n if (!map || !prop) return\n map[item] = prop\n debug(`Set ${item} to:`, prop)\n })\n })\n\n onCleanup(() => {\n resizeObserver?.disconnect()\n mutationObserver?.disconnect()\n map?.remove()\n debug('Map removed')\n })\n\n return (\n <>\n <div\n ref={mapRef}\n id={props.id}\n class={props?.class}\n classList={props?.classList}\n style={\n props?.class || props?.classList\n ? null\n : props.style || {\n position: 'absolute',\n inset: 0,\n 'z-index': -1,\n }\n }\n />\n {mapLoaded() && (\n <MapProvider map={mapLoaded()}>{props.children}</MapProvider>\n )}\n </>\n )\n}\n","import {\n onCleanup,\n createEffect,\n Component,\n createContext,\n useContext,\n createUniqueId,\n} from 'solid-js'\nimport { useMapContext } from '../MapProvider'\nimport type { SourceSpecification } from 'mapbox-gl/src/style-spec/types.js'\nimport { rasterStyleList } from '../../mapStyles'\n\nconst SourceContext = createContext<string>()\nexport const useSourceId = (): string => useContext(SourceContext)\n\ntype Props = {\n /** @optional Source ID for referencing non nexted Layers */\n id?: string\n /** @see https://docs.mapbox.com/mapbox-gl-js/style-spec/sources/ */\n source: SourceSpecification\n /** The map layers associated with this source */\n children?: any\n}\n\nexport const Source: Component<Props> = props => {\n const [ctx] = useMapContext()\n props.id ??= createUniqueId()\n\n const debug = (text, value?) => {\n ctx.map.debug &&\n console.debug('%c[MapGL]', 'color: #ec4899', text, value || '')\n }\n\n const lookup = url => {\n const s = url?.split(':').reduce((p, c) => p && p[c], rasterStyleList)\n const source = s\n ? {\n ...props.source,\n url: '',\n tiles: [\n s\n .replace(\n '{apikey}', //@ts-ignore\n props.source.apikey || import.meta.env.VITE_RASTER_API_KEY\n )\n .replace('{r}', window.devicePixelRatio > 1 ? '@2x' : ''),\n ],\n attribution: rasterStyleList[url.split(':')[0]]._copy,\n }\n : props.source\n\n source.tiles &&\n (source.tiles = ['a', 'b', 'c'].map(i =>\n source.tiles[0].replace('{s}', i)\n ))\n\n return source\n }\n\n // Add Source\n ctx.map.addSource(props.id, lookup(props.source.url))\n ctx.map.sourceIdList.push(props.id)\n debug('Add Source:', props.id)\n\n // Update Data\n const source = ctx.map.getSource(props.id)\n switch (props.source.type) {\n case 'geojson':\n createEffect(() => {\n const data = props.source.data\n if (!ctx.map.isSourceLoaded(props.id)) return\n source.setData(data || {})\n debug('Update GeoJSON Data:', props.id)\n })\n break\n case 'image':\n createEffect(() => {\n const url = props.source.url\n const coords = props.source.coordinates\n if (!ctx.map.isSourceLoaded(props.id)) return\n source.updateImage(url, coords)\n debug('Update Image Data:', props.id)\n })\n break\n case 'vector':\n createEffect(() => {\n const url = props.source.url\n const tiles = props.source.tiles\n if (!ctx.map.isSourceLoaded(props.id)) return\n url ? source.setUrl(url) : source.setTiles(tiles)\n debug('Update Vector Data:', props.id)\n })\n break\n case 'raster':\n createEffect(() => {\n const src = lookup(props.source.url)\n if (!ctx.map.isSourceLoaded(props.id)) return\n src.url ? source.setUrl(src.url) : source.setTiles(src.tiles)\n debug('Update Raster Data:', props.id)\n })\n break\n }\n\n // Remove Source\n onCleanup(() => {\n ctx.map\n ?.getStyle()\n .layers.forEach(\n layer => layer.source === props.id && ctx.map.removeLayer(layer.id)\n )\n ctx.map?.getSource(props.id) && ctx.map?.removeSource(props.id)\n debug('Remove Source:', props.id)\n })\n\n return (\n <SourceContext.Provider value={props.id}>\n {props.children}\n </SourceContext.Provider>\n )\n}\n","export const baseStyle = [\n 'id',\n 'type',\n 'filter',\n 'source',\n 'source-layer',\n 'minzoom',\n 'metadata',\n 'maxzoom',\n 'paint',\n 'layout'\n ]\n\nexport const layoutStyles = [\n 'visibility',\n 'line-join',\n 'line-cap',\n 'line-miter-limit',\n 'line-round-limit',\n 'line-sort-key',\n 'circle-sort-key',\n 'symbol-avoid-edges',\n 'symbol-placement',\n 'symbol-sort-key',\n 'symbol-spacing',\n 'symbol-z-order',\n 'icon-allow-overlap',\n 'icon-anchor',\n 'icon-ignore-placement',\n 'icon-image',\n 'icon-keep-upright',\n 'icon-offset',\n 'icon-optional',\n 'icon-padding',\n 'icon-pitch-alignment',\n 'icon-rotate',\n 'icon-rotation-alignment',\n 'icon-size',\n 'icon-text-fit',\n 'icon-text-fit-padding',\n 'text-allow-overlap',\n 'text-anchor',\n 'text-field',\n 'text-font',\n 'text-ignore-placement',\n 'text-justify',\n 'text-keep-upright',\n 'text-letter-spacing',\n 'text-line-height',\n 'text-max-angle',\n 'text-max-width',\n 'text-offset',\n 'text-optional',\n 'text-padding',\n 'text-pitch-alignment',\n 'text-radial-offset',\n 'text-rotate',\n 'text-rotation-alignment',\n 'text-size',\n 'text-transform',\n 'text-variable-anchor',\n 'text-writing-mode'\n]","import { onCleanup, createEffect, Component, createUniqueId } from 'solid-js'\nimport { useMapContext } from '../MapProvider'\nimport { useSourceId } from '../Source'\nimport { layerEvents } from '../../events'\nimport { baseStyle, layoutStyles } from '../../styles'\nimport type { layerEventTypes } from '../../events'\nimport type {\n FilterSpecification,\n StyleSpecification,\n} from 'mapbox-gl/src/style-spec/types.js'\nimport type { CustomLayerInterface } from 'mapbox-gl/src/style/style_layer/custom_style_layer'\n\nconst diff = (\n newProps: StyleSpecification = {},\n prevProps: StyleSpecification = {}\n): [string, any][] => {\n const keys = new Set([...Object.keys(newProps), ...Object.keys(prevProps)])\n return [...keys].reduce((acc, key: string) => {\n const value = newProps[key]\n if (value !== prevProps[key]) {\n acc.push([key, value])\n }\n return acc\n }, [])\n}\n\ntype Props = {\n id?: string\n /** A string that uniquely identifies the layer. If not provided, a unique ID will be generated. */\n style?: StyleSpecification\n /** A Mapbox Style Specification object that defines the visual appearance of the layer. */\n customLayer?: CustomLayerInterface\n /** An object that implements the `CustomLayerInterface` interface, which allows you to create custom layers using WebGL. */\n filter?: FilterSpecification\n /** A Mapbox filter specification that defines which features of the layer to include or exclude from the layer. */\n visible?: boolean\n /** A boolean that determines whether the layer is visible or not. */\n sourceId?: string\n /** A string that specifies the ID of the source that the layer uses for its data. */\n beforeType?:\n | 'background'\n | 'fill'\n | 'line'\n | 'symbol'\n | 'raster'\n | 'circle'\n | 'fill-extrusion'\n | 'heatmap'\n | 'hillshade'\n | 'sky'\n /** A string that specifies the type of layer before which the current layer should be inserted. */\n beforeId?: string\n /** A string that specifies the ID of the layer before which the current layer should be inserted. */\n featureState?: { id: number | string; state: object }\n /** 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. */\n children?: any\n /** Any content that should be rendered within the layer. */\n} & layerEventTypes\n\nconst newKey = (key, type) =>\n (key.startsWith(type) || key.startsWith('icon') || key.startsWith('text')\n ? ''\n : type + '-') + key.replace(/[A-Z]/g, (s) => '-' + s.toLowerCase())\n\nconst updateStyle = (oldStyle) => {\n if (!oldStyle) return\n let layout = {}\n let paint = {}\n let style = {}\n\n Object.entries(oldStyle).forEach(([key, value]) => {\n if (baseStyle.includes(key)) style[key] = value\n else {\n const nk = newKey(key, oldStyle.type)\n layoutStyles.includes(nk) ? (layout[nk] = value) : (paint[nk] = value)\n }\n })\n if (oldStyle.paint)\n Object.entries(oldStyle.paint).forEach(\n ([key, value]) => (paint[newKey(key, oldStyle.type)] = value)\n )\n if (oldStyle.layout)\n Object.entries(oldStyle.layout).forEach(\n ([key, value]) => (layout[newKey(key, oldStyle.type)] = value)\n )\n return { ...style, paint, layout } as StyleSpecification\n}\n\nexport const Layer: Component<Props> = (props) => {\n const [ctx] = useMapContext()\n const sourceId: string = props.style?.source || useSourceId()\n props.id = props.id || props.customLayer?.id || createUniqueId()\n\n const debug = (text, value?) => {\n ;(ctx.map.debug || ctx.map.debugEvents) &&\n console.debug('%c[MapGL]', 'color: #10b981', text, value || '')\n }\n\n // Add Layer\n ctx.map.addLayer(\n props.customLayer || {\n ...updateStyle(props.style),\n id: props.id,\n source: sourceId,\n metadata: {\n smg: { beforeType: props.beforeType, beforeId: props.beforeId },\n },\n },\n props.beforeType\n ? ctx.map.getStyle().layers.find((l) => l.type === props.beforeType)?.id\n : props.beforeId\n )\n ctx.map.layerIdList.push(props.id)\n if (props.customLayer) ctx.map.fire('load')\n debug('Add Layer:', props.id)\n\n // Hook up events\n layerEvents.forEach((item) => {\n if (props[item]) {\n const event = item.slice(2).toLowerCase()\n ctx.map.on(event, props.id, (evt) => {\n evt.clickOnLayer = true\n props[item](evt)\n ctx.map.debugEvent &&\n debug(`Layer '${event}' event on '${props.id}':`, evt)\n })\n }\n })\n\n // Update Style\n createEffect((prev: StyleSpecification) => {\n const style = updateStyle(props.style)\n if (style === prev) return\n\n if (style.layout !== prev?.layout)\n diff(style.layout, prev?.layout).forEach(([key, value]) =>\n ctx.map.setLayoutProperty(props.id, key, value, { validate: false })\n )\n\n if (style.paint !== prev?.paint)\n diff(style.paint, prev?.paint).forEach(([key, value]) =>\n ctx.map.setPaintProperty(props.id, key, value, { validate: false })\n )\n\n if (style.minzoom !== prev?.minzoom || style.maxzoom !== prev?.maxzoom)\n ctx.map.setLayerZoomRange(props.id, style.minzoom, style.maxzoom)\n\n if (style.filter !== prev?.filter)\n ctx.map.setFilter(props.id, style.filter, { validate: false })\n\n debug('Update Layer Style:', props.id)\n return style\n }, updateStyle(props.style))\n\n // Update Visibility\n createEffect((prev: boolean) => {\n if (props.visible === prev) return\n\n ctx.map.setLayoutProperty(\n props.id,\n 'visibility',\n props.visible ? 'visible' : 'none',\n { validate: false }\n )\n debug(`Update Visibility (${props.id}):`, props.visible.toString())\n return props.visible\n }, props.visible)\n\n // Update Filter\n createEffect(async () => {\n if (!props.filter) return\n\n !ctx.map.isStyleLoaded() && (await ctx.map.once('styledata'))\n ctx.map.setFilter(props.id, props.filter)\n debug(`Update Filter (${props.id}):`, props.filter)\n })\n\n // Update Feature State\n createEffect(async () => {\n if (!props.featureState || props.featureState.id === null) return\n\n !ctx.map.isStyleLoaded() && (await ctx.map.once('styledata'))\n\n ctx.map.removeFeatureState({\n source: sourceId,\n sourceLayer: props.style['source-layer'],\n })\n ctx.map.setFeatureState(\n {\n source: sourceId,\n sourceLayer: props.style['source-layer'],\n id: props.featureState.id,\n },\n props.featureState.state\n )\n })\n\n //Remove Layer\n onCleanup(() => ctx.map?.getLayer(props.id) && ctx.map?.removeLayer(props.id))\n\n return props.children\n}\n","import { onCleanup, VoidComponent, createUniqueId, onMount } from 'solid-js'\nimport { useMapContext } from '../MapProvider'\n\ndeclare global {\n interface Window {\n BABYLON?: any\n THREE?: any\n }\n}\n\ntype Props = {\n id?: string\n origin?: [number, number, number?] // [lng, lat, altitude]\n defaultLight?: boolean\n babylon?: boolean\n onAdd?: (scene: any, map: any, gl: any) => void\n onRender?: (gl: any, matrix: any) => void\n}\nexport const Layer3D: VoidComponent<Props> = (props) => {\n const [ctx] = useMapContext()\n\n onMount(async () => {\n props.id = props.id || createUniqueId()\n\n const worldOriginMercator = window.MapLib.MercatorCoordinate.fromLngLat(\n props.origin ? [props.origin[0], props.origin[1]] : [0, 0],\n props.origin ? props.origin[2] : 0\n )\n const worldScale = worldOriginMercator.meterInMercatorCoordinateUnits()\n\n let worldMatrix = null\n let BABYLON = null\n let THREE = null\n\n if (props.babylon) {\n BABYLON = await import('@babylonjs/core')\n worldMatrix = BABYLON.Matrix.Compose(\n new BABYLON.Vector3(worldScale, worldScale, worldScale),\n BABYLON.Quaternion.FromEulerAngles(Math.PI / 2, 0, 0),\n new BABYLON.Vector3(\n worldOriginMercator.x,\n worldOriginMercator.y,\n worldOriginMercator.z\n )\n )\n } else {\n THREE = await import('three')\n worldMatrix = {\n translateX: worldOriginMercator.x,\n translateY: worldOriginMercator.y,\n translateZ: worldOriginMercator.z,\n rotateX: Math.PI / 2,\n rotateY: 0,\n rotateZ: 0,\n scale: worldScale,\n }\n }\n\n ctx.map.addLayer({\n id: props.id,\n type: 'custom',\n renderingMode: '3d',\n onAdd(map, gl) {\n if (props.babylon) {\n const engine = new BABYLON.Engine(\n gl,\n true,\n {\n useHighPrecisionMatrix: true,\n },\n true\n )\n this.scene = new BABYLON.Scene(engine)\n this.scene.autoClear = false\n this.scene.detachControl()\n this.scene.beforeRender = () => engine.wipeCaches(true)\n this.scene.activeCamera = new BABYLON.Camera(\n 'Camera',\n new BABYLON.Vector3(),\n this.scene\n )\n if (props.defaultLight)\n new BABYLON.HemisphericLight(\n 'Light',\n new BABYLON.Vector3(1, 0, 0),\n this.scene\n )\n } else {\n this.camera = new THREE.Camera()\n this.scene = new THREE.Scene()\n if (props.defaultLight) {\n this.light = new THREE.DirectionalLight(0xffffff)\n this.light.position.set(100, 0, 0).normalize()\n this.scene.add(this.light)\n }\n\n this.renderer = new THREE.WebGLRenderer({\n canvas: map.getCanvas(),\n context: gl,\n antialias: true,\n })\n this.renderer.autoClear = false\n }\n this.map = map\n props.onAdd && props.onAdd(this.scene, this.map, gl)\n },\n render(gl, matrix) {\n if (props.babylon) {\n this.scene.activeCamera.freezeProjectionMatrix(\n worldMatrix.multiply(BABYLON.Matrix.FromArray(matrix))\n )\n const { x, y, z } = this.map.getFreeCameraOptions().position\n this.scene.activeCamera.position =\n BABYLON.Vector3.TransformCoordinates(\n new BABYLON.Vector3(x, y, z),\n this.scene.activeCamera.getProjectionMatrix().clone().invert()\n )\n this.scene.render(false)\n } else {\n const rotationX = new THREE.Matrix4().makeRotationAxis(\n new THREE.Vector3(1, 0, 0),\n worldMatrix.rotateX\n )\n const rotationY = new THREE.Matrix4().makeRotationAxis(\n new THREE.Vector3(0, 1, 0),\n worldMatrix.rotateY\n )\n const rotationZ = new THREE.Matrix4().makeRotationAxis(\n new THREE.Vector3(0, 0, 1),\n worldMatrix.rotateZ\n )\n\n const m = new THREE.Matrix4().fromArray(matrix)\n const l = new THREE.Matrix4()\n .makeTranslation(\n worldMatrix.translateX,\n worldMatrix.translateY,\n worldMatrix.translateZ\n )\n .scale(\n new THREE.Vector3(\n worldMatrix.scale,\n -worldMatrix.scale,\n worldMatrix.scale\n )\n )\n .multiply(rotationX)\n .multiply(rotationY)\n .multiply(rotationZ)\n this.camera.projectionMatrix = m.multiply(l)\n this.renderer.resetState()\n this.renderer.render(this.scene, this.camera)\n }\n props.onRender && props.onRender(gl, matrix)\n ctx.map.triggerRepaint()\n },\n })\n })\n\n onCleanup(() => {\n ctx.map.getLayer(props.id) && ctx.map.removeLayer(props.id)\n })\n\n return null\n}\n","import { onCleanup, createEffect, VoidComponent } from 'solid-js'\nimport { useMapContext } from '../MapProvider'\nimport type { Fog } from 'mapbox-gl'\n\ntype Props = {\n /** Fog/Atmosphere Specifications */\n style?: Fog\n}\n\nexport const Atmosphere: VoidComponent<Props> = (props: Props) => {\n const [ctx] = useMapContext()\n\n // Add or Update Atmosphere Layer\n createEffect(() => ctx.map.setFog(props.style || {}))\n\n // Remove Atmosphere Layer\n onCleanup(() => ctx.map.setFog(null))\n\n return null\n}\n","import {\n createEffect,\n VoidComponent,\n createUniqueId,\n onCleanup,\n} from 'solid-js'\nimport { useMapContext } from '../MapProvider'\nimport { useSourceId } from '../Source'\n\ninterface TerrainSpecification {\n source?: string\n exaggeration?: number | undefined\n}\n\nexport const Terrain: VoidComponent<TerrainSpecification> = (\n props?: TerrainSpecification\n) => {\n const [ctx] = useMapContext()\n let sourceId: string = useSourceId()\n\n // Add Terrain Source if not already defined\n if (!sourceId && !props?.source) {\n sourceId = createUniqueId()\n ctx.map.addSource(sourceId, {\n type: 'raster-dem',\n url: ctx.map.isMapLibre\n ? 'https://demotiles.maplibre.org/terrain-tiles/tiles.json'\n : 'mapbox://mapbox.terrain-rgb',\n tileSize: ctx.map.isMapLibre ? 256 : 512,\n maxzoom: ctx.map.isMapLibre ? undefined : 14,\n })\n ctx.map.sourceIdList.push(sourceId)\n }\n\n // Add or Update Terrain Layer\n createEffect(() => {\n ctx.map.setTerrain({\n exaggeration: props.exaggeration || 1,\n source: props?.source || sourceId,\n })\n })\n\n //Remove Terrain\n onCleanup(() => ctx.map?.setTerrain(null))\n\n return null\n}\n","import {\n createSignal,\n createEffect,\n onCleanup,\n splitProps,\n VoidComponent,\n untrack,\n} from 'solid-js'\nimport { useMapContext } from '../MapProvider'\nimport type { Options as AttributionOptions } from 'mapbox-gl/src/ui/control/attribution_control'\nimport type { Options as FullscreenOptions } from 'mapbox-gl/src/ui/control/fullscreen_control'\nimport type { Options as GeolocateOptions } from 'mapbox-gl/src/ui/control/geolocate_control'\nimport type { Options as NavigationOptions } from 'mapbox-gl/src/ui/control/navigation_control'\nimport type { Options as ScaleOptions } from 'mapbox-gl/src/ui/control/scale_control'\n\ntype ControlType =\n | 'navigation'\n | 'scale'\n | 'attribution'\n | 'fullscreen'\n | 'geolocate'\n | 'logo'\n | 'terrain'\n\ntype Props = {\n type?: ControlType\n /** a string that specifies the type of control to be displayed. It can be one of 'navigation', 'scale', 'attribution', 'fullscreen', or 'geolocate' */\n options?:\n | NavigationOptions\n | ScaleOptions\n | AttributionOptions\n | FullscreenOptions\n | GeolocateOptions\n | object\n /** an optional object that contains options specific to the control type */\n custom?: any\n /** an optional field that allows passing a custom control element. */\n position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'\n /** a string that specifies the position of the control on the map. It can be one of 'top-left', 'top-right', 'bottom-left', or 'bottom-right' */\n}\n\nexport const Control: VoidComponent<Props> = (props) => {\n const [ctx] = useMapContext()\n const [update, create] = splitProps(props, ['position'])\n const [control, setControl] = createSignal<any>(null)\n\n const controlClasses = new Map<ControlType, any>([\n ['navigation', window.MapLib.NavigationControl],\n ['scale', window.MapLib.ScaleControl],\n ['attribution', window.MapLib.AttributionControl],\n ['geolocate', window.MapLib.GeolocateControl],\n ['fullscreen', window.MapLib.FullscreenControl],\n ['logo', window.MapLib.LogoControl],\n ['terrain', window.MapLib.TerrainControl],\n ])\n\n // Add Control\n createEffect(() => {\n untrack(\n () =>\n control() &&\n ctx.map.hasControl(control()) &&\n ctx.map.removeControl(control())\n )\n setControl(\n create.custom ||\n new (controlClasses.get(create.type || 'navigation'))(create.options)\n )\n })\n\n // Update Position\n createEffect(() => {\n ctx.map.hasControl(control()) && ctx.map.removeControl(control())\n ctx.map.addControl(control(), update.position)\n })\n\n onCleanup(() => {\n ctx.map.hasControl(control()) && ctx.map.removeControl(control())\n })\n\n return null\n}\n","import { onCleanup, createEffect, Component, splitProps } from 'solid-js'\nimport { useMapContext } from '../MapProvider'\nimport type {\n Popup as PopupType,\n PopupOptions,\n Marker as MarkerType,\n MarkerOptions,\n LngLatLike,\n} from 'mapbox-gl'\n\ntype Props = {\n /** The geographical location to place the marker */\n lngLat: LngLatLike\n /** Options for the Mapbox GL JS marker */\n options?: MarkerOptions\n /** Options for the Mapbox GL JS popup that is associated with the marker */\n popup?: PopupOptions\n /** Whether the marker's associated popup should be open */\n showPopup?: boolean\n /** Whether the marker is draggable */\n draggable?: boolean\n /** A function that is called when the marker's associated popup is opened */\n onOpen?: () => void\n /** A function that is called when the marker's associated popup is closed */\n onClose?: () => void\n /** A function that is called when the marker starts being dragged */\n onDragStart?: () => void\n /** A function that is called when the marker stops being dragged */\n onDragEnd?: () => void\n /** A function that is called when the marker is being dragged */\n onDrag?: (lngLat: number[]) => void\n /** The content to be displayed in the marker's associated popup */\n children?: any\n}\n\nexport const Marker: Component<Props> = (props: Props) => {\n if (!props.lngLat) throw new Error('Marker - lngLat is required')\n const [update, create_popup, create_marker] = splitProps(\n props,\n ['lngLat', 'children', 'showPopup', 'draggable'],\n ['popup', 'onOpen', 'onClose']\n )\n\n const [ctx] = useMapContext()\n let marker: MarkerType = null\n let popup: PopupType = null\n const LNGLAT = update.lngLat\n\n // Add or Update Popup\n createEffect(() => {\n if (!ctx.map) return\n popup?.remove()\n popup = new window.MapLib.Popup({\n closeOnClick: false,\n focusAfterOpen: false,\n ...create_popup.popup,\n })\n .on('open', () => create_popup.onOpen?.())\n .on('close', () => create_popup.onClose?.())\n\n // Update Popup Content\n createEffect(() => {\n if (update.children === undefined) return\n typeof update.children === 'string'\n ? popup?.setHTML(update.children)\n : popup?.setDOMContent(update.children)\n marker?.setPopup(popup)\n })\n\n // Toggle Popup\n createEffect(\n () => update.showPopup !== popup?.isOpen() && marker?.togglePopup()\n )\n })\n\n // Add or Update Marker\n createEffect(() => {\n if (!ctx.map) return\n marker?.remove()\n marker = new window.MapLib.Marker(create_marker.options)\n .on('dragstart', () => create_marker.onDragStart?.())\n .on('dragend', () => create_marker.onDragEnd?.())\n .on('drag', () => create_marker.onDrag?.(marker?.getLngLat().toArray()))\n .setPopup(popup)\n .setLngLat(LNGLAT)\n .addTo(ctx.map)\n\n // Toggle Popup\n createEffect(\n () => update.showPopup !== popup?.isOpen() && marker?.togglePopup()\n )\n })\n\n // Update Position\n createEffect(() => marker?.setLngLat(update.lngLat))\n\n // Update Draggable\n createEffect(() => marker?.setDraggable(update.draggable))\n\n // Remove Marker\n onCleanup(() => marker?.remove())\n\n return null\n}\n","import { onCleanup, createEffect, Component, splitProps } from 'solid-js'\nimport { useMapContext } from '../MapProvider'\nimport type { Popup as PopupType, PopupOptions, LngLatLike } from 'mapbox-gl'\n\ntype Props = {\n /** Options for configuring the popup */\n options?: PopupOptions\n /** Flag for tracking the mouse pointer */\n trackPointer?: boolean\n /** Longitude and latitude for the popup */\n lngLat?: LngLatLike\n /** Callback for when the popup is opened */\n onOpen?: () => void\n /** Callback for when the popup is closed */\n onClose?: () => void\n /** Children to display within the popup */\n children?: any\n}\n\nexport const Popup: Component<Props> = (props: Props) => {\n if (!props.trackPointer && !props.lngLat)\n throw new Error('Popup - lngLat or trackPointer is required')\n\n const [update, create] = splitProps(props, [\n 'lngLat',\n 'children',\n 'trackPointer',\n ])\n const [ctx] = useMapContext()\n let popup: PopupType | undefined\n\n // Update Popup\n createEffect(() => {\n if (!ctx.map) return\n popup?.remove()\n popup = new window.MAPLIB.Popup({\n closeOnClick: false,\n focusAfterOpen: false,\n ...create.options,\n })\n .on('open', () => create.onOpen?.())\n .on('close', () => create.onClose?.())\n .addTo(ctx.map)\n\n // Update Position\n createEffect(() =>\n update.trackPointer\n ? popup.trackPointer()\n : popup.setLngLat(update.lngLat)\n )\n\n // Update Content\n createEffect(() =>\n typeof update.children === 'string'\n ? popup.setHTML(update.children)\n : popup.setDOMContent(update.children)\n )\n })\n\n // Remove Popup\n onCleanup(() => popup?.remove())\n\n return null\n}\n","import {\n onCleanup,\n createSignal,\n createEffect,\n VoidComponent,\n untrack,\n} from 'solid-js'\nimport { useMapContext } from '../MapProvider'\nimport type {\n StyleImageInterface,\n StyleImageMetadata,\n} from 'mapbox-gl/src/style/style_image'\n\nconst PATTERN = {\n diagonal_l: { size: 20, path: 'M20 0 0 20M-10 10 10-10M10 30 30 10' },\n diagonal_r: { size: 20, path: 'M0 0 20 20M30 10 10-10M10 30-10 10' },\n horizontal: { size: 14, path: 'M7 0V20' },\n vertical: { size: 14, path: 'M0 7H20' },\n cross: { size: 18, path: 'M9 0V18M0 9H18' },\n hash: { size: 30, path: 'M15 0 30 15 15 30 0 15Z' },\n chevron_h: { size: 20, path: 'M-5 5 0 10 10 0 20 10 25 5M0 30 10 20 20 30' },\n chevron_v: { size: 20, path: 'M5-5 10 0 0 10 10 20 5 25M25 15 20 10 25 5' },\n square: { size: 20, path: 'M8 8H12V12H8Z', fill: true },\n hex: { size: 50, path: 'M0 0V50L50 25ZM50 0V50L0 25ZM25 0V50' },\n circle: {\n size: 25,\n path: 'M8 10A2.5 2.5 0 118.01 10M18 15A2.5 2.5 0 1018.01 15',\n fill: true,\n },\n}\n\nexport const patternList = Object.keys(PATTERN)\n\nexport type Color =\n | `#${string}`\n | `rgb(${number}, ${number}, ${number})`\n | `rgba(${number}, ${number}, ${number}, ${number})`\n | `hsl(${number}, ${number}%, ${number}%)`\n | `hsla(${number}, ${number}%, ${number}%, ${number})`\n\ntype Props = {\n id: string\n /** The unique identifier for the image. */\n source?:\n | HTMLImageElement\n | ImageBitmap\n | ImageData\n | SVGElement\n | { width: number; height: number; data: Uint8Array | Uint8ClampedArray }\n | StyleImageInterface\n | string\n /** The image to be used for the image component. */\n options?: StyleImageMetadata & {\n fill?: Color\n stroke?: Color\n transform?: string\n }\n /** The options for the image */\n pattern?: {\n type: string\n color: Color\n background: Color\n lineWith: number\n }\n /** The pattern to be used for the image component. */\n}\n\nexport const MGL_Image: VoidComponent<Props> = props => {\n const [ctx] = useMapContext()\n const [size, setSize] = createSignal({ width: 0, height: 0 })\n\n const debug = (text, value?) => {\n ctx.map.debug &&\n console.debug('%c[MapGL]', 'color: #10b981', text, value || '')\n }\n\n // Remove Image\n onCleanup(() => {\n ctx.map?.hasImage(props.id) && ctx.map?.removeImage(props.id)\n debug('Remove Image:', props.id)\n })\n\n // Add or Update Image\n createEffect(() => {\n if (!props.id) throw new Error('Image - ID is required')\n if (!props.source && !props.pattern)\n throw new Error('Image - Image or Pattern is required')\n\n const ops = props.pattern\n ? { pixelRatio: 2, ...props.options }\n : props.options\n\n _loadImage(props.source || _createPattern(props.pattern), data => {\n const { width, height } = data\n if (ctx.map && !ctx.map.hasImage(props.id))\n ctx.map.addImage(props.id, data, ops)\n if (\n !props.pattern &&\n untrack(() => width === size().width && height === size().height)\n ) {\n ctx.map.updateImage(props.id, data)\n ctx.map.triggerRepaint()\n } else {\n ctx.map.removeImage(props.id)\n ctx.map.addImage(props.id, data, ops)\n }\n setSize({ width, height })\n debug('Add Image:', props.id)\n ctx.map.on('style.load', () => {\n if (ctx.map.hasImage(props.id)) return\n ctx.map.addImage(props.id, data, ops)\n debug('Re-Add Image:', props.id)\n })\n })\n })\n\n // Load Image / SVG\n const _loadImage = (image, callback) => {\n if (typeof image == 'string' && image?.trimStart().startsWith('<svg')) {\n image = new DOMParser().parseFromString(image, 'image/svg+xml')\n .childNodes[0]\n }\n if (image instanceof SVGElement) {\n props.options?.fill && image.setAttribute('fill', props.options.fill)\n props.options?.stroke &&\n image.setAttribute('stroke', props.options.stroke)\n image = new XMLSerializer().serializeToString(image)\n }\n if (typeof image !== 'string') return callback(image)\n ctx.map.loadImage(image, async (error, imageData) => {\n if (error) {\n if (typeof image == 'string' && image?.trimEnd().endsWith('.svg')) {\n image = await (await fetch(image)).text()\n image = new DOMParser().parseFromString(image, 'image/svg+xml')\n .childNodes[0]\n image.setAttribute('fill', props.options.fill)\n image.setAttribute('stroke', props.options.stroke)\n image.setAttribute('transform', props.options.transform)\n image = new XMLSerializer().serializeToString(image)\n }\n const img = new Image()\n img.crossOrigin = 'Anonymous'\n img.onload = () => {\n const canvas = document.createElement('canvas')\n canvas.width = Math.max(img.width, 50)\n canvas.height = Math.max(img.height, 50)\n const ctx = canvas.getContext('2d')\n ctx.imageSmoothingEnabled = true\n ctx.drawImage(img, 0, 0, canvas.width, canvas.height)\n return callback(ctx.getImageData(0, 0, canvas.width, canvas.height))\n }\n img.src = image.trimStart().startsWith('<svg')\n ? 'data:image/svg+xml;charset=utf-8,' + image\n : image\n } else {\n return callback(imageData)\n }\n })\n }\n\n const _createPattern = pattern => {\n const p = PATTERN[pattern.type]\n return {\n width: p.size,\n height: p.size,\n data: new Uint8Array(p.size * p.size * 4),\n onAdd: function () {\n let canvas = document.createElement('canvas')\n canvas.width = canvas.height = p.size\n this.ctx = canvas.getContext('2d', { willReadFrequently: true })\n },\n render: function () {\n this.ctx.fillStyle = pattern.background || 'transparent'\n this.ctx.fillRect(0, 0, this.width, this.height)\n this.ctx.strokeStyle = this.ctx.fillStyle = pattern.color || 'black'\n this.ctx.lineWidth = pattern.lineWith || 1\n this.ctx.stroke(new Path2D(p.path))\n if (p.fill) this.ctx.fill(new Path2D(p.path))\n this.data = this.ctx.getImageData(0, 0, this.width, this.height).data\n return true\n },\n }\n }\n\n return null\n}\n","import { createEffect, Component, onCleanup, createSignal } from 'solid-js'\nimport { useMapContext } from '../MapProvider'\nimport type { LngLatLike } from 'mapbox-gl'\n\n// linearly interpolate between two positions [x,y,z] based on time\nconst lerp = (a: number[], b: number[], t: number): number[] =>\n a.map((_, idx) => (1.0 - t) * a[idx] + t * b[idx])\n\n// sphericaly interpolate between two positions [x,y,z] based on time\nconst slerp = (a: number[], b: number[], t: number): number[] => {\n const dotProduct = a.map((_, idx) => a[idx] * b[idx]).reduce((m, n) => m + n)\n const theta = Math.acos(dotProduct)\n\n return a.map(\n (_, idx) =>\n (Math.sin((1 - t) * theta) / Math.sin(theta)) * a[idx] +\n (Math.sin(t * theta) / Math.sin(theta)) * b[idx]\n )\n}\n\n// calculations from: https://easings.net\nconst easeQuad = {\n in: (x: number): number => x * x,\n out: (x: number): number => 1 - (1 - x) * (1 - x),\n inOut: (x: number): number =>\n x < 0.5 ? 2 * x * x : 1 - Math.pow(-2 * x + 2, 2) / 2,\n}\n\n/** Options for rotating the globe. */\ninterface RotateGlobeOptions {\n /** The number of seconds per revolution. */\n secPerRev?: number\n /** The maximum zoom level for spinning the globe. */\n maxSpinZoom?: number\n /** The zoom level at which the spinning slows down. */\n slowSpinZoom?: number\n}\n\n/** Options for rotating the viewport. */\ninterface RotateViewportOptions {\n /** The number of seconds per revolution. */\n secPerRev?: number\n /** The pitch angle in degrees. */\n pitch?: number\n /** The center of rotation. */\n around?: LngLatLike\n}\n\n/** Props for the component. */\ntype Props = {\n /** Whether to rotate the globe. */\n rotateGlobe?: boolean | RotateGlobeOptions\n /** Whether to rotate the viewport. */\n rotateViewport?: boolean | RotateViewportOptions\n /** Whether to reverse the rotation direction. */\n reverse?: boolean\n /** Whether to reset the rotation when stopped. */\n resetWhenStopped?: boolean\n /** Translation options. */\n translate?: {\n /** The type of translation. */\n type?: 'line' | 'sphere'\n /** The starting position. */\n start: [number, number, number]\n /** The ending position. */\n end: [number, number, number]\n /** The target position. */\n target: LngLatLike\n /** The ending target position. */\n targetEnd?: LngLatLike\n /** The easing function to use. */\n easing?: 'in' | 'out' | 'inOut'\n /** Whether to loop the translation. */\n loop?: boolean\n /** The duration of the translation in milliseconds. */\n duration: number\n }\n /** The children to render. */\n children?: any\n}\n\nexport const Camera: Component<Props> = (props) => {\n const [ctx] = useMapContext()\n let animationTime = 0.1\n let isReverse = false\n\n // Handle User Interaction\n const [userInteraction, setUserInteraction] = createSignal(false)\n ;['mousedown', 'touchstart', 'wheel'].forEach((event) =>\n ctx.map.on(event, (evt) => !evt.rotate && setUserInteraction(true))\n )\n ;['moveend', 'mouseup', 'touchend'].forEach((event) =>\n ctx.map.on(event, (evt) => !evt.rotate && setUserInteraction(false))\n )\n\n const updateCameraPosition = async (\n [lng, lat, alt]: number[],\n target: LngLatLike\n ) => {\n const camera = ctx.map.getFreeCameraOptions()\n camera.position = window.MapLib.MercatorCoordinate.fromLngLat(\n [lng, lat],\n alt\n )\n camera.lookAtPoint(target)\n ctx.map.setFreeCameraOptions(camera)\n }\n\n const frame = () => {\n props.translate && window.requestAnimationFrame(frame)\n const params = [\n props.translate.start,\n props.translate.end,\n props.translate.easing\n ? easeQuad[props.translate.easing](animationTime)\n : animationTime,\n ] as const\n const position =\n props.translate.type === 'line' ? lerp(...params) : slerp(...params)\n\n updateCameraPosition(position, props.translate.target)\n\n if (!props.translate.loop && (animationTime > 1.0 || animationTime < 0.0))\n isReverse = !isReverse\n animationTime = isReverse ? animationTime - 0.001 : animationTime + 0.001\n }\n\n createEffect(() => {\n props.translate && window.requestAnimationFrame(frame)\n })\n\n const options = { duration: 1000, easing: (n) => n }\n\n const rotateGlobe = (): void => {\n if (userInteraction()) return\n const {\n secPerRev = 120,\n maxSpinZoom = 5,\n slowSpinZoom = 3,\n }: RotateGlobeOptions = props.rotateGlobe as RotateGlobeOptions\n\n const zoom: number = ctx.map.getZoom()\n if (zoom > maxSpinZoom) return\n let distancePerSecond: number = 360 / secPerRev\n if (zoom > slowSpinZoom)\n distancePerSecond *= (maxSpinZoom - zoom) / (maxSpinZoom - slowSpinZoom)\n const center: mapboxgl.LngLat = ctx.map.getCenter()\n center.lng = props.reverse\n ? center.lng + distancePerSecond\n : center.lng - distancePerSecond\n ctx.map.easeTo({ center, ...options }, { rotate: true })\n }\n\n const rotateViewport = (): void => {\n if (!props.rotateViewport || userInteraction()) return\n const rotateViewport = props.rotateViewport as RotateViewportOptions\n const secPerRev = rotateViewport?.secPerRev || 60\n const bearing = props.reverse\n ? ctx.map.getBearing() + 360 / secPerRev\n : ctx.map.getBearing() - 360 / secPerRev\n const pitch = rotateViewport?.pitch || 60\n const around = rotateViewport?.around\n ctx.map.easeTo({ bearing, pitch, around, ...options }, { rotate: true })\n }\n\n const onEnd = () => (props.rotateGlobe ? rotateGlobe() : rotateViewport())\n ctx.map.on('moveend', onEnd).on('dragend', onEnd)\n\n let originalCenter: mapboxgl.LngLatLike\n createEffect(() => {\n if (props.rotateGlobe == undefined) return\n if (props.rotateGlobe) {\n originalCenter = ctx.map.getCenter()\n rotateGlobe()\n } else {\n props.resetWhenStopped\n ? ctx.map.stop().easeTo({ center: originalCenter })\n : ctx.map.stop()\n }\n })\n\n createEffect(() => {\n if (props.rotateViewport == undefined) return\n props.rotateViewport\n ? rotateViewport()\n : props.resetWhenStopped\n ? ctx.map.stop().resetNorthPitch()\n : ctx.map.stop()\n })\n\n onCleanup(() => ctx.map.off('moveend', onEnd).off('dragend', onEnd))\n\n return props.children\n}\n","import { onCleanup, createEffect, VoidComponent } from 'solid-js'\nimport { useMapContext } from '../MapProvider'\nimport type { Light as LightSpecification } from 'mapbox-gl'\n\ntype Props = {\n /** Light Specifications */\n style: LightSpecification\n}\nexport const Light: VoidComponent<Props> = (props: Props) => {\n const [ctx] = useMapContext()\n\n // Add or Update Light Layer\n createEffect(() => ctx.map.setLight(props.style || {}))\n\n // Remove Light Layer\n onCleanup(() => ctx.map?.setLight(null))\n\n return null\n}\n","import { onCleanup, VoidComponent } from 'solid-js'\nimport { useMapContext } from '../MapProvider'\nimport { drawEvents } from '../../events'\nimport type { drawEventTypes } from '../../events'\n\ntype Props = {\n /** Draw Library */\n lib: any\n /** Draw Options */\n options?: object\n /** Draw Control Position */\n position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'\n /** Draw Control Instance */\n getInstance?: (object) => void\n} & drawEventTypes\n\nexport const Draw: VoidComponent<Props> = (props: Props) => {\n const [ctx] = useMapContext()\n\n // Add Draw Control\n const draw = new props.lib(props.options)\n ctx.map.addControl(draw, props.position || 'top-right')\n props.getInstance && props.getInstance(draw)\n\n // Hook up events\n const eventList: Record<string, (evt: any) => void> = {}\n drawEvents.forEach(item => {\n if (props[item]) {\n const event = `draw.${item.slice(2).toLowerCase()}`\n const fn = evt => props[item](evt)\n eventList[event] = fn\n ctx.map.on(event, fn)\n }\n })\n\n // Remove Draw Control\n onCleanup(() => {\n // Remove Events\n Object.keys(eventList).forEach(event => ctx.map.off(event, eventList[event]))\n // Remove Control\n ctx.map?.removeControl(draw)\n })\n\n return null\n}\n"],"names":["state","setState","createStore","map","MapContext","createContext","useMapContext","useContext","MapProvider","props","_$createComponent","Provider","value","children","mapEvents","layerEvents","drawEvents","mapBase","gitBase","gishub","hereBase","vectorStyleList","mb","light","dark","street","outdoor","sat","sat_street","nav","nav_night","basic","monochrome","leshine","icecream","cali","northstar","mineral","moonlight","frank","minimo","decimal","standard","blueprint","bubble","pencil","swiss_ski","vintage","whaam","neon","camoflauge","emerald","runner","x_ray","here","base","day","night","esri","charted_territory","colored_pencil","community","mid_century","modern_antique","nat_geo","newspaper","open_street_map","light_gray_canvas","dark_gray_canvas","human_geo_light","human_geo_dark","world_navigation","world_street","world_street_night","world_terrain","world_terrain_hybrid","world_topographic","chromium","dreamcatcher","seahaven","sangria","mercurial","imagery","imagery_hybrid","firefly","firefly_hybrid","oceans","carto","stamen","tf","rasterStyleList","osm","org","human","cycle","topo","_copy","voyager","positron","toner","toner_lite","watercolor","terrain","trans","trans_dark","landscape","outdoors","neighbourhood","spinal","pioneer","atlas","mobile","MapGL","mapRef","mutationObserver","id","createUniqueId","mapLoaded","setMapLoaded","createSignal","darkMode","setDarkMode","window","matchMedia","matches","document","body","classList","contains","internal","setInternal","debug","text","debugEvents","console","getStyle","style","String","split","reduce","p","c","replace","apikey","env","VITE_VECTOR_API_KEY","version","sources","layers","onMount","async","mapLib","import","Map","supported","Error","accessToken","options","VITE_MAPBOX_ACCESS_TOKEN","interactive","onViewportChange","viewport","projection","container","darkStyle","fitBoundsOptions","padding","sourceIdList","layerIdList","MapLib","forEach","item","prop","event","slice","toLowerCase","on","evt","setTimeout","clickOnLayer","Object","keys","layerId","once","rotate","onUserInteraction","darkTheme","addEventListener","toString","MutationObserver","observe","attributes","point","x","originalEvent","y","center","lat","getCenter","lng","zoom","getZoom","pitch","getPitch","bearing","getBearing","inTransit","bounds","createEffect","vp","cameraForBounds","stop","transitionType","defer","proj","setProjection","cur","cursorStyle","getCanvas","cursor","prev","isStyleLoaded","oldStyle","oldLayers","filter","l","includes","oldSources","s","obj","key","setStyle","newStyle","insertLayers","list","layer","index","findIndex","i","metadata","smg","beforeType","type","beforeId","fog","onCleanup","disconnect","remove","_el$","_tmpl$","_$use","_$effect","_p$","_v$","_v$2","class","_v$3","_v$4","position","inset","_$setAttribute","_$className","_$classList","_$style","undefined","_$memo","_c$","SourceContext","useSourceId","Source","ctx","lookup","url","source","tiles","VITE_RASTER_API_KEY","devicePixelRatio","attribution","addSource","push","getSource","data","isSourceLoaded","setData","coords","coordinates","updateImage","setUrl","setTiles","src","removeLayer","removeSource","baseStyle","layoutStyles","diff","newProps","prevProps","Set","acc","newKey","startsWith","updateStyle","layout","paint","entries","nk","Layer","sourceId","customLayer","addLayer","find","fire","debugEvent","setLayoutProperty","validate","setPaintProperty","minzoom","maxzoom","setLayerZoomRange","setFilter","visible","featureState","removeFeatureState","sourceLayer","setFeatureState","getLayer","Layer3D","worldOriginMercator","MercatorCoordinate","fromLngLat","origin","worldScale","meterInMercatorCoordinateUnits","worldMatrix","BABYLON","THREE","babylon","Matrix","Compose","Vector3","Quaternion","FromEulerAngles","Math","PI","z","translateX","translateY","translateZ","rotateX","rotateY","rotateZ","scale","renderingMode","onAdd","gl","engine","Engine","useHighPrecisionMatrix","this","scene","Scene","autoClear","detachControl","beforeRender","wipeCaches","activeCamera","Camera","defaultLight","HemisphericLight","camera","DirectionalLight","set","normalize","add","renderer","WebGLRenderer","canvas","context","antialias","render","matrix","freezeProjectionMatrix","multiply","FromArray","getFreeCameraOptions","TransformCoordinates","getProjectionMatrix","clone","invert","rotationX","Matrix4","makeRotationAxis","rotationY","rotationZ","m","fromArray","makeTranslation","projectionMatrix","resetState","onRender","triggerRepaint","Atmosphere","setFog","Terrain","isMapLibre","tileSize","setTerrain","exaggeration","Control","update","create","splitProps","control","setControl","controlClasses","NavigationControl","ScaleControl","AttributionControl","GeolocateControl","FullscreenControl","LogoControl","TerrainControl","untrack","hasControl","removeControl","custom","get","addControl","Marker","lngLat","create_popup","create_marker","marker","popup","LNGLAT","Popup","closeOnClick","focusAfterOpen","onOpen","onClose","setHTML","setDOMContent","setPopup","showPopup","isOpen","togglePopup","onDragStart","onDragEnd","onDrag","getLngLat","toArray","setLngLat","addTo","setDraggable","draggable","trackPointer","MAPLIB","PATTERN","diagonal_l","size","path","diagonal_r","horizontal","vertical","cross","hash","chevron_h","chevron_v","square","fill","hex","circle","patternList","MGL_Image","setSize","width","height","hasImage","removeImage","pattern","ops","pixelRatio","_loadImage","_createPattern","addImage","image","callback","trimStart","DOMParser","parseFromString","childNodes","SVGElement","setAttribute","stroke","XMLSerializer","serializeToString","loadImage","error","imageData","trimEnd","endsWith","fetch","transform","img","Image","crossOrigin","onload","createElement","max","getContext","imageSmoothingEnabled","drawImage","getImageData","Uint8Array","willReadFrequently","fillStyle","background","fillRect","strokeStyle","color","lineWidth","lineWith","Path2D","easeQuad","in","out","inOut","pow","animationTime","isReverse","userInteraction","setUserInteraction","frame","translate","requestAnimationFrame","params","start","end","easing","alt","target","lookAtPoint","setFreeCameraOptions","updateCameraPosition","lerp","a","b","t","_","idx","slerp","dotProduct","n","theta","acos","sin","loop","duration","rotateGlobe","secPerRev","maxSpinZoom","slowSpinZoom","distancePerSecond","reverse","easeTo","rotateViewport","around","onEnd","originalCenter","resetWhenStopped","resetNorthPitch","off","Light","setLight","Draw","draw","lib","getInstance","eventList","fn"],"mappings":"sXAIA,MAAOA,EAAOC,GAAYC,EAAY,CAAEC,IAAK,OAEhCC,EAAaC,EAAc,CAACL,IAE5BM,EAAgBA,IAAMC,EAAWH,GAEjCI,EAEPC,IACJA,EAAMN,KAAOF,EAAS,MAAOQ,EAAMN,KAEnCO,EACGN,EAAWO,SAAQ,CAACC,MAAO,CAACZ,GAAM,YAAAa,GAAA,OAAGJ,EAAMI,QAAQ,KC4ClDC,EAAsB,CAC1B,cACA,YACA,cACA,aACA,cACA,eACA,eACA,aACA,UACA,aACA,gBACA,eACA,aACA,gBACA,UACA,WACA,WACA,cACA,cACA,SACA,YACA,cACA,SACA,YACA,cACA,SACA,YACA,gBACA,WACA,a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,EAAI3Q,IAAIgN,OAAOuW,kBACf5S,EAAI3Q,IAAIgN,OAAM,IAGpBkC,GAAU,IAAMyB,EAAI3Q,IAAIwjB,IAAI,UAAWJ,GAAOI,IAAI,UAAWJ,KAEtD9iB,EAAMI,QAAQ,ECxLV+iB,GAA+BnjB,IAC1C,MAAOqQ,GAAOxQ,IAQd,OALA0M,GAAa,IAAM8D,EAAI3Q,IAAI0jB,SAASpjB,EAAM+H,OAAS,CAAE,KAGrD6G,GAAU,IAAMyB,EAAI3Q,KAAK0jB,SAAS,QAE3B,IAAI,ECDAC,GAA8BrjB,IACzC,MAAOqQ,GAAOxQ,IAGRyjB,EAAO,IAAItjB,EAAMujB,IAAIvjB,EAAMoJ,SACjCiH,EAAI3Q,IAAIwa,WAAWoJ,EAAMtjB,EAAMyP,UAAY,aAC3CzP,EAAMwjB,aAAexjB,EAAMwjB,YAAYF,GAGvC,MAAMG,EAAgD,CAAA,EAkBtD,OAjBAljB,EAAW0J,SAAQC,IACjB,GAAIlK,EAAMkK,GAAO,CACf,MAAME,EAAS,QAAOF,EAAKG,MAAM,GAAGC,gBAC9BoZ,EAAKlZ,GAAOxK,EAAMkK,GAAMM,GAC9BiZ,EAAUrZ,GAASsZ,EACnBrT,EAAI3Q,IAAI6K,GAAGH,EAAOsZ,EACpB,KAIF9U,GAAU,KAERjE,OAAOC,KAAK6Y,GAAWxZ,SAAQG,GAASiG,EAAI3Q,IAAIwjB,IAAI9Y,EAAOqZ,EAAUrZ,MAErEiG,EAAI3Q,KAAKqa,cAAcuJ,EAAK,IAGvB,IAAI"}
1
+ {"version":3,"file":"index.js","sources":["../../src/components/MapProvider/index.tsx","../../src/events.ts","../../src/mapStyles.ts","../../src/components/MapGL/index.tsx","../../src/components/Source/index.tsx","../../src/styles.ts","../../src/components/Layer/index.tsx","../../src/components/Layer3D/index.tsx","../../src/components/Atmosphere/index.tsx","../../src/components/Terrain/index.tsx","../../src/components/Control/index.tsx","../../src/components/Marker/index.tsx","../../src/components/Popup/index.tsx","../../src/components/Image/index.tsx","../../src/components/Camera/index.tsx","../../src/components/Light/index.tsx","../../src/components/Draw/index.tsx"],"sourcesContent":["import { createContext, useContext, ParentComponent } from 'solid-js'\nimport { createStore } from 'solid-js/store'\nimport type { Map } from '../MapGL'\n\nconst [state, setState] = createStore({ map: null })\n\nexport const MapContext = createContext([state])\n\nexport const useMapContext = () => useContext(MapContext)\n\nexport const MapProvider: ParentComponent<{\n map?: Map\n}> = (props) => {\n props.map && setState('map', props.map)\n\n return (\n <MapContext.Provider value={[state]}>{props.children}</MapContext.Provider>\n )\n}\n","import type {\n MapMouseEvent,\n MapTouchEvent,\n MapWheelEvent,\n MapDataEvent,\n MapBoxZoomEvent,\n} from 'mapbox-gl'\n\ntype mapEventTypes = {\n onMouseDown?: (event: MapMouseEvent) => void\n onMouseUp?: (event: MapMouseEvent) => void\n onMouseOver?: (event: MapMouseEvent) => void\n onMouseOut?: (event: MapMouseEvent) => void\n onMouseMove?: (event: MapMouseEvent) => void\n onMouseEnter?: (event: MapMouseEvent) => void\n onMouseLeave?: (event: MapMouseEvent) => void\n onPreClick?: (event: MapMouseEvent) => void\n onClick?: (event: MapMouseEvent) => void\n onDblClick?: (event: MapMouseEvent) => void\n onContextMenu?: (event: MapMouseEvent) => void\n onTouchStart?: (event: MapTouchEvent) => void\n onTouchEnd?: (event: MapTouchEvent) => void\n onTouchCancel?: (event: MapTouchEvent) => void\n onTouchMove?: (event: MapTouchEvent) => void\n onWheel?: (event: MapWheelEvent) => void\n onResize?: () => void\n onRemove?: () => void\n onMoveStart?: (event: DragEvent) => void\n onMove?: (event: MapMouseEvent | MapTouchEvent) => void\n onMoveEnd?: (event: DragEvent) => void\n onDragStart?: (event: DragEvent) => void\n onDrag?: (event: MapMouseEvent | MapTouchEvent) => void\n onDragEnd?: (event: DragEvent) => void\n onZoomStart?: (event: MapMouseEvent | MapTouchEvent) => void\n onZoom?: (event: MapMouseEvent | MapTouchEvent) => void\n onZoomEnd?: (event: MapMouseEvent | MapTouchEvent) => void\n onRotateStart?: (event: MapMouseEvent | MapTouchEvent) => void\n onRotate?: (event: MapMouseEvent | MapTouchEvent) => void\n onRotatEnd?: (event: MapMouseEvent | MapTouchEvent) => void\n onPitchStart?: (event: MapDataEvent) => void\n onPitch?: (event: MapDataEvent) => void\n onPitchEnd?: (event: MapDataEvent) => void\n onBoxZoomStart?: (event: MapBoxZoomEvent) => void\n onBoxZoomEnd?: (event: MapBoxZoomEvent) => void\n onBoxZoomCancel?: (event: MapBoxZoomEvent) => void\n onWebglContextLost?: () => void\n onWebglContextRestored?: () => void\n onLoad?: (event: any) => void\n onRender?: () => void\n onIdle?: () => void\n onError?: (error: string) => void\n onData?: (event: MapDataEvent) => void\n onStyleData?: (event: MapDataEvent) => void\n onSourceData?: (event: MapDataEvent) => void\n onDataLoading?: (event: MapDataEvent) => void\n onStyleDataLoading?: (event: MapDataEvent) => void\n onSourceDataLoading?: (event: MapDataEvent) => void\n onStyleImageMissing?: (event: MapDataEvent) => void\n}\n\nconst mapEvents: string[] = [\n 'onMouseDown',\n 'onMouseUp',\n 'onMouseOver',\n 'onMouseOut',\n 'onMouseMove',\n 'onMouseEnter',\n 'onMouseLeave',\n 'onPreClick',\n 'onClick',\n 'onDblClick',\n 'onContextMenu',\n 'onTouchStart',\n 'onTouchEnd',\n 'onTouchCancel',\n 'onWheel',\n 'onResize',\n 'onRemove',\n 'onTouchMove',\n 'onMoveStart',\n 'onMove',\n 'onMoveEnd',\n 'onDragStart',\n 'onDrag',\n 'onDragEnd',\n 'onZoomStart',\n 'onZoom',\n 'onZoomEnd',\n 'onRotateStart',\n 'onRotate',\n 'onRotatEnd',\n 'onPitchStart',\n 'onPitch',\n 'onPitchEnd',\n 'onBoxZoomStart',\n 'onBoxZoomEnd',\n 'onBoxZoomCancel',\n 'onWebglContextLost',\n 'onWebglContextRestored',\n 'onLoad',\n 'onRender',\n 'onIdle',\n 'onError',\n 'onData',\n 'onStyleData',\n 'onSourceData',\n 'onDataLoading',\n 'onStyleDataLoading',\n 'onSourceDataLoading',\n 'onStyleImageMissing',\n]\n\ntype layerEventTypes = {\n onMouseDown?: (event: MapMouseEvent) => void\n /** called when the mouse button is pressed down on the layer */\n onMouseUp?: (event: MapMouseEvent) => void\n /** called when the mouse button is released after a mouse down event on the layer */\n onMouseOver?: (event: MapMouseEvent) => void\n /** called when the mouse enters the layer */\n onMouseOut?: (event: MapMouseEvent) => void\n /** called when the mouse leaves the layer */\n onMouseMove?: (event: MapMouseEvent) => void\n /** called when the mouse is moved over the layer */\n onMouseEnter?: (event: MapMouseEvent) => void\n /** called when the mouse enters the layer */\n onMouseLeave?: (event: MapMouseEvent) => void\n /** called when the mouse leaves the layer */\n onClick?: (event: MapMouseEvent) => void\n /** called when the layer is clicked */\n onDblClick?: (event: MapMouseEvent) => void\n /** called when the layer is double-clicked */\n onContextMenu?: (event: MapMouseEvent) => void\n /** called when the context menu is triggered on the layer */\n onTouchStart?: (event: MapTouchEvent) => void\n /** called when a touch event is started on the layer */\n onTouchEnd?: (event: MapTouchEvent) => void\n /** called when a touch event is ended on the layer */\n onTouchCancel?: (event: MapTouchEvent) => void\n /** called when a touch event is cancelled on the layer */\n}\n\nconst layerEvents: any[] = [\n 'onMouseDown',\n 'onMouseUp',\n 'onMouseOver',\n 'onMouseOut',\n 'onMouseMove',\n 'onMouseEnter',\n 'onMouseLeave',\n 'onClick',\n 'onDblClick',\n 'onContextMenu',\n 'onTouchStart',\n 'onTouchEnd',\n 'onTouchCancel',\n]\n\nconst drawEvents: any[] = [\n 'onCreate',\n 'onDelete',\n 'onCombine',\n 'onUncombine',\n 'onUpdate',\n 'onSelectionchange',\n 'onModechange',\n 'onRender',\n 'onActionable',\n]\n\ntype drawEventTypes = {\n onCreate?: (event: Object) => void\n /** called when a feature is created */\n onDelete?: (event: Object) => void\n /** called when a feature is deleted */\n onCombine?: (event: Object) => void\n /** called when features are combined */\n onUncombine?: (event: Object) => void\n /** called when features are uncombined */\n onUpdate?: (event: Object) => void\n /** called when a feature is updated */\n onSelectionchange?: (event: Object) => void\n /** called when the selected features change */\n onModechange?: (event: Object) => void\n /** called when the draw mode changes */\n onRender?: (event: Object) => void\n /** called when the draw canvas is re-rendered */\n onActionable?: (event: Object) => void\n /** called when the state of the draw controls changes */\n}\n\nexport { mapEvents, layerEvents, drawEvents }\nexport type { mapEventTypes, layerEventTypes, drawEventTypes }\n","const mapBase = 'mapbox://styles/mapbox'\nconst gitBase = 'https://raw.githubusercontent.com/'\nconst gishub = 'https://raw.githubusercontent.com/GIShub4/map-styles/main/'\nconst hereBase = 'https://assets.vector.hereapi.com/styles/'\n\nexport const vectorStyleList: object = {\n mb: {\n standard: `${mapBase}/standard`,\n light: `${mapBase}/light-v11`,\n dark: `${mapBase}/dark-v11`,\n street: `${mapBase}/streets-v12`,\n outdoor: `${mapBase}/outdoors-v12`,\n sat: `${mapBase}/satellite-v9`,\n sat_street: `${mapBase}/satellite-streets-v12`,\n nav_base: `${mapBase}/navigation-guidance-day-v4`,\n nav_base_night: `${mapBase}/navigation-guidance-night-v4`,\n nav: `${mapBase}/navigation-day-v1`,\n nav_night: `${mapBase}/navigation-night-v1`,\n basic: `${mapBase}/cjf4m44iw0uza2spb3q0a7s41`,\n monochrome: `${mapBase}/cjv6rzz4j3m4b1fqcchuxclhb`,\n leshine: `${mapBase}/cjcunv5ae262f2sm9tfwg8i0w`,\n icecream: `${mapBase}/cj7t3i5yj0unt2rmt3y4b5e32`,\n cali: `${mapBase}/cjerxnqt3cgvp2rmyuxbeqme7`,\n northstar: `${mapBase}/cj44mfrt20f082snokim4ungi`,\n mineral: `${mapBase}/cjtep62gq54l21frr1whf27ak`,\n moonlight: `${mapBase}/cj3kbeqzo00022smj7akz3o1e`,\n frank: `${mapBase}-map-design/ckshxkppe0gge18nz20i0nrwq`,\n minimo: `${mapBase}-map-design/cksjc2nsq1bg117pnekb655h1`,\n decimal: `${mapBase}-map-design/ck4014y110wt61ctt07egsel6`,\n stand: `${mapBase}-map-design/ckr0svm3922ki18qntevm857n`,\n blueprint: `${mapBase}-map-design/cks97e1e37nsd17nzg7p0308g`,\n bubble: `${mapBase}-map-design/cksysy2nl62zp17quosctdtcc`,\n pencil: `${mapBase}-map-design/cks9iema71es417mlrft4go2k`,\n swiss_ski: `${gitBase}mapbox/mapbox-gl-swiss-ski-style/master/cij1zoclj002y8rkkdjl69psd.json`,\n vintage: `${gitBase}mapbox/mapbox-gl-vintage-style/master/cif5p01n202nisaktvljx9mv3.json`,\n whaam: `${gitBase}mapbox/mapbox-gl-whaam-style/master/cii8323c8004w0nlvtss3dbm2.json`,\n neon: `${gitBase}NatEvatt/awesome-mapbox-gl-styles/master/styles/Neon/style.json`,\n camoflauge: `${gitBase}jingsam/mapbox-gl-styles/master/Camouflage.json`,\n emerald: `${gitBase}jingsam/mapbox-gl-styles/master/Emerald.json`,\n runner: `${gitBase}jingsam/mapbox-gl-styles/master/Runner.json`,\n x_ray: `${gitBase}jingsam/mapbox-gl-styles/master/X-ray.json`,\n },\n here: {\n base: `${hereBase}berlin/base/mapbox/tilezen?apikey={apikey}`,\n day: `${hereBase}berlin/day/mapbox/tilezen?apikey={apikey}`,\n night: `${hereBase}berlin/night/mapbox/tilezen?apikey={apikey}`,\n },\n esri: {\n blueprint: `${gishub}esri:blueprint.json`,\n charted_territory: `${gishub}esri:charted-territory.json`,\n colored_pencil: `${gishub}esri:colored-pencil.json`,\n community: `${gishub}esri:community.json`,\n mid_century: `${gishub}esri:mid-century.json`,\n modern_antique: `${gishub}esri:modern-antique.json`,\n nat_geo: `${gishub}esri:national-geographic.json`,\n newspaper: `${gishub}esri:newspaper.json`,\n open_street_map: `${gishub}esri:open-street-map.json`,\n light_gray_canvas: `${gishub}esri:light-gray-canvas.json`,\n dark_gray_canvas: `${gishub}esri:dark-gray-canvas.json`,\n human_geo_light: `${gishub}esri:human-geography-light.json`,\n human_geo_dark: `${gishub}esri:human-geography-dark.json`,\n world_navigation: `${gishub}esri:world-navigation.json`,\n world_street: `${gishub}esri:world-street.json`,\n world_street_night: `${gishub}esri:world-street-night.json`,\n world_terrain: `${gishub}esri:world-terrain.json`,\n world_terrain_hybrid: `${gishub}esri:world-terrain-hybrid.json`,\n world_topographic: `${gishub}esri:world-topographic.json`,\n chromium: `${gishub}esri:chromium.json`,\n dreamcatcher: `${gishub}esri:dreamcatcher.json`,\n seahaven: `${gishub}esri:seahaven.json`,\n sangria: `${gishub}esri:sangria.json`,\n mercurial: `${gishub}esri:mercurial.json`,\n imagery: `${gishub}esri:imagery.json`,\n imagery_hybrid: `${gishub}esri:imagery-hybrid.json`,\n firefly: `${gishub}esri:firefly.json`,\n firefly_hybrid: `${gishub}esri:firefly-hybrid.json`,\n oceans: `${gishub}esri:oceans.json`,\n },\n}\nconst carto = 'https://{s}.basemaps.cartocdn.com/rastertiles/'\nconst stamen = 'https://stamen-tiles-{s}.a.ssl.fastly.net/'\nconst tf = 'https://{s}.tile.thunderforest.com/'\n\nexport const rasterStyleList: object = {\n osm: {\n org: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',\n human: 'https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png',\n cycle: 'https://{s}.tile-cyclosm.openstreetmap.fr/cyclosm/{z}/{x}/{y}.png',\n topo: 'https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png',\n _copy:\n '<a href=\"https://www.openstreetmap.org/copyright\" target=\"_blank\">&copy; OpenStreetMap</a>',\n },\n carto: {\n voyager: `${carto}voyager_labels_under/{z}/{x}/{y}{r}.png`,\n positron: `${carto}light_all/{z}/{x}/{y}{r}.png`,\n dark: `${carto}dark_all/{z}/{x}/{y}{r}.png`,\n _copy:\n '<a href=\"https://carto.com/attribution\" target=\"_blank\">&copy; Carto</a>',\n },\n stamen: {\n toner: `${stamen}toner/{z}/{x}/{y}{r}.png`,\n toner_lite: `${stamen}toner-lite/{z}/{x}/{y}{r}.png`,\n watercolor: `${stamen}watercolor/{z}/{x}/{y}.png`,\n terrain: `${stamen}terrain/{z}/{x}/{y}{r}.png`,\n _copy:\n '<a href=\"https://stamen.com/privacy-policy\" target=\"_blank\">&copy; Stamen Design</a>',\n },\n tf: {\n cycle: `${tf}cycle/{z}/{x}/{y}{r}.png?apikey={apikey}`,\n trans: `${tf}transport/{z}/{x}/{y}{r}.png?apikey={apikey}`,\n trans_dark: `${tf}transport-dark/{z}/{x}/{y}{r}.png?apikey={apikey}`,\n landscape: `${tf}landscape/{z}/{x}/{y}{r}.png?apikey={apikey}`,\n outdoors: `${tf}outdoors/{z}/{x}/{y}{r}.png?apikey={apikey}`,\n neighbourhood: `${tf}neighbourhood/{z}/{x}/{y}{r}.png?apikey={apikey}`,\n spinal: `${tf}spinal-map/{z}/{x}/{y}{r}.png?apikey={apikey}`,\n pioneer: `${tf}pioneer/{z}/{x}/{y}{r}.png?apikey={apikey}`,\n atlas: `${tf}atlas/{z}/{x}/{y}{r}.png?apikey={apikey}`,\n mobile: `${tf}mobile-atlas/{z}/{x}/{y}{r}.png?apikey={apikey}`,\n _copy:\n '<a href=\"https://thunderforest.com/privacy\" target=\"_blank\">&copy; Thunderforest</a>',\n },\n}\n","import {\n createSignal,\n createEffect,\n onMount,\n onCleanup,\n Component,\n on,\n} from \"solid-js\";\nimport { MapProvider } from \"../MapProvider\";\nimport { mapEvents } from \"../../events\";\nimport { vectorStyleList } from \"../../mapStyles\";\nimport type { mapEventTypes } from \"../../events\";\nimport type mapboxgl from \"mapbox-gl\";\nimport type { MapboxOptions } from \"mapbox-gl/src/ui/map\";\nimport type { LngLatLike } from \"mapbox-gl/src/geo/lng_lat.js\";\nimport type { LngLatBounds } from \"mapbox-gl/src/geo/lng_lat_bounds.js\";\nimport type { PaddingOptions } from \"mapbox-gl/src/geo/edge_insets.js\";\nimport type { StyleSpecification } from \"mapbox-gl/src/style-spec/types.js\";\nimport type { JSX } from \"solid-js\";\n\ndeclare global {\n interface Window {\n MapLib?: any;\n }\n}\n\nexport type Map = mapboxgl.Map & {\n debug: boolean;\n debugEvents: boolean;\n sourceIdList: string[];\n layerIdList: string[];\n};\n\nexport type Viewport = {\n id?: string;\n point?: { x: number; y: number };\n center?: LngLatLike;\n bounds?: LngLatBounds;\n zoom?: number;\n pitch?: number;\n bearing?: number;\n padding?: PaddingOptions;\n inTransit?: boolean;\n};\n\ntype Props = {\n /** ID for the map container element */\n id?: string;\n /** Map Container CSS Style */\n style?: JSX.CSSProperties;\n /** Map Container CSS Class */\n class?: string;\n /** SolidJS Class List for Map Container */\n classList?: {\n [k: string]: boolean | undefined;\n };\n /** Current Map View */\n viewport?: Viewport;\n /** Mapbox Options\n * @see https://docs.mapbox.com/mapbox-gl-js/api/map/#map-parameters\n */\n options?: MapboxOptions;\n /** Mapbox Style Configuration\n * @see https://docs.mapbox.com/mapbox-gl-js/guides/styles/#configure-a-style\n */\n config?: {\n id?: string;\n lightPreset?: \"dawn\" | \"day\" | \"dusk\" | \"night\";\n showPlaceLabels?: boolean;\n showRoadLabels?: boolean;\n showPointOfInterestLabels?: boolean;\n showTransitLabels?: boolean;\n font?: string[];\n [key: string]: boolean | string | string[];\n };\n /** Type for pan, move and zoom transitions */\n transitionType?: \"flyTo\" | \"easeTo\" | \"jumpTo\";\n /** Event listener for Viewport updates */\n onViewportChange?: (viewport: Viewport) => void;\n /** Event listener for User Interaction */\n onUserInteraction?: (user: boolean) => void;\n /** Displays Map Tile Borders */\n showTileBoundaries?: boolean;\n /** Displays Wireframe if Terrain is visible */\n showTerrainWireframe?: boolean;\n /** Displays Borders if Padding is set */\n showPadding?: boolean;\n /** Displays Label Collision Boxes */\n showCollisionBoxes?: boolean;\n /** Displays all feature outlines even if normally not drawn by style rules */\n showOverdrawInspector?: boolean;\n /** Mouse Cursor Style */\n cursorStyle?: string;\n //** Dark Map Style */\n darkStyle?: StyleSpecification | string;\n //** Disable automatic map resize */\n disableResize?: boolean;\n //** MapLibre library */\n mapLib?: any;\n //** APIkey for vector service */\n apikey?: string;\n //** Debug Message Mode */\n debug?: boolean;\n //** Debug Events */\n debugEvents?: boolean;\n ref?: HTMLDivElement;\n /** Children within the Map Container */\n children?: any;\n} & mapEventTypes;\n\n/** Creates a new Map Container */\nexport const MapGL: Component<Props> = (props) => {\n // props.id ??= createUniqueId()\n\n let map: Map;\n let mapRef: HTMLDivElement;\n let resizeObserver: ResizeObserver;\n let mutationObserver: MutationObserver;\n\n const [mapLoaded, setMapLoaded] = createSignal(null);\n const [darkMode, setDarkMode] = createSignal(\n (typeof window !== \"undefined\" &&\n window.matchMedia(\"(prefers-color-scheme: dark)\").matches) ||\n (typeof document !== \"undefined\" &&\n document.body.classList.contains(\"dark\")),\n );\n const [internal, setInternal] = createSignal(false);\n\n const debug = (text: string, value?: any) =>\n (props.debug || props.debugEvents) &&\n console.debug(\"%c[MapGL]\", \"color: #0ea5e9\", text, value || \"\");\n\n const getStyle = (light: any, dark: any) => {\n const style = darkMode() && dark ? dark : light;\n return typeof style === \"string\" || style instanceof String\n ? style\n ?.split(\":\")\n .reduce((p, c) => p && p[c], vectorStyleList)\n ?.replace(\n \"{apikey}\",\n //@ts-ignore\n props.apikey || import.meta.env.VITE_VECTOR_API_KEY,\n ) || style\n : style;\n };\n\n onMount(async () => {\n let mapLib = props.mapLib || (await import(\"mapbox-gl\"));\n if (!mapLib.Map) mapLib = window[\"maplibregl\"] || window[\"mapboxgl\"];\n\n if (typeof mapLib.supported === \"function\" && !mapLib.supported())\n throw new Error(\"Mapbox GL not supported\");\n\n debug(`Map (v${mapLib.version}) loading...`);\n map = new mapLib.Map({\n accessToken:\n //@ts-ignore\n props.options?.accessToken || import.meta.env.VITE_MAPBOX_ACCESS_TOKEN,\n interactive: props.options?.interactive || !!props.onViewportChange,\n ...props.options,\n ...props.viewport,\n projection: props.options?.projection,\n container: mapRef,\n style: getStyle(props.options?.style, props.darkStyle),\n fitBoundsOptions: { padding: props.viewport?.padding },\n } as MapboxOptions);\n\n map.debug = props.debug;\n map.debugEvents = props.debugEvents;\n map.sourceIdList = [];\n map.layerIdList = [];\n window.MapLib = mapLib;\n\n // Hook up events\n mapEvents.forEach((item) => {\n const prop = props[item];\n if (prop) {\n const event = item.slice(2).toLowerCase();\n if (typeof prop === \"function\") {\n map.on(event, (evt) => {\n setTimeout(() => {\n if (evt.clickOnLayer) return;\n prop(evt);\n props.debugEvents && debug(`Map '${event}' event:`, evt);\n }, 0);\n });\n } else {\n Object.keys(prop).forEach((layerId) => {\n map.on(event as any, layerId, (evt) => {\n setTimeout(() => {\n if (evt.clickOnLayer) return;\n prop[layerId](evt);\n props.debugEvents &&\n debug(`Map '${event}' event on '${layerId}':`, evt);\n }, 0);\n });\n });\n }\n }\n });\n\n map.once(\"load\", () => {\n setMapLoaded(map);\n debug(\"Map loaded\");\n\n // Handle User Interaction\n [\"mousedown\", \"touchstart\", \"wheel\"].forEach((event) =>\n map.on(event, (evt) => !evt.rotate && props.onUserInteraction?.(true)),\n );\n [\"moveend\", \"mouseup\", \"touchend\"].forEach((event) =>\n map.on(event, (evt) => !evt.rotate && props.onUserInteraction?.(false)),\n );\n\n // Listen to dark theme changes\n const darkTheme =\n typeof window !== \"undefined\" &&\n window?.matchMedia(\"(prefers-color-scheme: dark)\");\n darkTheme?.addEventListener(\"change\", () => {\n setDarkMode(darkTheme.matches);\n debug(\"Set dark theme to:\", darkTheme.matches?.toString());\n });\n mutationObserver = new MutationObserver(() => {\n const darkTheme = document.body.classList.contains(\"dark\");\n setDarkMode(darkTheme);\n debug(\"Set theme to:\", darkTheme);\n });\n mutationObserver.observe(document.body, { attributes: true });\n\n // Listen to map container size changes\n if (!props.disableResize) {\n resizeObserver = new ResizeObserver(() => {\n setTimeout(() => {\n map?.resize();\n }, 0);\n debug(\"Map resized\");\n });\n resizeObserver.observe(mapRef as Element);\n }\n\n // Update Configuration\n createEffect(() => {\n for (const key in props.config) {\n if (!key || key === \"id\") continue;\n const id = props.config?.id || \"basemap\";\n const value = props.config[key];\n //@ts-ignore\n map?.setConfigProperty(id, key, value);\n debug(`Set Config (${id}:${key}) to:`, value);\n }\n });\n\n // Update Viewport\n map.on(\"move\", (event) => {\n const viewport: Viewport = {\n ...props.viewport,\n id: props.id,\n point: {\n x: (event as any).originalEvent?.x,\n y: (event as any).originalEvent?.y,\n },\n center: props.viewport?.center?.lat\n ? map.getCenter()\n : [map.getCenter().lng, map.getCenter().lat],\n zoom: map.getZoom(),\n pitch: map.getPitch(),\n bearing: map.getBearing(),\n inTransit: true,\n bounds: null,\n // !internal()\n // ? props.viewport?.center?.lat\n // ? map.getBounds()\n // : [\n // [\n // map.getBounds().getNorthEast().lng,\n // map.getBounds().getNorthEast().lat,\n // ],\n // [\n // map.getBounds().getSouthWest().lng,\n // map.getBounds().getSouthWest().lat,\n // ],\n // ]\n // : null,\n };\n setInternal(true);\n !event.viewport && props.onViewportChange?.(viewport);\n });\n\n map.on(\"moveend\", (event) => {\n !event.rotate &&\n props.onViewportChange?.({ ...props.viewport, inTransit: false });\n setInternal(false);\n });\n });\n });\n\n // Hook up viewport event\n createEffect(\n on(\n () => props.viewport,\n (vp) => {\n if (props.id !== vp?.id || internal()) return;\n const viewport = {\n ...vp,\n ...(vp.bounds\n ? map.cameraForBounds(vp.bounds, {\n bearing: vp?.bearing,\n pitch: vp?.pitch,\n padding: vp?.padding,\n })\n : null),\n };\n map.stop()[props.transitionType || \"flyTo\"](viewport);\n debug(\n `Update Viewport (${props.transitionType || \"flyTo\"}):`,\n viewport,\n );\n },\n { defer: true },\n ),\n );\n\n // Update Projection\n createEffect(() => {\n const proj = props.options?.projection;\n if (!map || !proj) return;\n map.setProjection(proj);\n debug(\"Set Projection to:\", proj);\n });\n\n // Update Cursor\n createEffect(() => {\n const cur = props.cursorStyle;\n if (!map || !cur) return;\n map.getCanvas().style.cursor = cur;\n debug(\"Set Cursor to:\", cur);\n });\n\n const insertLayers = (list, layers) => {\n layers.forEach((layer) => {\n const index = list.findIndex((i) =>\n layer.metadata.smg.beforeType\n ? i.type === layer.metadata.smg.beforeType\n : i.id === layer.metadata.smg.beforeId,\n );\n list =\n index === -1\n ? [...list, layer]\n : [...list.slice(0, index), layer, ...list.slice(index + 1)];\n });\n return list;\n };\n\n // Update map style\n createEffect((prev) => {\n const style = getStyle(props.options?.style, props.darkStyle);\n if (map?.isStyleLoaded() && prev !== style) {\n const oldStyle = map.getStyle();\n const oldLayers = oldStyle.layers.filter((l) =>\n map.layerIdList.includes(l.id),\n );\n const oldSources = Object.keys(oldStyle.sources)\n .filter((s) => map.sourceIdList.includes(s))\n .reduce((obj, key) => ({ ...obj, [key]: oldStyle.sources[key] }), {});\n\n map.setStyle(style);\n map.once(\"styledata\", () => {\n if (!oldLayers) return;\n const newStyle = map.getStyle();\n map.setStyle({\n ...newStyle,\n sources: { ...newStyle.sources, ...oldSources },\n layers: insertLayers(newStyle.layers, oldLayers),\n fog: oldStyle.fog,\n terrain: oldStyle.terrain,\n });\n debug(\"Set Mapstyle to:\", style);\n });\n }\n return style;\n }, props.options?.style);\n\n // Update debug features\n [\n \"showTileBoundaries\",\n \"showTerrainWireframe\",\n \"showCollisionBoxes\",\n \"showPadding\",\n \"showOverdrawInspector\",\n ].forEach((item) => {\n createEffect(() => {\n const prop = props[item];\n if (!map || !prop) return;\n map[item] = prop;\n debug(`Set ${item} to:`, prop);\n });\n });\n\n onCleanup(() => {\n resizeObserver?.disconnect();\n mutationObserver?.disconnect();\n map?.remove();\n debug(\"Map removed\");\n });\n\n return (\n <div\n ref={mapRef}\n id={props.id}\n class={props?.class}\n classList={props?.classList}\n style={\n props?.class || props?.classList\n ? null\n : props.style || {\n position: \"absolute\",\n inset: 0,\n \"z-index\": -1,\n }\n }\n >\n {mapLoaded() && (\n <MapProvider map={mapLoaded()}>\n <div style={{ position: \"relative\" }}>{props.children}</div>\n </MapProvider>\n )}\n </div>\n );\n};\n","import {\n onCleanup,\n createEffect,\n Component,\n createContext,\n useContext,\n createUniqueId,\n} from 'solid-js'\nimport { useMapContext } from '../MapProvider'\nimport type { SourceSpecification } from 'mapbox-gl/src/style-spec/types.js'\nimport { rasterStyleList } from '../../mapStyles'\n\nconst SourceContext = createContext<string>()\nexport const useSourceId = (): string => useContext(SourceContext)\n\ntype Props = {\n /** @optional Source ID for referencing non nexted Layers */\n id?: string\n /** @see https://docs.mapbox.com/mapbox-gl-js/style-spec/sources/ */\n source: SourceSpecification\n /** The map layers associated with this source */\n children?: any\n}\n\nexport const Source: Component<Props> = props => {\n const [ctx] = useMapContext()\n props.id ??= createUniqueId()\n\n const debug = (text, value?) => {\n ctx.map.debug &&\n console.debug('%c[MapGL]', 'color: #ec4899', text, value || '')\n }\n\n const lookup = url => {\n const s = url?.split(':').reduce((p, c) => p && p[c], rasterStyleList)\n const source = s\n ? {\n ...props.source,\n url: '',\n tiles: [\n s\n .replace(\n '{apikey}', //@ts-ignore\n props.source.apikey || import.meta.env.VITE_RASTER_API_KEY\n )\n .replace('{r}', window.devicePixelRatio > 1 ? '@2x' : ''),\n ],\n attribution: rasterStyleList[url.split(':')[0]]._copy,\n }\n : props.source\n\n source.tiles &&\n (source.tiles = ['a', 'b', 'c'].map(i =>\n source.tiles[0].replace('{s}', i)\n ))\n\n return source\n }\n\n // Add Source\n ctx.map.addSource(props.id, lookup(props.source.url))\n ctx.map.sourceIdList.push(props.id)\n debug('Add Source:', props.id)\n\n // Update Data\n const source = ctx.map.getSource(props.id)\n switch (props.source.type) {\n case 'geojson':\n createEffect(() => {\n const data = props.source.data\n if (!ctx.map.isSourceLoaded(props.id)) return\n source.setData(data || {})\n debug('Update GeoJSON Data:', props.id)\n })\n break\n case 'image':\n createEffect(() => {\n const url = props.source.url\n const coords = props.source.coordinates\n if (!ctx.map.isSourceLoaded(props.id)) return\n source.updateImage(url, coords)\n debug('Update Image Data:', props.id)\n })\n break\n case 'vector':\n createEffect(() => {\n const url = props.source.url\n const tiles = props.source.tiles\n if (!ctx.map.isSourceLoaded(props.id)) return\n url ? source.setUrl(url) : source.setTiles(tiles)\n debug('Update Vector Data:', props.id)\n })\n break\n case 'raster':\n createEffect(() => {\n const src = lookup(props.source.url)\n if (!ctx.map.isSourceLoaded(props.id)) return\n src.url ? source.setUrl(src.url) : source.setTiles(src.tiles)\n debug('Update Raster Data:', props.id)\n })\n break\n }\n\n // Remove Source\n onCleanup(() => {\n ctx.map\n ?.getStyle()\n .layers.forEach(\n layer => layer.source === props.id && ctx.map.removeLayer(layer.id)\n )\n ctx.map?.getSource(props.id) && ctx.map?.removeSource(props.id)\n debug('Remove Source:', props.id)\n })\n\n return (\n <SourceContext.Provider value={props.id}>\n {props.children}\n </SourceContext.Provider>\n )\n}\n","export const baseStyle = [\n 'id',\n 'type',\n 'filter',\n 'source',\n 'source-layer',\n 'minzoom',\n 'metadata',\n 'maxzoom',\n 'paint',\n 'layout'\n ]\n\nexport const layoutStyles = [\n 'visibility',\n 'line-join',\n 'line-cap',\n 'line-miter-limit',\n 'line-round-limit',\n 'line-sort-key',\n 'circle-sort-key',\n 'symbol-avoid-edges',\n 'symbol-placement',\n 'symbol-sort-key',\n 'symbol-spacing',\n 'symbol-z-order',\n 'icon-allow-overlap',\n 'icon-anchor',\n 'icon-ignore-placement',\n 'icon-image',\n 'icon-keep-upright',\n 'icon-offset',\n 'icon-optional',\n 'icon-padding',\n 'icon-pitch-alignment',\n 'icon-rotate',\n 'icon-rotation-alignment',\n 'icon-size',\n 'icon-text-fit',\n 'icon-text-fit-padding',\n 'text-allow-overlap',\n 'text-anchor',\n 'text-field',\n 'text-font',\n 'text-ignore-placement',\n 'text-justify',\n 'text-keep-upright',\n 'text-letter-spacing',\n 'text-line-height',\n 'text-max-angle',\n 'text-max-width',\n 'text-offset',\n 'text-optional',\n 'text-padding',\n 'text-pitch-alignment',\n 'text-radial-offset',\n 'text-rotate',\n 'text-rotation-alignment',\n 'text-size',\n 'text-transform',\n 'text-variable-anchor',\n 'text-writing-mode'\n]","import { onCleanup, createEffect, Component, createUniqueId } from 'solid-js'\nimport { useMapContext } from '../MapProvider'\nimport { useSourceId } from '../Source'\nimport { layerEvents } from '../../events'\nimport { baseStyle, layoutStyles } from '../../styles'\nimport type { layerEventTypes } from '../../events'\nimport type {\n FilterSpecification,\n StyleSpecification,\n} from 'mapbox-gl/src/style-spec/types.js'\nimport type { CustomLayerInterface } from 'mapbox-gl/src/style/style_layer/custom_style_layer'\n\nconst diff = (\n newProps: StyleSpecification = {},\n prevProps: StyleSpecification = {}\n): [string, any][] => {\n const keys = new Set([...Object.keys(newProps), ...Object.keys(prevProps)])\n return [...keys].reduce((acc, key: string) => {\n const value = newProps[key]\n if (value !== prevProps[key]) {\n acc.push([key, value])\n }\n return acc\n }, [])\n}\n\ntype Props = {\n id?: string\n /** A string that uniquely identifies the layer. If not provided, a unique ID will be generated. */\n style?: StyleSpecification\n /** A Mapbox Style Specification object that defines the visual appearance of the layer. */\n customLayer?: CustomLayerInterface\n /** An object that implements the `CustomLayerInterface` interface, which allows you to create custom layers using WebGL. */\n filter?: FilterSpecification\n /** A Mapbox filter specification that defines which features of the layer to include or exclude from the layer. */\n visible?: boolean\n /** A boolean that determines whether the layer is visible or not. */\n sourceId?: string\n /** A string that specifies the ID of the source that the layer uses for its data. */\n slot?: string\n /** A string that specifies the slot to which the layer belongs. */\n beforeType?:\n | 'background'\n | 'fill'\n | 'line'\n | 'symbol'\n | 'raster'\n | 'circle'\n | 'fill-extrusion'\n | 'heatmap'\n | 'hillshade'\n | 'sky'\n /** A string that specifies the type of layer before which the current layer should be inserted. */\n beforeId?: string\n /** A string that specifies the ID of the layer before which the current layer should be inserted. */\n featureState?: { id: number | string; state: object }\n /** 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. */\n children?: any\n /** Any content that should be rendered within the layer. */\n} & layerEventTypes\n\nconst newKey = (key, type) =>\n (key.startsWith(type) || key.startsWith('icon') || key.startsWith('text')\n ? ''\n : type + '-') + key.replace(/[A-Z]/g, (s) => '-' + s.toLowerCase())\n\nconst updateStyle = (oldStyle) => {\n if (!oldStyle) return\n let layout = {}\n let paint = {}\n let style = {}\n\n Object.entries(oldStyle).forEach(([key, value]) => {\n if (baseStyle.includes(key)) style[key] = value\n else {\n const nk = newKey(key, oldStyle.type)\n layoutStyles.includes(nk) ? (layout[nk] = value) : (paint[nk] = value)\n }\n })\n if (oldStyle.paint)\n Object.entries(oldStyle.paint).forEach(\n ([key, value]) => (paint[newKey(key, oldStyle.type)] = value)\n )\n if (oldStyle.layout)\n Object.entries(oldStyle.layout).forEach(\n ([key, value]) => (layout[newKey(key, oldStyle.type)] = value)\n )\n return { ...style, paint, layout } as StyleSpecification\n}\n\nexport const Layer: Component<Props> = (props) => {\n const [ctx] = useMapContext()\n const sourceId: string = props.style?.source || useSourceId()\n props.id = props.id || props.customLayer?.id || createUniqueId()\n\n const debug = (text, value?) => {\n ;(ctx.map.debug || ctx.map.debugEvents) &&\n console.debug('%c[MapGL]', 'color: #10b981', text, value || '')\n }\n\n // Add Layer\n ctx.map.addLayer(\n props.customLayer || {\n ...updateStyle(props.style),\n id: props.id,\n source: sourceId,\n slot: props.slot || '',\n metadata: {\n smg: { beforeType: props.beforeType, beforeId: props.beforeId },\n },\n },\n props.beforeType\n ? ctx.map.getStyle().layers.find((l) => l.type === props.beforeType)?.id\n : props.beforeId\n )\n ctx.map.layerIdList.push(props.id)\n if (props.customLayer) ctx.map.fire('load')\n debug('Add Layer:', props.id)\n\n // Hook up events\n layerEvents.forEach((item) => {\n if (props[item]) {\n const event = item.slice(2).toLowerCase()\n ctx.map.on(event, props.id, (evt) => {\n evt.clickOnLayer = true\n props[item](evt)\n ctx.map.debugEvent &&\n debug(`Layer '${event}' event on '${props.id}':`, evt)\n })\n }\n })\n\n // Update Style\n createEffect((prev: StyleSpecification) => {\n const style = updateStyle(props.style)\n if (style === prev) return\n\n if (style.layout !== prev?.layout)\n diff(style.layout, prev?.layout).forEach(([key, value]) =>\n ctx.map.setLayoutProperty(props.id, key, value, { validate: false })\n )\n\n if (style.paint !== prev?.paint)\n diff(style.paint, prev?.paint).forEach(([key, value]) =>\n ctx.map.setPaintProperty(props.id, key, value, { validate: false })\n )\n\n if (style.minzoom !== prev?.minzoom || style.maxzoom !== prev?.maxzoom)\n ctx.map.setLayerZoomRange(props.id, style.minzoom, style.maxzoom)\n\n if (style.filter !== prev?.filter)\n ctx.map.setFilter(props.id, style.filter, { validate: false })\n\n debug('Update Layer Style:', props.id)\n return style\n }, updateStyle(props.style))\n\n // Update Visibility\n createEffect((prev: boolean) => {\n if (props.visible === prev) return\n\n ctx.map.setLayoutProperty(\n props.id,\n 'visibility',\n props.visible ? 'visible' : 'none',\n { validate: false }\n )\n debug(`Update Visibility (${props.id}):`, props.visible.toString())\n return props.visible\n }, props.visible)\n\n // Update Filter\n createEffect(async () => {\n if (!props.filter) return\n\n !ctx.map.isStyleLoaded() && (await ctx.map.once('styledata'))\n ctx.map.setFilter(props.id, props.filter)\n debug(`Update Filter (${props.id}):`, props.filter)\n })\n\n // Update Feature State\n createEffect(async () => {\n if (!props.featureState || props.featureState.id === null) return\n\n !ctx.map.isStyleLoaded() && (await ctx.map.once('styledata'))\n\n ctx.map.removeFeatureState({\n source: sourceId,\n sourceLayer: props.style['source-layer'],\n })\n ctx.map.setFeatureState(\n {\n source: sourceId,\n sourceLayer: props.style['source-layer'],\n id: props.featureState.id,\n },\n props.featureState.state\n )\n })\n\n //Remove Layer\n onCleanup(() => ctx.map?.getLayer(props.id) && ctx.map?.removeLayer(props.id))\n\n return props.children\n}\n","import { onCleanup, VoidComponent, createUniqueId, onMount } from 'solid-js'\nimport { useMapContext } from '../MapProvider'\n\ndeclare global {\n interface Window {\n BABYLON?: any\n THREE?: any\n }\n}\n\ntype Props = {\n id?: string\n origin?: [number, number, number?] // [lng, lat, altitude]\n defaultLight?: boolean\n babylon?: boolean\n onAdd?: (scene: any, map: any, gl: any) => void\n onRender?: (gl: any, matrix: any) => void\n}\nexport const Layer3D: VoidComponent<Props> = (props) => {\n const [ctx] = useMapContext()\n\n onMount(async () => {\n props.id = props.id || createUniqueId()\n\n const worldOriginMercator = window.MapLib.MercatorCoordinate.fromLngLat(\n props.origin ? [props.origin[0], props.origin[1]] : [0, 0],\n props.origin ? props.origin[2] : 0\n )\n const worldScale = worldOriginMercator.meterInMercatorCoordinateUnits()\n\n let worldMatrix = null\n let BABYLON = null\n let THREE = null\n\n if (props.babylon) {\n BABYLON = await import('@babylonjs/core')\n worldMatrix = BABYLON.Matrix.Compose(\n new BABYLON.Vector3(worldScale, worldScale, worldScale),\n BABYLON.Quaternion.FromEulerAngles(Math.PI / 2, 0, 0),\n new BABYLON.Vector3(\n worldOriginMercator.x,\n worldOriginMercator.y,\n worldOriginMercator.z\n )\n )\n } else {\n THREE = await import('three')\n worldMatrix = {\n translateX: worldOriginMercator.x,\n translateY: worldOriginMercator.y,\n translateZ: worldOriginMercator.z,\n rotateX: Math.PI / 2,\n rotateY: 0,\n rotateZ: 0,\n scale: worldScale,\n }\n }\n\n ctx.map.addLayer({\n id: props.id,\n type: 'custom',\n renderingMode: '3d',\n onAdd(map, gl) {\n if (props.babylon) {\n const engine = new BABYLON.Engine(\n gl,\n true,\n {\n useHighPrecisionMatrix: true,\n },\n true\n )\n this.scene = new BABYLON.Scene(engine)\n this.scene.autoClear = false\n this.scene.detachControl()\n this.scene.beforeRender = () => engine.wipeCaches(true)\n this.scene.activeCamera = new BABYLON.Camera(\n 'Camera',\n new BABYLON.Vector3(),\n this.scene\n )\n if (props.defaultLight)\n new BABYLON.HemisphericLight(\n 'Light',\n new BABYLON.Vector3(1, 0, 0),\n this.scene\n )\n } else {\n this.camera = new THREE.Camera()\n this.scene = new THREE.Scene()\n if (props.defaultLight) {\n this.light = new THREE.DirectionalLight(0xffffff)\n this.light.position.set(100, 0, 0).normalize()\n this.scene.add(this.light)\n }\n\n this.renderer = new THREE.WebGLRenderer({\n canvas: map.getCanvas(),\n context: gl,\n antialias: true,\n })\n this.renderer.autoClear = false\n }\n this.map = map\n props.onAdd && props.onAdd(this.scene, this.map, gl)\n },\n render(gl, matrix) {\n if (props.babylon) {\n this.scene.activeCamera.freezeProjectionMatrix(\n worldMatrix.multiply(BABYLON.Matrix.FromArray(matrix))\n )\n const { x, y, z } = this.map.getFreeCameraOptions().position\n this.scene.activeCamera.position =\n BABYLON.Vector3.TransformCoordinates(\n new BABYLON.Vector3(x, y, z),\n this.scene.activeCamera.getProjectionMatrix().clone().invert()\n )\n this.scene.render(false)\n } else {\n const rotationX = new THREE.Matrix4().makeRotationAxis(\n new THREE.Vector3(1, 0, 0),\n worldMatrix.rotateX\n )\n const rotationY = new THREE.Matrix4().makeRotationAxis(\n new THREE.Vector3(0, 1, 0),\n worldMatrix.rotateY\n )\n const rotationZ = new THREE.Matrix4().makeRotationAxis(\n new THREE.Vector3(0, 0, 1),\n worldMatrix.rotateZ\n )\n\n const m = new THREE.Matrix4().fromArray(matrix)\n const l = new THREE.Matrix4()\n .makeTranslation(\n worldMatrix.translateX,\n worldMatrix.translateY,\n worldMatrix.translateZ\n )\n .scale(\n new THREE.Vector3(\n worldMatrix.scale,\n -worldMatrix.scale,\n worldMatrix.scale\n )\n )\n .multiply(rotationX)\n .multiply(rotationY)\n .multiply(rotationZ)\n this.camera.projectionMatrix = m.multiply(l)\n this.renderer.resetState()\n this.renderer.render(this.scene, this.camera)\n }\n props.onRender && props.onRender(gl, matrix)\n ctx.map.triggerRepaint()\n },\n })\n })\n\n onCleanup(() => {\n ctx.map.getLayer(props.id) && ctx.map.removeLayer(props.id)\n })\n\n return null\n}\n","import { onCleanup, createEffect, VoidComponent } from 'solid-js'\nimport { useMapContext } from '../MapProvider'\nimport type { Fog } from 'mapbox-gl'\n\ntype Props = {\n /** Fog/Atmosphere Specifications */\n style?: Fog\n}\n\nexport const Atmosphere: VoidComponent<Props> = (props: Props) => {\n const [ctx] = useMapContext()\n\n // Add or Update Atmosphere Layer\n createEffect(() => ctx.map.setFog(props.style || {}))\n\n // Remove Atmosphere Layer\n onCleanup(() => ctx.map.setFog(null))\n\n return null\n}\n","import {\n createEffect,\n VoidComponent,\n createUniqueId,\n onCleanup,\n} from 'solid-js'\nimport { useMapContext } from '../MapProvider'\nimport { useSourceId } from '../Source'\n\ninterface TerrainSpecification {\n source?: string\n exaggeration?: number | undefined\n}\n\nexport const Terrain: VoidComponent<TerrainSpecification> = (\n props?: TerrainSpecification\n) => {\n const [ctx] = useMapContext()\n let sourceId: string = useSourceId()\n\n // Add Terrain Source if not already defined\n if (!sourceId && !props?.source) {\n sourceId = createUniqueId()\n ctx.map.addSource(sourceId, {\n type: 'raster-dem',\n url: ctx.map.isMapLibre\n ? 'https://demotiles.maplibre.org/terrain-tiles/tiles.json'\n : 'mapbox://mapbox.terrain-rgb',\n tileSize: ctx.map.isMapLibre ? 256 : 512,\n maxzoom: ctx.map.isMapLibre ? undefined : 14,\n })\n ctx.map.sourceIdList.push(sourceId)\n }\n\n // Add or Update Terrain Layer\n createEffect(() => {\n ctx.map.setTerrain({\n exaggeration: props.exaggeration || 1,\n source: props?.source || sourceId,\n })\n })\n\n //Remove Terrain\n onCleanup(() => ctx.map?.setTerrain(null))\n\n return null\n}\n","import {\n createSignal,\n createEffect,\n onCleanup,\n splitProps,\n VoidComponent,\n untrack,\n} from 'solid-js'\nimport { useMapContext } from '../MapProvider'\nimport type { Options as AttributionOptions } from 'mapbox-gl/src/ui/control/attribution_control'\nimport type { Options as FullscreenOptions } from 'mapbox-gl/src/ui/control/fullscreen_control'\nimport type { Options as GeolocateOptions } from 'mapbox-gl/src/ui/control/geolocate_control'\nimport type { Options as NavigationOptions } from 'mapbox-gl/src/ui/control/navigation_control'\nimport type { Options as ScaleOptions } from 'mapbox-gl/src/ui/control/scale_control'\n\ntype ControlType =\n | 'navigation'\n | 'scale'\n | 'attribution'\n | 'fullscreen'\n | 'geolocate'\n | 'logo'\n | 'terrain'\n\ntype Props = {\n type?: ControlType\n /** a string that specifies the type of control to be displayed. It can be one of 'navigation', 'scale', 'attribution', 'fullscreen', or 'geolocate' */\n options?:\n | NavigationOptions\n | ScaleOptions\n | AttributionOptions\n | FullscreenOptions\n | GeolocateOptions\n | object\n /** an optional object that contains options specific to the control type */\n custom?: any\n /** an optional field that allows passing a custom control element. */\n position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'\n /** a string that specifies the position of the control on the map. It can be one of 'top-left', 'top-right', 'bottom-left', or 'bottom-right' */\n}\n\nexport const Control: VoidComponent<Props> = (props) => {\n const [ctx] = useMapContext()\n const [update, create] = splitProps(props, ['position'])\n const [control, setControl] = createSignal<any>(null)\n\n const controlClasses = new Map<ControlType, any>([\n ['navigation', window.MapLib.NavigationControl],\n ['scale', window.MapLib.ScaleControl],\n ['attribution', window.MapLib.AttributionControl],\n ['geolocate', window.MapLib.GeolocateControl],\n ['fullscreen', window.MapLib.FullscreenControl],\n ['logo', window.MapLib.LogoControl],\n ['terrain', window.MapLib.TerrainControl],\n ])\n\n // Add Control\n createEffect(() => {\n untrack(\n () =>\n control() &&\n ctx.map.hasControl(control()) &&\n ctx.map.removeControl(control())\n )\n setControl(\n create.custom ||\n new (controlClasses.get(create.type || 'navigation'))(create.options)\n )\n })\n\n // Update Position\n createEffect(() => {\n ctx.map.hasControl(control()) && ctx.map.removeControl(control())\n ctx.map.addControl(control(), update.position)\n })\n\n onCleanup(() => {\n ctx.map.hasControl(control()) && ctx.map.removeControl(control())\n })\n\n return null\n}\n","import { onCleanup, createEffect, Component, splitProps } from 'solid-js'\nimport { useMapContext } from '../MapProvider'\nimport type {\n Popup as PopupType,\n PopupOptions,\n Marker as MarkerType,\n MarkerOptions,\n LngLatLike,\n} from 'mapbox-gl'\n\ntype Props = {\n /** The geographical location to place the marker */\n lngLat: LngLatLike\n /** Options for the Mapbox GL JS marker */\n options?: MarkerOptions\n /** Options for the Mapbox GL JS popup that is associated with the marker */\n popup?: PopupOptions\n /** Whether the marker's associated popup should be open */\n showPopup?: boolean\n /** Whether the marker is draggable */\n draggable?: boolean\n /** A function that is called when the marker's associated popup is opened */\n onOpen?: () => void\n /** A function that is called when the marker's associated popup is closed */\n onClose?: () => void\n /** A function that is called when the marker starts being dragged */\n onDragStart?: () => void\n /** A function that is called when the marker stops being dragged */\n onDragEnd?: () => void\n /** A function that is called when the marker is being dragged */\n onDrag?: (lngLat: number[]) => void\n /** The content to be displayed in the marker's associated popup */\n children?: any\n}\n\nexport const Marker: Component<Props> = (props: Props) => {\n if (!props.lngLat) throw new Error('Marker - lngLat is required')\n const [update, create_popup, create_marker] = splitProps(\n props,\n ['lngLat', 'children', 'showPopup', 'draggable'],\n ['popup', 'onOpen', 'onClose']\n )\n\n const [ctx] = useMapContext()\n let marker: MarkerType = null\n let popup: PopupType = null\n const LNGLAT = update.lngLat\n\n // Add or Update Popup\n createEffect(() => {\n if (!ctx.map) return\n popup?.remove()\n popup = new window.MapLib.Popup({\n closeOnClick: false,\n focusAfterOpen: false,\n ...create_popup.popup,\n })\n .on('open', () => create_popup.onOpen?.())\n .on('close', () => create_popup.onClose?.())\n\n // Update Popup Content\n createEffect(() => {\n if (update.children === undefined) return\n typeof update.children === 'string'\n ? popup?.setHTML(update.children)\n : popup?.setDOMContent(update.children)\n marker?.setPopup(popup)\n })\n\n // Toggle Popup\n createEffect(\n () => update.showPopup !== popup?.isOpen() && marker?.togglePopup()\n )\n })\n\n // Add or Update Marker\n createEffect(() => {\n if (!ctx.map) return\n marker?.remove()\n marker = new window.MapLib.Marker(create_marker.options)\n .on('dragstart', () => create_marker.onDragStart?.())\n .on('dragend', () => create_marker.onDragEnd?.())\n .on('drag', () => create_marker.onDrag?.(marker?.getLngLat().toArray()))\n .setPopup(popup)\n .setLngLat(LNGLAT)\n .addTo(ctx.map)\n\n // Toggle Popup\n createEffect(\n () => update.showPopup !== popup?.isOpen() && marker?.togglePopup()\n )\n })\n\n // Update Position\n createEffect(() => marker?.setLngLat(update.lngLat))\n\n // Update Draggable\n createEffect(() => marker?.setDraggable(update.draggable))\n\n // Remove Marker\n onCleanup(() => marker?.remove())\n\n return null\n}\n","import { onCleanup, createEffect, Component, splitProps } from 'solid-js'\nimport { useMapContext } from '../MapProvider'\nimport type { Popup as PopupType, PopupOptions, LngLatLike } from 'mapbox-gl'\n\ntype Props = {\n /** Options for configuring the popup */\n options?: PopupOptions\n /** Flag for tracking the mouse pointer */\n trackPointer?: boolean\n /** Longitude and latitude for the popup */\n lngLat?: LngLatLike\n /** Callback for when the popup is opened */\n onOpen?: () => void\n /** Callback for when the popup is closed */\n onClose?: () => void\n /** Children to display within the popup */\n children?: any\n}\n\nexport const Popup: Component<Props> = (props: Props) => {\n if (!props.trackPointer && !props.lngLat)\n throw new Error('Popup - lngLat or trackPointer is required')\n\n const [update, create] = splitProps(props, [\n 'lngLat',\n 'children',\n 'trackPointer',\n ])\n const [ctx] = useMapContext()\n let popup: PopupType | undefined\n\n // Update Popup\n createEffect(() => {\n if (!ctx.map) return\n popup?.remove()\n popup = new window.MAPLIB.Popup({\n closeOnClick: false,\n focusAfterOpen: false,\n ...create.options,\n })\n .on('open', () => create.onOpen?.())\n .on('close', () => create.onClose?.())\n .addTo(ctx.map)\n\n // Update Position\n createEffect(() =>\n update.trackPointer\n ? popup.trackPointer()\n : popup.setLngLat(update.lngLat)\n )\n\n // Update Content\n createEffect(() =>\n typeof update.children === 'string'\n ? popup.setHTML(update.children)\n : popup.setDOMContent(update.children)\n )\n })\n\n // Remove Popup\n onCleanup(() => popup?.remove())\n\n return null\n}\n","import {\n onCleanup,\n createSignal,\n createEffect,\n VoidComponent,\n untrack,\n} from 'solid-js'\nimport { useMapContext } from '../MapProvider'\nimport type {\n StyleImageInterface,\n StyleImageMetadata,\n} from 'mapbox-gl/src/style/style_image'\n\nconst PATTERN = {\n diagonal_l: { size: 20, path: 'M20 0 0 20M-10 10 10-10M10 30 30 10' },\n diagonal_r: { size: 20, path: 'M0 0 20 20M30 10 10-10M10 30-10 10' },\n horizontal: { size: 14, path: 'M7 0V20' },\n vertical: { size: 14, path: 'M0 7H20' },\n cross: { size: 18, path: 'M9 0V18M0 9H18' },\n hash: { size: 30, path: 'M15 0 30 15 15 30 0 15Z' },\n chevron_h: { size: 20, path: 'M-5 5 0 10 10 0 20 10 25 5M0 30 10 20 20 30' },\n chevron_v: { size: 20, path: 'M5-5 10 0 0 10 10 20 5 25M25 15 20 10 25 5' },\n square: { size: 20, path: 'M8 8H12V12H8Z', fill: true },\n hex: { size: 50, path: 'M0 0V50L50 25ZM50 0V50L0 25ZM25 0V50' },\n circle: {\n size: 25,\n path: 'M8 10A2.5 2.5 0 118.01 10M18 15A2.5 2.5 0 1018.01 15',\n fill: true,\n },\n}\n\nexport const patternList = Object.keys(PATTERN)\n\nexport type Color =\n | `#${string}`\n | `rgb(${number}, ${number}, ${number})`\n | `rgba(${number}, ${number}, ${number}, ${number})`\n | `hsl(${number}, ${number}%, ${number}%)`\n | `hsla(${number}, ${number}%, ${number}%, ${number})`\n\ntype Props = {\n id: string\n /** The unique identifier for the image. */\n source?:\n | HTMLImageElement\n | ImageBitmap\n | ImageData\n | SVGElement\n | { width: number; height: number; data: Uint8Array | Uint8ClampedArray }\n | StyleImageInterface\n | string\n /** The image to be used for the image component. */\n options?: StyleImageMetadata & {\n fill?: Color\n stroke?: Color\n transform?: string\n }\n /** The options for the image */\n pattern?: {\n type: string\n color: Color\n background: Color\n lineWith: number\n }\n /** The pattern to be used for the image component. */\n}\n\nexport const MGL_Image: VoidComponent<Props> = props => {\n const [ctx] = useMapContext()\n const [size, setSize] = createSignal({ width: 0, height: 0 })\n\n const debug = (text, value?) => {\n ctx.map.debug &&\n console.debug('%c[MapGL]', 'color: #10b981', text, value || '')\n }\n\n // Remove Image\n onCleanup(() => {\n ctx.map?.hasImage(props.id) && ctx.map?.removeImage(props.id)\n debug('Remove Image:', props.id)\n })\n\n // Add or Update Image\n createEffect(() => {\n if (!props.id) throw new Error('Image - ID is required')\n if (!props.source && !props.pattern)\n throw new Error('Image - Image or Pattern is required')\n\n const ops = props.pattern\n ? { pixelRatio: 2, ...props.options }\n : props.options\n\n _loadImage(props.source || _createPattern(props.pattern), data => {\n const { width, height } = data\n if (ctx.map && !ctx.map.hasImage(props.id))\n ctx.map.addImage(props.id, data, ops)\n if (\n !props.pattern &&\n untrack(() => width === size().width && height === size().height)\n ) {\n ctx.map.updateImage(props.id, data)\n ctx.map.triggerRepaint()\n } else {\n ctx.map.removeImage(props.id)\n ctx.map.addImage(props.id, data, ops)\n }\n setSize({ width, height })\n debug('Add Image:', props.id)\n ctx.map.on('style.load', () => {\n if (ctx.map.hasImage(props.id)) return\n ctx.map.addImage(props.id, data, ops)\n debug('Re-Add Image:', props.id)\n })\n })\n })\n\n // Load Image / SVG\n const _loadImage = (image, callback) => {\n if (typeof image == 'string' && image?.trimStart().startsWith('<svg')) {\n image = new DOMParser().parseFromString(image, 'image/svg+xml')\n .childNodes[0]\n }\n if (image instanceof SVGElement) {\n props.options?.fill && image.setAttribute('fill', props.options.fill)\n props.options?.stroke &&\n image.setAttribute('stroke', props.options.stroke)\n image = new XMLSerializer().serializeToString(image)\n }\n if (typeof image !== 'string') return callback(image)\n ctx.map.loadImage(image, async (error, imageData) => {\n if (error) {\n if (typeof image == 'string' && image?.trimEnd().endsWith('.svg')) {\n image = await (await fetch(image)).text()\n image = new DOMParser().parseFromString(image, 'image/svg+xml')\n .childNodes[0]\n image.setAttribute('fill', props.options.fill)\n image.setAttribute('stroke', props.options.stroke)\n image.setAttribute('transform', props.options.transform)\n image = new XMLSerializer().serializeToString(image)\n }\n const img = new Image()\n img.crossOrigin = 'Anonymous'\n img.onload = () => {\n const canvas = document.createElement('canvas')\n canvas.width = Math.max(img.width, 50)\n canvas.height = Math.max(img.height, 50)\n const ctx = canvas.getContext('2d')\n ctx.imageSmoothingEnabled = true\n ctx.drawImage(img, 0, 0, canvas.width, canvas.height)\n return callback(ctx.getImageData(0, 0, canvas.width, canvas.height))\n }\n img.src = image.trimStart().startsWith('<svg')\n ? 'data:image/svg+xml;charset=utf-8,' + image\n : image\n } else {\n return callback(imageData)\n }\n })\n }\n\n const _createPattern = pattern => {\n const p = PATTERN[pattern.type]\n return {\n width: p.size,\n height: p.size,\n data: new Uint8Array(p.size * p.size * 4),\n onAdd: function () {\n let canvas = document.createElement('canvas')\n canvas.width = canvas.height = p.size\n this.ctx = canvas.getContext('2d', { willReadFrequently: true })\n },\n render: function () {\n this.ctx.fillStyle = pattern.background || 'transparent'\n this.ctx.fillRect(0, 0, this.width, this.height)\n this.ctx.strokeStyle = this.ctx.fillStyle = pattern.color || 'black'\n this.ctx.lineWidth = pattern.lineWith || 1\n this.ctx.stroke(new Path2D(p.path))\n if (p.fill) this.ctx.fill(new Path2D(p.path))\n this.data = this.ctx.getImageData(0, 0, this.width, this.height).data\n return true\n },\n }\n }\n\n return null\n}\n","import { createEffect, Component, onCleanup, createSignal } from 'solid-js'\nimport { useMapContext } from '../MapProvider'\nimport type { LngLatLike } from 'mapbox-gl'\n\n// linearly interpolate between two positions [x,y,z] based on time\nconst lerp = (a: number[], b: number[], t: number): number[] =>\n a.map((_, idx) => (1.0 - t) * a[idx] + t * b[idx])\n\n// sphericaly interpolate between two positions [x,y,z] based on time\nconst slerp = (a: number[], b: number[], t: number): number[] => {\n const dotProduct = a.map((_, idx) => a[idx] * b[idx]).reduce((m, n) => m + n)\n const theta = Math.acos(dotProduct)\n\n return a.map(\n (_, idx) =>\n (Math.sin((1 - t) * theta) / Math.sin(theta)) * a[idx] +\n (Math.sin(t * theta) / Math.sin(theta)) * b[idx]\n )\n}\n\n// calculations from: https://easings.net\nconst easeQuad = {\n in: (x: number): number => x * x,\n out: (x: number): number => 1 - (1 - x) * (1 - x),\n inOut: (x: number): number =>\n x < 0.5 ? 2 * x * x : 1 - Math.pow(-2 * x + 2, 2) / 2,\n}\n\n/** Options for rotating the globe. */\ninterface RotateGlobeOptions {\n /** The number of seconds per revolution. */\n secPerRev?: number\n /** The maximum zoom level for spinning the globe. */\n maxSpinZoom?: number\n /** The zoom level at which the spinning slows down. */\n slowSpinZoom?: number\n}\n\n/** Options for rotating the viewport. */\ninterface RotateViewportOptions {\n /** The number of seconds per revolution. */\n secPerRev?: number\n /** The pitch angle in degrees. */\n pitch?: number\n /** The center of rotation. */\n around?: LngLatLike\n}\n\n/** Props for the component. */\ntype Props = {\n /** Whether to rotate the globe. */\n rotateGlobe?: boolean | RotateGlobeOptions\n /** Whether to rotate the viewport. */\n rotateViewport?: boolean | RotateViewportOptions\n /** Whether to reverse the rotation direction. */\n reverse?: boolean\n /** Whether to reset the rotation when stopped. */\n resetWhenStopped?: boolean\n /** Translation options. */\n translate?: {\n /** The type of translation. */\n type?: 'line' | 'sphere'\n /** The starting position. */\n start: [number, number, number]\n /** The ending position. */\n end: [number, number, number]\n /** The target position. */\n target: LngLatLike\n /** The ending target position. */\n targetEnd?: LngLatLike\n /** The easing function to use. */\n easing?: 'in' | 'out' | 'inOut'\n /** Whether to loop the translation. */\n loop?: boolean\n /** The duration of the translation in milliseconds. */\n duration: number\n }\n /** The children to render. */\n children?: any\n}\n\nexport const Camera: Component<Props> = (props) => {\n const [ctx] = useMapContext()\n let animationTime = 0.1\n let isReverse = false\n\n // Handle User Interaction\n const [userInteraction, setUserInteraction] = createSignal(false)\n ;['mousedown', 'touchstart', 'wheel'].forEach((event) =>\n ctx.map.on(event, (evt) => !evt.rotate && setUserInteraction(true))\n )\n ;['moveend', 'mouseup', 'touchend'].forEach((event) =>\n ctx.map.on(event, (evt) => !evt.rotate && setUserInteraction(false))\n )\n\n const updateCameraPosition = async (\n [lng, lat, alt]: number[],\n target: LngLatLike\n ) => {\n const camera = ctx.map.getFreeCameraOptions()\n camera.position = window.MapLib.MercatorCoordinate.fromLngLat(\n [lng, lat],\n alt\n )\n camera.lookAtPoint(target)\n ctx.map.setFreeCameraOptions(camera)\n }\n\n const frame = () => {\n props.translate && window.requestAnimationFrame(frame)\n const params = [\n props.translate.start,\n props.translate.end,\n props.translate.easing\n ? easeQuad[props.translate.easing](animationTime)\n : animationTime,\n ] as const\n const position =\n props.translate.type === 'line' ? lerp(...params) : slerp(...params)\n\n updateCameraPosition(position, props.translate.target)\n\n if (!props.translate.loop && (animationTime > 1.0 || animationTime < 0.0))\n isReverse = !isReverse\n animationTime = isReverse ? animationTime - 0.001 : animationTime + 0.001\n }\n\n createEffect(() => {\n props.translate && window.requestAnimationFrame(frame)\n })\n\n const options = { duration: 1000, easing: (n) => n }\n\n const rotateGlobe = (): void => {\n if (userInteraction()) return\n const {\n secPerRev = 120,\n maxSpinZoom = 5,\n slowSpinZoom = 3,\n }: RotateGlobeOptions = props.rotateGlobe as RotateGlobeOptions\n\n const zoom: number = ctx.map.getZoom()\n if (zoom > maxSpinZoom) return\n let distancePerSecond: number = 360 / secPerRev\n if (zoom > slowSpinZoom)\n distancePerSecond *= (maxSpinZoom - zoom) / (maxSpinZoom - slowSpinZoom)\n const center: mapboxgl.LngLat = ctx.map.getCenter()\n center.lng = props.reverse\n ? center.lng + distancePerSecond\n : center.lng - distancePerSecond\n ctx.map.easeTo({ center, ...options }, { rotate: true })\n }\n\n const rotateViewport = (): void => {\n if (!props.rotateViewport || userInteraction()) {\n ctx.map.stop()\n return\n }\n const rotateViewport = props.rotateViewport as RotateViewportOptions\n const secPerRev = rotateViewport?.secPerRev || 60\n const bearing = props.reverse\n ? ctx.map.getBearing() + 360 / secPerRev\n : ctx.map.getBearing() - 360 / secPerRev\n const pitch = rotateViewport?.pitch || 60\n const around = rotateViewport?.around\n ctx.map.easeTo({ bearing, pitch, around, ...options }, { rotate: true })\n }\n\n const onEnd = () => (props.rotateGlobe ? rotateGlobe() : rotateViewport())\n ctx.map.on('moveend', onEnd).on('dragend', onEnd)\n\n let originalCenter: mapboxgl.LngLatLike\n createEffect(() => {\n if (props.rotateGlobe == undefined) return\n if (props.rotateGlobe) {\n originalCenter = ctx.map.getCenter()\n rotateGlobe()\n } else {\n props.resetWhenStopped\n ? ctx.map.stop().easeTo({ center: originalCenter })\n : ctx.map.stop()\n }\n })\n\n createEffect(() => {\n if (props.rotateViewport == undefined) return\n props.rotateViewport\n ? rotateViewport()\n : props.resetWhenStopped\n ? ctx.map.stop().resetNorthPitch()\n : ctx.map.stop()\n })\n\n onCleanup(() => ctx.map.off('moveend', onEnd).off('dragend', onEnd))\n\n return props.children\n}\n","import { onCleanup, createEffect, VoidComponent } from 'solid-js'\nimport { useMapContext } from '../MapProvider'\nimport type { Light as LightSpecification } from 'mapbox-gl'\n\ntype Props = {\n /** Light Specifications */\n style: LightSpecification\n}\nexport const Light: VoidComponent<Props> = (props: Props) => {\n const [ctx] = useMapContext()\n\n // Add or Update Light Layer\n createEffect(() => ctx.map.setLight(props.style || {}))\n\n // Remove Light Layer\n onCleanup(() => ctx.map?.setLight(null))\n\n return null\n}\n","import { onCleanup, VoidComponent } from 'solid-js'\nimport { useMapContext } from '../MapProvider'\nimport { drawEvents } from '../../events'\nimport type { drawEventTypes } from '../../events'\n\ntype Props = {\n /** Draw Library */\n lib: any\n /** Draw Options */\n options?: object\n /** Draw Control Position */\n position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'\n /** Draw Control Instance */\n getInstance?: (object) => void\n} & drawEventTypes\n\nexport const Draw: VoidComponent<Props> = (props: Props) => {\n const [ctx] = useMapContext()\n\n // Add Draw Control\n const draw = new props.lib(props.options)\n ctx.map.addControl(draw, props.position || 'top-right')\n props.getInstance && props.getInstance(draw)\n\n // Hook up events\n const eventList: Record<string, (evt: any) => void> = {}\n drawEvents.forEach(item => {\n if (props[item]) {\n const event = `draw.${item.slice(2).toLowerCase()}`\n const fn = evt => props[item](evt)\n eventList[event] = fn\n ctx.map.on(event, fn)\n }\n })\n\n // Remove Draw Control\n onCleanup(() => {\n // Remove Events\n Object.keys(eventList).forEach(event => ctx.map.off(event, eventList[event]))\n // Remove Control\n ctx.map?.removeControl(draw)\n })\n\n return null\n}\n"],"names":["state","setState","createStore","map","MapContext","createContext","useMapContext","useContext","MapProvider","props","_$createComponent","Provider","value","children","mapEvents","layerEvents","drawEvents","mapBase","gitBase","gishub","hereBase","vectorStyleList","mb","standard","light","dark","street","outdoor","sat","sat_street","nav_base","nav_base_night","nav","nav_night","basic","monochrome","leshine","icecream","cali","northstar","mineral","moonlight","frank","minimo","decimal","stand","blueprint","bubble","pencil","swiss_ski","vintage","whaam","neon","camoflauge","emerald","runner","x_ray","here","base","day","night","esri","charted_territory","colored_pencil","community","mid_century","modern_antique","nat_geo","newspaper","open_street_map","light_gray_canvas","dark_gray_canvas","human_geo_light","human_geo_dark","world_navigation","world_street","world_street_night","world_terrain","world_terrain_hybrid","world_topographic","chromium","dreamcatcher","seahaven","sangria","mercurial","imagery","imagery_hybrid","firefly","firefly_hybrid","oceans","carto","stamen","tf","rasterStyleList","osm","org","human","cycle","topo","_copy","voyager","positron","toner","toner_lite","watercolor","terrain","trans","trans_dark","landscape","outdoors","neighbourhood","spinal","pioneer","atlas","mobile","MapGL","mapRef","resizeObserver","mutationObserver","mapLoaded","setMapLoaded","createSignal","darkMode","setDarkMode","window","matchMedia","matches","document","body","classList","contains","internal","setInternal","debug","text","debugEvents","console","getStyle","style","String","split","reduce","p","c","replace","apikey","env","VITE_VECTOR_API_KEY","onMount","async","mapLib","import","Map","supported","Error","version","accessToken","options","VITE_MAPBOX_ACCESS_TOKEN","interactive","onViewportChange","viewport","projection","container","darkStyle","fitBoundsOptions","padding","sourceIdList","layerIdList","MapLib","forEach","item","prop","event","slice","toLowerCase","on","evt","setTimeout","clickOnLayer","Object","keys","layerId","once","rotate","onUserInteraction","darkTheme","addEventListener","toString","MutationObserver","observe","attributes","disableResize","ResizeObserver","resize","createEffect","key","config","id","setConfigProperty","point","x","originalEvent","y","center","lat","getCenter","lng","zoom","getZoom","pitch","getPitch","bearing","getBearing","inTransit","bounds","vp","cameraForBounds","stop","transitionType","defer","proj","setProjection","cur","cursorStyle","getCanvas","cursor","prev","isStyleLoaded","oldStyle","oldLayers","layers","filter","l","includes","oldSources","sources","s","obj","setStyle","newStyle","insertLayers","list","layer","index","findIndex","i","metadata","smg","beforeType","type","beforeId","fog","onCleanup","disconnect","remove","_el$","_tmpl$","_$use","_$insert","_c$","_$memo","_el$2","setProperty","_$effect","_p$","_v$","_v$2","class","_v$3","_v$4","position","inset","e","_$setAttribute","t","_$className","a","_$classList","o","_$style","undefined","SourceContext","useSourceId","Source","ctx","createUniqueId","lookup","url","source","tiles","VITE_RASTER_API_KEY","devicePixelRatio","attribution","addSource","push","getSource","data","isSourceLoaded","setData","coords","coordinates","updateImage","setUrl","setTiles","src","removeLayer","removeSource","baseStyle","layoutStyles","diff","newProps","prevProps","Set","acc","newKey","startsWith","updateStyle","layout","paint","entries","nk","Layer","sourceId","customLayer","addLayer","slot","find","fire","debugEvent","setLayoutProperty","validate","setPaintProperty","minzoom","maxzoom","setLayerZoomRange","setFilter","visible","featureState","removeFeatureState","sourceLayer","setFeatureState","getLayer","Layer3D","worldOriginMercator","MercatorCoordinate","fromLngLat","origin","worldScale","meterInMercatorCoordinateUnits","worldMatrix","BABYLON","THREE","babylon","Matrix","Compose","Vector3","Quaternion","FromEulerAngles","Math","PI","z","translateX","translateY","translateZ","rotateX","rotateY","rotateZ","scale","renderingMode","onAdd","gl","engine","Engine","useHighPrecisionMatrix","this","scene","Scene","autoClear","detachControl","beforeRender","wipeCaches","activeCamera","Camera","defaultLight","HemisphericLight","camera","DirectionalLight","set","normalize","add","renderer","WebGLRenderer","canvas","context","antialias","render","matrix","freezeProjectionMatrix","multiply","FromArray","getFreeCameraOptions","TransformCoordinates","getProjectionMatrix","clone","invert","rotationX","Matrix4","makeRotationAxis","rotationY","rotationZ","m","fromArray","makeTranslation","projectionMatrix","resetState","onRender","triggerRepaint","Atmosphere","setFog","Terrain","isMapLibre","tileSize","setTerrain","exaggeration","Control","update","create","splitProps","control","setControl","controlClasses","NavigationControl","ScaleControl","AttributionControl","GeolocateControl","FullscreenControl","LogoControl","TerrainControl","untrack","hasControl","removeControl","custom","get","addControl","Marker","lngLat","create_popup","create_marker","marker","popup","LNGLAT","Popup","closeOnClick","focusAfterOpen","onOpen","onClose","setHTML","setDOMContent","setPopup","showPopup","isOpen","togglePopup","onDragStart","onDragEnd","onDrag","getLngLat","toArray","setLngLat","addTo","setDraggable","draggable","trackPointer","MAPLIB","PATTERN","diagonal_l","size","path","diagonal_r","horizontal","vertical","cross","hash","chevron_h","chevron_v","square","fill","hex","circle","patternList","MGL_Image","setSize","width","height","hasImage","removeImage","pattern","ops","pixelRatio","_loadImage","_createPattern","addImage","image","callback","trimStart","DOMParser","parseFromString","childNodes","SVGElement","setAttribute","stroke","XMLSerializer","serializeToString","loadImage","error","imageData","trimEnd","endsWith","fetch","transform","img","Image","crossOrigin","onload","createElement","max","getContext","imageSmoothingEnabled","drawImage","getImageData","Uint8Array","willReadFrequently","fillStyle","background","fillRect","strokeStyle","color","lineWidth","lineWith","Path2D","easeQuad","in","out","inOut","pow","animationTime","isReverse","userInteraction","setUserInteraction","frame","translate","requestAnimationFrame","params","start","end","easing","alt","target","lookAtPoint","setFreeCameraOptions","updateCameraPosition","lerp","b","_","idx","slerp","dotProduct","n","theta","acos","sin","loop","duration","rotateGlobe","secPerRev","maxSpinZoom","slowSpinZoom","distancePerSecond","reverse","easeTo","rotateViewport","around","onEnd","originalCenter","resetWhenStopped","resetNorthPitch","off","Light","setLight","Draw","draw","lib","getInstance","eventList","fn"],"mappings":"kYAIA,MAAOA,EAAOC,GAAYC,EAAY,CAAEC,IAAK,OAEhCC,EAAaC,EAAc,CAACL,IAE5BM,EAAgBA,IAAMC,EAAWH,GAEjCI,EAEPC,IACJA,EAAMN,KAAOF,EAAS,MAAOQ,EAAMN,KAEnCO,EACGN,EAAWO,SAAQ,CAACC,MAAO,CAACZ,GAAM,YAAAa,GAAA,OAAGJ,EAAMI,QAAQ,KC4ClDC,EAAsB,CAC1B,cACA,YACA,cACA,aACA,cACA,eACA,eACA,aACA,UACA,aACA,gBACA,eACA,aACA,gBACA,UACA,WACA,WACA,cACA,cACA,SACA,YACA,cACA,SACA,YACA,cACA,SACA,YACA,gBACA,WACA,aACA,eACA,UACA,aACA,iBACA,eACA,kBACA,qBACA,yBACA,SACA,WACA,SACA,UACA,SACA,cACA,eACA,gBACA,qBACA,sBACA,uBAgCIC,EAAqB,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1R,KAAKsb,cAAcqJ,EAAK,IAGvB,IAAI"}
@@ -65,8 +65,10 @@ export const Camera = (props) => {
65
65
  ctx.map.easeTo({ center, ...options }, { rotate: true });
66
66
  };
67
67
  const rotateViewport = () => {
68
- if (!props.rotateViewport || userInteraction())
68
+ if (!props.rotateViewport || userInteraction()) {
69
+ ctx.map.stop();
69
70
  return;
71
+ }
70
72
  const rotateViewport = props.rotateViewport;
71
73
  const secPerRev = rotateViewport?.secPerRev || 60;
72
74
  const bearing = props.reverse
@@ -50,6 +50,7 @@ export const Layer = (props) => {
50
50
  ...updateStyle(props.style),
51
51
  id: props.id,
52
52
  source: sourceId,
53
+ slot: props.slot || '',
53
54
  metadata: {
54
55
  smg: { beforeType: props.beforeType, beforeId: props.beforeId },
55
56
  },
@@ -1,39 +1,39 @@
1
- import { createSignal, createEffect, onMount, onCleanup, createUniqueId, on, } from 'solid-js';
2
- import { MapProvider } from '../MapProvider';
3
- import { mapEvents } from '../../events';
4
- import { vectorStyleList } from '../../mapStyles';
1
+ import { createSignal, createEffect, onMount, onCleanup, on, } from "solid-js";
2
+ import { MapProvider } from "../MapProvider";
3
+ import { mapEvents } from "../../events";
4
+ import { vectorStyleList } from "../../mapStyles";
5
5
  /** Creates a new Map Container */
6
6
  export const MapGL = (props) => {
7
- props.id ??= createUniqueId();
7
+ // props.id ??= createUniqueId()
8
8
  let map;
9
9
  let mapRef;
10
10
  let resizeObserver;
11
11
  let mutationObserver;
12
12
  const [mapLoaded, setMapLoaded] = createSignal(null);
13
- const [darkMode, setDarkMode] = createSignal((typeof window !== 'undefined' &&
14
- window.matchMedia('(prefers-color-scheme: dark)').matches) ||
15
- (typeof document !== 'undefined' &&
16
- document.body.classList.contains('dark')));
13
+ const [darkMode, setDarkMode] = createSignal((typeof window !== "undefined" &&
14
+ window.matchMedia("(prefers-color-scheme: dark)").matches) ||
15
+ (typeof document !== "undefined" &&
16
+ document.body.classList.contains("dark")));
17
17
  const [internal, setInternal] = createSignal(false);
18
18
  const debug = (text, value) => (props.debug || props.debugEvents) &&
19
- console.debug('%c[MapGL]', 'color: #0ea5e9', text, value || '');
19
+ console.debug("%c[MapGL]", "color: #0ea5e9", text, value || "");
20
20
  const getStyle = (light, dark) => {
21
21
  const style = darkMode() && dark ? dark : light;
22
- return typeof style === 'string' || style instanceof String
22
+ return typeof style === "string" || style instanceof String
23
23
  ? style
24
- ?.split(':')
24
+ ?.split(":")
25
25
  .reduce((p, c) => p && p[c], vectorStyleList)
26
- ?.replace('{apikey}',
26
+ ?.replace("{apikey}",
27
27
  //@ts-ignore
28
28
  props.apikey || import.meta.env.VITE_VECTOR_API_KEY) || style
29
- : style || { version: 8, sources: {}, layers: [] };
29
+ : style;
30
30
  };
31
31
  onMount(async () => {
32
- let mapLib = props.mapLib || (await import('mapbox-gl'));
32
+ let mapLib = props.mapLib || (await import("mapbox-gl"));
33
33
  if (!mapLib.Map)
34
- mapLib = window['maplibregl'] || window['mapboxgl'];
35
- if (typeof mapLib.supported === 'function' && !mapLib.supported())
36
- throw new Error('Mapbox GL not supported');
34
+ mapLib = window["maplibregl"] || window["mapboxgl"];
35
+ if (typeof mapLib.supported === "function" && !mapLib.supported())
36
+ throw new Error("Mapbox GL not supported");
37
37
  debug(`Map (v${mapLib.version}) loading...`);
38
38
  map = new mapLib.Map({
39
39
  accessToken:
@@ -57,7 +57,7 @@ export const MapGL = (props) => {
57
57
  const prop = props[item];
58
58
  if (prop) {
59
59
  const event = item.slice(2).toLowerCase();
60
- if (typeof prop === 'function') {
60
+ if (typeof prop === "function") {
61
61
  map.on(event, (evt) => {
62
62
  setTimeout(() => {
63
63
  if (evt.clickOnLayer)
@@ -82,34 +82,49 @@ export const MapGL = (props) => {
82
82
  }
83
83
  }
84
84
  });
85
- map.once('load', () => {
85
+ map.once("load", () => {
86
86
  setMapLoaded(map);
87
- debug('Map loaded');
88
- ['mousedown', 'touchstart', 'wheel'].forEach((event) => map.on(event, (evt) => !evt.rotate && props.onUserInteraction?.(true)));
89
- ['moveend', 'mouseup', 'touchend'].forEach((event) => map.on(event, (evt) => !evt.rotate && props.onUserInteraction?.(false)));
87
+ debug("Map loaded");
88
+ // Handle User Interaction
89
+ ["mousedown", "touchstart", "wheel"].forEach((event) => map.on(event, (evt) => !evt.rotate && props.onUserInteraction?.(true)));
90
+ ["moveend", "mouseup", "touchend"].forEach((event) => map.on(event, (evt) => !evt.rotate && props.onUserInteraction?.(false)));
90
91
  // Listen to dark theme changes
91
- const darkTheme = typeof window !== 'undefined' &&
92
- window?.matchMedia('(prefers-color-scheme: dark)');
93
- darkTheme?.addEventListener('change', () => {
92
+ const darkTheme = typeof window !== "undefined" &&
93
+ window?.matchMedia("(prefers-color-scheme: dark)");
94
+ darkTheme?.addEventListener("change", () => {
94
95
  setDarkMode(darkTheme.matches);
95
- debug('Set dark theme to:', darkTheme.matches?.toString());
96
+ debug("Set dark theme to:", darkTheme.matches?.toString());
96
97
  });
97
98
  mutationObserver = new MutationObserver(() => {
98
- const darkTheme = document.body.classList.contains('dark');
99
+ const darkTheme = document.body.classList.contains("dark");
99
100
  setDarkMode(darkTheme);
100
- debug('Set theme to:', darkTheme);
101
+ debug("Set theme to:", darkTheme);
101
102
  });
102
103
  mutationObserver.observe(document.body, { attributes: true });
103
104
  // Listen to map container size changes
104
- // if (!props.disableResize) {
105
- // resizeObserver = new ResizeObserver(() => {
106
- // map?.resize()
107
- // debug('Map resized')
108
- // })
109
- // resizeObserver.observe(mapRef as Element)
110
- // }
105
+ if (!props.disableResize) {
106
+ resizeObserver = new ResizeObserver(() => {
107
+ setTimeout(() => {
108
+ map?.resize();
109
+ }, 0);
110
+ debug("Map resized");
111
+ });
112
+ resizeObserver.observe(mapRef);
113
+ }
114
+ // Update Configuration
115
+ createEffect(() => {
116
+ for (const key in props.config) {
117
+ if (!key || key === "id")
118
+ continue;
119
+ const id = props.config?.id || "basemap";
120
+ const value = props.config[key];
121
+ //@ts-ignore
122
+ map?.setConfigProperty(id, key, value);
123
+ debug(`Set Config (${id}:${key}) to:`, value);
124
+ }
125
+ });
111
126
  // Update Viewport
112
- map.on('move', (event) => {
127
+ map.on("move", (event) => {
113
128
  const viewport = {
114
129
  ...props.viewport,
115
130
  id: props.id,
@@ -125,11 +140,25 @@ export const MapGL = (props) => {
125
140
  bearing: map.getBearing(),
126
141
  inTransit: true,
127
142
  bounds: null,
143
+ // !internal()
144
+ // ? props.viewport?.center?.lat
145
+ // ? map.getBounds()
146
+ // : [
147
+ // [
148
+ // map.getBounds().getNorthEast().lng,
149
+ // map.getBounds().getNorthEast().lat,
150
+ // ],
151
+ // [
152
+ // map.getBounds().getSouthWest().lng,
153
+ // map.getBounds().getSouthWest().lat,
154
+ // ],
155
+ // ]
156
+ // : null,
128
157
  };
129
158
  setInternal(true);
130
159
  !event.viewport && props.onViewportChange?.(viewport);
131
160
  });
132
- map.on('moveend', (event) => {
161
+ map.on("moveend", (event) => {
133
162
  !event.rotate &&
134
163
  props.onViewportChange?.({ ...props.viewport, inTransit: false });
135
164
  setInternal(false);
@@ -144,12 +173,14 @@ export const MapGL = (props) => {
144
173
  ...vp,
145
174
  ...(vp.bounds
146
175
  ? map.cameraForBounds(vp.bounds, {
176
+ bearing: vp?.bearing,
177
+ pitch: vp?.pitch,
147
178
  padding: vp?.padding,
148
179
  })
149
180
  : null),
150
181
  };
151
- map.stop()[props.transitionType || 'flyTo'](viewport);
152
- debug(`Update Viewport (${props.transitionType || 'flyTo'}):`, viewport);
182
+ map.stop()[props.transitionType || "flyTo"](viewport);
183
+ debug(`Update Viewport (${props.transitionType || "flyTo"}):`, viewport);
153
184
  }, { defer: true }));
154
185
  // Update Projection
155
186
  createEffect(() => {
@@ -157,7 +188,7 @@ export const MapGL = (props) => {
157
188
  if (!map || !proj)
158
189
  return;
159
190
  map.setProjection(proj);
160
- debug('Set Projection to:', proj);
191
+ debug("Set Projection to:", proj);
161
192
  });
162
193
  // Update Cursor
163
194
  createEffect(() => {
@@ -165,7 +196,7 @@ export const MapGL = (props) => {
165
196
  if (!map || !cur)
166
197
  return;
167
198
  map.getCanvas().style.cursor = cur;
168
- debug('Set Cursor to:', cur);
199
+ debug("Set Cursor to:", cur);
169
200
  });
170
201
  const insertLayers = (list, layers) => {
171
202
  layers.forEach((layer) => {
@@ -189,7 +220,7 @@ export const MapGL = (props) => {
189
220
  .filter((s) => map.sourceIdList.includes(s))
190
221
  .reduce((obj, key) => ({ ...obj, [key]: oldStyle.sources[key] }), {});
191
222
  map.setStyle(style);
192
- map.once('styledata', () => {
223
+ map.once("styledata", () => {
193
224
  if (!oldLayers)
194
225
  return;
195
226
  const newStyle = map.getStyle();
@@ -200,17 +231,18 @@ export const MapGL = (props) => {
200
231
  fog: oldStyle.fog,
201
232
  terrain: oldStyle.terrain,
202
233
  });
203
- debug('Set Mapstyle to:', style);
234
+ debug("Set Mapstyle to:", style);
204
235
  });
205
236
  }
206
237
  return style;
207
238
  }, props.options?.style);
239
+ // Update debug features
208
240
  [
209
- 'showTileBoundaries',
210
- 'showTerrainWireframe',
211
- 'showCollisionBoxes',
212
- 'showPadding',
213
- 'showOverdrawInspector',
241
+ "showTileBoundaries",
242
+ "showTerrainWireframe",
243
+ "showCollisionBoxes",
244
+ "showPadding",
245
+ "showOverdrawInspector",
214
246
  ].forEach((item) => {
215
247
  createEffect(() => {
216
248
  const prop = props[item];
@@ -224,16 +256,17 @@ export const MapGL = (props) => {
224
256
  resizeObserver?.disconnect();
225
257
  mutationObserver?.disconnect();
226
258
  map?.remove();
227
- debug('Map removed');
259
+ debug("Map removed");
228
260
  });
229
- return (<>
230
- <div ref={mapRef} id={props.id} class={props?.class} classList={props?.classList} style={props?.class || props?.classList
261
+ return (<div ref={mapRef} id={props.id} class={props?.class} classList={props?.classList} style={props?.class || props?.classList
231
262
  ? null
232
263
  : props.style || {
233
- position: 'absolute',
264
+ position: "absolute",
234
265
  inset: 0,
235
- 'z-index': -1,
236
- }}/>
237
- {mapLoaded() && (<MapProvider map={mapLoaded()}>{props.children}</MapProvider>)}
238
- </>);
266
+ "z-index": -1,
267
+ }}>
268
+ {mapLoaded() && (<MapProvider map={mapLoaded()}>
269
+ <div style={{ position: "relative" }}>{props.children}</div>
270
+ </MapProvider>)}
271
+ </div>);
239
272
  };
@@ -4,14 +4,17 @@ const gishub = 'https://raw.githubusercontent.com/GIShub4/map-styles/main/';
4
4
  const hereBase = 'https://assets.vector.hereapi.com/styles/';
5
5
  export const vectorStyleList = {
6
6
  mb: {
7
+ standard: `${mapBase}/standard`,
7
8
  light: `${mapBase}/light-v11`,
8
9
  dark: `${mapBase}/dark-v11`,
9
10
  street: `${mapBase}/streets-v12`,
10
11
  outdoor: `${mapBase}/outdoors-v12`,
11
12
  sat: `${mapBase}/satellite-v9`,
12
13
  sat_street: `${mapBase}/satellite-streets-v12`,
13
- nav: `${mapBase}/navigation-guidance-day-v4`,
14
- nav_night: `${mapBase}/navigation-guidance-night-v4`,
14
+ nav_base: `${mapBase}/navigation-guidance-day-v4`,
15
+ nav_base_night: `${mapBase}/navigation-guidance-night-v4`,
16
+ nav: `${mapBase}/navigation-day-v1`,
17
+ nav_night: `${mapBase}/navigation-night-v1`,
15
18
  basic: `${mapBase}/cjf4m44iw0uza2spb3q0a7s41`,
16
19
  monochrome: `${mapBase}/cjv6rzz4j3m4b1fqcchuxclhb`,
17
20
  leshine: `${mapBase}/cjcunv5ae262f2sm9tfwg8i0w`,
@@ -23,7 +26,7 @@ export const vectorStyleList = {
23
26
  frank: `${mapBase}-map-design/ckshxkppe0gge18nz20i0nrwq`,
24
27
  minimo: `${mapBase}-map-design/cksjc2nsq1bg117pnekb655h1`,
25
28
  decimal: `${mapBase}-map-design/ck4014y110wt61ctt07egsel6`,
26
- standard: `${mapBase}-map-design/ckr0svm3922ki18qntevm857n`,
29
+ stand: `${mapBase}-map-design/ckr0svm3922ki18qntevm857n`,
27
30
  blueprint: `${mapBase}-map-design/cks97e1e37nsd17nzg7p0308g`,
28
31
  bubble: `${mapBase}-map-design/cksysy2nl62zp17quosctdtcc`,
29
32
  pencil: `${mapBase}-map-design/cks9iema71es417mlrft4go2k`,
@@ -15,6 +15,8 @@ type Props = {
15
15
  /** A boolean that determines whether the layer is visible or not. */
16
16
  sourceId?: string;
17
17
  /** A string that specifies the ID of the source that the layer uses for its data. */
18
+ slot?: string;
19
+ /** A string that specifies the slot to which the layer belongs. */
18
20
  beforeType?: 'background' | 'fill' | 'line' | 'symbol' | 'raster' | 'circle' | 'fill-extrusion' | 'heatmap' | 'hillshade' | 'sky';
19
21
  /** A string that specifies the type of layer before which the current layer should be inserted. */
20
22
  beforeId?: string;
@@ -1,12 +1,12 @@
1
- import { Component } from 'solid-js';
2
- import type { mapEventTypes } from '../../events';
3
- import type mapboxgl from 'mapbox-gl';
4
- import type { MapboxOptions } from 'mapbox-gl/src/ui/map';
5
- import type { LngLatLike } from 'mapbox-gl/src/geo/lng_lat.js';
6
- import type { LngLatBounds } from 'mapbox-gl/src/geo/lng_lat_bounds.js';
7
- import type { PaddingOptions } from 'mapbox-gl/src/geo/edge_insets.js';
8
- import type { StyleSpecification } from 'mapbox-gl/src/style-spec/types.js';
9
- import type { JSX } from 'solid-js';
1
+ import { Component } from "solid-js";
2
+ import type { mapEventTypes } from "../../events";
3
+ import type mapboxgl from "mapbox-gl";
4
+ import type { MapboxOptions } from "mapbox-gl/src/ui/map";
5
+ import type { LngLatLike } from "mapbox-gl/src/geo/lng_lat.js";
6
+ import type { LngLatBounds } from "mapbox-gl/src/geo/lng_lat_bounds.js";
7
+ import type { PaddingOptions } from "mapbox-gl/src/geo/edge_insets.js";
8
+ import type { StyleSpecification } from "mapbox-gl/src/style-spec/types.js";
9
+ import type { JSX } from "solid-js";
10
10
  declare global {
11
11
  interface Window {
12
12
  MapLib?: any;
@@ -49,8 +49,21 @@ type Props = {
49
49
  * @see https://docs.mapbox.com/mapbox-gl-js/api/map/#map-parameters
50
50
  */
51
51
  options?: MapboxOptions;
52
+ /** Mapbox Style Configuration
53
+ * @see https://docs.mapbox.com/mapbox-gl-js/guides/styles/#configure-a-style
54
+ */
55
+ config?: {
56
+ id?: string;
57
+ lightPreset?: "dawn" | "day" | "dusk" | "night";
58
+ showPlaceLabels?: boolean;
59
+ showRoadLabels?: boolean;
60
+ showPointOfInterestLabels?: boolean;
61
+ showTransitLabels?: boolean;
62
+ font?: string[];
63
+ [key: string]: boolean | string | string[];
64
+ };
52
65
  /** Type for pan, move and zoom transitions */
53
- transitionType?: 'flyTo' | 'easeTo' | 'jumpTo';
66
+ transitionType?: "flyTo" | "easeTo" | "jumpTo";
54
67
  /** Event listener for Viewport updates */
55
68
  onViewportChange?: (viewport: Viewport) => void;
56
69
  /** Event listener for User Interaction */
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.10.3",
2
+ "version": "1.10.5",
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.",
@@ -53,19 +53,19 @@
53
53
  ],
54
54
  "devDependencies": {
55
55
  "@rollup/plugin-terser": "^0.4.4",
56
- "@solidjs/testing-library": "^0.8.4",
57
- "@testing-library/jest-dom": "^6.1.5",
58
- "@types/mapbox-gl": "^2.7.19",
59
- "@vitest/coverage-v8": "^1.1.0",
60
- "jsdom": "^23.0.1",
56
+ "@solidjs/testing-library": "^0.8.6",
57
+ "@testing-library/jest-dom": "^6.4.2",
58
+ "@types/mapbox-gl": "^2.7.21",
59
+ "@vitest/coverage-v8": "^1.3.1",
60
+ "jsdom": "^24.0.0",
61
61
  "jsdom-worker": "^0.3.0",
62
- "rollup": "^4.9.1",
63
- "rollup-plugin-import-css": "^3.3.5",
62
+ "rollup": "^4.12.0",
63
+ "rollup-plugin-import-css": "^3.5.0",
64
64
  "rollup-preset-solid": "^2.0.1",
65
65
  "typescript": "^5.3.3",
66
- "vite": "^5.0.10",
67
- "vite-plugin-solid": "^2.8.0",
68
- "vitest": "^1.1.0"
66
+ "vite": "^5.1.4",
67
+ "vite-plugin-solid": "^2.10.1",
68
+ "vitest": "^1.3.1"
69
69
  },
70
70
  "peerDependencies": {
71
71
  "@babylonjs/core": "^6.24.0",