leaflet-html 0.4.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -1,16 +1,33 @@
1
1
  # Leaflet HTML
2
2
 
3
- Leaflet expressed in HTML to add maps to Hypermedia Driven Applications (HDA).
3
+ Leaflet expressed in HTML adds map capabilities to Hypermedia Driven Applications (HDA).
4
4
 
5
- Indeed, since it is HTML, any front end framework should work with it.
5
+ [![npm version](http://img.shields.io/npm/v/leaflet-html.svg?style="for-the-badge")](https://npmjs.org/package/leaflet-html)
6
+ [![tests](https://img.shields.io/github/actions/workflow/status/andrewgryan/leaflet-html/tests.yml?branch=master&logo=github&style=for-the-badge)](https://github.com/andrewgryan/leaflet-html/actions/workflows/tests.yml)
7
+
8
+
9
+ ## Motivation
10
+
11
+ Expressing Leaflet in HTML enables compatibility with a wide range of front end frameworks.
6
12
 
7
13
  Fine grained reactive frameworks such as [Solid JS](https://solidjs.com) or [Van JS](https://vanjs.org) are ideal candidates for client side development.
8
14
 
9
15
  RESTful frameworks, like [HTMX](Https://htmx.org), that serve HTML over the wire are perfect choices for server rendered content.
10
16
 
17
+ Even static site generators like [Zola](https://getzola.org) are ideal for this approach.
18
+
19
+ ## Documentation
20
+
21
+ A comprehensive documentation site is available.
22
+
23
+ [leaflet-html docs](https://andrewgryan.github.io/leaflet-html/)
24
+
11
25
  ## Installation
12
26
 
13
27
  Include Leaflet JS/CSS assets and Leaflet HTML in the document.
28
+ This can be achieved using [importmap](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type/importmap)
29
+ to point both `leaflet` and `leaflet-html` at ES modules.
30
+
14
31
 
15
32
  ```html
16
33
  <link
@@ -19,6 +36,14 @@ Include Leaflet JS/CSS assets and Leaflet HTML in the document.
19
36
  integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="
20
37
  crossorigin=""
21
38
  />
39
+ ```
40
+
41
+ ### CDN
42
+
43
+ Leaflet HTML is available via a Content Delivery Network (CDN) on unpkg.com.
44
+ This is a good option for use cases that don't need a build step.
45
+
46
+ ```
22
47
  <script type="importmap">
23
48
  {
24
49
  "imports": {
@@ -29,13 +54,36 @@ Include Leaflet JS/CSS assets and Leaflet HTML in the document.
29
54
  </script>
30
55
  ```
31
56
 
57
+ Execute the library by importing it in a `script` tag.
58
+ Leaflet dependencies are detected via the `importmap`.
59
+
32
60
  ```html
33
61
  <script type="module">
34
62
  import "leaflet-html";
35
63
  </script>
36
64
  ```
37
65
 
38
- Remember to style **l-map** elements with display and size settings to make them visible.
66
+ ### NPM
67
+
68
+ Leaflet HTML can be added to a project using `npm`.
69
+
70
+ ```sh
71
+ npm install leaflet-html
72
+ ```
73
+
74
+ If using a build tool like `vite`, the following script tag and some CSS is all that is needed to get going.
75
+
76
+ ```html
77
+ <script type="module">
78
+ import "leaflet-html";
79
+ </script>
80
+ ```
81
+
82
+ ### Style
83
+
84
+ In both CDN and `npm` installation approaches some minimal styling needs to be applied.
85
+ Custom elements are `display: inline` by default.
86
+ Leaflet maps, `l-map` elements, need to be set to `display: block` to have a vertical size.
39
87
 
40
88
  ```css
41
89
  l-map {
@@ -43,11 +91,15 @@ l-map {
43
91
  block-size: 100vh;
44
92
  }
45
93
  ```
94
+ > [!NOTE]
95
+ > Only `l-map` tag needs dimensions.
96
+ > All other `l-*` elements are purely semantic.
97
+ > They do not take up space on the page.
98
+ > They just indicate the state of the map.
46
99
 
47
100
  ## Quick start
48
101
 
49
- A minimal Leaflet-HTML app, is `<l-map center="[0,0]" zoom="1"></l-map>`, which adds an empty map to a page.
50
- But a gray block is of little use, to show a map, add a `<l-tile-layer>` tag with a `url-template` and `attribution`.
102
+ To show a map with a base map background, add a `<l-tile-layer>` tag with a `url-template` and `attribution` inside a `<l-map>`.
51
103
 
52
104
  ```html
53
105
  <l-map center="[0, 0]" zoom="1">
@@ -58,8 +110,18 @@ But a gray block is of little use, to show a map, add a `<l-tile-layer>` tag wit
58
110
  </l-map>
59
111
  ```
60
112
 
61
- Adding layers, layer groups, and controls requires very little additional effort.
62
- The same translation patterns can be followed to map from JS to HTML.
113
+ Adding layers, layer groups, and controls follows the Leaflet JS one-to-one.
114
+ E.g. to add a marker to the above example.
115
+
116
+ ```html
117
+ <l-map center="[0, 0]" zoom="1">
118
+ <l-tile-layer
119
+ url-template="https://tile.openstreetmap.org/{z}/{x}/{y}.png"
120
+ attribution='&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
121
+ ></l-tile-layer>
122
+ <l-marker lat-lng="[51.5, -0.09]"></l-marker>
123
+ </l-map>
124
+ ```
63
125
 
64
126
  ## Custom elements
65
127
 
@@ -68,19 +130,28 @@ Leaflet HTML uses Custom elements to declare the state of each map on the page.
68
130
  The most common elements are described below.
69
131
  The naming convention followed here makes it easy to map from a Leaflet method, e.g. `L.method()`, to a custom element, e.g. `<l-method></l-method>`.
70
132
 
71
- Name | Description
72
- -- | --
73
- l-map | `L.map` parent element for a map. Child elements `addTo` this element.
74
- l-tile-layer | `L.tileLayer` call, can be attached to a `l-map` or `l-base-layers` element.
75
- l-marker | `L.marker` equivalent, can be attached to a `l-map` or `l-layer-group`.
76
- l-icon | Icon attachable to `l-marker`.
77
- l-popup | Popup.
78
- l-image-overlay | Image overlay.
79
- l-video-overlay | Video overlay.
80
- l-control-layers | Adds `l-base-layers` and `l-overlay-layers` to control UI.
81
- l-base-layers | Collection of layers, typical `l-tile-layers`.
82
- l-overlay-layers | Collection of layers, either layer or layer groups.
83
- l-layer-group | Parent element to group layers inside control UI. Makes adding/removing groups of UI to a map simple.
133
+ Positional arguments and options are specified as kebab-case equivalents of the camelCase name from the Leaflet docs.
134
+ E.g. `<l-method foo-bar="42"></l-method>` translates to `L.method({fooBar: 42})`.
135
+ Type conversions and correct call positions are handled by the library.
136
+
137
+ Name | Leaflet docs | Description
138
+ -- | -- | --
139
+ l-map | [L.map](https://leafletjs.com/reference.html#map) | Parent element for a map. Child elements `addTo` this element.
140
+ l-tile-layer | [L.tileLayer](https://leafletjs.com/reference.html#tilelayer) | TileLayer, can be attached to a `l-map` or `l-base-layers` element.
141
+ l-marker | [L.marker](https://leafletjs.com/reference.html#marker) | Marker, can be attached to a `l-map` or `l-layer-group`.
142
+ l-icon | [L.icon](https://leafletjs.com/reference.html#icon) | Icon attachable to `l-marker`.
143
+ l-popup | [L.popup](https://leafletjs.com/reference.html#popup) | Popup.
144
+ l-tooltip | [L.tooltip](https://leafletjs.com/reference.html#tooltip) | Tooltip.
145
+ l-image-overlay | [L.imageOverlay](https://leafletjs.com/reference.html#imageoverlay) | Image overlay.
146
+ l-video-overlay | [L.videoOverlay](https://leafletjs.com/reference.html#videooverlay) | Video overlay.
147
+ l-control-layers | [L.control.layers](https://leafletjs.com/reference.html#control-layers) | Adds `l-base-layers` and `l-overlay-layers` to control UI.
148
+ l-base-layers | [L.control.layers](https://leafletjs.com/reference.html#control-layers) | Child of `l-control-layers`. Contains `l-tile-layer` elements.
149
+ l-overlay-layers | [L.control.layers](https://leafletjs.com/reference.html#control-layers) | Child of `l-control-layers`. Contains either layer or layer group elements.
150
+ l-layer-group | [L.layerGroup](https://leafletjs.com/reference.html#layergroup) | Parent element to group layers inside control UI. Makes adding/removing groups of UI to a map simple.
151
+ l-circle | [L.circle](https://leafletjs.com/reference.html#circle) | Vector layer.
152
+ l-rectangle | [L.rectangle](https://leafletjs.com/reference.html#rectangle) | Vector layer.
153
+ l-polygon | [L.polygon](https://leafletjs.com/reference.html#polygon) | Vector layer.
154
+ l-polyline | [L.polyline](https://leafletjs.com/reference.html#polyline) | Vector layer.
84
155
 
85
156
  Each custom element can be configured using HTML attributes with the same naming convention as the Leaflet docs.
86
157
 
@@ -114,7 +185,7 @@ The HTML in `example/index.html` is a simple demonstration of the API.
114
185
  ![image](https://github.com/andrewgryan/leaflet-html/assets/22789046/0186bce2-ddcc-443a-b7a2-ccd86dcffcfc)
115
186
 
116
187
  ```html
117
- <!-- Note: Leaflet JS/CSS must be included in <head> and [data-leaflet-html] styled to an appropriate size. -->
188
+ <!-- Note: Leaflet JS/CSS must be included in <head> and l-map styled to an appropriate size. -->
118
189
  <l-map center="[39.61, -105.02]" zoom="10">
119
190
  <l-control-layers>
120
191
  <l-base-layers>
@@ -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,Circle as l,Rectangle as c,Polygon as s,Polyline as u,tooltip as p,circle as d,polyline as f,polygon as b,rectangle as h}from"leaflet";function m(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(m=function(){return!!t})()}function v(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,g(t,e)}function y(t){return y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},y(t)}function g(t,e){return g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},g(t,e)}function E(t){var e="function"==typeof Map?new Map:void 0;return E=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(m())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var a=new(t.bind.apply(t,r));return n&&g(a,n.prototype),a}(t,arguments,y(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),g(n,t)},E(t)}var A="map:addTo",C="popup:add",L=/*#__PURE__*/function(t){function e(){return t.call(this)||this}return v(e,t),e.prototype.connectedCallback=function(){this.addEventListener(A,function(t){t.detail.type="base"})},e}(/*#__PURE__*/E(HTMLElement)),w=/*#__PURE__*/function(t){function n(){return t.call(this)||this}return v(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__*/E(HTMLElement)),O=/*#__PURE__*/function(t){function e(){var e;return(e=t.call(this)||this).layer=null,e}return v(e,t),e}(/*#__PURE__*/E(HTMLElement)),k=/*#__PURE__*/function(t){function e(){var e;return(e=t.call(this)||this).layer=null,e}return v(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}(O),S=/*#__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 O&&null!==e.map&&null!==t.layer&&e.map.removeLayer(t.layer)})}})}).observe(t,{childList:!0}),t}return v(n,e),n.prototype.connectedCallback=function(){var e=this;this.map=t.map(this);var n=this.getAttribute("center"),r=this.getAttribute("zoom");null!==n&&null!==r&&this.map.setView(JSON.parse(n),parseInt(r)),this.addEventListener(A,function(t){t.detail.layer.addTo(e.map)}),this.addEventListener("layer:remove",function(t){null!==e.map&&e.map.removeLayer(t.detail.layer)})},n}(/*#__PURE__*/E(HTMLElement)),N=/*#__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}v(n,e);var r=n.prototype;return r.connectedCallback=function(){var e=this,n=JSON.parse(this.getAttribute("lat-lng")),r=parseFloat(this.getAttribute("opacity")||"1.0");if(this.layer=t.marker(n,{opacity: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(C,function(t){e.layer.bindPopup(t.detail.content)});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}(O);if(N.observedAttributes=["lat-lng","opacity","icon"],import.meta.vitest){var J=import.meta.vitest,T=J.it,M=J.expect;(0,J.beforeAll)(function(){customElements.define("l-marker",N)}),T("default icon",function(){var e=document.createElement("l-marker");document.body.appendChild(e);var n=e.layer.getIcon(),r=new t.Icon.Default;M(n).toEqual(r)}),T("adds an icon",function(){var e=document.createElement("l-marker");e.setAttribute("icon",JSON.stringify({iconUrl:"foo.png"})),document.body.appendChild(e);var n=e.layer.getIcon(),r=t.icon({iconUrl:"foo.png"});M(n).toEqual(r)}),T("changes an icon",function(){var e=document.createElement("l-marker");document.body.appendChild(e),e.setAttribute("icon",JSON.stringify({iconUrl:"bar.png"}));var n=e.layer.getIcon(),r=t.icon({iconUrl:"bar.png"});M(n).toEqual(r)})}var H=/*#__PURE__*/function(t){function e(){return t.call(this)||this}return v(e,t),e.prototype.connectedCallback=function(){this.addEventListener(A,function(t){t.detail.type="overlay"})},e}(/*#__PURE__*/E(HTMLElement)),j=/*#__PURE__*/function(t){function e(){return t.call(this)||this}return v(e,t),e.prototype.connectedCallback=function(){var t=this.getAttribute("content"),e=new CustomEvent(C,{cancelable:!0,bubbles:!0,detail:{content:t}});this.dispatchEvent(e)},e}(/*#__PURE__*/E(HTMLElement)),P=/*#__PURE__*/function(t){function e(){var e;return(e=t.call(this)||this).layer=null,e}return v(e,t),e.prototype.connectedCallback=function(){var t=this.getAttribute("name"),e=this.getAttribute("url-template");if(null!==e){var n={},a="attribution";this.hasAttribute(a)&&(n[a]=this.getAttribute(a)),this.layer=r(e,n);var i=new CustomEvent(A,{detail:{name:t,layer:this.layer},bubbles:!0});this.dispatchEvent(i)}},e}(O),U=/*#__PURE__*/function(t){function e(){return t.call(this)||this}return v(e,t),e.prototype.attributeChangedCallback=function(t,e,n){var r=new CustomEvent("map:bounds",{bubbles:!0,detail:{bounds:JSON.parse(n),method:this.getAttribute("method")||"fitBounds"}});this.dispatchEvent(r)},e}(/*#__PURE__*/E(HTMLElement));U.observedAttributes=["bounds"];var I=/*#__PURE__*/function(t){function e(){var e;return(e=t.call(this)||this).layer=null,e}v(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}(O);I.observedAttributes=["url","bounds","opacity"];var F=/*#__PURE__*/function(t){function e(){return t.call(this)||this}return v(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}(O),_=/*#__PURE__*/function(t){function e(){return t.call(this)||this}return v(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__*/E(HTMLElement)),z=function(t){return t.replace(/-./g,function(t){return t[1].toUpperCase()})},B=/*#__PURE__*/function(e){function n(){var t;return(t=e.call(this)||this).icon=null,t}return v(n,e),n.prototype.connectedCallback=function(){var e=this,n={};["icon-url","icon-retina-url","shadow-url","shadow-retina-url","class-name"].forEach(function(t){e.hasAttribute(t)&&(n[z(t)]=e.getAttribute(t))}),["icon-anchor","icon-size","shadow-anchor","shadow-size","tooltip-anchor","popup-anchor"].forEach(function(t){e.hasAttribute(t)&&(n[z(t)]=JSON.parse(e.getAttribute(t)))}),this.hasAttribute("cross-origin")&&(n.crossOrigin="true"===this.getAttribute("cross-origin")),this.icon=t.icon(n);var r=new CustomEvent("icon:add",{cancelable:!0,bubbles:!0,detail:{icon:this.icon}});this.dispatchEvent(r)},n}(/*#__PURE__*/E(HTMLElement));if(import.meta.vitest){var q=import.meta.vitest,x=q.it,R=q.expect;(0,q.beforeAll)(function(){customElements.define("l-icon",B)}),x("default",function(){var e=document.createElement("l-icon");document.body.appendChild(e);var n=e.icon,r=t.icon();R(n).toEqual(r)}),x("emits icon:add event",function(){try{var e=document.createElement("l-icon"),n=new Promise(function(t){e.addEventListener("icon:add",function(e){t(e.detail.icon)})});return document.body.appendChild(e),Promise.resolve(n).then(function(e){var n=t.icon();R(e).toEqual(n)})}catch(t){return Promise.reject(t)}}),x("options",function(){var e=document.createElement("l-icon");e.setAttribute("icon-url","url.png"),e.setAttribute("icon-retina-url","retina.png"),e.setAttribute("icon-size","[0, 0]"),e.setAttribute("icon-anchor","[0, 0]"),e.setAttribute("popup-anchor","[0, 0]"),e.setAttribute("tooltip-anchor","[0, 0]"),e.setAttribute("shadow-url","urlShadow.png"),e.setAttribute("shadow-retina-url","retinaShadow.png"),e.setAttribute("shadow-size","[0, 0]"),e.setAttribute("shadow-anchor","[0, 0]"),e.setAttribute("class-name","foo"),e.setAttribute("cross-origin","true"),document.body.appendChild(e);var n=e.icon,r=t.icon({iconUrl:"url.png",iconRetinaUrl:"retina.png",iconSize:[0,0],iconAnchor:[0,0],popupAnchor:[0,0],tooltipAnchor:[0,0],shadowUrl:"urlShadow.png",shadowRetinaUrl:"retinaShadow.png",shadowSize:[0,0],shadowAnchor:[0,0],className:"foo",crossOrigin:!0});R(n).toEqual(r)})}var D=function(t){switch(t){case"circle":return[V("latLng","latlng",null)];case"rectangle":return[V("latLngBounds","latlngbounds",null)];case"polygon":case"polyline":return[V("latLngs","latlng",null)]}},V=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:G(e),defaultValue:n};var r},G=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}}},K=function(t){var e={circle:[V("radius","number",null)],path:[V("stroke","boolean",!0),V("color","string","#3388ff"),V("weight","number",3),V("opacity","number",1),V("lineCap","string","round"),V("lineJoin","string","round"),V("dashArray","string",null),V("dashOffset","string",null),V("fill","boolean",!0),V("fillColor","string","#3388ff"),V("fillOpacity","number",.2)],polyline:[V("smoothFactor","number",1),V("noClip","boolean",!1)],polygon:[],rectangle:[],interactiveLayer:[V("interactive","boolean",!0)]};return W(t).flatMap(function(t){return e[t]})},Q={circle:["path"],polyline:["path"],polygon:["polyline"],rectangle:["polygon"],path:["interactiveLayer"],interactiveLayer:[]},W=function(t){for(var e=t,n=[t];Q[e].length>0;){var r=Q[e][0];n.push(r),e=r}return n},X=function(t,e){var n={};return K(e).forEach(function(e){t.hasAttribute(e.kebab)&&(n[e.camel]=e.parser(t.getAttribute(e.kebab)))}),n},Y=function(t,e){return"tooltip"===e?Z():$(t,e)},Z=function(){var t=/*#__PURE__*/function(t){function e(){var e;return(e=t.call(this)||this).tooltip=p(),e}v(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__*/E(HTMLElement));return t.observedAttributes=["content"],t},$=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}v(r,n);var a=r.prototype;return a.connectedCallback=function(){var n=function(t,e){return D(e).map(function(e){return e.parser(t.getAttribute(e.kebab))})}(this,e),r=X(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(D(e),K(e)).find(function(t){return t.kebab===n});if(void 0!==a){var i=a.parser(r);if(t instanceof l)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 s?"lat-lngs"===n&&t.setLatLngs(JSON.parse(r)):t instanceof u&&"lat-lngs"===n&&t.setLatLngs(JSON.parse(r));var o,p=K("polyline").find(function(t){return t.kebab===n});void 0!==p&&t.setStyle(((o={})[p.camel]=i,o))}}(this.layer,e,t,r)},r}(/*#__PURE__*/E(HTMLElement));return n.observedAttributes=function(t){var e=D(t).map(function(t){return t.kebab}),n=K(t).map(function(t){return t.kebab});return[].concat(e,n)}(e),n},tt=(customElements.define("l-map",S),customElements.define("l-control-layers",w),customElements.define("l-base-layers",L),customElements.define("l-overlay-layers",H),customElements.define("l-layer-group",k),customElements.define("l-tile-layer",P),customElements.define("l-marker",N),customElements.define("l-popup",j),customElements.define("l-lat-lng-bounds",U),customElements.define("l-image-overlay",I),customElements.define("l-video-overlay",F),customElements.define("l-geojson",_),customElements.define("l-icon",B),customElements.define("l-circle",Y(d,"circle")),customElements.define("l-polyline",Y(f,"polyline")),customElements.define("l-polygon",Y(b,"polygon")),customElements.define("l-rectangle",Y(h,"rectangle")),void customElements.define("l-tooltip",Y(p,"tooltip")));export{tt 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,tooltip as l,Circle as s,Rectangle as c,Polygon as u,Polyline as p,circle as d,polyline as f,polygon as b,rectangle as h}from"leaflet";function m(t){return m=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},m(t)}function v(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,g(t,e)}function y(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(y=function(){return!!t})()}function g(t,e){return g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},g(t,e)}function E(t){var e="function"==typeof Map?new Map:void 0;return E=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(y())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var a=new(t.bind.apply(t,r));return n&&g(a,n.prototype),a}(t,arguments,m(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),g(n,t)},E(t)}var A="map:addTo",C="popup:add",w=/*#__PURE__*/function(t){function e(){return t.call(this)||this}return v(e,t),e.prototype.connectedCallback=function(){this.addEventListener(A,function(t){t.detail.type="base"})},e}(/*#__PURE__*/E(HTMLElement)),L=/*#__PURE__*/function(t){function n(){return t.call(this)||this}return v(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__*/E(HTMLElement)),O=/*#__PURE__*/function(t){function e(){var e;return(e=t.call(this)||this).layer=null,e}return v(e,t),e}(/*#__PURE__*/E(HTMLElement)),k=/*#__PURE__*/function(t){function e(){var e;return(e=t.call(this)||this).layer=null,e}return v(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}(O),S=/*#__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 O&&null!==e.map&&null!==t.layer&&e.map.removeLayer(t.layer)})}})}).observe(t,{childList:!0}),t}v(n,e);var r=n.prototype;return r.connectedCallback=function(){var e=this;if(this.map=t.map(this),this.hasAttribute("on")){var n=this.getAttribute("on");null!==n&&n.split(/\s+/).forEach(function(t){null!==e.map&&e.map.on(t,function(n){e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:n}))})})}if(this.hasAttribute("fit-world"))this.map.fitWorld();else{var r=this.getAttribute("center"),a=this.getAttribute("zoom");null!==r&&null!==a&&this.map.setView(JSON.parse(r),parseInt(a))}this.hasAttribute("locate")&&this.map.locate(JSON.parse(this.getAttribute("locate"))),this.addEventListener(A,function(t){t.detail.layer.addTo(e.map)}),this.addEventListener("layer:remove",function(t){null!==e.map&&e.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__*/E(HTMLElement));S.observedAttributes=["zoom","center"];var N=/*#__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}v(n,e);var r=n.prototype;return r.connectedCallback=function(){var e=this,n=JSON.parse(this.getAttribute("lat-lng")),r=parseFloat(this.getAttribute("opacity")||"1.0");if(this.layer=t.marker(n,{opacity: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(C,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}(O);if(N.observedAttributes=["lat-lng","opacity","icon"],import.meta.vitest){var J=import.meta.vitest,T=J.it,M=J.expect;(0,J.beforeAll)(function(){customElements.define("l-marker",N)}),T("default icon",function(){var e=document.createElement("l-marker");document.body.appendChild(e);var n=e.layer.getIcon(),r=new t.Icon.Default;M(n).toEqual(r)}),T("adds an icon",function(){var e=document.createElement("l-marker");e.setAttribute("icon",JSON.stringify({iconUrl:"foo.png"})),document.body.appendChild(e);var n=e.layer.getIcon(),r=t.icon({iconUrl:"foo.png"});M(n).toEqual(r)}),T("changes an icon",function(){var e=document.createElement("l-marker");document.body.appendChild(e),e.setAttribute("icon",JSON.stringify({iconUrl:"bar.png"}));var n=e.layer.getIcon(),r=t.icon({iconUrl:"bar.png"});M(n).toEqual(r)})}var H=/*#__PURE__*/function(t){function e(){return t.call(this)||this}return v(e,t),e.prototype.connectedCallback=function(){this.addEventListener(A,function(t){t.detail.type="overlay"})},e}(/*#__PURE__*/E(HTMLElement)),P=/*#__PURE__*/function(t){function e(){return t.call(this)||this}return v(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(C,{cancelable:!0,bubbles:!0,detail:{content:t,openPopup:e}});this.dispatchEvent(r)},e}(/*#__PURE__*/E(HTMLElement)),j=/*#__PURE__*/function(t){function e(){var e;return(e=t.call(this)||this).layer=null,e}return v(e,t),e.prototype.connectedCallback=function(){var t=this.getAttribute("name"),e=this.getAttribute("url-template");if(null!==e){var n={},a="attribution";this.hasAttribute(a)&&(n[a]=this.getAttribute(a)),this.layer=r(e,n);var i=new CustomEvent(A,{detail:{name:t,layer:this.layer},bubbles:!0});this.dispatchEvent(i)}},e}(O),I=/*#__PURE__*/function(t){function e(){return t.call(this)||this}v(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__*/E(HTMLElement));I.observedAttributes=["bounds"];var U=/*#__PURE__*/function(t){function e(){var e;return(e=t.call(this)||this).layer=null,e}v(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}(O);U.observedAttributes=["url","bounds","opacity"];var z=/*#__PURE__*/function(t){function e(){return t.call(this)||this}return v(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}(O),F=/*#__PURE__*/function(t){function e(){return t.call(this)||this}return v(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__*/E(HTMLElement)),_=function(t){return t.replace(/-./g,function(t){return t[1].toUpperCase()})},B=/*#__PURE__*/function(e){function n(){var t;return(t=e.call(this)||this).icon=null,t}return v(n,e),n.prototype.connectedCallback=function(){var e=this,n={};["icon-url","icon-retina-url","shadow-url","shadow-retina-url","class-name"].forEach(function(t){e.hasAttribute(t)&&(n[_(t)]=e.getAttribute(t))}),["icon-anchor","icon-size","shadow-anchor","shadow-size","tooltip-anchor","popup-anchor"].forEach(function(t){e.hasAttribute(t)&&(n[_(t)]=JSON.parse(e.getAttribute(t)))}),this.hasAttribute("cross-origin")&&(n.crossOrigin="true"===this.getAttribute("cross-origin")),this.icon=t.icon(n);var r=new CustomEvent("icon:add",{cancelable:!0,bubbles:!0,detail:{icon:this.icon}});this.dispatchEvent(r)},n}(/*#__PURE__*/E(HTMLElement));if(import.meta.vitest){var q=import.meta.vitest,x=q.it,R=q.expect;(0,q.beforeAll)(function(){customElements.define("l-icon",B)}),x("default",function(){var e=document.createElement("l-icon");document.body.appendChild(e);var n=e.icon,r=t.icon();R(n).toEqual(r)}),x("emits icon:add event",function(){try{var e=document.createElement("l-icon"),n=new Promise(function(t){e.addEventListener("icon:add",function(e){t(e.detail.icon)})});return document.body.appendChild(e),Promise.resolve(n).then(function(e){var n=t.icon();R(e).toEqual(n)})}catch(t){return Promise.reject(t)}}),x("options",function(){var e=document.createElement("l-icon");e.setAttribute("icon-url","url.png"),e.setAttribute("icon-retina-url","retina.png"),e.setAttribute("icon-size","[0, 0]"),e.setAttribute("icon-anchor","[0, 0]"),e.setAttribute("popup-anchor","[0, 0]"),e.setAttribute("tooltip-anchor","[0, 0]"),e.setAttribute("shadow-url","urlShadow.png"),e.setAttribute("shadow-retina-url","retinaShadow.png"),e.setAttribute("shadow-size","[0, 0]"),e.setAttribute("shadow-anchor","[0, 0]"),e.setAttribute("class-name","foo"),e.setAttribute("cross-origin","true"),document.body.appendChild(e);var n=e.icon,r=t.icon({iconUrl:"url.png",iconRetinaUrl:"retina.png",iconSize:[0,0],iconAnchor:[0,0],popupAnchor:[0,0],tooltipAnchor:[0,0],shadowUrl:"urlShadow.png",shadowRetinaUrl:"retinaShadow.png",shadowSize:[0,0],shadowAnchor:[0,0],className:"foo",crossOrigin:!0});R(n).toEqual(r)})}var V=/*#__PURE__*/function(t){function e(){var e;return(e=t.call(this)||this).tooltip=l(),e}v(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__*/E(HTMLElement));V.observedAttributes=["content"];var D=function(t){switch(t){case"circle":return[W("latLng","latlng",null)];case"rectangle":return[W("latLngBounds","latlngbounds",null)];case"polygon":case"polyline":return[W("latLngs","latlng",null)]}},W=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:Z(e),defaultValue:n};var r},Z=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}}},G=function(t){var e={circle:[W("radius","number",null)],path:[W("stroke","boolean",!0),W("color","string","#3388ff"),W("weight","number",3),W("opacity","number",1),W("lineCap","string","round"),W("lineJoin","string","round"),W("dashArray","string",null),W("dashOffset","string",null),W("fill","boolean",!0),W("fillColor","string","#3388ff"),W("fillOpacity","number",.2)],polyline:[W("smoothFactor","number",1),W("noClip","boolean",!1)],polygon:[],rectangle:[],interactiveLayer:[W("interactive","boolean",!0)]};return Q(t).flatMap(function(t){return e[t]})},K={circle:["path"],polyline:["path"],polygon:["polyline"],rectangle:["polygon"],path:["interactiveLayer"],interactiveLayer:[]},Q=function(t){for(var e=t,n=[t];K[e].length>0;){var r=K[e][0];n.push(r),e=r}return n},X=function(t,e){var n={};return G(e).forEach(function(e){t.hasAttribute(e.kebab)&&(n[e.camel]=e.parser(t.getAttribute(e.kebab)))}),n},Y=/*#__PURE__*/function(t){function e(e){var n;return(n=t.call(this,e)||this).name="LeafletHTMLError",n}return v(e,t),e}(/*#__PURE__*/E(Error)),$=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}v(r,n);var a=r.prototype;return a.connectedCallback=function(){var n=function(t,e){return D(e).map(function(n){if(!t.hasAttribute(n.kebab))throw new Y("l-"+e+" element missing "+n.kebab+" HTML attribute");return n.parser(t.getAttribute(n.kebab))})}(this,e),r=X(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(D(e),G(e)).find(function(t){return t.kebab===n});if(void 0!==a){var i=a.parser(r);if(t instanceof s)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 u?"lat-lngs"===n&&t.setLatLngs(JSON.parse(r)):t instanceof p&&"lat-lngs"===n&&t.setLatLngs(JSON.parse(r));var o,l=G("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__*/E(HTMLElement));return n.observedAttributes=function(t){var e=D(t).map(function(t){return t.kebab}),n=G(t).map(function(t){return t.kebab});return[].concat(e,n)}(e),n},tt=(customElements.define("l-map",S),customElements.define("l-control-layers",L),customElements.define("l-base-layers",w),customElements.define("l-overlay-layers",H),customElements.define("l-layer-group",k),customElements.define("l-tile-layer",j),customElements.define("l-marker",N),customElements.define("l-popup",P),customElements.define("l-lat-lng-bounds",I),customElements.define("l-image-overlay",U),customElements.define("l-video-overlay",z),customElements.define("l-geojson",F),customElements.define("l-icon",B),customElements.define("l-circle",$(d,"circle")),customElements.define("l-polyline",$(f,"polyline")),customElements.define("l-polygon",$(b,"polygon")),customElements.define("l-rectangle",$(h,"rectangle")),void customElements.define("l-tooltip",V));export{tt as default};
2
2
  //# sourceMappingURL=leaflet-html.js.map
@@ -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/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/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","// @ts-check\nimport * as L from \"leaflet\";\nimport { layerRemove, mapAddTo } from \"./events.js\";\nimport LLayer from \"./l-layer.js\";\n\nclass LMap extends HTMLElement {\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 const center = this.getAttribute(\"center\");\n const zoom = this.getAttribute(\"zoom\");\n if (center !== null && zoom !== null) {\n this.map.setView(JSON.parse(center), parseInt(zoom));\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\nexport default LMap;\n","// @vitest-environment happy-dom\nimport * as L from \"leaflet\";\nimport { mapAddTo, popupAdd } from \"./events.js\";\nimport LLayer from \"./l-layer.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 const latLng = JSON.parse(this.getAttribute(\"lat-lng\"));\n const opacity = parseFloat(this.getAttribute(\"opacity\") || \"1.0\");\n this.layer = L.marker(latLng, { opacity });\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 } = ev.detail;\n this.layer.bindPopup(content);\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\nif (import.meta.vitest) {\n const { it, expect, beforeAll } = import.meta.vitest;\n\n beforeAll(() => {\n customElements.define(\"l-marker\", LMarker);\n });\n\n it(\"default icon\", () => {\n const el = document.createElement(\"l-marker\");\n document.body.appendChild(el);\n let actual = el.layer.getIcon();\n let expected = new L.Icon.Default();\n expect(actual).toEqual(expected);\n });\n\n it(\"adds an icon\", () => {\n const el = document.createElement(\"l-marker\");\n // Set attribute before appendChild\n el.setAttribute(\"icon\", JSON.stringify({ iconUrl: \"foo.png\" }));\n document.body.appendChild(el);\n let actual = el.layer.getIcon();\n let expected = L.icon({ iconUrl: \"foo.png\" });\n expect(actual).toEqual(expected);\n });\n\n it(\"changes an icon\", () => {\n const el = document.createElement(\"l-marker\");\n // Set attribute after appendChild\n document.body.appendChild(el);\n el.setAttribute(\"icon\", JSON.stringify({ iconUrl: \"bar.png\" }));\n let actual = el.layer.getIcon();\n let expected = L.icon({ iconUrl: \"bar.png\" });\n expect(actual).toEqual(expected);\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 const event = new CustomEvent(popupAdd, {\n cancelable: true,\n bubbles: true,\n detail: {\n content,\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\";\n\nclass LTileLayer extends LLayer {\n constructor() {\n super();\n this.layer = null\n }\n\n connectedCallback() {\n const name = this.getAttribute(\"name\");\n const urlTemplate = this.getAttribute(\"url-template\");\n if (urlTemplate === null) {\n return;\n }\n const options = {};\n const key = \"attribution\";\n if (this.hasAttribute(key)) {\n options[key] = this.getAttribute(key);\n }\n this.layer = tileLayer(urlTemplate, options);\n const event = new CustomEvent(mapAddTo, {\n detail: { name, layer: this.layer },\n bubbles: true,\n });\n this.dispatchEvent(event);\n }\n}\n\nexport default LTileLayer;\n","// @ts-check\nclass LLatLngBounds extends HTMLElement {\n static observedAttributes = [\"bounds\"];\n\n constructor() {\n super();\n }\n\n attributeChangedCallback(_name, _oldValue, newValue) {\n const event = new CustomEvent(\"map:bounds\", {\n bubbles: true,\n detail: {\n bounds: JSON.parse(newValue),\n method: this.getAttribute(\"method\") || \"fitBounds\",\n },\n });\n this.dispatchEvent(event);\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","// @vitest-environment happy-dom\nimport * as L from \"leaflet\";\nimport { kebabToCamel } from \"./util.js\"; \n\n\nclass LIcon extends HTMLElement {\n constructor() {\n super();\n this.icon = null;\n }\n\n connectedCallback() {\n const options = {};\n\n // Strings\n let keys = [\n \"icon-url\",\n \"icon-retina-url\",\n \"shadow-url\",\n \"shadow-retina-url\",\n \"class-name\",\n ];\n keys.forEach((key) => {\n if (this.hasAttribute(key)) {\n options[kebabToCamel(key)] = this.getAttribute(key);\n }\n });\n\n // Points\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 if (this.hasAttribute(key)) {\n options[kebabToCamel(key)] = JSON.parse(this.getAttribute(key));\n }\n });\n\n if (this.hasAttribute(\"cross-origin\")) {\n options.crossOrigin = this.getAttribute(\"cross-origin\") === \"true\";\n }\n this.icon = L.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\nif (import.meta.vitest) {\n const { it, expect, beforeAll } = import.meta.vitest;\n\n beforeAll(() => {\n customElements.define(\"l-icon\", LIcon);\n });\n\n it(\"default\", () => {\n const el = document.createElement(\"l-icon\");\n document.body.appendChild(el);\n\n let actual = el.icon;\n let expected = L.icon();\n expect(actual).toEqual(expected);\n });\n\n it(\"emits icon:add event\", async () => {\n const el = document.createElement(\"l-icon\");\n let promise = new Promise((resolve) => {\n el.addEventListener(\"icon:add\", (ev) => {\n resolve(ev.detail.icon);\n });\n });\n document.body.appendChild(el);\n let actual = await promise;\n let expected = L.icon();\n expect(actual).toEqual(expected);\n });\n\n it(\"options\", () => {\n const el = document.createElement(\"l-icon\");\n el.setAttribute(\"icon-url\", \"url.png\");\n el.setAttribute(\"icon-retina-url\", \"retina.png\");\n el.setAttribute(\"icon-size\", \"[0, 0]\");\n el.setAttribute(\"icon-anchor\", \"[0, 0]\");\n el.setAttribute(\"popup-anchor\", \"[0, 0]\");\n el.setAttribute(\"tooltip-anchor\", \"[0, 0]\");\n el.setAttribute(\"shadow-url\", \"urlShadow.png\");\n el.setAttribute(\"shadow-retina-url\", \"retinaShadow.png\");\n el.setAttribute(\"shadow-size\", \"[0, 0]\");\n el.setAttribute(\"shadow-anchor\", \"[0, 0]\");\n el.setAttribute(\"class-name\", \"foo\");\n el.setAttribute(\"cross-origin\", \"true\");\n document.body.appendChild(el);\n\n let actual = el.icon;\n let expected = L.icon({\n iconUrl: \"url.png\",\n iconRetinaUrl: \"retina.png\",\n iconSize: [0, 0],\n iconAnchor: [0, 0],\n popupAnchor: [0, 0],\n tooltipAnchor: [0, 0],\n shadowUrl: \"urlShadow.png\",\n shadowRetinaUrl: \"retinaShadow.png\",\n shadowSize: [0, 0],\n shadowAnchor: [0, 0],\n className: \"foo\",\n crossOrigin: true,\n });\n expect(actual).toEqual(expected);\n });\n}\n\nexport default LIcon;\n","// @ts-check\nimport { Circle, LatLng, Polygon, Polyline, Rectangle, tooltip } from \"leaflet\";\nimport { camelToKebab } from \"./util.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 {(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 * @param {HTMLElement} el\n * @param {MethodName} methodName\n */\nconst positional = (el, methodName) => {\n return positionalArguments(methodName).map((option) =>\n option.parser(el.getAttribute(option.kebab)),\n );\n};\n\n/**\n * @param {(MethodName | \"tooltip\")} methodName\n */\nconst generator = (method, methodName) => {\n if (methodName === \"tooltip\") {\n return generateTooltip();\n } else {\n return generateVector(method, methodName);\n }\n};\n\nconst generateTooltip = () => {\n class cls 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 attributeChangedCallback(attName, _, newValue) {\n if (attName === \"content\") {\n this.tooltip.setContent(newValue);\n }\n }\n }\n return cls;\n};\n\n\n/**\n * @param {MethodName} methodName\n */\nconst generateVector = (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 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 generator from \"./generator.js\";\nimport { circle, polyline, polygon, rectangle, tooltip } 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\", generator(tooltip, \"tooltip\"));\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","LMap","map","method","bounds","target","el","_this2","L","center","zoom","setView","JSON","parse","addTo","LMarker","setIcon","icon","_proto","latLng","opacity","parseFloat","marker","hasAttribute","setAttribute","stamp","bindPopup","content","attributeChangedCallback","_oldValue","newValue","setLatLng","setOpacity","observedAttributes","vitest","_import$meta$vitest","it","expect","beforeAll","customElements","define","document","createElement","body","appendChild","actual","getIcon","expected","Icon","Default","toEqual","stringify","iconUrl","LOverlayLayers","LPopup","LTileLayer","urlTemplate","options","key","tileLayer","LLatLngBounds","_name","LImageOverlay","url","alt","imageOverlay","console","warn","setUrl","setBounds","LVideoOverlay","autoplay","muted","playsInline","videoOverlay","LGeoJSON","value","geoJSON","kebabToCamel","kebab","replace","x","toUpperCase","LIcon","crossOrigin","promise","Promise","resolve","then","e","reject","iconRetinaUrl","iconSize","iconAnchor","popupAnchor","tooltipAnchor","shadowUrl","shadowRetinaUrl","shadowSize","shadowAnchor","className","positionalArguments","methodName","option","defaultValue","camel","s","split","letter","idx","toLowerCase","join","parser","inferParser","_OPTIONS","circle","path","polyline","polygon","rectangle","interactiveLayer","inheritance","flatMap","parent","INHERITS","chain","length","push","settings","result","o","generator","generateTooltip","generateVector","cls","tooltip","attName","_","setContent","_HTMLElement2","bindTooltip","_proto2","args","positional","apply","concat","_opt","find","parsedValue","Circle","setRadius","Rectangle","setLatLngs","Polygon","Polyline","_layer$setStyle","opt","setStyle","setter","opts","attributes","init"],"mappings":"y7CAAaA,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,OAHjB,CAAA,EAEG,CAAE,GAGlBZ,KAAKI,iBAAiBT,EAAU,SAACU,GAC/B,IAAAQ,EAA8BR,EAAGC,OAAzBQ,EAAID,EAAJC,KAAMC,EAAIF,EAAJE,KAAMC,EAAKH,EAALG,MACP,YAATF,EACFJ,EAAcO,WAAWD,EAAOD,GACd,SAATD,GACTJ,EAAcQ,aAAaF,EAAOD,GAEpCV,EAAGc,gBACL,GAEA,IAAMC,EAAQ,IAAIC,YAAY1B,EAAU,CACtC2B,YAAY,EACZC,SAAS,EACTjB,OAAQ,CACNU,MAAON,KAGXV,KAAKwB,cAAcJ,EACrB,EAACX,CAAA,CA9BiB,cA8BjBF,EA9B0BC,cCLvBiB,eAAM3B,SAAAA,GACV,SAAA2B,IAAcC,IAAAA,EAEKA,OADjBA,EAAA5B,EAAAC,KAAMC,aACDgB,MAAQ,KAAIU,CACnB,CAACD,OAAAxB,EAAAwB,EAAA3B,GAAA2B,CAAA,CAJS3B,cAITS,EAJkBC,cCKfmB,eAAW,SAAAC,GACf,SAAAD,IAAc,IAAAD,EAEM,OADlBA,EAAAE,EAAA7B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AQ,WACpD5E,eAAeC,OAAO,aAAc2F,EAAUd,EAAU,aACxD9E,eAAeC,OAAO,YAAa2F,EAAUb,EAAS,YACtD/E,eAAeC,OAAO,cAAe2F,EAAUZ,EAAW,mBAC1DhF,eAAeC,OAAO,YAAa2F,EAAUI,EAAS"}
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/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","// @ts-check\nimport * as L from \"leaflet\";\nimport { layerRemove, mapAddTo } from \"./events.js\";\nimport LLayer from \"./l-layer.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 center = this.getAttribute(\"center\");\n const zoom = this.getAttribute(\"zoom\");\n if (center !== null && zoom !== null) {\n this.map.setView(JSON.parse(center), parseInt(zoom));\n }\n }\n if (this.hasAttribute(\"locate\")) {\n this.map.locate(JSON.parse(this.getAttribute(\"locate\")));\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","// @vitest-environment happy-dom\nimport * as L from \"leaflet\";\nimport { mapAddTo, popupAdd } from \"./events.js\";\nimport LLayer from \"./l-layer.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 const latLng = JSON.parse(this.getAttribute(\"lat-lng\"));\n const opacity = parseFloat(this.getAttribute(\"opacity\") || \"1.0\");\n this.layer = L.marker(latLng, { opacity });\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\nif (import.meta.vitest) {\n const { it, expect, beforeAll } = import.meta.vitest;\n\n beforeAll(() => {\n customElements.define(\"l-marker\", LMarker);\n });\n\n it(\"default icon\", () => {\n const el = document.createElement(\"l-marker\");\n document.body.appendChild(el);\n let actual = el.layer.getIcon();\n let expected = new L.Icon.Default();\n expect(actual).toEqual(expected);\n });\n\n it(\"adds an icon\", () => {\n const el = document.createElement(\"l-marker\");\n // Set attribute before appendChild\n el.setAttribute(\"icon\", JSON.stringify({ iconUrl: \"foo.png\" }));\n document.body.appendChild(el);\n let actual = el.layer.getIcon();\n let expected = L.icon({ iconUrl: \"foo.png\" });\n expect(actual).toEqual(expected);\n });\n\n it(\"changes an icon\", () => {\n const el = document.createElement(\"l-marker\");\n // Set attribute after appendChild\n document.body.appendChild(el);\n el.setAttribute(\"icon\", JSON.stringify({ iconUrl: \"bar.png\" }));\n let actual = el.layer.getIcon();\n let expected = L.icon({ iconUrl: \"bar.png\" });\n expect(actual).toEqual(expected);\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\";\n\nclass LTileLayer extends LLayer {\n constructor() {\n super();\n this.layer = null\n }\n\n connectedCallback() {\n const name = this.getAttribute(\"name\");\n const urlTemplate = this.getAttribute(\"url-template\");\n if (urlTemplate === null) {\n return;\n }\n const options = {};\n const key = \"attribution\";\n if (this.hasAttribute(key)) {\n options[key] = this.getAttribute(key);\n }\n this.layer = tileLayer(urlTemplate, options);\n const event = new CustomEvent(mapAddTo, {\n detail: { name, layer: this.layer },\n bubbles: true,\n });\n this.dispatchEvent(event);\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","// @vitest-environment happy-dom\nimport * as L from \"leaflet\";\nimport { kebabToCamel } from \"./util.js\"; \n\n\nclass LIcon extends HTMLElement {\n constructor() {\n super();\n this.icon = null;\n }\n\n connectedCallback() {\n const options = {};\n\n // Strings\n let keys = [\n \"icon-url\",\n \"icon-retina-url\",\n \"shadow-url\",\n \"shadow-retina-url\",\n \"class-name\",\n ];\n keys.forEach((key) => {\n if (this.hasAttribute(key)) {\n options[kebabToCamel(key)] = this.getAttribute(key);\n }\n });\n\n // Points\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 if (this.hasAttribute(key)) {\n options[kebabToCamel(key)] = JSON.parse(this.getAttribute(key));\n }\n });\n\n if (this.hasAttribute(\"cross-origin\")) {\n options.crossOrigin = this.getAttribute(\"cross-origin\") === \"true\";\n }\n this.icon = L.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\nif (import.meta.vitest) {\n const { it, expect, beforeAll } = import.meta.vitest;\n\n beforeAll(() => {\n customElements.define(\"l-icon\", LIcon);\n });\n\n it(\"default\", () => {\n const el = document.createElement(\"l-icon\");\n document.body.appendChild(el);\n\n let actual = el.icon;\n let expected = L.icon();\n expect(actual).toEqual(expected);\n });\n\n it(\"emits icon:add event\", async () => {\n const el = document.createElement(\"l-icon\");\n let promise = new Promise((resolve) => {\n el.addEventListener(\"icon:add\", (ev) => {\n resolve(ev.detail.icon);\n });\n });\n document.body.appendChild(el);\n let actual = await promise;\n let expected = L.icon();\n expect(actual).toEqual(expected);\n });\n\n it(\"options\", () => {\n const el = document.createElement(\"l-icon\");\n el.setAttribute(\"icon-url\", \"url.png\");\n el.setAttribute(\"icon-retina-url\", \"retina.png\");\n el.setAttribute(\"icon-size\", \"[0, 0]\");\n el.setAttribute(\"icon-anchor\", \"[0, 0]\");\n el.setAttribute(\"popup-anchor\", \"[0, 0]\");\n el.setAttribute(\"tooltip-anchor\", \"[0, 0]\");\n el.setAttribute(\"shadow-url\", \"urlShadow.png\");\n el.setAttribute(\"shadow-retina-url\", \"retinaShadow.png\");\n el.setAttribute(\"shadow-size\", \"[0, 0]\");\n el.setAttribute(\"shadow-anchor\", \"[0, 0]\");\n el.setAttribute(\"class-name\", \"foo\");\n el.setAttribute(\"cross-origin\", \"true\");\n document.body.appendChild(el);\n\n let actual = el.icon;\n let expected = L.icon({\n iconUrl: \"url.png\",\n iconRetinaUrl: \"retina.png\",\n iconSize: [0, 0],\n iconAnchor: [0, 0],\n popupAnchor: [0, 0],\n tooltipAnchor: [0, 0],\n shadowUrl: \"urlShadow.png\",\n shadowRetinaUrl: \"retinaShadow.png\",\n shadowSize: [0, 0],\n shadowAnchor: [0, 0],\n className: \"foo\",\n crossOrigin: true,\n });\n expect(actual).toEqual(expected);\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\";\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\nclass LeafletHTMLError extends Error {\n /**\n * @param {string} message\n */\n constructor(message) {\n super(message);\n this.name = \"LeafletHTMLError\";\n }\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 if (!el.hasAttribute(option.kebab)) {\n throw new LeafletHTMLError(\n `l-${methodName} element missing ${option.kebab} HTML attribute`\n );\n }\n return option.parser(el.getAttribute(option.kebab));\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","LMap","map","method","bounds","target","el","_proto","_this2","L","hasAttribute","on","split","eventName","e","fitWorld","center","zoom","setView","JSON","parse","locate","addTo","attributeChangedCallback","_oldValue","newValue","setZoom","observedAttributes","LMarker","setIcon","icon","latLng","opacity","parseFloat","marker","setAttribute","stamp","openPopup","popup","bindPopup","content","setLatLng","setOpacity","vitest","_import$meta$vitest","it","expect","beforeAll","customElements","define","document","createElement","body","appendChild","actual","getIcon","expected","Icon","Default","toEqual","stringify","iconUrl","LOverlayLayers","LPopup","openPopupAttribute","LTileLayer","urlTemplate","options","key","tileLayer","LLatLngBounds","value","getEvent","_name","LImageOverlay","url","alt","imageOverlay","console","warn","setUrl","setBounds","LVideoOverlay","autoplay","muted","playsInline","videoOverlay","LGeoJSON","geoJSON","kebabToCamel","kebab","replace","x","toUpperCase","LIcon","crossOrigin","promise","Promise","resolve","then","reject","iconRetinaUrl","iconSize","iconAnchor","popupAnchor","tooltipAnchor","shadowUrl","shadowRetinaUrl","shadowSize","shadowAnchor","className","LTooltip","tooltip","attName","_","setContent","positionalArguments","methodName","option","defaultValue","camel","s","letter","idx","toLowerCase","join","parser","inferParser","_OPTIONS","circle","path","polyline","polygon","rectangle","interactiveLayer","inheritance","flatMap","parent","INHERITS","chain","length","push","settings","result","o","LeafletHTMLError","_Error","message","Error","generator","cls","bindTooltip","args","positional","apply","concat","_opt","find","parsedValue","Circle","setRadius","Rectangle","setLatLngs","Polygon","Polyline","_layer$setStyle","opt","setStyle","setter","opts","attributes","init"],"mappings":"y7CAAaA,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,OAHjB,CAAA,EAEG,CAAE,GAGlBZ,KAAKI,iBAAiBT,EAAU,SAACU,GAC/B,IAAAQ,EAA8BR,EAAGC,OAAzBQ,EAAID,EAAJC,KAAMC,EAAIF,EAAJE,KAAMC,EAAKH,EAALG,MACP,YAATF,EACFJ,EAAcO,WAAWD,EAAOD,GACd,SAATD,GACTJ,EAAcQ,aAAaF,EAAOD,GAEpCV,EAAGc,gBACL,GAEA,IAAMC,EAAQ,IAAIC,YAAY1B,EAAU,CACtC2B,YAAY,EACZC,SAAS,EACTjB,OAAQ,CACNU,MAAON,KAGXV,KAAKwB,cAAcJ,EACrB,EAACX,CAAA,CA9BiB,cA8BjBF,EA9B0BC,cCLvBiB,eAAM3B,SAAAA,GACV,SAAA2B,IAAcC,IAAAA,EAEKA,OADjBA,EAAA5B,EAAAC,KAAMC,aACDgB,MAAQ,KAAIU,CACnB,CAACD,OAAAxB,EAAAwB,EAAA3B,GAAA2B,CAAA,CAJS3B,cAITS,EAJkBC,cCKfmB,eAAW,SAA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mBAAoBqB,GAC1CtB,eAAeC,OAAO,kBAAmByB,GACzC1B,eAAeC,OAAO,kBAAmBiC,GACzClC,eAAeC,OAAO,YAAasC,GACnCvC,eAAeC,OAAO,SAAU6C,GAChC9C,eAAeC,OAAO,WAAYoG,EAAUpB,EAAQ,WACpDjF,eAAeC,OAAO,aAAcoG,EAAUlB,EAAU,aACxDnF,eAAeC,OAAO,YAAaoG,EAAUjB,EAAS,YACtDpF,eAAeC,OAAO,cAAeoG,EAAUhB,EAAW,mBAC1DrF,eAAeC,OAAO,YAAa8D"}
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "leaflet-html",
3
3
  "type": "module",
4
- "version": "0.4.0",
4
+ "version": "0.6.0",
5
5
  "description": "Leaflet expressed in HTML",
6
6
  "keywords": [
7
- "leaflet",
8
- "hda",
9
- "html",
10
- "hypermedia",
11
- "maps"
7
+ "leaflet",
8
+ "hda",
9
+ "html",
10
+ "hypermedia",
11
+ "maps"
12
12
  ],
13
13
  "source": "src/index.js",
14
14
  "main": "./dist/leaflet-html.cjs",
@@ -26,9 +26,12 @@
26
26
  "scripts": {
27
27
  "build": "microbundle --format esm",
28
28
  "watch": "microbundle watch -o ./docs/static --format esm",
29
- "test": "vitest"
29
+ "test": "vitest",
30
+ "coverage": "vitest run --coverage",
31
+ "coverage:watch": "vitest watch --coverage"
30
32
  },
31
33
  "devDependencies": {
34
+ "@vitest/coverage-v8": "^1.6.0",
32
35
  "happy-dom": "^14.10.1",
33
36
  "microbundle": "^0.15.1",
34
37
  "prettier": "3.2.5",