@cowegis/client 1.0.0-alpha4 → 1.0.0-alpha6

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.
Files changed (39) hide show
  1. package/.editorconfig +17 -0
  2. package/.eslintrc.js +31 -0
  3. package/.idea/DdevIntegration.xml +6 -0
  4. package/.idea/deployment.xml +15 -0
  5. package/.idea/inspectionProfiles/Project_Default.xml +6 -0
  6. package/.idea/php.xml +19 -0
  7. package/.idea/vcs.xml +1 -1
  8. package/.idea/webServers.xml +10 -0
  9. package/js/Registry.js +1 -1
  10. package/js/assets/AssetsLoader.js +14 -11
  11. package/js/bundle.js +13 -16
  12. package/js/client.js +5 -6
  13. package/js/control/attributionControlFactory.js +1 -1
  14. package/js/control/geocoderControlFactory.js +10 -3
  15. package/js/control/index.js +1 -1
  16. package/js/control/loadingControlFactory.js +2 -2
  17. package/js/control/scaleControlFactory.js +1 -1
  18. package/js/control/zoomControlFactory.js +1 -1
  19. package/js/element/EditorElement.js +2 -2
  20. package/js/element/MapElement.js +22 -3
  21. package/js/factory/MapFactory.js +21 -17
  22. package/js/factory/index.js +1 -1
  23. package/js/geocoder/Cowegis.js +77 -0
  24. package/js/geojson/bindPopupFromFeature.js +1 -1
  25. package/js/geojson/bindTooltipFromFeature.js +1 -1
  26. package/js/geojson/index.js +1 -1
  27. package/js/geojson/pointToLayer.js +4 -3
  28. package/js/icon/FontAwesomeIcon.js +3 -2
  29. package/js/icon/divIconFactory.js +1 -2
  30. package/js/icon/fontAwesomeIconFactory.js +3 -2
  31. package/js/icon/imageIconFactory.js +1 -1
  32. package/js/icon/index.js +1 -1
  33. package/js/icon/svgIconFactory.js +3 -2
  34. package/js/layer/OverpassLayer.js +4 -3
  35. package/js/layer/dataLayerFactory.js +6 -6
  36. package/js/layer/featureGroupFactory.js +1 -0
  37. package/js/layer/overpassLayerFactory.js +1 -1
  38. package/js/leaflet/index.js +3 -2
  39. package/package.json +26 -15
