@opensystemslab/map 0.8.2 → 1.0.0-alpha.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +20 -0
- package/dist/component-lib.es.js +1 -1
- package/dist/component-lib.umd.js +131 -111
- package/dist/{html2canvas.esm-DbilGY6A.mjs → html2canvas.esm-d2sM-0Wm.mjs} +55 -71
- package/dist/{index-1HbxZ3C1.mjs → index-BcNEfKoK.mjs} +44179 -40735
- package/dist/{index.es-BF5JbvAz.mjs → index.es-DNpy3O6w.mjs} +1405 -1511
- package/dist/index.html +13 -8
- package/dist/purify.es-B7BPtUgm.mjs +471 -0
- package/dist/style.css +1 -1
- package/package.json +18 -13
- package/types/components/address-autocomplete/index.d.ts +5 -1
- package/types/components/my-map/drawing.d.ts +6 -5
- package/types/components/my-map/index.d.ts +34 -4
- package/types/components/my-map/layers.d.ts +10 -0
- package/types/components/my-map/os-features.d.ts +2 -2
- package/types/components/my-map/utils.d.ts +3 -3
- package/dist/purify.es-D6iZHRnd.mjs +0 -471
- package/types/components/my-map/os-layers.d.ts +0 -5
- /package/types/components/my-map/{os-layers.test.d.ts → layers.test.d.ts} +0 -0
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@opensystemslab/map",
|
3
|
-
"version": "0.
|
3
|
+
"version": "1.0.0-alpha.0",
|
4
4
|
"license": "MPL-2.0",
|
5
5
|
"private": false,
|
6
6
|
"repository": {
|
@@ -26,36 +26,36 @@
|
|
26
26
|
"docsPublish": "pitsby build"
|
27
27
|
},
|
28
28
|
"dependencies": {
|
29
|
-
"@turf/union": "^
|
29
|
+
"@turf/union": "^7.0.0",
|
30
30
|
"accessible-autocomplete": "^2.0.4",
|
31
31
|
"file-saver": "^2.0.5",
|
32
|
-
"govuk-frontend": "^5.
|
32
|
+
"govuk-frontend": "^5.4.0",
|
33
33
|
"jspdf": "^2.5.1",
|
34
34
|
"lit": "^3.0.1",
|
35
35
|
"ol": "^9.1.0",
|
36
|
-
"ol-ext": "^4.0.
|
36
|
+
"ol-ext": "^4.0.21",
|
37
37
|
"ol-mapbox-style": "^12.3.0",
|
38
38
|
"postcode": "^5.1.0",
|
39
|
-
"proj4": "^2.
|
40
|
-
"rambda": "^
|
39
|
+
"proj4": "^2.11.0",
|
40
|
+
"rambda": "^9.2.1"
|
41
41
|
},
|
42
42
|
"devDependencies": {
|
43
|
-
"@glorious/pitsby": "^1.37.
|
44
|
-
"@testing-library/dom": "^
|
43
|
+
"@glorious/pitsby": "^1.37.2",
|
44
|
+
"@testing-library/dom": "^10.4.0",
|
45
45
|
"@testing-library/user-event": "^14.5.2",
|
46
46
|
"@types/file-saver": "^2.0.7",
|
47
|
-
"@types/node": "
|
47
|
+
"@types/node": "22.0.3",
|
48
48
|
"@types/ol-ext": "npm:@siedlerchr/types-ol-ext@^3.3.0",
|
49
49
|
"@types/proj4": "^2.5.5",
|
50
50
|
"@vitest/ui": "^0.34.7",
|
51
51
|
"happy-dom": "^9.1.9",
|
52
52
|
"husky": "^8.0.3",
|
53
|
-
"lint-staged": "^
|
53
|
+
"lint-staged": "^15.2.7",
|
54
54
|
"prettier": "^3.2.5",
|
55
55
|
"rollup-plugin-postcss-lit": "^2.1.0",
|
56
56
|
"sass": "^1.69.5",
|
57
|
-
"typescript": "^5.
|
58
|
-
"vite": "^5.
|
57
|
+
"typescript": "^5.5.2",
|
58
|
+
"vite": "^5.3.2",
|
59
59
|
"vitest": "0.34.6",
|
60
60
|
"wait-for-expect": "^3.0.2"
|
61
61
|
},
|
@@ -65,5 +65,10 @@
|
|
65
65
|
"stackblitz": {
|
66
66
|
"startCommand": "npm run test:ui"
|
67
67
|
},
|
68
|
-
"packageManager": "pnpm@
|
68
|
+
"packageManager": "pnpm@8.6.6",
|
69
|
+
"pnpm": {
|
70
|
+
"overrides": {
|
71
|
+
"braces@<3.0.3": ">=3.0.3"
|
72
|
+
}
|
73
|
+
}
|
69
74
|
}
|
@@ -10,7 +10,11 @@ export declare class AddressAutocomplete extends LitElement {
|
|
10
10
|
postcode: string;
|
11
11
|
label: string;
|
12
12
|
initialAddress: string;
|
13
|
-
|
13
|
+
osApiKey: string;
|
14
|
+
/**
|
15
|
+
* @deprecated - please set singular `osApiKey`
|
16
|
+
*/
|
17
|
+
osPlacesApiKey: any;
|
14
18
|
osProxyEndpoint: string;
|
15
19
|
arrowStyle: ArrowStyleEnum;
|
16
20
|
labelStyle: LabelStyleEnum;
|
@@ -1,10 +1,11 @@
|
|
1
|
+
import { Type } from "ol/geom/Geometry";
|
1
2
|
import { Draw, Modify, Snap } from "ol/interaction";
|
2
3
|
import { Vector as VectorLayer } from "ol/layer";
|
3
4
|
import { Vector as VectorSource } from "ol/source";
|
4
|
-
export type DrawTypeEnum = "Polygon" | "Point"
|
5
|
+
export type DrawTypeEnum = Extract<Type, "Polygon" | "Point" | "Circle">;
|
5
6
|
export type DrawPointerEnum = "crosshair" | "dot";
|
6
|
-
export declare const drawingSource: VectorSource<import("ol/Feature").default<import("ol/geom
|
7
|
-
export declare function configureDrawingLayer(drawType: DrawTypeEnum,
|
8
|
-
export declare function configureDraw(drawType: DrawTypeEnum,
|
7
|
+
export declare const drawingSource: VectorSource<import("ol/Feature").default<import("ol/geom").Geometry>>;
|
8
|
+
export declare function configureDrawingLayer(drawType: DrawTypeEnum, drawColor: string, drawMany: boolean): VectorLayer<VectorSource<import("ol/Feature").default<import("ol/geom").Geometry>>>;
|
9
|
+
export declare function configureDraw(drawType: DrawTypeEnum, drawPointer: DrawPointerEnum, drawColor: string): Draw;
|
9
10
|
export declare const snap: Snap;
|
10
|
-
export declare function configureModify(
|
11
|
+
export declare function configureModify(drawPointer: DrawPointerEnum, drawColor: string): Modify;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { LitElement } from "lit";
|
2
2
|
import Map from "ol/Map";
|
3
3
|
import { DrawPointerEnum, DrawTypeEnum } from "./drawing";
|
4
|
+
import { BasemapEnum } from "./layers";
|
4
5
|
import { ProjectionEnum } from "./projections";
|
5
6
|
import { AreaUnitEnum } from "./utils";
|
6
7
|
type MarkerImageEnum = "circle" | "pin";
|
@@ -10,12 +11,17 @@ export declare class MyMap extends LitElement {
|
|
10
11
|
id: string;
|
11
12
|
latitude: number;
|
12
13
|
longitude: number;
|
14
|
+
basemap: BasemapEnum;
|
13
15
|
projection: ProjectionEnum;
|
14
16
|
zoom: number;
|
15
17
|
minZoom: number;
|
16
18
|
maxZoom: number;
|
17
19
|
drawMode: boolean;
|
20
|
+
drawMany: boolean;
|
18
21
|
drawType: DrawTypeEnum;
|
22
|
+
/**
|
23
|
+
* @deprecated - please set `drawColor` regardless of `drawType`
|
24
|
+
*/
|
19
25
|
drawPointColor: string;
|
20
26
|
drawGeojsonData: {
|
21
27
|
type: string;
|
@@ -24,15 +30,20 @@ export declare class MyMap extends LitElement {
|
|
24
30
|
drawGeojsonDataCopyright: string;
|
25
31
|
drawGeojsonDataBuffer: number;
|
26
32
|
drawPointer: DrawPointerEnum;
|
27
|
-
showFeaturesAtPoint: boolean;
|
28
33
|
clickFeatures: boolean;
|
29
34
|
drawColor: string;
|
35
|
+
/**
|
36
|
+
* @deprecated - please set `drawColor` and fill will be automatically inferred using 20% opacity
|
37
|
+
*/
|
30
38
|
drawFillColor: string;
|
39
|
+
showFeaturesAtPoint: boolean;
|
31
40
|
featureColor: string;
|
32
41
|
featureFill: boolean;
|
42
|
+
/**
|
43
|
+
* @deprecated
|
44
|
+
*/
|
33
45
|
featureBorderNone: boolean;
|
34
46
|
featureBuffer: number;
|
35
|
-
showGeojsonDataMarkers: boolean;
|
36
47
|
showCentreMarker: boolean;
|
37
48
|
markerImage: MarkerImageEnum;
|
38
49
|
markerLatitude: number;
|
@@ -42,18 +53,37 @@ export declare class MyMap extends LitElement {
|
|
42
53
|
type: string;
|
43
54
|
features: never[];
|
44
55
|
};
|
56
|
+
showGeojsonDataMarkers: boolean;
|
45
57
|
geojsonDataCopyright: string;
|
46
58
|
geojsonColor: string;
|
47
59
|
geojsonFill: boolean;
|
48
60
|
geojsonBuffer: number;
|
61
|
+
/**
|
62
|
+
* @deprecated - please specify `basemap="OSRaster"` directly instead
|
63
|
+
*/
|
49
64
|
disableVectorTiles: boolean;
|
50
|
-
|
51
|
-
|
65
|
+
osApiKey: string;
|
66
|
+
/**
|
67
|
+
* @deprecated - please set singular `osApiKey`
|
68
|
+
*/
|
69
|
+
osVectorTilesApiKey: any;
|
70
|
+
/**
|
71
|
+
* @deprecated - please set singular `osApiKey`
|
72
|
+
*/
|
73
|
+
osFeaturesApiKey: any;
|
52
74
|
osCopyright: string;
|
53
75
|
osProxyEndpoint: string;
|
76
|
+
/**
|
77
|
+
* @deprecated - please specify `basemap="MapboxSatellite"` + `mapboxAccessToken` instead
|
78
|
+
*/
|
79
|
+
applySatelliteStyle: boolean;
|
80
|
+
mapboxAccessToken: string;
|
54
81
|
hideResetControl: boolean;
|
55
82
|
resetControlImage: ResetControlImageEnum;
|
56
83
|
staticMode: boolean;
|
84
|
+
/**
|
85
|
+
* @deprecated - both `area.squareMetres` & `area.hectares` are calculated by default now in applicable `geojsonChange` events
|
86
|
+
*/
|
57
87
|
areaUnit: AreaUnitEnum;
|
58
88
|
showScale: boolean;
|
59
89
|
useScaleBarStyle: boolean;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { Tile as TileLayer } from "ol/layer";
|
2
|
+
import VectorTileLayer from "ol/layer/VectorTile";
|
3
|
+
import { OSM, XYZ } from "ol/source";
|
4
|
+
import VectorLayer from "ol/layer/Vector";
|
5
|
+
import VectorSource from "ol/source/Vector";
|
6
|
+
export type BasemapEnum = "OSM" | "MapboxSatellite" | "OSRaster" | "OSVectorTile";
|
7
|
+
export declare function makeDefaultTileLayer(): TileLayer<OSM>;
|
8
|
+
export declare function makeMapboxSatelliteBasemap(): VectorLayer<VectorSource>;
|
9
|
+
export declare function makeOSRasterBasemap(apiKey: string, proxyEndpoint: string, copyright: string): TileLayer<XYZ>;
|
10
|
+
export declare function makeOsVectorTileBasemap(apiKey: string, proxyEndpoint: string, copyright: string): VectorTileLayer;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Vector as VectorLayer } from "ol/layer";
|
2
2
|
import { Vector as VectorSource } from "ol/source";
|
3
|
-
export declare const outlineSource: VectorSource<import("ol
|
4
|
-
export declare function makeFeatureLayer(color: string, featureFill: boolean
|
3
|
+
export declare const outlineSource: VectorSource<import("ol").Feature<import("ol/geom").Geometry>>;
|
4
|
+
export declare function makeFeatureLayer(color: string, featureFill: boolean): VectorLayer<VectorSource<import("ol").Feature<import("ol/geom").Geometry>>>;
|
5
5
|
/**
|
6
6
|
* Create an OGC XML filter parameter value which will select the TopographicArea
|
7
7
|
* features containing the coordinates of the provided point
|
@@ -7,12 +7,12 @@ import VectorSource from "ol/source/Vector";
|
|
7
7
|
import { ProjectionEnum } from "./projections";
|
8
8
|
export type AreaUnitEnum = "m2" | "ha";
|
9
9
|
/**
|
10
|
-
* Calculate
|
10
|
+
* Calculate the area of a polygon
|
11
11
|
* @param polygon
|
12
12
|
* @param unit - defaults to square metres ("m2"), or supports "ha" for hectares
|
13
|
-
* @returns - the total area
|
13
|
+
* @returns - the total area
|
14
14
|
*/
|
15
|
-
export declare function
|
15
|
+
export declare function calculateArea(polygon: Geometry, unit?: AreaUnitEnum): number;
|
16
16
|
/**
|
17
17
|
* Fit map view to extent of data features, overriding default zoom & center
|
18
18
|
* @param olMap - an OpenLayers map
|