@htmlbricks/hb-map 0.50.0-alpha.25 → 0.50.0-alpha.26

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/main.iife.js CHANGED
@@ -330,4 +330,3 @@ var yp=Object.defineProperty;var Gc=nt=>{throw TypeError(nt)};var xp=(nt,ot,mt)=
330
330
  }
331
331
 
332
332
  `;function op(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var mr={exports:{}},Lc;function ap(){if(Lc)return mr.exports;Lc=1;function n(t,e=100,i={}){if(typeof t!="function")throw new TypeError(`Expected the first parameter to be a function, got \`${typeof t}\`.`);if(e<0)throw new RangeError("`wait` must not be negative.");const{immediate:s}=typeof i=="boolean"?{immediate:i}:i;let r,o,a,l,h;function c(){const f=r,g=o;return r=void 0,o=void 0,h=t.apply(f,g),h}function u(){const f=Date.now()-l;f<e&&f>=0?a=setTimeout(u,e-f):(a=void 0,s||(h=c()))}const d=function(...f){if(r&&this!==r&&Object.getPrototypeOf(this)===Object.getPrototypeOf(r))throw new Error("Debounced method called with different contexts of the same prototype.");r=this,o=f,l=Date.now();const g=s&&!a;return a||(a=setTimeout(u,e)),g&&(h=c()),h};return Object.defineProperty(d,"isPending",{get(){return a!==void 0}}),d.clear=()=>{a&&(clearTimeout(a),a=void 0)},d.flush=()=>{a&&d.trigger()},d.trigger=()=>{h=c(),d.clear()},d}return mr.exports.debounce=n,mr.exports=n,mr.exports}var lp=ap();const hp=op(lp);var cp=(n,t)=>t(n),up=Ju('<div id="map" style="width: 100%; height: 100%;"></div> <div id="popup" class="ol-popup"><button id="popup-closer" class="ol-popup-closer" aria-label="Close popup"></button> <div id="popup-content"></div></div>',1);const dp={hash:"svelte-is0uqp",code:":host {display:block;height:100%;}"};function Ac(n,t){Va(t,!0),ed(n,dp);function e(v,R){t.$$host.dispatchEvent(new CustomEvent(v,{detail:R}))}let i=ds(null),s=ds(null),r=ds(void 0),o=ds(null),a,l=ci(t,"id",7,""),h=ci(t,"style",7,""),c=ci(t,"center",23,()=>[37.5176038,15.0819224]),u=ci(t,"zoom",7,6),d=ci(t,"source",23,()=>({type:"osm"})),f=ci(t,"options",23,()=>({})),g=ci(t,"data",23,()=>[]);Wa(()=>{typeof d()=="string"&&d(JSON.parse(d())),f()&&typeof f()=="string"&&f(JSON.parse(f())),typeof u()=="string"&&u(Number(u())),typeof c()=="string"&&c(JSON.parse(c())),typeof g()=="string"&&g(JSON.parse(g())),_()});function m(v){var I,L;const R=Ys(v.coordinate,"EPSG:3857","EPSG:4326"),T=(I=st(i))==null?void 0:I.forEachFeatureAtPixel(v.pixel,function(M,P){return M});T&&T.get("marker")?(e("markerClick",{coordinates:{latitude:R[1],longitude:R[0]},id:T.get("id")}),T.get("popupHtml")&&((L=st(o))!=null&&L.innerHTML)&&(st(o).innerHTML=T.get("popupHtml"),a==null||a.setPosition(v.coordinate))):(a==null||a.setPosition(void 0),e("pointClickCoordinates",{coordinates:{latitude:R[1],longitude:R[0]}}))}function _(){var v,R;if(st(s)){if(st(i)){Ct(i,null);const M=document.createElement("style");M.innerHTML=bc,st(s).innerHTML="",st(s).appendChild(M)}const T=[];d().type.toLowerCase()==="osm"?T.push(new Sc({source:new Qm})):d().type.toLowerCase()==="xyz"&&d().url&&T.push(new Sc({source:new Rc({url:d().url})}));let I=[],L=Wt();if((v=g())!=null&&v.filter(M=>M.marker).length){const M=[];for(const b of g().filter(F=>F.marker).map(F=>F.marker)){const F=new kr({geometry:b!=null&&b.lngLat?new Ks(to(b.lngLat)):void 0,icon:b==null?void 0:b.icon,marker:!0,id:(b==null?void 0:b.id)||void 0,popupHtml:b==null?void 0:b.popupHtml});M.push(F);const O=(R=F.getGeometry())==null?void 0:R.getCoordinates();b!=null&&b.lngLat&&I.push(b.lngLat),f().centerFromGeometries&&O&&(L=cl(L,O))}const P=new Pe({image:new Qi({scale:3,anchor:[.5,.8],src:"https://upload.wikimedia.org/wikipedia/commons/e/e7/Maki2-marker-18.svg"})}),A=new $_({source:new vg({features:M}),style(b){const F=b.get("icon");let O;return F!=null&&F.uri?(O=new Pe({image:new Qi({scale:F.scale||.15,anchor:F.anchor||[.5,.8],src:F.uri})}),O):P}});T.push(A)}a=new Rm({element:st(r),autoPan:{animation:{duration:250}}}),Ct(i,de(new wm({target:st(s),layers:T,overlays:[a],view:new ye({center:to(c()),zoom:u()})}))),f().centerFromGeometries&&I.length>1?st(i).getView().fit(L,{padding:[25,25,25,25]}):f().centerFromGeometries&&st(i).getView().setCenter(to(I[0])),st(i).on("singleclick",function(M){m(M)})}}function p(v){var R,T;a==null||a.setPosition(void 0),(T=(R=v==null?void 0:v.target)==null?void 0:R.blur)==null||T.call(R)}id(()=>{var R;Ct(s,de(t.$$host.querySelector("#map"))),Ct(r,de(t.$$host.querySelector("#popup"))),Ct(o,de(t.$$host.querySelector("#popup-content")));const v=document.createElement("style");v.innerHTML=bc,(R=st(s))==null||R.appendChild(v),_()});var y=up(),w=Ra(()=>hp(_,200));ju("resize",Rr,function(...v){var R;(R=st(w))==null||R.apply(this,v)});var x=wu(vu(y),2),E=Eu(x);return E.__click=[cp,p],xu(2),yu(x),Ja(n,y),ja({get id(){return l()},set id(v=""){l(v),Ce()},get style(){return h()},set style(v=""){h(v),Ce()},get center(){return c()},set center(v=[37.5176038,15.0819224]){c(v),Ce()},get zoom(){return u()},set zoom(v=6){u(v),Ce()},get source(){return d()},set source(v={type:"osm"}){d(v),Ce()},get options(){return f()},set options(v={}){f(v),Ce()},get data(){return g()},set data(v=[]){g(v),Ce()}})}Hu(["click"]),customElements.define("hb-map",ad(Ac,{id:{},style:{},center:{},zoom:{},source:{},options:{},data:{}},[],[],!0)),nt.Component=Ac,Object.defineProperty(nt,Symbol.toStringTag,{value:"Module"})})(this.map=this.map||{});
333
- //# sourceMappingURL=main.iife.js.map
package/manifest.json CHANGED
@@ -320,5 +320,5 @@
320
320
  "size": {},
321
321
  "iifePath": "main.iife.js",
322
322
  "repoName": "@htmlbricks/hb-map",
323
- "version": "0.50.0-alpha.25"
323
+ "version": "0.50.0-alpha.26"
324
324
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@htmlbricks/hb-map",
3
- "version": "0.50.0-alpha.25",
3
+ "version": "0.50.0-alpha.26",
4
4
  "contributors": [],
5
5
  "description": "",
6
6
  "licenses": [