package/.editorconfig ADDED
@@ -0,0 +1,17 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ indent_style = space
6
+ end_of_line = lf
7
+ insert_final_newline = true
8
+ trim_trailing_whitespace = true
9
+
10
+ [*.php]
11
+ indent_size = 4
12
+
13
+ [*.js]
14
+ indent_size = 4
15
+
16
+ [{*.vue,*.json,*.html5,*.xlf,*.twig}]
17
+ indent_size = 2
package/.eslintrc.js ADDED
@@ -0,0 +1,31 @@
1
+ module.exports = {
2
+ parser: '@babel/eslint-parser',
3
+ parserOptions: {
4
+ sourceType: 'module',
5
+ allowImportExportEverywhere: true,
6
+ requireConfigFile: false,
7
+ },
8
+ extends: [
9
+ 'plugin:import/recommended'
10
+ ],
11
+ rules: {
12
+ "quotes": [2, "single", "avoid-escape"],
13
+ "import/order": ["error", {
14
+ groups: ["builtin", "external", "internal", "parent", "sibling", "index", "object", "type"],
15
+ "newlines-between": "always",
16
+ alphabetize: {
17
+ order: "asc"
18
+ }
19
+ }],
20
+ },
21
+ settings: {
22
+ "import/extensions": [
23
+ ".js",
24
+ ],
25
+ 'import/resolver': {
26
+ typescript: {},
27
+ webpack: {}
28
+ },
29
+ "import/ignore": ["/*.png/", "/*.jpg/"]
30
+ }
31
+ }
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="de.php_perfect.intellij.ddev.settings.DdevSettingsState">
4
+ <option name="ddevBinary" value="/usr/bin/ddev" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,15 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="PublishConfigData" remoteFilesAllowedToDisappearOnAutoupload="false" confirmBeforeUploading="false">
4
+ <option name="confirmBeforeUploading" value="false" />
5
+ <serverData>
6
+ <paths name="cowegis/client-bundle">
7
+ <serverdata>
8
+ <mappings>
9
+ <mapping deploy="node_modules/@cowegis/client" local="$PROJECT_DIR$" web="/" />
10
+ </mappings>
11
+ </serverdata>
12
+ </paths>
13
+ </serverData>
14
+ </component>
15
+ </project>
@@ -0,0 +1,6 @@
1
+ <component name="InspectionProjectProfileManager">
2
+ <profile version="1.0">
3
+ <option name="myName" value="Project Default" />
4
+ <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
5
+ </profile>
6
+ </component>
package/.idea/php.xml ADDED
@@ -0,0 +1,19 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="MessDetectorOptionsConfiguration">
4
+ <option name="transferred" value="true" />
5
+ </component>
6
+ <component name="PHPCSFixerOptionsConfiguration">
7
+ <option name="transferred" value="true" />
8
+ </component>
9
+ <component name="PHPCodeSnifferOptionsConfiguration">
10
+ <option name="highlightLevel" value="WARNING" />
11
+ <option name="transferred" value="true" />
12
+ </component>
13
+ <component name="PhpStanOptionsConfiguration">
14
+ <option name="transferred" value="true" />
15
+ </component>
16
+ <component name="PsalmOptionsConfiguration">
17
+ <option name="transferred" value="true" />
18
+ </component>
19
+ </project>
package/.idea/vcs.xml CHANGED
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <project version="4">
3
3
  <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$" vcs="Git" />
4
+ <mapping directory="" vcs="Git" />
5
5
  </component>
6
6
  </project>
@@ -0,0 +1,10 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="WebServers">
4
+ <option name="servers">
5
+ <webServer id="0f278a7c-9371-43a2-ac17-c9d94ee78ff4" name="cowegis/client-bundle" url="http://localhost">
6
+ <fileTransfer mountedRoot="$PROJECT_DIR$/../cowegis-client-bundle" accessType="MOUNT" port="0" />
7
+ </webServer>
8
+ </option>
9
+ </component>
10
+ </project>
package/js/Registry.js CHANGED
@@ -13,7 +13,7 @@ class Registry {
13
13
  return this.factories[name];
14
14
  }
15
15
 
16
- throw 'Type "' + name + " not found";
16
+ throw 'Type "' + name + ' not found';
17
17
  }
18
18
  }
19
19
 
@@ -1,5 +1,5 @@
1
- import layerTypes from '../layer';
2
1
  import controlTypes from '../control';
2
+ import layerTypes from '../layer';
3
3
 
