leaflet-html 0.7.2 → 0.7.3
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +40 -0
- package/dist/leaflet-html.js +1 -1
- package/dist/leaflet-html.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
@@ -178,6 +178,46 @@ For example, a marker with a custom icon in Leaflet JS has attributes like `{ sh
|
|
178
178
|
</l-map>
|
179
179
|
```
|
180
180
|
|
181
|
+
## Events
|
182
|
+
|
183
|
+
Leaflet events are wrapped in CustomElement events and available in the `detail` property of the Event.
|
184
|
+
By default, the "ready" event is triggered by the map element.
|
185
|
+
|
186
|
+
```html
|
187
|
+
<l-map id="map" ...>
|
188
|
+
...
|
189
|
+
</l-map>
|
190
|
+
|
191
|
+
<script>
|
192
|
+
const el = document.getElementById("map")
|
193
|
+
el.addEventListener("ready", (ev) => {
|
194
|
+
const map = ev.detail
|
195
|
+
console.log({ map })
|
196
|
+
})
|
197
|
+
</script>
|
198
|
+
```
|
199
|
+
|
200
|
+
Arbitrary map events can be listened to by specifying a space-separated list of map events in the on attribute, e.g. `on="resize zoomend"`.
|
201
|
+
|
202
|
+
This adds a forwarding mechanism to the CustomElement, to add custom JS listeners use `addEventListener("resize", ...)`
|
203
|
+
and use the `CustomElement` detail property as it is the underlying Leaflet Event.
|
204
|
+
|
205
|
+
|
206
|
+
```html
|
207
|
+
<l-map id="map" ... on="resize">
|
208
|
+
...
|
209
|
+
</l-map>
|
210
|
+
|
211
|
+
<script>
|
212
|
+
// Note: both addEventListener and on="eventName" needed
|
213
|
+
const el = document.getElementById("map")
|
214
|
+
el.addEventListener("resize", (ev) => {
|
215
|
+
const leafletResizeEvent = ev.detail
|
216
|
+
console.log(leafletResizeEvent)
|
217
|
+
})
|
218
|
+
</script>
|
219
|
+
```
|
220
|
+
|
181
221
|
## Realistic example
|
182
222
|
|
183
223
|
The HTML in `example/index.html` is a simple demonstration of the API.
|
package/dist/leaflet-html.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
import*as t from"leaflet";import{control as e,layerGroup as n,tileLayer as r,imageOverlay as a,videoOverlay as i,geoJSON as o,icon as l,tooltip as s,Circle as u,Rectangle as c,Polygon as f,Polyline as p,circle as b,polyline as v,polygon as h,rectangle as d}from"leaflet";function y(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function m(){return m=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},m.apply(null,arguments)}function g(t){return g=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},g(t)}function E(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,C(t,e)}function L(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(L=function(){return!!t})()}function C(t,e){return C=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},C(t,e)}function O(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}function w(t){var e="function"==typeof Map?new Map:void 0;return w=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return function(t,e,n){if(L())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var a=new(t.bind.apply(t,r));return n&&C(a,n.prototype),a}(t,arguments,g(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),C(n,t)},w(t)}var A="map:addTo",k="popup:add",S=/*#__PURE__*/function(t){function e(){return t.call(this)||this}return E(e,t),e.prototype.connectedCallback=function(){this.addEventListener(A,function(t){t.detail.type="base"})},e}(/*#__PURE__*/w(HTMLElement)),N=/*#__PURE__*/function(t){function n(){return t.call(this)||this}return E(n,t),n.prototype.connectedCallback=function(){var t=e.layers({},{});this.addEventListener(A,function(e){var n=e.detail,r=n.type,a=n.name,i=n.layer;"overlay"===r?t.addOverlay(i,a):"base"===r&&t.addBaseLayer(i,a),e.preventDefault()});var n=new CustomEvent(A,{cancelable:!0,bubbles:!0,detail:{layer:t}});this.dispatchEvent(n)},n}(/*#__PURE__*/w(HTMLElement)),T=/*#__PURE__*/function(t){function e(){var e;return(e=t.call(this)||this).layer=null,e}return E(e,t),e}(/*#__PURE__*/w(HTMLElement)),j=/*#__PURE__*/function(t){function e(){var e;return(e=t.call(this)||this).layer=null,e}return E(e,t),e.prototype.connectedCallback=function(){var t=this.getAttribute("name"),e=n();this.layer=e;var r=new CustomEvent(A,{cancelable:!0,bubbles:!0,detail:{layer:e,name:t}});this.dispatchEvent(r),this.addEventListener(A,function(t){t.stopPropagation(),e.addLayer(t.detail.layer)}),new MutationObserver(function(t){t.forEach(function(t){t.removedNodes.forEach(function(t){if(t instanceof HTMLElement){var n=t.getAttribute("leaflet-id");if(null!==n){var r=e.getLayer(parseInt(n));void 0!==r&&e.removeLayer(r)}}})})}).observe(this,{childList:!0})},e}(T),J=/*#__PURE__*/function(t){function e(e){var n;return(n=t.call(this)||this).issues=[],n.name="LeafletHTMLError",n.issues=e,n}return E(e,t),n=e,(r=[{key:"message",get:function(){return JSON.stringify(this.issues,null,2)}}])&&function(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,O(r.key),r)}}(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(/*#__PURE__*/w(Error)),M=function(t,e){var n=t(function(t){return{status:"clean",issues:[],value:t}}(e));if("clean"!==n.status)throw new J(n.issues);return n.value},P=function(t){return function(e){for(var n=e.issues,r="clean",a={},i=0,o=Object.keys(t);i<o.length;i++){var l=o[i],s=t[l](e);"clean"!==s.status&&(r=s.status),null===s.value&&"clean"===s.status||(n=[].concat(n,s.issues),a[l]=s.value)}return{status:r,issues:n,value:a}}},H=function(){var t=[].slice.call(arguments);return function(e){for(var n=0;n<t.length&&"abort"!==(e=t[n](e)).status;n++);return e}},_=function(){var t=[].slice.call(arguments);return function(e){for(var n=0;n<t.length;n++)e=t[n](e);return e}},I=function(t){return function(e){return null===e.value?e:t(e)}},F=function(t){return function(e){return null===(e=t(e)).value?{status:"clean",issues:[],value:null}:e}},z=function(t){return function(e){var n=e.value,r=n.getAttribute(t);return null===r?{status:"abort",issues:[].concat(e.issues,[R(n,t)]),value:null}:m({},e,{value:r})}},B=function(){return function(t){var e;try{e=JSON.parse(t.value)}catch(e){return{status:"abort",issues:[].concat(t.issues,[x(e)]),value:null}}return m({},t,{value:e})}},U=function(t){return H.apply(void 0,[z(t)].concat([].slice.call(arguments,1)))},x=function(t){return{code:"parse_json",message:t.message}},R=function(t,e){return{code:"missing_attribute",message:t.tagName.toLowerCase()+" missing attribute '"+e+"'"}},V=/*#__PURE__*/function(e){function n(){var t;return(t=e.call(this)||this).map=null,t.addEventListener("map:bounds",function(e){var n=e.detail;null!==t.map&&t.map[n.method](n.bounds)}),new MutationObserver(function(t){t.forEach(function(t){if(t.target instanceof n){var e=t.target;t.removedNodes.forEach(function(t){t instanceof T&&null!==e.map&&null!==t.layer&&e.map.removeLayer(t.layer)})}})}).observe(t,{childList:!0}),t}E(n,e);var r=n.prototype;return r.connectedCallback=function(){var e,n=this;if(this.map=t.map(this),this.hasAttribute("on")){var r=this.getAttribute("on");null!==r&&r.split(/\s+/).forEach(function(t){null!==n.map&&n.map.on(t,function(e){n.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:e}))})})}if(this.hasAttribute("fit-world"))this.map.fitWorld();else{var a=(e={zoom:U("zoom",function(t){var e,n=parseInt(t.value);return isNaN(n)?{status:"abort",issues:[].concat(t.issues,[(e=t.value,{code:"parse_int",message:'could not parse int given: "'+e+'"'})]),value:n}:m({},t,{value:n})}),center:U("center",B())},function(t){for(var n=t.status,r=t.issues,a={},i=0,o=Object.keys(e);i<o.length;i++){var l=o[i],s=e[l](t);"abort"===s.status&&(n="abort",r=[].concat(r,s.issues)),a[l]=s.value}return{status:n,issues:r,value:a}}),i=M(a,this);this.map.setView(i.center,i.zoom)}if(this.hasAttribute("locate")){var o=U("locate",B());this.map.locate(M(o,this))}this.addEventListener(A,function(t){t.detail.layer.addTo(n.map)}),this.addEventListener("layer:remove",function(t){null!==n.map&&n.map.removeLayer(t.detail.layer)})},r.attributeChangedCallback=function(t,e,n){null!==this.map&&("zoom"===t?this.map.setZoom(parseInt(n)):"center"===t&&this.map.setView(JSON.parse(n)))},n}(/*#__PURE__*/w(HTMLElement));V.observedAttributes=["zoom","center"];var D=/*#__PURE__*/function(e){function n(){var t;return(t=e.call(this)||this).layer=null,t.addEventListener("icon:add",function(e){e.stopPropagation(),t.layer.setIcon(e.detail.icon)}),t}E(n,e);var r=n.prototype;return r.connectedCallback=function(){var e=this,n=M(U("lat-lng",B()),this),r=M(P({opacity:_(F(z("opacity")),I(function(t){var e,n=parseFloat(t.value);return isNaN(n)?{status:"abort",issues:[].concat(t.issues,[(e=t.value,{code:"parse_float",message:'could not parse float given: "'+e+'"'})]),value:n}:m({},t,{value:n})}))}),this);if(this.layer=t.marker(n,r),this.hasAttribute("icon")){var a=t.icon(JSON.parse(this.getAttribute("icon")));this.layer.setIcon(a)}this.setAttribute("leaflet-id",t.stamp(this.layer)),this.addEventListener(k,function(t){var n=t.detail,r=n.openPopup,a=e.layer.bindPopup(n.content);r&&a.openPopup()});var i=new CustomEvent(A,{cancelable:!0,bubbles:!0,detail:{layer:this.layer}});this.dispatchEvent(i)},r.attributeChangedCallback=function(e,n,r){null!==this.layer&&("lat-lng"===e&&this.layer.setLatLng(JSON.parse(r)),"opacity"===e&&this.layer.setOpacity(parseFloat(r)),"icon"===e&&this.layer.setIcon(t.icon(JSON.parse(r))))},n}(T);D.observedAttributes=["lat-lng","opacity","icon"];var W=/*#__PURE__*/function(t){function e(){return t.call(this)||this}return E(e,t),e.prototype.connectedCallback=function(){this.addEventListener(A,function(t){t.detail.type="overlay"})},e}(/*#__PURE__*/w(HTMLElement)),Z=/*#__PURE__*/function(t){function e(){return t.call(this)||this}return E(e,t),e.prototype.connectedCallback=function(){var t=this.getAttribute("content"),e=!1,n=this.getAttribute("open-popup");null!==n&&(e="false"!==n);var r=new CustomEvent(k,{cancelable:!0,bubbles:!0,detail:{content:t,openPopup:e}});this.dispatchEvent(r)},e}(/*#__PURE__*/w(HTMLElement)),$=/*#__PURE__*/function(t){function e(){var e;return(e=t.call(this)||this).layer=null,e}return E(e,t),e.prototype.connectedCallback=function(){for(var t,n=M(z("url-template"),this),a={},i=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return y(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?y(t,e):void 0}}(t))){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(e.parseTemplateAttributes(n));!(t=i()).done;){var o=t.value,l=this.getAttribute(o);null!==l&&(a[o]=l)}var s=this.getAttribute("name"),u=P({attribution:F(z("attribution")),errorTileUrl:F(z("error-tile-url"))}),c=M(u,this);this.layer=r(n,m({},a,c));var f=new CustomEvent(A,{detail:{name:s,layer:this.layer},bubbles:!0});this.dispatchEvent(f)},e.parseTemplateAttributes=function(t){return[].concat(t.matchAll(/{(.*?)}/g)).map(function(t){return t[1]})},e}(T),q=/*#__PURE__*/function(t){function e(){return t.call(this)||this}E(e,t);var n=e.prototype;return n.connectedCallback=function(){var t=this.getAttribute("bounds");null!==t&&this.dispatchEvent(this.getEvent(JSON.parse(t)))},n.attributeChangedCallback=function(t,e,n){this.dispatchEvent(this.getEvent(JSON.parse(n)))},n.getEvent=function(t){return new CustomEvent("map:bounds",{bubbles:!0,detail:{bounds:t,method:this.getAttribute("method")||"fitBounds"}})},e}(/*#__PURE__*/w(HTMLElement));q.observedAttributes=["bounds"];var G=/*#__PURE__*/function(t){function e(){var e;return(e=t.call(this)||this).layer=null,e}E(e,t);var n=e.prototype;return n.connectedCallback=function(){var t=this.getAttribute("url");if(null!==t){var e=this.getAttribute("bounds");if(null!==e){var n={opacity:parseFloat(this.getAttribute("opacity")||"1.0"),alt:this.getAttribute("alt")||""};this.layer=a(t,JSON.parse(e),n),this.dispatchEvent(new CustomEvent(A,{cancelable:!0,bubbles:!0,detail:{layer:this.layer}}))}else console.warn("attribute 'bounds' not set")}else console.warn("attribute 'url' not set")},n.attributeChangedCallback=function(t,e,n){null!==this.layer&&("url"===t?this.layer.setUrl(n):"bounds"===t?this.layer.setBounds(JSON.parse(n)):"opacity"===t&&this.layer.setOpacity(parseFloat(n)))},e}(T);G.observedAttributes=["url","bounds","opacity"];var K=/*#__PURE__*/function(t){function e(){return t.call(this)||this}return E(e,t),e.prototype.connectedCallback=function(){var t=JSON.parse(this.getAttribute("url")),e=JSON.parse(this.getAttribute("bounds")),n={opacity:parseFloat(this.getAttribute("opacity")||"1.0"),alt:this.getAttribute("alt")||"",autoplay:!0,muted:!0,playsInline:!0},r=i(t,e,n);this.dispatchEvent(new CustomEvent(A,{cancelable:!0,bubbles:!0,detail:{layer:r}}))},e}(T),Q=/*#__PURE__*/function(t){function e(){return t.call(this)||this}return E(e,t),e.prototype.connectedCallback=function(){var t=this.getAttribute("geojson");if(null!==t){var e=o(JSON.parse(t));this.dispatchEvent(new CustomEvent(A,{bubbles:!0,cancelable:!0,detail:{layer:e}}))}},e}(/*#__PURE__*/w(HTMLElement)),X=function(t){return t.replace(/-./g,function(t){return t[1].toUpperCase()})},Y=/*#__PURE__*/function(t){function e(){var e;return(e=t.call(this)||this).icon=null,e}return E(e,t),e.prototype.connectedCallback=function(){var t={};["icon-url","icon-retina-url","shadow-url","shadow-retina-url","class-name"].forEach(function(e){t[X(e)]=F(z(e))}),["icon-anchor","icon-size","shadow-anchor","shadow-size","tooltip-anchor","popup-anchor"].forEach(function(e){t[X(e)]=_(F(z(e)),I(B()))}),t.crossOrigin=_(F(z("cross-origin")),I(function(t){return m({},t,{value:"true"===t.value.toLowerCase()})}));var e=P(t),n=M(e,this);this.icon=l(n);var r=new CustomEvent("icon:add",{cancelable:!0,bubbles:!0,detail:{icon:this.icon}});this.dispatchEvent(r)},e}(/*#__PURE__*/w(HTMLElement)),tt=/*#__PURE__*/function(t){function e(){var e;return(e=t.call(this)||this).tooltip=s(),e}E(e,t);var n=e.prototype;return n.connectedCallback=function(){var t=new CustomEvent("bindTooltip",{cancelable:!0,bubbles:!0,detail:{tooltip:this.tooltip}});this.dispatchEvent(t)},n.attributeChangedCallback=function(t,e,n){"content"===t&&this.tooltip.setContent(n)},e}(/*#__PURE__*/w(HTMLElement));tt.observedAttributes=["content"];var et=function(t){switch(t){case"circle":return[nt("latLng","latlng",null)];case"rectangle":return[nt("latLngBounds","latlngbounds",null)];case"polygon":case"polyline":return[nt("latLngs","latlng",null)]}},nt=function(t,e,n){return{camel:t,kebab:(r=t,r.split("").map(function(t,e){return t.toUpperCase()===t?(0!==e?"-":"")+t.toLowerCase():t}).join("")),parser:rt(e),defaultValue:n};var r},rt=function(t){switch(t.toLowerCase()){case"boolean":return function(t){return"true"===t};case"number":return parseFloat;case"latlng":case"latlngbounds":return JSON.parse;default:return function(t){return t}}},at=function(t){var e={circle:[nt("radius","number",null)],path:[nt("stroke","boolean",!0),nt("color","string","#3388ff"),nt("weight","number",3),nt("opacity","number",1),nt("lineCap","string","round"),nt("lineJoin","string","round"),nt("dashArray","string",null),nt("dashOffset","string",null),nt("fill","boolean",!0),nt("fillColor","string","#3388ff"),nt("fillOpacity","number",.2)],polyline:[nt("smoothFactor","number",1),nt("noClip","boolean",!1)],polygon:[],rectangle:[],interactiveLayer:[nt("interactive","boolean",!0)]};return ot(t).flatMap(function(t){return e[t]})},it={circle:["path"],polyline:["path"],polygon:["polyline"],rectangle:["polygon"],path:["interactiveLayer"],interactiveLayer:[]},ot=function(t){for(var e=t,n=[t];it[e].length>0;){var r=it[e][0];n.push(r),e=r}return n},lt=function(t,e){var n={};return at(e).forEach(function(e){t.hasAttribute(e.kebab)&&(n[e.camel]=e.parser(t.getAttribute(e.kebab)))}),n},st=function(t,e){var n=/*#__PURE__*/function(n){function r(){var t;return(t=n.call(this)||this).layer=null,t.addEventListener("bindTooltip",function(e){null!==t.layer&&t.layer.bindTooltip(e.detail.tooltip)}),t}E(r,n);var a=r.prototype;return a.connectedCallback=function(){var n=function(t,e){return et(e).map(function(e){var n=z(e.kebab),r=M(n,t);return e.parser(r)})}(this,e),r=lt(this,e);this.layer=t.apply(void 0,n.concat([r]));var a=new CustomEvent("map:addTo",{cancelable:!0,bubbles:!0,detail:{layer:this.layer}});this.dispatchEvent(a)},a.attributeChangedCallback=function(t,n,r){null!==this.layer&&function(t,e,n,r){var a=[].concat(et(e),at(e)).find(function(t){return t.kebab===n});if(void 0!==a){var i=a.parser(r);if(t instanceof u)switch(n){case"lat-lng":t.setLatLng(JSON.parse(r));break;case"radius":t.setRadius(parseFloat(r))}else if(t instanceof c)switch(n){case"lat-lngs":t.setLatLngs(JSON.parse(r));break;case"lat-lng-bounds":t.setBounds(JSON.parse(r))}else t instanceof f?"lat-lngs"===n&&t.setLatLngs(JSON.parse(r)):t instanceof p&&"lat-lngs"===n&&t.setLatLngs(JSON.parse(r));var o,l=at("polyline").find(function(t){return t.kebab===n});void 0!==l&&t.setStyle(((o={})[l.camel]=i,o))}}(this.layer,e,t,r)},r}(/*#__PURE__*/w(HTMLElement));return n.observedAttributes=function(t){var e=et(t).map(function(t){return t.kebab}),n=at(t).map(function(t){return t.kebab});return[].concat(e,n)}(e),n},ut=(customElements.define("l-map",V),customElements.define("l-control-layers",N),customElements.define("l-base-layers",S),customElements.define("l-overlay-layers",W),customElements.define("l-layer-group",j),customElements.define("l-tile-layer",$),customElements.define("l-marker",D),customElements.define("l-popup",Z),customElements.define("l-lat-lng-bounds",q),customElements.define("l-image-overlay",G),customElements.define("l-video-overlay",K),customElements.define("l-geojson",Q),customElements.define("l-icon",Y),customElements.define("l-circle",st(b,"circle")),customElements.define("l-polyline",st(v,"polyline")),customElements.define("l-polygon",st(h,"polygon")),customElements.define("l-rectangle",st(d,"rectangle")),void customElements.define("l-tooltip",tt));export{ut as default};
|
1
|
+
import*as t from"leaflet";import{control as e,layerGroup as n,tileLayer as r,imageOverlay as a,videoOverlay as i,geoJSON as o,icon as l,tooltip as s,Circle as u,Rectangle as c,Polygon as f,Polyline as p,circle as b,polyline as v,polygon as d,rectangle as h}from"leaflet";function y(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function m(){return m=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},m.apply(null,arguments)}function g(t){return g=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},g(t)}function E(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,L(t,e)}function C(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(C=function(){return!!t})()}function L(t,e){return L=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},L(t,e)}function w(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}function O(t){var e="function"==typeof Map?new Map:void 0;return O=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return function(t,e,n){if(C())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var a=new(t.bind.apply(t,r));return n&&L(a,n.prototype),a}(t,arguments,g(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),L(n,t)},O(t)}var A="map:addTo",k="popup:add",S=/*#__PURE__*/function(t){function e(){return t.call(this)||this}return E(e,t),e.prototype.connectedCallback=function(){this.addEventListener(A,function(t){t.detail.type="base"})},e}(/*#__PURE__*/O(HTMLElement)),N=/*#__PURE__*/function(t){function n(){return t.call(this)||this}return E(n,t),n.prototype.connectedCallback=function(){var t=e.layers({},{});this.addEventListener(A,function(e){var n=e.detail,r=n.type,a=n.name,i=n.layer;"overlay"===r?t.addOverlay(i,a):"base"===r&&t.addBaseLayer(i,a),e.preventDefault()});var n=new CustomEvent(A,{cancelable:!0,bubbles:!0,detail:{layer:t}});this.dispatchEvent(n)},n}(/*#__PURE__*/O(HTMLElement)),T=/*#__PURE__*/function(t){function e(){var e;return(e=t.call(this)||this).layer=null,e}return E(e,t),e}(/*#__PURE__*/O(HTMLElement)),j=/*#__PURE__*/function(t){function e(){var e;return(e=t.call(this)||this).layer=null,e}return E(e,t),e.prototype.connectedCallback=function(){var t=this.getAttribute("name"),e=n();this.layer=e;var r=new CustomEvent(A,{cancelable:!0,bubbles:!0,detail:{layer:e,name:t}});this.dispatchEvent(r),this.addEventListener(A,function(t){t.stopPropagation(),e.addLayer(t.detail.layer)}),new MutationObserver(function(t){t.forEach(function(t){t.removedNodes.forEach(function(t){if(t instanceof HTMLElement){var n=t.getAttribute("leaflet-id");if(null!==n){var r=e.getLayer(parseInt(n));void 0!==r&&e.removeLayer(r)}}})})}).observe(this,{childList:!0})},e}(T),J=/*#__PURE__*/function(t){function e(e){var n;return(n=t.call(this)||this).issues=[],n.name="LeafletHTMLError",n.issues=e,n}return E(e,t),n=e,(r=[{key:"message",get:function(){return JSON.stringify(this.issues,null,2)}}])&&function(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,w(r.key),r)}}(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(/*#__PURE__*/O(Error)),M=function(t,e){var n=t(function(t){return{status:"clean",issues:[],value:t}}(e));if("clean"!==n.status)throw new J(n.issues);return n.value},P=function(t){return function(e){for(var n=e.issues,r="clean",a={},i=0,o=Object.keys(t);i<o.length;i++){var l=o[i],s=t[l](e);"clean"!==s.status&&(r=s.status),null===s.value&&"clean"===s.status||(n=[].concat(n,s.issues),a[l]=s.value)}return{status:r,issues:n,value:a}}},H=function(){var t=[].slice.call(arguments);return function(e){for(var n=0;n<t.length&&"abort"!==(e=t[n](e)).status;n++);return e}},_=function(){var t=[].slice.call(arguments);return function(e){for(var n=0;n<t.length;n++)e=t[n](e);return e}},I=function(t){return function(e){return null===e.value?e:t(e)}},F=function(t){return function(e){return null===(e=t(e)).value?{status:"clean",issues:[],value:null}:e}},z=function(t){return function(e){var n=e.value,r=n.getAttribute(t);return null===r?{status:"abort",issues:[].concat(e.issues,[R(n,t)]),value:null}:m({},e,{value:r})}},B=function(){return function(t){var e;try{e=JSON.parse(t.value)}catch(e){return{status:"abort",issues:[].concat(t.issues,[x(e)]),value:null}}return m({},t,{value:e})}},U=function(t){return H.apply(void 0,[z(t)].concat([].slice.call(arguments,1)))},x=function(t){return{code:"parse_json",message:t.message}},R=function(t,e){return{code:"missing_attribute",message:t.tagName.toLowerCase()+" missing attribute '"+e+"'"}},V=/*#__PURE__*/function(e){function n(){var t;return(t=e.call(this)||this).map=null,t.addEventListener("map:bounds",function(e){var n=e.detail;null!==t.map&&t.map[n.method](n.bounds)}),new MutationObserver(function(t){t.forEach(function(t){if(t.target instanceof n){var e=t.target;t.removedNodes.forEach(function(t){t instanceof T&&null!==e.map&&null!==t.layer&&e.map.removeLayer(t.layer)})}})}).observe(t,{childList:!0}),t}E(n,e);var r=n.prototype;return r.connectedCallback=function(){var e,n=this;if(this.map=t.map(this),this.map.whenReady(function(){n.dispatchEvent(new CustomEvent("ready",{bubbles:!0,cancelable:!0,detail:n.map}))}),this.hasAttribute("on")){var r=this.getAttribute("on");null!==r&&r.split(/\s+/).forEach(function(t){null!==n.map&&n.map.on(t,function(e){n.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:e}))})})}if(this.hasAttribute("fit-world"))this.map.fitWorld();else{var a=(e={zoom:U("zoom",function(t){var e,n=parseInt(t.value);return isNaN(n)?{status:"abort",issues:[].concat(t.issues,[(e=t.value,{code:"parse_int",message:'could not parse int given: "'+e+'"'})]),value:n}:m({},t,{value:n})}),center:U("center",B())},function(t){for(var n=t.status,r=t.issues,a={},i=0,o=Object.keys(e);i<o.length;i++){var l=o[i],s=e[l](t);"abort"===s.status&&(n="abort",r=[].concat(r,s.issues)),a[l]=s.value}return{status:n,issues:r,value:a}}),i=M(a,this);this.map.setView(i.center,i.zoom)}if(this.hasAttribute("locate")){var o=U("locate",B());this.map.locate(M(o,this))}this.addEventListener(A,function(t){t.detail.layer.addTo(n.map)}),this.addEventListener("layer:remove",function(t){null!==n.map&&n.map.removeLayer(t.detail.layer)})},r.attributeChangedCallback=function(t,e,n){null!==this.map&&("zoom"===t?this.map.setZoom(parseInt(n)):"center"===t&&this.map.setView(JSON.parse(n)))},n}(/*#__PURE__*/O(HTMLElement));V.observedAttributes=["zoom","center"];var D=/*#__PURE__*/function(e){function n(){var t;return(t=e.call(this)||this).layer=null,t.addEventListener("icon:add",function(e){e.stopPropagation(),t.layer.setIcon(e.detail.icon)}),t}E(n,e);var r=n.prototype;return r.connectedCallback=function(){var e=this,n=M(U("lat-lng",B()),this),r=M(P({opacity:_(F(z("opacity")),I(function(t){var e,n=parseFloat(t.value);return isNaN(n)?{status:"abort",issues:[].concat(t.issues,[(e=t.value,{code:"parse_float",message:'could not parse float given: "'+e+'"'})]),value:n}:m({},t,{value:n})}))}),this);if(this.layer=t.marker(n,r),this.hasAttribute("icon")){var a=t.icon(JSON.parse(this.getAttribute("icon")));this.layer.setIcon(a)}this.setAttribute("leaflet-id",t.stamp(this.layer)),this.addEventListener(k,function(t){var n=t.detail,r=n.openPopup,a=e.layer.bindPopup(n.content);r&&a.openPopup()});var i=new CustomEvent(A,{cancelable:!0,bubbles:!0,detail:{layer:this.layer}});this.dispatchEvent(i)},r.attributeChangedCallback=function(e,n,r){null!==this.layer&&("lat-lng"===e&&this.layer.setLatLng(JSON.parse(r)),"opacity"===e&&this.layer.setOpacity(parseFloat(r)),"icon"===e&&this.layer.setIcon(t.icon(JSON.parse(r))))},n}(T);D.observedAttributes=["lat-lng","opacity","icon"];var W=/*#__PURE__*/function(t){function e(){return t.call(this)||this}return E(e,t),e.prototype.connectedCallback=function(){this.addEventListener(A,function(t){t.detail.type="overlay"})},e}(/*#__PURE__*/O(HTMLElement)),Z=/*#__PURE__*/function(t){function e(){return t.call(this)||this}return E(e,t),e.prototype.connectedCallback=function(){var t=this.getAttribute("content"),e=!1,n=this.getAttribute("open-popup");null!==n&&(e="false"!==n);var r=new CustomEvent(k,{cancelable:!0,bubbles:!0,detail:{content:t,openPopup:e}});this.dispatchEvent(r)},e}(/*#__PURE__*/O(HTMLElement)),$=/*#__PURE__*/function(t){function e(){var e;return(e=t.call(this)||this).layer=null,e}return E(e,t),e.prototype.connectedCallback=function(){for(var t,n=M(z("url-template"),this),a={},i=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return y(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?y(t,e):void 0}}(t))){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(e.parseTemplateAttributes(n));!(t=i()).done;){var o=t.value,l=this.getAttribute(o);null!==l&&(a[o]=l)}var s=this.getAttribute("name"),u=P({attribution:F(z("attribution")),errorTileUrl:F(z("error-tile-url"))}),c=M(u,this);this.layer=r(n,m({},a,c));var f=new CustomEvent(A,{detail:{name:s,layer:this.layer},bubbles:!0});this.dispatchEvent(f)},e.parseTemplateAttributes=function(t){return[].concat(t.matchAll(/{(.*?)}/g)).map(function(t){return t[1]})},e}(T),q=/*#__PURE__*/function(t){function e(){return t.call(this)||this}E(e,t);var n=e.prototype;return n.connectedCallback=function(){var t=this.getAttribute("bounds");null!==t&&this.dispatchEvent(this.getEvent(JSON.parse(t)))},n.attributeChangedCallback=function(t,e,n){this.dispatchEvent(this.getEvent(JSON.parse(n)))},n.getEvent=function(t){return new CustomEvent("map:bounds",{bubbles:!0,detail:{bounds:t,method:this.getAttribute("method")||"fitBounds"}})},e}(/*#__PURE__*/O(HTMLElement));q.observedAttributes=["bounds"];var G=/*#__PURE__*/function(t){function e(){var e;return(e=t.call(this)||this).layer=null,e}E(e,t);var n=e.prototype;return n.connectedCallback=function(){var t=this.getAttribute("url");if(null!==t){var e=this.getAttribute("bounds");if(null!==e){var n={opacity:parseFloat(this.getAttribute("opacity")||"1.0"),alt:this.getAttribute("alt")||""};this.layer=a(t,JSON.parse(e),n),this.dispatchEvent(new CustomEvent(A,{cancelable:!0,bubbles:!0,detail:{layer:this.layer}}))}else console.warn("attribute 'bounds' not set")}else console.warn("attribute 'url' not set")},n.attributeChangedCallback=function(t,e,n){null!==this.layer&&("url"===t?this.layer.setUrl(n):"bounds"===t?this.layer.setBounds(JSON.parse(n)):"opacity"===t&&this.layer.setOpacity(parseFloat(n)))},e}(T);G.observedAttributes=["url","bounds","opacity"];var K=/*#__PURE__*/function(t){function e(){return t.call(this)||this}return E(e,t),e.prototype.connectedCallback=function(){var t=JSON.parse(this.getAttribute("url")),e=JSON.parse(this.getAttribute("bounds")),n={opacity:parseFloat(this.getAttribute("opacity")||"1.0"),alt:this.getAttribute("alt")||"",autoplay:!0,muted:!0,playsInline:!0},r=i(t,e,n);this.dispatchEvent(new CustomEvent(A,{cancelable:!0,bubbles:!0,detail:{layer:r}}))},e}(T),Q=/*#__PURE__*/function(t){function e(){return t.call(this)||this}return E(e,t),e.prototype.connectedCallback=function(){var t=this.getAttribute("geojson");if(null!==t){var e=o(JSON.parse(t));this.dispatchEvent(new CustomEvent(A,{bubbles:!0,cancelable:!0,detail:{layer:e}}))}},e}(/*#__PURE__*/O(HTMLElement)),X=function(t){return t.replace(/-./g,function(t){return t[1].toUpperCase()})},Y=/*#__PURE__*/function(t){function e(){var e;return(e=t.call(this)||this).icon=null,e}return E(e,t),e.prototype.connectedCallback=function(){var t={};["icon-url","icon-retina-url","shadow-url","shadow-retina-url","class-name"].forEach(function(e){t[X(e)]=F(z(e))}),["icon-anchor","icon-size","shadow-anchor","shadow-size","tooltip-anchor","popup-anchor"].forEach(function(e){t[X(e)]=_(F(z(e)),I(B()))}),t.crossOrigin=_(F(z("cross-origin")),I(function(t){return m({},t,{value:"true"===t.value.toLowerCase()})}));var e=P(t),n=M(e,this);this.icon=l(n);var r=new CustomEvent("icon:add",{cancelable:!0,bubbles:!0,detail:{icon:this.icon}});this.dispatchEvent(r)},e}(/*#__PURE__*/O(HTMLElement)),tt=/*#__PURE__*/function(t){function e(){var e;return(e=t.call(this)||this).tooltip=s(),e}E(e,t);var n=e.prototype;return n.connectedCallback=function(){var t=new CustomEvent("bindTooltip",{cancelable:!0,bubbles:!0,detail:{tooltip:this.tooltip}});this.dispatchEvent(t)},n.attributeChangedCallback=function(t,e,n){"content"===t&&this.tooltip.setContent(n)},e}(/*#__PURE__*/O(HTMLElement));tt.observedAttributes=["content"];var et=function(t){switch(t){case"circle":return[nt("latLng","latlng",null)];case"rectangle":return[nt("latLngBounds","latlngbounds",null)];case"polygon":case"polyline":return[nt("latLngs","latlng",null)]}},nt=function(t,e,n){return{camel:t,kebab:(r=t,r.split("").map(function(t,e){return t.toUpperCase()===t?(0!==e?"-":"")+t.toLowerCase():t}).join("")),parser:rt(e),defaultValue:n};var r},rt=function(t){switch(t.toLowerCase()){case"boolean":return function(t){return"true"===t};case"number":return parseFloat;case"latlng":case"latlngbounds":return JSON.parse;default:return function(t){return t}}},at=function(t){var e={circle:[nt("radius","number",null)],path:[nt("stroke","boolean",!0),nt("color","string","#3388ff"),nt("weight","number",3),nt("opacity","number",1),nt("lineCap","string","round"),nt("lineJoin","string","round"),nt("dashArray","string",null),nt("dashOffset","string",null),nt("fill","boolean",!0),nt("fillColor","string","#3388ff"),nt("fillOpacity","number",.2)],polyline:[nt("smoothFactor","number",1),nt("noClip","boolean",!1)],polygon:[],rectangle:[],interactiveLayer:[nt("interactive","boolean",!0)]};return ot(t).flatMap(function(t){return e[t]})},it={circle:["path"],polyline:["path"],polygon:["polyline"],rectangle:["polygon"],path:["interactiveLayer"],interactiveLayer:[]},ot=function(t){for(var e=t,n=[t];it[e].length>0;){var r=it[e][0];n.push(r),e=r}return n},lt=function(t,e){var n={};return at(e).forEach(function(e){t.hasAttribute(e.kebab)&&(n[e.camel]=e.parser(t.getAttribute(e.kebab)))}),n},st=function(t,e){var n=/*#__PURE__*/function(n){function r(){var t;return(t=n.call(this)||this).layer=null,t.addEventListener("bindTooltip",function(e){null!==t.layer&&t.layer.bindTooltip(e.detail.tooltip)}),t}E(r,n);var a=r.prototype;return a.connectedCallback=function(){var n=function(t,e){return et(e).map(function(e){var n=z(e.kebab),r=M(n,t);return e.parser(r)})}(this,e),r=lt(this,e);this.layer=t.apply(void 0,n.concat([r]));var a=new CustomEvent("map:addTo",{cancelable:!0,bubbles:!0,detail:{layer:this.layer}});this.dispatchEvent(a)},a.attributeChangedCallback=function(t,n,r){null!==this.layer&&function(t,e,n,r){var a=[].concat(et(e),at(e)).find(function(t){return t.kebab===n});if(void 0!==a){var i=a.parser(r);if(t instanceof u)switch(n){case"lat-lng":t.setLatLng(JSON.parse(r));break;case"radius":t.setRadius(parseFloat(r))}else if(t instanceof c)switch(n){case"lat-lngs":t.setLatLngs(JSON.parse(r));break;case"lat-lng-bounds":t.setBounds(JSON.parse(r))}else t instanceof f?"lat-lngs"===n&&t.setLatLngs(JSON.parse(r)):t instanceof p&&"lat-lngs"===n&&t.setLatLngs(JSON.parse(r));var o,l=at("polyline").find(function(t){return t.kebab===n});void 0!==l&&t.setStyle(((o={})[l.camel]=i,o))}}(this.layer,e,t,r)},r}(/*#__PURE__*/O(HTMLElement));return n.observedAttributes=function(t){var e=et(t).map(function(t){return t.kebab}),n=at(t).map(function(t){return t.kebab});return[].concat(e,n)}(e),n},ut=(customElements.define("l-map",V),customElements.define("l-control-layers",N),customElements.define("l-base-layers",S),customElements.define("l-overlay-layers",W),customElements.define("l-layer-group",j),customElements.define("l-tile-layer",$),customElements.define("l-marker",D),customElements.define("l-popup",Z),customElements.define("l-lat-lng-bounds",q),customElements.define("l-image-overlay",G),customElements.define("l-video-overlay",K),customElements.define("l-geojson",Q),customElements.define("l-icon",Y),customElements.define("l-circle",st(b,"circle")),customElements.define("l-polyline",st(v,"polyline")),customElements.define("l-polygon",st(d,"polygon")),customElements.define("l-rectangle",st(h,"rectangle")),void customElements.define("l-tooltip",tt));export{ut as default};
|
2
2
|
//# sourceMappingURL=leaflet-html.js.map
|
package/dist/leaflet-html.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"leaflet-html.js","sources":["../src/events.js","../src/l-base-layers.js","../src/l-control-layers.js","../src/l-layer.js","../src/l-layer-group.js","../src/parse.js","../src/l-map.js","../src/l-marker.js","../src/l-overlay-layers.js","../src/l-popup.js","../src/l-tile-layer.js","../src/l-lat-lng-bounds.js","../src/l-image-overlay.js","../src/l-video-overlay.js","../src/l-geojson.js","../src/util.js","../src/l-icon.js","../src/l-tooltip.js","../src/generator.js","../src/index.js"],"sourcesContent":["export const mapAddTo = \"map:addTo\";\nexport const popupAdd = \"popup:add\";\nexport const layerRemove = \"layer:remove\";\n","// @ts-check\nimport { mapAddTo } from \"./events.js\";\n\nclass LBaseLayers extends HTMLElement {\n constructor() {\n super();\n }\n\n connectedCallback() {\n this.addEventListener(mapAddTo, (ev) => {\n ev.detail[\"type\"] = \"base\";\n });\n }\n}\n\nexport default LBaseLayers;\n","// @ts-check\n/** @typedef {import(\"leaflet\").Layer} Layer */\nimport { control } from \"leaflet\";\nimport { mapAddTo } from \"./events.js\";\n\nclass LControlLayers extends HTMLElement {\n constructor() {\n super();\n }\n\n connectedCallback() {\n /** @type {{ [key: string]: Layer }} */\n const base = {};\n /** @type {{ [key: string]: Layer }} */\n const overlay = {};\n const controlLayers = control.layers(base, overlay);\n\n this.addEventListener(mapAddTo, (ev) => {\n const { type, name, layer } = ev.detail;\n if (type === \"overlay\") {\n controlLayers.addOverlay(layer, name);\n } else if (type === \"base\") {\n controlLayers.addBaseLayer(layer, name);\n }\n ev.preventDefault();\n });\n\n const event = new CustomEvent(mapAddTo, {\n cancelable: true,\n bubbles: true,\n detail: {\n layer: controlLayers,\n },\n });\n this.dispatchEvent(event);\n }\n}\n\nexport default LControlLayers;\n","class LLayer extends HTMLElement {\n constructor() {\n super()\n this.layer = null\n }\n}\n\nexport default LLayer\n","// @ts-check\nimport { layerGroup } from \"leaflet\";\nimport { mapAddTo } from \"./events.js\";\nimport LLayer from \"./l-layer.js\";\n\nclass LLayerGroup extends LLayer {\n constructor() {\n super();\n this.layer = null;\n }\n\n connectedCallback() {\n const name = this.getAttribute(\"name\");\n const group = layerGroup();\n this.layer = group;\n\n const event = new CustomEvent(mapAddTo, {\n cancelable: true,\n bubbles: true,\n detail: {\n layer: group,\n name,\n },\n });\n this.dispatchEvent(event);\n\n this.addEventListener(mapAddTo, (ev) => {\n ev.stopPropagation();\n group.addLayer(ev.detail.layer);\n });\n\n const observer = new MutationObserver(function (mutations) {\n mutations.forEach((mutation) => {\n mutation.removedNodes.forEach((node) => {\n if (node instanceof HTMLElement) {\n const leafletId = node.getAttribute(\"leaflet-id\");\n if (leafletId !== null) {\n const layer = group.getLayer(parseInt(leafletId));\n if (typeof layer !== \"undefined\") {\n group.removeLayer(layer);\n }\n }\n }\n });\n });\n });\n observer.observe(this, { childList: true });\n }\n}\n\nexport default LLayerGroup;\n","/// <reference path=\"./parser.d.ts\" />\n \nexport class LeafletHTMLError extends Error {\n /** @type {Issue[]} */\n issues = [];\n\n /**\n * @param {Issue[]} issues\n */\n constructor(issues) {\n super();\n this.name = \"LeafletHTMLError\";\n this.issues = issues;\n }\n\n get message() {\n return JSON.stringify(this.issues, null, 2);\n }\n}\n\n/**\n * @template T\n * @param {T} value\n * @returns {Context<T>}\n */\nconst wrap = (value) => {\n return {\n status: \"clean\",\n issues: [],\n value,\n };\n};\n\n/**\n * @template T\n * @param {Context<T>} value\n * @returns {T}\n */\nconst unwrap = ({ value }) => value;\n\n/**\n * @template S\n * @template T\n * @param {Parser<T, S>} schema\n * @param {T} value\n * @returns {S}\n */\nexport const parse = (schema, value) => {\n const result = schema(wrap(value));\n if (result.status !== \"clean\") {\n throw new LeafletHTMLError(result.issues);\n } else {\n return unwrap(result);\n }\n};\n\n/**\n * @template S\n * @template T\n * @param {Parser<T, S>} schema\n * @param {T} value\n * @returns {Context<S>}\n */\nexport const safeParse = (schema, value) => schema(wrap(value));\n\n/**\n * @param {Object} obj\n * @returns {(ctx: Context<Object>) => Context<Object>}\n */\nexport const object = (obj) => (ctx) => {\n let { status, issues } = ctx;\n const result = {};\n for (const key of Object.keys(obj)) {\n if (key in ctx.value) {\n result[key] = obj[key](wrap(ctx.value[key])).value;\n } else {\n status = \"abort\";\n issues = [...issues, missingKeyIssue(key)];\n }\n }\n return { status, issues, value: result };\n};\n\n// CONNECTORS\n\n/**\n * @template T\n * @param {Object} obj\n * @returns {(ctx: Context<T>) => Context<Object>}\n */\nexport const distribute = (obj) => (ctx) => {\n let { status, issues } = ctx;\n const result = {};\n for (const key of Object.keys(obj)) {\n let localCtx = obj[key](ctx);\n if (localCtx.status === \"abort\") {\n status = \"abort\";\n issues = [...issues, ...localCtx.issues];\n }\n result[key] = localCtx.value;\n }\n return { status, issues, value: result };\n};\n\nexport const partial = (obj) => (ctx) => {\n let { issues } = ctx;\n let status = \"clean\"\n const result = {};\n for (const key of Object.keys(obj)) {\n let localCtx = obj[key](ctx);\n if (localCtx.status !== \"clean\") {\n status = localCtx.status\n }\n \n if ((localCtx.value === null) && (localCtx.status === \"clean\")) {\n continue\n } else {\n issues = [...issues, ...localCtx.issues];\n result[key] = localCtx.value;\n }\n }\n return { status, issues, value: result };\n};\n\nexport const pipe =\n (...parsers) =>\n (ctx) => {\n for (let i = 0; i < parsers.length; i++) {\n ctx = parsers[i](ctx);\n if (ctx.status === \"abort\") {\n break;\n }\n }\n return ctx;\n };\n\nexport const chain = (...parsers) => (ctx) => {\n for (let i=0; i<parsers.length; i++) {\n ctx = parsers[i](ctx)\n }\n return ctx\n}\n\n\n// PRIMITIVES\nexport const nullable = (parser) => (ctx) => {\n if (ctx.value === null) {\n return ctx\n }\n return parser(ctx)\n}\n\nexport const optional = (parser) => (ctx) => {\n ctx = parser(ctx)\n if (ctx.value === null) {\n return {status: \"clean\", issues: [], value: null}\n } else {\n return ctx\n }\n}\n\n/**\n * @param {string} attributeName\n * @returns {Parser<HTMLElement, string>}\n */\nexport const htmlAttribute = (attributeName) => (ctx) => {\n const el = ctx.value;\n let result = el.getAttribute(attributeName);\n if (result === null) {\n return {\n status: \"abort\",\n issues: [...ctx.issues, htmlAttributeIssue(el, attributeName)],\n value: null,\n };\n }\n return { ...ctx, value: result };\n};\n\n/**\n * @returns {(ctx: Context<string>) => Context<number>}\n */\nexport const int = () => (ctx) => {\n let result = parseInt(ctx.value);\n if (isNaN(result)) {\n return {\n status: \"abort\",\n issues: [...ctx.issues, intIssue(ctx.value)],\n value: result,\n };\n }\n return { ...ctx, value: result };\n};\n\n/**\n * @returns {(ctx: Context<string>) => Context<number>}\n */\nexport const float = () => (ctx) => {\n let result = parseFloat(ctx.value);\n if (isNaN(result)) {\n return {\n status: \"abort\",\n issues: [...ctx.issues, floatIssue(ctx.value)],\n value: result,\n };\n }\n return { ...ctx, value: result };\n};\n\n/**\n * @returns {(ctx: Context<string>) => Context<number>}\n */\nexport const json = () => (ctx) => {\n let result;\n try {\n result = JSON.parse(ctx.value);\n } catch (e) {\n return {\n status: \"abort\",\n issues: [...ctx.issues, jsonIssue(e)],\n value: null,\n };\n }\n return { ...ctx, value: result };\n};\n\n/**\n * @returns {(ctx: Context<string>) => Context<boolean>}\n */\nexport const bool = () => (ctx) => {\n return { ...ctx, value: ctx.value.toLowerCase() === \"true\" };\n};\n\n/**\n * @template T\n * @template S\n * @param {string} key\n * @param {Parser<T, S>[]} fns\n */\nexport const option = (key, ...fns) => pipe(htmlAttribute(key), ...fns);\n\n\n// ISSUES\n\n/**\n * @param {string} value\n * @returns {Issue}\n */\nexport const intIssue = (value) => {\n return {\n code: \"parse_int\",\n message: `could not parse int given: \"${value}\"`,\n };\n};\n\n/**\n * @param {string} value\n * @returns {Issue}\n */\nexport const floatIssue = (value) => {\n return {\n code: \"parse_float\",\n message: `could not parse float given: \"${value}\"`,\n };\n};\n\n/**\n * @param {SyntaxError} e\n * @returns {Issue}\n */\nexport const jsonIssue = (e) => {\n return {\n code: \"parse_json\",\n message: e.message,\n };\n};\n\n/**\n * @param {string} value\n * @returns {Issue}\n */\nexport const missingKeyIssue = (value) => {\n return {\n code: \"missing_key\",\n message: `key not found: ${value}`,\n };\n};\n\n/**\n * @param {HTMLElement} el\n * @param {string} attributeName\n * @returns {Issue}\n */\nexport const htmlAttributeIssue = (el, attributeName) => {\n return {\n code: \"missing_attribute\",\n message: `${el.tagName.toLowerCase()} missing attribute '${attributeName}'`,\n };\n};\n","// @ts-check\nimport * as L from \"leaflet\";\nimport { layerRemove, mapAddTo } from \"./events.js\";\nimport LLayer from \"./l-layer.js\";\nimport { distribute, int, json, option, parse } from \"./parse.js\";\n\nclass LMap extends HTMLElement {\n static observedAttributes = [\"zoom\", \"center\"];\n\n constructor() {\n super();\n\n this.map = null;\n this.addEventListener(\"map:bounds\", (ev) => {\n const { bounds, method } = ev.detail;\n if (this.map !== null) {\n this.map[method](bounds);\n }\n });\n\n // Observe removed l-tile-layers\n const observer = new MutationObserver(function (mutations) {\n mutations.forEach((mutation) => {\n if (mutation.target instanceof LMap) {\n const el = mutation.target;\n mutation.removedNodes.forEach((node) => {\n if (node instanceof LLayer) {\n if (el.map !== null && node.layer !== null) {\n el.map.removeLayer(node.layer);\n }\n }\n });\n }\n });\n });\n observer.observe(this, { childList: true });\n }\n\n connectedCallback() {\n this.map = L.map(this);\n\n // Connect Leaflet events\n if (this.hasAttribute(\"on\")) {\n const on = this.getAttribute(\"on\");\n if (on !== null) {\n on.split(/\\s+/).forEach((eventName) => {\n if (this.map !== null) {\n this.map.on(eventName, (e) => {\n this.dispatchEvent(\n new CustomEvent(eventName, { bubbles: true, detail: e })\n );\n });\n }\n });\n }\n }\n\n if (this.hasAttribute(\"fit-world\")) {\n this.map.fitWorld();\n } else {\n const schema = distribute({\n zoom: option(\"zoom\", int()),\n center: option(\"center\", json())\n })\n const { zoom, center } = parse(schema, this)\n this.map.setView(center, zoom);\n }\n\n if (this.hasAttribute(\"locate\")) {\n const schema = option(\"locate\", json())\n this.map.locate(parse(schema, this));\n }\n\n this.addEventListener(mapAddTo, (ev) => {\n const layer = ev.detail.layer;\n layer.addTo(this.map);\n });\n\n this.addEventListener(layerRemove, (ev) => {\n if (this.map !== null) {\n this.map.removeLayer(ev.detail.layer);\n }\n });\n }\n\n attributeChangedCallback(name, _oldValue, newValue) {\n if (this.map !== null) {\n if (name === \"zoom\") {\n this.map.setZoom(parseInt(newValue));\n } else if (name === \"center\") {\n this.map.setView(JSON.parse(newValue));\n }\n }\n }\n}\n\nexport default LMap;\n","import * as L from \"leaflet\";\nimport { mapAddTo, popupAdd } from \"./events.js\";\nimport LLayer from \"./l-layer.js\";\nimport {\n chain,\n float,\n json,\n option,\n optional,\n htmlAttribute,\n parse,\n partial,\n nullable,\n} from \"./parse.js\";\n\nclass LMarker extends LLayer {\n static observedAttributes = [\"lat-lng\", \"opacity\", \"icon\"];\n\n constructor() {\n super();\n this.layer = null;\n this.addEventListener(\"icon:add\", (ev) => {\n ev.stopPropagation();\n this.layer.setIcon(ev.detail.icon);\n });\n }\n\n connectedCallback() {\n // Experimental parse/validate API\n const latLng = parse(option(\"lat-lng\", json()), this);\n const options = parse(\n partial({\n opacity: chain(optional(htmlAttribute(\"opacity\")), nullable(float())),\n }),\n this\n );\n this.layer = L.marker(latLng, options);\n\n if (this.hasAttribute(\"icon\")) {\n const icon = L.icon(JSON.parse(this.getAttribute(\"icon\")));\n this.layer.setIcon(icon);\n }\n\n this.setAttribute(\"leaflet-id\", L.stamp(this.layer));\n\n this.addEventListener(popupAdd, (ev) => {\n const { content, openPopup } = ev.detail;\n const popup = this.layer.bindPopup(content);\n if (openPopup) {\n popup.openPopup();\n }\n });\n\n const event = new CustomEvent(mapAddTo, {\n cancelable: true,\n bubbles: true,\n detail: {\n layer: this.layer,\n },\n });\n this.dispatchEvent(event);\n }\n\n attributeChangedCallback(name, _oldValue, newValue) {\n if (this.layer !== null) {\n if (name === \"lat-lng\") {\n this.layer.setLatLng(JSON.parse(newValue));\n }\n if (name === \"opacity\") {\n this.layer.setOpacity(parseFloat(newValue));\n }\n if (name === \"icon\") {\n this.layer.setIcon(L.icon(JSON.parse(newValue)));\n }\n }\n }\n}\n\nexport default LMarker;\n","// @ts-check\nimport { mapAddTo } from \"./events.js\";\n\nclass LOverlayLayers extends HTMLElement {\n constructor() {\n super();\n }\n\n connectedCallback() {\n this.addEventListener(mapAddTo, (ev) => {\n ev.detail[\"type\"] = \"overlay\";\n });\n }\n}\n\nexport default LOverlayLayers;\n","// @ts-check\nimport { popupAdd } from \"./events.js\";\n\nclass LPopup extends HTMLElement {\n constructor() {\n super();\n }\n\n connectedCallback() {\n const content = this.getAttribute(\"content\");\n let openPopup = false;\n const openPopupAttribute = this.getAttribute(\"open-popup\");\n if (openPopupAttribute !== null) {\n openPopup = openPopupAttribute !== \"false\";\n }\n const event = new CustomEvent(popupAdd, {\n cancelable: true,\n bubbles: true,\n detail: {\n content,\n openPopup,\n },\n });\n this.dispatchEvent(event);\n }\n}\n\nexport default LPopup;\n","// @ts-check\nimport { tileLayer } from \"leaflet\";\nimport { mapAddTo } from \"./events.js\";\nimport LLayer from \"./l-layer.js\";\nimport { htmlAttribute, optional, parse, partial } from \"./parse.js\";\n\nclass LTileLayer extends LLayer {\n constructor() {\n super();\n this.layer = null;\n }\n\n connectedCallback() {\n const urlTemplate = parse(htmlAttribute(\"url-template\"), this)\n \n // Template attributes\n const urlAttributes = LTileLayer.parseTemplateAttributes(urlTemplate)\n const templateOptions = {}\n for (const attribute of urlAttributes) {\n const value = this.getAttribute(attribute)\n if (value !== null) {\n templateOptions[attribute] = value\n }\n }\n \n // Options\n const name = this.getAttribute(\"name\");\n const schema = partial({\n attribution: optional(htmlAttribute(\"attribution\")),\n errorTileUrl: optional(htmlAttribute(\"error-tile-url\"))\n })\n const options = parse(schema, this)\n this.layer = tileLayer(urlTemplate, { ...templateOptions, ...options });\n const event = new CustomEvent(mapAddTo, {\n detail: { name, layer: this.layer },\n bubbles: true,\n });\n this.dispatchEvent(event);\n }\n\n /**\n * @param {string} urlTemplate\n * @returns {string[]}\n */\n static parseTemplateAttributes(urlTemplate) {\n const regex = /{(.*?)}/g\n return [...urlTemplate.matchAll(regex)].map(match => match[1])\n }\n}\n\nexport default LTileLayer;\n","// @ts-check\nimport { LatLngBounds } from \"leaflet\";\n\nclass LLatLngBounds extends HTMLElement {\n static observedAttributes = [\"bounds\"];\n\n constructor() {\n super();\n }\n\n connectedCallback() {\n let value = this.getAttribute(\"bounds\")\n if (value !== null) {\n this.dispatchEvent(this.getEvent(JSON.parse(value)))\n }\n }\n\n attributeChangedCallback(_name, _oldValue, newValue) {\n this.dispatchEvent(this.getEvent(JSON.parse(newValue)));\n }\n\n /**\n * @param {LatLngBounds} bounds\n */\n getEvent(bounds) {\n return new CustomEvent(\"map:bounds\", {\n bubbles: true,\n detail: {\n bounds,\n method: this.getAttribute(\"method\") || \"fitBounds\",\n },\n });\n }\n}\n\nexport default LLatLngBounds;\n","// @ts-check\nimport { imageOverlay } from \"leaflet\";\nimport { mapAddTo } from \"./events.js\";\nimport LLayer from \"./l-layer.js\";\n\nclass LImageOverlay extends LLayer {\n static observedAttributes = [\"url\", \"bounds\", \"opacity\"];\n\n constructor() {\n super();\n this.layer = null;\n }\n\n connectedCallback() {\n const url = this.getAttribute(\"url\");\n if (url === null) {\n console.warn(\"attribute 'url' not set\");\n return;\n }\n let bounds = this.getAttribute(\"bounds\");\n if (bounds === null) {\n console.warn(\"attribute 'bounds' not set\");\n return;\n }\n const options = {\n opacity: parseFloat(this.getAttribute(\"opacity\") || \"1.0\"),\n alt: this.getAttribute(\"alt\") || \"\",\n };\n this.layer = imageOverlay(url, JSON.parse(bounds), options);\n this.dispatchEvent(\n new CustomEvent(mapAddTo, {\n cancelable: true,\n bubbles: true,\n detail: {\n layer: this.layer,\n },\n })\n );\n }\n\n attributeChangedCallback(name, _oldValue, newValue) {\n if (this.layer !== null) {\n if (name === \"url\") {\n this.layer.setUrl(newValue);\n } else if (name === \"bounds\") {\n this.layer.setBounds(JSON.parse(newValue));\n } else if (name === \"opacity\") {\n this.layer.setOpacity(parseFloat(newValue));\n }\n }\n }\n}\n\nexport default LImageOverlay;\n","// @ts-check\nimport { videoOverlay } from \"leaflet\";\nimport { mapAddTo } from \"./events.js\";\nimport LLayer from \"./l-layer.js\";\n\nclass LVideoOverlay extends LLayer {\n constructor() {\n super();\n }\n\n connectedCallback() {\n const url = JSON.parse(this.getAttribute(\"url\"));\n const bounds = JSON.parse(this.getAttribute(\"bounds\"));\n const options = {\n opacity: parseFloat(this.getAttribute(\"opacity\") || \"1.0\"),\n alt: this.getAttribute(\"alt\") || \"\",\n autoplay: true,\n muted: true,\n playsInline: true,\n };\n const layer = videoOverlay(url, bounds, options);\n this.dispatchEvent(\n new CustomEvent(mapAddTo, {\n cancelable: true,\n bubbles: true,\n detail: {\n layer,\n },\n }),\n );\n }\n}\n\nexport default LVideoOverlay;\n","// @ts-check\nimport { geoJSON } from \"leaflet\";\nimport { mapAddTo } from \"./events.js\";\n\nclass LGeoJSON extends HTMLElement {\n constructor() {\n super();\n }\n\n connectedCallback() {\n const value = this.getAttribute(\"geojson\");\n if (value !== null) {\n const layer = geoJSON(JSON.parse(value));\n this.dispatchEvent(\n new CustomEvent(mapAddTo, {\n bubbles: true,\n cancelable: true,\n detail: {\n layer,\n },\n }),\n );\n }\n }\n}\n\nexport default LGeoJSON;\n","// Utility functions\nexport const kebabToCamel = (kebab) => kebab.replace(/-./g, (x) => x[1].toUpperCase());\nexport const camelToKebab = (s) => {\n return s.split('').map((letter, idx) => {\n return letter.toUpperCase() === letter\n ? `${idx !== 0 ? '-' : ''}${letter.toLowerCase()}`\n : letter;\n }).join('');\n}\n\n","import { icon } from \"leaflet\";\nimport {\n bool,\n chain,\n htmlAttribute,\n json,\n nullable,\n optional,\n parse,\n partial,\n} from \"./parse.js\";\nimport { kebabToCamel } from \"./util.js\";\n\nclass LIcon extends HTMLElement {\n constructor() {\n super();\n this.icon = null;\n }\n\n connectedCallback() {\n // Experimental parse/validate API\n const obj = {};\n const keys = [\n \"icon-url\",\n \"icon-retina-url\",\n \"shadow-url\",\n \"shadow-retina-url\",\n \"class-name\",\n ];\n keys.forEach((key) => {\n obj[kebabToCamel(key)] = optional(htmlAttribute(key));\n });\n let points = [\n \"icon-anchor\",\n \"icon-size\",\n \"shadow-anchor\",\n \"shadow-size\",\n \"tooltip-anchor\",\n \"popup-anchor\",\n ];\n points.forEach((key) => {\n obj[kebabToCamel(key)] = chain(\n optional(htmlAttribute(key)),\n nullable(json())\n );\n });\n obj[\"crossOrigin\"] = chain(\n optional(htmlAttribute(\"cross-origin\")),\n nullable(bool())\n );\n const schema = partial(obj);\n const options = parse(schema, this);\n\n this.icon = icon(options);\n\n const event = new CustomEvent(\"icon:add\", {\n cancelable: true,\n bubbles: true,\n detail: {\n icon: this.icon,\n },\n });\n this.dispatchEvent(event);\n }\n}\n\nexport default LIcon;\n","// @ts-check\n\nimport { tooltip } from \"leaflet\";\n\nclass LTooltip extends HTMLElement {\n static observedAttributes = [\"content\"];\n\n constructor() {\n super();\n this.tooltip = tooltip();\n }\n\n connectedCallback() {\n const event = new CustomEvent(\"bindTooltip\", {\n cancelable: true,\n bubbles: true,\n detail: {\n tooltip: this.tooltip,\n },\n });\n this.dispatchEvent(event);\n }\n\n /**\n * @param {string} attName\n * @param {string} newValue\n */\n attributeChangedCallback(attName, _, newValue) {\n if (attName === \"content\") {\n this.tooltip.setContent(newValue);\n }\n }\n}\n\nexport default LTooltip;\n","// @ts-check\nimport { Circle, LatLng, Polygon, Polyline, Rectangle } from \"leaflet\";\nimport { camelToKebab } from \"./util.js\";\nimport { htmlAttribute, parse } from \"./parse.js\";\n\n/**\n * @typedef {Object} TagOption\n * @property {string} camel\n * @property {string} kebab\n * @property {(s: string) => AttributeValue} parser\n * @property {AttributeValue | null} defaultValue\n */\n/**\n * @typedef {(\"circle\"|\"rectangle\"|\"polygon\"|\"polyline\")} MethodName\n * @typedef {(\"path\"|\"interactiveLayer\")} LayerName\n * @typedef {(\"boolean\"|\"number\"|\"string\"|\"latlng\"|\"latlngbounds\")} AttributeType\n * @typedef {(boolean|number|string|LatLng)} AttributeValue\n */\n\n/**\n * @param {MethodName} methodName\n * @returns {TagOption[]}\n */\nconst positionalArguments = (methodName) => {\n switch (methodName) {\n case \"circle\":\n return [option(\"latLng\", \"latlng\", null)];\n case \"rectangle\":\n return [option(\"latLngBounds\", \"latlngbounds\", null)];\n case \"polygon\":\n return [option(\"latLngs\", \"latlng\", null)];\n case \"polyline\":\n return [option(\"latLngs\", \"latlng\", null)];\n }\n};\n\n/**\n * @param {string} name\n * @param {AttributeType} type\n * @param {AttributeValue | null} defaultValue\n * @returns {TagOption}\n */\nconst option = (name, type, defaultValue) => {\n return {\n camel: name,\n kebab: camelToKebab(name),\n parser: inferParser(type),\n defaultValue,\n };\n};\n\n/**\n * @param {AttributeType} type\n * @returns {(s: string) => AttributeValue}\n */\nconst inferParser = (type) => {\n switch (type.toLowerCase()) {\n case \"boolean\":\n return (s) => s === \"true\";\n case \"number\":\n return parseFloat;\n case \"latlng\":\n case \"latlngbounds\":\n return JSON.parse;\n case \"string\":\n return (s) => s;\n default:\n return (s) => s;\n }\n};\n\n/**\n * @param {MethodName} methodName\n * @returns {TagOption[]}\n */\nconst options = (methodName) => {\n const _OPTIONS = {\n circle: [option(\"radius\", \"number\", null)],\n path: [\n option(\"stroke\", \"boolean\", true),\n option(\"color\", \"string\", \"#3388ff\"),\n option(\"weight\", \"number\", 3),\n option(\"opacity\", \"number\", 1.0),\n option(\"lineCap\", \"string\", \"round\"),\n option(\"lineJoin\", \"string\", \"round\"),\n option(\"dashArray\", \"string\", null),\n option(\"dashOffset\", \"string\", null),\n option(\"fill\", \"boolean\", true),\n option(\"fillColor\", \"string\", \"#3388ff\"),\n option(\"fillOpacity\", \"number\", 0.2),\n ],\n polyline: [\n option(\"smoothFactor\", \"number\", 1.0),\n option(\"noClip\", \"boolean\", false),\n ],\n polygon: [],\n rectangle: [],\n interactiveLayer: [option(\"interactive\", \"boolean\", true)],\n };\n return inheritance(methodName).flatMap((parent) => _OPTIONS[parent]);\n};\n\n/**\n * @type {Object.<string, (MethodName | LayerName)[]>}\n */\nconst INHERITS = {\n circle: [\"path\"],\n polyline: [\"path\"],\n polygon: [\"polyline\"],\n rectangle: [\"polygon\"],\n path: [\"interactiveLayer\"],\n interactiveLayer: [],\n};\n\n/**\n * @param {MethodName} methodName\n * @returns {(MethodName | LayerName)[]}\n */\nconst inheritance = (methodName) => {\n /** @type {(MethodName | LayerName)} */\n let name = methodName;\n let chain = [methodName];\n while (INHERITS[name].length > 0) {\n let parent = INHERITS[name][0];\n chain.push(parent);\n name = parent;\n }\n return chain;\n};\n\n/**\n * @param {MethodName} methodName\n * @param {string} newValue\n * @param {string} name\n * @param {(Circle | Rectangle | Polygon | Polyline)} layer\n */\nconst setter = (layer, methodName, name, newValue) => {\n // Parse\n const allOptions = [\n ...positionalArguments(methodName),\n ...options(methodName),\n ];\n let _opt = allOptions.find((o) => o.kebab === name);\n if (typeof _opt === \"undefined\") {\n return;\n }\n const parsedValue = _opt.parser(newValue);\n\n // Update\n if (layer instanceof Circle) {\n switch (name) {\n case \"lat-lng\":\n layer.setLatLng(JSON.parse(newValue));\n break;\n case \"radius\":\n layer.setRadius(parseFloat(newValue));\n break;\n }\n } else if (layer instanceof Rectangle) {\n switch (name) {\n case \"lat-lngs\":\n layer.setLatLngs(JSON.parse(newValue));\n break;\n case \"lat-lng-bounds\":\n layer.setBounds(JSON.parse(newValue));\n break;\n }\n } else if (layer instanceof Polygon) {\n switch (name) {\n case \"lat-lngs\":\n layer.setLatLngs(JSON.parse(newValue));\n break;\n }\n } else if (layer instanceof Polyline) {\n switch (name) {\n case \"lat-lngs\":\n layer.setLatLngs(JSON.parse(newValue));\n break;\n }\n }\n\n // setStyle options\n let opt = options(\"polyline\").find((o) => o.kebab === name);\n if (typeof opt !== \"undefined\") {\n layer.setStyle({ [opt.camel]: parsedValue });\n }\n};\n\n/**\n * @param {MethodName} methodName\n */\nconst attributes = (methodName) => {\n let args = positionalArguments(methodName).map((o) => o.kebab);\n let opts = options(methodName).map((o) => o.kebab);\n return [...args, ...opts];\n};\n\n/**\n * @param {HTMLElement} el\n * @param {MethodName} methodName\n */\nconst settings = (el, methodName) => {\n // Gather settings\n let result = {};\n\n // Process inheritance chain\n options(methodName).forEach((o) => {\n if (el.hasAttribute(o.kebab)) {\n result[o.camel] = o.parser(el.getAttribute(o.kebab));\n }\n });\n return result;\n};\n\n/**\n * Read positional arguments from HTMLElement\n *\n * @param {HTMLElement} el\n * @param {MethodName} methodName\n */\nconst positional = (el, methodName) => {\n return positionalArguments(methodName).map(option => {\n const schema = htmlAttribute(option.kebab)\n const value = parse(schema, el)\n return option.parser(value);\n })\n};\n\n/**\n * @param {MethodName} methodName\n */\nconst generator = (method, methodName) => {\n class cls extends HTMLElement {\n static observedAttributes = attributes(methodName);\n\n constructor() {\n super();\n this.layer = null;\n this.addEventListener(\"bindTooltip\", (ev) => {\n if (this.layer !== null) {\n this.layer.bindTooltip(ev.detail.tooltip);\n }\n });\n }\n\n connectedCallback() {\n const args = positional(this, methodName);\n const options = settings(this, methodName);\n this.layer = method(...args, options);\n const event = new CustomEvent(\"map:addTo\", {\n cancelable: true,\n bubbles: true,\n detail: {\n layer: this.layer,\n },\n });\n this.dispatchEvent(event);\n }\n\n /**\n * @param {string} attName\n * @param {string} newValue\n */\n attributeChangedCallback(attName, _, newValue) {\n if (this.layer !== null) {\n setter(this.layer, methodName, attName, newValue);\n }\n }\n }\n return cls;\n};\n\nexport default generator;\n","// @ts-check\nimport LBaseLayers from \"./l-base-layers.js\";\nimport LControlLayers from \"./l-control-layers.js\";\nimport LLayerGroup from \"./l-layer-group.js\";\nimport LMap from \"./l-map.js\";\nimport LMarker from \"./l-marker.js\";\nimport LOverlayLayers from \"./l-overlay-layers.js\";\nimport LPopup from \"./l-popup.js\";\nimport LTileLayer from \"./l-tile-layer.js\";\nimport LLatLngBounds from \"./l-lat-lng-bounds.js\";\nimport LImageOverlay from \"./l-image-overlay.js\";\nimport LVideoOverlay from \"./l-video-overlay.js\";\nimport LGeoJSON from \"./l-geojson.js\";\nimport LIcon from \"./l-icon.js\";\nimport LTooltip from \"./l-tooltip.js\";\nimport generator from \"./generator.js\";\nimport { circle, polyline, polygon, rectangle } from \"leaflet\";\n\nconst init = (() => {\n // Custom elements (order of definition is important)\n customElements.define(\"l-map\", LMap);\n customElements.define(\"l-control-layers\", LControlLayers);\n customElements.define(\"l-base-layers\", LBaseLayers);\n customElements.define(\"l-overlay-layers\", LOverlayLayers);\n customElements.define(\"l-layer-group\", LLayerGroup);\n customElements.define(\"l-tile-layer\", LTileLayer);\n customElements.define(\"l-marker\", LMarker);\n customElements.define(\"l-popup\", LPopup);\n customElements.define(\"l-lat-lng-bounds\", LLatLngBounds);\n customElements.define(\"l-image-overlay\", LImageOverlay);\n customElements.define(\"l-video-overlay\", LVideoOverlay);\n customElements.define(\"l-geojson\", LGeoJSON);\n customElements.define(\"l-icon\", LIcon);\n customElements.define(\"l-circle\", generator(circle, \"circle\"));\n customElements.define(\"l-polyline\", generator(polyline, \"polyline\"));\n customElements.define(\"l-polygon\", generator(polygon, \"polygon\"));\n customElements.define(\"l-rectangle\", generator(rectangle, \"rectangle\"));\n customElements.define(\"l-tooltip\", LTooltip);\n})();\n\nexport default init;\n"],"names":["mapAddTo","popupAdd","LBaseLayers","_HTMLElement","call","this","_inheritsLoose","prototype","connectedCallback","addEventListener","ev","detail","_wrapNativeSuper","HTMLElement","LControlLayers","controlLayers","control","layers","_ev$detail","type","name","layer","addOverlay","addBaseLayer","preventDefault","event","CustomEvent","cancelable","bubbles","dispatchEvent","LLayer","_this","LLayerGroup","_LLayer","getAttribute","group","layerGroup","stopPropagation","addLayer","MutationObserver","mutations","forEach","mutation","removedNodes","node","leafletId","getLayer","parseInt","removeLayer","observe","childList","LeafletHTMLError","_Error","issues","key","get","JSON","stringify","Error","parse","schema","value","result","status","wrap","partial","obj","ctx","_i3","_Object$keys3","Object","keys","length","localCtx","concat","pipe","parsers","slice","arguments","i","chain","nullable","parser","optional","htmlAttribute","attributeName","el","htmlAttributeIssue","_extends","json","e","jsonIssue","option","apply","code","message","tagName","toLowerCase","LMap","map","method","bounds","target","_proto","_this2","L","hasAttribute","on","split","eventName","fitWorld","zoom","isNaN","center","_i2","_Object$keys2","_parse","setView","locate","addTo","attributeChangedCallback","_oldValue","newValue","setZoom","observedAttributes","LMarker","setIcon","icon","latLng","options","opacity","parseFloat","marker","setAttribute","stamp","openPopup","popup","bindPopup","content","setLatLng","setOpacity","LOverlayLayers","LPopup","openPopupAttribute","LTileLayer","_step","urlTemplate","templateOptions","_iterator","_createForOfIteratorHelperLoose","parseTemplateAttributes","done","attribute","attribution","errorTileUrl","tileLayer","matchAll","match","LLatLngBounds","getEvent","_name","LImageOverlay","url","alt","imageOverlay","console","warn","setUrl","setBounds","LVideoOverlay","autoplay","muted","playsInline","videoOverlay","LGeoJSON","geoJSON","kebabToCamel","kebab","replace","x","toUpperCase","LIcon","LTooltip","tooltip","attName","_","setContent","positionalArguments","methodName","defaultValue","camel","s","letter","idx","join","inferParser","_OPTIONS","circle","path","polyline","polygon","rectangle","interactiveLayer","inheritance","flatMap","parent","INHERITS","push","settings","o","generator","cls","bindTooltip","args","positional","_opt","find","parsedValue","Circle","setRadius","Rectangle","setLatLngs","Polygon","Polyline","_layer$setStyle","opt","setStyle","setter","opts","attributes","init","customElements","define"],"mappings":"kiEAAaA,EAAW,YACXC,EAAW,YCElBC,eAAWC,SAAAA,GACf,SAAAD,IAAc,OACZC,EAAAC,KAAAC,OAAOA,IACT,CAMC,OANAC,EAAAJ,EAAAC,GAAAD,EAAAK,UAEDC,kBAAA,WACEH,KAAKI,iBAAiBT,EAAU,SAACU,GAC/BA,EAAGC,OAAa,KAAI,MACtB,EACF,EAACT,CAAA,CATcC,cASdS,EATuBC,cCEpBC,eAAc,SAAAX,GAClB,SAAAW,IAAc,OACZX,EAAAC,KAAMC,WACR,CA2BC,OA3BAC,EAAAQ,EAAAX,GAAAW,EAAAP,UAEDC,kBAAA,WAEE,IAGMO,EAAgBC,EAAQC,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-layers.js","../src/l-layer.js","../src/l-layer-group.js","../src/parse.js","../src/l-map.js","../src/l-marker.js","../src/l-overlay-layers.js","../src/l-popup.js","../src/l-tile-layer.js","../src/l-lat-lng-bounds.js","../src/l-image-overlay.js","../src/l-video-overlay.js","../src/l-geojson.js","../src/util.js","../src/l-icon.js","../src/l-tooltip.js","../src/generator.js","../src/index.js"],"sourcesContent":["export const mapAddTo = \"map:addTo\";\nexport const popupAdd = \"popup:add\";\nexport const layerRemove = \"layer:remove\";\n","// @ts-check\nimport { mapAddTo } from \"./events.js\";\n\nclass LBaseLayers extends HTMLElement {\n constructor() {\n super();\n }\n\n connectedCallback() {\n this.addEventListener(mapAddTo, (ev) => {\n ev.detail[\"type\"] = \"base\";\n });\n }\n}\n\nexport default LBaseLayers;\n","// @ts-check\n/** @typedef {import(\"leaflet\").Layer} Layer */\nimport { control } from \"leaflet\";\nimport { mapAddTo } from \"./events.js\";\n\nclass LControlLayers extends HTMLElement {\n constructor() {\n super();\n }\n\n connectedCallback() {\n /** @type {{ [key: string]: Layer }} */\n const base = {};\n /** @type {{ [key: string]: Layer }} */\n const overlay = {};\n const controlLayers = control.layers(base, overlay);\n\n this.addEventListener(mapAddTo, (ev) => {\n const { type, name, layer } = ev.detail;\n if (type === \"overlay\") {\n controlLayers.addOverlay(layer, name);\n } else if (type === \"base\") {\n controlLayers.addBaseLayer(layer, name);\n }\n ev.preventDefault();\n });\n\n const event = new CustomEvent(mapAddTo, {\n cancelable: true,\n bubbles: true,\n detail: {\n layer: controlLayers,\n },\n });\n this.dispatchEvent(event);\n }\n}\n\nexport default LControlLayers;\n","class LLayer extends HTMLElement {\n constructor() {\n super()\n this.layer = null\n }\n}\n\nexport default LLayer\n","// @ts-check\nimport { layerGroup } from \"leaflet\";\nimport { mapAddTo } from \"./events.js\";\nimport LLayer from \"./l-layer.js\";\n\nclass LLayerGroup extends LLayer {\n constructor() {\n super();\n this.layer = null;\n }\n\n connectedCallback() {\n const name = this.getAttribute(\"name\");\n const group = layerGroup();\n this.layer = group;\n\n const event = new CustomEvent(mapAddTo, {\n cancelable: true,\n bubbles: true,\n detail: {\n layer: group,\n name,\n },\n });\n this.dispatchEvent(event);\n\n this.addEventListener(mapAddTo, (ev) => {\n ev.stopPropagation();\n group.addLayer(ev.detail.layer);\n });\n\n const observer = new MutationObserver(function (mutations) {\n mutations.forEach((mutation) => {\n mutation.removedNodes.forEach((node) => {\n if (node instanceof HTMLElement) {\n const leafletId = node.getAttribute(\"leaflet-id\");\n if (leafletId !== null) {\n const layer = group.getLayer(parseInt(leafletId));\n if (typeof layer !== \"undefined\") {\n group.removeLayer(layer);\n }\n }\n }\n });\n });\n });\n observer.observe(this, { childList: true });\n }\n}\n\nexport default LLayerGroup;\n","/// <reference path=\"./parser.d.ts\" />\n \nexport class LeafletHTMLError extends Error {\n /** @type {Issue[]} */\n issues = [];\n\n /**\n * @param {Issue[]} issues\n */\n constructor(issues) {\n super();\n this.name = \"LeafletHTMLError\";\n this.issues = issues;\n }\n\n get message() {\n return JSON.stringify(this.issues, null, 2);\n }\n}\n\n/**\n * @template T\n * @param {T} value\n * @returns {Context<T>}\n */\nconst wrap = (value) => {\n return {\n status: \"clean\",\n issues: [],\n value,\n };\n};\n\n/**\n * @template T\n * @param {Context<T>} value\n * @returns {T}\n */\nconst unwrap = ({ value }) => value;\n\n/**\n * @template S\n * @template T\n * @param {Parser<T, S>} schema\n * @param {T} value\n * @returns {S}\n */\nexport const parse = (schema, value) => {\n const result = schema(wrap(value));\n if (result.status !== \"clean\") {\n throw new LeafletHTMLError(result.issues);\n } else {\n return unwrap(result);\n }\n};\n\n/**\n * @template S\n * @template T\n * @param {Parser<T, S>} schema\n * @param {T} value\n * @returns {Context<S>}\n */\nexport const safeParse = (schema, value) => schema(wrap(value));\n\n/**\n * @param {Object} obj\n * @returns {(ctx: Context<Object>) => Context<Object>}\n */\nexport const object = (obj) => (ctx) => {\n let { status, issues } = ctx;\n const result = {};\n for (const key of Object.keys(obj)) {\n if (key in ctx.value) {\n result[key] = obj[key](wrap(ctx.value[key])).value;\n } else {\n status = \"abort\";\n issues = [...issues, missingKeyIssue(key)];\n }\n }\n return { status, issues, value: result };\n};\n\n// CONNECTORS\n\n/**\n * @template T\n * @param {Object} obj\n * @returns {(ctx: Context<T>) => Context<Object>}\n */\nexport const distribute = (obj) => (ctx) => {\n let { status, issues } = ctx;\n const result = {};\n for (const key of Object.keys(obj)) {\n let localCtx = obj[key](ctx);\n if (localCtx.status === \"abort\") {\n status = \"abort\";\n issues = [...issues, ...localCtx.issues];\n }\n result[key] = localCtx.value;\n }\n return { status, issues, value: result };\n};\n\nexport const partial = (obj) => (ctx) => {\n let { issues } = ctx;\n let status = \"clean\"\n const result = {};\n for (const key of Object.keys(obj)) {\n let localCtx = obj[key](ctx);\n if (localCtx.status !== \"clean\") {\n status = localCtx.status\n }\n \n if ((localCtx.value === null) && (localCtx.status === \"clean\")) {\n continue\n } else {\n issues = [...issues, ...localCtx.issues];\n result[key] = localCtx.value;\n }\n }\n return { status, issues, value: result };\n};\n\nexport const pipe =\n (...parsers) =>\n (ctx) => {\n for (let i = 0; i < parsers.length; i++) {\n ctx = parsers[i](ctx);\n if (ctx.status === \"abort\") {\n break;\n }\n }\n return ctx;\n };\n\nexport const chain = (...parsers) => (ctx) => {\n for (let i=0; i<parsers.length; i++) {\n ctx = parsers[i](ctx)\n }\n return ctx\n}\n\n\n// PRIMITIVES\nexport const nullable = (parser) => (ctx) => {\n if (ctx.value === null) {\n return ctx\n }\n return parser(ctx)\n}\n\nexport const optional = (parser) => (ctx) => {\n ctx = parser(ctx)\n if (ctx.value === null) {\n return {status: \"clean\", issues: [], value: null}\n } else {\n return ctx\n }\n}\n\n/**\n * @param {string} attributeName\n * @returns {Parser<HTMLElement, string>}\n */\nexport const htmlAttribute = (attributeName) => (ctx) => {\n const el = ctx.value;\n let result = el.getAttribute(attributeName);\n if (result === null) {\n return {\n status: \"abort\",\n issues: [...ctx.issues, htmlAttributeIssue(el, attributeName)],\n value: null,\n };\n }\n return { ...ctx, value: result };\n};\n\n/**\n * @returns {(ctx: Context<string>) => Context<number>}\n */\nexport const int = () => (ctx) => {\n let result = parseInt(ctx.value);\n if (isNaN(result)) {\n return {\n status: \"abort\",\n issues: [...ctx.issues, intIssue(ctx.value)],\n value: result,\n };\n }\n return { ...ctx, value: result };\n};\n\n/**\n * @returns {(ctx: Context<string>) => Context<number>}\n */\nexport const float = () => (ctx) => {\n let result = parseFloat(ctx.value);\n if (isNaN(result)) {\n return {\n status: \"abort\",\n issues: [...ctx.issues, floatIssue(ctx.value)],\n value: result,\n };\n }\n return { ...ctx, value: result };\n};\n\n/**\n * @returns {(ctx: Context<string>) => Context<number>}\n */\nexport const json = () => (ctx) => {\n let result;\n try {\n result = JSON.parse(ctx.value);\n } catch (e) {\n return {\n status: \"abort\",\n issues: [...ctx.issues, jsonIssue(e)],\n value: null,\n };\n }\n return { ...ctx, value: result };\n};\n\n/**\n * @returns {(ctx: Context<string>) => Context<boolean>}\n */\nexport const bool = () => (ctx) => {\n return { ...ctx, value: ctx.value.toLowerCase() === \"true\" };\n};\n\n/**\n * @template T\n * @template S\n * @param {string} key\n * @param {Parser<T, S>[]} fns\n */\nexport const option = (key, ...fns) => pipe(htmlAttribute(key), ...fns);\n\n\n// ISSUES\n\n/**\n * @param {string} value\n * @returns {Issue}\n */\nexport const intIssue = (value) => {\n return {\n code: \"parse_int\",\n message: `could not parse int given: \"${value}\"`,\n };\n};\n\n/**\n * @param {string} value\n * @returns {Issue}\n */\nexport const floatIssue = (value) => {\n return {\n code: \"parse_float\",\n message: `could not parse float given: \"${value}\"`,\n };\n};\n\n/**\n * @param {SyntaxError} e\n * @returns {Issue}\n */\nexport const jsonIssue = (e) => {\n return {\n code: \"parse_json\",\n message: e.message,\n };\n};\n\n/**\n * @param {string} value\n * @returns {Issue}\n */\nexport const missingKeyIssue = (value) => {\n return {\n code: \"missing_key\",\n message: `key not found: ${value}`,\n };\n};\n\n/**\n * @param {HTMLElement} el\n * @param {string} attributeName\n * @returns {Issue}\n */\nexport const htmlAttributeIssue = (el, attributeName) => {\n return {\n code: \"missing_attribute\",\n message: `${el.tagName.toLowerCase()} missing attribute '${attributeName}'`,\n };\n};\n","// @ts-check\nimport * as L from \"leaflet\";\nimport { layerRemove, mapAddTo } from \"./events.js\";\nimport LLayer from \"./l-layer.js\";\nimport { distribute, int, json, option, parse } from \"./parse.js\";\n\nclass LMap extends HTMLElement {\n static observedAttributes = [\"zoom\", \"center\"];\n\n constructor() {\n super();\n\n this.map = null;\n this.addEventListener(\"map:bounds\", (ev) => {\n const { bounds, method } = ev.detail;\n if (this.map !== null) {\n this.map[method](bounds);\n }\n });\n\n // Observe removed l-tile-layers\n const observer = new MutationObserver(function (mutations) {\n mutations.forEach((mutation) => {\n if (mutation.target instanceof LMap) {\n const el = mutation.target;\n mutation.removedNodes.forEach((node) => {\n if (node instanceof LLayer) {\n if (el.map !== null && node.layer !== null) {\n el.map.removeLayer(node.layer);\n }\n }\n });\n }\n });\n });\n observer.observe(this, { childList: true });\n }\n\n connectedCallback() {\n this.map = L.map(this);\n\n // Allow listeners to know when the map is \"ready\"\n this.map.whenReady(() => {\n this.dispatchEvent(\n new CustomEvent(\"ready\", {\n bubbles: true,\n cancelable: true,\n detail: this.map\n })\n )\n })\n\n // Connect Leaflet events\n if (this.hasAttribute(\"on\")) {\n const on = this.getAttribute(\"on\");\n if (on !== null) {\n on.split(/\\s+/).forEach((eventName) => {\n if (this.map !== null) {\n this.map.on(eventName, (e) => {\n this.dispatchEvent(\n new CustomEvent(eventName, { bubbles: true, detail: e })\n );\n });\n }\n });\n }\n }\n\n if (this.hasAttribute(\"fit-world\")) {\n this.map.fitWorld();\n } else {\n const schema = distribute({\n zoom: option(\"zoom\", int()),\n center: option(\"center\", json())\n })\n const { zoom, center } = parse(schema, this)\n this.map.setView(center, zoom);\n }\n\n if (this.hasAttribute(\"locate\")) {\n const schema = option(\"locate\", json())\n this.map.locate(parse(schema, this));\n }\n\n this.addEventListener(mapAddTo, (ev) => {\n const layer = ev.detail.layer;\n layer.addTo(this.map);\n });\n\n this.addEventListener(layerRemove, (ev) => {\n if (this.map !== null) {\n this.map.removeLayer(ev.detail.layer);\n }\n });\n }\n\n attributeChangedCallback(name, _oldValue, newValue) {\n if (this.map !== null) {\n if (name === \"zoom\") {\n this.map.setZoom(parseInt(newValue));\n } else if (name === \"center\") {\n this.map.setView(JSON.parse(newValue));\n }\n }\n }\n}\n\nexport default LMap;\n","import * as L from \"leaflet\";\nimport { mapAddTo, popupAdd } from \"./events.js\";\nimport LLayer from \"./l-layer.js\";\nimport {\n chain,\n float,\n json,\n option,\n optional,\n htmlAttribute,\n parse,\n partial,\n nullable,\n} from \"./parse.js\";\n\nclass LMarker extends LLayer {\n static observedAttributes = [\"lat-lng\", \"opacity\", \"icon\"];\n\n constructor() {\n super();\n this.layer = null;\n this.addEventListener(\"icon:add\", (ev) => {\n ev.stopPropagation();\n this.layer.setIcon(ev.detail.icon);\n });\n }\n\n connectedCallback() {\n // Experimental parse/validate API\n const latLng = parse(option(\"lat-lng\", json()), this);\n const options = parse(\n partial({\n opacity: chain(optional(htmlAttribute(\"opacity\")), nullable(float())),\n }),\n this\n );\n this.layer = L.marker(latLng, options);\n\n if (this.hasAttribute(\"icon\")) {\n const icon = L.icon(JSON.parse(this.getAttribute(\"icon\")));\n this.layer.setIcon(icon);\n }\n\n this.setAttribute(\"leaflet-id\", L.stamp(this.layer));\n\n this.addEventListener(popupAdd, (ev) => {\n const { content, openPopup } = ev.detail;\n const popup = this.layer.bindPopup(content);\n if (openPopup) {\n popup.openPopup();\n }\n });\n\n const event = new CustomEvent(mapAddTo, {\n cancelable: true,\n bubbles: true,\n detail: {\n layer: this.layer,\n },\n });\n this.dispatchEvent(event);\n }\n\n attributeChangedCallback(name, _oldValue, newValue) {\n if (this.layer !== null) {\n if (name === \"lat-lng\") {\n this.layer.setLatLng(JSON.parse(newValue));\n }\n if (name === \"opacity\") {\n this.layer.setOpacity(parseFloat(newValue));\n }\n if (name === \"icon\") {\n this.layer.setIcon(L.icon(JSON.parse(newValue)));\n }\n }\n }\n}\n\nexport default LMarker;\n","// @ts-check\nimport { mapAddTo } from \"./events.js\";\n\nclass LOverlayLayers extends HTMLElement {\n constructor() {\n super();\n }\n\n connectedCallback() {\n this.addEventListener(mapAddTo, (ev) => {\n ev.detail[\"type\"] = \"overlay\";\n });\n }\n}\n\nexport default LOverlayLayers;\n","// @ts-check\nimport { popupAdd } from \"./events.js\";\n\nclass LPopup extends HTMLElement {\n constructor() {\n super();\n }\n\n connectedCallback() {\n const content = this.getAttribute(\"content\");\n let openPopup = false;\n const openPopupAttribute = this.getAttribute(\"open-popup\");\n if (openPopupAttribute !== null) {\n openPopup = openPopupAttribute !== \"false\";\n }\n const event = new CustomEvent(popupAdd, {\n cancelable: true,\n bubbles: true,\n detail: {\n content,\n openPopup,\n },\n });\n this.dispatchEvent(event);\n }\n}\n\nexport default LPopup;\n","// @ts-check\nimport { tileLayer } from \"leaflet\";\nimport { mapAddTo } from \"./events.js\";\nimport LLayer from \"./l-layer.js\";\nimport { htmlAttribute, optional, parse, partial } from \"./parse.js\";\n\nclass LTileLayer extends LLayer {\n constructor() {\n super();\n this.layer = null;\n }\n\n connectedCallback() {\n const urlTemplate = parse(htmlAttribute(\"url-template\"), this)\n \n // Template attributes\n const urlAttributes = LTileLayer.parseTemplateAttributes(urlTemplate)\n const templateOptions = {}\n for (const attribute of urlAttributes) {\n const value = this.getAttribute(attribute)\n if (value !== null) {\n templateOptions[attribute] = value\n }\n }\n \n // Options\n const name = this.getAttribute(\"name\");\n const schema = partial({\n attribution: optional(htmlAttribute(\"attribution\")),\n errorTileUrl: optional(htmlAttribute(\"error-tile-url\"))\n })\n const options = parse(schema, this)\n this.layer = tileLayer(urlTemplate, { ...templateOptions, ...options });\n const event = new CustomEvent(mapAddTo, {\n detail: { name, layer: this.layer },\n bubbles: true,\n });\n this.dispatchEvent(event);\n }\n\n /**\n * @param {string} urlTemplate\n * @returns {string[]}\n */\n static parseTemplateAttributes(urlTemplate) {\n const regex = /{(.*?)}/g\n return [...urlTemplate.matchAll(regex)].map(match => match[1])\n }\n}\n\nexport default LTileLayer;\n","// @ts-check\nimport { LatLngBounds } from \"leaflet\";\n\nclass LLatLngBounds extends HTMLElement {\n static observedAttributes = [\"bounds\"];\n\n constructor() {\n super();\n }\n\n connectedCallback() {\n let value = this.getAttribute(\"bounds\")\n if (value !== null) {\n this.dispatchEvent(this.getEvent(JSON.parse(value)))\n }\n }\n\n attributeChangedCallback(_name, _oldValue, newValue) {\n this.dispatchEvent(this.getEvent(JSON.parse(newValue)));\n }\n\n /**\n * @param {LatLngBounds} bounds\n */\n getEvent(bounds) {\n return new CustomEvent(\"map:bounds\", {\n bubbles: true,\n detail: {\n bounds,\n method: this.getAttribute(\"method\") || \"fitBounds\",\n },\n });\n }\n}\n\nexport default LLatLngBounds;\n","// @ts-check\nimport { imageOverlay } from \"leaflet\";\nimport { mapAddTo } from \"./events.js\";\nimport LLayer from \"./l-layer.js\";\n\nclass LImageOverlay extends LLayer {\n static observedAttributes = [\"url\", \"bounds\", \"opacity\"];\n\n constructor() {\n super();\n this.layer = null;\n }\n\n connectedCallback() {\n const url = this.getAttribute(\"url\");\n if (url === null) {\n console.warn(\"attribute 'url' not set\");\n return;\n }\n let bounds = this.getAttribute(\"bounds\");\n if (bounds === null) {\n console.warn(\"attribute 'bounds' not set\");\n return;\n }\n const options = {\n opacity: parseFloat(this.getAttribute(\"opacity\") || \"1.0\"),\n alt: this.getAttribute(\"alt\") || \"\",\n };\n this.layer = imageOverlay(url, JSON.parse(bounds), options);\n this.dispatchEvent(\n new CustomEvent(mapAddTo, {\n cancelable: true,\n bubbles: true,\n detail: {\n layer: this.layer,\n },\n })\n );\n }\n\n attributeChangedCallback(name, _oldValue, newValue) {\n if (this.layer !== null) {\n if (name === \"url\") {\n this.layer.setUrl(newValue);\n } else if (name === \"bounds\") {\n this.layer.setBounds(JSON.parse(newValue));\n } else if (name === \"opacity\") {\n this.layer.setOpacity(parseFloat(newValue));\n }\n }\n }\n}\n\nexport default LImageOverlay;\n","// @ts-check\nimport { videoOverlay } from \"leaflet\";\nimport { mapAddTo } from \"./events.js\";\nimport LLayer from \"./l-layer.js\";\n\nclass LVideoOverlay extends LLayer {\n constructor() {\n super();\n }\n\n connectedCallback() {\n const url = JSON.parse(this.getAttribute(\"url\"));\n const bounds = JSON.parse(this.getAttribute(\"bounds\"));\n const options = {\n opacity: parseFloat(this.getAttribute(\"opacity\") || \"1.0\"),\n alt: this.getAttribute(\"alt\") || \"\",\n autoplay: true,\n muted: true,\n playsInline: true,\n };\n const layer = videoOverlay(url, bounds, options);\n this.dispatchEvent(\n new CustomEvent(mapAddTo, {\n cancelable: true,\n bubbles: true,\n detail: {\n layer,\n },\n }),\n );\n }\n}\n\nexport default LVideoOverlay;\n","// @ts-check\nimport { geoJSON } from \"leaflet\";\nimport { mapAddTo } from \"./events.js\";\n\nclass LGeoJSON extends HTMLElement {\n constructor() {\n super();\n }\n\n connectedCallback() {\n const value = this.getAttribute(\"geojson\");\n if (value !== null) {\n const layer = geoJSON(JSON.parse(value));\n this.dispatchEvent(\n new CustomEvent(mapAddTo, {\n bubbles: true,\n cancelable: true,\n detail: {\n layer,\n },\n }),\n );\n }\n }\n}\n\nexport default LGeoJSON;\n","// Utility functions\nexport const kebabToCamel = (kebab) => kebab.replace(/-./g, (x) => x[1].toUpperCase());\nexport const camelToKebab = (s) => {\n return s.split('').map((letter, idx) => {\n return letter.toUpperCase() === letter\n ? `${idx !== 0 ? '-' : ''}${letter.toLowerCase()}`\n : letter;\n }).join('');\n}\n\n","import { icon } from \"leaflet\";\nimport {\n bool,\n chain,\n htmlAttribute,\n json,\n nullable,\n optional,\n parse,\n partial,\n} from \"./parse.js\";\nimport { kebabToCamel } from \"./util.js\";\n\nclass LIcon extends HTMLElement {\n constructor() {\n super();\n this.icon = null;\n }\n\n connectedCallback() {\n // Experimental parse/validate API\n const obj = {};\n const keys = [\n \"icon-url\",\n \"icon-retina-url\",\n \"shadow-url\",\n \"shadow-retina-url\",\n \"class-name\",\n ];\n keys.forEach((key) => {\n obj[kebabToCamel(key)] = optional(htmlAttribute(key));\n });\n let points = [\n \"icon-anchor\",\n \"icon-size\",\n \"shadow-anchor\",\n \"shadow-size\",\n \"tooltip-anchor\",\n \"popup-anchor\",\n ];\n points.forEach((key) => {\n obj[kebabToCamel(key)] = chain(\n optional(htmlAttribute(key)),\n nullable(json())\n );\n });\n obj[\"crossOrigin\"] = chain(\n optional(htmlAttribute(\"cross-origin\")),\n nullable(bool())\n );\n const schema = partial(obj);\n const options = parse(schema, this);\n\n this.icon = icon(options);\n\n const event = new CustomEvent(\"icon:add\", {\n cancelable: true,\n bubbles: true,\n detail: {\n icon: this.icon,\n },\n });\n this.dispatchEvent(event);\n }\n}\n\nexport default LIcon;\n","// @ts-check\n\nimport { tooltip } from \"leaflet\";\n\nclass LTooltip extends HTMLElement {\n static observedAttributes = [\"content\"];\n\n constructor() {\n super();\n this.tooltip = tooltip();\n }\n\n connectedCallback() {\n const event = new CustomEvent(\"bindTooltip\", {\n cancelable: true,\n bubbles: true,\n detail: {\n tooltip: this.tooltip,\n },\n });\n this.dispatchEvent(event);\n }\n\n /**\n * @param {string} attName\n * @param {string} newValue\n */\n attributeChangedCallback(attName, _, newValue) {\n if (attName === \"content\") {\n this.tooltip.setContent(newValue);\n }\n }\n}\n\nexport default LTooltip;\n","// @ts-check\nimport { Circle, LatLng, Polygon, Polyline, Rectangle } from \"leaflet\";\nimport { camelToKebab } from \"./util.js\";\nimport { htmlAttribute, parse } from \"./parse.js\";\n\n/**\n * @typedef {Object} TagOption\n * @property {string} camel\n * @property {string} kebab\n * @property {(s: string) => AttributeValue} parser\n * @property {AttributeValue | null} defaultValue\n */\n/**\n * @typedef {(\"circle\"|\"rectangle\"|\"polygon\"|\"polyline\")} MethodName\n * @typedef {(\"path\"|\"interactiveLayer\")} LayerName\n * @typedef {(\"boolean\"|\"number\"|\"string\"|\"latlng\"|\"latlngbounds\")} AttributeType\n * @typedef {(boolean|number|string|LatLng)} AttributeValue\n */\n\n/**\n * @param {MethodName} methodName\n * @returns {TagOption[]}\n */\nconst positionalArguments = (methodName) => {\n switch (methodName) {\n case \"circle\":\n return [option(\"latLng\", \"latlng\", null)];\n case \"rectangle\":\n return [option(\"latLngBounds\", \"latlngbounds\", null)];\n case \"polygon\":\n return [option(\"latLngs\", \"latlng\", null)];\n case \"polyline\":\n return [option(\"latLngs\", \"latlng\", null)];\n }\n};\n\n/**\n * @param {string} name\n * @param {AttributeType} type\n * @param {AttributeValue | null} defaultValue\n * @returns {TagOption}\n */\nconst option = (name, type, defaultValue) => {\n return {\n camel: name,\n kebab: camelToKebab(name),\n parser: inferParser(type),\n defaultValue,\n };\n};\n\n/**\n * @param {AttributeType} type\n * @returns {(s: string) => AttributeValue}\n */\nconst inferParser = (type) => {\n switch (type.toLowerCase()) {\n case \"boolean\":\n return (s) => s === \"true\";\n case \"number\":\n return parseFloat;\n case \"latlng\":\n case \"latlngbounds\":\n return JSON.parse;\n case \"string\":\n return (s) => s;\n default:\n return (s) => s;\n }\n};\n\n/**\n * @param {MethodName} methodName\n * @returns {TagOption[]}\n */\nconst options = (methodName) => {\n const _OPTIONS = {\n circle: [option(\"radius\", \"number\", null)],\n path: [\n option(\"stroke\", \"boolean\", true),\n option(\"color\", \"string\", \"#3388ff\"),\n option(\"weight\", \"number\", 3),\n option(\"opacity\", \"number\", 1.0),\n option(\"lineCap\", \"string\", \"round\"),\n option(\"lineJoin\", \"string\", \"round\"),\n option(\"dashArray\", \"string\", null),\n option(\"dashOffset\", \"string\", null),\n option(\"fill\", \"boolean\", true),\n option(\"fillColor\", \"string\", \"#3388ff\"),\n option(\"fillOpacity\", \"number\", 0.2),\n ],\n polyline: [\n option(\"smoothFactor\", \"number\", 1.0),\n option(\"noClip\", \"boolean\", false),\n ],\n polygon: [],\n rectangle: [],\n interactiveLayer: [option(\"interactive\", \"boolean\", true)],\n };\n return inheritance(methodName).flatMap((parent) => _OPTIONS[parent]);\n};\n\n/**\n * @type {Object.<string, (MethodName | LayerName)[]>}\n */\nconst INHERITS = {\n circle: [\"path\"],\n polyline: [\"path\"],\n polygon: [\"polyline\"],\n rectangle: [\"polygon\"],\n path: [\"interactiveLayer\"],\n interactiveLayer: [],\n};\n\n/**\n * @param {MethodName} methodName\n * @returns {(MethodName | LayerName)[]}\n */\nconst inheritance = (methodName) => {\n /** @type {(MethodName | LayerName)} */\n let name = methodName;\n let chain = [methodName];\n while (INHERITS[name].length > 0) {\n let parent = INHERITS[name][0];\n chain.push(parent);\n name = parent;\n }\n return chain;\n};\n\n/**\n * @param {MethodName} methodName\n * @param {string} newValue\n * @param {string} name\n * @param {(Circle | Rectangle | Polygon | Polyline)} layer\n */\nconst setter = (layer, methodName, name, newValue) => {\n // Parse\n const allOptions = [\n ...positionalArguments(methodName),\n ...options(methodName),\n ];\n let _opt = allOptions.find((o) => o.kebab === name);\n if (typeof _opt === \"undefined\") {\n return;\n }\n const parsedValue = _opt.parser(newValue);\n\n // Update\n if (layer instanceof Circle) {\n switch (name) {\n case \"lat-lng\":\n layer.setLatLng(JSON.parse(newValue));\n break;\n case \"radius\":\n layer.setRadius(parseFloat(newValue));\n break;\n }\n } else if (layer instanceof Rectangle) {\n switch (name) {\n case \"lat-lngs\":\n layer.setLatLngs(JSON.parse(newValue));\n break;\n case \"lat-lng-bounds\":\n layer.setBounds(JSON.parse(newValue));\n break;\n }\n } else if (layer instanceof Polygon) {\n switch (name) {\n case \"lat-lngs\":\n layer.setLatLngs(JSON.parse(newValue));\n break;\n }\n } else if (layer instanceof Polyline) {\n switch (name) {\n case \"lat-lngs\":\n layer.setLatLngs(JSON.parse(newValue));\n break;\n }\n }\n\n // setStyle options\n let opt = options(\"polyline\").find((o) => o.kebab === name);\n if (typeof opt !== \"undefined\") {\n layer.setStyle({ [opt.camel]: parsedValue });\n }\n};\n\n/**\n * @param {MethodName} methodName\n */\nconst attributes = (methodName) => {\n let args = positionalArguments(methodName).map((o) => o.kebab);\n let opts = options(methodName).map((o) => o.kebab);\n return [...args, ...opts];\n};\n\n/**\n * @param {HTMLElement} el\n * @param {MethodName} methodName\n */\nconst settings = (el, methodName) => {\n // Gather settings\n let result = {};\n\n // Process inheritance chain\n options(methodName).forEach((o) => {\n if (el.hasAttribute(o.kebab)) {\n result[o.camel] = o.parser(el.getAttribute(o.kebab));\n }\n });\n return result;\n};\n\n/**\n * Read positional arguments from HTMLElement\n *\n * @param {HTMLElement} el\n * @param {MethodName} methodName\n */\nconst positional = (el, methodName) => {\n return positionalArguments(methodName).map(option => {\n const schema = htmlAttribute(option.kebab)\n const value = parse(schema, el)\n return option.parser(value);\n })\n};\n\n/**\n * @param {MethodName} methodName\n */\nconst generator = (method, methodName) => {\n class cls extends HTMLElement {\n static observedAttributes = attributes(methodName);\n\n constructor() {\n super();\n this.layer = null;\n this.addEventListener(\"bindTooltip\", (ev) => {\n if (this.layer !== null) {\n this.layer.bindTooltip(ev.detail.tooltip);\n }\n });\n }\n\n connectedCallback() {\n const args = positional(this, methodName);\n const options = settings(this, methodName);\n this.layer = method(...args, options);\n const event = new CustomEvent(\"map:addTo\", {\n cancelable: true,\n bubbles: true,\n detail: {\n layer: this.layer,\n },\n });\n this.dispatchEvent(event);\n }\n\n /**\n * @param {string} attName\n * @param {string} newValue\n */\n attributeChangedCallback(attName, _, newValue) {\n if (this.layer !== null) {\n setter(this.layer, methodName, attName, newValue);\n }\n }\n }\n return cls;\n};\n\nexport default generator;\n","// @ts-check\nimport LBaseLayers from \"./l-base-layers.js\";\nimport LControlLayers from \"./l-control-layers.js\";\nimport LLayerGroup from \"./l-layer-group.js\";\nimport LMap from \"./l-map.js\";\nimport LMarker from \"./l-marker.js\";\nimport LOverlayLayers from \"./l-overlay-layers.js\";\nimport LPopup from \"./l-popup.js\";\nimport LTileLayer from \"./l-tile-layer.js\";\nimport LLatLngBounds from \"./l-lat-lng-bounds.js\";\nimport LImageOverlay from \"./l-image-overlay.js\";\nimport LVideoOverlay from \"./l-video-overlay.js\";\nimport LGeoJSON from \"./l-geojson.js\";\nimport LIcon from \"./l-icon.js\";\nimport LTooltip from \"./l-tooltip.js\";\nimport generator from \"./generator.js\";\nimport { circle, polyline, polygon, rectangle } from \"leaflet\";\n\nconst init = (() => {\n // Custom elements (order of definition is important)\n customElements.define(\"l-map\", LMap);\n customElements.define(\"l-control-layers\", LControlLayers);\n customElements.define(\"l-base-layers\", LBaseLayers);\n customElements.define(\"l-overlay-layers\", LOverlayLayers);\n customElements.define(\"l-layer-group\", LLayerGroup);\n customElements.define(\"l-tile-layer\", LTileLayer);\n customElements.define(\"l-marker\", LMarker);\n customElements.define(\"l-popup\", LPopup);\n customElements.define(\"l-lat-lng-bounds\", LLatLngBounds);\n customElements.define(\"l-image-overlay\", LImageOverlay);\n customElements.define(\"l-video-overlay\", LVideoOverlay);\n customElements.define(\"l-geojson\", LGeoJSON);\n customElements.define(\"l-icon\", LIcon);\n customElements.define(\"l-circle\", generator(circle, \"circle\"));\n customElements.define(\"l-polyline\", generator(polyline, \"polyline\"));\n customElements.define(\"l-polygon\", generator(polygon, \"polygon\"));\n customElements.define(\"l-rectangle\", generator(rectangle, \"rectangle\"));\n customElements.define(\"l-tooltip\", LTooltip);\n})();\n\nexport default init;\n"],"names":["mapAddTo","popupAdd","LBaseLayers","_HTMLElement","call","this","_inheritsLoose","prototype","connectedCallback","addEventListener","ev","detail","_wrapNativeSuper","HTMLElement","LControlLayers","controlLayers","control","layers","_ev$detail","type","name","layer","addOverlay","addBaseLayer","preventDefault","event","CustomEvent","cancelable","bubbles","dispatchEvent","LLayer","_this","LLayerGroup","_LLayer","getAttribute","group","layerGroup","stopPropagation","addLayer","MutationObserver","mutations","forEach","mutation","removedNodes","node","leafletId","getLayer","parseInt","removeLayer","observe","childList","LeafletHTMLError","_Error","issues","key","get","JSON","stringify","Error","parse","schema","value","result","status","wrap","partial","obj","ctx","_i3","_Object$keys3","Object","keys","length","localCtx","concat","pipe","parsers","slice","arguments","i","chain","nullable","parser","optional","htmlAttribute","attributeName","el","htmlAttributeIssue","_extends","json","e","jsonIssue","option","apply","code","message","tagName","toLowerCase","LMap","map","method","bounds","target","_proto","_this2","L","whenReady","hasAttribute","on","split","eventName","fitWorld","zoom","isNaN","center","_i2","_Object$keys2","_parse","setView","locate","addTo","attributeChangedCallback","_oldValue","newValue","setZoom","observedAttributes","LMarker","setIcon","icon","latLng","options","opacity","parseFloat","marker","setAttribute","stamp","openPopup","popup","bindPopup","content","setLatLng","setOpacity","LOverlayLayers","LPopup","openPopupAttribute","LTileLayer","_step","urlTemplate","templateOptions","_iterator","_createForOfIteratorHelperLoose","parseTemplateAttributes","done","attribute","attribution","errorTileUrl","tileLayer","matchAll","match","LLatLngBounds","getEvent","_name","LImageOverlay","url","alt","imageOverlay","console","warn","setUrl","setBounds","LVideoOverlay","autoplay","muted","playsInline","videoOverlay","LGeoJSON","geoJSON","kebabToCamel","kebab","replace","x","toUpperCase","LIcon","LTooltip","tooltip","attName","_","setContent","positionalArguments","methodName","defaultValue","camel","s","letter","idx","join","inferParser","_OPTIONS","circle","path","polyline","polygon","rectangle","interactiveLayer","inheritance","flatMap","parent","INHERITS","push","settings","o","generator","cls","bindTooltip","args","positional","_opt","find","parsedValue","Circle","setRadius","Rectangle","setLatLngs","Polygon","Polyline","_layer$setStyle","opt","setStyle","setter","opts","attributes","init","customElements","define"],"mappings":"kiEAAaA,EAAW,YACXC,EAAW,YCElBC,eAAWC,SAAAA,GACf,SAAAD,IAAc,OACZC,EAAAC,KAAAC,OAAOA,IACT,CAMC,OANAC,EAAAJ,EAAAC,GAAAD,EAAAK,UAEDC,kBAAA,WACEH,KAAKI,iBAAiBT,EAAU,SAACU,GAC/BA,EAAGC,OAAa,KAAI,MACtB,EACF,EAACT,CAAA,CATcC,cASdS,EATuBC,cCEpBC,eAAc,SAAAX,GAClB,SAAAW,IAAc,OACZX,EAAAC,KAAMC,WACR,CA2BC,OA3BAC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