@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.mjs CHANGED
@@ -1724,6 +1724,7 @@ function LayersPanel({
1724
1724
  hideBasemapSwitcher = false,
1725
1725
  externalPersistence = false,
1726
1726
  customGlobalMenuItems,
1727
+ extraLayerToolbarButtons,
1727
1728
  layerBadgeProvider,
1728
1729
  featureCountProvider
1729
1730
  }) {
@@ -2029,12 +2030,11 @@ function LayersPanel({
2029
2030
  size: "small",
2030
2031
  checked: ((_d = layer.heatmapConfig) == null ? void 0 : _d.enabled) ?? false,
2031
2032
  onChange: (checked) => {
2032
- var _a2, _b2, _c2;
2033
+ var _a2, _b2;
2033
2034
  return onUpdateHeatmapConfig(layer.id, {
2034
2035
  enabled: checked,
2035
2036
  intensity: ((_a2 = layer.heatmapConfig) == null ? void 0 : _a2.intensity) ?? 1,
2036
- radius: ((_b2 = layer.heatmapConfig) == null ? void 0 : _b2.radius) ?? 20,
2037
- hideFeatures: ((_c2 = layer.heatmapConfig) == null ? void 0 : _c2.hideFeatures) ?? false
2037
+ radius: ((_b2 = layer.heatmapConfig) == null ? void 0 : _b2.radius) ?? 20
2038
2038
  });
2039
2039
  },
2040
2040
  "data-testid": `switch-heatmap-${layer.id}`
@@ -2076,20 +2076,6 @@ function LayersPanel({
2076
2076
  })
2077
2077
  }
2078
2078
  )
2079
- ] }),
2080
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
2081
- /* @__PURE__ */ jsx(
2082
- Switch,
2083
- {
2084
- size: "small",
2085
- checked: layer.heatmapConfig.hideFeatures ?? false,
2086
- onChange: (checked) => onUpdateHeatmapConfig(layer.id, {
2087
- ...layer.heatmapConfig,
2088
- hideFeatures: checked
2089
- })
2090
- }
2091
- ),
2092
- /* @__PURE__ */ jsx("span", { className: "text-[10px]", children: "Hide points" })
2093
2079
  ] })
2094
2080
  ] })
2095
2081
  ] }),
@@ -2515,6 +2501,7 @@ function LayersPanel({
2515
2501
  ) })
2516
2502
  }
2517
2503
  ),
2504
+ extraLayerToolbarButtons,
2518
2505
  /* @__PURE__ */ jsx(
2519
2506
  Dropdown,
2520
2507
  {
@@ -2797,6 +2784,56 @@ function getFeatureTypeIcon(geometryType, kind, size = "sm") {
2797
2784
  return null;
2798
2785
  }
2799
2786
  }
2787
+ function colorPickerNoHexPanel(_panel, extra) {
2788
+ const { Picker, Presets } = extra.components;
2789
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 min-w-[220px]", children: [
2790
+ /* @__PURE__ */ jsx(Picker, {}),
2791
+ /* @__PURE__ */ jsx(Presets, {})
2792
+ ] });
2793
+ }
2794
+ function LatLngFields(props) {
2795
+ const { latitude, longitude, isEditable, testIdPrefix } = props;
2796
+ if (!isEditable) {
2797
+ return /* @__PURE__ */ jsxs(
2798
+ "div",
2799
+ {
2800
+ className: "flex items-center gap-2 text-[13px] font-mono text-foreground px-1 py-1",
2801
+ "data-testid": `${testIdPrefix}-display`,
2802
+ children: [
2803
+ /* @__PURE__ */ jsx("span", { "data-testid": `${testIdPrefix}-latitude-text`, children: latitude || "—" }),
2804
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "/" }),
2805
+ /* @__PURE__ */ jsx("span", { "data-testid": `${testIdPrefix}-longitude-text`, children: longitude || "—" })
2806
+ ]
2807
+ }
2808
+ );
2809
+ }
2810
+ return /* @__PURE__ */ jsxs("div", { className: "flex gap-1", children: [
2811
+ /* @__PURE__ */ jsx(
2812
+ Input,
2813
+ {
2814
+ value: latitude,
2815
+ onChange: (e) => props.onLatChange(e.target.value),
2816
+ onFocus: props.onLatFocus,
2817
+ onBlur: props.onLatBlur,
2818
+ placeholder: "Latitude",
2819
+ className: "!h-6 text-[13px] flex-1",
2820
+ "data-testid": `${testIdPrefix}-latitude`
2821
+ }
2822
+ ),
2823
+ /* @__PURE__ */ jsx(
2824
+ Input,
2825
+ {
2826
+ value: longitude,
2827
+ onChange: (e) => props.onLngChange(e.target.value),
2828
+ onFocus: props.onLngFocus,
2829
+ onBlur: props.onLngBlur,
2830
+ placeholder: "Longitude",
2831
+ className: "!h-6 text-[13px] flex-1",
2832
+ "data-testid": `${testIdPrefix}-longitude`
2833
+ }
2834
+ )
2835
+ ] });
2836
+ }
2800
2837
  function PointColorDot({ color, size = 20 }) {
2801
2838
  return /* @__PURE__ */ jsx("svg", { width: size, height: size, viewBox: "0 0 20 20", className: "shrink-0", children: /* @__PURE__ */ jsx("circle", { cx: "10", cy: "10", r: "7", fill: color, stroke: color, strokeWidth: "2", opacity: "0.9" }) });
2802
2839
  }
@@ -2850,8 +2887,21 @@ const RECORD_EXCLUDE_KEYS = /* @__PURE__ */ new Set([
2850
2887
  "entityType",
2851
2888
  "startDate",
2852
2889
  "endDate",
2853
- "description"
2890
+ // The feature's color is already conveyed by the colored dot in the panel
2891
+ // header; showing it again as a property row (`#0C66E4`) is just noise.
2892
+ "color"
2893
+ // NOTE: 'description' intentionally NOT excluded — we surface it as a regular
2894
+ // property row instead of giving it its own labelled section.
2854
2895
  ]);
2896
+ function buildKeyExclusionPredicate(set) {
2897
+ const lowered = new Set(Array.from(set, (k) => k.toLowerCase()));
2898
+ return (key) => {
2899
+ if (set.has(key)) return true;
2900
+ const normalized = key.toLowerCase().replace(/^[^a-z0-9_-]+/, "");
2901
+ return lowered.has(normalized);
2902
+ };
2903
+ }
2904
+ const isExcludedRecordKey = buildKeyExclusionPredicate(RECORD_EXCLUDE_KEYS);
2855
2905
  const RECORD_FIELDS_HIDDEN_PREFIXES = ["_", "os_"];
