leaflet-html 0.1.6 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,7 +9,19 @@ jobs:
9
9
  runs-on: ubuntu-latest
10
10
  steps:
11
11
  - name: Checkout repository
12
- uses: actions/checkout@v2
12
+ uses: actions/checkout@v4
13
+ - name: Set Node.js
14
+ uses: actions/setup-node@v4
15
+ with:
16
+ node-version: 21
17
+ - name: Install
18
+ uses: borales/actions-yarn@v4
19
+ with:
20
+ cmd: install
21
+ - name: Build
22
+ uses: borales/actions-yarn@v4
23
+ with:
24
+ cmd: build
13
25
  - name: Publish if version has been updated
14
26
  uses: pascalgn/npm-publish-action@1.3.9
15
27
  with:
package/README.md CHANGED
@@ -8,6 +8,34 @@ Fine grained reactive frameworks such as [Solid JS](https://solidjs.com) or [Van
8
8
 
9
9
  RESTful frameworks, like [HTMX](Https://htmx.org), that serve HTML over the wire are perfect choices for server rendered content.
10
10
 
11
+ ## Usage
12
+
13
+ Include both Leaflet and Leaflet HTML in script tags in the head of the document.
14
+
15
+ ```html
16
+ <link
17
+ rel="stylesheet"
18
+ href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"
19
+ integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="
20
+ crossorigin=""
21
+ />
22
+ <script
23
+ src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"
24
+ integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="
25
+ crossorigin=""
26
+ ></script>
27
+ <script src="https://unpkg.com/leaflet-html@latest/leaflet-html.umd.js"></script>
28
+ ```
29
+
30
+ And remember to style the various map container elements with enough size to be visible.
31
+
32
+ ```css
33
+ l-map {
34
+ display: block;
35
+ block-size: 100vh;
36
+ }
37
+ ```
38
+
11
39
  ## Example
12
40
 
13
41
  The HTML in `example/index.html` is a simple demonstration of the API.
@@ -16,41 +44,40 @@ The HTML in `example/index.html` is a simple demonstration of the API.
16
44
 
17
45
  ```html
18
46
  <!-- Note: Leaflet JS/CSS must be included in <head> and [data-leaflet-html] styled to an appropriate size. -->
19
- <div data-leaflet-html data-center="[39.61, -105.02]" data-zoom="10">
20
- <div data-control-layers>
21
- <div data-base-maps>
22
- <div data-tile-layer
23
- data-name="OpenStreetMap"
24
- data-url-template="https://tile.openstreetmap.org/{z}/{x}/{y}.png"
25
- data-attribution='&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
26
- data-max-zoom="12"
27
- ></div>
28
- <div data-tile-layer
29
- data-name="Toner"
30
- data-url-template="https://tiles.stadiamaps.com/tiles/stamen_toner/{z}/{x}/{y}{r}.png"
31
- data-attribution=''
32
- data-max-zoom="12"
33
- data-show
34
- ></div>
35
- </div>
36
- <div data-overlay-maps>
37
- <div data-layer-group data-name="Cities">
38
- <div data-marker data-lat-lng="[39.61, -105.02]">
39
- <div data-popup data-content="This is Littleton, CO."></div>
40
- </div>
41
- <div data-marker data-lat-lng="[39.74, -104.99]">
42
- <div data-popup data-content="This is Denver, CO."></div>
43
- </div>
44
- <div data-marker data-lat-lng="[39.73, -104.8]">
45
- <div data-popup data-content="This is Aurora, CO."></div>
46
- </div>
47
- <div data-marker data-lat-lng="[39.77, -105.23]">
48
- <div data-popup data-content="This is Golden, CO."></div>
49
- </div>
50
- </div>
51
- </div>
52
- </div>
53
- </div>
47
+ <l-map center="[39.61, -105.02]" zoom="10">
48
+ <l-control-layers>
49
+ <l-base-layers>
50
+ <l-tile-layer
51
+ name="OpenStreetMap"
52
+ url-template="https://tile.openstreetmap.org/{z}/{x}/{y}.png"
53
+ attribution='&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
54
+ max-zoom="12"
55
+ ></l-tile-layer>
56
+ <l-tile-layer
57
+ name="Toner"
58
+ url-template="https://tiles.stadiamaps.com/tiles/stamen_toner/{z}/{x}/{y}{r}.png"
59
+ attribution=''
60
+ max-zoom="12"
61
+ ></l-tile-layer>
62
+ </l-base-layers>
63
+ <l-overlay-layers>
64
+ <l-layer-group name="Cities">
65
+ <l-marker lat-lng="[39.61, -105.02]">
66
+ <l-popup content="This is Littleton, CO."></l-popup>
67
+ </l-marker>
68
+ <l-marker lat-lng="[39.74, -104.99]">
69
+ <l-popup content="This is Denver, CO."></l-popup>
70
+ </l-marker>
71
+ <l-marker lat-lng="[39.73, -104.8]">
72
+ <l-popup content="This is Aurora, CO."></l-popup>
73
+ </l-marker>
74
+ <l-marker lat-lng="[39.77, -105.23]">
75
+ <l-popup content="This is Golden, CO."></l-popup>
76
+ </l-marker>
77
+ </l-layer-group>
78
+ </l-overlay-layers>
79
+ </l-control-layers>
80
+ </l-map>
54
81
  ```
55
82
 
56
83
  ## Build
@@ -0,0 +1,2 @@
1
+ function t(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(t=function(){return!!e})()}function e(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,r(t,e)}function n(t){return n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},n(t)}function r(t,e){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},r(t,e)}function a(e){var i="function"==typeof Map?new Map:void 0;return a=function(e){if(null===e||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==i){if(i.has(e))return i.get(e);i.set(e,a)}function a(){return function(e,n,a){if(t())return Reflect.construct.apply(null,arguments);var i=[null];i.push.apply(i,n);var o=new(e.bind.apply(e,i));return a&&r(o,a.prototype),o}(e,arguments,n(this).constructor)}return a.prototype=Object.create(e.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),r(a,e)},a(e)}var i="map:addTo",o="popup:add",l=/*#__PURE__*/function(t){function n(){return t.call(this)||this}return e(n,t),n.prototype.connectedCallback=function(){this.addEventListener(i,function(t){t.detail.type="base"})},n}(/*#__PURE__*/a(HTMLElement)),u=/*#__PURE__*/function(t){function n(){return t.call(this)||this}return e(n,t),n.prototype.connectedCallback=function(){var t=L.control.layers({},{});this.addEventListener(i,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 e=new CustomEvent(i,{cancelable:!0,bubbles:!0,detail:{layer:t}});this.dispatchEvent(e)},n}(/*#__PURE__*/a(HTMLElement)),s=/*#__PURE__*/function(t){function n(){return t.call(this)||this}return e(n,t),n.prototype.connectedCallback=function(){var t=this.getAttribute("name"),e=L.layerGroup(),n=new CustomEvent(i,{cancelable:!0,bubbles:!0,detail:{layer:e,name:t}});this.dispatchEvent(n),this.addEventListener(i,function(t){t.stopPropagation(),e.addLayer(t.detail.layer)}),new MutationObserver(function(t){t.forEach(function(t){t.removedNodes.forEach(function(t){var n=t.getAttribute("leaflet-id"),r=e.getLayer(n);e.removeLayer(r)})})}).observe(this,{childList:!0})},n}(/*#__PURE__*/a(HTMLElement)),c=/*#__PURE__*/function(t){function n(){var e;return(e=t.call(this)||this).map=null,e.addEventListener("map:bounds",function(t){var n=t.detail;e.map[n.method](n.bounds)}),e}return e(n,t),n.prototype.connectedCallback=function(){var t=this;this.map=L.map(this);var e=this.getAttribute("center"),n=this.getAttribute("zoom");null!==e&&null!==n&&this.map.setView(JSON.parse(e),parseInt(n)),this.addEventListener(i,function(e){e.detail.layer.addTo(t.map)}),this.addEventListener("layer:remove",function(e){t.map.remove(e.detail.layer)})},n}(/*#__PURE__*/a(HTMLElement)),p=/*#__PURE__*/function(t){function n(){var e;return(e=t.call(this)||this).layer=null,e}e(n,t);var r=n.prototype;return r.connectedCallback=function(){var t=this,e=JSON.parse(this.getAttribute("lat-lng")),n=parseFloat(this.getAttribute("opacity")||"1.0");this.layer=L.marker(e,{opacity:n}),this.setAttribute("leaflet-id",L.stamp(this.layer)),this.addEventListener(o,function(e){t.layer.bindPopup(e.detail.content)});var r=new CustomEvent(i,{cancelable:!0,bubbles:!0,detail:{layer:this.layer}});this.dispatchEvent(r)},r.attributeChangedCallback=function(t,e,n){null!==this.layer&&("lat-lng"===t&&this.layer.setLatLng(JSON.parse(n)),"opacity"===t&&this.layer.setOpacity(parseFloat(n)))},n}(/*#__PURE__*/a(HTMLElement));p.observedAttributes=["lat-lng","opacity"];var d=/*#__PURE__*/function(t){function n(){return t.call(this)||this}return e(n,t),n.prototype.connectedCallback=function(){this.addEventListener(i,function(t){t.detail.type="overlay"})},n}(/*#__PURE__*/a(HTMLElement)),b=/*#__PURE__*/function(t){function n(){return t.call(this)||this}return e(n,t),n.prototype.connectedCallback=function(){var t=this.getAttribute("content"),e=new CustomEvent(o,{cancelable:!0,bubbles:!0,detail:{content:t}});this.dispatchEvent(e)},n}(/*#__PURE__*/a(HTMLElement)),h=/*#__PURE__*/function(t){function n(){return t.call(this)||this}return e(n,t),n.prototype.connectedCallback=function(){var t=this.getAttribute("name"),e=this.getAttribute("url-template"),n=this.getAttribute("attribution"),r=L.tileLayer(e,{attribution:n}),a=new CustomEvent(i,{detail:{name:t,layer:r},bubbles:!0});this.dispatchEvent(a)},n}(/*#__PURE__*/a(HTMLElement)),f=/*#__PURE__*/function(t){function n(){return t.call(this)||this}return e(n,t),n.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)},n}(/*#__PURE__*/a(HTMLElement));f.observedAttributes=["bounds"];var y=/*#__PURE__*/function(t){function n(){var e;return(e=t.call(this)||this).layer=null,e}e(n,t);var r=n.prototype;return r.connectedCallback=function(){var t=this.getAttribute("url"),e=JSON.parse(this.getAttribute("bounds")),n={opacity:parseFloat(this.getAttribute("opacity")||"1.0"),alt:this.getAttribute("alt")||""};this.layer=L.imageOverlay(t,e,n),this.dispatchEvent(new CustomEvent(i,{cancelable:!0,bubbles:!0,detail:{layer:this.layer}}))},r.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)))},n}(/*#__PURE__*/a(HTMLElement));y.observedAttributes=["url","bounds","opacity"];var v=/*#__PURE__*/function(t){function n(){return t.call(this)||this}return e(n,t),n.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=L.videoOverlay(t,e,n);this.dispatchEvent(new CustomEvent(i,{cancelable:!0,bubbles:!0,detail:{layer:r}}))},n}(/*#__PURE__*/a(HTMLElement)),m=/*#__PURE__*/function(t){function n(){return t.call(this)||this}return e(n,t),n.prototype.connectedCallback=function(){var t=L.geoJSON(JSON.parse(this.getAttribute("geojson")));this.dispatchEvent(new CustomEvent(i,{bubbles:!0,cancelable:!0,detail:{layer:t}}))},n}(/*#__PURE__*/a(HTMLElement)),E=(customElements.define("l-map",c),customElements.define("l-control-layers",u),customElements.define("l-base-layers",l),customElements.define("l-overlay-layers",d),customElements.define("l-layer-group",s),customElements.define("l-tile-layer",h),customElements.define("l-marker",p),customElements.define("l-popup",b),customElements.define("l-lat-lng-bounds",f),customElements.define("l-image-overlay",y),customElements.define("l-video-overlay",v),void customElements.define("l-geojson",m));module.exports=E;
2
+ //# sourceMappingURL=leaflet-html.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"leaflet-html.cjs","sources":["../src/events.js","../src/l-base-layers.js","../src/l-control-layers.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/index.js"],"sourcesContent":["export const mapAddTo = \"map:addTo\"\nexport const popupAdd = \"popup:add\"\nexport const layerRemove = \"layer:remove\"\n","import { 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\n","import { mapAddTo } from \"./events.js\"\n\nclass LControlLayers extends HTMLElement {\n constructor() {\n super()\n }\n \n connectedCallback() {\n const base = {}\n const overlay = {}\n const control = L.control.layers(base, overlay)\n\n this.addEventListener(mapAddTo, (ev) => {\n const { type, name, layer } = ev.detail\n if (type === \"overlay\") {\n control.addOverlay(layer, name)\n } else if (type === \"base\") {\n control.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: control\n }\n })\n this.dispatchEvent(event)\n }\n}\n\nexport default LControlLayers\n","import { mapAddTo } from \"./events.js\"\n\nclass LLayerGroup extends HTMLElement {\n constructor() {\n super()\n }\n \n connectedCallback() {\n const name = this.getAttribute(\"name\")\n const group = L.layerGroup()\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 const leafletId = node.getAttribute(\"leaflet-id\");\n const layer = group.getLayer(leafletId);\n group.removeLayer(layer);\n });\n });\n });\n observer.observe(this, { childList: true })\n }\n}\n\nexport default LLayerGroup\n","// @ts-check\nimport { layerRemove, mapAddTo } from \"./events.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 this.map[method](bounds)\n })\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 this.map.remove(ev.detail.layer)\n })\n }\n}\n\nexport default LMap\n","import { mapAddTo, popupAdd } from \"./events.js\"; \n\nclass LMarker extends HTMLElement {\n static observedAttributes = [\"lat-lng\", \"opacity\"]\n\n constructor() {\n super()\n this.layer = null\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 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 }\n }\n}\n\n\nexport default LMarker\n","import { 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","import { 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\n\nexport default LPopup\n\n","import { mapAddTo } from \"./events.js\"\n\nclass LTileLayer extends HTMLElement {\n constructor() {\n super()\n }\n\n connectedCallback() {\n const name = this.getAttribute(\"name\")\n const urlTemplate = this.getAttribute(\"url-template\")\n const attribution = this.getAttribute(\"attribution\")\n const options = { attribution }\n const layer = L.tileLayer(urlTemplate, options)\n const event = new CustomEvent(mapAddTo, { detail: { name, layer }, bubbles: true})\n this.dispatchEvent(event)\n }\n}\n\nexport default LTileLayer\n","class 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","import { mapAddTo } from \"./events.js\"\n\nclass LImageOverlay extends HTMLElement {\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 const bounds = JSON.parse(this.getAttribute(\"bounds\"))\n const options = {\n opacity: parseFloat(this.getAttribute(\"opacity\") || \"1.0\"),\n alt: this.getAttribute(\"alt\") || \"\"\n }\n this.layer = L.imageOverlay(url, bounds, options)\n this.dispatchEvent(new CustomEvent(mapAddTo, {\n cancelable: true,\n bubbles: true,\n detail: {\n layer: this.layer\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","import { mapAddTo } from \"./events.js\"\n\nclass LVideoOverlay extends HTMLElement {\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 = L.videoOverlay(url, bounds, options)\n this.dispatchEvent(new CustomEvent(mapAddTo, {\n cancelable: true,\n bubbles: true,\n detail: {\n layer\n }\n }))\n }\n}\n\nexport default LVideoOverlay\n\n","import { mapAddTo } from \"./events.js\"\n\nclass LGeoJSON extends HTMLElement {\n constructor() {\n super()\n }\n\n connectedCallback() {\n const layer = L.geoJSON(JSON.parse(this.getAttribute(\"geojson\")))\n this.dispatchEvent(new CustomEvent(mapAddTo, {\n bubbles: true,\n cancelable: true,\n detail: {\n layer\n }\n }))\n }\n}\n\nexport default LGeoJSON\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\";\n\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})();\n\nexport default init;\n"],"names":["mapAddTo","popupAdd","LBaseLayers","_HTMLElement","call","this","_inheritsLoose","prototype","connectedCallback","addEventListener","ev","detail","_wrapNativeSuper","HTMLElement","LControlLayers","control","L","layers","_ev$detail","type","name","layer","addOverlay","addBaseLayer","preventDefault","event","CustomEvent","cancelable","bubbles","dispatchEvent","LLayerGroup","getAttribute","group","layerGroup","stopPropagation","addLayer","MutationObserver","mutations","forEach","mutation","removedNodes","node","leafletId","getLayer","removeLayer","observe","childList","LMap","_this","map","method","bounds","_this2","center","zoom","setView","JSON","parse","parseInt","addTo","remove","LMarker","_proto","latLng","opacity","parseFloat","marker","setAttribute","stamp","bindPopup","content","attributeChangedCallback","_oldValue","newValue","setLatLng","setOpacity","observedAttributes","LOverlayLayers","LPopup","LTileLayer","urlTemplate","attribution","tileLayer","LLatLngBounds","_name","LImageOverlay","url","options","alt","imageOverlay","setUrl","setBounds","LVideoOverlay","autoplay","muted","playsInline","videoOverlay","LGeoJSON","geoJSON","init","customElements","define"],"mappings":"orCAAaA,EAAW,YACXC,EAAW,YCClBC,eAAW,SAAAC,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,CATc,cASdU,EATuBC,cCApBC,eAAc,SAAAX,GAClB,SAAAW,IAAc,OACZX,EAAAC,KAAMC,WACR,CAyBC,OAzBAC,EAAAQ,EAAAX,GAAAW,EAAAP,UAEDC,kBAAA,WACE,IAEMO,EAAUC,EAAED,QAAQE,OAFb,CAAA,EACG,CAAE,GAGlBZ,KAAKI,iB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AeC,OAAO,gBAAiBvE,GACvCsE,eAAeC,OAAO,eAAgBtB,GACtCqB,eAAeC,OAAO,WAAYxC,GAClCuC,eAAeC,OAAO,UAAWvB,GACjCsB,eAAeC,OAAO,mBAAoBlB,GAC1CiB,eAAeC,OAAO,kBAAmBhB,GACzCe,eAAeC,OAAO,kBAAmBT,QACzCQ,eAAeC,OAAO,YAAaJ"}
@@ -0,0 +1,2 @@
1
+ function t(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(t=function(){return!!e})()}function e(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,r(t,e)}function n(t){return n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},n(t)}function r(t,e){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},r(t,e)}function a(e){var i="function"==typeof Map?new Map:void 0;return a=function(e){if(null===e||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==i){if(i.has(e))return i.get(e);i.set(e,a)}function a(){return function(e,n,a){if(t())return Reflect.construct.apply(null,arguments);var i=[null];i.push.apply(i,n);var o=new(e.bind.apply(e,i));return a&&r(o,a.prototype),o}(e,arguments,n(this).constructor)}return a.prototype=Object.create(e.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),r(a,e)},a(e)}var i="map:addTo",o="popup:add",l=/*#__PURE__*/function(t){function n(){return t.call(this)||this}return e(n,t),n.prototype.connectedCallback=function(){this.addEventListener(i,function(t){t.detail.type="base"})},n}(/*#__PURE__*/a(HTMLElement)),u=/*#__PURE__*/function(t){function n(){return t.call(this)||this}return e(n,t),n.prototype.connectedCallback=function(){var t=L.control.layers({},{});this.addEventListener(i,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 e=new CustomEvent(i,{cancelable:!0,bubbles:!0,detail:{layer:t}});this.dispatchEvent(e)},n}(/*#__PURE__*/a(HTMLElement)),s=/*#__PURE__*/function(t){function n(){return t.call(this)||this}return e(n,t),n.prototype.connectedCallback=function(){var t=this.getAttribute("name"),e=L.layerGroup(),n=new CustomEvent(i,{cancelable:!0,bubbles:!0,detail:{layer:e,name:t}});this.dispatchEvent(n),this.addEventListener(i,function(t){t.stopPropagation(),e.addLayer(t.detail.layer)}),new MutationObserver(function(t){t.forEach(function(t){t.removedNodes.forEach(function(t){var n=t.getAttribute("leaflet-id"),r=e.getLayer(n);e.removeLayer(r)})})}).observe(this,{childList:!0})},n}(/*#__PURE__*/a(HTMLElement)),c=/*#__PURE__*/function(t){function n(){var e;return(e=t.call(this)||this).map=null,e.addEventListener("map:bounds",function(t){var n=t.detail;e.map[n.method](n.bounds)}),e}return e(n,t),n.prototype.connectedCallback=function(){var t=this;this.map=L.map(this);var e=this.getAttribute("center"),n=this.getAttribute("zoom");null!==e&&null!==n&&this.map.setView(JSON.parse(e),parseInt(n)),this.addEventListener(i,function(e){e.detail.layer.addTo(t.map)}),this.addEventListener("layer:remove",function(e){t.map.remove(e.detail.layer)})},n}(/*#__PURE__*/a(HTMLElement)),p=/*#__PURE__*/function(t){function n(){var e;return(e=t.call(this)||this).layer=null,e}e(n,t);var r=n.prototype;return r.connectedCallback=function(){var t=this,e=JSON.parse(this.getAttribute("lat-lng")),n=parseFloat(this.getAttribute("opacity")||"1.0");this.layer=L.marker(e,{opacity:n}),this.setAttribute("leaflet-id",L.stamp(this.layer)),this.addEventListener(o,function(e){t.layer.bindPopup(e.detail.content)});var r=new CustomEvent(i,{cancelable:!0,bubbles:!0,detail:{layer:this.layer}});this.dispatchEvent(r)},r.attributeChangedCallback=function(t,e,n){null!==this.layer&&("lat-lng"===t&&this.layer.setLatLng(JSON.parse(n)),"opacity"===t&&this.layer.setOpacity(parseFloat(n)))},n}(/*#__PURE__*/a(HTMLElement));p.observedAttributes=["lat-lng","opacity"];var d=/*#__PURE__*/function(t){function n(){return t.call(this)||this}return e(n,t),n.prototype.connectedCallback=function(){this.addEventListener(i,function(t){t.detail.type="overlay"})},n}(/*#__PURE__*/a(HTMLElement)),b=/*#__PURE__*/function(t){function n(){return t.call(this)||this}return e(n,t),n.prototype.connectedCallback=function(){var t=this.getAttribute("content"),e=new CustomEvent(o,{cancelable:!0,bubbles:!0,detail:{content:t}});this.dispatchEvent(e)},n}(/*#__PURE__*/a(HTMLElement)),f=/*#__PURE__*/function(t){function n(){return t.call(this)||this}return e(n,t),n.prototype.connectedCallback=function(){var t=this.getAttribute("name"),e=this.getAttribute("url-template"),n=this.getAttribute("attribution"),r=L.tileLayer(e,{attribution:n}),a=new CustomEvent(i,{detail:{name:t,layer:r},bubbles:!0});this.dispatchEvent(a)},n}(/*#__PURE__*/a(HTMLElement)),h=/*#__PURE__*/function(t){function n(){return t.call(this)||this}return e(n,t),n.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)},n}(/*#__PURE__*/a(HTMLElement));h.observedAttributes=["bounds"];var y=/*#__PURE__*/function(t){function n(){var e;return(e=t.call(this)||this).layer=null,e}e(n,t);var r=n.prototype;return r.connectedCallback=function(){var t=this.getAttribute("url"),e=JSON.parse(this.getAttribute("bounds")),n={opacity:parseFloat(this.getAttribute("opacity")||"1.0"),alt:this.getAttribute("alt")||""};this.layer=L.imageOverlay(t,e,n),this.dispatchEvent(new CustomEvent(i,{cancelable:!0,bubbles:!0,detail:{layer:this.layer}}))},r.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)))},n}(/*#__PURE__*/a(HTMLElement));y.observedAttributes=["url","bounds","opacity"];var v=/*#__PURE__*/function(t){function n(){return t.call(this)||this}return e(n,t),n.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=L.videoOverlay(t,e,n);this.dispatchEvent(new CustomEvent(i,{cancelable:!0,bubbles:!0,detail:{layer:r}}))},n}(/*#__PURE__*/a(HTMLElement)),m=/*#__PURE__*/function(t){function n(){return t.call(this)||this}return e(n,t),n.prototype.connectedCallback=function(){var t=L.geoJSON(JSON.parse(this.getAttribute("geojson")));this.dispatchEvent(new CustomEvent(i,{bubbles:!0,cancelable:!0,detail:{layer:t}}))},n}(/*#__PURE__*/a(HTMLElement)),E=(customElements.define("l-map",c),customElements.define("l-control-layers",u),customElements.define("l-base-layers",l),customElements.define("l-overlay-layers",d),customElements.define("l-layer-group",s),customElements.define("l-tile-layer",f),customElements.define("l-marker",p),customElements.define("l-popup",b),customElements.define("l-lat-lng-bounds",h),customElements.define("l-image-overlay",y),customElements.define("l-video-overlay",v),void customElements.define("l-geojson",m));export{E as default};
2
+ //# sourceMappingURL=leaflet-html.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"leaflet-html.esm.js","sources":["../src/events.js","../src/l-base-layers.js","../src/l-control-layers.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/index.js"],"sourcesContent":["export const mapAddTo = \"map:addTo\"\nexport const popupAdd = \"popup:add\"\nexport const layerRemove = \"layer:remove\"\n","import { 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\n","import { mapAddTo } from \"./events.js\"\n\nclass LControlLayers extends HTMLElement {\n constructor() {\n super()\n }\n \n connectedCallback() {\n const base = {}\n const overlay = {}\n const control = L.control.layers(base, overlay)\n\n this.addEventListener(mapAddTo, (ev) => {\n const { type, name, layer } = ev.detail\n if (type === \"overlay\") {\n control.addOverlay(layer, name)\n } else if (type === \"base\") {\n control.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: control\n }\n })\n this.dispatchEvent(event)\n }\n}\n\nexport default LControlLayers\n","import { mapAddTo } from \"./events.js\"\n\nclass LLayerGroup extends HTMLElement {\n constructor() {\n super()\n }\n \n connectedCallback() {\n const name = this.getAttribute(\"name\")\n const group = L.layerGroup()\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 const leafletId = node.getAttribute(\"leaflet-id\");\n const layer = group.getLayer(leafletId);\n group.removeLayer(layer);\n });\n });\n });\n observer.observe(this, { childList: true })\n }\n}\n\nexport default LLayerGroup\n","// @ts-check\nimport { layerRemove, mapAddTo } from \"./events.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 this.map[method](bounds)\n })\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 this.map.remove(ev.detail.layer)\n })\n }\n}\n\nexport default LMap\n","import { mapAddTo, popupAdd } from \"./events.js\"; \n\nclass LMarker extends HTMLElement {\n static observedAttributes = [\"lat-lng\", \"opacity\"]\n\n constructor() {\n super()\n this.layer = null\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 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 }\n }\n}\n\n\nexport default LMarker\n","import { 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","import { 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\n\nexport default LPopup\n\n","import { mapAddTo } from \"./events.js\"\n\nclass LTileLayer extends HTMLElement {\n constructor() {\n super()\n }\n\n connectedCallback() {\n const name = this.getAttribute(\"name\")\n const urlTemplate = this.getAttribute(\"url-template\")\n const attribution = this.getAttribute(\"attribution\")\n const options = { attribution }\n const layer = L.tileLayer(urlTemplate, options)\n const event = new CustomEvent(mapAddTo, { detail: { name, layer }, bubbles: true})\n this.dispatchEvent(event)\n }\n}\n\nexport default LTileLayer\n","class 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","import { mapAddTo } from \"./events.js\"\n\nclass LImageOverlay extends HTMLElement {\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 const bounds = JSON.parse(this.getAttribute(\"bounds\"))\n const options = {\n opacity: parseFloat(this.getAttribute(\"opacity\") || \"1.0\"),\n alt: this.getAttribute(\"alt\") || \"\"\n }\n this.layer = L.imageOverlay(url, bounds, options)\n this.dispatchEvent(new CustomEvent(mapAddTo, {\n cancelable: true,\n bubbles: true,\n detail: {\n layer: this.layer\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","import { mapAddTo } from \"./events.js\"\n\nclass LVideoOverlay extends HTMLElement {\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 = L.videoOverlay(url, bounds, options)\n this.dispatchEvent(new CustomEvent(mapAddTo, {\n cancelable: true,\n bubbles: true,\n detail: {\n layer\n }\n }))\n }\n}\n\nexport default LVideoOverlay\n\n","import { mapAddTo } from \"./events.js\"\n\nclass LGeoJSON extends HTMLElement {\n constructor() {\n super()\n }\n\n connectedCallback() {\n const layer = L.geoJSON(JSON.parse(this.getAttribute(\"geojson\")))\n this.dispatchEvent(new CustomEvent(mapAddTo, {\n bubbles: true,\n cancelable: true,\n detail: {\n layer\n }\n }))\n }\n}\n\nexport default LGeoJSON\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\";\n\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})();\n\nexport default init;\n"],"names":["mapAddTo","popupAdd","LBaseLayers","_HTMLElement","call","this","_inheritsLoose","prototype","connectedCallback","addEventListener","ev","detail","_wrapNativeSuper","HTMLElement","LControlLayers","control","L","layers","_ev$detail","type","name","layer","addOverlay","addBaseLayer","preventDefault","event","CustomEvent","cancelable","bubbles","dispatchEvent","LLayerGroup","getAttribute","group","layerGroup","stopPropagation","addLayer","MutationObserver","mutations","forEach","mutation","removedNodes","node","leafletId","getLayer","removeLayer","observe","childList","LMap","_this","map","method","bounds","_this2","center","zoom","setView","JSON","parse","parseInt","addTo","remove","LMarker","_proto","latLng","opacity","parseFloat","marker","setAttribute","stamp","bindPopup","content","attributeChangedCallback","_oldValue","newValue","setLatLng","setOpacity","observedAttributes","LOverlayLayers","LPopup","LTileLayer","urlTemplate","attribution","tileLayer","LLatLngBounds","_name","LImageOverlay","url","options","alt","imageOverlay","setUrl","setBounds","LVideoOverlay","autoplay","muted","playsInline","videoOverlay","LGeoJSON","geoJSON","init","customElements","define"],"mappings":"orCAAaA,EAAW,YACXC,EAAW,YCClBC,eAAW,SAAAC,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,CATc,cASdU,EATuBC,cCApBC,eAAc,SAAAX,GAClB,SAAAW,IAAc,OACZX,EAAAC,KAAMC,WACR,CAyBC,OAzBAC,EAAAQ,EAAAX,GAAAW,EAAAP,UAEDC,kBAAA,WACE,IAEMO,EAAUC,EAAED,QAAQE,OAFb,CAAA,EACG,CAAE,GAGlBZ,KAAKI,iBAAiBT,EAAU,SAACU,GAC/B,IAAAQ,EAA8BR,EAAGC,OAAzBQ,EAAID,EAAJC,KAAMC,EAAIF,EAAJE,KAAMC,EAAKH,EAALG,MACP,YAATF,EACFJ,EAAQO,WAAWD,EAAOD,GACR,SAATD,GACTJ,EAAQQ,aAAaF,EAAOD,GAE9BV,EAAGc,gBACL,GAEA,IAAMC,EAAQ,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"}
@@ -0,0 +1,2 @@
1
+ const t="map:addTo",e="popup:add";class s extends HTMLElement{constructor(){super()}connectedCallback(){this.addEventListener(t,t=>{t.detail.type="base"})}}class a extends HTMLElement{constructor(){super()}connectedCallback(){const e=L.control.layers({},{});this.addEventListener(t,t=>{const{type:s,name:a,layer:l}=t.detail;"overlay"===s?e.addOverlay(l,a):"base"===s&&e.addBaseLayer(l,a),t.preventDefault()});const s=new CustomEvent(t,{cancelable:!0,bubbles:!0,detail:{layer:e}});this.dispatchEvent(s)}}class l extends HTMLElement{constructor(){super()}connectedCallback(){const e=this.getAttribute("name"),s=L.layerGroup(),a=new CustomEvent(t,{cancelable:!0,bubbles:!0,detail:{layer:s,name:e}});this.dispatchEvent(a),this.addEventListener(t,t=>{t.stopPropagation(),s.addLayer(t.detail.layer)}),new MutationObserver(function(t){t.forEach(t=>{t.removedNodes.forEach(t=>{const e=t.getAttribute("leaflet-id"),a=s.getLayer(e);s.removeLayer(a)})})}).observe(this,{childList:!0})}}class n extends HTMLElement{constructor(){super(),this.map=null,this.addEventListener("map:bounds",t=>{const{bounds:e,method:s}=t.detail;this.map[s](e)})}connectedCallback(){this.map=L.map(this);const e=this.getAttribute("center"),s=this.getAttribute("zoom");null!==e&&null!==s&&this.map.setView(JSON.parse(e),parseInt(s)),this.addEventListener(t,t=>{t.detail.layer.addTo(this.map)}),this.addEventListener("layer:remove",t=>{this.map.remove(t.detail.layer)})}}class i extends HTMLElement{constructor(){super(),this.layer=null}connectedCallback(){const s=JSON.parse(this.getAttribute("lat-lng")),a=parseFloat(this.getAttribute("opacity")||"1.0");this.layer=L.marker(s,{opacity:a}),this.setAttribute("leaflet-id",L.stamp(this.layer)),this.addEventListener(e,t=>{const{content:e}=t.detail;this.layer.bindPopup(e)});const l=new CustomEvent(t,{cancelable:!0,bubbles:!0,detail:{layer:this.layer}});this.dispatchEvent(l)}attributeChangedCallback(t,e,s){null!==this.layer&&("lat-lng"===t&&this.layer.setLatLng(JSON.parse(s)),"opacity"===t&&this.layer.setOpacity(parseFloat(s)))}}i.observedAttributes=["lat-lng","opacity"];class r extends HTMLElement{constructor(){super()}connectedCallback(){this.addEventListener(t,t=>{t.detail.type="overlay"})}}class o extends HTMLElement{constructor(){super()}connectedCallback(){const t=this.getAttribute("content"),s=new CustomEvent(e,{cancelable:!0,bubbles:!0,detail:{content:t}});this.dispatchEvent(s)}}class c extends HTMLElement{constructor(){super()}connectedCallback(){const e=this.getAttribute("name"),s=this.getAttribute("url-template"),a=this.getAttribute("attribution"),l=L.tileLayer(s,{attribution:a}),n=new CustomEvent(t,{detail:{name:e,layer:l},bubbles:!0});this.dispatchEvent(n)}}class d extends HTMLElement{constructor(){super()}attributeChangedCallback(t,e,s){const a=new CustomEvent("map:bounds",{bubbles:!0,detail:{bounds:JSON.parse(s),method:this.getAttribute("method")||"fitBounds"}});this.dispatchEvent(a)}}d.observedAttributes=["bounds"];class u extends HTMLElement{constructor(){super(),this.layer=null}connectedCallback(){const e=this.getAttribute("url"),s=JSON.parse(this.getAttribute("bounds")),a={opacity:parseFloat(this.getAttribute("opacity")||"1.0"),alt:this.getAttribute("alt")||""};this.layer=L.imageOverlay(e,s,a),this.dispatchEvent(new CustomEvent(t,{cancelable:!0,bubbles:!0,detail:{layer:this.layer}}))}attributeChangedCallback(t,e,s){null!==this.layer&&("url"===t?this.layer.setUrl(s):"bounds"===t?this.layer.setBounds(JSON.parse(s)):"opacity"===t&&this.layer.setOpacity(parseFloat(s)))}}u.observedAttributes=["url","bounds","opacity"];class b extends HTMLElement{constructor(){super()}connectedCallback(){const e=JSON.parse(this.getAttribute("url")),s=JSON.parse(this.getAttribute("bounds")),a={opacity:parseFloat(this.getAttribute("opacity")||"1.0"),alt:this.getAttribute("alt")||"",autoplay:!0,muted:!0,playsInline:!0},l=L.videoOverlay(e,s,a);this.dispatchEvent(new CustomEvent(t,{cancelable:!0,bubbles:!0,detail:{layer:l}}))}}class p extends HTMLElement{constructor(){super()}connectedCallback(){const e=L.geoJSON(JSON.parse(this.getAttribute("geojson")));this.dispatchEvent(new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:{layer:e}}))}}const h=(customElements.define("l-map",n),customElements.define("l-control-layers",a),customElements.define("l-base-layers",s),customElements.define("l-overlay-layers",r),customElements.define("l-layer-group",l),customElements.define("l-tile-layer",c),customElements.define("l-marker",i),customElements.define("l-popup",o),customElements.define("l-lat-lng-bounds",d),customElements.define("l-image-overlay",u),customElements.define("l-video-overlay",b),void customElements.define("l-geojson",p));export{h as default};
2
+ //# sourceMappingURL=leaflet-html.js.map
@@ -0,0 +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-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/index.js"],"sourcesContent":["export const mapAddTo = \"map:addTo\"\nexport const popupAdd = \"popup:add\"\nexport const layerRemove = \"layer:remove\"\n","import { 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\n","import { mapAddTo } from \"./events.js\"\n\nclass LControlLayers extends HTMLElement {\n constructor() {\n super()\n }\n \n connectedCallback() {\n const base = {}\n const overlay = {}\n const control = L.control.layers(base, overlay)\n\n this.addEventListener(mapAddTo, (ev) => {\n const { type, name, layer } = ev.detail\n if (type === \"overlay\") {\n control.addOverlay(layer, name)\n } else if (type === \"base\") {\n control.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: control\n }\n })\n this.dispatchEvent(event)\n }\n}\n\nexport default LControlLayers\n","import { mapAddTo } from \"./events.js\"\n\nclass LLayerGroup extends HTMLElement {\n constructor() {\n super()\n }\n \n connectedCallback() {\n const name = this.getAttribute(\"name\")\n const group = L.layerGroup()\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 const leafletId = node.getAttribute(\"leaflet-id\");\n const layer = group.getLayer(leafletId);\n group.removeLayer(layer);\n });\n });\n });\n observer.observe(this, { childList: true })\n }\n}\n\nexport default LLayerGroup\n","// @ts-check\nimport { layerRemove, mapAddTo } from \"./events.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 this.map[method](bounds)\n })\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 this.map.remove(ev.detail.layer)\n })\n }\n}\n\nexport default LMap\n","import { mapAddTo, popupAdd } from \"./events.js\"; \n\nclass LMarker extends HTMLElement {\n static observedAttributes = [\"lat-lng\", \"opacity\"]\n\n constructor() {\n super()\n this.layer = null\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 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 }\n }\n}\n\n\nexport default LMarker\n","import { 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","import { 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\n\nexport default LPopup\n\n","import { mapAddTo } from \"./events.js\"\n\nclass LTileLayer extends HTMLElement {\n constructor() {\n super()\n }\n\n connectedCallback() {\n const name = this.getAttribute(\"name\")\n const urlTemplate = this.getAttribute(\"url-template\")\n const attribution = this.getAttribute(\"attribution\")\n const options = { attribution }\n const layer = L.tileLayer(urlTemplate, options)\n const event = new CustomEvent(mapAddTo, { detail: { name, layer }, bubbles: true})\n this.dispatchEvent(event)\n }\n}\n\nexport default LTileLayer\n","class 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","import { mapAddTo } from \"./events.js\"\n\nclass LImageOverlay extends HTMLElement {\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 const bounds = JSON.parse(this.getAttribute(\"bounds\"))\n const options = {\n opacity: parseFloat(this.getAttribute(\"opacity\") || \"1.0\"),\n alt: this.getAttribute(\"alt\") || \"\"\n }\n this.layer = L.imageOverlay(url, bounds, options)\n this.dispatchEvent(new CustomEvent(mapAddTo, {\n cancelable: true,\n bubbles: true,\n detail: {\n layer: this.layer\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","import { mapAddTo } from \"./events.js\"\n\nclass LVideoOverlay extends HTMLElement {\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 = L.videoOverlay(url, bounds, options)\n this.dispatchEvent(new CustomEvent(mapAddTo, {\n cancelable: true,\n bubbles: true,\n detail: {\n layer\n }\n }))\n }\n}\n\nexport default LVideoOverlay\n\n","import { mapAddTo } from \"./events.js\"\n\nclass LGeoJSON extends HTMLElement {\n constructor() {\n super()\n }\n\n connectedCallback() {\n const layer = L.geoJSON(JSON.parse(this.getAttribute(\"geojson\")))\n this.dispatchEvent(new CustomEvent(mapAddTo, {\n bubbles: true,\n cancelable: true,\n detail: {\n layer\n }\n }))\n }\n}\n\nexport default LGeoJSON\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\";\n\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})();\n\nexport default init;\n"],"names":["mapAddTo","popupAdd","LBaseLayers","HTMLElement","constructor","super","connectedCallback","this","addEventListener","ev","detail","LControlLayers","control","L","layers","type","name","layer","addOverlay","addBaseLayer","preventDefault","event","CustomEvent","cancelable","bubbles","dispatchEvent","LLayerGroup","getAttribute","group","layerGroup","stopPropagation","addLayer","MutationObserver","mutations","forEach","mutation","removedNodes","node","leafletId","getLayer","removeLayer","observe","childList","LMap","map","bounds","method","center","zoom","setView","JSON","parse","parseInt","addTo","remove","LMarker","latLng","opacity","parseFloat","marker","setAttribute","stamp","content","bindPopup","attributeChangedCallback","_oldValue","newValue","setLatLng","setOpacity","observedAttributes","LOverlayLayers","LPopup","LTileLayer","urlTemplate","attribution","tileLayer","LLatLngBounds","_name","LImageOverlay","url","options","alt","imageOverlay","setUrl","setBounds","LVideoOverlay","autoplay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,eAAeC,OAAO,gBAAiB5F,GACvC2F,eAAeC,OAAO,mBAAoBxB,GAC1CuB,eAAeC,OAAO,gBAAiBpE,GACvCmE,eAAeC,OAAO,eAAgBtB,GACtCqB,eAAeC,OAAO,WAAYvC,GAClCsC,eAAeC,OAAO,UAAWvB,GACjCsB,eAAeC,OAAO,mBAAoBlB,GAC1CiB,eAAeC,OAAO,kBAAmBhB,GACzCe,eAAeC,OAAO,kBAAmBT,QACzCQ,eAAeC,OAAO,YAAaJ"}
@@ -0,0 +1,2 @@
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t||self).leafletHtml=e()}(this,function(){function t(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(t=function(){return!!e})()}function e(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,r(t,e)}function n(t){return n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},n(t)}function r(t,e){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},r(t,e)}function a(e){var i="function"==typeof Map?new Map:void 0;return a=function(e){if(null===e||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==i){if(i.has(e))return i.get(e);i.set(e,a)}function a(){return function(e,n,a){if(t())return Reflect.construct.apply(null,arguments);var i=[null];i.push.apply(i,n);var o=new(e.bind.apply(e,i));return a&&r(o,a.prototype),o}(e,arguments,n(this).constructor)}return a.prototype=Object.create(e.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),r(a,e)},a(e)}var i="map:addTo",o="popup:add",l=/*#__PURE__*/function(t){function n(){return t.call(this)||this}return e(n,t),n.prototype.connectedCallback=function(){this.addEventListener(i,function(t){t.detail.type="base"})},n}(/*#__PURE__*/a(HTMLElement)),u=/*#__PURE__*/function(t){function n(){return t.call(this)||this}return e(n,t),n.prototype.connectedCallback=function(){var t=L.control.layers({},{});this.addEventListener(i,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 e=new CustomEvent(i,{cancelable:!0,bubbles:!0,detail:{layer:t}});this.dispatchEvent(e)},n}(/*#__PURE__*/a(HTMLElement)),s=/*#__PURE__*/function(t){function n(){return t.call(this)||this}return e(n,t),n.prototype.connectedCallback=function(){var t=this.getAttribute("name"),e=L.layerGroup(),n=new CustomEvent(i,{cancelable:!0,bubbles:!0,detail:{layer:e,name:t}});this.dispatchEvent(n),this.addEventListener(i,function(t){t.stopPropagation(),e.addLayer(t.detail.layer)}),new MutationObserver(function(t){t.forEach(function(t){t.removedNodes.forEach(function(t){var n=t.getAttribute("leaflet-id"),r=e.getLayer(n);e.removeLayer(r)})})}).observe(this,{childList:!0})},n}(/*#__PURE__*/a(HTMLElement)),c=/*#__PURE__*/function(t){function n(){var e;return(e=t.call(this)||this).map=null,e.addEventListener("map:bounds",function(t){var n=t.detail;e.map[n.method](n.bounds)}),e}return e(n,t),n.prototype.connectedCallback=function(){var t=this;this.map=L.map(this);var e=this.getAttribute("center"),n=this.getAttribute("zoom");null!==e&&null!==n&&this.map.setView(JSON.parse(e),parseInt(n)),this.addEventListener(i,function(e){e.detail.layer.addTo(t.map)}),this.addEventListener("layer:remove",function(e){t.map.remove(e.detail.layer)})},n}(/*#__PURE__*/a(HTMLElement)),p=/*#__PURE__*/function(t){function n(){var e;return(e=t.call(this)||this).layer=null,e}e(n,t);var r=n.prototype;return r.connectedCallback=function(){var t=this,e=JSON.parse(this.getAttribute("lat-lng")),n=parseFloat(this.getAttribute("opacity")||"1.0");this.layer=L.marker(e,{opacity:n}),this.setAttribute("leaflet-id",L.stamp(this.layer)),this.addEventListener(o,function(e){t.layer.bindPopup(e.detail.content)});var r=new CustomEvent(i,{cancelable:!0,bubbles:!0,detail:{layer:this.layer}});this.dispatchEvent(r)},r.attributeChangedCallback=function(t,e,n){null!==this.layer&&("lat-lng"===t&&this.layer.setLatLng(JSON.parse(n)),"opacity"===t&&this.layer.setOpacity(parseFloat(n)))},n}(/*#__PURE__*/a(HTMLElement));p.observedAttributes=["lat-lng","opacity"];var d=/*#__PURE__*/function(t){function n(){return t.call(this)||this}return e(n,t),n.prototype.connectedCallback=function(){this.addEventListener(i,function(t){t.detail.type="overlay"})},n}(/*#__PURE__*/a(HTMLElement)),f=/*#__PURE__*/function(t){function n(){return t.call(this)||this}return e(n,t),n.prototype.connectedCallback=function(){var t=this.getAttribute("content"),e=new CustomEvent(o,{cancelable:!0,bubbles:!0,detail:{content:t}});this.dispatchEvent(e)},n}(/*#__PURE__*/a(HTMLElement)),b=/*#__PURE__*/function(t){function n(){return t.call(this)||this}return e(n,t),n.prototype.connectedCallback=function(){var t=this.getAttribute("name"),e=this.getAttribute("url-template"),n=this.getAttribute("attribution"),r=L.tileLayer(e,{attribution:n}),a=new CustomEvent(i,{detail:{name:t,layer:r},bubbles:!0});this.dispatchEvent(a)},n}(/*#__PURE__*/a(HTMLElement)),h=/*#__PURE__*/function(t){function n(){return t.call(this)||this}return e(n,t),n.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)},n}(/*#__PURE__*/a(HTMLElement));h.observedAttributes=["bounds"];var y=/*#__PURE__*/function(t){function n(){var e;return(e=t.call(this)||this).layer=null,e}e(n,t);var r=n.prototype;return r.connectedCallback=function(){var t=this.getAttribute("url"),e=JSON.parse(this.getAttribute("bounds")),n={opacity:parseFloat(this.getAttribute("opacity")||"1.0"),alt:this.getAttribute("alt")||""};this.layer=L.imageOverlay(t,e,n),this.dispatchEvent(new CustomEvent(i,{cancelable:!0,bubbles:!0,detail:{layer:this.layer}}))},r.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)))},n}(/*#__PURE__*/a(HTMLElement));y.observedAttributes=["url","bounds","opacity"];var m=/*#__PURE__*/function(t){function n(){return t.call(this)||this}return e(n,t),n.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=L.videoOverlay(t,e,n);this.dispatchEvent(new CustomEvent(i,{cancelable:!0,bubbles:!0,detail:{layer:r}}))},n}(/*#__PURE__*/a(HTMLElement)),v=/*#__PURE__*/function(t){function n(){return t.call(this)||this}return e(n,t),n.prototype.connectedCallback=function(){var t=L.geoJSON(JSON.parse(this.getAttribute("geojson")));this.dispatchEvent(new CustomEvent(i,{bubbles:!0,cancelable:!0,detail:{layer:t}}))},n}(/*#__PURE__*/a(HTMLElement));return customElements.define("l-map",c),customElements.define("l-control-layers",u),customElements.define("l-base-layers",l),customElements.define("l-overlay-layers",d),customElements.define("l-layer-group",s),customElements.define("l-tile-layer",b),customElements.define("l-marker",p),customElements.define("l-popup",f),customElements.define("l-lat-lng-bounds",h),customElements.define("l-image-overlay",y),customElements.define("l-video-overlay",m),void customElements.define("l-geojson",v)});
2
+ //# sourceMappingURL=leaflet-html.umd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"leaflet-html.umd.js","sources":["../src/events.js","../src/l-base-layers.js","../src/l-control-layers.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/index.js"],"sourcesContent":["export const mapAddTo = \"map:addTo\"\nexport const popupAdd = \"popup:add\"\nexport const layerRemove = \"layer:remove\"\n","import { 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\n","import { mapAddTo } from \"./events.js\"\n\nclass LControlLayers extends HTMLElement {\n constructor() {\n super()\n }\n \n connectedCallback() {\n const base = {}\n const overlay = {}\n const control = L.control.layers(base, overlay)\n\n this.addEventListener(mapAddTo, (ev) => {\n const { type, name, layer } = ev.detail\n if (type === \"overlay\") {\n control.addOverlay(layer, name)\n } else if (type === \"base\") {\n control.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: control\n }\n })\n this.dispatchEvent(event)\n }\n}\n\nexport default LControlLayers\n","import { mapAddTo } from \"./events.js\"\n\nclass LLayerGroup extends HTMLElement {\n constructor() {\n super()\n }\n \n connectedCallback() {\n const name = this.getAttribute(\"name\")\n const group = L.layerGroup()\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 const leafletId = node.getAttribute(\"leaflet-id\");\n const layer = group.getLayer(leafletId);\n group.removeLayer(layer);\n });\n });\n });\n observer.observe(this, { childList: true })\n }\n}\n\nexport default LLayerGroup\n","// @ts-check\nimport { layerRemove, mapAddTo } from \"./events.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 this.map[method](bounds)\n })\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 this.map.remove(ev.detail.layer)\n })\n }\n}\n\nexport default LMap\n","import { mapAddTo, popupAdd } from \"./events.js\"; \n\nclass LMarker extends HTMLElement {\n static observedAttributes = [\"lat-lng\", \"opacity\"]\n\n constructor() {\n super()\n this.layer = null\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 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 }\n }\n}\n\n\nexport default LMarker\n","import { 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","import { 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\n\nexport default LPopup\n\n","import { mapAddTo } from \"./events.js\"\n\nclass LTileLayer extends HTMLElement {\n constructor() {\n super()\n }\n\n connectedCallback() {\n const name = this.getAttribute(\"name\")\n const urlTemplate = this.getAttribute(\"url-template\")\n const attribution = this.getAttribute(\"attribution\")\n const options = { attribution }\n const layer = L.tileLayer(urlTemplate, options)\n const event = new CustomEvent(mapAddTo, { detail: { name, layer }, bubbles: true})\n this.dispatchEvent(event)\n }\n}\n\nexport default LTileLayer\n","class 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","import { mapAddTo } from \"./events.js\"\n\nclass LImageOverlay extends HTMLElement {\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 const bounds = JSON.parse(this.getAttribute(\"bounds\"))\n const options = {\n opacity: parseFloat(this.getAttribute(\"opacity\") || \"1.0\"),\n alt: this.getAttribute(\"alt\") || \"\"\n }\n this.layer = L.imageOverlay(url, bounds, options)\n this.dispatchEvent(new CustomEvent(mapAddTo, {\n cancelable: true,\n bubbles: true,\n detail: {\n layer: this.layer\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","import { mapAddTo } from \"./events.js\"\n\nclass LVideoOverlay extends HTMLElement {\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 = L.videoOverlay(url, bounds, options)\n this.dispatchEvent(new CustomEvent(mapAddTo, {\n cancelable: true,\n bubbles: true,\n detail: {\n layer\n }\n }))\n }\n}\n\nexport default LVideoOverlay\n\n","import { mapAddTo } from \"./events.js\"\n\nclass LGeoJSON extends HTMLElement {\n constructor() {\n super()\n }\n\n connectedCallback() {\n const layer = L.geoJSON(JSON.parse(this.getAttribute(\"geojson\")))\n this.dispatchEvent(new CustomEvent(mapAddTo, {\n bubbles: true,\n cancelable: true,\n detail: {\n layer\n }\n }))\n }\n}\n\nexport default LGeoJSON\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\";\n\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})();\n\nexport default init;\n"],"names":["mapAddTo","popupAdd","LBaseLayers","_HTMLElement","call","this","_inheritsLoose","prototype","connectedCallback","addEventListener","ev","detail","_wrapNativeSuper","HTMLElement","LControlLayers","control","L","layers","_ev$detail","type","name","layer","addOverlay","addBaseLayer","preventDefault","event","CustomEvent","cancelable","bubbles","dispatchEvent","LLayerGroup","getAttribute","group","layerGroup","stopPropagation","addLayer","MutationObserver","mutations","forEach","mutation","removedNodes","node","leafletId","getLayer","removeLayer","observe","childList","LMap","_this","map","method","bounds","_this2","center","zoom","setView","JSON","parse","parseInt","addTo","remove","LMarker","_proto","latLng","opacity","parseFloat","marker","setAttribute","stamp","bindPopup","content","attributeChangedCallback","_oldValue","newValue","setLatLng","setOpacity","observedAttributes","LOverlayLayers","LPopup","LTileLayer","urlTemplate","attribution","tileLayer","LLatLngBounds","_name","LImageOverlay","url","options","alt","imageOverlay","setUrl","setBounds","LVideoOverlay","autoplay","muted","playsInline","videoOverlay","LGeoJSON","geoJSON","customElements","define"],"mappings":"k5CAAaA,EAAW,YACXC,EAAW,YCClBC,eAAW,SAAAC,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,CATc,cASdU,EATuBC,cCApBC,eAAc,SAAAX,GAClB,SAAAW,IAAc,OACZX,EAAAC,KAAMC,WACR,CAyBC,OAzBAC,EAAAQ,EAAAX,GAAAW,EAAAP,UAEDC,kBAAA,WACE,IAEMO,EAAUC,EAAED,QAAQE,OAFb,CAAA,EACG,CAAE,GAGlBZ,KAAKI,iBAAiBT,EAAU,SAACU,GAC/B,IAAAQ,EAA8BR,EAAGC,OAAzBQ,EAAID,EAAJC,KAAMC,EAAIF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AAeC,OAAO,UAAWtB,GACjCqB,eAAeC,OAAO,mBAAoBjB,GAC1CgB,eAAeC,OAAO,kBAAmBf,GACzCc,eAAeC,OAAO,kBAAmBR,QACzCO,eAAeC,OAAO,YAAaH"}
@@ -16,71 +16,69 @@ The hierarchy in the JS API is replicated by nesting HTML elements.
16
16
 
