Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-yandex-maps

Package Overview
Dependencies
Maintainers
1
Versions
159
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-yandex-maps - npm Package Compare versions

Comparing version 1.0.9 to 1.1.0

2

dist/vue-yandex-maps.esm.js

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue");const t=Symbol();const o=new class{events;ymapReady;scriptIsNotAttached;pluginInstalledGlobal;constructor(){this.events={},this.ymapReady=!1,this.scriptIsNotAttached=!0,this.pluginInstalledGlobal=!1}$on(e,t){return this.events[e]||(this.events[e]=[]),this.events[e].push(t),()=>{this.events[e]=this.events[e].filter((e=>t!==e))}}$emit(e){const t=this.events[e];t&&t.forEach((e=>e()))}};function n(e){return new Promise(((t,n)=>{if(window.ymaps)return o.ymapReady||(o.ymapReady=!0,o.$emit("scriptIsLoaded")),t(!0);if(document.getElementById("vue-yandex-maps-script"))return void o.$on("scriptIsLoaded",t);const a=document.createElement("SCRIPT"),{apiKey:s="",lang:r="ru_RU",version:d="2.1",coordorder:c="latlong",debug:l=!1,enterprise:p=!1}=e,i=`https://${p?"enterprise.":""}api-maps.yandex.ru/${d}/?${`lang=${r}${s&&`&apikey=${s}`}&mode=${l?"debug":"release"}&coordorder=${c}`}`;a.setAttribute("src",i),a.setAttribute("async",""),a.setAttribute("defer",""),a.setAttribute("id","vue-yandex-maps-script"),document.head.appendChild(a),o.scriptIsNotAttached=!1,a.onload=(e=>()=>{ymaps.ready((()=>{o.ymapReady=!0,o.$emit("scriptIsLoaded"),e(!0)}))})(t),a.onerror=n}))}const a=e=>Array.isArray(e)?e.map(a):+e,s=["actionbegin","actionbreak","actionend","actiontick","actiontickcomplete","balloonclose","balloonopen","boundschange","click","contextmenu","dblclick","destroy","hintclose","hintopen","marginchange","mousedown","mouseenter","mouseleave","mousemove","mouseup","multitouchend","multitouchmove","multitouchstart","optionschange","sizechange","typechange","wheel"],r=["balloonclose","balloonopen","beforedrag","beforedragstart","click","contextmenu","dblclick","drag","dragend","dragstart","editorstatechange","geometrychange","hintclose","hintopen","mapchange","mousedown","mouseenter","mouseleave","mousemove","mouseup","multitouchend","multitouchmove","multitouchstart","optionschange","overlaychange","parentchange","propertieschange","wheel"];function d(e,t=!1){const o=[],n=[];let a,s;return{addGeoObject:(n,s)=>{o.push(t?s:n),clearTimeout(a),a=window.setTimeout((()=>e(o,"add")))},deleteGeoObject:(o,a)=>{n.push(t?a:o),clearTimeout(s),s=window.setTimeout((()=>e(n,"remove")))}}}var c=e.defineComponent({name:"YandexMap",props:{coordinates:{type:Array,required:!0},zoom:{type:Number,default:10},bounds:{type:Array,default:null},behaviors:{type:Array,default:null},controls:{type:Array,default:null},detailedControls:{type:Object,default:null},events:{type:Array,default:()=>["click"],validator:e=>e.every((e=>s.includes(e)))},mapType:{type:String,default:"map"},settings:{type:Object,default:()=>({})},panOptions:{type:Object,default:void 0},options:{type:Object,default:()=>({})}},emits:[...s,"geo-objects-updated","created"],setup(a,{emit:s,slots:r,expose:c}){const l=e.ref(!1),p=o.pluginInstalledGlobal&&e.inject("pluginOptions")||{};let i;const u=`yandexMap${Math.round(1e5*Math.random())}`,{addGeoObject:m,deleteGeoObject:b}=d(((e,t)=>{i&&e.length&&(e.forEach((e=>i?.geoObjects[t](e))),s("geo-objects-updated",i.geoObjects),e=[])}));e.provide(t,{addGeoObject:m,deleteGeoObject:b});const y=()=>{if(l.value=!0,i=new ymaps.Map(u,{center:a.coordinates,zoom:a.zoom,bounds:a.bounds,behaviors:a.behaviors,controls:a.controls,type:`yandex#${a.mapType}`},a.options),a.events.forEach((e=>i?.events?.add(e,(t=>s(e,t))))),a.detailedControls){Object.keys(a.detailedControls).forEach((e=>{i?.controls.remove(e),i?.controls.add(e,a.detailedControls?.[e])}))}s("created",i)};if(o.scriptIsNotAttached){n({...p,...a.settings})}return o.ymapReady?ymaps.ready(y):o.$on("scriptIsLoaded",y),c(i),e.watch((()=>a.coordinates),(e=>i?.panTo(e,a.panOptions))),e.watch((()=>a.zoom),(e=>i?.setZoom(e))),e.watch((()=>a.bounds),(e=>i?.setBounds(e))),e.watch((()=>a.mapType),(e=>i?.setType(e))),()=>e.h("section",{class:"yandex-container","data-test":"map"},[e.h("div",{id:u,style:"min-height: 100%;"}),l.value&&e.h("div",{style:"display: none;"},[r.default?.()])])}}),l=e.defineComponent({name:"YandexMarker",props:{coordinates:{type:Array,required:!0},markerId:{type:[String,Number],required:!0},properties:{type:Object,default:()=>({})},options:{type:Object,default:null},type:{type:String,default:"Point"},radius:{type:Number,default:null},events:{type:Array,default:()=>["click"],validator:e=>e.every((e=>r.includes(e)))}},emits:[...r],setup(o,{emit:n,slots:s,expose:r}){const{addGeoObject:d,deleteGeoObject:c}=e.inject(t)||{},l=e.computed((()=>o.coordinates.map(a))),p=e.ref(!1),i={geometry:{type:o.type,coordinates:l.value,radius:o.radius},properties:{...o.properties,markerId:o.markerId}},u=s.component?.().length?ymaps.templateLayoutFactory.createClass(`<div id="balloon-${o.markerId}" class="yandex-balloon"><div>`,{build(){u.superclass.build.call(this),p.value=!0},clear(){p.value=!1,u.superclass.clear.call(this)}}):null,m={balloonContentLayout:u,...o.options},b=new ymaps.GeoObject(i,m);o.events.forEach((e=>b.events?.add(e,(t=>n(e,t))))),e.provide("marker",b);const y={...i,options:m};return e.onMounted((()=>{d(b,y)})),e.onBeforeUnmount((()=>{c(b,y)})),e.watch((()=>o.coordinates),(e=>{b.geometry?.setCoordinates?.(e)})),r(b),s.component?.().length?()=>p.value&&e.h(e.Teleport,{to:`#balloon-${o.markerId}`},[s.component?.()]):()=>s.default?.()}}),p=e.defineComponent({name:"YandexGeoObjectCollection",props:{options:{type:Object,default:()=>({})}},emits:["geo-objects-updated"],setup(o,{emit:n,expose:a,slots:s}){const r=new ymaps.GeoObjectCollection({},o.options),{addGeoObject:c,deleteGeoObject:l}=e.inject(t)||{},{addGeoObject:p,deleteGeoObject:i}=d(((e,t)=>{r&&e.length&&(e.forEach((e=>r[t](e))),n("geo-objects-updated",r),e=[])}));return e.provide(t,{addGeoObject:p,deleteGeoObject:i}),e.onMounted((()=>{c(r)})),e.onBeforeUnmount((()=>{l(r)})),a(r),()=>s.default?.()}}),i=e.defineComponent({name:"YandexClusterer",props:{options:{type:Object,default:()=>({})}},emits:["geo-objects-updated"],setup(o,{emit:n,expose:a,slots:s}){const r=new ymaps.Clusterer(o.options),{addGeoObject:c,deleteGeoObject:l}=e.inject(t)||{},{addGeoObject:p,deleteGeoObject:i}=d(((e,t)=>{r&&e.length&&(r[t](e),n("geo-objects-updated",r),e=[])}));return e.provide(t,{addGeoObject:p,deleteGeoObject:i}),e.onMounted((()=>{c(r)})),e.onBeforeUnmount((()=>{l(r)})),a(r),()=>s.default?.()}}),u=e.defineComponent({name:"YandexObjectManager",props:{options:{type:Object,default:()=>({})}},emits:["geo-objects-updated"],setup(o,{emit:n,expose:a,slots:s}){const r=new ymaps.ObjectManager(o.options),{addGeoObject:c,deleteGeoObject:l}=e.inject(t)||{},{addGeoObject:p,deleteGeoObject:i}=d(((e,t)=>{if(!r||!e.length)return;const o=e.map((e=>({type:"Feature",id:e.properties.markerId,geometry:e.geometry,properties:e.properties,options:e.options})));r[t](o),n("geo-objects-updated",r),e=[]}),!0);return e.provide(t,{addGeoObject:p,deleteGeoObject:i}),e.onMounted((()=>{c(r)})),e.onBeforeUnmount((()=>{l(r)})),a(r),()=>s.default?.()}});let m;const b=n,y=c,h=l,g=p,j=i,v=u;var f={install:(e,t)=>{m||(m=!0,o.pluginInstalledGlobal=!0,e.provide("pluginOptions",t),e.component("YandexMap",c),e.component("YandexMarker",l),e.component("YandexCollection",p),e.component("YandexClusterer",i),e.component("YandexObjectManager",u))}};exports.YandexClusterer=j,exports.YandexCollection=g,exports.YandexMap=y,exports.YandexMarker=h,exports.YandexObjectManager=v,exports.default=f,exports.loadYmap=b;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue");const t=Symbol();const o=new class{events;ymapReady;scriptIsNotAttached;pluginInstalledGlobal;constructor(){this.events={},this.ymapReady=!1,this.scriptIsNotAttached=!0,this.pluginInstalledGlobal=!1}$on(e,t){return this.events[e]||(this.events[e]=[]),this.events[e].push(t),()=>{this.events[e]=this.events[e].filter((e=>t!==e))}}$emit(e){const t=this.events[e];t&&t.forEach((e=>e()))}};function n(e){return new Promise(((t,n)=>{if(window.ymaps)return o.ymapReady||(o.ymapReady=!0,o.$emit("scriptIsLoaded")),t(!0);if(document.getElementById("vue-yandex-maps-script"))return void o.$on("scriptIsLoaded",t);const a=document.createElement("SCRIPT"),{apiKey:s="",lang:r="ru_RU",version:d="2.1",coordorder:c="latlong",debug:l=!1,enterprise:p=!1}=e,i=`https://${p?"enterprise.":""}api-maps.yandex.ru/${d}/?${`lang=${r}${s&&`&apikey=${s}`}&mode=${l?"debug":"release"}&coordorder=${c}`}`;a.setAttribute("src",i),a.setAttribute("async",""),a.setAttribute("defer",""),a.setAttribute("id","vue-yandex-maps-script"),document.head.appendChild(a),o.scriptIsNotAttached=!1,a.onload=(e=>()=>{ymaps.ready((()=>{o.ymapReady=!0,o.$emit("scriptIsLoaded"),e(!0)}))})(t),a.onerror=n}))}const a=e=>Array.isArray(e)?e.map(a):+e,s=["actionbegin","actionbreak","actionend","actiontick","actiontickcomplete","balloonclose","balloonopen","boundschange","click","contextmenu","dblclick","destroy","hintclose","hintopen","marginchange","mousedown","mouseenter","mouseleave","mousemove","mouseup","multitouchend","multitouchmove","multitouchstart","optionschange","sizechange","typechange","wheel"],r=["balloonclose","balloonopen","beforedrag","beforedragstart","click","contextmenu","dblclick","drag","dragend","dragstart","editorstatechange","geometrychange","hintclose","hintopen","mapchange","mousedown","mouseenter","mouseleave","mousemove","mouseup","multitouchend","multitouchmove","multitouchstart","optionschange","overlaychange","parentchange","propertieschange","wheel"];function d(e,t=!1){let o,n,a=[],s=[];return{addGeoObject:(n,s)=>{a.push(t?s:n),clearTimeout(o),o=window.setTimeout((()=>{e(a,"add"),a=[]}))},deleteGeoObject:(o,a)=>{s.push(t?a:o),clearTimeout(n),n=window.setTimeout((()=>{e(s,"remove"),s=[]}))}}}var c=e.defineComponent({name:"YandexMap",props:{coordinates:{type:Array,required:!0},zoom:{type:Number,default:10},bounds:{type:Array,default:null},behaviors:{type:Array,default:null},controls:{type:Array,default:null},detailedControls:{type:Object,default:null},events:{type:Array,default:()=>["click"],validator:e=>e.every((e=>s.includes(e)))},mapType:{type:String,default:"map"},settings:{type:Object,default:()=>({})},panOptions:{type:Object,default:void 0},options:{type:Object,default:()=>({})}},emits:[...s,"geo-objects-updated","created"],setup(a,{emit:s,slots:r,expose:c}){const l=e.ref(!1),p=o.pluginInstalledGlobal&&e.inject("pluginOptions")||{};let i;const u=`yandexMap${Math.round(1e5*Math.random())}`,{addGeoObject:m,deleteGeoObject:b}=d(((e,t)=>{i&&e.length&&(e.forEach((e=>i?.geoObjects[t](e))),s("geo-objects-updated",i.geoObjects))}));e.provide(t,{addGeoObject:m,deleteGeoObject:b});const y=()=>{if(l.value=!0,i=new ymaps.Map(u,{center:a.coordinates,zoom:a.zoom,bounds:a.bounds,behaviors:a.behaviors,controls:a.controls,type:`yandex#${a.mapType}`},a.options),a.events.forEach((e=>i?.events?.add(e,(t=>s(e,t))))),a.detailedControls){Object.keys(a.detailedControls).forEach((e=>{i?.controls.remove(e),i?.controls.add(e,a.detailedControls?.[e])}))}s("created",i)};if(o.scriptIsNotAttached){n({...p,...a.settings})}return o.ymapReady?ymaps.ready(y):o.$on("scriptIsLoaded",y),c(i),e.watch((()=>a.coordinates),(e=>i?.panTo(e,a.panOptions))),e.watch((()=>a.zoom),(e=>i?.setZoom(e))),e.watch((()=>a.bounds),(e=>i?.setBounds(e))),e.watch((()=>a.mapType),(e=>i?.setType(e))),()=>e.h("section",{class:"yandex-container","data-test":"map"},[e.h("div",{id:u,style:"min-height: 100%;"}),l.value&&e.h("div",{style:"display: none;"},[r.default?.()])])}}),l=e.defineComponent({name:"YandexMarker",props:{coordinates:{type:Array,required:!0},markerId:{type:[String,Number],required:!0},properties:{type:Object,default:()=>({})},options:{type:Object,default:null},type:{type:String,default:"Point"},radius:{type:Number,default:null},events:{type:Array,default:()=>["click"],validator:e=>e.every((e=>r.includes(e)))}},emits:[...r],setup(o,{emit:n,slots:s,expose:r}){const{addGeoObject:d,deleteGeoObject:c}=e.inject(t)||{},l=e.computed((()=>o.coordinates.map(a))),p=e.ref(!1),i={geometry:{type:o.type,coordinates:l.value,radius:o.radius},properties:{...o.properties,markerId:o.markerId}},u=s.component?.().length?ymaps.templateLayoutFactory.createClass(`<div id="balloon-${o.markerId}" class="yandex-balloon"><div>`,{build(){u.superclass.build.call(this),p.value=!0},clear(){p.value=!1,u.superclass.clear.call(this)}}):null,m={balloonContentLayout:u,...o.options},b=new ymaps.GeoObject(i,m);o.events.forEach((e=>b.events?.add(e,(t=>n(e,t))))),e.provide("marker",b);const y={...i,options:m};return e.onMounted((()=>{d(b,y)})),e.onBeforeUnmount((()=>{c(b,y)})),e.watch((()=>o.coordinates),(e=>{b.geometry?.setCoordinates?.(e)})),r(b),s.component?.().length?()=>p.value&&e.h(e.Teleport,{to:`#balloon-${o.markerId}`},[s.component?.()]):()=>s.default?.()}}),p=e.defineComponent({name:"YandexGeoObjectCollection",props:{options:{type:Object,default:()=>({})}},emits:["geo-objects-updated"],setup(o,{emit:n,expose:a,slots:s}){const r=new ymaps.GeoObjectCollection({},o.options),{addGeoObject:c,deleteGeoObject:l}=e.inject(t)||{},{addGeoObject:p,deleteGeoObject:i}=d(((e,t)=>{r&&e.length&&(e.forEach((e=>r[t](e))),n("geo-objects-updated",r))}));return e.provide(t,{addGeoObject:p,deleteGeoObject:i}),e.onMounted((()=>{c(r)})),e.onBeforeUnmount((()=>{l(r)})),a(r),()=>s.default?.()}}),i=e.defineComponent({name:"YandexClusterer",props:{options:{type:Object,default:()=>({})}},emits:["geo-objects-updated"],setup(o,{emit:n,expose:a,slots:s}){const r=new ymaps.Clusterer(o.options),{addGeoObject:c,deleteGeoObject:l}=e.inject(t)||{},{addGeoObject:p,deleteGeoObject:i}=d(((e,t)=>{r&&e.length&&(r[t](e),n("geo-objects-updated",r))}));return e.provide(t,{addGeoObject:p,deleteGeoObject:i}),e.onMounted((()=>{c(r)})),e.onBeforeUnmount((()=>{l(r)})),a(r),()=>s.default?.()}}),u=e.defineComponent({name:"YandexObjectManager",props:{options:{type:Object,default:()=>({})}},emits:["geo-objects-updated"],setup(o,{emit:n,expose:a,slots:s}){const r=new ymaps.ObjectManager(o.options),{addGeoObject:c,deleteGeoObject:l}=e.inject(t)||{},{addGeoObject:p,deleteGeoObject:i}=d(((e,t)=>{if(!r||!e.length)return;const o=e.map((e=>({type:"Feature",id:e.properties.markerId,geometry:e.geometry,properties:e.properties,options:e.options})));r[t](o),n("geo-objects-updated",r)}),!0);return e.provide(t,{addGeoObject:p,deleteGeoObject:i}),e.onMounted((()=>{c(r)})),e.onBeforeUnmount((()=>{l(r)})),a(r),()=>s.default?.()}});let m;const b=n,y=c,h=l,g=p,j=i,v=u;var f={install:(e,t)=>{m||(m=!0,o.pluginInstalledGlobal=!0,e.provide("pluginOptions",t),e.component("YandexMap",c),e.component("YandexMarker",l),e.component("YandexCollection",p),e.component("YandexClusterer",i),e.component("YandexObjectManager",u))}};exports.YandexClusterer=j,exports.YandexCollection=g,exports.YandexMap=y,exports.YandexMarker=h,exports.YandexObjectManager=v,exports.default=f,exports.loadYmap=b;
//# sourceMappingURL=vue-yandex-maps.esm.js.map

