@mcp-b/geo-leaflet 0.3.0 → 0.3.2
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.
|
@@ -56,7 +56,8 @@ let SigveloLeafletGeojson = class SigveloLeafletGeojson extends LitElement {
|
|
|
56
56
|
/** @internal */
|
|
57
57
|
_subscribeChannel() {
|
|
58
58
|
this._unsubscribeChannel?.();
|
|
59
|
-
|
|
59
|
+
this._unsubscribeChannel = null;
|
|
60
|
+
if (!this.isConnected || !this.channel) return;
|
|
60
61
|
this._unsubscribeChannel = subscribeClassify(this.channel, (detail) => {
|
|
61
62
|
this.styleFunction = detail.styleFunction;
|
|
62
63
|
});
|
|
@@ -113,7 +114,7 @@ let SigveloLeafletGeojson = class SigveloLeafletGeojson extends LitElement {
|
|
|
113
114
|
/** @internal */
|
|
114
115
|
_addLayer() {
|
|
115
116
|
this._removeLayer();
|
|
116
|
-
if (!this._mapEl?.map || !this.data) return;
|
|
117
|
+
if (!this.isConnected || !this._mapEl?.map || !this.data) return;
|
|
117
118
|
this._layer = import_leaflet_src.geoJSON(this.data, {
|
|
118
119
|
style: (feature) => feature ? this._getStyleForFeature(feature) : {},
|
|
119
120
|
interactive: this.interactive,
|
|
@@ -139,6 +140,7 @@ let SigveloLeafletGeojson = class SigveloLeafletGeojson extends LitElement {
|
|
|
139
140
|
this._layer = null;
|
|
140
141
|
}
|
|
141
142
|
updated(changed) {
|
|
143
|
+
if (changed.has("channel")) this._subscribeChannel();
|
|
142
144
|
if (changed.has("data") || changed.has("interactive") || changed.has("popupTitleProperty") || changed.has("popupValueProperty") || changed.has("popupValueLabel")) this._addLayer();
|
|
143
145
|
else if (changed.has("styleFunction") || changed.has("fillColor") || changed.has("fillOpacity") || changed.has("strokeColor") || changed.has("strokeWidth") || changed.has("strokeOpacity")) this._layer?.setStyle((feature) => feature ? this._getStyleForFeature(feature) : {});
|
|
144
146
|
else if (changed.has("fitBounds") && this.fitBounds && this._layer && this._mapEl?.map) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcp-b/geo-leaflet",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
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/geo-support": "0.3.
|
|
37
|
-
"@mcp-b/wc-support": "0.3.
|
|
36
|
+
"@mcp-b/geo-support": "0.3.2",
|
|
37
|
+
"@mcp-b/wc-support": "0.3.2"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@custom-elements-manifest/analyzer": "^0.10.10",
|