@yarrow-uz/yarrow-map-web-sdk 1.0.47 → 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 +24 -0
- 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 +7 -14
- 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/cache.d.ts +0 -17
- package/dist/maps/config.d.ts +0 -18
- package/dist/maps/events.d.ts +0 -13
- package/dist/maps/layers.d.ts +0 -21
- package/dist/maps/markers.d.ts +0 -12
- package/dist/maps/navigation.d.ts +0 -15
- package/dist/maps/routing/builder.d.ts +0 -34
- package/dist/maps/routing/helpers.d.ts +0 -15
- package/dist/maps/routing/renderer.d.ts +0 -8
- package/dist/maps/routing/types.d.ts +0 -41
- package/dist/maps/search.d.ts +0 -23
- package/dist/maps/styles.d.ts +0 -29
- package/dist/maps/types.d.ts +0 -111
- package/dist/maps/yarrow.d.ts +0 -92
- package/dist/maps/yarrowControls.d.ts +0 -51
- package/dist/react/YarrowMapView.d.ts +0 -12
- package/dist/react/useYarrowMap.d.ts +0 -40
|
@@ -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/cache.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { type RequestParameters, ResourceType } from 'maplibre-gl';
|
|
2
|
-
import { TILE_CACHE_NAME, ICON_CACHE_NAME, CACHE_PROTOCOL, type NormalizedCacheConfig, type CachedArrayBufferResponse } from './types';
|
|
3
|
-
export declare const hasCacheStorage: () => boolean;
|
|
4
|
-
export declare const normalizeCacheConfig: (cache?: {
|
|
5
|
-
enabled?: boolean;
|
|
6
|
-
lifespanDays?: number;
|
|
7
|
-
}) => NormalizedCacheConfig;
|
|
8
|
-
export declare const resolveRequestUrl: (url: string, baseUrl?: string) => string;
|
|
9
|
-
export declare const buildProtocolUrl: (url: string, lifespanMs: number) => string;
|
|
10
|
-
export declare const extractCachedAt: (response: Response) => number | null;
|
|
11
|
-
export declare const toCachedArrayBufferResponse: (response: Response) => Promise<CachedArrayBufferResponse>;
|
|
12
|
-
export declare const fetchFromNetwork: (url: string, abortController: AbortController, requestParameters?: RequestParameters) => Promise<CachedArrayBufferResponse>;
|
|
13
|
-
export declare const fetchArrayBufferWithCache: (url: string, cacheName: string, lifespanMs: number, abortController: AbortController, requestParameters?: RequestParameters) => Promise<CachedArrayBufferResponse>;
|
|
14
|
-
export declare const getDefaultLifespanMs: () => number;
|
|
15
|
-
export declare const isCacheableResourceType: (resourceType?: ResourceType) => boolean;
|
|
16
|
-
export { TILE_CACHE_NAME, ICON_CACHE_NAME, CACHE_PROTOCOL };
|
|
17
|
-
//# sourceMappingURL=cache.d.ts.map
|
package/dist/maps/config.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { BrandBadgePosition } from './brandBadge';
|
|
2
|
-
import { normalizeYarrowControlsConfig } from './yarrowControls';
|
|
3
|
-
import type { YarrowMapConfigOptions, NormalizedCacheConfig } from './types';
|
|
4
|
-
export declare class YarrowMapConfig {
|
|
5
|
-
readonly container: HTMLElement | string;
|
|
6
|
-
readonly center: [number, number];
|
|
7
|
-
readonly zoom: number;
|
|
8
|
-
readonly minZoom: number;
|
|
9
|
-
readonly maxZoom: number;
|
|
10
|
-
theme: 'light' | 'dark';
|
|
11
|
-
cache: NormalizedCacheConfig;
|
|
12
|
-
brandBadgePosition: BrandBadgePosition;
|
|
13
|
-
controls: ReturnType<typeof normalizeYarrowControlsConfig>;
|
|
14
|
-
excludePoiLayer: boolean;
|
|
15
|
-
apiKey: string;
|
|
16
|
-
constructor(config: YarrowMapConfigOptions);
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=config.d.ts.map
|
package/dist/maps/events.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Map as MaplibreMap } from 'maplibre-gl';
|
|
2
|
-
import type { LayerDescriptor } from './types';
|
|
3
|
-
export declare class YarrowEventManager {
|
|
4
|
-
private getMap;
|
|
5
|
-
private getLayers;
|
|
6
|
-
constructor(getMap: () => MaplibreMap | undefined, getLayers: () => LayerDescriptor[]);
|
|
7
|
-
onMoveEnd(callback: (lat: number, lng: number, zoom: number) => void): void;
|
|
8
|
-
onMapClick(callback: (lat: number, lng: number) => void): void;
|
|
9
|
-
onIconClick(layerGroup: 'pois' | 'buildings', callback: (lat: number, lng: number, properties: Record<string, unknown>) => void): void;
|
|
10
|
-
onLayerClick(layerName: 'buildings' | 'pois', callback: (lat: number, lng: number, properties: Record<string, unknown>) => void): void;
|
|
11
|
-
changeBackgroundColor(color: string): void;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=events.d.ts.map
|
package/dist/maps/layers.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Map as MaplibreMap } from 'maplibre-gl';
|
|
2
|
-
import type { GeoJSONSourceSpecification, LayerSpecification, FeatureIdentifier, MapGeoJSONFeature, QueryRenderedFeaturesOptions, PointLike } from 'maplibre-gl';
|
|
3
|
-
import type { LayerDescriptor, AddLayerOptions } from './types';
|
|
4
|
-
export declare class YarrowLayerManager {
|
|
5
|
-
private getMap;
|
|
6
|
-
private setLayers?;
|
|
7
|
-
private layers;
|
|
8
|
-
constructor(getMap: () => MaplibreMap | undefined, setLayers?: ((layers: LayerDescriptor[]) => void) | undefined);
|
|
9
|
-
getLayers(): LayerDescriptor[];
|
|
10
|
-
setLayersArray(layers: LayerDescriptor[]): void;
|
|
11
|
-
addSource(sourceId: string, data: GeoJSONSourceSpecification['data']): void;
|
|
12
|
-
updateSourceData(sourceId: string, data: GeoJSONSourceSpecification['data']): void;
|
|
13
|
-
addLayer(layerName: string, layerType: LayerSpecification['type'], featureCollection: GeoJSONSourceSpecification['data'], paint?: LayerSpecification['paint'], layout?: LayerSpecification['layout'], iconSettings?: {
|
|
14
|
-
width?: number;
|
|
15
|
-
height?: number;
|
|
16
|
-
}, options?: AddLayerOptions): void;
|
|
17
|
-
removeLayer(layerName: string): void;
|
|
18
|
-
setFeatureState(feature: FeatureIdentifier, state: Record<string, unknown>): void;
|
|
19
|
-
queryRenderedFeatures(geometryOrOptions?: PointLike | [PointLike, PointLike] | QueryRenderedFeaturesOptions, options?: QueryRenderedFeaturesOptions): MapGeoJSONFeature[];
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=layers.d.ts.map
|
package/dist/maps/markers.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Marker, type Map as MaplibreMap, type MarkerOptions } from 'maplibre-gl';
|
|
2
|
-
interface YarrowMarkerOptions extends MarkerOptions {
|
|
3
|
-
onClick?: () => void;
|
|
4
|
-
}
|
|
5
|
-
export declare class YarrowMarkerManager {
|
|
6
|
-
private getMap;
|
|
7
|
-
constructor(getMap: () => MaplibreMap | undefined);
|
|
8
|
-
addMarker(coordinates: [number, number], options?: YarrowMarkerOptions): Marker | null;
|
|
9
|
-
removeMarker(marker: Marker | null): void;
|
|
10
|
-
}
|
|
11
|
-
export {};
|
|
12
|
-
//# sourceMappingURL=markers.d.ts.map
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Map as MaplibreMap } from 'maplibre-gl';
|
|
2
|
-
import type { BoundsInput } from './types';
|
|
3
|
-
export declare class YarrowNavigationManager {
|
|
4
|
-
private getMap;
|
|
5
|
-
constructor(getMap: () => MaplibreMap | undefined);
|
|
6
|
-
zoomTo(lat: number, lng: number, zoom: number): void;
|
|
7
|
-
fitBounds(data: BoundsInput): void;
|
|
8
|
-
getBoundingBox(data: BoundsInput): {
|
|
9
|
-
xMin: number;
|
|
10
|
-
xMax: number;
|
|
11
|
-
yMin: number;
|
|
12
|
-
yMax: number;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=navigation.d.ts.map
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { RouteFeature } from '../types';
|
|
2
|
-
import type { YarrowLayerManager } from '../layers';
|
|
3
|
-
import type { BuildRouteOptions, BuildRouteResult } from './types';
|
|
4
|
-
export declare class YarrowRoutingRenderer {
|
|
5
|
-
private addLayer;
|
|
6
|
-
constructor(addLayer: YarrowLayerManager['addLayer']);
|
|
7
|
-
renderRoutes(routes: RouteFeature[], baseLayerName?: string): void;
|
|
8
|
-
}
|
|
9
|
-
export declare class YarrowRoutingBuilder {
|
|
10
|
-
private getMap;
|
|
11
|
-
private addLayer;
|
|
12
|
-
private removeLayer;
|
|
13
|
-
private fitBounds;
|
|
14
|
-
constructor(getMap: () => maplibregl.Map | undefined, addLayer: YarrowLayerManager['addLayer'], removeLayer: YarrowLayerManager['removeLayer'], fitBounds: (data: {
|
|
15
|
-
type?: string;
|
|
16
|
-
features: Array<{
|
|
17
|
-
geometry?: {
|
|
18
|
-
type?: string;
|
|
19
|
-
coordinates?: unknown;
|
|
20
|
-
};
|
|
21
|
-
}>;
|
|
22
|
-
}) => void);
|
|
23
|
-
buildRoute(options: BuildRouteOptions): Promise<BuildRouteResult>;
|
|
24
|
-
buildRouteWithLabels(startCoordinates: [number, number], endCoordinates: [number, number], profile: string): Promise<{
|
|
25
|
-
features: RouteFeature[];
|
|
26
|
-
directions: unknown[];
|
|
27
|
-
}>;
|
|
28
|
-
buildMultiSegmentRouteWithLabels(coordinates: [number, number][], profile: string, language?: string): Promise<{
|
|
29
|
-
features: RouteFeature[];
|
|
30
|
-
directions: unknown[][];
|
|
31
|
-
}>;
|
|
32
|
-
clearAllRoutes(): void;
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=builder.d.ts.map
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { RouteFeature } from '../types';
|
|
2
|
-
export declare const POPUP_CSS = "position: absolute; padding: 6px 12px; background: #fff; border: 1px solid #ccc; border-radius: 6px; font-size: 13px; font-weight: 500; box-shadow: 0 2px 6px rgba(0,0,0,0.15); pointer-events: none; z-index: 9999;";
|
|
3
|
-
export declare const createPopupElement: (labelText: string, x: number, y: number) => HTMLDivElement;
|
|
4
|
-
export declare const removeAllRoutePopups: () => void;
|
|
5
|
-
export declare const formatDuration: (minutes: number) => string;
|
|
6
|
-
export declare const formatDistance: (meters: number) => string;
|
|
7
|
-
export declare const formatRouteLabel: (duration: number, distance: number, isBest: boolean, bestDuration?: number) => string;
|
|
8
|
-
export declare const getMidpointCoordinates: (coordinates: [number, number][]) => [number, number];
|
|
9
|
-
export declare const createRouteLabelFeature: (coordinates: [number, number], labelText: string) => GeoJSON.Feature;
|
|
10
|
-
export declare const createHoverPopup: (map: maplibregl.Map, e: maplibregl.MapMouseEvent, labelText: string) => HTMLDivElement | null;
|
|
11
|
-
export declare const createClickPopup: (map: maplibregl.Map, coordinates: [number, number], labelText: string) => HTMLDivElement | null;
|
|
12
|
-
export declare const setupMoveListenerForPopup: (map: maplibregl.Map, coordinates: [number, number]) => void;
|
|
13
|
-
export declare const clearOldRouteLayers: (removeLayer: (layerId: string) => void) => void;
|
|
14
|
-
export declare const transformRouteCoordinates: (features: RouteFeature[]) => RouteFeature[];
|
|
15
|
-
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { YarrowLayerManager } from '../layers';
|
|
2
|
-
import type { RouteFeature } from '../types';
|
|
3
|
-
export declare class YarrowRoutingRenderer {
|
|
4
|
-
private addLayer;
|
|
5
|
-
constructor(addLayer: YarrowLayerManager['addLayer']);
|
|
6
|
-
renderRoutes(routes: RouteFeature[], baseLayerName?: string): void;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=renderer.d.ts.map
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { RouteFeature } from '../types';
|
|
2
|
-
export declare const ROUTE_LAYER_COLORS: string[];
|
|
3
|
-
export declare const MAX_ROUTE_INDEX = 5;
|
|
4
|
-
export declare const ROUTE_API_URL = "https://api.yarrow.uz/api/routing/route";
|
|
5
|
-
export interface BuildRouteOptions {
|
|
6
|
-
profile: string;
|
|
7
|
-
coordinates: [number, number][];
|
|
8
|
-
routeColor?: string;
|
|
9
|
-
routeWidth?: number;
|
|
10
|
-
routeOpacity?: number;
|
|
11
|
-
alternativeColor?: string;
|
|
12
|
-
alternativeWidth?: number;
|
|
13
|
-
alternativeOpacity?: number;
|
|
14
|
-
showLabels?: boolean;
|
|
15
|
-
labelFont?: string[];
|
|
16
|
-
labelSize?: number;
|
|
17
|
-
labelOffset?: [number, number];
|
|
18
|
-
labelAnchor?: 'top' | 'bottom' | 'left' | 'right' | 'center';
|
|
19
|
-
fitBounds?: boolean;
|
|
20
|
-
clearOldRoutes?: boolean;
|
|
21
|
-
language?: string;
|
|
22
|
-
layerPrefix?: string;
|
|
23
|
-
}
|
|
24
|
-
export interface BuildRouteResult {
|
|
25
|
-
features: RouteFeature[];
|
|
26
|
-
directions: RouteDirection[][];
|
|
27
|
-
meta: {
|
|
28
|
-
profile: string;
|
|
29
|
-
totalRoutes: number;
|
|
30
|
-
bestRouteIndex: number;
|
|
31
|
-
duration: number;
|
|
32
|
-
distance: number;
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
export type RouteDirection = {
|
|
36
|
-
distance: number;
|
|
37
|
-
duration: number;
|
|
38
|
-
instruction: string;
|
|
39
|
-
[key: string]: unknown;
|
|
40
|
-
};
|
|
41
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/maps/search.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { Map as MaplibreMap } from 'maplibre-gl';
|
|
2
|
-
import type { SearchResult, BoundsInput } from './types';
|
|
3
|
-
import type { YarrowLayerManager } from './layers';
|
|
4
|
-
type SearchOptions = {
|
|
5
|
-
layerName?: string;
|
|
6
|
-
iconImage?: string;
|
|
7
|
-
highlightColor?: string;
|
|
8
|
-
pulseAnimation?: boolean;
|
|
9
|
-
zoomToResults?: boolean;
|
|
10
|
-
onIconClick?: (lat: number, lng: number, properties: Record<string, unknown>) => void;
|
|
11
|
-
onResultsUpdate?: (results: SearchResult[]) => void;
|
|
12
|
-
onLoadingStateChange?: (state: 'firstRender' | 'rerender' | false) => void;
|
|
13
|
-
};
|
|
14
|
-
export declare class YarrowSearchManager {
|
|
15
|
-
private getMap;
|
|
16
|
-
private fitBounds;
|
|
17
|
-
private addLayer;
|
|
18
|
-
private removeLayer;
|
|
19
|
-
constructor(getMap: () => MaplibreMap | undefined, fitBounds: (data: BoundsInput) => void, addLayer: YarrowLayerManager['addLayer'], removeLayer: YarrowLayerManager['removeLayer']);
|
|
20
|
-
highlightSearchResults(query: string, highlightOptions?: SearchOptions): () => void;
|
|
21
|
-
}
|
|
22
|
-
export {};
|
|
23
|
-
//# sourceMappingURL=search.d.ts.map
|
package/dist/maps/styles.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { StyleSpecification } from 'maplibre-gl';
|
|
2
|
-
import { type BrandBadgeController } from './brandBadge';
|
|
3
|
-
import type { YarrowMapConfig } from './config';
|
|
4
|
-
import type { BrandBadgePosition, LayerDescriptor } from './types';
|
|
5
|
-
import type { YarrowControlsController } from './yarrowControls';
|
|
6
|
-
export declare class YarrowStylesManager {
|
|
7
|
-
private getMap;
|
|
8
|
-
private config;
|
|
9
|
-
private fetchJson;
|
|
10
|
-
private fixStyle;
|
|
11
|
-
private getIconsMap;
|
|
12
|
-
private addIconsToMap;
|
|
13
|
-
private badgeController;
|
|
14
|
-
private controlsController;
|
|
15
|
-
private syncCollision;
|
|
16
|
-
private updateLayersArray;
|
|
17
|
-
private setLayers?;
|
|
18
|
-
private layers;
|
|
19
|
-
constructor(getMap: () => maplibregl.Map | undefined, config: YarrowMapConfig, fetchJson: <T>(url: string, cacheName: string) => Promise<T>, fixStyle: (style: StyleSpecification) => void, getIconsMap: () => Promise<Record<string, string>>, addIconsToMap: (icons: Record<string, string>) => Promise<void>, badgeController: BrandBadgeController, controlsController: YarrowControlsController, syncCollision: () => void, updateLayersArray: (style: StyleSpecification) => void, setLayers?: ((layers: LayerDescriptor[]) => void) | undefined);
|
|
20
|
-
setLayersArray(layers: LayerDescriptor[]): void;
|
|
21
|
-
changeStyles(styleType?: string): Promise<StyleSpecification>;
|
|
22
|
-
changeTheme(theme: 'light' | 'dark'): Promise<StyleSpecification>;
|
|
23
|
-
changeBrandBadgePosition(position: BrandBadgePosition): BrandBadgePosition;
|
|
24
|
-
getControlsInsetForCollision(controlsPosition: 'left-top' | 'left-bottom' | 'right-top' | 'right-bottom', badgePosition: BrandBadgePosition, badgeHeight: number): {
|
|
25
|
-
top?: number;
|
|
26
|
-
bottom?: number;
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=styles.d.ts.map
|
package/dist/maps/types.d.ts
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import type { GeoJSONSourceSpecification, LayerSpecification, MapGeoJSONFeature, FeatureIdentifier, PointLike, QueryRenderedFeaturesOptions, RequestParameters, StyleSpecification } from 'maplibre-gl';
|
|
2
|
-
import type { FilterSpecification } from '@maplibre/maplibre-gl-style-spec';
|
|
3
|
-
import type { BrandBadgePosition } from './brandBadge';
|
|
4
|
-
import type { YarrowControlsConfig, YarrowControlsPosition } from './yarrowControls';
|
|
5
|
-
export type { BrandBadgePosition };
|
|
6
|
-
export type { YarrowControlsConfig, YarrowControlsPosition };
|
|
7
|
-
export type CacheConfig = {
|
|
8
|
-
enabled?: boolean;
|
|
9
|
-
lifespanDays?: number;
|
|
10
|
-
};
|
|
11
|
-
export type NormalizedCacheConfig = {
|
|
12
|
-
enabled: boolean;
|
|
13
|
-
lifespanDays: number;
|
|
14
|
-
};
|
|
15
|
-
export type CachedArrayBufferResponse = {
|
|
16
|
-
data: ArrayBuffer;
|
|
17
|
-
cacheControl: string | null;
|
|
18
|
-
expires: string | null;
|
|
19
|
-
contentType: string | null;
|
|
20
|
-
};
|
|
21
|
-
export type LayerDescriptor = {
|
|
22
|
-
type: string;
|
|
23
|
-
name: string;
|
|
24
|
-
};
|
|
25
|
-
export type AddLayerOptions = {
|
|
26
|
-
sourceId?: string;
|
|
27
|
-
filter?: FilterSpecification;
|
|
28
|
-
};
|
|
29
|
-
export type StyleLayerLike = {
|
|
30
|
-
id: string;
|
|
31
|
-
type?: string;
|
|
32
|
-
source?: string;
|
|
33
|
-
'source-layer'?: string;
|
|
34
|
-
layout?: Record<string, unknown>;
|
|
35
|
-
};
|
|
36
|
-
export type BoundsInput = {
|
|
37
|
-
type?: string;
|
|
38
|
-
features: Array<{
|
|
39
|
-
geometry?: {
|
|
40
|
-
type?: string;
|
|
41
|
-
coordinates?: unknown;
|
|
42
|
-
};
|
|
43
|
-
}>;
|
|
44
|
-
};
|
|
45
|
-
export type GeoJsonDataObject = Exclude<GeoJSONSourceSpecification['data'], string>;
|
|
46
|
-
export type RouteFeature = {
|
|
47
|
-
type: 'Feature';
|
|
48
|
-
geometry: {
|
|
49
|
-
type: 'LineString';
|
|
50
|
-
coordinates: [number, number][];
|
|
51
|
-
};
|
|
52
|
-
properties: {
|
|
53
|
-
duration: number;
|
|
54
|
-
distance: number;
|
|
55
|
-
[key: string]: unknown;
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
export type RouteBuildResult = {
|
|
59
|
-
features: RouteFeature[];
|
|
60
|
-
directions: unknown[];
|
|
61
|
-
};
|
|
62
|
-
export type MultiRouteBuildResult = {
|
|
63
|
-
features: RouteFeature[];
|
|
64
|
-
directions: unknown[][];
|
|
65
|
-
};
|
|
66
|
-
export type IconListItem = {
|
|
67
|
-
icon_image_name: string;
|
|
68
|
-
icon_image_url: string;
|
|
69
|
-
};
|
|
70
|
-
export type SearchResult = {
|
|
71
|
-
id?: string | number;
|
|
72
|
-
latitude?: number;
|
|
73
|
-
longitude?: number;
|
|
74
|
-
icon_img?: string;
|
|
75
|
-
name?: string;
|
|
76
|
-
[key: string]: unknown;
|
|
77
|
-
};
|
|
78
|
-
export type YarrowMapConfigOptions = {
|
|
79
|
-
container: HTMLElement | string;
|
|
80
|
-
center: [number, number];
|
|
81
|
-
zoom?: number;
|
|
82
|
-
minZoom?: number;
|
|
83
|
-
maxZoom?: number;
|
|
84
|
-
theme?: 'light' | 'dark';
|
|
85
|
-
cache?: CacheConfig;
|
|
86
|
-
brandBadgePosition?: BrandBadgePosition;
|
|
87
|
-
controls?: YarrowControlsConfig;
|
|
88
|
-
excludePoiLayer?: boolean;
|
|
89
|
-
apiKey: string;
|
|
90
|
-
};
|
|
91
|
-
export type SearchOptions = {
|
|
92
|
-
layerName?: string;
|
|
93
|
-
iconImage?: string;
|
|
94
|
-
highlightColor?: string;
|
|
95
|
-
pulseAnimation?: boolean;
|
|
96
|
-
zoomToResults?: boolean;
|
|
97
|
-
onIconClick?: (lat: number, lng: number, properties: Record<string, unknown>) => void;
|
|
98
|
-
onResultsUpdate?: (results: SearchResult[]) => void;
|
|
99
|
-
onLoadingStateChange?: (state: 'firstRender' | 'rerender' | false) => void;
|
|
100
|
-
};
|
|
101
|
-
export declare const OVERLAY_COLLISION_GAP_PX = 8;
|
|
102
|
-
export declare const ROUTE_COLORS: string[];
|
|
103
|
-
export declare const DEFAULT_CACHE_ENABLED = false;
|
|
104
|
-
export declare const DEFAULT_CACHE_LIFESPAN_DAYS = 30;
|
|
105
|
-
export declare const MILLISECONDS_PER_DAY: number;
|
|
106
|
-
export declare const TILE_CACHE_NAME = "yarrow-cache-v1-tile";
|
|
107
|
-
export declare const ICON_CACHE_NAME = "yarrow-cache-v1-icon";
|
|
108
|
-
export declare const CACHE_PROTOCOL = "yarrowcache";
|
|
109
|
-
export declare const CACHED_AT_HEADER = "x-yarrow-cached-at";
|
|
110
|
-
export type { GeoJSONSourceSpecification, LayerSpecification, MapGeoJSONFeature, FeatureIdentifier, PointLike, QueryRenderedFeaturesOptions, RequestParameters, StyleSpecification, };
|
|
111
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/maps/yarrow.d.ts
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { type FeatureIdentifier, type GeoJSONSourceSpecification, type LayerSpecification, Map as MaplibreMap, type Marker, type MarkerOptions, type PointLike, type QueryRenderedFeaturesOptions, type StyleSpecification } from 'maplibre-gl';
|
|
2
|
-
import { YarrowMapConfig } from './config';
|
|
3
|
-
import type { BuildRouteOptions, BuildRouteResult } from './routing/types';
|
|
4
|
-
import type { BoundsInput, LayerDescriptor, RouteFeature, SearchOptions } from './types';
|
|
5
|
-
import { type AddLayerOptions } from './types';
|
|
6
|
-
export declare class YarrowMap {
|
|
7
|
-
private static isCacheProtocolRegistered;
|
|
8
|
-
config: YarrowMapConfig;
|
|
9
|
-
map?: MaplibreMap;
|
|
10
|
-
layers: LayerDescriptor[];
|
|
11
|
-
private layerManager;
|
|
12
|
-
private markerManager;
|
|
13
|
-
private routingBuilder;
|
|
14
|
-
private routingRenderer;
|
|
15
|
-
private searchManager;
|
|
16
|
-
private stylesManager;
|
|
17
|
-
private navigationManager;
|
|
18
|
-
private eventManager;
|
|
19
|
-
private badgeController;
|
|
20
|
-
private controlsController;
|
|
21
|
-
private badgeResizeObserver?;
|
|
22
|
-
private poiLayerConfig?;
|
|
23
|
-
private poiSourceConfig?;
|
|
24
|
-
constructor(config: YarrowMapConfig);
|
|
25
|
-
private ensureCacheProtocol;
|
|
26
|
-
private get cacheLifespanMs();
|
|
27
|
-
private isCacheEnabled;
|
|
28
|
-
private transformRequestForCache;
|
|
29
|
-
private fetchJson;
|
|
30
|
-
private addApiKeyToUrl;
|
|
31
|
-
private loadImageFromSrc;
|
|
32
|
-
private loadIconImage;
|
|
33
|
-
private getIconsMap;
|
|
34
|
-
private addIconsToMap;
|
|
35
|
-
private patchMapRemoveForBadgeCleanup;
|
|
36
|
-
private getControlsInsetForCollision;
|
|
37
|
-
private syncOverlayCollisionInset;
|
|
38
|
-
private stopBadgeCollisionObserver;
|
|
39
|
-
private startBadgeCollisionObserver;
|
|
40
|
-
fixStyle(style: StyleSpecification | null | undefined): void;
|
|
41
|
-
private updateLayersArray;
|
|
42
|
-
private storePoiLayerConfig;
|
|
43
|
-
private removePoiLayerFromStyle;
|
|
44
|
-
init(): Promise<void>;
|
|
45
|
-
clearCache(): Promise<void>;
|
|
46
|
-
changeStyles(styleType?: string): Promise<StyleSpecification>;
|
|
47
|
-
changeTheme(theme: 'light' | 'dark'): Promise<StyleSpecification>;
|
|
48
|
-
changeBrandBadgePosition(position: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'): import("./brandBadge").BrandBadgePosition;
|
|
49
|
-
enablePoiLayer(): void;
|
|
50
|
-
disablePoiLayer(): void;
|
|
51
|
-
zoomTo(lat: number, lng: number, zoom: number): void;
|
|
52
|
-
fitBounds(data: BoundsInput): void;
|
|
53
|
-
getBoundingBox(data: BoundsInput): {
|
|
54
|
-
xMin: number;
|
|
55
|
-
xMax: number;
|
|
56
|
-
yMin: number;
|
|
57
|
-
yMax: number;
|
|
58
|
-
};
|
|
59
|
-
onMoveEnd(callback: (lat: number, lng: number, zoom: number) => void): void;
|
|
60
|
-
onMapClick(callback: (lat: number, lng: number) => void): void;
|
|
61
|
-
onIconClick(layerGroup: 'pois' | 'buildings', callback: (lat: number, lng: number, properties: Record<string, unknown>) => void): void;
|
|
62
|
-
onLayerClick(layerName: 'buildings' | 'pois', callback: (lat: number, lng: number, properties: Record<string, unknown>) => void): void;
|
|
63
|
-
changeBackgroundColor(color: string): void;
|
|
64
|
-
addSource(sourceId: string, data: GeoJSONSourceSpecification['data']): void;
|
|
65
|
-
updateSourceData(sourceId: string, data: GeoJSONSourceSpecification['data']): void;
|
|
66
|
-
addLayer(layerName: string, layerType: LayerSpecification['type'], featureCollection: GeoJSONSourceSpecification['data'], paint?: LayerSpecification['paint'], layout?: LayerSpecification['layout'], iconSettings?: {
|
|
67
|
-
width?: number;
|
|
68
|
-
height?: number;
|
|
69
|
-
}, options?: AddLayerOptions): void;
|
|
70
|
-
removeLayer(layerName: string): void;
|
|
71
|
-
setFeatureState(feature: FeatureIdentifier, state: Record<string, unknown>): void;
|
|
72
|
-
queryRenderedFeatures(geometryOrOptions?: PointLike | [PointLike, PointLike] | QueryRenderedFeaturesOptions, options?: QueryRenderedFeaturesOptions): import("maplibre-gl").MapGeoJSONFeature[];
|
|
73
|
-
addMarker(coordinates: [number, number], options?: MarkerOptions): Marker | null;
|
|
74
|
-
removeMarker(marker: Marker | null): void;
|
|
75
|
-
renderRoutes(routes: RouteFeature[], baseLayerName?: string): void;
|
|
76
|
-
buildRoute(options: BuildRouteOptions): Promise<BuildRouteResult>;
|
|
77
|
-
buildRouteWithLabels(startCoordinates: [number, number], endCoordinates: [number, number], profile: string): Promise<{
|
|
78
|
-
features: RouteFeature[];
|
|
79
|
-
directions: unknown[];
|
|
80
|
-
}>;
|
|
81
|
-
buildMultiSegmentRouteWithLabels(coordinates: [number, number][], profile: string, language?: string): Promise<{
|
|
82
|
-
features: RouteFeature[];
|
|
83
|
-
directions: unknown[][];
|
|
84
|
-
}>;
|
|
85
|
-
clearAllRoutes(): void;
|
|
86
|
-
highlightSearchResults(query: string, options?: SearchOptions): () => void;
|
|
87
|
-
}
|
|
88
|
-
export { YarrowMapConfig };
|
|
89
|
-
export type { BrandBadgePosition } from './brandBadge';
|
|
90
|
-
export type { YarrowControlsConfig, YarrowControlsPosition, } from './yarrowControls';
|
|
91
|
-
export type { YarrowMapConfigOptions } from './types';
|
|
92
|
-
//# sourceMappingURL=yarrow.d.ts.map
|
|
@@ -1,51 +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 zoomInButton?;
|
|
31
|
-
private zoomOutButton?;
|
|
32
|
-
private compassButton?;
|
|
33
|
-
private compassNeedle?;
|
|
34
|
-
private onRotate?;
|
|
35
|
-
private onZoomInClick?;
|
|
36
|
-
private onZoomOutClick?;
|
|
37
|
-
private onCompassClick?;
|
|
38
|
-
private inset;
|
|
39
|
-
private state;
|
|
40
|
-
mount(map: MaplibreMap, state: YarrowControlsState): void;
|
|
41
|
-
update(state: YarrowControlsState): void;
|
|
42
|
-
setInset(inset?: Partial<YarrowControlsInset>): void;
|
|
43
|
-
teardown(removeHost?: boolean): void;
|
|
44
|
-
private createDom;
|
|
45
|
-
private applyHostPosition;
|
|
46
|
-
private renderVisibleButtons;
|
|
47
|
-
private attachMapListeners;
|
|
48
|
-
private updateCompassNeedle;
|
|
49
|
-
}
|
|
50
|
-
export {};
|
|
51
|
-
//# 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,40 +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
|
-
excludePoiLayer?: boolean;
|
|
25
|
-
apiKey: string;
|
|
26
|
-
};
|
|
27
|
-
export type UseYarrowMapOptions = {
|
|
28
|
-
config: YarrowMapReactConfig;
|
|
29
|
-
configKey?: string | number;
|
|
30
|
-
onReady?: (map: YarrowMap) => void;
|
|
31
|
-
};
|
|
32
|
-
export type UseYarrowMapResult = {
|
|
33
|
-
containerRef: React.RefObject<HTMLDivElement | null>;
|
|
34
|
-
map: YarrowMap | null;
|
|
35
|
-
isReady: boolean;
|
|
36
|
-
error: Error | null;
|
|
37
|
-
};
|
|
38
|
-
export declare const useYarrowMap: ({ config, configKey, onReady, }: UseYarrowMapOptions) => UseYarrowMapResult;
|
|
39
|
-
export {};
|
|
40
|
-
//# sourceMappingURL=useYarrowMap.d.ts.map
|