@@ -1,2 +0,2 @@

import{defineComponent as e,ref as t,inject as o,provide as a,watch as n,h as s,computed as d,onMounted as r,onBeforeUnmount as l,Teleport as c}from"vue";const i=Symbol();const p=new class{events;ymapReady;scriptIsNotAttached;pluginInstalledGlobal;constructor(){this.events={},this.ymapReady=!1,this.scriptIsNotAttached=!0,this.pluginInstalledGlobal=!1}$on(e,t){return this.events[e]||(this.events[e]=[]),this.events[e].push(t),()=>{this.events[e]=this.events[e].filter((e=>t!==e))}}$emit(e){const t=this.events[e];t&&t.forEach((e=>e()))}};function u(e){return new Promise(((t,o)=>{if(window.ymaps)return p.ymapReady||(p.ymapReady=!0,p.$emit("scriptIsLoaded")),t(!0);if(document.getElementById("vue-yandex-maps-script"))return void p.$on("scriptIsLoaded",t);const a=document.createElement("SCRIPT"),{apiKey:n="",lang:s="ru_RU",version:d="2.1",coordorder:r="latlong",debug:l=!1,enterprise:c=!1}=e,i=`https://${c?"enterprise.":""}api-maps.yandex.ru/${d}/?${`lang=${s}${n&&`&apikey=${n}`}&mode=${l?"debug":"release"}&coordorder=${r}`}`;a.setAttribute("src",i),a.setAttribute("async",""),a.setAttribute("defer",""),a.setAttribute("id","vue-yandex-maps-script"),document.head.appendChild(a),p.scriptIsNotAttached=!1,a.onload=(e=>()=>{ymaps.ready((()=>{p.ymapReady=!0,p.$emit("scriptIsLoaded"),e(!0)}))})(t),a.onerror=o}))}const m=e=>Array.isArray(e)?e.map(m):+e,y=["actionbegin","actionbreak","actionend","actiontick","actiontickcomplete","balloonclose","balloonopen","boundschange","click","contextmenu","dblclick","destroy","hintclose","hintopen","marginchange","mousedown","mouseenter","mouseleave","mousemove","mouseup","multitouchend","multitouchmove","multitouchstart","optionschange","sizechange","typechange","wheel"],b=["balloonclose","balloonopen","beforedrag","beforedragstart","click","contextmenu","dblclick","drag","dragend","dragstart","editorstatechange","geometrychange","hintclose","hintopen","mapchange","mousedown","mouseenter","mouseleave","mousemove","mouseup","multitouchend","multitouchmove","multitouchstart","optionschange","overlaychange","parentchange","propertieschange","wheel"];function h(e,t=!1){const o=[],a=[];let n,s;return{addGeoObject:(a,s)=>{o.push(t?s:a),clearTimeout(n),n=window.setTimeout((()=>e(o,"add")))},deleteGeoObject:(o,n)=>{a.push(t?n:o),clearTimeout(s),s=window.setTimeout((()=>e(a,"remove")))}}}var g=e({name:"YandexMap",props:{coordinates:{type:Array,required:!0},zoom:{type:Number,default:10},bounds:{type:Array,default:null},behaviors:{type:Array,default:null},controls:{type:Array,default:null},detailedControls:{type:Object,default:null},events:{type:Array,default:()=>["click"],validator:e=>e.every((e=>y.includes(e)))},mapType:{type:String,default:"map"},settings:{type:Object,default:()=>({})},panOptions:{type:Object,default:void 0},options:{type:Object,default:()=>({})}},emits:[...y,"geo-objects-updated","created"],setup(e,{emit:d,slots:r,expose:l}){const c=t(!1),m=p.pluginInstalledGlobal&&o("pluginOptions")||{};let y;const b=`yandexMap${Math.round(1e5*Math.random())}`,{addGeoObject:g,deleteGeoObject:j}=h(((e,t)=>{y&&e.length&&(e.forEach((e=>y?.geoObjects[t](e))),d("geo-objects-updated",y.geoObjects),e=[])}));a(i,{addGeoObject:g,deleteGeoObject:j});const v=()=>{if(c.value=!0,y=new ymaps.Map(b,{center:e.coordinates,zoom:e.zoom,bounds:e.bounds,behaviors:e.behaviors,controls:e.controls,type:`yandex#${e.mapType}`},e.options),e.events.forEach((e=>y?.events?.add(e,(t=>d(e,t))))),e.detailedControls){Object.keys(e.detailedControls).forEach((t=>{y?.controls.remove(t),y?.controls.add(t,e.detailedControls?.[t])}))}d("created",y)};if(p.scriptIsNotAttached){u({...m,...e.settings})}return p.ymapReady?ymaps.ready(v):p.$on("scriptIsLoaded",v),l(y),n((()=>e.coordinates),(t=>y?.panTo(t,e.panOptions))),n((()=>e.zoom),(e=>y?.setZoom(e))),n((()=>e.bounds),(e=>y?.setBounds(e))),n((()=>e.mapType),(e=>y?.setType(e))),()=>s("section",{class:"yandex-container","data-test":"map"},[s("div",{id:b,style:"min-height: 100%;"}),c.value&&s("div",{style:"display: none;"},[r.default?.()])])}}),j=e({name:"YandexMarker",props:{coordinates:{type:Array,required:!0},markerId:{type:[String,Number],required:!0},properties:{type:Object,default:()=>({})},options:{type:Object,default:null},type:{type:String,default:"Point"},radius:{type:Number,default:null},events:{type:Array,default:()=>["click"],validator:e=>e.every((e=>b.includes(e)))}},emits:[...b],setup(e,{emit:p,slots:u,expose:y}){const{addGeoObject:b,deleteGeoObject:h}=o(i)||{},g=d((()=>e.coordinates.map(m))),j=t(!1),v={geometry:{type:e.type,coordinates:g.value,radius:e.radius},properties:{...e.properties,markerId:e.markerId}},O=u.component?.().length?ymaps.templateLayoutFactory.createClass(`<div id="balloon-${e.markerId}" class="yandex-balloon"><div>`,{build(){O.superclass.build.call(this),j.value=!0},clear(){j.value=!1,O.superclass.clear.call(this)}}):null,f={balloonContentLayout:O,...e.options},G=new ymaps.GeoObject(v,f);e.events.forEach((e=>G.events?.add(e,(t=>p(e,t))))),a("marker",G);const x={...v,options:f};return r((()=>{b(G,x)})),l((()=>{h(G,x)})),n((()=>e.coordinates),(e=>{G.geometry?.setCoordinates?.(e)})),y(G),u.component?.().length?()=>j.value&&s(c,{to:`#balloon-${e.markerId}`},[u.component?.()]):()=>u.default?.()}}),v=e({name:"YandexGeoObjectCollection",props:{options:{type:Object,default:()=>({})}},emits:["geo-objects-updated"],setup(e,{emit:t,expose:n,slots:s}){const d=new ymaps.GeoObjectCollection({},e.options),{addGeoObject:c,deleteGeoObject:p}=o(i)||{},{addGeoObject:u,deleteGeoObject:m}=h(((e,o)=>{d&&e.length&&(e.forEach((e=>d[o](e))),t("geo-objects-updated",d),e=[])}));return a(i,{addGeoObject:u,deleteGeoObject:m}),r((()=>{c(d)})),l((()=>{p(d)})),n(d),()=>s.default?.()}}),O=e({name:"YandexClusterer",props:{options:{type:Object,default:()=>({})}},emits:["geo-objects-updated"],setup(e,{emit:t,expose:n,slots:s}){const d=new ymaps.Clusterer(e.options),{addGeoObject:c,deleteGeoObject:p}=o(i)||{},{addGeoObject:u,deleteGeoObject:m}=h(((e,o)=>{d&&e.length&&(d[o](e),t("geo-objects-updated",d),e=[])}));return a(i,{addGeoObject:u,deleteGeoObject:m}),r((()=>{c(d)})),l((()=>{p(d)})),n(d),()=>s.default?.()}}),f=e({name:"YandexObjectManager",props:{options:{type:Object,default:()=>({})}},emits:["geo-objects-updated"],setup(e,{emit:t,expose:n,slots:s}){const d=new ymaps.ObjectManager(e.options),{addGeoObject:c,deleteGeoObject:p}=o(i)||{},{addGeoObject:u,deleteGeoObject:m}=h(((e,o)=>{if(!d||!e.length)return;const a=e.map((e=>({type:"Feature",id:e.properties.markerId,geometry:e.geometry,properties:e.properties,options:e.options})));d[o](a),t("geo-objects-updated",d),e=[]}),!0);return a(i,{addGeoObject:u,deleteGeoObject:m}),r((()=>{c(d)})),l((()=>{p(d)})),n(d),()=>s.default?.()}});let G;const x=u,k=g,I=j,$=v,w=O,A=f;var C={install:(e,t)=>{G||(G=!0,p.pluginInstalledGlobal=!0,e.provide("pluginOptions",t),e.component("YandexMap",g),e.component("YandexMarker",j),e.component("YandexCollection",v),e.component("YandexClusterer",O),e.component("YandexObjectManager",f))}};export{w as YandexClusterer,$ as YandexCollection,k as YandexMap,I as YandexMarker,A as YandexObjectManager,C as default,x as loadYmap};
import{defineComponent as e,ref as t,inject as o,provide as a,watch as n,h as s,computed as d,onMounted as r,onBeforeUnmount as l,Teleport as c}from"vue";const i=Symbol();const p=new class{events;ymapReady;scriptIsNotAttached;pluginInstalledGlobal;constructor(){this.events={},this.ymapReady=!1,this.scriptIsNotAttached=!0,this.pluginInstalledGlobal=!1}$on(e,t){return this.events[e]||(this.events[e]=[]),this.events[e].push(t),()=>{this.events[e]=this.events[e].filter((e=>t!==e))}}$emit(e){const t=this.events[e];t&&t.forEach((e=>e()))}};function u(e){return new Promise(((t,o)=>{if(window.ymaps)return p.ymapReady||(p.ymapReady=!0,p.$emit("scriptIsLoaded")),t(!0);if(document.getElementById("vue-yandex-maps-script"))return void p.$on("scriptIsLoaded",t);const a=document.createElement("SCRIPT"),{apiKey:n="",lang:s="ru_RU",version:d="2.1",coordorder:r="latlong",debug:l=!1,enterprise:c=!1}=e,i=`https://${c?"enterprise.":""}api-maps.yandex.ru/${d}/?${`lang=${s}${n&&`&apikey=${n}`}&mode=${l?"debug":"release"}&coordorder=${r}`}`;a.setAttribute("src",i),a.setAttribute("async",""),a.setAttribute("defer",""),a.setAttribute("id","vue-yandex-maps-script"),document.head.appendChild(a),p.scriptIsNotAttached=!1,a.onload=(e=>()=>{ymaps.ready((()=>{p.ymapReady=!0,p.$emit("scriptIsLoaded"),e(!0)}))})(t),a.onerror=o}))}const m=e=>Array.isArray(e)?e.map(m):+e,y=["actionbegin","actionbreak","actionend","actiontick","actiontickcomplete","balloonclose","balloonopen","boundschange","click","contextmenu","dblclick","destroy","hintclose","hintopen","marginchange","mousedown","mouseenter","mouseleave","mousemove","mouseup","multitouchend","multitouchmove","multitouchstart","optionschange","sizechange","typechange","wheel"],b=["balloonclose","balloonopen","beforedrag","beforedragstart","click","contextmenu","dblclick","drag","dragend","dragstart","editorstatechange","geometrychange","hintclose","hintopen","mapchange","mousedown","mouseenter","mouseleave","mousemove","mouseup","multitouchend","multitouchmove","multitouchstart","optionschange","overlaychange","parentchange","propertieschange","wheel"];function h(e,t=!1){let o,a,n=[],s=[];return{addGeoObject:(a,s)=>{n.push(t?s:a),clearTimeout(o),o=window.setTimeout((()=>{e(n,"add"),n=[]}))},deleteGeoObject:(o,n)=>{s.push(t?n:o),clearTimeout(a),a=window.setTimeout((()=>{e(s,"remove"),s=[]}))}}}var g=e({name:"YandexMap",props:{coordinates:{type:Array,required:!0},zoom:{type:Number,default:10},bounds:{type:Array,default:null},behaviors:{type:Array,default:null},controls:{type:Array,default:null},detailedControls:{type:Object,default:null},events:{type:Array,default:()=>["click"],validator:e=>e.every((e=>y.includes(e)))},mapType:{type:String,default:"map"},settings:{type:Object,default:()=>({})},panOptions:{type:Object,default:void 0},options:{type:Object,default:()=>({})}},emits:[...y,"geo-objects-updated","created"],setup(e,{emit:d,slots:r,expose:l}){const c=t(!1),m=p.pluginInstalledGlobal&&o("pluginOptions")||{};let y;const b=`yandexMap${Math.round(1e5*Math.random())}`,{addGeoObject:g,deleteGeoObject:j}=h(((e,t)=>{y&&e.length&&(e.forEach((e=>y?.geoObjects[t](e))),d("geo-objects-updated",y.geoObjects))}));a(i,{addGeoObject:g,deleteGeoObject:j});const v=()=>{if(c.value=!0,y=new ymaps.Map(b,{center:e.coordinates,zoom:e.zoom,bounds:e.bounds,behaviors:e.behaviors,controls:e.controls,type:`yandex#${e.mapType}`},e.options),e.events.forEach((e=>y?.events?.add(e,(t=>d(e,t))))),e.detailedControls){Object.keys(e.detailedControls).forEach((t=>{y?.controls.remove(t),y?.controls.add(t,e.detailedControls?.[t])}))}d("created",y)};if(p.scriptIsNotAttached){u({...m,...e.settings})}return p.ymapReady?ymaps.ready(v):p.$on("scriptIsLoaded",v),l(y),n((()=>e.coordinates),(t=>y?.panTo(t,e.panOptions))),n((()=>e.zoom),(e=>y?.setZoom(e))),n((()=>e.bounds),(e=>y?.setBounds(e))),n((()=>e.mapType),(e=>y?.setType(e))),()=>s("section",{class:"yandex-container","data-test":"map"},[s("div",{id:b,style:"min-height: 100%;"}),c.value&&s("div",{style:"display: none;"},[r.default?.()])])}}),j=e({name:"YandexMarker",props:{coordinates:{type:Array,required:!0},markerId:{type:[String,Number],required:!0},properties:{type:Object,default:()=>({})},options:{type:Object,default:null},type:{type:String,default:"Point"},radius:{type:Number,default:null},events:{type:Array,default:()=>["click"],validator:e=>e.every((e=>b.includes(e)))}},emits:[...b],setup(e,{emit:p,slots:u,expose:y}){const{addGeoObject:b,deleteGeoObject:h}=o(i)||{},g=d((()=>e.coordinates.map(m))),j=t(!1),v={geometry:{type:e.type,coordinates:g.value,radius:e.radius},properties:{...e.properties,markerId:e.markerId}},O=u.component?.().length?ymaps.templateLayoutFactory.createClass(`<div id="balloon-${e.markerId}" class="yandex-balloon"><div>`,{build(){O.superclass.build.call(this),j.value=!0},clear(){j.value=!1,O.superclass.clear.call(this)}}):null,f={balloonContentLayout:O,...e.options},G=new ymaps.GeoObject(v,f);e.events.forEach((e=>G.events?.add(e,(t=>p(e,t))))),a("marker",G);const x={...v,options:f};return r((()=>{b(G,x)})),l((()=>{h(G,x)})),n((()=>e.coordinates),(e=>{G.geometry?.setCoordinates?.(e)})),y(G),u.component?.().length?()=>j.value&&s(c,{to:`#balloon-${e.markerId}`},[u.component?.()]):()=>u.default?.()}}),v=e({name:"YandexGeoObjectCollection",props:{options:{type:Object,default:()=>({})}},emits:["geo-objects-updated"],setup(e,{emit:t,expose:n,slots:s}){const d=new ymaps.GeoObjectCollection({},e.options),{addGeoObject:c,deleteGeoObject:p}=o(i)||{},{addGeoObject:u,deleteGeoObject:m}=h(((e,o)=>{d&&e.length&&(e.forEach((e=>d[o](e))),t("geo-objects-updated",d))}));return a(i,{addGeoObject:u,deleteGeoObject:m}),r((()=>{c(d)})),l((()=>{p(d)})),n(d),()=>s.default?.()}}),O=e({name:"YandexClusterer",props:{options:{type:Object,default:()=>({})}},emits:["geo-objects-updated"],setup(e,{emit:t,expose:n,slots:s}){const d=new ymaps.Clusterer(e.options),{addGeoObject:c,deleteGeoObject:p}=o(i)||{},{addGeoObject:u,deleteGeoObject:m}=h(((e,o)=>{d&&e.length&&(d[o](e),t("geo-objects-updated",d))}));return a(i,{addGeoObject:u,deleteGeoObject:m}),r((()=>{c(d)})),l((()=>{p(d)})),n(d),()=>s.default?.()}}),f=e({name:"YandexObjectManager",props:{options:{type:Object,default:()=>({})}},emits:["geo-objects-updated"],setup(e,{emit:t,expose:n,slots:s}){const d=new ymaps.ObjectManager(e.options),{addGeoObject:c,deleteGeoObject:p}=o(i)||{},{addGeoObject:u,deleteGeoObject:m}=h(((e,o)=>{if(!d||!e.length)return;const a=e.map((e=>({type:"Feature",id:e.properties.markerId,geometry:e.geometry,properties:e.properties,options:e.options})));d[o](a),t("geo-objects-updated",d)}),!0);return a(i,{addGeoObject:u,deleteGeoObject:m}),r((()=>{c(d)})),l((()=>{p(d)})),n(d),()=>s.default?.()}});let G;const x=u,k=g,I=j,$=v,w=O,A=f;var C={install:(e,t)=>{G||(G=!0,p.pluginInstalledGlobal=!0,e.provide("pluginOptions",t),e.component("YandexMap",g),e.component("YandexMarker",j),e.component("YandexCollection",v),e.component("YandexClusterer",O),e.component("YandexObjectManager",f))}};export{w as YandexClusterer,$ as YandexCollection,k as YandexMap,I as YandexMarker,A as YandexObjectManager,C as default,x as loadYmap};
//# sourceMappingURL=vue-yandex-maps.umd.js.map
{
"name": "vue-yandex-maps",
"version": "1.0.9",
"version": "1.1.0",
"description": "Yandex Maps component for Vue 3",

@@ -5,0 +5,0 @@ "main": "dist/vue-yandex-maps.umd.js",

@@ -24,4 +24,2 @@ import { defineComponent, inject, onMounted, onBeforeUnmount, provide, PropType } from 'vue';

emit('geo-objects-updated', clusterer);
arr = [];
};

