@trackunit/react-map 0.1.22 → 0.1.24
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 +197 -113
- package/index.esm.js +197 -113
- package/package.json +11 -11
- package/src/index.d.ts +1 -1
- package/src/layers/shared/measureLabelWidth.d.ts +8 -6
- package/src/layers/useShapes/buildShapeLabelResolutionContext.d.ts +6 -7
- package/src/layers/useShapes/shapeFillTiling.d.ts +0 -1
- package/src/layers/useShapes/shapeStackOrder.d.ts +3 -10
- package/src/markers/shared/mapMarkerVariants.d.ts +3 -3
|
@@ -2,14 +2,13 @@ import { type GeoJsonBbox, type GeoJsonFeature } from "@trackunit/geo-json-utils
|
|
|
2
2
|
import type { MapInteractionState } from "@trackunit/react-map-adapter-shared";
|
|
3
3
|
import type { ShapeLabelResolutionContext } from "./shapeLabelResolution";
|
|
4
4
|
/**
|
|
5
|
-
* Build the per-feature, per-frame context passed to
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* Build the per-feature, per-frame context passed to viewport-aware shape
|
|
6
|
+
* callbacks. Pure: no React, no `api` reads — caller supplies the already-
|
|
7
|
+
* projected viewport bits, the precomputed `shapesInViewport` count for the
|
|
8
|
+
* layer, a lazy overlap count, and the current interaction state.
|
|
9
9
|
*
|
|
10
10
|
* Lives next to `shapeLabelResolution.ts` and is consumed by
|
|
11
|
-
* `useShapeDecorations` once per feature
|
|
12
|
-
* decoration, before any placement work runs.
|
|
11
|
+
* `useShapeDecorations` once per feature, before any placement work runs.
|
|
13
12
|
*/
|
|
14
13
|
export declare const buildShapeLabelResolutionContext: (feature: GeoJsonFeature, args: Readonly<{
|
|
15
14
|
handleId: string;
|
|
@@ -18,6 +17,6 @@ export declare const buildShapeLabelResolutionContext: (feature: GeoJsonFeature,
|
|
|
18
17
|
zoom: number;
|
|
19
18
|
tileSize: number;
|
|
20
19
|
shapesInViewport: number;
|
|
21
|
-
|
|
20
|
+
getOverlappingShapesCount: () => number;
|
|
22
21
|
interaction: MapInteractionState;
|
|
23
22
|
}>) => ShapeLabelResolutionContext | null;
|
|
@@ -29,7 +29,6 @@ export type FillTilingInput = Readonly<{
|
|
|
29
29
|
/** Only features whose bbox intersects this are considered. */
|
|
30
30
|
viewportBounds: GeoJsonBbox;
|
|
31
31
|
resolveStackOrder: ResolveShapeStackOrder;
|
|
32
|
-
zoom: number;
|
|
33
32
|
/**
|
|
34
33
|
* Feature id that is currently selected. Selection forces the feature to the
|
|
35
34
|
* top of its overlap group, overriding resting order. Takes highest priority.
|
|
@@ -12,22 +12,15 @@ export type ContendedShape = Readonly<{
|
|
|
12
12
|
/** IDs of other contended shapes that fully contain this one. */
|
|
13
13
|
containedIn: ReadonlyArray<string>;
|
|
14
14
|
}>;
|
|
15
|
-
/**
|
|
16
|
-
* Context for a single resolve pass.
|
|
17
|
-
*/
|
|
18
|
-
export type ShapeStackContext = Readonly<{
|
|
19
|
-
/** Current map zoom level. */
|
|
20
|
-
zoom: number;
|
|
21
|
-
}>;
|
|
22
15
|
/**
|
|
23
16
|
* Decides fill ownership for a set of overlapping shapes. Returns the contended
|
|
24
17
|
* feature IDs ordered **top-first** — the first ID owns shared pixels, later
|
|
25
18
|
* IDs are clipped against the winners ahead of them.
|
|
26
19
|
*
|
|
27
|
-
* Pure: same
|
|
28
|
-
* `overlap.resolveStackOrder` option on `useShapes`.
|
|
20
|
+
* Pure and zoom-invariant: same contended shapes must yield the same ordering.
|
|
21
|
+
* Swappable per-layer via the `overlap.resolveStackOrder` option on `useShapes`.
|
|
29
22
|
*/
|
|
30
|
-
export type ResolveShapeStackOrder = (contended: ReadonlyArray<ContendedShape
|
|
23
|
+
export type ResolveShapeStackOrder = (contended: ReadonlyArray<ContendedShape>) => ReadonlyArray<string>;
|
|
31
24
|
/**
|
|
32
25
|
* Default stack-order policy (ADR-0021 "golden path"). In priority order:
|
|
33
26
|
*
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
* both states. The inner indicator disc (`cvaMarkerIndicator` below) carries
|
|
9
9
|
* its own per-size `h-* w-*`; the outer surface sizes intrinsically around it.
|
|
10
10
|
*
|
|
11
|
-
* `
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* `transitionProperty` is set inline in `MapMarker.tsx` to list only the
|
|
12
|
+
* properties that need to animate, intentionally excluding `width` to prevent
|
|
13
|
+
* non-composited layout thrashing. See `MarkerAnimatedSurface.tsx` for details.
|
|
14
14
|
*/
|
|
15
15
|
export declare const cvaMapMarker: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
16
16
|
/**
|