@octostar/map-component 0.1.28 → 0.1.30

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
@@ -1745,6 +1745,7 @@ function LayersPanel({
1745
1745
  hideBasemapSwitcher = false,
1746
1746
  externalPersistence = false,
1747
1747
  customGlobalMenuItems,
1748
+ extraLayerToolbarButtons,
1748
1749
  layerBadgeProvider,
1749
1750
  featureCountProvider
1750
1751
  }) {
@@ -2050,12 +2051,11 @@ function LayersPanel({
2050
2051
  size: "small",
2051
2052
  checked: ((_d = layer.heatmapConfig) == null ? void 0 : _d.enabled) ?? false,
2052
2053
  onChange: (checked) => {
2053
- var _a2, _b2, _c2;
2054
+ var _a2, _b2;
2054
2055
  return onUpdateHeatmapConfig(layer.id, {
2055
2056
  enabled: checked,
2056
2057
  intensity: ((_a2 = layer.heatmapConfig) == null ? void 0 : _a2.intensity) ?? 1,
2057
- radius: ((_b2 = layer.heatmapConfig) == null ? void 0 : _b2.radius) ?? 20,
2058
- hideFeatures: ((_c2 = layer.heatmapConfig) == null ? void 0 : _c2.hideFeatures) ?? false
2058
+ radius: ((_b2 = layer.heatmapConfig) == null ? void 0 : _b2.radius) ?? 20
2059
2059
  });
2060
2060
  },
2061
2061
  "data-testid": `switch-heatmap-${layer.id}`
@@ -2097,20 +2097,6 @@ function LayersPanel({
2097
2097
  })
2098
2098
  }
2099
2099
  )
2100
- ] }),
2101
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
2102
- /* @__PURE__ */ jsxRuntime.jsx(
2103
- antd.Switch,
2104
- {
2105
- size: "small",
2106
- checked: layer.heatmapConfig.hideFeatures ?? false,
2107
- onChange: (checked) => onUpdateHeatmapConfig(layer.id, {
2108
- ...layer.heatmapConfig,
2109
- hideFeatures: checked
2110
- })
2111
- }
2112
- ),
2113
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px]", children: "Hide points" })
2114
2100
  ] })
2115
2101
  ] })
2116
2102
  ] }),
@@ -2536,6 +2522,7 @@ function LayersPanel({
2536
2522
  ) })
2537
2523
  }
2538
2524
  ),
2525
+ extraLayerToolbarButtons,
2539
2526
  /* @__PURE__ */ jsxRuntime.jsx(
2540
2527
  antd.Dropdown,
2541
2528
  {
@@ -2818,6 +2805,56 @@ function getFeatureTypeIcon(geometryType, kind, size = "sm") {
2818
2805
  return null;
2819
2806
  }
2820
2807
  }
2808
+ function colorPickerNoHexPanel(_panel, extra) {
2809
+ const { Picker, Presets } = extra.components;
2810
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2 min-w-[220px]", children: [
2811
+ /* @__PURE__ */ jsxRuntime.jsx(Picker, {}),
2812
+ /* @__PURE__ */ jsxRuntime.jsx(Presets, {})
2813
+ ] });
2814
+ }
2815
+ function LatLngFields(props) {
2816
+ const { latitude, longitude, isEditable, testIdPrefix } = props;
2817
+ if (!isEditable) {
2818
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2819
+ "div",
2820
+ {
2821
+ className: "flex items-center gap-2 text-[13px] font-mono text-foreground px-1 py-1",
2822
+ "data-testid": `${testIdPrefix}-display`,
2823
+ children: [
2824
+ /* @__PURE__ */ jsxRuntime.jsx("span", { "data-testid": `${testIdPrefix}-latitude-text`, children: latitude || "—" }),
2825
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "/" }),
2826
+ /* @__PURE__ */ jsxRuntime.jsx("span", { "data-testid": `${testIdPrefix}-longitude-text`, children: longitude || "—" })
2827
+ ]
2828
+ }
2829
+ );
2830
+ }
2831
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-1", children: [
2832
+ /* @__PURE__ */ jsxRuntime.jsx(
2833
+ antd.Input,
2834
+ {
2835
+ value: latitude,
2836
+ onChange: (e) => props.onLatChange(e.target.value),
2837
+ onFocus: props.onLatFocus,
2838
+ onBlur: props.onLatBlur,
2839
+ placeholder: "Latitude",
2840
+ className: "!h-6 text-[13px] flex-1",
2841
+ "data-testid": `${testIdPrefix}-latitude`
2842
+ }
2843
+ ),
2844
+ /* @__PURE__ */ jsxRuntime.jsx(
2845
+ antd.Input,
2846
+ {
2847
+ value: longitude,
2848
+ onChange: (e) => props.onLngChange(e.target.value),
2849
+ onFocus: props.onLngFocus,
2850
+ onBlur: props.onLngBlur,
2851
+ placeholder: "Longitude",
2852
+ className: "!h-6 text-[13px] flex-1",
2853
+ "data-testid": `${testIdPrefix}-longitude`
2854
+ }
2855
+ )
2856
+ ] });
2857
+ }
2821
2858
  function PointColorDot({ color, size = 20 }) {
2822
2859
  return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 20 20", className: "shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "10", cy: "10", r: "7", fill: color, stroke: color, strokeWidth: "2", opacity: "0.9" }) });
2823
2860
  }
@@ -2871,8 +2908,21 @@ const RECORD_EXCLUDE_KEYS = /* @__PURE__ */ new Set([
2871
2908
  "entityType",
2872
2909
  "startDate",
2873
2910
  "endDate",
2874
- "description"
2911
+ // The feature's color is already conveyed by the colored dot in the panel
2912
+ // header; showing it again as a property row (`#0C66E4`) is just noise.
2913
+ "color"
2914
+ // NOTE: 'description' intentionally NOT excluded — we surface it as a regular
2915
+ // property row instead of giving it its own labelled section.
2875
2916
  ]);
2917
+ function buildKeyExclusionPredicate(set) {
2918
+ const lowered = new Set(Array.from(set, (k) => k.toLowerCase()));
2919
+ return (key) => {
2920
+ if (set.has(key)) return true;
2921
+ const normalized = key.toLowerCase().replace(/^[^a-z0-9_-]+/, "");
2922
+ return lowered.has(normalized);
2923
+ };
2924
+ }
2925
+ const isExcludedRecordKey = buildKeyExclusionPredicate(RECORD_EXCLUDE_KEYS);
2876
2926
  const RECORD_FIELDS_HIDDEN_PREFIXES = ["_", "os_"];