2856
2906
  function parseRecordFields(feature) {
2857
2907
  const raw = feature.properties._recordFields;
@@ -2878,14 +2928,14 @@ function RecordFieldsSection({ feature }) {
2878
2928
  Collapse,
2879
2929
  {
2880
2930
  size: "small",
2881
- defaultActiveKey: ["record-fields"],
2931
+ defaultActiveKey: [],
2882
2932
  ghost: true,
2883
2933
  className: "[&_.ant-collapse-header]:!px-0 [&_.ant-collapse-header]:!py-1 [&_.ant-collapse-content-box]:!px-0 [&_.ant-collapse-content-box]:!py-1",
2884
2934
  items: [{
2885
2935
  key: "record-fields",
2886
2936
  label: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
2887
2937
  /* @__PURE__ */ jsx(Info, { className: "w-3 h-3 text-foreground" }),
2888
- /* @__PURE__ */ jsx("span", { className: "text-xs font-medium", children: "Record Fields" }),
2938
+ /* @__PURE__ */ jsx("span", { className: "text-[11px] font-bold uppercase tracking-wide text-foreground", children: "Record Fields" }),
2889
2939
  /* @__PURE__ */ jsxs("span", { className: "text-[10px] text-muted-foreground ml-1", children: [
2890
2940
  "(",
2891
2941
  fields.length,
@@ -3035,10 +3085,46 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
3035
3085
  setLatitude("");
3036
3086
  }
3037
3087
  }
3038
- 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"];
3088
+ const reserved = /* @__PURE__ */ new Set([
3089
+ "name",
3090
+ "description",
3091
+ "startDate",
3092
+ "endDate",
3093
+ "stroke",
3094
+ "stroke-width",
3095
+ "stroke-opacity",
3096
+ "fill",
3097
+ "fill-opacity",
3098
+ "kind",
3099
+ "label",
3100
+ "fontSize",
3101
+ "fontColor",
3102
+ "fontWeight",
3103
+ "arrowSize",
3104
+ "circleCenter",
3105
+ "circleRadius",
3106
+ "icon",
3107
+ "iconSize",
3108
+ "pointIcon",
3109
+ "pointIconSize",
3110
+ "entityType",
3111
+ "entity_id",
3112
+ "entity_type",
3113
+ "entity_label",
3114
+ "os_workspace",
3115
+ "workspace",
3116
+ "source_name",
3117
+ "id",
3118
+ "latitude",
3119
+ "longitude",
3120
+ // The marker color is shown via the colored dot in the panel header,
3121
+ // so we don't repeat it as an editable property row.
3122
+ "color"
3123
+ ]);
3124
+ const isReservedKey = buildKeyExclusionPredicate(reserved);
3039
3125
  const custom = [];
3040
3126
  Object.entries(feature.properties).forEach(([key, value]) => {
3041
- if (!reserved.includes(key) && value !== void 0 && value !== null && !key.startsWith("_") && !key.startsWith("os_") && !key.startsWith("isHidden")) {
3127
+ if (!isReservedKey(key) && value !== void 0 && value !== null && !key.startsWith("_") && !key.startsWith("os_") && !key.startsWith("isHidden")) {
3042
3128
  custom.push({ key, value: String(value) });
3043
3129
  }
3044
3130
  });
@@ -3222,7 +3308,7 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
3222
3308
  handleRefresh(true);
3223
3309
  }, [feature == null ? void 0 : feature.id, isRecord, featureRefreshProvider, feature, handleRefresh]);
3224
3310
  const recordProperties = feature ? Object.entries(feature.properties).filter(
3225
- ([key, value]) => !RECORD_EXCLUDE_KEYS.has(key) && value !== void 0 && value !== null && !key.startsWith("_") && !key.startsWith("isHidden")
3311
+ ([key, value]) => !isExcludedRecordKey(key) && value !== void 0 && value !== null && !key.startsWith("_") && !key.startsWith("os_") && !key.startsWith("isHidden")
3226
3312
  ).map(([key, value]) => ({ key, value: String(value) })) : [];
3227
3313
  const entityCardsContent = /* @__PURE__ */ jsx("div", { className: "p-2 space-y-2", children: entityCardProvider ? selectedFeatures.map((f) => {
3228
3314
  const geoFeature = {
@@ -3239,7 +3325,7 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
3239
3325
  return /* @__PURE__ */ jsxs(
3240
3326
  "div",
3241
3327
  {
3242
- className: "absolute top-4 right-4 z-10 w-72 bg-background/95 floating-panel rounded-lg shadow-lg border border-border",
3328
+ className: "absolute top-4 right-4 z-10 w-80 bg-background/95 floating-panel rounded-lg shadow-lg border border-border",
3243
3329
  "data-testid": "panel-properties",
3244
3330
  children: [
3245
3331
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2 px-2.5 py-2 border-b border-border", children: [
@@ -3275,21 +3361,20 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
3275
3361
  onMoveFeaturesToLayer && /* @__PURE__ */ jsx(Dropdown, { menu: { items: buildLayerMenuItems("move") }, trigger: ["click"], placement: "bottomRight", children: /* @__PURE__ */ jsx(Tooltip, { title: "Move to layer", children: /* @__PURE__ */ jsx(Button, { type: "text", icon: /* @__PURE__ */ jsx(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" }) }) })
3276
3362
  ] })
3277
3363
  ] }),
3278
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 flex-wrap", children: [
3279
- isRecord ? /* @__PURE__ */ jsx(Tag, { color: "cyan", className: "!text-[10px] !px-1.5 !py-0 !leading-4 !m-0", children: "Octostar record" }) : /* @__PURE__ */ jsx(Tag, { color: "blue", className: "!text-[10px] !px-1.5 !py-0 !leading-4 !m-0", children: "Local map feature" }),
3280
- isUnsaved && /* @__PURE__ */ jsx(Tag, { color: "orange", className: "!text-[10px] !px-1.5 !py-0 !leading-4 !border-0 !m-0", children: "unsaved" }),
3364
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 flex-wrap", children: [
3365
+ isRecord ? /* @__PURE__ */ jsx(Tag, { color: "cyan", className: "!text-[12px] !px-2.5 !py-0.5 !leading-5 !m-0 !font-semibold", children: "Octostar record" }) : /* @__PURE__ */ jsx(Tag, { color: "blue", className: "!text-[12px] !px-2.5 !py-0.5 !leading-5 !m-0 !font-semibold", children: "Local map feature" }),
3366
+ isUnsaved && /* @__PURE__ */ jsx(Tag, { color: "orange", className: "!text-[12px] !px-2.5 !py-0.5 !leading-5 !border-0 !m-0 !font-semibold", children: "Unsaved" }),
3281
3367
  !isRecord && featureSaveProvider && /* @__PURE__ */ jsx(
3282
3368
  Button,
3283
3369
  {
3284
3370
  type: "primary",
3285
- size: "small",
3286
- icon: /* @__PURE__ */ jsx(Save, { className: "w-3 h-3" }),
3371
+ size: "middle",
3372
+ icon: /* @__PURE__ */ jsx(Save, { className: "w-3.5 h-3.5" }),
3287
3373
  loading: isSaving,
3288
3374
  onClick: handleFeatureSave,
3289
- className: "!h-5 !px-1.5 !text-[11px]",
3290
- style: { padding: "1px 6px" },
3375
+ className: "!h-7 !px-3 !text-[12px] !font-medium",
3291
3376
  "data-testid": "button-save-feature",
3292
- children: "Create entity…"
3377
+ children: "Create entity"
3293
3378
  }
3294
3379
  )
3295
3380
  ] })
@@ -3373,92 +3458,57 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
3373
3458
  /* @__PURE__ */ jsx("label", { className: "text-xs text-muted-foreground", children: "Lat / Lng" }),
3374
3459
  feature.geometry.type !== "Point" && /* @__PURE__ */ jsx(Tooltip, { title: "Lat and Lng refer to the centroid of this feature", children: /* @__PURE__ */ jsx("span", { className: "text-[13px] text-muted-foreground cursor-help", children: "*" }) })
3375
3460
  ] }),
3376
- /* @__PURE__ */ jsxs("div", { className: "flex gap-1", children: [
3377
- /* @__PURE__ */ jsx(
3378
- Input,
3379
- {
3380
- value: latitude,
3381
- onChange: (e) => setLatitude(e.target.value),
3382
- onFocus: () => {
3383
- latInputFocused.current = true;
3384
- },
3385
- onBlur: () => {
3386
- latInputFocused.current = false;
3387
- if (feature.geometry.type === "Point" && isEditMode && !isReadOnlyLayer && onUpdateGeometry) {
3388
- const lat = parseFloat(latitude);
3389
- const lng = parseFloat(longitude);
3390
- const coords = feature.geometry.coordinates;
3391
- if (isNaN(lat)) {
3392
- toast({ title: "Invalid latitude", description: "Please enter a valid number", variant: "destructive" });
3393
- setLatitude(coords[1].toFixed(6));
3394
- } else if (lat < -90 || lat > 90) {
3395
- toast({ title: "Invalid latitude", description: "Latitude must be between -90 and 90", variant: "destructive" });
3396
- setLatitude(coords[1].toFixed(6));
3397
- } else if (isNaN(lng) || lng < -180 || lng > 180) ;
3398
- else {
3399
- onUpdateGeometry(feature.id, {
3400
- type: "Point",
3401
- coordinates: [lng, lat]
3402
- });
3403
- }
3461
+ /* @__PURE__ */ jsx(
3462
+ LatLngFields,
3463
+ {
3464
+ latitude,
3465
+ longitude,
3466
+ isEditable: feature.geometry.type === "Point" && isEditMode && !isReadOnlyLayer,
3467
+ testIdPrefix: "input-feature",
3468
+ onLatChange: setLatitude,
3469
+ onLngChange: setLongitude,
3470
+ onLatFocus: () => {
3471
+ latInputFocused.current = true;
3472
+ },
3473
+ onLngFocus: () => {
3474
+ lngInputFocused.current = true;
3475
+ },
3476
+ onLatBlur: () => {
3477
+ latInputFocused.current = false;
3478
+ if (feature.geometry.type === "Point" && isEditMode && !isReadOnlyLayer && onUpdateGeometry) {
3479
+ const lat = parseFloat(latitude);
3480
+ const lng = parseFloat(longitude);
3481
+ const coords = feature.geometry.coordinates;
3482
+ if (isNaN(lat)) {
3483
+ toast({ title: "Invalid latitude", description: "Please enter a valid number", variant: "destructive" });
3484
+ setLatitude(coords[1].toFixed(6));
3485
+ } else if (lat < -90 || lat > 90) {
3486
+ toast({ title: "Invalid latitude", description: "Latitude must be between -90 and 90", variant: "destructive" });
3487
+ setLatitude(coords[1].toFixed(6));
3488
+ } else if (isNaN(lng) || lng < -180 || lng > 180) ;
3489
+ else {
3490
+ onUpdateGeometry(feature.id, { type: "Point", coordinates: [lng, lat] });
3404
3491
  }
3405
- },
3406
- placeholder: "Latitude",
3407
- readOnly: feature.geometry.type !== "Point" || !isEditMode || isReadOnlyLayer,
3408
- className: "!h-6 text-[13px] flex-1",
3409
- "data-testid": "input-feature-latitude"
3410
- }
3411
- ),
3412
- /* @__PURE__ */ jsx(
3413
- Input,
3414
- {
3415
- value: longitude,
3416
- onChange: (e) => setLongitude(e.target.value),
3417
- onFocus: () => {
3418
- lngInputFocused.current = true;
3419
- },
3420
- onBlur: () => {
3421
- lngInputFocused.current = false;
3422
- if (feature.geometry.type === "Point" && isEditMode && !isReadOnlyLayer && onUpdateGeometry) {
3423
- const lat = parseFloat(latitude);
3424
- const lng = parseFloat(longitude);
3425
- const coords = feature.geometry.coordinates;
3426
- if (isNaN(lng)) {
3427
- toast({ title: "Invalid longitude", description: "Please enter a valid number", variant: "destructive" });
3428
- setLongitude(coords[0].toFixed(6));
3429
- } else if (lng < -180 || lng > 180) {
3430
- toast({ title: "Invalid longitude", description: "Longitude must be between -180 and 180", variant: "destructive" });
3431
- setLongitude(coords[0].toFixed(6));
3432
- } else if (isNaN(lat) || lat < -90 || lat > 90) ;
3433
- else {
3434
- onUpdateGeometry(feature.id, {
3435
- type: "Point",
3436
- coordinates: [lng, lat]
3437
- });
3438
- }
3492
+ }
3493
+ },
3494
+ onLngBlur: () => {
3495
+ lngInputFocused.current = false;
3496
+ if (feature.geometry.type === "Point" && isEditMode && !isReadOnlyLayer && onUpdateGeometry) {
3497
+ const lat = parseFloat(latitude);
3498
+ const lng = parseFloat(longitude);
3499
+ const coords = feature.geometry.coordinates;
3500
+ if (isNaN(lng)) {
3501
+ toast({ title: "Invalid longitude", description: "Please enter a valid number", variant: "destructive" });
3502
+ setLongitude(coords[0].toFixed(6));
3503
+ } else if (lng < -180 || lng > 180) {
3504
+ toast({ title: "Invalid longitude", description: "Longitude must be between -180 and 180", variant: "destructive" });
3505
+ setLongitude(coords[0].toFixed(6));
3506
+ } else if (isNaN(lat) || lat < -90 || lat > 90) ;
3507
+ else {
3508
+ onUpdateGeometry(feature.id, { type: "Point", coordinates: [lng, lat] });
3439
3509
  }
3440
- },
3441
- placeholder: "Longitude",
3442
- readOnly: feature.geometry.type !== "Point" || !isEditMode || isReadOnlyLayer,
3443
- className: "!h-6 text-[13px] flex-1",
3444
- "data-testid": "input-feature-longitude"
3510
+ }
3445
3511
  }
3446
- )
3447
- ] })
3448
- ] }),
3449
- /* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
3450
- /* @__PURE__ */ jsx("label", { htmlFor: "feature-description", className: "text-xs text-muted-foreground", children: "Description" }),
3451
- /* @__PURE__ */ jsx(
3452
- TextArea,
3453
- {
3454
- id: "feature-description",
3455
- value: description,
3456
- onChange: (e) => setDescription(e.target.value),
3457
- onBlur: () => handleSave(),
3458
- placeholder: isEditMode ? "Add description..." : "No description",
3459
- className: "!min-h-[50px] resize-none text-[13px]",
3460
- readOnly: !isEditMode,
3461
- "data-testid": "input-feature-description"
3462
3512
  }
3463
3513
  )
3464
3514
  ] }),
@@ -3474,7 +3524,7 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
3474
3524
  key: "temporal",
3475
3525
  label: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
3476
3526
  /* @__PURE__ */ jsx(Calendar, { className: "w-3 h-3 text-foreground" }),
3477
- /* @__PURE__ */ jsx("span", { className: "text-xs font-medium", children: "Temporal" }),
3527
+ /* @__PURE__ */ jsx("span", { className: "text-[11px] font-bold uppercase tracking-wide text-foreground", children: "Temporal" }),
3478
3528
  (startDate || endDate) && /* @__PURE__ */ jsxs("span", { className: "text-[10px] text-muted-foreground ml-1", children: [
3479
3529
  "(",
3480
3530
  startDate && endDate ? "2 dates" : "1 date",
@@ -3561,10 +3611,10 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
3561
3611
  }
3562
3612
  ),
3563
3613
  /* @__PURE__ */ jsx(Divider, { className: "!my-1.5" }),
3564
- /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
3614
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
3565
3615
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
3566
3616
  /* @__PURE__ */ jsx(Palette, { className: "w-3 h-3 text-foreground" }),
3567
- /* @__PURE__ */ jsx("span", { className: "text-xs font-medium", children: "Style" })
3617
+ /* @__PURE__ */ jsx("span", { className: "text-[11px] font-bold uppercase tracking-wide text-foreground", children: "Style" })
3568
3618
  ] }),
3569
3619
  feature.properties.kind === "text" && /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
3570
3620
  /* @__PURE__ */ jsxs("div", { children: [
@@ -3681,6 +3731,8 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
3681
3731
  disabled: !isEditMode,
3682
3732
  size: "small",
3683
3733
  showText: false,
3734
+ disabledAlpha: true,
3735
+ panelRender: colorPickerNoHexPanel,
3684
3736
  "data-testid": "color-picker-stroke"
3685
3737
  }
3686
3738
  ) }) }),
@@ -3755,6 +3807,8 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
3755
3807
  disabled: !isEditMode,
3756
3808
  size: "small",
3757
3809
  showText: false,
3810
+ disabledAlpha: true,
3811
+ panelRender: colorPickerNoHexPanel,
3758
3812
  "data-testid": "color-picker-fill"
3759
3813
  }
3760
3814
  ) }) }),
