@trackunit/react-map 0.2.250 → 0.2.257
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/index.cjs.js +82 -74
- package/index.esm.js +82 -74
- package/package.json +11 -11
- package/src/layers/internal/stickSolver.d.ts +30 -13
- package/src/layers/useHeatmap/HeatmapBenchmarkHistoryCompactMedianSummary.d.ts +7 -0
- package/src/layers/useHeatmap/HeatmapBenchmarkHistoryRunReport.d.ts +8 -0
- package/src/layers/useHeatmap/HeatmapPerformancePanel.d.ts +22 -0
- package/src/layers/useHeatmap/heatmapBenchmarkHistory.d.ts +456 -0
- package/src/layers/useHeatmap/heatmapScaleFixture.d.ts +13 -0
- package/src/stories/benchmarkSchemas.d.ts +17 -0
package/index.cjs.js
CHANGED
|
@@ -6484,8 +6484,32 @@ const sqDistance = (a, b) => {
|
|
|
6484
6484
|
return dx * dx + dy * dy;
|
|
6485
6485
|
};
|
|
6486
6486
|
|
|
6487
|
-
/**
|
|
6488
|
-
|
|
6487
|
+
/**
|
|
6488
|
+
* Preferred displacement directions, most-preferred first (screen angles; −π/2 is up, 0 is right,
|
|
6489
|
+
* +π/2 is down). Maplex-style cartographic ranking: upper-right, then the other corners, then the
|
|
6490
|
+
* sides, then top. Straight-down is deliberately omitted — a blocked zone (see {@link RANKED_WITH_BLOCKED_RAD}).
|
|
6491
|
+
* Tuned in the browser with design; the solver tries these in order and takes the first that fits.
|
|
6492
|
+
*/
|
|
6493
|
+
const RANKED_ANGLES_RAD = [
|
|
6494
|
+
-Math.PI / 4, // upper-right
|
|
6495
|
+
Math.PI / 4, // lower-right
|
|
6496
|
+
(-3 * Math.PI) / 4, // upper-left
|
|
6497
|
+
(3 * Math.PI) / 4, // lower-left
|
|
6498
|
+
0, // right
|
|
6499
|
+
Math.PI, // left
|
|
6500
|
+
-Math.PI / 2, // top
|
|
6501
|
+
];
|
|
6502
|
+
/**
|
|
6503
|
+
* The blocked displacement zone: directions the primary ranked search never uses (straight-down reads
|
|
6504
|
+
* as the pill dangling off the bottom of its pin). The single source the ranked-with-blocked list and
|
|
6505
|
+
* the incumbency check both derive from, so a future second blocked direction is one edit, not three.
|
|
6506
|
+
*/
|
|
6507
|
+
const BLOCKED_ANGLES_RAD = [Math.PI / 2]; // straight-down
|
|
6508
|
+
/**
|
|
6509
|
+
* The ranked directions plus the blocked zone appended last. Used only by the relaxed cluster-clear
|
|
6510
|
+
* fallback, where getting a guaranteed label off a cluster outranks the "never straight-down" rule.
|
|
6511
|
+
*/
|
|
6512
|
+
const RANKED_WITH_BLOCKED_RAD = [...RANKED_ANGLES_RAD, ...BLOCKED_ANGLES_RAD];
|
|
6489
6513
|
/** Anchor pin radius in px (the `xs` dot, 8px + 2px border): only feeds the tip's soft floor. */
|
|
6490
6514
|
const ANCHOR_DOT_RADIUS_PX = 5;
|
|
6491
6515
|
const collidesWithPlaced = (point, footprint, placed) => placed.some(other => overlaps(point, footprint, other.point, other.footprint));
|
|
@@ -6529,35 +6553,26 @@ const lineCrossesPlaced = (anchor, tip, placed) => placed.some(({ point, footpri
|
|
|
6529
6553
|
return false;
|
|
6530
6554
|
return segmentIntersectsBox(anchor, tip, point[0] - halfW, point[1] - halfH, point[0] + halfW, point[1] + halfH);
|
|
6531
6555
|
});
|
|
6532
|
-
/** Squared distance from `point` to the nearest placed label centre (Infinity when none). */
|
|
6533
|
-
const clearanceSq = (point, placed) => {
|
|
6534
|
-
let min = Infinity;
|
|
6535
|
-
for (const other of placed) {
|
|
6536
|
-
const d = sqDistance(point, other.point);
|
|
6537
|
-
if (d < min)
|
|
6538
|
-
min = d;
|
|
6539
|
-
}
|
|
6540
|
-
return min;
|
|
6541
|
-
};
|
|
6542
6556
|
/**
|
|
6543
6557
|
* Finds a stick offset for a guaranteed (Tier-A) label whose anchor is taken.
|
|
6544
6558
|
*
|
|
6545
|
-
*
|
|
6546
|
-
*
|
|
6547
|
-
*
|
|
6548
|
-
*
|
|
6549
|
-
*
|
|
6550
|
-
*
|
|
6551
|
-
*
|
|
6552
|
-
*
|
|
6553
|
-
*
|
|
6554
|
-
*
|
|
6559
|
+
* Tries a **ranked preferred order** of directions ({@link RANKED_ANGLES_RAD}, Maplex-style:
|
|
6560
|
+
* upper-right first, straight-down blocked) at increasing radii from `baseDistancePx` outward
|
|
6561
|
+
* (`radiusSteps` rings). At the shortest ring that has room it takes the **highest-ranked** angle that
|
|
6562
|
+
* is footprint-free and on-canvas; among those it prefers one whose leader line does not cross a label,
|
|
6563
|
+
* but a crossing is allowed rather than blocking (connectors render below the pill band, so a crossing
|
|
6564
|
+
* line passes behind the labels it crosses). The radius ramp is a fallback used only when a ring has no
|
|
6565
|
+
* free angle. If every candidate is rejected it returns `undefined` (the caller keeps the label at its
|
|
6566
|
+
* anchor — never dropped). `previousOffset` is reused while it stays footprint-free and on-canvas
|
|
6567
|
+
* (regardless of crossing), so a settled stick keeps its direction between settles and never swings for
|
|
6568
|
+
* a now-free higher-ranked angle — except a remembered blocked-zone (straight-down) offset, which is
|
|
6569
|
+
* reused only while `clusterClearFallback` is active, so it does not persist once its cluster is gone.
|
|
6555
6570
|
*
|
|
6556
6571
|
* Geometry matches the renderer: the collision/reserved point is the **rendered pill centre**
|
|
6557
6572
|
* (`resolveTentativeTip` + `computePillCSSPlacement`), not the raw polar tip; the line is tested to
|
|
6558
6573
|
* that tip.
|
|
6559
6574
|
*/
|
|
6560
|
-
const findStickOffset = ({ anchor, placed, footprint, pillWidthPx, pillHeightPx, degreesPerPixel, viewBox, baseDistancePx, radiusStepPx, radiusSteps,
|
|
6575
|
+
const findStickOffset = ({ anchor, placed, footprint, pillWidthPx, pillHeightPx, degreesPerPixel, viewBox, baseDistancePx, radiusStepPx, radiusSteps, previousOffset, clusterClearFallback, }) => {
|
|
6561
6576
|
// Geometry uses the physical (as-painted) pill size; the view-box clamp insets by its half-extents,
|
|
6562
6577
|
// so a pill that visually fits is not rejected. The padded `footprint` is used only for keep-out
|
|
6563
6578
|
// (`collidesWithPlaced`), not here — that separation is the point of SAGA-855.
|
|
@@ -6593,81 +6608,76 @@ const findStickOffset = ({ anchor, placed, footprint, pillWidthPx, pillHeightPx,
|
|
|
6593
6608
|
return undefined;
|
|
6594
6609
|
return { pillCentre, lineClear: !lineCrossesPlaced(anchor, tip, placed) };
|
|
6595
6610
|
};
|
|
6596
|
-
// Reuse the remembered offset
|
|
6611
|
+
// Reuse the remembered offset while it stays footprint-free and on-canvas, so a settled stick keeps
|
|
6612
|
+
// its direction (crossing is no longer required — connectors render below the pill band). A blocked-zone
|
|
6613
|
+
// angle (straight-down) only ever comes from the cluster-clear fallback, so reuse it only while that
|
|
6614
|
+
// fallback is still in play; otherwise a stale straight-down would persist through incumbency after the
|
|
6615
|
+
// cluster moved away, a direction the primary ranked search would never choose (SAGA-883 review).
|
|
6597
6616
|
if (previousOffset !== undefined) {
|
|
6598
|
-
const
|
|
6599
|
-
if (
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
|
|
6617
|
+
const isBlockedAngle = BLOCKED_ANGLES_RAD.includes(previousOffset.angleRad);
|
|
6618
|
+
if (!isBlockedAngle || clusterClearFallback === true) {
|
|
6619
|
+
const prev = evaluate(previousOffset.angleRad, previousOffset.distancePx);
|
|
6620
|
+
if (prev !== undefined) {
|
|
6621
|
+
return {
|
|
6622
|
+
positioning: { type: "polar", angleRad: previousOffset.angleRad, distance: previousOffset.distancePx },
|
|
6623
|
+
pillCentre: prev.pillCentre,
|
|
6624
|
+
};
|
|
6625
|
+
}
|
|
6604
6626
|
}
|
|
6605
6627
|
}
|
|
6606
|
-
|
|
6607
|
-
//
|
|
6608
|
-
// float noise of a radially symmetric ring) keep the earlier, up-first angle — deterministic.
|
|
6609
|
-
const beats = (clearance, best) => best === undefined || clearance > best.clearance * (1 + 1e-6);
|
|
6610
|
-
let fallback;
|
|
6628
|
+
// Ranked preferred order, inner ring first. At each ring take the highest-ranked free angle, preferring
|
|
6629
|
+
// a non-crossing one but accepting a crossing one rather than skipping to an outer ring.
|
|
6611
6630
|
for (let ring = 0; ring < radiusSteps; ring++) {
|
|
6612
6631
|
const distance = baseDistancePx + ring * radiusStepPx;
|
|
6613
|
-
let
|
|
6614
|
-
let
|
|
6615
|
-
for (
|
|
6616
|
-
const angleRad = UP_ANGLE_RAD + a * angleStep;
|
|
6632
|
+
let bestPreferred; // highest-ranked, non-crossing
|
|
6633
|
+
let bestAny; // highest-ranked, crossing allowed
|
|
6634
|
+
for (const angleRad of RANKED_ANGLES_RAD) {
|
|
6617
6635
|
const evaluated = evaluate(angleRad, distance);
|
|
6618
6636
|
if (evaluated === undefined)
|
|
6619
6637
|
continue;
|
|
6620
|
-
|
|
6638
|
+
if (bestAny === undefined)
|
|
6639
|
+
bestAny = { angleRad, pillCentre: evaluated.pillCentre };
|
|
6621
6640
|
if (evaluated.lineClear) {
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
|
-
}
|
|
6625
|
-
else if (beats(clearance, bestCrossing)) {
|
|
6626
|
-
bestCrossing = { angleRad, pillCentre: evaluated.pillCentre, clearance };
|
|
6641
|
+
bestPreferred = { angleRad, pillCentre: evaluated.pillCentre };
|
|
6642
|
+
break; // highest-ranked non-crossing found — nothing lower-ranked can beat it
|
|
6627
6643
|
}
|
|
6628
6644
|
}
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
|
|
6632
|
-
pillCentre: bestClear.pillCentre,
|
|
6633
|
-
};
|
|
6634
|
-
}
|
|
6635
|
-
if (fallback === undefined && bestCrossing !== undefined) {
|
|
6636
|
-
fallback = {
|
|
6637
|
-
positioning: { type: "polar", angleRad: bestCrossing.angleRad, distance },
|
|
6638
|
-
pillCentre: bestCrossing.pillCentre,
|
|
6639
|
-
};
|
|
6645
|
+
const chosen = bestPreferred ?? bestAny;
|
|
6646
|
+
if (chosen !== undefined) {
|
|
6647
|
+
return { positioning: { type: "polar", angleRad: chosen.angleRad, distance }, pillCentre: chosen.pillCentre };
|
|
6640
6648
|
}
|
|
6641
6649
|
}
|
|
6642
|
-
if (fallback !== undefined)
|
|
6643
|
-
return fallback;
|
|
6644
6650
|
if (clusterClearFallback !== true)
|
|
6645
6651
|
return undefined;
|
|
6646
|
-
|
|
6652
|
+
// Relaxed fallback: no offset clears every label, so rather than drop a guaranteed label back onto
|
|
6653
|
+
// its anchor (which may sit on a cluster), take the highest-ranked offset that clears all CLUSTERS,
|
|
6654
|
+
// even if it overlaps other labels. "Never cover a cluster" wins over "never overlap a label" here;
|
|
6655
|
+
// only if even that is impossible does the caller keep the anchor. Blocked zones (straight-down) are
|
|
6656
|
+
// allowed here, and line-crossing is ignored (connectors render below the pill band).
|
|
6657
|
+
//
|
|
6658
|
+
// An on-canvas offset is preferred (inner ring, ranked first). If none exists — e.g. an asset wedged
|
|
6659
|
+
// between an edge cluster and the map edge, where inward offsets hit the cluster and outward ones fall
|
|
6660
|
+
// off-canvas — an edge-clipping offset is the last resort: clipping the viewport beats covering a cluster.
|
|
6647
6661
|
let bestOffCanvas;
|
|
6648
6662
|
for (let ring = 0; ring < radiusSteps; ring++) {
|
|
6649
6663
|
const distance = baseDistancePx + ring * radiusStepPx;
|
|
6650
|
-
for (
|
|
6651
|
-
const angleRad = UP_ANGLE_RAD + a * angleStep;
|
|
6664
|
+
for (const angleRad of RANKED_WITH_BLOCKED_RAD) {
|
|
6652
6665
|
const { pillCentre } = geometryFor(angleRad, distance);
|
|
6653
6666
|
if (collidesWithClusters(pillCentre, footprint, placed))
|
|
6654
6667
|
continue;
|
|
6655
|
-
|
|
6656
|
-
|
|
6657
|
-
|
|
6658
|
-
bestOffCanvas = { angleRad, distance, pillCentre, clearance };
|
|
6659
|
-
}
|
|
6660
|
-
else if (beats(clearance, bestOnCanvas)) {
|
|
6661
|
-
bestOnCanvas = { angleRad, distance, pillCentre, clearance };
|
|
6668
|
+
if (!outsideViewBox(pillCentre)) {
|
|
6669
|
+
// Highest-ranked cluster-clear offset that stays on-canvas, at the innermost ring that has one.
|
|
6670
|
+
return { positioning: { type: "polar", angleRad, distance }, pillCentre };
|
|
6662
6671
|
}
|
|
6672
|
+
if (bestOffCanvas === undefined)
|
|
6673
|
+
bestOffCanvas = { angleRad, distance, pillCentre };
|
|
6663
6674
|
}
|
|
6664
6675
|
}
|
|
6665
|
-
|
|
6666
|
-
return chosen === undefined
|
|
6676
|
+
return bestOffCanvas === undefined
|
|
6667
6677
|
? undefined
|
|
6668
6678
|
: {
|
|
6669
|
-
positioning: { type: "polar", angleRad:
|
|
6670
|
-
pillCentre:
|
|
6679
|
+
positioning: { type: "polar", angleRad: bestOffCanvas.angleRad, distance: bestOffCanvas.distance },
|
|
6680
|
+
pillCentre: bestOffCanvas.pillCentre,
|
|
6671
6681
|
};
|
|
6672
6682
|
};
|
|
6673
6683
|
|
|
@@ -6676,7 +6686,6 @@ const EMPTY_IDS = new Set();
|
|
|
6676
6686
|
const STICK_BASE_DISTANCE_PX = MARKER_TUNING.stick.defaultPositioning.distance;
|
|
6677
6687
|
const STICK_RADIUS_STEP_PX = 24;
|
|
6678
6688
|
const STICK_RADIUS_STEPS = 3;
|
|
6679
|
-
const STICK_ANGLES_PER_RING = 8;
|
|
6680
6689
|
const byId = (a, b) => (a.id < b.id ? -1 : a.id > b.id ? 1 : 0);
|
|
6681
6690
|
const isWithinBounds = (position, bounds) => {
|
|
6682
6691
|
const [lng, lat] = position;
|
|
@@ -6870,7 +6879,6 @@ const buildLabelPlacement = ({ items, getId, getPosition, focus, bounds, footpri
|
|
|
6870
6879
|
baseDistancePx: STICK_BASE_DISTANCE_PX,
|
|
6871
6880
|
radiusStepPx: STICK_RADIUS_STEP_PX,
|
|
6872
6881
|
radiusSteps: STICK_RADIUS_STEPS,
|
|
6873
|
-
anglesPerRing: STICK_ANGLES_PER_RING,
|
|
6874
6882
|
previousOffset: previousStickOffsets?.get(candidate.id),
|
|
6875
6883
|
clusterClearFallback: anchorOnCluster,
|
|
6876
6884
|
});
|
package/index.esm.js
CHANGED
|
@@ -6483,8 +6483,32 @@ const sqDistance = (a, b) => {
|
|
|
6483
6483
|
return dx * dx + dy * dy;
|
|
6484
6484
|
};
|
|
6485
6485
|
|
|
6486
|
-
/**
|
|
6487
|
-
|
|
6486
|
+
/**
|
|
6487
|
+
* Preferred displacement directions, most-preferred first (screen angles; −π/2 is up, 0 is right,
|
|
6488
|
+
* +π/2 is down). Maplex-style cartographic ranking: upper-right, then the other corners, then the
|
|
6489
|
+
* sides, then top. Straight-down is deliberately omitted — a blocked zone (see {@link RANKED_WITH_BLOCKED_RAD}).
|
|
6490
|
+
* Tuned in the browser with design; the solver tries these in order and takes the first that fits.
|
|
6491
|
+
*/
|
|
6492
|
+
const RANKED_ANGLES_RAD = [
|
|
6493
|
+
-Math.PI / 4, // upper-right
|
|
6494
|
+
Math.PI / 4, // lower-right
|
|
6495
|
+
(-3 * Math.PI) / 4, // upper-left
|
|
6496
|
+
(3 * Math.PI) / 4, // lower-left
|
|
6497
|
+
0, // right
|
|
6498
|
+
Math.PI, // left
|
|
6499
|
+
-Math.PI / 2, // top
|
|
6500
|
+
];
|
|
6501
|
+
/**
|
|
6502
|
+
* The blocked displacement zone: directions the primary ranked search never uses (straight-down reads
|
|
6503
|
+
* as the pill dangling off the bottom of its pin). The single source the ranked-with-blocked list and
|
|
6504
|
+
* the incumbency check both derive from, so a future second blocked direction is one edit, not three.
|
|
6505
|
+
*/
|
|
6506
|
+
const BLOCKED_ANGLES_RAD = [Math.PI / 2]; // straight-down
|
|
6507
|
+
/**
|
|
6508
|
+
* The ranked directions plus the blocked zone appended last. Used only by the relaxed cluster-clear
|
|
6509
|
+
* fallback, where getting a guaranteed label off a cluster outranks the "never straight-down" rule.
|
|
6510
|
+
*/
|
|
6511
|
+
const RANKED_WITH_BLOCKED_RAD = [...RANKED_ANGLES_RAD, ...BLOCKED_ANGLES_RAD];
|
|
6488
6512
|
/** Anchor pin radius in px (the `xs` dot, 8px + 2px border): only feeds the tip's soft floor. */
|
|
6489
6513
|
const ANCHOR_DOT_RADIUS_PX = 5;
|
|
6490
6514
|
const collidesWithPlaced = (point, footprint, placed) => placed.some(other => overlaps(point, footprint, other.point, other.footprint));
|
|
@@ -6528,35 +6552,26 @@ const lineCrossesPlaced = (anchor, tip, placed) => placed.some(({ point, footpri
|
|
|
6528
6552
|
return false;
|
|
6529
6553
|
return segmentIntersectsBox(anchor, tip, point[0] - halfW, point[1] - halfH, point[0] + halfW, point[1] + halfH);
|
|
6530
6554
|
});
|
|
6531
|
-
/** Squared distance from `point` to the nearest placed label centre (Infinity when none). */
|
|
6532
|
-
const clearanceSq = (point, placed) => {
|
|
6533
|
-
let min = Infinity;
|
|
6534
|
-
for (const other of placed) {
|
|
6535
|
-
const d = sqDistance(point, other.point);
|
|
6536
|
-
if (d < min)
|
|
6537
|
-
min = d;
|
|
6538
|
-
}
|
|
6539
|
-
return min;
|
|
6540
|
-
};
|
|
6541
6555
|
/**
|
|
6542
6556
|
* Finds a stick offset for a guaranteed (Tier-A) label whose anchor is taken.
|
|
6543
6557
|
*
|
|
6544
|
-
*
|
|
6545
|
-
*
|
|
6546
|
-
*
|
|
6547
|
-
*
|
|
6548
|
-
*
|
|
6549
|
-
*
|
|
6550
|
-
*
|
|
6551
|
-
*
|
|
6552
|
-
*
|
|
6553
|
-
*
|
|
6558
|
+
* Tries a **ranked preferred order** of directions ({@link RANKED_ANGLES_RAD}, Maplex-style:
|
|
6559
|
+
* upper-right first, straight-down blocked) at increasing radii from `baseDistancePx` outward
|
|
6560
|
+
* (`radiusSteps` rings). At the shortest ring that has room it takes the **highest-ranked** angle that
|
|
6561
|
+
* is footprint-free and on-canvas; among those it prefers one whose leader line does not cross a label,
|
|
6562
|
+
* but a crossing is allowed rather than blocking (connectors render below the pill band, so a crossing
|
|
6563
|
+
* line passes behind the labels it crosses). The radius ramp is a fallback used only when a ring has no
|
|
6564
|
+
* free angle. If every candidate is rejected it returns `undefined` (the caller keeps the label at its
|
|
6565
|
+
* anchor — never dropped). `previousOffset` is reused while it stays footprint-free and on-canvas
|
|
6566
|
+
* (regardless of crossing), so a settled stick keeps its direction between settles and never swings for
|
|
6567
|
+
* a now-free higher-ranked angle — except a remembered blocked-zone (straight-down) offset, which is
|
|
6568
|
+
* reused only while `clusterClearFallback` is active, so it does not persist once its cluster is gone.
|
|
6554
6569
|
*
|
|
6555
6570
|
* Geometry matches the renderer: the collision/reserved point is the **rendered pill centre**
|
|
6556
6571
|
* (`resolveTentativeTip` + `computePillCSSPlacement`), not the raw polar tip; the line is tested to
|
|
6557
6572
|
* that tip.
|
|
6558
6573
|
*/
|
|
6559
|
-
const findStickOffset = ({ anchor, placed, footprint, pillWidthPx, pillHeightPx, degreesPerPixel, viewBox, baseDistancePx, radiusStepPx, radiusSteps,
|
|
6574
|
+
const findStickOffset = ({ anchor, placed, footprint, pillWidthPx, pillHeightPx, degreesPerPixel, viewBox, baseDistancePx, radiusStepPx, radiusSteps, previousOffset, clusterClearFallback, }) => {
|
|
6560
6575
|
// Geometry uses the physical (as-painted) pill size; the view-box clamp insets by its half-extents,
|
|
6561
6576
|
// so a pill that visually fits is not rejected. The padded `footprint` is used only for keep-out
|
|
6562
6577
|
// (`collidesWithPlaced`), not here — that separation is the point of SAGA-855.
|
|
@@ -6592,81 +6607,76 @@ const findStickOffset = ({ anchor, placed, footprint, pillWidthPx, pillHeightPx,
|
|
|
6592
6607
|
return undefined;
|
|
6593
6608
|
return { pillCentre, lineClear: !lineCrossesPlaced(anchor, tip, placed) };
|
|
6594
6609
|
};
|
|
6595
|
-
// Reuse the remembered offset
|
|
6610
|
+
// Reuse the remembered offset while it stays footprint-free and on-canvas, so a settled stick keeps
|
|
6611
|
+
// its direction (crossing is no longer required — connectors render below the pill band). A blocked-zone
|
|
6612
|
+
// angle (straight-down) only ever comes from the cluster-clear fallback, so reuse it only while that
|
|
6613
|
+
// fallback is still in play; otherwise a stale straight-down would persist through incumbency after the
|
|
6614
|
+
// cluster moved away, a direction the primary ranked search would never choose (SAGA-883 review).
|
|
6596
6615
|
if (previousOffset !== undefined) {
|
|
6597
|
-
const
|
|
6598
|
-
if (
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
|
|
6616
|
+
const isBlockedAngle = BLOCKED_ANGLES_RAD.includes(previousOffset.angleRad);
|
|
6617
|
+
if (!isBlockedAngle || clusterClearFallback === true) {
|
|
6618
|
+
const prev = evaluate(previousOffset.angleRad, previousOffset.distancePx);
|
|
6619
|
+
if (prev !== undefined) {
|
|
6620
|
+
return {
|
|
6621
|
+
positioning: { type: "polar", angleRad: previousOffset.angleRad, distance: previousOffset.distancePx },
|
|
6622
|
+
pillCentre: prev.pillCentre,
|
|
6623
|
+
};
|
|
6624
|
+
}
|
|
6603
6625
|
}
|
|
6604
6626
|
}
|
|
6605
|
-
|
|
6606
|
-
//
|
|
6607
|
-
// float noise of a radially symmetric ring) keep the earlier, up-first angle — deterministic.
|
|
6608
|
-
const beats = (clearance, best) => best === undefined || clearance > best.clearance * (1 + 1e-6);
|
|
6609
|
-
let fallback;
|
|
6627
|
+
// Ranked preferred order, inner ring first. At each ring take the highest-ranked free angle, preferring
|
|
6628
|
+
// a non-crossing one but accepting a crossing one rather than skipping to an outer ring.
|
|
6610
6629
|
for (let ring = 0; ring < radiusSteps; ring++) {
|
|
6611
6630
|
const distance = baseDistancePx + ring * radiusStepPx;
|
|
6612
|
-
let
|
|
6613
|
-
let
|
|
6614
|
-
for (
|
|
6615
|
-
const angleRad = UP_ANGLE_RAD + a * angleStep;
|
|
6631
|
+
let bestPreferred; // highest-ranked, non-crossing
|
|
6632
|
+
let bestAny; // highest-ranked, crossing allowed
|
|
6633
|
+
for (const angleRad of RANKED_ANGLES_RAD) {
|
|
6616
6634
|
const evaluated = evaluate(angleRad, distance);
|
|
6617
6635
|
if (evaluated === undefined)
|
|
6618
6636
|
continue;
|
|
6619
|
-
|
|
6637
|
+
if (bestAny === undefined)
|
|
6638
|
+
bestAny = { angleRad, pillCentre: evaluated.pillCentre };
|
|
6620
6639
|
if (evaluated.lineClear) {
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
}
|
|
6624
|
-
else if (beats(clearance, bestCrossing)) {
|
|
6625
|
-
bestCrossing = { angleRad, pillCentre: evaluated.pillCentre, clearance };
|
|
6640
|
+
bestPreferred = { angleRad, pillCentre: evaluated.pillCentre };
|
|
6641
|
+
break; // highest-ranked non-crossing found — nothing lower-ranked can beat it
|
|
6626
6642
|
}
|
|
6627
6643
|
}
|
|
6628
|
-
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
pillCentre: bestClear.pillCentre,
|
|
6632
|
-
};
|
|
6633
|
-
}
|
|
6634
|
-
if (fallback === undefined && bestCrossing !== undefined) {
|
|
6635
|
-
fallback = {
|
|
6636
|
-
positioning: { type: "polar", angleRad: bestCrossing.angleRad, distance },
|
|
6637
|
-
pillCentre: bestCrossing.pillCentre,
|
|
6638
|
-
};
|
|
6644
|
+
const chosen = bestPreferred ?? bestAny;
|
|
6645
|
+
if (chosen !== undefined) {
|
|
6646
|
+
return { positioning: { type: "polar", angleRad: chosen.angleRad, distance }, pillCentre: chosen.pillCentre };
|
|
6639
6647
|
}
|
|
6640
6648
|
}
|
|
6641
|
-
if (fallback !== undefined)
|
|
6642
|
-
return fallback;
|
|
6643
6649
|
if (clusterClearFallback !== true)
|
|
6644
6650
|
return undefined;
|
|
6645
|
-
|
|
6651
|
+
// Relaxed fallback: no offset clears every label, so rather than drop a guaranteed label back onto
|
|
6652
|
+
// its anchor (which may sit on a cluster), take the highest-ranked offset that clears all CLUSTERS,
|
|
6653
|
+
// even if it overlaps other labels. "Never cover a cluster" wins over "never overlap a label" here;
|
|
6654
|
+
// only if even that is impossible does the caller keep the anchor. Blocked zones (straight-down) are
|
|
6655
|
+
// allowed here, and line-crossing is ignored (connectors render below the pill band).
|
|
6656
|
+
//
|
|
6657
|
+
// An on-canvas offset is preferred (inner ring, ranked first). If none exists — e.g. an asset wedged
|
|
6658
|
+
// between an edge cluster and the map edge, where inward offsets hit the cluster and outward ones fall
|
|
6659
|
+
// off-canvas — an edge-clipping offset is the last resort: clipping the viewport beats covering a cluster.
|
|
6646
6660
|
let bestOffCanvas;
|
|
6647
6661
|
for (let ring = 0; ring < radiusSteps; ring++) {
|
|
6648
6662
|
const distance = baseDistancePx + ring * radiusStepPx;
|
|
6649
|
-
for (
|
|
6650
|
-
const angleRad = UP_ANGLE_RAD + a * angleStep;
|
|
6663
|
+
for (const angleRad of RANKED_WITH_BLOCKED_RAD) {
|
|
6651
6664
|
const { pillCentre } = geometryFor(angleRad, distance);
|
|
6652
6665
|
if (collidesWithClusters(pillCentre, footprint, placed))
|
|
6653
6666
|
continue;
|
|
6654
|
-
|
|
6655
|
-
|
|
6656
|
-
|
|
6657
|
-
bestOffCanvas = { angleRad, distance, pillCentre, clearance };
|
|
6658
|
-
}
|
|
6659
|
-
else if (beats(clearance, bestOnCanvas)) {
|
|
6660
|
-
bestOnCanvas = { angleRad, distance, pillCentre, clearance };
|
|
6667
|
+
if (!outsideViewBox(pillCentre)) {
|
|
6668
|
+
// Highest-ranked cluster-clear offset that stays on-canvas, at the innermost ring that has one.
|
|
6669
|
+
return { positioning: { type: "polar", angleRad, distance }, pillCentre };
|
|
6661
6670
|
}
|
|
6671
|
+
if (bestOffCanvas === undefined)
|
|
6672
|
+
bestOffCanvas = { angleRad, distance, pillCentre };
|
|
6662
6673
|
}
|
|
6663
6674
|
}
|
|
6664
|
-
|
|
6665
|
-
return chosen === undefined
|
|
6675
|
+
return bestOffCanvas === undefined
|
|
6666
6676
|
? undefined
|
|
6667
6677
|
: {
|
|
6668
|
-
positioning: { type: "polar", angleRad:
|
|
6669
|
-
pillCentre:
|
|
6678
|
+
positioning: { type: "polar", angleRad: bestOffCanvas.angleRad, distance: bestOffCanvas.distance },
|
|
6679
|
+
pillCentre: bestOffCanvas.pillCentre,
|
|
6670
6680
|
};
|
|
6671
6681
|
};
|
|
6672
6682
|
|
|
@@ -6675,7 +6685,6 @@ const EMPTY_IDS = new Set();
|
|
|
6675
6685
|
const STICK_BASE_DISTANCE_PX = MARKER_TUNING.stick.defaultPositioning.distance;
|
|
6676
6686
|
const STICK_RADIUS_STEP_PX = 24;
|
|
6677
6687
|
const STICK_RADIUS_STEPS = 3;
|
|
6678
|
-
const STICK_ANGLES_PER_RING = 8;
|
|
6679
6688
|
const byId = (a, b) => (a.id < b.id ? -1 : a.id > b.id ? 1 : 0);
|
|
6680
6689
|
const isWithinBounds = (position, bounds) => {
|
|
6681
6690
|
const [lng, lat] = position;
|
|
@@ -6869,7 +6878,6 @@ const buildLabelPlacement = ({ items, getId, getPosition, focus, bounds, footpri
|
|
|
6869
6878
|
baseDistancePx: STICK_BASE_DISTANCE_PX,
|
|
6870
6879
|
radiusStepPx: STICK_RADIUS_STEP_PX,
|
|
6871
6880
|
radiusSteps: STICK_RADIUS_STEPS,
|
|
6872
|
-
anglesPerRing: STICK_ANGLES_PER_RING,
|
|
6873
6881
|
previousOffset: previousStickOffsets?.get(candidate.id),
|
|
6874
6882
|
clusterClearFallback: anchorOnCluster,
|
|
6875
6883
|
});
|
package/package.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-map",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.257",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=24.x"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@trackunit/react-components": "
|
|
11
|
-
"@trackunit/css-class-variance-utilities": "2.6.
|
|
12
|
-
"@trackunit/react-form-components": "2.
|
|
13
|
-
"@trackunit/react-core-hooks": "1.
|
|
14
|
-
"@trackunit/geo-json-utils": "1.21.
|
|
15
|
-
"@trackunit/i18n-library-translation": "2.
|
|
10
|
+
"@trackunit/react-components": "6.0.4",
|
|
11
|
+
"@trackunit/css-class-variance-utilities": "2.6.14",
|
|
12
|
+
"@trackunit/react-form-components": "2.17.5",
|
|
13
|
+
"@trackunit/react-core-hooks": "1.31.4",
|
|
14
|
+
"@trackunit/geo-json-utils": "1.21.14",
|
|
15
|
+
"@trackunit/i18n-library-translation": "2.14.4",
|
|
16
16
|
"react-minimal-pie-chart": "^8.4.0",
|
|
17
|
-
"@trackunit/react-map-adapter-shared": "0.0.
|
|
18
|
-
"@trackunit/react-map-color-utils": "0.0.
|
|
19
|
-
"@trackunit/shared-utils": "1.22.
|
|
20
|
-
"@trackunit/ui-design-tokens": "1.21.
|
|
17
|
+
"@trackunit/react-map-adapter-shared": "0.0.181",
|
|
18
|
+
"@trackunit/react-map-color-utils": "0.0.155",
|
|
19
|
+
"@trackunit/shared-utils": "1.22.14",
|
|
20
|
+
"@trackunit/ui-design-tokens": "1.21.14",
|
|
21
21
|
"@floating-ui/react": "^0.26.25",
|
|
22
22
|
"es-toolkit": "^1.52.0",
|
|
23
23
|
"tailwind-merge": "^3.7.0",
|
|
@@ -43,8 +43,6 @@ export type StickSolverParams = Readonly<{
|
|
|
43
43
|
radiusStepPx: number;
|
|
44
44
|
/** Number of rings tried outward from the base distance. */
|
|
45
45
|
radiusSteps: number;
|
|
46
|
-
/** Candidate angles per ring (evenly spaced, starting straight up). */
|
|
47
|
-
anglesPerRing: number;
|
|
48
46
|
/** Previously-chosen offset for this asset — tried first so a stable label does not swing. */
|
|
49
47
|
previousOffset?: StickOffset;
|
|
50
48
|
/**
|
|
@@ -55,23 +53,42 @@ export type StickSolverParams = Readonly<{
|
|
|
55
53
|
*/
|
|
56
54
|
clusterClearFallback?: boolean;
|
|
57
55
|
}>;
|
|
56
|
+
/**
|
|
57
|
+
* Preferred displacement directions, most-preferred first (screen angles; −π/2 is up, 0 is right,
|
|
58
|
+
* +π/2 is down). Maplex-style cartographic ranking: upper-right, then the other corners, then the
|
|
59
|
+
* sides, then top. Straight-down is deliberately omitted — a blocked zone (see {@link RANKED_WITH_BLOCKED_RAD}).
|
|
60
|
+
* Tuned in the browser with design; the solver tries these in order and takes the first that fits.
|
|
61
|
+
*/
|
|
62
|
+
export declare const RANKED_ANGLES_RAD: ReadonlyArray<number>;
|
|
63
|
+
/**
|
|
64
|
+
* The blocked displacement zone: directions the primary ranked search never uses (straight-down reads
|
|
65
|
+
* as the pill dangling off the bottom of its pin). The single source the ranked-with-blocked list and
|
|
66
|
+
* the incumbency check both derive from, so a future second blocked direction is one edit, not three.
|
|
67
|
+
*/
|
|
68
|
+
export declare const BLOCKED_ANGLES_RAD: ReadonlyArray<number>;
|
|
69
|
+
/**
|
|
70
|
+
* The ranked directions plus the blocked zone appended last. Used only by the relaxed cluster-clear
|
|
71
|
+
* fallback, where getting a guaranteed label off a cluster outranks the "never straight-down" rule.
|
|
72
|
+
*/
|
|
73
|
+
export declare const RANKED_WITH_BLOCKED_RAD: ReadonlyArray<number>;
|
|
58
74
|
/**
|
|
59
75
|
* Finds a stick offset for a guaranteed (Tier-A) label whose anchor is taken.
|
|
60
76
|
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
77
|
+
* Tries a **ranked preferred order** of directions ({@link RANKED_ANGLES_RAD}, Maplex-style:
|
|
78
|
+
* upper-right first, straight-down blocked) at increasing radii from `baseDistancePx` outward
|
|
79
|
+
* (`radiusSteps` rings). At the shortest ring that has room it takes the **highest-ranked** angle that
|
|
80
|
+
* is footprint-free and on-canvas; among those it prefers one whose leader line does not cross a label,
|
|
81
|
+
* but a crossing is allowed rather than blocking (connectors render below the pill band, so a crossing
|
|
82
|
+
* line passes behind the labels it crosses). The radius ramp is a fallback used only when a ring has no
|
|
83
|
+
* free angle. If every candidate is rejected it returns `undefined` (the caller keeps the label at its
|
|
84
|
+
* anchor — never dropped). `previousOffset` is reused while it stays footprint-free and on-canvas
|
|
85
|
+
* (regardless of crossing), so a settled stick keeps its direction between settles and never swings for
|
|
86
|
+
* a now-free higher-ranked angle — except a remembered blocked-zone (straight-down) offset, which is
|
|
87
|
+
* reused only while `clusterClearFallback` is active, so it does not persist once its cluster is gone.
|
|
71
88
|
*
|
|
72
89
|
* Geometry matches the renderer: the collision/reserved point is the **rendered pill centre**
|
|
73
90
|
* (`resolveTentativeTip` + `computePillCSSPlacement`), not the raw polar tip; the line is tested to
|
|
74
91
|
* that tip.
|
|
75
92
|
*/
|
|
76
|
-
export declare const findStickOffset: ({ anchor, placed, footprint, pillWidthPx, pillHeightPx, degreesPerPixel, viewBox, baseDistancePx, radiusStepPx, radiusSteps,
|
|
93
|
+
export declare const findStickOffset: ({ anchor, placed, footprint, pillWidthPx, pillHeightPx, degreesPerPixel, viewBox, baseDistancePx, radiusStepPx, radiusSteps, previousOffset, clusterClearFallback, }: StickSolverParams) => StickSolution | undefined;
|
|
77
94
|
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
import type { HeatmapBenchmarkResults } from "./heatmapBenchmarkHistory";
|
|
3
|
+
type HeatmapBenchmarkHistoryCompactMedianSummaryProps = Readonly<{
|
|
4
|
+
results: HeatmapBenchmarkResults;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const HeatmapBenchmarkHistoryCompactMedianSummary: ({ results, }: HeatmapBenchmarkHistoryCompactMedianSummaryProps) => ReactElement;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
import { type HeatmapBenchmarkResultConfig, type HeatmapBenchmarkResults } from "./heatmapBenchmarkHistory";
|
|
3
|
+
type HeatmapBenchmarkHistoryRunReportProps = Readonly<{
|
|
4
|
+
results: HeatmapBenchmarkResults;
|
|
5
|
+
config: HeatmapBenchmarkResultConfig;
|
|
6
|
+
}>;
|
|
7
|
+
export declare const HeatmapBenchmarkHistoryRunReport: ({ results, config, }: HeatmapBenchmarkHistoryRunReportProps) => ReactElement;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { HeatmapRenderError } from "@trackunit/react-map-adapter-shared";
|
|
2
|
+
import type { ReactElement } from "react";
|
|
3
|
+
type AdapterType = "google" | "mapbox";
|
|
4
|
+
export type HeatmapLastOperation = "initial" | "toggle-on" | "data-replace" | null;
|
|
5
|
+
type HeatmapPerformancePanelProps = Readonly<{
|
|
6
|
+
adapter: AdapterType;
|
|
7
|
+
dataLength: number;
|
|
8
|
+
pointCount: number;
|
|
9
|
+
totalCount: number;
|
|
10
|
+
heatmapInSnapshot: boolean;
|
|
11
|
+
loading: boolean;
|
|
12
|
+
fps: number | null;
|
|
13
|
+
isCameraIdle: boolean;
|
|
14
|
+
isMapReady: boolean;
|
|
15
|
+
lastOperation: HeatmapLastOperation;
|
|
16
|
+
rendererReadyMs: number | null;
|
|
17
|
+
dataUpdateMs: number | null;
|
|
18
|
+
lastError: HeatmapRenderError | null;
|
|
19
|
+
deckNote?: string;
|
|
20
|
+
}>;
|
|
21
|
+
export declare const HeatmapPerformancePanel: ({ adapter, dataLength, pointCount, totalCount, heatmapInSnapshot, loading, fps, isCameraIdle, isMapReady, lastOperation, rendererReadyMs, dataUpdateMs, lastError, deckNote, }: HeatmapPerformancePanelProps) => ReactElement;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,456 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const HEATMAP_BENCHMARK_SCENARIOS: readonly ["Initial", "ToggleOn", "DataReplace"];
|
|
3
|
+
/** Stats shown in heatmap benchmark history tables (computeStats still stores p95 for markers). */
|
|
4
|
+
export declare const HEATMAP_BENCHMARK_STAT_LABELS: readonly ["min", "median", "max"];
|
|
5
|
+
export declare const heatmapBenchmarkResultsSchema: z.ZodObject<{
|
|
6
|
+
Initial: z.ZodObject<{
|
|
7
|
+
min: z.ZodNumber;
|
|
8
|
+
median: z.ZodNumber;
|
|
9
|
+
p95: z.ZodNumber;
|
|
10
|
+
max: z.ZodNumber;
|
|
11
|
+
}, "strict", z.ZodTypeAny, {
|
|
12
|
+
max: number;
|
|
13
|
+
min: number;
|
|
14
|
+
median: number;
|
|
15
|
+
p95: number;
|
|
16
|
+
}, {
|
|
17
|
+
max: number;
|
|
18
|
+
min: number;
|
|
19
|
+
median: number;
|
|
20
|
+
p95: number;
|
|
21
|
+
}>;
|
|
22
|
+
ToggleOn: z.ZodObject<{
|
|
23
|
+
min: z.ZodNumber;
|
|
24
|
+
median: z.ZodNumber;
|
|
25
|
+
p95: z.ZodNumber;
|
|
26
|
+
max: z.ZodNumber;
|
|
27
|
+
}, "strict", z.ZodTypeAny, {
|
|
28
|
+
max: number;
|
|
29
|
+
min: number;
|
|
30
|
+
median: number;
|
|
31
|
+
p95: number;
|
|
32
|
+
}, {
|
|
33
|
+
max: number;
|
|
34
|
+
min: number;
|
|
35
|
+
median: number;
|
|
36
|
+
p95: number;
|
|
37
|
+
}>;
|
|
38
|
+
DataReplace: z.ZodObject<{
|
|
39
|
+
min: z.ZodNumber;
|
|
40
|
+
median: z.ZodNumber;
|
|
41
|
+
p95: z.ZodNumber;
|
|
42
|
+
max: z.ZodNumber;
|
|
43
|
+
}, "strict", z.ZodTypeAny, {
|
|
44
|
+
max: number;
|
|
45
|
+
min: number;
|
|
46
|
+
median: number;
|
|
47
|
+
p95: number;
|
|
48
|
+
}, {
|
|
49
|
+
max: number;
|
|
50
|
+
min: number;
|
|
51
|
+
median: number;
|
|
52
|
+
p95: number;
|
|
53
|
+
}>;
|
|
54
|
+
}, "strict", z.ZodTypeAny, {
|
|
55
|
+
Initial: {
|
|
56
|
+
max: number;
|
|
57
|
+
min: number;
|
|
58
|
+
median: number;
|
|
59
|
+
p95: number;
|
|
60
|
+
};
|
|
61
|
+
ToggleOn: {
|
|
62
|
+
max: number;
|
|
63
|
+
min: number;
|
|
64
|
+
median: number;
|
|
65
|
+
p95: number;
|
|
66
|
+
};
|
|
67
|
+
DataReplace: {
|
|
68
|
+
max: number;
|
|
69
|
+
min: number;
|
|
70
|
+
median: number;
|
|
71
|
+
p95: number;
|
|
72
|
+
};
|
|
73
|
+
}, {
|
|
74
|
+
Initial: {
|
|
75
|
+
max: number;
|
|
76
|
+
min: number;
|
|
77
|
+
median: number;
|
|
78
|
+
p95: number;
|
|
79
|
+
};
|
|
80
|
+
ToggleOn: {
|
|
81
|
+
max: number;
|
|
82
|
+
min: number;
|
|
83
|
+
median: number;
|
|
84
|
+
p95: number;
|
|
85
|
+
};
|
|
86
|
+
DataReplace: {
|
|
87
|
+
max: number;
|
|
88
|
+
min: number;
|
|
89
|
+
median: number;
|
|
90
|
+
p95: number;
|
|
91
|
+
};
|
|
92
|
+
}>;
|
|
93
|
+
export type HeatmapBenchmarkResults = z.infer<typeof heatmapBenchmarkResultsSchema>;
|
|
94
|
+
declare const benchmarkResultConfigSchema: z.ZodObject<{
|
|
95
|
+
adapter: z.ZodEnum<["google", "mapbox"]>;
|
|
96
|
+
pointCount: z.ZodNumber;
|
|
97
|
+
iterations: z.ZodNumber;
|
|
98
|
+
weightMode: z.ZodEnum<["uniform", "hotspot"]>;
|
|
99
|
+
deckChunkNote: z.ZodOptional<z.ZodString>;
|
|
100
|
+
}, "strict", z.ZodTypeAny, {
|
|
101
|
+
adapter: "google" | "mapbox";
|
|
102
|
+
pointCount: number;
|
|
103
|
+
iterations: number;
|
|
104
|
+
weightMode: "uniform" | "hotspot";
|
|
105
|
+
deckChunkNote?: string | undefined;
|
|
106
|
+
}, {
|
|
107
|
+
adapter: "google" | "mapbox";
|
|
108
|
+
pointCount: number;
|
|
109
|
+
iterations: number;
|
|
110
|
+
weightMode: "uniform" | "hotspot";
|
|
111
|
+
deckChunkNote?: string | undefined;
|
|
112
|
+
}>;
|
|
113
|
+
export type HeatmapBenchmarkResultConfig = z.infer<typeof benchmarkResultConfigSchema>;
|
|
114
|
+
export declare const heatmapBenchmarkHistoryEntrySchema: z.ZodObject<{
|
|
115
|
+
id: z.ZodString;
|
|
116
|
+
timestamp: z.ZodNumber;
|
|
117
|
+
results: z.ZodObject<{
|
|
118
|
+
Initial: z.ZodObject<{
|
|
119
|
+
min: z.ZodNumber;
|
|
120
|
+
median: z.ZodNumber;
|
|
121
|
+
p95: z.ZodNumber;
|
|
122
|
+
max: z.ZodNumber;
|
|
123
|
+
}, "strict", z.ZodTypeAny, {
|
|
124
|
+
max: number;
|
|
125
|
+
min: number;
|
|
126
|
+
median: number;
|
|
127
|
+
p95: number;
|
|
128
|
+
}, {
|
|
129
|
+
max: number;
|
|
130
|
+
min: number;
|
|
131
|
+
median: number;
|
|
132
|
+
p95: number;
|
|
133
|
+
}>;
|
|
134
|
+
ToggleOn: z.ZodObject<{
|
|
135
|
+
min: z.ZodNumber;
|
|
136
|
+
median: z.ZodNumber;
|
|
137
|
+
p95: z.ZodNumber;
|
|
138
|
+
max: z.ZodNumber;
|
|
139
|
+
}, "strict", z.ZodTypeAny, {
|
|
140
|
+
max: number;
|
|
141
|
+
min: number;
|
|
142
|
+
median: number;
|
|
143
|
+
p95: number;
|
|
144
|
+
}, {
|
|
145
|
+
max: number;
|
|
146
|
+
min: number;
|
|
147
|
+
median: number;
|
|
148
|
+
p95: number;
|
|
149
|
+
}>;
|
|
150
|
+
DataReplace: z.ZodObject<{
|
|
151
|
+
min: z.ZodNumber;
|
|
152
|
+
median: z.ZodNumber;
|
|
153
|
+
p95: z.ZodNumber;
|
|
154
|
+
max: z.ZodNumber;
|
|
155
|
+
}, "strict", z.ZodTypeAny, {
|
|
156
|
+
max: number;
|
|
157
|
+
min: number;
|
|
158
|
+
median: number;
|
|
159
|
+
p95: number;
|
|
160
|
+
}, {
|
|
161
|
+
max: number;
|
|
162
|
+
min: number;
|
|
163
|
+
median: number;
|
|
164
|
+
p95: number;
|
|
165
|
+
}>;
|
|
166
|
+
}, "strict", z.ZodTypeAny, {
|
|
167
|
+
Initial: {
|
|
168
|
+
max: number;
|
|
169
|
+
min: number;
|
|
170
|
+
median: number;
|
|
171
|
+
p95: number;
|
|
172
|
+
};
|
|
173
|
+
ToggleOn: {
|
|
174
|
+
max: number;
|
|
175
|
+
min: number;
|
|
176
|
+
median: number;
|
|
177
|
+
p95: number;
|
|
178
|
+
};
|
|
179
|
+
DataReplace: {
|
|
180
|
+
max: number;
|
|
181
|
+
min: number;
|
|
182
|
+
median: number;
|
|
183
|
+
p95: number;
|
|
184
|
+
};
|
|
185
|
+
}, {
|
|
186
|
+
Initial: {
|
|
187
|
+
max: number;
|
|
188
|
+
min: number;
|
|
189
|
+
median: number;
|
|
190
|
+
p95: number;
|
|
191
|
+
};
|
|
192
|
+
ToggleOn: {
|
|
193
|
+
max: number;
|
|
194
|
+
min: number;
|
|
195
|
+
median: number;
|
|
196
|
+
p95: number;
|
|
197
|
+
};
|
|
198
|
+
DataReplace: {
|
|
199
|
+
max: number;
|
|
200
|
+
min: number;
|
|
201
|
+
median: number;
|
|
202
|
+
p95: number;
|
|
203
|
+
};
|
|
204
|
+
}>;
|
|
205
|
+
config: z.ZodObject<{
|
|
206
|
+
adapter: z.ZodEnum<["google", "mapbox"]>;
|
|
207
|
+
pointCount: z.ZodNumber;
|
|
208
|
+
iterations: z.ZodNumber;
|
|
209
|
+
weightMode: z.ZodEnum<["uniform", "hotspot"]>;
|
|
210
|
+
deckChunkNote: z.ZodOptional<z.ZodString>;
|
|
211
|
+
}, "strict", z.ZodTypeAny, {
|
|
212
|
+
adapter: "google" | "mapbox";
|
|
213
|
+
pointCount: number;
|
|
214
|
+
iterations: number;
|
|
215
|
+
weightMode: "uniform" | "hotspot";
|
|
216
|
+
deckChunkNote?: string | undefined;
|
|
217
|
+
}, {
|
|
218
|
+
adapter: "google" | "mapbox";
|
|
219
|
+
pointCount: number;
|
|
220
|
+
iterations: number;
|
|
221
|
+
weightMode: "uniform" | "hotspot";
|
|
222
|
+
deckChunkNote?: string | undefined;
|
|
223
|
+
}>;
|
|
224
|
+
}, "strict", z.ZodTypeAny, {
|
|
225
|
+
id: string;
|
|
226
|
+
config: {
|
|
227
|
+
adapter: "google" | "mapbox";
|
|
228
|
+
pointCount: number;
|
|
229
|
+
iterations: number;
|
|
230
|
+
weightMode: "uniform" | "hotspot";
|
|
231
|
+
deckChunkNote?: string | undefined;
|
|
232
|
+
};
|
|
233
|
+
results: {
|
|
234
|
+
Initial: {
|
|
235
|
+
max: number;
|
|
236
|
+
min: number;
|
|
237
|
+
median: number;
|
|
238
|
+
p95: number;
|
|
239
|
+
};
|
|
240
|
+
ToggleOn: {
|
|
241
|
+
max: number;
|
|
242
|
+
min: number;
|
|
243
|
+
median: number;
|
|
244
|
+
p95: number;
|
|
245
|
+
};
|
|
246
|
+
DataReplace: {
|
|
247
|
+
max: number;
|
|
248
|
+
min: number;
|
|
249
|
+
median: number;
|
|
250
|
+
p95: number;
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
timestamp: number;
|
|
254
|
+
}, {
|
|
255
|
+
id: string;
|
|
256
|
+
config: {
|
|
257
|
+
adapter: "google" | "mapbox";
|
|
258
|
+
pointCount: number;
|
|
259
|
+
iterations: number;
|
|
260
|
+
weightMode: "uniform" | "hotspot";
|
|
261
|
+
deckChunkNote?: string | undefined;
|
|
262
|
+
};
|
|
263
|
+
results: {
|
|
264
|
+
Initial: {
|
|
265
|
+
max: number;
|
|
266
|
+
min: number;
|
|
267
|
+
median: number;
|
|
268
|
+
p95: number;
|
|
269
|
+
};
|
|
270
|
+
ToggleOn: {
|
|
271
|
+
max: number;
|
|
272
|
+
min: number;
|
|
273
|
+
median: number;
|
|
274
|
+
p95: number;
|
|
275
|
+
};
|
|
276
|
+
DataReplace: {
|
|
277
|
+
max: number;
|
|
278
|
+
min: number;
|
|
279
|
+
median: number;
|
|
280
|
+
p95: number;
|
|
281
|
+
};
|
|
282
|
+
};
|
|
283
|
+
timestamp: number;
|
|
284
|
+
}>;
|
|
285
|
+
export declare const heatmapBenchmarkHistorySchema: z.ZodArray<z.ZodObject<{
|
|
286
|
+
id: z.ZodString;
|
|
287
|
+
timestamp: z.ZodNumber;
|
|
288
|
+
results: z.ZodObject<{
|
|
289
|
+
Initial: z.ZodObject<{
|
|
290
|
+
min: z.ZodNumber;
|
|
291
|
+
median: z.ZodNumber;
|
|
292
|
+
p95: z.ZodNumber;
|
|
293
|
+
max: z.ZodNumber;
|
|
294
|
+
}, "strict", z.ZodTypeAny, {
|
|
295
|
+
max: number;
|
|
296
|
+
min: number;
|
|
297
|
+
median: number;
|
|
298
|
+
p95: number;
|
|
299
|
+
}, {
|
|
300
|
+
max: number;
|
|
301
|
+
min: number;
|
|
302
|
+
median: number;
|
|
303
|
+
p95: number;
|
|
304
|
+
}>;
|
|
305
|
+
ToggleOn: z.ZodObject<{
|
|
306
|
+
min: z.ZodNumber;
|
|
307
|
+
median: z.ZodNumber;
|
|
308
|
+
p95: z.ZodNumber;
|
|
309
|
+
max: z.ZodNumber;
|
|
310
|
+
}, "strict", z.ZodTypeAny, {
|
|
311
|
+
max: number;
|
|
312
|
+
min: number;
|
|
313
|
+
median: number;
|
|
314
|
+
p95: number;
|
|
315
|
+
}, {
|
|
316
|
+
max: number;
|
|
317
|
+
min: number;
|
|
318
|
+
median: number;
|
|
319
|
+
p95: number;
|
|
320
|
+
}>;
|
|
321
|
+
DataReplace: z.ZodObject<{
|
|
322
|
+
min: z.ZodNumber;
|
|
323
|
+
median: z.ZodNumber;
|
|
324
|
+
p95: z.ZodNumber;
|
|
325
|
+
max: z.ZodNumber;
|
|
326
|
+
}, "strict", z.ZodTypeAny, {
|
|
327
|
+
max: number;
|
|
328
|
+
min: number;
|
|
329
|
+
median: number;
|
|
330
|
+
p95: number;
|
|
331
|
+
}, {
|
|
332
|
+
max: number;
|
|
333
|
+
min: number;
|
|
334
|
+
median: number;
|
|
335
|
+
p95: number;
|
|
336
|
+
}>;
|
|
337
|
+
}, "strict", z.ZodTypeAny, {
|
|
338
|
+
Initial: {
|
|
339
|
+
max: number;
|
|
340
|
+
min: number;
|
|
341
|
+
median: number;
|
|
342
|
+
p95: number;
|
|
343
|
+
};
|
|
344
|
+
ToggleOn: {
|
|
345
|
+
max: number;
|
|
346
|
+
min: number;
|
|
347
|
+
median: number;
|
|
348
|
+
p95: number;
|
|
349
|
+
};
|
|
350
|
+
DataReplace: {
|
|
351
|
+
max: number;
|
|
352
|
+
min: number;
|
|
353
|
+
median: number;
|
|
354
|
+
p95: number;
|
|
355
|
+
};
|
|
356
|
+
}, {
|
|
357
|
+
Initial: {
|
|
358
|
+
max: number;
|
|
359
|
+
min: number;
|
|
360
|
+
median: number;
|
|
361
|
+
p95: number;
|
|
362
|
+
};
|
|
363
|
+
ToggleOn: {
|
|
364
|
+
max: number;
|
|
365
|
+
min: number;
|
|
366
|
+
median: number;
|
|
367
|
+
p95: number;
|
|
368
|
+
};
|
|
369
|
+
DataReplace: {
|
|
370
|
+
max: number;
|
|
371
|
+
min: number;
|
|
372
|
+
median: number;
|
|
373
|
+
p95: number;
|
|
374
|
+
};
|
|
375
|
+
}>;
|
|
376
|
+
config: z.ZodObject<{
|
|
377
|
+
adapter: z.ZodEnum<["google", "mapbox"]>;
|
|
378
|
+
pointCount: z.ZodNumber;
|
|
379
|
+
iterations: z.ZodNumber;
|
|
380
|
+
weightMode: z.ZodEnum<["uniform", "hotspot"]>;
|
|
381
|
+
deckChunkNote: z.ZodOptional<z.ZodString>;
|
|
382
|
+
}, "strict", z.ZodTypeAny, {
|
|
383
|
+
adapter: "google" | "mapbox";
|
|
384
|
+
pointCount: number;
|
|
385
|
+
iterations: number;
|
|
386
|
+
weightMode: "uniform" | "hotspot";
|
|
387
|
+
deckChunkNote?: string | undefined;
|
|
388
|
+
}, {
|
|
389
|
+
adapter: "google" | "mapbox";
|
|
390
|
+
pointCount: number;
|
|
391
|
+
iterations: number;
|
|
392
|
+
weightMode: "uniform" | "hotspot";
|
|
393
|
+
deckChunkNote?: string | undefined;
|
|
394
|
+
}>;
|
|
395
|
+
}, "strict", z.ZodTypeAny, {
|
|
396
|
+
id: string;
|
|
397
|
+
config: {
|
|
398
|
+
adapter: "google" | "mapbox";
|
|
399
|
+
pointCount: number;
|
|
400
|
+
iterations: number;
|
|
401
|
+
weightMode: "uniform" | "hotspot";
|
|
402
|
+
deckChunkNote?: string | undefined;
|
|
403
|
+
};
|
|
404
|
+
results: {
|
|
405
|
+
Initial: {
|
|
406
|
+
max: number;
|
|
407
|
+
min: number;
|
|
408
|
+
median: number;
|
|
409
|
+
p95: number;
|
|
410
|
+
};
|
|
411
|
+
ToggleOn: {
|
|
412
|
+
max: number;
|
|
413
|
+
min: number;
|
|
414
|
+
median: number;
|
|
415
|
+
p95: number;
|
|
416
|
+
};
|
|
417
|
+
DataReplace: {
|
|
418
|
+
max: number;
|
|
419
|
+
min: number;
|
|
420
|
+
median: number;
|
|
421
|
+
p95: number;
|
|
422
|
+
};
|
|
423
|
+
};
|
|
424
|
+
timestamp: number;
|
|
425
|
+
}, {
|
|
426
|
+
id: string;
|
|
427
|
+
config: {
|
|
428
|
+
adapter: "google" | "mapbox";
|
|
429
|
+
pointCount: number;
|
|
430
|
+
iterations: number;
|
|
431
|
+
weightMode: "uniform" | "hotspot";
|
|
432
|
+
deckChunkNote?: string | undefined;
|
|
433
|
+
};
|
|
434
|
+
results: {
|
|
435
|
+
Initial: {
|
|
436
|
+
max: number;
|
|
437
|
+
min: number;
|
|
438
|
+
median: number;
|
|
439
|
+
p95: number;
|
|
440
|
+
};
|
|
441
|
+
ToggleOn: {
|
|
442
|
+
max: number;
|
|
443
|
+
min: number;
|
|
444
|
+
median: number;
|
|
445
|
+
p95: number;
|
|
446
|
+
};
|
|
447
|
+
DataReplace: {
|
|
448
|
+
max: number;
|
|
449
|
+
min: number;
|
|
450
|
+
median: number;
|
|
451
|
+
p95: number;
|
|
452
|
+
};
|
|
453
|
+
};
|
|
454
|
+
timestamp: number;
|
|
455
|
+
}>, "many">;
|
|
456
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { GeoJsonBbox, GeoJsonPosition } from "@trackunit/geo-json-utils";
|
|
2
|
+
/**
|
|
3
|
+
* Seeded track points for heatmap scale Storybook presets.
|
|
4
|
+
* Tier sizes (100, ~600, 4k, 10k, 25k, 50k) align with libs/react/map/docs/use-heatmap-plan.md
|
|
5
|
+
* § Dataset tiers — rationale is documented there and in SAGA-926, not in Storybook UI copy.
|
|
6
|
+
*/
|
|
7
|
+
export type HeatmapScalePoint = Readonly<{
|
|
8
|
+
position: GeoJsonPosition;
|
|
9
|
+
weight: number;
|
|
10
|
+
}>;
|
|
11
|
+
export type HeatmapWeightMode = "uniform" | "hotspot";
|
|
12
|
+
export declare const computeHeatmapTrackBounds: (points: ReadonlyArray<HeatmapScalePoint>, paddingRatio?: number) => GeoJsonBbox;
|
|
13
|
+
export declare const generateHeatmapTrackPoints: (count: number, seed: number, weightMode?: HeatmapWeightMode) => ReadonlyArray<HeatmapScalePoint>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const benchmarkStatsSchema: z.ZodObject<{
|
|
3
|
+
min: z.ZodNumber;
|
|
4
|
+
median: z.ZodNumber;
|
|
5
|
+
p95: z.ZodNumber;
|
|
6
|
+
max: z.ZodNumber;
|
|
7
|
+
}, "strict", z.ZodTypeAny, {
|
|
8
|
+
max: number;
|
|
9
|
+
min: number;
|
|
10
|
+
median: number;
|
|
11
|
+
p95: number;
|
|
12
|
+
}, {
|
|
13
|
+
max: number;
|
|
14
|
+
min: number;
|
|
15
|
+
median: number;
|
|
16
|
+
p95: number;
|
|
17
|
+
}>;
|