2877
2927
  function parseRecordFields(feature) {
2878
2928
  const raw = feature.properties._recordFields;
@@ -2899,14 +2949,14 @@ function RecordFieldsSection({ feature }) {
2899
2949
  antd.Collapse,
2900
2950
  {
2901
2951
  size: "small",
2902
- defaultActiveKey: ["record-fields"],
2952
+ defaultActiveKey: [],
2903
2953
  ghost: true,
2904
2954
  className: "[&_.ant-collapse-header]:!px-0 [&_.ant-collapse-header]:!py-1 [&_.ant-collapse-content-box]:!px-0 [&_.ant-collapse-content-box]:!py-1",
2905
2955
  items: [{
2906
2956
  key: "record-fields",
2907
2957
  label: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
2908
2958
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Info, { className: "w-3 h-3 text-foreground" }),
2909
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-medium", children: "Record Fields" }),
2959
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] font-bold uppercase tracking-wide text-foreground", children: "Record Fields" }),
2910
2960
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-[10px] text-muted-foreground ml-1", children: [
2911
2961
  "(",
2912
2962
  fields.length,
@@ -3056,10 +3106,46 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
3056
3106
  setLatitude("");
3057
3107
  }
3058
3108
  }
3059
- const reserved = ["name", "description", "startDate", "endDate", "stroke", "stroke-width", "stroke-opacity", "fill", "fill-opacity", "kind", "label", "fontSize", "fontColor", "fontWeight", "arrowSize", "circleCenter", "circleRadius", "icon", "iconSize", "pointIcon", "pointIconSize", "entityType", "entity_id", "entity_type", "entity_label", "os_workspace", "workspace", "source_name", "id", "latitude", "longitude"];
3109
+ const reserved = /* @__PURE__ */ new Set([
3110
+ "name",
3111
+ "description",
3112
+ "startDate",
3113
+ "endDate",
3114
+ "stroke",
3115
+ "stroke-width",
3116
+ "stroke-opacity",
3117
+ "fill",
3118
+ "fill-opacity",
3119
+ "kind",
3120
+ "label",
3121
+ "fontSize",
3122
+ "fontColor",
3123
+ "fontWeight",
3124
+ "arrowSize",
3125
+ "circleCenter",
3126
+ "circleRadius",
3127
+ "icon",
3128
+ "iconSize",
3129
+ "pointIcon",
3130
+ "pointIconSize",
3131
+ "entityType",
3132
+ "entity_id",
3133
+ "entity_type",
3134
+ "entity_label",
3135
+ "os_workspace",
3136
+ "workspace",
3137
+ "source_name",
3138
+ "id",
3139
+ "latitude",
3140
+ "longitude",
3141
+ // The marker color is shown via the colored dot in the panel header,
3142
+ // so we don't repeat it as an editable property row.
3143
+ "color"
3144
+ ]);
3145
+ const isReservedKey = buildKeyExclusionPredicate(reserved);
3060
3146
  const custom = [];
3061
3147
  Object.entries(feature.properties).forEach(([key, value]) => {
3062
- if (!reserved.includes(key) && value !== void 0 && value !== null && !key.startsWith("_") && !key.startsWith("os_") && !key.startsWith("isHidden")) {
3148
+ if (!isReservedKey(key) && value !== void 0 && value !== null && !key.startsWith("_") && !key.startsWith("os_") && !key.startsWith("isHidden")) {
3063
3149
  custom.push({ key, value: String(value) });
3064
3150
  }
3065
3151
  });
@@ -3243,7 +3329,7 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
3243
3329
  handleRefresh(true);
3244
3330
  }, [feature == null ? void 0 : feature.id, isRecord, featureRefreshProvider, feature, handleRefresh]);
3245
3331
  const recordProperties = feature ? Object.entries(feature.properties).filter(
3246
- ([key, value]) => !RECORD_EXCLUDE_KEYS.has(key) && value !== void 0 && value !== null && !key.startsWith("_") && !key.startsWith("isHidden")
3332
+ ([key, value]) => !isExcludedRecordKey(key) && value !== void 0 && value !== null && !key.startsWith("_") && !key.startsWith("os_") && !key.startsWith("isHidden")
3247
3333
  ).map(([key, value]) => ({ key, value: String(value) })) : [];
3248
3334
  const entityCardsContent = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2 space-y-2", children: entityCardProvider ? selectedFeatures.map((f) => {
3249
3335
  const geoFeature = {
@@ -3260,7 +3346,7 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
3260
3346
  return /* @__PURE__ */ jsxRuntime.jsxs(
3261
3347
  "div",
3262
3348
  {
3263
- className: "absolute top-4 right-4 z-10 w-72 bg-background/95 floating-panel rounded-lg shadow-lg border border-border",
3349
+ className: "absolute top-4 right-4 z-10 w-80 bg-background/95 floating-panel rounded-lg shadow-lg border border-border",
3264
3350
  "data-testid": "panel-properties",
3265
3351
  children: [
3266
3352
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2 px-2.5 py-2 border-b border-border", children: [
@@ -3296,21 +3382,20 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
3296
3382
  onMoveFeaturesToLayer && /* @__PURE__ */ jsxRuntime.jsx(antd.Dropdown, { menu: { items: buildLayerMenuItems("move") }, trigger: ["click"], placement: "bottomRight", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Tooltip, { title: "Move to layer", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "text", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.FolderInput, { className: "w-3.5 h-3.5" }), className: "!w-5 !h-5 !min-w-0 !p-0", "data-testid": "button-move-to-layer-prop" }) }) })
3297
3383
  ] })
3298
3384
  ] }),
3299
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5 flex-wrap", children: [
3300
- isRecord ? /* @__PURE__ */ jsxRuntime.jsx(antd.Tag, { color: "cyan", className: "!text-[10px] !px-1.5 !py-0 !leading-4 !m-0", children: "Octostar record" }) : /* @__PURE__ */ jsxRuntime.jsx(antd.Tag, { color: "blue", className: "!text-[10px] !px-1.5 !py-0 !leading-4 !m-0", children: "Local map feature" }),
3301
- isUnsaved && /* @__PURE__ */ jsxRuntime.jsx(antd.Tag, { color: "orange", className: "!text-[10px] !px-1.5 !py-0 !leading-4 !border-0 !m-0", children: "unsaved" }),
3385
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 flex-wrap", children: [
3386
+ isRecord ? /* @__PURE__ */ jsxRuntime.jsx(antd.Tag, { color: "cyan", className: "!text-[12px] !px-2.5 !py-0.5 !leading-5 !m-0 !font-semibold", children: "Octostar record" }) : /* @__PURE__ */ jsxRuntime.jsx(antd.Tag, { color: "blue", className: "!text-[12px] !px-2.5 !py-0.5 !leading-5 !m-0 !font-semibold", children: "Local map feature" }),
3387
+ isUnsaved && /* @__PURE__ */ jsxRuntime.jsx(antd.Tag, { color: "orange", className: "!text-[12px] !px-2.5 !py-0.5 !leading-5 !border-0 !m-0 !font-semibold", children: "Unsaved" }),
3302
3388
  !isRecord && featureSaveProvider && /* @__PURE__ */ jsxRuntime.jsx(
3303
3389
  antd.Button,
3304
3390
  {
3305
3391
  type: "primary",
3306
- size: "small",
3307
- icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Save, { className: "w-3 h-3" }),
3392
+ size: "middle",
3393
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Save, { className: "w-3.5 h-3.5" }),
3308
3394
  loading: isSaving,
