@trackunit/react-map-adapter-shared 0.0.207 → 0.0.209

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 CHANGED
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
+ var esToolkit = require('es-toolkit');
3
4
  var geoJsonUtils = require('@trackunit/geo-json-utils');
4
5
  var uiDesignTokens = require('@trackunit/ui-design-tokens');
5
- var esToolkit = require('es-toolkit');
6
6
  var zod = require('zod');
7
7
  var reactMapColorUtils = require('@trackunit/react-map-color-utils');
8
8
 
@@ -869,6 +869,38 @@ const mercatorCenterFromBounds = (bounds) => {
869
869
 
870
870
  /** A `DrawValue` with no features. Stable reference, safe for snapshot comparisons. */
871
871
  const EMPTY_DRAW_VALUE = { type: "FeatureCollection", features: [] };
872
+ /**
873
+ * Wraps one polygon in a single-feature `DrawValue`, the typed counterpart of
874
+ * `toFeatureCollection` for a drawing (a form's stored boundary, say). The `id` key is
875
+ * written only when given and `properties` defaults to `{}`, the engine's own shape, so
876
+ * two calls with the same input are identical key for key and a controller that compares
877
+ * features whole sees no change between them.
878
+ */
879
+ const toDrawValue = (polygon, options) => ({
880
+ type: "FeatureCollection",
881
+ features: [
882
+ {
883
+ type: "Feature",
884
+ ...(options?.id === undefined ? {} : { id: options.id }),
885
+ geometry: polygon,
886
+ properties: options?.properties ?? {},
887
+ },
888
+ ],
889
+ });
890
+ /**
891
+ * Geometry-only equality of two drawings. Ids and properties are ignored because the
892
+ * engine assigns its own ids and bookkeeping properties, and a consumer round-tripping
893
+ * the value through form state re-labels them: two drawings are the same when their
894
+ * polygons have the same rings in the same order. The controller and `useDraw` both
895
+ * use it to tell a user edit from an echo of a value they were given.
896
+ */
897
+ const drawValuesEqual = (a, b) => {
898
+ if (a === b)
899
+ return true;
900
+ if (a.features.length !== b.features.length)
901
+ return false;
902
+ return esToolkit.isEqual(a.features.map(feature => feature.geometry), b.features.map(feature => feature.geometry));
903
+ };
872
904
  const NO_DRAW_ERRORS = { engine: null, value: null };
873
905
 
874
906
  // ============================================================================
@@ -1818,8 +1850,9 @@ const removeGoneIndexedMarkers = ({ incomingFeatureIds, markerIndex, markers, po
1818
1850
  * Convert a MarkerAnchor value to a CSS transform string.
1819
1851
  * Assumes the element's **bottom-center** is at the coordinate by default.
1820
1852
  * Google Maps AdvancedMarkerElement positions custom DOM content at
1821
- * bottom-center, so all Google DOM elements (symbol dots, shape point dots,
1822
- * and DOM markers) need this to correct anchoring.
1853
+ * bottom-center, so Google dot elements (symbol dots and shape point dots)
1854
+ * need this to correct anchoring. DOM markers use {@link anchorToGoogleOffsets}
1855
+ * instead, because a transform leaves an empty hit area above the content.
1823
1856
  */
1824
1857
  const anchorFromBottomCenter = (anchor) => {
1825
1858
  switch (anchor) {
@@ -1846,6 +1879,48 @@ const anchorFromBottomCenter = (anchor) => {
1846
1879
  }
1847
1880
  }
1848
1881
  };
1882
+ const anchorToGooglePercentages = (anchor) => {
1883
+ switch (anchor) {
1884
+ case "center":
1885
+ return { anchorLeft: "-50%", anchorTop: "-50%" };
1886
+ case "top":
1887
+ return { anchorLeft: "-50%", anchorTop: "0%" };
1888
+ case "bottom":
1889
+ return { anchorLeft: "-50%", anchorTop: "-100%" };
1890
+ case "left":
1891
+ return { anchorLeft: "0%", anchorTop: "-50%" };
1892
+ case "right":
1893
+ return { anchorLeft: "-100%", anchorTop: "-50%" };
1894
+ case "top-left":
1895
+ return { anchorLeft: "0%", anchorTop: "0%" };
1896
+ case "top-right":
1897
+ return { anchorLeft: "-100%", anchorTop: "0%" };
1898
+ case "bottom-left":
1899
+ return { anchorLeft: "0%", anchorTop: "-100%" };
1900
+ case "bottom-right":
1901
+ return { anchorLeft: "-100%", anchorTop: "-100%" };
1902
+ default: {
1903
+ throw new Error(`${anchor} is not known`);
1904
+ }
1905
+ }
1906
+ };
1907
+ const foldPixelsIntoPercentage = (percentage, pixels) => pixels === 0 ? percentage : `calc(${percentage} ${pixels > 0 ? "+" : "-"} ${Math.abs(pixels)}px)`;
1908
+ /**
1909
+ * Convert a MarkerAnchor value, and an optional pixel offset, to Google's native
1910
+ * `anchorLeft` / `anchorTop`: CSS length-percentages that offset the marker from
1911
+ * its top-left corner (Google's default is `-50%` / `-100%`, i.e. bottom-center).
1912
+ * Unlike {@link anchorFromBottomCenter}, this moves the marker's layout box, so
1913
+ * the `<gmp-advanced-marker>` hover and click area matches the visible content.
1914
+ */
1915
+ const anchorToGoogleOffsets = (anchor, pixelOffset) => {
1916
+ const { anchorLeft, anchorTop } = anchorToGooglePercentages(anchor);
1917
+ if (pixelOffset === undefined)
1918
+ return { anchorLeft, anchorTop };
1919
+ return {
1920
+ anchorLeft: foldPixelsIntoPercentage(anchorLeft, pixelOffset.x),
1921
+ anchorTop: foldPixelsIntoPercentage(anchorTop, pixelOffset.y),
1922
+ };
1923
+ };
1849
1924
  const LAYER_FADE_DURATION_MS = 200;
1850
1925
  /**
1851
1926
  * Start an element at opacity 0 and animate it in via CSS transition.
@@ -2749,6 +2824,7 @@ exports.TRAFFIC_MIN_ZOOM = TRAFFIC_MIN_ZOOM;
2749
2824
  exports.WORLD_BBOX = WORLD_BBOX;
2750
2825
  exports.allocSafeAreaDebugId = allocSafeAreaDebugId;
2751
2826
  exports.anchorFromBottomCenter = anchorFromBottomCenter;
2827
+ exports.anchorToGoogleOffsets = anchorToGoogleOffsets;
2752
2828
  exports.angularDistance = angularDistance;
2753
2829
  exports.attachSafeAreaHoverListeners = attachSafeAreaHoverListeners;
2754
2830
  exports.bboxEquals = bboxEquals;
@@ -2772,6 +2848,7 @@ exports.defineAdapter = defineAdapter;
2772
2848
  exports.densifyGeodesicFeatures = densifyGeodesicFeatures;
2773
2849
  exports.disableSafeAreaDebug = disableSafeAreaDebug;
2774
2850
  exports.discriminateRenderResult = discriminateRenderResult;
2851
+ exports.drawValuesEqual = drawValuesEqual;
2775
2852
  exports.enableSafeAreaDebug = enableSafeAreaDebug;
2776
2853
  exports.estimateZoomFromBounds = estimateZoomFromBounds;
2777
2854
  exports.extractLineCoordinates = extractLineCoordinates;
@@ -2810,6 +2887,7 @@ exports.resolveSymbolDescriptor = resolveSymbolDescriptor;
2810
2887
  exports.safePolygon = safePolygon;
2811
2888
  exports.setHitTargetInert = setHitTargetInert;
2812
2889
  exports.toDeg = toDeg;
2890
+ exports.toDrawValue = toDrawValue;
2813
2891
  exports.toRad = toRad;
2814
2892
  exports.unwrapLongitudeNear = unwrapLongitudeNear;
2815
2893
  exports.validateInitialViewport = validateInitialViewport;
package/index.esm.js CHANGED
@@ -1,6 +1,6 @@
1
+ import { isEqual } from 'es-toolkit';
1
2
  import { validatePosition, validateBbox } from '@trackunit/geo-json-utils';
2
3
  import { color } from '@trackunit/ui-design-tokens';
3
- import { isEqual } from 'es-toolkit';
4
4
  import { z } from 'zod';
5
5
  import { lightenColor, darkenColor } from '@trackunit/react-map-color-utils';
6
6
 
@@ -867,6 +867,38 @@ const mercatorCenterFromBounds = (bounds) => {
867
867
 
868
868
  /** A `DrawValue` with no features. Stable reference, safe for snapshot comparisons. */
869
869
  const EMPTY_DRAW_VALUE = { type: "FeatureCollection", features: [] };
870
+ /**
871
+ * Wraps one polygon in a single-feature `DrawValue`, the typed counterpart of
872
+ * `toFeatureCollection` for a drawing (a form's stored boundary, say). The `id` key is
873
+ * written only when given and `properties` defaults to `{}`, the engine's own shape, so
874
+ * two calls with the same input are identical key for key and a controller that compares
875
+ * features whole sees no change between them.
876
+ */
877
+ const toDrawValue = (polygon, options) => ({
878
+ type: "FeatureCollection",
879
+ features: [
880
+ {
881
+ type: "Feature",
882
+ ...(options?.id === undefined ? {} : { id: options.id }),
883
+ geometry: polygon,
884
+ properties: options?.properties ?? {},
885
+ },
886
+ ],
887
+ });
888
+ /**
889
+ * Geometry-only equality of two drawings. Ids and properties are ignored because the
890
+ * engine assigns its own ids and bookkeeping properties, and a consumer round-tripping
891
+ * the value through form state re-labels them: two drawings are the same when their
892
+ * polygons have the same rings in the same order. The controller and `useDraw` both
893
+ * use it to tell a user edit from an echo of a value they were given.
894
+ */
895
+ const drawValuesEqual = (a, b) => {
896
+ if (a === b)
897
+ return true;
898
+ if (a.features.length !== b.features.length)
899
+ return false;
900
+ return isEqual(a.features.map(feature => feature.geometry), b.features.map(feature => feature.geometry));
901
+ };
870
902
  const NO_DRAW_ERRORS = { engine: null, value: null };
871
903
 
872
904
  // ============================================================================
@@ -1816,8 +1848,9 @@ const removeGoneIndexedMarkers = ({ incomingFeatureIds, markerIndex, markers, po
1816
1848
  * Convert a MarkerAnchor value to a CSS transform string.
1817
1849
  * Assumes the element's **bottom-center** is at the coordinate by default.
1818
1850
  * Google Maps AdvancedMarkerElement positions custom DOM content at
1819
- * bottom-center, so all Google DOM elements (symbol dots, shape point dots,
1820
- * and DOM markers) need this to correct anchoring.
1851
+ * bottom-center, so Google dot elements (symbol dots and shape point dots)
1852
+ * need this to correct anchoring. DOM markers use {@link anchorToGoogleOffsets}
1853
+ * instead, because a transform leaves an empty hit area above the content.
1821
1854
  */
1822
1855
  const anchorFromBottomCenter = (anchor) => {
1823
1856
  switch (anchor) {
@@ -1844,6 +1877,48 @@ const anchorFromBottomCenter = (anchor) => {
1844
1877
  }
1845
1878
  }
1846
1879
  };
1880
+ const anchorToGooglePercentages = (anchor) => {
1881
+ switch (anchor) {
1882
+ case "center":
1883
+ return { anchorLeft: "-50%", anchorTop: "-50%" };
1884
+ case "top":
1885
+ return { anchorLeft: "-50%", anchorTop: "0%" };
1886
+ case "bottom":
1887
+ return { anchorLeft: "-50%", anchorTop: "-100%" };
1888
+ case "left":
1889
+ return { anchorLeft: "0%", anchorTop: "-50%" };
1890
+ case "right":
1891
+ return { anchorLeft: "-100%", anchorTop: "-50%" };
1892
+ case "top-left":
1893
+ return { anchorLeft: "0%", anchorTop: "0%" };
1894
+ case "top-right":
1895
+ return { anchorLeft: "-100%", anchorTop: "0%" };
1896
+ case "bottom-left":
1897
+ return { anchorLeft: "0%", anchorTop: "-100%" };
1898
+ case "bottom-right":
1899
+ return { anchorLeft: "-100%", anchorTop: "-100%" };
1900
+ default: {
1901
+ throw new Error(`${anchor} is not known`);
1902
+ }
1903
+ }
1904
+ };
1905
+ const foldPixelsIntoPercentage = (percentage, pixels) => pixels === 0 ? percentage : `calc(${percentage} ${pixels > 0 ? "+" : "-"} ${Math.abs(pixels)}px)`;
1906
+ /**
1907
+ * Convert a MarkerAnchor value, and an optional pixel offset, to Google's native
1908
+ * `anchorLeft` / `anchorTop`: CSS length-percentages that offset the marker from
1909
+ * its top-left corner (Google's default is `-50%` / `-100%`, i.e. bottom-center).
1910
+ * Unlike {@link anchorFromBottomCenter}, this moves the marker's layout box, so
1911
+ * the `<gmp-advanced-marker>` hover and click area matches the visible content.
1912
+ */
1913
+ const anchorToGoogleOffsets = (anchor, pixelOffset) => {
1914
+ const { anchorLeft, anchorTop } = anchorToGooglePercentages(anchor);
1915
+ if (pixelOffset === undefined)
1916
+ return { anchorLeft, anchorTop };
1917
+ return {
1918
+ anchorLeft: foldPixelsIntoPercentage(anchorLeft, pixelOffset.x),
1919
+ anchorTop: foldPixelsIntoPercentage(anchorTop, pixelOffset.y),
1920
+ };
1921
+ };
1847
1922
  const LAYER_FADE_DURATION_MS = 200;
1848
1923
  /**
1849
1924
  * Start an element at opacity 0 and animate it in via CSS transition.
@@ -2721,4 +2796,4 @@ const resolveStrokeColors = (style, shapeType, theme) => {
2721
2796
  };
2722
2797
  };
2723
2798
 
2724
- export { ANCHOR_SELECTOR, CIRCLE_SYMBOL_DEFAULT_DIAMETER_PX, CIRCLE_SYMBOL_DEFAULT_OPACITY, DEFAULT_CENTER, DEFAULT_MAP_APPEARANCE, DEFAULT_ZOOM, EMPTY_DRAW_VALUE, GEODESIC_MAX_SEGMENT_KM, HIT_SURFACE_SELECTOR, INERT_HIT_TARGET_CLASS, INITIAL_CAMERA_STATE, INITIAL_INTERACTION_STATE, INITIAL_MAP_STATE, INITIAL_MAP_STATUS, KEYBOARD_PAN_AMOUNT, KEYBOARD_ZOOM_AMOUNT, LAYER_FADE_DURATION_MS, MAP_CURSORS, MAX_ZOOM, MIN_ZOOM, NO_DRAW_ERRORS, SAFE_AREA_DEFAULT_BUFFER_PX, TRAFFIC_MIN_ZOOM, WORLD_BBOX, allocSafeAreaDebugId, anchorFromBottomCenter, angularDistance, attachSafeAreaHoverListeners, bboxEquals, bufferRectCorners, buildAdaptiveDomEntries, buildAdaptiveDomRenderFn, buildAdaptiveSymbolStyleFn, cameraStateEquals, canPatchAdaptiveMarker, canPatchAdaptiveViewport, canPatchMarkerInPlace, clearSafeArea, collectFeatureIdSet, computeInitialState, computeMarkerDomPortalZIndex, convexHull, createClusterPinElement, createDefaultClusterElement, createSymbolDotElement, defineAdapter, densifyGeodesicFeatures, disableSafeAreaDebug, discriminateRenderResult, enableSafeAreaDebug, estimateZoomFromBounds, extractLineCoordinates, extractPointCoordinates, extractPolygonPaths, extractSourceData, fadeInElement, filterRectsByCursorDirection, geometryTypeToShapeType, getAdaptiveDomFeatureIds, getAnchorRect, getEffectiveRestrictBounds, getHitSurfaceRect, googleMapCspDirectives, hasSameFeatureIds, intermediatePoint, isCanvasMarkerMode, isEventOfType, isSafeAreaDebugEnabled, mapAppearanceSchema, mapStateEquals, mapThemeSchema, mapTypeSchema, mapboxMapCspDirectives, mercatorCenterFromBounds, mergeAntimeridianFeatures, patchPortalDescriptors, pointInPolygon, removeGoneIndexedMarkers, renderSafeArea, resolveCircleSymbolDefaults, resolveHoveredStyle, resolveSelectedStyle, resolveStrokeColors, resolveSymbolDescriptor, safePolygon, setHitTargetInert, toDeg, toRad, unwrapLongitudeNear, validateInitialViewport, watchSafeAreaLeave };
2799
+ export { ANCHOR_SELECTOR, CIRCLE_SYMBOL_DEFAULT_DIAMETER_PX, CIRCLE_SYMBOL_DEFAULT_OPACITY, DEFAULT_CENTER, DEFAULT_MAP_APPEARANCE, DEFAULT_ZOOM, EMPTY_DRAW_VALUE, GEODESIC_MAX_SEGMENT_KM, HIT_SURFACE_SELECTOR, INERT_HIT_TARGET_CLASS, INITIAL_CAMERA_STATE, INITIAL_INTERACTION_STATE, INITIAL_MAP_STATE, INITIAL_MAP_STATUS, KEYBOARD_PAN_AMOUNT, KEYBOARD_ZOOM_AMOUNT, LAYER_FADE_DURATION_MS, MAP_CURSORS, MAX_ZOOM, MIN_ZOOM, NO_DRAW_ERRORS, SAFE_AREA_DEFAULT_BUFFER_PX, TRAFFIC_MIN_ZOOM, WORLD_BBOX, allocSafeAreaDebugId, anchorFromBottomCenter, anchorToGoogleOffsets, angularDistance, attachSafeAreaHoverListeners, bboxEquals, bufferRectCorners, buildAdaptiveDomEntries, buildAdaptiveDomRenderFn, buildAdaptiveSymbolStyleFn, cameraStateEquals, canPatchAdaptiveMarker, canPatchAdaptiveViewport, canPatchMarkerInPlace, clearSafeArea, collectFeatureIdSet, computeInitialState, computeMarkerDomPortalZIndex, convexHull, createClusterPinElement, createDefaultClusterElement, createSymbolDotElement, defineAdapter, densifyGeodesicFeatures, disableSafeAreaDebug, discriminateRenderResult, drawValuesEqual, enableSafeAreaDebug, estimateZoomFromBounds, extractLineCoordinates, extractPointCoordinates, extractPolygonPaths, extractSourceData, fadeInElement, filterRectsByCursorDirection, geometryTypeToShapeType, getAdaptiveDomFeatureIds, getAnchorRect, getEffectiveRestrictBounds, getHitSurfaceRect, googleMapCspDirectives, hasSameFeatureIds, intermediatePoint, isCanvasMarkerMode, isEventOfType, isSafeAreaDebugEnabled, mapAppearanceSchema, mapStateEquals, mapThemeSchema, mapTypeSchema, mapboxMapCspDirectives, mercatorCenterFromBounds, mergeAntimeridianFeatures, patchPortalDescriptors, pointInPolygon, removeGoneIndexedMarkers, renderSafeArea, resolveCircleSymbolDefaults, resolveHoveredStyle, resolveSelectedStyle, resolveStrokeColors, resolveSymbolDescriptor, safePolygon, setHitTargetInert, toDeg, toDrawValue, toRad, unwrapLongitudeNear, validateInitialViewport, watchSafeAreaLeave };
@@ -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
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@trackunit/react-map-adapter-shared",
3
- "version": "0.0.207",
3
+ "version": "0.0.209",
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-map-color-utils": "0.0.181",
11
- "@trackunit/geo-json-utils": "1.21.40",
10
+ "@trackunit/react-map-color-utils": "0.0.182",
11
+ "@trackunit/geo-json-utils": "1.21.41",
12
12
  "@trackunit/ui-design-tokens": "1.21.39",
13
13
  "es-toolkit": "^1.52.0",
14
14
  "zod": "^3.25.76"
package/src/DrawPort.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { GeoJsonFeatureCollection } from "@trackunit/geo-json-utils";
1
+ import type { GeoJsonFeature, GeoJsonFeatureCollection, GeoJsonPolygon } from "@trackunit/geo-json-utils";
2
2
  /**
3
3
  * Interaction mode of the drawing capability (ADR 0030).
4
4
  *
@@ -8,14 +8,46 @@ import type { GeoJsonFeatureCollection } from "@trackunit/geo-json-utils";
8
8
  */
9
9
  export type DrawMode = "idle" | "polygon" | "select";
10
10
  /**
11
- * The committed drawing: a standard GeoJSON FeatureCollection whose features are
12
- * `Polygon` geometries with a single outer ring, lon/lat positions, closed.
13
- * Adapters never expose in-progress geometry here — a polygon appears once the user
14
- * has finished it.
11
+ * One feature of a drawing: a standard GeoJSON `Feature` whose geometry is a
12
+ * `Polygon`. The type stops at the geometry kind; the engine is stricter than the
13
+ * type can say (one closed outer ring, no holes, no self-intersection), and a
14
+ * feature that passes the type but not the engine stays in the value and is
15
+ * reported as `value-rejected` (see `DrawError`).
15
16
  */
16
- export type DrawValue = GeoJsonFeatureCollection;
17
+ export interface DrawFeature extends Omit<GeoJsonFeature, "geometry"> {
18
+ readonly geometry: GeoJsonPolygon;
19
+ }
20
+ /**
21
+ * The committed drawing: a standard GeoJSON FeatureCollection of `Polygon`
22
+ * features, lon/lat positions. Narrower than `GeoJsonFeatureCollection` so a point
23
+ * or a line is a type error rather than a runtime rejection; it is still assignable
24
+ * to the wider type where a layer wants it. Adapters never expose in-progress
25
+ * geometry here: a polygon appears once the user has finished it.
26
+ */
27
+ export interface DrawValue extends Omit<GeoJsonFeatureCollection, "features"> {
28
+ readonly features: Array<DrawFeature>;
29
+ }
17
30
  /** A `DrawValue` with no features. Stable reference, safe for snapshot comparisons. */
18
31
  export declare const EMPTY_DRAW_VALUE: DrawValue;
32
+ /**
33
+ * Wraps one polygon in a single-feature `DrawValue`, the typed counterpart of
34
+ * `toFeatureCollection` for a drawing (a form's stored boundary, say). The `id` key is
35
+ * written only when given and `properties` defaults to `{}`, the engine's own shape, so
36
+ * two calls with the same input are identical key for key and a controller that compares
37
+ * features whole sees no change between them.
38
+ */
39
+ export declare const toDrawValue: (polygon: GeoJsonPolygon, options?: Readonly<{
40
+ id?: string | number;
41
+ properties?: Readonly<Record<string, unknown>>;
42
+ }>) => DrawValue;
43
+ /**
44
+ * Geometry-only equality of two drawings. Ids and properties are ignored because the
45
+ * engine assigns its own ids and bookkeeping properties, and a consumer round-tripping
46
+ * the value through form state re-labels them: two drawings are the same when their
47
+ * polygons have the same rings in the same order. The controller and `useDraw` both
48
+ * use it to tell a user edit from an echo of a value they were given.
49
+ */
50
+ export declare const drawValuesEqual: (a: DrawValue, b: DrawValue) => boolean;
19
51
  /**
20
52
  * Why the drawing could not do what it was asked (ADR 0030).
21
53
  *
@@ -1,4 +1,4 @@
1
- import type { AdaptiveRenderState, CircleSymbolDescriptor, GeoJsonFeature, GeoJsonFeatureCollection, MarkerAnchor, RenderMedium, SymbolDescriptor, SymbolRenderState } from "./layerApiTypes";
1
+ import type { AdaptiveRenderState, CircleSymbolDescriptor, GeoJsonFeature, GeoJsonFeatureCollection, MarkerAnchor, PixelOffset, RenderMedium, SymbolDescriptor, SymbolRenderState } from "./layerApiTypes";
2
2
  import type { DomPortalDescriptor, MarkerSourceConfig } from "./LayerPort";
3
3
  type ReactNode = import("react").ReactNode;
4
4
  /** Simple {lng, lat} coordinate pair used across adapters */
@@ -246,10 +246,22 @@ export declare const removeGoneIndexedMarkers: <TMarker>({ incomingFeatureIds, m
246
246
  * Convert a MarkerAnchor value to a CSS transform string.
247
247
  * Assumes the element's **bottom-center** is at the coordinate by default.
248
248
  * Google Maps AdvancedMarkerElement positions custom DOM content at
249
- * bottom-center, so all Google DOM elements (symbol dots, shape point dots,
250
- * and DOM markers) need this to correct anchoring.
249
+ * bottom-center, so Google dot elements (symbol dots and shape point dots)
250
+ * need this to correct anchoring. DOM markers use {@link anchorToGoogleOffsets}
251
+ * instead, because a transform leaves an empty hit area above the content.
251
252
  */
252
253
  export declare const anchorFromBottomCenter: (anchor: MarkerAnchor) => string;
254
+ /**
255
+ * Convert a MarkerAnchor value, and an optional pixel offset, to Google's native
256
+ * `anchorLeft` / `anchorTop`: CSS length-percentages that offset the marker from
257
+ * its top-left corner (Google's default is `-50%` / `-100%`, i.e. bottom-center).
258
+ * Unlike {@link anchorFromBottomCenter}, this moves the marker's layout box, so
259
+ * the `<gmp-advanced-marker>` hover and click area matches the visible content.
260
+ */
261
+ export declare const anchorToGoogleOffsets: (anchor: MarkerAnchor, pixelOffset?: PixelOffset) => {
262
+ anchorLeft: string;
263
+ anchorTop: string;
264
+ };
253
265
  export declare const LAYER_FADE_DURATION_MS = 200;
254
266
  /**
255
267
  * Start an element at opacity 0 and animate it in via CSS transition.