@@ -3811,49 +3865,67 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
3811
3865
  ] })
3812
3866
  ] }),
3813
3867
  /* @__PURE__ */ jsx(Divider, { className: "!my-1.5" }),
3814
- /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
3815
- /* @__PURE__ */ jsx("span", { className: "text-xs font-medium", children: "Custom Properties" }),
3816
- customProperties.length === 0 && !isEditMode && /* @__PURE__ */ jsx("p", { className: "text-[13px] text-muted-foreground", children: "None" }),
3817
- customProperties.length > 0 && /* @__PURE__ */ jsx("div", { className: "space-y-0.5", children: customProperties.map((prop, index) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-0.5", children: [
3818
- /* @__PURE__ */ jsx(
3819
- Input,
3820
- {
3821
- value: prop.key,
3822
- onChange: (e) => handlePropertyKeyChange(index, e.target.value),
3823
- onBlur: () => handleSave(),
3824
- placeholder: "Key",
3825
- className: "flex-1 text-[13px] font-mono !h-5 !px-1",
3826
- readOnly: !isEditMode,
3827
- "data-testid": `input-property-key-${index}`
3828
- }
3829
- ),
3830
- /* @__PURE__ */ jsx(
3831
- Input,
3832
- {
3833
- value: prop.value,
3834
- onChange: (e) => handlePropertyValueChange(index, e.target.value),
3835
- onBlur: () => handleSave(),
3836
- placeholder: "Val",
3837
- className: "flex-1 text-[13px] !h-5 !px-1",
3838
- readOnly: !isEditMode,
3839
- "data-testid": `input-property-value-${index}`
3840
- }
3841
- ),
3842
- isEditMode && /* @__PURE__ */ jsx(
3843
- "button",
3844
- {
3845
- type: "button",
3846
- onClick: () => {
3847
- handleRemoveProperty(index);
3848
- setTimeout(() => handleSave(), 0);
3849
- },
3850
- className: "text-destructive shrink-0 h-5 w-5 flex items-center justify-center",
3851
- "data-testid": `button-remove-property-${index}`,
3852
- children: /* @__PURE__ */ jsx(Trash2, { className: "w-2.5 h-2.5" })
3853
- }
3854
- )
3855
- ] }, index)) }),
3856
- isEditMode && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-0.5", children: [
3868
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
3869
+ /* @__PURE__ */ jsx("span", { className: "text-[11px] font-bold uppercase tracking-wide text-foreground", children: "Properties" }),
3870
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
3871
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-1", children: [
3872
+ /* @__PURE__ */ jsx("div", { className: "text-[13px] font-mono text-muted-foreground shrink-0 w-24 px-1 leading-6 select-none", children: "description" }),
3873
+ /* @__PURE__ */ jsx(
3874
+ TextArea,
3875
+ {
3876
+ id: "feature-description",
3877
+ value: description,
3878
+ onChange: (e) => setDescription(e.target.value),
3879
+ onBlur: () => handleSave(),
3880
+ autoSize: { minRows: 1, maxRows: 5 },
3881
+ placeholder: isEditMode ? "—" : "",
3882
+ readOnly: !isEditMode,
3883
+ className: "flex-1 !text-[13px] !px-1.5 !py-0.5 resize-none",
3884
+ "data-testid": "input-feature-description"
3885
+ }
3886
+ )
3887
+ ] }),
3888
+ customProperties.map((prop, index) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
3889
+ /* @__PURE__ */ jsx(
3890
+ Input,
3891
+ {
3892
+ value: prop.key,
3893
+ onChange: (e) => handlePropertyKeyChange(index, e.target.value),
3894
+ onBlur: () => handleSave(),
3895
+ placeholder: "Key",
3896
+ className: "shrink-0 w-24 text-[13px] font-mono !h-6 !px-1",
3897
+ readOnly: !isEditMode,
3898
+ "data-testid": `input-property-key-${index}`
3899
+ }
3900
+ ),
3901
+ /* @__PURE__ */ jsx(
3902
+ Input,
3903
+ {
3904
+ value: prop.value,
3905
+ onChange: (e) => handlePropertyValueChange(index, e.target.value),
3906
+ onBlur: () => handleSave(),
3907
+ placeholder: "Value",
3908
+ className: "flex-1 text-[13px] !h-6 !px-1.5",
3909
+ readOnly: !isEditMode,
3910
+ "data-testid": `input-property-value-${index}`
3911
+ }
3912
+ ),
3913
+ isEditMode && /* @__PURE__ */ jsx(
3914
+ "button",
3915
+ {
3916
+ type: "button",
3917
+ onClick: () => {
3918
+ handleRemoveProperty(index);
3919
+ setTimeout(() => handleSave(), 0);
3920
+ },
3921
+ className: "text-destructive shrink-0 h-6 w-6 flex items-center justify-center rounded hover:bg-destructive/10 transition-colors",
3922
+ "data-testid": `button-remove-property-${index}`,
3923
+ children: /* @__PURE__ */ jsx(Trash2, { className: "w-3 h-3" })
3924
+ }
3925
+ )
3926
+ ] }, index))
3927
+ ] }),
3928
+ isEditMode && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 pt-0.5", children: [
3857
3929
  /* @__PURE__ */ jsx(
3858
3930
  Input,
3859
3931
  {
@@ -3865,8 +3937,8 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
3865
3937
  handleAddProperty();
3866
3938
  }
3867
3939
  },
