@yarrow-uz/yarrow-map-web-sdk 1.0.46 → 1.0.48
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/CHANGELOG.md +40 -0
- package/README.md +28 -1015
- package/dist/main.umd.js +835 -0
- package/dist/module.d.ts +16599 -0
- package/dist/module.js +834 -4
- package/dist/react/index.d.ts +342 -4
- package/dist/react/index.js +83 -2
- package/package.json +9 -15
- package/dist/config/main.d.ts +0 -6
- package/dist/main.d.ts +0 -3
- package/dist/main.js +0 -5
- package/dist/maps/brandBadge.d.ts +0 -24
- package/dist/maps/yarrow.d.ts +0 -173
- package/dist/maps/yarrowControls.d.ts +0 -52
- package/dist/react/YarrowMapView.d.ts +0 -12
- package/dist/react/useYarrowMap.d.ts +0 -39
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export type BrandBadgeTheme = 'light' | 'dark';
|
|
2
|
-
export type BrandBadgePosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
3
|
-
export declare const DEFAULT_BRAND_BADGE_POSITION: BrandBadgePosition;
|
|
4
|
-
export declare const normalizeBrandBadgePosition: (position?: BrandBadgePosition) => BrandBadgePosition;
|
|
5
|
-
type BrandBadgeState = {
|
|
6
|
-
theme: BrandBadgeTheme;
|
|
7
|
-
position: BrandBadgePosition;
|
|
8
|
-
};
|
|
9
|
-
export declare class BrandBadgeController {
|
|
10
|
-
private host?;
|
|
11
|
-
private container?;
|
|
12
|
-
private observer?;
|
|
13
|
-
private enforcerInterval?;
|
|
14
|
-
private state;
|
|
15
|
-
mount(container: HTMLElement, state: BrandBadgeState): void;
|
|
16
|
-
update(state: BrandBadgeState): void;
|
|
17
|
-
getHostElement(): HTMLDivElement | undefined;
|
|
18
|
-
teardown(removeHost?: boolean): void;
|
|
19
|
-
private getHostInlineStyle;
|
|
20
|
-
private applyHostStyles;
|
|
21
|
-
private createHost;
|
|
22
|
-
}
|
|
23
|
-
export {};
|
|
24
|
-
//# sourceMappingURL=brandBadge.d.ts.map
|
package/dist/maps/yarrow.d.ts
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
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';
|
|
3
|
-
import { type BrandBadgePosition } from './brandBadge';
|
|
4
|
-
import { type NormalizedYarrowControlsConfig, type YarrowControlsConfig, type YarrowControlsPosition } from './yarrowControls';
|
|
5
|
-
type CacheConfig = {
|
|
6
|
-
enabled?: boolean;
|
|
7
|
-
lifespanDays?: number;
|
|
8
|
-
};
|
|
9
|
-
type YarrowMapConfigOptions = {
|
|
10
|
-
container: HTMLElement | string;
|
|
11
|
-
center: [number, number];
|
|
12
|
-
zoom?: number;
|
|
13
|
-
minZoom?: number;
|
|
14
|
-
maxZoom?: number;
|
|
15
|
-
theme?: 'light' | 'dark';
|
|
16
|
-
cache?: CacheConfig;
|
|
17
|
-
brandBadgePosition?: BrandBadgePosition;
|
|
18
|
-
controls?: YarrowControlsConfig;
|
|
19
|
-
apiKey: string;
|
|
20
|
-
};
|
|
21
|
-
type NormalizedCacheConfig = {
|
|
22
|
-
enabled: boolean;
|
|
23
|
-
lifespanDays: number;
|
|
24
|
-
};
|
|
25
|
-
type LayerDescriptor = {
|
|
26
|
-
type: string;
|
|
27
|
-
name: string;
|
|
28
|
-
};
|
|
29
|
-
type AddLayerOptions = {
|
|
30
|
-
sourceId?: string;
|
|
31
|
-
filter?: FilterSpecification;
|
|
32
|
-
};
|
|
33
|
-
type BoundsInput = {
|
|
34
|
-
type?: string;
|
|
35
|
-
features: Array<{
|
|
36
|
-
geometry?: {
|
|
37
|
-
type?: string;
|
|
38
|
-
coordinates?: unknown;
|
|
39
|
-
};
|
|
40
|
-
}>;
|
|
41
|
-
};
|
|
42
|
-
type RouteFeature = {
|
|
43
|
-
type: 'Feature';
|
|
44
|
-
geometry: {
|
|
45
|
-
type: 'LineString';
|
|
46
|
-
coordinates: [number, number][];
|
|
47
|
-
};
|
|
48
|
-
properties: {
|
|
49
|
-
duration: number;
|
|
50
|
-
distance: number;
|
|
51
|
-
[key: string]: unknown;
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
type RouteBuildResult = {
|
|
55
|
-
features: RouteFeature[];
|
|
56
|
-
directions: unknown[];
|
|
57
|
-
};
|
|
58
|
-
type MultiRouteBuildResult = {
|
|
59
|
-
features: RouteFeature[];
|
|
60
|
-
directions: unknown[][];
|
|
61
|
-
};
|
|
62
|
-
type SearchResult = {
|
|
63
|
-
id?: string | number;
|
|
64
|
-
latitude?: number;
|
|
65
|
-
longitude?: number;
|
|
66
|
-
icon_img?: string;
|
|
67
|
-
name?: string;
|
|
68
|
-
[key: string]: unknown;
|
|
69
|
-
};
|
|
70
|
-
declare class YarrowMapConfig {
|
|
71
|
-
container: HTMLElement | string;
|
|
72
|
-
center: [number, number];
|
|
73
|
-
zoom: number;
|
|
74
|
-
minZoom: number;
|
|
75
|
-
maxZoom: number;
|
|
76
|
-
theme: 'light' | 'dark';
|
|
77
|
-
cache: NormalizedCacheConfig;
|
|
78
|
-
brandBadgePosition: BrandBadgePosition;
|
|
79
|
-
controls: NormalizedYarrowControlsConfig;
|
|
80
|
-
apiKey: string;
|
|
81
|
-
constructor(config: YarrowMapConfigOptions);
|
|
82
|
-
}
|
|
83
|
-
declare class YarrowMap {
|
|
84
|
-
private static isCacheProtocolRegistered;
|
|
85
|
-
config: YarrowMapConfig;
|
|
86
|
-
map?: MaplibreMap;
|
|
87
|
-
layers: LayerDescriptor[];
|
|
88
|
-
private brandBadgeController;
|
|
89
|
-
private yarrowControlsController;
|
|
90
|
-
private badgeResizeObserver?;
|
|
91
|
-
constructor(config: YarrowMapConfig);
|
|
92
|
-
private ensureCacheProtocol;
|
|
93
|
-
private get cacheLifespanMs();
|
|
94
|
-
private isCacheEnabled;
|
|
95
|
-
private transformRequestForCache;
|
|
96
|
-
private fetchJson;
|
|
97
|
-
private loadImageFromSrc;
|
|
98
|
-
private loadIconImage;
|
|
99
|
-
private getIconsMap;
|
|
100
|
-
private addIconsToMap;
|
|
101
|
-
private patchMapRemoveForBadgeCleanup;
|
|
102
|
-
private getControlsInsetForCollision;
|
|
103
|
-
private syncOverlayCollisionInset;
|
|
104
|
-
private stopBadgeCollisionObserver;
|
|
105
|
-
private startBadgeCollisionObserver;
|
|
106
|
-
clearCache(): Promise<void>;
|
|
107
|
-
fixStyle(style: StyleSpecification | null | undefined): void;
|
|
108
|
-
init(): Promise<void>;
|
|
109
|
-
changeStyles(styleType: string | undefined): Promise<StyleSpecification>;
|
|
110
|
-
changeTheme(theme: 'light' | 'dark'): Promise<StyleSpecification>;
|
|
111
|
-
changeBrandBadgePosition(position: BrandBadgePosition): BrandBadgePosition;
|
|
112
|
-
zoomTo(lat: number, lng: number, zoom: number): void;
|
|
113
|
-
fitBounds(data: BoundsInput): void;
|
|
114
|
-
getBoundingBox(data: BoundsInput): {
|
|
115
|
-
xMin: number;
|
|
116
|
-
yMin: number;
|
|
117
|
-
xMax: number;
|
|
118
|
-
yMax: number;
|
|
119
|
-
};
|
|
120
|
-
onMoveEnd(callback: (lat: number, lng: number, zoom: number) => void): void;
|
|
121
|
-
onMapClick(callback: (lat: number, lng: number) => void): void;
|
|
122
|
-
onIconClick(layerGroup: 'pois' | 'buildings', callback: (lat: number, lng: number, properties: Record<string, unknown>) => void): void;
|
|
123
|
-
onLayerClick(layerName: 'buildings' | 'pois', callback: (lat: number, lng: number, properties: Record<string, unknown>) => void): void;
|
|
124
|
-
changeBackgroundColor(color: string): void;
|
|
125
|
-
addSource(sourceId: string, data: GeoJSONSourceSpecification['data']): void;
|
|
126
|
-
updateSourceData(sourceId: string, data: GeoJSONSourceSpecification['data']): void;
|
|
127
|
-
addLayer(layerName: string, layerType: LayerSpecification['type'], featureCollection: GeoJSONSourceSpecification['data'], paint?: LayerSpecification['paint'], layout?: LayerSpecification['layout'], iconSettings?: {
|
|
128
|
-
width?: number;
|
|
129
|
-
height?: number;
|
|
130
|
-
}, options?: AddLayerOptions): void;
|
|
131
|
-
setFeatureState(feature: FeatureIdentifier, state: Record<string, unknown>): void;
|
|
132
|
-
queryRenderedFeatures(geometryOrOptions?: PointLike | [PointLike, PointLike] | QueryRenderedFeaturesOptions, options?: QueryRenderedFeaturesOptions): MapGeoJSONFeature[];
|
|
133
|
-
addMarker(coordinates: [number, number], options?: {
|
|
134
|
-
element?: HTMLElement;
|
|
135
|
-
color?: string;
|
|
136
|
-
draggable?: boolean;
|
|
137
|
-
anchor?: 'center' | 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
138
|
-
onClick?: () => void;
|
|
139
|
-
}): maplibregl.Marker | null;
|
|
140
|
-
removeMarker(marker: maplibregl.Marker | null): void;
|
|
141
|
-
removeLayer(layerName: string): void;
|
|
142
|
-
renderRoutes(routes: RouteFeature[], baseLayerName?: string): void;
|
|
143
|
-
buildRouteWithLabels(startCoordinates: [number, number], endCoordinates: [number, number], profile: string): Promise<RouteBuildResult>;
|
|
144
|
-
buildMultiSegmentRouteWithLabels(coordinates: [number, number][], profile: string, language?: string): Promise<MultiRouteBuildResult>;
|
|
145
|
-
clearAllRoutes(): void;
|
|
146
|
-
highlightSearchResults(query: string, highlightOptions?: {
|
|
147
|
-
layerName?: string;
|
|
148
|
-
iconImage?: string;
|
|
149
|
-
highlightColor?: string;
|
|
150
|
-
pulseAnimation?: boolean;
|
|
151
|
-
zoomToResults?: boolean;
|
|
152
|
-
onIconClick?: (lat: number, lng: number, properties: Record<string, unknown>) => void;
|
|
153
|
-
onResultsUpdate?: (results: SearchResult[]) => void;
|
|
154
|
-
onLoadingStateChange?: (state: 'firstRender' | 'rerender' | false) => void;
|
|
155
|
-
}): () => void;
|
|
156
|
-
private currentBusRouteInterval?;
|
|
157
|
-
private currentBusMarkers;
|
|
158
|
-
private currentRouteLayers;
|
|
159
|
-
private readonly MAX_BUSES;
|
|
160
|
-
private svgCache;
|
|
161
|
-
private mapMoveTimeout?;
|
|
162
|
-
private busPositions;
|
|
163
|
-
private animationFrameId?;
|
|
164
|
-
private animateBusMarkers;
|
|
165
|
-
private startBusAnimation;
|
|
166
|
-
private stopBusAnimation;
|
|
167
|
-
showBusRoute(route_id?: string): Promise<() => void>;
|
|
168
|
-
}
|
|
169
|
-
export { YarrowMap, YarrowMapConfig };
|
|
170
|
-
export type { BrandBadgePosition };
|
|
171
|
-
export type { YarrowControlsConfig, YarrowControlsPosition };
|
|
172
|
-
export type { YarrowMapConfigOptions };
|
|
173
|
-
//# sourceMappingURL=yarrow.d.ts.map
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import type { Map as MaplibreMap } from 'maplibre-gl';
|
|
2
|
-
export type YarrowControlsPosition = 'left' | 'left-top' | 'left-bottom' | 'right' | 'right-top' | 'right-bottom';
|
|
3
|
-
export type YarrowControlsConfig = {
|
|
4
|
-
enabled?: boolean;
|
|
5
|
-
position?: YarrowControlsPosition;
|
|
6
|
-
zoom?: boolean;
|
|
7
|
-
compass?: boolean;
|
|
8
|
-
};
|
|
9
|
-
export type NormalizedYarrowControlsConfig = {
|
|
10
|
-
enabled: boolean;
|
|
11
|
-
position: YarrowControlsPosition;
|
|
12
|
-
zoom: boolean;
|
|
13
|
-
compass: boolean;
|
|
14
|
-
};
|
|
15
|
-
type YarrowControlsInset = {
|
|
16
|
-
top: number;
|
|
17
|
-
right: number;
|
|
18
|
-
bottom: number;
|
|
19
|
-
left: number;
|
|
20
|
-
};
|
|
21
|
-
export declare const DEFAULT_YARROW_CONTROLS_CONFIG: NormalizedYarrowControlsConfig;
|
|
22
|
-
export declare const normalizeYarrowControlsConfig: (controls?: YarrowControlsConfig) => NormalizedYarrowControlsConfig;
|
|
23
|
-
type YarrowControlsState = {
|
|
24
|
-
theme: 'light' | 'dark';
|
|
25
|
-
controls: NormalizedYarrowControlsConfig;
|
|
26
|
-
};
|
|
27
|
-
export declare class YarrowControlsController {
|
|
28
|
-
private map?;
|
|
29
|
-
private host?;
|
|
30
|
-
private container?;
|
|
31
|
-
private zoomInButton?;
|
|
32
|
-
private zoomOutButton?;
|
|
33
|
-
private compassButton?;
|
|
34
|
-
private compassNeedle?;
|
|
35
|
-
private onRotate?;
|
|
36
|
-
private onZoomInClick?;
|
|
37
|
-
private onZoomOutClick?;
|
|
38
|
-
private onCompassClick?;
|
|
39
|
-
private inset;
|
|
40
|
-
private state;
|
|
41
|
-
mount(map: MaplibreMap, state: YarrowControlsState): void;
|
|
42
|
-
update(state: YarrowControlsState): void;
|
|
43
|
-
setInset(inset?: Partial<YarrowControlsInset>): void;
|
|
44
|
-
teardown(removeHost?: boolean): void;
|
|
45
|
-
private createDom;
|
|
46
|
-
private applyHostPosition;
|
|
47
|
-
private renderVisibleButtons;
|
|
48
|
-
private attachMapListeners;
|
|
49
|
-
private updateCompassNeedle;
|
|
50
|
-
}
|
|
51
|
-
export {};
|
|
52
|
-
//# sourceMappingURL=yarrowControls.d.ts.map
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type * as React from 'react';
|
|
2
|
-
import { useYarrowMap, type YarrowMapReactConfig } from './useYarrowMap';
|
|
3
|
-
type YarrowMapViewProps = {
|
|
4
|
-
config: YarrowMapReactConfig;
|
|
5
|
-
configKey?: string | number;
|
|
6
|
-
onReady?: Parameters<typeof useYarrowMap>[0]['onReady'];
|
|
7
|
-
className?: string;
|
|
8
|
-
style?: React.CSSProperties;
|
|
9
|
-
};
|
|
10
|
-
export declare const YarrowMapView: ({ config, configKey, onReady, className, style, }: YarrowMapViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export {};
|
|
12
|
-
//# sourceMappingURL=YarrowMapView.d.ts.map
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type * as React from 'react';
|
|
2
|
-
import { YarrowMap } from '../maps/yarrow';
|
|
3
|
-
type CacheConfig = {
|
|
4
|
-
enabled?: boolean;
|
|
5
|
-
lifespanDays?: number;
|
|
6
|
-
};
|
|
7
|
-
type BrandBadgePosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
8
|
-
type YarrowControlsPosition = 'left' | 'left-top' | 'left-bottom' | 'right' | 'right-top' | 'right-bottom';
|
|
9
|
-
type YarrowControlsConfig = {
|
|
10
|
-
enabled?: boolean;
|
|
11
|
-
position?: YarrowControlsPosition;
|
|
12
|
-
zoom?: boolean;
|
|
13
|
-
compass?: boolean;
|
|
14
|
-
};
|
|
15
|
-
export type YarrowMapReactConfig = {
|
|
16
|
-
center: [number, number];
|
|
17
|
-
zoom?: number;
|
|
18
|
-
minZoom?: number;
|
|
19
|
-
maxZoom?: number;
|
|
20
|
-
theme?: 'light' | 'dark';
|
|
21
|
-
cache?: CacheConfig;
|
|
22
|
-
brandBadgePosition?: BrandBadgePosition;
|
|
23
|
-
controls?: YarrowControlsConfig;
|
|
24
|
-
apiKey: string;
|
|
25
|
-
};
|
|
26
|
-
export type UseYarrowMapOptions = {
|
|
27
|
-
config: YarrowMapReactConfig;
|
|
28
|
-
configKey?: string | number;
|
|
29
|
-
onReady?: (map: YarrowMap) => void;
|
|
30
|
-
};
|
|
31
|
-
export type UseYarrowMapResult = {
|
|
32
|
-
containerRef: React.RefObject<HTMLDivElement | null>;
|
|
33
|
-
map: YarrowMap | null;
|
|
34
|
-
isReady: boolean;
|
|
35
|
-
error: Error | null;
|
|
36
|
-
};
|
|
37
|
-
export declare const useYarrowMap: ({ config, configKey, onReady, }: UseYarrowMapOptions) => UseYarrowMapResult;
|
|
38
|
-
export {};
|
|
39
|
-
//# sourceMappingURL=useYarrowMap.d.ts.map
|