17
17
  The following is a live running example of Leaflet HTML.
18
18
 
19
- <div data-leaflet-html data-center="[39.61, -105.02]" data-zoom="10">
20
- <div data-control-layers>
21
- <div data-base-maps>
22
- <div
23
- data-tile-layer
24
- data-name="CartoDB_Voyager"
25
- data-url-template="https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}{r}.png"
26
- data-attribution='&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors &copy; <a href="https://carto.com/attributions">CARTO</a>'
27
- data-max-zoom="20"
28
- data-subdomains="abcd"
29
- data-show
30
- ></div>
31
- </div>
32
- <div data-overlay-maps>
33
- <div data-layer-group data-name="Cities">
34
- <div data-marker data-lat-lng="[39.61, -105.02]">
35
- <div data-popup data-content="This is Littleton, CO."></div>
36
- </div>
37
- <div data-marker data-lat-lng="[39.74, -104.99]">
38
- <div data-popup data-content="This is Denver, CO."></div>
39
- </div>
40
- <div data-marker data-lat-lng="[39.73, -104.8]">
41
- <div data-popup data-content="This is Aurora, CO."></div>
42
- </div>
43
- <div data-marker data-lat-lng="[39.77, -105.23]">
44
- <div data-popup data-content="This is Golden, CO."></div>
45
- </div>
46
- </div>
47
- </div>
48
- </div>
49
- </div>
19
+ <l-map center="[39.61, -105.02]" zoom="10">
20
+ <l-control-layers>
21
+ <l-base-layers>
22
+ <l-tile-layer
23
+ name="CartoDB_Voyager"
24
+ url-template="https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}{r}.png"
25
+ attribution='&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors &copy; <a href="https://carto.com/attributions">CARTO</a>'
26
+ max-zoom="20"
27
+ subdomains="abcd"
28
+ show
29
+ ></l-tile-layer>
30
+ </l-base-layers>
31
+ <l-overlay-layers>
32
+ <l-layer-group name="Cities">
33
+ <l-marker lat-lng="[39.61, -105.02]">
34
+ <l-popup content="This is Littleton, CO."></l-popup>
35
+ </l-marker>
36
+ <l-marker lat-lng="[39.74, -104.99]">
37
+ <l-popup content="This is Denver, CO."></l-popup>
38
+ </l-marker>
39
+ <l-marker lat-lng="[39.73, -104.8]">
40
+ <l-popup content="This is Aurora, CO."></l-popup>
41
+ </l-marker>
42
+ <l-marker lat-lng="[39.77, -105.23]">
43
+ <l-popup content="This is Golden, CO."></l-popup>
44
+ </l-marker>
45
+ </l-layer-group>
46
+ </l-overlay-layers>
47
+ </l-control-layers>
48
+ </l-map>
50
49
 