3868
- placeholder: "New property...",
3869
- className: "flex-1 text-[13px] !h-5 !px-1",
3940
+ placeholder: "New property…",
3941
+ className: "flex-1 text-[13px] !h-6 !px-1.5",
3870
3942
  "data-testid": "input-new-property-key"
3871
3943
  }
3872
3944
  ),
@@ -3876,9 +3948,9 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
3876
3948
  type: "button",
3877
3949
  onClick: handleAddProperty,
3878
3950
  disabled: !newPropertyKey.trim(),
3879
- className: "h-5 w-5 flex items-center justify-center border border-border rounded disabled:opacity-50",
3951
+ className: "h-6 w-6 flex items-center justify-center border border-border rounded disabled:opacity-50 hover:bg-muted transition-colors",
3880
3952
  "data-testid": "button-add-property",
3881
- children: /* @__PURE__ */ jsx(Plus, { className: "w-2.5 h-2.5" })
3953
+ children: /* @__PURE__ */ jsx(Plus, { className: "w-3 h-3" })
3882
3954
  }
3883
3955
  )
3884
3956
  ] })
@@ -3898,7 +3970,7 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
3898
3970
  /* @__PURE__ */ jsx("span", { className: "text-[12px] text-muted-foreground", children: "Layer:" }),
