@mcp-b/geo-leaflet 0.2.22 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/choropleth/choropleth.js +2 -2
- package/dist/components/circle/circle.js +75 -1
- package/dist/components/control/control.d.ts +8 -2
- package/dist/components/control/control.js +72 -1
- package/dist/components/geojson/geojson.js +181 -1
- package/dist/components/map/map.js +1 -1
- package/dist/components/marker/marker.js +102 -1
- package/dist/components/polygon/polygon.js +69 -1
- package/dist/components/polyline/polyline.js +63 -1
- package/dist/components/popup/popup.js +28 -1
- package/dist/components/scale-control/scale-control.js +54 -1
- package/dist/components/tilelayer/tilelayer.js +73 -1
- package/dist/docs/custom-elements.json +34 -39
- package/dist/index.js +10 -10
- package/dist/{map-DGu4FVda.js → map-ChMH_5_A.js} +11 -17
- package/package.json +3 -3
- package/dist/circle-BNPIzKH-.js +0 -85
- package/dist/components/find-leaflet-map.d.ts +0 -11
- package/dist/components/find-leaflet-map.js +0 -17
- package/dist/control-DvPCCR2e.js +0 -68
- package/dist/geojson-Dlvc_wAg.js +0 -190
- package/dist/marker-RT0-gpae.js +0 -116
- package/dist/polygon-DtiZDmnC.js +0 -79
- package/dist/polyline-C3VgapkC.js +0 -73
- package/dist/popup-BDNUUZWQ.js +0 -35
- package/dist/scale-control-D5QJFlOJ.js +0 -64
- package/dist/tilelayer-CwHdbtD_.js +0 -83
|
@@ -1,2 +1,55 @@
|
|
|
1
|
-
import { t as
|
|
1
|
+
import { n as __toESM, t as require_leaflet_src } from "../../leaflet-src-DkjKLRUt.js";
|
|
2
|
+
import { t as __decorate } from "../../decorate-DcF3lt7P.js";
|
|
3
|
+
import { LitElement, html } from "lit";
|
|
4
|
+
import { customElement, property } from "lit/decorators.js";
|
|
5
|
+
import { findMapElement } from "@mcp-b/geo-support/base/find-map-element";
|
|
6
|
+
import styles from "@mcp-b/geo-support/styles/map-child.styles";
|
|
7
|
+
//#region src/components/scale-control/scale-control.ts
|
|
8
|
+
var import_leaflet_src = /* @__PURE__ */ __toESM(require_leaflet_src(), 1);
|
|
9
|
+
let SigveloLeafletScaleControl = class SigveloLeafletScaleControl extends LitElement {
|
|
10
|
+
constructor(..._args) {
|
|
11
|
+
super(..._args);
|
|
12
|
+
this.position = "bottomleft";
|
|
13
|
+
this.metric = true;
|
|
14
|
+
this.imperial = true;
|
|
15
|
+
this.maxWidth = 100;
|
|
16
|
+
this._control = null;
|
|
17
|
+
this._mapEl = null;
|
|
18
|
+
}
|
|
19
|
+
static {
|
|
20
|
+
this.styles = [styles];
|
|
21
|
+
}
|
|
22
|
+
async connectedCallback() {
|
|
23
|
+
super.connectedCallback();
|
|
24
|
+
this._mapEl = findMapElement(this, "sigvelo-leaflet-map");
|
|
25
|
+
await this._mapEl?.whenMapReady(this, () => this._addControl());
|
|
26
|
+
}
|
|
27
|
+
disconnectedCallback() {
|
|
28
|
+
super.disconnectedCallback();
|
|
29
|
+
if (this._control && this._mapEl?.map) this._control.remove();
|
|
30
|
+
this._control = null;
|
|
31
|
+
}
|
|
32
|
+
/** @internal */
|
|
33
|
+
_addControl() {
|
|
34
|
+
if (!this._mapEl?.map) return;
|
|
35
|
+
this._control = import_leaflet_src.control.scale({
|
|
36
|
+
position: this.position,
|
|
37
|
+
metric: this.metric,
|
|
38
|
+
imperial: this.imperial,
|
|
39
|
+
maxWidth: this.maxWidth
|
|
40
|
+
}).addTo(this._mapEl.map);
|
|
41
|
+
}
|
|
42
|
+
render() {
|
|
43
|
+
return html``;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
__decorate([property()], SigveloLeafletScaleControl.prototype, "position", void 0);
|
|
47
|
+
__decorate([property({ type: Boolean })], SigveloLeafletScaleControl.prototype, "metric", void 0);
|
|
48
|
+
__decorate([property({ type: Boolean })], SigveloLeafletScaleControl.prototype, "imperial", void 0);
|
|
49
|
+
__decorate([property({
|
|
50
|
+
attribute: "max-width",
|
|
51
|
+
type: Number
|
|
52
|
+
})], SigveloLeafletScaleControl.prototype, "maxWidth", void 0);
|
|
53
|
+
SigveloLeafletScaleControl = __decorate([customElement("sigvelo-leaflet-scale-control")], SigveloLeafletScaleControl);
|
|
54
|
+
//#endregion
|
|
2
55
|
export { SigveloLeafletScaleControl };
|
|
@@ -1,2 +1,74 @@
|
|
|
1
|
-
import { t as
|
|
1
|
+
import { n as __toESM, t as require_leaflet_src } from "../../leaflet-src-DkjKLRUt.js";
|
|
2
|
+
import { t as __decorate } from "../../decorate-DcF3lt7P.js";
|
|
3
|
+
import { LitElement, html } from "lit";
|
|
4
|
+
import { customElement, property } from "lit/decorators.js";
|
|
5
|
+
import { findMapElement } from "@mcp-b/geo-support/base/find-map-element";
|
|
6
|
+
import styles from "@mcp-b/geo-support/styles/map-child.styles";
|
|
7
|
+
//#region src/components/tilelayer/tilelayer.ts
|
|
8
|
+
var import_leaflet_src = /* @__PURE__ */ __toESM(require_leaflet_src(), 1);
|
|
9
|
+
let SigveloLeafletTilelayer = class SigveloLeafletTilelayer extends LitElement {
|
|
10
|
+
constructor(..._args) {
|
|
11
|
+
super(..._args);
|
|
12
|
+
this.url = "";
|
|
13
|
+
this.attribution = "";
|
|
14
|
+
this.minZoom = 0;
|
|
15
|
+
this.maxZoom = 19;
|
|
16
|
+
this.subdomains = "abc";
|
|
17
|
+
this.opacity = 1;
|
|
18
|
+
this._layer = null;
|
|
19
|
+
this._mapEl = null;
|
|
20
|
+
}
|
|
21
|
+
static {
|
|
22
|
+
this.styles = [styles];
|
|
23
|
+
}
|
|
24
|
+
async connectedCallback() {
|
|
25
|
+
super.connectedCallback();
|
|
26
|
+
this._mapEl = findMapElement(this, "sigvelo-leaflet-map");
|
|
27
|
+
await this._mapEl?.whenMapReady(this, () => this._addLayer());
|
|
28
|
+
}
|
|
29
|
+
disconnectedCallback() {
|
|
30
|
+
super.disconnectedCallback();
|
|
31
|
+
this._removeLayer();
|
|
32
|
+
}
|
|
33
|
+
/** @internal */
|
|
34
|
+
_addLayer() {
|
|
35
|
+
if (!this._mapEl?.map || !this.url) return;
|
|
36
|
+
this._layer = import_leaflet_src.tileLayer(this.url, {
|
|
37
|
+
attribution: this.attribution,
|
|
38
|
+
minZoom: this.minZoom,
|
|
39
|
+
maxZoom: this.maxZoom,
|
|
40
|
+
subdomains: this.subdomains,
|
|
41
|
+
opacity: this.opacity
|
|
42
|
+
}).addTo(this._mapEl.map);
|
|
43
|
+
}
|
|
44
|
+
/** @internal */
|
|
45
|
+
_removeLayer() {
|
|
46
|
+
this._layer?.remove();
|
|
47
|
+
this._layer = null;
|
|
48
|
+
}
|
|
49
|
+
updated(changed) {
|
|
50
|
+
if (changed.has("url") && this._layer) {
|
|
51
|
+
this._removeLayer();
|
|
52
|
+
this._addLayer();
|
|
53
|
+
}
|
|
54
|
+
if (changed.has("opacity") && this._layer) this._layer.setOpacity(this.opacity);
|
|
55
|
+
}
|
|
56
|
+
render() {
|
|
57
|
+
return html``;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
__decorate([property()], SigveloLeafletTilelayer.prototype, "url", void 0);
|
|
61
|
+
__decorate([property()], SigveloLeafletTilelayer.prototype, "attribution", void 0);
|
|
62
|
+
__decorate([property({
|
|
63
|
+
attribute: "min-zoom",
|
|
64
|
+
type: Number
|
|
65
|
+
})], SigveloLeafletTilelayer.prototype, "minZoom", void 0);
|
|
66
|
+
__decorate([property({
|
|
67
|
+
attribute: "max-zoom",
|
|
68
|
+
type: Number
|
|
69
|
+
})], SigveloLeafletTilelayer.prototype, "maxZoom", void 0);
|
|
70
|
+
__decorate([property()], SigveloLeafletTilelayer.prototype, "subdomains", void 0);
|
|
71
|
+
__decorate([property({ type: Number })], SigveloLeafletTilelayer.prototype, "opacity", void 0);
|
|
72
|
+
SigveloLeafletTilelayer = __decorate([customElement("sigvelo-leaflet-tilelayer")], SigveloLeafletTilelayer);
|
|
73
|
+
//#endregion
|
|
2
74
|
export { SigveloLeafletTilelayer };
|
|
@@ -592,27 +592,56 @@
|
|
|
592
592
|
"kind": "class",
|
|
593
593
|
"description": "A generic control container for a Leaflet map. Wraps arbitrary content\nand places it in one of Leaflet's four control corners, stacking properly\nwith zoom, attribution, and other controls.",
|
|
594
594
|
"name": "SigveloLeafletControl",
|
|
595
|
+
"slots": [
|
|
596
|
+
{
|
|
597
|
+
"description": "Control content, retained in the control’s light DOM.",
|
|
598
|
+
"name": ""
|
|
599
|
+
}
|
|
600
|
+
],
|
|
595
601
|
"members": [
|
|
602
|
+
{
|
|
603
|
+
"kind": "method",
|
|
604
|
+
"name": "_removeControl",
|
|
605
|
+
"privacy": "private"
|
|
606
|
+
},
|
|
607
|
+
{
|
|
608
|
+
"kind": "field",
|
|
609
|
+
"name": "_stopPlacement",
|
|
610
|
+
"type": {
|
|
611
|
+
"text": "(() => void) | null"
|
|
612
|
+
},
|
|
613
|
+
"privacy": "private",
|
|
614
|
+
"default": "null",
|
|
615
|
+
"parsedType": {
|
|
616
|
+
"text": "null | { }"
|
|
617
|
+
}
|
|
618
|
+
},
|
|
596
619
|
{
|
|
597
620
|
"kind": "field",
|
|
598
621
|
"name": "position",
|
|
599
622
|
"type": {
|
|
600
|
-
"text": "
|
|
623
|
+
"text": "ControlPosition"
|
|
601
624
|
},
|
|
602
625
|
"default": "\"bottom-left\"",
|
|
603
626
|
"description": "Position of the control on the map.",
|
|
604
|
-
"attribute": "position"
|
|
627
|
+
"attribute": "position",
|
|
628
|
+
"parsedType": {
|
|
629
|
+
"text": "'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'"
|
|
630
|
+
}
|
|
605
631
|
}
|
|
606
632
|
],
|
|
607
633
|
"attributes": [
|
|
608
634
|
{
|
|
609
635
|
"name": "position",
|
|
610
636
|
"type": {
|
|
611
|
-
"text": "
|
|
637
|
+
"text": "ControlPosition"
|
|
612
638
|
},
|
|
613
639
|
"default": "\"bottom-left\"",
|
|
614
640
|
"description": "Position of the control on the map.",
|
|
615
|
-
"fieldName": "position"
|
|
641
|
+
"fieldName": "position",
|
|
642
|
+
"parsedType": {
|
|
643
|
+
"text": "'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'"
|
|
644
|
+
}
|
|
616
645
|
}
|
|
617
646
|
],
|
|
618
647
|
"superclass": {
|
|
@@ -642,40 +671,6 @@
|
|
|
642
671
|
}
|
|
643
672
|
]
|
|
644
673
|
},
|
|
645
|
-
{
|
|
646
|
-
"kind": "javascript-module",
|
|
647
|
-
"path": "src/components/find-leaflet-map.ts",
|
|
648
|
-
"declarations": [
|
|
649
|
-
{
|
|
650
|
-
"kind": "function",
|
|
651
|
-
"name": "findLeafletMap",
|
|
652
|
-
"return": {
|
|
653
|
-
"type": {
|
|
654
|
-
"text": "SigveloLeafletMap | null"
|
|
655
|
-
}
|
|
656
|
-
},
|
|
657
|
-
"parameters": [
|
|
658
|
-
{
|
|
659
|
-
"name": "element",
|
|
660
|
-
"type": {
|
|
661
|
-
"text": "HTMLElement"
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
],
|
|
665
|
-
"description": "Finds the containing map even when a map child is rendered by a nested web\ncomponent. `Element.closest()` does not cross a shadow-root boundary, while\nhost applications may compose the reusable Leaflet elements that way."
|
|
666
|
-
}
|
|
667
|
-
],
|
|
668
|
-
"exports": [
|
|
669
|
-
{
|
|
670
|
-
"kind": "js",
|
|
671
|
-
"name": "findLeafletMap",
|
|
672
|
-
"declaration": {
|
|
673
|
-
"name": "findLeafletMap",
|
|
674
|
-
"module": "src/components/find-leaflet-map.ts"
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
]
|
|
678
|
-
},
|
|
679
674
|
{
|
|
680
675
|
"kind": "javascript-module",
|
|
681
676
|
"path": "src/components/geojson/geojson.ts",
|
|
@@ -2059,7 +2054,7 @@
|
|
|
2059
2054
|
"package": {
|
|
2060
2055
|
"name": "@mcp-b/geo-leaflet",
|
|
2061
2056
|
"description": "Leaflet web components for Sigvelo, built with Lit.",
|
|
2062
|
-
"version": "0.
|
|
2057
|
+
"version": "0.3.1",
|
|
2063
2058
|
"license": "MIT"
|
|
2064
2059
|
}
|
|
2065
2060
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { t as SigveloLeafletMap } from "./map-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { t as SigveloLeafletMap } from "./map-ChMH_5_A.js";
|
|
2
|
+
import { SigveloLeafletTilelayer } from "./components/tilelayer/tilelayer.js";
|
|
3
|
+
import { SigveloLeafletMarker } from "./components/marker/marker.js";
|
|
4
|
+
import { SigveloLeafletPopup } from "./components/popup/popup.js";
|
|
5
|
+
import { SigveloLeafletGeojson } from "./components/geojson/geojson.js";
|
|
6
|
+
import { SigveloLeafletControl } from "./components/control/control.js";
|
|
7
7
|
import { SigveloLeafletChoropleth } from "./components/choropleth/choropleth.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
8
|
+
import { SigveloLeafletCircle } from "./components/circle/circle.js";
|
|
9
|
+
import { SigveloLeafletPolyline } from "./components/polyline/polyline.js";
|
|
10
|
+
import { SigveloLeafletPolygon } from "./components/polygon/polygon.js";
|
|
11
|
+
import { SigveloLeafletScaleControl } from "./components/scale-control/scale-control.js";
|
|
12
12
|
export { SigveloLeafletChoropleth, SigveloLeafletCircle, SigveloLeafletControl, SigveloLeafletGeojson, SigveloLeafletMap, SigveloLeafletMarker, SigveloLeafletPolygon, SigveloLeafletPolyline, SigveloLeafletPopup, SigveloLeafletScaleControl, SigveloLeafletTilelayer };
|
|
@@ -17,17 +17,6 @@ var layers_2x_default = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0C
|
|
|
17
17
|
//#endregion
|
|
18
18
|
//#region src/components/map/map.styles.ts
|
|
19
19
|
var map_styles_default = css`
|
|
20
|
-
:host {
|
|
21
|
-
display: block;
|
|
22
|
-
position: relative;
|
|
23
|
-
box-sizing: border-box;
|
|
24
|
-
min-height: 300px;
|
|
25
|
-
overflow: hidden;
|
|
26
|
-
border: 1px solid var(--sigvelo-color-neutral-border-muted, rgb(255 255 255 / 15%));
|
|
27
|
-
border-radius: var(--sigvelo-radius-md, 8px);
|
|
28
|
-
background: var(--sigvelo-color-surface-sunken, #171717);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
20
|
.map-layout {
|
|
32
21
|
position: absolute;
|
|
33
22
|
inset: 0;
|
|
@@ -72,13 +61,13 @@ var map_styles_default = css`
|
|
|
72
61
|
width: 100%;
|
|
73
62
|
max-width: none;
|
|
74
63
|
margin: 0;
|
|
75
|
-
padding:
|
|
64
|
+
padding: var(--sigvelo-spacing-1) var(--sigvelo-spacing-2);
|
|
76
65
|
border: 0;
|
|
77
66
|
border-radius: 0;
|
|
78
67
|
color: var(--sigvelo-color-text-muted, #b4b4b4);
|
|
79
68
|
background: transparent;
|
|
80
69
|
box-shadow: none;
|
|
81
|
-
font-size:
|
|
70
|
+
font-size: var(--sigvelo-control-text-xs);
|
|
82
71
|
line-height: 1.35;
|
|
83
72
|
text-align: right;
|
|
84
73
|
white-space: normal;
|
|
@@ -95,7 +84,7 @@ var map_styles_default = css`
|
|
|
95
84
|
overflow: hidden;
|
|
96
85
|
border: 1px solid var(--sigvelo-color-neutral-border-muted, rgb(255 255 255 / 15%));
|
|
97
86
|
border-radius: var(--sigvelo-radius-sm, 4px);
|
|
98
|
-
box-shadow:
|
|
87
|
+
box-shadow: var(--sigvelo-elevation-floating);
|
|
99
88
|
}
|
|
100
89
|
|
|
101
90
|
.leaflet-container .leaflet-bar a,
|
|
@@ -109,15 +98,20 @@ var map_styles_default = css`
|
|
|
109
98
|
background: var(--sigvelo-color-surface-raised, #282828);
|
|
110
99
|
}
|
|
111
100
|
|
|
101
|
+
.leaflet-container a:focus-visible {
|
|
102
|
+
outline: var(--sigvelo-focus-ring);
|
|
103
|
+
outline-offset: calc(-1 * var(--sigvelo-focus-width));
|
|
104
|
+
}
|
|
105
|
+
|
|
112
106
|
.leaflet-container .leaflet-popup-content-wrapper,
|
|
113
107
|
.leaflet-container .leaflet-popup-tip {
|
|
114
|
-
color:
|
|
115
|
-
background:
|
|
108
|
+
color: var(--sigvelo-color-text);
|
|
109
|
+
background: var(--sigvelo-color-surface);
|
|
116
110
|
}
|
|
117
111
|
|
|
118
112
|
.leaflet-container .leaflet-popup-close-button,
|
|
119
113
|
.leaflet-container .leaflet-popup-close-button:hover {
|
|
120
|
-
color:
|
|
114
|
+
color: var(--sigvelo-color-text-muted);
|
|
121
115
|
}
|
|
122
116
|
`;
|
|
123
117
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcp-b/geo-leaflet",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Leaflet web components for Sigvelo, built with Lit.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"custom-elements",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@mcp-b/
|
|
37
|
-
"@mcp-b/
|
|
36
|
+
"@mcp-b/geo-support": "0.3.1",
|
|
37
|
+
"@mcp-b/wc-support": "0.3.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@custom-elements-manifest/analyzer": "^0.10.10",
|
package/dist/circle-BNPIzKH-.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { n as __toESM, t as require_leaflet_src } from "./leaflet-src-DkjKLRUt.js";
|
|
2
|
-
import { t as __decorate } from "./decorate-DcF3lt7P.js";
|
|
3
|
-
import { findLeafletMap } from "./components/find-leaflet-map.js";
|
|
4
|
-
import { LitElement, css, html } from "lit";
|
|
5
|
-
import { customElement, property } from "lit/decorators.js";
|
|
6
|
-
//#region src/components/circle/circle.styles.ts
|
|
7
|
-
var import_leaflet_src = /* @__PURE__ */ __toESM(require_leaflet_src(), 1);
|
|
8
|
-
var circle_styles_default = css`
|
|
9
|
-
:host {
|
|
10
|
-
display: none;
|
|
11
|
-
}
|
|
12
|
-
`;
|
|
13
|
-
//#endregion
|
|
14
|
-
//#region src/components/circle/circle.ts
|
|
15
|
-
let SigveloLeafletCircle = class SigveloLeafletCircle extends LitElement {
|
|
16
|
-
constructor(..._args) {
|
|
17
|
-
super(..._args);
|
|
18
|
-
this.latitude = 0;
|
|
19
|
-
this.longitude = 0;
|
|
20
|
-
this.radius = 100;
|
|
21
|
-
this.fillColor = "#3388ff";
|
|
22
|
-
this.fillOpacity = .2;
|
|
23
|
-
this.strokeColor = "#3388ff";
|
|
24
|
-
this.strokeWidth = 3;
|
|
25
|
-
this._circle = null;
|
|
26
|
-
this._mapEl = null;
|
|
27
|
-
}
|
|
28
|
-
static {
|
|
29
|
-
this.styles = [circle_styles_default];
|
|
30
|
-
}
|
|
31
|
-
async connectedCallback() {
|
|
32
|
-
super.connectedCallback();
|
|
33
|
-
this._mapEl = findLeafletMap(this);
|
|
34
|
-
if (this._mapEl) {
|
|
35
|
-
await this._mapEl.mapReady;
|
|
36
|
-
this._addCircle();
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
disconnectedCallback() {
|
|
40
|
-
super.disconnectedCallback();
|
|
41
|
-
this._circle?.remove();
|
|
42
|
-
this._circle = null;
|
|
43
|
-
}
|
|
44
|
-
/** @internal */
|
|
45
|
-
_addCircle() {
|
|
46
|
-
if (!this._mapEl?.map) return;
|
|
47
|
-
this._circle = import_leaflet_src.circle([this.latitude, this.longitude], {
|
|
48
|
-
radius: this.radius,
|
|
49
|
-
fillColor: this.fillColor,
|
|
50
|
-
fillOpacity: this.fillOpacity,
|
|
51
|
-
color: this.strokeColor,
|
|
52
|
-
weight: this.strokeWidth
|
|
53
|
-
}).addTo(this._mapEl.map);
|
|
54
|
-
}
|
|
55
|
-
updated(changed) {
|
|
56
|
-
if (!this._circle) return;
|
|
57
|
-
if (changed.has("latitude") || changed.has("longitude")) this._circle.setLatLng([this.latitude, this.longitude]);
|
|
58
|
-
if (changed.has("radius")) this._circle.setRadius(this.radius);
|
|
59
|
-
if (changed.has("fillColor") || changed.has("fillOpacity") || changed.has("strokeColor") || changed.has("strokeWidth")) this._circle.setStyle({
|
|
60
|
-
fillColor: this.fillColor,
|
|
61
|
-
fillOpacity: this.fillOpacity,
|
|
62
|
-
color: this.strokeColor,
|
|
63
|
-
weight: this.strokeWidth
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
render() {
|
|
67
|
-
return html``;
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
__decorate([property({ type: Number })], SigveloLeafletCircle.prototype, "latitude", void 0);
|
|
71
|
-
__decorate([property({ type: Number })], SigveloLeafletCircle.prototype, "longitude", void 0);
|
|
72
|
-
__decorate([property({ type: Number })], SigveloLeafletCircle.prototype, "radius", void 0);
|
|
73
|
-
__decorate([property({ attribute: "fill-color" })], SigveloLeafletCircle.prototype, "fillColor", void 0);
|
|
74
|
-
__decorate([property({
|
|
75
|
-
attribute: "fill-opacity",
|
|
76
|
-
type: Number
|
|
77
|
-
})], SigveloLeafletCircle.prototype, "fillOpacity", void 0);
|
|
78
|
-
__decorate([property({ attribute: "stroke-color" })], SigveloLeafletCircle.prototype, "strokeColor", void 0);
|
|
79
|
-
__decorate([property({
|
|
80
|
-
attribute: "stroke-width",
|
|
81
|
-
type: Number
|
|
82
|
-
})], SigveloLeafletCircle.prototype, "strokeWidth", void 0);
|
|
83
|
-
SigveloLeafletCircle = __decorate([customElement("sigvelo-leaflet-circle")], SigveloLeafletCircle);
|
|
84
|
-
//#endregion
|
|
85
|
-
export { SigveloLeafletCircle as t };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { SigveloLeafletMap } from "./map/map.js";
|
|
2
|
-
|
|
3
|
-
//#region src/components/find-leaflet-map.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Finds the containing map even when a map child is rendered by a nested web
|
|
6
|
-
* component. `Element.closest()` does not cross a shadow-root boundary, while
|
|
7
|
-
* host applications may compose the reusable Leaflet elements that way.
|
|
8
|
-
*/
|
|
9
|
-
declare function findLeafletMap(element: HTMLElement): SigveloLeafletMap | null;
|
|
10
|
-
//#endregion
|
|
11
|
-
export { findLeafletMap };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
//#region src/components/find-leaflet-map.ts
|
|
2
|
-
/**
|
|
3
|
-
* Finds the containing map even when a map child is rendered by a nested web
|
|
4
|
-
* component. `Element.closest()` does not cross a shadow-root boundary, while
|
|
5
|
-
* host applications may compose the reusable Leaflet elements that way.
|
|
6
|
-
*/
|
|
7
|
-
function findLeafletMap(element) {
|
|
8
|
-
let current = element;
|
|
9
|
-
while (current) {
|
|
10
|
-
if (current instanceof HTMLElement && current.localName === "sigvelo-leaflet-map") return current;
|
|
11
|
-
const root = current.getRootNode();
|
|
12
|
-
current = current.parentNode ?? (root instanceof ShadowRoot ? root.host : null);
|
|
13
|
-
}
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
//#endregion
|
|
17
|
-
export { findLeafletMap };
|
package/dist/control-DvPCCR2e.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { n as __toESM, t as require_leaflet_src } from "./leaflet-src-DkjKLRUt.js";
|
|
2
|
-
import { t as __decorate } from "./decorate-DcF3lt7P.js";
|
|
3
|
-
import { findLeafletMap } from "./components/find-leaflet-map.js";
|
|
4
|
-
import { LitElement, css, html } from "lit";
|
|
5
|
-
import { customElement, property } from "lit/decorators.js";
|
|
6
|
-
//#region src/components/control/control.styles.ts
|
|
7
|
-
var import_leaflet_src = /* @__PURE__ */ __toESM(require_leaflet_src(), 1);
|
|
8
|
-
var control_styles_default = css`
|
|
9
|
-
:host {
|
|
10
|
-
display: none;
|
|
11
|
-
}
|
|
12
|
-
`;
|
|
13
|
-
//#endregion
|
|
14
|
-
//#region src/components/control/control.ts
|
|
15
|
-
let SigveloLeafletControl = class SigveloLeafletControl extends LitElement {
|
|
16
|
-
constructor(..._args) {
|
|
17
|
-
super(..._args);
|
|
18
|
-
this.position = "bottom-left";
|
|
19
|
-
this._control = null;
|
|
20
|
-
this._mapEl = null;
|
|
21
|
-
}
|
|
22
|
-
static {
|
|
23
|
-
this.styles = [control_styles_default];
|
|
24
|
-
}
|
|
25
|
-
/** @internal Map position names to Leaflet format. */
|
|
26
|
-
_toLeafletPosition() {
|
|
27
|
-
return {
|
|
28
|
-
"top-left": "topleft",
|
|
29
|
-
"top-right": "topright",
|
|
30
|
-
"bottom-left": "bottomleft",
|
|
31
|
-
"bottom-right": "bottomright"
|
|
32
|
-
}[this.position] ?? "bottomleft";
|
|
33
|
-
}
|
|
34
|
-
async connectedCallback() {
|
|
35
|
-
super.connectedCallback();
|
|
36
|
-
this._mapEl = findLeafletMap(this);
|
|
37
|
-
if (this._mapEl) {
|
|
38
|
-
await this._mapEl.mapReady;
|
|
39
|
-
this._addControl();
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
disconnectedCallback() {
|
|
43
|
-
super.disconnectedCallback();
|
|
44
|
-
this._control?.remove();
|
|
45
|
-
this._control = null;
|
|
46
|
-
}
|
|
47
|
-
/** @internal */
|
|
48
|
-
_addControl() {
|
|
49
|
-
if (!this._mapEl?.map) return;
|
|
50
|
-
const children = Array.from(this.children);
|
|
51
|
-
const CustomControl = import_leaflet_src.Control.extend({ onAdd: () => {
|
|
52
|
-
const container = import_leaflet_src.DomUtil.create("div", "sigvelo-leaflet-custom-control");
|
|
53
|
-
for (const child of children) container.appendChild(child);
|
|
54
|
-
import_leaflet_src.DomEvent.disableClickPropagation(container);
|
|
55
|
-
import_leaflet_src.DomEvent.disableScrollPropagation(container);
|
|
56
|
-
return container;
|
|
57
|
-
} });
|
|
58
|
-
this._control = new CustomControl({ position: this._toLeafletPosition() });
|
|
59
|
-
this._control.addTo(this._mapEl.map);
|
|
60
|
-
}
|
|
61
|
-
render() {
|
|
62
|
-
return html` <slot></slot> `;
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
__decorate([property()], SigveloLeafletControl.prototype, "position", void 0);
|
|
66
|
-
SigveloLeafletControl = __decorate([customElement("sigvelo-leaflet-control")], SigveloLeafletControl);
|
|
67
|
-
//#endregion
|
|
68
|
-
export { SigveloLeafletControl as t };
|