51
50
 
52
51
  ```html
53
52
  <!-- Example -->
54
- <div data-leaflet-html data-center="[39.61, -105.02]" data-zoom="10">
55
- <div data-control-layers>
56
- <div data-base-maps>
57
- <div
58
- data-tile-layer
59
- data-name="CartoDB_Voyager"
60
- data-url-template="https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}{r}.png"
61
- data-attribution='&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors &copy; <a href="https://carto.com/attributions">CARTO</a>'
62
- data-max-zoom="20"
63
- data-subdomains="abcd"
64
- data-show
65
- ></div>
66
- </div>
67
- <div data-overlay-maps>
68
- <div data-layer-group data-name="Cities">
69
- <div data-marker data-lat-lng="[39.61, -105.02]">
70
- <div data-popup data-content="This is Littleton, CO."></div>
71
- </div>
72
- <div data-marker data-lat-lng="[39.74, -104.99]">
73
- <div data-popup data-content="This is Denver, CO."></div>
74
- </div>
75
- <div data-marker data-lat-lng="[39.73, -104.8]">
76
- <div data-popup data-content="This is Aurora, CO."></div>
77
- </div>
78
- <div data-marker data-lat-lng="[39.77, -105.23]">
79
- <div data-popup data-content="This is Golden, CO."></div>
80
- </div>
81
- </div>
82
- </div>
83
- </div>
84
- </div>
53
+ <l-map center="[39.61, -105.02]" zoom="10">
54
+ <l-control-layers>
55
+ <l-base-layers>
56
+ <l-tile-layer
57
+ name="CartoDB_Voyager"
58
+ url-template="https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}{r}.png"
59
+ attribution='&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors &copy; <a href="https://carto.com/attributions">CARTO</a>'
60
+ max-zoom="20"
61
+ subdomains="abcd"
62
+ show
63
+ ></l-tile-layer>
64
+ </l-base-layers>
65
+ <l-overlay-layers>
66
+ <l-layer-group name="Cities">
67
+ <l-marker lat-lng="[39.61, -105.02]">
68
+ <l-popup content="This is Littleton, CO."></l-popup>
69
+ </l-marker>
70
+ <l-marker lat-lng="[39.74, -104.99]">
71
+ <l-popup content="This is Denver, CO."></l-popup>
72
+ </l-marker>
73
+ <l-marker lat-lng="[39.73, -104.8]">
74
+ <l-popup content="This is Aurora, CO."></l-popup>
75
+ </l-marker>
76
+ <l-marker lat-lng="[39.77, -105.23]">
77
+ <l-popup content="This is Golden, CO."></l-popup>
78
+ </l-marker>
79
+ </l-layer-group>
80
+ </l-overlay-layers>
81
+ </l-control-layers>
82
+ </l-map>
85
83
  ```