3309
3395
  onClick: handleFeatureSave,
3310
- className: "!h-5 !px-1.5 !text-[11px]",
3311
- style: { padding: "1px 6px" },
3396
+ className: "!h-7 !px-3 !text-[12px] !font-medium",
3312
3397
  "data-testid": "button-save-feature",
3313
- children: "Create entity…"
3398
+ children: "Create entity"
3314
3399
  }
3315
3400
  )
3316
3401
  ] })
@@ -3394,92 +3479,57 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
3394
3479
  /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-xs text-muted-foreground", children: "Lat / Lng" }),
3395
3480
  feature.geometry.type !== "Point" && /* @__PURE__ */ jsxRuntime.jsx(antd.Tooltip, { title: "Lat and Lng refer to the centroid of this feature", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[13px] text-muted-foreground cursor-help", children: "*" }) })
3396
3481
  ] }),
3397
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-1", children: [
3398
- /* @__PURE__ */ jsxRuntime.jsx(
3399
- antd.Input,
3400
- {
3401
- value: latitude,
3402
- onChange: (e) => setLatitude(e.target.value),
3403
- onFocus: () => {
3404
- latInputFocused.current = true;
3405
- },
3406
- onBlur: () => {
3407
- latInputFocused.current = false;
3408
- if (feature.geometry.type === "Point" && isEditMode && !isReadOnlyLayer && onUpdateGeometry) {
3409
- const lat = parseFloat(latitude);
3410
- const lng = parseFloat(longitude);
3411
- const coords = feature.geometry.coordinates;
3412
- if (isNaN(lat)) {
3413
- toast({ title: "Invalid latitude", description: "Please enter a valid number", variant: "destructive" });
3414
- setLatitude(coords[1].toFixed(6));
3415
- } else if (lat < -90 || lat > 90) {
3416
- toast({ title: "Invalid latitude", description: "Latitude must be between -90 and 90", variant: "destructive" });
3417
- setLatitude(coords[1].toFixed(6));
3418
- } else if (isNaN(lng) || lng < -180 || lng > 180) ;
3419
- else {
3420
- onUpdateGeometry(feature.id, {
3421
- type: "Point",
3422
- coordinates: [lng, lat]
3423
- });
3424
- }
3482
+ /* @__PURE__ */ jsxRuntime.jsx(
3483
+ LatLngFields,
3484
+ {
3485
+ latitude,
3486
+ longitude,
3487
+ isEditable: feature.geometry.type === "Point" && isEditMode && !isReadOnlyLayer,
3488
+ testIdPrefix: "input-feature",
3489
+ onLatChange: setLatitude,
3490
+ onLngChange: setLongitude,
3491
+ onLatFocus: () => {
3492
+ latInputFocused.current = true;
3493
+ },
3494
+ onLngFocus: () => {
3495
+ lngInputFocused.current = true;
3496
+ },
3497
+ onLatBlur: () => {
3498
+ latInputFocused.current = false;
3499
+ if (feature.geometry.type === "Point" && isEditMode && !isReadOnlyLayer && onUpdateGeometry) {
3500
+ const lat = parseFloat(latitude);
3501
+ const lng = parseFloat(longitude);
3502
+ const coords = feature.geometry.coordinates;
3503
+ if (isNaN(lat)) {
3504
+ toast({ title: "Invalid latitude", description: "Please enter a valid number", variant: "destructive" });
3505
+ setLatitude(coords[1].toFixed(6));
3506
+ } else if (lat < -90 || lat > 90) {
3507
+ toast({ title: "Invalid latitude", description: "Latitude must be between -90 and 90", variant: "destructive" });
3508
+ setLatitude(coords[1].toFixed(6));
3509
+ } else if (isNaN(lng) || lng < -180 || lng > 180) ;
3510
+ else {
3511
+ onUpdateGeometry(feature.id, { type: "Point", coordinates: [lng, lat] });
3425
3512
  }
3426
- },
3427
- placeholder: "Latitude",
3428
- readOnly: feature.geometry.type !== "Point" || !isEditMode || isReadOnlyLayer,
3429
- className: "!h-6 text-[13px] flex-1",
3430
- "data-testid": "input-feature-latitude"
3431
- }
3432
- ),
3433
- /* @__PURE__ */ jsxRuntime.jsx(
3434
- antd.Input,
3435
- {
3436
- value: longitude,
3437
- onChange: (e) => setLongitude(e.target.value),
3438
- onFocus: () => {
3439
- lngInputFocused.current = true;
3440
- },
3441
- onBlur: () => {
3442
- lngInputFocused.current = false;
3443
- if (feature.geometry.type === "Point" && isEditMode && !isReadOnlyLayer && onUpdateGeometry) {
3444
- const lat = parseFloat(latitude);
3445
- const lng = parseFloat(longitude);
3446
- const coords = feature.geometry.coordinates;
3447
- if (isNaN(lng)) {
3448
- toast({ title: "Invalid longitude", description: "Please enter a valid number", variant: "destructive" });
3449
- setLongitude(coords[0].toFixed(6));
3450
- } else if (lng < -180 || lng > 180) {
3451
- toast({ title: "Invalid longitude", description: "Longitude must be between -180 and 180", variant: "destructive" });
3452
- setLongitude(coords[0].toFixed(6));
3453
- } else if (isNaN(lat) || lat < -90 || lat > 90) ;
3454
- else {
3455
- onUpdateGeometry(feature.id, {
3456
- type: "Point",
3457
- coordinates: [lng, lat]
3458
- });
3459
- }
3513
+ }
3514
+ },
3515
+ onLngBlur: () => {
3516
+ lngInputFocused.current = false;
3517
+ if (feature.geometry.type === "Point" && isEditMode && !isReadOnlyLayer && onUpdateGeometry) {
3518
+ const lat = parseFloat(latitude);
3519
+ const lng = parseFloat(longitude);
3520
+ const coords = feature.geometry.coordinates;
3521
+ if (isNaN(lng)) {
3522
+ toast({ title: "Invalid longitude", description: "Please enter a valid number", variant: "destructive" });
3523
+ setLongitude(coords[0].toFixed(6));
3524
+ } else if (lng < -180 || lng > 180) {
3525
+ toast({ title: "Invalid longitude", description: "Longitude must be between -180 and 180", variant: "destructive" });
3526
+ setLongitude(coords[0].toFixed(6));
3527
+ } else if (isNaN(lat) || lat < -90 || lat > 90) ;
3528
+ else {
3529
+ onUpdateGeometry(feature.id, { type: "Point", coordinates: [lng, lat] });
3460
3530
  }
3461
- },
3462
- placeholder: "Longitude",
3463
- readOnly: feature.geometry.type !== "Point" || !isEditMode || isReadOnlyLayer,
3464
- className: "!h-6 text-[13px] flex-1",
3465
- "data-testid": "input-feature-longitude"
3531
+ }
3466
3532
  }
3467
- )
3468
- ] })
3469
- ] }),
3470
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-0.5", children: [
3471
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "feature-description", className: "text-xs text-muted-foreground", children: "Description" }),
3472
- /* @__PURE__ */ jsxRuntime.jsx(
3473
- TextArea,
3474
- {
3475
- id: "feature-description",
3476
- value: description,
3477
- onChange: (e) => setDescription(e.target.value),
3478
- onBlur: () => handleSave(),
3479
- placeholder: isEditMode ? "Add description..." : "No description",
3480
- className: "!min-h-[50px] resize-none text-[13px]",
3481
- readOnly: !isEditMode,
3482
- "data-testid": "input-feature-description"
3483
3533
  }
3484
3534
  )
