@geospatial-sdk/maplibre 0.0.5-dev.43 → 0.0.5-dev.45

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/README.md CHANGED
@@ -1,11 +1,42 @@
1
- # `maplibre`
1
+ # `@geospatial-sdk/maplibre`
2
2
 
3
- > TODO: description
3
+ <!-- #region body -->
4
4
 
5
- ## Usage
5
+ This package provides utilities to create and manage [MapLibre GL JS](https://maplibre.org/) maps using the declarative Map Context model from `@geospatial-sdk/core`.
6
+
7
+ ## Installation
6
8
 
9
+ ```sh
10
+ npm install @geospatial-sdk/maplibre
7
11
  ```
8
- const openlayers = require('maplibre');
9
12
 
10
- // TODO: DEMONSTRATE API
13
+ ## Usage
14
+
15
+ ```typescript
16
+ import { createMapFromContext } from "@geospatial-sdk/maplibre";
17
+ import type { MapContext } from "@geospatial-sdk/core";
18
+
19
+ const mapContext: MapContext = {
20
+ layers: [
21
+ {
22
+ type: "xyz",
23
+ url: "https://tile.openstreetmap.org/{z}/{x}/{y}.png",
24
+ },
25
+ ],
26
+ view: {
27
+ center: [6, 48.5],
28
+ zoom: 5,
29
+ },
30
+ };
31
+
32
+ const map = await createMapFromContext(
33
+ mapContext,
34
+ document.getElementById("map"),
35
+ );
11
36
  ```
37
+
38
+ <!-- #endregion body -->
39
+
40
+ ## Documentation
41
+
42
+ For more detailed API documentation, see the [documentation website](https://camptocamp.github.io/geospatial-sdk/docs/).
package/dist/index.d.ts CHANGED
@@ -1,3 +1,8 @@
1
+ /**
2
+ * {@include ../README.md#body}
3
+ *
4
+ * @module 📦 maplibre
5
+ */
1
6
  export * from "./map/index.js";
2
7
  export * from "./maplibre.models.js";
3
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC"}
package/dist/index.js CHANGED
@@ -1,2 +1,7 @@
1
+ /**
2
+ * {@include ../README.md#body}
3
+ *
4
+ * @module 📦 maplibre
5
+ */
1
6
  export * from "./map/index.js";
2
7
  export * from "./maplibre.models.js";
@@ -1,3 +1,7 @@
1
+ /**
2
+ * @hideGroups
3
+ * @packageDocumentation
4
+ */
1
5
  export { createMapFromContext, resetMapFromContext } from "./create-map.js";
2
6
  export { applyContextDiffToMap } from "./apply-context-diff.js";
3
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/map/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/map/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC"}
package/dist/map/index.js CHANGED
@@ -1,2 +1,6 @@
1
+ /**
2
+ * @hideGroups
3
+ * @packageDocumentation
4
+ */
1
5
  export { createMapFromContext, resetMapFromContext } from "./create-map.js";
2
6
  export { applyContextDiffToMap } from "./apply-context-diff.js";
@@ -1,5 +1,5 @@
1
1
  import { describe, expect, it } from "vitest";
2
- import { contextStyleToMaplibreLayers } from "./style.helpers";
2
+ import { contextStyleToMaplibreLayers } from "./style.helpers.js";
3
3
 
4
4
  const defautlMaplibreFill = {
5
5
  type: "fill",
package/lib/index.ts CHANGED
@@ -1,2 +1,8 @@
1
+ /**
2
+ * {@include ../README.md#body}
3
+ *
4
+ * @module 📦 maplibre
5
+ */
6
+
1
7
  export * from "./map/index.js";
2
8
  export * from "./maplibre.models.js";
@@ -1,15 +1,13 @@
1
1
  import { beforeEach, describe, expect, it, vi } from "vitest";
2
- import { MapContext, MapContextDiff } from "@geospatial-sdk/core";
2
+ import { MapContextDiff } from "@geospatial-sdk/core";
3
3
  import {
4
- SAMPLE_CONTEXT,
5
4
  SAMPLE_LAYER1,
6
5
  SAMPLE_LAYER2,
7
6
  SAMPLE_LAYER3,
8
7
  SAMPLE_LAYER4,
9
- } from "@geospatial-sdk/core/fixtures/map-context.fixtures";
10
- import { applyContextDiffToMap } from "./apply-context-diff";
11
- import * as mapHelpers from "../helpers/map.helpers";
12
- import { getBeforeId } from "../helpers/map.helpers";
8
+ } from "@geospatial-sdk/core/fixtures/map-context.fixtures.js";
9
+ import { applyContextDiffToMap } from "./apply-context-diff.js";
10
+ import * as mapHelpers from "../helpers/map.helpers.js";
13
11
 
14
12
  // Helper to create a fresh mock Map instance for each test
15
13
  function createMockMap() {
@@ -26,15 +24,10 @@ function createMockMap() {
26
24
  }
27
25
 
28
26
  describe("applyContextDiffToMap (mocked Map)", () => {
29
- let context: MapContext;
30
27
  let diff: MapContextDiff;
31
28
  let map: ReturnType<typeof createMockMap>;
32
29
 
33
30
  beforeEach(async () => {
34
- context = {
35
- ...SAMPLE_CONTEXT,
36
- layers: [SAMPLE_LAYER2, SAMPLE_LAYER1],
37
- };
38
31
  map = createMockMap();
39
32
  map.getStyle.mockReturnValue({ layers: [], sources: {} });
40
33
  });
@@ -90,9 +83,6 @@ describe("applyContextDiffToMap (mocked Map)", () => {
90
83
  const generateLayerIdSpy = vi
91
84
  .spyOn(mapHelpers, "generateLayerId")
92
85
  .mockReturnValue("azreza");
93
- const getBeforeId = vi
94
- .spyOn(mapHelpers, "getBeforeId")
95
- .mockReturnValue("azreza");
96
86
  const removeLayersFromSourceSpy = vi.spyOn(
97
87
  mapHelpers,
98
88
  "removeLayersFromSource",
@@ -5,9 +5,9 @@ import {
5
5
  MAP_CTX_LAYER_OGCAPI_FIXTURE,
6
6
  MAP_CTX_LAYER_WFS_FIXTURE,
7
7
  MAP_CTX_LAYER_WMS_FIXTURE,
8
- } from "@geospatial-sdk/core/fixtures/map-context.fixtures";
8
+ } from "@geospatial-sdk/core/fixtures/map-context.fixtures.js";
9
9
  import { LayerGeojsonWithData, MapContextLayer } from "@geospatial-sdk/core";
10
- import { createLayer } from "./create-map";
10
+ import { createLayer } from "./create-map.js";
11
11
  import {
12
12
  FillLayerSpecification,
13
13
  GeoJSONSourceSpecification,
@@ -16,8 +16,8 @@ import {
16
16
  import {
17
17
  FEATURE_COLLECTION_LINESTRING_FIXTURE_4326,
18
18
  FEATURE_COLLECTION_POLYGON_FIXTURE_4326,
19
- } from "@geospatial-sdk/core/fixtures/geojson.fixtures";
20
- import { PartialStyleSpecification } from "../maplibre.models";
19
+ } from "@geospatial-sdk/core/fixtures/geojson.fixtures.js";
20
+ import { PartialStyleSpecification } from "../maplibre.models.js";
21
21
  import {
22
22
  CircleLayerSpecification,
23
23
  LayerSpecification,
package/lib/map/index.ts CHANGED
@@ -1,2 +1,7 @@
1
+ /**
2
+ * @hideGroups
3
+ * @packageDocumentation
4
+ */
5
+
1
6
  export { createMapFromContext, resetMapFromContext } from "./create-map.js";
2
7
  export { applyContextDiffToMap } from "./apply-context-diff.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geospatial-sdk/maplibre",
3
- "version": "0.0.5-dev.43+a7f100d",
3
+ "version": "0.0.5-dev.45+a90fe28",
4
4
  "description": "Maplibre-related utilities",
5
5
  "keywords": [
6
6
  "maplibre",
@@ -33,7 +33,7 @@
33
33
  "maplibre-gl": "^5.7.3"
34
34
  },
35
35
  "dependencies": {
36
- "@geospatial-sdk/core": "^0.0.5-dev.43+a7f100d"
36
+ "@geospatial-sdk/core": "^0.0.5-dev.45+a90fe28"
37
37
  },
38
- "gitHead": "a7f100dfebe66dff0f44abb4c630917db89453fd"
38
+ "gitHead": "a90fe28ac749e1d35a976bdcfd02cb47357e8955"
39
39
  }