@trackunit/react-map-adapter-shared 0.0.134 → 0.0.135
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 +12 -5
- package/index.esm.js +12 -5
- package/migrations/entry.js.map +1 -0
- package/package.json +1 -1
- package/src/markerDomPortalStacking.d.ts +8 -4
package/index.cjs.js
CHANGED
|
@@ -1109,9 +1109,12 @@ const INITIAL_INTERACTION_STATE = {
|
|
|
1109
1109
|
const GEOMETRY_WEIGHT = {
|
|
1110
1110
|
cluster: 0,
|
|
1111
1111
|
circle: 1,
|
|
1112
|
-
|
|
1113
|
-
stick:
|
|
1112
|
+
// Idle band for `stick`; an active (hovered/selected) stick uses `STICK_ACTIVE_WEIGHT` instead.
|
|
1113
|
+
stick: 2,
|
|
1114
|
+
pill: 3,
|
|
1114
1115
|
};
|
|
1116
|
+
/** Band a hovered/selected stick jumps to — above the `pill` (label) band, for interaction-to-front. */
|
|
1117
|
+
const STICK_ACTIVE_WEIGHT = 4;
|
|
1115
1118
|
const PHASE_WEIGHT = {
|
|
1116
1119
|
expanded: 0,
|
|
1117
1120
|
idle: 1,
|
|
@@ -1120,15 +1123,19 @@ const PHASE_WEIGHT = {
|
|
|
1120
1123
|
};
|
|
1121
1124
|
/** Room for new phases without overlapping the next geometry band. */
|
|
1122
1125
|
const GEOMETRY_STRIDE = 10;
|
|
1126
|
+
const isActivePhase = (phase) => phase === "hovered" || phase === "selected";
|
|
1123
1127
|
/**
|
|
1124
1128
|
* Single source of truth for DOM marker portal `z-index` values.
|
|
1125
1129
|
*
|
|
1126
|
-
*
|
|
1127
|
-
*
|
|
1130
|
+
* `cluster`, `circle` and `pill` tiers always sort by geometry regardless of phase (any `pill`
|
|
1131
|
+
* stacks above any `circle`). A `stick` is the exception: idle/expanded it sits just below the
|
|
1132
|
+
* `pill` band (so its leader line and anchor pin never cover another label), but hovered/selected it
|
|
1133
|
+
* promotes above the `pill` band (interaction-to-front). Within a band, phase orders
|
|
1128
1134
|
* expanded → idle → hovered → selected.
|
|
1129
1135
|
*/
|
|
1130
1136
|
const computeMarkerDomPortalZIndex = (geometry, phase) => {
|
|
1131
|
-
|
|
1137
|
+
const geometryWeight = geometry === "stick" && isActivePhase(phase) ? STICK_ACTIVE_WEIGHT : GEOMETRY_WEIGHT[geometry];
|
|
1138
|
+
return geometryWeight * GEOMETRY_STRIDE + PHASE_WEIGHT[phase];
|
|
1132
1139
|
};
|
|
1133
1140
|
|
|
1134
1141
|
// ============================================================================
|
package/index.esm.js
CHANGED
|
@@ -1107,9 +1107,12 @@ const INITIAL_INTERACTION_STATE = {
|
|
|
1107
1107
|
const GEOMETRY_WEIGHT = {
|
|
1108
1108
|
cluster: 0,
|
|
1109
1109
|
circle: 1,
|
|
1110
|
-
|
|
1111
|
-
stick:
|
|
1110
|
+
// Idle band for `stick`; an active (hovered/selected) stick uses `STICK_ACTIVE_WEIGHT` instead.
|
|
1111
|
+
stick: 2,
|
|
1112
|
+
pill: 3,
|
|
1112
1113
|
};
|
|
1114
|
+
/** Band a hovered/selected stick jumps to — above the `pill` (label) band, for interaction-to-front. */
|
|
1115
|
+
const STICK_ACTIVE_WEIGHT = 4;
|
|
1113
1116
|
const PHASE_WEIGHT = {
|
|
1114
1117
|
expanded: 0,
|
|
1115
1118
|
idle: 1,
|
|
@@ -1118,15 +1121,19 @@ const PHASE_WEIGHT = {
|
|
|
1118
1121
|
};
|
|
1119
1122
|
/** Room for new phases without overlapping the next geometry band. */
|
|
1120
1123
|
const GEOMETRY_STRIDE = 10;
|
|
1124
|
+
const isActivePhase = (phase) => phase === "hovered" || phase === "selected";
|
|
1121
1125
|
/**
|
|
1122
1126
|
* Single source of truth for DOM marker portal `z-index` values.
|
|
1123
1127
|
*
|
|
1124
|
-
*
|
|
1125
|
-
*
|
|
1128
|
+
* `cluster`, `circle` and `pill` tiers always sort by geometry regardless of phase (any `pill`
|
|
1129
|
+
* stacks above any `circle`). A `stick` is the exception: idle/expanded it sits just below the
|
|
1130
|
+
* `pill` band (so its leader line and anchor pin never cover another label), but hovered/selected it
|
|
1131
|
+
* promotes above the `pill` band (interaction-to-front). Within a band, phase orders
|
|
1126
1132
|
* expanded → idle → hovered → selected.
|
|
1127
1133
|
*/
|
|
1128
1134
|
const computeMarkerDomPortalZIndex = (geometry, phase) => {
|
|
1129
|
-
|
|
1135
|
+
const geometryWeight = geometry === "stick" && isActivePhase(phase) ? STICK_ACTIVE_WEIGHT : GEOMETRY_WEIGHT[geometry];
|
|
1136
|
+
return geometryWeight * GEOMETRY_STRIDE + PHASE_WEIGHT[phase];
|
|
1130
1137
|
};
|
|
1131
1138
|
|
|
1132
1139
|
// ============================================================================
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry.js","sourceRoot":"","sources":["../../../../../libs/react/map-adapter-shared/migrations/entry.ts"],"names":[],"mappings":"","sourcesContent":["export {};\n"]}
|
package/package.json
CHANGED
|
@@ -2,8 +2,10 @@ import type { MapTheme } from "./primitiveMapTypes";
|
|
|
2
2
|
/**
|
|
3
3
|
* Visual role of a DOM portal marker for **global** stacking (z-index) on the map.
|
|
4
4
|
*
|
|
5
|
-
* Ordering (back → front): `cluster` < `circle` < `pill` < `stick`.
|
|
6
|
-
*
|
|
5
|
+
* Ordering (back → front): `cluster` < `circle` < idle `stick` < `pill` < active `stick`.
|
|
6
|
+
* A `stick` is phase-dependent: while idle/expanded it sits below the `pill` (label) band so its
|
|
7
|
+
* leader line and anchor pin never cover another marker's label; when hovered/selected it promotes
|
|
8
|
+
* above the label band (interaction-to-front). Cluster DOM stays behind individual markers.
|
|
7
9
|
*/
|
|
8
10
|
export type MarkerDomPortalStackGeometry = "circle" | "pill" | "stick" | "cluster";
|
|
9
11
|
/**
|
|
@@ -29,8 +31,10 @@ export type DomPortalStackingResolver = (item: unknown, input: DomPortalStacking
|
|
|
29
31
|
/**
|
|
30
32
|
* Single source of truth for DOM marker portal `z-index` values.
|
|
31
33
|
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
+
* `cluster`, `circle` and `pill` tiers always sort by geometry regardless of phase (any `pill`
|
|
35
|
+
* stacks above any `circle`). A `stick` is the exception: idle/expanded it sits just below the
|
|
36
|
+
* `pill` band (so its leader line and anchor pin never cover another label), but hovered/selected it
|
|
37
|
+
* promotes above the `pill` band (interaction-to-front). Within a band, phase orders
|
|
34
38
|
* expanded → idle → hovered → selected.
|
|
35
39
|
*/
|
|
36
40
|
export declare const computeMarkerDomPortalZIndex: (geometry: MarkerDomPortalStackGeometry, phase: MarkerDomPortalStackPhase) => number;
|