@htmlbricks/hb-map 0.61.17 → 0.61.18
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 +1 -1
- package/main.iife.js.map +1 -1
- package/manifest.json +10 -1
- package/package.json +1 -1
- package/types/webcomponent.type.d.json +9 -0
- package/types/webcomponent.type.d.ts +3 -0
package/main.iife.js
CHANGED
|
@@ -327,5 +327,5 @@
|
|
|
327
327
|
content: "✖";
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
-
`;function vp(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var fr={exports:{}},Xc;function Cp(){if(Xc)return fr.exports;Xc=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 fr.exports.debounce=n,fr.exports=n,fr.exports}var Rp=Cp();const Tp=vp(Rp);var Ip=(n,t)=>t(n),Sp=ld('<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 bp={hash:"svelte-1a08ofc",code:":host {display:block;height:200px;width:200px;}"};function Yc(n,t){La(t,!0),gd(n,bp);function e(w,T){t.$$host.dispatchEvent(new CustomEvent(w,{detail:T}))}let i=Kt(null),s=Kt(null),r=Kt(void 0),o=Kt(null),a,l=Fi(t,"id",7,""),h=Fi(t,"center",23,()=>[37.5176038,15.0819224]),c=Fi(t,"zoom",7,6),u=Fi(t,"source",23,()=>({type:"osm"})),d=Fi(t,"options",23,()=>({})),f=Fi(t,"data",23,()=>[]);Za(()=>{let w=!1;typeof u()=="string"&&(u(JSON.parse(u())),w=!0),d()&&typeof d()=="string"&&(d(JSON.parse(d())),w=!0),typeof c()=="string"&&(c(Number(c())),w=!0),typeof h()=="string"&&(h(JSON.parse(h())),w=!0),typeof f()=="string"&&(f(JSON.parse(f())),w=!0),w&&m()});function g(w){const T=Pn(w.coordinate,"EPSG:3857","EPSG:4326"),R=it(i)?.getView?.()?.getCenter?.(),I=Pn(R||h(),"EPSG:3857","EPSG:4326"),L=it(i)?.getView?.()?.getZoom?.()||c(),P=it(i)?.forEachFeatureAtPixel(w.pixel,function(A,b){return A});P&&P.get("marker")?(e("markerClick",{coordinates:{latitude:T[1],longitude:T[0]},id:P.get("id")}),P.get("popupHtml")&&it(o)?.innerHTML&&(it(o).innerHTML=P.get("popupHtml"),a?.setPosition(w.coordinate))):(a?.setPosition(void 0),e("pointClickCoordinates",{coordinates:{latitude:T[1],longitude:T[0]},zoom:L,center:I}))}function m(){if(it(s)){if(it(i)){St(i,null);const I=document.createElement("style");I.innerHTML=Wc,it(s).innerHTML="",it(s).appendChild(I)}const w=[];u().type.toLowerCase()==="osm"?w.push(new zc({source:new _p})):u().type.toLowerCase()==="xyz"&&u().url&&w.push(new zc({source:new kc({url:u().url})}));let T=[],R=zt();if(f()?.filter?.(I=>I.marker)?.length){const I=[];for(const A of f().filter(b=>b.marker).map(b=>b.marker)){const b=new kr({geometry:A?.lngLat?new Ys(to(A.lngLat)):void 0,icon:A?.icon,marker:!0,id:A?.id||void 0,popupHtml:A?.popupHtml});I.push(b);const M=b.getGeometry()?.getCoordinates();A?.lngLat&&T.push(A.lngLat),d().centerFromGeometries&&M&&M[2]!==-1/0&&M[3]!==-1/0&&(console.log("coords",M),R=vl(R,M))}const L=new Te({image:new tn({scale:3,anchor:[.5,.8],src:"https://upload.wikimedia.org/wikipedia/commons/e/e7/Maki2-marker-18.svg"})}),P=new nm({source:new Fg({features:I}),style(A){const b=A.get("icon");let M;return b?.uri?(M=new Te({image:new tn({scale:b.scale||.15,anchor:b.anchor||[.5,.8],src:b.uri,opacity:b.opacity||1})}),M):L}});w.push(P)}a=new Wm({element:it(r),autoPan:{animation:{duration:250}}}),St(i,new Gm({target:it(s),layers:w,overlays:[a],view:new ge({center:to(h()),zoom:c()})}),!0),d()?.centerFromGeometries&&T&&T.length>1&&R[2]!==-1/0&&R[3]!==-1/0?(console.log("extent",R),it(i).getView().fit(R,{padding:[25,25,25,25]})):d()?.centerFromGeometries&&it(i).getView().setCenter(to(T[0])),it(i).on("singleclick",function(I){g(I)})}}function _(w){a?.setPosition(void 0),w?.target?.blur?.()}fd(()=>{St(s,t.$$host?.shadowRoot?.querySelector("#map"),!0),St(r,t.$$host?.shadowRoot?.querySelector("#popup"),!0),St(o,t.$$host?.shadowRoot?.querySelector("#popup-content"),!0);const w=document.createElement("style");w.innerHTML=Wc,it(s)?.appendChild(w),m()});var p={get id(){return l()},set id(w=""){l(w),ni()},get center(){return h()},set center(w=[37.5176038,15.0819224]){h(w),ni()},get zoom(){return c()},set zoom(w=6){c(w),ni()},get source(){return u()},set source(w={type:"osm"}){u(w),ni()},get options(){return d()},set options(w={}){d(w),ni()},get data(){return f()},set data(w=[]){f(w),ni()}},y=Sp(),v=Ou(()=>Tp(m,200));rd("resize",Sr,function(...w){it(v)?.apply(this,w)});var x=Xu(Wu(y),2),E=zu(x);return E.__click=[Ip,_],Tu(2),Ru(x),cl(n,y),Aa(p)}od(["click"]),customElements.define("hb-map",xd(Yc,{id:{},center:{},zoom:{},source:{},options:{},data:{}},[],[],!0)),fa.Component=Yc,Object.defineProperty(fa,Symbol.toStringTag,{value:"Module"})})(this.map=this.map||{});
|
|
330
|
+
`;function vp(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var fr={exports:{}},Xc;function Cp(){if(Xc)return fr.exports;Xc=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 fr.exports.debounce=n,fr.exports=n,fr.exports}var Rp=Cp();const Tp=vp(Rp);var Ip=(n,t)=>t(n),Sp=ld('<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 bp={hash:"svelte-1a08ofc",code:":host {display:block;height:200px;width:200px;}"};function Yc(n,t){La(t,!0),gd(n,bp);function e(w,T){t.$$host.dispatchEvent(new CustomEvent(w,{detail:T}))}let i=Kt(null),s=Kt(null),r=Kt(void 0),o=Kt(null),a,l=Fi(t,"id",7,""),h=Fi(t,"center",23,()=>[37.5176038,15.0819224]),c=Fi(t,"zoom",7,6),u=Fi(t,"source",23,()=>({type:"osm"})),d=Fi(t,"options",23,()=>({})),f=Fi(t,"data",23,()=>[]);Za(()=>{let w=!1;typeof u()=="string"&&(u(JSON.parse(u())),w=!0),d()&&typeof d()=="string"&&(d(JSON.parse(d())),w=!0),typeof c()=="string"&&(c(Number(c())),w=!0),typeof h()=="string"&&(h(JSON.parse(h())),w=!0),typeof f()=="string"&&(f(JSON.parse(f())),w=!0),w&&m()});function g(w){const T=Pn(w.coordinate,"EPSG:3857","EPSG:4326"),R=it(i)?.getView?.()?.getCenter?.(),I=Pn(R||h(),"EPSG:3857","EPSG:4326"),L=it(i)?.getView?.()?.getZoom?.()||c(),P=it(i)?.forEachFeatureAtPixel(w.pixel,function(A,b){return A});P&&P.get("marker")?(e("markerClick",{coordinates:{latitude:T[1],longitude:T[0]},id:P.get("id")}),P.get("popupHtml")&&it(o)?.innerHTML&&(it(o).innerHTML=P.get("popupHtml"),a?.setPosition(w.coordinate))):(a?.setPosition(void 0),e("pointClickCoordinates",{coordinates:{latitude:T[1],longitude:T[0]},zoom:L,center:I}))}function m(){if(it(s)){if(it(i)){St(i,null);const I=document.createElement("style");I.innerHTML=Wc,it(s).innerHTML="",it(s).appendChild(I)}const w=[];u().type.toLowerCase()==="osm"?w.push(new zc({source:new _p})):u().type.toLowerCase()==="xyz"&&u().url&&w.push(new zc({source:new kc({url:u().url})}));let T=[],R=zt();if(f()?.filter?.(I=>I.marker)?.length){const I=[];for(const A of f().filter(b=>b.marker).map(b=>b.marker)){const b=new kr({geometry:A?.lngLat?new Ys(to(A.lngLat)):void 0,icon:A?.icon,marker:!0,id:A?.id||void 0,popupHtml:A?.popupHtml});I.push(b);const M=b.getGeometry()?.getCoordinates();A?.lngLat&&T.push(A.lngLat),d().centerFromGeometries&&M&&M[2]!==-1/0&&M[3]!==-1/0&&(console.log("coords",M),R=vl(R,M))}const L=new Te({image:new tn({scale:3,anchor:[.5,.8],src:"https://upload.wikimedia.org/wikipedia/commons/e/e7/Maki2-marker-18.svg"})}),P=new nm({source:new Fg({features:I}),style(A){const b=A.get("icon");let M;return b?.uri?(M=new Te({image:new tn({scale:b.scale||.15,anchor:b.anchor||[.5,.8],src:b.uri,opacity:b.opacity||1,color:b.color||void 0})}),M):L}});w.push(P)}a=new Wm({element:it(r),autoPan:{animation:{duration:250}}}),St(i,new Gm({target:it(s),layers:w,overlays:[a],view:new ge({center:to(h()),zoom:c()})}),!0),d()?.centerFromGeometries&&T&&T.length>1&&R[2]!==-1/0&&R[3]!==-1/0?(console.log("extent",R),it(i).getView().fit(R,{padding:[25,25,25,25]})):d()?.centerFromGeometries&&it(i).getView().setCenter(to(T[0])),it(i).on("singleclick",function(I){g(I)})}}function _(w){a?.setPosition(void 0),w?.target?.blur?.()}fd(()=>{St(s,t.$$host?.shadowRoot?.querySelector("#map"),!0),St(r,t.$$host?.shadowRoot?.querySelector("#popup"),!0),St(o,t.$$host?.shadowRoot?.querySelector("#popup-content"),!0);const w=document.createElement("style");w.innerHTML=Wc,it(s)?.appendChild(w),m()});var p={get id(){return l()},set id(w=""){l(w),ni()},get center(){return h()},set center(w=[37.5176038,15.0819224]){h(w),ni()},get zoom(){return c()},set zoom(w=6){c(w),ni()},get source(){return u()},set source(w={type:"osm"}){u(w),ni()},get options(){return d()},set options(w={}){d(w),ni()},get data(){return f()},set data(w=[]){f(w),ni()}},y=Sp(),v=Ou(()=>Tp(m,200));rd("resize",Sr,function(...w){it(v)?.apply(this,w)});var x=Xu(Wu(y),2),E=zu(x);return E.__click=[Ip,_],Tu(2),Ru(x),cl(n,y),Aa(p)}od(["click"]),customElements.define("hb-map",xd(Yc,{id:{},center:{},zoom:{},source:{},options:{},data:{}},[],[],!0)),fa.Component=Yc,Object.defineProperty(fa,Symbol.toStringTag,{value:"Module"})})(this.map=this.map||{});
|
|
331
331
|
//# sourceMappingURL=main.iife.js.map
|