mobility-toolbox-js 3.0.0-beta.15 → 3.0.0-beta.16

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/mbt.js CHANGED
@@ -44485,7 +44485,7 @@ uniform ${i3} ${s3} u_${a3};
44485
44485
  })
44486
44486
  );
44487
44487
  this.options = options;
44488
- this.children = options.children || [];
44488
+ this.set("children", options.children || []);
44489
44489
  }
44490
44490
  /** @deprecated */
44491
44491
  get children() {
@@ -44613,7 +44613,7 @@ uniform ${i3} ${s3} u_${a3};
44613
44613
  (oldValue || []).forEach((child) => {
44614
44614
  child.set("parent", void 0);
44615
44615
  });
44616
- (this.children || []).forEach((child) => {
44616
+ (this.get("children") || []).forEach((child) => {
44617
44617
  child.set("parent", this);
44618
44618
  });
44619
44619
  }
@@ -44664,13 +44664,18 @@ uniform ${i3} ${s3} u_${a3};
44664
44664
  var MobilityLayerMixin_default = MobilityLayerMixin;
44665
44665
 
44666
44666
  // src/ol/layers/MaplibreLayer.ts
44667
+ var buildStyleUrl = (url, style, apiKey, apiKeyName) => {
44668
+ return getUrlWithParams_default(`${url}/styles/${style}/style.json`, {
44669
+ [apiKeyName]: apiKey
44670
+ }).toString();
44671
+ };
44667
44672
  var MaplibreLayer = class _MaplibreLayer extends MobilityLayerMixin_default(MapLibreLayer) {
44668
44673
  get mbMap() {
44669
- console.warn("Deprecated. Use layer.maplibreMap.");
44674
+ console.warn(".mbMap deprecated. Use layer.maplibreMap.");
44670
44675
  return this.maplibreMap;
44671
44676
  }
44672
44677
  get maplibreMap() {
44673
- console.warn("Deprecated. Use layer.mapLibreMap.");
44678
+ console.warn(".maplibreMap eprecated. Use layer.mapLibreMap.");
44674
44679
  return this.mapLibreMap;
44675
44680
  }
44676
44681
  // get queryRenderedFeaturesOptions(): maplibregl.QueryRenderedFeaturesOptions {
@@ -44704,7 +44709,7 @@ uniform ${i3} ${s3} u_${a3};
44704
44709
  * @param {string} [options.url="https://maps.geops.io"] The geOps Maps API url.
44705
44710
  */
44706
44711
  constructor(options) {
44707
- super({
44712
+ const newOptions = {
44708
44713
  apiKeyName: "key",
44709
44714
  style: "travic_v2",
44710
44715
  url: "https://maps.geops.io",
@@ -44712,7 +44717,16 @@ uniform ${i3} ${s3} u_${a3};
44712
44717
  mapLibreOptions: {
44713
44718
  ...options.mapLibreOptions || {}
44714
44719
  }
44715
- });
44720
+ };
44721
+ if (!newOptions.mapLibreOptions.style && newOptions.apiKey) {
44722
+ newOptions.mapLibreOptions.style = buildStyleUrl(
44723
+ newOptions.url,
44724
+ newOptions.style,
44725
+ newOptions.apiKey,
44726
+ newOptions.apiKeyName
44727
+ );
44728
+ }
44729
+ super(newOptions);
44716
44730
  }
44717
44731
  /**
44718
44732
  * Initialize the layer and listen to feature clicks.
@@ -44740,19 +44754,15 @@ uniform ${i3} ${s3} u_${a3};
44740
44754
  if (this.url.includes("style.json")) {
44741
44755
  return this.url;
44742
44756
  }
44743
- return getUrlWithParams_default(`${this.url}/styles/${this.style}/style.json`, {
44744
- [this.get("apiKeyName")]: this.get("apiKey")
44745
- }).toString();
44757
+ return buildStyleUrl(
44758
+ this.url,
44759
+ this.style,
44760
+ this.get("apiKey"),
44761
+ this.get("apiKeyName")
44762
+ );
44746
44763
  }
44747
- // eslint-disable-next-line class-methods-use-this
44748
- // createMap(options: MapOptions): Map {
44749
- // return new Map(options);
44750
- // }
44751
- // createRenderer(): MaplibreLayerRenderer {
44752
- // return new MaplibreLayerRenderer(this);
44753
- // }
44754
44764
  updateMaplibreMap() {
44755
- this.maplibreMap?.setStyle(this.getStyle(), { diff: false });
44765
+ this.mapLibreMap?.setStyle(this.getStyle(), { diff: false });
44756
44766
  }
44757
44767
  /**
44758
44768
  * Create a copy of the MaplibreLayer.