@kepler.gl/reducers 3.1.0-alpha.1 → 3.1.0-alpha.2

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.
Files changed (49) hide show
  1. package/dist/combined-updaters.d.ts +79 -0
  2. package/dist/combined-updaters.js +358 -0
  3. package/dist/composer-helpers.d.ts +24 -0
  4. package/dist/composer-helpers.js +101 -0
  5. package/dist/composers.d.ts +18 -0
  6. package/dist/composers.js +23 -0
  7. package/dist/core.d.ts +64 -0
  8. package/dist/core.js +105 -0
  9. package/dist/data-utils.d.ts +12 -0
  10. package/dist/data-utils.js +57 -0
  11. package/dist/export-utils.d.ts +21 -0
  12. package/dist/export-utils.js +91 -0
  13. package/dist/index.d.ts +35 -0
  14. package/dist/index.js +342 -0
  15. package/dist/interaction-utils.d.ts +29 -0
  16. package/dist/interaction-utils.js +105 -0
  17. package/dist/layer-utils.d.ts +96 -0
  18. package/dist/layer-utils.js +310 -0
  19. package/dist/map-state-updaters.d.ts +93 -0
  20. package/dist/map-state-updaters.js +432 -0
  21. package/dist/map-state.d.ts +75 -0
  22. package/dist/map-state.js +35 -0
  23. package/dist/map-style-updaters.d.ts +179 -0
  24. package/dist/map-style-updaters.js +656 -0
  25. package/dist/map-style.d.ts +4 -0
  26. package/dist/map-style.js +34 -0
  27. package/dist/merger-handler.d.ts +10 -0
  28. package/dist/merger-handler.js +105 -0
  29. package/dist/middleware.d.ts +8 -0
  30. package/dist/middleware.js +27 -0
  31. package/dist/provider-state-updaters.d.ts +35 -0
  32. package/dist/provider-state-updaters.js +348 -0
  33. package/dist/provider-state.d.ts +4 -0
  34. package/dist/provider-state.js +35 -0
  35. package/dist/root.d.ts +24 -0
  36. package/dist/root.js +206 -0
  37. package/dist/ui-state-updaters.d.ts +362 -0
  38. package/dist/ui-state-updaters.js +762 -0
  39. package/dist/ui-state.d.ts +3 -0
  40. package/dist/ui-state.js +37 -0
  41. package/dist/vis-state-merger.d.ts +143 -0
  42. package/dist/vis-state-merger.js +812 -0
  43. package/dist/vis-state-selectors.d.ts +10 -0
  44. package/dist/vis-state-selectors.js +30 -0
  45. package/dist/vis-state-updaters.d.ts +546 -0
  46. package/dist/vis-state-updaters.js +3338 -0
  47. package/dist/vis-state.d.ts +155 -0
  48. package/dist/vis-state.js +36 -0
  49. package/package.json +17 -17
