@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.
- package/LICENSE +21 -0
- package/dist/circle-CqXHsyYH.js +84 -0
- package/dist/components/choropleth/choropleth.d.ts +68 -0
- package/dist/components/choropleth/choropleth.js +195 -0
- package/dist/components/circle/circle.d.ts +43 -0
- package/dist/components/circle/circle.js +2 -0
- package/dist/components/control/control.d.ts +43 -0
- package/dist/components/control/control.js +2 -0
- package/dist/components/find-leaflet-map.d.ts +11 -0
- package/dist/components/find-leaflet-map.js +17 -0
- package/dist/components/geojson/geojson.d.ts +80 -0
- package/dist/components/geojson/geojson.js +2 -0
- package/dist/components/map/map.d.ts +44 -0
- package/dist/components/map/map.js +2 -0
- package/dist/components/marker/marker.d.ts +53 -0
- package/dist/components/marker/marker.js +2 -0
- package/dist/components/polygon/polygon.d.ts +39 -0
- package/dist/components/polygon/polygon.js +2 -0
- package/dist/components/polyline/polyline.d.ts +39 -0
- package/dist/components/polyline/polyline.js +2 -0
- package/dist/components/popup/popup.d.ts +30 -0
- package/dist/components/popup/popup.js +2 -0
- package/dist/components/scale-control/scale-control.d.ts +37 -0
- package/dist/components/scale-control/scale-control.js +2 -0
- package/dist/components/tilelayer/tilelayer.d.ts +43 -0
- package/dist/components/tilelayer/tilelayer.js +2 -0
- package/dist/control-ysNMOWeF.js +67 -0
- package/dist/decorate-DcF3lt7P.js +9 -0
- package/dist/default-icon-BVVgDSdq.d.ts +1 -0
- package/dist/default-icon.d.ts +1 -0
- package/dist/default-icon.js +12 -0
- package/dist/docs/custom-elements.json +2051 -0
- package/dist/geojson-DPaCrjMF.js +189 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +12 -0
- package/dist/map-DRJUOrtM.js +204 -0
- package/dist/marker-D4gW4fyF.js +115 -0
- package/dist/polygon-DbFiHm4R.js +78 -0
- package/dist/polyline-SAcEwHDC.js +72 -0
- package/dist/popup-BDNUUZWQ.js +35 -0
- package/dist/scale-control-BR_iH4gM.js +63 -0
- package/dist/tilelayer-DI2cPv01.js +82 -0
- package/package.json +75 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as L from "leaflet";
|
|
2
|
+
import { LitElement } from "lit";
|
|
3
|
+
|
|
4
|
+
//#region src/components/marker/marker.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* A marker on a Leaflet map. Must be a child of `<sigvelo-leaflet-map>`.
|
|
7
|
+
* Nest a `<sigvelo-leaflet-popup>` inside for popup content.
|
|
8
|
+
*
|
|
9
|
+
* @tag sigvelo-leaflet-marker
|
|
10
|
+
*/
|
|
11
|
+
declare class SigveloLeafletMarker extends LitElement {
|
|
12
|
+
/** @internal */
|
|
13
|
+
static styles: import("lit").CSSResult[];
|
|
14
|
+
/** Marker latitude. */
|
|
15
|
+
latitude: number;
|
|
16
|
+
/** Marker longitude. */
|
|
17
|
+
longitude: number;
|
|
18
|
+
/** Title attribute for the marker (shows on hover). */
|
|
19
|
+
title: string;
|
|
20
|
+
/** Whether the marker is draggable. */
|
|
21
|
+
draggable: boolean;
|
|
22
|
+
/** Opacity of the marker (0-1). */
|
|
23
|
+
opacity: number;
|
|
24
|
+
/** Custom icon URL. If not set, the default Leaflet icon is used. */
|
|
25
|
+
iconUrl: string;
|
|
26
|
+
/** Icon width in pixels (used with icon-url). */
|
|
27
|
+
iconWidth: number;
|
|
28
|
+
/** Icon height in pixels (used with icon-url). */
|
|
29
|
+
iconHeight: number;
|
|
30
|
+
/** @internal */
|
|
31
|
+
private _marker;
|
|
32
|
+
/** @internal */
|
|
33
|
+
private _mapEl;
|
|
34
|
+
/** Access the underlying Leaflet marker instance. */
|
|
35
|
+
get marker(): L.Marker | null;
|
|
36
|
+
connectedCallback(): Promise<void>;
|
|
37
|
+
disconnectedCallback(): void;
|
|
38
|
+
/** @internal */
|
|
39
|
+
private _addMarker;
|
|
40
|
+
/** @internal */
|
|
41
|
+
private _removeMarker;
|
|
42
|
+
/** @internal */
|
|
43
|
+
private _bindChildPopup;
|
|
44
|
+
protected updated(): void;
|
|
45
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
46
|
+
}
|
|
47
|
+
declare global {
|
|
48
|
+
interface HTMLElementTagNameMap {
|
|
49
|
+
"sigvelo-leaflet-marker": SigveloLeafletMarker;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
export { SigveloLeafletMarker };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { LitElement, PropertyValues } from "lit";
|
|
2
|
+
|
|
3
|
+
//#region src/components/polygon/polygon.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* A polygon overlay on a Leaflet map. Must be a child of `<sigvelo-leaflet-map>`.
|
|
6
|
+
*
|
|
7
|
+
* @tag sigvelo-leaflet-polygon
|
|
8
|
+
*/
|
|
9
|
+
declare class SigveloLeafletPolygon extends LitElement {
|
|
10
|
+
/** @internal */
|
|
11
|
+
static styles: import("lit").CSSResult[];
|
|
12
|
+
/** Array of [lat, lng] coordinate pairs forming the polygon. Set via property. */
|
|
13
|
+
positions: Array<[number, number]>;
|
|
14
|
+
/** Fill color (CSS color string). */
|
|
15
|
+
fillColor: string;
|
|
16
|
+
/** Fill opacity (0-1). */
|
|
17
|
+
fillOpacity: number;
|
|
18
|
+
/** Stroke color (CSS color string). */
|
|
19
|
+
strokeColor: string;
|
|
20
|
+
/** Stroke width in pixels. */
|
|
21
|
+
strokeWidth: number;
|
|
22
|
+
/** @internal */
|
|
23
|
+
private _polygon;
|
|
24
|
+
/** @internal */
|
|
25
|
+
private _mapEl;
|
|
26
|
+
connectedCallback(): Promise<void>;
|
|
27
|
+
disconnectedCallback(): void;
|
|
28
|
+
/** @internal */
|
|
29
|
+
private _addPolygon;
|
|
30
|
+
protected updated(changed: PropertyValues): void;
|
|
31
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
32
|
+
}
|
|
33
|
+
declare global {
|
|
34
|
+
interface HTMLElementTagNameMap {
|
|
35
|
+
"sigvelo-leaflet-polygon": SigveloLeafletPolygon;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { SigveloLeafletPolygon };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { LitElement, PropertyValues } from "lit";
|
|
2
|
+
|
|
3
|
+
//#region src/components/polyline/polyline.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* A polyline overlay on a Leaflet map. Must be a child of `<sigvelo-leaflet-map>`.
|
|
6
|
+
*
|
|
7
|
+
* @tag sigvelo-leaflet-polyline
|
|
8
|
+
*/
|
|
9
|
+
declare class SigveloLeafletPolyline extends LitElement {
|
|
10
|
+
/** @internal */
|
|
11
|
+
static styles: import("lit").CSSResult[];
|
|
12
|
+
/** Array of [lat, lng] coordinate pairs. Set via property. */
|
|
13
|
+
positions: Array<[number, number]>;
|
|
14
|
+
/** Line color (CSS color string). */
|
|
15
|
+
color: string;
|
|
16
|
+
/** Line width in pixels. */
|
|
17
|
+
weight: number;
|
|
18
|
+
/** Opacity (0-1). */
|
|
19
|
+
opacity: number;
|
|
20
|
+
/** Dash pattern (e.g. "5 10"). */
|
|
21
|
+
dashArray: string;
|
|
22
|
+
/** @internal */
|
|
23
|
+
private _polyline;
|
|
24
|
+
/** @internal */
|
|
25
|
+
private _mapEl;
|
|
26
|
+
connectedCallback(): Promise<void>;
|
|
27
|
+
disconnectedCallback(): void;
|
|
28
|
+
/** @internal */
|
|
29
|
+
private _addPolyline;
|
|
30
|
+
protected updated(changed: PropertyValues): void;
|
|
31
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
32
|
+
}
|
|
33
|
+
declare global {
|
|
34
|
+
interface HTMLElementTagNameMap {
|
|
35
|
+
"sigvelo-leaflet-polyline": SigveloLeafletPolyline;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { SigveloLeafletPolyline };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
|
|
3
|
+
//#region src/components/popup/popup.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Popup content for a Leaflet marker or map. Nest inside a
|
|
6
|
+
* `<sigvelo-leaflet-marker>` to attach to a marker, or use standalone
|
|
7
|
+
* inside `<sigvelo-leaflet-map>` for a map-level popup.
|
|
8
|
+
*
|
|
9
|
+
* Content is provided via the default slot (Light DOM) so Sigvelo design
|
|
10
|
+
* tokens and components render correctly.
|
|
11
|
+
*
|
|
12
|
+
* @tag sigvelo-leaflet-popup
|
|
13
|
+
* @slot - Popup content.
|
|
14
|
+
*/
|
|
15
|
+
declare class SigveloLeafletPopup extends LitElement {
|
|
16
|
+
/** @internal */
|
|
17
|
+
static styles: import("lit").CSSResult[];
|
|
18
|
+
/** Maximum width of the popup in pixels. */
|
|
19
|
+
maxWidth: number;
|
|
20
|
+
/** Minimum width of the popup in pixels. */
|
|
21
|
+
minWidth: number;
|
|
22
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
23
|
+
}
|
|
24
|
+
declare global {
|
|
25
|
+
interface HTMLElementTagNameMap {
|
|
26
|
+
"sigvelo-leaflet-popup": SigveloLeafletPopup;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { SigveloLeafletPopup };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as L from "leaflet";
|
|
2
|
+
import { LitElement } from "lit";
|
|
3
|
+
|
|
4
|
+
//#region src/components/scale-control/scale-control.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* A scale bar control for a Leaflet map. Must be a child of `<sigvelo-leaflet-map>`.
|
|
7
|
+
*
|
|
8
|
+
* @tag sigvelo-leaflet-scale-control
|
|
9
|
+
*/
|
|
10
|
+
declare class SigveloLeafletScaleControl extends LitElement {
|
|
11
|
+
/** @internal */
|
|
12
|
+
static styles: import("lit").CSSResult[];
|
|
13
|
+
/** Position of the control on the map. */
|
|
14
|
+
position: L.ControlPosition;
|
|
15
|
+
/** Whether to show the metric scale line. */
|
|
16
|
+
metric: boolean;
|
|
17
|
+
/** Whether to show the imperial scale line. */
|
|
18
|
+
imperial: boolean;
|
|
19
|
+
/** Maximum width of the control in pixels. */
|
|
20
|
+
maxWidth: number;
|
|
21
|
+
/** @internal */
|
|
22
|
+
private _control;
|
|
23
|
+
/** @internal */
|
|
24
|
+
private _mapEl;
|
|
25
|
+
connectedCallback(): Promise<void>;
|
|
26
|
+
disconnectedCallback(): void;
|
|
27
|
+
/** @internal */
|
|
28
|
+
private _addControl;
|
|
29
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
30
|
+
}
|
|
31
|
+
declare global {
|
|
32
|
+
interface HTMLElementTagNameMap {
|
|
33
|
+
"sigvelo-leaflet-scale-control": SigveloLeafletScaleControl;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { SigveloLeafletScaleControl };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { LitElement, PropertyValues } from "lit";
|
|
2
|
+
|
|
3
|
+
//#region src/components/tilelayer/tilelayer.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* A tile layer for a Leaflet map. Must be a child of `<sigvelo-leaflet-map>`.
|
|
6
|
+
*
|
|
7
|
+
* @tag sigvelo-leaflet-tilelayer
|
|
8
|
+
*/
|
|
9
|
+
declare class SigveloLeafletTilelayer extends LitElement {
|
|
10
|
+
/** @internal */
|
|
11
|
+
static styles: import("lit").CSSResult[];
|
|
12
|
+
/** URL template for tiles (e.g. `https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png`). */
|
|
13
|
+
url: string;
|
|
14
|
+
/** Attribution text for this tile layer. */
|
|
15
|
+
attribution: string;
|
|
16
|
+
/** Minimum zoom for this layer. */
|
|
17
|
+
minZoom: number;
|
|
18
|
+
/** Maximum zoom for this layer. */
|
|
19
|
+
maxZoom: number;
|
|
20
|
+
/** Tile subdomains. */
|
|
21
|
+
subdomains: string;
|
|
22
|
+
/** Opacity of the tile layer (0-1). */
|
|
23
|
+
opacity: number;
|
|
24
|
+
/** @internal */
|
|
25
|
+
private _layer;
|
|
26
|
+
/** @internal */
|
|
27
|
+
private _mapEl;
|
|
28
|
+
connectedCallback(): Promise<void>;
|
|
29
|
+
disconnectedCallback(): void;
|
|
30
|
+
/** @internal */
|
|
31
|
+
private _addLayer;
|
|
32
|
+
/** @internal */
|
|
33
|
+
private _removeLayer;
|
|
34
|
+
protected updated(changed: PropertyValues): void;
|
|
35
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
36
|
+
}
|
|
37
|
+
declare global {
|
|
38
|
+
interface HTMLElementTagNameMap {
|
|
39
|
+
"sigvelo-leaflet-tilelayer": SigveloLeafletTilelayer;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { SigveloLeafletTilelayer };
|
|
@@ -0,0 +1,67 @@
|
|
|
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/control/control.styles.ts
|
|
7
|
+
var control_styles_default = css`
|
|
8
|
+
:host {
|
|
9
|
+
display: none;
|
|
10
|
+
}
|
|
11
|
+
`;
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/components/control/control.ts
|
|
14
|
+
let SigveloLeafletControl = class SigveloLeafletControl extends LitElement {
|
|
15
|
+
constructor(..._args) {
|
|
16
|
+
super(..._args);
|
|
17
|
+
this.position = "bottom-left";
|
|
18
|
+
this._control = null;
|
|
19
|
+
this._mapEl = null;
|
|
20
|
+
}
|
|
21
|
+
static {
|
|
22
|
+
this.styles = [control_styles_default];
|
|
23
|
+
}
|
|
24
|
+
/** @internal Map position names to Leaflet format. */
|
|
25
|
+
_toLeafletPosition() {
|
|
26
|
+
return {
|
|
27
|
+
"top-left": "topleft",
|
|
28
|
+
"top-right": "topright",
|
|
29
|
+
"bottom-left": "bottomleft",
|
|
30
|
+
"bottom-right": "bottomright"
|
|
31
|
+
}[this.position] ?? "bottomleft";
|
|
32
|
+
}
|
|
33
|
+
async connectedCallback() {
|
|
34
|
+
super.connectedCallback();
|
|
35
|
+
this._mapEl = findLeafletMap(this);
|
|
36
|
+
if (this._mapEl) {
|
|
37
|
+
await this._mapEl.mapReady;
|
|
38
|
+
this._addControl();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
disconnectedCallback() {
|
|
42
|
+
super.disconnectedCallback();
|
|
43
|
+
this._control?.remove();
|
|
44
|
+
this._control = null;
|
|
45
|
+
}
|
|
46
|
+
/** @internal */
|
|
47
|
+
_addControl() {
|
|
48
|
+
if (!this._mapEl?.map) return;
|
|
49
|
+
const children = Array.from(this.children);
|
|
50
|
+
const CustomControl = L.Control.extend({ onAdd: () => {
|
|
51
|
+
const container = L.DomUtil.create("div", "sigvelo-leaflet-custom-control");
|
|
52
|
+
for (const child of children) container.appendChild(child);
|
|
53
|
+
L.DomEvent.disableClickPropagation(container);
|
|
54
|
+
L.DomEvent.disableScrollPropagation(container);
|
|
55
|
+
return container;
|
|
56
|
+
} });
|
|
57
|
+
this._control = new CustomControl({ position: this._toLeafletPosition() });
|
|
58
|
+
this._control.addTo(this._mapEl.map);
|
|
59
|
+
}
|
|
60
|
+
render() {
|
|
61
|
+
return html` <slot></slot> `;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
__decorate([property()], SigveloLeafletControl.prototype, "position", void 0);
|
|
65
|
+
SigveloLeafletControl = __decorate([customElement("sigvelo-leaflet-control")], SigveloLeafletControl);
|
|
66
|
+
//#endregion
|
|
67
|
+
export { SigveloLeafletControl as t };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region \0@oxc-project+runtime@0.138.0/helpers/esm/decorate.js
|
|
2
|
+
function __decorate(decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { __decorate as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as L from "leaflet";
|
|
2
|
+
import iconUrl from "leaflet/dist/images/marker-icon.png";
|
|
3
|
+
import iconRetinaUrl from "leaflet/dist/images/marker-icon-2x.png";
|
|
4
|
+
import shadowUrl from "leaflet/dist/images/marker-shadow.png";
|
|
5
|
+
//#region src/default-icon.ts
|
|
6
|
+
L.Icon.Default.mergeOptions({
|
|
7
|
+
iconUrl,
|
|
8
|
+
iconRetinaUrl,
|
|
9
|
+
shadowUrl
|
|
10
|
+
});
|
|
11
|
+
//#endregion
|
|
12
|
+
export {};
|