@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
@@ -0,0 +1,35 @@
1
+ import { t as __decorate } from "./decorate-DcF3lt7P.js";
2
+ import { LitElement, css, html } from "lit";
3
+ import { customElement, property } from "lit/decorators.js";
4
+ //#region src/components/popup/popup.styles.ts
5
+ var popup_styles_default = css`
6
+ :host {
7
+ display: none;
8
+ }
9
+ `;
10
+ //#endregion
11
+ //#region src/components/popup/popup.ts
12
+ let SigveloLeafletPopup = class SigveloLeafletPopup extends LitElement {
13
+ constructor(..._args) {
14
+ super(..._args);
15
+ this.maxWidth = 300;
16
+ this.minWidth = 50;
17
+ }
18
+ static {
19
+ this.styles = [popup_styles_default];
20
+ }
21
+ render() {
22
+ return html` <slot></slot> `;
23
+ }
24
+ };
25
+ __decorate([property({
26
+ attribute: "max-width",
27
+ type: Number
28
+ })], SigveloLeafletPopup.prototype, "maxWidth", void 0);
29
+ __decorate([property({
30
+ attribute: "min-width",
31
+ type: Number
32
+ })], SigveloLeafletPopup.prototype, "minWidth", void 0);
33
+ SigveloLeafletPopup = __decorate([customElement("sigvelo-leaflet-popup")], SigveloLeafletPopup);
34
+ //#endregion
35
+ export { SigveloLeafletPopup as t };
@@ -0,0 +1,63 @@
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/scale-control/scale-control.styles.ts
7
+ var scale_control_styles_default = css`
8
+ :host {
9
+ display: none;
10
+ }
11
+ `;
12
+ //#endregion
13
+ //#region src/components/scale-control/scale-control.ts
14
+ let SigveloLeafletScaleControl = class SigveloLeafletScaleControl extends LitElement {
15
+ constructor(..._args) {
16
+ super(..._args);
17
+ this.position = "bottomleft";
18
+ this.metric = true;
19
+ this.imperial = true;
20
+ this.maxWidth = 100;
21
+ this._control = null;
22
+ this._mapEl = null;
23
+ }
24
+ static {
25
+ this.styles = [scale_control_styles_default];
26
+ }
27
+ async connectedCallback() {
28
+ super.connectedCallback();
29
+ this._mapEl = findLeafletMap(this);
30
+ if (this._mapEl) {
31
+ await this._mapEl.mapReady;
32
+ this._addControl();
33
+ }
34
+ }
35
+ disconnectedCallback() {
36
+ super.disconnectedCallback();
37
+ if (this._control && this._mapEl?.map) this._control.remove();
38
+ this._control = null;
39
+ }
40
+ /** @internal */
41
+ _addControl() {
42
+ if (!this._mapEl?.map) return;
43
+ this._control = L.control.scale({
44
+ position: this.position,
45
+ metric: this.metric,
46
+ imperial: this.imperial,
47
+ maxWidth: this.maxWidth
48
+ }).addTo(this._mapEl.map);
49
+ }
50
+ render() {
51
+ return html``;
52
+ }
53
+ };
54
+ __decorate([property()], SigveloLeafletScaleControl.prototype, "position", void 0);
55
+ __decorate([property({ type: Boolean })], SigveloLeafletScaleControl.prototype, "metric", void 0);
56
+ __decorate([property({ type: Boolean })], SigveloLeafletScaleControl.prototype, "imperial", void 0);
57
+ __decorate([property({
58
+ attribute: "max-width",
59
+ type: Number
60
+ })], SigveloLeafletScaleControl.prototype, "maxWidth", void 0);
61
+ SigveloLeafletScaleControl = __decorate([customElement("sigvelo-leaflet-scale-control")], SigveloLeafletScaleControl);
62
+ //#endregion
63
+ export { SigveloLeafletScaleControl as t };
@@ -0,0 +1,82 @@
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/tilelayer/tilelayer.styles.ts
7
+ var tilelayer_styles_default = css`
8
+ :host {
9
+ display: none;
10
+ }
11
+ `;
12
+ //#endregion
13
+ //#region src/components/tilelayer/tilelayer.ts
14
+ let SigveloLeafletTilelayer = class SigveloLeafletTilelayer extends LitElement {
15
+ constructor(..._args) {
16
+ super(..._args);
17
+ this.url = "";
18
+ this.attribution = "";
19
+ this.minZoom = 0;
20
+ this.maxZoom = 19;
21
+ this.subdomains = "abc";
22
+ this.opacity = 1;
23
+ this._layer = null;
24
+ this._mapEl = null;
25
+ }
26
+ static {
27
+ this.styles = [tilelayer_styles_default];
28
+ }
29
+ async connectedCallback() {
30
+ super.connectedCallback();
31
+ this._mapEl = findLeafletMap(this);
32
+ if (this._mapEl) {
33
+ await this._mapEl.mapReady;
34
+ this._addLayer();
35
+ }
36
+ }
37
+ disconnectedCallback() {
38
+ super.disconnectedCallback();
39
+ this._removeLayer();
40
+ }
41
+ /** @internal */
42
+ _addLayer() {
43
+ if (!this._mapEl?.map || !this.url) return;
44
+ this._layer = L.tileLayer(this.url, {
45
+ attribution: this.attribution,
46
+ minZoom: this.minZoom,
47
+ maxZoom: this.maxZoom,
48
+ subdomains: this.subdomains,
49
+ opacity: this.opacity
50
+ }).addTo(this._mapEl.map);
51
+ }
52
+ /** @internal */
53
+ _removeLayer() {
54
+ this._layer?.remove();
55
+ this._layer = null;
56
+ }
57
+ updated(changed) {
58
+ if (changed.has("url") && this._layer) {
59
+ this._removeLayer();
60
+ this._addLayer();
61
+ }
62
+ if (changed.has("opacity") && this._layer) this._layer.setOpacity(this.opacity);
63
+ }
64
+ render() {
65
+ return html``;
66
+ }
67
+ };
68
+ __decorate([property()], SigveloLeafletTilelayer.prototype, "url", void 0);
69
+ __decorate([property()], SigveloLeafletTilelayer.prototype, "attribution", void 0);
70
+ __decorate([property({
71
+ attribute: "min-zoom",
72
+ type: Number
73
+ })], SigveloLeafletTilelayer.prototype, "minZoom", void 0);
74
+ __decorate([property({
75
+ attribute: "max-zoom",
76
+ type: Number
77
+ })], SigveloLeafletTilelayer.prototype, "maxZoom", void 0);
78
+ __decorate([property()], SigveloLeafletTilelayer.prototype, "subdomains", void 0);
79
+ __decorate([property({ type: Number })], SigveloLeafletTilelayer.prototype, "opacity", void 0);
80
+ SigveloLeafletTilelayer = __decorate([customElement("sigvelo-leaflet-tilelayer")], SigveloLeafletTilelayer);
81
+ //#endregion
82
+ export { SigveloLeafletTilelayer as t };
package/package.json ADDED
@@ -0,0 +1,75 @@
1
+ {
2
+ "name": "@mcp-b/geo-leaflet",
3
+ "version": "0.2.0",
4
+ "description": "Leaflet web components for Sigvelo, built with Lit.",
5
+ "keywords": [
6
+ "custom-elements",
7
+ "geospatial",
8
+ "leaflet",
9
+ "lit-element",
10
+ "maps",
11
+ "web-components"
12
+ ],
13
+ "license": "MIT",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/WebMCP-org/design-system.git",
17
+ "directory": "packages/geo-leaflet"
18
+ },
19
+ "files": [
20
+ "dist"
21
+ ],
22
+ "type": "module",
23
+ "types": "dist/index.d.ts",
24
+ "exports": {
25
+ ".": {
26
+ "types": "./dist/index.d.ts",
27
+ "import": "./dist/index.js"
28
+ },
29
+ "./components/*": "./dist/components/*",
30
+ "./custom-elements.json": "./dist/docs/custom-elements.json"
31
+ },
32
+ "publishConfig": {
33
+ "access": "public"
34
+ },
35
+ "dependencies": {
36
+ "@mcp-b/geo-support": "0.2.0",
37
+ "@mcp-b/wc-support": "0.2.0"
38
+ },
39
+ "devDependencies": {
40
+ "@custom-elements-manifest/analyzer": "^0.10.4",
41
+ "@storybook/addon-a11y": "^10.5.2",
42
+ "@storybook/addon-docs": "^10.5.2",
43
+ "@storybook/addon-vitest": "^10.5.2",
44
+ "@storybook/web-components-vite": "10.5.2",
45
+ "@types/leaflet": "^1.9.0",
46
+ "@vitest/browser-playwright": "^4.1.10",
47
+ "@vitest/coverage-v8": "^4.1.10",
48
+ "@wc-toolkit/cem-inheritance": "^1.2.2",
49
+ "@wc-toolkit/cem-sorter": "^1.0.1",
50
+ "@wc-toolkit/type-parser": "^1.2.0",
51
+ "leaflet": "^1.9.0",
52
+ "playwright": "~1.61.0",
53
+ "storybook": "^10.5.2",
54
+ "tinyglobby": "^0.2.15",
55
+ "typescript": "^6.0.3",
56
+ "vite": "npm:@voidzero-dev/vite-plus-core@0.2.4",
57
+ "vite-plugin-static-copy": "^3.3.0",
58
+ "vitest": "^4.1.10"
59
+ },
60
+ "peerDependencies": {
61
+ "leaflet": "^1.9.0",
62
+ "lit": "^3.0.0",
63
+ "lit-html": "^3.0.0"
64
+ },
65
+ "customElements": "dist/docs/custom-elements.json",
66
+ "scripts": {
67
+ "analyze": "cem analyze",
68
+ "analyze:dev": "cem analyze --watch",
69
+ "build": "tsc -p tsconfig.prod.json && vp run build:lib && vp run analyze",
70
+ "build:lib": "vp pack",
71
+ "storybook": "vp run @mcp-b/web-components#storybook",
72
+ "test": "vp run @mcp-b/web-components#test",
73
+ "typecheck": "tsc --noEmit"
74
+ }
75
+ }