solid-map-gl 1.10.4 → 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,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,createUniqueId as m,createSignal as g,onMount as u,createEffect as h,on as y,onCleanup 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:{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:`${z}/navigation-guidance-day-v4`,nav_night:`${z}/navigation-guidance-night-v4`,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`,standard:`${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,w,f;p.id??=m();const[v,x]=g(null),[k,M]=g("undefined"!=typeof window&&window.matchMedia("(prefers-color-scheme: dark)").matches||"undefined"!=typeof document&&document.body.classList.contains("dark")),[L,j]=g(!1),C=(e,t)=>(p.debug||p.debugEvents)&&console.debug("%c[MapGL]","color: #0ea5e9",e,t||""),z=(e,t)=>{const o=k()&&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:o||"mapbox://styles/mapbox/standard"};u((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");C(`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:z(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&&C(`Map '${o}' event:`,e))}),0)})):Object.keys(t).forEach((e=>{c.on(o,e,(a=>{setTimeout((()=>{a.clickOnLayer||(t[e](a),p.debugEvents&&C(`Map '${o}' event on '${e}':`,a))}),0)}))}))}})),c.once("load",(()=>{x(c),C("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",(()=>{M(e.matches),C("Set dark theme to:",e.matches?.toString())})),f=new MutationObserver((()=>{const e=document.body.classList.contains("dark");M(e),C("Set theme to:",e)})),f.observe(document.body,{attributes:!0}),p.disableResize||(w=new ResizeObserver((()=>{setTimeout((()=>{c?.resize()}),0),C("Map resized")})),w.observe(d)),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};j(!0),!e.viewport&&p.onViewportChange?.(t)})),c.on("moveend",(e=>{!e.rotate&&p.onViewportChange?.({...p.viewport,inTransit:!1}),j(!1)}))}))})),h(y((()=>p.viewport),(e=>{if(p.id!==e?.id||L())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),C(`Update Viewport (${p.transitionType||"flyTo"}):`,t)}),{defer:!0})),h((()=>{const{importID:e,configName:t,value:o}=p.config||{};c&&t&&o&&(c.setConfigProperty(e||"basemap",t,o),C(`Set Config (${e}:${t}) to:`,o))})),h((()=>{const e=p.options?.projection;c&&e&&(c.setProjection(e),C("Set Projection to:",e))})),h((()=>{const e=p.cursorStyle;c&&e&&(c.getCanvas().style.cursor=e,C("Set Cursor to:",e))}));return h((e=>{const t=z(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}),C("Set Mapstyle to:",t)}))}return t}),p.options?.style),["showTileBoundaries","showTerrainWireframe","showCollisionBoxes","showPadding","showOverdrawInspector"].forEach((e=>{h((()=>{const t=p[e];c&&t&&(c[e]=t,C(`Set ${e} to:`,t))}))})),b((()=>{w?.disconnect(),f?.disconnect(),c?.remove(),C("Map removed")})),_=R(),"function"==typeof d?t(d,_):d=_,o(_,(E=a((()=>!!v())),()=>E()&&e($,{get map(){return v()},get children(){return p.children}}))),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(_,"id",e.e=t),o!==e.t&&i(_,e.t=o),e.a=s(_,a,e.a),e.o=l(_,n,e.o),e}),{e:void 0,t:void 0,a:void 0,o:void 0}),_;var E,_},q=c(),Z=()=>d(q),F=t=>{const[o]=L();t.id??=m();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":h((()=>{const e=t.source.data;o.map.isSourceLoaded(t.id)&&(r.setData(e||{}),a("Update GeoJSON Data:",t.id))}));break;case"image":h((()=>{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":h((()=>{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":h((()=>{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 b((()=>{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())),N=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}},H=e=>{const[t]=L(),o=e.style?.source||Z();e.id=e.id||e.customLayer?.id||m();const a=(e,o)=>{(t.map.debug||t.map.debugEvents)&&console.debug("%c[MapGL]","color: #10b981",e,o||"")};return t.map.addLayer(e.customLayer||{...N(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)}))}})),h((o=>{const n=N(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}),N(e.style)),h((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),h((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))})),h((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))})),b((()=>t.map?.getLayer(e.id)&&t.map?.removeLayer(e.id))),e.children},X=e=>{const[t]=L();return u((async()=>{e.id=e.id||m();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()}})})),b((()=>{t.map.getLayer(e.id)&&t.map.removeLayer(e.id)})),null},Y=e=>{const[t]=L();return h((()=>t.map.setFog(e.style||{}))),b((()=>t.map.setFog(null))),null},K=e=>{const[t]=L();let o=Z();return o||e?.source||(o=m(),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)),h((()=>{t.map.setTerrain({exaggeration:e.exaggeration||1,source:e?.source||o})})),b((()=>t.map?.setTerrain(null))),null},J=e=>{const[t]=L(),[o,a]=w(e,["position"]),[n,r]=g(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 h((()=>{f((()=>n()&&t.map.hasControl(n())&&t.map.removeControl(n()))),r(a.custom||new(i.get(a.type||"navigation"))(a.options))})),h((()=>{t.map.hasControl(n())&&t.map.removeControl(n()),t.map.addControl(n(),o.position)})),b((()=>{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 h((()=>{n.map&&(i?.remove(),i=new window.MapLib.Popup({closeOnClick:!1,focusAfterOpen:!1,...o.popup}).on("open",(()=>o.onOpen?.())).on("close",(()=>o.onClose?.())),h((()=>{void 0!==t.children&&("string"==typeof t.children?i?.setHTML(t.children):i?.setDOMContent(t.children),r?.setPopup(i))})),h((()=>t.showPopup!==i?.isOpen()&&r?.togglePopup())))})),h((()=>{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),h((()=>t.showPopup!==i?.isOpen()&&r?.togglePopup())))})),h((()=>r?.setLngLat(t.lngLat))),h((()=>r?.setDraggable(t.draggable))),b((()=>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 h((()=>{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),h((()=>t.trackPointer?n.trackPointer():n.setLngLat(t.lngLat))),h((()=>"string"==typeof t.children?n.setHTML(t.children):n.setDOMContent(t.children))))})),b((()=>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]=g({width:0,height:0}),n=(e,o)=>{t.map.debug&&console.debug("%c[MapGL]","color: #10b981",e,o||"")};b((()=>{t.map?.hasImage(e.id)&&t.map?.removeImage(e.id),n("Remove Image:",e.id)})),h((()=>{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]=g(!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};h((()=>{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),h((()=>{null!=e.rotateGlobe&&(e.rotateGlobe?(d=t.map.getCenter(),l()):e.resetWhenStopped?t.map.stop().easeTo({center:d}):t.map.stop())})),h((()=>{null!=e.rotateViewport&&(e.rotateViewport?p():e.resetWhenStopped?t.map.stop().resetNorthPitch():t.map.stop())})),b((()=>t.map.off("moveend",c).off("dragend",c))),e.children},ie=e=>{const[t]=L();return h((()=>t.map.setLight(e.style||{}))),b((()=>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)}})),b((()=>{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,H 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};
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 config?: {\n importID?: string\n configName:\n | 'showPlaceLabels'\n | 'showRoadLabels'\n | 'showPointOfInterestLabels'\n | 'showTransitLabels'\n | 'lightPreset'\n | 'font'\n value: boolean | 'dusk' | 'dawn' | 'day' | 'night' | any[]\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, 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 || 'mapbox://styles/mapbox/standard'\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 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(`Update Viewport (${props.transitionType || 'flyTo'}):`, viewport)\n },\n { defer: true }\n )\n )\n\n // Update Configuration\n createEffect(() => {\n const { importID, configName, value } = props.config || {}\n if (!map || !configName || !value) return\n //@ts-ignore\n map.setConfigProperty(importID || 'basemap', configName, value)\n debug(`Set Config (${importID}:${configName}) to:`, value)\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()}>{props.children}</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","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","resizeObserver","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","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","point","x","originalEvent","y","center","lat","getCenter","lng","zoom","getZoom","pitch","getPitch","bearing","getBearing","inTransit","bounds","createEffect","vp","cameraForBounds","stop","transitionType","defer","importID","configName","config","setConfigProperty","proj","setProjection","cur","cursorStyle","getCanvas","cursor","prev","isStyleLoaded","oldStyle","oldLayers","layers","filter","l","includes","oldSources","sources","s","obj","key","setStyle","newStyle","insertLayers","list","layer","index","findIndex","i","metadata","smg","beforeType","type","beforeId","fog","onCleanup","disconnect","remove","_el$","_tmpl$","_$use","_$insert","_c$","_$memo","_$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","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,CACzB,cACA,YACA,cACA,aACA,cACA,eACA,eACA,UACA,aACA,gBACA,eACA,aACA,iBAGIC,EAAoB,CACxB,WACA,WACA,YACA,cACA,WACA,oBACA,eACA,WACA,gBCtKIC,EAAU,yBACVC,EAAU,qCACVC,EAAS,6DACTC,EAAW,4CAEJC,EAA0B,CACrCC,GAAI,CACFC,MAAQ,GAAEN,cACVO,KAAO,GAAEP,aACTQ,OA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,GAAOI,IAAI,UAAWJ,KAEtD1jB,EAAMI,QAAQ,EC3LV2jB,GAA+B/jB,IAC1C,MAAOkR,GAAOrR,IAQd,OALA4M,GAAa,IAAMyE,EAAIxR,IAAIskB,SAAShkB,EAAMgI,OAAS,CAAE,KAGrDoH,GAAU,IAAM8B,EAAIxR,KAAKskB,SAAS,QAE3B,IAAI,ECDAC,GAA8BjkB,IACzC,MAAOkR,GAAOrR,IAGRqkB,EAAO,IAAIlkB,EAAMmkB,IAAInkB,EAAMmJ,SACjC+H,EAAIxR,IAAIsb,WAAWkJ,EAAMlkB,EAAMoQ,UAAY,aAC3CpQ,EAAMokB,aAAepkB,EAAMokB,YAAYF,GAGvC,MAAMG,EAAgD,CAAA,EAkBtD,OAjBA9jB,EAAWyJ,SAAQC,IACjB,GAAIjK,EAAMiK,GAAO,CACf,MAAME,EAAS,QAAOF,EAAKG,MAAM,GAAGC,gBAC9Bia,EAAK/Z,GAAOvK,EAAMiK,GAAMM,GAC9B8Z,EAAUla,GAASma,EACnBpT,EAAIxR,IAAI4K,GAAGH,EAAOma,EACpB,KAIFlV,GAAU,KAER1E,OAAOC,KAAK0Z,GAAWra,SAAQG,GAAS+G,EAAIxR,IAAIokB,IAAI3Z,EAAOka,EAAUla,MAErE+G,EAAIxR,KAAKmb,cAAcqJ,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,CACzB,cACA,YACA,cACA,aACA,cACA,eACA,eACA,UACA,aACA,gBACA,eACA,aACA,iBAGIC,EAAoB,CACxB,WACA,WACA,YACA,cACA,WACA,oBACA,eACA,WACA,gBCtKIC,EAAU,y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53
+ slot: props.slot || '',
54
54
  metadata: {
55
55
  smg: { beforeType: props.beforeType, beforeId: props.beforeId },
56
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 || 'mapbox://styles/mapbox/standard';
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,22 +82,23 @@ 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
@@ -106,12 +107,24 @@ export const MapGL = (props) => {
106
107
  setTimeout(() => {
107
108
  map?.resize();
108
109
  }, 0);
109
- debug('Map resized');
110
+ debug("Map resized");
110
111
  });
111
112
  resizeObserver.observe(mapRef);
112
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
+ });
113
126
  // Update Viewport
114
- map.on('move', (event) => {
127
+ map.on("move", (event) => {
115
128
  const viewport = {
116
129
  ...props.viewport,
117
130
  id: props.id,
@@ -145,7 +158,7 @@ export const MapGL = (props) => {
145
158
  setInternal(true);
146
159
  !event.viewport && props.onViewportChange?.(viewport);
147
160
  });
148
- map.on('moveend', (event) => {
161
+ map.on("moveend", (event) => {
149
162
  !event.rotate &&
150
163
  props.onViewportChange?.({ ...props.viewport, inTransit: false });
151
164
  setInternal(false);
@@ -166,25 +179,16 @@ export const MapGL = (props) => {
166
179
  })
167
180
  : null),
168
181
  };
169
- map.stop()[props.transitionType || 'flyTo'](viewport);
170
- debug(`Update Viewport (${props.transitionType || 'flyTo'}):`, viewport);
182
+ map.stop()[props.transitionType || "flyTo"](viewport);
183
+ debug(`Update Viewport (${props.transitionType || "flyTo"}):`, viewport);
171
184
  }, { defer: true }));
172
- // Update Configuration
173
- createEffect(() => {
174
- const { importID, configName, value } = props.config || {};
175
- if (!map || !configName || !value)
176
- return;
177
- //@ts-ignore
178
- map.setConfigProperty(importID || 'basemap', configName, value);
179
- debug(`Set Config (${importID}:${configName}) to:`, value);
180
- });
181
185
  // Update Projection
182
186
  createEffect(() => {
183
187
  const proj = props.options?.projection;
184
188
  if (!map || !proj)
185
189
  return;
186
190
  map.setProjection(proj);
187
- debug('Set Projection to:', proj);
191
+ debug("Set Projection to:", proj);
188
192
  });
189
193
  // Update Cursor
190
194
  createEffect(() => {
@@ -192,7 +196,7 @@ export const MapGL = (props) => {
192
196
  if (!map || !cur)
193
197
  return;
194
198
  map.getCanvas().style.cursor = cur;
195
- debug('Set Cursor to:', cur);
199
+ debug("Set Cursor to:", cur);
196
200
  });
197
201
  const insertLayers = (list, layers) => {
198
202
  layers.forEach((layer) => {
@@ -216,7 +220,7 @@ export const MapGL = (props) => {
216
220
  .filter((s) => map.sourceIdList.includes(s))
217
221
  .reduce((obj, key) => ({ ...obj, [key]: oldStyle.sources[key] }), {});
218
222
  map.setStyle(style);
219
- map.once('styledata', () => {
223
+ map.once("styledata", () => {
220
224
  if (!oldLayers)
221
225
  return;
222
226
  const newStyle = map.getStyle();
@@ -227,17 +231,18 @@ export const MapGL = (props) => {
227
231
  fog: oldStyle.fog,
228
232
  terrain: oldStyle.terrain,
229
233
  });
230
- debug('Set Mapstyle to:', style);
234
+ debug("Set Mapstyle to:", style);
231
235
  });
232
236
  }
233
237
  return style;
234
238
  }, props.options?.style);
239
+ // Update debug features
235
240
  [
236
- 'showTileBoundaries',
237
- 'showTerrainWireframe',
238
- 'showCollisionBoxes',
239
- 'showPadding',
240
- 'showOverdrawInspector',
241
+ "showTileBoundaries",
242
+ "showTerrainWireframe",
243
+ "showCollisionBoxes",
244
+ "showPadding",
245
+ "showOverdrawInspector",
241
246
  ].forEach((item) => {
242
247
  createEffect(() => {
243
248
  const prop = props[item];
@@ -251,15 +256,17 @@ export const MapGL = (props) => {
251
256
  resizeObserver?.disconnect();
252
257
  mutationObserver?.disconnect();
253
258
  map?.remove();
254
- debug('Map removed');
259
+ debug("Map removed");
255
260
  });
256
261
  return (<div ref={mapRef} id={props.id} class={props?.class} classList={props?.classList} style={props?.class || props?.classList
257
262
  ? null
258
263
  : props.style || {
259
- position: 'absolute',
264
+ position: "absolute",
260
265
  inset: 0,
261
- 'z-index': -1,
266
+ "z-index": -1,
262
267
  }}>
263
- {mapLoaded() && (<MapProvider map={mapLoaded()}>{props.children}</MapProvider>)}
268
+ {mapLoaded() && (<MapProvider map={mapLoaded()}>
269
+ <div style={{ position: "relative" }}>{props.children}</div>
270
+ </MapProvider>)}
264
271
  </div>);
265
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`,
@@ -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,13 +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
+ */
52
55
  config?: {
53
- importID?: string;
54
- configName: 'showPlaceLabels' | 'showRoadLabels' | 'showPointOfInterestLabels' | 'showTransitLabels' | 'lightPreset' | 'font';
55
- value: boolean | 'dusk' | 'dawn' | 'day' | 'night' | any[];
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[];
56
64
  };
57
65
  /** Type for pan, move and zoom transitions */
58
- transitionType?: 'flyTo' | 'easeTo' | 'jumpTo';
66
+ transitionType?: "flyTo" | "easeTo" | "jumpTo";
59
67
  /** Event listener for Viewport updates */
60
68
  onViewportChange?: (viewport: Viewport) => void;
61
69
  /** Event listener for User Interaction */
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.10.4",
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.",
@@ -56,16 +56,16 @@
56
56
  "@solidjs/testing-library": "^0.8.6",
57
57
  "@testing-library/jest-dom": "^6.4.2",
58
58
  "@types/mapbox-gl": "^2.7.21",
59
- "@vitest/coverage-v8": "^1.2.2",
59
+ "@vitest/coverage-v8": "^1.3.1",
60
60
  "jsdom": "^24.0.0",
61
61
  "jsdom-worker": "^0.3.0",
62
- "rollup": "^4.11.0",
63
- "rollup-plugin-import-css": "^3.4.0",
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.1.3",
66
+ "vite": "^5.1.4",
67
67
  "vite-plugin-solid": "^2.10.1",
68
- "vitest": "^1.2.2"
68
+ "vitest": "^1.3.1"
69
69
  },
70
70
  "peerDependencies": {
71
71
  "@babylonjs/core": "^6.24.0",