3899
3971
  /* @__PURE__ */ jsx("span", { className: "text-[12px] text-foreground truncate", children: layerName })
3900
3972
  ] }),
3901
- /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1.5 flex-wrap", children: /* @__PURE__ */ jsx(Tag, { color: "cyan", className: "!text-[10px] !px-1.5 !py-0 !leading-4 !m-0", children: "Octostar record" }) })
3973
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 flex-wrap", children: /* @__PURE__ */ jsx(Tag, { color: "cyan", className: "!text-[12px] !px-2.5 !py-0.5 !leading-5 !m-0 !font-semibold", children: "Octostar record" }) })
3902
3974
  ] }),
3903
3975
  /* @__PURE__ */ jsx(Divider, { className: "!my-1.5" }),
3904
3976
  /* @__PURE__ */ jsx("div", { className: "space-y-1", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
@@ -3919,93 +3991,73 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
3919
3991
  ) })
3920
3992
  ] }) }),
3921
3993
  /* @__PURE__ */ jsx(Divider, { className: "!my-1.5" }),
3922
- feature.properties.description && /* @__PURE__ */ jsxs(Fragment, { children: [
3923
- /* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
3924
- /* @__PURE__ */ jsx("label", { className: "text-xs text-muted-foreground", children: "Description" }),
3925
- /* @__PURE__ */ jsx("p", { className: "text-[13px] text-foreground whitespace-pre-wrap break-words m-0", children: String(feature.properties.description) })
3926
- ] }),
3927
- /* @__PURE__ */ jsx(Divider, { className: "!my-1.5" })
3928
- ] }),
3929
3994
  /* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
3930
3995
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
3931
3996
  /* @__PURE__ */ jsx(MapPin, { className: "w-3 h-3 text-muted-foreground" }),
3932
3997
  /* @__PURE__ */ jsx("label", { className: "text-xs text-muted-foreground", children: "Lat / Lng" }),
3933
3998
  feature.geometry.type !== "Point" && /* @__PURE__ */ jsx(Tooltip, { title: "Lat and Lng refer to the centroid of this feature", children: /* @__PURE__ */ jsx("span", { className: "text-[13px] text-muted-foreground cursor-help", children: "*" }) })
3934
3999
  ] }),