3485
3535
  ] }),
@@ -3495,7 +3545,7 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
3495
3545
  key: "temporal",
3496
3546
  label: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
3497
3547
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Calendar, { className: "w-3 h-3 text-foreground" }),
3498
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-medium", children: "Temporal" }),
3548
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] font-bold uppercase tracking-wide text-foreground", children: "Temporal" }),
3499
3549
  (startDate || endDate) && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-[10px] text-muted-foreground ml-1", children: [
3500
3550
  "(",
3501
3551
  startDate && endDate ? "2 dates" : "1 date",
@@ -3582,10 +3632,10 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
3582
3632
  }
3583
3633
  ),
3584
3634
  /* @__PURE__ */ jsxRuntime.jsx(antd.Divider, { className: "!my-1.5" }),
3585
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
3635
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
3586
3636
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
3587
3637
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Palette, { className: "w-3 h-3 text-foreground" }),
3588
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-medium", children: "Style" })
3638
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] font-bold uppercase tracking-wide text-foreground", children: "Style" })
3589
3639
  ] }),
3590
3640
  feature.properties.kind === "text" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
3591
3641
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
@@ -3702,6 +3752,8 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
3702
3752
  disabled: !isEditMode,
3703
3753
  size: "small",
3704
3754
  showText: false,
3755
+ disabledAlpha: true,
3756
+ panelRender: colorPickerNoHexPanel,
3705
3757
  "data-testid": "color-picker-stroke"
3706
3758
  }
3707
3759
  ) }) }),
@@ -3776,6 +3828,8 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
3776
3828
  disabled: !isEditMode,
3777
3829
  size: "small",
3778
3830
  showText: false,
3831
+ disabledAlpha: true,
3832
+ panelRender: colorPickerNoHexPanel,
3779
3833
  "data-testid": "color-picker-fill"
3780
3834
  }
3781
3835
  ) }) }),
@@ -3832,49 +3886,67 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
3832
3886
  ] })
3833
3887
  ] }),
3834
3888
  /* @__PURE__ */ jsxRuntime.jsx(antd.Divider, { className: "!my-1.5" }),
3835
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
3836
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-medium", children: "Custom Properties" }),
3837
- customProperties.length === 0 && !isEditMode && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[13px] text-muted-foreground", children: "None" }),
3838
- customProperties.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-0.5", children: customProperties.map((prop, index) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-0.5", children: [
3839
- /* @__PURE__ */ jsxRuntime.jsx(
3840
- antd.Input,
3841
- {
3842
- value: prop.key,
3843
- onChange: (e) => handlePropertyKeyChange(index, e.target.value),
3844
- onBlur: () => handleSave(),
3845
- placeholder: "Key",
3846
- className: "flex-1 text-[13px] font-mono !h-5 !px-1",
3847
- readOnly: !isEditMode,
3848
- "data-testid": `input-property-key-${index}`
3849
- }
3850
- ),
3851
- /* @__PURE__ */ jsxRuntime.jsx(
3852
- antd.Input,
3853
- {
3854
- value: prop.value,
3855
- onChange: (e) => handlePropertyValueChange(index, e.target.value),
3856
- onBlur: () => handleSave(),
3857
- placeholder: "Val",
3858
- className: "flex-1 text-[13px] !h-5 !px-1",
3859
- readOnly: !isEditMode,
3860
- "data-testid": `input-property-value-${index}`
3861
- }
3862
- ),
3863
- isEditMode && /* @__PURE__ */ jsxRuntime.jsx(
3864
- "button",
3865
- {
3866
- type: "button",
3867
- onClick: () => {
3868
- handleRemoveProperty(index);
3869
- setTimeout(() => handleSave(), 0);
3870
- },
3871
- className: "text-destructive shrink-0 h-5 w-5 flex items-center justify-center",
3872
- "data-testid": `button-remove-property-${index}`,
3873
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { className: "w-2.5 h-2.5" })
3874
- }
3875
- )
3876
- ] }, index)) }),
3877
- isEditMode && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-0.5", children: [
3889
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
3890
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] font-bold uppercase tracking-wide text-foreground", children: "Properties" }),
3891
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
3892
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-1", children: [
3893
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-[13px] font-mono text-muted-foreground shrink-0 w-24 px-1 leading-6 select-none", children: "description" }),
3894
+ /* @__PURE__ */ jsxRuntime.jsx(
3895
+ TextArea,
3896
+ {
3897
+ id: "feature-description",
3898
+ value: description,
3899
+ onChange: (e) => setDescription(e.target.value),
3900
+ onBlur: () => handleSave(),
3901
+ autoSize: { minRows: 1, maxRows: 5 },
3902
+ placeholder: isEditMode ? "—" : "",
3903
+ readOnly: !isEditMode,
3904
+ className: "flex-1 !text-[13px] !px-1.5 !py-0.5 resize-none",
3905
+ "data-testid": "input-feature-description"
3906
+ }
3907
+ )
3908
+ ] }),
3909
+ customProperties.map((prop, index) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
3910
+ /* @__PURE__ */ jsxRuntime.jsx(
3911
+ antd.Input,
3912
+ {
3913
+ value: prop.key,
3914
+ onChange: (e) => handlePropertyKeyChange(index, e.target.value),
3915
+ onBlur: () => handleSave(),
3916
+ placeholder: "Key",
3917
+ className: "shrink-0 w-24 text-[13px] font-mono !h-6 !px-1",
3918
+ readOnly: !isEditMode,
3919
+ "data-testid": `input-property-key-${index}`
3920
+ }
3921
+ ),
3922
+ /* @__PURE__ */ jsxRuntime.jsx(
3923
+ antd.Input,
3924
+ {
3925
+ value: prop.value,
3926
+ onChange: (e) => handlePropertyValueChange(index, e.target.value),
3927
+ onBlur: () => handleSave(),
3928
+ placeholder: "Value",
3929
+ className: "flex-1 text-[13px] !h-6 !px-1.5",
3930
+ readOnly: !isEditMode,
3931
+ "data-testid": `input-property-value-${index}`
3932
+ }
3933
+ ),
3934
+ isEditMode && /* @__PURE__ */ jsxRuntime.jsx(
3935
+ "button",
3936
+ {
3937
+ type: "button",
3938
+ onClick: () => {
3939
+ handleRemoveProperty(index);
3940
+ setTimeout(() => handleSave(), 0);
3941
+ },
3942
+ className: "text-destructive shrink-0 h-6 w-6 flex items-center justify-center rounded hover:bg-destructive/10 transition-colors",
3943
+ "data-testid": `button-remove-property-${index}`,
3944
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { className: "w-3 h-3" })
3945
+ }
3946
+ )
3947
+ ] }, index))
3948
+ ] }),
3949
+ isEditMode && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 pt-0.5", children: [
3878
3950
  /* @__PURE__ */ jsxRuntime.jsx(
3879
3951
  antd.Input,
3880
3952
  {
@@ -3886,8 +3958,8 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
3886
3958
  handleAddProperty();
3887
3959
  }
3888
3960
  },