@@ -28,0 +26,0 @@

@@ -24,4 +24,2 @@ import { defineComponent, inject, onMounted, onBeforeUnmount, provide } from 'vue';

emit('geo-objects-updated', collection);
arr = [];
};

@@ -28,0 +26,0 @@

@@ -69,3 +69,2 @@ import { h, defineComponent, provide, inject, ref, PropType, watch } from 'vue';

emit('geo-objects-updated', map.geoObjects);
arr = [];
};

@@ -72,0 +71,0 @@

@@ -32,4 +32,2 @@ import { defineComponent, inject, onMounted, onBeforeUnmount, provide, PropType } from 'vue';

emit('geo-objects-updated', objectManager);
arr = [];
};

@@ -36,0 +34,0 @@

@@ -7,4 +7,4 @@ import { MarkerAction, UpdateFunction, MarkerJson } from '../types';

) {
const markersToAdd: any[] = [];
const markersToDelete: any[] = [];
let markersToAdd: any[] = [];
let markersToDelete: any[] = [];
let addGeoObjectTimeout: number | undefined;

@@ -16,3 +16,6 @@ let deleteGeoObjectTimeout: number | undefined;

clearTimeout(addGeoObjectTimeout);
addGeoObjectTimeout = window.setTimeout(() => updateFunction(markersToAdd, 'add'));
addGeoObjectTimeout = window.setTimeout(() => {
updateFunction(markersToAdd, 'add');
markersToAdd = [];
});
};

@@ -23,3 +26,6 @@

clearTimeout(deleteGeoObjectTimeout);
deleteGeoObjectTimeout = window.setTimeout(() => updateFunction(markersToDelete, 'remove'));
deleteGeoObjectTimeout = window.setTimeout(() => {
updateFunction(markersToDelete, 'remove');
markersToDelete = [];
});
};

@@ -26,0 +32,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc