vue-maplibre-gl
Advanced tools
Comparing version 2.0.3 to 2.0.4
/*! | ||
* vue-maplibre-gl v2.0.3 | ||
* vue-maplibre-gl v2.0.4 | ||
* (c) 2023 Volker Nauruhn | ||
@@ -319,3 +319,3 @@ * @license MIT | ||
function y() { | ||
N.isMounted = !1, N.isLoaded = !1, r.value && (r.value.getCanvas().removeEventListener("webglcontextlost", C), l.value = !1, g.forEach((u, s) => { | ||
N.isMounted = !1, N.isLoaded = !1, h.value = !1, r.value && (r.value.getCanvas().removeEventListener("webglcontextlost", C), l.value = !1, g.forEach((u, s) => { | ||
r.value.off(s.startsWith("__") ? s.substring(2) : s, u); | ||
@@ -322,0 +322,0 @@ }), r.value.remove()); |
/*! | ||
* vue-maplibre-gl v2.0.3 | ||
* vue-maplibre-gl v2.0.4 | ||
* (c) 2023 Volker Nauruhn | ||
@@ -7,3 +7,3 @@ * @license MIT | ||
(function(s,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("maplibre-gl"),require("mitt")):typeof define=="function"&&define.amd?define(["exports","vue","maplibre-gl","mitt"],e):(s=typeof globalThis<"u"?globalThis:s||self,e(s.VueMaplibreGl={},s.Vue,s.maplibregl,s.mitt))})(this,function(s,e,w,Le){"use strict";var Fe=Object.defineProperty;var De=(s,e,w)=>e in s?Fe(s,e,{enumerable:!0,configurable:!0,writable:!0,value:w}):s[e]=w;var p=(s,e,w)=>(De(s,typeof e!="symbol"?e+"":e,w),w);var G=document.createElement("style");G.textContent=`.mgl-container{position:relative}.mgl-wrapper{position:absolute;top:0;right:0;bottom:0;left:0}.maplibregl-ctrl .maplibregl-ctrl-icon svg{margin-top:2px}.maplibregl-ctrl .maplibregl-style-switch{display:block}.maplibregl-ctrl .maplibregl-style-switch.is-open,.maplibregl-ctrl .maplibregl-style-list{display:none}.maplibregl-ctrl .maplibregl-style-list.is-open{display:block}.maplibregl-ctrl .maplibregl-style-list button{width:100%;text-align:left;padding:0 5px}.maplibregl-ctrl .maplibregl-style-list button.is-active{font-weight:700}.maplibregl-ctrl-top-left .maplibregl-style-list button,.maplibregl-ctrl-bottom-left .maplibregl-style-list button{text-align:left}.maplibregl-ctrl-top-right .maplibregl-style-list button,.maplibregl-ctrl-bottom-right .maplibregl-style-list button{text-align:right} | ||
`,document.head.appendChild(G);const $e="",y=Symbol("map"),C=Symbol("isLoaded"),S=Symbol("componentId"),R=Symbol("sourceId"),E=Symbol("sourceLayerRegistry"),F=Symbol("emitter");function Me(t){return Object.keys(t)}function P(t){return Object.keys(t)}const u=e.reactive({style:"https://demotiles.maplibre.org/style.json",center:Object.freeze([0,0]),zoom:1,trackResize:!1});class L{static createEventHandler(i,o,a,r){return(n={})=>a.emit(r,{type:n.type,map:o,component:i,event:n})}}p(L,"MAP_OPTION_KEYS",["antialias","attributionControl","bearing","bearingSnap","bounds","boxZoom","center","clickTolerance","collectResourceTiming","crossSourceCollisions","container","customAttribution","dragPan","dragRotate","doubleClickZoom","hash","fadeDuration","failIfMajorPerformanceCaveat","fitBoundsOptions","interactive","keyboard","locale","localIdeographFontFamily","logoPosition","maxBounds","maxPitch","maxZoom","minPitch","minZoom","preserveDrawingBuffer","pitch","pitchWithRotate","refreshExpiredTiles","renderWorldCopies","scrollZoom","mapStyle","trackResize","transformRequest","touchZoomRotate","touchPitch","zoom","maxTileCacheSize","pixelRatio","cooperativeGestures"]),p(L,"MARKER_OPTION_KEYS",["element","offset","anchor","color","draggable","clickTolerance","rotation","rotationAlignment","pitchAlignment","scale"]),p(L,"MAP_EVENT_TYPES",["error","load","idle","remove","render","resize","webglcontextlost","webglcontextrestored","dataloading","data","tiledataloading","sourcedataloading","styledataloading","sourcedata","styledata","boxzoomcancel","boxzoomstart","boxzoomend","touchcancel","touchmove","touchend","touchstart","click","contextmenu","dblclick","mousemove","mouseup","mousedown","mouseout","mouseover","movestart","move","moveend","zoomstart","zoom","zoomend","rotatestart","rotate","rotateend","dragstart","drag","dragend","pitchstart","pitch","pitchend","wheel"]);var j=(t=>(t.TOP_LEFT="top-left",t.TOP_RIGHT="top-right",t.BOTTOM_LEFT="bottom-left",t.BOTTOM_RIGHT="bottom-right",t))(j||{});const A=Object.values(j),D=new Map,Y=Symbol("default");function ve(t=Y){let i=D.get(t);return i||(i=e.reactive({isLoaded:!1,isMounted:!1}),D.set(t,i)),i}function Ee(t,i=Y){var a;let o=D.get(i);return o||(o=e.reactive({isLoaded:!1,isMounted:!1}),D.set(i,o)),o.isLoaded=!1,o.isMounted=!1,o.component=t,o.map=t.map,o.isLoaded=((a=t.map)==null?void 0:a.loaded())||!1,o}function je(t,i=250,o=!1){let a;function r(){const n=arguments,c=()=>{a=void 0,o!==!0&&t.apply(this,n)};clearTimeout(a),o===!0&&a===void 0&&t.apply(this,n),a=window.setTimeout(c,i)}return r.cancel=()=>{clearTimeout(a)},r}const q=e.defineComponent({name:"MglMap",props:{width:{type:[Number,String],default:"100%"},height:{type:[Number,String],default:"100%"},antialias:{type:Boolean,default:()=>u.antialias},attributionControl:{type:Boolean,default:()=>u.attributionControl},bearing:{type:Number,default:()=>u.bearing},bearingSnap:{type:Number,default:()=>u.bearingSnap},bounds:{type:[Array,Object],default:()=>u.bounds},boxZoom:{type:Boolean,default:()=>u.boxZoom},center:{type:[Array,Object],default:()=>u.center},clickTolerance:{type:Number,default:()=>u.clickTolerance},collectResourceTiming:{type:Boolean,default:()=>u.collectResourceTiming},crossSourceCollisions:{type:Boolean,default:()=>u.crossSourceCollisions},customAttribution:{type:[String,Array],default:()=>u.customAttribution},dragPan:{type:Boolean,default:()=>u.dragPan},dragRotate:{type:Boolean,default:()=>u.dragRotate},doubleClickZoom:{type:Boolean,default:()=>u.doubleClickZoom},hash:{type:[Boolean,String],default:()=>u.hash},fadeDuration:{type:Number,default:()=>u.fadeDuration},failIfMajorPerformanceCaveat:{type:Boolean,default:()=>u.failIfMajorPerformanceCaveat},fitBoundsOptions:{type:Object,default:()=>u.fitBoundsOptions},interactive:{type:Boolean,default:()=>u.interactive},keyboard:{type:Boolean,default:()=>u.keyboard},locale:{type:Object,default:()=>u.locale},localIdeographFontFamily:{type:String,default:()=>u.localIdeographFontFamily},logoPosition:{type:[String],validator:t=>t in j,default:()=>u.logoPosition},maxBounds:{type:[Array,Object],default:()=>u.maxBounds},maxPitch:{type:Number,default:()=>u.maxPitch},maxZoom:{type:Number,default:()=>u.maxZoom},minPitch:{type:Number,default:()=>u.minPitch},minZoom:{type:Number,default:()=>u.minZoom},preserveDrawingBuffer:{type:Boolean,default:()=>u.preserveDrawingBuffer},pitch:{type:Number,default:()=>u.pitch},pitchWithRotate:{type:Boolean,default:()=>u.pitchWithRotate},refreshExpiredTiles:{type:Boolean,default:()=>u.refreshExpiredTiles},renderWorldCopies:{type:Boolean,default:()=>u.renderWorldCopies},scrollZoom:{type:Boolean,default:()=>u.scrollZoom},mapStyle:{type:[String,Object],default:()=>u.style},trackResize:{type:Boolean,default:()=>u.trackResize},transformRequest:{type:Function,default:u.transformRequest},touchZoomRotate:{type:Boolean,default:()=>u.touchZoomRotate},touchPitch:{type:Boolean,default:()=>u.touchPitch},zoom:{type:Number,default:()=>u.zoom},maxTileCacheSize:{type:Number,default:()=>u.maxTileCacheSize},mapKey:{type:[String,Symbol]},pixelRatio:{type:Number,default:()=>u.pixelRatio},cooperativeGestures:{type:[Boolean,Object],default:()=>u.cooperativeGestures}},emits:["map:error","map:load","map:idle","map:remove","map:render","map:resize","map:webglcontextlost","map:webglcontextrestored","map:dataloading","map:data","map:tiledataloading","map:sourcedataloading","map:styledataloading","map:sourcedata","map:styledata","map:boxzoomcancel","map:boxzoomstart","map:boxzoomend","map:touchcancel","map:touchmove","map:touchend","map:touchstart","map:click","map:contextmenu","map:dblclick","map:mousemove","map:mouseup","map:mousedown","map:mouseout","map:mouseover","map:movestart","map:move","map:moveend","map:zoomstart","map:zoom","map:zoomend","map:rotatestart","map:rotate","map:rotateend","map:dragstart","map:drag","map:dragend","map:pitchstart","map:pitch","map:pitchend","map:wheel"],setup(t,i){const o=e.markRaw(e.getCurrentInstance()),a=e.shallowRef(null),r=e.shallowRef(null),n=e.shallowRef(null),c=e.ref(!1),h=e.ref(!1),f=new Map,T=Le(),N=Ee(o,t.mapKey);let _;e.provide(y,n),e.provide(C,h),e.provide(S,o.uid),e.provide(R,""),e.provide(F,T),e.watch(e.toRef(t,"bearing"),d=>{var l;d&&((l=n.value)==null||l.setBearing(d))}),e.watch(e.toRef(t,"bounds"),d=>{var l;d&&((l=n.value)==null||l.fitBounds(d,t.fitBoundsOptions))}),e.watch(e.toRef(t,"center"),d=>{var l;d&&((l=n.value)==null||l.setCenter(d))}),e.watch(e.toRef(t,"maxBounds"),d=>{var l;d&&((l=n.value)==null||l.setMaxBounds(d))}),e.watch(e.toRef(t,"maxPitch"),d=>{var l;d&&((l=n.value)==null||l.setMaxPitch(d))}),e.watch(e.toRef(t,"maxZoom"),d=>{var l;d&&((l=n.value)==null||l.setMaxZoom(d))}),e.watch(e.toRef(t,"minPitch"),d=>{var l;d&&((l=n.value)==null||l.setMinPitch(d))}),e.watch(e.toRef(t,"minZoom"),d=>{var l;d&&((l=n.value)==null||l.setMinZoom(d))}),e.watch(e.toRef(t,"pitch"),d=>{var l;d&&((l=n.value)==null||l.setPitch(d))}),e.watch(e.toRef(t,"renderWorldCopies"),d=>{var l;d&&((l=n.value)==null||l.setRenderWorldCopies(d))}),e.watch(e.toRef(t,"mapStyle"),d=>{var l;d&&((l=n.value)==null||l.setStyle(d))}),e.watch(e.toRef(t,"transformRequest"),d=>{var l;d&&((l=n.value)==null||l.setTransformRequest(d))}),e.watch(e.toRef(t,"zoom"),d=>{var l;d&&((l=n.value)==null||l.setZoom(d))}),e.watch(e.toRef(t,"zoom"),d=>{var l;d&&((l=n.value)==null||l.setZoom(d))});function V(){N.isMounted=!0;const d=Object.keys(t).filter(l=>t[l]!==void 0&&L.MAP_OPTION_KEYS.indexOf(l)!==-1).reduce((l,k)=>(l[k==="mapStyle"?"style":k]=e.unref(t[k]),l),{container:r.value});if(n.value=e.markRaw(new w.Map(d)),N.map=n.value,c.value=!0,f.set("__load",()=>(h.value=!0,N.isLoaded=!0)),n.value.on("load",f.get("__load")),o.vnode.props){for(let l=0,k=L.MAP_EVENT_TYPES.length;l<k;l++)if(o.vnode.props["onMap:"+L.MAP_EVENT_TYPES[l]]){const Oe=L.createEventHandler(o,n.value,i,"map:"+L.MAP_EVENT_TYPES[l]);f.set(L.MAP_EVENT_TYPES[l],Oe),n.value.on(L.MAP_EVENT_TYPES[l],Oe)}}n.value.getCanvas().addEventListener("webglcontextlost",O)}function g(){N.isMounted=!1,N.isLoaded=!1,n.value&&(n.value.getCanvas().removeEventListener("webglcontextlost",O),c.value=!1,f.forEach((d,l)=>{n.value.off(l.startsWith("__")?l.substring(2):l,d)}),n.value.remove())}function O(){g(),e.nextTick(V)}return e.onMounted(()=>{V(),n.value&&(_=new ResizeObserver(je(n.value.resize.bind(n.value),100)),_.observe(r.value))}),e.onBeforeUnmount(()=>{_&&_.disconnect(),g()}),{map:n,componentContainer:a,container:r,isLoaded:h,isInitialized:c}},render(){return e.h("div",{ref:"componentContainer",class:"mgl-container",style:{height:this.$props.height,width:this.$props.width}},[e.h("div",{ref:"container",class:"mgl-wrapper"}),this.isInitialized&&this.$slots.default?this.$slots.default():void 0])}});function I(t,i,o){e.watch(t,a=>{var r,n;a&&A.indexOf(a)===-1||((r=i.value)!=null&&r.hasControl(o)&&i.value.removeControl(o),(n=i.value)==null||n.addControl(o,a))},{immediate:!0})}const K=e.defineComponent({name:"MglAttributionControl",props:{position:{type:String,validator:t=>A.indexOf(t)!==-1},compact:Boolean,customAttribution:[String,Array]},setup(t){const i=e.inject(y),o=new w.AttributionControl({compact:t.compact,customAttribution:t.customAttribution});I(e.toRef(t,"position"),i,o),e.onBeforeUnmount(()=>i.value.removeControl(o))},render(){}}),H=class{constructor(i,o){p(this,"container");this.isAdded=i,this.container=document.createElement("div"),this.setClasses(o)}getDefaultPosition(){return j.TOP_LEFT}onAdd(){return e.nextTick(()=>this.isAdded.value=!0),this.container}onRemove(){this.isAdded.value=!1,this.container.remove()}setClasses(i){i?(this.container.classList.remove(H.CONTROL_CLASS),this.container.classList.remove(H.CONTROL_GROUP_CLASS)):(this.container.classList.add(H.CONTROL_CLASS),this.container.classList.add(H.CONTROL_GROUP_CLASS))}};let z=H;p(z,"CONTROL_CLASS","maplibregl-ctrl"),p(z,"CONTROL_GROUP_CLASS","maplibregl-ctrl-group");const J=e.defineComponent({name:"MglCustomControl",props:{position:{type:String,validator:t=>A.indexOf(t)!==-1},noClasses:{type:Boolean,default:!1}},setup(t){const i=e.inject(y),o=e.ref(!1),a=new z(o,t.noClasses);return I(e.toRef(t,"position"),i,a),e.watch(e.toRef(t,"noClasses"),r=>a.setClasses(r)),e.onBeforeUnmount(()=>{var r;(r=i.value)==null||r.removeControl(a)}),{isAdded:o,container:a.container}},render(){return this.isAdded?e.h(e.Teleport,{to:this.container},this.$slots.default?this.$slots.default():void 0):e.createCommentVNode("custom-component")}}),X=e.defineComponent({name:"MglFullscreenControl",props:{position:{type:String,default:j.TOP_RIGHT,validator:t=>A.indexOf(t)!==-1},container:{type:Object,default:null}},setup(t){const i=e.inject(y),o=new w.FullscreenControl({container:t.container||void 0});I(e.toRef(t,"position"),i,o),e.onBeforeUnmount(()=>{var a;return(a=i.value)==null?void 0:a.removeControl(o)})},render(){}});class Ae{constructor(i="rgba(0,0,0,0.9)",o=4*window.devicePixelRatio,a="#7cf859",r="Monaco, Consolas, Courier, monospace",n=60*window.devicePixelRatio,c=90*window.devicePixelRatio,h=0,f=5*window.devicePixelRatio,T=100*window.devicePixelRatio){p(this,"frames",0);p(this,"totalTime",0);p(this,"totalFrames",0);p(this,"time",null);p(this,"map");p(this,"container");p(this,"readOutput");p(this,"canvas");p(this,"eventHandlers",new Map);this.background=i,this.barWidth=o,this.color=a,this.font=r,this.graphHeight=n,this.graphWidth=c,this.graphTop=h,this.graphRight=f,this.width=T}getDefaultPosition(){return j.TOP_RIGHT}onAdd(i){this.map=i;const o=this.container=document.createElement("div");return o.className="mapboxgl-ctrl mapboxgl-ctrl-fps",o.style.backgroundColor=this.background,o.style.borderRadius="6px",this.readOutput=document.createElement("div"),this.readOutput.style.color=this.color,this.readOutput.style.fontFamily=this.font,this.readOutput.style.padding="0 5px 5px",this.readOutput.style.fontSize="9px",this.readOutput.style.fontWeight="bold",this.readOutput.textContent="Waiting…",this.canvas=document.createElement("canvas"),this.canvas.className="mapboxgl-ctrl-canvas",this.canvas.width=this.width,this.canvas.height=this.graphHeight,this.canvas.style.cssText=`width: ${this.width/window.devicePixelRatio}px; height: ${this.graphHeight/window.devicePixelRatio}px;`,o.appendChild(this.readOutput),o.appendChild(this.canvas),this.eventHandlers.set("movestart",this.onMoveStart.bind(this)),this.eventHandlers.set("moveend",this.onMoveEnd.bind(this)),this.map.on("movestart",this.eventHandlers.get("movestart")),this.map.on("moveend",this.eventHandlers.get("moveend")),this.container}onRemove(){this.map.off("movestart",this.eventHandlers.get("movestart")),this.map.off("moveend",this.eventHandlers.get("moveend")),this.eventHandlers.clear(),this.container.parentNode.removeChild(this.container),this.map=void 0}onMoveStart(){this.frames=0,this.time=performance.now(),this.eventHandlers.set("render",this.onRender.bind(this)),this.map.on("render",this.eventHandlers.get("render"))}onMoveEnd(){const i=performance.now();this.updateGraph(this.getFPS(i)),this.frames=0,this.time=null,this.map.off("render",this.eventHandlers.get("render"))}onRender(){if(this.time){this.frames++;const i=performance.now();i>=this.time+1e3&&(this.updateGraph(this.getFPS(i)),this.frames=0,this.time=performance.now())}}getFPS(i){return this.totalTime+=i-this.time,this.totalFrames+=this.frames,Math.round(1e3*this.frames/(i-this.time))||0}updateGraph(i){const o=this.canvas.getContext("2d"),a=Math.round(1e3*this.totalFrames/this.totalTime)||0,r=(this.graphHeight,this.barWidth);o.fillStyle=this.background,o.globalAlpha=1,o.fillRect(0,0,this.graphWidth,this.graphTop),o.fillStyle=this.color,this.readOutput.textContent=`${i} FPS (${a} Avg)`,o.drawImage(this.canvas,this.graphRight+r,this.graphTop,this.graphWidth-r,this.graphHeight,this.graphRight,this.graphTop,this.graphWidth-r,this.graphHeight),o.fillRect(this.graphRight+this.graphWidth-r,this.graphTop,r,this.graphHeight),o.fillStyle=this.background,o.globalAlpha=.75,o.fillRect(this.graphRight+this.graphWidth-r,this.graphTop,r,(1-i/100)*this.graphHeight)}}const Q=e.defineComponent({name:"MglFrameRateControl",props:{position:{type:String,validator:t=>A.indexOf(t)!==-1},background:{type:String,default:"rgba(0,0,0,0.9)"},barWidth:{type:Number,default:4*window.devicePixelRatio},color:{type:String,default:"#7cf859"},font:{type:String,default:"Monaco, Consolas, Courier, monospace"},graphHeight:{type:Number,default:60*window.devicePixelRatio},graphWidth:{type:Number,default:90*window.devicePixelRatio},graphTop:{type:Number,default:0},graphRight:{type:Number,default:5*window.devicePixelRatio},width:{type:Number,default:100*window.devicePixelRatio}},setup(t){const i=e.inject(y),o=new Ae(t.background,t.barWidth,t.color,t.font,t.graphHeight,t.graphWidth,t.graphTop,t.graphRight,t.width);I(e.toRef(t,"position"),i,o),e.onBeforeUnmount(()=>{var a;return(a=i.value)==null?void 0:a.removeControl(o)})},render(){}}),ee=e.defineComponent({name:"MglGeolocationControl",props:{position:{type:String,default:j.TOP_RIGHT,validator:t=>A.indexOf(t)!==-1},positionOptions:{type:Object,default:{enableHighAccuracy:!1,timeout:6e3}},fitBoundsOptions:{type:Object,default:{maxZoom:15}},trackUserLocation:{type:Boolean,default:!1},showAccuracyCircle:{type:Boolean,default:!0},showUserLocation:{type:Boolean,default:!0}},setup(t){const i=e.inject(y),o=new w.GeolocateControl({positionOptions:t.positionOptions,fitBoundsOptions:t.fitBoundsOptions,trackUserLocation:t.trackUserLocation,showAccuracyCircle:t.showAccuracyCircle,showUserLocation:t.showUserLocation});I(e.toRef(t,"position"),i,o),e.onBeforeUnmount(()=>{var a;return(a=i.value)==null?void 0:a.removeControl(o)})},render(){}}),te=e.defineComponent({name:"MglNavigationControl",props:{position:{type:String,default:j.TOP_RIGHT,validator:t=>A.indexOf(t)!==-1},showCompass:{type:Boolean,default:!0},showZoom:{type:Boolean,default:!0},visualizePitch:Boolean},setup(t){const i=e.inject(y),o=new w.NavigationControl({showCompass:t.showCompass,showZoom:t.showZoom,visualizePitch:t.visualizePitch});I(e.toRef(t,"position"),i,o),e.onBeforeUnmount(()=>{var a;return(a=i.value)==null?void 0:a.removeControl(o)})},render(){}});var oe=(t=>(t.IMPERIAL="imperial",t.METRIC="metric",t.NAUTICAL="nautical",t))(oe||{});const Ie=Object.values(oe),ie=e.defineComponent({name:"MglScaleControl",props:{position:{type:String,validator:t=>A.indexOf(t)!==-1},maxWidth:{type:Number,default:100},unit:{type:String,default:"metric",validator:t=>Ie.indexOf(t)!==-1}},setup(t){const i=e.inject(y),o=new w.ScaleControl({maxWidth:t.maxWidth,unit:t.unit});I(e.toRef(t,"position"),i,o),e.onBeforeUnmount(()=>{var a;return(a=i.value)==null?void 0:a.removeControl(o)})},render(){}});var $=(t=>(t.DEFAULT="default",t.TEXT="text",t.MDI="mdi",t.SIMPLE_ICON="simple-icons",t))($||{});const Te=Object.values($),U={text:void 0,mdi:{size:21,viewbox:"0 0 24 24"},["simple-icons"]:{size:21,viewbox:"0 0 24 24"},default:{size:0,viewbox:"0 0 0 0"}},Z=e.defineComponent({name:"MglButton",props:{type:{type:String,default:"default",validator:t=>Te.indexOf(t)!==-1},path:{type:String},size:Number,viewbox:String},setup(t){!t.path&&t.type!=="text"&&e.warn("property `path` must be set on MaplibreButton");const i=e.ref(U[t.type]||U.default);return e.watch(()=>t.type,o=>i.value=U[o]||U.default),{defaults:i}},render(){return this.type==="text"?e.h("button",{type:"button"},this.$slots.default?this.$slots.default():void 0):e.h("button",{type:"button",class:"maplibregl-ctrl-icon"},[e.h("svg",{width:this.size||this.defaults.size,height:this.size||this.defaults.size,viewBox:this.viewbox||this.defaults.viewbox},e.h("path",{fill:"currentColor",d:this.path})),this.$slots.default?this.$slots.default():void 0])}});function ae(t){return t&&!!t.stopPropagation}const ne=e.defineComponent({name:"MglStyleSwitchControl",props:{position:{type:String,validator:t=>A.indexOf(t)!==-1},mapStyles:{type:Array,required:!0,default:[]},modelValue:{type:Object},isOpen:{type:Boolean,default:void 0}},emits:["update:modelValue","update:isOpen"],setup(t,{emit:i}){const o=e.inject(y),a=e.inject(C),r=e.inject(F),n=e.ref(!1),c=e.ref(t.isOpen===void 0?!1:t.isOpen),h=e.shallowRef(t.modelValue===void 0?t.mapStyles.length?t.mapStyles[0]:null:t.modelValue),f=new z(n,!1),T=V.bind(null,!1);function N(){const g=o.value.getStyle().name;for(let O=0,d=t.mapStyles.length;O<d;O++)if(t.mapStyles[O].name===g){_(t.mapStyles[O]);break}}e.watch(a,g=>{g&&N()},{immediate:!0}),o.value.on("style.load",N),document.addEventListener("click",T),I(e.toRef(t,"position"),o,f),t.modelValue!==void 0&&e.watch(e.toRef(t,"modelValue"),g=>{g!==void 0&&(h.value=g)}),t.isOpen!==void 0&&e.watch(e.toRef(t,"isOpen"),g=>{g!==void 0&&(c.value=g)}),e.onBeforeUnmount(()=>{o.value.removeControl(f),o.value.off("style.load",N),document.removeEventListener("click",T)});function _(g){var O;((O=h.value)==null?void 0:O.name)!==g.name&&(r.emit("styleSwitched",g),o.value.setStyle(g.style),t.modelValue===void 0&&(h.value=g),i("update:modelValue",g),V(!1))}function V(g,O){ae(O)?O.stopPropagation():ae(g)&&g.stopPropagation(),!(t.isOpen!==void 0&&t.isOpen===g||c.value===g)&&(t.isOpen===void 0?(c.value=typeof g=="boolean"?g:!c.value,i("update:isOpen",c.value)):i("update:isOpen",typeof g=="boolean"?g:!t.isOpen))}return{isAdded:n,container:f.container,setStyle:_,toggleOpen:V,intIsOpen:c,intModelValue:h}},template:` | ||
`,document.head.appendChild(G);const $e="",y=Symbol("map"),C=Symbol("isLoaded"),S=Symbol("componentId"),R=Symbol("sourceId"),E=Symbol("sourceLayerRegistry"),F=Symbol("emitter");function Me(t){return Object.keys(t)}function P(t){return Object.keys(t)}const u=e.reactive({style:"https://demotiles.maplibre.org/style.json",center:Object.freeze([0,0]),zoom:1,trackResize:!1});class L{static createEventHandler(i,o,a,r){return(n={})=>a.emit(r,{type:n.type,map:o,component:i,event:n})}}p(L,"MAP_OPTION_KEYS",["antialias","attributionControl","bearing","bearingSnap","bounds","boxZoom","center","clickTolerance","collectResourceTiming","crossSourceCollisions","container","customAttribution","dragPan","dragRotate","doubleClickZoom","hash","fadeDuration","failIfMajorPerformanceCaveat","fitBoundsOptions","interactive","keyboard","locale","localIdeographFontFamily","logoPosition","maxBounds","maxPitch","maxZoom","minPitch","minZoom","preserveDrawingBuffer","pitch","pitchWithRotate","refreshExpiredTiles","renderWorldCopies","scrollZoom","mapStyle","trackResize","transformRequest","touchZoomRotate","touchPitch","zoom","maxTileCacheSize","pixelRatio","cooperativeGestures"]),p(L,"MARKER_OPTION_KEYS",["element","offset","anchor","color","draggable","clickTolerance","rotation","rotationAlignment","pitchAlignment","scale"]),p(L,"MAP_EVENT_TYPES",["error","load","idle","remove","render","resize","webglcontextlost","webglcontextrestored","dataloading","data","tiledataloading","sourcedataloading","styledataloading","sourcedata","styledata","boxzoomcancel","boxzoomstart","boxzoomend","touchcancel","touchmove","touchend","touchstart","click","contextmenu","dblclick","mousemove","mouseup","mousedown","mouseout","mouseover","movestart","move","moveend","zoomstart","zoom","zoomend","rotatestart","rotate","rotateend","dragstart","drag","dragend","pitchstart","pitch","pitchend","wheel"]);var j=(t=>(t.TOP_LEFT="top-left",t.TOP_RIGHT="top-right",t.BOTTOM_LEFT="bottom-left",t.BOTTOM_RIGHT="bottom-right",t))(j||{});const A=Object.values(j),D=new Map,Y=Symbol("default");function ve(t=Y){let i=D.get(t);return i||(i=e.reactive({isLoaded:!1,isMounted:!1}),D.set(t,i)),i}function Ee(t,i=Y){var a;let o=D.get(i);return o||(o=e.reactive({isLoaded:!1,isMounted:!1}),D.set(i,o)),o.isLoaded=!1,o.isMounted=!1,o.component=t,o.map=t.map,o.isLoaded=((a=t.map)==null?void 0:a.loaded())||!1,o}function je(t,i=250,o=!1){let a;function r(){const n=arguments,c=()=>{a=void 0,o!==!0&&t.apply(this,n)};clearTimeout(a),o===!0&&a===void 0&&t.apply(this,n),a=window.setTimeout(c,i)}return r.cancel=()=>{clearTimeout(a)},r}const q=e.defineComponent({name:"MglMap",props:{width:{type:[Number,String],default:"100%"},height:{type:[Number,String],default:"100%"},antialias:{type:Boolean,default:()=>u.antialias},attributionControl:{type:Boolean,default:()=>u.attributionControl},bearing:{type:Number,default:()=>u.bearing},bearingSnap:{type:Number,default:()=>u.bearingSnap},bounds:{type:[Array,Object],default:()=>u.bounds},boxZoom:{type:Boolean,default:()=>u.boxZoom},center:{type:[Array,Object],default:()=>u.center},clickTolerance:{type:Number,default:()=>u.clickTolerance},collectResourceTiming:{type:Boolean,default:()=>u.collectResourceTiming},crossSourceCollisions:{type:Boolean,default:()=>u.crossSourceCollisions},customAttribution:{type:[String,Array],default:()=>u.customAttribution},dragPan:{type:Boolean,default:()=>u.dragPan},dragRotate:{type:Boolean,default:()=>u.dragRotate},doubleClickZoom:{type:Boolean,default:()=>u.doubleClickZoom},hash:{type:[Boolean,String],default:()=>u.hash},fadeDuration:{type:Number,default:()=>u.fadeDuration},failIfMajorPerformanceCaveat:{type:Boolean,default:()=>u.failIfMajorPerformanceCaveat},fitBoundsOptions:{type:Object,default:()=>u.fitBoundsOptions},interactive:{type:Boolean,default:()=>u.interactive},keyboard:{type:Boolean,default:()=>u.keyboard},locale:{type:Object,default:()=>u.locale},localIdeographFontFamily:{type:String,default:()=>u.localIdeographFontFamily},logoPosition:{type:[String],validator:t=>t in j,default:()=>u.logoPosition},maxBounds:{type:[Array,Object],default:()=>u.maxBounds},maxPitch:{type:Number,default:()=>u.maxPitch},maxZoom:{type:Number,default:()=>u.maxZoom},minPitch:{type:Number,default:()=>u.minPitch},minZoom:{type:Number,default:()=>u.minZoom},preserveDrawingBuffer:{type:Boolean,default:()=>u.preserveDrawingBuffer},pitch:{type:Number,default:()=>u.pitch},pitchWithRotate:{type:Boolean,default:()=>u.pitchWithRotate},refreshExpiredTiles:{type:Boolean,default:()=>u.refreshExpiredTiles},renderWorldCopies:{type:Boolean,default:()=>u.renderWorldCopies},scrollZoom:{type:Boolean,default:()=>u.scrollZoom},mapStyle:{type:[String,Object],default:()=>u.style},trackResize:{type:Boolean,default:()=>u.trackResize},transformRequest:{type:Function,default:u.transformRequest},touchZoomRotate:{type:Boolean,default:()=>u.touchZoomRotate},touchPitch:{type:Boolean,default:()=>u.touchPitch},zoom:{type:Number,default:()=>u.zoom},maxTileCacheSize:{type:Number,default:()=>u.maxTileCacheSize},mapKey:{type:[String,Symbol]},pixelRatio:{type:Number,default:()=>u.pixelRatio},cooperativeGestures:{type:[Boolean,Object],default:()=>u.cooperativeGestures}},emits:["map:error","map:load","map:idle","map:remove","map:render","map:resize","map:webglcontextlost","map:webglcontextrestored","map:dataloading","map:data","map:tiledataloading","map:sourcedataloading","map:styledataloading","map:sourcedata","map:styledata","map:boxzoomcancel","map:boxzoomstart","map:boxzoomend","map:touchcancel","map:touchmove","map:touchend","map:touchstart","map:click","map:contextmenu","map:dblclick","map:mousemove","map:mouseup","map:mousedown","map:mouseout","map:mouseover","map:movestart","map:move","map:moveend","map:zoomstart","map:zoom","map:zoomend","map:rotatestart","map:rotate","map:rotateend","map:dragstart","map:drag","map:dragend","map:pitchstart","map:pitch","map:pitchend","map:wheel"],setup(t,i){const o=e.markRaw(e.getCurrentInstance()),a=e.shallowRef(null),r=e.shallowRef(null),n=e.shallowRef(null),c=e.ref(!1),h=e.ref(!1),f=new Map,T=Le(),N=Ee(o,t.mapKey);let _;e.provide(y,n),e.provide(C,h),e.provide(S,o.uid),e.provide(R,""),e.provide(F,T),e.watch(e.toRef(t,"bearing"),d=>{var l;d&&((l=n.value)==null||l.setBearing(d))}),e.watch(e.toRef(t,"bounds"),d=>{var l;d&&((l=n.value)==null||l.fitBounds(d,t.fitBoundsOptions))}),e.watch(e.toRef(t,"center"),d=>{var l;d&&((l=n.value)==null||l.setCenter(d))}),e.watch(e.toRef(t,"maxBounds"),d=>{var l;d&&((l=n.value)==null||l.setMaxBounds(d))}),e.watch(e.toRef(t,"maxPitch"),d=>{var l;d&&((l=n.value)==null||l.setMaxPitch(d))}),e.watch(e.toRef(t,"maxZoom"),d=>{var l;d&&((l=n.value)==null||l.setMaxZoom(d))}),e.watch(e.toRef(t,"minPitch"),d=>{var l;d&&((l=n.value)==null||l.setMinPitch(d))}),e.watch(e.toRef(t,"minZoom"),d=>{var l;d&&((l=n.value)==null||l.setMinZoom(d))}),e.watch(e.toRef(t,"pitch"),d=>{var l;d&&((l=n.value)==null||l.setPitch(d))}),e.watch(e.toRef(t,"renderWorldCopies"),d=>{var l;d&&((l=n.value)==null||l.setRenderWorldCopies(d))}),e.watch(e.toRef(t,"mapStyle"),d=>{var l;d&&((l=n.value)==null||l.setStyle(d))}),e.watch(e.toRef(t,"transformRequest"),d=>{var l;d&&((l=n.value)==null||l.setTransformRequest(d))}),e.watch(e.toRef(t,"zoom"),d=>{var l;d&&((l=n.value)==null||l.setZoom(d))}),e.watch(e.toRef(t,"zoom"),d=>{var l;d&&((l=n.value)==null||l.setZoom(d))});function V(){N.isMounted=!0;const d=Object.keys(t).filter(l=>t[l]!==void 0&&L.MAP_OPTION_KEYS.indexOf(l)!==-1).reduce((l,k)=>(l[k==="mapStyle"?"style":k]=e.unref(t[k]),l),{container:r.value});if(n.value=e.markRaw(new w.Map(d)),N.map=n.value,c.value=!0,f.set("__load",()=>(h.value=!0,N.isLoaded=!0)),n.value.on("load",f.get("__load")),o.vnode.props){for(let l=0,k=L.MAP_EVENT_TYPES.length;l<k;l++)if(o.vnode.props["onMap:"+L.MAP_EVENT_TYPES[l]]){const Oe=L.createEventHandler(o,n.value,i,"map:"+L.MAP_EVENT_TYPES[l]);f.set(L.MAP_EVENT_TYPES[l],Oe),n.value.on(L.MAP_EVENT_TYPES[l],Oe)}}n.value.getCanvas().addEventListener("webglcontextlost",O)}function g(){N.isMounted=!1,N.isLoaded=!1,h.value=!1,n.value&&(n.value.getCanvas().removeEventListener("webglcontextlost",O),c.value=!1,f.forEach((d,l)=>{n.value.off(l.startsWith("__")?l.substring(2):l,d)}),n.value.remove())}function O(){g(),e.nextTick(V)}return e.onMounted(()=>{V(),n.value&&(_=new ResizeObserver(je(n.value.resize.bind(n.value),100)),_.observe(r.value))}),e.onBeforeUnmount(()=>{_&&_.disconnect(),g()}),{map:n,componentContainer:a,container:r,isLoaded:h,isInitialized:c}},render(){return e.h("div",{ref:"componentContainer",class:"mgl-container",style:{height:this.$props.height,width:this.$props.width}},[e.h("div",{ref:"container",class:"mgl-wrapper"}),this.isInitialized&&this.$slots.default?this.$slots.default():void 0])}});function I(t,i,o){e.watch(t,a=>{var r,n;a&&A.indexOf(a)===-1||((r=i.value)!=null&&r.hasControl(o)&&i.value.removeControl(o),(n=i.value)==null||n.addControl(o,a))},{immediate:!0})}const K=e.defineComponent({name:"MglAttributionControl",props:{position:{type:String,validator:t=>A.indexOf(t)!==-1},compact:Boolean,customAttribution:[String,Array]},setup(t){const i=e.inject(y),o=new w.AttributionControl({compact:t.compact,customAttribution:t.customAttribution});I(e.toRef(t,"position"),i,o),e.onBeforeUnmount(()=>i.value.removeControl(o))},render(){}}),H=class{constructor(i,o){p(this,"container");this.isAdded=i,this.container=document.createElement("div"),this.setClasses(o)}getDefaultPosition(){return j.TOP_LEFT}onAdd(){return e.nextTick(()=>this.isAdded.value=!0),this.container}onRemove(){this.isAdded.value=!1,this.container.remove()}setClasses(i){i?(this.container.classList.remove(H.CONTROL_CLASS),this.container.classList.remove(H.CONTROL_GROUP_CLASS)):(this.container.classList.add(H.CONTROL_CLASS),this.container.classList.add(H.CONTROL_GROUP_CLASS))}};let z=H;p(z,"CONTROL_CLASS","maplibregl-ctrl"),p(z,"CONTROL_GROUP_CLASS","maplibregl-ctrl-group");const J=e.defineComponent({name:"MglCustomControl",props:{position:{type:String,validator:t=>A.indexOf(t)!==-1},noClasses:{type:Boolean,default:!1}},setup(t){const i=e.inject(y),o=e.ref(!1),a=new z(o,t.noClasses);return I(e.toRef(t,"position"),i,a),e.watch(e.toRef(t,"noClasses"),r=>a.setClasses(r)),e.onBeforeUnmount(()=>{var r;(r=i.value)==null||r.removeControl(a)}),{isAdded:o,container:a.container}},render(){return this.isAdded?e.h(e.Teleport,{to:this.container},this.$slots.default?this.$slots.default():void 0):e.createCommentVNode("custom-component")}}),X=e.defineComponent({name:"MglFullscreenControl",props:{position:{type:String,default:j.TOP_RIGHT,validator:t=>A.indexOf(t)!==-1},container:{type:Object,default:null}},setup(t){const i=e.inject(y),o=new w.FullscreenControl({container:t.container||void 0});I(e.toRef(t,"position"),i,o),e.onBeforeUnmount(()=>{var a;return(a=i.value)==null?void 0:a.removeControl(o)})},render(){}});class Ae{constructor(i="rgba(0,0,0,0.9)",o=4*window.devicePixelRatio,a="#7cf859",r="Monaco, Consolas, Courier, monospace",n=60*window.devicePixelRatio,c=90*window.devicePixelRatio,h=0,f=5*window.devicePixelRatio,T=100*window.devicePixelRatio){p(this,"frames",0);p(this,"totalTime",0);p(this,"totalFrames",0);p(this,"time",null);p(this,"map");p(this,"container");p(this,"readOutput");p(this,"canvas");p(this,"eventHandlers",new Map);this.background=i,this.barWidth=o,this.color=a,this.font=r,this.graphHeight=n,this.graphWidth=c,this.graphTop=h,this.graphRight=f,this.width=T}getDefaultPosition(){return j.TOP_RIGHT}onAdd(i){this.map=i;const o=this.container=document.createElement("div");return o.className="mapboxgl-ctrl mapboxgl-ctrl-fps",o.style.backgroundColor=this.background,o.style.borderRadius="6px",this.readOutput=document.createElement("div"),this.readOutput.style.color=this.color,this.readOutput.style.fontFamily=this.font,this.readOutput.style.padding="0 5px 5px",this.readOutput.style.fontSize="9px",this.readOutput.style.fontWeight="bold",this.readOutput.textContent="Waiting…",this.canvas=document.createElement("canvas"),this.canvas.className="mapboxgl-ctrl-canvas",this.canvas.width=this.width,this.canvas.height=this.graphHeight,this.canvas.style.cssText=`width: ${this.width/window.devicePixelRatio}px; height: ${this.graphHeight/window.devicePixelRatio}px;`,o.appendChild(this.readOutput),o.appendChild(this.canvas),this.eventHandlers.set("movestart",this.onMoveStart.bind(this)),this.eventHandlers.set("moveend",this.onMoveEnd.bind(this)),this.map.on("movestart",this.eventHandlers.get("movestart")),this.map.on("moveend",this.eventHandlers.get("moveend")),this.container}onRemove(){this.map.off("movestart",this.eventHandlers.get("movestart")),this.map.off("moveend",this.eventHandlers.get("moveend")),this.eventHandlers.clear(),this.container.parentNode.removeChild(this.container),this.map=void 0}onMoveStart(){this.frames=0,this.time=performance.now(),this.eventHandlers.set("render",this.onRender.bind(this)),this.map.on("render",this.eventHandlers.get("render"))}onMoveEnd(){const i=performance.now();this.updateGraph(this.getFPS(i)),this.frames=0,this.time=null,this.map.off("render",this.eventHandlers.get("render"))}onRender(){if(this.time){this.frames++;const i=performance.now();i>=this.time+1e3&&(this.updateGraph(this.getFPS(i)),this.frames=0,this.time=performance.now())}}getFPS(i){return this.totalTime+=i-this.time,this.totalFrames+=this.frames,Math.round(1e3*this.frames/(i-this.time))||0}updateGraph(i){const o=this.canvas.getContext("2d"),a=Math.round(1e3*this.totalFrames/this.totalTime)||0,r=(this.graphHeight,this.barWidth);o.fillStyle=this.background,o.globalAlpha=1,o.fillRect(0,0,this.graphWidth,this.graphTop),o.fillStyle=this.color,this.readOutput.textContent=`${i} FPS (${a} Avg)`,o.drawImage(this.canvas,this.graphRight+r,this.graphTop,this.graphWidth-r,this.graphHeight,this.graphRight,this.graphTop,this.graphWidth-r,this.graphHeight),o.fillRect(this.graphRight+this.graphWidth-r,this.graphTop,r,this.graphHeight),o.fillStyle=this.background,o.globalAlpha=.75,o.fillRect(this.graphRight+this.graphWidth-r,this.graphTop,r,(1-i/100)*this.graphHeight)}}const Q=e.defineComponent({name:"MglFrameRateControl",props:{position:{type:String,validator:t=>A.indexOf(t)!==-1},background:{type:String,default:"rgba(0,0,0,0.9)"},barWidth:{type:Number,default:4*window.devicePixelRatio},color:{type:String,default:"#7cf859"},font:{type:String,default:"Monaco, Consolas, Courier, monospace"},graphHeight:{type:Number,default:60*window.devicePixelRatio},graphWidth:{type:Number,default:90*window.devicePixelRatio},graphTop:{type:Number,default:0},graphRight:{type:Number,default:5*window.devicePixelRatio},width:{type:Number,default:100*window.devicePixelRatio}},setup(t){const i=e.inject(y),o=new Ae(t.background,t.barWidth,t.color,t.font,t.graphHeight,t.graphWidth,t.graphTop,t.graphRight,t.width);I(e.toRef(t,"position"),i,o),e.onBeforeUnmount(()=>{var a;return(a=i.value)==null?void 0:a.removeControl(o)})},render(){}}),ee=e.defineComponent({name:"MglGeolocationControl",props:{position:{type:String,default:j.TOP_RIGHT,validator:t=>A.indexOf(t)!==-1},positionOptions:{type:Object,default:{enableHighAccuracy:!1,timeout:6e3}},fitBoundsOptions:{type:Object,default:{maxZoom:15}},trackUserLocation:{type:Boolean,default:!1},showAccuracyCircle:{type:Boolean,default:!0},showUserLocation:{type:Boolean,default:!0}},setup(t){const i=e.inject(y),o=new w.GeolocateControl({positionOptions:t.positionOptions,fitBoundsOptions:t.fitBoundsOptions,trackUserLocation:t.trackUserLocation,showAccuracyCircle:t.showAccuracyCircle,showUserLocation:t.showUserLocation});I(e.toRef(t,"position"),i,o),e.onBeforeUnmount(()=>{var a;return(a=i.value)==null?void 0:a.removeControl(o)})},render(){}}),te=e.defineComponent({name:"MglNavigationControl",props:{position:{type:String,default:j.TOP_RIGHT,validator:t=>A.indexOf(t)!==-1},showCompass:{type:Boolean,default:!0},showZoom:{type:Boolean,default:!0},visualizePitch:Boolean},setup(t){const i=e.inject(y),o=new w.NavigationControl({showCompass:t.showCompass,showZoom:t.showZoom,visualizePitch:t.visualizePitch});I(e.toRef(t,"position"),i,o),e.onBeforeUnmount(()=>{var a;return(a=i.value)==null?void 0:a.removeControl(o)})},render(){}});var oe=(t=>(t.IMPERIAL="imperial",t.METRIC="metric",t.NAUTICAL="nautical",t))(oe||{});const Ie=Object.values(oe),ie=e.defineComponent({name:"MglScaleControl",props:{position:{type:String,validator:t=>A.indexOf(t)!==-1},maxWidth:{type:Number,default:100},unit:{type:String,default:"metric",validator:t=>Ie.indexOf(t)!==-1}},setup(t){const i=e.inject(y),o=new w.ScaleControl({maxWidth:t.maxWidth,unit:t.unit});I(e.toRef(t,"position"),i,o),e.onBeforeUnmount(()=>{var a;return(a=i.value)==null?void 0:a.removeControl(o)})},render(){}});var $=(t=>(t.DEFAULT="default",t.TEXT="text",t.MDI="mdi",t.SIMPLE_ICON="simple-icons",t))($||{});const Te=Object.values($),U={text:void 0,mdi:{size:21,viewbox:"0 0 24 24"},["simple-icons"]:{size:21,viewbox:"0 0 24 24"},default:{size:0,viewbox:"0 0 0 0"}},Z=e.defineComponent({name:"MglButton",props:{type:{type:String,default:"default",validator:t=>Te.indexOf(t)!==-1},path:{type:String},size:Number,viewbox:String},setup(t){!t.path&&t.type!=="text"&&e.warn("property `path` must be set on MaplibreButton");const i=e.ref(U[t.type]||U.default);return e.watch(()=>t.type,o=>i.value=U[o]||U.default),{defaults:i}},render(){return this.type==="text"?e.h("button",{type:"button"},this.$slots.default?this.$slots.default():void 0):e.h("button",{type:"button",class:"maplibregl-ctrl-icon"},[e.h("svg",{width:this.size||this.defaults.size,height:this.size||this.defaults.size,viewBox:this.viewbox||this.defaults.viewbox},e.h("path",{fill:"currentColor",d:this.path})),this.$slots.default?this.$slots.default():void 0])}});function ae(t){return t&&!!t.stopPropagation}const ne=e.defineComponent({name:"MglStyleSwitchControl",props:{position:{type:String,validator:t=>A.indexOf(t)!==-1},mapStyles:{type:Array,required:!0,default:[]},modelValue:{type:Object},isOpen:{type:Boolean,default:void 0}},emits:["update:modelValue","update:isOpen"],setup(t,{emit:i}){const o=e.inject(y),a=e.inject(C),r=e.inject(F),n=e.ref(!1),c=e.ref(t.isOpen===void 0?!1:t.isOpen),h=e.shallowRef(t.modelValue===void 0?t.mapStyles.length?t.mapStyles[0]:null:t.modelValue),f=new z(n,!1),T=V.bind(null,!1);function N(){const g=o.value.getStyle().name;for(let O=0,d=t.mapStyles.length;O<d;O++)if(t.mapStyles[O].name===g){_(t.mapStyles[O]);break}}e.watch(a,g=>{g&&N()},{immediate:!0}),o.value.on("style.load",N),document.addEventListener("click",T),I(e.toRef(t,"position"),o,f),t.modelValue!==void 0&&e.watch(e.toRef(t,"modelValue"),g=>{g!==void 0&&(h.value=g)}),t.isOpen!==void 0&&e.watch(e.toRef(t,"isOpen"),g=>{g!==void 0&&(c.value=g)}),e.onBeforeUnmount(()=>{o.value.removeControl(f),o.value.off("style.load",N),document.removeEventListener("click",T)});function _(g){var O;((O=h.value)==null?void 0:O.name)!==g.name&&(r.emit("styleSwitched",g),o.value.setStyle(g.style),t.modelValue===void 0&&(h.value=g),i("update:modelValue",g),V(!1))}function V(g,O){ae(O)?O.stopPropagation():ae(g)&&g.stopPropagation(),!(t.isOpen!==void 0&&t.isOpen===g||c.value===g)&&(t.isOpen===void 0?(c.value=typeof g=="boolean"?g:!c.value,i("update:isOpen",c.value)):i("update:isOpen",typeof g=="boolean"?g:!t.isOpen))}return{isAdded:n,container:f.container,setStyle:_,toggleOpen:V,intIsOpen:c,intModelValue:h}},template:` | ||
<slot> | ||
@@ -10,0 +10,0 @@ <slot name="button"></slot> |
{ | ||
"name": "vue-maplibre-gl", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"description": "Vue 3 plugin for maplibre-gl", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -231,2 +231,3 @@ import { | ||
registryItem.isLoaded = false; | ||
isLoaded.value = false; | ||
@@ -233,0 +234,0 @@ // unbind events |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
421980
3662