4
4
  class AssetsLoader {
5
5
  constructor(element) {
@@ -29,16 +29,19 @@ class AssetsLoader {
29
29
 
30
30
  case 'component':
31
31
  return import(/* webpackIgnore: true */ asset.url).then(function (component) {
32
- console.log(component);
33
- // TODO: Rework, for plugins
34
- // if (component instanceof LayerType) {
35
- // this.layerTypes.register(component.name(), component);
36
- // } else if (component instanceof ControlType) {
37
- // this.controlTypes.register(component.name(), component)
38
- // } else {
39
- // throw new Error('Unknown component provided');
40
- // }
41
- });
32
+ switch (component.type) {
33
+ case 'layer':
34
+ this.layerTypes.register(component.name, component.factory);
35
+ break;
36
+
37
+ case 'control':
38
+ this.controlTypes.register(component.name, component.factory);
39
+ break;
40
+
41
+ default:
42
+ throw new Error('Unsupported component provided');
43
+ }
44
+ }.bind(this));
42
45
 
43
46
  default:
44
47
  throw new Error('Unsupported asset type ' + asset.type);
package/js/bundle.js CHANGED
@@ -1,25 +1,22 @@
1
1
  import {layerTypes, iconTypes, controlTypes, mapFactory} from './client';
2
-
3
- import dataLayerFactory from './layer/dataLayerFactory';
4
- import featureGroupFactory from "./layer/featureGroupFactory";
5
- import layerGroupFactory from "./layer/layerGroupFactory";
6
- import markerClusterGroupFactory from "./layer/markerClusterGroupFactory";
7
- import overpassLayerFactory from "./layer/overpassLayerFactory";
8
- import providerLayerFactory from './layer/providerLayerFactory';
9
- import tileLayerFactory from './layer/tileLayerFactory';
10
-
11
- import attributionControlFactory from "./control/attributionControlFactory";
2
+ import attributionControlFactory from './control/attributionControlFactory';
12
3
  import fullscreenControlFactory from './control/fullscreenControlFactory';
13
- import geocoderControlFactory from "./control/geocoderControlFactory";
14
- import layersControlFactory from "./control/layersControlFactory";
4
+ import geocoderControlFactory from './control/geocoderControlFactory';
5
+ import layersControlFactory from './control/layersControlFactory';
15
6
  import loadingControlFactory from './control/loadingControlFactory';
16
7
  import scaleControlFactory from './control/scaleControlFactory';
17
8
  import zoomControlFactory from './control/zoomControlFactory';
18
-
19
- import divIconFactory from "./icon/divIconFactory";
20
- import fontAwesomeIconFactory from "./icon/fontAwesomeIconFactory";
9
+ import divIconFactory from './icon/divIconFactory';
10
+ import fontAwesomeIconFactory from './icon/fontAwesomeIconFactory';
21
11
  import imageIconFactory from './icon/imageIconFactory';
22
- import svgIconFactory from "./icon/svgIconFactory";
12
+ import svgIconFactory from './icon/svgIconFactory';
13
+ import dataLayerFactory from './layer/dataLayerFactory';
14
+ import featureGroupFactory from './layer/featureGroupFactory';
15
+ import layerGroupFactory from './layer/layerGroupFactory';
16
+ import markerClusterGroupFactory from './layer/markerClusterGroupFactory';
17
+ import overpassLayerFactory from './layer/overpassLayerFactory';
18
+ import providerLayerFactory from './layer/providerLayerFactory';
19
+ import tileLayerFactory from './layer/tileLayerFactory';
23
20
 
24
21
  layerTypes.register('data', dataLayerFactory);
25
22
  layerTypes.register('featureGroup', featureGroupFactory);
package/js/client.js CHANGED
@@ -1,14 +1,13 @@
1
- import MapElement from './element/MapElement';
2
- import EditorElement from "./element/EditorElement";
3
-
4
- import layerTypes from './layer';
5
1
  import controlTypes from './control';
6
- import iconTypes from './icon';
2
+ import EditorElement from './element/EditorElement';
3
+ import MapElement from './element/MapElement';
7
4
  import {mapFactory} from './factory';
5
+ import iconTypes from './icon';
6
+ import layerTypes from './layer';
8
7
 
9
8
  import 'leaflet/dist/leaflet.css';
10
9
  import '@geoman-io/leaflet-geoman-free/dist/leaflet-geoman.css';
11
- import 'leaflet-control-geocoder/Control.Geocoder.css';
10
+ import 'leaflet-control-geocoder/dist/Control.Geocoder.css';
12
11
  import 'leaflet.fullscreen/Control.FullScreen.css';
13
12
  import 'leaflet-loading/src/Control.Loading.css';
14
13
  import 'leaflet.markercluster/dist/MarkerCluster.css';
@@ -1,4 +1,4 @@
1
- import leaflet from "../leaflet";
1
+ import leaflet from '../leaflet';
2
2
 
3
3
  export default async function(config, element) {
4
4
  const control = leaflet.control.attribution(config.options);
@@ -1,8 +1,15 @@
1
- import Geocoder from 'leaflet-control-geocoder';
1
+ import {
2
+ Geocoder,
3
+ geocoders
4
+ } from 'leaflet-control-geocoder';
5
+
6
+ import {cowegis} from '../geocoder/Cowegis';
7
+
8
+ geocoders.cowegis = cowegis;
2
9
 
3
10
  export default async function(config) {
4
- if (config.options.geocoder !== undefined && !config.options.geocode instanceof global.IGeocoder) {
5
- // TODO: Create custom geocoder;
11
+ if (config.geocoder !== undefined && config.geocoder !== null && !config.options.geocode) {
12
+ config.options.geocoder = geocoders[config.geocoder.type](config.geocoder.options)
6
13
  }
7
14
 
8
15
  return new Geocoder(config.options);
@@ -1,3 +1,3 @@
1
- import Registry from "../Registry";
1
+ import Registry from '../Registry';
2
2
 
3
3
  export default new Registry();
@@ -16,11 +16,11 @@ export default async function(config, element) {
16
16
  width: 3,
17
17
  radius: 4,
18
18
  rotate: 13,
19
- top: "50%"
19
+ top: '50%'
20
20
  }
21
21
  }
22
22
  if (config.options.spinjs && global.Spinner === undefined) {
23
- await import(/* webpackChunkName: "spin" */ 'spin.js').then(
23
+ await import('spin.js').then(
24
24
  (module) => global.Spinner = module.Spinner
25
25
  );
26
26
  }
@@ -1,4 +1,4 @@
1
- import leaflet from "../leaflet";
1
+ import leaflet from '../leaflet';
2
2
 
3
3
  export default async function (config) {
4
4
  return leaflet.control.scale(config.options);
@@ -1,4 +1,4 @@
1
- import leaflet from "../leaflet";
1
+ import leaflet from '../leaflet';
2
2
 
3
3
  export default async function(config, element) {
4
4
  const control = leaflet.control.zoom(config.options);
@@ -1,4 +1,4 @@
1
- import MapElement from "./MapElement";
1
+ import MapElement from './MapElement';
2
2
 
3
3
  export default class EditorElement extends MapElement {
4
4
  constructor() {
@@ -10,7 +10,7 @@ export default class EditorElement extends MapElement {
10
10
  this.style.display = 'block';
11
11
  }
12
12
 
13
- await import(/* webpackChunkName: "geoman-free" */ '@geoman-io/leaflet-geoman-free');
13
+ await import('@geoman-io/leaflet-geoman-free');
14
14
 
15
15
  return super.connectedCallback();
16
16
  }
@@ -1,6 +1,6 @@
1
+ import AssetsLoader from '../assets/AssetsLoader';
2
+ import { mapFactory } from '../factory';
1
3
  import L from '../leaflet';
2
- import AssetsLoader from "../assets/AssetsLoader";
3
- import { mapFactory } from "../factory";
4
4
 
5
5
  const template = `
6
6
  <div class="cowegis-map-container" style="height: 100%"></div>
@@ -94,7 +94,26 @@ class MapElement extends HTMLElement {
94
94
  return;
95
95
  }
96
96
 
97
- this.observeConfig(this.container);
97
+ let configLoaded = false;
98
+
99
+ this.childNodes.forEach(function (node) {
100
+ if (!(node instanceof HTMLScriptElement)) {
101
+ return;
102
+ }
103
+
104
+ if (node.getAttribute('type') !== 'application/vnd.cowegis.map+json') {
105
+ return;
106
+ }
107
+
108
+ this.config = JSON.parse(node.innerText);
109
+ configLoaded = true;
110
+ }.bind(this));
111
+
112
+ if (configLoaded) {
113
+ return;
114
+ }
115
+
116
+ this.observeConfig();
98
117
  }
99
118
 
100
119
  observeConfig() {
@@ -1,9 +1,11 @@
1
+ import {LatLngBounds} from 'leaflet';
2
+
1
3
  import controlTypes from '../control';
2
- import layerTypes from '../layer';
3
4
  import iconTypes from '../icon';
4
- import bindEvents from "./bindEvents";
5
- import preloadAssets from "./preloadAssets";
6
- import {LatLngBounds} from "leaflet";
5
+ import layerTypes from '../layer';
6
+
7
+ import bindEvents from './bindEvents';
8
+ import preloadAssets from './preloadAssets';
7
9
 
8
10
  class MapFactory {
9
11
  constructor() {
@@ -30,10 +32,12 @@ class MapFactory {
30
32
 
31
33
  element.map = element.leaflet.map(element.container, config.options);
32
34
 
33
- config.panes.forEach((pane) => promises.push(this.createPane(pane, element)));
35
+ config.panes.forEach((pane) => this.createPane(pane, element));
34
36
  config.layers.forEach((layer) => promises.push(this.createLayer(layer, element)));
35
37
  config.controls.forEach((config) => promises.push(this.createControl(config, element)));
36
38
 
39
+ promises.push(this.configureEditor(config.editor, element));
40
+
37
41
  this.registerListeners(config, element);
38
42
 
39
43
  if (config.view) {
@@ -121,22 +125,22 @@ class MapFactory {
121
125
  });
122
126
  }
123
127
 
124
- registerListeners(config, element) {
125
- bindEvents(element.map, config.events, element);
126
- }
128
+ async configureEditor(config, element){
129
+ if (! config || !element.map.pm) {
130
+ return;
131
+ }
127
132
 
128
- getListener(element, reference)
129
- {
130
- if (reference.namespace === null) {
131
- return element.listeners[reference.reference];
133
+ if (config.toolbar) {
134
+ element.map.pm.addControls(config.toolbar);
132
135
  }
133
136
 
134
- let listeners = element.listeners;
135
- reference.namespace.forEach(function (part) {
136
- listeners = listeners[part];
137
- });
137
+ if (config.language) {
138
+ element.map.pm.setLang(config.language);
139
+ }
140
+ }
138
141
 
139
- return listeners[reference.reference];
142
+ registerListeners(config, element) {
143
+ bindEvents(element.map, config.events, element);
140
144
  }
141
145
  }
142
146
 
@@ -1,4 +1,4 @@
1
- import MapFactory from "./MapFactory";
1
+ import MapFactory from './MapFactory';
2
2
 
3
3
  export const mapFactory = new MapFactory();
4
4
 
@@ -0,0 +1,77 @@
1
+ import {Util} from 'leaflet';
2
+ import {geocoders} from 'leaflet-control-geocoder';
3
+
4
+ function getParamString(obj, existingUrl, uppercase) {
5
+ const params = [];
6
+ for (const i in obj) {
7
+ const key = encodeURIComponent(uppercase ? i.toUpperCase() : i);
8
+ const value = obj[i];
9
+ if (!Array.isArray(value)) {
10
+ params.push(key + '=' + encodeURIComponent(String(value)));
11
+ } else {
12
+ for (let j = 0; j < value.length; j++) {
13
+ params.push(key + '=' + encodeURIComponent(value[j]));
14
+ }
15
+ }
16
+ }
17
+ return (!existingUrl || existingUrl.indexOf('?') === -1 ? '?' : '&') + params.join('&');
18
+ }
19
+
20
+ function getJSON(url, params, callback) {
21
+ const xmlHttp = new XMLHttpRequest();
22
+ xmlHttp.onreadystatechange = function () {
23
+ if (xmlHttp.readyState !== 4) {
24
+ return;
25
+ }
26
+ let message;
27
+ if (xmlHttp.status !== 200 && xmlHttp.status !== 304) {
28
+ message = '';
29
+ } else if (typeof xmlHttp.response === 'string') {
30
+ // IE doesn't parse JSON responses even with responseType: 'json'.
31
+ try {
32
+ message = JSON.parse(xmlHttp.response);
33
+ } catch (e) {
34
+ // Not a JSON response
35
+ message = xmlHttp.response;
36
+ }
37
+ } else {
38
+ message = xmlHttp.response;
39
+ }
40
+ callback(message);
41
+ };
42
+ xmlHttp.open('GET', url + getParamString(params), true);
43
+ xmlHttp.responseType = 'json';
44
+ xmlHttp.setRequestHeader('Accept', 'application/json');
45
+ xmlHttp.send(null);
46
+ }
47
+
48
+ export class Cowegis extends geocoders.Nominatim {
49
+ geocode(query, cb, context) {
50
+ const params = Util.extend({
51
+ q: query,
52
+ limit: 5,
53
+ format: 'json',
54
+ addressdetails: 1
55
+ }, this.options.geocodingQueryParams);
56
+ getJSON(this.options.serviceUrl, params, data => {
57
+ const results = [];
58
+ for (let i = data.length - 1; i >= 0; i--) {
59
+ const bbox = data[i].boundingbox;
60
+ for (let j = 0; j < 4; j++) bbox[j] = +bbox[j];
61
+ results[i] = {
62
+ icon: data[i].icon,
63
+ name: data[i].display_name,
64
+ html: this.options.htmlTemplate ? this.options.htmlTemplate(data[i]) : undefined,
65
+ bbox: L.latLngBounds([bbox[0], bbox[2]], [bbox[1], bbox[3]]),
66
+ center: L.latLng(data[i].lat, data[i].lon),
67
+ properties: data[i]
68
+ };
69
+ }
70
+ cb.call(context, results);
71
+ });
72
+ }
73
+ }
74
+
75
+ export function cowegis(options) {
76
+ return new Cowegis(options);
77
+ }
@@ -1,4 +1,4 @@
1
- import bindEvents from "../factory/bindEvents";
1
+ import bindEvents from '../factory/bindEvents';
2
2
 
3
3
  export default function (object, feature, element) {
4
4
  if (!feature.properties || !feature.properties.popup) {
@@ -1,4 +1,4 @@
1
- import bindEvents from "../factory/bindEvents";
1
+ import bindEvents from '../factory/bindEvents';
2
2
 
3
3
  export default function (object, feature, element) {
4
4
  if (!feature.properties || !feature.properties.tooltip) {
@@ -1,5 +1,5 @@
1
- import { feature as parseTopoJsonFeature } from "topojson-client";
2
1
  import toGeoJSON from '@mapbox/togeojson';
2
+ import { feature as parseTopoJsonFeature } from 'topojson-client';
3
3
  import wellknown from 'wellknown';
4
4
 
5
5
  function parseXml(str) {
@@ -1,6 +1,7 @@
1
- import bindEvents from "../factory/bindEvents";
2
- import bindPopupFromFeature from "./bindPopupFromFeature";
3
- import bindTooltipFromFeature from "./bindTooltipFromFeature";
1
+ import bindEvents from '../factory/bindEvents';
2
+
3
+ import bindPopupFromFeature from './bindPopupFromFeature';
4
+ import bindTooltipFromFeature from './bindTooltipFromFeature';
4
5
 
5
6
  export default function (feature, latlng, element) {
6
7
  let type = 'marker';
@@ -1,5 +1,6 @@
1
- import { icon, findIconDefinition, library } from "@fortawesome/fontawesome-svg-core";
2
- import SvgIcon from "./SvgIcon";
1
+ import { icon, findIconDefinition, library } from '@fortawesome/fontawesome-svg-core';
2
+
3
+ import SvgIcon from './SvgIcon';
3
4
 
4
5
  const prefixes = {
5
6
  solid: 'fas',
@@ -1,5 +1,4 @@
1
- import {Util} from "leaflet";
2
- import {DivIcon} from "leaflet";
1
+ import {Util,DivIcon} from 'leaflet';
3
2
 
4
3
  export default function (config, properties, element) {
5
4
  const options = Util.extend({}, config.options);
@@ -1,5 +1,6 @@
1
- import FontAwesomeIcon from "./FontAwesomeIcon";
2
- import {Util} from "leaflet";
1
+ import {Util} from 'leaflet';
2
+
3
+ import FontAwesomeIcon from './FontAwesomeIcon';
3
4
 
4
5
  const attribution = '<a href="https://fontawesome.com/" target="_blank" rel="nofollow noopener" title="Font Awesome Free Icons by Fonticons Inc.">Font Awesome</a>';
5
6
 
@@ -1,4 +1,4 @@
1
- import {Icon, Util} from "leaflet";
1
+ import {Icon, Util} from 'leaflet';
2
2
 
3
3
  export default function(config, options, element) {
4
4
  options = Util.extend({}, config.options, options || {});
package/js/icon/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import Registry from "../Registry";
1
+ import Registry from '../Registry';
2
2
 
3
3
  export default new Registry();
@@ -1,5 +1,6 @@
1
- import SvgIcon from "./SvgIcon";
2
- import {Util} from "leaflet";
1
+ import {Util} from 'leaflet';
2
+
3
+ import SvgIcon from './SvgIcon';
3
4
 
4
5
  export default function(config, properties, element) {
5
6
  const options = Util.extend({}, config.options);
@@ -1,5 +1,6 @@
1
+ import osmtogeojson from 'osmtogeojson';
2
+
1
3
  import leaflet from '../leaflet';
2
- import osmtogeojson from "osmtogeojson";
3
4
 
4
5
  /**
5
6
  * Get the bounds as overpass bbox string.
@@ -10,7 +11,7 @@ function toOverpassBBoxString (LatLngBounds) {
10
11
  var a = LatLngBounds._southWest,
11
12
  b = LatLngBounds._northEast;
12
13
 
13
- return [a.lat, a.lng, b.lat, b.lng].join(",");
14
+ return [a.lat, a.lng, b.lat, b.lng].join(',');
14
15
  }
15
16
 
16
17
  /**
@@ -57,7 +58,7 @@ export default leaflet.FeatureGroup.extend({
57
58
 
58
59
  var bounds = toOverpassBBoxString(this._map.getBounds());
59
60
  var query = this.options.query.replace(/(BBOX)/g, bounds);
60
- var url = this.options.endpoint + "interpreter?data=[out:json];" + query;
61
+ var url = this.options.endpoint + 'interpreter?data=[out:json];' + query;
61
62
 
62
63
  this._map.fire('dataloading', {layer: this});
63
64
 
@@ -1,9 +1,9 @@
1
- import leaflet from '../leaflet';
2
- import pointToLayer from "../geojson/pointToLayer";
1
+ import {mapFactory} from '../factory';
3
2
  import {determineListener} from '../factory/bindEvents';
4
- import preloadAssets from "../factory/preloadAssets";
5
- import GeoJSON from "../geojson";
6
- import {mapFactory} from "../factory";
3
+ import preloadAssets from '../factory/preloadAssets';
4
+ import {from} from '../geojson';
5
+ import pointToLayer from '../geojson/pointToLayer';
6
+ import leaflet from '../leaflet';
7
7
 
8
8
  function boundsListener(layer, map) {
9
9
  if (!layer.options.adjustBounds) {
@@ -57,7 +57,7 @@ export default async function (config, element) {
57
57
  throw new Error(`Unknown data type "${config.data.type}"`);
58
58
  }
59
59
 
60
- data = GeoJSON.from(config.data.format, data);
60
+ data = from(config.data.format, data);
61
61
 
62
62
  // TODO: Implement a better way for preprocessing geojson data
63
63
  if (data.features) {
@@ -1,4 +1,5 @@
1
1
  import leaflet from '../leaflet';
2
+
2
3
  import {createFactory} from './layerGroupFactory';
3
4
 
4
5
  export default createFactory(leaflet.featureGroup);
@@ -1,4 +1,4 @@
1
- import OverpassLayer from "./OverpassLayer";
1
+ import OverpassLayer from './OverpassLayer';
2
2
 
3
3
  export default async function (config, element) {
4
4
  return new OverpassLayer(config.options);
@@ -1,6 +1,7 @@
1
1
  import leaflet from 'leaflet';
2
- import "@raruto/leaflet-gesture-handling";
3
- import { ATTRIBUTION} from "../config";
2
+
3
+ import '@raruto/leaflet-gesture-handling';
4
+ import { ATTRIBUTION} from '../config';
4
5
 
5
6
  /* This code is needed to properly load the images in the Leaflet CSS */
6
7
  delete leaflet.Icon.Default.prototype._getIconUrl;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cowegis/client",
3
- "version": "1.0.0-alpha4",
3
+ "version": "1.0.0-alpha6",
4
4
  "description": "Cowegis web client",
5
5
  "main": "js/client.js",
6
6
  "repository": {
@@ -20,24 +20,35 @@
20
20
  },
21
21
  "homepage": "https://github.com/cowegis/cowegis-js-client#readme",
22
22
  "dependencies": {
23
- "@fortawesome/fontawesome-svg-core": "^1.2.32",
24
- "@fortawesome/free-brands-svg-icons": "^5.15.1",
25
- "@fortawesome/free-regular-svg-icons": "^5.15.1",
26
- "@fortawesome/free-solid-svg-icons": "^5.15.1",
27
- "@geoman-io/leaflet-geoman-free": "^2.8.0",
28
- "@mapbox/maki": "^6.2.0",
23
+ "@fortawesome/fontawesome-svg-core": "^6.1",
24
+ "@fortawesome/free-brands-svg-icons": "^6.1",
25
+ "@fortawesome/free-regular-svg-icons": "^6.1",
26
+ "@fortawesome/free-solid-svg-icons": "^6.1",
27
+ "@geoman-io/leaflet-geoman-free": "^2.13.0",
29
28
  "@mapbox/togeojson": "^0.16.0",
30
- "@raruto/leaflet-gesture-handling": "^1.3.2",
31
- "leaflet": "^1.6.0",
32
- "leaflet-control-geocoder": "^1.13.0",
29
+ "@raruto/leaflet-gesture-handling": "^1.4.3",
30
+ "leaflet": "^1.9.4",
31
+ "leaflet-control-geocoder": "^2.4.0",
33
32
  "leaflet-loading": "^0.1.24",
34
- "leaflet-providers": "^1.11.0",
35
- "leaflet.fullscreen": "^1.6.0",
36
- "leaflet.markercluster": "^1.4.1",
33
+ "leaflet-providers": "^2.0.0",
34
+ "leaflet.fullscreen": "^3.0.2",
35
+ "leaflet.markercluster": "^1.5.3",
37
36
  "leaflet.markercluster.layersupport": "^2.0.1",
38
- "osmtogeojson": "^3.0.0-beta.4",
39
- "spin.js": "^4.1.0",
37
+ "osmtogeojson": "^3.0.0-beta.5",
38
+ "spin.js": "^4.1.2",
40
39
  "topojson-client": "^3.1.0",
41
40
  "wellknown": "^0.5.0"
41
+ },
42
+ "devDependencies": {
43
+ "@babel/eslint-parser": "^7.18.2",
44
+ "eslint": "^8.15.0",
45
+ "eslint-import-resolver-typescript": "^2.7.1",
46
+ "eslint-import-resolver-webpack": "^0.13.2",
47
+ "eslint-plugin-html": "^6.2.0",
48
+ "eslint-plugin-import": "^2.26.0"
49
+ },
50
+ "scripts": {
51
+ "lint": "eslint --ext .js js/",
52
+ "fix": "eslint --ext .js js/ --fix"
42
53
  }
43
54
  }