3935
- /* @__PURE__ */ jsxs("div", { className: "flex gap-1", children: [
3936
- /* @__PURE__ */ jsx(
3937
- Input,
3938
- {
3939
- value: latitude,
3940
- onChange: (e) => setLatitude(e.target.value),
3941
- onFocus: () => {
3942
- latInputFocused.current = true;
3943
- },
3944
- onBlur: () => {
3945
- latInputFocused.current = false;
3946
- if (feature.geometry.type === "Point" && isEditMode && !isReadOnlyLayer && onUpdateGeometry) {
3947
- const lat = parseFloat(latitude);
3948
- const lng = parseFloat(longitude);
3949
- const coords = feature.geometry.coordinates;
3950
- if (isNaN(lat)) {
3951
- toast({ title: "Invalid latitude", description: "Please enter a valid number", variant: "destructive" });
3952
- setLatitude(coords[1].toFixed(6));
3953
- } else if (lat < -90 || lat > 90) {
3954
- toast({ title: "Invalid latitude", description: "Latitude must be between -90 and 90", variant: "destructive" });
3955
- setLatitude(coords[1].toFixed(6));
3956
- } else if (isNaN(lng) || lng < -180 || lng > 180) ;
3957
- else {
3958
- onUpdateGeometry(feature.id, { type: "Point", coordinates: [lng, lat] });
3959
- }
4000
+ /* @__PURE__ */ jsx(
4001
+ LatLngFields,
4002
+ {
4003
+ latitude,
4004
+ longitude,
4005
+ isEditable: feature.geometry.type === "Point" && isEditMode && !isReadOnlyLayer,
4006
+ testIdPrefix: "input-record",
4007
+ onLatChange: setLatitude,
4008
+ onLngChange: setLongitude,
4009
+ onLatFocus: () => {
4010
+ latInputFocused.current = true;
4011
+ },
4012
+ onLngFocus: () => {
4013
+ lngInputFocused.current = true;
4014
+ },
4015
+ onLatBlur: () => {
4016
+ latInputFocused.current = false;
4017
+ if (feature.geometry.type === "Point" && isEditMode && !isReadOnlyLayer && onUpdateGeometry) {
4018
+ const lat = parseFloat(latitude);
4019
+ const lng = parseFloat(longitude);
4020
+ const coords = feature.geometry.coordinates;
4021
+ if (isNaN(lat)) {
4022
+ toast({ title: "Invalid latitude", description: "Please enter a valid number", variant: "destructive" });
4023
+ setLatitude(coords[1].toFixed(6));
4024
+ } else if (lat < -90 || lat > 90) {
4025
+ toast({ title: "Invalid latitude", description: "Latitude must be between -90 and 90", variant: "destructive" });
4026
+ setLatitude(coords[1].toFixed(6));
4027
+ } else if (isNaN(lng) || lng < -180 || lng > 180) ;
4028
+ else {
4029
+ onUpdateGeometry(feature.id, { type: "Point", coordinates: [lng, lat] });
3960
4030
  }
3961
- },
3962
- placeholder: "Latitude",
3963
- readOnly: feature.geometry.type !== "Point" || !isEditMode || isReadOnlyLayer,
3964
- className: "!h-6 text-[13px] flex-1",
3965
- "data-testid": "input-record-latitude"
3966
- }
3967
- ),
3968
- /* @__PURE__ */ jsx(
3969
- Input,
3970
- {
3971
- value: longitude,
3972
- onChange: (e) => setLongitude(e.target.value),
3973
- onFocus: () => {
3974
- lngInputFocused.current = true;
3975
- },
3976
- onBlur: () => {
3977
- lngInputFocused.current = false;
3978
- if (feature.geometry.type === "Point" && isEditMode && !isReadOnlyLayer && onUpdateGeometry) {
3979
- const lat = parseFloat(latitude);
3980
- const lng = parseFloat(longitude);
3981
- const coords = feature.geometry.coordinates;
3982
- if (isNaN(lng)) {
3983
- toast({ title: "Invalid longitude", description: "Please enter a valid number", variant: "destructive" });
3984
- setLongitude(coords[0].toFixed(6));
3985
- } else if (lng < -180 || lng > 180) {
3986
- toast({ title: "Invalid longitude", description: "Longitude must be between -180 and 180", variant: "destructive" });
3987
- setLongitude(coords[0].toFixed(6));
3988
- } else if (isNaN(lat) || lat < -90 || lat > 90) ;
3989
- else {
3990
- onUpdateGeometry(feature.id, { type: "Point", coordinates: [lng, lat] });
3991
- }
4031
+ }
4032
+ },
4033
+ onLngBlur: () => {
4034
+ lngInputFocused.current = false;
4035
+ if (feature.geometry.type === "Point" && isEditMode && !isReadOnlyLayer && onUpdateGeometry) {
4036
+ const lat = parseFloat(latitude);
4037
+ const lng = parseFloat(longitude);
4038
+ const coords = feature.geometry.coordinates;
4039
+ if (isNaN(lng)) {
4040
+ toast({ title: "Invalid longitude", description: "Please enter a valid number", variant: "destructive" });
4041
+ setLongitude(coords[0].toFixed(6));
4042
+ } else if (lng < -180 || lng > 180) {
4043
+ toast({ title: "Invalid longitude", description: "Longitude must be between -180 and 180", variant: "destructive" });
4044
+ setLongitude(coords[0].toFixed(6));
4045
+ } else if (isNaN(lat) || lat < -90 || lat > 90) ;
4046
+ else {
4047
+ onUpdateGeometry(feature.id, { type: "Point", coordinates: [lng, lat] });
3992
4048
  }
3993
- },
3994
- placeholder: "Longitude",
3995
- readOnly: feature.geometry.type !== "Point" || !isEditMode || isReadOnlyLayer,
3996
- className: "!h-6 text-[13px] flex-1",
3997
- "data-testid": "input-record-longitude"
4049
+ }
3998
4050
  }
3999
- )
4000
- ] })
4051
+ }
4052
+ )
4001
4053
  ] }),
4002
4054
  recordProperties.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
4003
4055
  /* @__PURE__ */ jsx(Divider, { className: "!my-1.5" }),
4004
4056
  /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
4005
- /* @__PURE__ */ jsx("span", { className: "text-xs font-medium", children: "Properties" }),
4057
+ /* @__PURE__ */ jsx("span", { className: "text-[11px] font-bold uppercase tracking-wide text-foreground", children: "Properties" }),
4006
4058
  /* @__PURE__ */ jsx("div", { className: "space-y-0.5", children: recordProperties.map(({ key, value }) => /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2 py-0.5", children: [
4007
4059
  /* @__PURE__ */ jsx("span", { className: "text-[11px] text-muted-foreground shrink-0 pt-px min-w-[80px]", children: formatPropertyKey(key) }),
4008
- /* @__PURE__ */ jsx("span", { className: "text-[13px] text-foreground break-all", children: value })
4060
+ /* @__PURE__ */ jsx("span", { className: "text-[13px] text-foreground whitespace-pre-wrap break-words", children: value })
4009
4061
  ] }, key)) })
4010
4062
  ] })
4011
4063
  ] }),
