@octostar/map-component 0.6.0 → 0.6.1

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
@@ -2737,6 +2737,16 @@ function cn(...inputs) {
2737
2737
  function pushAll(target, items) {
2738
2738
  for (const item of items) target.push(item);
2739
2739
  }
2740
+ const HTML_ESCAPES = {
2741
+ "&": "&",
2742
+ "<": "&lt;",
2743
+ ">": "&gt;",
2744
+ '"': "&quot;",
2745
+ "'": "&#39;"
2746
+ };
2747
+ function escapeHtml(value) {
2748
+ return String(value).replace(/[&<>"']/g, (ch) => HTML_ESCAPES[ch]);
2749
+ }
2740
2750
  function downloadBlob(blob, filename) {
2741
2751
  const url = URL.createObjectURL(blob);
2742
2752
  const anchor = document.createElement("a");
@@ -11548,13 +11558,13 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
11548
11558
  const displayProps = Object.entries(props).filter(([key, value]) => !TOOLTIP_EXCLUDED_KEYS.includes(key) && !key.startsWith("_") && !key.startsWith("isHidden") && !key.startsWith("isTrace") && !key.startsWith("isTimeline") && !key.startsWith("trace") && value != null && value !== "").slice(0, 5);
11549
11559
  const name = props.name;
11550
11560
  let html = '<div class="text-sm space-y-0.5">';
11551
- if (name) html += `<div class="font-medium">${name}</div>`;
11552
- if (featureId) html += `<div class="text-xs text-muted-foreground"><span class="opacity-70">ID:</span> ${String(featureId).slice(0, 30)}</div>`;
11561
+ if (name) html += `<div class="font-medium">${escapeHtml(name)}</div>`;
11562
+ if (featureId) html += `<div class="text-xs text-muted-foreground"><span class="opacity-70">ID:</span> ${escapeHtml(featureId.slice(0, 30))}</div>`;
11553
11563
  const otherProps = displayProps.filter(([k]) => k !== "name" && k !== "id");
11554
11564
  if (otherProps.length > 0) {
11555
11565
  html += '<div class="text-xs text-muted-foreground space-y-0.5">';
11556
11566
  otherProps.forEach(([key, value]) => {
11557
- html += `<div><span class="opacity-70">${key}:</span> ${String(value).slice(0, 30)}</div>`;
11567
+ html += `<div><span class="opacity-70">${escapeHtml(key)}:</span> ${escapeHtml(String(value).slice(0, 30))}</div>`;
11558
11568
  });
11559
11569
  html += "</div>";
11560
11570
  }
@@ -11562,7 +11572,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
11562
11572
  html += '<div class="text-xs border-t border-border/50 mt-1 pt-1 space-y-0.5">';
11563
11573
  highlightFields.forEach((fieldName) => {
11564
11574
  const value = props[fieldName];
11565
- if (value != null && value !== "") html += `<div class="flex justify-between gap-2"><span class="opacity-70">${fieldName}:</span> <span class="font-medium">${String(value).slice(0, 20)}</span></div>`;
11575
+ if (value != null && value !== "") html += `<div class="flex justify-between gap-2"><span class="opacity-70">${escapeHtml(fieldName)}:</span> <span class="font-medium">${escapeHtml(String(value).slice(0, 20))}</span></div>`;
11566
11576
  });
11567
11577
  html += "</div>";
11568
11578
  }
@@ -11779,15 +11789,15 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
11779
11789
  const toName = props.toName || "";
11780
11790
  let html = '<div class="text-sm space-y-1">';
11781
11791
  if (fromName || toName) {
11782
- html += `<div class="font-medium text-xs text-muted-foreground">${fromName || "?"} → ${toName || "?"}</div>`;
11792
+ html += `<div class="font-medium text-xs text-muted-foreground">${escapeHtml(fromName || "?")} → ${escapeHtml(toName || "?")}</div>`;
11783
11793
  }
11784
11794
  html += '<div class="space-y-0.5">';
11785
- html += `<div><span class="text-muted-foreground">Duration:</span> <span class="font-medium">${duration}</span></div>`;
11786
- html += `<div><span class="text-muted-foreground">Distance:</span> <span class="font-medium">${distance2}</span></div>`;
11787
- html += `<div><span class="text-muted-foreground">Avg Speed:</span> <span class="font-medium">${avgSpeed}</span></div>`;
11795
+ html += `<div><span class="text-muted-foreground">Duration:</span> <span class="font-medium">${escapeHtml(duration)}</span></div>`;
11796
+ html += `<div><span class="text-muted-foreground">Distance:</span> <span class="font-medium">${escapeHtml(distance2)}</span></div>`;
11797
+ html += `<div><span class="text-muted-foreground">Avg Speed:</span> <span class="font-medium">${escapeHtml(avgSpeed)}</span></div>`;
11788
11798
  html += "</div>";
11789
11799
  if (group) {
11790
- html += `<div class="text-xs text-muted-foreground border-t border-border/50 mt-1 pt-1">Group: ${group}</div>`;
11800
+ html += `<div class="text-xs text-muted-foreground border-t border-border/50 mt-1 pt-1">Group: ${escapeHtml(group)}</div>`;
11791
11801
  }
11792
11802
  html += "</div>";
11793
11803
  if (!tracePopupRef.current) {
@@ -18258,6 +18268,7 @@ export {
18258
18268
  cn,
18259
18269
  createClusterPieManager,
18260
18270
  createTimelineStore,
18271
+ escapeHtml,
18261
18272
  featureCollectionBlobPartsAsync,
18262
18273
  getIconEmoji,
18263
18274
  isFeatureInRange,