maplibre-gl-layer-control 0.17.3 → 0.17.4

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 ===== */
@@ -280,6 +280,7 @@ export declare class LayerControl implements IControl {
280
280
  private onLayerRename?;
281
281
  private onLayerReorder?;
282
282
  private onLayerRemove?;
283
+ private onLayerStyleChange?;
283
284
  private onBackgroundVisibilityChange?;
284
285
  private onBackgroundOpacityChange?;
285
286
  private enableBackgroundPresets;
@@ -642,6 +643,32 @@ export declare class LayerControl implements IControl {
642
643
  * Add controls for symbol layers
643
644
  */
644
645
  private addSymbolControls;
646
+ /**
647
+ * Notify the host that a paint property changed through the style editor.
648
+ * Reports the layer the active style editor belongs to (`activeStyleEditor`),
649
+ * not the internal native sub-layer id a control may edit, so consumers can
650
+ * map the change back to their own layer model.
651
+ */
652
+ private notifyLayerStyleChange;
653
+ /**
654
+ * Re-read an open style editor's controls from the current map paint so they
655
+ * reflect changes made elsewhere (e.g. an external sidebar writing the same
656
+ * paint properties). Setting input `.value` programmatically does not
657
+ * dispatch an `input` event, so this never re-triggers
658
+ * {@link LayerControlOptions.onLayerStyleChange}. The control the user is
659
+ * actively dragging (the focused input) is left untouched so the refresh
660
+ * does not fight an in-progress drag.
661
+ *
662
+ * @param layerId Restrict the refresh to one layer's editor. Defaults to the
663
+ * currently active editor. No-op when that editor is not open.
664
+ */
665
+ refreshStyleEditor(layerId?: string): void;
666
+ /**
667
+ * Update every slider/color control in a style editor from the layer's
668
+ * current map paint. Each control records the layer it reads from in
669
+ * `dataset.layerId` (see createSliderControl/createColorControl).
670
+ */
671
+ private syncStyleEditorControlsFromMap;
645
672
  /**
646
673
  * Create a color control
647
674
  */
@@ -820,6 +847,17 @@ export declare interface LayerControlOptions {
820
847
  onLayerReorder?: (layerOrder: string[]) => void;
821
848
  /** Callback when a layer is removed via context menu */
822
849
  onLayerRemove?: (layerId: string) => void;
850
+ /**
851
+ * Callback fired whenever a paint property is changed through the per-layer
852
+ * style editor (a slider/color input, or the Reset button). Reports the
853
+ * layer the open style editor belongs to (`layerId`), the MapLibre paint
854
+ * property name (e.g. `"raster-brightness-max"`, `"fill-color"`), and the new
855
+ * value (a number for sliders, a hex string for color pickers). Lets
856
+ * consumers mirror the change into their own store so external style UI
857
+ * (e.g. a separate sidebar) stays in sync. The control still applies the
858
+ * change to the map itself; this callback is purely a notification.
859
+ */
860
+ onLayerStyleChange?: (layerId: string, property: string, value: unknown) => void;
823
861
  /**
824
862
  * Callback fired when the Background (basemap) group visibility is toggled
825
863
  * 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.4",
4
4
  "description": "A comprehensive layer control for MapLibre GL with advanced styling capabilities",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",