@mcp-b/geo-openlayers 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-BiLEqiGC.js +102 -0
- package/dist/components/circle/circle.d.ts +47 -0
- package/dist/components/circle/circle.js +2 -0
- package/dist/components/control/control.d.ts +41 -0
- package/dist/components/control/control.js +2 -0
- package/dist/components/geojson/geojson.d.ts +66 -0
- package/dist/components/geojson/geojson.js +2 -0
- package/dist/components/map/map.d.ts +45 -0
- package/dist/components/map/map.js +2 -0
- package/dist/components/marker/marker.d.ts +46 -0
- package/dist/components/marker/marker.js +2 -0
- package/dist/components/overlay/overlay.d.ts +40 -0
- package/dist/components/overlay/overlay.js +2 -0
- package/dist/components/polygon/polygon.d.ts +45 -0
- package/dist/components/polygon/polygon.js +2 -0
- package/dist/components/polyline/polyline.d.ts +45 -0
- package/dist/components/polyline/polyline.js +2 -0
- package/dist/components/popup/popup.d.ts +27 -0
- package/dist/components/popup/popup.js +2 -0
- package/dist/components/scale-control/scale-control.d.ts +32 -0
- package/dist/components/scale-control/scale-control.js +2 -0
- package/dist/components/tilelayer/tilelayer.d.ts +38 -0
- package/dist/components/tilelayer/tilelayer.js +2 -0
- package/dist/control-CTiiOtzM.js +59 -0
- package/dist/decorate-DcF3lt7P.js +9 -0
- package/dist/docs/custom-elements.json +1404 -0
- package/dist/geojson-BU-tOeyz.js +184 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +12 -0
- package/dist/map-eGQh7n8O.js +146 -0
- package/dist/marker-DEG_oTfJ.js +124 -0
- package/dist/overlay-BFXjnhLj.js +65 -0
- package/dist/polygon-BaKBzEHK.js +105 -0
- package/dist/polyline-DXXHbwfm.js +89 -0
- package/dist/popup-CpiCysPO.js +30 -0
- package/dist/scale-control-zMLnp2Rt.js +57 -0
- package/dist/tilelayer-BAC1OCHe.js +73 -0
- package/package.json +76 -0
|
@@ -0,0 +1,89 @@
|
|
|
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
|
+
import { fromLonLat } from "ol/proj.js";
|
|
5
|
+
import VectorLayer from "ol/layer/Vector.js";
|
|
6
|
+
import VectorSource from "ol/source/Vector.js";
|
|
7
|
+
import { Stroke, Style } from "ol/style.js";
|
|
8
|
+
import Feature from "ol/Feature.js";
|
|
9
|
+
import LineString from "ol/geom/LineString.js";
|
|
10
|
+
//#region src/components/polyline/polyline.styles.ts
|
|
11
|
+
var polyline_styles_default = css`
|
|
12
|
+
:host {
|
|
13
|
+
display: none;
|
|
14
|
+
}
|
|
15
|
+
`;
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/components/polyline/polyline.ts
|
|
18
|
+
let SigveloOlPolyline = class SigveloOlPolyline extends LitElement {
|
|
19
|
+
constructor(..._args) {
|
|
20
|
+
super(..._args);
|
|
21
|
+
this.positions = [];
|
|
22
|
+
this.color = "#3388ff";
|
|
23
|
+
this.width = 3;
|
|
24
|
+
this.opacity = 1;
|
|
25
|
+
this.dashArray = [];
|
|
26
|
+
this._layer = null;
|
|
27
|
+
this._feature = null;
|
|
28
|
+
this._mapEl = null;
|
|
29
|
+
}
|
|
30
|
+
static {
|
|
31
|
+
this.styles = [polyline_styles_default];
|
|
32
|
+
}
|
|
33
|
+
async connectedCallback() {
|
|
34
|
+
super.connectedCallback();
|
|
35
|
+
this._mapEl = this.closest("sigvelo-ol-map");
|
|
36
|
+
if (this._mapEl) {
|
|
37
|
+
await this._mapEl.mapReady;
|
|
38
|
+
this._addLine();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
disconnectedCallback() {
|
|
42
|
+
super.disconnectedCallback();
|
|
43
|
+
if (this._layer && this._mapEl?.map) this._mapEl.map.removeLayer(this._layer);
|
|
44
|
+
this._layer = null;
|
|
45
|
+
this._feature = null;
|
|
46
|
+
}
|
|
47
|
+
/** @internal */
|
|
48
|
+
_toCoords() {
|
|
49
|
+
return this.positions.map(([lat, lng]) => fromLonLat([lng, lat]));
|
|
50
|
+
}
|
|
51
|
+
/** @internal */
|
|
52
|
+
_hexToRgba(hex, opacity) {
|
|
53
|
+
return `rgba(${parseInt(hex.slice(1, 3), 16)}, ${parseInt(hex.slice(3, 5), 16)}, ${parseInt(hex.slice(5, 7), 16)}, ${opacity})`;
|
|
54
|
+
}
|
|
55
|
+
/** @internal */
|
|
56
|
+
_addLine() {
|
|
57
|
+
if (!this._mapEl?.map || this.positions.length < 2) return;
|
|
58
|
+
this._feature = new Feature({ geometry: new LineString(this._toCoords()) });
|
|
59
|
+
this._layer = new VectorLayer({
|
|
60
|
+
source: new VectorSource({ features: [this._feature] }),
|
|
61
|
+
style: new Style({ stroke: new Stroke({
|
|
62
|
+
color: this._hexToRgba(this.color, this.opacity),
|
|
63
|
+
width: this.width,
|
|
64
|
+
lineDash: this.dashArray.length ? this.dashArray : void 0
|
|
65
|
+
}) })
|
|
66
|
+
});
|
|
67
|
+
this._mapEl.map.addLayer(this._layer);
|
|
68
|
+
}
|
|
69
|
+
updated(changed) {
|
|
70
|
+
if (!this._feature || !this._layer) return;
|
|
71
|
+
if (changed.has("positions")) this._feature.getGeometry().setCoordinates(this._toCoords());
|
|
72
|
+
if (changed.has("color") || changed.has("width") || changed.has("opacity") || changed.has("dashArray")) this._layer.setStyle(new Style({ stroke: new Stroke({
|
|
73
|
+
color: this._hexToRgba(this.color, this.opacity),
|
|
74
|
+
width: this.width,
|
|
75
|
+
lineDash: this.dashArray.length ? this.dashArray : void 0
|
|
76
|
+
}) }));
|
|
77
|
+
}
|
|
78
|
+
render() {
|
|
79
|
+
return html``;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
__decorate([property({ attribute: false })], SigveloOlPolyline.prototype, "positions", void 0);
|
|
83
|
+
__decorate([property()], SigveloOlPolyline.prototype, "color", void 0);
|
|
84
|
+
__decorate([property({ type: Number })], SigveloOlPolyline.prototype, "width", void 0);
|
|
85
|
+
__decorate([property({ type: Number })], SigveloOlPolyline.prototype, "opacity", void 0);
|
|
86
|
+
__decorate([property({ attribute: false })], SigveloOlPolyline.prototype, "dashArray", void 0);
|
|
87
|
+
SigveloOlPolyline = __decorate([customElement("sigvelo-ol-polyline")], SigveloOlPolyline);
|
|
88
|
+
//#endregion
|
|
89
|
+
export { SigveloOlPolyline as t };
|
|
@@ -0,0 +1,30 @@
|
|
|
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 SigveloOlPopup = class SigveloOlPopup extends LitElement {
|
|
13
|
+
constructor(..._args) {
|
|
14
|
+
super(..._args);
|
|
15
|
+
this.maxWidth = 300;
|
|
16
|
+
}
|
|
17
|
+
static {
|
|
18
|
+
this.styles = [popup_styles_default];
|
|
19
|
+
}
|
|
20
|
+
render() {
|
|
21
|
+
return html` <slot></slot> `;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
__decorate([property({
|
|
25
|
+
attribute: "max-width",
|
|
26
|
+
type: Number
|
|
27
|
+
})], SigveloOlPopup.prototype, "maxWidth", void 0);
|
|
28
|
+
SigveloOlPopup = __decorate([customElement("sigvelo-ol-popup")], SigveloOlPopup);
|
|
29
|
+
//#endregion
|
|
30
|
+
export { SigveloOlPopup as t };
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
import ScaleLine from "ol/control/ScaleLine.js";
|
|
5
|
+
//#region src/components/scale-control/scale-control.styles.ts
|
|
6
|
+
var scale_control_styles_default = css`
|
|
7
|
+
:host {
|
|
8
|
+
display: none;
|
|
9
|
+
}
|
|
10
|
+
`;
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/components/scale-control/scale-control.ts
|
|
13
|
+
let SigveloOlScaleControl = class SigveloOlScaleControl extends LitElement {
|
|
14
|
+
constructor(..._args) {
|
|
15
|
+
super(..._args);
|
|
16
|
+
this.units = "metric";
|
|
17
|
+
this.minWidth = 64;
|
|
18
|
+
this._control = null;
|
|
19
|
+
this._mapEl = null;
|
|
20
|
+
}
|
|
21
|
+
static {
|
|
22
|
+
this.styles = [scale_control_styles_default];
|
|
23
|
+
}
|
|
24
|
+
async connectedCallback() {
|
|
25
|
+
super.connectedCallback();
|
|
26
|
+
this._mapEl = this.closest("sigvelo-ol-map");
|
|
27
|
+
if (this._mapEl) {
|
|
28
|
+
await this._mapEl.mapReady;
|
|
29
|
+
this._addControl();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
disconnectedCallback() {
|
|
33
|
+
super.disconnectedCallback();
|
|
34
|
+
if (this._control && this._mapEl?.map) this._mapEl.map.removeControl(this._control);
|
|
35
|
+
this._control = null;
|
|
36
|
+
}
|
|
37
|
+
/** @internal */
|
|
38
|
+
_addControl() {
|
|
39
|
+
if (!this._mapEl?.map) return;
|
|
40
|
+
this._control = new ScaleLine({
|
|
41
|
+
units: this.units,
|
|
42
|
+
minWidth: this.minWidth
|
|
43
|
+
});
|
|
44
|
+
this._mapEl.map.addControl(this._control);
|
|
45
|
+
}
|
|
46
|
+
render() {
|
|
47
|
+
return html``;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
__decorate([property()], SigveloOlScaleControl.prototype, "units", void 0);
|
|
51
|
+
__decorate([property({
|
|
52
|
+
attribute: "min-width",
|
|
53
|
+
type: Number
|
|
54
|
+
})], SigveloOlScaleControl.prototype, "minWidth", void 0);
|
|
55
|
+
SigveloOlScaleControl = __decorate([customElement("sigvelo-ol-scale-control")], SigveloOlScaleControl);
|
|
56
|
+
//#endregion
|
|
57
|
+
export { SigveloOlScaleControl as t };
|
|
@@ -0,0 +1,73 @@
|
|
|
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
|
+
import TileLayer from "ol/layer/Tile.js";
|
|
5
|
+
import OSM from "ol/source/OSM.js";
|
|
6
|
+
import XYZ from "ol/source/XYZ.js";
|
|
7
|
+
//#region src/components/tilelayer/tilelayer.styles.ts
|
|
8
|
+
var tilelayer_styles_default = css`
|
|
9
|
+
:host {
|
|
10
|
+
display: none;
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/components/tilelayer/tilelayer.ts
|
|
15
|
+
let SigveloOlTilelayer = class SigveloOlTilelayer extends LitElement {
|
|
16
|
+
constructor(..._args) {
|
|
17
|
+
super(..._args);
|
|
18
|
+
this.url = "";
|
|
19
|
+
this.attribution = "";
|
|
20
|
+
this.opacity = 1;
|
|
21
|
+
this._layer = null;
|
|
22
|
+
this._mapEl = null;
|
|
23
|
+
}
|
|
24
|
+
static {
|
|
25
|
+
this.styles = [tilelayer_styles_default];
|
|
26
|
+
}
|
|
27
|
+
async connectedCallback() {
|
|
28
|
+
super.connectedCallback();
|
|
29
|
+
this._mapEl = this.closest("sigvelo-ol-map");
|
|
30
|
+
if (this._mapEl) {
|
|
31
|
+
await this._mapEl.mapReady;
|
|
32
|
+
this._addLayer();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
disconnectedCallback() {
|
|
36
|
+
super.disconnectedCallback();
|
|
37
|
+
this._removeLayer();
|
|
38
|
+
}
|
|
39
|
+
/** @internal */
|
|
40
|
+
_addLayer() {
|
|
41
|
+
if (!this._mapEl?.map) return;
|
|
42
|
+
const source = this.url ? new XYZ({
|
|
43
|
+
url: this.url,
|
|
44
|
+
attributions: this.attribution || void 0
|
|
45
|
+
}) : new OSM();
|
|
46
|
+
this._layer = new TileLayer({
|
|
47
|
+
source,
|
|
48
|
+
opacity: this.opacity
|
|
49
|
+
});
|
|
50
|
+
this._mapEl.map.addLayer(this._layer);
|
|
51
|
+
}
|
|
52
|
+
/** @internal */
|
|
53
|
+
_removeLayer() {
|
|
54
|
+
if (this._layer && this._mapEl?.map) this._mapEl.map.removeLayer(this._layer);
|
|
55
|
+
this._layer = null;
|
|
56
|
+
}
|
|
57
|
+
updated(changed) {
|
|
58
|
+
if (changed.has("url")) {
|
|
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()], SigveloOlTilelayer.prototype, "url", void 0);
|
|
69
|
+
__decorate([property()], SigveloOlTilelayer.prototype, "attribution", void 0);
|
|
70
|
+
__decorate([property({ type: Number })], SigveloOlTilelayer.prototype, "opacity", void 0);
|
|
71
|
+
SigveloOlTilelayer = __decorate([customElement("sigvelo-ol-tilelayer")], SigveloOlTilelayer);
|
|
72
|
+
//#endregion
|
|
73
|
+
export { SigveloOlTilelayer as t };
|
package/package.json
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mcp-b/geo-openlayers",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "OpenLayers web components for Sigvelo, built with Lit.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"custom-elements",
|
|
7
|
+
"geospatial",
|
|
8
|
+
"gis",
|
|
9
|
+
"lit-element",
|
|
10
|
+
"maps",
|
|
11
|
+
"ogc",
|
|
12
|
+
"openlayers",
|
|
13
|
+
"web-components"
|
|
14
|
+
],
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/WebMCP-org/design-system.git",
|
|
19
|
+
"directory": "packages/geo-openlayers"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist"
|
|
23
|
+
],
|
|
24
|
+
"type": "module",
|
|
25
|
+
"types": "dist/index.d.ts",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"import": "./dist/index.js"
|
|
30
|
+
},
|
|
31
|
+
"./components/*": "./dist/components/*",
|
|
32
|
+
"./custom-elements.json": "./dist/docs/custom-elements.json"
|
|
33
|
+
},
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@mcp-b/geo-support": "0.2.0",
|
|
39
|
+
"@mcp-b/wc-support": "0.2.0"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@custom-elements-manifest/analyzer": "^0.10.4",
|
|
43
|
+
"@storybook/addon-a11y": "^10.5.2",
|
|
44
|
+
"@storybook/addon-docs": "^10.5.2",
|
|
45
|
+
"@storybook/addon-vitest": "^10.5.2",
|
|
46
|
+
"@storybook/web-components-vite": "10.5.2",
|
|
47
|
+
"@vitest/browser-playwright": "^4.1.10",
|
|
48
|
+
"@vitest/coverage-v8": "^4.1.10",
|
|
49
|
+
"@wc-toolkit/cem-inheritance": "^1.2.2",
|
|
50
|
+
"@wc-toolkit/cem-sorter": "^1.0.1",
|
|
51
|
+
"@wc-toolkit/type-parser": "^1.2.0",
|
|
52
|
+
"ol": "^10.5.0",
|
|
53
|
+
"playwright": "~1.61.0",
|
|
54
|
+
"storybook": "^10.5.2",
|
|
55
|
+
"tinyglobby": "^0.2.15",
|
|
56
|
+
"typescript": "^6.0.3",
|
|
57
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@0.2.4",
|
|
58
|
+
"vite-plugin-static-copy": "^3.3.0",
|
|
59
|
+
"vitest": "^4.1.10"
|
|
60
|
+
},
|
|
61
|
+
"peerDependencies": {
|
|
62
|
+
"lit": "^3.0.0",
|
|
63
|
+
"lit-html": "^3.0.0",
|
|
64
|
+
"ol": "^10.0.0"
|
|
65
|
+
},
|
|
66
|
+
"customElements": "dist/docs/custom-elements.json",
|
|
67
|
+
"scripts": {
|
|
68
|
+
"analyze": "cem analyze",
|
|
69
|
+
"analyze:dev": "cem analyze --watch",
|
|
70
|
+
"build": "tsc -p tsconfig.prod.json && vp run build:lib && vp run analyze",
|
|
71
|
+
"build:lib": "vp pack",
|
|
72
|
+
"storybook": "vp run @mcp-b/web-components#storybook",
|
|
73
|
+
"test": "vp run @mcp-b/web-components#test",
|
|
74
|
+
"typecheck": "tsc --noEmit"
|
|
75
|
+
}
|
|
76
|
+
}
|