86
84
 
@@ -5,30 +5,33 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
6
6
  <style>
7
7
 
8
- [data-leaflet-html] {
9
- block-size: 40ch;
10
- isolation: isolate;
11
- z-index: 1;
12
- }
8
+ l-map {
9
+ display: block;
10
+ block-size: 40ch;
11
+ isolation: isolate;
12
+ z-index: 1;
13
+ }
14
+
13
15
  body {
14
16
  font-family: system-ui;
15
17
  line-height: 1.6;
16
18
  }
17
- h1, h2 {
18
- font-weight: 100;
19
- }
20
19
 
21
- pre {
22
- padding-inline: 0.75rem;
23
- padding-block: 0.5rem;
24
- border-radius: 0.2rem;
25
- overflow-x: scroll;
26
- }
20
+ h1, h2 {
21
+ font-weight: 100;
22
+ }
23
+
24
+ pre {
25
+ padding-inline: 0.75rem;
26
+ padding-block: 0.5rem;
27
+ border-radius: 0.2rem;
28
+ overflow-x: scroll;
29
+ }
27
30
 
28
- .wrapper {
29
- inline-size: 80ch;
30
- margin-inline: auto;
31
- }
31
+ .wrapper {
32
+ inline-size: min(90%, 80ch);
33
+ margin-inline: auto;
34
+ }
32
35
  </style>
33
36
  <link
34
37
  rel="stylesheet"
@@ -42,7 +45,8 @@ pre {
42
45
  crossorigin=""
43
46
  ></script>
44
47
  <script
45
- src="https://unpkg.com/leaflet-html@latest/dist/leaflet-html.umd.js"
48
+ type="module"
49
+ src="https://unpkg.com/leaflet-html@latest/dist/leaflet-html.js"
46
50
  ></script>
47
51
  </head>
48
52
  <body>