maplibre-gl-layer-control 0.19.0 → 0.19.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/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const LayerControl = require("./LayerControl-BxSfUXK6.cjs");
3
+ const LayerControl = require("./LayerControl-2Gi-t4dS.cjs");
4
4
  exports.CustomLayerRegistry = LayerControl.CustomLayerRegistry;
5
5
  exports.LayerControl = LayerControl.LayerControl;
6
6
  exports.clamp = LayerControl.clamp;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { C, L, c, l, m, k, o, f, b, d, e, a, h, j, g, i, n, r, s } from "./LayerControl-CvH3r0T2.js";
1
+ import { C, L, c, l, m, k, o, f, b, d, e, a, h, j, g, i, n, r, s } from "./LayerControl-Ccyj0y-D.js";
2
2
  export {
3
3
  C as CustomLayerRegistry,
4
4
  L as LayerControl,
package/dist/react.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const react = require("react");
4
- const LayerControl = require("./LayerControl-BxSfUXK6.cjs");
4
+ const LayerControl = require("./LayerControl-2Gi-t4dS.cjs");
5
5
  function LayerControlReact({
6
6
  map,
7
7
  position = "top-right",
package/dist/react.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { useRef, useEffect, useState, useCallback } from "react";
2
- import { L as LayerControl, g as getLayerType, s as setLayerOpacity, p as cacheOriginalLayerStyle, q as restoreOriginalStyle, c as clamp, a as getLayerOpacity } from "./LayerControl-CvH3r0T2.js";
2
+ import { L as LayerControl, g as getLayerType, s as setLayerOpacity, p as cacheOriginalLayerStyle, q as restoreOriginalStyle, c as clamp, a as getLayerOpacity } from "./LayerControl-Ccyj0y-D.js";
3
3
  function LayerControlReact({
4
4
  map,
5
5
  position = "top-right",
@@ -397,6 +397,8 @@ export declare class LayerControl implements IControl {
397
397
  private basemapLayerIdsProvided;
398
398
  /** Set once onAdd has listed the map's layers (after any basemapStyleUrl fetch). */
399
399
  private layersListed;
400
+ /** setLayerState calls made before the layers were listed, applied once they are. */
401
+ private pendingLayerStates;
400
402
  /** Panel order set through setLayerOrder, used to order layers with nothing on the map. */
401
403
  private layerOrderHint;
402
404
  private widthFrame;
@@ -583,16 +585,24 @@ export declare class LayerControl implements IControl {
583
585
  * Only layers the control already lists are updated, with one exception:
584
586
  * `"Background"` adds the Background row when the control has none (a style
585
587
  * whose basemap lives in style imports has no root basemap layers to detect,
586
- * so the control would otherwise show no Background row). It returns false
587
- * until the control has listed the map's layers (after `onAdd`, and after a
588
- * `basemapStyleUrl` fetch), since seeding state earlier would stop the
589
- * control from detecting layers on its own.
588
+ * so the control would otherwise show no Background row).
589
+ *
590
+ * Until the control has listed the map's layers (during `onAdd`, and while a
591
+ * `basemapStyleUrl` fetch is in flight) the update is queued and applied
592
+ * once they are listed, since seeding state earlier would stop the control
593
+ * from detecting layers on its own.
590
594
  *
591
595
  * @param layerId The layer ID, or `"Background"` for the basemap row
592
596
  * @param state The fields to change; omitted fields keep their value
593
- * @returns True if a layer state was updated or created
597
+ * @returns True if a layer state was updated, created or queued; false
598
+ * before the control is added to a map or for a layer it does not list
594
599
  */
595
600
  setLayerState(layerId: string, state: Partial<Pick<LayerState, "visible" | "opacity" | "name">>): boolean;
601
+ /**
602
+ * Mark the map's layers as listed and apply setLayerState calls queued
603
+ * before then.
604
+ */
605
+ private finishListing;
596
606
  /**
597
607
  * Set the order the panel lists layers in, then redraw the rows.
598
608
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maplibre-gl-layer-control",
3
- "version": "0.19.0",
3
+ "version": "0.19.1",
4
4
  "description": "A comprehensive layer control for MapLibre GL with advanced styling capabilities",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",