maplibre-gl-components 0.1.0 → 0.2.0

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.
@@ -614,7 +614,6 @@ class Legend {
614
614
  */
615
615
  constructor(options) {
616
616
  __publicField(this, "_container");
617
- __publicField(this, "_contentEl");
618
617
  __publicField(this, "_options");
619
618
  __publicField(this, "_state");
620
619
  __publicField(this, "_eventHandlers", /* @__PURE__ */ new Map());
@@ -643,7 +642,6 @@ class Legend {
643
642
  var _a, _b;
644
643
  (_b = (_a = this._container) == null ? void 0 : _a.parentNode) == null ? void 0 : _b.removeChild(this._container);
645
644
  this._container = void 0;
646
- this._contentEl = void 0;
647
645
  this._eventHandlers.clear();
648
646
  }
649
647
  /**
@@ -676,10 +674,7 @@ class Legend {
676
674
  expand() {
677
675
  if (this._state.collapsed) {
678
676
  this._state.collapsed = false;
679
- if (this._contentEl) {
680
- this._contentEl.style.display = "block";
681
- }
682
- this._updateToggleIcon();
677
+ this._render();
683
678
  this._emit("expand");
684
679
  }
685
680
  }
@@ -689,10 +684,7 @@ class Legend {
689
684
  collapse() {
690
685
  if (!this._state.collapsed) {
691
686
  this._state.collapsed = true;
692
- if (this._contentEl) {
693
- this._contentEl.style.display = "none";
694
- }
695
- this._updateToggleIcon();
687
+ this._render();
696
688
  this._emit("collapse");
697
689
  }
698
690
  }
@@ -814,18 +806,43 @@ class Legend {
814
806
  * @returns The swatch element.
815
807
  */
816
808
  _createSwatch(item) {
817
- const { swatchSize } = this._options;
809
+ const { swatchSize = 16 } = this._options;
810
+ const shape = item.shape || "square";
818
811
  const swatch = document.createElement("span");
819
- swatch.className = `maplibre-gl-legend-swatch maplibre-gl-legend-swatch-${item.shape || "square"}`;
820
- Object.assign(swatch.style, {
821
- width: `${swatchSize}px`,
822
- height: item.shape === "line" ? "3px" : `${swatchSize}px`,
823
- backgroundColor: item.color,
824
- borderRadius: item.shape === "circle" ? "50%" : item.shape === "line" ? "0" : "2px",
825
- border: item.strokeColor ? `1px solid ${item.strokeColor}` : "1px solid rgba(0,0,0,0.1)",
812
+ swatch.className = `maplibre-gl-legend-swatch maplibre-gl-legend-swatch-${shape}`;
813
+ const baseStyles = {
826
814
  flexShrink: "0",
827
815
  display: "inline-block"
828
- });
816
+ };
817
+ if (shape === "line") {
818
+ Object.assign(swatch.style, {
819
+ ...baseStyles,
820
+ width: `${swatchSize}px`,
821
+ height: "4px",
822
+ backgroundColor: item.color,
823
+ borderRadius: "2px",
824
+ border: "none",
825
+ alignSelf: "center"
826
+ });
827
+ } else if (shape === "circle") {
828
+ Object.assign(swatch.style, {
829
+ ...baseStyles,
830
+ width: `${swatchSize}px`,
831
+ height: `${swatchSize}px`,
832
+ backgroundColor: item.color,
833
+ borderRadius: "50%",
834
+ border: item.strokeColor ? `2px solid ${item.strokeColor}` : "1px solid rgba(0,0,0,0.1)"
835
+ });
836
+ } else {
837
+ Object.assign(swatch.style, {
838
+ ...baseStyles,
839
+ width: `${swatchSize}px`,
840
+ height: `${swatchSize}px`,
841
+ backgroundColor: item.color,
842
+ borderRadius: "2px",
843
+ border: item.strokeColor ? `2px solid ${item.strokeColor}` : "1px solid rgba(0,0,0,0.1)"
844
+ });
845
+ }
829
846
  if (item.icon) {
830
847
  Object.assign(swatch.style, {
831
848
  backgroundImage: `url(${item.icon})`,
@@ -833,21 +850,13 @@ class Legend {
833
850
  backgroundRepeat: "no-repeat",
834
851
  backgroundPosition: "center",
835
852
  backgroundColor: "transparent",
836
- border: "none"
853
+ border: "none",
854
+ width: `${swatchSize}px`,
855
+ height: `${swatchSize}px`
837
856
  });
838
857
  }
839
858
  return swatch;
840
859
  }
841
- /**
842
- * Updates the toggle icon based on collapsed state.
843
- */
844
- _updateToggleIcon() {
845
- var _a;
846
- const toggle = (_a = this._container) == null ? void 0 : _a.querySelector(".maplibre-gl-legend-toggle");
847
- if (toggle) {
848
- toggle.innerHTML = this._state.collapsed ? "▶" : "▼";
849
- }
850
- }
851
860
  /**
852
861
  * Renders the legend content.
853
862
  */
@@ -866,14 +875,17 @@ class Legend {
866
875
  collapsible
867
876
  } = this._options;
868
877
  this._container.innerHTML = "";
878
+ const isCollapsedWithHeader = this._state.collapsed && (title || collapsible);
879
+ const vertPadding = isCollapsedWithHeader ? 4 : padding;
869
880
  Object.assign(this._container.style, {
870
881
  backgroundColor,
871
882
  opacity: opacity.toString(),
872
883
  borderRadius: `${borderRadius}px`,
873
- padding: `${padding}px`,
884
+ padding: `${vertPadding}px ${padding}px`,
874
885
  fontSize: `${fontSize}px`,
875
886
  color: fontColor,
876
- width: `${width}px`,
887
+ width: isCollapsedWithHeader ? "auto" : `${width}px`,
888
+ maxWidth: `${width}px`,
877
889
  boxShadow: "0 0 0 2px rgba(0, 0, 0, 0.1)",
878
890
  display: this._state.visible ? "block" : "none",
879
891
  fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
@@ -885,7 +897,7 @@ class Legend {
885
897
  display: "flex",
886
898
  alignItems: "center",
887
899
  justifyContent: "space-between",
888
- marginBottom: "8px",
900
+ paddingBottom: this._state.collapsed ? "0" : "4px",
889
901
  cursor: collapsible ? "pointer" : "default"
890
902
  });
891
903
  if (title) {
@@ -912,7 +924,6 @@ class Legend {
912
924
  overflowY: "auto",
913
925
  display: this._state.collapsed ? "none" : "block"
914
926
  });
915
- this._contentEl = content;
916
927
  this._state.items.forEach((item) => {
917
928
  const row = document.createElement("div");
918
929
  row.className = "maplibre-gl-legend-item";
@@ -936,15 +947,20 @@ class Legend {
936
947
  const DEFAULT_OPTIONS = {
937
948
  html: "",
938
949
  element: void 0,
950
+ title: "",
939
951
  position: "top-left",
940
952
  className: "",
941
953
  visible: true,
954
+ collapsible: false,
955
+ collapsed: false,
942
956
  backgroundColor: "rgba(255, 255, 255, 0.9)",
943
957
  padding: 10,
944
958
  borderRadius: 4,
945
959
  opacity: 1,
946
960
  maxWidth: 300,
947
- maxHeight: 400
961
+ maxHeight: 400,
962
+ fontSize: 12,
963
+ fontColor: "#333"
948
964
  };
949
965
  class HtmlControl {
950
966
  /**
@@ -961,6 +977,7 @@ class HtmlControl {
961
977
  this._options = { ...DEFAULT_OPTIONS, ...options };
962
978
  this._state = {
963
979
  visible: this._options.visible,
980
+ collapsed: this._options.collapsed,
964
981
  html: this._options.html
965
982
  };
966
983
  }
@@ -1011,6 +1028,36 @@ class HtmlControl {
1011
1028
  this._emit("hide");
1012
1029
  }
1013
1030
  }
1031
+ /**
1032
+ * Expands the control (if collapsible).
1033
+ */
1034
+ expand() {
1035
+ if (this._state.collapsed) {
1036
+ this._state.collapsed = false;
1037
+ this._render();
1038
+ this._emit("expand");
1039
+ }
1040
+ }
1041
+ /**
1042
+ * Collapses the control (if collapsible).
1043
+ */
1044
+ collapse() {
1045
+ if (!this._state.collapsed) {
1046
+ this._state.collapsed = true;
1047
+ this._render();
1048
+ this._emit("collapse");
1049
+ }
1050
+ }
1051
+ /**
1052
+ * Toggles the collapsed state.
1053
+ */
1054
+ toggle() {
1055
+ if (this._state.collapsed) {
1056
+ this.expand();
1057
+ } else {
1058
+ this.collapse();
1059
+ }
1060
+ }
1014
1061
  /**
1015
1062
  * Sets the HTML content.
1016
1063
  *
@@ -1057,6 +1104,7 @@ class HtmlControl {
1057
1104
  this._options = { ...this._options, ...options };
1058
1105
  if (options.html !== void 0) this._state.html = options.html;
1059
1106
  if (options.visible !== void 0) this._state.visible = options.visible;
1107
+ if (options.collapsed !== void 0) this._state.collapsed = options.collapsed;
1060
1108
  this._render();
1061
1109
  this._emit("update");
1062
1110
  }
@@ -1121,28 +1169,70 @@ class HtmlControl {
1121
1169
  _render() {
1122
1170
  if (!this._container) return;
1123
1171
  const {
1172
+ title = "",
1173
+ collapsible = false,
1124
1174
  backgroundColor = "rgba(255, 255, 255, 0.9)",
1125
1175
  opacity = 1,
1126
1176
  borderRadius = 4,
1127
1177
  padding = 10,
1128
1178
  maxWidth = 300,
1129
- maxHeight = 400
1179
+ maxHeight = 400,
1180
+ fontSize = 12,
1181
+ fontColor = "#333"
1130
1182
  } = this._options;
1131
1183
  this._container.innerHTML = "";
1184
+ const isCollapsedWithHeader = this._state.collapsed && (title || collapsible);
1185
+ const vertPadding = isCollapsedWithHeader ? 4 : padding;
1132
1186
  Object.assign(this._container.style, {
1133
1187
  backgroundColor,
1134
1188
  opacity: String(opacity),
1135
1189
  borderRadius: `${borderRadius}px`,
1136
- padding: `${padding}px`,
1190
+ padding: `${vertPadding}px ${padding}px`,
1137
1191
  maxWidth: `${maxWidth}px`,
1138
- maxHeight: `${maxHeight}px`,
1139
- overflowY: "auto",
1192
+ fontSize: `${fontSize}px`,
1193
+ color: fontColor,
1140
1194
  boxShadow: "0 0 0 2px rgba(0, 0, 0, 0.1)",
1141
1195
  display: this._state.visible ? "block" : "none",
1142
1196
  fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
1143
1197
  });
1198
+ if (collapsible || title) {
1199
+ const header = document.createElement("div");
1200
+ header.className = "maplibre-gl-html-control-header";
1201
+ Object.assign(header.style, {
1202
+ display: "flex",
1203
+ alignItems: "center",
1204
+ justifyContent: "space-between",
1205
+ paddingBottom: this._state.collapsed ? "0" : "8px",
1206
+ cursor: collapsible ? "pointer" : "default"
1207
+ });
1208
+ if (title) {
1209
+ const titleEl = document.createElement("span");
1210
+ titleEl.className = "maplibre-gl-html-control-title";
1211
+ titleEl.textContent = title;
1212
+ titleEl.style.fontWeight = "600";
1213
+ header.appendChild(titleEl);
1214
+ }
1215
+ if (collapsible) {
1216
+ const toggleBtn = document.createElement("span");
1217
+ toggleBtn.className = "maplibre-gl-html-control-toggle";
1218
+ toggleBtn.innerHTML = this._state.collapsed ? "▶" : "▼";
1219
+ Object.assign(toggleBtn.style, {
1220
+ marginLeft: "8px",
1221
+ fontSize: "10px",
1222
+ userSelect: "none"
1223
+ });
1224
+ header.appendChild(toggleBtn);
1225
+ header.addEventListener("click", () => this.toggle());
1226
+ }
1227
+ this._container.appendChild(header);
1228
+ }
1144
1229
  const content = document.createElement("div");
1145
1230
  content.className = "maplibre-gl-html-control-content";
1231
+ Object.assign(content.style, {
1232
+ maxHeight: `${maxHeight}px`,
1233
+ overflowY: "auto",
1234
+ display: this._state.collapsed ? "none" : "block"
1235
+ });
1146
1236
  this._contentEl = content;
1147
1237
  if (this._options.element) {
1148
1238
  content.appendChild(this._options.element);
@@ -1188,4 +1278,4 @@ export {
1188
1278
  clamp as y,
1189
1279
  formatNumericValue as z
1190
1280
  };
1191
- //# sourceMappingURL=HtmlControl-iggZQwXP.js.map
1281
+ //# sourceMappingURL=HtmlControl-mwWlMV6V.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HtmlControl-mwWlMV6V.js","sources":["../src/lib/colormaps/sequential.ts","../src/lib/colormaps/diverging.ts","../src/lib/colormaps/misc.ts","../src/lib/colormaps/index.ts","../src/lib/utils/helpers.ts","../src/lib/core/Colorbar.ts","../src/lib/core/Legend.ts","../src/lib/core/HtmlControl.ts"],"sourcesContent":["import type { ColorStop } from '../core/types';\n\n/**\n * Viridis colormap - perceptually uniform, colorblind-friendly.\n */\nexport const viridis: ColorStop[] = [\n { position: 0.0, color: '#440154' },\n { position: 0.1, color: '#482878' },\n { position: 0.2, color: '#3e4a89' },\n { position: 0.3, color: '#31688e' },\n { position: 0.4, color: '#26838f' },\n { position: 0.5, color: '#1f9e89' },\n { position: 0.6, color: '#35b779' },\n { position: 0.7, color: '#6ece58' },\n { position: 0.8, color: '#b5de2b' },\n { position: 0.9, color: '#fde725' },\n { position: 1.0, color: '#fde725' },\n];\n\n/**\n * Plasma colormap - perceptually uniform.\n */\nexport const plasma: ColorStop[] = [\n { position: 0.0, color: '#0d0887' },\n { position: 0.1, color: '#41049d' },\n { position: 0.2, color: '#6a00a8' },\n { position: 0.3, color: '#8f0da4' },\n { position: 0.4, color: '#b12a90' },\n { position: 0.5, color: '#cc4778' },\n { position: 0.6, color: '#e16462' },\n { position: 0.7, color: '#f2844b' },\n { position: 0.8, color: '#fca636' },\n { position: 0.9, color: '#fcce25' },\n { position: 1.0, color: '#f0f921' },\n];\n\n/**\n * Inferno colormap - perceptually uniform.\n */\nexport const inferno: ColorStop[] = [\n { position: 0.0, color: '#000004' },\n { position: 0.1, color: '#1b0c41' },\n { position: 0.2, color: '#4a0c6b' },\n { position: 0.3, color: '#781c6d' },\n { position: 0.4, color: '#a52c60' },\n { position: 0.5, color: '#cf4446' },\n { position: 0.6, color: '#ed6925' },\n { position: 0.7, color: '#fb9b06' },\n { position: 0.8, color: '#f7d13d' },\n { position: 0.9, color: '#fcffa4' },\n { position: 1.0, color: '#fcffa4' },\n];\n\n/**\n * Magma colormap - perceptually uniform.\n */\nexport const magma: ColorStop[] = [\n { position: 0.0, color: '#000004' },\n { position: 0.1, color: '#180f3d' },\n { position: 0.2, color: '#440f76' },\n { position: 0.3, color: '#721f81' },\n { position: 0.4, color: '#9e2f7f' },\n { position: 0.5, color: '#cd4071' },\n { position: 0.6, color: '#f1605d' },\n { position: 0.7, color: '#fd9668' },\n { position: 0.8, color: '#fec98d' },\n { position: 0.9, color: '#fcfdbf' },\n { position: 1.0, color: '#fcfdbf' },\n];\n\n/**\n * Cividis colormap - colorblind-friendly.\n */\nexport const cividis: ColorStop[] = [\n { position: 0.0, color: '#00204d' },\n { position: 0.1, color: '#00306f' },\n { position: 0.2, color: '#2a406c' },\n { position: 0.3, color: '#4a5068' },\n { position: 0.4, color: '#636166' },\n { position: 0.5, color: '#7b7362' },\n { position: 0.6, color: '#94865c' },\n { position: 0.7, color: '#af9b51' },\n { position: 0.8, color: '#cab040' },\n { position: 0.9, color: '#e6c628' },\n { position: 1.0, color: '#ffdd00' },\n];\n","import type { ColorStop } from '../core/types';\n\n/**\n * Coolwarm diverging colormap.\n */\nexport const coolwarm: ColorStop[] = [\n { position: 0.0, color: '#3b4cc0' },\n { position: 0.1, color: '#5977e3' },\n { position: 0.2, color: '#7b9ff9' },\n { position: 0.3, color: '#9ebeff' },\n { position: 0.4, color: '#c0d4f5' },\n { position: 0.5, color: '#dddcdc' },\n { position: 0.6, color: '#f2cbb7' },\n { position: 0.7, color: '#f7ac8e' },\n { position: 0.8, color: '#ee8468' },\n { position: 0.9, color: '#d65244' },\n { position: 1.0, color: '#b40426' },\n];\n\n/**\n * Blue-White-Red diverging colormap.\n */\nexport const bwr: ColorStop[] = [\n { position: 0.0, color: '#0000ff' },\n { position: 0.5, color: '#ffffff' },\n { position: 1.0, color: '#ff0000' },\n];\n\n/**\n * Seismic diverging colormap.\n */\nexport const seismic: ColorStop[] = [\n { position: 0.0, color: '#00004d' },\n { position: 0.25, color: '#0000ff' },\n { position: 0.5, color: '#ffffff' },\n { position: 0.75, color: '#ff0000' },\n { position: 1.0, color: '#4d0000' },\n];\n\n/**\n * Red-Blue diverging colormap.\n */\nexport const RdBu: ColorStop[] = [\n { position: 0.0, color: '#67001f' },\n { position: 0.1, color: '#b2182b' },\n { position: 0.2, color: '#d6604d' },\n { position: 0.3, color: '#f4a582' },\n { position: 0.4, color: '#fddbc7' },\n { position: 0.5, color: '#f7f7f7' },\n { position: 0.6, color: '#d1e5f0' },\n { position: 0.7, color: '#92c5de' },\n { position: 0.8, color: '#4393c3' },\n { position: 0.9, color: '#2166ac' },\n { position: 1.0, color: '#053061' },\n];\n\n/**\n * Red-Yellow-Blue diverging colormap.\n */\nexport const RdYlBu: ColorStop[] = [\n { position: 0.0, color: '#a50026' },\n { position: 0.1, color: '#d73027' },\n { position: 0.2, color: '#f46d43' },\n { position: 0.3, color: '#fdae61' },\n { position: 0.4, color: '#fee090' },\n { position: 0.5, color: '#ffffbf' },\n { position: 0.6, color: '#e0f3f8' },\n { position: 0.7, color: '#abd9e9' },\n { position: 0.8, color: '#74add1' },\n { position: 0.9, color: '#4575b4' },\n { position: 1.0, color: '#313695' },\n];\n\n/**\n * Red-Yellow-Green diverging colormap.\n */\nexport const RdYlGn: ColorStop[] = [\n { position: 0.0, color: '#a50026' },\n { position: 0.1, color: '#d73027' },\n { position: 0.2, color: '#f46d43' },\n { position: 0.3, color: '#fdae61' },\n { position: 0.4, color: '#fee08b' },\n { position: 0.5, color: '#ffffbf' },\n { position: 0.6, color: '#d9ef8b' },\n { position: 0.7, color: '#a6d96a' },\n { position: 0.8, color: '#66bd63' },\n { position: 0.9, color: '#1a9850' },\n { position: 1.0, color: '#006837' },\n];\n\n/**\n * Spectral diverging colormap.\n */\nexport const spectral: ColorStop[] = [\n { position: 0.0, color: '#9e0142' },\n { position: 0.1, color: '#d53e4f' },\n { position: 0.2, color: '#f46d43' },\n { position: 0.3, color: '#fdae61' },\n { position: 0.4, color: '#fee08b' },\n { position: 0.5, color: '#ffffbf' },\n { position: 0.6, color: '#e6f598' },\n { position: 0.7, color: '#abdda4' },\n { position: 0.8, color: '#66c2a5' },\n { position: 0.9, color: '#3288bd' },\n { position: 1.0, color: '#5e4fa2' },\n];\n","import type { ColorStop } from '../core/types';\n\n/**\n * Jet colormap (classic rainbow-like).\n */\nexport const jet: ColorStop[] = [\n { position: 0.0, color: '#00007f' },\n { position: 0.125, color: '#0000ff' },\n { position: 0.25, color: '#007fff' },\n { position: 0.375, color: '#00ffff' },\n { position: 0.5, color: '#7fff7f' },\n { position: 0.625, color: '#ffff00' },\n { position: 0.75, color: '#ff7f00' },\n { position: 0.875, color: '#ff0000' },\n { position: 1.0, color: '#7f0000' },\n];\n\n/**\n * Rainbow colormap.\n */\nexport const rainbow: ColorStop[] = [\n { position: 0.0, color: '#ff0000' },\n { position: 0.17, color: '#ff8000' },\n { position: 0.33, color: '#ffff00' },\n { position: 0.5, color: '#00ff00' },\n { position: 0.67, color: '#00ffff' },\n { position: 0.83, color: '#0000ff' },\n { position: 1.0, color: '#8000ff' },\n];\n\n/**\n * Turbo colormap (improved rainbow).\n */\nexport const turbo: ColorStop[] = [\n { position: 0.0, color: '#30123b' },\n { position: 0.1, color: '#4662d7' },\n { position: 0.2, color: '#36aaf9' },\n { position: 0.3, color: '#1ae4b6' },\n { position: 0.4, color: '#72fe5e' },\n { position: 0.5, color: '#c8ef34' },\n { position: 0.6, color: '#faba39' },\n { position: 0.7, color: '#f66b19' },\n { position: 0.8, color: '#ca2a04' },\n { position: 0.9, color: '#7a0403' },\n { position: 1.0, color: '#7a0403' },\n];\n\n/**\n * Terrain colormap.\n */\nexport const terrain: ColorStop[] = [\n { position: 0.0, color: '#333399' },\n { position: 0.15, color: '#0099cc' },\n { position: 0.25, color: '#00cc99' },\n { position: 0.35, color: '#99cc00' },\n { position: 0.5, color: '#ffcc00' },\n { position: 0.65, color: '#cc6600' },\n { position: 0.75, color: '#993300' },\n { position: 0.85, color: '#996633' },\n { position: 1.0, color: '#ffffff' },\n];\n\n/**\n * Ocean colormap.\n */\nexport const ocean: ColorStop[] = [\n { position: 0.0, color: '#007f00' },\n { position: 0.25, color: '#00007f' },\n { position: 0.5, color: '#0000ff' },\n { position: 0.75, color: '#7fffff' },\n { position: 1.0, color: '#ffffff' },\n];\n\n/**\n * Hot colormap (black-red-yellow-white).\n */\nexport const hot: ColorStop[] = [\n { position: 0.0, color: '#000000' },\n { position: 0.33, color: '#ff0000' },\n { position: 0.67, color: '#ffff00' },\n { position: 1.0, color: '#ffffff' },\n];\n\n/**\n * Cool colormap (cyan-magenta).\n */\nexport const cool: ColorStop[] = [\n { position: 0.0, color: '#00ffff' },\n { position: 1.0, color: '#ff00ff' },\n];\n\n/**\n * Gray/Grayscale colormap.\n */\nexport const gray: ColorStop[] = [\n { position: 0.0, color: '#000000' },\n { position: 1.0, color: '#ffffff' },\n];\n\n/**\n * Bone colormap.\n */\nexport const bone: ColorStop[] = [\n { position: 0.0, color: '#000000' },\n { position: 0.375, color: '#545474' },\n { position: 0.75, color: '#a9c8c8' },\n { position: 1.0, color: '#ffffff' },\n];\n","import type { ColorStop, ColormapName } from '../core/types';\nimport { viridis, plasma, inferno, magma, cividis } from './sequential';\nimport { coolwarm, bwr, seismic, RdBu, RdYlBu, RdYlGn, spectral } from './diverging';\nimport { jet, rainbow, turbo, terrain, ocean, hot, cool, gray, bone } from './misc';\n\n/**\n * Map of all built-in colormaps.\n */\nexport const COLORMAPS: Record<ColormapName, ColorStop[]> = {\n // Sequential\n viridis,\n plasma,\n inferno,\n magma,\n cividis,\n // Diverging\n coolwarm,\n bwr,\n seismic,\n RdBu,\n RdYlBu,\n RdYlGn,\n spectral,\n // Miscellaneous\n jet,\n rainbow,\n turbo,\n terrain,\n ocean,\n hot,\n cool,\n gray,\n bone,\n};\n\n/**\n * Gets a colormap by name.\n *\n * @param name - The colormap name.\n * @returns Array of color stops.\n */\nexport function getColormap(name: ColormapName): ColorStop[] {\n return COLORMAPS[name] || COLORMAPS.viridis;\n}\n\n/**\n * Checks if a colormap name is valid.\n *\n * @param name - The name to check.\n * @returns True if the name is a valid colormap.\n */\nexport function isValidColormap(name: string): name is ColormapName {\n return name in COLORMAPS;\n}\n\n/**\n * Gets all available colormap names.\n *\n * @returns Array of colormap names.\n */\nexport function getColormapNames(): ColormapName[] {\n return Object.keys(COLORMAPS) as ColormapName[];\n}\n\n// Re-export individual colormaps\nexport { viridis, plasma, inferno, magma, cividis };\nexport { coolwarm, bwr, seismic, RdBu, RdYlBu, RdYlGn, spectral };\nexport { jet, rainbow, turbo, terrain, ocean, hot, cool, gray, bone };\n","/**\n * Clamps a value between min and max.\n *\n * @param value - The value to clamp.\n * @param min - The minimum value.\n * @param max - The maximum value.\n * @returns The clamped value.\n */\nexport function clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max);\n}\n\n/**\n * Formats a numeric value based on the range.\n *\n * @param value - The value to format.\n * @param range - The total range (max - min).\n * @returns Formatted string.\n */\nexport function formatNumericValue(value: number, range: number): string {\n if (range >= 100) {\n return Math.round(value).toString();\n } else if (range >= 1) {\n return value.toFixed(1);\n } else if (range >= 0.1) {\n return value.toFixed(2);\n } else {\n return value.toFixed(3);\n }\n}\n\n/**\n * Generates a unique ID with optional prefix.\n *\n * @param prefix - Optional prefix for the ID.\n * @returns A unique ID string.\n */\nexport function generateId(prefix = 'mlgl'): string {\n return `${prefix}-${Math.random().toString(36).substring(2, 9)}`;\n}\n\n/**\n * Debounces a function call.\n *\n * @param fn - The function to debounce.\n * @param delay - The delay in milliseconds.\n * @returns A debounced function.\n */\nexport function debounce<T extends (...args: unknown[]) => void>(\n fn: T,\n delay: number\n): (...args: Parameters<T>) => void {\n let timeoutId: ReturnType<typeof setTimeout>;\n return (...args: Parameters<T>) => {\n clearTimeout(timeoutId);\n timeoutId = setTimeout(() => fn(...args), delay);\n };\n}\n\n/**\n * Throttles a function call.\n *\n * @param fn - The function to throttle.\n * @param limit - The minimum time between calls in milliseconds.\n * @returns A throttled function.\n */\nexport function throttle<T extends (...args: unknown[]) => void>(\n fn: T,\n limit: number\n): (...args: Parameters<T>) => void {\n let inThrottle = false;\n return (...args: Parameters<T>) => {\n if (!inThrottle) {\n fn(...args);\n inThrottle = true;\n setTimeout(() => (inThrottle = false), limit);\n }\n };\n}\n\n/**\n * Joins class names, filtering out falsy values.\n *\n * @param classes - Class names to join.\n * @returns Joined class string.\n */\nexport function classNames(...classes: (string | undefined | null | false)[]): string {\n return classes.filter(Boolean).join(' ');\n}\n","import type { IControl, Map as MapLibreMap } from 'maplibre-gl';\nimport type {\n ColorbarOptions,\n ColorbarState,\n ComponentEvent,\n ComponentEventHandler,\n ColorStop,\n} from './types';\nimport { getColormap, isValidColormap } from '../colormaps';\nimport { formatNumericValue } from '../utils';\n\n/**\n * Default options for the Colorbar control.\n */\nconst DEFAULT_OPTIONS: Required<Omit<ColorbarOptions, 'colorStops'>> & { colorStops: ColorStop[] } = {\n colormap: 'viridis',\n colorStops: [],\n vmin: 0,\n vmax: 1,\n label: '',\n units: '',\n orientation: 'vertical',\n position: 'bottom-right',\n barThickness: 20,\n barLength: 200,\n ticks: { count: 5 },\n className: '',\n visible: true,\n opacity: 1,\n backgroundColor: 'rgba(255, 255, 255, 0.9)',\n fontSize: 11,\n fontColor: '#333',\n borderRadius: 4,\n padding: 8,\n};\n\n/**\n * A continuous gradient colorbar control for MapLibre GL maps.\n *\n * Displays a color gradient legend with customizable colormaps,\n * tick marks, labels, and positioning.\n *\n * @example\n * ```typescript\n * const colorbar = new Colorbar({\n * colormap: 'viridis',\n * vmin: 0,\n * vmax: 100,\n * label: 'Temperature',\n * units: '°C',\n * orientation: 'vertical',\n * });\n * map.addControl(colorbar, 'bottom-right');\n * ```\n */\nexport class Colorbar implements IControl {\n private _container?: HTMLElement;\n private _options: Required<Omit<ColorbarOptions, 'colorStops'>> & { colorStops: ColorStop[] };\n private _state: ColorbarState;\n private _eventHandlers: Map<ComponentEvent, Set<ComponentEventHandler<ColorbarState>>> =\n new Map();\n\n /**\n * Creates a new Colorbar instance.\n *\n * @param options - Configuration options for the colorbar.\n */\n constructor(options?: ColorbarOptions) {\n this._options = { ...DEFAULT_OPTIONS, ...options };\n this._state = {\n visible: this._options.visible,\n vmin: this._options.vmin,\n vmax: this._options.vmax,\n colormap: this._options.colormap,\n };\n }\n\n /**\n * Called when the control is added to the map.\n * Implements the IControl interface.\n *\n * @param map - The MapLibre GL map instance.\n * @returns The control's container element.\n */\n onAdd(_map: MapLibreMap): HTMLElement {\n this._container = this._createContainer();\n this._render();\n return this._container;\n }\n\n /**\n * Called when the control is removed from the map.\n * Implements the IControl interface.\n */\n onRemove(): void {\n this._container?.parentNode?.removeChild(this._container);\n this._container = undefined;\n this._eventHandlers.clear();\n }\n\n /**\n * Shows the colorbar.\n */\n show(): void {\n if (!this._state.visible) {\n this._state.visible = true;\n if (this._container) {\n this._container.style.display = 'flex';\n }\n this._emit('show');\n }\n }\n\n /**\n * Hides the colorbar.\n */\n hide(): void {\n if (this._state.visible) {\n this._state.visible = false;\n if (this._container) {\n this._container.style.display = 'none';\n }\n this._emit('hide');\n }\n }\n\n /**\n * Updates the colorbar options and re-renders.\n *\n * @param options - Partial options to update.\n */\n update(options: Partial<ColorbarOptions>): void {\n this._options = { ...this._options, ...options };\n if (options.vmin !== undefined) this._state.vmin = options.vmin;\n if (options.vmax !== undefined) this._state.vmax = options.vmax;\n if (options.colormap !== undefined) this._state.colormap = options.colormap;\n if (options.visible !== undefined) this._state.visible = options.visible;\n this._render();\n this._emit('update');\n }\n\n /**\n * Gets the current state.\n *\n * @returns The current colorbar state.\n */\n getState(): ColorbarState {\n return { ...this._state };\n }\n\n /**\n * Registers an event handler.\n *\n * @param event - The event type to listen for.\n * @param handler - The callback function.\n */\n on(event: ComponentEvent, handler: ComponentEventHandler<ColorbarState>): void {\n if (!this._eventHandlers.has(event)) {\n this._eventHandlers.set(event, new Set());\n }\n this._eventHandlers.get(event)!.add(handler);\n }\n\n /**\n * Removes an event handler.\n *\n * @param event - The event type.\n * @param handler - The callback function to remove.\n */\n off(event: ComponentEvent, handler: ComponentEventHandler<ColorbarState>): void {\n this._eventHandlers.get(event)?.delete(handler);\n }\n\n /**\n * Gets the resolved color stops for the current colormap.\n *\n * @returns Array of color stops.\n */\n private _getColorStops(): ColorStop[] {\n // Custom color stops take priority\n if (this._options.colorStops && this._options.colorStops.length > 0) {\n return this._options.colorStops;\n }\n\n const colormap = this._options.colormap;\n\n // If colormap is a string array, convert to color stops\n if (Array.isArray(colormap)) {\n return colormap.map((color, i) => ({\n position: i / (colormap.length - 1),\n color,\n }));\n }\n\n // If colormap is a name, get the built-in colormap\n if (typeof colormap === 'string' && isValidColormap(colormap)) {\n return getColormap(colormap);\n }\n\n // Default to viridis\n return getColormap('viridis');\n }\n\n /**\n * Generates the CSS gradient string.\n *\n * @returns CSS linear-gradient string.\n */\n private _generateGradient(): string {\n const stops = this._getColorStops();\n const direction = this._options.orientation === 'horizontal' ? 'to right' : 'to top';\n const colorStops = stops.map((stop) => `${stop.color} ${stop.position * 100}%`).join(', ');\n return `linear-gradient(${direction}, ${colorStops})`;\n }\n\n /**\n * Generates tick values.\n *\n * @returns Array of tick values.\n */\n private _generateTicks(): number[] {\n const { ticks, vmin, vmax } = this._options;\n\n if (ticks.values && ticks.values.length > 0) {\n return ticks.values;\n }\n\n const count = ticks.count || 5;\n const step = (vmax - vmin) / (count - 1);\n return Array.from({ length: count }, (_, i) => vmin + i * step);\n }\n\n /**\n * Formats a tick value for display.\n *\n * @param value - The tick value.\n * @returns Formatted string.\n */\n private _formatTick(value: number): string {\n const { ticks, units } = this._options;\n\n if (ticks.format) {\n return ticks.format(value);\n }\n\n // Auto-format based on range\n const range = this._options.vmax - this._options.vmin;\n const formatted = formatNumericValue(value, range);\n\n return units ? `${formatted}${units}` : formatted;\n }\n\n /**\n * Emits an event to all registered handlers.\n *\n * @param event - The event type to emit.\n */\n private _emit(event: ComponentEvent): void {\n const handlers = this._eventHandlers.get(event);\n if (handlers) {\n const eventData = { type: event, state: this.getState() };\n handlers.forEach((handler) => handler(eventData));\n }\n }\n\n /**\n * Creates the main container element.\n *\n * @returns The container element.\n */\n private _createContainer(): HTMLElement {\n const container = document.createElement('div');\n container.className = `maplibregl-ctrl maplibre-gl-colorbar${\n this._options.className ? ` ${this._options.className}` : ''\n }`;\n\n if (!this._state.visible) {\n container.style.display = 'none';\n }\n\n return container;\n }\n\n /**\n * Renders the colorbar content.\n */\n private _render(): void {\n if (!this._container) return;\n\n const {\n orientation,\n barThickness,\n barLength,\n label,\n backgroundColor,\n opacity,\n fontSize,\n fontColor,\n borderRadius,\n padding,\n } = this._options;\n const isVertical = orientation === 'vertical';\n const ticks = this._generateTicks();\n\n // Clear existing content\n this._container.innerHTML = '';\n\n // Apply container styles\n Object.assign(this._container.style, {\n backgroundColor,\n opacity: opacity.toString(),\n borderRadius: `${borderRadius}px`,\n padding: `${padding}px`,\n fontSize: `${fontSize}px`,\n color: fontColor,\n display: this._state.visible ? 'flex' : 'none',\n flexDirection: isVertical ? 'row' : 'column',\n alignItems: 'stretch',\n gap: '6px',\n boxShadow: '0 0 0 2px rgba(0, 0, 0, 0.1)',\n fontFamily: '-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif',\n });\n\n // Add label if provided\n if (label) {\n const labelEl = document.createElement('div');\n labelEl.className = 'maplibre-gl-colorbar-label';\n labelEl.textContent = label;\n Object.assign(labelEl.style, {\n fontWeight: '600',\n textAlign: 'center',\n marginBottom: isVertical ? '0' : '4px',\n writingMode: isVertical ? 'vertical-rl' : 'horizontal-tb',\n transform: isVertical ? 'rotate(180deg)' : 'none',\n });\n this._container.appendChild(labelEl);\n }\n\n // Create gradient bar with ticks\n const barWrapper = document.createElement('div');\n barWrapper.className = 'maplibre-gl-colorbar-bar-wrapper';\n Object.assign(barWrapper.style, {\n display: 'flex',\n flexDirection: isVertical ? 'row' : 'column',\n alignItems: 'stretch',\n });\n\n // Gradient bar\n const bar = document.createElement('div');\n bar.className = 'maplibre-gl-colorbar-bar';\n Object.assign(bar.style, {\n background: this._generateGradient(),\n width: isVertical ? `${barThickness}px` : `${barLength}px`,\n height: isVertical ? `${barLength}px` : `${barThickness}px`,\n borderRadius: '2px',\n border: '1px solid rgba(0, 0, 0, 0.2)',\n });\n\n // Ticks container\n const ticksContainer = document.createElement('div');\n ticksContainer.className = 'maplibre-gl-colorbar-ticks';\n Object.assign(ticksContainer.style, {\n display: 'flex',\n flexDirection: isVertical ? 'column-reverse' : 'row',\n justifyContent: 'space-between',\n width: isVertical ? 'auto' : `${barLength}px`,\n height: isVertical ? `${barLength}px` : 'auto',\n marginLeft: isVertical ? '4px' : '0',\n marginTop: isVertical ? '0' : '4px',\n });\n\n ticks.forEach((value) => {\n const tick = document.createElement('span');\n tick.className = 'maplibre-gl-colorbar-tick';\n tick.textContent = this._formatTick(value);\n tick.style.fontSize = `${fontSize - 1}px`;\n ticksContainer.appendChild(tick);\n });\n\n barWrapper.appendChild(bar);\n barWrapper.appendChild(ticksContainer);\n this._container.appendChild(barWrapper);\n }\n}\n","import type { IControl, Map as MapLibreMap } from 'maplibre-gl';\nimport type {\n LegendOptions,\n LegendState,\n LegendItem,\n ComponentEvent,\n ComponentEventHandler,\n} from './types';\n\n/**\n * Default options for the Legend control.\n */\nconst DEFAULT_OPTIONS: Required<LegendOptions> = {\n title: '',\n items: [],\n position: 'bottom-left',\n className: '',\n visible: true,\n collapsible: false,\n collapsed: false,\n width: 200,\n maxHeight: 300,\n opacity: 1,\n backgroundColor: 'rgba(255, 255, 255, 0.9)',\n fontSize: 12,\n fontColor: '#333',\n swatchSize: 16,\n borderRadius: 4,\n padding: 10,\n};\n\n/**\n * A categorical legend control for MapLibre GL maps.\n *\n * Displays discrete legend items with color swatches and labels.\n *\n * @example\n * ```typescript\n * const legend = new Legend({\n * title: 'Land Use',\n * items: [\n * { label: 'Residential', color: '#ff6b6b' },\n * { label: 'Commercial', color: '#4ecdc4' },\n * { label: 'Industrial', color: '#95a5a6' },\n * ],\n * });\n * map.addControl(legend, 'bottom-left');\n * ```\n */\nexport class Legend implements IControl {\n private _container?: HTMLElement;\n private _options: Required<LegendOptions>;\n private _state: LegendState;\n private _eventHandlers: Map<ComponentEvent, Set<ComponentEventHandler<LegendState>>> = new Map();\n\n /**\n * Creates a new Legend instance.\n *\n * @param options - Configuration options for the legend.\n */\n constructor(options?: LegendOptions) {\n this._options = { ...DEFAULT_OPTIONS, ...options };\n this._state = {\n visible: this._options.visible,\n collapsed: this._options.collapsed,\n items: [...this._options.items],\n };\n }\n\n /**\n * Called when the control is added to the map.\n *\n * @param map - The MapLibre GL map instance.\n * @returns The control's container element.\n */\n onAdd(_map: MapLibreMap): HTMLElement {\n this._container = this._createContainer();\n this._render();\n return this._container;\n }\n\n /**\n * Called when the control is removed from the map.\n */\n onRemove(): void {\n this._container?.parentNode?.removeChild(this._container);\n this._container = undefined;\n this._eventHandlers.clear();\n }\n\n /**\n * Shows the legend.\n */\n show(): void {\n if (!this._state.visible) {\n this._state.visible = true;\n if (this._container) {\n this._container.style.display = 'block';\n }\n this._emit('show');\n }\n }\n\n /**\n * Hides the legend.\n */\n hide(): void {\n if (this._state.visible) {\n this._state.visible = false;\n if (this._container) {\n this._container.style.display = 'none';\n }\n this._emit('hide');\n }\n }\n\n /**\n * Expands the legend (if collapsible).\n */\n expand(): void {\n if (this._state.collapsed) {\n this._state.collapsed = false;\n this._render();\n this._emit('expand');\n }\n }\n\n /**\n * Collapses the legend (if collapsible).\n */\n collapse(): void {\n if (!this._state.collapsed) {\n this._state.collapsed = true;\n this._render();\n this._emit('collapse');\n }\n }\n\n /**\n * Toggles the collapsed state.\n */\n toggle(): void {\n if (this._state.collapsed) {\n this.expand();\n } else {\n this.collapse();\n }\n }\n\n /**\n * Updates the legend items.\n *\n * @param items - New legend items.\n */\n setItems(items: LegendItem[]): void {\n this._state.items = [...items];\n this._options.items = [...items];\n this._render();\n this._emit('update');\n }\n\n /**\n * Adds a legend item.\n *\n * @param item - Legend item to add.\n */\n addItem(item: LegendItem): void {\n this._state.items.push(item);\n this._options.items.push(item);\n this._render();\n this._emit('update');\n }\n\n /**\n * Removes a legend item by label.\n *\n * @param label - Label of the item to remove.\n */\n removeItem(label: string): void {\n this._state.items = this._state.items.filter((item) => item.label !== label);\n this._options.items = [...this._state.items];\n this._render();\n this._emit('update');\n }\n\n /**\n * Updates legend options and re-renders.\n *\n * @param options - Partial options to update.\n */\n update(options: Partial<LegendOptions>): void {\n this._options = { ...this._options, ...options };\n if (options.items) this._state.items = [...options.items];\n if (options.visible !== undefined) this._state.visible = options.visible;\n if (options.collapsed !== undefined) this._state.collapsed = options.collapsed;\n this._render();\n this._emit('update');\n }\n\n /**\n * Gets the current state.\n *\n * @returns The current legend state.\n */\n getState(): LegendState {\n return { ...this._state, items: [...this._state.items] };\n }\n\n /**\n * Registers an event handler.\n *\n * @param event - The event type to listen for.\n * @param handler - The callback function.\n */\n on(event: ComponentEvent, handler: ComponentEventHandler<LegendState>): void {\n if (!this._eventHandlers.has(event)) {\n this._eventHandlers.set(event, new Set());\n }\n this._eventHandlers.get(event)!.add(handler);\n }\n\n /**\n * Removes an event handler.\n *\n * @param event - The event type.\n * @param handler - The callback function to remove.\n */\n off(event: ComponentEvent, handler: ComponentEventHandler<LegendState>): void {\n this._eventHandlers.get(event)?.delete(handler);\n }\n\n /**\n * Emits an event to all registered handlers.\n *\n * @param event - The event type to emit.\n */\n private _emit(event: ComponentEvent): void {\n const handlers = this._eventHandlers.get(event);\n if (handlers) {\n const eventData = { type: event, state: this.getState() };\n handlers.forEach((handler) => handler(eventData));\n }\n }\n\n /**\n * Creates the main container element.\n *\n * @returns The container element.\n */\n private _createContainer(): HTMLElement {\n const container = document.createElement('div');\n container.className = `maplibregl-ctrl maplibre-gl-legend${\n this._options.className ? ` ${this._options.className}` : ''\n }`;\n\n if (!this._state.visible) {\n container.style.display = 'none';\n }\n\n return container;\n }\n\n /**\n * Creates a color swatch element.\n *\n * @param item - Legend item configuration.\n * @returns The swatch element.\n */\n private _createSwatch(item: LegendItem): HTMLElement {\n const { swatchSize = 16 } = this._options;\n const shape = item.shape || 'square';\n const swatch = document.createElement('span');\n swatch.className = `maplibre-gl-legend-swatch maplibre-gl-legend-swatch-${shape}`;\n\n // Base styles\n const baseStyles: Record<string, string> = {\n flexShrink: '0',\n display: 'inline-block',\n };\n\n if (shape === 'line') {\n // Line shape: horizontal line with rounded ends\n Object.assign(swatch.style, {\n ...baseStyles,\n width: `${swatchSize}px`,\n height: '4px',\n backgroundColor: item.color,\n borderRadius: '2px',\n border: 'none',\n alignSelf: 'center',\n });\n } else if (shape === 'circle') {\n // Circle shape\n Object.assign(swatch.style, {\n ...baseStyles,\n width: `${swatchSize}px`,\n height: `${swatchSize}px`,\n backgroundColor: item.color,\n borderRadius: '50%',\n border: item.strokeColor ? `2px solid ${item.strokeColor}` : '1px solid rgba(0,0,0,0.1)',\n });\n } else {\n // Square shape (default)\n Object.assign(swatch.style, {\n ...baseStyles,\n width: `${swatchSize}px`,\n height: `${swatchSize}px`,\n backgroundColor: item.color,\n borderRadius: '2px',\n border: item.strokeColor ? `2px solid ${item.strokeColor}` : '1px solid rgba(0,0,0,0.1)',\n });\n }\n\n // If icon is provided, use background image\n if (item.icon) {\n Object.assign(swatch.style, {\n backgroundImage: `url(${item.icon})`,\n backgroundSize: 'contain',\n backgroundRepeat: 'no-repeat',\n backgroundPosition: 'center',\n backgroundColor: 'transparent',\n border: 'none',\n width: `${swatchSize}px`,\n height: `${swatchSize}px`,\n });\n }\n\n return swatch;\n }\n\n /**\n * Renders the legend content.\n */\n private _render(): void {\n if (!this._container) return;\n\n const {\n title,\n backgroundColor,\n opacity,\n fontSize,\n fontColor,\n borderRadius,\n padding,\n width,\n maxHeight,\n collapsible,\n } = this._options;\n\n // Clear existing content\n this._container.innerHTML = '';\n\n // Apply container styles\n // When collapsed with header, use minimal vertical padding to match HtmlControl\n const isCollapsedWithHeader = this._state.collapsed && (title || collapsible);\n const vertPadding = isCollapsedWithHeader ? 4 : padding;\n Object.assign(this._container.style, {\n backgroundColor,\n opacity: opacity.toString(),\n borderRadius: `${borderRadius}px`,\n padding: `${vertPadding}px ${padding}px`,\n fontSize: `${fontSize}px`,\n color: fontColor,\n width: isCollapsedWithHeader ? 'auto' : `${width}px`,\n maxWidth: `${width}px`,\n boxShadow: '0 0 0 2px rgba(0, 0, 0, 0.1)',\n display: this._state.visible ? 'block' : 'none',\n fontFamily: '-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif',\n });\n\n // Add title/header\n if (title || collapsible) {\n const header = document.createElement('div');\n header.className = 'maplibre-gl-legend-header';\n Object.assign(header.style, {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n paddingBottom: this._state.collapsed ? '0' : '4px',\n cursor: collapsible ? 'pointer' : 'default',\n });\n\n if (title) {\n const titleEl = document.createElement('span');\n titleEl.className = 'maplibre-gl-legend-title';\n titleEl.textContent = title;\n titleEl.style.fontWeight = '600';\n header.appendChild(titleEl);\n }\n\n if (collapsible) {\n const toggleBtn = document.createElement('span');\n toggleBtn.className = 'maplibre-gl-legend-toggle';\n toggleBtn.innerHTML = this._state.collapsed ? '&#9654;' : '&#9660;';\n toggleBtn.style.marginLeft = '8px';\n header.appendChild(toggleBtn);\n header.addEventListener('click', () => this.toggle());\n }\n\n this._container.appendChild(header);\n }\n\n // Content area\n const content = document.createElement('div');\n content.className = 'maplibre-gl-legend-content';\n Object.assign(content.style, {\n maxHeight: `${maxHeight}px`,\n overflowY: 'auto',\n display: this._state.collapsed ? 'none' : 'block',\n });\n\n // Render legend items\n this._state.items.forEach((item) => {\n const row = document.createElement('div');\n row.className = 'maplibre-gl-legend-item';\n Object.assign(row.style, {\n display: 'flex',\n alignItems: 'center',\n gap: '8px',\n padding: '4px 0',\n });\n\n const swatch = this._createSwatch(item);\n const label = document.createElement('span');\n label.className = 'maplibre-gl-legend-label';\n label.textContent = item.label;\n\n row.appendChild(swatch);\n row.appendChild(label);\n content.appendChild(row);\n });\n\n this._container.appendChild(content);\n }\n}\n","import type { IControl, Map as MapLibreMap } from 'maplibre-gl';\nimport type {\n HtmlControlOptions,\n HtmlControlState,\n ComponentEvent,\n ComponentEventHandler,\n} from './types';\n\n/**\n * Default options for the HtmlControl.\n */\nconst DEFAULT_OPTIONS: Required<Omit<HtmlControlOptions, 'element'>> & { element?: HTMLElement } = {\n html: '',\n element: undefined,\n title: '',\n position: 'top-left',\n className: '',\n visible: true,\n collapsible: false,\n collapsed: false,\n backgroundColor: 'rgba(255, 255, 255, 0.9)',\n padding: 10,\n borderRadius: 4,\n opacity: 1,\n maxWidth: 300,\n maxHeight: 400,\n fontSize: 12,\n fontColor: '#333',\n};\n\n/**\n * A flexible HTML content control for MapLibre GL maps.\n *\n * Allows displaying arbitrary HTML content that can be dynamically updated.\n * Supports collapsible mode with a toggle button.\n *\n * @example\n * ```typescript\n * const htmlControl = new HtmlControl({\n * html: '<div><strong>Stats:</strong> 1,234 features</div>',\n * position: 'top-left',\n * collapsible: true,\n * title: 'Statistics',\n * });\n * map.addControl(htmlControl, 'top-left');\n *\n * // Update content dynamically\n * htmlControl.setHtml('<div><strong>Stats:</strong> 5,678 features</div>');\n * ```\n */\nexport class HtmlControl implements IControl {\n private _container?: HTMLElement;\n private _contentEl?: HTMLElement;\n private _options: Required<Omit<HtmlControlOptions, 'element'>> & { element?: HTMLElement };\n private _state: HtmlControlState;\n private _eventHandlers: Map<ComponentEvent, Set<ComponentEventHandler<HtmlControlState>>> =\n new Map();\n\n /**\n * Creates a new HtmlControl instance.\n *\n * @param options - Configuration options for the control.\n */\n constructor(options?: HtmlControlOptions) {\n this._options = { ...DEFAULT_OPTIONS, ...options };\n this._state = {\n visible: this._options.visible,\n collapsed: this._options.collapsed,\n html: this._options.html,\n };\n }\n\n /**\n * Called when the control is added to the map.\n * Implements the IControl interface.\n *\n * @param map - The MapLibre GL map instance.\n * @returns The control's container element.\n */\n onAdd(_map: MapLibreMap): HTMLElement {\n this._container = this._createContainer();\n this._render();\n return this._container;\n }\n\n /**\n * Called when the control is removed from the map.\n * Implements the IControl interface.\n */\n onRemove(): void {\n this._container?.parentNode?.removeChild(this._container);\n this._container = undefined;\n this._contentEl = undefined;\n this._eventHandlers.clear();\n }\n\n /**\n * Shows the control.\n */\n show(): void {\n if (!this._state.visible) {\n this._state.visible = true;\n if (this._container) {\n this._container.style.display = 'block';\n }\n this._emit('show');\n }\n }\n\n /**\n * Hides the control.\n */\n hide(): void {\n if (this._state.visible) {\n this._state.visible = false;\n if (this._container) {\n this._container.style.display = 'none';\n }\n this._emit('hide');\n }\n }\n\n /**\n * Expands the control (if collapsible).\n */\n expand(): void {\n if (this._state.collapsed) {\n this._state.collapsed = false;\n this._render();\n this._emit('expand');\n }\n }\n\n /**\n * Collapses the control (if collapsible).\n */\n collapse(): void {\n if (!this._state.collapsed) {\n this._state.collapsed = true;\n this._render();\n this._emit('collapse');\n }\n }\n\n /**\n * Toggles the collapsed state.\n */\n toggle(): void {\n if (this._state.collapsed) {\n this.expand();\n } else {\n this.collapse();\n }\n }\n\n /**\n * Sets the HTML content.\n *\n * @param html - The HTML string to display.\n */\n setHtml(html: string): void {\n this._state.html = html;\n this._options.html = html;\n this._options.element = undefined; // Clear element when setting HTML\n if (this._contentEl) {\n this._contentEl.innerHTML = html;\n }\n this._emit('update');\n }\n\n /**\n * Sets a DOM element as content.\n *\n * @param element - The DOM element to display.\n */\n setElement(element: HTMLElement): void {\n this._options.element = element;\n this._options.html = '';\n this._state.html = '';\n if (this._contentEl) {\n this._contentEl.innerHTML = '';\n this._contentEl.appendChild(element);\n }\n this._emit('update');\n }\n\n /**\n * Gets the content container element.\n *\n * @returns The content container element, or undefined if not yet added to map.\n */\n getElement(): HTMLElement | undefined {\n return this._contentEl;\n }\n\n /**\n * Updates control options and re-renders.\n *\n * @param options - Partial options to update.\n */\n update(options: Partial<HtmlControlOptions>): void {\n this._options = { ...this._options, ...options };\n if (options.html !== undefined) this._state.html = options.html;\n if (options.visible !== undefined) this._state.visible = options.visible;\n if (options.collapsed !== undefined) this._state.collapsed = options.collapsed;\n this._render();\n this._emit('update');\n }\n\n /**\n * Gets the current state.\n *\n * @returns The current control state.\n */\n getState(): HtmlControlState {\n return { ...this._state };\n }\n\n /**\n * Registers an event handler.\n *\n * @param event - The event type to listen for.\n * @param handler - The callback function.\n */\n on(event: ComponentEvent, handler: ComponentEventHandler<HtmlControlState>): void {\n if (!this._eventHandlers.has(event)) {\n this._eventHandlers.set(event, new Set());\n }\n this._eventHandlers.get(event)!.add(handler);\n }\n\n /**\n * Removes an event handler.\n *\n * @param event - The event type.\n * @param handler - The callback function to remove.\n */\n off(event: ComponentEvent, handler: ComponentEventHandler<HtmlControlState>): void {\n this._eventHandlers.get(event)?.delete(handler);\n }\n\n /**\n * Emits an event to all registered handlers.\n *\n * @param event - The event type to emit.\n */\n private _emit(event: ComponentEvent): void {\n const handlers = this._eventHandlers.get(event);\n if (handlers) {\n const eventData = { type: event, state: this.getState() };\n handlers.forEach((handler) => handler(eventData));\n }\n }\n\n /**\n * Creates the main container element.\n *\n * @returns The container element.\n */\n private _createContainer(): HTMLElement {\n const container = document.createElement('div');\n container.className = `maplibregl-ctrl maplibre-gl-html-control${\n this._options.className ? ` ${this._options.className}` : ''\n }`;\n\n if (!this._state.visible) {\n container.style.display = 'none';\n }\n\n return container;\n }\n\n /**\n * Renders the control content.\n */\n private _render(): void {\n if (!this._container) return;\n\n const {\n title = '',\n collapsible = false,\n backgroundColor = 'rgba(255, 255, 255, 0.9)',\n opacity = 1,\n borderRadius = 4,\n padding = 10,\n maxWidth = 300,\n maxHeight = 400,\n fontSize = 12,\n fontColor = '#333',\n } = this._options;\n\n // Clear existing content\n this._container.innerHTML = '';\n\n // Apply container styles\n // When collapsed with header, use minimal vertical padding\n const isCollapsedWithHeader = this._state.collapsed && (title || collapsible);\n const vertPadding = isCollapsedWithHeader ? 4 : padding;\n Object.assign(this._container.style, {\n backgroundColor,\n opacity: String(opacity),\n borderRadius: `${borderRadius}px`,\n padding: `${vertPadding}px ${padding}px`,\n maxWidth: `${maxWidth}px`,\n fontSize: `${fontSize}px`,\n color: fontColor,\n boxShadow: '0 0 0 2px rgba(0, 0, 0, 0.1)',\n display: this._state.visible ? 'block' : 'none',\n fontFamily: '-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif',\n });\n\n // Add header with toggle if collapsible\n if (collapsible || title) {\n const header = document.createElement('div');\n header.className = 'maplibre-gl-html-control-header';\n Object.assign(header.style, {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n paddingBottom: this._state.collapsed ? '0' : '8px',\n cursor: collapsible ? 'pointer' : 'default',\n });\n\n if (title) {\n const titleEl = document.createElement('span');\n titleEl.className = 'maplibre-gl-html-control-title';\n titleEl.textContent = title;\n titleEl.style.fontWeight = '600';\n header.appendChild(titleEl);\n }\n\n if (collapsible) {\n const toggleBtn = document.createElement('span');\n toggleBtn.className = 'maplibre-gl-html-control-toggle';\n toggleBtn.innerHTML = this._state.collapsed ? '&#9654;' : '&#9660;';\n Object.assign(toggleBtn.style, {\n marginLeft: '8px',\n fontSize: '10px',\n userSelect: 'none',\n });\n header.appendChild(toggleBtn);\n header.addEventListener('click', () => this.toggle());\n }\n\n this._container.appendChild(header);\n }\n\n // Create content element\n const content = document.createElement('div');\n content.className = 'maplibre-gl-html-control-content';\n Object.assign(content.style, {\n maxHeight: `${maxHeight}px`,\n overflowY: 'auto',\n display: this._state.collapsed ? 'none' : 'block',\n });\n this._contentEl = content;\n\n // Set content\n if (this._options.element) {\n content.appendChild(this._options.element);\n } else if (this._options.html) {\n content.innerHTML = this._options.html;\n }\n\n this._container.appendChild(content);\n }\n}\n"],"names":["DEFAULT_OPTIONS"],"mappings":";;;AAKO,MAAM,UAAuB;AAAA,EAClC,EAAE,UAAU,GAAK,OAAO,UAAA;AAAA,EACxB,EAAE,UAAU,KAAK,OAAO,UAAA;AAAA,EACxB,EAAE,UAAU,KAAK,OAAO,UAAA;AAAA,EACxB,EAAE,UAAU,KAAK,OAAO,UAAA;AAAA,EACxB,EAAE,UAAU,KAAK,OAAO,UAAA;AAAA,EACxB,EAAE,UAAU,KAAK,OAAO,UAAA;AAAA,EACxB,EAAE,UAAU,KAAK,OAAO,UAAA;AAAA,EACxB,EAAE,UAAU,KAAK,OAAO,UAAA;AAAA,EACxB,EAAE,UAAU,KAAK,OAAO,UAAA;AAAA,EACxB,EAAE,UAAU,KAAK,OAAO,UAAA;AAAA,EACxB,EAAE,UAAU,GAAK,OAAO,UAAA;AAC1B;AAKO,MAAM,SAAsB;AAAA,EACjC,EAAE,UAAU,GAAK,OAAO,UAAA;AAAA,EACxB,EAAE,UAAU,KAAK,OAAO,UAAA;AAAA,EACxB,EAAE,UAAU,KAAK,OAAO,UAAA;AAAA,EACxB,EAAE,UAAU,KAAK,OAAO,UAAA;AAAA,EACxB,EAAE,UAAU,KAAK,OAAO,UAAA;AAAA,EACxB,EAAE,UAAU,KAAK,OAAO,UAAA;AAAA,EACxB,EAAE,UAAU,KAAK,OAAO,UAAA;AAAA,EACxB,EAAE,UAAU,KAAK,OAAO,UAAA;AAAA,EACxB,EAAE,UAAU,KAAK,OAAO,UAAA;AAAA,EACxB,EAAE,UAAU,KAAK,OAAO,UAAA;AAAA,EACxB,EAAE,UAAU,GAAK,OAAO,UAAA;AAC1B;AAKO,MAAM,UAAuB;AA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