@mappedin/marker-cluster 6.17.0-beta.0 → 6.18.0-beta.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.
Files changed (2) hide show
  1. package/lib/esm/index.js +1 -1
  2. package/package.json +4 -4
package/lib/esm/index.js CHANGED
@@ -1 +1 @@
1
- var ee=Object.defineProperty,ce=Object.defineProperties;var me=Object.getOwnPropertyDescriptors;var Z=Object.getOwnPropertySymbols;var ge=Object.prototype.hasOwnProperty,fe=Object.prototype.propertyIsEnumerable;var te=s=>{throw TypeError(s)};var J=(s,e,t)=>e in s?ee(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,C=(s,e)=>{for(var t in e||(e={}))ge.call(e,t)&&J(s,t,e[t]);if(Z)for(var t of Z(e))fe.call(e,t)&&J(s,t,e[t]);return s},R=(s,e)=>ce(s,me(e)),o=(s,e)=>ee(s,"name",{value:e,configurable:!0});var h=(s,e,t)=>J(s,typeof e!="symbol"?e+"":e,t),re=(s,e,t)=>e.has(s)||te("Cannot "+t);var r=(s,e,t)=>(re(s,e,"read from private field"),t?t.call(s):e.get(s)),a=(s,e,t)=>e.has(s)?te("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,t),f=(s,e,t,n)=>(re(s,e,"write to private field"),n?n.call(s,t):e.set(s,t),t);var y={env:{NODE_ENV:"production",npm_package_version:"6.17.0-beta.0"}};function ne(s,e,t=!1){let n=null,i=0,l=o(function(...c){i++,i===1&&t===!0&&s(...c);let g=o(()=>{(!t||i>1)&&s(...c),n=null,i=0},"later");clearTimeout(n),n=setTimeout(g,e)},"debounced");return l.cancel=function(){n&&(clearTimeout(n),n=null),i=0},l}o(ne,"debounce");var ye="[MappedinJS]";function Me(s="",{prefix:e=ye}={}){let t="".concat(e).concat(s?"-".concat(s):""),n=o((i,l)=>{if(typeof window<"u"&&window.rnDebug){let c=l.map(g=>g instanceof Error&&g.stack?"".concat(g.message,"\n").concat(g.stack):g);window.rnDebug("".concat(s," ").concat(i,": ").concat(c.join(" ")))}},"rnDebug");return{logState:y.env.NODE_ENV==="test"?3:0,log(...i){this.logState<=0&&(console.log(t,...i),n("log",i))},warn(...i){this.logState<=1&&(console.warn(t,...i),n("warn",i))},error(...i){this.logState<=2&&(console.error(t,...i),n("error",i))},assert(...i){console.assert(...i)},time(i){console.time(i)},timeEnd(i){console.timeEnd(i)},setLevel(i){0<=i&&i<=3&&(this.logState=i)}}}o(Me,"createLogger");var be=Me();var se=be;var K=[0,4,6,8,10],ie=o(()=>{let s=new Array(16).fill(0),e=Math.random()*4294967296;for(let n=0;n<s.length;n++)n>0&&(n&3)===0&&(e=Math.random()*4294967296),s[n]=e>>>((n&3)<<3)&255;let t=s.map(n=>n.toString(16).padStart(2,"0"));return t[6]="4"+t[6][1],t[8]=["8","9","a","b"].includes(t[7][0])?t[7]:"a"+t[7][1],K.map((n,i)=>t.slice(n,i===K.length-1?void 0:K[i+1]).join("")).join("-")},"randomId");var N=["red","blue","green","purple","orange","pink","brown","gray","black","magenta","cyan","silver","maroon","teal","aqua"],oe=o((s,e,t)=>'<div style="background-color:'.concat(e,";color:white;width:").concat(t,"px;height:").concat(t,"px;border-radius:50%;text-align:center;line-height:").concat(t,"px;border:1px solid white;font-size:").concat(Math.floor(t*.7),'px;">').concat(s,"</div>"),"debugMarkerFn");import{Coordinate as ae}from"@mappedin/mappedin-js";var _=o(s=>parseFloat(s.toFixed(8)),"trimCoordValue"),le=o((s,e)=>{if(s.length===0)return new ae({latitude:0,longitude:0});let t=s.reduce((i,l)=>i+l.latitude,0)/s.length,n=s.reduce((i,l)=>i+l.longitude,0)/s.length;return new ae({latitude:_(t),longitude:_(n),floorId:e!=null?e:s[0].floorId})},"averageCoords"),ue=o((s,e)=>s.length===0?"":[...s.map(t=>t.id).sort(),_(e.latitude),_(e.longitude),e.floorId].filter(t=>t!=null).join("-"),"getClusterId"),de=o((s,e)=>{if(e<=0)throw new Error("Buffer must be greater than 0");return{minX:s.x-e/2,minY:s.y-e/2,maxX:s.x+e/2,maxY:s.y+e/2}},"bufferPoint");import Ce from"rbush";var A=o(s=>"".concat(s.x,",").concat(s.y),"serializePoint"),p,U=class U extends Ce{constructor(){super(...arguments);a(this,p,new Map);h(this,"load",o(t=>{for(let n of t)r(this,p).set(A(n),n);return super.load(t)},"load"));h(this,"insert",o(t=>(r(this,p).set(A(t),t),super.insert(t)),"insert"));h(this,"remove",o(t=>(r(this,p).delete(A(t)),super.remove(t)),"remove"));h(this,"clear",o(()=>(r(this,p).clear(),super.clear()),"clear"));h(this,"peek",o(()=>r(this,p).values().next().value,"peek"));h(this,"has",o(t=>r(this,p).has(A(t)),"has"));h(this,"find",o(t=>{for(let n of r(this,p).values())if(t(n))return n},"find"));h(this,"toBBox",o(t=>({minX:t.x,minY:t.y,maxX:t.x,maxY:t.y}),"toBBox"));h(this,"compareMinX",o((t,n)=>t.x-n.x,"compareMinX"));h(this,"compareMinY",o((t,n)=>t.y-n.y,"compareMinY"));h(this,"equals",o((t,n)=>t.x===n.x&&t.y===n.y,"equals"))}get size(){return r(this,p).size}};p=new WeakMap,o(U,"PointRBush");var S=U;var B,k,M,b,x,V,F,W=class W{constructor(e){a(this,B);a(this,k,{threshold:100});a(this,M,new S);a(this,b,new Map);a(this,x,[]);a(this,V,o(()=>[...r(this,b).values()].map(e=>R(C({},r(this,B).getScreenCoordinateFromCoordinate(e.target.anchorTarget)),{markerId:e.id})),"#getScreenCoordinates"));a(this,F,o(e=>{let t=[e];r(this,M).remove(e);let n=r(this,M).search(de(e,r(this,k).threshold));if(n.length===0)return t;t.push(...n);for(let i of n)r(this,M).remove(i);return t},"#resolveNeighbours"));f(this,B,e)}setOptions(e){if(e.threshold!=null&&e.threshold<=0)throw new Error("Cluster threshold must be greater than 0");f(this,k,C(C({},r(this,k)),e))}load(e){r(this,b).clear();for(let t of e)r(this,b).set(t.id,t)}getClusters(){var l;let e=r(this,V).call(this);r(this,M).clear(),r(this,M).load(e);let t=r(this,M),n=[],i=[];for(;t.size>0;){let c=(l=t.find(v=>r(this,x).includes(v)))!=null?l:t.peek();if(c==null)break;i.push(c);let he=r(this,F).call(this,c).map(v=>r(this,b).get(v.markerId)).filter(v=>v!=null);n.push(he)}return f(this,x,i),n}destroy(){r(this,b).clear(),r(this,M).clear(),f(this,x,[])}};B=new WeakMap,k=new WeakMap,M=new WeakMap,b=new WeakMap,x=new WeakMap,V=new WeakMap,F=new WeakMap,o(W,"ScreenDistanceClustering");var O=W;var w,m,d,u,P,T,G,j,Y,z,X,q,L,I,E,D,$,Q=class Q{constructor(e,t,n){h(this,"id",ie());a(this,w);a(this,m);a(this,d);a(this,u,{singleMarkersById:new Map,clustersById:new Map,clusterMarkersByClusterId:new Map,debugMarkersByClusterId:new Map,debugColorsByClusterId:new Map});a(this,P);a(this,T);a(this,G,o(()=>[...r(this,u).singleMarkersById.values()],"#getMarkers"));a(this,j,o(e=>{r(this,m).updateState(e,{enabled:!1})},"#hideMarker"));a(this,Y,o(e=>{r(this,m).updateState(e,{enabled:!0})},"#showMarker"));a(this,z,o(()=>{let e=r(this,d).algorithm;return e.load(r(this,G).call(this)),e.getClusters()},"#getClusteredMarkers"));a(this,X,o(e=>{var n;let t=le(e.map(i=>i.target.anchorTarget),(n=r(this,d).floor)==null?void 0:n.id);return{id:ue(e,t),markers:e,center:t}},"#createCluster"));a(this,q,o(e=>{var i;let t=(i=r(this,u).debugColorsByClusterId.get(e.id))!=null?i:N[0],n=r(this,P).call(this,e);n!=null&&r(this,u).clusterMarkersByClusterId.set(e.id,n);for(let l of e.markers)r(this,d).debug&&(l.contentEl.style.outline="2px solid ".concat(t)),r(this,d).hideClusteredMarkers&&r(this,j).call(this,l);if(r(this,d).debug){(n==null?void 0:n.contentEl.firstChild)instanceof HTMLElement&&(n.contentEl.firstChild.style.opacity="0.25");let l=r(this,m).Markers.add(e.center,oe(e.markers.length.toString(),t,20),{rank:"always-visible",zIndex:99});r(this,u).debugMarkersByClusterId.set(e.id,l)}},"#addClusterMarkers"));a(this,L,o(e=>{let t=r(this,u).clusterMarkersByClusterId.get(e.id);if(t!=null&&(r(this,m).Markers.remove(t),r(this,u).clusterMarkersByClusterId.delete(e.id)),r(this,d).debug){let n=r(this,u).debugMarkersByClusterId.get(e.id);n!=null&&(r(this,m).Markers.remove(n),r(this,u).debugMarkersByClusterId.delete(e.id))}for(let n of e.markers)r(this,Y).call(this,n)},"#removeClusterMarkers"));a(this,I,o(()=>{let e=new Map(r(this,u).clustersById),t=[],n=r(this,z).call(this);for(let i=0;i<n.length;i++){let l=n[i];if(l.length<r(this,d).minSize)continue;let c=r(this,X).call(this,l);r(this,u).clustersById.has(c.id)?e.delete(c.id):t.push(c)}for(let i of e.values())r(this,L).call(this,i),r(this,u).clustersById.delete(i.id),r(this,d).debug&&r(this,u).debugColorsByClusterId.delete(i.id);for(let i of t){if(r(this,d).debug){let l=N[Math.floor(Math.random()*N.length)];r(this,u).debugColorsByClusterId.set(i.id,l)}r(this,q).call(this,i),r(this,u).clustersById.set(i.id,i)}},"#updateImmediately"));a(this,E,o(()=>{r(this,d).debounce===0?r(this,I).call(this):r(this,T).call(this)},"#update"));a(this,D,o(()=>{r(this,E).call(this)},"#handleCameraChange"));a(this,$,o(()=>{r(this,I).call(this)},"#handleFocus"));h(this,"add",o(e=>{var t,n;if(r(this,d).floor==null)r(this,d).floor=(n=r(this,w).getById("floor",(t=e.target.anchorTarget.floorId)!=null?t:""))!=null?n:null;else if(r(this,d).floor.id!==e.target.anchorTarget.floorId)throw new Error("Cannot cluster markers on different floors!");r(this,u).singleMarkersById.set(e.id,e),r(this,E).call(this)},"add"));h(this,"remove",o(e=>{if(!r(this,u).singleMarkersById.has(e.id)){se.log("Cannot remove marker ".concat(e.id," because it is not in the cluster!"));return}r(this,u).singleMarkersById.delete(e.id),r(this,E).call(this)},"remove"));h(this,"has",o(e=>r(this,u).singleMarkersById.has(e.id),"has"));h(this,"destroy",o(()=>{r(this,d).algorithm.destroy(),r(this,m).off("camera-change",r(this,D)),window.removeEventListener("focus",r(this,$));for(let[,e]of r(this,u).clustersById)r(this,L).call(this,e);for(let e of Object.values(r(this,u)))if(e instanceof Map)e.clear();else throw new Error("Encountered unexpected data type in cache! Potentially failed to clean up MarkerCluster.")},"destroy"));var l,c;let i;if((n==null?void 0:n.algorithm)==null){let g=new O(e);g.setOptions((l=n==null?void 0:n.algorithmOptions)!=null?l:{}),i=g}else i=n.algorithm,i.setOptions((c=n==null?void 0:n.algorithmOptions)!=null?c:{});if(f(this,d,R(C({floor:null,minSize:2,debounce:50,debug:!1,hideClusteredMarkers:!0},n),{algorithm:i})),f(this,m,e),f(this,w,r(this,m).getMapData()),r(this,w)==null)throw new Error("No map data found in MapView!");f(this,P,t),f(this,T,ne(r(this,I),r(this,d).debounce)),r(this,m).on("camera-change",r(this,D)),window.addEventListener("focus",r(this,$))}get clusters(){return[...r(this,u).clustersById.values()]}};w=new WeakMap,m=new WeakMap,d=new WeakMap,u=new WeakMap,P=new WeakMap,T=new WeakMap,G=new WeakMap,j=new WeakMap,Y=new WeakMap,z=new WeakMap,X=new WeakMap,q=new WeakMap,L=new WeakMap,I=new WeakMap,E=new WeakMap,D=new WeakMap,$=new WeakMap,o(Q,"MarkerCluster");var H=Q;export{H as MarkerCluster,S as PointRBush,O as ScreenDistanceClustering};
1
+ var ee=Object.defineProperty,ce=Object.defineProperties;var me=Object.getOwnPropertyDescriptors;var Z=Object.getOwnPropertySymbols;var ge=Object.prototype.hasOwnProperty,fe=Object.prototype.propertyIsEnumerable;var te=s=>{throw TypeError(s)};var J=(s,e,t)=>e in s?ee(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,C=(s,e)=>{for(var t in e||(e={}))ge.call(e,t)&&J(s,t,e[t]);if(Z)for(var t of Z(e))fe.call(e,t)&&J(s,t,e[t]);return s},R=(s,e)=>ce(s,me(e)),o=(s,e)=>ee(s,"name",{value:e,configurable:!0});var h=(s,e,t)=>J(s,typeof e!="symbol"?e+"":e,t),re=(s,e,t)=>e.has(s)||te("Cannot "+t);var r=(s,e,t)=>(re(s,e,"read from private field"),t?t.call(s):e.get(s)),a=(s,e,t)=>e.has(s)?te("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,t),f=(s,e,t,n)=>(re(s,e,"write to private field"),n?n.call(s,t):e.set(s,t),t);var y={env:{NODE_ENV:"production",npm_package_version:"6.18.0-beta.0"}};function ne(s,e,t=!1){let n=null,i=0,l=o(function(...c){i++,i===1&&t===!0&&s(...c);let g=o(()=>{(!t||i>1)&&s(...c),n=null,i=0},"later");clearTimeout(n),n=setTimeout(g,e)},"debounced");return l.cancel=function(){n&&(clearTimeout(n),n=null),i=0},l}o(ne,"debounce");var ye="[MappedinJS]";function Me(s="",{prefix:e=ye}={}){let t="".concat(e).concat(s?"-".concat(s):""),n=o((i,l)=>{if(typeof window<"u"&&window.rnDebug){let c=l.map(g=>g instanceof Error&&g.stack?"".concat(g.message,"\n").concat(g.stack):g);window.rnDebug("".concat(s," ").concat(i,": ").concat(c.join(" ")))}},"rnDebug");return{logState:y.env.NODE_ENV==="test"?3:0,log(...i){this.logState<=0&&(console.log(t,...i),n("log",i))},warn(...i){this.logState<=1&&(console.warn(t,...i),n("warn",i))},error(...i){this.logState<=2&&(console.error(t,...i),n("error",i))},assert(...i){console.assert(...i)},time(i){console.time(i)},timeEnd(i){console.timeEnd(i)},setLevel(i){0<=i&&i<=3&&(this.logState=i)}}}o(Me,"createLogger");var be=Me();var se=be;var K=[0,4,6,8,10],ie=o(()=>{let s=new Array(16).fill(0),e=Math.random()*4294967296;for(let n=0;n<s.length;n++)n>0&&(n&3)===0&&(e=Math.random()*4294967296),s[n]=e>>>((n&3)<<3)&255;let t=s.map(n=>n.toString(16).padStart(2,"0"));return t[6]="4"+t[6][1],t[8]=["8","9","a","b"].includes(t[7][0])?t[7]:"a"+t[7][1],K.map((n,i)=>t.slice(n,i===K.length-1?void 0:K[i+1]).join("")).join("-")},"randomId");var N=["red","blue","green","purple","orange","pink","brown","gray","black","magenta","cyan","silver","maroon","teal","aqua"],oe=o((s,e,t)=>'<div style="background-color:'.concat(e,";color:white;width:").concat(t,"px;height:").concat(t,"px;border-radius:50%;text-align:center;line-height:").concat(t,"px;border:1px solid white;font-size:").concat(Math.floor(t*.7),'px;">').concat(s,"</div>"),"debugMarkerFn");import{Coordinate as ae}from"@mappedin/mappedin-js";var _=o(s=>parseFloat(s.toFixed(8)),"trimCoordValue"),le=o((s,e)=>{if(s.length===0)return new ae({latitude:0,longitude:0});let t=s.reduce((i,l)=>i+l.latitude,0)/s.length,n=s.reduce((i,l)=>i+l.longitude,0)/s.length;return new ae({latitude:_(t),longitude:_(n),floorId:e!=null?e:s[0].floorId})},"averageCoords"),ue=o((s,e)=>s.length===0?"":[...s.map(t=>t.id).sort(),_(e.latitude),_(e.longitude),e.floorId].filter(t=>t!=null).join("-"),"getClusterId"),de=o((s,e)=>{if(e<=0)throw new Error("Buffer must be greater than 0");return{minX:s.x-e/2,minY:s.y-e/2,maxX:s.x+e/2,maxY:s.y+e/2}},"bufferPoint");import Ce from"rbush";var A=o(s=>"".concat(s.x,",").concat(s.y),"serializePoint"),p,U=class U extends Ce{constructor(){super(...arguments);a(this,p,new Map);h(this,"load",o(t=>{for(let n of t)r(this,p).set(A(n),n);return super.load(t)},"load"));h(this,"insert",o(t=>(r(this,p).set(A(t),t),super.insert(t)),"insert"));h(this,"remove",o(t=>(r(this,p).delete(A(t)),super.remove(t)),"remove"));h(this,"clear",o(()=>(r(this,p).clear(),super.clear()),"clear"));h(this,"peek",o(()=>r(this,p).values().next().value,"peek"));h(this,"has",o(t=>r(this,p).has(A(t)),"has"));h(this,"find",o(t=>{for(let n of r(this,p).values())if(t(n))return n},"find"));h(this,"toBBox",o(t=>({minX:t.x,minY:t.y,maxX:t.x,maxY:t.y}),"toBBox"));h(this,"compareMinX",o((t,n)=>t.x-n.x,"compareMinX"));h(this,"compareMinY",o((t,n)=>t.y-n.y,"compareMinY"));h(this,"equals",o((t,n)=>t.x===n.x&&t.y===n.y,"equals"))}get size(){return r(this,p).size}};p=new WeakMap,o(U,"PointRBush");var S=U;var B,k,M,b,x,V,F,W=class W{constructor(e){a(this,B);a(this,k,{threshold:100});a(this,M,new S);a(this,b,new Map);a(this,x,[]);a(this,V,o(()=>[...r(this,b).values()].map(e=>R(C({},r(this,B).getScreenCoordinateFromCoordinate(e.target.anchorTarget)),{markerId:e.id})),"#getScreenCoordinates"));a(this,F,o(e=>{let t=[e];r(this,M).remove(e);let n=r(this,M).search(de(e,r(this,k).threshold));if(n.length===0)return t;t.push(...n);for(let i of n)r(this,M).remove(i);return t},"#resolveNeighbours"));f(this,B,e)}setOptions(e){if(e.threshold!=null&&e.threshold<=0)throw new Error("Cluster threshold must be greater than 0");f(this,k,C(C({},r(this,k)),e))}load(e){r(this,b).clear();for(let t of e)r(this,b).set(t.id,t)}getClusters(){var l;let e=r(this,V).call(this);r(this,M).clear(),r(this,M).load(e);let t=r(this,M),n=[],i=[];for(;t.size>0;){let c=(l=t.find(v=>r(this,x).includes(v)))!=null?l:t.peek();if(c==null)break;i.push(c);let he=r(this,F).call(this,c).map(v=>r(this,b).get(v.markerId)).filter(v=>v!=null);n.push(he)}return f(this,x,i),n}destroy(){r(this,b).clear(),r(this,M).clear(),f(this,x,[])}};B=new WeakMap,k=new WeakMap,M=new WeakMap,b=new WeakMap,x=new WeakMap,V=new WeakMap,F=new WeakMap,o(W,"ScreenDistanceClustering");var O=W;var w,m,d,u,P,T,G,j,Y,z,X,q,L,I,E,D,$,Q=class Q{constructor(e,t,n){h(this,"id",ie());a(this,w);a(this,m);a(this,d);a(this,u,{singleMarkersById:new Map,clustersById:new Map,clusterMarkersByClusterId:new Map,debugMarkersByClusterId:new Map,debugColorsByClusterId:new Map});a(this,P);a(this,T);a(this,G,o(()=>[...r(this,u).singleMarkersById.values()],"#getMarkers"));a(this,j,o(e=>{r(this,m).updateState(e,{enabled:!1})},"#hideMarker"));a(this,Y,o(e=>{r(this,m).updateState(e,{enabled:!0})},"#showMarker"));a(this,z,o(()=>{let e=r(this,d).algorithm;return e.load(r(this,G).call(this)),e.getClusters()},"#getClusteredMarkers"));a(this,X,o(e=>{var n;let t=le(e.map(i=>i.target.anchorTarget),(n=r(this,d).floor)==null?void 0:n.id);return{id:ue(e,t),markers:e,center:t}},"#createCluster"));a(this,q,o(e=>{var i;let t=(i=r(this,u).debugColorsByClusterId.get(e.id))!=null?i:N[0],n=r(this,P).call(this,e);n!=null&&r(this,u).clusterMarkersByClusterId.set(e.id,n);for(let l of e.markers)r(this,d).debug&&(l.contentEl.style.outline="2px solid ".concat(t)),r(this,d).hideClusteredMarkers&&r(this,j).call(this,l);if(r(this,d).debug){(n==null?void 0:n.contentEl.firstChild)instanceof HTMLElement&&(n.contentEl.firstChild.style.opacity="0.25");let l=r(this,m).Markers.add(e.center,oe(e.markers.length.toString(),t,20),{rank:"always-visible",zIndex:99});r(this,u).debugMarkersByClusterId.set(e.id,l)}},"#addClusterMarkers"));a(this,L,o(e=>{let t=r(this,u).clusterMarkersByClusterId.get(e.id);if(t!=null&&(r(this,m).Markers.remove(t),r(this,u).clusterMarkersByClusterId.delete(e.id)),r(this,d).debug){let n=r(this,u).debugMarkersByClusterId.get(e.id);n!=null&&(r(this,m).Markers.remove(n),r(this,u).debugMarkersByClusterId.delete(e.id))}for(let n of e.markers)r(this,Y).call(this,n)},"#removeClusterMarkers"));a(this,I,o(()=>{let e=new Map(r(this,u).clustersById),t=[],n=r(this,z).call(this);for(let i=0;i<n.length;i++){let l=n[i];if(l.length<r(this,d).minSize)continue;let c=r(this,X).call(this,l);r(this,u).clustersById.has(c.id)?e.delete(c.id):t.push(c)}for(let i of e.values())r(this,L).call(this,i),r(this,u).clustersById.delete(i.id),r(this,d).debug&&r(this,u).debugColorsByClusterId.delete(i.id);for(let i of t){if(r(this,d).debug){let l=N[Math.floor(Math.random()*N.length)];r(this,u).debugColorsByClusterId.set(i.id,l)}r(this,q).call(this,i),r(this,u).clustersById.set(i.id,i)}},"#updateImmediately"));a(this,E,o(()=>{r(this,d).debounce===0?r(this,I).call(this):r(this,T).call(this)},"#update"));a(this,D,o(()=>{r(this,E).call(this)},"#handleCameraChange"));a(this,$,o(()=>{r(this,I).call(this)},"#handleFocus"));h(this,"add",o(e=>{var t,n;if(r(this,d).floor==null)r(this,d).floor=(n=r(this,w).getById("floor",(t=e.target.anchorTarget.floorId)!=null?t:""))!=null?n:null;else if(r(this,d).floor.id!==e.target.anchorTarget.floorId)throw new Error("Cannot cluster markers on different floors!");r(this,u).singleMarkersById.set(e.id,e),r(this,E).call(this)},"add"));h(this,"remove",o(e=>{if(!r(this,u).singleMarkersById.has(e.id)){se.log("Cannot remove marker ".concat(e.id," because it is not in the cluster!"));return}r(this,u).singleMarkersById.delete(e.id),r(this,E).call(this)},"remove"));h(this,"has",o(e=>r(this,u).singleMarkersById.has(e.id),"has"));h(this,"destroy",o(()=>{r(this,d).algorithm.destroy(),r(this,m).off("camera-change",r(this,D)),window.removeEventListener("focus",r(this,$));for(let[,e]of r(this,u).clustersById)r(this,L).call(this,e);for(let e of Object.values(r(this,u)))if(e instanceof Map)e.clear();else throw new Error("Encountered unexpected data type in cache! Potentially failed to clean up MarkerCluster.")},"destroy"));var l,c;let i;if((n==null?void 0:n.algorithm)==null){let g=new O(e);g.setOptions((l=n==null?void 0:n.algorithmOptions)!=null?l:{}),i=g}else i=n.algorithm,i.setOptions((c=n==null?void 0:n.algorithmOptions)!=null?c:{});if(f(this,d,R(C({floor:null,minSize:2,debounce:50,debug:!1,hideClusteredMarkers:!0},n),{algorithm:i})),f(this,m,e),f(this,w,r(this,m).getMapData()),r(this,w)==null)throw new Error("No map data found in MapView!");f(this,P,t),f(this,T,ne(r(this,I),r(this,d).debounce)),r(this,m).on("camera-change",r(this,D)),window.addEventListener("focus",r(this,$))}get clusters(){return[...r(this,u).clustersById.values()]}};w=new WeakMap,m=new WeakMap,d=new WeakMap,u=new WeakMap,P=new WeakMap,T=new WeakMap,G=new WeakMap,j=new WeakMap,Y=new WeakMap,z=new WeakMap,X=new WeakMap,q=new WeakMap,L=new WeakMap,I=new WeakMap,E=new WeakMap,D=new WeakMap,$=new WeakMap,o(Q,"MarkerCluster");var H=Q;export{H as MarkerCluster,S as PointRBush,O as ScreenDistanceClustering};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mappedin/marker-cluster",
3
- "version": "6.17.0-beta.0",
3
+ "version": "6.18.0-beta.0",
4
4
  "homepage": "https://developer.mappedin.com/",
5
5
  "private": false,
6
6
  "main": "lib/esm/index.js",
@@ -18,7 +18,7 @@
18
18
  "rbush": "^4.0.1"
19
19
  },
20
20
  "peerDependencies": {
21
- "@mappedin/mappedin-js": "^6.17.0"
21
+ "@mappedin/mappedin-js": "^6.18.0"
22
22
  },
23
23
  "devDependencies": {},
24
24
  "volta": {
@@ -29,8 +29,8 @@
29
29
  "build": "pnpm clean && pnpm types && node scripts/build.mjs",
30
30
  "build:prod": "cross-env NODE_ENV=production pnpm build",
31
31
  "types": "tsc -b tsconfig.build.json",
32
- "test": "NODE_ENV=test jest",
33
- "test:cov": "NODE_ENV=test jest --coverage",
32
+ "test": "jest --config jest.config.js",
33
+ "test:cov": "pnpm test --coverage",
34
34
  "version:ci": "pnpm version --no-commit-hooks --no-git-tag-version",
35
35
  "clean": "rm -rf lib/** && rm -rf examples/dist/**",
36
36
  "docs": "pnpm build && pnpm docs:build",