@@ -4025,7 +4077,7 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
4025
4077
  return /* @__PURE__ */ jsxs(
4026
4078
  "div",
4027
4079
  {
4028
- 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",
4080
+ 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",
4029
4081
  style: { maxHeight: "calc(100vh - 6rem)" },
4030
4082
  "data-testid": "panel-properties",
4031
4083
  children: [
@@ -4158,7 +4210,7 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
4158
4210
  return /* @__PURE__ */ jsxs(
4159
4211
  "div",
4160
4212
  {
4161
- 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",
4213
+ 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",
4162
4214
  style: { maxHeight: "calc(100vh - 6rem)" },
4163
4215
  "data-testid": "panel-properties",
4164
4216
  children: [
@@ -5692,6 +5744,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
5692
5744
  enableProperties = true,
5693
5745
  toastProvider,
5694
5746
  customGlobalMenuItems,
5747
+ extraLayerToolbarButtons,
5695
5748
  layerBadgeProvider,
5696
5749
  featureCountProvider,
5697
5750
  fitBoundsProvider,
@@ -5774,6 +5827,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
5774
5827
  const [cursorCoords, setCursorCoords] = useState(null);
5775
5828
  const [contextMenu, setContextMenu] = useState(null);
5776
5829
  const timelineStore = useTimelineStore();
5830
+ useEffect(() => () => useTimelineStore.getState().reset(), []);
5777
5831
  const { toast: internalToast } = useToast();
5778
5832
  const toast = toastProvider ?? internalToast;
5779
5833
  useEffect(() => {
@@ -6137,7 +6191,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
6137
6191
  const sourceData = {
6138
6192
  type: "FeatureCollection",
6139
6193
  features: allFeatures.map((f) => {
6140
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
6194
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
6141
6195
  const featureId = String(f.id);
6142
6196
  const layer = featureToLayer.get(featureId);
6143
6197
  const visualConfig = layer == null ? void 0 : layer.visualConfig;
@@ -6209,8 +6263,8 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
6209
6263
  featureIconSize = iconConfig.size ?? 24;
6210
6264
  }
6211
6265
  const isPoint = f.geometry.type === "Point";
6212
- 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);
6213
- 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);
6266
+ const hideByHeatmap = isPoint && ((_i = layer == null ? void 0 : layer.heatmapConfig) == null ? void 0 : _i.enabled) === true;
6267
+ 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);
6214
6268
  const isSelected = selectedIds.includes(featureId);
6215
6269
  const hideByTrace = false;
6216
6270
  const isLine = f.geometry.type === "LineString" || f.geometry.type === "MultiLineString";
@@ -6252,7 +6306,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
6252
6306
  "stroke-width": strokeWidth,
6253
6307
  "stroke-opacity": hideFlatFor3DOnly ? 0 : isTimelineVisible ? baseOpacity : 0,
6254
6308
  fill: strokeColor,
6255
- "fill-opacity": hideFlatFor3DOnly ? 0 : isTimelineVisible ? ((_m = f.properties) == null ? void 0 : _m["fill-opacity"]) ?? 0.2 : 0,
6309
+ "fill-opacity": hideFlatFor3DOnly ? 0 : isTimelineVisible ? ((_l = f.properties) == null ? void 0 : _l["fill-opacity"]) ?? 0.2 : 0,
6256
6310
  pointRadius,
6257
6311
  isHiddenFor3DOnly: hideFlatFor3DOnly ? 1 : 0,
6258
6312
  isTimelineHidden: isTimelineVisible ? 0 : 1
@@ -6638,8 +6692,15 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
6638
6692
  attributionControl: false,
6639
6693
  boxZoom: false,
6640
6694
  // Disable default box zoom - we use shift+drag for selection instead
6641
- maxPitch: 80
6695
+ maxPitch: 80,
6642
6696
  // Allow steep camera angles for 3D terrain viewing
6697
+ // Required for `getCanvas().toDataURL()` (used by `captureScreenshot()`
6698
+ // on the imperative handle) to return a populated image instead of a
6699
+ // blank one. In maplibre-gl v5 this lives under
6700
+ // `canvasContextAttributes`, not at the top level. Modern desktop GPUs
6701
+ // absorb the small extra cost without measurable impact on this
6702
+ // editor-grade map.
6703
+ canvasContextAttributes: { preserveDrawingBuffer: true }
6643
6704
  });
6644
6705
  const attrCtrl = new maplibregl.AttributionControl({
6645
6706
  compact: true,
@@ -6916,6 +6977,33 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
6916
6977
  // Text features: center anchor; others: top anchor
6917
6978
  "text-anchor": ["case", ["==", ["get", "kind"], "text"], "center", "top"],
6918
6979
  "text-offset": ["case", ["==", ["get", "kind"], "text"], ["literal", [0, 0]], ["literal", [0, 0.8]]],
6980
+ // Always allow overlap for every label this layer renders.
6981
+ //
6982
+ // The earlier `false` branch (for plain entity labels) was an
6983
+ // attempt to thin dense clusters via MapLibre's collision
6984
+ // detection. In practice it interacts poorly with this layer:
6985
+ //
6986
+ // - The `custom-labels` symbol layer has NO `icon-image`, so
6987
+ // `text-optional: true` cannot fall back to "show icon, drop
6988
+ // text". MapLibre instead drops the entire symbol when the
6989
+ // text loses collision.
6990
+ // - Vector basemaps (Streets / OSM Bright) place dense
6991
+ // city / POI / street labels everywhere, and our entity
6992
+ // label loses against ANY of them even at low zoom on an
6993
+ // otherwise-empty map. The PR that introduced collision
6994
+ // here only anticipated this happening "occasionally at
6995
+ // very high zoom", but the empirical behaviour is far more
6996
+ // aggressive.
6997
+ //
6998
+ // Net effect of the previous setting: a freshly dropped entity
6999
+ // point on an editable layer rendered NO label at all on most
7000
+ // basemaps, even with a single feature on the map.
7001
+ //
7002
+ // Reverting to unconditional `true` restores the previous
7003
+ // (working) behaviour. Stacking in dense clusters should be
7004
+ // addressed via a different mechanism (cluster/heatmap modes
7005
+ // already exist; per-zoom font-size or a host-supplied
7006
+ // collision opt-in are options if revisited).
6919
7007
  "text-allow-overlap": true,
6920
7008
  "text-ignore-placement": false,
6921
7009
  "text-optional": true,
@@ -7835,6 +7923,101 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
7835
7923
  if (!map.current || !isMapLoadedRef.current) return;
7836
7924
  map.current.flyTo({ center: coords, zoom: zoom ?? map.current.getZoom(), duration: (options == null ? void 0 : options.duration) ?? 2e3 });
7837
7925
  },
7926
+ updateLayerConfig: (layerId, config) => {
7927
+ const idx = layersRef.current.findIndex((l) => l.id === layerId);
7928
+ if (idx < 0) return false;
7929
+ const current = layersRef.current[idx];
7930
+ const next = { ...current };
7931
+ if ("visible" in config) {
7932
+ const wantedVisible = config.visible ?? true;
7933
+ if (wantedVisible !== current.visible && !current.readOnly && draw.current) {
7934
+ if (wantedVisible) {
7935
+ const hidden = hiddenFeatures.current.get(layerId) || [];
7936
+ const newIds = [];
7937
+ isApiAddingRef.current = true;
7938
+ try {
7939
+ hidden.forEach((f) => {
7940
+ const ids = draw.current.add(f);
7941
+ newIds.push(ids[0]);
7942
+ });
7943
+ } finally {
7944
+ isApiAddingRef.current = false;
7945
+ }
7946
+ hiddenFeatures.current.delete(layerId);
7947
+ next.visible = true;
7948
+ next.featureIds = newIds;
7949
+ } else {
7950
+ const features = current.featureIds.map((id) => draw.current.get(id)).filter(Boolean);
7951
+ hiddenFeatures.current.set(layerId, features);
7952
+ current.featureIds.forEach((id) => {
7953
+ try {
7954
+ draw.current.delete(id);
7955
+ } catch {
7956
+ }
7957
+ });
7958
+ next.visible = false;
7959
+ next.featureIds = [];
7960
+ }
7961
+ } else {
7962
+ next.visible = wantedVisible;
7963
+ }
7964
+ }
7965
+ if ("visualConfig" in config) next.visualConfig = config.visualConfig;
7966
+ if ("traceConfig" in config) next.traceConfig = config.traceConfig;
7967
+ if ("heatmapConfig" in config) next.heatmapConfig = config.heatmapConfig;
7968
+ if ("clusterConfig" in config) next.clusterConfig = config.clusterConfig;
7969
+ if ("altitudeDisplayMode" in config) next.altitudeDisplayMode = config.altitudeDisplayMode;
7970
+ const updated = [...layersRef.current];
7971
+ updated[idx] = next;
7972
+ layersRef.current = updated;
7973
+ setLayers(updated);
7974
+ if ("visible" in config) {
7975
+ updateFeatureCount();
7976
+ scheduleTimelineUpdate();
7977
+ }
7978
+ requestAnimationFrame(() => syncRef.current());
7979
+ return true;
7980
+ },
7981
+ captureScreenshot: async (options) => {
7982
+ const m = map.current;
7983
+ if (!m || !isMapLoadedRef.current) {
7984
+ toast({
7985
+ title: "Screenshot failed",
7986
+ description: "Map is not ready yet.",
7987
+ variant: "destructive"
7988
+ });
7989
+ throw new Error("Map is not ready");
7990
+ }
7991
+ const SCREENSHOT_RENDER_TIMEOUT_MS = 1e4;
7992
+ try {
7993
+ await new Promise((resolve, reject) => {
7994
+ const onRender = () => {
7995
+ clearTimeout(timeoutId);
7996
+ resolve();
7997
+ };
7998
+ const timeoutId = setTimeout(() => {
7999
+ try {
8000
+ m.off("render", onRender);
8001
+ } catch {
8002
+ }
8003
+ reject(new Error("Screenshot timed out waiting for render (map may have been destroyed)"));
8004
+ }, SCREENSHOT_RENDER_TIMEOUT_MS);
8005
+ m.once("render", onRender);
8006
+ m.triggerRepaint();
8007
+ });
8008
+ } catch (err) {
8009
+ toast({
8010
+ title: "Screenshot failed",
8011
+ description: err instanceof Error ? err.message : "The map did not render in time. Please try again.",
8012
+ variant: "destructive"
8013
+ });
8014
+ throw err;
8015
+ }
8016
+ const canvas = m.getCanvas();
8017
+ const fmt = (options == null ? void 0 : options.format) === "jpeg" ? "image/jpeg" : "image/png";
8018
+ const dataUrl = fmt === "image/jpeg" ? canvas.toDataURL(fmt, options == null ? void 0 : options.quality) : canvas.toDataURL(fmt);
8019
+ return { dataUrl, width: canvas.width, height: canvas.height };
8020
+ },
7838
8021
  fitToData: (layerIds) => {
7839
8022
  if (!map.current || !isMapLoadedRef.current) return;
7840
8023
  const drawFeatures = draw.current ? draw.current.getAll().features : [];
@@ -7873,11 +8056,25 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
7873
8056
  const newLayer = {
7874
8057
  id: layerId,
7875
8058
  name,
7876
- visible: true,
8059
+ // Default to visible. The optional `visible` flag lets restore-flows
8060
+ // recreate a layer that the user had previously hidden, without
8061
+ // racing a follow-up `setLayerVisibility(id, false)` call (which
8062
+ // briefly flashes the layer on screen between addLayer and the
8063
+ // visibility toggle).
8064
+ visible: (options == null ? void 0 : options.visible) ?? true,
7877
8065
  featureIds: [],
7878
8066
  readOnly: options == null ? void 0 : options.readOnly,
7879
8067
  group: options == null ? void 0 : options.group,
7880
- metadata: options == null ? void 0 : options.metadata
8068
+ metadata: options == null ? void 0 : options.metadata,
8069
+ // Per-layer visual configs are passed through verbatim so that hosts
8070
+ // restoring a saved map (workspace auto-save, file merge, etc.) can
8071
+ // recreate heatmap / cluster / color-by-field / label / size / trace
8072
+ // settings without a follow-up "update visual config" round-trip.
8073
+ visualConfig: options == null ? void 0 : options.visualConfig,
8074
+ traceConfig: options == null ? void 0 : options.traceConfig,
8075
+ heatmapConfig: options == null ? void 0 : options.heatmapConfig,
8076
+ clusterConfig: options == null ? void 0 : options.clusterConfig,
8077
+ altitudeDisplayMode: options == null ? void 0 : options.altitudeDisplayMode
7881
8078
  };
7882
8079
  if (geojson) {
7883
8080
  if (options == null ? void 0 : options.readOnly) {
@@ -7916,6 +8113,17 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
7916
8113
  }
7917
8114
  }
7918
8115
  }
8116
+ if (newLayer.visible === false && !(options == null ? void 0 : options.readOnly) && draw.current && newLayer.featureIds.length > 0) {
8117
+ const features = newLayer.featureIds.map((id) => draw.current.get(id)).filter(Boolean);
8118
+ hiddenFeatures.current.set(layerId, features);
8119
+ newLayer.featureIds.forEach((id) => {
8120
+ try {
8121
+ draw.current.delete(id);
8122
+ } catch {
8123
+ }
8124
+ });
8125
+ newLayer.featureIds = [];
8126
+ }
7919
8127
  const updatedLayers = [...layersRef.current, newLayer];
7920
8128
  layersRef.current = updatedLayers;
7921
8129
  setLayers(updatedLayers);
@@ -12158,6 +12366,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
12158
12366
  hideBasemapSwitcher,
12159
12367
  externalPersistence,
12160
12368
  customGlobalMenuItems,
12369
+ extraLayerToolbarButtons,
12161
12370
  layerBadgeProvider,
12162
12371
  featureCountProvider
12163
12372
  }