@octostar/map-component 0.2.14 → 0.2.15

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
@@ -2337,6 +2337,85 @@ function hashStringToColor(str) {
2337
2337
  const light = 45 + (hash >>> 16) % 18;
2338
2338
  return hslToHex(hue, sat, light);
2339
2339
  }
2340
+ const GRADIENT_RAMP = [
2341
+ "#fee5d9",
2342
+ "#fcae91",
2343
+ "#fb6a4a",
2344
+ "#de2d26",
2345
+ "#a50f15"
2346
+ ];
2347
+ const GRADIENT_FALLBACK_COLOR = "#9ca3af";
2348
+ const NUMERIC_FIELD_RATIO_THRESHOLD = 0.8;
2349
+ const NUMERIC_FIELD_COVERAGE_FLOOR = 0.3;
2350
+ function coerceFiniteNumber(raw) {
2351
+ if (typeof raw === "number") return Number.isFinite(raw) ? raw : null;
2352
+ if (typeof raw === "string" && raw.trim() !== "") {
2353
+ const n = Number(raw);
2354
+ return Number.isFinite(n) ? n : null;
2355
+ }
2356
+ return null;
2357
+ }
2358
+ function parseHexColor(hex) {
2359
+ return [
2360
+ parseInt(hex.slice(1, 3), 16),
2361
+ parseInt(hex.slice(3, 5), 16),
2362
+ parseInt(hex.slice(5, 7), 16)
2363
+ ];
2364
+ }
2365
+ function gradientColor(t, ramp = GRADIENT_RAMP) {
2366
+ const clamped = Math.max(0, Math.min(1, Number.isFinite(t) ? t : 0.5));
2367
+ const scaled = clamped * (ramp.length - 1);
2368
+ const i = Math.min(Math.floor(scaled), ramp.length - 2);
2369
+ const frac = scaled - i;
2370
+ const [r1, g1, b1] = parseHexColor(ramp[i]);
2371
+ const [r2, g2, b2] = parseHexColor(ramp[i + 1]);
2372
+ const channel = (a, b) => Math.round(a + (b - a) * frac).toString(16).padStart(2, "0");
2373
+ return `#${channel(r1, r2)}${channel(g1, g2)}${channel(b1, b2)}`;
2374
+ }
2375
+ function defaultColorScaleForField(field) {
2376
+ if (!field) return "categorical";
2377
+ return (field.numericRatio ?? 0) >= NUMERIC_FIELD_RATIO_THRESHOLD && (field.coverage ?? 0) >= NUMERIC_FIELD_COVERAGE_FLOOR ? "gradient" : "categorical";
2378
+ }
2379
+ function computeNumericRange(featureIds, getProperties, fieldName) {
2380
+ var _a;
2381
+ let min = Infinity;
2382
+ let max = -Infinity;
2383
+ for (const id of featureIds) {
2384
+ const v = coerceFiniteNumber((_a = getProperties(id)) == null ? void 0 : _a[fieldName]);
2385
+ if (v === null) continue;
2386
+ if (v < min) min = v;
2387
+ if (v > max) max = v;
2388
+ }
2389
+ return isFinite(min) ? { min, max } : null;
2390
+ }
2391
+ function resolveFeatureColor(colorConfig, properties, fallback, gradientRange) {
2392
+ if (!colorConfig) return fallback;
2393
+ if (colorConfig.mode === "fixed" && colorConfig.fixedColor) return colorConfig.fixedColor;
2394
+ if (colorConfig.mode === "field" && colorConfig.fieldName) {
2395
+ if (colorConfig.scale === "gradient") {
2396
+ const value = coerceFiniteNumber(properties == null ? void 0 : properties[colorConfig.fieldName]);
2397
+ if (value === null || !gradientRange) return GRADIENT_FALLBACK_COLOR;
2398
+ const t = gradientRange.max > gradientRange.min ? (value - gradientRange.min) / (gradientRange.max - gradientRange.min) : 0.5;
2399
+ return gradientColor(t);
2400
+ }
2401
+ if (properties) {
2402
+ const key = categoricalKey(properties[colorConfig.fieldName]);
2403
+ if (key !== null) return hashStringToColor(key);
2404
+ }
2405
+ }
2406
+ return fallback;
2407
+ }
2408
+ function formatGradientStop(value) {
2409
+ if (!Number.isFinite(value)) return "";
2410
+ const abs = Math.abs(value);
2411
+ if (abs >= 1e4) {
2412
+ return new Intl.NumberFormat("en-US", { notation: "compact", maximumFractionDigits: 1 }).format(value);
2413
+ }
2414
+ if (abs > 0 && abs < 1) {
2415
+ return new Intl.NumberFormat("en-US", { maximumSignificantDigits: 3 }).format(value);
2416
+ }
2417
+ return new Intl.NumberFormat("en-US", { maximumFractionDigits: 2 }).format(value);
2418
+ }
2340
2419
  const MAP_STYLES = [
2341
2420
  { id: "streets", name: "Streets", icon: lucideReact.Map },
2342
2421
  { id: "satellite", name: "Satellite", icon: lucideReact.Satellite },
@@ -2425,6 +2504,38 @@ function ColorByFieldLegend({
2425
2504
  }
2426
2505
  );
2427
2506
  }
2507
+ function ColorGradientLegend({
2508
+ layerId,
2509
+ min,
2510
+ max,
2511
+ sampled
2512
+ }) {
2513
+ const degenerate = min === max;
2514
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2515
+ "div",
2516
+ {
2517
+ className: "mt-1 rounded border border-border/50 bg-background/40 p-1.5",
2518
+ "data-testid": `legend-gradient-${layerId}`,
2519
+ children: [
2520
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-[10px] uppercase tracking-wide text-muted-foreground mb-1", children: [
2521
+ "Legend",
2522
+ sampled ? " (sampled)" : ""
2523
+ ] }),
2524
+ /* @__PURE__ */ jsxRuntime.jsx(
2525
+ "div",
2526
+ {
2527
+ className: "h-2.5 rounded-sm border border-black/10",
2528
+ style: { background: degenerate ? gradientColor(0.5) : `linear-gradient(to right, ${GRADIENT_RAMP.join(", ")})` }
2529
+ }
2530
+ ),
2531
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-between text-[11px] text-muted-foreground tabular-nums mt-0.5", children: degenerate ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mx-auto", children: formatGradientStop(min) }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2532
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: formatGradientStop(min) }),
2533
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: formatGradientStop(max) })
2534
+ ] }) })
2535
+ ]
2536
+ }
2537
+ );
2538
+ }
2428
2539
  function LayersPanel({
2429
2540
  layers,
2430
2541
  onAddLayer,
@@ -2563,7 +2674,7 @@ function LayersPanel({
2563
2674
  });
2564
2675
  }, [onRemoveLayer]);
2565
2676
  const renderLayerItem = (layer) => {
2566
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba;
2677
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da;
2567
2678
  const customCount = featureCountProvider == null ? void 0 : featureCountProvider(layer.id);
2568
2679
  const featureCount = customCount != null ? customCount : getFeatureCount(layer.id);
2569
2680
  const isExpanded = expandedLayers.has(layer.id);
@@ -2676,6 +2787,41 @@ function LayersPanel({
2676
2787
  label: "Save GeoJSON to desktop",
2677
2788
  onClick: () => onSaveLayerGeoJSON(layer.id)
2678
2789
  },
2790
+ ...onUpdateVisualConfig ? [
2791
+ { type: "divider" },
2792
+ {
2793
+ key: "never-hide-labels",
2794
+ label: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-1.5 py-1", onClick: (e) => e.stopPropagation(), children: [
2795
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
2796
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
2797
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Type, { className: "w-[18px] h-[18px]" }),
2798
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm", children: "Never hide labels" })
2799
+ ] }),
2800
+ /* @__PURE__ */ jsxRuntime.jsx(
2801
+ antd.Switch,
2802
+ {
2803
+ size: "small",
2804
+ disabled: (_b = (_a = layer.visualConfig) == null ? void 0 : _a.label) == null ? void 0 : _b.hidden,
2805
+ checked: !!((_d = (_c = layer.visualConfig) == null ? void 0 : _c.label) == null ? void 0 : _d.neverHide),
2806
+ onChange: (checked) => {
2807
+ var _a2, _b2, _c2;
2808
+ return onUpdateVisualConfig(layer.id, {
2809
+ ...layer.visualConfig,
2810
+ label: {
2811
+ ...(_a2 = layer.visualConfig) == null ? void 0 : _a2.label,
2812
+ mode: ((_c2 = (_b2 = layer.visualConfig) == null ? void 0 : _b2.label) == null ? void 0 : _c2.mode) ?? "standard",
2813
+ neverHide: checked
2814
+ }
2815
+ });
2816
+ },
2817
+ "data-testid": `switch-never-hide-labels-${layer.id}`
2818
+ }
2819
+ )
2820
+ ] }),
2821
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-muted-foreground mt-1", children: ((_f = (_e = layer.visualConfig) == null ? void 0 : _e.label) == null ? void 0 : _f.hidden) ? "Labels are turned off for this layer" : "Show every label even when the map is crowded" })
2822
+ ] })
2823
+ }
2824
+ ] : [],
2679
2825
  ...onFitToLayerFeatures && (typeof featureCount === "string" ? featureCount.length > 0 : featureCount > 0) ? [
2680
2826
  { type: "divider" },
2681
2827
  {
@@ -2728,14 +2874,14 @@ function LayersPanel({
2728
2874
  ]
2729
2875
  }
2730
2876
  ),
2731
- (hasPointFeatures == null ? void 0 : hasPointFeatures(layer.id)) && !((_a = layer.metadata) == null ? void 0 : _a.hidePointFeatures) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1 p-1.5 bg-muted/30 rounded-md", children: [
2877
+ (hasPointFeatures == null ? void 0 : hasPointFeatures(layer.id)) && !((_g = layer.metadata) == null ? void 0 : _g.hidePointFeatures) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1 p-1.5 bg-muted/30 rounded-md", children: [
2732
2878
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-1.5 text-xs font-medium", children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Point Features" }) }),
2733
2879
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
2734
2880
  /* @__PURE__ */ jsxRuntime.jsx(
2735
2881
  antd.Switch,
2736
2882
  {
2737
2883
  size: "small",
2738
- checked: ((_b = layer.traceConfig) == null ? void 0 : _b.enabled) ?? false,
2884
+ checked: ((_h = layer.traceConfig) == null ? void 0 : _h.enabled) ?? false,
2739
2885
  onChange: (checked) => {
2740
2886
  var _a2;
2741
2887
  return onUpdateTraceConfig(layer.id, {
@@ -2748,7 +2894,7 @@ function LayersPanel({
2748
2894
  ),
2749
2895
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs", children: "Trace Lines" })
2750
2896
  ] }),
2751
- ((_c = layer.traceConfig) == null ? void 0 : _c.enabled) && /* @__PURE__ */ jsxRuntime.jsx(
2897
+ ((_i = layer.traceConfig) == null ? void 0 : _i.enabled) && /* @__PURE__ */ jsxRuntime.jsx(
2752
2898
  antd.Select,
2753
2899
  {
2754
2900
  size: "small",
@@ -2774,7 +2920,7 @@ function LayersPanel({
2774
2920
  antd.Switch,
2775
2921
  {
2776
2922
  size: "small",
2777
- checked: ((_d = layer.heatmapConfig) == null ? void 0 : _d.enabled) ?? false,
2923
+ checked: ((_j = layer.heatmapConfig) == null ? void 0 : _j.enabled) ?? false,
2778
2924
  onChange: (checked) => {
2779
2925
  var _a2, _b2;
2780
2926
  return onUpdateHeatmapConfig(layer.id, {
@@ -2788,7 +2934,7 @@ function LayersPanel({
2788
2934
  ),
2789
2935
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs", children: "Heatmap" })
2790
2936
  ] }),
2791
- ((_e = layer.heatmapConfig) == null ? void 0 : _e.enabled) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1 pl-4", children: [
2937
+ ((_k = layer.heatmapConfig) == null ? void 0 : _k.enabled) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1 pl-4", children: [
2792
2938
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
2793
2939
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] w-12", children: "Intensity" }),
2794
2940
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -2832,10 +2978,11 @@ function LayersPanel({
2832
2978
  antd.Switch,
2833
2979
  {
2834
2980
  size: "small",
2835
- checked: ((_f = layer.clusterConfig) == null ? void 0 : _f.enabled) ?? false,
2981
+ checked: ((_l = layer.clusterConfig) == null ? void 0 : _l.enabled) ?? false,
2836
2982
  onChange: (checked) => {
2837
2983
  var _a2, _b2;
2838
2984
  return onUpdateClusterConfig(layer.id, {
2985
+ ...layer.clusterConfig,
2839
2986
  enabled: checked,
2840
2987
  groupByField: ((_a2 = layer.clusterConfig) == null ? void 0 : _a2.groupByField) ?? null,
2841
2988
  showPointDots: ((_b2 = layer.clusterConfig) == null ? void 0 : _b2.showPointDots) ?? false
@@ -2846,7 +2993,7 @@ function LayersPanel({
2846
2993
  ),
2847
2994
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs", children: "Clustering" })
2848
2995
  ] }),
2849
- ((_g = layer.clusterConfig) == null ? void 0 : _g.enabled) && getLayerFields && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1 pl-4", children: [
2996
+ ((_m = layer.clusterConfig) == null ? void 0 : _m.enabled) && getLayerFields && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1 pl-4", children: [
2850
2997
  /* @__PURE__ */ jsxRuntime.jsx(
2851
2998
  antd.Select,
2852
2999
  {
@@ -2879,6 +3026,53 @@ function LayersPanel({
2879
3026
  }
2880
3027
  ),
2881
3028
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px]", children: "Show point dots" })
3029
+ ] }),
3030
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
3031
+ /* @__PURE__ */ jsxRuntime.jsx(
3032
+ antd.Switch,
3033
+ {
3034
+ size: "small",
3035
+ checked: layer.clusterConfig.countByFieldEnabled ?? false,
3036
+ onChange: (checked) => onUpdateClusterConfig(layer.id, {
3037
+ ...layer.clusterConfig,
3038
+ countByFieldEnabled: checked
3039
+ }),
3040
+ "data-testid": `switch-cluster-count-by-${layer.id}`
3041
+ }
3042
+ ),
3043
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px]", children: "Count by field" })
3044
+ ] }),
3045
+ layer.clusterConfig.countByFieldEnabled && /* @__PURE__ */ jsxRuntime.jsx(
3046
+ antd.Select,
3047
+ {
3048
+ size: "small",
3049
+ value: layer.clusterConfig.countByField ?? void 0,
3050
+ onChange: (val) => onUpdateClusterConfig(layer.id, {
3051
+ ...layer.clusterConfig,
3052
+ countByField: val
3053
+ }),
3054
+ className: "w-full text-xs",
3055
+ placeholder: "Select numeric field...",
3056
+ showSearch: true,
3057
+ optionFilterProp: "label",
3058
+ options: getLayerFields(layer.id).filter((f) => f.isNumeric).map((f) => ({ value: f.name, label: f.name })),
3059
+ "data-testid": `select-cluster-count-field-${layer.id}`
3060
+ }
3061
+ ),
3062
+ !layer.clusterConfig.groupByField && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
3063
+ /* @__PURE__ */ jsxRuntime.jsx(
3064
+ antd.Switch,
3065
+ {
3066
+ size: "small",
3067
+ checked: layer.clusterConfig.bubbleGradient ?? false,
3068
+ onChange: (checked) => onUpdateClusterConfig(layer.id, {
3069
+ ...layer.clusterConfig,
3070
+ bubbleGradient: checked
3071
+ }),
3072
+ "data-testid": `switch-cluster-gradient-${layer.id}`
3073
+ }
3074
+ ),
3075
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px]", children: "Color bubbles by value" })
2882
3076
  ] })
2883
3077
  ] })
