@yarrow-uz/rn-map-sdk 0.1.0 → 0.3.0

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.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { CameraRef, CameraRef as CameraRef$1, MapProps, MapRef, MapRef as MapRef$1, OfflinePackStatus, PressEventWithFeatures } from "@maplibre/maplibre-react-native";
2
- import { ReactNode, Ref } from "react";
1
+ import { CameraRef, CameraRef as CameraRef$1, MapProps, MapRef, MapRef as MapRef$1, MarkerProps, OfflinePackStatus, PressEventWithFeatures } from "@maplibre/maplibre-react-native";
2
+ import { ReactElement, ReactNode, Ref, RefObject } from "react";
3
3
  import { NativeSyntheticEvent, ViewProps } from "react-native";
4
4
  declare const YARROW_MAP_URL: string;
5
5
  declare const YARROW_SEARCH_API_URL: string;
@@ -10,24 +10,6 @@ export declare function getYarrowApiKey(): string;
10
10
  * url unchanged when no key is configured yet or the url cannot be parsed.
11
11
  */
12
12
  export declare function addApiKeyToUrl(url: string): string;
13
- export declare function trackDau(apiKey: string, sdkType?: string): void;
14
- /**
15
- * Public alias of `STORAGE_KEY` so platform SDKs can build storage adapters
16
- * (e.g. React Native AsyncStorage bridges) without hard-coding the key.
17
- */
18
- export declare const USER_TOKEN_STORAGE_KEY = "yarrow:user_token";
19
- /**
20
- * Minimal persistence contract for the anonymous user token. The default
21
- * resolution uses `localStorage` when available (guarded — this is the only
22
- * file in core allowed to touch it); shells without a DOM (e.g. React Native)
23
- * can inject their own storage via `setTokenStorage`.
24
- */
25
- interface TokenStorage {
26
- getItem(key: string): string | null;
27
- setItem(key: string, value: string): void;
28
- }
29
- export declare function setTokenStorage(storage: TokenStorage): void;
30
- export declare function getOrCreateUserToken(): string;
31
13
  type CacheConfig = {
32
14
  enabled?: boolean;
33
15
  lifespanDays?: number;
@@ -42,6 +24,15 @@ type CachedArrayBufferResponse = {
42
24
  expires: string | null;
43
25
  contentType: string | null;
44
26
  };
27
+ type BoundsInput = {
28
+ type?: string;
29
+ features: Array<{
30
+ geometry?: {
31
+ type?: string;
32
+ coordinates?: unknown;
33
+ };
34
+ }>;
35
+ };
45
36
  type RouteFeature = {
46
37
  type: 'Feature';
47
38
  geometry: {
@@ -54,6 +45,8 @@ type RouteFeature = {
54
45
  [key: string]: unknown;
55
46
  };
56
47
  };
48
+ /** Style-API endpoint returning the icon registry (`IconListItem[]`). */
49
+ export declare const ICONS_ENDPOINT = "/icons-image";
57
50
  type SearchResult = {
58
51
  id?: string | number;
59
52
  latitude?: number;
@@ -75,6 +68,19 @@ export declare const TILE_CACHE_NAME = "yarrow-cache-v1-tile";
75
68
  export declare const ICON_CACHE_NAME = "yarrow-cache-v1-icon";
76
69
  export declare const CACHE_PROTOCOL = "yarrowcache";
77
70
  export declare const CACHED_AT_HEADER = "x-yarrow-cached-at";
71
+ /** A geographic bounding box in degrees. */
72
+ type BoundingBox = {
73
+ xMin: number;
74
+ xMax: number;
75
+ yMin: number;
76
+ yMax: number;
77
+ };
78
+ /**
79
+ * Computes the geographic bounding box of a FeatureCollection whose features
80
+ * are Points, LineStrings or Polygons. Pure platform-agnostic math shared by
81
+ * the web and React Native SDKs' camera helpers.
82
+ */
83
+ export declare function getBoundingBox(data: BoundsInput): BoundingBox;
78
84
  /**
79
85
  * Structural subset of maplibre-gl's `RequestParameters` covering the fields
80
86
  * used for the network fetch. Any real maplibre `RequestParameters` object is
@@ -122,7 +128,6 @@ type FetchRoutesInput = {
122
128
  /** Cancels the routing request. */
123
129
  signal?: AbortSignal;
124
130
  };
125
- export declare const transformRouteCoordinates: (features: RouteFeature[]) => RouteFeature[];
126
131
  interface RoutesMeta {
127
132
  profile: string;
128
133
  totalRoutes: number;
@@ -145,6 +150,7 @@ interface FetchRoutesResult {
145
150
  * like the web SDK's historic `buildRoute()` behavior.
146
151
  */
147
152
  export declare function fetchRoutes(input: FetchRoutesInput): Promise<FetchRoutesResult>;
153
+ export declare const transformRouteCoordinates: (features: RouteFeature[]) => RouteFeature[];
148
154
  export declare const haversineDistance: (lat1: number, lon1: number, lat2: number, lon2: number) => number;
149
155
  interface FetchSearchResultsInput {
150
156
  lat: number;
@@ -171,6 +177,312 @@ export declare function normalizeStyleType(styleType?: string): YarrowStyleType;
171
177
  * `YarrowStylesManager.buildStyleEndpoint()`.
172
178
  */
173
179
  export declare function buildStyleEndpoint(styleType: YarrowStyleType, theme: 'light' | 'dark'): string;
180
+ export declare function trackDau(apiKey: string, sdkType?: string): void;
181
+ /**
182
+ * Public alias of `STORAGE_KEY` so platform SDKs can build storage adapters
183
+ * (e.g. React Native AsyncStorage bridges) without hard-coding the key.
184
+ */
185
+ export declare const USER_TOKEN_STORAGE_KEY = "yarrow:user_token";
186
+ /**
187
+ * Minimal persistence contract for the anonymous user token. The default
188
+ * resolution uses `localStorage` when available (guarded — this is the only
189
+ * file in core allowed to touch it); shells without a DOM (e.g. React Native)
190
+ * can inject their own storage via `setTokenStorage`.
191
+ */
192
+ interface TokenStorage {
193
+ getItem(key: string): string | null;
194
+ setItem(key: string, value: string): void;
195
+ }
196
+ export declare function setTokenStorage(storage: TokenStorage): void;
197
+ export declare function getOrCreateUserToken(): string;
198
+ type ClusterBadgeProps = {
199
+ /** Cluster centroid as `[longitude, latitude]`. */
200
+ lngLat: [number, number];
201
+ /** Number of markers the badge stands in for. */
202
+ count: number;
203
+ /** Visual theme — picks the badge colors (web parity). */
204
+ theme: 'light' | 'dark';
205
+ onPress?: () => void;
206
+ };
207
+ /**
208
+ * The count badge that stands in for clustered highlight/search markers —
209
+ * the native counterpart of the web SDK's cluster DOM marker (blue circle,
210
+ * white border, bold count).
211
+ */
212
+ export declare const ClusterBadge: import("react").MemoExoticComponent<({ lngLat, count, theme, onPress }: ClusterBadgeProps) => import("react/jsx-runtime").JSX.Element>;
213
+ /**
214
+ * Clustering configuration and normalization — the declarative counterpart of
215
+ * the web SDK's `setClustering`. Defaults match the web SDK exactly:
216
+ * 60 px merge radius, no clustering above zoom 16, clusters need ≥ 2 markers.
217
+ */
218
+ export declare const DEFAULT_CLUSTER_RADIUS_PX = 60;
219
+ export declare const DEFAULT_CLUSTER_MAX_ZOOM = 16;
220
+ export declare const DEFAULT_CLUSTER_MIN_POINTS = 2;
221
+ /** A single marker that belongs to a pressed cluster. */
222
+ type ClusterChild = {
223
+ /**
224
+ * The marker id. Web parity uses numeric POI ids; the RN SDK also accepts
225
+ * string keys (search results without an `id` get index-based keys).
226
+ */
227
+ id: number | string;
228
+ lng: number;
229
+ lat: number;
230
+ };
231
+ /**
232
+ * Called when a cluster badge is pressed, with the POIs it represents. Return
233
+ * exactly `false` to suppress the default zoom-to-expand behaviour.
234
+ */
235
+ type ClusterClickHandler = (children: ClusterChild[]) => unknown;
236
+ /**
237
+ * Clustering config for highlight/search markers. Off by default; pass `true`
238
+ * to enable with defaults, or an object to tune it (passing an object also
239
+ * enables it).
240
+ */
241
+ type ClusteringConfig = boolean | {
242
+ /** Merge distance in screen points. Default 60. */
243
+ radius?: number;
244
+ /** Above this zoom, markers never cluster. Default 16. */
245
+ maxZoom?: number;
246
+ /** Minimum markers within `radius` to form a cluster. Min/default 2. */
247
+ minPoints?: number;
248
+ /** Overrides/augments the default zoom-to-expand on cluster press. */
249
+ onClusterClick?: ClusterClickHandler;
250
+ };
251
+ type NormalizedClusteringConfig = {
252
+ enabled: boolean;
253
+ radius: number;
254
+ maxZoom: number;
255
+ minPoints: number;
256
+ onClusterClick?: ClusterClickHandler;
257
+ };
258
+ /**
259
+ * Normalizes the public clustering option (`true` / config object / falsy)
260
+ * into a fully-resolved config. Passing an object enables clustering.
261
+ * `minPoints` is clamped to at least 2 — a "cluster" of one is just the
262
+ * marker itself.
263
+ */
264
+ export declare function normalizeClusteringConfig(input: ClusteringConfig | undefined): NormalizedClusteringConfig;
265
+ /** A marker eligible for clustering: its id and coordinates. */
266
+ type ClusterPoint = {
267
+ id: number | string;
268
+ lng: number;
269
+ lat: number;
270
+ };
271
+ /** A computed cluster: badge position plus the members it stands in for. */
272
+ type PixelCluster = {
273
+ /**
274
+ * Key used to reuse a badge across recomputes (the first member's id —
275
+ * grouping is deterministic, so this is stable).
276
+ */
277
+ key: number | string;
278
+ lng: number;
279
+ lat: number;
280
+ members: ClusterChild[];
281
+ };
282
+ /**
283
+ * Groups projected points greedily by pixel distance: each unvisited point
284
+ * seeds a group and absorbs every remaining point within `radius`. O(n²), but
285
+ * the highlighted/search-marker count is small (dozens at most), so this
286
+ * stays cheap and deterministic. Ported from the web SDK's cluster engine.
287
+ */
288
+ export declare function groupByPixelRadius<T extends {
289
+ x: number;
290
+ y: number;
291
+ }>(items: T[], radius: number): T[][];
292
+ /**
293
+ * Base-style layer targets — mirrors the web SDK's `ClickLayerTarget`. Unlike
294
+ * the web SDK (which resolves layer ids dynamically from the loaded style),
295
+ * native cannot enumerate style layers, so these are the canonical Yarrow
296
+ * style layer ids, verified against the served `/styles/` document (identical
297
+ * in light and dark). Apps can override per target via the options argument
298
+ * of `useYarrowLayerPress` if the style changes.
299
+ */
300
+ type ClickLayerTarget = 'pois' | 'buildings' | 'mahalla' | 'district' | 'region' | 'country';
301
+ export declare const YARROW_CLICK_LAYER_IDS: Record<ClickLayerTarget, string[]>;
302
+ type LayerPressInfo = {
303
+ lat: number;
304
+ lng: number;
305
+ properties: Record<string, unknown>;
306
+ /** `true` when the pressed POI is currently highlighted (pois target only). */
307
+ selected?: boolean;
308
+ };
309
+ type UseYarrowLayerPressOptions = {
310
+ /** Per-target layer-id overrides (the base map's layer ids). */
311
+ layerIds?: Partial<Record<ClickLayerTarget, string[]>>;
312
+ };
313
+ /**
314
+ * Base-style-layer press handler — the native counterpart of the web SDK's
315
+ * `onIconClick('pois' | 'buildings')` and `onLayerClick(<admin label>)`. On
316
+ * every map press it queries the rendered features at the press point for the
317
+ * target layers and invokes `handler` with the topmost hit. Must be called
318
+ * inside `<YarrowMapView>` — extract a child component rendered as a map
319
+ * child (hooks outside the map can't see the runtime):
320
+ *
321
+ * ```tsx
322
+ * function PoiPressReporter() {
323
+ * useYarrowLayerPress('pois', ({ lat, lng, properties, selected }) => {
324
+ * console.log('POI pressed', properties.id, selected);
325
+ * });
326
+ * return null;
327
+ * }
328
+ *
329
+ * <YarrowMapView apiKey={KEY}>
330
+ * <PoiPressReporter />
331
+ * </YarrowMapView>
332
+ * ```
333
+ *
334
+ * Unlike the web SDK, targets resolve to the canonical Yarrow style layer
335
+ * ids (verified against the served `/styles/` document, identical in light
336
+ * and dark) instead of dynamic style inspection — override `layerIds` if
337
+ * your style variant names them differently.
338
+ */
339
+ export declare function useYarrowLayerPress(target: ClickLayerTarget | ClickLayerTarget[], handler: (info: LayerPressInfo) => void, options?: UseYarrowLayerPressOptions): void;
340
+ type UseYarrowSearchOptions = {
341
+ /** Latitude the search ranks results around. */
342
+ lat: number;
343
+ /** Longitude the search ranks results around. */
344
+ lon: number;
345
+ /** Result page. Default `1`. */
346
+ page?: number;
347
+ /** Results per page. Default `15`. */
348
+ pageSize?: number;
349
+ /** Debounce before querying, ms. Default `300`. */
350
+ debounceMs?: number;
351
+ /** Set `false` to pause querying — pending results clear while paused.
352
+ * Default `true`. */
353
+ enabled?: boolean;
354
+ };
355
+ type UseYarrowSearchResult = {
356
+ results: SearchResult[];
357
+ isLoading: boolean;
358
+ error: Error | null;
359
+ };
360
+ /**
361
+ * Debounced, abortable search against the Yarrow search API.
362
+ *
363
+ * Requires the API key to be configured (`YarrowMapView` does this on mount;
364
+ * otherwise call `setYarrowApiKey()` first).
365
+ *
366
+ * ```tsx
367
+ * const { results, isLoading } = useYarrowSearch(query, {
368
+ * lat: position?.lat ?? 41.2995,
369
+ * lon: position?.lng ?? 69.2401,
370
+ * });
371
+ * ```
372
+ */
373
+ export declare const useYarrowSearch: (query: string, options: UseYarrowSearchOptions) => UseYarrowSearchResult;
374
+ type UseYarrowMapSearchOptions = UseYarrowSearchOptions & {
375
+ /**
376
+ * Re-runs the search when the camera moves at least `thresholdMeters`
377
+ * (default 500, web parity) after a `debounceMs` settle delay (default 250,
378
+ * web parity). Pass `false` to disable; `true` uses both defaults.
379
+ */
380
+ refetchOnMove?: boolean | {
381
+ thresholdMeters?: number;
382
+ debounceMs?: number;
383
+ };
384
+ };
385
+ type UseYarrowMapSearchResult = UseYarrowSearchResult & {
386
+ /** The coordinate the current results were fetched around. */
387
+ center: {
388
+ lat: number;
389
+ lon: number;
390
+ };
391
+ };
392
+ /**
393
+ * `useYarrowSearch` plus web-parity re-query on camera movement: when the map
394
+ * moves ≥ 500 m from where the current results were fetched for, the search
395
+ * re-runs around the new center. Must be called inside `<YarrowMapView>` to
396
+ * observe camera moves (outside one it behaves exactly like `useYarrowSearch`).
397
+ *
398
+ * ```tsx
399
+ * const { results, isLoading, center } = useYarrowMapSearch(query, {
400
+ * lat: 41.2995,
401
+ * lon: 69.2401,
402
+ * refetchOnMove: true,
403
+ * });
404
+ * <SearchResultsLayer results={results} />
405
+ * ```
406
+ */
407
+ export declare function useYarrowMapSearch(query: string, options: UseYarrowMapSearchOptions): UseYarrowMapSearchResult;
408
+ type UseYarrowRoutingOptions = {
409
+ /** Routing profile, e.g. `"driving"`, `"walking"`. Default `"driving"`. */
410
+ profile?: string;
411
+ /** Language for turn-by-turn directions. */
412
+ language?: string;
413
+ };
414
+ type BuildRouteInput = {
415
+ /** Waypoints as `[longitude, latitude][]` (minimum two). */
416
+ coordinates: [number, number][];
417
+ /** Overrides the hook-level profile for this request. */
418
+ profile?: string;
419
+ /** Overrides the hook-level language for this request. */
420
+ language?: string;
421
+ /** Cancels the request. */
422
+ signal?: AbortSignal;
423
+ };
424
+ type UseYarrowRoutingResult = {
425
+ /** Renderable route features — feed straight into `<RouteLayer routes={…}>`. */
426
+ routes: RouteFeature[];
427
+ /** Turn-by-turn directions per route. */
428
+ directions: RouteDirection[][];
429
+ /** Duration/distance/profile summary of the best route, when present. */
430
+ meta: RoutesMeta | null;
431
+ isLoading: boolean;
432
+ error: Error | null;
433
+ /** Fetches routes and stores them in state. Rejects on network failure —
434
+ * "no route found" resolves to an empty result instead. */
435
+ buildRoute: (input: BuildRouteInput) => Promise<FetchRoutesResult>;
436
+ /** Clears routes/directions/meta and any error. */
437
+ clearRoutes: () => void;
438
+ };
439
+ /**
440
+ * Headless routing state for the Yarrow routing API — pairs with
441
+ * `<RouteLayer>` for rendering.
442
+ *
443
+ * ```tsx
444
+ * const { routes, isLoading, buildRoute } = useYarrowRouting({ profile: 'driving' });
445
+ * <YarrowMapView apiKey={KEY} center={[69.2401, 41.2995]}>
446
+ * <RouteLayer routes={routes} />
447
+ * </YarrowMapView>
448
+ * ```
449
+ */
450
+ export declare const useYarrowRouting: (options?: UseYarrowRoutingOptions) => UseYarrowRoutingResult;
451
+ /** Icon registry: sprite name (e.g. `"school"`) → image URL. */
452
+ type YarrowIconsMap = Record<string, string>;
453
+ /**
454
+ * Fetches the Yarrow icon registry (`/icons-image`) and reduces it to a
455
+ * name → URL map. Native has no Cache Storage, so the result is not persisted
456
+ * — `<YarrowMapView>` fetches it once per mount when icons are enabled.
457
+ *
458
+ * Also seeds core's API-key module state (like every standalone client), so
459
+ * the key is current even if the hook runs before a map mounts.
460
+ */
461
+ export declare function fetchYarrowIcons(apiKey?: string): Promise<YarrowIconsMap>;
462
+ /**
463
+ * Best-effort icon URL for a search-result `category.name` / tile
464
+ * `node_type`. The registry is keyed by sprite names, which usually match
465
+ * category names — the same fallback the web SDK applies via its icon
466
+ * expression.
467
+ */
468
+ export declare function resolveCategoryIcon(iconsByName: YarrowIconsMap | undefined, name: string | undefined): string | undefined;
469
+ type YarrowImagesProps = {
470
+ /** Icon registry entries to add to the style: sprite name → image URL. */
471
+ iconsByName: YarrowIconsMap;
472
+ /**
473
+ * Fired when the style references an icon the registry doesn't cover —
474
+ * the map should re-fetch the registry (once) to recover.
475
+ */
476
+ onMissingIcon?: (name: string) => void;
477
+ };
478
+ /**
479
+ * Adds the Yarrow icon images to the native style so symbol layers can
480
+ * resolve their `icon-image` names — the native counterpart of the web SDK's
481
+ * `addIconsToMap` prefetch plus its missing-image resolver. `Images` accepts
482
+ * remote URLs and downloads them natively; `onImageMissing` covers icons
483
+ * referenced before the registry fetch lands or after a failed fetch.
484
+ */
485
+ export declare const YarrowImages: import("react").MemoExoticComponent<({ iconsByName, onMissingIcon }: YarrowImagesProps) => import("react/jsx-runtime").JSX.Element>;
174
486
  /**
175
487
  * Configuration for the React Native map — the `container`-free counterpart
176
488
  * of the web SDK's `YarrowMapConfigOptions`. The native view is sized by the
@@ -192,6 +504,83 @@ type YarrowMapConfigOptions = {
192
504
  /** Base style. Default `"default"` (street map). */
193
505
  styleType?: YarrowStyleType;
194
506
  };
507
+ /**
508
+ * Validated, defaulted RN map configuration. Mirrors the web SDK's
509
+ * `YarrowMapConfig` minus the DOM container (the native view is sized by the
510
+ * consuming app's layout) and minus web-only rendering options (hover,
511
+ * clustering, controls, tile cache — none of which exist on native).
512
+ */
513
+ export declare class YarrowMapConfig {
514
+ readonly center: [number, number];
515
+ readonly zoom: number;
516
+ readonly minZoom: number;
517
+ readonly maxZoom: number;
518
+ theme: 'light' | 'dark';
519
+ styleType: YarrowStyleType;
520
+ apiKey: string;
521
+ constructor(config: YarrowMapConfigOptions);
522
+ }
523
+ type RoutePressEvent = NativeSyntheticEvent<PressEventWithFeatures>;
524
+ /**
525
+ * Called when a rendered route is pressed, with the press event (carrying the
526
+ * GeoJSON feature) and the route's index in the `routes` array.
527
+ */
528
+ type RoutePressHandler = (event: RoutePressEvent, routeIndex: number) => void;
529
+ type RouteLayerProps = {
530
+ /** Route line features — feed with `useYarrowRouting().routes` or your own
531
+ * `fetchRoutes()` result. Best route renders bold; the rest as fainter,
532
+ * thinner alternatives. */
533
+ routes: RouteFeature[];
534
+ /** Index of the route to highlight. Default `0`. */
535
+ bestIndex?: number;
536
+ /** Best-route color. Default `#22c55e`. */
537
+ routeColor?: string;
538
+ /** Best-route line width. Default `5`. */
539
+ routeWidth?: number;
540
+ /** Best-route opacity. Default `1`. */
541
+ routeOpacity?: number;
542
+ /** Alternative-route color. Default `#aaaaaa` — every alternative shares
543
+ * it, matching the web SDK's `buildRoute()`. */
544
+ alternativeColor?: string;
545
+ /** Alternative-route line width. Default `2.5`. */
546
+ alternativeWidth?: number;
547
+ /** Alternative-route opacity. Default `0.5`. */
548
+ alternativeOpacity?: number;
549
+ /** Prefix for source/layer ids. Default `"yarrow-route"`. */
550
+ layerPrefix?: string;
551
+ /** Called when a rendered route line is pressed. */
552
+ onPressRoute?: RoutePressHandler;
553
+ /**
554
+ * Distinct-series mode — web `renderRoutes()` parity. Every route draws in
555
+ * its own color from the shared `ROUTE_COLORS` palette (cycled), width 4
556
+ * and opacity 0.8, with no best/alternative distinction; the
557
+ * `bestIndex`/route/alternative style props are ignored.
558
+ */
559
+ distinct?: boolean;
560
+ };
561
+ /**
562
+ * Declarative route rendering: one GeoJSON source + line layer per route.
563
+ * Compose inside `<YarrowMapView>` and drive it with `useYarrowRouting()`:
564
+ *
565
+ * ```tsx
566
+ * const { routes } = useYarrowRouting();
567
+ * <YarrowMapView apiKey={KEY} center={[69.2401, 41.2995]}>
568
+ * <RouteLayer routes={routes} onPressRoute={…} />
569
+ * </YarrowMapView>
570
+ * ```
571
+ *
572
+ * Pass `distinct` to render independent series instead of best-route-plus-
573
+ * alternatives — the declarative counterpart of the web SDK's
574
+ * `renderRoutes()`.
575
+ */
576
+ export declare const RouteLayer: import("react").MemoExoticComponent<({ routes, bestIndex, routeColor, routeWidth, routeOpacity, alternativeColor, alternativeWidth, alternativeOpacity, layerPrefix, onPressRoute, distinct }: RouteLayerProps) => import("react/jsx-runtime").JSX.Element[]>;
577
+ /**
578
+ * Full style URL for MapLibre React Native's `mapStyle` prop, built from the
579
+ * platform-agnostic style endpoint plus the configured API key. The key comes
580
+ * from core's module state (`setYarrowApiKey`) — `YarrowMapView` calls it for
581
+ * you; standalone callers must set it first.
582
+ */
583
+ export declare function buildStyleUrl(styleType?: string, theme?: 'light' | 'dark'): string;
195
584
  type YarrowMapViewProps = YarrowMapConfigOptions & {
196
585
  /** Called once the native map finished loading its style. */
197
586
  onReady?: (map: MapRef$1) => void;
@@ -200,6 +589,11 @@ type YarrowMapViewProps = YarrowMapConfigOptions & {
200
589
  /** Called when the user presses the map (bubbles up from pressable
201
590
  * sources unless they call `event.stopPropagation()`). */
202
591
  onPress?: MapProps['onPress'];
592
+ /**
593
+ * Called when the camera finishes moving — web `onMoveEnd` parity:
594
+ * `(lat, lng, zoom)`.
595
+ */
596
+ onMoveEnd?: (lat: number, lng: number, zoom: number) => void;
203
597
  /** Forwarded to the inner camera — use it for `flyTo`/`fitBounds`/`zoomTo`.
204
598
  * The outer component ref is the `MapRef` (getCenter, queryRenderedFeatures…). */
205
599
  cameraRef?: Ref<CameraRef$1>;
@@ -211,6 +605,12 @@ type YarrowMapViewProps = YarrowMapConfigOptions & {
211
605
  compass?: boolean;
212
606
  /** Fire-and-forget DAU ping when the style first loads. Default `true`. */
213
607
  dauTracking?: boolean;
608
+ /**
609
+ * Fetch the Yarrow icon registry and add it to the style so POI symbols and
610
+ * category-icon fallbacks work (web icon-pipeline parity). Disable only if
611
+ * your style/labels don't need the Yarrow icons. Default `true`.
612
+ */
613
+ icons?: boolean;
214
614
  /** Style for the wrapping native view. Default `{ flex: 1 }`. */
215
615
  style?: ViewProps['style'];
216
616
  /** Sources/layers/markers rendered inside the map. */
@@ -218,7 +618,9 @@ type YarrowMapViewProps = YarrowMapConfigOptions & {
218
618
  };
219
619
  /**
220
620
  * React Native Yarrow map. Renders MapLibre Native with a Yarrow style URL
221
- * (theme + styleType aware, API key attached) and a default camera.
621
+ * (theme + styleType aware, API key attached) and a default camera, and
622
+ * provides the runtime (refs, icon registry, camera/event subscriptions) to
623
+ * the SDK layers rendered inside it.
222
624
  *
223
625
  * ```tsx
224
626
  * const mapRef = useRef<MapRef>(null);
@@ -243,6 +645,11 @@ export declare const YarrowMapView: import("react").ForwardRefExoticComponent<Ya
243
645
  /** Called when the user presses the map (bubbles up from pressable
244
646
  * sources unless they call `event.stopPropagation()`). */
245
647
  onPress?: MapProps['onPress'];
648
+ /**
649
+ * Called when the camera finishes moving — web `onMoveEnd` parity:
650
+ * `(lat, lng, zoom)`.
651
+ */
652
+ onMoveEnd?: (lat: number, lng: number, zoom: number) => void;
246
653
  /** Forwarded to the inner camera — use it for `flyTo`/`fitBounds`/`zoomTo`.
247
654
  * The outer component ref is the `MapRef` (getCenter, queryRenderedFeatures…). */
248
655
  cameraRef?: Ref<CameraRef$1>;
@@ -254,153 +661,98 @@ export declare const YarrowMapView: import("react").ForwardRefExoticComponent<Ya
254
661
  compass?: boolean;
255
662
  /** Fire-and-forget DAU ping when the style first loads. Default `true`. */
256
663
  dauTracking?: boolean;
664
+ /**
665
+ * Fetch the Yarrow icon registry and add it to the style so POI symbols and
666
+ * category-icon fallbacks work (web icon-pipeline parity). Disable only if
667
+ * your style/labels don't need the Yarrow icons. Default `true`.
668
+ */
669
+ icons?: boolean;
257
670
  /** Style for the wrapping native view. Default `{ flex: 1 }`. */
258
671
  style?: ViewProps['style'];
259
672
  /** Sources/layers/markers rendered inside the map. */
260
673
  children?: ReactNode;
261
674
  } & import("react").RefAttributes<MapRef$1>>;
262
- type RoutePressEvent = NativeSyntheticEvent<PressEventWithFeatures>;
675
+ type HighlightMarkerViewProps = {
676
+ /** Coordinates as `[longitude, latitude]`. */
677
+ lngLat: [number, number];
678
+ /** Icon URL; when absent a blue dot is rendered (web parity). */
679
+ iconUrl?: string;
680
+ /** Label rendered under the icon. */
681
+ title?: string;
682
+ /** Icon size in points: a number (square) or `[width, height]`. Default 56. */
683
+ iconSize?: number | [number, number];
684
+ /** Plays the exit animation instead of the enter one. */
685
+ leaving?: boolean;
686
+ onPress?: () => void;
687
+ };
263
688
  /**
264
- * Called when a rendered route is pressed, with the press event (carrying the
265
- * GeoJSON feature) and the route's index in the `routes` array.
689
+ * The animated icon+label marker shared by `<PoiHighlightLayer>` and
690
+ * `<SearchResultsLayer>` — the native counterpart of the web SDK's
691
+ * `createMarkerElement` + enter/exit CSS transitions. The scale/fade runs on
692
+ * an inner view (never on the `Marker` itself, which the map repositions
693
+ * every frame).
266
694
  */
267
- type RoutePressHandler = (event: RoutePressEvent, routeIndex: number) => void;
268
- type RouteLayerProps = {
269
- /** Route line features — feed with `useYarrowRouting().routes` or your own
270
- * `fetchRoutes()` result. Best route renders bold; the rest as fainter,
271
- * thinner alternatives. */
272
- routes: RouteFeature[];
273
- /** Index of the route to highlight. Default `0`. */
274
- bestIndex?: number;
275
- /** Best-route color. Default `#22c55e`. */
276
- routeColor?: string;
277
- /** Best-route line width. Default `5`. */
278
- routeWidth?: number;
279
- /** Best-route opacity. Default `1`. */
280
- routeOpacity?: number;
281
- /** Alternative-route color. Defaults to the shared palette by index. */
282
- alternativeColor?: string;
283
- /** Alternative-route line width. Default `2.5`. */
284
- alternativeWidth?: number;
285
- /** Alternative-route opacity. Default `0.5`. */
286
- alternativeOpacity?: number;
287
- /** Prefix for source/layer ids. Default `"yarrow-route"`. */
288
- layerPrefix?: string;
289
- /** Called when a rendered route line is pressed. */
290
- onPressRoute?: RoutePressHandler;
695
+ export declare const HighlightMarkerView: import("react").MemoExoticComponent<({ lngLat, iconUrl, title, iconSize, leaving, onPress }: HighlightMarkerViewProps) => import("react/jsx-runtime").JSX.Element>;
696
+ type YarrowMarkerProps = {
697
+ /** Coordinates as `[longitude, latitude]`. */
698
+ lngLat: [number, number];
699
+ /** Which part of the marker sits on the coordinate. Default `'bottom'`. */
700
+ anchor?: MarkerProps['anchor'];
701
+ /** Pixel offset `[x, y]` applied relative to the anchor. */
702
+ offset?: [number, number];
703
+ /** Called when the marker is pressed. */
704
+ onPress?: () => void;
705
+ /** Marker content — a single view (icon, label, bubble, …). */
706
+ children: ReactElement;
291
707
  };
292
708
  /**
293
- * Declarative route rendering: one GeoJSON source + line layer per route.
294
- * Compose inside `<YarrowMapView>` and drive it with `useYarrowRouting()`:
709
+ * Declarative counterpart of the web SDK's `addMarker()` / `removeMarker()`.
710
+ * Mounting places the marker, unmounting removes it; the React lifecycle
711
+ * replaces the imperative manager pair.
295
712
  *
296
713
  * ```tsx
297
- * const { routes } = useYarrowRouting();
298
714
  * <YarrowMapView apiKey={KEY} center={[69.2401, 41.2995]}>
299
- * <RouteLayer routes={routes} onPressRoute={…} />
715
+ * <YarrowMarker lngLat={[69.2401, 41.2995]} onPress={() => …}>
716
+ * <PinIcon />
717
+ * </YarrowMarker>
300
718
  * </YarrowMapView>
301
719
  * ```
302
720
  */
303
- export declare const RouteLayer: import("react").MemoExoticComponent<({ routes, bestIndex, routeColor, routeWidth, routeOpacity, alternativeColor, alternativeWidth, alternativeOpacity, layerPrefix, onPressRoute }: RouteLayerProps) => import("react/jsx-runtime").JSX.Element[]>;
304
- /**
305
- * Validated, defaulted RN map configuration. Mirrors the web SDK's
306
- * `YarrowMapConfig` minus the DOM container (the native view is sized by the
307
- * consuming app's layout) and minus web-only rendering options (hover,
308
- * clustering, controls, tile cache — none of which exist on native).
309
- */
310
- export declare class YarrowMapConfig {
311
- readonly center: [number, number];
312
- readonly zoom: number;
313
- readonly minZoom: number;
314
- readonly maxZoom: number;
315
- theme: 'light' | 'dark';
316
- styleType: YarrowStyleType;
317
- apiKey: string;
318
- constructor(config: YarrowMapConfigOptions);
319
- }
320
- /**
321
- * Full style URL for MapLibre React Native's `mapStyle` prop, built from the
322
- * platform-agnostic style endpoint plus the configured API key. The key comes
323
- * from core's module state (`setYarrowApiKey`) — `YarrowMapView` calls it for
324
- * you; standalone callers must set it first.
325
- */
326
- export declare function buildStyleUrl(styleType?: string, theme?: 'light' | 'dark'): string;
327
- type UseYarrowSearchOptions = {
328
- /** Latitude the search ranks results around. */
329
- lat: number;
330
- /** Longitude the search ranks results around. */
331
- lon: number;
332
- /** Result page. Default `1`. */
333
- page?: number;
334
- /** Results per page. Default `15`. */
335
- pageSize?: number;
336
- /** Debounce before querying, ms. Default `300`. */
337
- debounceMs?: number;
338
- /** Set `false` to pause querying — pending results clear while paused.
339
- * Default `true`. */
340
- enabled?: boolean;
341
- };
342
- type UseYarrowSearchResult = {
343
- results: SearchResult[];
344
- isLoading: boolean;
345
- error: Error | null;
346
- };
347
- /**
348
- * Debounced, abortable search against the Yarrow search API.
349
- *
350
- * Requires the API key to be configured (`YarrowMapView` does this on mount;
351
- * otherwise call `setYarrowApiKey()` first).
352
- *
353
- * ```tsx
354
- * const { results, isLoading } = useYarrowSearch(query, {
355
- * lat: position?.lat ?? 41.2995,
356
- * lon: position?.lng ?? 69.2401,
357
- * });
358
- * ```
359
- */
360
- export declare const useYarrowSearch: (query: string, options: UseYarrowSearchOptions) => UseYarrowSearchResult;
361
- type UseYarrowRoutingOptions = {
362
- /** Routing profile, e.g. `"driving"`, `"walking"`. Default `"driving"`. */
363
- profile?: string;
364
- /** Language for turn-by-turn directions. */
365
- language?: string;
721
+ export declare const YarrowMarker: import("react").MemoExoticComponent<({ lngLat, anchor, offset, onPress, children }: YarrowMarkerProps) => import("react/jsx-runtime").JSX.Element>;
722
+ type ZoomToOptions = {
723
+ /** Animation duration in ms. Web's `speed` option has no native equivalent. */
724
+ duration?: number;
366
725
  };
367
- type BuildRouteInput = {
368
- /** Waypoints as `[longitude, latitude][]` (minimum two). */
369
- coordinates: [number, number][];
370
- /** Overrides the hook-level profile for this request. */
371
- profile?: string;
372
- /** Overrides the hook-level language for this request. */
373
- language?: string;
374
- /** Cancels the request. */
375
- signal?: AbortSignal;
726
+ type FitBoundsOptions = {
727
+ /** Padding in points around the fitted bounds. Default `50`. */
728
+ padding?: number;
729
+ /** Animation duration in ms. Default `1000`. */
730
+ duration?: number;
376
731
  };
377
- type UseYarrowRoutingResult = {
378
- /** Renderable route features — feed straight into `<RouteLayer routes={…}>`. */
379
- routes: RouteFeature[];
380
- /** Turn-by-turn directions per route. */
381
- directions: RouteDirection[][];
382
- /** Duration/distance/profile summary of the best route, when present. */
383
- meta: RoutesMeta | null;
384
- isLoading: boolean;
385
- error: Error | null;
386
- /** Fetches routes and stores them in state. Rejects on network failure —
387
- * "no route found" resolves to an empty result instead. */
388
- buildRoute: (input: BuildRouteInput) => Promise<FetchRoutesResult>;
389
- /** Clears routes/directions/meta and any error. */
390
- clearRoutes: () => void;
732
+ type YarrowCamera = {
733
+ /** Flies the camera to a coordinate at `zoom`. */
734
+ zoomTo(lat: number, lng: number, zoom: number, options?: ZoomToOptions): void;
735
+ /**
736
+ * Fits the camera to the bounds of a GeoJSON FeatureCollection. Applies the
737
+ * web SDK's minimum-dimension expansion (0.003°) so single points don't
738
+ * over-zoom. Web's `maxZoom` cap is not supported natively.
739
+ */
740
+ fitBounds(data: BoundsInput, options?: FitBoundsOptions): void;
741
+ /** Computes the geographic bounding box of a FeatureCollection. */
742
+ getBoundingBox(data: BoundsInput): BoundingBox;
391
743
  };
392
744
  /**
393
- * Headless routing state for the Yarrow routing API — pairs with
394
- * `<RouteLayer>` for rendering.
745
+ * Web-parity camera helpers on top of a `CameraRef`. Reads the enclosing
746
+ * `<YarrowMapView>` camera when called inside the map; otherwise pass a ref:
395
747
  *
396
748
  * ```tsx
397
- * const { routes, isLoading, buildRoute } = useYarrowRouting({ profile: 'driving' });
398
- * <YarrowMapView apiKey={KEY} center={[69.2401, 41.2995]}>
399
- * <RouteLayer routes={routes} />
400
- * </YarrowMapView>
749
+ * const cameraRef = useRef<CameraRef>(null);
750
+ * <YarrowMapView apiKey={KEY} cameraRef={cameraRef}>…</YarrowMapView>
751
+ * const camera = useYarrowCamera(cameraRef);
752
+ * camera.zoomTo(41.2995, 69.2401, 14);
401
753
  * ```
402
754
  */
403
- export declare const useYarrowRouting: (options?: UseYarrowRoutingOptions) => UseYarrowRoutingResult;
755
+ export declare function useYarrowCamera(cameraRefInput?: RefObject<CameraRef$1 | null>): YarrowCamera;
404
756
  /** Download progress of an offline region (normalized native pack status). */
405
757
  type OfflineRegionProgress = Omit<OfflinePackStatus, 'id'>;
406
758
  /**
@@ -543,6 +895,40 @@ type EstimateRegionInput = {
543
895
  * ```
544
896
  */
545
897
  export declare const estimateRegion: (input: EstimateRegionInput) => OfflineRegionEstimate;
898
+ type UseYarrowOfflineRegionsOptions = {
899
+ /** Yarrow API key from the dashboard. Required. */
900
+ apiKey: string;
901
+ /** Poll interval while any region is downloading, ms. Default `1000`. */
902
+ pollMs?: number;
903
+ };
904
+ type UseYarrowOfflineRegionsResult = {
905
+ /** All regions created through the SDK, newest first. */
906
+ regions: OfflineRegionSummary[];
907
+ /** True during the initial `listRegions()` load. */
908
+ isLoading: boolean;
909
+ error: Error | null;
910
+ /** Re-reads regions from the native layer. */
911
+ refresh: () => Promise<void>;
912
+ /** Starts a region download (idempotent by `name` — see
913
+ * `YarrowOfflineManager.downloadRegion`). */
914
+ download: (options: OfflineRegionDownloadOptions) => Promise<OfflineRegionHandle>;
915
+ pause: (name: string) => Promise<void>;
916
+ resume: (name: string) => Promise<void>;
917
+ /** Revalidates stored tiles against the server — the cheap refresh path. */
918
+ invalidate: (name: string) => Promise<void>;
919
+ remove: (name: string) => Promise<void>;
920
+ };
921
+ /**
922
+ * Offline region state for settings/offline screens — pairs with
923
+ * `YarrowOfflineManager`. Polls the native layer while downloads run, so
924
+ * `regions` (and progress bars) stay current.
925
+ *
926
+ * ```tsx
927
+ * const { regions, download, remove } = useYarrowOfflineRegions({ apiKey });
928
+ * await download({ name: 'tashkent', bounds: [69.15, 41.2, 69.4, 41.4] });
929
+ * ```
930
+ */
931
+ export declare const useYarrowOfflineRegions: (options: UseYarrowOfflineRegionsOptions) => UseYarrowOfflineRegionsResult;
546
932
  type YarrowOfflineManagerOptions = {
547
933
  /** Yarrow API key from the dashboard. Required. */
548
934
  apiKey: string;
@@ -635,40 +1021,229 @@ export declare class YarrowOfflineManager {
635
1021
  private toHandle;
636
1022
  private deletePack;
637
1023
  }
638
- type UseYarrowOfflineRegionsOptions = {
639
- /** Yarrow API key from the dashboard. Required. */
1024
+ /** Coordinates the caller already holds (e.g. from a search result). */
1025
+ type PlaceLocation = {
1026
+ lat: number;
1027
+ lng: number;
1028
+ };
1029
+ /** Coordinates (+ optional icon URL and title) resolved before placing a marker. */
1030
+ type ResolvedPoiData = {
1031
+ lng: number;
1032
+ lat: number;
1033
+ iconUrl?: string;
1034
+ title?: string;
1035
+ };
1036
+ /** Payload passed to a highlight marker's press handler. */
1037
+ type PoiHighlightPressInfo = {
1038
+ /** The highlighted POI id. */
1039
+ id: number;
1040
+ lng: number;
1041
+ lat: number;
1042
+ /** Resolved title/icon of the marker, if any. */
1043
+ title?: string;
1044
+ iconUrl?: string;
1045
+ };
1046
+ /**
1047
+ * Per-id data the caller already holds. Anything provided here skips the
1048
+ * corresponding lookup (viewport query / place-detail API) — the cheapest
1049
+ * resolution wins, exactly like the web SDK's `HighlightPOIOptions`.
1050
+ */
1051
+ type HighlightPoiData = {
1052
+ location?: PlaceLocation;
1053
+ icon?: string;
1054
+ title?: string;
1055
+ };
1056
+ type PoiHighlightLayerProps = {
1057
+ /** POI id(s) to highlight — the declarative selection state. */
1058
+ ids: number | number[];
1059
+ /**
1060
+ * Per-id data the caller already holds (location/icon/title). Anything
1061
+ * provided skips the corresponding lookup.
1062
+ */
1063
+ dataById?: Record<number, HighlightPoiData>;
1064
+ /** Icon size in points: a number (square) or `[width, height]`. Default 56. */
1065
+ iconSize?: number | [number, number];
1066
+ /** Flies the camera to the highlighted POI(s) once resolved. Default `false`. */
1067
+ panTo?: boolean;
1068
+ /** Target zoom for `panTo` of a single POI. Default `13`. */
1069
+ zoom?: number;
1070
+ /** Clusters the highlight markers (`true` or a config object). */
1071
+ clustering?: ClusteringConfig;
1072
+ /** Called when a highlight marker is pressed. */
1073
+ onHighlightPress?: (info: PoiHighlightPressInfo) => void;
1074
+ /** Called when a POI could not be resolved (its highlight is rolled back). */
1075
+ onResolveError?: (id: number) => void;
1076
+ };
1077
+ /**
1078
+ * Declarative counterpart of the web SDK's `highlightPOI()`: renders an
1079
+ * animated icon+label marker for each highlighted POI id, resolving each id
1080
+ * cheapest-first (caller data → rendered tiles → place-detail API).
1081
+ * Highlight state is owned by the `ids` prop (or
1082
+ * `useYarrowPoiHighlight().highlightedIds`); removing an id plays the exit
1083
+ * animation and unmounts the marker.
1084
+ *
1085
+ * Known native limitation (documented in the README): the base style's own
1086
+ * POI icon is not hidden behind the highlight marker — native has no runtime
1087
+ * `setFilter`, so the marker simply draws on top of it.
1088
+ *
1089
+ * ```tsx
1090
+ * <YarrowMapView apiKey={KEY} center={[69.2401, 41.2995]}>
1091
+ * <PoiHighlightLayer ids={[123]} dataById={{ 123: { location } }} panTo />
1092
+ * </YarrowMapView>
1093
+ * ```
1094
+ */
1095
+ export declare function PoiHighlightLayer({ ids, dataById, iconSize, panTo, zoom, clustering, onHighlightPress, onResolveError }: PoiHighlightLayerProps): import("react/jsx-runtime").JSX.Element | null;
1096
+ /** Camera state snapshot delivered to region-change subscribers. */
1097
+ type YarrowRegionState = {
1098
+ /** Map center as `[lng, lat]`. */
1099
+ center: [number, number];
1100
+ zoom: number;
1101
+ };
1102
+ /** A raw map press, delivered to press subscribers before `onPress` props. */
1103
+ type YarrowMapPress = {
1104
+ /** Press location as `[lng, lat]`. */
1105
+ lngLat: [number, number];
1106
+ /** Press location in viewport pixels `[x, y]` (for `queryRenderedFeatures`). */
1107
+ point: [number, number];
1108
+ };
1109
+ /**
1110
+ * Shared runtime state that `<YarrowMapView>` provides to the layers and hooks
1111
+ * rendered inside it. Everything is optional at the type level so hooks can
1112
+ * also run outside a map (they no-op with a console warning where relevant).
1113
+ */
1114
+ type YarrowMapRuntime = {
640
1115
  apiKey: string;
641
- /** Poll interval while any region is downloading, ms. Default `1000`. */
642
- pollMs?: number;
1116
+ /** Visual theme of the map, for theme-aware overlay styling. */
1117
+ theme: 'light' | 'dark';
1118
+ mapRef: RefObject<MapRef$1 | null>;
1119
+ cameraRef: RefObject<CameraRef$1 | null>;
1120
+ /** Icon registry: sprite name → image URL (empty until loaded / disabled). */
1121
+ iconsByName: Record<string, string>;
1122
+ /**
1123
+ * POI ids currently highlighted by `<PoiHighlightLayer>` — a mutable set
1124
+ * (no re-renders) so press handlers can report the web SDK's `selected`
1125
+ * flag. Updated by the layer; read by `useYarrowLayerPress`.
1126
+ */
1127
+ highlightedPoiIds: RefObject<Set<number>>;
1128
+ /**
1129
+ * Subscribes to region changes (the `moveend` parity point). Returns an
1130
+ * unsubscribe function.
1131
+ */
1132
+ subscribeRegionChange: (listener: (state: YarrowRegionState) => void) => () => void;
1133
+ /**
1134
+ * Subscribes to raw map presses. Returns an unsubscribe function.
1135
+ */
1136
+ subscribePress: (listener: (press: YarrowMapPress) => void) => () => void;
643
1137
  };
644
- type UseYarrowOfflineRegionsResult = {
645
- /** All regions created through the SDK, newest first. */
646
- regions: OfflineRegionSummary[];
647
- /** True during the initial `listRegions()` load. */
648
- isLoading: boolean;
649
- error: Error | null;
650
- /** Re-reads regions from the native layer. */
651
- refresh: () => Promise<void>;
652
- /** Starts a region download (idempotent by `name` — see
653
- * `YarrowOfflineManager.downloadRegion`). */
654
- download: (options: OfflineRegionDownloadOptions) => Promise<OfflineRegionHandle>;
655
- pause: (name: string) => Promise<void>;
656
- resume: (name: string) => Promise<void>;
657
- /** Revalidates stored tiles against the server — the cheap refresh path. */
658
- invalidate: (name: string) => Promise<void>;
659
- remove: (name: string) => Promise<void>;
1138
+ export declare const YarrowMapContext: import("react").Context<YarrowMapRuntime | null>;
1139
+ /** Reads the enclosing `<YarrowMapView>` runtime, or `null` outside one. */
1140
+ export declare function useYarrowMapRuntime(): YarrowMapRuntime | null;
1141
+ /** The base style's POI symbol layer (`node_tile` source). */
1142
+ export declare const POI_BASE_LAYER = "pois_tile_layer";
1143
+ /**
1144
+ * Fetches a POI's coordinates and icon from the place-detail API — the
1145
+ * off-screen / below-zoom fallback of the resolution chain. Returns `null`
1146
+ * on any failure or missing coordinates (web parity).
1147
+ *
1148
+ * When the response carries no `icon_img`, the icon is derived from
1149
+ * `node_type` (falling back to `category.name`) — the web SDK resolves it
1150
+ * through its style `icon-image` expression; native approximates that with
1151
+ * an icon-registry lookup by the same name, since the detail endpoint
1152
+ * returns the node type rather than an icon URL.
1153
+ */
1154
+ export declare function fetchPlaceLocation(id: number, iconsByName?: Record<string, string>): Promise<ResolvedPoiData | null>;
1155
+ /**
1156
+ * Reads a POI's point geometry from the style's POI layer within the current
1157
+ * viewport — the free, no-network resolution step. Native can only query
1158
+ * *rendered* features (no `querySourceFeatures` on undeclared sources), so
1159
+ * off-screen POIs fall through to the place-detail API. Icons are resolved
1160
+ * best-effort from the registry via the feature's `node_type`.
1161
+ */
1162
+ export declare function lookupPoiInViewport(mapRef: MapRef$1, id: number, iconsByName?: Record<string, string>): Promise<ResolvedPoiData | null>;
1163
+ /**
1164
+ * Resolves a POI's coordinates, icon and title cheapest-first:
1165
+ * 1. caller-provided `location` / `icon` / `title`
1166
+ * 2. local lookup in the rendered POI layer (no network)
1167
+ * 3. the place-detail API (off-screen / below the POI zoom range, or when
1168
+ * anything is still missing — web parity: the API fills icon and title
1169
+ * too, not just coordinates)
1170
+ *
1171
+ * The web SDK additionally evaluates the style's `icon-image` expression for
1172
+ * both the tile and the place-detail steps; native approximates it with a
1173
+ * registry lookup by `node_type`. Coordinate resolution is the hard
1174
+ * requirement — if it fails, the highlight is rolled back by the caller.
1175
+ */
1176
+ export declare function resolvePoiData(id: number, options: HighlightPoiData, runtime: YarrowMapRuntime): Promise<ResolvedPoiData | null>;
1177
+ /** Handle for one active highlight — mirrors the web SDK's `POIHighlight`. */
1178
+ type YarrowPoiHighlight = {
1179
+ readonly id: number;
1180
+ remove: () => void;
1181
+ };
1182
+ type UseYarrowPoiHighlightResult = {
1183
+ /** All currently highlighted ids — feed to `<PoiHighlightLayer ids={…}>`. */
1184
+ highlightedIds: number[];
1185
+ /**
1186
+ * Highlights one or more POIs. Additive by default (web parity); pass
1187
+ * `{ replace: true }` to reset the selection first. Returns one handle per
1188
+ * id whose `remove()` un-highlights it.
1189
+ */
1190
+ highlight: (input: number | number[], options?: {
1191
+ replace?: boolean;
1192
+ }) => YarrowPoiHighlight[];
1193
+ /** Un-highlights all POIs, or the given id(s). */
1194
+ reset: (input?: number | number[]) => void;
1195
+ /** Whether a POI id is currently highlighted. */
1196
+ isHighlighted: (id: number) => boolean;
660
1197
  };
661
1198
  /**
662
- * Offline region state for settings/offline screens — pairs with
663
- * `YarrowOfflineManager`. Polls the native layer while downloads run, so
664
- * `regions` (and progress bars) stay current.
1199
+ * Headless highlight state — the declarative counterpart of the web SDK's
1200
+ * `highlightPOI` / `resetPOIHighlight` / `isPOIHighlighted` /
1201
+ * `getHighlightedPOIs` quartet. Rendering is owned by `<PoiHighlightLayer>`:
665
1202
  *
666
1203
  * ```tsx
667
- * const { regions, download, remove } = useYarrowOfflineRegions({ apiKey });
668
- * await download({ name: 'tashkent', bounds: [69.15, 41.2, 69.4, 41.4] });
1204
+ * const { highlightedIds, highlight } = useYarrowPoiHighlight();
1205
+ * <YarrowMapView apiKey={KEY}>
1206
+ * <PoiHighlightLayer ids={highlightedIds} panTo />
1207
+ * </YarrowMapView>
669
1208
  * ```
670
1209
  */
671
- export declare const useYarrowOfflineRegions: (options: UseYarrowOfflineRegionsOptions) => UseYarrowOfflineRegionsResult;
1210
+ export declare function useYarrowPoiHighlight(): UseYarrowPoiHighlightResult;
1211
+ type SearchResultsLayerProps = {
1212
+ /** Results from `useYarrowSearch` (or your own fetch). */
1213
+ results: SearchResult[];
1214
+ /** Icon size in points: a number (square) or `[width, height]`. Default 56. */
1215
+ iconSize?: number | [number, number];
1216
+ /**
1217
+ * Fits the camera to the results the first time a non-empty page renders
1218
+ * (default `true`). The fit runs once per session — pass a `fitKey` to
1219
+ * start a new session (web parity: the web fits once per
1220
+ * `highlightSearchResults()` call, so a new query re-fits).
1221
+ */
1222
+ zoomToResults?: boolean;
1223
+ /**
1224
+ * Session identity for `zoomToResults`: changing it re-arms the initial
1225
+ * fit, e.g. `fitKey={query}` re-fits when the query changes (web parity).
1226
+ * Omitted (or unchanged) = fit once per mount.
1227
+ */
1228
+ fitKey?: string | number;
1229
+ /** Clusters the result markers (`true` or a config object). */
1230
+ clustering?: ClusteringConfig;
1231
+ /** Called when a result marker is pressed. */
1232
+ onResultPress?: (lat: number, lng: number, result: SearchResult) => void;
1233
+ };
1234
+ /**
1235
+ * Renders search results on the map — the declarative counterpart of the web
1236
+ * SDK's `highlightSearchResults()`. Icon precedence per result:
1237
+ * `icon_img` → registry icon by `category.name` → blue-dot fallback.
1238
+ *
1239
+ * ```tsx
1240
+ * const { results, isLoading } = useYarrowSearch(query, { lat, lon });
1241
+ * <YarrowMapView apiKey={KEY}>
1242
+ * <SearchResultsLayer results={results} onResultPress={…} />
1243
+ * </YarrowMapView>
1244
+ * ```
1245
+ */
1246
+ export declare function SearchResultsLayer({ results, iconSize, zoomToResults, fitKey, clustering, onResultPress }: SearchResultsLayerProps): import("react/jsx-runtime").JSX.Element | null;
672
1247
  /**
673
1248
  * Minimal slice of `@react-native-async-storage/async-storage` the adapter
674
1249
  * needs. Accepting a structural type (instead of importing the module) keeps
@@ -699,4 +1274,4 @@ type AsyncStorageLike = {
699
1274
  * ```
700
1275
  */
701
1276
  export declare function setAsyncStorageTokenStorage(storage: AsyncStorageLike): Promise<void>;
702
- export { type AsyncStorageLike, type BuildRouteInput, type CacheConfig, type CachedArrayBufferResponse, type CameraRef, type FetchRoutesInput, type FetchRoutesResult, type MapRef, type NormalizedCacheConfig, type OfflineBounds, type OfflineRegionDownloadOptions, type OfflineRegionErrorCode, type OfflineRegionEstimate, type OfflineRegionHandle, type OfflineRegionProgress, type OfflineRegionSummary, type RouteDirection, type RouteDirectionModifier, type RouteFeature, type RouteLayerProps, type RoutesMeta, type SearchResult, type TokenStorage, type UseYarrowOfflineRegionsOptions, type UseYarrowOfflineRegionsResult, type UseYarrowRoutingOptions, type UseYarrowRoutingResult, type UseYarrowSearchOptions, type UseYarrowSearchResult, YARROW_MAP_URL, YARROW_SEARCH_API_URL, type YarrowMapConfigOptions, type YarrowMapViewProps, type YarrowOfflineError, type YarrowOfflineManagerOptions, type YarrowStyleType };
1277
+ export { type AsyncStorageLike, type BoundingBox, type BuildRouteInput, type CacheConfig, type CachedArrayBufferResponse, type CameraRef, type ClickLayerTarget, type ClusterBadgeProps, type ClusterChild, type ClusterClickHandler, type ClusterPoint, type ClusteringConfig, type FetchRoutesInput, type FetchRoutesResult, type FitBoundsOptions, type HighlightMarkerViewProps, type HighlightPoiData, type LayerPressInfo, type MapRef, type NormalizedCacheConfig, type NormalizedClusteringConfig, type OfflineBounds, type OfflineRegionDownloadOptions, type OfflineRegionErrorCode, type OfflineRegionEstimate, type OfflineRegionHandle, type OfflineRegionProgress, type OfflineRegionSummary, type PixelCluster, type PlaceLocation, type PoiHighlightLayerProps, type PoiHighlightPressInfo, type ResolvedPoiData, type RouteDirection, type RouteDirectionModifier, type RouteFeature, type RouteLayerProps, type RoutesMeta, type SearchResult, type SearchResultsLayerProps, type TokenStorage, type UseYarrowLayerPressOptions, type UseYarrowMapSearchOptions, type UseYarrowMapSearchResult, type UseYarrowOfflineRegionsOptions, type UseYarrowOfflineRegionsResult, type UseYarrowPoiHighlightResult, type UseYarrowRoutingOptions, type UseYarrowRoutingResult, type UseYarrowSearchOptions, type UseYarrowSearchResult, YARROW_MAP_URL, YARROW_SEARCH_API_URL, type YarrowCamera, type YarrowIconsMap, type YarrowImagesProps, type YarrowMapConfigOptions, type YarrowMapPress, type YarrowMapRuntime, type YarrowMapViewProps, type YarrowMarkerProps, type YarrowOfflineError, type YarrowOfflineManagerOptions, type YarrowPoiHighlight, type YarrowRegionState, type YarrowStyleType, type ZoomToOptions };