3889
- placeholder: "New property...",
3890
- className: "flex-1 text-[13px] !h-5 !px-1",
3961
+ placeholder: "New property…",
3962
+ className: "flex-1 text-[13px] !h-6 !px-1.5",
3891
3963
  "data-testid": "input-new-property-key"
3892
3964
  }
3893
3965
  ),
@@ -3897,9 +3969,9 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
3897
3969
  type: "button",
3898
3970
  onClick: handleAddProperty,
3899
3971
  disabled: !newPropertyKey.trim(),
3900
- className: "h-5 w-5 flex items-center justify-center border border-border rounded disabled:opacity-50",
3972
+ className: "h-6 w-6 flex items-center justify-center border border-border rounded disabled:opacity-50 hover:bg-muted transition-colors",
3901
3973
  "data-testid": "button-add-property",
3902
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "w-2.5 h-2.5" })
3974
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "w-3 h-3" })
3903
3975
  }
3904
3976
  )
3905
3977
  ] })
@@ -3919,7 +3991,7 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
3919
3991
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[12px] text-muted-foreground", children: "Layer:" }),
3920
3992
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[12px] text-foreground truncate", children: layerName })
3921
3993
  ] }),
3922
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-1.5 flex-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Tag, { color: "cyan", className: "!text-[10px] !px-1.5 !py-0 !leading-4 !m-0", children: "Octostar record" }) })
3994
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2 flex-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Tag, { color: "cyan", className: "!text-[12px] !px-2.5 !py-0.5 !leading-5 !m-0 !font-semibold", children: "Octostar record" }) })
3923
3995
  ] }),
3924
3996
  /* @__PURE__ */ jsxRuntime.jsx(antd.Divider, { className: "!my-1.5" }),
3925
3997
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
@@ -3940,93 +4012,73 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
3940
4012
  ) })
3941
4013
  ] }) }),
3942
4014
  /* @__PURE__ */ jsxRuntime.jsx(antd.Divider, { className: "!my-1.5" }),
3943
- feature.properties.description && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3944
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-0.5", children: [
3945
- /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-xs text-muted-foreground", children: "Description" }),
3946
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[13px] text-foreground whitespace-pre-wrap break-words m-0", children: String(feature.properties.description) })
3947
- ] }),
3948
- /* @__PURE__ */ jsxRuntime.jsx(antd.Divider, { className: "!my-1.5" })
3949
- ] }),
3950
4015
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-0.5", children: [
3951
4016
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
3952
4017
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MapPin, { className: "w-3 h-3 text-muted-foreground" }),
3953
4018
  /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-xs text-muted-foreground", children: "Lat / Lng" }),
3954
4019
  feature.geometry.type !== "Point" && /* @__PURE__ */ jsxRuntime.jsx(antd.Tooltip, { title: "Lat and Lng refer to the centroid of this feature", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[13px] text-muted-foreground cursor-help", children: "*" }) })
3955
4020
  ] }),
