yio-map 0.12.1 → 0.14.1
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 +49 -72
- package/dist/YioMap.d.ts +3 -0
- package/dist/YioMap.d.ts.map +1 -1
- package/dist/controls/AddressSearch.d.ts +3 -1
- package/dist/controls/AddressSearch.d.ts.map +1 -1
- package/dist/controls/AddressSearchControl.d.ts +1 -0
- package/dist/controls/AddressSearchControl.d.ts.map +1 -1
- package/dist/controls/YioAttribution.d.ts.map +1 -1
- package/dist/i18n.d.ts +16 -0
- package/dist/i18n.d.ts.map +1 -0
- package/dist/yio-map.iife.js +73 -90
- package/dist/yio-map.js +1784 -1857
- package/dist/yio-map.umd.cjs +73 -90
- package/package.json +16 -19
package/README.md
CHANGED
|
@@ -1,101 +1,78 @@
|
|
|
1
|
-
yio-map
|
|
1
|
+
# yio-map
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm i yio-map
|
|
9
|
-
```
|
|
3
|
+
Web component for interactive maps built on [LitElement](https://lit.dev/) and [OpenLayers](https://openlayers.org/).
|
|
10
4
|
|
|
11
5
|
## Usage
|
|
12
6
|
|
|
13
|
-
###
|
|
14
|
-
|
|
15
|
-
```html
|
|
16
|
-
<script type="module">
|
|
17
|
-
import 'yio-map';
|
|
18
|
-
</script>
|
|
19
|
-
|
|
20
|
-
<yio-map></yio-map>
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
### With the standalone build
|
|
24
|
-
|
|
25
|
-
Download `yio-map.umd.cjs` from the [latest release](https://github.com/yiogmbh/yio-map/releases/latest), put it in your project directory, and add it with a `script` element:
|
|
7
|
+
### CDN
|
|
26
8
|
|
|
27
9
|
```html
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
To scan the project for linting and formatting errors, run
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
npm run lint
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
To automatically fix linting and formatting errors, run
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
npm run format
|
|
10
|
+
<yio-map
|
|
11
|
+
style="width: 100%; height: 500px;"
|
|
12
|
+
contentMap="/path/to/style.json"
|
|
13
|
+
center="[14.5, 47.5]"
|
|
14
|
+
zoom="8"
|
|
15
|
+
></yio-map>
|
|
16
|
+
<script src="https://cdn.jsdelivr.net/npm/yio-map@0/dist/yio-map.iife.js"></script>
|
|
45
17
|
```
|
|
46
18
|
|
|
47
|
-
|
|
19
|
+
The IIFE bundle includes all dependencies and registers `<yio-map>` as a custom element.
|
|
48
20
|
|
|
49
|
-
|
|
21
|
+
### npm
|
|
50
22
|
|
|
51
23
|
```bash
|
|
52
|
-
npm
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
To run the tests in interactive watch mode run:
|
|
56
|
-
|
|
57
|
-
```bash
|
|
58
|
-
npm run test:watch
|
|
24
|
+
npm i yio-map
|
|
59
25
|
```
|
|
60
26
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
To run a local instance of Storybook for your component, run
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
npm run storybook
|
|
27
|
+
```js
|
|
28
|
+
import 'yio-map';
|
|
67
29
|
```
|
|
68
30
|
|
|
69
|
-
|
|
31
|
+
When using a bundler, `ol` and `ol-mapbox-style` are expected as peer dependencies.
|
|
70
32
|
|
|
71
|
-
|
|
72
|
-
npm run storybook:build
|
|
73
|
-
```
|
|
33
|
+
## Attributes
|
|
74
34
|
|
|
75
|
-
|
|
35
|
+
| Attribute | Type | Description |
|
|
36
|
+
|---|---|---|
|
|
37
|
+
| `contentMap` | `string` | URL to a Mapbox/MapLibre style JSON |
|
|
38
|
+
| `center` | `[lon, lat]` | Initial map center in EPSG:4326 |
|
|
39
|
+
| `zoom` | `number` | Initial zoom level (1 -- 22) |
|
|
40
|
+
| `enableSearch` | `boolean` | Show address search input |
|
|
41
|
+
| `enablePinning` | `boolean` | Allow placing markers on the map |
|
|
42
|
+
| `enableSelect` | `boolean` | Enable feature selection on click/hover |
|
|
43
|
+
| `editCreate` | `string` | Source layer name to draw new features on |
|
|
44
|
+
| `editModify` | `number[]` | Feature IDs enabled for editing |
|
|
45
|
+
| `geojsonSources` | `object\|string` | GeoJSON data or URL to overlay |
|
|
46
|
+
| `sourceLayerVisibility` | `object` | Toggle visibility of source layers |
|
|
47
|
+
| `lang` | `string` | Override UI language (defaults to `<html lang>`, then browser language, then `en`). Supported: `en`, `de` |
|
|
76
48
|
|
|
77
|
-
|
|
78
|
-
npm start
|
|
79
|
-
```
|
|
49
|
+
## Events
|
|
80
50
|
|
|
81
|
-
|
|
51
|
+
| Event | Detail | Description |
|
|
52
|
+
|---|---|---|
|
|
53
|
+
| `change` | `{ changedProperties }` | Map state changed (center, zoom, features) |
|
|
54
|
+
| `click` | PointerEvent | Click on the map (with `enableSelect`) |
|
|
55
|
+
| `pin` | `{ coordinate: [lon, lat] }` | Marker placed (with `enablePinning`) |
|
|
82
56
|
|
|
83
|
-
|
|
57
|
+
## Development
|
|
84
58
|
|
|
85
|
-
|
|
59
|
+
Requires a `.env` file for API proxying (copy from `.env.example`).
|
|
86
60
|
|
|
87
61
|
```bash
|
|
88
|
-
npm
|
|
62
|
+
npm start # Dev server with demo (index.html)
|
|
63
|
+
npm test # Tests (Vitest + Playwright)
|
|
64
|
+
npm run test:watch # Interactive test mode
|
|
65
|
+
npm run lint # ESLint + Prettier check
|
|
66
|
+
npm run format # Auto-fix lint/format
|
|
67
|
+
npm run build # Production build (ES + IIFE + UMD + types)
|
|
68
|
+
npm run storybook # Component stories
|
|
89
69
|
```
|
|
90
70
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
## Publishing a release
|
|
94
|
-
|
|
95
|
-
The quickest way to push a tag that triggers an automated release process is to use `npm vesion {patch|minor|major}` and `git push --folow-tags`. Example:
|
|
71
|
+
## Release
|
|
96
72
|
|
|
97
73
|
```bash
|
|
98
|
-
|
|
99
|
-
npm version patch
|
|
74
|
+
npm version patch # or minor / major
|
|
100
75
|
git push --follow-tags
|
|
101
76
|
```
|
|
77
|
+
|
|
78
|
+
Pushing a version tag triggers CI to run tests, build, publish to npm, and create a GitHub release.
|
package/dist/YioMap.d.ts
CHANGED
package/dist/YioMap.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"YioMap.d.ts","sourceRoot":"","sources":["../src/YioMap.js"],"names":[],"mappings":"AAqBA;IACE,yCAmCE;IAEF
|
|
1
|
+
{"version":3,"file":"YioMap.d.ts","sourceRoot":"","sources":["../src/YioMap.js"],"names":[],"mappings":"AAqBA;IACE,yCAmCE;IAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAeE;IAEF,sBAAsB;IACtB,kBADW,OAAO,CACO;IA6EvB,iBAAoB;IACpB,aAAa;IACb,kBAAoB;IAYtB;;OAEG;IACH,oBAFa,UAAU,CAItB;IAED;;OAEG;IACH,2BAFa,OAAO,CAAC,UAAU,CAAC,CAI/B;IAED;;OAEG;IACH,oBAFW,KAAK,QAOf;IAHG,wDAAwE;IAS5E,8BAGC;IAPD,yBAEC;IAWD,8BAGC;IAPD,yBAEC;IAOD,gCAGC;IAED,2BAEC;IAMD,iCAGC;IAPD,4BAEC;IAWD,kCAGC;IAPD,6BAEC;IAWD,+BAEC;IAND,0BAEC;IAUD,sCAEC;IAND,iCAEC;IAUD,iCAGC;IAPD,4BAEC;IAkBD,wBAcC;IAoHD,2CAQC;IAED,sCAwCC;IAcD;;;OAGG;IACH,eAFW,KAAK,CAAC,MAAM,CAAC,QAIvB;IAmBD,+CAEC;;CACF;2BA/egD,KAAK;uBAU/B,mBAAmB"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export class AddressSearch extends LitElement {
|
|
2
2
|
static styles: import("lit").CSSResult[];
|
|
3
3
|
static properties: {
|
|
4
|
+
lang: {
|
|
5
|
+
type: StringConstructor;
|
|
6
|
+
};
|
|
4
7
|
placeholder: {
|
|
5
8
|
type: StringConstructor;
|
|
6
9
|
};
|
|
@@ -35,7 +38,6 @@ export class AddressSearch extends LitElement {
|
|
|
35
38
|
state: boolean;
|
|
36
39
|
};
|
|
37
40
|
};
|
|
38
|
-
placeholder: string;
|
|
39
41
|
resultCount: number;
|
|
40
42
|
sortByDistance: boolean;
|
|
41
43
|
minSearchLength: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddressSearch.d.ts","sourceRoot":"","sources":["../../src/controls/AddressSearch.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AddressSearch.d.ts","sourceRoot":"","sources":["../../src/controls/AddressSearch.js"],"names":[],"mappings":"AAQA;IACE,yCAOE;IAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAaE;IAWA,oBAAoB;IACpB,wBAA2B;IAC3B,wBAAwB;IACxB,eAAqB;IACrB,eAAgB;IAChB,gBAAkB;IAClB,kBAAqB;IACrB,sBAAyB;IACzB,eAAkB;IAClB,sBAAsB;IAmQxB,+CAqBC;;CACF;2BA5UgD,KAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddressSearchControl.d.ts","sourceRoot":"","sources":["../../src/controls/AddressSearchControl.js"],"names":[],"mappings":"AAIA;IAIE,0BAaC;IAhBD,4BAA4B;IAC5B,eADW,aAAa,CACV;IAiBd,uBAYC;CACF;
|
|
1
|
+
{"version":3,"file":"AddressSearchControl.d.ts","sourceRoot":"","sources":["../../src/controls/AddressSearchControl.js"],"names":[],"mappings":"AAIA;IAIE,0BAaC;IAhBD,4BAA4B;IAC5B,eADW,aAAa,CACV;IAiBd,qBAEC;IAED,uBAYC;CACF;oBAxCmB,uBAAuB;8BAEb,oBAAoB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"YioAttribution.d.ts","sourceRoot":"","sources":["../../src/controls/YioAttribution.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"YioAttribution.d.ts","sourceRoot":"","sources":["../../src/controls/YioAttribution.js"],"names":[],"mappings":"AASA,yCA0CG;wBAnDqB,2BAA2B"}
|
package/dist/i18n.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves a BCP 47 language tag to a 2-letter language code.
|
|
3
|
+
* Priority: langOverride > <html lang> > navigator.language > 'en'
|
|
4
|
+
* @param {string|null|undefined} langOverride
|
|
5
|
+
* @returns {string}
|
|
6
|
+
*/
|
|
7
|
+
export function resolveLanguage(langOverride: string | null | undefined): string;
|
|
8
|
+
/**
|
|
9
|
+
* Returns the translation bundle for a given namespace and optional language override.
|
|
10
|
+
* Falls back to English if the language or namespace is not found.
|
|
11
|
+
* @param {string} namespace
|
|
12
|
+
* @param {string|null|undefined} langOverride
|
|
13
|
+
* @returns {Record<string, string>}
|
|
14
|
+
*/
|
|
15
|
+
export function getTranslations(namespace: string, langOverride: string | null | undefined): Record<string, string>;
|
|
16
|
+
//# sourceMappingURL=i18n.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../src/i18n.js"],"names":[],"mappings":"AAyBA;;;;;GAKG;AACH,8CAHW,MAAM,GAAC,IAAI,GAAC,SAAS,GACnB,MAAM,CAMlB;AAED;;;;;;GAMG;AACH,2CAJW,MAAM,gBACN,MAAM,GAAC,IAAI,GAAC,SAAS,GACnB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAQlC"}
|