2884
3078
  ] })
@@ -2915,7 +3109,7 @@ function LayersPanel({
2915
3109
  antd.Switch,
2916
3110
  {
2917
3111
  size: "small",
2918
- checked: !((_i = (_h = layer.visualConfig) == null ? void 0 : _h.label) == null ? void 0 : _i.hidden),
3112
+ checked: !((_o = (_n = layer.visualConfig) == null ? void 0 : _n.label) == null ? void 0 : _o.hidden),
2919
3113
  onChange: (checked) => {
2920
3114
  var _a2, _b2, _c2;
2921
3115
  return onUpdateVisualConfig(layer.id, {
@@ -2931,8 +3125,8 @@ function LayersPanel({
2931
3125
  antd.Select,
2932
3126
  {
2933
3127
  size: "small",
2934
- disabled: (_k = (_j = layer.visualConfig) == null ? void 0 : _j.label) == null ? void 0 : _k.hidden,
2935
- value: ((_m = (_l = layer.visualConfig) == null ? void 0 : _l.label) == null ? void 0 : _m.mode) ?? "standard",
3128
+ disabled: (_q = (_p = layer.visualConfig) == null ? void 0 : _p.label) == null ? void 0 : _q.hidden,
3129
+ value: ((_s = (_r = layer.visualConfig) == null ? void 0 : _r.label) == null ? void 0 : _s.mode) ?? "standard",
2936
3130
  onChange: (val) => {
2937
3131
  var _a2;
2938
3132
  return onUpdateVisualConfig(layer.id, {
@@ -2949,15 +3143,18 @@ function LayersPanel({
2949
3143
  "data-testid": `select-label-mode-${layer.id}`
2950
3144
  }
2951
3145
  ),
2952
- ((_o = (_n = layer.visualConfig) == null ? void 0 : _n.label) == null ? void 0 : _o.mode) === "field" && /* @__PURE__ */ jsxRuntime.jsx(
3146
+ ((_u = (_t = layer.visualConfig) == null ? void 0 : _t.label) == null ? void 0 : _u.mode) === "field" && /* @__PURE__ */ jsxRuntime.jsx(
2953
3147
  antd.Select,
2954
3148
  {
2955
3149
  size: "small",
2956
- value: ((_q = (_p = layer.visualConfig) == null ? void 0 : _p.label) == null ? void 0 : _q.fieldName) ?? "",
2957
- onChange: (val) => onUpdateVisualConfig(layer.id, {
2958
- ...layer.visualConfig,
2959
- label: { mode: "field", fieldName: val }
2960
- }),
3150
+ value: ((_w = (_v = layer.visualConfig) == null ? void 0 : _v.label) == null ? void 0 : _w.fieldName) ?? "",
3151
+ onChange: (val) => {
3152
+ var _a2;
3153
+ return onUpdateVisualConfig(layer.id, {
3154
+ ...layer.visualConfig,
3155
+ label: { ...(_a2 = layer.visualConfig) == null ? void 0 : _a2.label, mode: "field", fieldName: val }
3156
+ });
3157
+ },
2961
3158
  className: "w-full text-sm",
2962
3159
  placeholder: "Select field...",
2963
3160
  showSearch: true,
@@ -2966,15 +3163,18 @@ function LayersPanel({
2966
3163
  "data-testid": `select-label-field-${layer.id}`
2967
3164
  }
2968
3165
  ),
2969
- ((_s = (_r = layer.visualConfig) == null ? void 0 : _r.label) == null ? void 0 : _s.mode) === "fixed" && /* @__PURE__ */ jsxRuntime.jsx(
3166
+ ((_y = (_x = layer.visualConfig) == null ? void 0 : _x.label) == null ? void 0 : _y.mode) === "fixed" && /* @__PURE__ */ jsxRuntime.jsx(
2970
3167
  antd.Input,
2971
3168
  {
2972
3169
  size: "small",
2973
- value: ((_u = (_t = layer.visualConfig) == null ? void 0 : _t.label) == null ? void 0 : _u.fixedText) ?? "",
2974
- onChange: (e) => onUpdateVisualConfig(layer.id, {
2975
- ...layer.visualConfig,
2976
- label: { mode: "fixed", fixedText: e.target.value }
2977
- }),
3170
+ value: ((_A = (_z = layer.visualConfig) == null ? void 0 : _z.label) == null ? void 0 : _A.fixedText) ?? "",
3171
+ onChange: (e) => {
3172
+ var _a2;
3173
+ return onUpdateVisualConfig(layer.id, {
3174
+ ...layer.visualConfig,
3175
+ label: { ...(_a2 = layer.visualConfig) == null ? void 0 : _a2.label, mode: "fixed", fixedText: e.target.value }
3176
+ });
3177
+ },
2978
3178
  placeholder: "Enter label text...",
2979
3179
  className: "text-sm",
2980
3180
  "data-testid": `input-label-text-${layer.id}`
@@ -2988,7 +3188,7 @@ function LayersPanel({
2988
3188
  antd.Select,
2989
3189
  {
2990
3190
  size: "small",
2991
- value: ((_w = (_v = layer.visualConfig) == null ? void 0 : _v.size) == null ? void 0 : _w.mode) ?? "standard",
3191
+ value: ((_C = (_B = layer.visualConfig) == null ? void 0 : _B.size) == null ? void 0 : _C.mode) ?? "standard",
2992
3192
  onChange: (val) => onUpdateVisualConfig(layer.id, {
2993
3193
  ...layer.visualConfig,
2994
3194
  size: { mode: val }
@@ -3002,11 +3202,11 @@ function LayersPanel({
3002
3202
  "data-testid": `select-size-mode-${layer.id}`
3003
3203
  }
3004
3204
  ),
3005
- ((_y = (_x = layer.visualConfig) == null ? void 0 : _x.size) == null ? void 0 : _y.mode) === "field" && /* @__PURE__ */ jsxRuntime.jsx(
3205
+ ((_E = (_D = layer.visualConfig) == null ? void 0 : _D.size) == null ? void 0 : _E.mode) === "field" && /* @__PURE__ */ jsxRuntime.jsx(
3006
3206
  antd.Select,
3007
3207
  {
3008
3208
  size: "small",
3009
- value: ((_A = (_z = layer.visualConfig) == null ? void 0 : _z.size) == null ? void 0 : _A.fieldName) ?? "",
3209
+ value: ((_G = (_F = layer.visualConfig) == null ? void 0 : _F.size) == null ? void 0 : _G.fieldName) ?? "",
3010
3210
  onChange: (val) => onUpdateVisualConfig(layer.id, {
3011
3211
  ...layer.visualConfig,
3012
3212
  size: { mode: "field", fieldName: val }
@@ -3019,11 +3219,11 @@ function LayersPanel({
3019
3219
  "data-testid": `select-size-field-${layer.id}`
3020
3220
  }
3021
3221
  ),
3022
- ((_C = (_B = layer.visualConfig) == null ? void 0 : _B.size) == null ? void 0 : _C.mode) === "override" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
3222
+ ((_I = (_H = layer.visualConfig) == null ? void 0 : _H.size) == null ? void 0 : _I.mode) === "override" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
3023
3223
  /* @__PURE__ */ jsxRuntime.jsx(
3024
3224
  antd.Slider,
3025
3225
  {
3026
- value: ((_E = (_D = layer.visualConfig) == null ? void 0 : _D.size) == null ? void 0 : _E.overrideValue) ?? 5,
3226
+ value: ((_K = (_J = layer.visualConfig) == null ? void 0 : _J.size) == null ? void 0 : _K.overrideValue) ?? 5,
3027
3227
  min: 1,
3028
3228
  max: 10,
3029
3229
  step: 1,
@@ -3034,7 +3234,7 @@ function LayersPanel({
3034
3234
  })
3035
3235
  }
3036
3236
  ),
3037
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm w-4 text-right", children: ((_G = (_F = layer.visualConfig) == null ? void 0 : _F.size) == null ? void 0 : _G.overrideValue) ?? 5 })
3237
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm w-4 text-right", children: ((_M = (_L = layer.visualConfig) == null ? void 0 : _L.size) == null ? void 0 : _M.overrideValue) ?? 5 })
3038
3238
  ] }),
3039
3239
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 text-sm text-muted-foreground pt-0.5", children: [
3040
3240
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-3.5 h-3.5 rounded-full bg-current" }),
@@ -3044,7 +3244,7 @@ function LayersPanel({
3044
3244
  antd.Select,
3045
3245
  {
3046
3246
  size: "small",
3047
- value: ((_I = (_H = layer.visualConfig) == null ? void 0 : _H.color) == null ? void 0 : _I.mode) ?? "standard",
3247
+ value: ((_O = (_N = layer.visualConfig) == null ? void 0 : _N.color) == null ? void 0 : _O.mode) ?? "standard",
3048
3248
  onChange: (val) => onUpdateVisualConfig(layer.id, {
3049
3249
  ...layer.visualConfig,
3050
3250
  color: { mode: val }
@@ -3058,37 +3258,77 @@ function LayersPanel({
3058
3258
  "data-testid": `select-color-mode-${layer.id}`
3059
3259
  }
3060
3260
  ),
3061
- ((_K = (_J = layer.visualConfig) == null ? void 0 : _J.color) == null ? void 0 : _K.mode) === "field" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3062
- /* @__PURE__ */ jsxRuntime.jsx(
3063
- antd.Select,
3064
- {
3065
- size: "small",
3066
- value: ((_M = (_L = layer.visualConfig) == null ? void 0 : _L.color) == null ? void 0 : _M.fieldName) ?? "",
3067
- onChange: (val) => onUpdateVisualConfig(layer.id, {
3068
- ...layer.visualConfig,
3069
- color: { mode: "field", fieldName: val }
3070
- }),
3071
- className: "w-full text-sm",
3072
- placeholder: "Select field...",
3073
- showSearch: true,
3074
- optionFilterProp: "label",
3075
- options: getLayerFields(layer.id).map((f) => ({ value: f.name, label: f.name })),
3076
- "data-testid": `select-color-field-${layer.id}`
3077
- }
3078
- ),
3079
- ((_O = (_N = layer.visualConfig) == null ? void 0 : _N.color) == null ? void 0 : _O.fieldName) && getFieldValueDistribution && /* @__PURE__ */ jsxRuntime.jsx(
3080
- ColorByFieldLegend,
3081
- {
3082
- layerId: layer.id,
3083
- fieldName: layer.visualConfig.color.fieldName,
3084
- getFieldValueDistribution
3085
- }
3086
- )
3087
- ] }),
3088
- ((_Q = (_P = layer.visualConfig) == null ? void 0 : _P.color) == null ? void 0 : _Q.mode) === "fixed" && /* @__PURE__ */ jsxRuntime.jsx(
3261
+ ((_Q = (_P = layer.visualConfig) == null ? void 0 : _P.color) == null ? void 0 : _Q.mode) === "field" && (() => {
3262
+ var _a2, _b2, _c2, _d2;
3263
+ const fields = getLayerFields(layer.id);
3264
+ const colorField = (_b2 = (_a2 = layer.visualConfig) == null ? void 0 : _a2.color) == null ? void 0 : _b2.fieldName;
3265
+ const fieldStats = colorField ? fields.find((f) => f.name === colorField) : void 0;
3266
+ const fieldHasNumeric = (fieldStats == null ? void 0 : fieldStats.min) !== void 0;
3267
+ const scale = ((_d2 = (_c2 = layer.visualConfig) == null ? void 0 : _c2.color) == null ? void 0 : _d2.scale) ?? "categorical";
3268
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3269
+ /* @__PURE__ */ jsxRuntime.jsx(
3270
+ antd.Select,
3271
+ {
3272
+ size: "small",
3273
+ value: colorField ?? "",
3274
+ onChange: (val) => onUpdateVisualConfig(layer.id, {
3275
+ ...layer.visualConfig,
3276
+ // The scale default is decided once, at pick time, and
3277
+ // stored — never re-inferred at render, so data drifting
3278
+ // later can't silently flip a user's choice.
3279
+ color: { mode: "field", fieldName: val, scale: defaultColorScaleForField(fields.find((f) => f.name === val)) }
3280
+ }),
3281
+ className: "w-full text-sm",
3282
+ placeholder: "Select field...",
3283
+ showSearch: true,
3284
+ optionFilterProp: "label",
3285
+ options: fields.map((f) => ({ value: f.name, label: f.name })),
3286
+ "data-testid": `select-color-field-${layer.id}`
3287
+ }
3288
+ ),
3289
+ colorField && /* @__PURE__ */ jsxRuntime.jsx(
3290
+ antd.Segmented,
3291
+ {
3292
+ size: "small",
3293
+ block: true,
3294
+ value: scale,
3295
+ onChange: (val) => {
3296
+ var _a3;
3297
+ return onUpdateVisualConfig(layer.id, {
3298
+ ...layer.visualConfig,
3299
+ color: { ...(_a3 = layer.visualConfig) == null ? void 0 : _a3.color, mode: "field", scale: val }
3300
+ });
3301
+ },
3302
+ options: [
3303
+ { label: "Categories", value: "categorical" },
3304
+ { label: "Gradient", value: "gradient", disabled: !fieldHasNumeric && scale !== "gradient" }
3305
+ ],
3306
+ "data-testid": `segmented-color-scale-${layer.id}`
3307
+ }
3308
+ ),
3309
+ colorField && scale === "gradient" && fieldStats && fieldStats.min !== void 0 && fieldStats.max !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(
3310
+ ColorGradientLegend,
3311
+ {
3312
+ layerId: layer.id,
3313
+ min: fieldStats.min,
3314
+ max: fieldStats.max,
3315
+ sampled: fieldStats.sampled
3316
+ }
3317
+ ),
3318
+ colorField && scale !== "gradient" && getFieldValueDistribution && /* @__PURE__ */ jsxRuntime.jsx(
3319
+ ColorByFieldLegend,
3320
+ {
3321
+ layerId: layer.id,
3322
+ fieldName: colorField,
3323
+ getFieldValueDistribution
3324
+ }
3325
+ )
3326
+ ] });
3327
+ })(),
3328
+ ((_S = (_R = layer.visualConfig) == null ? void 0 : _R.color) == null ? void 0 : _S.mode) === "fixed" && /* @__PURE__ */ jsxRuntime.jsx(
3089
3329
  ColorPickerPopover,
3090
3330
  {
3091
- value: ((_S = (_R = layer.visualConfig) == null ? void 0 : _R.color) == null ? void 0 : _S.fixedColor) ?? "#3b82f6",
3331
+ value: ((_U = (_T = layer.visualConfig) == null ? void 0 : _T.color) == null ? void 0 : _U.fixedColor) ?? "#3b82f6",
3092
3332
  onChange: (color) => {
3093
3333
  onUpdateVisualConfig == null ? void 0 : onUpdateVisualConfig(layer.id, {
3094
3334
  ...layer.visualConfig,
@@ -3101,7 +3341,7 @@ function LayersPanel({
3101
3341
  testId: `color-fixed-${layer.id}`
3102
3342
  }
3103
3343
  ),
3104
- (hasPointFeatures == null ? void 0 : hasPointFeatures(layer.id)) && !((_T = layer.metadata) == null ? void 0 : _T.hidePointFeatures) && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3344
+ (hasPointFeatures == null ? void 0 : hasPointFeatures(layer.id)) && !((_V = layer.metadata) == null ? void 0 : _V.hidePointFeatures) && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3105
3345
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 text-sm text-muted-foreground pt-0.5", children: [
3106
3346
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Smile, { className: "w-3.5 h-3.5" }),
3107
3347
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Point Icon" })
@@ -3111,7 +3351,7 @@ function LayersPanel({
3111
3351
  antd.Switch,
3112
3352
  {
3113
3353
  size: "small",
3114
- checked: ((_V = (_U = layer.visualConfig) == null ? void 0 : _U.icon) == null ? void 0 : _V.enabled) ?? false,
3354
+ checked: ((_X = (_W = layer.visualConfig) == null ? void 0 : _W.icon) == null ? void 0 : _X.enabled) ?? false,
3115
3355
  onChange: (checked) => {
3116
3356
  var _a2, _b2, _c2, _d2;
3117
3357
  onUpdateVisualConfig == null ? void 0 : onUpdateVisualConfig(layer.id, {
@@ -3126,11 +3366,11 @@ function LayersPanel({
3126
3366
  "data-testid": `switch-icon-${layer.id}`
3127
3367
  }
3128
3368
  ),
3129
- ((_X = (_W = layer.visualConfig) == null ? void 0 : _W.icon) == null ? void 0 : _X.enabled) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 flex-1", children: [
3369
+ ((_Z = (_Y = layer.visualConfig) == null ? void 0 : _Y.icon) == null ? void 0 : _Z.enabled) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 flex-1", children: [
3130
3370
  /* @__PURE__ */ jsxRuntime.jsx(
3131
3371
  IconPicker,
3132
3372
  {
3133
- value: ((_Z = (_Y = layer.visualConfig) == null ? void 0 : _Y.icon) == null ? void 0 : _Z.icon) ?? "📍",
3373
+ value: ((_$ = (__ = layer.visualConfig) == null ? void 0 : __.icon) == null ? void 0 : _$.icon) ?? "📍",
3134
3374
  onChange: (icon) => {
3135
3375
  var _a2, _b2;
3136
3376
  onUpdateVisualConfig == null ? void 0 : onUpdateVisualConfig(layer.id, {
@@ -3147,7 +3387,7 @@ function LayersPanel({
3147
3387
  /* @__PURE__ */ jsxRuntime.jsx(
3148
3388
  antd.Slider,
3149
3389
  {
3150
- value: ((_$ = (__ = layer.visualConfig) == null ? void 0 : __.icon) == null ? void 0 : _$.size) ?? 24,
3390
+ value: ((_ba = (_aa = layer.visualConfig) == null ? void 0 : _aa.icon) == null ? void 0 : _ba.size) ?? 24,
3151
3391
  min: 12,
3152
3392
  max: 48,
3153
3393
  step: 2,
@@ -3165,7 +3405,7 @@ function LayersPanel({
3165
3405
  }
3166
3406
  }
3167
3407
  ),
3168
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm w-6 text-right", children: ((_ba = (_aa = layer.visualConfig) == null ? void 0 : _aa.icon) == null ? void 0 : _ba.size) ?? 24 })
3408
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm w-6 text-right", children: ((_da = (_ca = layer.visualConfig) == null ? void 0 : _ca.icon) == null ? void 0 : _da.size) ?? 24 })
3169
3409
  ] })
3170
3410
  ] })
3171
3411
  ] })
@@ -6498,13 +6738,282 @@ function hitTestSelection(featureGroups, selectionPolygon, options) {
6498
6738
  mapPerfLog("hit-test", "selection gesture", { visited, total, selected: selectedIds.length });
6499
6739
  return selectedIds;
6500
6740
  }
6741
+ const CLUSTER_COUNT_VALUE_PROP = "__cluster_count_value";
6742
+ const CLUSTER_SUM_PROP = "value_sum";
6743
+ const CLUSTER_MEMBER_ID_PROP = "__cluster_fid";
6744
+ function clusterCountValue(raw) {
6745
+ if (typeof raw === "number") return Number.isFinite(raw) ? raw : 1;
6746
+ if (typeof raw === "string" && raw.trim() !== "") {
6747
+ const n = Number(raw);
6748
+ if (Number.isFinite(n)) return n;
6749
+ }
6750
+ return 1;
6751
+ }
6752
+ function injectClusterCountValues(features, fieldName) {
6753
+ return features.map((f) => {
6754
+ var _a;
6755
+ return {
6756
+ ...f,
6757
+ properties: {
6758
+ ...f.properties,
6759
+ [CLUSTER_COUNT_VALUE_PROP]: clusterCountValue((_a = f.properties) == null ? void 0 : _a[fieldName]),
6760
+ ...f.id != null ? { [CLUSTER_MEMBER_ID_PROP]: String(f.id) } : {}
6761
+ }
6762
+ };
6763
+ });
6764
+ }
6765
+ function roundHalfAwayFromZero1(n) {
6766
+ return Math.sign(n) * Math.round(Math.abs(n) * 10) / 10;
6767
+ }
6768
+ function formatClusterBadge(value) {
6769
+ if (value >= 1e6) return `${roundHalfAwayFromZero1(value / 1e6)}M`;
6770
+ if (value >= 1e3) return `${roundHalfAwayFromZero1(value / 1e3)}k`;
6771
+ return String(roundHalfAwayFromZero1(value));
6772
+ }
6773
+ function clusterBadgeTextField(prop) {
6774
+ const value = ["get", prop];
6775
+ const round1 = (expr) => ["/", ["round", ["*", expr, 10]], 10];
6776
+ return [
6777
+ "step",
6778
+ value,
6779
+ ["to-string", round1(value)],
6780
+ 1e3,
6781
+ ["concat", ["to-string", round1(["/", value, 1e3])], "k"],
6782
+ 1e6,
6783
+ ["concat", ["to-string", round1(["/", value, 1e6])], "M"]
6784
+ ];
6785
+ }
6786
+ const INTERNAL_PROPERTY_KEYS = /* @__PURE__ */ new Set([
6787
+ "fill",
6788
+ "fill-opacity",
6789
+ "pointRadius",
6790
+ "pointIcon",
6791
+ "pointIconSize",
6792
+ "circleCenter",
6793
+ "circleRadius",
6794
+ "icon",
6795
+ "iconSize",
6796
+ "fontSize",
6797
+ "fontColor",
6798
+ "fontWeight",
6799
+ "arrowSize",
6800
+ "label",
6801
+ "entityType",
6802
+ "kind",
6803
+ "meta:type",
6804
+ "stroke",
6805
+ "stroke-width",
6806
+ "stroke-opacity",
6807
+ CLUSTER_COUNT_VALUE_PROP,
6808
+ CLUSTER_MEMBER_ID_PROP
6809
+ ]);
6810
+ const STYLING_PROPERTY_KEYS = [
6811
+ "stroke",
6812
+ "stroke-width",
6813
+ "stroke-opacity",
6814
+ "fill",
6815
+ "fill-opacity",
6816
+ "pointRadius",
6817
+ "pointIcon",
6818
+ "pointIconSize",
6819
+ "icon",
6820
+ "iconSize",
6821
+ "circleCenter",
6822
+ "circleRadius",
6823
+ "fontSize",
6824
+ "fontColor",
6825
+ "fontWeight",
6826
+ "arrowSize"
6827
+ ];
6828
+ const INTERNAL_PROPERTY_PREFIXES = [
6829
+ "IsHiddenBy",
6830
+ "isHidden",
6831
+ "isSelected",
6832
+ "isTrace",
6833
+ "isTimeline",
6834
+ "trace"
6835
+ ];
6836
+ function isInternalProperty(key) {
6837
+ if (INTERNAL_PROPERTY_KEYS.has(key)) return true;
6838
+ return INTERNAL_PROPERTY_PREFIXES.some((prefix) => key.startsWith(prefix));
6839
+ }
6840
+ function computeBubbleDomain(values) {
6841
+ let min = Infinity;
6842
+ let max = -Infinity;
6843
+ for (const v of values) {
6844
+ if (!Number.isFinite(v)) continue;
6845
+ if (v < min) min = v;
6846
+ if (v > max) max = v;
6847
+ }
6848
+ return isFinite(min) ? { min, max } : null;
6849
+ }
6850
+ function bubbleGradientColorExpression(prop, min, max) {
6851
+ if (!(max > min)) return gradientColor(0.5);
6852
+ const expr = ["interpolate", ["linear"], ["get", prop]];
6853
+ const span = max - min;
6854
+ GRADIENT_RAMP.forEach((color, i) => {
6855
+ expr.push(min + span * i / (GRADIENT_RAMP.length - 1), color);
6856
+ });
6857
+ return expr;
6858
+ }
6859
+ function createClusterGradientManager(map, sourceId, options) {
6860
+ const clusterProp = options.valueProp ?? "point_count";
6861
+ let scheduled = false;
6862
+ let lastDomainKey = "";
6863
+ let reportedFailure = false;
6864
+ function reportFailure(stage, error) {
6865
+ if (reportedFailure) return;
6866
+ reportedFailure = true;
6867
+ console.error(`[map-component] cluster gradient ${stage} failed; bubbles keep their current colors:`, error);
6868
+ }
6869
+ function apply() {
6870
+ scheduled = false;
6871
+ let values;
6872
+ try {
6873
+ if (!map.getSource(sourceId)) return;
6874
+ values = map.querySourceFeatures(sourceId, { filter: ["has", "point_count"] }).map((f) => {
6875
+ var _a;
6876
+ return Number((_a = f.properties) == null ? void 0 : _a[clusterProp]);
6877
+ });
6878
+ if (options.singleLayerId) {
6879
+ const singles = map.querySourceFeatures(sourceId, {
6880
+ filter: ["all", ["!", ["has", "point_count"]], [">", ["get", CLUSTER_COUNT_VALUE_PROP], 1]]
6881
+ });
6882
+ values.push(...singles.map((f) => {
6883
+ var _a;
6884
+ return Number((_a = f.properties) == null ? void 0 : _a[CLUSTER_COUNT_VALUE_PROP]);
6885
+ }));
6886
+ }
6887
+ } catch (error) {
6888
+ reportFailure("domain query", error);
6889
+ return;
6890
+ }
6891
+ const domain = computeBubbleDomain(values);
6892
+ if (!domain) return;
6893
+ const key = `${domain.min}|${domain.max}`;
6894
+ if (key === lastDomainKey) return;
6895
+ lastDomainKey = key;
6896
+ try {
6897
+ if (map.getLayer(options.clustersLayerId)) {
6898
+ map.setPaintProperty(
6899
+ options.clustersLayerId,
6900
+ "circle-color",
6901
+ bubbleGradientColorExpression(clusterProp, domain.min, domain.max)
6902
+ );
6903
+ }
6904
+ if (options.singleLayerId && map.getLayer(options.singleLayerId)) {
6905
+ map.setPaintProperty(
6906
+ options.singleLayerId,
6907
+ "circle-color",
6908
+ bubbleGradientColorExpression(CLUSTER_COUNT_VALUE_PROP, domain.min, domain.max)
6909
+ );
6910
+ }
6911
+ } catch (error) {
6912
+ reportFailure("paint update", error);
6913
+ lastDomainKey = "";
6914
+ }
6915
+ }
6916
+ function schedule() {
6917
+ if (scheduled) return;
6918
+ scheduled = true;
6919
+ requestAnimationFrame(apply);
6920
+ }
6921
+ function onData(e) {
6922
+ if (e.sourceId === sourceId) schedule();
6923
+ }
6924
+ map.on("moveend", schedule);
6925
+ map.on("data", onData);
6926
+ schedule();
6927
+ return {
6928
+ destroy: () => {
6929
+ map.off("moveend", schedule);
6930
+ map.off("data", onData);
6931
+ }
6932
+ };
6933
+ }
6934
+ const LABEL_NEVER_HIDE_PROP = "_labelNeverHide";
6935
+ const PINNED_LABEL_FILTER = ["==", ["get", LABEL_NEVER_HIDE_PROP], 1];
6936
+ const UNPINNED_LABEL_FILTER = ["!=", ["get", LABEL_NEVER_HIDE_PROP], 1];
6937
+ function computeLabelNeverHide(label) {
6938
+ return (label == null ? void 0 : label.neverHide) && !label.hidden ? 1 : 0;
6939
+ }
6940
+ function buildCustomLabelLayout() {
6941
+ return {
6942
+ // Hide labels for trace points (except last point which has isTraceLabel),
6943
+ // arrows handled by the custom-arrow-labels layer. Features blanked by
6944
+ // heatmap/cluster/trace modes stay blank in BOTH layers: "never hide"
6945
+ // exempts labels from collision and density culling, it does not resurrect
6946
+ // labels other mode choices explicitly blank.
6947
+ "text-field": [
6948
+ "case",
6949
+ ["==", ["get", "isHiddenByTrace"], true],
6950
+ "",
6951
+ ["==", ["get", "isHiddenByHeatmap"], 1],
6952
+ "",
6953
+ ["==", ["get", "isHiddenByCluster"], 1],
6954
+ "",
6955
+ ["==", ["get", "kind"], "arrow"],
6956
+ "",
6957
+ // Trace points: only show label if isTraceLabel is true (last point in group)
6958
+ ["all", ["==", ["get", "isTracePoint"], true], ["!=", ["get", "isTraceLabel"], true]],
6959
+ "",
6960
+ ["==", ["get", "kind"], "text"],
6961
+ ["coalesce", ["get", "label"], ["get", "text"], "New Label"],
6962
+ ["coalesce", ["get", "name"], ""]
6963
+ ],
6964
+ // Text features use their fontSize property; trace labels 14px; others 12px
6965
+ "text-size": [
6966
+ "case",
6967
+ ["==", ["get", "kind"], "text"],
6968
+ ["coalesce", ["get", "fontSize"], 14],
6969
+ ["==", ["get", "isTraceLabel"], true],
6970
+ 14,
6971
+ 12
6972
+ ],
6973
+ // Text features: center anchor; others: top anchor
6974
+ "text-anchor": ["case", ["==", ["get", "kind"], "text"], "center", "top"],
6975
+ "text-offset": ["case", ["==", ["get", "kind"], "text"], ["literal", [0, 0]], ["literal", [0, 0.8]]],
6976
+ "text-padding": 2,
6977
+ // Bold font for text features with fontWeight=bold, trace labels, others regular
6978
+ "text-font": [
6979
+ "case",
6980
+ ["all", ["==", ["get", "kind"], "text"], ["==", ["get", "fontWeight"], "bold"]],
6981
+ ["literal", ["Montserrat SemiBold", "Noto Sans Regular"]],
6982
+ ["==", ["get", "isTraceLabel"], true],
6983
+ ["literal", ["Montserrat Medium", "Noto Sans Regular"]],
6984
+ ["literal", ["Montserrat Regular", "Noto Sans Regular"]]
6985
+ ]
6986
+ };
6987
+ }
6988
+ function buildCustomLabelPaint() {
6989
+ return {
6990
+ // Text features use fontColor; others use default
6991
+ "text-color": [
6992
+ "case",
6993
+ ["==", ["get", "kind"], "text"],
6994
+ ["coalesce", ["get", "fontColor"], "#000000"],
6995
+ "#1f2937"
6996
+ ],
6997
+ "text-halo-color": "#ffffff",
6998
+ // Thicker halo for trace labels and text features
6999
+ "text-halo-width": [
7000
+ "case",
7001
+ ["==", ["get", "kind"], "text"],
7002
+ 2,
7003
+ ["==", ["get", "isTraceLabel"], true],
7004
+ 2,
7005
+ 1.5
7006
+ ],
7007
+ "text-opacity": ["*", 0.9, ["get", "stroke-opacity"]]
7008
+ };
7009
+ }
6501
7010
  const OTHER_BUCKET_KEY = "__other__";
6502
7011
  const OTHER_BUCKET_LABEL = "Other";
6503
7012
  const OTHER_BUCKET_COLOR = "#9ca3af";
6504
7013
  function toDisplayName(name) {
6505
7014
  return name === OTHER_BUCKET_KEY ? OTHER_BUCKET_LABEL : name;
6506
7015
  }
6507
- function createPieSVG(categories, total, size = 44, onSliceHover) {
7016
+ function createPieSVG(categories, total, size = 44, onSliceHover, badgeValue) {
6508
7017
  const container = document.createElement("div");
6509
7018
  container.style.width = `${size}px`;
6510
7019
  container.style.height = `${size}px`;
@@ -6602,16 +7111,17 @@ function createPieSVG(categories, total, size = 44, onSliceHover) {
6602
7111
  centerCircle.setAttribute("r", String(innerRadius - 2));
6603
7112
  centerCircle.setAttribute("fill", "#1f2937");
6604
7113
  svg.appendChild(centerCircle);
7114
+ const badgeText = formatClusterBadge(badgeValue ?? total);
6605
7115
  const text = document.createElementNS("http://www.w3.org/2000/svg", "text");
6606
7116
  text.setAttribute("x", String(radius));
6607
7117
  text.setAttribute("y", String(radius));
6608
7118
  text.setAttribute("text-anchor", "middle");
6609
7119
  text.setAttribute("dominant-baseline", "central");
6610
7120
  text.setAttribute("fill", "white");
6611
- text.setAttribute("font-size", total >= 1e3 ? "9" : total >= 100 ? "10" : "11");
7121
+ text.setAttribute("font-size", badgeText.length >= 6 ? "8" : badgeText.length >= 4 ? "9" : badgeText.length >= 3 ? "10" : "11");
6612
7122
  text.setAttribute("font-weight", "bold");
6613
7123
  text.setAttribute("font-family", "system-ui, sans-serif");
6614
- text.textContent = total >= 1e3 ? `${(total / 1e3).toFixed(1)}k` : String(total);
7124
+ text.textContent = badgeText;
6615
7125
  svg.appendChild(text);
6616
7126
  container.appendChild(svg);
6617
7127
  return container;
@@ -6658,17 +7168,17 @@ function hideTooltip() {
6658
7168
  tooltipEl.style.display = "none";
6659
7169
  }
6660
7170
  }
6661
- function fingerprintCluster(pointCount, counts, size) {
6662
- return `${size}|${pointCount}|${counts.join(",")}`;
7171
+ function fingerprintCluster(pointCount, counts, size, badgeValue) {
7172
+ return `${size}|${pointCount}|${badgeValue ?? ""}|${counts.join(",")}`;
6663
7173
  }
6664
- function buildPieElement(categories, pointCount, size, source, clusterId, map, coords) {
7174
+ function buildPieElement(categories, pointCount, size, source, clusterId, map, coords, badgeValue) {
6665
7175
  const el = createPieSVG(categories, pointCount, size, (cat, event) => {
6666
7176
  if (cat) {
6667
7177
  showTooltip(cat, event.clientX, event.clientY);
6668
7178
  } else {
6669
7179
  hideTooltip();
6670
7180
  }
6671
- });
7181
+ }, badgeValue);
6672
7182
  el.addEventListener("click", () => {
6673
7183
  source.getClusterExpansionZoom(clusterId).then((zoom) => {
6674
7184
  if (typeof zoom === "number") {
@@ -6687,13 +7197,16 @@ function renderClusterPies(map, sourceId, categoryValues, categoryColorMap, mark
6687
7197
  });
6688
7198
  const visibleClusterIds = /* @__PURE__ */ new Set();
6689
7199
  clusters.forEach((feature) => {
6690
- var _a, _b;
7200
+ var _a, _b, _c;
6691
7201
  const clusterId = (_a = feature.properties) == null ? void 0 : _a.cluster_id;
6692
7202
  if (clusterId === void 0) return;
6693
7203
  const clusterKey = `${clusterId}`;
6694
7204
  visibleClusterIds.add(clusterKey);
6695
7205
  const coords = feature.geometry.coordinates;
6696
7206
  const pointCount = ((_b = feature.properties) == null ? void 0 : _b.point_count) || 0;
7207
+ const sumRaw = (_c = feature.properties) == null ? void 0 : _c[CLUSTER_SUM_PROP];
7208
+ const sumNum = typeof sumRaw === "number" ? sumRaw : sumRaw != null ? Number(sumRaw) : NaN;
7209
+ const badgeValue = Number.isFinite(sumNum) ? sumNum : void 0;
6697
7210
  const allCounts = categoryValues.map((_, i) => {
6698
7211
  var _a2;
6699
7212
  return Number(((_a2 = feature.properties) == null ? void 0 : _a2[`cat_${i}`]) || 0);
@@ -6705,13 +7218,13 @@ function renderClusterPies(map, sourceId, categoryValues, categoryColorMap, mark
6705
7218
  color: categoryColorMap[cat] || "#3b82f6"
6706
7219
  })).filter((c) => c.count > 0);
6707
7220
  const size = pointCount < 100 ? 40 : pointCount < 750 ? 50 : 60;
6708
- const fingerprint = fingerprintCluster(pointCount, allCounts, size);
7221
+ const fingerprint = fingerprintCluster(pointCount, allCounts, size, badgeValue);
6709
7222
  const existing = markers.get(clusterKey);
6710
7223
  if (existing && existing.fingerprint === fingerprint) {
6711
7224
  existing.marker.setLngLat(coords);
6712
7225
  return;
6713
7226
  }
6714
- const el = buildPieElement(categories, pointCount, size, source, clusterId, map, coords);
7227
+ const el = buildPieElement(categories, pointCount, size, source, clusterId, map, coords, badgeValue);
6715
7228
  if (existing) {
6716
7229
  existing.marker.remove();
6717
7230
  }
@@ -7152,6 +7665,8 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
7152
7665
  const loadingBasemaps = react.useRef(/* @__PURE__ */ new Set());
7153
7666
  const customBasemapRegistry = react.useRef(/* @__PURE__ */ new Map());
7154
7667
  const clusterPieManagers = react.useRef(/* @__PURE__ */ new Map());
7668
+ const clusterGradientManagers = react.useRef(/* @__PURE__ */ new Map());
7669
+ const clusterLayerHandlers = react.useRef(/* @__PURE__ */ new Map());
7155
7670
  const handleMapStyleChangeRef = react.useRef(null);
7156
7671
  const flightPath3DLayerId = react.useRef(null);
7157
7672
  const update3DFlightPathsRef = react.useRef(null);
@@ -7166,6 +7681,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
7166
7681
  const [selectedFeatureIds, setSelectedFeatureIds] = react.useState([]);
7167
7682
  const [featureCount, setFeatureCount] = react.useState(0);
7168
7683
  const [featureUpdateCounter, setFeatureUpdateCounter] = react.useState(0);
7684
+ const [clusterDataVersion, setClusterDataVersion] = react.useState(0);
7169
7685
  const [showProperties, setShowProperties] = react.useState(false);
7170
7686
  const [autoFocusLabel, setAutoFocusLabel] = react.useState(false);
7171
7687
  const [showLayers, setShowLayers] = react.useState(false);
@@ -7497,6 +8013,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
7497
8013
  });
7498
8014
  });
7499
8015
  });
8016
+ const layerGradientRanges = /* @__PURE__ */ new Map();
7500
8017
  selectedFeatureIds.forEach((fid) => {
7501
8018
  var _a;
7502
8019
  const feature = featById.get(fid);
@@ -7506,22 +8023,29 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
7506
8023
  colorMap.set(fid, tracePointColors.get(fid));
7507
8024
  return;
7508
8025
  }
7509
- let color = ((_a = feature == null ? void 0 : feature.properties) == null ? void 0 : _a.stroke) || "#3b82f6";
8026
+ const fallback = ((_a = feature == null ? void 0 : feature.properties) == null ? void 0 : _a.stroke) || "#3b82f6";
8027
+ let color = fallback;
7510
8028
  const colorConfig = visualConfig == null ? void 0 : visualConfig.color;
7511
8029
  if (colorConfig && feature) {
7512
- if (colorConfig.mode === "fixed" && colorConfig.fixedColor) {
7513
- color = colorConfig.fixedColor;
7514
- } else if (colorConfig.mode === "field" && colorConfig.fieldName && feature.properties) {
7515
- const key = categoricalKey(feature.properties[colorConfig.fieldName]);
7516
- if (key !== null) {
7517
- color = hashStringToColor$1(key);
8030
+ let range;
8031
+ if (layer && colorConfig.mode === "field" && colorConfig.scale === "gradient" && colorConfig.fieldName) {
8032
+ const cached = layerGradientRanges.get(layer.id);
8033
+ if (cached === void 0) {
8034
+ range = computeNumericRange(layer.featureIds, (id) => {
8035
+ var _a2;
8036
+ return (_a2 = featById.get(id)) == null ? void 0 : _a2.properties;
8037
+ }, colorConfig.fieldName);
8038
+ layerGradientRanges.set(layer.id, range);
8039
+ } else {
8040
+ range = cached;
7518
8041
  }
7519
8042
  }
8043
+ color = resolveFeatureColor(colorConfig, feature.properties, fallback, range);
7520
8044
  }
7521
8045
  colorMap.set(fid, color);
7522
8046
  });
7523
8047
  return colorMap;
7524
- }, [selectedFeatureIds, layers, getAllFeatures, hashStringToColor$1]);
8048
+ }, [selectedFeatureIds, layers, getAllFeatures]);
7525
8049
  const countVisibleFeatures = react.useCallback((threshold) => {
7526
8050
  const m = map.current;
7527
8051
  if (!m) return 0;
@@ -7672,27 +8196,38 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
7672
8196
  layer.featureIds.forEach((fid) => featureToLayer.set(fid, layer));
7673
8197
  });
7674
8198
  const sizeFieldRanges = /* @__PURE__ */ new Map();
8199
+ const colorFieldRanges = /* @__PURE__ */ new Map();
7675
8200
  currentLayers.forEach((layer) => {
7676
- var _a;
8201
+ var _a, _b;
7677
8202
  if (!layer.visible) return;
7678
8203
  const sizeConfig = (_a = layer.visualConfig) == null ? void 0 : _a.size;
7679
- if ((sizeConfig == null ? void 0 : sizeConfig.mode) === "field" && sizeConfig.fieldName) {
7680
- let min = Infinity, max = -Infinity;
7681
- layer.featureIds.forEach((fid) => {
7682
- const feature = featureById.get(fid);
7683
- if (feature == null ? void 0 : feature.properties) {
7684
- const rawVal = feature.properties[sizeConfig.fieldName];
7685
- const val = typeof rawVal === "number" ? rawVal : typeof rawVal === "string" && rawVal.trim() !== "" ? Number(rawVal) : NaN;
7686
- if (isFinite(val)) {
7687
- min = Math.min(min, val);
7688
- max = Math.max(max, val);
7689
- }
8204
+ const colorConfig = (_b = layer.visualConfig) == null ? void 0 : _b.color;
8205
+ const sizeField = (sizeConfig == null ? void 0 : sizeConfig.mode) === "field" && sizeConfig.fieldName ? sizeConfig.fieldName : null;
8206
+ const colorField = (colorConfig == null ? void 0 : colorConfig.mode) === "field" && colorConfig.scale === "gradient" && colorConfig.fieldName ? colorConfig.fieldName : null;
8207
+ if (!sizeField && !colorField) return;
8208
+ let sMin = Infinity, sMax = -Infinity;
8209
+ let cMin = Infinity, cMax = -Infinity;
8210
+ layer.featureIds.forEach((fid) => {
8211
+ var _a2;
8212
+ const props = (_a2 = featureById.get(fid)) == null ? void 0 : _a2.properties;
8213
+ if (!props) return;
8214
+ if (sizeField) {
8215
+ const v = coerceFiniteNumber(props[sizeField]);
8216
+ if (v !== null) {
8217
+ if (v < sMin) sMin = v;
8218
+ if (v > sMax) sMax = v;
7690
8219
  }
7691
- });
7692
- if (isFinite(min) && isFinite(max)) {
7693
- sizeFieldRanges.set(layer.id, { min, max });
7694
8220
  }
7695
- }
8221
+ if (colorField) {
8222
+ const v = coerceFiniteNumber(props[colorField]);
8223
+ if (v !== null) {
8224
+ if (v < cMin) cMin = v;
8225
+ if (v > cMax) cMax = v;
8226
+ }
8227
+ }
8228
+ });
8229
+ if (sizeField && isFinite(sMin)) sizeFieldRanges.set(layer.id, { min: sMin, max: sMax });
8230
+ if (colorField && isFinite(cMin)) colorFieldRanges.set(layer.id, { min: cMin, max: cMax });
7696
8231
  });
7697
8232
  const lastTracePointIds = /* @__PURE__ */ new Set();
7698
8233
  const tracePointColors = /* @__PURE__ */ new Map();
@@ -7757,7 +8292,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
7757
8292
  const sourceData = {
7758
8293
  type: "FeatureCollection",
7759
8294
  features: allFeatures.map((f) => {
7760
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
8295
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
7761
8296
  const featureId = String(f.id);
7762
8297
  const layer = featureToLayer.get(featureId);
7763
8298
  const visualConfig = layer == null ? void 0 : layer.visualConfig;
@@ -7766,14 +8301,12 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
7766
8301
  let strokeColor = ((_b = f.properties) == null ? void 0 : _b.stroke) || "#3b82f6";
7767
8302
  const colorConfig = visualConfig == null ? void 0 : visualConfig.color;
7768
8303
  if (colorConfig) {
7769
- if (colorConfig.mode === "fixed" && colorConfig.fixedColor) {
7770
- strokeColor = colorConfig.fixedColor;
7771
- } else if (colorConfig.mode === "field" && colorConfig.fieldName && f.properties) {
7772
- const key = categoricalKey(f.properties[colorConfig.fieldName]);
7773
- if (key !== null) {
7774
- strokeColor = hashStringToColor$1(key);
7775
- }
7776
- }
8304
+ strokeColor = resolveFeatureColor(
8305
+ colorConfig,
8306
+ f.properties,
8307
+ strokeColor,
8308
+ layer ? colorFieldRanges.get(layer.id) : void 0
8309
+ );
7777
8310
  }
7778
8311
  let strokeWidth = ((_c = f.properties) == null ? void 0 : _c["stroke-width"]) || 2;
7779
8312
  let pointRadius = Math.round(3 + strokeWidth);
@@ -7901,7 +8434,8 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
7901
8434
  pointRadius,
7902
8435
  isHiddenFor3DOnly: hideFlatFor3DOnly ? 1 : 0,
7903
8436
  isTimelineHidden: isTimelineVisible ? 0 : 1,
7904
- _labelPriority: labelPriority
8437
+ _labelPriority: labelPriority,
8438
+ [LABEL_NEVER_HIDE_PROP]: computeLabelNeverHide((_o = layer == null ? void 0 : layer.visualConfig) == null ? void 0 : _o.label)
7905
8439
  }
7906
8440
  };
7907
8441
  })
@@ -8215,6 +8749,15 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
8215
8749
  clusterPieManagers.current.delete(layerId);
8216
8750
  }
8217
8751
  });
8752
+ clusterGradientManagers.current.forEach((mgr, layerId) => {
8753
+ if (!liveLayerIds.has(layerId)) {
8754
+ try {
8755
+ mgr.destroy();
8756
+ } catch {
8757
+ }
8758
+ clusterGradientManagers.current.delete(layerId);
8759
+ }
8760
+ });
8218
8761
  const m = map.current;
8219
8762
  if (!m) return;
8220
8763
  let style;
@@ -8223,7 +8766,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
8223
8766
  } catch {
8224
8767
  return;
8225
8768
  }
8226
- const layerPrefixes = ["heatmap-layer-", "cluster-count-", "clusters-", "unclustered-point-"];
8769
+ const layerPrefixes = ["heatmap-layer-", "cluster-count-", "cluster-single-count-", "cluster-single-", "clusters-", "unclustered-point-"];
8227
8770
  const sourcePrefixes = ["heatmap-source-", "cluster-source-"];
8228
8771
  ((style == null ? void 0 : style.layers) ?? []).forEach((sl) => {
8229
8772
  const prefix = layerPrefixes.find((p) => sl.id.startsWith(p));
@@ -8673,39 +9216,10 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
8673
9216
  id: "custom-labels",
8674
9217
  type: "symbol",
8675
9218
  source: "custom-features",
9219
+ filter: UNPINNED_LABEL_FILTER,
8676
9220
  layout: {
9221
+ ...buildCustomLabelLayout(),
8677
9222
  "visibility": "none",
8678
- // Hide labels for trace points (except last point which has isTraceLabel), arrows handled separately
8679
- "text-field": [
8680
- "case",
8681
- ["==", ["get", "isHiddenByTrace"], true],
8682
- "",
8683
- ["==", ["get", "isHiddenByHeatmap"], 1],
8684
- "",
8685
- ["==", ["get", "isHiddenByCluster"], 1],
8686
- "",
8687
- ["==", ["get", "kind"], "arrow"],
8688
- "",
8689
- // Arrows use custom-arrow-labels layer
8690
- // Trace points: only show label if isTraceLabel is true (last point in group)
8691
- ["all", ["==", ["get", "isTracePoint"], true], ["!=", ["get", "isTraceLabel"], true]],
8692
- "",
8693
- ["==", ["get", "kind"], "text"],
8694
- ["coalesce", ["get", "label"], ["get", "text"], "New Label"],
8695
- ["coalesce", ["get", "name"], ""]
8696
- ],
8697
- // Text features use their fontSize property; trace labels 14px; others 12px
8698
- "text-size": [
8699
- "case",
8700
- ["==", ["get", "kind"], "text"],
8701
- ["coalesce", ["get", "fontSize"], 14],
8702
- ["==", ["get", "isTraceLabel"], true],
8703
- 14,
8704
- 12
8705
- ],
8706
- // Text features: center anchor; others: top anchor
8707
- "text-anchor": ["case", ["==", ["get", "kind"], "text"], "center", "top"],
8708
- "text-offset": ["case", ["==", ["get", "kind"], "text"], ["literal", [0, 0]], ["literal", [0, 0.8]]],
8709
9223
  // Native collision-based de-overlap.
8710
9224
  //
8711
9225
  // History: a prior PR turned collision off (`text-allow-overlap: true`)
@@ -8732,40 +9246,28 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
8732
9246
  "text-allow-overlap": false,
8733
9247
  "text-ignore-placement": false,
8734
9248
  "text-optional": true,
8735
- "text-padding": 2,
8736
9249
  // Lower value = higher collision priority (placed first).
8737
9250
  // Computed per-feature in syncFeaturesToCustomLayers.
8738
- "symbol-sort-key": ["coalesce", ["get", "_labelPriority"], 100],
8739
- // Bold font for text features with fontWeight=bold, trace labels, others regular
8740
- "text-font": [
8741
- "case",
8742
- ["all", ["==", ["get", "kind"], "text"], ["==", ["get", "fontWeight"], "bold"]],
8743
- ["literal", ["Montserrat SemiBold", "Noto Sans Regular"]],
8744
- ["==", ["get", "isTraceLabel"], true],
8745
- ["literal", ["Montserrat Medium", "Noto Sans Regular"]],
8746
- ["literal", ["Montserrat Regular", "Noto Sans Regular"]]
8747
- ]
9251
+ "symbol-sort-key": ["coalesce", ["get", "_labelPriority"], 100]
8748
9252
  },
8749
- paint: {
8750
- // Text features use fontColor; others use default
8751
- "text-color": [
8752
- "case",
8753
- ["==", ["get", "kind"], "text"],
8754
- ["coalesce", ["get", "fontColor"], "#000000"],
8755
- "#1f2937"
8756
- ],
8757
- "text-halo-color": "#ffffff",
8758
- // Thicker halo for trace labels and text features
8759
- "text-halo-width": [
8760
- "case",
8761
- ["==", ["get", "kind"], "text"],
8762
- 2,
8763
- ["==", ["get", "isTraceLabel"], true],
8764
- 2,
8765
- 1.5
8766
- ],
8767
- "text-opacity": ["*", 0.9, ["get", "stroke-opacity"]]
8768
- }
9253
+ paint: buildCustomLabelPaint()
9254
+ });
9255
+ mapInstance.addLayer({
9256
+ id: "custom-labels-pinned",
9257
+ type: "symbol",
9258
+ source: "custom-features",
9259
+ filter: PINNED_LABEL_FILTER,
9260
+ layout: {
9261
+ ...buildCustomLabelLayout(),
9262
+ "visibility": "visible",
9263
+ "text-allow-overlap": true,
9264
+ "text-ignore-placement": true,
9265
+ // With allow-overlap the collision pass is gone and the key only
9266
+ // orders painting, where HIGHER paints on top — negate so important
9267
+ // (low-priority-value) labels draw over their neighbours' halos.
9268
+ "symbol-sort-key": ["*", -1, ["coalesce", ["get", "_labelPriority"], 100]]
9269
+ },
9270
+ paint: buildCustomLabelPaint()
8769
9271
  });
8770
9272
  mapInstance.addSource("arrow-heads", {
8771
9273
  type: "geojson",
@@ -9591,7 +10093,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
9591
10093
  scheduleSync();
9592
10094
  });
9593
10095
  mapInstance.on("click", (e) => {
9594
- var _a;
10096
+ var _a, _b;
9595
10097
  if (!enableSelectionRef.current) return;
9596
10098
  if (e.originalEvent.button !== 0) return;
9597
10099
  if (contextMenuFiredRef.current) return;
@@ -9600,14 +10102,24 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
9600
10102
  const features = mapInstance.queryRenderedFeatures(e.point, {
9601
10103
  layers: ["custom-polygon-fill", "custom-line", "custom-point"]
9602
10104
  });
10105
+ let clusteredFeatureId = null;
9603
10106
  if (features.length === 0) {
9604
- if (selectedFeatureIdsRef.current.length > 0 && !isModifierKey) {
9605
- applySelectionState([]);
10107
+ const clusterOverlayIds = layersRef.current.filter((l) => {
10108
+ var _a2;
10109
+ return (_a2 = l.clusterConfig) == null ? void 0 : _a2.enabled;
10110
+ }).flatMap((l) => [`clusters-${l.id}`, `cluster-single-${l.id}`, `cluster-single-count-${l.id}`, `unclustered-point-${l.id}`]).filter((id) => mapInstance.getLayer(id));
10111
+ const clusterHit = clusterOverlayIds.length > 0 ? mapInstance.queryRenderedFeatures(e.point, { layers: clusterOverlayIds })[0] : void 0;
10112
+ if (!clusterHit) {
10113
+ if (selectedFeatureIdsRef.current.length > 0 && !isModifierKey) {
10114
+ applySelectionState([]);
10115
+ }
10116
+ return;
9606
10117
  }
9607
- return;
10118
+ const memberId = (_a = clusterHit.properties) == null ? void 0 : _a[CLUSTER_MEMBER_ID_PROP];
10119
+ if (memberId == null || memberId === "") return;
10120
+ clusteredFeatureId = String(memberId);
9608
10121
  }
9609
- const hitFeature = features[0];
9610
- const featureId = (_a = hitFeature.properties) == null ? void 0 : _a.id;
10122
+ const featureId = clusteredFeatureId ?? ((_b = features[0].properties) == null ? void 0 : _b.id);
9611
10123
  if (!featureId) return;
9612
10124
  let isReadOnly = false;
9613
10125
  readOnlyFeatures.current.forEach((layerFeatures) => {
@@ -10908,10 +11420,17 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
10908
11420
  scheduleSync();
10909
11421
  scheduleTimelineUpdate();
10910
11422
  setFeatureUpdateCounter((c) => c + 1);
11423
+ if (hasRealChange && !(options == null ? void 0 : options.fromRefresh) && layersRef.current.some((l) => {
11424
+ var _a2;
11425
+ return (_a2 = l.clusterConfig) == null ? void 0 : _a2.enabled;
11426
+ })) {
11427
+ setClusterDataVersion((c) => c + 1);
11428
+ }
10911
11429
  const updated = draw.current.get(featureId);
10912
11430
  if (updated) onFeatureUpdate == null ? void 0 : onFeatureUpdate(updated);
10913
11431
  } else {
10914
11432
  let updatedFeature;
11433
+ let anyRealChange = false;
10915
11434
  readOnlyFeatures.current.forEach((features, layerId) => {
10916
11435
  var _a2;
10917
11436
  const idx = features.findIndex((f) => String(f.id) === featureId);
@@ -10923,6 +11442,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
10923
11442
  const oldVal = (_a3 = f.properties) == null ? void 0 : _a3[key];
10924
11443
  if (JSON.stringify(oldVal) !== JSON.stringify(value)) hasRealChange = true;
10925
11444
  });
11445
+ if (hasRealChange) anyRealChange = true;
10926
11446
  const currentUnsaved = (_a2 = f.properties) == null ? void 0 : _a2._unsaved;
10927
11447
  const nextProperties = { ...f.properties, ...normalizedProperties };
10928
11448
  if (!externalPersistence && hasRealChange && currentUnsaved !== false && !(options == null ? void 0 : options.fromRefresh)) {
@@ -10943,6 +11463,12 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
10943
11463
  scheduleSync();
10944
11464
  scheduleTimelineUpdate();
10945
11465
  setFeatureUpdateCounter((c) => c + 1);
11466
+ if (anyRealChange && !(options == null ? void 0 : options.fromRefresh) && layersRef.current.some((l) => {
11467
+ var _a2;
11468
+ return (_a2 = l.clusterConfig) == null ? void 0 : _a2.enabled;
11469
+ })) {
11470
+ setClusterDataVersion((c) => c + 1);
11471
+ }
10946
11472
  onFeatureUpdate == null ? void 0 : onFeatureUpdate(updatedFeature);
10947
11473
  }
10948
11474
  }
@@ -10970,6 +11496,12 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
10970
11496
  draw.current.changeMode("simple_select", { featureIds: [featureId] });
10971
11497
  scheduleSync();
10972
11498
  setFeatureUpdateCounter((c) => c + 1);
11499
+ if (layersRef.current.some((l) => {
11500
+ var _a;
11501
+ return (_a = l.clusterConfig) == null ? void 0 : _a.enabled;
11502
+ })) {
11503
+ setClusterDataVersion((c) => c + 1);
11504
+ }
10973
11505
  const updated = draw.current.get(featureId);
10974
11506
  if (updated) {
10975
11507
  onFeatureUpdate == null ? void 0 : onFeatureUpdate(updated);
@@ -11324,11 +11856,17 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
11324
11856
  try {
11325
11857
  if (firstVisibleBasemapSymbol) {
11326
11858
  m.moveLayer("custom-labels", firstVisibleBasemapSymbol.id);
11859
+ if (m.getLayer("custom-labels-pinned")) {
11860
+ m.moveLayer("custom-labels-pinned", firstVisibleBasemapSymbol.id);
11861
+ }
11327
11862
  if (m.getLayer("custom-arrow-labels")) {
11328
11863
  m.moveLayer("custom-arrow-labels", firstVisibleBasemapSymbol.id);
11329
11864
  }
11330
11865
  } else {
11331
11866
  m.moveLayer("custom-labels");
11867
+ if (m.getLayer("custom-labels-pinned")) {
11868
+ m.moveLayer("custom-labels-pinned");
11869
+ }
11332
11870
  if (m.getLayer("custom-arrow-labels")) {
11333
11871
  m.moveLayer("custom-arrow-labels");
11334
11872
  }
@@ -11633,7 +12171,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
11633
12171
  const layer = layers.find((l) => l.id === layerId);
11634
12172
  if (!layer) return [];
11635
12173
  const fieldsMap = /* @__PURE__ */ new Map();
11636
- const excludedFields = /* @__PURE__ */ new Set(["name", "startDate", "endDate", "opacity"]);
12174
+ const excludedFields = /* @__PURE__ */ new Set(["name", "startDate", "endDate", "opacity", ...STYLING_PROPERTY_KEYS]);
11637
12175
  const MAX_SAMPLES = 1e4;
11638
12176
  let features = [];
11639
12177
  if (layer.readOnly) {
@@ -11643,22 +12181,41 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
11643
12181
  } else {
11644
12182
  features = hiddenFeatures.current.get(layerId) || [];
11645
12183
  }
11646
- const sampleFeatures = features.slice(0, MAX_SAMPLES);
12184
+ const sampled = !layer.readOnly && features.length > MAX_SAMPLES;
12185
+ const sampleFeatures = layer.readOnly ? features : features.slice(0, MAX_SAMPLES);
11647
12186
  sampleFeatures.forEach((f) => {
11648
12187
  if (f && f.properties) {
11649
12188
  Object.entries(f.properties).forEach(([key, value]) => {
11650
- if (!excludedFields.has(key)) {
11651
- const isNumeric = typeof value === "number" || typeof value === "string" && value.trim() !== "" && !isNaN(Number(value));
11652
- if (!fieldsMap.has(key)) {
11653
- fieldsMap.set(key, isNumeric);
11654
- } else if (isNumeric && !fieldsMap.get(key)) {
11655
- fieldsMap.set(key, true);
11656
- }
12189
+ if (excludedFields.has(key)) return;
12190
+ let acc = fieldsMap.get(key);
12191
+ if (!acc) {
12192
+ acc = { isNumeric: false, numericCount: 0, nonEmptyCount: 0, min: Infinity, max: -Infinity };
12193
+ fieldsMap.set(key, acc);
12194
+ }
12195
+ if (typeof value === "number" || typeof value === "string" && value.trim() !== "" && !isNaN(Number(value))) {
12196
+ acc.isNumeric = true;
12197
+ }
12198
+ if (!(value == null || typeof value === "string" && value.trim() === "")) {
12199
+ acc.nonEmptyCount++;
12200
+ }
12201
+ const num = coerceFiniteNumber(value);
12202
+ if (num !== null) {
12203
+ acc.numericCount++;
12204
+ if (num < acc.min) acc.min = num;
12205
+ if (num > acc.max) acc.max = num;
11657
12206
  }
11658
12207
  });
11659
12208
  }
11660
12209
  });
11661
- return Array.from(fieldsMap.entries()).map(([name, isNumeric]) => ({ name, isNumeric })).sort((a, b) => a.name.localeCompare(b.name));
12210
+ const sampledFeatureCount = sampleFeatures.length;
12211
+ return Array.from(fieldsMap.entries()).map(([name, acc]) => ({
12212
+ name,
12213
+ isNumeric: acc.isNumeric,
12214
+ numericRatio: acc.nonEmptyCount > 0 ? acc.numericCount / acc.nonEmptyCount : 0,
12215
+ coverage: sampledFeatureCount > 0 ? acc.nonEmptyCount / sampledFeatureCount : 0,
12216
+ sampled,
12217
+ ...acc.numericCount > 0 ? { min: acc.min, max: acc.max } : {}
12218
+ })).sort((a, b) => a.name.localeCompare(b.name));
11662
12219
  }, [layers]);
11663
12220
  const getFieldValueDistribution = react.useCallback(
11664
12221
  (layerId, fieldName, maxValues = 50) => {
@@ -13406,16 +13963,33 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
13406
13963
  mapInstance.once("idle", rebuildClusters);
13407
13964
  return;
13408
13965
  }
13966
+ clusterLayerHandlers.current.forEach((handlers, layerId) => {
13967
+ const clustersLayerId = `clusters-${layerId}`;
13968
+ try {
13969
+ mapInstance.off("click", clustersLayerId, handlers.click);
13970
+ mapInstance.off("mouseenter", clustersLayerId, handlers.enter);
13971
+ mapInstance.off("mouseleave", clustersLayerId, handlers.leave);
13972
+ } catch {
13973
+ }
13974
+ });
13975
+ clusterLayerHandlers.current.clear();
13409
13976
  layers.forEach((layer) => {
13410
13977
  const sourceId = `cluster-source-${layer.id}`;
13411
13978
  const clustersLayerId = `clusters-${layer.id}`;
13412
13979
  const clusterCountLayerId = `cluster-count-${layer.id}`;
13413
13980
  const unclusteredLayerId = `unclustered-point-${layer.id}`;
13981
+ const singleValueLayerId = `cluster-single-${layer.id}`;
13982
+ const singleValueCountLayerId = `cluster-single-count-${layer.id}`;
13414
13983
  const existingPieManager = clusterPieManagers.current.get(layer.id);
13415
13984
  if (existingPieManager) {
13416
13985
  existingPieManager.destroy();
13417
13986
  clusterPieManagers.current.delete(layer.id);
13418
13987
  }
13988
+ const existingGradientManager = clusterGradientManagers.current.get(layer.id);
13989
+ if (existingGradientManager) {
13990
+ existingGradientManager.destroy();
13991
+ clusterGradientManagers.current.delete(layer.id);
13992
+ }
13419
13993
  try {
13420
13994
  if (mapInstance.getLayer(clusterCountLayerId)) {
13421
13995
  mapInstance.removeLayer(clusterCountLayerId);
@@ -13423,6 +13997,12 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
13423
13997
  if (mapInstance.getLayer(clustersLayerId)) {
13424
13998
  mapInstance.removeLayer(clustersLayerId);
13425
13999
  }
14000
+ if (mapInstance.getLayer(singleValueCountLayerId)) {
14001
+ mapInstance.removeLayer(singleValueCountLayerId);
14002
+ }
14003
+ if (mapInstance.getLayer(singleValueLayerId)) {
14004
+ mapInstance.removeLayer(singleValueLayerId);
14005
+ }
13426
14006
  if (mapInstance.getLayer(unclusteredLayerId)) {
13427
14007
  mapInstance.removeLayer(unclusteredLayerId);
13428
14008
  }
@@ -13433,12 +14013,14 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
13433
14013
  }
13434
14014
  });
13435
14015
  layers.forEach((layer) => {
13436
- var _a, _b, _c, _d;
14016
+ var _a, _b, _c, _d, _e, _f, _g;
13437
14017
  if (!((_a = layer.clusterConfig) == null ? void 0 : _a.enabled) || !layer.visible) return;
13438
14018
  const sourceId = `cluster-source-${layer.id}`;
13439
14019
  const clustersLayerId = `clusters-${layer.id}`;
13440
14020
  const clusterCountLayerId = `cluster-count-${layer.id}`;
13441
14021
  const unclusteredLayerId = `unclustered-point-${layer.id}`;
14022
+ const singleValueLayerId = `cluster-single-${layer.id}`;
14023
+ const singleValueCountLayerId = `cluster-single-count-${layer.id}`;
13442
14024
  let pointFeatures = [];
13443
14025
  if (layer.visible) {
13444
14026
  if (layer.readOnly) {
@@ -13465,10 +14047,12 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
13465
14047
  }
13466
14048
  if (pointFeatures.length === 0) return;
13467
14049
  const groupByField = (_b = layer.clusterConfig) == null ? void 0 : _b.groupByField;
14050
+ const countByField = ((_c = layer.clusterConfig) == null ? void 0 : _c.countByFieldEnabled) && ((_d = layer.clusterConfig) == null ? void 0 : _d.countByField) || null;
14051
+ const bubbleGradient = !!((_e = layer.clusterConfig) == null ? void 0 : _e.bubbleGradient) && !groupByField;
13468
14052
  const OTHER_COLOR = OTHER_BUCKET_COLOR;
13469
14053
  const MAX_CATEGORIES = 15;
13470
14054
  try {
13471
- const layerColor = ((_d = (_c = layer.visualConfig) == null ? void 0 : _c.color) == null ? void 0 : _d.fixedColor) || "#3b82f6";
14055
+ const layerColor = ((_g = (_f = layer.visualConfig) == null ? void 0 : _f.color) == null ? void 0 : _g.fixedColor) || "#3b82f6";
13472
14056
  let clusterProperties = {};
13473
14057
  let categoryValues = [];
13474
14058
  let categoryColorMap = {};
@@ -13498,12 +14082,16 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
13498
14082
  const otherExpr = topKeys.length === 0 ? 1 : ["match", fieldAsString, topKeys, 0, 1];
13499
14083
  clusterProperties[`cat_${categoryValues.length - 1}`] = ["+", otherExpr];
13500
14084
  }
14085
+ if (countByField) {
14086
+ clusterProperties[CLUSTER_SUM_PROP] = ["+", ["get", CLUSTER_COUNT_VALUE_PROP]];
14087
+ }
14088
+ const sourceFeatures = countByField ? injectClusterCountValues(pointFeatures, countByField) : pointFeatures;
13501
14089
  const mapStyleMaxZoom = typeof mapInstance.getMaxZoom === "function" ? mapInstance.getMaxZoom() : 24;
13502
14090
  const clusterMaxZoom = Math.min(24, Math.max(1, mapStyleMaxZoom - 1));
13503
14091
  const geojsonSourceMaxZoom = Math.min(24, Math.max(clusterMaxZoom + 1, mapStyleMaxZoom));
13504
14092
  mapInstance.addSource(sourceId, {
13505
14093
  type: "geojson",
13506
- data: { type: "FeatureCollection", features: pointFeatures },
14094
+ data: { type: "FeatureCollection", features: sourceFeatures },
13507
14095
  maxzoom: geojsonSourceMaxZoom,
13508
14096
  cluster: true,
13509
14097
  clusterMaxZoom,
@@ -13561,12 +14149,15 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
13561
14149
  source: sourceId,
13562
14150
  filter: ["has", "point_count"],
13563
14151
  layout: {
13564
- "text-field": ["get", "point_count_abbreviated"],
14152
+ "text-field": countByField ? clusterBadgeTextField(CLUSTER_SUM_PROP) : ["get", "point_count_abbreviated"],
13565
14153
  "text-font": ["Open Sans Bold", "Arial Unicode MS Bold"],
13566
14154
  "text-size": 12
13567
14155
  },
13568
14156
  paint: {
13569
- "text-color": "#ffffff"
14157
+ "text-color": "#ffffff",
14158
+ // The gradient's pale end needs a dark halo for the white
14159
+ // badge text to stay readable at every ramp stop.
14160
+ ...bubbleGradient ? { "text-halo-color": "#111827", "text-halo-width": 1.1 } : {}
13570
14161
  }
13571
14162
  });
13572
14163
  }
@@ -13581,7 +14172,9 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
13581
14172
  id: unclusteredLayerId,
13582
14173
  type: "circle",
13583
14174
  source: sourceId,
13584
- filter: ["!", ["has", "point_count"]],
14175
+ // With count-by-field on, points whose value exceeds 1 render as
14176
+ // value bubbles below instead of plain dots.
14177
+ filter: countByField ? ["all", ["!", ["has", "point_count"]], ["<=", ["get", CLUSTER_COUNT_VALUE_PROP], 1]] : ["!", ["has", "point_count"]],
13585
14178
  paint: {
13586
14179
  "circle-color": unclusteredColor,
13587
14180
  "circle-radius": 6,
@@ -13589,7 +14182,50 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
13589
14182
  "circle-stroke-color": "#ffffff"
13590
14183
  }
13591
14184
  });
13592
- mapInstance.on("click", clustersLayerId, async (e) => {
14185
+ if (countByField) {
14186
+ const singleValueFilter = ["all", ["!", ["has", "point_count"]], [">", ["get", CLUSTER_COUNT_VALUE_PROP], 1]];
14187
+ mapInstance.addLayer({
14188
+ id: singleValueLayerId,
14189
+ type: "circle",
14190
+ source: sourceId,
14191
+ filter: singleValueFilter,
14192
+ paint: {
14193
+ "circle-color": unclusteredColor,
14194
+ "circle-radius": 14,
14195
+ "circle-stroke-width": 2,
14196
+ "circle-stroke-color": "#ffffff"
14197
+ }
14198
+ });
14199
+ mapInstance.addLayer({
14200
+ id: singleValueCountLayerId,
14201
+ type: "symbol",
14202
+ source: sourceId,
14203
+ filter: singleValueFilter,
14204
+ layout: {
14205
+ "text-field": clusterBadgeTextField(CLUSTER_COUNT_VALUE_PROP),
14206
+ "text-font": ["Open Sans Bold", "Arial Unicode MS Bold"],
14207
+ "text-size": 11,
14208
+ // A bubble without its number reads as broken - never cull.
14209
+ "text-allow-overlap": true,
14210
+ "text-ignore-placement": true
14211
+ },
14212
+ paint: {
14213
+ "text-color": "#ffffff",
14214
+ ...bubbleGradient ? { "text-halo-color": "#111827", "text-halo-width": 1.1 } : {}
14215
+ }
14216
+ });
14217
+ }
14218
+ if (bubbleGradient) {
14219
+ clusterGradientManagers.current.set(
14220
+ layer.id,
14221
+ createClusterGradientManager(mapInstance, sourceId, {
14222
+ clustersLayerId,
14223
+ valueProp: countByField ? CLUSTER_SUM_PROP : null,
14224
+ ...countByField ? { singleLayerId: singleValueLayerId } : {}
14225
+ })
14226
+ );
14227
+ }
14228
+ const handleClusterClick = async (e) => {
13593
14229
  var _a2;
13594
14230
  const features = mapInstance.queryRenderedFeatures(e.point, {
13595
14231
  layers: [clustersLayerId]
@@ -13608,12 +14244,20 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
13608
14244
  }
13609
14245
  } catch {
13610
14246
  }
13611
- });
13612
- mapInstance.on("mouseenter", clustersLayerId, () => {
14247
+ };
14248
+ const handleClusterMouseEnter = () => {
13613
14249
  mapInstance.getCanvas().style.cursor = "pointer";
13614
- });
13615
- mapInstance.on("mouseleave", clustersLayerId, () => {
14250
+ };
14251
+ const handleClusterMouseLeave = () => {
13616
14252
  mapInstance.getCanvas().style.cursor = "";
14253
+ };
14254
+ mapInstance.on("click", clustersLayerId, handleClusterClick);
14255
+ mapInstance.on("mouseenter", clustersLayerId, handleClusterMouseEnter);
14256
+ mapInstance.on("mouseleave", clustersLayerId, handleClusterMouseLeave);
14257
+ clusterLayerHandlers.current.set(layer.id, {
14258
+ click: handleClusterClick,
14259
+ enter: handleClusterMouseEnter,
14260
+ leave: handleClusterMouseLeave
13617
14261
  });
13618
14262
  } catch (e) {
13619
14263
  console.warn("Error creating cluster layer:", e);
@@ -13631,7 +14275,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
13631
14275
  } catch {
13632
14276
  }
13633
14277
  };
13634
- }, [isMapLoaded, layers, currentMapStyle, hashStringToColor$1]);
14278
+ }, [isMapLoaded, layers, currentMapStyle, hashStringToColor$1, clusterDataVersion]);
13635
14279
  if (mapError) {
13636
14280
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `flex items-center justify-center h-full bg-muted/30 ${className || ""}`, "data-testid": "map-error", children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Card, { className: "max-w-md", children: [
13637
14281
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4 border-b border-border", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
@@ -15151,40 +15795,6 @@ function DebugSidebar({ onAddRandomPoints, onImportKML, onAddDomMarkers, onRemov
15151
15795
  }
15152
15796
  );
15153
15797
  }
15154
- const INTERNAL_PROPERTY_KEYS = /* @__PURE__ */ new Set([
15155
- "fill",
15156
- "fill-opacity",
15157
- "pointRadius",
15158
- "pointIcon",
15159
- "pointIconSize",
15160
- "circleCenter",
15161
- "circleRadius",
15162
- "icon",
15163
- "iconSize",
15164
- "fontSize",
15165
- "fontColor",
15166
- "fontWeight",
15167
- "arrowSize",
15168
- "label",
15169
- "entityType",
15170
- "kind",
15171
- "meta:type",
15172
- "stroke",
15173
- "stroke-width",
15174
- "stroke-opacity"
15175
- ]);
15176
- const INTERNAL_PROPERTY_PREFIXES = [
15177
- "IsHiddenBy",
15178
- "isHidden",
15179
- "isSelected",
15180
- "isTrace",
15181
- "isTimeline",
15182
- "trace"
15183
- ];
15184
- function isInternalProperty(key) {
15185
- if (INTERNAL_PROPERTY_KEYS.has(key)) return true;
15186
- return INTERNAL_PROPERTY_PREFIXES.some((prefix) => key.startsWith(prefix));
15187
- }
15188
15798
  exports.ActionPanel = ActionPanel;
15189
15799
  exports.ClusterPieManager = ClusterPieManager;
15190
15800
  exports.ColorPickerPopover = ColorPickerPopover;