3956
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-1", children: [
3957
- /* @__PURE__ */ jsxRuntime.jsx(
3958
- antd.Input,
3959
- {
3960
- value: latitude,
3961
- onChange: (e) => setLatitude(e.target.value),
3962
- onFocus: () => {
3963
- latInputFocused.current = true;
3964
- },
3965
- onBlur: () => {
3966
- latInputFocused.current = false;
3967
- if (feature.geometry.type === "Point" && isEditMode && !isReadOnlyLayer && onUpdateGeometry) {
3968
- const lat = parseFloat(latitude);
3969
- const lng = parseFloat(longitude);
3970
- const coords = feature.geometry.coordinates;
3971
- if (isNaN(lat)) {
3972
- toast({ title: "Invalid latitude", description: "Please enter a valid number", variant: "destructive" });
3973
- setLatitude(coords[1].toFixed(6));
3974
- } else if (lat < -90 || lat > 90) {
3975
- toast({ title: "Invalid latitude", description: "Latitude must be between -90 and 90", variant: "destructive" });
3976
- setLatitude(coords[1].toFixed(6));
3977
- } else if (isNaN(lng) || lng < -180 || lng > 180) ;
3978
- else {
3979
- onUpdateGeometry(feature.id, { type: "Point", coordinates: [lng, lat] });
3980
- }
4021
+ /* @__PURE__ */ jsxRuntime.jsx(
4022
+ LatLngFields,
4023
+ {
4024
+ latitude,
4025
+ longitude,
4026
+ isEditable: feature.geometry.type === "Point" && isEditMode && !isReadOnlyLayer,
4027
+ testIdPrefix: "input-record",
4028
+ onLatChange: setLatitude,
4029
+ onLngChange: setLongitude,
4030
+ onLatFocus: () => {
4031
+ latInputFocused.current = true;
4032
+ },
4033
+ onLngFocus: () => {
4034
+ lngInputFocused.current = true;
4035
+ },
4036
+ onLatBlur: () => {
4037
+ latInputFocused.current = false;
4038
+ if (feature.geometry.type === "Point" && isEditMode && !isReadOnlyLayer && onUpdateGeometry) {
4039
+ const lat = parseFloat(latitude);
4040
+ const lng = parseFloat(longitude);
4041
+ const coords = feature.geometry.coordinates;
4042
+ if (isNaN(lat)) {
4043
+ toast({ title: "Invalid latitude", description: "Please enter a valid number", variant: "destructive" });
4044
+ setLatitude(coords[1].toFixed(6));
4045
+ } else if (lat < -90 || lat > 90) {
4046
+ toast({ title: "Invalid latitude", description: "Latitude must be between -90 and 90", variant: "destructive" });
4047
+ setLatitude(coords[1].toFixed(6));
4048
+ } else if (isNaN(lng) || lng < -180 || lng > 180) ;
4049
+ else {
4050
+ onUpdateGeometry(feature.id, { type: "Point", coordinates: [lng, lat] });
3981
4051
  }
3982
- },
3983
- placeholder: "Latitude",
3984
- readOnly: feature.geometry.type !== "Point" || !isEditMode || isReadOnlyLayer,
3985
- className: "!h-6 text-[13px] flex-1",
3986
- "data-testid": "input-record-latitude"
3987
- }
3988
- ),
3989
- /* @__PURE__ */ jsxRuntime.jsx(
3990
- antd.Input,
3991
- {
3992
- value: longitude,
3993
- onChange: (e) => setLongitude(e.target.value),
3994
- onFocus: () => {
3995
- lngInputFocused.current = true;
3996
- },
3997
- onBlur: () => {
3998
- lngInputFocused.current = false;
3999
- if (feature.geometry.type === "Point" && isEditMode && !isReadOnlyLayer && onUpdateGeometry) {
4000
- const lat = parseFloat(latitude);
4001
- const lng = parseFloat(longitude);
4002
- const coords = feature.geometry.coordinates;
4003
- if (isNaN(lng)) {
4004
- toast({ title: "Invalid longitude", description: "Please enter a valid number", variant: "destructive" });
4005
- setLongitude(coords[0].toFixed(6));
4006
- } else if (lng < -180 || lng > 180) {
4007
- toast({ title: "Invalid longitude", description: "Longitude must be between -180 and 180", variant: "destructive" });
4008
- setLongitude(coords[0].toFixed(6));
4009
- } else if (isNaN(lat) || lat < -90 || lat > 90) ;
4010
- else {
4011
- onUpdateGeometry(feature.id, { type: "Point", coordinates: [lng, lat] });
4012
- }
4052
+ }
4053
+ },
4054
+ onLngBlur: () => {
4055
+ lngInputFocused.current = false;
4056
+ if (feature.geometry.type === "Point" && isEditMode && !isReadOnlyLayer && onUpdateGeometry) {
4057
+ const lat = parseFloat(latitude);
4058
+ const lng = parseFloat(longitude);
4059
+ const coords = feature.geometry.coordinates;
4060
+ if (isNaN(lng)) {
4061
+ toast({ title: "Invalid longitude", description: "Please enter a valid number", variant: "destructive" });
4062
+ setLongitude(coords[0].toFixed(6));
4063
+ } else if (lng < -180 || lng > 180) {
4064
+ toast({ title: "Invalid longitude", description: "Longitude must be between -180 and 180", variant: "destructive" });
4065
+ setLongitude(coords[0].toFixed(6));
4066
+ } else if (isNaN(lat) || lat < -90 || lat > 90) ;
4067
+ else {
4068
+ onUpdateGeometry(feature.id, { type: "Point", coordinates: [lng, lat] });
4013
4069
  }
4014
- },
4015
- placeholder: "Longitude",
4016
- readOnly: feature.geometry.type !== "Point" || !isEditMode || isReadOnlyLayer,
4017
- className: "!h-6 text-[13px] flex-1",
4018
- "data-testid": "input-record-longitude"
4070
+ }
4019
4071
  }
4020
- )
4021
- ] })
4072
+ }
4073
+ )
4022
4074
  ] }),
4023
4075
  recordProperties.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4024
4076
  /* @__PURE__ */ jsxRuntime.jsx(antd.Divider, { className: "!my-1.5" }),
4025
4077
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
4026
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-medium", children: "Properties" }),
4078
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] font-bold uppercase tracking-wide text-foreground", children: "Properties" }),
4027
4079
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-0.5", children: recordProperties.map(({ key, value }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2 py-0.5", children: [
4028
4080
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] text-muted-foreground shrink-0 pt-px min-w-[80px]", children: formatPropertyKey(key) }),
4029
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[13px] text-foreground break-all", children: value })
4081
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[13px] text-foreground whitespace-pre-wrap break-words", children: value })
4030
4082
  ] }, key)) })
4031
4083
  ] })
4032
4084
  ] }),