@@ -0,0 +1,179 @@
1
+ import { RGBColor, LayerGroup, MapStyles, InputStyle, VisibleLayerGroups } from '@kepler.gl/types';
2
+ import { ActionTypes, ReceiveMapConfigPayload, KeplerGlInitPayload, MapStyleActions } from '@kepler.gl/actions';
3
+ export declare type MapboxStyleUrl = string;
4
+ export declare type MapStyle = {
5
+ styleType: string;
6
+ visibleLayerGroups: VisibleLayerGroups;
7
+ topLayerGroups: VisibleLayerGroups;
8
+ mapStyles: MapStyles;
9
+ mapboxApiAccessToken: string | null;
10
+ mapboxApiUrl: string;
11
+ mapStylesReplaceDefault: boolean;
12
+ inputStyle: InputStyle;
13
+ threeDBuildingColor: RGBColor;
14
+ backgroundColor: RGBColor;
15
+ custom3DBuildingColor: boolean;
16
+ bottomMapStyle: any;
17
+ topMapStyle: any;
18
+ initialState?: MapStyle;
19
+ isLoading: {
20
+ [key: string]: boolean;
21
+ };
22
+ };
23
+ /**
24
+ * Default initial `mapStyle`
25
+ * @memberof mapStyleUpdaters
26
+ * @constant
27
+ * @property styleType - Default: `'dark'`
28
+ * @property visibleLayerGroups - Default: `{}`
29
+ * @property topLayerGroups - Default: `{}`
30
+ * @property mapStyles - mapping from style key to style object
31
+ * @property mapboxApiAccessToken - Default: `null`
32
+ * @Property mapboxApiUrl - Default null
33
+ * @Property mapStylesReplaceDefault - Default: `false`
34
+ * @property inputStyle - Default: `{}`
35
+ * @property threeDBuildingColor - Default: `[r, g, b]`
36
+ * @property backgroundColor - Default: `[r, g, b]`
37
+ * @public
38
+ */
39
+ export declare const INITIAL_MAP_STYLE: MapStyle;
40
+ interface GetMapStylesParam {
41
+ styleType: string;
42
+ visibleLayerGroups: {
43
+ [id: string]: LayerGroup | boolean;
44
+ };
45
+ topLayerGroups: {
46
+ [id: string]: LayerGroup | boolean;
47
+ };
48
+ mapStyles: {
49
+ [id: string]: any;
50
+ };
51
+ }
52
+ /**
53
+ * Create two map styles from preset map style, one for top map one for bottom
54
+ *
55
+ * @param {string} styleType - current map style
56
+ * @param {Object} visibleLayerGroups - visible layers of bottom map
57
+ * @param {Object} topLayerGroups - visible layers of top map
58
+ * @param {Object} mapStyles - a dictionary of all map styles
59
+ * @returns {Object} bottomMapStyle | topMapStyle | isRaster
60
+ */
61
+ export declare function getMapStyles({ styleType, visibleLayerGroups, topLayerGroups, mapStyles }: GetMapStylesParam): {
62
+ bottomMapStyle?: undefined;
63
+ topMapStyle?: undefined;
64
+ editable?: undefined;
65
+ } | {
66
+ bottomMapStyle: any;
67
+ topMapStyle: {
68
+ layers: any;
69
+ } | null;
70
+ editable: number;
71
+ };
72
+ /**
73
+ * @memberof mapStyleUpdaters
74
+ * @public
75
+ */
76
+ export declare const requestMapStylesUpdater: (state: MapStyle, { payload: { mapStyles, onSuccess } }: MapStyleActions.RequestMapStylesUpdaterAction) => MapStyle;
77
+ /**
78
+ * Propagate `mapStyle` reducer with `mapboxApiAccessToken` and `mapStylesReplaceDefault`.
79
+ * if mapStylesReplaceDefault is true mapStyles is emptied; loadMapStylesUpdater() will
80
+ * populate mapStyles.
81
+ *
82
+ * @memberof mapStyleUpdaters
83
+ * @public
84
+ */
85
+ export declare const initMapStyleUpdater: (state: MapStyle, { payload }: {
86
+ type?: "@@kepler.gl/INIT" | undefined;
87
+ payload: KeplerGlInitPayload;
88
+ }) => MapStyle;
89
+ /**
90
+ * Update `visibleLayerGroups`to change layer group visibility
91
+ * @memberof mapStyleUpdaters
92
+ * @public
93
+ */
94
+ export declare const mapConfigChangeUpdater: (state: MapStyle, action: MapStyleActions.MapConfigChangeUpdaterAction) => MapStyle;
95
+ /**
96
+ * Change to another map style. The selected style should already been loaded into `mapStyle.mapStyles`
97
+ * @memberof mapStyleUpdaters
98
+ * @public
99
+ */
100
+ export declare const mapStyleChangeUpdater: (state: MapStyle, { payload: { styleType, onSuccess } }: MapStyleActions.MapStyleChangeUpdaterAction) => MapStyle;
101
+ /**
102
+ * Callback when load map style success
103
+ * @memberof mapStyleUpdaters
104
+ * @public
105
+ */
106
+ export declare const loadMapStylesUpdater: (state: MapStyle, action: MapStyleActions.LoadMapStylesUpdaterAction) => MapStyle;
107
+ /**
108
+ * Callback when load map style error
109
+ * @memberof mapStyleUpdaters
110
+ * @public
111
+ */
112
+ export declare const loadMapStyleErrUpdater: (state: MapStyle, { payload: { ids, error } }: MapStyleActions.LoadMapStyleErrUpdaterAction) => MapStyle;
113
+ /**
114
+ * Load map style object when pass in saved map config
115
+ * @memberof mapStyleUpdaters
116
+ * @param state `mapStyle`
117
+ * @param action
118
+ * @param action.payload saved map config `{mapStyle, visState, mapState}`
119
+ * @returns nextState or `react-pam` tasks to load map style object
120
+ */
121
+ export declare const receiveMapConfigUpdater: (state: MapStyle, { payload: { config } }: {
122
+ type?: typeof ActionTypes.RECEIVE_MAP_CONFIG;
123
+ payload: ReceiveMapConfigPayload;
124
+ }) => MapStyle;
125
+ /**
126
+ * Reset map style config to initial state
127
+ * @memberof mapStyleUpdaters
128
+ * @param state `mapStyle`
129
+ * @returns nextState
130
+ * @public
131
+ */
132
+ export declare const resetMapConfigMapStyleUpdater: (state: MapStyle) => MapStyle;
133
+ /**
134
+ * Callback when a custom map style object is received
135
+ * @memberof mapStyleUpdaters
136
+ * @public
137
+ */
138
+ export declare const loadCustomMapStyleUpdater: (state: MapStyle, { payload: { icon, style, error } }: MapStyleActions.LoadCustomMapStyleUpdaterAction) => MapStyle;
139
+ /**
140
+ * Input a custom map style object
141
+ * @memberof mapStyleUpdaters
142
+ * @public
143
+ */
144
+ export declare const inputMapStyleUpdater: (state: MapStyle, { payload: { inputStyle, mapState } }: MapStyleActions.InputMapStyleUpdaterAction) => MapStyle;
145
+ /**
146
+ * Add map style from user input to reducer and set it to current style
147
+ * This action is called when user click confirm after putting in a valid style url in the custom map style dialog.
148
+ * It should not be called from outside kepler.gl without a valid `inputStyle` in the `mapStyle` reducer.
149
+ * @memberof mapStyleUpdaters
150
+ */
151
+ export declare const addCustomMapStyleUpdater: (state: MapStyle) => MapStyle;
152
+ /**
153
+ * Edit map style from user input to reducer.
154
+ * This action is called when user clicks confirm after editing an existing custom style in the custom map style dialog.
155
+ * It should not be called from outside kepler.gl without a valid `inputStyle` in the `mapStyle` reducer.
156
+ * @memberof mapStyleUpdaters
157
+ */
158
+ export declare const editCustomMapStyleUpdater: (state: MapStyle) => MapStyle;
159
+ /**
160
+ * Remove a custom map style from `state.mapStyle.mapStyles`.
161
+ * @memberof mapStyleUpdaters
162
+ */
163
+ export declare const removeCustomMapStyleUpdater: (state: MapStyle, action: MapStyleActions.RemoveCustomMapStyleUpdaterAction) => MapStyle;
164
+ /**
165
+ * Updates 3d building color
166
+ * @memberof mapStyleUpdaters
167
+ */
168
+ export declare const set3dBuildingColorUpdater: (state: MapStyle, { payload: color }: MapStyleActions.Set3dBuildingColorUpdaterAction) => MapStyle;
169
+ /**
170
+ * Updates background color
171
+ * @memberof mapStyleUpdaters
172
+ */
173
+ export declare const setBackgroundColorUpdater: (state: MapStyle, { payload: color }: MapStyleActions.SetBackgroundColorUpdaterAction) => MapStyle;
174
+ /**
175
+ * Return the initial input style
176
+ * @return Object
177
+ */
178
+ export declare function getInitialInputStyle(): InputStyle;
179
+ export {};