@opensystemslab/map 0.8.3 → 1.0.0-alpha.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/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.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": "^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";
@@ -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
- osVectorTilesApiKey: string;
51
- osFeaturesApiKey: string;
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/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;