@opensystemslab/map 0.6.1 → 0.6.3

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.6.1",
3
+ "version": "0.6.3",
4
4
  "license": "OGL-UK-3.0",
5
5
  "private": false,
6
6
  "repository": {
@@ -42,16 +42,16 @@
42
42
  "@testing-library/user-event": "^14.4.3",
43
43
  "@types/node": "^18.6.3",
44
44
  "@types/proj4": "^2.5.2",
45
- "@vitest/ui": "^0.23.2",
46
- "happy-dom": "^6.0.4",
45
+ "@vitest/ui": "^0.26.1",
46
+ "happy-dom": "^8.1.0",
47
47
  "husky": "^8.0.1",
48
48
  "lint-staged": "^13.0.3",
49
49
  "prettier": "^2.3.2",
50
50
  "rollup-plugin-postcss-lit": "^2.0.0",
51
51
  "sass": "^1.44.0",
52
52
  "typescript": "^4.3.5",
53
- "vite": "^3.0.4",
54
- "vitest": "0.20.3",
53
+ "vite": "^4.0.0",
54
+ "vitest": "0.26.1",
55
55
  "wait-for-expect": "^3.0.2"
56
56
  },
57
57
  "engines": {
@@ -11,6 +11,7 @@ export declare class AddressAutocomplete extends LitElement {
11
11
  label: string;
12
12
  initialAddress: string;
13
13
  osPlacesApiKey: string;
14
+ osProxyEndpoint: string;
14
15
  arrowStyle: ArrowStyleEnum;
15
16
  labelStyle: LabelStyleEnum;
16
17
  private _totalAddresses;
@@ -1,9 +1,10 @@
1
1
  import { Draw, Modify, Snap } from "ol/interaction";
2
2
  import { Vector as VectorLayer } from "ol/layer";
3
3
  import { Vector as VectorSource } from "ol/source";
4
+ export declare type DrawTypeEnum = "Polygon" | "Point";
4
5
  export declare type DrawPointerEnum = "crosshair" | "dot";
5
6
  export declare const drawingSource: VectorSource<import("ol/geom/Geometry").default>;
6
- export declare const drawingLayer: VectorLayer<VectorSource<import("ol/geom/Geometry").default>>;
7
- export declare function configureDraw(pointerStyle: DrawPointerEnum): Draw;
7
+ export declare function configureDrawingLayer(drawType: DrawTypeEnum, pointColor: string): VectorLayer<VectorSource<import("ol/geom/Geometry").default>>;
8
+ export declare function configureDraw(drawType: DrawTypeEnum, pointerStyle: DrawPointerEnum, pointColor: string): Draw;
8
9
  export declare const snap: Snap;
9
10
  export declare function configureModify(pointerStyle: DrawPointerEnum): Modify;
@@ -1,10 +1,10 @@
1
1
  import { LitElement } from "lit";
2
2
  import Map from "ol/Map";
3
- import { DrawPointerEnum } from "./drawing";
3
+ import { DrawPointerEnum, DrawTypeEnum } from "./drawing";
4
4
  import { ProjectionEnum } from "./projections";
5
5
  import { AreaUnitEnum } from "./utils";
6
6
  declare type MarkerImageEnum = "circle" | "pin";
7
- declare type ResetControlImageEnum = "unicode" | "reset" | "trash" | "erase";
7
+ declare type ResetControlImageEnum = "unicode" | "trash";
8
8
  export declare class MyMap extends LitElement {
9
9
  static styles: import("lit").CSSResult;
10
10
  id: string;
@@ -15,6 +15,8 @@ export declare class MyMap extends LitElement {
15
15
  minZoom: number;
16
16
  maxZoom: number;
17
17
  drawMode: boolean;
18
+ drawType: DrawTypeEnum;
19
+ drawPointColor: string;
18
20
  drawGeojsonData: {
19
21
  type: string;
20
22
  geometry: {};
@@ -43,6 +45,7 @@ export declare class MyMap extends LitElement {
43
45
  osVectorTilesApiKey: string;
44
46
  osFeaturesApiKey: string;
45
47
  osCopyright: string;
48
+ osProxyEndpoint: string;
46
49
  hideResetControl: boolean;
47
50
  resetControlImage: ResetControlImageEnum;
48
51
  staticMode: boolean;
@@ -7,6 +7,7 @@ export declare function makeFeatureLayer(color: string, featureFill: boolean, bo
7
7
  * features containing the coordinates of the provided point
8
8
  * @param coord - xy coordinate
9
9
  * @param apiKey - Ordnance Survey Features API key, sign up here: https://osdatahub.os.uk/plans
10
+ * @param proxyEndpoint - Endpoint to proxy all requests to Ordnance Survey
10
11
  * @param supportClickFeatures - whether the featureSource should support `clickFeatures` mode or be cleared upfront
11
12
  */
12
- export declare function getFeaturesAtPoint(coord: Array<number>, apiKey: any, supportClickFeatures: boolean): void;
13
+ export declare function getFeaturesAtPoint(coord: Array<number>, apiKey: any, proxyEndpoint: string, supportClickFeatures: boolean): void;
@@ -1,5 +1,5 @@
1
1
  import { Tile as TileLayer } from "ol/layer";
2
2
  import VectorTileLayer from "ol/layer/VectorTile";
3
- import { XYZ } from "ol/source";
4
- export declare function makeRasterBaseMap(copyright: string, apiKey?: string): TileLayer<XYZ>;
5
- export declare function makeOsVectorTileBaseMap(copyright: string, apiKey: string): VectorTileLayer;
3
+ import { OSM } from "ol/source";
4
+ export declare function makeRasterBaseMap(apiKey: string, proxyEndpoint: string, copyright: string): TileLayer<OSM>;
5
+ export declare function makeOsVectorTileBaseMap(apiKey: string, proxyEndpoint: string, copyright: string): VectorTileLayer | undefined;
@@ -0,0 +1,10 @@
1
+ import "./index";
2
+ import type { IWindow } from "happy-dom";
3
+ declare global {
4
+ interface Window extends IWindow {
5
+ }
6
+ }
7
+ declare global {
8
+ interface Window extends IWindow {
9
+ }
10
+ }
@@ -0,0 +1,19 @@
1
+ declare type OSServices = "xyz" | "vectorTile" | "vectorTileStyle" | "places" | "features";
2
+ interface ServiceOptions {
3
+ service: OSServices;
4
+ apiKey: string;
5
+ proxyEndpoint: string;
6
+ params?: Record<string, string>;
7
+ }
8
+ export declare function constructURL(domain: string, path: string, params?: Record<string, string>): string;
9
+ export declare function getOSServiceURL({ service, apiKey, params, }: Omit<ServiceOptions, "proxyEndpoint">): string;
10
+ /**
11
+ * Generate a proxied OS service URL
12
+ * XXX: OS API key must be appended to requests by the proxy endpoint
13
+ */
14
+ export declare function getProxyServiceURL({ service, proxyEndpoint, params, }: Omit<ServiceOptions, "apiKey">): string;
15
+ /**
16
+ * Get either an OS service URL, or a proxied endpoint to an OS service URL
17
+ */
18
+ export declare function getServiceURL({ service, apiKey, proxyEndpoint, params, }: ServiceOptions): string;
19
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,2 +1,3 @@
1
1
  export declare function getShadowRoot(customEl: string): ShadowRoot | null | undefined;
2
2
  export declare function getShadowRootEl(customEl: string, el: string): Element | null | undefined;
3
+ export declare function setupMap(mapElement: any): Promise<void>;