@opensystemslab/map 0.8.3 → 1.0.0-alpha.1

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opensystemslab/map",
3
- "version": "0.8.3",
3
+ "version": "1.0.0-alpha.1",
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": "^6.5.0",
29
+ "@turf/union": "^7.0.0",
30
30
  "accessible-autocomplete": "^2.0.4",
31
31
  "file-saver": "^2.0.5",
32
- "govuk-frontend": "^5.0.0",
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.17",
36
+ "ol-ext": "^4.0.21",
37
37
  "ol-mapbox-style": "^12.3.0",
38
38
  "postcode": "^5.1.0",
39
- "proj4": "^2.9.2",
40
- "rambda": "^8.6.0"
39
+ "proj4": "^2.11.0",
40
+ "rambda": "^9.2.1"
41
41
  },
42
42
  "devDependencies": {
43
- "@glorious/pitsby": "^1.37.0",
44
- "@testing-library/dom": "^9.3.4",
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": "18.19.21",
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": "^14.0.1",
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.3.3",
58
- "vite": "^5.1.7",
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
  },
@@ -10,7 +10,11 @@ export declare class AddressAutocomplete extends LitElement {
10
10
  postcode: string;
11
11
  label: string;
12
12
  initialAddress: string;
13
- osPlacesApiKey: string;
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/Geometry").default>>;
7
- export declare function configureDrawingLayer(drawType: DrawTypeEnum, pointColor: string, drawColor: string, drawFillColor: string): VectorLayer<VectorSource<import("ol/Feature").default<import("ol/geom/Geometry").default>>>;
8
- export declare function configureDraw(drawType: DrawTypeEnum, pointerStyle: DrawPointerEnum, pointColor: string, drawColor: string, drawFillColor: string): Draw;
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(pointerStyle: DrawPointerEnum, drawColor: string): Modify;
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";
@@ -8,14 +9,20 @@ type ResetControlImageEnum = "unicode" | "trash";
8
9
  export declare class MyMap extends LitElement {
9
10
  static styles: import("lit").CSSResult;
10
11
  id: string;
12
+ dataTestId: string;
11
13
  latitude: number;
12
14
  longitude: number;
15
+ basemap: BasemapEnum;
13
16
  projection: ProjectionEnum;
14
17
  zoom: number;
15
18
  minZoom: number;
16
19
  maxZoom: number;
17
20
  drawMode: boolean;
21
+ drawMany: boolean;
18
22
  drawType: DrawTypeEnum;
23
+ /**
24
+ * @deprecated - please set `drawColor` regardless of `drawType`
25
+ */
19
26
  drawPointColor: string;
20
27
  drawGeojsonData: {
21
28
  type: string;
@@ -24,15 +31,20 @@ export declare class MyMap extends LitElement {
24
31
  drawGeojsonDataCopyright: string;
25
32
  drawGeojsonDataBuffer: number;
26
33
  drawPointer: DrawPointerEnum;
27
- showFeaturesAtPoint: boolean;
28
34
  clickFeatures: boolean;
29
35
  drawColor: string;
36
+ /**
37
+ * @deprecated - please set `drawColor` and fill will be automatically inferred using 20% opacity
38
+ */
30
39
  drawFillColor: string;
40
+ showFeaturesAtPoint: boolean;
31
41
  featureColor: string;
32
42
  featureFill: boolean;
43
+ /**
44
+ * @deprecated
45
+ */
33
46
  featureBorderNone: boolean;
34
47
  featureBuffer: number;
35
- showGeojsonDataMarkers: boolean;
36
48
  showCentreMarker: boolean;
37
49
  markerImage: MarkerImageEnum;
38
50
  markerLatitude: number;
@@ -42,18 +54,37 @@ export declare class MyMap extends LitElement {
42
54
  type: string;
43
55
  features: never[];
44
56
  };
57
+ showGeojsonDataMarkers: boolean;
45
58
  geojsonDataCopyright: string;
46
59
  geojsonColor: string;
47
60
  geojsonFill: boolean;
48
61
  geojsonBuffer: number;
62
+ /**
63
+ * @deprecated - please specify `basemap="OSRaster"` directly instead
64
+ */
49
65
  disableVectorTiles: boolean;
50
- osVectorTilesApiKey: string;
51
- osFeaturesApiKey: string;
66
+ osApiKey: string;
67
+ /**
68
+ * @deprecated - please set singular `osApiKey`
69
+ */
70
+ osVectorTilesApiKey: any;
71
+ /**
72
+ * @deprecated - please set singular `osApiKey`
73
+ */
74
+ osFeaturesApiKey: any;
52
75
  osCopyright: string;
53
76
  osProxyEndpoint: string;
77
+ /**
78
+ * @deprecated - please specify `basemap="MapboxSatellite"` + `mapboxAccessToken` instead
79
+ */
80
+ applySatelliteStyle: boolean;
81
+ mapboxAccessToken: string;
54
82
  hideResetControl: boolean;
55
83
  resetControlImage: ResetControlImageEnum;
56
84
  staticMode: boolean;
85
+ /**
86
+ * @deprecated - both `area.squareMetres` & `area.hectares` are calculated by default now in applicable `geojsonChange` events
87
+ */
57
88
  areaUnit: AreaUnitEnum;
58
89
  showScale: boolean;
59
90
  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/Feature").default<import("ol/geom/Geometry").default>>;
4
- export declare function makeFeatureLayer(color: string, featureFill: boolean, borderNone: boolean): VectorLayer<VectorSource<import("ol/Feature").default<import("ol/geom/Geometry").default>>>;
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 & format the area of a polygon
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 formatted with unit as a string
13
+ * @returns - the total area
14
14
  */
15
- export declare function formatArea(polygon: Geometry, unit: AreaUnitEnum): string | undefined;
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
@@ -1,5 +0,0 @@
1
- import { Tile as TileLayer } from "ol/layer";
2
- import VectorTileLayer from "ol/layer/VectorTile";
3
- import { OSM } from "ol/source";
4
- export declare function makeRasterBaseMap(apiKey: string, proxyEndpoint: string, copyright: string, collapseAttributions: boolean): TileLayer<OSM>;
5
- export declare function makeOsVectorTileBaseMap(apiKey: string, proxyEndpoint: string, copyright: string, collapseAttributions: boolean): VectorTileLayer | undefined;