@yarrow-uz/yarrow-map-web-sdk 1.0.40 → 1.0.42

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.
@@ -14,6 +14,7 @@ export declare class BrandBadgeController {
14
14
  private state;
15
15
  mount(container: HTMLElement, state: BrandBadgeState): void;
16
16
  update(state: BrandBadgeState): void;
17
+ getHostElement(): HTMLDivElement | undefined;
17
18
  teardown(removeHost?: boolean): void;
18
19
  private getHostInlineStyle;
19
20
  private applyHostStyles;
@@ -1,4 +1,5 @@
1
- import { type GeoJSONSourceSpecification, type LayerSpecification, Map as MaplibreMap, type StyleSpecification } from 'maplibre-gl';
1
+ import { type GeoJSONSourceSpecification, type LayerSpecification, type MapGeoJSONFeature, Map as MaplibreMap, type FeatureIdentifier, type PointLike, type QueryRenderedFeaturesOptions, type StyleSpecification } from 'maplibre-gl';
2
+ import type { FilterSpecification } from '@maplibre/maplibre-gl-style-spec';
2
3
  import { type BrandBadgePosition } from './brandBadge';
3
4
  import { type NormalizedYarrowControlsConfig, type YarrowControlsConfig, type YarrowControlsPosition } from './yarrowControls';
4
5
  type CacheConfig = {
@@ -24,6 +25,10 @@ type LayerDescriptor = {
24
25
  type: string;
25
26
  name: string;
26
27
  };
28
+ type AddLayerOptions = {
29
+ sourceId?: string;
30
+ filter?: FilterSpecification;
31
+ };
27
32
  type BoundsInput = {
28
33
  type?: string;
29
34
  features: Array<{
@@ -81,6 +86,7 @@ declare class YarrowMap {
81
86
  layers: LayerDescriptor[];
82
87
  private brandBadgeController;
83
88
  private yarrowControlsController;
89
+ private badgeResizeObserver?;
84
90
  constructor(config: YarrowMapConfig);
85
91
  private ensureCacheProtocol;
86
92
  private get cacheLifespanMs();
@@ -92,6 +98,10 @@ declare class YarrowMap {
92
98
  private getIconsMap;
93
99
  private addIconsToMap;
94
100
  private patchMapRemoveForBadgeCleanup;
101
+ private getControlsInsetForCollision;
102
+ private syncOverlayCollisionInset;
103
+ private stopBadgeCollisionObserver;
104
+ private startBadgeCollisionObserver;
95
105
  clearCache(): Promise<void>;
96
106
  fixStyle(style: StyleSpecification | null | undefined): void;
97
107
  init(): Promise<void>;
@@ -110,10 +120,14 @@ declare class YarrowMap {
110
120
  onIconClick(layerGroup: 'pois' | 'buildings', callback: (lat: number, lng: number, properties: Record<string, unknown>) => void): void;
111
121
  onLayerClick(layerName: 'buildings' | 'pois', callback: (lat: number, lng: number, properties: Record<string, unknown>) => void): void;
112
122
  changeBackgroundColor(color: string): void;
113
- addLayer(layerName: string, layerType: LayerSpecification['type'], featureCollection: GeoJSONSourceSpecification['data'], paint?: Record<string, unknown>, layout?: Record<string, unknown>, iconSettings?: {
123
+ addSource(sourceId: string, data: GeoJSONSourceSpecification['data']): void;
124
+ updateSourceData(sourceId: string, data: GeoJSONSourceSpecification['data']): void;
125
+ addLayer(layerName: string, layerType: LayerSpecification['type'], featureCollection: GeoJSONSourceSpecification['data'], paint?: LayerSpecification['paint'], layout?: LayerSpecification['layout'], iconSettings?: {
114
126
  width?: number;
115
127
  height?: number;
116
- }): void;
128
+ }, options?: AddLayerOptions): void;
129
+ setFeatureState(feature: FeatureIdentifier, state: Record<string, unknown>): void;
130
+ queryRenderedFeatures(geometryOrOptions?: PointLike | [PointLike, PointLike] | QueryRenderedFeaturesOptions, options?: QueryRenderedFeaturesOptions): MapGeoJSONFeature[];
117
131
  addMarker(coordinates: [number, number], options?: {
118
132
  element?: HTMLElement;
119
133
  color?: string;
@@ -1,5 +1,5 @@
1
1
  import type { Map as MaplibreMap } from 'maplibre-gl';
2
- export type YarrowControlsPosition = 'left' | 'right';
2
+ export type YarrowControlsPosition = 'left' | 'left-top' | 'left-bottom' | 'right' | 'right-top' | 'right-bottom';
3
3
  export type YarrowControlsConfig = {
4
4
  enabled?: boolean;
5
5
  position?: YarrowControlsPosition;
@@ -12,6 +12,12 @@ export type NormalizedYarrowControlsConfig = {
12
12
  zoom: boolean;
13
13
  compass: boolean;
14
14
  };
15
+ type YarrowControlsInset = {
16
+ top: number;
17
+ right: number;
18
+ bottom: number;
19
+ left: number;
20
+ };
15
21
  export declare const DEFAULT_YARROW_CONTROLS_CONFIG: NormalizedYarrowControlsConfig;
16
22
  export declare const normalizeYarrowControlsConfig: (controls?: YarrowControlsConfig) => NormalizedYarrowControlsConfig;
17
23
  type YarrowControlsState = {
@@ -30,9 +36,11 @@ export declare class YarrowControlsController {
30
36
  private onZoomInClick?;
31
37
  private onZoomOutClick?;
32
38
  private onCompassClick?;
39
+ private inset;
33
40
  private state;
34
41
  mount(map: MaplibreMap, state: YarrowControlsState): void;
35
42
  update(state: YarrowControlsState): void;
43
+ setInset(inset?: Partial<YarrowControlsInset>): void;
36
44
  teardown(removeHost?: boolean): void;
37
45
  private createDom;
38
46
  private applyHostPosition;