@opensystemslab/map 0.6.2 → 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/dist/index.html CHANGED
@@ -43,7 +43,7 @@
43
43
  <div style="display:flex;flex-direction:column;">
44
44
  <h1 style="color:red;font-family:Inter,Helvetica,sans-serif;font-size:16px;">*** This is a testing sandbox - these components are unaware of each other! ***</h1>
45
45
  <div style="margin-bottom:1em">
46
- <my-map zoom="20" maxZoom="23" drawMode drawPointer="dot" id="example-map" showScale />
46
+ <my-map zoom="20" maxZoom="23" drawMode drawPointer="dot" id="example-map" showScale disableVectorTiles osProxyEndpoint="https://api.editor.planx.dev/proxy/ordnance-survey" />
47
47
  </div>
48
48
  <div style="margin-bottom:1em">
49
49
  <postcode-search hintText="Optional hint text shows up here" id="example-postcode" />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opensystemslab/map",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
4
4
  "license": "OGL-UK-3.0",
5
5
  "private": false,
6
6
  "repository": {
@@ -42,7 +42,7 @@
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.25.5",
45
+ "@vitest/ui": "^0.26.1",
46
46
  "happy-dom": "^8.1.0",
47
47
  "husky": "^8.0.1",
48
48
  "lint-staged": "^13.0.3",
@@ -51,7 +51,7 @@
51
51
  "sass": "^1.44.0",
52
52
  "typescript": "^4.3.5",
53
53
  "vite": "^4.0.0",
54
- "vitest": "0.25.6",
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;
@@ -45,6 +45,7 @@ export declare class MyMap extends LitElement {
45
45
  osVectorTilesApiKey: string;
46
46
  osFeaturesApiKey: string;
47
47
  osCopyright: string;
48
+ osProxyEndpoint: string;
48
49
  hideResetControl: boolean;
49
50
  resetControlImage: ResetControlImageEnum;
50
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>;