vue3-google-map 0.8.5 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +585 -16
- package/dist/cjs/index.js +77 -49
- package/dist/es/index.js +74 -53
- package/dist/themes/es/index.js +28 -0
- package/dist/{types/themes → themes/types}/aubergine.d.ts +0 -0
- package/dist/{types/themes → themes/types}/dark.d.ts +0 -0
- package/dist/{types/themes → themes/types}/grey.d.ts +0 -0
- package/dist/{types/themes → themes/types}/index.d.ts +0 -0
- package/dist/{types/themes → themes/types}/minimal.d.ts +0 -0
- package/dist/{types/themes → themes/types}/retro.d.ts +0 -0
- package/dist/{types/themes → themes/types}/roadways.d.ts +0 -0
- package/dist/{types/themes → themes/types}/roadwaysMinimal.d.ts +0 -0
- package/dist/{types/themes → themes/types}/ultraLight.d.ts +0 -0
- package/dist/types/components/GoogleMap.vue.d.ts +3 -3
- package/dist/types/components/InfoWindow.vue.d.ts +5 -3
- package/dist/types/components/Marker.d.ts +4 -4
- package/dist/types/components/MarkerCluster.d.ts +15 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/index.d.ts +0 -1
- package/dist/types/shared/index.d.ts +5 -2
- package/package.json +22 -4
package/dist/es/index.js
CHANGED
|
@@ -1,57 +1,78 @@
|
|
|
1
|
-
import{ref,defineComponent,provide,watch,onMounted,toRef,onBeforeUnmount,pushScopeId,popScopeId,openBlock,createBlock,createVNode,renderSlot,withScopeId,inject,Fragment,createCommentVNode,withDirectives,vShow,
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import{ref,defineComponent,provide,watch,onMounted,toRef,onBeforeUnmount,pushScopeId,popScopeId,openBlock,createBlock,createVNode,renderSlot,withScopeId,inject,computed,Fragment,createCommentVNode,withDirectives,vShow,Comment,markRaw}from'vue';/*
|
|
2
|
+
*****************************************************************************
|
|
3
|
+
Copyright (c) Microsoft Corporation.
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted.
|
|
7
|
+
|
|
8
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
+
*****************************************************************************/
|
|
16
|
+
let u=Symbol("map"),v=Symbol("api"),w=Symbol("marker"),x=Symbol("markerCluster"),y=Symbol("mapTilesLoaded"),z=ref(null),A="click dblclick drag dragend dragstart mousedown mousemove mouseout mouseover mouseup rightclick".split(" ");
|
|
17
|
+
var aa=function B(a,b){if(a===b)return!0;if(a&&b&&"object"==typeof a&&"object"==typeof b){if(a.constructor!==b.constructor)return!1;var d;if(Array.isArray(a)){var e=a.length;if(e!=b.length)return!1;for(d=e;0!==d--;)if(!B(a[d],b[d]))return!1;return!0}if(a.constructor===RegExp)return a.source===b.source&&a.flags===b.flags;if(a.valueOf!==Object.prototype.valueOf)return a.valueOf()===b.valueOf();if(a.toString!==Object.prototype.toString)return a.toString()===b.toString();var g=Object.keys(a);e=g.length;
|
|
18
|
+
if(e!==Object.keys(b).length)return!1;for(d=e;0!==d--;)if(!Object.prototype.hasOwnProperty.call(b,g[d]))return!1;for(d=e;0!==d--;)if(e=g[d],!B(a[e],b[e]))return!1;return!0}return a!==a&&b!==b};
|
|
19
|
+
class C{constructor({apiKey:a,channel:b,client:c,id:d="__googleMapsScriptId",libraries:e=[],language:g,region:f,version:l,mapIds:h,nonce:k,retries:m=3,url:n="https://maps.googleapis.com/maps/api/js"}){this.CALLBACK="__googleMapsCallback";this.callbacks=[];this.loading=this.done=!1;this.errors=[];this.version=l;this.apiKey=a;this.channel=b;this.client=c;this.id=d||"__googleMapsScriptId";this.libraries=e;this.language=g;this.region=f;this.mapIds=h;this.nonce=k;this.retries=m;this.url=n;if(C.instance){if(!aa(this.options,
|
|
20
|
+
C.instance.options))throw Error(`Loader must not be called again with different options. ${JSON.stringify(this.options)} !== ${JSON.stringify(C.instance.options)}`);return C.instance}C.instance=this}get options(){return{version:this.version,apiKey:this.apiKey,channel:this.channel,client:this.client,id:this.id,libraries:this.libraries,language:this.language,region:this.region,mapIds:this.mapIds,nonce:this.nonce,url:this.url}}get failed(){return this.done&&!this.loading&&this.errors.length>=this.retries+
|
|
6
21
|
1}createUrl(){let a=this.url;a+=`?callback=${this.CALLBACK}`;this.apiKey&&(a+=`&key=${this.apiKey}`);this.channel&&(a+=`&channel=${this.channel}`);this.client&&(a+=`&client=${this.client}`);0<this.libraries.length&&(a+=`&libraries=${this.libraries.join(",")}`);this.language&&(a+=`&language=${this.language}`);this.region&&(a+=`®ion=${this.region}`);this.version&&(a+=`&v=${this.version}`);this.mapIds&&(a+=`&map_ids=${this.mapIds.join(",")}`);return a}deleteScript(){let a=document.getElementById(this.id);
|
|
7
|
-
a&&a.remove()}load(){return this.loadPromise()}loadPromise(){return new Promise((a,b)=>{this.loadCallback(
|
|
22
|
+
a&&a.remove()}load(){return this.loadPromise()}loadPromise(){return new Promise((a,b)=>{this.loadCallback(c=>{c?b(c.error):a(window.google)})})}loadCallback(a){this.callbacks.push(a);this.execute()}setScript(){if(document.getElementById(this.id))this.callback();else{var a=this.createUrl(),b=document.createElement("script");b.id=this.id;b.type="text/javascript";b.src=a;b.onerror=this.loadErrorCallback.bind(this);b.defer=!0;b.async=!0;this.nonce&&(b.nonce=this.nonce);document.head.appendChild(b)}}reset(){this.deleteScript();
|
|
8
23
|
this.loading=this.done=!1;this.errors=[];this.onerrorEvent=null}resetIfRetryingFailed(){this.failed&&this.reset()}loadErrorCallback(a){this.errors.push(a);this.errors.length<=this.retries?(a=this.errors.length*Math.pow(2,this.errors.length),console.log(`Failed to load Google Maps script, retrying in ${a} ms.`),setTimeout(()=>{this.deleteScript();this.setScript()},a)):(this.onerrorEvent=a,this.callback())}setCallback(){window.__googleMapsCallback=this.callback.bind(this)}callback(){this.done=!0;this.loading=
|
|
9
|
-
!1;this.callbacks.forEach(a=>{a(this.onerrorEvent)});this.callbacks=[]}execute(){this.resetIfRetryingFailed();this.done?this.callback():window.google&&window.google.maps&&window.google.maps.version?(console.warn("Google Maps already loaded outside @googlemaps/js-api-loader.This may result in undesirable behavior as options and script parameters may not match."),this.callback()):this.loading||(this.loading=!0,this.setCallback(),this.setScript())}}let
|
|
10
|
-
var
|
|
24
|
+
!1;this.callbacks.forEach(a=>{a(this.onerrorEvent)});this.callbacks=[]}execute(){this.resetIfRetryingFailed();this.done?this.callback():window.google&&window.google.maps&&window.google.maps.version?(console.warn("Google Maps already loaded outside @googlemaps/js-api-loader.This may result in undesirable behavior as options and script parameters may not match."),this.callback()):this.loading||(this.loading=!0,this.setCallback(),this.setScript())}}let D="bounds_changed center_changed click dblclick drag dragend dragstart heading_changed idle maptypeid_changed mousemove mouseout mouseover projection_changed resize rightclick tilesloaded tilt_changed zoom_changed".split(" ");
|
|
25
|
+
var E=defineComponent({props:{apiKey:{type:String,default:""},version:{type:String,default:"weekly"},libraries:{type:Array,default:()=>["places"]},region:{type:String,required:!1},language:{type:String,required:!1},backgroundColor:{type:String,required:!1},center:{type:Object,default:()=>({lat:0,lng:0})},clickableIcons:{type:Boolean,required:!1,default:void 0},controlSize:{type:Number,required:!1},disableDefaultUi:{type:Boolean,required:!1,default:void 0},disableDoubleClickZoom:{type:Boolean,required:!1,
|
|
11
26
|
default:void 0},draggable:{type:Boolean,required:!1,default:void 0},draggableCursor:{type:String,required:!1},draggingCursor:{type:String,required:!1},fullscreenControl:{type:Boolean,required:!1,default:void 0},fullscreenControlPosition:{type:String,required:!1},gestureHandling:{type:String,required:!1},heading:{type:Number,required:!1},keyboardShortcuts:{type:Boolean,required:!1,default:void 0},mapTypeControl:{type:Boolean,required:!1,default:void 0},mapTypeControlOptions:{type:Object,required:!1},
|
|
12
27
|
mapTypeId:{type:[Number,String],required:!1},maxZoom:{type:Number,required:!1},minZoom:{type:Number,required:!1},noClear:{type:Boolean,required:!1,default:void 0},panControl:{type:Boolean,required:!1,default:void 0},panControlPosition:{type:String,required:!1},restriction:{type:Object,required:!1},rotateControl:{type:Boolean,required:!1,default:void 0},rotateControlPosition:{type:String,required:!1},scaleControl:{type:Boolean,required:!1,default:void 0},scaleControlStyle:{type:Number,required:!1},
|
|
13
|
-
scrollwheel:{type:Boolean,required:!1,default:void 0},streetView:{type:Object,required:!1},streetViewControl:{type:Boolean,required:!1,default:void 0},streetViewControlPosition:{type:String,required:!1},styles:{type:Array,required:!1},tilt:{type:Number,required:!1},zoom:{type:Number,required:!1},zoomControl:{type:Boolean,required:!1,default:void 0},zoomControlPosition:{type:String,required:!1}},emits:
|
|
14
|
-
|
|
15
|
-
disableDefaultUI:a.disableDefaultUi};return{...
|
|
16
|
-
|
|
17
|
-
(a=
|
|
18
|
-
|
|
19
|
-
let G=
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
(
|
|
29
|
-
|
|
30
|
-
let
|
|
31
|
-
{
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
{
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
{
|
|
39
|
-
{
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
{
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
{
|
|
47
|
-
|
|
48
|
-
var
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
{
|
|
57
|
-
|
|
28
|
+
scrollwheel:{type:Boolean,required:!1,default:void 0},streetView:{type:Object,required:!1},streetViewControl:{type:Boolean,required:!1,default:void 0},streetViewControlPosition:{type:String,required:!1},styles:{type:Array,required:!1},tilt:{type:Number,required:!1},zoom:{type:Number,required:!1},zoomControl:{type:Boolean,required:!1,default:void 0},zoomControlPosition:{type:String,required:!1}},emits:D,setup(a,{emit:b}){let c=ref(null),d=ref(!1),e=ref(null),g=ref(null),f=ref(!1);provide(u,e);provide(v,
|
|
29
|
+
g);provide(y,f);let l=()=>{const b={...a};Object.keys(b).forEach(a=>{void 0===b[a]&&delete b[a]});var c=a=>{var b;return a?{position:null===(b=g.value)||void 0===b?void 0:b.ControlPosition[a]}:{}};c={scaleControlOptions:a.scaleControlStyle?{style:a.scaleControlStyle}:{},panControlOptions:c(a.panControlPosition),zoomControlOptions:c(a.zoomControlPosition),rotateControlOptions:c(a.rotateControlPosition),streetViewControlOptions:c(a.streetViewControlPosition),fullscreenControlOptions:c(a.fullscreenControlPosition),
|
|
30
|
+
disableDefaultUI:a.disableDefaultUi};return{...b,...c}},h=watch([g,e],([a,b])=>{a&&b&&(a.event.addListenerOnce(b,"tilesloaded",()=>{f.value=!0}),setTimeout(h,0))},{immediate:!0}),k=()=>{try{const {apiKey:b,region:c,version:d,language:e,libraries:f}=a;z.value=new C({apiKey:b,region:c,version:d,language:e,libraries:f})}catch(m){console.error(m)}};onMounted(()=>{k();z.value.load().then(()=>{g.value=google.maps;e.value=new google.maps.Map(c.value,l());D.forEach(a=>{var c;null===(c=e.value)||void 0===
|
|
31
|
+
c?void 0:c.addListener(a,c=>b(a,c))});d.value=!0;let f=Object.keys(a).filter(a=>!["center","zoom"].includes(a)).map(b=>toRef(a,b));watch([()=>a.center,()=>a.zoom,...f],([a,b],[c,d])=>{var f,g,h;let {center:k,zoom:m,...n}=l();null===(f=e.value)||void 0===f?void 0:f.setOptions(n);void 0!==b&&b!==d&&(null===(g=e.value)||void 0===g?void 0:g.setZoom(b));b=!c||a.lng!==c.lng||a.lat!==c.lat;a&&b&&(null===(h=e.value)||void 0===h?void 0:h.panTo(a))})})});onBeforeUnmount(()=>{var a;f.value=!1;e.value&&(null===
|
|
32
|
+
(a=g.value)||void 0===a?void 0:a.event.clearInstanceListeners(e.value))});return{mapRef:c,ready:d,map:e,api:g,mapTilesLoaded:f}}});function F(a,b){void 0===b&&(b={});b=b.insertAt;if(a&&"undefined"!==typeof document){var c=document.head||document.getElementsByTagName("head")[0],d=document.createElement("style");d.type="text/css";"top"===b?c.firstChild?c.insertBefore(d,c.firstChild):c.appendChild(d):c.appendChild(d);d.styleSheet?d.styleSheet.cssText=a:d.appendChild(document.createTextNode(a))}}F("\n.mapdiv[data-v-177d06e3] {\n width: 100%;\n height: 100%;\n}\n");
|
|
33
|
+
let ba=withScopeId("data-v-177d06e3");pushScopeId("data-v-177d06e3");let ca={ref:"mapRef",class:"mapdiv"};popScopeId();let da=ba(a=>(openBlock(),createBlock("div",null,[createVNode("div",ca,null,512),renderSlot(a.$slots,"default",{ready:a.ready,map:a.map,api:a.api,mapTilesLoaded:a.mapTilesLoaded},void 0,!0)])));E.render=da;E.__scopeId="data-v-177d06e3";
|
|
34
|
+
let G=(a,b,c,d)=>{let e=null;const g=ref(null),f=inject(u,ref()),l=inject(v,ref()),h=inject(x,ref()),k=computed(()=>!!(h.value&&l.value&&e instanceof l.value.Marker));watch([f,c],(m,[n,t])=>{var q,p,r;m=JSON.stringify(c.value)!==JSON.stringify(t)||f.value!==n;f.value&&l.value&&m&&(e?(e.setOptions(c.value),k.value&&(null===(q=h.value)||void 0===q?void 0:q.removeMarker(e),null===(p=h.value)||void 0===p?void 0:p.addMarker(e))):(g.value="Marker"===a?e=new l.value[a](c.value):e=new l.value[a]({...c.value,
|
|
35
|
+
map:f.value}),k.value?null===(r=h.value)||void 0===r?void 0:r.addMarker(e):e.setMap(f.value),b.forEach(a=>{null===e||void 0===e?void 0:e.addListener(a,b=>d(a,b))})))},{immediate:!0});onBeforeUnmount(()=>{var a,b;e&&(null===(a=l.value)||void 0===a?void 0:a.event.clearInstanceListeners(e),k.value?null===(b=h.value)||void 0===b?void 0:b.removeMarker(e):e.setMap(null))});return g},H="animation_changed click dblclick rightclick dragstart dragend drag mouseover mousedown mouseout mouseup draggable_changed clickable_changed contextmenu cursor_changed flat_changed rightclick zindex_changed icon_changed position_changed shape_changed title_changed visible_changed".split(" ");
|
|
36
|
+
var ea=defineComponent({name:"Marker",props:{options:{type:Object,required:!0}},emits:H,setup(a,{emit:b,expose:c,slots:d}){a=toRef(a,"options");b=G("Marker",H,a,b);provide(w,b);c({marker:b});return()=>{var a;return null===(a=d.default)||void 0===a?void 0:a.call(d)}}}),fa=defineComponent({name:"Polyline",props:{options:{type:Object,required:!0}},emits:A,setup(a,{emit:b}){a=toRef(a,"options");return{polyline:G("Polyline",A,a,b)}},render:()=>null}),ha=defineComponent({name:"Polygon",props:{options:{type:Object,
|
|
37
|
+
required:!0}},emits:A,setup(a,{emit:b}){a=toRef(a,"options");return{polygon:G("Polygon",A,a,b)}},render:()=>null});let I=A.concat(["bounds_changed"]);var ia=defineComponent({name:"Rectangle",props:{options:{type:Object,required:!0}},emits:I,setup(a,{emit:b}){a=toRef(a,"options");return{rectangle:G("Rectangle",I,a,b)}},render:()=>null});let J=A.concat(["center_changed","radius_changed"]);
|
|
38
|
+
var ja=defineComponent({name:"Circle",props:{options:{type:Object,required:!0}},emits:J,setup(a,{emit:b}){a=toRef(a,"options");return{circle:G("Circle",J,a,b)}},render:()=>null}),K=defineComponent({props:{position:{type:String,required:!0},index:{type:Number,default:1}},emits:["content:loaded"],setup(a,{emit:b}){let c=ref(null),d=inject(u,ref()),e=inject(v,ref()),g=inject(y,ref(!1)),f=ref(!1),l=watch([g,e,c],([c,d,e])=>{d&&c&&e&&(h(a.position),f.value=!0,b("content:loaded"),setTimeout(l,0))},{immediate:!0}),
|
|
39
|
+
h=a=>{d.value&&e.value&&c.value&&d.value.controls[e.value.ControlPosition[a]].push(c.value)},k=a=>{if(d.value&&e.value){let b=null;a=e.value.ControlPosition[a];d.value.controls[a].forEach((a,d)=>{a===c.value&&(b=d)});null!==b&&d.value.controls[a].removeAt(b)}};onBeforeUnmount(()=>k(a.position));watch(()=>a.position,(a,b)=>{k(b);h(a)});watch(()=>a.index,b=>{b&&c.value&&(c.value.index=a.index)});return{controlRef:c,showContent:f}}});let ka={ref:"controlRef"};
|
|
40
|
+
K.render=function(a){return openBlock(),createBlock(Fragment,null,[createCommentVNode("\n v-show must be used instead of v-if otherwise there\n would be no rendered content pushed to the map controls\n "),withDirectives(createVNode("div",ka,[renderSlot(a.$slots,"default")],512),[[vShow,a.showContent]])],2112)};let L="closeclick content_changed domready position_changed visible zindex_changed".split(" ");
|
|
41
|
+
var M=defineComponent({props:{options:{type:Object,default:()=>({})}},emits:L,setup(a,{slots:b,emit:c}){let d,e=ref(),g=ref(),f=inject(u,ref()),l=inject(v,ref()),h=inject(w,ref()),k,m=computed(()=>{var a;return null===(a=b.default)||void 0===a?void 0:a.call(b).some(a=>a.type!==Comment)});onMounted(()=>{watch([f,()=>a.options],([,a],[b,q])=>{b=JSON.stringify(a)!==JSON.stringify(q)||f.value!==b;f.value&&l.value&&b&&(d?(d.setOptions({...a,content:m.value?g.value:a.content}),h.value||d.open({map:f.value})):
|
|
42
|
+
(e.value=d=new l.value.InfoWindow({...a,content:m.value?g.value:a.content}),h.value?k=h.value.addListener("click",()=>{d.open({map:f.value,anchor:h.value})}):d.open({map:f.value}),L.forEach(a=>{null===d||void 0===d?void 0:d.addListener(a,b=>c(a,b))})))},{immediate:!0})});onBeforeUnmount(()=>{var a;k&&k.remove();d&&(null===(a=l.value)||void 0===a?void 0:a.event.clearInstanceListeners(d),d.close())});return{infoWindow:e,infoWindowRef:g,hasSlotContent:m,anchor:h}}});F("\n.info-window-content[data-v-5b373d6e] {\n display: none;\n}\n.mapdiv .info-window-content[data-v-5b373d6e] {\n display: block;\n}\n");
|
|
43
|
+
let la=withScopeId("data-v-5b373d6e");pushScopeId("data-v-5b373d6e");let ma={key:0,ref:"infoWindowRef",class:"info-window-content"};popScopeId();let na=la(a=>a.hasSlotContent?(openBlock(),createBlock("div",ma,[renderSlot(a.$slots,"default",{},void 0,!0)],512)):createCommentVNode("v-if",!0));M.render=na;M.__scopeId="data-v-5b373d6e";function N(a,b,c,d,e,g){if(!(e-d<=c)){var f=d+e>>1;O(a,b,f,d,e,g%2);N(a,b,c,d,f-1,g+1);N(a,b,c,f+1,e,g+1)}}
|
|
44
|
+
function O(a,b,c,d,e,g){for(;e>d;){if(600<e-d){var f=e-d+1,l=c-d+1,h=Math.log(f),k=.5*Math.exp(2*h/3);h=.5*Math.sqrt(h*k*(f-k)/f)*(0>l-f/2?-1:1);O(a,b,c,Math.max(d,Math.floor(c-l*k/f+h)),Math.min(e,Math.floor(c+(f-l)*k/f+h)),g)}f=b[2*c+g];l=d;k=e;P(a,b,d,c);for(b[2*e+g]>f&&P(a,b,d,e);l<k;){P(a,b,l,k);l++;for(k--;b[2*l+g]<f;)l++;for(;b[2*k+g]>f;)k--}b[2*d+g]===f?P(a,b,d,k):(k++,P(a,b,k,e));k<=c&&(d=k+1);c<=k&&(e=k-1)}}function P(a,b,c,d){Q(a,c,d);Q(b,2*c,2*d);Q(b,2*c+1,2*d+1)}
|
|
45
|
+
function Q(a,b,c){let d=a[b];a[b]=a[c];a[c]=d}let oa=a=>a[0],pa=a=>a[1];
|
|
46
|
+
class R{constructor(a,b=oa,c=pa,d=64,e=Float64Array){this.nodeSize=d;this.points=a;let g=this.ids=new (65536>a.length?Uint16Array:Uint32Array)(a.length);e=this.coords=new e(2*a.length);for(let d=0;d<a.length;d++)g[d]=d,e[2*d]=b(a[d]),e[2*d+1]=c(a[d]);N(g,e,d,0,g.length-1,0)}range(a,b,c,d){{var e=this.ids,g=this.coords,f=this.nodeSize;let h=[0,e.length-1,0],k=[],m,n;for(;h.length;){var l=h.pop();let t=h.pop(),q=h.pop();if(t-q<=f){for(l=q;l<=t;l++)m=g[2*l],n=g[2*l+1],m>=a&&m<=c&&n>=b&&n<=d&&k.push(e[l]);
|
|
47
|
+
continue}let p=Math.floor((q+t)/2);m=g[2*p];n=g[2*p+1];m>=a&&m<=c&&n>=b&&n<=d&&k.push(e[p]);let r=(l+1)%2;if(0===l?a<=m:b<=n)h.push(q),h.push(p-1),h.push(r);if(0===l?c>=m:d>=n)h.push(p+1),h.push(t),h.push(r)}a=k}return a}within(a,b,c){{var d=this.ids,e=this.coords,g=this.nodeSize;let m=[0,d.length-1,0],n=[],t=c*c;for(;m.length;){var f=m.pop();let q=m.pop();var l=m.pop();if(q-l<=g){for(f=l;f<=q;f++){l=e[2*f]-a;var h=e[2*f+1]-b;l=l*l+h*h;l<=t&&n.push(d[f])}continue}h=Math.floor((l+q)/2);let p=e[2*h],
|
|
48
|
+
r=e[2*h+1];{var k=p-a;let c=r-b;k=k*k+c*c}k<=t&&n.push(d[h]);k=(f+1)%2;if(0===f?a-c<=p:b-c<=r)m.push(l),m.push(h-1),m.push(k);if(0===f?a+c>=p:b+c>=r)m.push(h+1),m.push(q),m.push(k)}a=n}return a}}let qa={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:a=>a},S=Math.fround||(a=>b=>{a[0]=+b;return a[0]})(new Float32Array(1));
|
|
49
|
+
class ra{constructor(a){this.options=T(Object.create(qa),a);this.trees=Array(this.options.maxZoom+1)}load(a){let {log:b,minZoom:c,maxZoom:d,nodeSize:e}=this.options;b&&console.time("total time");var g=`prepare ${a.length} points`;b&&console.time(g);this.points=a;let f=[];for(let b=0;b<a.length;b++)a[b].geometry&&f.push(sa(a[b],b));this.trees[d+1]=new R(f,U,V,e,Float32Array);b&&console.timeEnd(g);for(a=d;a>=c;a--)g=+Date.now(),f=this._cluster(f,a),this.trees[a]=new R(f,U,V,e,Float32Array),b&&console.log("z%d: %d clusters in %dms",
|
|
50
|
+
a,f.length,+Date.now()-g);b&&console.timeEnd("total time");return this}getClusters(a,b){let c=((a[0]+180)%360+360)%360-180;var d=Math.max(-90,Math.min(90,a[1])),e=180===a[2]?180:((a[2]+180)%360+360)%360-180;let g=Math.max(-90,Math.min(90,a[3]));if(360<=a[2]-a[0])c=-180,e=180;else if(c>e){var f=this.getClusters([c,d,180,g],b);d=this.getClusters([-180,d,e,g],b);return f.concat(d)}b=this.trees[this._limitZoom(b)];e=b.range(c/360+.5,W(g),e/360+.5,W(d));d=[];for(f of e)e=b.points[f],d.push(e.numPoints?
|
|
51
|
+
ta(e):this.points[e.index]);return d}getChildren(a){var b=this._getOriginId(a),c=this._getOriginZoom(a);let d=this.trees[c];if(!d)throw Error("No cluster with the specified id.");b=d.points[b];if(!b)throw Error("No cluster with the specified id.");b=d.within(b.x,b.y,this.options.radius/(this.options.extent*Math.pow(2,c-1)));c=[];for(let e of b)b=d.points[e],b.parentId===a&&c.push(b.numPoints?ta(b):this.points[b.index]);if(0===c.length)throw Error("No cluster with the specified id.");return c}getLeaves(a,
|
|
52
|
+
b,c){let d=[];this._appendLeaves(d,a,b||10,c||0,0);return d}getTile(a,b,c){let d=this.trees[this._limitZoom(a)];a=Math.pow(2,a);let {extent:e,radius:g}=this.options,f=g/e,l=(c-f)/a,h=(c+1+f)/a,k={features:[]};this._addTileFeatures(d.range((b-f)/a,l,(b+1+f)/a,h),d.points,b,c,a,k);0===b&&this._addTileFeatures(d.range(1-f/a,l,1,h),d.points,a,c,a,k);b===a-1&&this._addTileFeatures(d.range(0,l,f/a,h),d.points,-1,c,a,k);return k.features.length?k:null}getClusterExpansionZoom(a){let b=this._getOriginZoom(a)-
|
|
53
|
+
1;for(;b<=this.options.maxZoom;){a=this.getChildren(a);b++;if(1!==a.length)break;a=a[0].properties.cluster_id}return b}_appendLeaves(a,b,c,d,e){b=this.getChildren(b);for(let g of b)if((b=g.properties)&&b.cluster?e=e+b.point_count<=d?e+b.point_count:this._appendLeaves(a,b.cluster_id,c,d,e):e<d?e++:a.push(g),a.length===c)break;return e}_addTileFeatures(a,b,c,d,e,g){for(let h of a){a=b[h];let k=a.numPoints;var f=void 0;let m;var l=void 0;k?(f=ua(a),m=a.x,l=a.y):(l=this.points[a.index],f=l.properties,
|
|
54
|
+
m=l.geometry.coordinates[0]/360+.5,l=W(l.geometry.coordinates[1]));f={type:1,geometry:[[Math.round(this.options.extent*(m*e-c)),Math.round(this.options.extent*(l*e-d))]],tags:f};let n;k?n=a.id:this.options.generateId?n=a.index:this.points[a.index].id&&(n=this.points[a.index].id);void 0!==n&&(f.id=n);g.features.push(f)}}_limitZoom(a){return Math.max(this.options.minZoom,Math.min(Math.floor(+a),this.options.maxZoom+1))}_cluster(a,b){let c=[],{radius:d,extent:e,reduce:g,minPoints:f}=this.options,l=d/
|
|
55
|
+
(e*Math.pow(2,b));for(let d=0;d<a.length;d++){var h=a[d];if(h.zoom<=b)continue;h.zoom=b;let e=this.trees[b+1];var k=e.within(h.x,h.y,l),m=h.numPoints||1;let p=m;for(let a of k){var n=e.points[a];n.zoom>b&&(p+=n.numPoints||1)}if(p>m&&p>=f){n=h.x*m;let a=h.y*m;m=g&&1<m?this._map(h,!0):null;let f=(d<<5)+(b+1)+this.points.length;for(let c of k){k=e.points[c];if(k.zoom<=b)continue;k.zoom=b;let d=k.numPoints||1;n+=k.x*d;a+=k.y*d;k.parentId=f;g&&(m||(m=this._map(h,!0)),g(m,this._map(k)))}h.parentId=f;c.push(va(n/
|
|
56
|
+
p,a/p,f,p,m))}else if(c.push(h),1<p)for(let a of k)h=e.points[a],h.zoom<=b||(h.zoom=b,c.push(h))}return c}_getOriginId(a){return a-this.points.length>>5}_getOriginZoom(a){return(a-this.points.length)%32}_map(a,b){if(a.numPoints)return b?T({},a.properties):a.properties;a=this.points[a.index].properties;let c=this.options.map(a);return b&&c===a?T({},c):c}}function va(a,b,c,d,e){return{x:S(a),y:S(b),zoom:Infinity,id:c,parentId:-1,numPoints:d,properties:e}}
|
|
57
|
+
function sa(a,b){let [c,d]=a.geometry.coordinates;return{x:S(c/360+.5),y:S(W(d)),zoom:Infinity,index:b,parentId:-1}}function ta(a){var b=a.id,c=ua(a);return{type:"Feature",id:b,properties:c,geometry:{type:"Point",coordinates:[360*(a.x-.5),360*Math.atan(Math.exp((180-360*a.y)*Math.PI/180))/Math.PI-90]}}}
|
|
58
|
+
function ua(a){let b=a.numPoints,c=1E4<=b?`${Math.round(b/1E3)}k`:1E3<=b?`${Math.round(b/100)/10}k`:b;return T(T({},a.properties),{cluster:!0,cluster_id:a.id,point_count:b,point_count_abbreviated:c})}function W(a){a=Math.sin(a*Math.PI/180);a=.5-.25*Math.log((1+a)/(1-a))/Math.PI;return 0>a?0:1<a?1:a}function T(a,b){for(let c in b)a[c]=b[c];return a}function U(a){return a.x}function V(a){return a.y}
|
|
59
|
+
var xa=function wa(a,b){if(a===b)return!0;if(a&&b&&"object"==typeof a&&"object"==typeof b){if(a.constructor!==b.constructor)return!1;var d;if(Array.isArray(a)){var e=a.length;if(e!=b.length)return!1;for(d=e;0!==d--;)if(!wa(a[d],b[d]))return!1;return!0}if(a.constructor===RegExp)return a.source===b.source&&a.flags===b.flags;if(a.valueOf!==Object.prototype.valueOf)return a.valueOf()===b.valueOf();if(a.toString!==Object.prototype.toString)return a.toString()===b.toString();var g=Object.keys(a);e=g.length;
|
|
60
|
+
if(e!==Object.keys(b).length)return!1;for(d=e;0!==d--;)if(!Object.prototype.hasOwnProperty.call(b,g[d]))return!1;for(d=e;0!==d--;)if(e=g[d],!wa(a[e],b[e]))return!1;return!0}return a!==a&&b!==b};
|
|
61
|
+
class X{constructor({markers:a,position:b}){this.markers=a;b&&(this._position=b instanceof google.maps.LatLng?b:new google.maps.LatLng(b))}get bounds(){if(0!==this.markers.length||this._position)return this.markers.reduce((a,b)=>a.extend(b.getPosition()),new google.maps.LatLngBounds(this._position,this._position))}get position(){return this._position||this.bounds.getCenter()}get count(){return this.markers.filter(a=>a.getVisible()).length}push(a){this.markers.push(a)}delete(){this.marker&&(this.marker.setMap(null),
|
|
62
|
+
delete this.marker);this.markers.length=0}}class ya{constructor({maxZoom:a=16}){this.maxZoom=a}noop({markers:a}){return za(a)}}let za=a=>a.map(a=>new X({position:a.getPosition(),markers:[a]}));
|
|
63
|
+
class Aa extends ya{constructor(a){var {maxZoom:b,radius:c=60}=a,d=["maxZoom","radius"],e={},g;for(g in a)Object.prototype.hasOwnProperty.call(a,g)&&0>d.indexOf(g)&&(e[g]=a[g]);if(null!=a&&"function"===typeof Object.getOwnPropertySymbols){var f=0;for(g=Object.getOwnPropertySymbols(a);f<g.length;f++)0>d.indexOf(g[f])&&Object.prototype.propertyIsEnumerable.call(a,g[f])&&(e[g[f]]=a[g[f]])}super({maxZoom:b});this.superCluster=new ra(Object.assign({maxZoom:this.maxZoom,radius:c},e));this.state={zoom:null}}calculate(a){let b=
|
|
64
|
+
!1;if(!xa(a.markers,this.markers)){b=!0;this.markers=[...a.markers];var c=this.markers.map(a=>({type:"Feature",geometry:{type:"Point",coordinates:[a.getPosition().lng(),a.getPosition().lat()]},properties:{marker:a}}));this.superCluster.load(c)}c={zoom:a.map.getZoom()};b||this.state.zoom>this.maxZoom&&c.zoom>this.maxZoom||(b=b||!xa(this.state,c));this.state=c;b&&(this.clusters=this.cluster(a));return{clusters:this.clusters,changed:b}}cluster({map:a}){return this.superCluster.getClusters([-180,-90,
|
|
65
|
+
180,90],Math.round(a.getZoom())).map(this.transformCluster.bind(this))}transformCluster({geometry:{coordinates:[a,b]},properties:c}){if(c.cluster)return new X({markers:this.superCluster.getLeaves(c.cluster_id,Infinity).map(a=>a.properties.marker),position:new google.maps.LatLng({lat:b,lng:a})});a=c.marker;return new X({markers:[a],position:a.getPosition()})}}
|
|
66
|
+
class Ba{constructor(a,b){this.markers={sum:a.length};a=b.map(a=>a.count);let c=a.reduce((a,b)=>a+b,0);this.clusters={count:b.length,markers:{mean:c/b.length,sum:c,min:Math.min(...a),max:Math.max(...a)}}}}class Ca{render({count:a,position:b},c){c=window.btoa(`
|
|
67
|
+
<svg fill="${a>Math.max(10,c.clusters.markers.mean)?"#ff0000":"#0000ff"}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 240">
|
|
68
|
+
<circle cx="120" cy="120" opacity=".6" r="70" />
|
|
69
|
+
<circle cx="120" cy="120" opacity=".3" r="90" />
|
|
70
|
+
<circle cx="120" cy="120" opacity=".2" r="110" />
|
|
71
|
+
</svg>`);return new google.maps.Marker({position:b,icon:{url:`data:image/svg+xml;base64,${c}`,scaledSize:new google.maps.Size(45,45)},label:{text:String(a),color:"rgba(255,255,255,0.9)",fontSize:"12px"},title:`Cluster of ${a} markers`,zIndex:Number(google.maps.Marker.MAX_ZINDEX)+a})}}class Da{constructor(){var a=Da,b=google.maps.OverlayView;for(let c in b.prototype)a.prototype[c]=b.prototype[c]}}var Y,Z=Y||(Y={});Z.CLUSTERING_BEGIN="clusteringbegin";Z.CLUSTERING_END="clusteringend";
|
|
72
|
+
Z.CLUSTER_CLICK="click";let Ea=(a,b,c)=>{c.fitBounds(b.bounds)};
|
|
73
|
+
class Fa extends Da{constructor({map:a,markers:b=[],algorithm:c=new Aa({}),renderer:d=new Ca,onClusterClick:e=Ea}){super();this.markers=[...b];this.clusters=[];this.algorithm=c;this.renderer=d;this.onClusterClick=e;a&&this.setMap(a)}addMarker(a,b){this.markers.includes(a)||(this.markers.push(a),b||this.render())}addMarkers(a,b){a.forEach(a=>{this.addMarker(a,!0)});b||this.render()}removeMarker(a,b){let c=this.markers.indexOf(a);if(-1===c)return!1;a.setMap(null);this.markers.splice(c,1);b||this.render();
|
|
74
|
+
return!0}removeMarkers(a,b){let c=!1;a.forEach(a=>{c=this.removeMarker(a,!0)||c});c&&!b&&this.render();return c}clearMarkers(a){this.markers.length=0;a||this.render()}render(){let a=this.getMap();if(a instanceof google.maps.Map&&this.getProjection()){google.maps.event.trigger(this,Y.CLUSTERING_BEGIN,this);let {clusters:b,changed:c}=this.algorithm.calculate({markers:this.markers,map:a,mapCanvasProjection:this.getProjection()});if(c||void 0==c)this.reset(),this.clusters=b,this.renderClusters();google.maps.event.trigger(this,
|
|
75
|
+
Y.CLUSTERING_END,this)}}onAdd(){this.idleListener=this.getMap().addListener("idle",this.render.bind(this));this.render()}onRemove(){google.maps.event.removeListener(this.idleListener);this.reset()}reset(){this.markers.forEach(a=>a.setMap(null));this.clusters.forEach(a=>a.delete());this.clusters=[]}renderClusters(){let a=new Ba(this.markers,this.clusters),b=this.getMap();this.clusters.forEach(c=>{1===c.markers.length?c.marker=c.markers[0]:(c.marker=this.renderer.render(c,a),this.onClusterClick&&c.marker.addListener("click",
|
|
76
|
+
a=>{google.maps.event.trigger(this,Y.CLUSTER_CLICK,c);this.onClusterClick(a,c,b)}));c.marker.setMap(b)})}}let Ga=["clusteringbegin","clusteringend","click"];
|
|
77
|
+
var Ha=defineComponent({name:"MarkerCluster",props:{options:{type:Object,default:()=>({})}},emits:Ga,setup(a,{emit:b,expose:c,slots:d}){let e=ref(),g=inject(u,ref()),f=inject(v,ref());provide(x,e);watch(g,()=>{g.value&&(e.value=markRaw(new Fa({map:g.value,...a.options})),Ga.forEach(a=>{var c;null===(c=e.value)||void 0===c?void 0:c.addListener(a,c=>b(a,c))}))},{immediate:!0});onBeforeUnmount(()=>{var a;e.value&&(null===(a=f.value)||void 0===a?void 0:a.event.clearInstanceListeners(e.value),e.value.clearMarkers(),
|
|
78
|
+
e.value.setMap(null))});c({markerCluster:e});return()=>{var a;return null===(a=d.default)||void 0===a?void 0:a.call(d)}}});export{ja as Circle,K as CustomControl,E as GoogleMap,M as InfoWindow,ea as Marker,Ha as MarkerCluster,ha as Polygon,fa as Polyline,ia as Rectangle}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
let a=[{featureType:"administrative.land_parcel",elementType:"all",stylers:[{visibility:"off"}]},{featureType:"administrative.land_parcel",elementType:"geometry.stroke",stylers:[{visibility:"off"},{weight:7}]},{featureType:"administrative.locality",elementType:"geometry.stroke",stylers:[{visibility:"on"}]},{featureType:"administrative.locality",elementType:"labels.text.fill",stylers:[{visibility:"on"}]},{featureType:"administrative.locality",elementType:"labels.text.stroke",stylers:[{visibility:"on"}]},
|
|
2
|
+
{featureType:"administrative.neighborhood",stylers:[{visibility:"off"}]},{featureType:"administrative.neighborhood",elementType:"geometry.fill",stylers:[{color:"#00ff28"},{visibility:"on"},{weight:2}]},{featureType:"administrative.neighborhood",elementType:"geometry.stroke",stylers:[{color:"#00ff28"},{visibility:"on"}]},{featureType:"administrative.neighborhood",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"administrative.neighborhood",elementType:"labels.text.stroke",stylers:[{visibility:"off"}]},
|
|
3
|
+
{featureType:"landscape.natural",elementType:"geometry.fill",stylers:[{visibility:"on"}]},{featureType:"poi",elementType:"labels.text",stylers:[{visibility:"off"}]},{featureType:"poi.attraction",stylers:[{visibility:"off"}]},{featureType:"poi.business",elementType:"all",stylers:[{visibility:"off"}]},{featureType:"poi.medical",elementType:"all",stylers:[{visibility:"off"}]},{featureType:"poi.place_of_worship",elementType:"all",stylers:[{visibility:"off"}]},{featureType:"poi.school",elementType:"all",
|
|
4
|
+
stylers:[{visibility:"off"}]},{featureType:"poi.sports_complex",elementType:"geometry.fill",stylers:[{visibility:"on"}]},{featureType:"poi.sports_complex",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"road",elementType:"labels.text",stylers:[{visibility:"on"},{lightness:-10},{color:"#b5b5b5"},{weight:.2}]},{featureType:"road",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"road.local",elementType:"geometry.fill",stylers:[{color:"#fbfbfb"},{lightness:-15},
|
|
5
|
+
{weight:.5}]},{featureType:"road.local",elementType:"geometry.stroke",stylers:[{visibility:"off"}]},{featureType:"transit",elementType:"all",stylers:[{visibility:"off"}]},{featureType:"transit.station",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"water",elementType:"labels.text",stylers:[{visibility:"off"}]}],b=[{featureType:"all",elementType:"labels",stylers:[{visibility:"on"}]},{featureType:"all",elementType:"labels.text.fill",stylers:[{saturation:36},{color:"#000000"},
|
|
6
|
+
{lightness:40}]},{featureType:"all",elementType:"labels.text.stroke",stylers:[{visibility:"on"},{color:"#000000"},{lightness:16}]},{featureType:"all",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"administrative",elementType:"geometry.fill",stylers:[{color:"#000000"},{lightness:20}]},{featureType:"administrative",elementType:"geometry.stroke",stylers:[{color:"#000000"},{lightness:17},{weight:1.2}]},{featureType:"administrative.country",elementType:"labels.text.fill",stylers:[{color:"#e5c163"}]},
|
|
7
|
+
{featureType:"administrative.locality",elementType:"labels.text.fill",stylers:[{color:"#c4c4c4"}]},{featureType:"administrative.neighborhood",elementType:"labels.text.fill",stylers:[{color:"#e5c163"}]},{featureType:"landscape",elementType:"geometry",stylers:[{color:"#000000"},{lightness:20}]},{featureType:"poi",elementType:"geometry",stylers:[{color:"#000000"},{lightness:21},{visibility:"on"}]},{featureType:"poi.business",elementType:"geometry",stylers:[{visibility:"on"}]},{featureType:"road.highway",
|
|
8
|
+
elementType:"geometry.fill",stylers:[{color:"#e5c163"},{lightness:0}]},{featureType:"road.highway",elementType:"geometry.stroke",stylers:[{visibility:"off"}]},{featureType:"road.highway",elementType:"labels.text.fill",stylers:[{color:"#ffffff"}]},{featureType:"road.highway",elementType:"labels.text.stroke",stylers:[{color:"#e5c163"}]},{featureType:"road.arterial",elementType:"geometry",stylers:[{color:"#000000"},{lightness:18}]},{featureType:"road.arterial",elementType:"geometry.fill",stylers:[{color:"#575757"}]},
|
|
9
|
+
{featureType:"road.arterial",elementType:"labels.text.fill",stylers:[{color:"#ffffff"}]},{featureType:"road.arterial",elementType:"labels.text.stroke",stylers:[{color:"#2c2c2c"}]},{featureType:"road.local",elementType:"geometry",stylers:[{color:"#000000"},{lightness:16}]},{featureType:"road.local",elementType:"labels.text.fill",stylers:[{color:"#999999"}]},{featureType:"transit",elementType:"geometry",stylers:[{color:"#000000"},{lightness:19}]},{featureType:"water",elementType:"geometry",stylers:[{color:"#000000"},
|
|
10
|
+
{lightness:17}]}],c=[...b,...a];
|
|
11
|
+
var aubergine=[{elementType:"geometry",stylers:[{color:"#1d2c4d"}]},{elementType:"labels.text.fill",stylers:[{color:"#8ec3b9"}]},{elementType:"labels.text.stroke",stylers:[{color:"#1a3646"}]},{featureType:"administrative.country",elementType:"geometry.stroke",stylers:[{color:"#4b6878"}]},{featureType:"administrative.land_parcel",elementType:"labels.text.fill",stylers:[{color:"#64779e"}]},{featureType:"administrative.province",elementType:"geometry.stroke",stylers:[{color:"#4b6878"}]},{featureType:"landscape.man_made",
|
|
12
|
+
elementType:"geometry.stroke",stylers:[{color:"#334e87"}]},{featureType:"landscape.natural",elementType:"geometry",stylers:[{color:"#023e58"}]},{featureType:"poi",elementType:"geometry",stylers:[{color:"#283d6a"}]},{featureType:"poi",elementType:"labels.text.fill",stylers:[{color:"#6f9ba5"}]},{featureType:"poi",elementType:"labels.text.stroke",stylers:[{color:"#1d2c4d"}]},{featureType:"poi.park",elementType:"geometry.fill",stylers:[{color:"#023e58"}]},{featureType:"poi.park",elementType:"labels.text.fill",
|
|
13
|
+
stylers:[{color:"#3C7680"}]},{featureType:"road",elementType:"geometry",stylers:[{color:"#304a7d"}]},{featureType:"road",elementType:"labels.text.fill",stylers:[{color:"#98a5be"}]},{featureType:"road",elementType:"labels.text.stroke",stylers:[{color:"#1d2c4d"}]},{featureType:"road.highway",elementType:"geometry",stylers:[{color:"#2c6675"}]},{featureType:"road.highway",elementType:"geometry.stroke",stylers:[{color:"#255763"}]},{featureType:"road.highway",elementType:"labels.text.fill",stylers:[{color:"#b0d5ce"}]},
|
|
14
|
+
{featureType:"road.highway",elementType:"labels.text.stroke",stylers:[{color:"#023e58"}]},{featureType:"transit",elementType:"labels.text.fill",stylers:[{color:"#98a5be"}]},{featureType:"transit",elementType:"labels.text.stroke",stylers:[{color:"#1d2c4d"}]},{featureType:"transit.line",elementType:"geometry.fill",stylers:[{color:"#283d6a"}]},{featureType:"transit.station",elementType:"geometry",stylers:[{color:"#3a4762"}]},{featureType:"water",elementType:"geometry",stylers:[{color:"#0e1626"}]},{featureType:"water",
|
|
15
|
+
elementType:"labels.text.fill",stylers:[{color:"#4e6d70"}]}];
|
|
16
|
+
var dark=[{elementType:"geometry",stylers:[{color:"#242f3e"}]},{elementType:"labels.text.stroke",stylers:[{color:"#242f3e"}]},{elementType:"labels.text.fill",stylers:[{color:"#746855"}]},{featureType:"administrative.locality",elementType:"labels.text.fill",stylers:[{color:"#d59563"}]},{featureType:"poi",elementType:"labels.text.fill",stylers:[{color:"#d59563"}]},{featureType:"poi.park",elementType:"geometry",stylers:[{color:"#263c3f"}]},{featureType:"poi.park",elementType:"labels.text.fill",stylers:[{color:"#6b9a76"}]},
|
|
17
|
+
{featureType:"road",elementType:"geometry",stylers:[{color:"#38414e"}]},{featureType:"road",elementType:"geometry.stroke",stylers:[{color:"#212a37"}]},{featureType:"road",elementType:"labels.text.fill",stylers:[{color:"#9ca5b3"}]},{featureType:"road.highway",elementType:"geometry",stylers:[{color:"#746855"}]},{featureType:"road.highway",elementType:"geometry.stroke",stylers:[{color:"#1f2835"}]},{featureType:"road.highway",elementType:"labels.text.fill",stylers:[{color:"#f3d19c"}]},{featureType:"transit",
|
|
18
|
+
elementType:"geometry",stylers:[{color:"#2f3948"}]},{featureType:"transit.station",elementType:"labels.text.fill",stylers:[{color:"#d59563"}]},{featureType:"water",elementType:"geometry",stylers:[{color:"#17263c"}]},{featureType:"water",elementType:"labels.text.fill",stylers:[{color:"#515c6d"}]},{featureType:"water",elementType:"labels.text.stroke",stylers:[{color:"#17263c"}]}];
|
|
19
|
+
var grey=[{featureType:"all",elementType:"labels.text.fill",stylers:[{saturation:36},{color:"#000000"},{lightness:40}]},{featureType:"all",elementType:"labels.text.stroke",stylers:[{visibility:"on"},{color:"#000000"},{lightness:16}]},{featureType:"all",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"administrative",elementType:"geometry.fill",stylers:[{color:"#000000"},{lightness:20}]},{featureType:"administrative",elementType:"geometry.stroke",stylers:[{color:"#000000"},
|
|
20
|
+
{lightness:17},{weight:1.2}]},{featureType:"landscape",elementType:"geometry",stylers:[{color:"#000000"},{lightness:20}]},{featureType:"poi",elementType:"geometry",stylers:[{color:"#000000"},{lightness:21}]},{featureType:"road.highway",elementType:"geometry.fill",stylers:[{color:"#000000"},{lightness:17}]},{featureType:"road.highway",elementType:"geometry.stroke",stylers:[{color:"#000000"},{lightness:29},{weight:.2}]},{featureType:"road.arterial",elementType:"geometry",stylers:[{color:"#000000"},
|
|
21
|
+
{lightness:18}]},{featureType:"road.local",elementType:"geometry",stylers:[{color:"#000000"},{lightness:16}]},{featureType:"transit",elementType:"geometry",stylers:[{color:"#000000"},{lightness:19}]},{featureType:"water",elementType:"geometry",stylers:[{color:"#000000"},{lightness:17}]}];
|
|
22
|
+
var retro=[{elementType:"geometry",stylers:[{color:"#ebe3cd"}]},{elementType:"labels.text.fill",stylers:[{color:"#523735"}]},{elementType:"labels.text.stroke",stylers:[{color:"#f5f1e6"}]},{featureType:"administrative",elementType:"geometry.stroke",stylers:[{color:"#c9b2a6"}]},{featureType:"administrative.land_parcel",elementType:"geometry.stroke",stylers:[{color:"#dcd2be"}]},{featureType:"administrative.land_parcel",elementType:"labels.text.fill",stylers:[{color:"#ae9e90"}]},{featureType:"landscape.natural",
|
|
23
|
+
elementType:"geometry",stylers:[{color:"#dfd2ae"}]},{featureType:"poi",elementType:"geometry",stylers:[{color:"#dfd2ae"}]},{featureType:"poi",elementType:"labels.text.fill",stylers:[{color:"#93817c"}]},{featureType:"poi.park",elementType:"geometry.fill",stylers:[{color:"#a5b076"}]},{featureType:"poi.park",elementType:"labels.text.fill",stylers:[{color:"#447530"}]},{featureType:"road",elementType:"geometry",stylers:[{color:"#f5f1e6"}]},{featureType:"road.arterial",elementType:"geometry",stylers:[{color:"#fdfcf8"}]},
|
|
24
|
+
{featureType:"road.highway",elementType:"geometry",stylers:[{color:"#f8c967"}]},{featureType:"road.highway",elementType:"geometry.stroke",stylers:[{color:"#e9bc62"}]},{featureType:"road.highway.controlled_access",elementType:"geometry",stylers:[{color:"#e98d58"}]},{featureType:"road.highway.controlled_access",elementType:"geometry.stroke",stylers:[{color:"#db8555"}]},{featureType:"road.local",elementType:"labels.text.fill",stylers:[{color:"#806b63"}]},{featureType:"transit.line",elementType:"geometry",
|
|
25
|
+
stylers:[{color:"#dfd2ae"}]},{featureType:"transit.line",elementType:"labels.text.fill",stylers:[{color:"#8f7d77"}]},{featureType:"transit.line",elementType:"labels.text.stroke",stylers:[{color:"#ebe3cd"}]},{featureType:"transit.station",elementType:"geometry",stylers:[{color:"#dfd2ae"}]},{featureType:"water",elementType:"geometry.fill",stylers:[{color:"#b9d3c2"}]},{featureType:"water",elementType:"labels.text.fill",stylers:[{color:"#92998d"}]}];
|
|
26
|
+
var ultraLight=[{featureType:"water",elementType:"geometry",stylers:[{color:"#e9e9e9"},{lightness:17}]},{featureType:"landscape",elementType:"geometry",stylers:[{color:"#f5f5f5"},{lightness:20}]},{featureType:"road.highway",elementType:"geometry.fill",stylers:[{color:"#ffffff"},{lightness:17}]},{featureType:"road.highway",elementType:"geometry.stroke",stylers:[{color:"#ffffff"},{lightness:29},{weight:.2}]},{featureType:"road.arterial",elementType:"geometry",stylers:[{color:"#ffffff"},{lightness:18}]},
|
|
27
|
+
{featureType:"road.local",elementType:"geometry",stylers:[{color:"#ffffff"},{lightness:16}]},{featureType:"poi",elementType:"geometry",stylers:[{color:"#f5f5f5"},{lightness:21}]},{featureType:"poi.park",elementType:"geometry",stylers:[{color:"#dedede"},{lightness:21}]},{elementType:"labels.text.stroke",stylers:[{visibility:"on"},{color:"#ffffff"},{lightness:16}]},{elementType:"labels.text.fill",stylers:[{saturation:36},{color:"#333333"},{lightness:40}]},{elementType:"labels.icon",stylers:[{visibility:"off"}]},
|
|
28
|
+
{featureType:"transit",elementType:"geometry",stylers:[{color:"#f2f2f2"},{lightness:19}]},{featureType:"administrative",elementType:"geometry.fill",stylers:[{color:"#fefefe"},{lightness:20}]},{featureType:"administrative",elementType:"geometry.stroke",stylers:[{color:"#fefefe"},{lightness:17},{weight:1.2}]}];export{aubergine,dark,grey,a as minimal,retro,b as roadways,c as roadwaysMinimal,ultraLight}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -26,7 +26,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
26
26
|
required: false;
|
|
27
27
|
};
|
|
28
28
|
center: {
|
|
29
|
-
type: PropType<google.maps.LatLng>;
|
|
29
|
+
type: PropType<google.maps.LatLng | google.maps.LatLngLiteral>;
|
|
30
30
|
default: () => {
|
|
31
31
|
lat: number;
|
|
32
32
|
lng: number;
|
|
@@ -606,7 +606,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
606
606
|
apiKey: string;
|
|
607
607
|
version: string;
|
|
608
608
|
libraries: ("drawing" | "geometry" | "localContext" | "places" | "visualization")[];
|
|
609
|
-
center: google.maps.LatLng;
|
|
609
|
+
center: google.maps.LatLng | google.maps.LatLngLiteral;
|
|
610
610
|
clickableIcons: boolean;
|
|
611
611
|
disableDefaultUi: boolean;
|
|
612
612
|
disableDoubleClickZoom: boolean;
|
|
@@ -649,7 +649,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
649
649
|
apiKey: string;
|
|
650
650
|
version: string;
|
|
651
651
|
libraries: ("drawing" | "geometry" | "localContext" | "places" | "visualization")[];
|
|
652
|
-
center: google.maps.LatLng;
|
|
652
|
+
center: google.maps.LatLng | google.maps.LatLngLiteral;
|
|
653
653
|
clickableIcons: boolean;
|
|
654
654
|
disableDefaultUi: boolean;
|
|
655
655
|
disableDoubleClickZoom: boolean;
|
|
@@ -3,14 +3,16 @@ import { PropType } from "vue";
|
|
|
3
3
|
declare const _default: import("vue").DefineComponent<{
|
|
4
4
|
options: {
|
|
5
5
|
type: PropType<google.maps.InfoWindowOptions>;
|
|
6
|
-
|
|
6
|
+
default: () => {};
|
|
7
7
|
};
|
|
8
8
|
}, {
|
|
9
9
|
infoWindow: import("vue").Ref<google.maps.InfoWindow | undefined>;
|
|
10
10
|
infoWindowRef: import("vue").Ref<HTMLElement | undefined>;
|
|
11
11
|
hasSlotContent: import("vue").ComputedRef<boolean | undefined>;
|
|
12
|
-
|
|
12
|
+
anchor: import("vue").Ref<google.maps.Marker | undefined>;
|
|
13
13
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, string[], string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
14
14
|
options: google.maps.InfoWindowOptions;
|
|
15
|
-
} & {}>, {
|
|
15
|
+
} & {}>, {
|
|
16
|
+
options: google.maps.InfoWindowOptions;
|
|
17
|
+
}>;
|
|
16
18
|
export default _default;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/// <reference types="google.maps" />
|
|
2
|
-
import { PropType
|
|
2
|
+
import { PropType } from "vue";
|
|
3
3
|
declare const _default: import("vue").DefineComponent<{
|
|
4
4
|
options: {
|
|
5
5
|
type: PropType<google.maps.MarkerOptions>;
|
|
6
6
|
required: true;
|
|
7
7
|
};
|
|
8
|
-
}, {
|
|
9
|
-
|
|
10
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, string[], string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
8
|
+
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}>[] | undefined, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, string[], string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
11
11
|
options: google.maps.MarkerOptions;
|
|
12
12
|
} & {}>, {}>;
|
|
13
13
|
export default _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { PropType } from "vue";
|
|
2
|
+
import { MarkerClustererOptions } from "@googlemaps/markerclusterer";
|
|
3
|
+
declare const _default: import("vue").DefineComponent<{
|
|
4
|
+
options: {
|
|
5
|
+
type: PropType<MarkerClustererOptions>;
|
|
6
|
+
default: () => {};
|
|
7
|
+
};
|
|
8
|
+
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}>[] | undefined, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, string[], string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
11
|
+
options: MarkerClustererOptions;
|
|
12
|
+
} & {}>, {
|
|
13
|
+
options: MarkerClustererOptions;
|
|
14
|
+
}>;
|
|
15
|
+
export default _default;
|
|
@@ -6,3 +6,4 @@ export { default as Rectangle } from "./Rectangle";
|
|
|
6
6
|
export { default as Circle } from "./Circle";
|
|
7
7
|
export { default as CustomControl } from "./CustomControl.vue";
|
|
8
8
|
export { default as InfoWindow } from "./InfoWindow.vue";
|
|
9
|
+
export { default as MarkerCluster } from "./MarkerCluster";
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/// <reference types="google.maps" />
|
|
2
|
+
import type { MarkerClusterer } from "@googlemaps/markerclusterer";
|
|
2
3
|
import { InjectionKey, Ref } from "vue";
|
|
3
|
-
export declare const mapSymbol: InjectionKey<Ref<google.maps.Map
|
|
4
|
-
export declare const apiSymbol: InjectionKey<Ref<typeof google.maps
|
|
4
|
+
export declare const mapSymbol: InjectionKey<Ref<google.maps.Map>>;
|
|
5
|
+
export declare const apiSymbol: InjectionKey<Ref<typeof google.maps>>;
|
|
6
|
+
export declare const markerSymbol: InjectionKey<Ref<google.maps.Marker>>;
|
|
7
|
+
export declare const markerClusterSymbol: InjectionKey<Ref<MarkerClusterer>>;
|
|
5
8
|
/**
|
|
6
9
|
* Utilitary flag for components that need to know the map
|
|
7
10
|
* was fully loaded (including its tiles) to decide their behavior
|
package/package.json
CHANGED
|
@@ -1,21 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue3-google-map",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/inocan-group/vue3-google-maps.git"
|
|
8
8
|
},
|
|
9
|
-
"homepage": "https://
|
|
9
|
+
"homepage": "https://vue3-google-map.netlify.app",
|
|
10
10
|
"description": "A set of composable components for easy use of Google Maps in your Vue 3 projects.",
|
|
11
11
|
"unpkg": "dist/cjs/index.js",
|
|
12
12
|
"jsdelivr": "dist/cjs/index.js",
|
|
13
13
|
"main": "dist/cjs/index.js",
|
|
14
14
|
"module": "dist/es/index.js",
|
|
15
|
-
"typings": "dist/types/index.d.ts",
|
|
16
15
|
"files": [
|
|
17
16
|
"dist"
|
|
18
17
|
],
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"import": "./dist/es/index.js",
|
|
21
|
+
"require": "./dist/cjs/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./themes": "./dist/themes/es/index.js",
|
|
24
|
+
"./package.json": "./package.json"
|
|
25
|
+
},
|
|
26
|
+
"typesVersions": {
|
|
27
|
+
"*": {
|
|
28
|
+
"*": [
|
|
29
|
+
"dist/types/index.d.ts"
|
|
30
|
+
],
|
|
31
|
+
"themes": [
|
|
32
|
+
"dist/themes/types/index.d.ts"
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
},
|
|
19
36
|
"scripts": {
|
|
20
37
|
"dev": "vite",
|
|
21
38
|
"autoindex": "yarn do autoindex --sfc",
|
|
@@ -35,7 +52,8 @@
|
|
|
35
52
|
"release": "standard-version"
|
|
36
53
|
},
|
|
37
54
|
"dependencies": {
|
|
38
|
-
"@googlemaps/js-api-loader": "^1.12.11"
|
|
55
|
+
"@googlemaps/js-api-loader": "^1.12.11",
|
|
56
|
+
"@googlemaps/markerclusterer": "^2.0.6"
|
|
39
57
|
},
|
|
40
58
|
"devDependencies": {
|
|
41
59
|
"@ampproject/rollup-plugin-closure-compiler": "^0.26.0",
|