@@ -4046,7 +4098,7 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
4046
4098
  return /* @__PURE__ */ jsxRuntime.jsxs(
4047
4099
  "div",
4048
4100
  {
4049
- className: "absolute top-4 right-4 z-10 w-72 bg-background/95 floating-panel rounded-lg shadow-lg border border-border flex flex-col overflow-hidden",
4101
+ className: "absolute top-4 right-4 z-10 w-80 bg-background/95 floating-panel rounded-lg shadow-lg border border-border flex flex-col overflow-hidden",
4050
4102
  style: { maxHeight: "calc(100vh - 6rem)" },
4051
4103
  "data-testid": "panel-properties",
4052
4104
  children: [
@@ -4179,7 +4231,7 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
4179
4231
  return /* @__PURE__ */ jsxRuntime.jsxs(
4180
4232
  "div",
4181
4233
  {
4182
- className: "absolute top-4 right-4 z-10 w-64 bg-background/95 floating-panel rounded-lg shadow-lg border border-border flex flex-col overflow-hidden",
4234
+ className: "absolute top-4 right-4 z-10 w-72 bg-background/95 floating-panel rounded-lg shadow-lg border border-border flex flex-col overflow-hidden",
4183
4235
  style: { maxHeight: "calc(100vh - 6rem)" },
4184
4236
  "data-testid": "panel-properties",
4185
4237
  children: [
@@ -5713,6 +5765,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
5713
5765
  enableProperties = true,
5714
5766
  toastProvider,
5715
5767
  customGlobalMenuItems,
5768
+ extraLayerToolbarButtons,
5716
5769
  layerBadgeProvider,
5717
5770
  featureCountProvider,
5718
5771
  fitBoundsProvider,
@@ -5795,6 +5848,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
5795
5848
  const [cursorCoords, setCursorCoords] = react.useState(null);
5796
5849
  const [contextMenu, setContextMenu] = react.useState(null);
5797
5850
  const timelineStore = useTimelineStore();
5851
+ react.useEffect(() => () => useTimelineStore.getState().reset(), []);
5798
5852
  const { toast: internalToast } = useToast();
5799
5853
  const toast = toastProvider ?? internalToast;
5800
5854
  react.useEffect(() => {
@@ -6158,7 +6212,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
6158
6212
  const sourceData = {
6159
6213
  type: "FeatureCollection",
6160
6214
  features: allFeatures.map((f) => {
6161
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
6215
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
6162
6216
  const featureId = String(f.id);
6163
6217
  const layer = featureToLayer.get(featureId);
6164
6218
  const visualConfig = layer == null ? void 0 : layer.visualConfig;
@@ -6230,8 +6284,8 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
6230
6284
  featureIconSize = iconConfig.size ?? 24;
6231
6285
  }
6232
6286
  const isPoint = f.geometry.type === "Point";
6233
- const hideByHeatmap = isPoint && ((_i = layer == null ? void 0 : layer.heatmapConfig) == null ? void 0 : _i.enabled) && ((_j = layer == null ? void 0 : layer.heatmapConfig) == null ? void 0 : _j.hideFeatures);
6234
- const hideByCluster = isPoint && ((_k = layer == null ? void 0 : layer.clusterConfig) == null ? void 0 : _k.enabled) === true && !((_l = layer == null ? void 0 : layer.clusterConfig) == null ? void 0 : _l.showPointDots);
6287
+ const hideByHeatmap = isPoint && ((_i = layer == null ? void 0 : layer.heatmapConfig) == null ? void 0 : _i.enabled) === true;
6288
+ const hideByCluster = isPoint && ((_j = layer == null ? void 0 : layer.clusterConfig) == null ? void 0 : _j.enabled) === true && !((_k = layer == null ? void 0 : layer.clusterConfig) == null ? void 0 : _k.showPointDots);
6235
6289
  const isSelected = selectedIds.includes(featureId);
6236
6290
  const hideByTrace = false;
6237
6291
  const isLine = f.geometry.type === "LineString" || f.geometry.type === "MultiLineString";
@@ -6273,7 +6327,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
6273
6327
  "stroke-width": strokeWidth,
6274
6328
  "stroke-opacity": hideFlatFor3DOnly ? 0 : isTimelineVisible ? baseOpacity : 0,
6275
6329
  fill: strokeColor,
6276
- "fill-opacity": hideFlatFor3DOnly ? 0 : isTimelineVisible ? ((_m = f.properties) == null ? void 0 : _m["fill-opacity"]) ?? 0.2 : 0,
6330
+ "fill-opacity": hideFlatFor3DOnly ? 0 : isTimelineVisible ? ((_l = f.properties) == null ? void 0 : _l["fill-opacity"]) ?? 0.2 : 0,
6277
6331
  pointRadius,
6278
6332
  isHiddenFor3DOnly: hideFlatFor3DOnly ? 1 : 0,
6279
6333
  isTimelineHidden: isTimelineVisible ? 0 : 1
@@ -6659,8 +6713,15 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
6659
6713
  attributionControl: false,
6660
6714
  boxZoom: false,
6661
6715
  // Disable default box zoom - we use shift+drag for selection instead
6662
- maxPitch: 80
6716
+ maxPitch: 80,
6663
6717
  // Allow steep camera angles for 3D terrain viewing
6718
+ // Required for `getCanvas().toDataURL()` (used by `captureScreenshot()`
6719
+ // on the imperative handle) to return a populated image instead of a
6720
+ // blank one. In maplibre-gl v5 this lives under
6721
+ // `canvasContextAttributes`, not at the top level. Modern desktop GPUs
6722
+ // absorb the small extra cost without measurable impact on this
6723
+ // editor-grade map.
6724
+ canvasContextAttributes: { preserveDrawingBuffer: true }
6664
6725
  });
6665
6726
  const attrCtrl = new maplibregl.AttributionControl({
6666
6727
  compact: true,
@@ -6937,6 +6998,33 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
6937
6998
  // Text features: center anchor; others: top anchor
6938
6999
  "text-anchor": ["case", ["==", ["get", "kind"], "text"], "center", "top"],
6939
7000
  "text-offset": ["case", ["==", ["get", "kind"], "text"], ["literal", [0, 0]], ["literal", [0, 0.8]]],
7001
+ // Always allow overlap for every label this layer renders.
7002
+ //
7003
+ // The earlier `false` branch (for plain entity labels) was an
7004
+ // attempt to thin dense clusters via MapLibre's collision
7005
+ // detection. In practice it interacts poorly with this layer:
7006
+ //
7007
+ // - The `custom-labels` symbol layer has NO `icon-image`, so
7008
+ // `text-optional: true` cannot fall back to "show icon, drop
7009
+ // text". MapLibre instead drops the entire symbol when the
7010
+ // text loses collision.
7011
+ // - Vector basemaps (Streets / OSM Bright) place dense
7012
+ // city / POI / street labels everywhere, and our entity
7013
+ // label loses against ANY of them even at low zoom on an
7014
+ // otherwise-empty map. The PR that introduced collision
7015
+ // here only anticipated this happening "occasionally at
7016
+ // very high zoom", but the empirical behaviour is far more
7017
+ // aggressive.
7018
+ //
7019
+ // Net effect of the previous setting: a freshly dropped entity
7020
+ // point on an editable layer rendered NO label at all on most
7021
+ // basemaps, even with a single feature on the map.
7022
+ //
7023
+ // Reverting to unconditional `true` restores the previous
7024
+ // (working) behaviour. Stacking in dense clusters should be
7025
+ // addressed via a different mechanism (cluster/heatmap modes
7026
+ // already exist; per-zoom font-size or a host-supplied
7027
+ // collision opt-in are options if revisited).
6940
7028
  "text-allow-overlap": true,
6941
7029
  "text-ignore-placement": false,
6942
7030
  "text-optional": true,
@@ -7856,6 +7944,101 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
7856
7944
  if (!map.current || !isMapLoadedRef.current) return;
7857
7945
  map.current.flyTo({ center: coords, zoom: zoom ?? map.current.getZoom(), duration: (options == null ? void 0 : options.duration) ?? 2e3 });
7858
7946
  },
7947
+ updateLayerConfig: (layerId, config) => {
7948
+ const idx = layersRef.current.findIndex((l) => l.id === layerId);
7949
+ if (idx < 0) return false;
7950
+ const current = layersRef.current[idx];
7951
+ const next = { ...current };
7952
+ if ("visible" in config) {
7953
+ const wantedVisible = config.visible ?? true;
7954
+ if (wantedVisible !== current.visible && !current.readOnly && draw.current) {
7955
+ if (wantedVisible) {
7956
+ const hidden = hiddenFeatures.current.get(layerId) || [];
7957
+ const newIds = [];
7958
+ isApiAddingRef.current = true;
7959
+ try {
7960
+ hidden.forEach((f) => {
7961
+ const ids = draw.current.add(f);
7962
+ newIds.push(ids[0]);
7963
+ });
7964
+ } finally {
7965
+ isApiAddingRef.current = false;
7966
+ }
7967
+ hiddenFeatures.current.delete(layerId);
7968
+ next.visible = true;
7969
+ next.featureIds = newIds;
7970
+ } else {
7971
+ const features = current.featureIds.map((id) => draw.current.get(id)).filter(Boolean);
7972
+ hiddenFeatures.current.set(layerId, features);
7973
+ current.featureIds.forEach((id) => {
7974
+ try {
7975
+ draw.current.delete(id);
7976
+ } catch {
7977
+ }
7978
+ });
7979
+ next.visible = false;
7980
+ next.featureIds = [];
7981
+ }
7982
+ } else {
7983
+ next.visible = wantedVisible;
7984
+ }
7985
+ }
7986
+ if ("visualConfig" in config) next.visualConfig = config.visualConfig;
7987
+ if ("traceConfig" in config) next.traceConfig = config.traceConfig;
7988
+ if ("heatmapConfig" in config) next.heatmapConfig = config.heatmapConfig;
7989
+ if ("clusterConfig" in config) next.clusterConfig = config.clusterConfig;
7990
+ if ("altitudeDisplayMode" in config) next.altitudeDisplayMode = config.altitudeDisplayMode;
7991
+ const updated = [...layersRef.current];
7992
+ updated[idx] = next;
7993
+ layersRef.current = updated;
7994
+ setLayers(updated);
7995
+ if ("visible" in config) {
7996
+ updateFeatureCount();
7997
+ scheduleTimelineUpdate();
7998
+ }
7999
+ requestAnimationFrame(() => syncRef.current());
8000
+ return true;
8001
+ },
8002
+ captureScreenshot: async (options) => {
8003
+ const m = map.current;
8004
+ if (!m || !isMapLoadedRef.current) {
8005
+ toast({
8006
+ title: "Screenshot failed",
8007
+ description: "Map is not ready yet.",
8008
+ variant: "destructive"
8009
+ });
8010
+ throw new Error("Map is not ready");
8011
+ }
8012
+ const SCREENSHOT_RENDER_TIMEOUT_MS = 1e4;
8013
+ try {
8014
+ await new Promise((resolve, reject) => {
8015
+ const onRender = () => {
8016
+ clearTimeout(timeoutId);
8017
+ resolve();
8018
+ };
8019
+ const timeoutId = setTimeout(() => {
8020
+ try {
8021
+ m.off("render", onRender);
8022
+ } catch {
8023
+ }
8024
+ reject(new Error("Screenshot timed out waiting for render (map may have been destroyed)"));
8025
+ }, SCREENSHOT_RENDER_TIMEOUT_MS);
8026
+ m.once("render", onRender);
8027
+ m.triggerRepaint();
8028
+ });
8029
+ } catch (err) {
8030
+ toast({
8031
+ title: "Screenshot failed",
8032
+ description: err instanceof Error ? err.message : "The map did not render in time. Please try again.",
8033
+ variant: "destructive"
8034
+ });
8035
+ throw err;
8036
+ }
8037
+ const canvas = m.getCanvas();
8038
+ const fmt = (options == null ? void 0 : options.format) === "jpeg" ? "image/jpeg" : "image/png";
8039
+ const dataUrl = fmt === "image/jpeg" ? canvas.toDataURL(fmt, options == null ? void 0 : options.quality) : canvas.toDataURL(fmt);
8040
+ return { dataUrl, width: canvas.width, height: canvas.height };
8041
+ },
7859
8042
  fitToData: (layerIds) => {
7860
8043
  if (!map.current || !isMapLoadedRef.current) return;
7861
8044
  const drawFeatures = draw.current ? draw.current.getAll().features : [];
@@ -7894,11 +8077,25 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
7894
8077
  const newLayer = {
7895
8078
  id: layerId,
7896
8079
  name,
7897
- visible: true,
8080
+ // Default to visible. The optional `visible` flag lets restore-flows
8081
+ // recreate a layer that the user had previously hidden, without
8082
+ // racing a follow-up `setLayerVisibility(id, false)` call (which
8083
+ // briefly flashes the layer on screen between addLayer and the
8084
+ // visibility toggle).
8085
+ visible: (options == null ? void 0 : options.visible) ?? true,
7898
8086
  featureIds: [],
7899
8087
  readOnly: options == null ? void 0 : options.readOnly,
7900
8088
  group: options == null ? void 0 : options.group,
7901
- metadata: options == null ? void 0 : options.metadata
8089
+ metadata: options == null ? void 0 : options.metadata,
8090
+ // Per-layer visual configs are passed through verbatim so that hosts
8091
+ // restoring a saved map (workspace auto-save, file merge, etc.) can
8092
+ // recreate heatmap / cluster / color-by-field / label / size / trace
8093
+ // settings without a follow-up "update visual config" round-trip.
8094
+ visualConfig: options == null ? void 0 : options.visualConfig,
8095
+ traceConfig: options == null ? void 0 : options.traceConfig,
8096
+ heatmapConfig: options == null ? void 0 : options.heatmapConfig,
8097
+ clusterConfig: options == null ? void 0 : options.clusterConfig,
8098
+ altitudeDisplayMode: options == null ? void 0 : options.altitudeDisplayMode
7902
8099
  };
7903
8100
  if (geojson) {
7904
8101
  if (options == null ? void 0 : options.readOnly) {
@@ -7937,6 +8134,17 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
7937
8134
  }
7938
8135
  }
7939
8136
  }
8137
+ if (newLayer.visible === false && !(options == null ? void 0 : options.readOnly) && draw.current && newLayer.featureIds.length > 0) {
8138
+ const features = newLayer.featureIds.map((id) => draw.current.get(id)).filter(Boolean);
8139
+ hiddenFeatures.current.set(layerId, features);
8140
+ newLayer.featureIds.forEach((id) => {
8141
+ try {
8142
+ draw.current.delete(id);
8143
+ } catch {
8144
+ }
8145
+ });
8146
+ newLayer.featureIds = [];
8147
+ }
7940
8148
  const updatedLayers = [...layersRef.current, newLayer];
7941
8149
  layersRef.current = updatedLayers;
7942
8150
  setLayers(updatedLayers);
@@ -12179,6 +12387,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
12179
12387
  hideBasemapSwitcher,
12180
12388
  externalPersistence,
12181
12389
  customGlobalMenuItems,
12390
+ extraLayerToolbarButtons,
12182
12391
  layerBadgeProvider,
12183
12392
  featureCountProvider
12184
12393
  }