maplibre-gl-layer-control 0.17.3 → 0.17.5

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.
@@ -665,6 +665,7 @@
665
665
 
666
666
  .style-editor-actions {
667
667
  display: flex;
668
+ flex-wrap: wrap;
668
669
  gap: 8px;
669
670
  justify-content: flex-end;
670
671
  padding-top: 8px;
@@ -672,8 +673,8 @@
672
673
  }
673
674
 
674
675
  .style-editor-button {
675
- padding: 8px 16px;
676
- min-width: 70px;
676
+ padding: 8px 12px;
677
+ min-width: 60px;
677
678
  border: 1px solid #ddd;
678
679
  border-radius: 3px;
679
680
  background: white;
@@ -694,43 +695,15 @@
694
695
  background: #e0e0e0;
695
696
  }
696
697
 
697
- .layer-control-style-editor .style-editor-button-reset {
698
- background: #fb923c !important;
699
- color: #ffffff !important;
700
- border-color: #f97316 !important;
701
- font-weight: 600;
702
- }
703
-
704
- .layer-control-style-editor .style-editor-button-reset:hover {
705
- background: #f97316 !important;
706
- border-color: #ea580c !important;
707
- color: #ffffff !important;
708
- }
709
-
710
- .layer-control-style-editor .style-editor-button-close {
711
- background: #6b7280 !important;
712
- color: #ffffff !important;
713
- border-color: #4b5563 !important;
714
- font-weight: 600;
715
- }
716
-
717
- .layer-control-style-editor .style-editor-button-close:hover {
718
- background: #4b5563 !important;
719
- border-color: #374151 !important;
720
- color: #ffffff !important;
721
- }
722
-
723
- .layer-control-style-editor .style-editor-button-remove {
724
- background: #ef4444 !important;
725
- color: #ffffff !important;
726
- border-color: #dc2626 !important;
727
- font-weight: 600;
728
- }
729
-
698
+ /* The Reset / Remove / Close action buttons share the neutral base style above.
699
+ They intentionally drop the former orange/gray/red fills: consuming apps
700
+ reserve those signal colors for warnings and errors, so a standard action
701
+ button should not emit them. The destructive Remove action is confirmed via
702
+ an inline prompt and only hints its nature with a restrained red on hover. */
730
703
  .layer-control-style-editor .style-editor-button-remove:hover {
731
- background: #dc2626 !important;
732
- border-color: #b91c1c !important;
733
- color: #ffffff !important;
704
+ background: #fef2f2;
705
+ border-color: #fca5a5;
706
+ color: #b91c1c;
734
707
  }
735
708
 
736
709
  /* ===== Background Legend Panel ===== */
@@ -104,6 +104,11 @@ export declare class CustomLayerRegistry {
104
104
  * @returns Array of layer IDs
105
105
  */
106
106
  getAllLayerIds(): string[];
107
+ /**
108
+ * Get each adapter's layer IDs as a separate list, in adapter order.
109
+ * @returns One array of layer IDs per registered adapter
110
+ */
111
+ getLayerIdGroups(): string[][];
107
112
  /**
108
113
  * Check if a layer ID is managed by any adapter.
109
114
  * @param layerId The layer ID to check
@@ -280,6 +285,7 @@ export declare class LayerControl implements IControl {
280
285
  private onLayerRename?;
281
286
  private onLayerReorder?;
282
287
  private onLayerRemove?;
288
+ private onLayerStyleChange?;
283
289
  private onBackgroundVisibilityChange?;
284
290
  private onBackgroundOpacityChange?;
285
291
  private enableBackgroundPresets;
@@ -642,6 +648,32 @@ export declare class LayerControl implements IControl {
642
648
  * Add controls for symbol layers
643
649
  */
644
650
  private addSymbolControls;
651
+ /**
652
+ * Notify the host that a paint property changed through the style editor.
653
+ * Reports the layer the active style editor belongs to (`activeStyleEditor`),
654
+ * not the internal native sub-layer id a control may edit, so consumers can
655
+ * map the change back to their own layer model.
656
+ */
657
+ private notifyLayerStyleChange;
658
+ /**
659
+ * Re-read an open style editor's controls from the current map paint so they
660
+ * reflect changes made elsewhere (e.g. an external sidebar writing the same
661
+ * paint properties). Setting input `.value` programmatically does not
662
+ * dispatch an `input` event, so this never re-triggers
663
+ * {@link LayerControlOptions.onLayerStyleChange}. The control the user is
664
+ * actively dragging (the focused input) is left untouched so the refresh
665
+ * does not fight an in-progress drag.
666
+ *
667
+ * @param layerId Restrict the refresh to one layer's editor. Defaults to the
668
+ * currently active editor. No-op when that editor is not open.
669
+ */
670
+ refreshStyleEditor(layerId?: string): void;
671
+ /**
672
+ * Update every slider/color control in a style editor from the layer's
673
+ * current map paint. Each control records the layer it reads from in
674
+ * `dataset.layerId` (see createSliderControl/createColorControl).
675
+ */
676
+ private syncStyleEditorControlsFromMap;
645
677
  /**
646
678
  * Create a color control
647
679
  */
@@ -820,6 +852,17 @@ export declare interface LayerControlOptions {
820
852
  onLayerReorder?: (layerOrder: string[]) => void;
821
853
  /** Callback when a layer is removed via context menu */
822
854
  onLayerRemove?: (layerId: string) => void;
855
+ /**
856
+ * Callback fired whenever a paint property is changed through the per-layer
857
+ * style editor (a slider/color input, or the Reset button). Reports the
858
+ * layer the open style editor belongs to (`layerId`), the MapLibre paint
859
+ * property name (e.g. `"raster-brightness-max"`, `"fill-color"`), and the new
860
+ * value (a number for sliders, a hex string for color pickers). Lets
861
+ * consumers mirror the change into their own store so external style UI
862
+ * (e.g. a separate sidebar) stays in sync. The control still applies the
863
+ * change to the map itself; this callback is purely a notification.
864
+ */
865
+ onLayerStyleChange?: (layerId: string, property: string, value: unknown) => void;
823
866
  /**
824
867
  * Callback fired when the Background (basemap) group visibility is toggled
825
868
  * via the control's checkbox. Lets consumers mirror the new state into their
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maplibre-gl-layer-control",
3
- "version": "0.17.3",
3
+ "version": "0.17.5",
4
4
  "description": "A comprehensive layer control for MapLibre GL with advanced styling capabilities",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",