import { RGBColor } from './types'; import ActionTypes from 'constants/action-types'; import { ReceiveMapConfigPayload, KeplerGlInitPayload } from '../actions/actions'; import * as MapStyleActions from '../actions/map-style-actions'; export type LayerGroup = { slug: string; filter(layer: { id: string; }): boolean; defaultVisibility: boolean; }; export type VisibleLayerGroups = { [key: string]: boolean; }; export type MapboxStyleUrl = string; export type BaseMapStyle = { id: string; label: string; url: string; icon: string; style?: Object; layerGroups: LayerGroup[]; }; export type MapStyles = { [key: string]: BaseMapStyle; }; export type InputStyle = { accessToken: string | null; error: boolean; isValid: boolean; label: string | null; style: any | null; url: string | null; icon: string | null; custom: boolean; }; export type MapStyle = { styleType: string; visibleLayerGroups: VisibleLayerGroups; topLayerGroups: VisibleLayerGroups; mapStyles: MapStyles; mapboxApiAccessToken: string | null; mapboxApiUrl: string; mapStylesReplaceDefault: boolean; inputStyle: InputStyle; threeDBuildingColor: RGBColor; custom3DBuildingColor: boolean; initialState?: MapStyle; }; /** * Default initial `mapStyle` * @memberof mapStyleUpdaters * @constant * @property styleType - Default: `'dark'` * @property visibleLayerGroups - Default: `{}` * @property topLayerGroups - Default: `{}` * @property mapStyles - mapping from style key to style object * @property mapboxApiAccessToken - Default: `null` * @Property mapboxApiUrl - Default null * @Property mapStylesReplaceDefault - Default: `false` * @property inputStyle - Default: `{}` * @property threeDBuildingColor - Default: `[r, g, b]` * @public */ export declare const INITIAL_MAP_STYLE: MapStyle; interface GetMapStylesParam { styleType: string; visibleLayerGroups: { [id: string]: LayerGroup | boolean; }; topLayerGroups: { [id: string]: LayerGroup | boolean; }; mapStyles: { [id: string]: any; }; } /** * Create two map styles from preset map style, one for top map one for bottom * * @param {string} styleType - current map style * @param {Object} visibleLayerGroups - visible layers of bottom map * @param {Object} topLayerGroups - visible layers of top map * @param {Object} mapStyles - a dictionary of all map styles * @returns {Object} bottomMapStyle | topMapStyle | isRaster */ export declare function getMapStyles({ styleType, visibleLayerGroups, topLayerGroups, mapStyles }: GetMapStylesParam): { bottomMapStyle?: undefined; topMapStyle?: undefined; editable?: undefined; } | { bottomMapStyle: any; topMapStyle: any; editable: number; }; /** * Propagate `mapStyle` reducer with `mapboxApiAccessToken` and `mapStylesReplaceDefault`. * if mapStylesReplaceDefault is true mapStyles is emptied; loadMapStylesUpdater() will * populate mapStyles. * * @memberof mapStyleUpdaters * @public */ export declare const initMapStyleUpdater: (state: MapStyle, { payload }: { type?: typeof ActionTypes.INIT; payload: KeplerGlInitPayload; }) => MapStyle; /** * Update `visibleLayerGroups`to change layer group visibility * @memberof mapStyleUpdaters * @public */ export declare const mapConfigChangeUpdater: (state: MapStyle, action: MapStyleActions.MapConfigChangeUpdaterAction) => MapStyle; /** * Change to another map style. The selected style should already been loaded into `mapStyle.mapStyles` * @memberof mapStyleUpdaters * @public */ export declare const mapStyleChangeUpdater: (state: MapStyle, { payload: styleType }: MapStyleActions.MapStyleChangeUpdaterAction) => MapStyle; /** * Callback when load map style success * @memberof mapStyleUpdaters * @public */ export declare const loadMapStylesUpdater: (state: MapStyle, action: MapStyleActions.LoadMapStylesUpdaterAction) => MapStyle; /** * Callback when load map style error * @memberof mapStyleUpdaters * @public */ export declare const loadMapStyleErrUpdater: (state: MapStyle, action: MapStyleActions.LoadMapStyleErrUpdaterAction) => MapStyle; /** * @memberof mapStyleUpdaters * @public */ export declare const requestMapStylesUpdater: (state: MapStyle, { payload: mapStyles }: MapStyleActions.RequestMapStylesUpdaterAction) => MapStyle; /** * Load map style object when pass in saved map config * @memberof mapStyleUpdaters * @param state `mapStyle` * @param action * @param action.payload saved map config `{mapStyle, visState, mapState}` * @returns nextState or `react-pam` tasks to load map style object */ export declare const receiveMapConfigUpdater: (state: MapStyle, { payload: { config } }: { type?: typeof ActionTypes.RECEIVE_MAP_CONFIG; payload: ReceiveMapConfigPayload; }) => MapStyle; /** * Reset map style config to initial state * @memberof mapStyleUpdaters * @param state `mapStyle` * @returns nextState * @public */ export declare const resetMapConfigMapStyleUpdater: (state: MapStyle) => MapStyle; /** * Callback when a custom map style object is received * @memberof mapStyleUpdaters * @public */ export declare const loadCustomMapStyleUpdater: (state: MapStyle, { payload: { icon, style, error } }: MapStyleActions.LoadCustomMapStyleUpdaterAction) => MapStyle; /** * Input a custom map style object * @memberof mapStyleUpdaters * @public */ export declare const inputMapStyleUpdater: (state: MapStyle, { payload: { inputStyle, mapState } }: MapStyleActions.InputMapStyleUpdaterAction) => MapStyle; /** * Add map style from user input to reducer and set it to current style * This action is called when user click confirm after putting in a valid style url in the custom map style dialog. * It should not be called from outside kepler.gl without a valid `inputStyle` in the `mapStyle` reducer. * @memberof mapStyleUpdaters */ export declare const addCustomMapStyleUpdater: (state: MapStyle) => MapStyle; /** * Updates 3d building color * @memberof mapStyleUpdaters */ export declare const set3dBuildingColorUpdater: (state: MapStyle, { payload: color }: MapStyleActions.Set3dBuildingColorUpdaterAction) => MapStyle; /** * Return the initial input style * @return Object */ export declare function getInitialInputStyle(): { accessToken: any; error: boolean; isValid: boolean; label: any; style: any; url: any; icon: any; custom: boolean; }; export {};