@mcp-b/geo-leaflet 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.
Files changed (43) hide show
  1. package/LICENSE +21 -0
  2. package/dist/circle-CqXHsyYH.js +84 -0
  3. package/dist/components/choropleth/choropleth.d.ts +68 -0
  4. package/dist/components/choropleth/choropleth.js +195 -0
  5. package/dist/components/circle/circle.d.ts +43 -0
  6. package/dist/components/circle/circle.js +2 -0
  7. package/dist/components/control/control.d.ts +43 -0
  8. package/dist/components/control/control.js +2 -0
  9. package/dist/components/find-leaflet-map.d.ts +11 -0
  10. package/dist/components/find-leaflet-map.js +17 -0
  11. package/dist/components/geojson/geojson.d.ts +80 -0
  12. package/dist/components/geojson/geojson.js +2 -0
  13. package/dist/components/map/map.d.ts +44 -0
  14. package/dist/components/map/map.js +2 -0
  15. package/dist/components/marker/marker.d.ts +53 -0
  16. package/dist/components/marker/marker.js +2 -0
  17. package/dist/components/polygon/polygon.d.ts +39 -0
  18. package/dist/components/polygon/polygon.js +2 -0
  19. package/dist/components/polyline/polyline.d.ts +39 -0
  20. package/dist/components/polyline/polyline.js +2 -0
  21. package/dist/components/popup/popup.d.ts +30 -0
  22. package/dist/components/popup/popup.js +2 -0
  23. package/dist/components/scale-control/scale-control.d.ts +37 -0
  24. package/dist/components/scale-control/scale-control.js +2 -0
  25. package/dist/components/tilelayer/tilelayer.d.ts +43 -0
  26. package/dist/components/tilelayer/tilelayer.js +2 -0
  27. package/dist/control-ysNMOWeF.js +67 -0
  28. package/dist/decorate-DcF3lt7P.js +9 -0
  29. package/dist/default-icon-BVVgDSdq.d.ts +1 -0
  30. package/dist/default-icon.d.ts +1 -0
  31. package/dist/default-icon.js +12 -0
  32. package/dist/docs/custom-elements.json +2051 -0
  33. package/dist/geojson-DPaCrjMF.js +189 -0
  34. package/dist/index.d.ts +12 -0
  35. package/dist/index.js +12 -0
  36. package/dist/map-DRJUOrtM.js +204 -0
  37. package/dist/marker-D4gW4fyF.js +115 -0
  38. package/dist/polygon-DbFiHm4R.js +78 -0
  39. package/dist/polyline-SAcEwHDC.js +72 -0
  40. package/dist/popup-BDNUUZWQ.js +35 -0
  41. package/dist/scale-control-BR_iH4gM.js +63 -0
  42. package/dist/tilelayer-DI2cPv01.js +82 -0
  43. package/package.json +75 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 MCP-B contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,84 @@
1
+ import { t as __decorate } from "./decorate-DcF3lt7P.js";
2
+ import { findLeafletMap } from "./components/find-leaflet-map.js";
3
+ import * as L from "leaflet";
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 circle_styles_default = css`
8
+ :host {
9
+ display: none;
10
+ }
11
+ `;
12
+ //#endregion
13
+ //#region src/components/circle/circle.ts
14
+ let SigveloLeafletCircle = class SigveloLeafletCircle extends LitElement {
15
+ constructor(..._args) {
16
+ super(..._args);
17
+ this.latitude = 0;
18
+ this.longitude = 0;
19
+ this.radius = 100;
20
+ this.fillColor = "#3388ff";
21
+ this.fillOpacity = .2;
22
+ this.strokeColor = "#3388ff";
23
+ this.strokeWidth = 3;
24
+ this._circle = null;
25
+ this._mapEl = null;
26
+ }
27
+ static {
28
+ this.styles = [circle_styles_default];
29
+ }
30
+ async connectedCallback() {
31
+ super.connectedCallback();
32
+ this._mapEl = findLeafletMap(this);
33
+ if (this._mapEl) {
34
+ await this._mapEl.mapReady;
35
+ this._addCircle();
36
+ }
37
+ }
38
+ disconnectedCallback() {
39
+ super.disconnectedCallback();
40
+ this._circle?.remove();
41
+ this._circle = null;
42
+ }
43
+ /** @internal */
44
+ _addCircle() {
45
+ if (!this._mapEl?.map) return;
46
+ this._circle = L.circle([this.latitude, this.longitude], {
47
+ radius: this.radius,
48
+ fillColor: this.fillColor,
49
+ fillOpacity: this.fillOpacity,
50
+ color: this.strokeColor,
51
+ weight: this.strokeWidth
52
+ }).addTo(this._mapEl.map);
53
+ }
54
+ updated(changed) {
55
+ if (!this._circle) return;
56
+ if (changed.has("latitude") || changed.has("longitude")) this._circle.setLatLng([this.latitude, this.longitude]);
57
+ if (changed.has("radius")) this._circle.setRadius(this.radius);
58
+ if (changed.has("fillColor") || changed.has("fillOpacity") || changed.has("strokeColor") || changed.has("strokeWidth")) this._circle.setStyle({
59
+ fillColor: this.fillColor,
60
+ fillOpacity: this.fillOpacity,
61
+ color: this.strokeColor,
62
+ weight: this.strokeWidth
63
+ });
64
+ }
65
+ render() {
66
+ return html``;
67
+ }
68
+ };
69
+ __decorate([property({ type: Number })], SigveloLeafletCircle.prototype, "latitude", void 0);
70
+ __decorate([property({ type: Number })], SigveloLeafletCircle.prototype, "longitude", void 0);
71
+ __decorate([property({ type: Number })], SigveloLeafletCircle.prototype, "radius", void 0);
72
+ __decorate([property({ attribute: "fill-color" })], SigveloLeafletCircle.prototype, "fillColor", void 0);
73
+ __decorate([property({
74
+ attribute: "fill-opacity",
75
+ type: Number
76
+ })], SigveloLeafletCircle.prototype, "fillOpacity", void 0);
77
+ __decorate([property({ attribute: "stroke-color" })], SigveloLeafletCircle.prototype, "strokeColor", void 0);
78
+ __decorate([property({
79
+ attribute: "stroke-width",
80
+ type: Number
81
+ })], SigveloLeafletCircle.prototype, "strokeWidth", void 0);
82
+ SigveloLeafletCircle = __decorate([customElement("sigvelo-leaflet-circle")], SigveloLeafletCircle);
83
+ //#endregion
84
+ export { SigveloLeafletCircle as t };
@@ -0,0 +1,68 @@
1
+ import { PropertyValues } from "lit";
2
+ import { SigveloElement } from "@mcp-b/wc-support/base/sigvelo-element";
3
+ import { ClassificationMethod, GeoJsonFeatureCollection } from "@mcp-b/geo-support/types";
4
+
5
+ //#region src/components/choropleth/choropleth.d.ts
6
+ type ChoroplethRow = Readonly<Record<string, string | number | boolean | null>>;
7
+ /**
8
+ * A classified GeoJSON polygon layer with a coordinated Leaflet legend.
9
+ * Place it inside a `<sigvelo-leaflet-map>`.
10
+ *
11
+ * @tag sigvelo-leaflet-choropleth
12
+ */
13
+ declare class SigveloLeafletChoropleth extends SigveloElement {
14
+ static styles: import("lit").CSSResult;
15
+ /** Trusted GeoJSON supplied by the host application. */
16
+ data: GeoJsonFeatureCollection;
17
+ /** Optional GeoJSON URL loaded only when this component is rendered. */
18
+ src: string;
19
+ /** Optional bounded rows joined onto feature properties before classification. */
20
+ rows: readonly ChoroplethRow[] | undefined;
21
+ /** Feature property used to match a row. */
22
+ featureKey: string;
23
+ /** Row property used to match a feature. */
24
+ dataKey: string;
25
+ /** Numeric feature property used to classify regions. */
26
+ property: string;
27
+ /** Classification algorithm. */
28
+ method: ClassificationMethod;
29
+ /** Number of color classes. */
30
+ numClasses: number;
31
+ /** Reviewed ColorBrewer scheme name. */
32
+ colorScheme: string;
33
+ /** Legend heading. */
34
+ legendTitle: string;
35
+ /** Feature property displayed as the region popup heading. */
36
+ popupTitleProperty: string;
37
+ /** Label displayed before the classified value in region popups. */
38
+ popupValueLabel: string;
39
+ /** Leaflet control position for the legend. */
40
+ legendPosition: "top-left" | "top-right" | "bottom-left" | "bottom-right";
41
+ /** Whether polygon features emit click events. */
42
+ interactive: boolean;
43
+ /** Fit the parent map to the loaded polygons. */
44
+ fitBounds: boolean;
45
+ private sourceData;
46
+ private sourceLoading;
47
+ private sourceError;
48
+ private sourceController?;
49
+ private sourceRequest;
50
+ private sourceReady;
51
+ /** Resolves after the current remote GeoJSON request settles. */
52
+ get dataReady(): Promise<void>;
53
+ /** Whether a remote GeoJSON request is active. */
54
+ get loading(): boolean;
55
+ /** Bounded loading error for host diagnostics. */
56
+ get loadError(): string;
57
+ disconnectedCallback(): void;
58
+ protected updated(changed: PropertyValues<this>): void;
59
+ private loadSource;
60
+ render(): import("lit-html").TemplateResult<1>;
61
+ }
62
+ declare global {
63
+ interface HTMLElementTagNameMap {
64
+ "sigvelo-leaflet-choropleth": SigveloLeafletChoropleth;
65
+ }
66
+ }
67
+ //#endregion
68
+ export { SigveloLeafletChoropleth };
@@ -0,0 +1,195 @@
1
+ import { t as __decorate } from "../../decorate-DcF3lt7P.js";
2
+ import "../../geojson-DPaCrjMF.js";
3
+ import "../../control-ysNMOWeF.js";
4
+ import { css, html, nothing } from "lit";
5
+ import { customElement, property, state } from "lit/decorators.js";
6
+ import { createClassifyStyle } from "@mcp-b/geo-support/classification";
7
+ import "@mcp-b/geo-support/components/legend/legend";
8
+ import { SigveloElement } from "@mcp-b/wc-support/base/sigvelo-element";
9
+ //#region src/components/choropleth/choropleth.ts
10
+ const emptyData = {
11
+ type: "FeatureCollection",
12
+ features: []
13
+ };
14
+ function isFeatureCollection(value) {
15
+ if (!value || typeof value !== "object" || Reflect.get(value, "type") !== "FeatureCollection") return false;
16
+ const features = Reflect.get(value, "features");
17
+ return Array.isArray(features) && features.every((feature) => feature !== null && typeof feature === "object" && Reflect.get(feature, "type") === "Feature" && Reflect.get(feature, "geometry") !== null && typeof Reflect.get(feature, "geometry") === "object");
18
+ }
19
+ function joinRows(data, rows, featureKey, dataKey, property) {
20
+ if (rows === void 0) return data;
21
+ const values = new Map(rows.filter((row) => typeof row[dataKey] === "string" && typeof row[property] === "number" && Number.isFinite(row[property])).map((row) => [String(row[dataKey]), row[property]]));
22
+ return {
23
+ type: "FeatureCollection",
24
+ features: data.features.map((feature) => {
25
+ const properties = { ...feature.properties };
26
+ delete properties[property];
27
+ const featureValue = properties[featureKey];
28
+ if (typeof featureValue === "string") {
29
+ const value = values.get(featureValue);
30
+ if (value !== void 0) properties[property] = value;
31
+ }
32
+ return {
33
+ ...feature,
34
+ properties
35
+ };
36
+ })
37
+ };
38
+ }
39
+ let SigveloLeafletChoropleth = class SigveloLeafletChoropleth extends SigveloElement {
40
+ constructor(..._args) {
41
+ super(..._args);
42
+ this.data = emptyData;
43
+ this.src = "";
44
+ this.featureKey = "name";
45
+ this.dataKey = "name";
46
+ this.property = "density";
47
+ this.method = "naturalBreaks";
48
+ this.numClasses = 5;
49
+ this.colorScheme = "Blues";
50
+ this.legendTitle = "";
51
+ this.popupTitleProperty = "name";
52
+ this.popupValueLabel = "";
53
+ this.legendPosition = "top-right";
54
+ this.interactive = true;
55
+ this.fitBounds = true;
56
+ this.sourceData = null;
57
+ this.sourceLoading = false;
58
+ this.sourceError = "";
59
+ this.sourceRequest = 0;
60
+ this.sourceReady = Promise.resolve();
61
+ }
62
+ static {
63
+ this.styles = css`
64
+ :host {
65
+ display: contents;
66
+ }
67
+
68
+ .status {
69
+ max-inline-size: 18rem;
70
+ padding: 0.5rem 0.625rem;
71
+ border-radius: 0.375rem;
72
+ color: CanvasText;
73
+ background: Canvas;
74
+ box-shadow: 0 1px 4px rgb(0 0 0 / 24%);
75
+ font:
76
+ 0.8125rem/1.35 system-ui,
77
+ sans-serif;
78
+ }
79
+ `;
80
+ }
81
+ /** Resolves after the current remote GeoJSON request settles. */
82
+ get dataReady() {
83
+ return this.sourceReady;
84
+ }
85
+ /** Whether a remote GeoJSON request is active. */
86
+ get loading() {
87
+ return this.sourceLoading;
88
+ }
89
+ /** Bounded loading error for host diagnostics. */
90
+ get loadError() {
91
+ return this.sourceError;
92
+ }
93
+ disconnectedCallback() {
94
+ this.sourceController?.abort();
95
+ super.disconnectedCallback();
96
+ }
97
+ updated(changed) {
98
+ super.updated(changed);
99
+ if (changed.has("src")) this.loadSource();
100
+ }
101
+ loadSource() {
102
+ this.sourceController?.abort();
103
+ this.sourceController = void 0;
104
+ this.sourceData = null;
105
+ this.sourceError = "";
106
+ const src = this.src.trim();
107
+ if (!src) {
108
+ this.sourceLoading = false;
109
+ this.sourceReady = Promise.resolve();
110
+ return;
111
+ }
112
+ const request = ++this.sourceRequest;
113
+ const controller = new AbortController();
114
+ this.sourceController = controller;
115
+ this.sourceLoading = true;
116
+ this.sourceReady = fetch(src, { signal: controller.signal }).then(async (response) => {
117
+ if (!response.ok) throw new Error(`GeoJSON request failed with status ${response.status}.`);
118
+ const value = await response.json();
119
+ if (!isFeatureCollection(value)) throw new Error("The geography source is not a GeoJSON FeatureCollection.");
120
+ if (request === this.sourceRequest) this.sourceData = value;
121
+ }).catch((error) => {
122
+ if (controller.signal.aborted || request !== this.sourceRequest) return;
123
+ this.sourceError = error instanceof Error ? error.message.slice(0, 240) : "GeoJSON load failed.";
124
+ }).finally(() => {
125
+ if (request === this.sourceRequest) this.sourceLoading = false;
126
+ });
127
+ }
128
+ render() {
129
+ const data = joinRows(this.src ? this.sourceData ?? emptyData : this.data, this.rows, this.featureKey, this.dataKey, this.property);
130
+ const result = createClassifyStyle(data.features, {
131
+ property: this.property,
132
+ method: this.method,
133
+ numClasses: this.numClasses,
134
+ colorScheme: this.colorScheme,
135
+ strokeColor: "#475569",
136
+ strokeWidth: 1,
137
+ strokeOpacity: .9,
138
+ fillOpacity: .84
139
+ });
140
+ return html`
141
+ <sigvelo-leaflet-geojson
142
+ .data=${data}
143
+ .styleFunction=${result.styleFunction}
144
+ .interactive=${this.interactive}
145
+ .fitBounds=${this.fitBounds}
146
+ .popupTitleProperty=${this.popupTitleProperty}
147
+ .popupValueProperty=${this.property}
148
+ .popupValueLabel=${this.popupValueLabel || this.legendTitle || this.property}
149
+ fill-color="#64748b"
150
+ fill-opacity="0.55"
151
+ stroke-color="#475569"
152
+ stroke-width="1"
153
+ ></sigvelo-leaflet-geojson>
154
+ ${this.sourceLoading || this.sourceError ? html`<sigvelo-leaflet-control position="top-left">
155
+ <div class="status" role=${this.sourceError ? "alert" : "status"}>
156
+ ${this.sourceError || "Loading geography…"}
157
+ </div>
158
+ </sigvelo-leaflet-control>` : nothing}
159
+ ${result.colors.length > 0 ? html`<sigvelo-leaflet-control position=${this.legendPosition}>
160
+ <sigvelo-geo-legend
161
+ title=${this.legendTitle || this.property}
162
+ .breaks=${result.breaks}
163
+ .colors=${result.colors}
164
+ ></sigvelo-geo-legend>
165
+ </sigvelo-leaflet-control>` : nothing}
166
+ `;
167
+ }
168
+ };
169
+ __decorate([property({ attribute: false })], SigveloLeafletChoropleth.prototype, "data", void 0);
170
+ __decorate([property()], SigveloLeafletChoropleth.prototype, "src", void 0);
171
+ __decorate([property({ attribute: false })], SigveloLeafletChoropleth.prototype, "rows", void 0);
172
+ __decorate([property({ attribute: "feature-key" })], SigveloLeafletChoropleth.prototype, "featureKey", void 0);
173
+ __decorate([property({ attribute: "data-key" })], SigveloLeafletChoropleth.prototype, "dataKey", void 0);
174
+ __decorate([property()], SigveloLeafletChoropleth.prototype, "property", void 0);
175
+ __decorate([property()], SigveloLeafletChoropleth.prototype, "method", void 0);
176
+ __decorate([property({
177
+ attribute: "num-classes",
178
+ type: Number
179
+ })], SigveloLeafletChoropleth.prototype, "numClasses", void 0);
180
+ __decorate([property({ attribute: "color-scheme" })], SigveloLeafletChoropleth.prototype, "colorScheme", void 0);
181
+ __decorate([property({ attribute: "legend-title" })], SigveloLeafletChoropleth.prototype, "legendTitle", void 0);
182
+ __decorate([property({ attribute: "popup-title-property" })], SigveloLeafletChoropleth.prototype, "popupTitleProperty", void 0);
183
+ __decorate([property({ attribute: "popup-value-label" })], SigveloLeafletChoropleth.prototype, "popupValueLabel", void 0);
184
+ __decorate([property({ attribute: "legend-position" })], SigveloLeafletChoropleth.prototype, "legendPosition", void 0);
185
+ __decorate([property({ type: Boolean })], SigveloLeafletChoropleth.prototype, "interactive", void 0);
186
+ __decorate([property({
187
+ attribute: "fit-bounds",
188
+ type: Boolean
189
+ })], SigveloLeafletChoropleth.prototype, "fitBounds", void 0);
190
+ __decorate([state()], SigveloLeafletChoropleth.prototype, "sourceData", void 0);
191
+ __decorate([state()], SigveloLeafletChoropleth.prototype, "sourceLoading", void 0);
192
+ __decorate([state()], SigveloLeafletChoropleth.prototype, "sourceError", void 0);
193
+ SigveloLeafletChoropleth = __decorate([customElement("sigvelo-leaflet-choropleth")], SigveloLeafletChoropleth);
194
+ //#endregion
195
+ export { SigveloLeafletChoropleth };
@@ -0,0 +1,43 @@
1
+ import { LitElement, PropertyValues } from "lit";
2
+
3
+ //#region src/components/circle/circle.d.ts
4
+ /**
5
+ * A circle overlay on a Leaflet map. Must be a child of `<sigvelo-leaflet-map>`.
6
+ *
7
+ * @tag sigvelo-leaflet-circle
8
+ */
9
+ declare class SigveloLeafletCircle extends LitElement {
10
+ /** @internal */
11
+ static styles: import("lit").CSSResult[];
12
+ /** Center latitude. */
13
+ latitude: number;
14
+ /** Center longitude. */
15
+ longitude: number;
16
+ /** Radius in meters. */
17
+ radius: number;
18
+ /** Fill color (CSS color string). */
19
+ fillColor: string;
20
+ /** Fill opacity (0-1). */
21
+ fillOpacity: number;
22
+ /** Stroke color (CSS color string). */
23
+ strokeColor: string;
24
+ /** Stroke width in pixels. */
25
+ strokeWidth: number;
26
+ /** @internal */
27
+ private _circle;
28
+ /** @internal */
29
+ private _mapEl;
30
+ connectedCallback(): Promise<void>;
31
+ disconnectedCallback(): void;
32
+ /** @internal */
33
+ private _addCircle;
34
+ protected updated(changed: PropertyValues): void;
35
+ render(): import("lit-html").TemplateResult<1>;
36
+ }
37
+ declare global {
38
+ interface HTMLElementTagNameMap {
39
+ "sigvelo-leaflet-circle": SigveloLeafletCircle;
40
+ }
41
+ }
42
+ //#endregion
43
+ export { SigveloLeafletCircle };
@@ -0,0 +1,2 @@
1
+ import { t as SigveloLeafletCircle } from "../../circle-CqXHsyYH.js";
2
+ export { SigveloLeafletCircle };
@@ -0,0 +1,43 @@
1
+ import { LitElement } from "lit";
2
+
3
+ //#region src/components/control/control.d.ts
4
+ /**
5
+ * A generic control container for a Leaflet map. Wraps arbitrary content
6
+ * and places it in one of Leaflet's four control corners, stacking properly
7
+ * with zoom, attribution, and other controls.
8
+ *
9
+ * @tag sigvelo-leaflet-control
10
+ *
11
+ * @example
12
+ * ```html
13
+ * <sigvelo-leaflet-map>
14
+ * <sigvelo-leaflet-control position="bottom-left">
15
+ * <sigvelo-geo-legend title="Density" ...></sigvelo-geo-legend>
16
+ * </sigvelo-leaflet-control>
17
+ * </sigvelo-leaflet-map>
18
+ * ```
19
+ */
20
+ declare class SigveloLeafletControl extends LitElement {
21
+ /** @internal */
22
+ static styles: import("lit").CSSResult[];
23
+ /** Position of the control on the map. */
24
+ position: "top-left" | "top-right" | "bottom-left" | "bottom-right";
25
+ /** @internal */
26
+ private _control;
27
+ /** @internal */
28
+ private _mapEl;
29
+ /** @internal Map position names to Leaflet format. */
30
+ private _toLeafletPosition;
31
+ connectedCallback(): Promise<void>;
32
+ disconnectedCallback(): void;
33
+ /** @internal */
34
+ private _addControl;
35
+ render(): import("lit-html").TemplateResult<1>;
36
+ }
37
+ declare global {
38
+ interface HTMLElementTagNameMap {
39
+ "sigvelo-leaflet-control": SigveloLeafletControl;
40
+ }
41
+ }
42
+ //#endregion
43
+ export { SigveloLeafletControl };
@@ -0,0 +1,2 @@
1
+ import { t as SigveloLeafletControl } from "../../control-ysNMOWeF.js";
2
+ export { SigveloLeafletControl };
@@ -0,0 +1,11 @@
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 };
@@ -0,0 +1,17 @@
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 };
@@ -0,0 +1,80 @@
1
+ import * as L from "leaflet";
2
+ import { LitElement, PropertyValues } from "lit";
3
+ import { GeoJsonData, StyleFunction } from "@mcp-b/geo-support/types";
4
+
5
+ //#region src/components/geojson/geojson.d.ts
6
+ /**
7
+ * Renders GeoJSON data on a Leaflet map. Must be a child of `<sigvelo-leaflet-map>`.
8
+ *
9
+ * @tag sigvelo-leaflet-geojson
10
+ *
11
+ * @event sigvelo-feature-click - Fired when a GeoJSON feature is clicked.
12
+ */
13
+ declare class SigveloLeafletGeojson extends LitElement {
14
+ /** @internal */
15
+ static styles: import("lit").CSSResult[];
16
+ /** GeoJSON data (Feature or FeatureCollection). Set via property, not attribute. */
17
+ data: GeoJsonData | null;
18
+ /**
19
+ * Per-feature style function for choropleth / thematic maps.
20
+ * When set, each feature is styled by calling this function.
21
+ * Returned values override the static style props; omitted keys fall back to them.
22
+ */
23
+ styleFunction: StyleFunction | null;
24
+ /** Fill color for polygons / circles. */
25
+ fillColor: string;
26
+ /** Fill opacity (0-1). */
27
+ fillOpacity: number;
28
+ /** Stroke color. */
29
+ strokeColor: string;
30
+ /** Stroke width in pixels. */
31
+ strokeWidth: number;
32
+ /** Stroke opacity (0-1). */
33
+ strokeOpacity: number;
34
+ /** Whether features should respond to click events. */
35
+ interactive: boolean;
36
+ /** Feature property shown as the popup heading. */
37
+ popupTitleProperty: string;
38
+ /** Optional feature property shown as the popup value. */
39
+ popupValueProperty: string;
40
+ /** Optional label placed before the popup value. */
41
+ popupValueLabel: string;
42
+ /** Fit the parent map to this layer whenever it is added. */
43
+ fitBounds: boolean;
44
+ /**
45
+ * Channel name for auto-syncing with a classify panel.
46
+ * When set, styleFunction updates automatically from the panel.
47
+ */
48
+ channel: string;
49
+ /** @internal */
50
+ private _layer;
51
+ /** @internal */
52
+ private _mapEl;
53
+ /** @internal */
54
+ private _unsubscribeChannel;
55
+ /** Access the underlying Leaflet GeoJSON layer. */
56
+ get layer(): L.GeoJSON | null;
57
+ connectedCallback(): Promise<void>;
58
+ disconnectedCallback(): void;
59
+ /** @internal */
60
+ private _subscribeChannel;
61
+ /** @internal */
62
+ private _toGeoJsonFeature;
63
+ /** @internal */
64
+ private _getStyleForFeature;
65
+ /** @internal */
66
+ private _getPopupForFeature;
67
+ /** @internal */
68
+ private _addLayer;
69
+ /** @internal */
70
+ private _removeLayer;
71
+ protected updated(changed: PropertyValues): void;
72
+ render(): import("lit-html").TemplateResult<1>;
73
+ }
74
+ declare global {
75
+ interface HTMLElementTagNameMap {
76
+ "sigvelo-leaflet-geojson": SigveloLeafletGeojson;
77
+ }
78
+ }
79
+ //#endregion
80
+ export { SigveloLeafletGeojson };
@@ -0,0 +1,2 @@
1
+ import { t as SigveloLeafletGeojson } from "../../geojson-DPaCrjMF.js";
2
+ export { SigveloLeafletGeojson };
@@ -0,0 +1,44 @@
1
+ import * as L from "leaflet";
2
+ import { PropertyValues } from "lit";
3
+ import { GeoMapElement } from "@mcp-b/geo-support/base/geo-map-element";
4
+ import { FitBoundsOptions, FlyToOptions } from "@mcp-b/geo-support/types";
5
+
6
+ //#region src/components/map/map.d.ts
7
+ /**
8
+ * A Leaflet map component. Wrap tile layers, markers, and other geo elements
9
+ * as children of this component.
10
+ *
11
+ * @tag sigvelo-leaflet-map
12
+ *
13
+ * @event sigvelo-map-click - Fired when the map is clicked.
14
+ * @event sigvelo-map-move - Fired while the map center is changing.
15
+ * @event sigvelo-map-moveend - Fired when map movement ends.
16
+ * @event sigvelo-map-zoom - Fired while the zoom level is changing.
17
+ * @event sigvelo-map-zoomend - Fired when zooming ends.
18
+ * @event sigvelo-map-load - Fired when the map finishes loading.
19
+ */
20
+ declare class SigveloLeafletMap extends GeoMapElement {
21
+ /** @internal */
22
+ static styles: import("lit").CSSResult[];
23
+ /** Whether to show default zoom controls. */
24
+ zoomControl: boolean;
25
+ /** Whether to show default attribution control. */
26
+ attributionControl: boolean;
27
+ /** @internal */
28
+ private _map;
29
+ /** Access the underlying Leaflet map instance (after mapReady resolves). */
30
+ get map(): L.Map | null;
31
+ protected createMap(container: HTMLElement): void;
32
+ protected destroyMap(): void;
33
+ protected updateView(changed: PropertyValues): void;
34
+ protected invalidateSize(): void;
35
+ flyTo(options: FlyToOptions): void;
36
+ fitBounds(options: FitBoundsOptions): void;
37
+ }
38
+ declare global {
39
+ interface HTMLElementTagNameMap {
40
+ "sigvelo-leaflet-map": SigveloLeafletMap;
41
+ }
42
+ }
43
+ //#endregion
44
+ export { SigveloLeafletMap };
@@ -0,0 +1,2 @@
1
+ import { t as SigveloLeafletMap } from "../../map-DRJUOrtM.js";
2
+ export { SigveloLeafletMap };