@kepler.gl/actions 3.3.0-alpha.2 → 3.3.0-alpha.21
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/dist/action-types.d.ts +103 -1
- package/dist/action-wrapper.d.ts +22 -17
- package/dist/actions.d.ts +13 -0
- package/dist/cjs/action-types.js +266 -0
- package/dist/cjs/action-types.js.map +1 -0
- package/dist/cjs/action-wrapper.js +177 -0
- package/dist/cjs/action-wrapper.js.map +1 -0
- package/dist/cjs/actions.js +193 -0
- package/dist/cjs/actions.js.map +1 -0
- package/dist/cjs/identity-actions.js +86 -0
- package/dist/cjs/identity-actions.js.map +1 -0
- package/dist/cjs/index.js +182 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/map-state-actions.js +174 -0
- package/dist/cjs/map-state-actions.js.map +1 -0
- package/dist/cjs/map-style-actions.js +211 -0
- package/dist/cjs/map-style-actions.js.map +1 -0
- package/dist/cjs/provider-actions.js +99 -0
- package/dist/cjs/provider-actions.js.map +1 -0
- package/dist/cjs/ui-state-actions.js +463 -0
- package/dist/cjs/ui-state-actions.js.map +1 -0
- package/dist/cjs/vis-state-actions.js +1859 -0
- package/dist/cjs/vis-state-actions.js.map +1 -0
- package/dist/esm/action-types.js +260 -0
- package/dist/esm/action-types.js.map +1 -0
- package/dist/esm/action-wrapper.js +171 -0
- package/dist/esm/action-wrapper.js.map +1 -0
- package/dist/esm/actions.js +186 -0
- package/dist/esm/actions.js.map +1 -0
- package/dist/esm/identity-actions.js +79 -0
- package/dist/esm/identity-actions.js.map +1 -0
- package/dist/esm/index.js +27 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/map-state-actions.js +167 -0
- package/dist/esm/map-state-actions.js.map +1 -0
- package/dist/esm/map-style-actions.js +204 -0
- package/dist/esm/map-style-actions.js.map +1 -0
- package/dist/esm/provider-actions.js +93 -0
- package/dist/esm/provider-actions.js.map +1 -0
- package/dist/esm/ui-state-actions.js +456 -0
- package/dist/esm/ui-state-actions.js.map +1 -0
- package/dist/esm/vis-state-actions.js +1728 -0
- package/dist/esm/vis-state-actions.js.map +1 -0
- package/dist/map-state-actions.d.ts +51 -3
- package/dist/ui-state-actions.d.ts +77 -2
- package/dist/vis-state-actions.d.ts +573 -21
- package/package.json +25 -22
- package/dist/action-types.js +0 -213
- package/dist/action-wrapper.js +0 -174
- package/dist/actions.js +0 -187
- package/dist/identity-actions.js +0 -86
- package/dist/index.js +0 -183
- package/dist/map-state-actions.js +0 -129
- package/dist/map-style-actions.js +0 -211
- package/dist/provider-actions.js +0 -99
- package/dist/ui-state-actions.js +0 -388
- package/dist/vis-state-actions.js +0 -1299
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// Copyright contributors to the kepler.gl project
|
|
3
|
+
|
|
4
|
+
import { createAction } from '@reduxjs/toolkit';
|
|
5
|
+
import { default as ActionTypes } from './action-types';
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* Toggle between 3d and 2d map.
|
|
9
|
+
* @memberof mapStateActions
|
|
10
|
+
* @public
|
|
11
|
+
* @example
|
|
12
|
+
* import {togglePerspective} from '@kepler.gl/actions';
|
|
13
|
+
* this.props.dispatch(togglePerspective());
|
|
14
|
+
*/
|
|
15
|
+
export var togglePerspective = createAction(ActionTypes.TOGGLE_PERSPECTIVE);
|
|
16
|
+
/**
|
|
17
|
+
* Fit map viewport to bounds
|
|
18
|
+
* @memberof mapStateActions
|
|
19
|
+
* @param {Array<Number>} bounds as `[lngMin, latMin, lngMax, latMax]`
|
|
20
|
+
* @param {Number|Object} [padding] padding in pixels around the bounds. Can be a number or `{top, bottom, left, right}`.
|
|
21
|
+
* @public
|
|
22
|
+
* @example
|
|
23
|
+
* import {fitBounds} from '@kepler.gl/actions';
|
|
24
|
+
* this.props.dispatch(fitBounds([-122.23, 37.127, -122.11, 37.456]));
|
|
25
|
+
* this.props.dispatch(fitBounds([-122.23, 37.127, -122.11, 37.456], {left: 300}));
|
|
26
|
+
*/
|
|
27
|
+
export var fitBounds = createAction(ActionTypes.FIT_BOUNDS, function (bounds, padding) {
|
|
28
|
+
return {
|
|
29
|
+
payload: bounds,
|
|
30
|
+
meta: {
|
|
31
|
+
padding: padding
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
/**
|
|
36
|
+
* Update map viewport
|
|
37
|
+
* @memberof mapStateActions
|
|
38
|
+
* @param {Object} viewport viewport object container one or any of these properties `width`, `height`, `latitude` `longitude`, `zoom`, `pitch`, `bearing`, `dragRotate`
|
|
39
|
+
* @param {Number} [viewport.width] Width of viewport
|
|
40
|
+
* @param {Number} [viewport.height] Height of viewport
|
|
41
|
+
* @param {Number} [viewport.zoom] Zoom of viewport
|
|
42
|
+
* @param {Number} [viewport.pitch] Camera angle in degrees (0 is straight down)
|
|
43
|
+
* @param {Number} [viewport.bearing] Map rotation in degrees (0 means north is up)
|
|
44
|
+
* @param {Number} [viewport.latitude] Latitude center of viewport on map in mercator projection
|
|
45
|
+
* @param {Number} [viewport.longitude] Longitude Center of viewport on map in mercator projection
|
|
46
|
+
* @param {boolean} [viewport.dragRotate] Whether to enable drag and rotate map into perspective viewport
|
|
47
|
+
* @param {number} mapIndex Index of which map to update the viewport of
|
|
48
|
+
* @public
|
|
49
|
+
* @example
|
|
50
|
+
* import {updateMap} from '@kepler.gl/actions';
|
|
51
|
+
* this.props.dispatch(updateMap({latitude: 37.75043, longitude: -122.34679, width: 800, height: 1200}, 0));
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
export var updateMap = createAction(ActionTypes.UPDATE_MAP, function (viewport, mapIndex) {
|
|
55
|
+
return {
|
|
56
|
+
payload: {
|
|
57
|
+
viewport: viewport,
|
|
58
|
+
mapIndex: mapIndex
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
/**
|
|
63
|
+
* Apply a partial map state, as used by the viewport JSON editor.
|
|
64
|
+
* Width and height of the current viewport are preserved.
|
|
65
|
+
* @memberof mapStateActions
|
|
66
|
+
* @param mapState - Partial map state from saved JSON
|
|
67
|
+
* @param mapIndex - Split-map pane to apply camera fields to when viewports are unsynced
|
|
68
|
+
* @public
|
|
69
|
+
*/
|
|
70
|
+
export var applyMapState = createAction(ActionTypes.APPLY_MAP_STATE, function (mapState, mapIndex) {
|
|
71
|
+
return {
|
|
72
|
+
payload: mapState,
|
|
73
|
+
meta: {
|
|
74
|
+
mapIndex: mapIndex
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
});
|
|
78
|
+
/**
|
|
79
|
+
* Toggle between single map or split maps
|
|
80
|
+
* @memberof mapStateActions
|
|
81
|
+
* @param {Number} [index] index is provided, close split map at index
|
|
82
|
+
* @public
|
|
83
|
+
* @example
|
|
84
|
+
* import {toggleSplitMap} from '@kepler.gl/actions';
|
|
85
|
+
* this.props.dispatch(toggleSplitMap());
|
|
86
|
+
*/
|
|
87
|
+
export var toggleSplitMap = createAction(ActionTypes.TOGGLE_SPLIT_MAP, function (index) {
|
|
88
|
+
return {
|
|
89
|
+
payload: index
|
|
90
|
+
};
|
|
91
|
+
});
|
|
92
|
+
/**
|
|
93
|
+
* For split maps, toggle between having (un)synced viewports and (un)locked zooms
|
|
94
|
+
* @memberof mapStateActions
|
|
95
|
+
* @param {Object} syncInfo
|
|
96
|
+
* @param {boolean} [syncInfo.isViewportSynced] Are the 2 split maps having synced viewports?
|
|
97
|
+
* @param {boolean} [syncInfo.isZoomLocked] If split, are the zooms locked to each other or independent?
|
|
98
|
+
*/
|
|
99
|
+
export var toggleSplitMapViewport = createAction(ActionTypes.TOGGLE_SPLIT_MAP_VIEWPORT, function (syncInfo) {
|
|
100
|
+
return {
|
|
101
|
+
payload: syncInfo
|
|
102
|
+
};
|
|
103
|
+
});
|
|
104
|
+
/**
|
|
105
|
+
* Set map view mode (2D, 3D, or Globe)
|
|
106
|
+
* @memberof mapStateActions
|
|
107
|
+
* @param mapViewMode - One of MapViewMode values
|
|
108
|
+
* @public
|
|
109
|
+
*/
|
|
110
|
+
export var setMapViewMode = createAction(ActionTypes.SET_MAP_VIEW_MODE, function (mapViewMode) {
|
|
111
|
+
return {
|
|
112
|
+
payload: {
|
|
113
|
+
mapViewMode: mapViewMode
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
});
|
|
117
|
+
/**
|
|
118
|
+
* Update globe configuration
|
|
119
|
+
* @memberof mapStateActions
|
|
120
|
+
* @param config - Partial globe config to merge
|
|
121
|
+
* @public
|
|
122
|
+
*/
|
|
123
|
+
export var globeConfigChange = createAction(ActionTypes.GLOBE_CONFIG_CHANGE, function (config) {
|
|
124
|
+
return {
|
|
125
|
+
payload: config
|
|
126
|
+
};
|
|
127
|
+
});
|
|
128
|
+
/**
|
|
129
|
+
* Set map split mode (single, dual, or swipe)
|
|
130
|
+
* @memberof mapStateActions
|
|
131
|
+
* @param {Object} payload
|
|
132
|
+
* @param {MapSplitMode} payload.mapSplitMode The split mode to set
|
|
133
|
+
* @public
|
|
134
|
+
*/
|
|
135
|
+
export var setMapSplitMode = createAction(ActionTypes.SET_MAP_SPLIT_MODE, function (payload) {
|
|
136
|
+
return {
|
|
137
|
+
payload: payload
|
|
138
|
+
};
|
|
139
|
+
});
|
|
140
|
+
/**
|
|
141
|
+
* Set the swipe compare divider position
|
|
142
|
+
* @memberof mapStateActions
|
|
143
|
+
* @param {Object} payload
|
|
144
|
+
* @param {number} payload.percentage The percentage position (0-100)
|
|
145
|
+
* @public
|
|
146
|
+
*/
|
|
147
|
+
export var setSwipeComparePercentage = createAction(ActionTypes.SET_SWIPE_COMPARE_PERCENTAGE, function (payload) {
|
|
148
|
+
return {
|
|
149
|
+
payload: payload
|
|
150
|
+
};
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* This declaration is needed to group actions in docs
|
|
155
|
+
*/
|
|
156
|
+
/**
|
|
157
|
+
* Actions handled mostly by `mapState` reducer.
|
|
158
|
+
* They manage map viewport update, toggle between 2d and 3d map,
|
|
159
|
+
* toggle between single and split maps.
|
|
160
|
+
*
|
|
161
|
+
* @public
|
|
162
|
+
*/
|
|
163
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
164
|
+
// @ts-ignore
|
|
165
|
+
var mapStateActions = null;
|
|
166
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
167
|
+
//# sourceMappingURL=map-state-actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map-state-actions.js","names":["createAction","default","ActionTypes","togglePerspective","TOGGLE_PERSPECTIVE","fitBounds","FIT_BOUNDS","bounds","padding","payload","meta","updateMap","UPDATE_MAP","viewport","mapIndex","applyMapState","APPLY_MAP_STATE","mapState","toggleSplitMap","TOGGLE_SPLIT_MAP","index","toggleSplitMapViewport","TOGGLE_SPLIT_MAP_VIEWPORT","syncInfo","setMapViewMode","SET_MAP_VIEW_MODE","mapViewMode","globeConfigChange","GLOBE_CONFIG_CHANGE","config","setMapSplitMode","SET_MAP_SPLIT_MODE","setSwipeComparePercentage","SET_SWIPE_COMPARE_PERCENTAGE","mapStateActions"],"sources":["../../src/map-state-actions.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright contributors to the kepler.gl project\n\nimport {createAction} from '@reduxjs/toolkit';\nimport {default as ActionTypes} from './action-types';\nimport {Bounds, MapState, Merge, Viewport, ViewportPadding} from '@kepler.gl/types';\nimport {MapSplitMode, MapViewMode, GlobeConfig} from '@kepler.gl/constants';\n\nexport type TogglePerspectiveUpdaterAction = void;\n/**\n *\n * Toggle between 3d and 2d map.\n * @memberof mapStateActions\n * @public\n * @example\n * import {togglePerspective} from '@kepler.gl/actions';\n * this.props.dispatch(togglePerspective());\n */\nexport const togglePerspective: () => Merge<\n TogglePerspectiveUpdaterAction,\n {type: typeof ActionTypes.TOGGLE_PERSPECTIVE}\n> = createAction(ActionTypes.TOGGLE_PERSPECTIVE);\n\nexport type FitBoundsUpdaterAction = {\n payload: Bounds;\n meta?: {padding?: ViewportPadding};\n};\n/**\n * Fit map viewport to bounds\n * @memberof mapStateActions\n * @param {Array<Number>} bounds as `[lngMin, latMin, lngMax, latMax]`\n * @param {Number|Object} [padding] padding in pixels around the bounds. Can be a number or `{top, bottom, left, right}`.\n * @public\n * @example\n * import {fitBounds} from '@kepler.gl/actions';\n * this.props.dispatch(fitBounds([-122.23, 37.127, -122.11, 37.456]));\n * this.props.dispatch(fitBounds([-122.23, 37.127, -122.11, 37.456], {left: 300}));\n */\nexport const fitBounds: (\n bounds: Bounds,\n padding?: ViewportPadding\n) => Merge<FitBoundsUpdaterAction, {type: typeof ActionTypes.FIT_BOUNDS}> = createAction(\n ActionTypes.FIT_BOUNDS,\n (bounds: Bounds, padding?: ViewportPadding) => ({\n payload: bounds,\n meta: {padding}\n })\n);\n\nexport type UpdateMapUpdaterAction = {payload: {viewport: Viewport; mapIndex?: number}};\n/**\n * Update map viewport\n * @memberof mapStateActions\n * @param {Object} viewport viewport object container one or any of these properties `width`, `height`, `latitude` `longitude`, `zoom`, `pitch`, `bearing`, `dragRotate`\n * @param {Number} [viewport.width] Width of viewport\n * @param {Number} [viewport.height] Height of viewport\n * @param {Number} [viewport.zoom] Zoom of viewport\n * @param {Number} [viewport.pitch] Camera angle in degrees (0 is straight down)\n * @param {Number} [viewport.bearing] Map rotation in degrees (0 means north is up)\n * @param {Number} [viewport.latitude] Latitude center of viewport on map in mercator projection\n * @param {Number} [viewport.longitude] Longitude Center of viewport on map in mercator projection\n * @param {boolean} [viewport.dragRotate] Whether to enable drag and rotate map into perspective viewport\n * @param {number} mapIndex Index of which map to update the viewport of\n * @public\n * @example\n * import {updateMap} from '@kepler.gl/actions';\n * this.props.dispatch(updateMap({latitude: 37.75043, longitude: -122.34679, width: 800, height: 1200}, 0));\n */\n\nexport const updateMap: (\n viewport: Viewport,\n mapIndex?: number\n) => Merge<UpdateMapUpdaterAction, {type: typeof ActionTypes.UPDATE_MAP}> = createAction(\n ActionTypes.UPDATE_MAP,\n (viewport: Viewport, mapIndex?: number) => ({\n payload: {\n viewport,\n mapIndex\n }\n })\n);\n\nexport type ApplyMapStateUpdaterAction = {\n payload: Partial<MapState>;\n meta?: {mapIndex?: number};\n};\n/**\n * Apply a partial map state, as used by the viewport JSON editor.\n * Width and height of the current viewport are preserved.\n * @memberof mapStateActions\n * @param mapState - Partial map state from saved JSON\n * @param mapIndex - Split-map pane to apply camera fields to when viewports are unsynced\n * @public\n */\nexport const applyMapState: (\n mapState: Partial<MapState>,\n mapIndex?: number\n) => Merge<ApplyMapStateUpdaterAction, {type: typeof ActionTypes.APPLY_MAP_STATE}> = createAction(\n ActionTypes.APPLY_MAP_STATE,\n (mapState: Partial<MapState>, mapIndex?: number) => ({\n payload: mapState,\n meta: {mapIndex}\n })\n);\n\nexport type ToggleSplitMapUpdaterAction = {\n payload: number;\n};\n/**\n * Toggle between single map or split maps\n * @memberof mapStateActions\n * @param {Number} [index] index is provided, close split map at index\n * @public\n * @example\n * import {toggleSplitMap} from '@kepler.gl/actions';\n * this.props.dispatch(toggleSplitMap());\n */\nexport const toggleSplitMap: (\n payload: number\n) => Merge<ToggleSplitMapUpdaterAction, {type: typeof ActionTypes.TOGGLE_SPLIT_MAP}> = createAction(\n ActionTypes.TOGGLE_SPLIT_MAP,\n (index: number) => ({payload: index})\n);\n\nexport type ToggleSplitMapViewportUpdaterAction = {\n payload: {\n isViewportSynced?: boolean;\n isZoomLocked?: boolean;\n };\n};\n\n/**\n * For split maps, toggle between having (un)synced viewports and (un)locked zooms\n * @memberof mapStateActions\n * @param {Object} syncInfo\n * @param {boolean} [syncInfo.isViewportSynced] Are the 2 split maps having synced viewports?\n * @param {boolean} [syncInfo.isZoomLocked] If split, are the zooms locked to each other or independent?\n */\nexport const toggleSplitMapViewport: (payload: {\n isViewportSynced?: boolean;\n isZoomLocked?: boolean;\n}) => Merge<\n ToggleSplitMapViewportUpdaterAction,\n {type: typeof ActionTypes.TOGGLE_SPLIT_MAP_VIEWPORT}\n> = createAction(\n ActionTypes.TOGGLE_SPLIT_MAP_VIEWPORT,\n (syncInfo: ToggleSplitMapViewportUpdaterAction['payload']) => ({payload: syncInfo})\n);\n\nexport type SetMapViewModeUpdaterAction = {payload: {mapViewMode: MapViewMode}};\n/**\n * Set map view mode (2D, 3D, or Globe)\n * @memberof mapStateActions\n * @param mapViewMode - One of MapViewMode values\n * @public\n */\nexport const setMapViewMode: (\n mapViewMode: MapViewMode\n) => Merge<SetMapViewModeUpdaterAction, {type: typeof ActionTypes.SET_MAP_VIEW_MODE}> =\n createAction(ActionTypes.SET_MAP_VIEW_MODE, (mapViewMode: MapViewMode) => ({\n payload: {mapViewMode}\n }));\n\nexport type GlobeConfigChangeUpdaterAction = {payload: Partial<GlobeConfig>};\n/**\n * Update globe configuration\n * @memberof mapStateActions\n * @param config - Partial globe config to merge\n * @public\n */\nexport const globeConfigChange: (\n config: Partial<GlobeConfig>\n) => Merge<GlobeConfigChangeUpdaterAction, {type: typeof ActionTypes.GLOBE_CONFIG_CHANGE}> =\n createAction(ActionTypes.GLOBE_CONFIG_CHANGE, (config: Partial<GlobeConfig>) => ({\n payload: config\n }));\nexport type SetMapSplitModeUpdaterAction = {\n payload: {\n mapSplitMode: MapSplitMode;\n };\n};\n/**\n * Set map split mode (single, dual, or swipe)\n * @memberof mapStateActions\n * @param {Object} payload\n * @param {MapSplitMode} payload.mapSplitMode The split mode to set\n * @public\n */\nexport const setMapSplitMode: (payload: {\n mapSplitMode: MapSplitMode;\n}) => Merge<SetMapSplitModeUpdaterAction, {type: typeof ActionTypes.SET_MAP_SPLIT_MODE}> =\n createAction(ActionTypes.SET_MAP_SPLIT_MODE, (payload: {mapSplitMode: MapSplitMode}) => ({\n payload\n }));\n\nexport type SetSwipeComparePercentageUpdaterAction = {\n payload: {\n percentage: number;\n };\n};\n/**\n * Set the swipe compare divider position\n * @memberof mapStateActions\n * @param {Object} payload\n * @param {number} payload.percentage The percentage position (0-100)\n * @public\n */\nexport const setSwipeComparePercentage: (payload: {\n percentage: number;\n}) => Merge<\n SetSwipeComparePercentageUpdaterAction,\n {type: typeof ActionTypes.SET_SWIPE_COMPARE_PERCENTAGE}\n> = createAction(ActionTypes.SET_SWIPE_COMPARE_PERCENTAGE, (payload: {percentage: number}) => ({\n payload\n}));\n\n/**\n * This declaration is needed to group actions in docs\n */\n/**\n * Actions handled mostly by `mapState` reducer.\n * They manage map viewport update, toggle between 2d and 3d map,\n * toggle between single and split maps.\n *\n * @public\n */\n/* eslint-disable @typescript-eslint/no-unused-vars */\n// @ts-ignore\nconst mapStateActions = null;\n/* eslint-enable @typescript-eslint/no-unused-vars */\n"],"mappings":"AAAA;AACA;;AAEA,SAAQA,YAAY,QAAO,kBAAkB;AAC7C,SAAQC,OAAO,IAAIC,WAAW,QAAO,gBAAgB;AAKrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,iBAGZ,GAAGH,YAAY,CAACE,WAAW,CAACE,kBAAkB,CAAC;AAMhD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,SAG4D,GAAGL,YAAY,CACtFE,WAAW,CAACI,UAAU,EACtB,UAACC,MAAc,EAAEC,OAAyB;EAAA,OAAM;IAC9CC,OAAO,EAAEF,MAAM;IACfG,IAAI,EAAE;MAACF,OAAO,EAAPA;IAAO;EAChB,CAAC;AAAA,CACH,CAAC;AAGD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,IAAMG,SAG4D,GAAGX,YAAY,CACtFE,WAAW,CAACU,UAAU,EACtB,UAACC,QAAkB,EAAEC,QAAiB;EAAA,OAAM;IAC1CL,OAAO,EAAE;MACPI,QAAQ,EAARA,QAAQ;MACRC,QAAQ,EAARA;IACF;EACF,CAAC;AAAA,CACH,CAAC;AAMD;AACA;AACA;AACA;AACA;AACA;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BAKZ,GAAGhC,YAAY,CAACE,WAAW,CAAC+B,4BAA4B,EAAE,UAACxB,OAA6B;EAAA,OAAM;IAC7FA,OAAO,EAAPA;EACF,CAAC;AAAA,CAAC,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMyB,eAAe,GAAG,IAAI;AAC5B","ignoreList":[]}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// Copyright contributors to the kepler.gl project
|
|
3
|
+
|
|
4
|
+
import { createAction } from '@reduxjs/toolkit';
|
|
5
|
+
import { default as ActionTypes } from './action-types';
|
|
6
|
+
/**
|
|
7
|
+
* Add map style from user input to reducer and set it to current style
|
|
8
|
+
* This action is called when user click confirm after putting in a valid style url in the custom map style dialog.
|
|
9
|
+
* It should not be called from outside kepler.gl without a valid `inputStyle` in the `mapStyle` reducer.
|
|
10
|
+
* param {void}
|
|
11
|
+
* @memberof mapStyleActions
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export var addCustomMapStyle = createAction(ActionTypes.ADD_CUSTOM_MAP_STYLE);
|
|
15
|
+
/**
|
|
16
|
+
* Edit map style from user input to reducer.
|
|
17
|
+
* This action is called when user clicks confirm after editing an existing custom style in the custom map style dialog.
|
|
18
|
+
* It should not be called from outside kepler.gl without a valid `inputStyle` in the `mapStyle` reducer.
|
|
19
|
+
* param {void}
|
|
20
|
+
* @memberof mapStyleActions
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
export var editCustomMapStyle = createAction(ActionTypes.EDIT_CUSTOM_MAP_STYLE);
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Remove a custom map style from `state.mapStyle.mapStyles`.
|
|
27
|
+
* @param id
|
|
28
|
+
* @memberof mapStyleActions
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
export var removeCustomMapStyle = createAction(ActionTypes.REMOVE_CUSTOM_MAP_STYLE, function (_ref) {
|
|
32
|
+
var id = _ref.id;
|
|
33
|
+
return {
|
|
34
|
+
payload: {
|
|
35
|
+
id: id
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
/** INPUT_MAP_STYLE */
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Input a custom map style object
|
|
44
|
+
* @memberof mapStyleActions
|
|
45
|
+
* @param inputStyle
|
|
46
|
+
* @param inputStyle.url - style url e.g. `'mapbox://styles/heshan/xxxxxyyyyzzz'`
|
|
47
|
+
* @param inputStyle.id - style id e.g. `'custom_style_1'`
|
|
48
|
+
* @param inputStyle.style - actual mapbox style json
|
|
49
|
+
* @param inputStyle.label - style name
|
|
50
|
+
* @param inputStyle.accessToken - mapbox access token
|
|
51
|
+
* @param inputStyle.icon - icon image data url
|
|
52
|
+
* @param [mapState] - mapState is optional
|
|
53
|
+
* @public
|
|
54
|
+
*/
|
|
55
|
+
export var inputMapStyle = createAction(ActionTypes.INPUT_MAP_STYLE, function (inputStyle, mapState) {
|
|
56
|
+
return {
|
|
57
|
+
payload: {
|
|
58
|
+
inputStyle: inputStyle,
|
|
59
|
+
mapState: mapState
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
/** MAP_CONFIG_CHANGE */
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Update `visibleLayerGroups`to change layer group visibility
|
|
68
|
+
* @memberof mapStyleActions
|
|
69
|
+
* @param mapStyle new config `{visibleLayerGroups: {label: false, road: true, background: true}}`
|
|
70
|
+
* @public
|
|
71
|
+
*/
|
|
72
|
+
export var mapConfigChange = createAction(ActionTypes.MAP_CONFIG_CHANGE, function (mapStyle) {
|
|
73
|
+
return {
|
|
74
|
+
payload: mapStyle
|
|
75
|
+
};
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
/** REQUEST_MAP_STYLES */
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Request map style style object based on style.url.
|
|
82
|
+
* @memberof mapStyleActions
|
|
83
|
+
* @public
|
|
84
|
+
*/
|
|
85
|
+
export var requestMapStyles = createAction(ActionTypes.REQUEST_MAP_STYLES, function (mapStyles, onSuccess) {
|
|
86
|
+
return {
|
|
87
|
+
payload: {
|
|
88
|
+
mapStyles: mapStyles,
|
|
89
|
+
onSuccess: onSuccess
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
/** LOAD_MAP_STYLES */
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Callback when load map style success
|
|
98
|
+
* @memberof mapStyleActions
|
|
99
|
+
* @param newStyles a `{[id]: style}` mapping
|
|
100
|
+
* @public
|
|
101
|
+
*/
|
|
102
|
+
export var loadMapStyles = createAction(ActionTypes.LOAD_MAP_STYLES, function (newStyles, onSuccess) {
|
|
103
|
+
return {
|
|
104
|
+
payload: {
|
|
105
|
+
newStyles: newStyles,
|
|
106
|
+
onSuccess: onSuccess
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
/** LOAD_MAP_STYLE_ERR */
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Callback when load map style error
|
|
115
|
+
* @memberof mapStyleActions
|
|
116
|
+
* @param ids
|
|
117
|
+
* @param error
|
|
118
|
+
* @public
|
|
119
|
+
*/
|
|
120
|
+
export var loadMapStyleErr = createAction(ActionTypes.LOAD_MAP_STYLE_ERR, function (ids, error) {
|
|
121
|
+
return {
|
|
122
|
+
payload: {
|
|
123
|
+
ids: ids,
|
|
124
|
+
error: error
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
/** MAP_STYLE_CHANGE */
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Change to another map style. The selected style should already been loaded into `mapStyle.mapStyles`
|
|
133
|
+
* @memberof mapStyleActions
|
|
134
|
+
* @param styleType the style to change to
|
|
135
|
+
* @param onSuccess optional success callback function when an asynchronous basemap syle has loaded
|
|
136
|
+
* @public
|
|
137
|
+
*/
|
|
138
|
+
export var mapStyleChange = createAction(ActionTypes.MAP_STYLE_CHANGE, function (styleType, onSuccess) {
|
|
139
|
+
return {
|
|
140
|
+
payload: {
|
|
141
|
+
styleType: styleType,
|
|
142
|
+
onSuccess: onSuccess
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
/** LOAD_CUSTOM_MAP_STYLE */
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Callback when a custom map style object is received
|
|
151
|
+
* @memberof mapStyleActions
|
|
152
|
+
* @param customMapStyle
|
|
153
|
+
* @param customMapStyle.icon
|
|
154
|
+
* @param customMapStyle.style
|
|
155
|
+
* @param customMapStyle.error
|
|
156
|
+
* @public
|
|
157
|
+
*/
|
|
158
|
+
export var loadCustomMapStyle = createAction(ActionTypes.LOAD_CUSTOM_MAP_STYLE, function (customMapStyle) {
|
|
159
|
+
return {
|
|
160
|
+
payload: customMapStyle
|
|
161
|
+
};
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
/** SET_3D_BUILDING_COLOR */
|
|
165
|
+
|
|
166
|
+
// SET_3D_BUILDING_COLOR
|
|
167
|
+
/**
|
|
168
|
+
* Set 3d building layer group color
|
|
169
|
+
* @memberof mapStyleActions
|
|
170
|
+
* @param color - [r, g, b]
|
|
171
|
+
* @public
|
|
172
|
+
*/
|
|
173
|
+
export var set3dBuildingColor = createAction(ActionTypes.SET_3D_BUILDING_COLOR, function (color) {
|
|
174
|
+
return {
|
|
175
|
+
payload: color
|
|
176
|
+
};
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
/** SET_BACKGROUND_COLOR */
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Set background color
|
|
183
|
+
* @memberof mapStyleActions
|
|
184
|
+
* @param color - [r, g, b]
|
|
185
|
+
* @public
|
|
186
|
+
*/
|
|
187
|
+
export var setBackgroundColor = createAction(ActionTypes.SET_BACKGROUND_COLOR, function (color) {
|
|
188
|
+
return {
|
|
189
|
+
payload: color
|
|
190
|
+
};
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Actions handled mostly by `mapStyle` reducer.
|
|
195
|
+
* They manage the display of base map, such as loading and receiving base map styles,
|
|
196
|
+
* hiding and showing map layers, user input of custom map style url.
|
|
197
|
+
*
|
|
198
|
+
* @public
|
|
199
|
+
*/
|
|
200
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
201
|
+
// @ts-ignore
|
|
202
|
+
var mapStyleActions = null;
|
|
203
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
204
|
+
//# sourceMappingURL=map-style-actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map-style-actions.js","names":["createAction","default","ActionTypes","addCustomMapStyle","ADD_CUSTOM_MAP_STYLE","editCustomMapStyle","EDIT_CUSTOM_MAP_STYLE","removeCustomMapStyle","REMOVE_CUSTOM_MAP_STYLE","_ref","id","payload","inputMapStyle","INPUT_MAP_STYLE","inputStyle","mapState","mapConfigChange","MAP_CONFIG_CHANGE","mapStyle","requestMapStyles","REQUEST_MAP_STYLES","mapStyles","onSuccess","loadMapStyles","LOAD_MAP_STYLES","newStyles","loadMapStyleErr","LOAD_MAP_STYLE_ERR","ids","error","mapStyleChange","MAP_STYLE_CHANGE","styleType","loadCustomMapStyle","LOAD_CUSTOM_MAP_STYLE","customMapStyle","set3dBuildingColor","SET_3D_BUILDING_COLOR","color","setBackgroundColor","SET_BACKGROUND_COLOR","mapStyleActions"],"sources":["../../src/map-style-actions.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright contributors to the kepler.gl project\n\nimport {createAction} from '@reduxjs/toolkit';\nimport {default as ActionTypes} from './action-types';\nimport {\n InputStyle,\n MapStyles,\n Merge,\n RGBColor,\n MapState,\n VisibleLayerGroups,\n LayerGroup\n} from '@kepler.gl/types';\n\n/**\n * Add map style from user input to reducer and set it to current style\n * This action is called when user click confirm after putting in a valid style url in the custom map style dialog.\n * It should not be called from outside kepler.gl without a valid `inputStyle` in the `mapStyle` reducer.\n * param {void}\n * @memberof mapStyleActions\n * @public\n */\nexport const addCustomMapStyle: () => {\n type: typeof ActionTypes.ADD_CUSTOM_MAP_STYLE;\n} = createAction(ActionTypes.ADD_CUSTOM_MAP_STYLE);\n\nexport type RemoveCustomMapStyleUpdaterAction = {\n payload: {\n id: string;\n };\n};\n\n/**\n * Edit map style from user input to reducer.\n * This action is called when user clicks confirm after editing an existing custom style in the custom map style dialog.\n * It should not be called from outside kepler.gl without a valid `inputStyle` in the `mapStyle` reducer.\n * param {void}\n * @memberof mapStyleActions\n * @public\n */\nexport const editCustomMapStyle: () => {\n type: typeof ActionTypes.EDIT_CUSTOM_MAP_STYLE;\n} = createAction(ActionTypes.EDIT_CUSTOM_MAP_STYLE);\n\n/**\n * Remove a custom map style from `state.mapStyle.mapStyles`.\n * @param id\n * @memberof mapStyleActions\n * @public\n */\nexport const removeCustomMapStyle: ({\n id\n}: RemoveCustomMapStyleUpdaterAction['payload']) => Merge<\n RemoveCustomMapStyleUpdaterAction,\n {type: typeof ActionTypes.REMOVE_CUSTOM_MAP_STYLE}\n> = createAction(ActionTypes.REMOVE_CUSTOM_MAP_STYLE, ({id}) => {\n return {\n payload: {\n id\n }\n };\n});\n\n/** INPUT_MAP_STYLE */\nexport type InputMapStyleUpdaterAction = {\n payload: {\n inputStyle: Partial<InputStyle>;\n mapState?: MapState;\n };\n};\n/**\n * Input a custom map style object\n * @memberof mapStyleActions\n * @param inputStyle\n * @param inputStyle.url - style url e.g. `'mapbox://styles/heshan/xxxxxyyyyzzz'`\n * @param inputStyle.id - style id e.g. `'custom_style_1'`\n * @param inputStyle.style - actual mapbox style json\n * @param inputStyle.label - style name\n * @param inputStyle.accessToken - mapbox access token\n * @param inputStyle.icon - icon image data url\n * @param [mapState] - mapState is optional\n * @public\n */\nexport const inputMapStyle: (\n inputStyle: InputMapStyleUpdaterAction['payload']['inputStyle'],\n mapState?: InputMapStyleUpdaterAction['payload']['mapState']\n) => Merge<InputMapStyleUpdaterAction, {type: typeof ActionTypes.INPUT_MAP_STYLE}> = createAction(\n ActionTypes.INPUT_MAP_STYLE,\n (\n inputStyle: InputMapStyleUpdaterAction['payload']['inputStyle'],\n mapState: InputMapStyleUpdaterAction['payload']['mapState']\n ) => ({\n payload: {\n inputStyle,\n mapState\n }\n })\n);\n\n/** MAP_CONFIG_CHANGE */\nexport type MapConfigChangeUpdaterAction = {\n payload: {\n visibleLayerGroups?: VisibleLayerGroups;\n topLayerGroups?: VisibleLayerGroups;\n };\n};\n/**\n * Update `visibleLayerGroups`to change layer group visibility\n * @memberof mapStyleActions\n * @param mapStyle new config `{visibleLayerGroups: {label: false, road: true, background: true}}`\n * @public\n */\nexport const mapConfigChange: (\n mapStyle: MapConfigChangeUpdaterAction['payload']\n) => Merge<MapConfigChangeUpdaterAction, {type: typeof ActionTypes.MAP_CONFIG_CHANGE}> =\n createAction(\n ActionTypes.MAP_CONFIG_CHANGE,\n (mapStyle: MapConfigChangeUpdaterAction['payload']) => ({payload: mapStyle})\n );\n\ntype OnLoadMapStyleSuccessCallback = (payload: {styleType: string}) => any;\n\n/** REQUEST_MAP_STYLES */\nexport type RequestMapStylesUpdaterAction = {\n payload: {\n mapStyles: {\n [key: string]: {\n id: string;\n label?: string;\n url: string;\n icon?: string;\n layerGroups?: LayerGroup[];\n };\n };\n onSuccess?: OnLoadMapStyleSuccessCallback;\n };\n};\n/**\n * Request map style style object based on style.url.\n * @memberof mapStyleActions\n * @public\n */\nexport const requestMapStyles: (\n mapStyles: RequestMapStylesUpdaterAction['payload']['mapStyles'],\n onSuccess?: RequestMapStylesUpdaterAction['payload']['onSuccess']\n) => Merge<RequestMapStylesUpdaterAction, {type: typeof ActionTypes.REQUEST_MAP_STYLES}> =\n createAction(\n ActionTypes.REQUEST_MAP_STYLES,\n (\n mapStyles: RequestMapStylesUpdaterAction['payload']['mapStyles'],\n onSuccess?: RequestMapStylesUpdaterAction['payload']['onSuccess']\n ) => ({payload: {mapStyles, onSuccess}})\n );\n\n/** LOAD_MAP_STYLES */\nexport type LoadMapStylesUpdaterAction = {\n payload: {\n newStyles: MapStyles;\n onSuccess?: OnLoadMapStyleSuccessCallback;\n };\n};\n/**\n * Callback when load map style success\n * @memberof mapStyleActions\n * @param newStyles a `{[id]: style}` mapping\n * @public\n */\nexport const loadMapStyles: (\n newStyles: LoadMapStylesUpdaterAction['payload']['newStyles'],\n onSuccess?: LoadMapStylesUpdaterAction['payload']['onSuccess']\n) => Merge<LoadMapStylesUpdaterAction, {type: typeof ActionTypes.LOAD_MAP_STYLES}> = createAction(\n ActionTypes.LOAD_MAP_STYLES,\n (\n newStyles: LoadMapStylesUpdaterAction['payload']['newStyles'],\n onSuccess?: LoadMapStylesUpdaterAction['payload']['onSuccess']\n ) => ({payload: {newStyles, onSuccess}})\n);\n\n/** LOAD_MAP_STYLE_ERR */\nexport type LoadMapStyleErrUpdaterAction = {\n payload: {\n ids: string[];\n error: Error;\n };\n};\n/**\n * Callback when load map style error\n * @memberof mapStyleActions\n * @param ids\n * @param error\n * @public\n */\nexport const loadMapStyleErr: (\n ids: LoadMapStyleErrUpdaterAction['payload']['ids'],\n error: LoadMapStyleErrUpdaterAction['payload']['error']\n) => Merge<LoadMapStyleErrUpdaterAction, {type: typeof ActionTypes.LOAD_MAP_STYLE_ERR}> =\n createAction(\n ActionTypes.LOAD_MAP_STYLE_ERR,\n (\n ids: LoadMapStyleErrUpdaterAction['payload']['ids'],\n error: LoadMapStyleErrUpdaterAction['payload']['error']\n ) => ({payload: {ids, error}})\n );\n\n/** MAP_STYLE_CHANGE */\nexport type MapStyleChangeUpdaterAction = {\n payload: {\n styleType: string;\n onSuccess?: OnLoadMapStyleSuccessCallback;\n };\n};\n/**\n * Change to another map style. The selected style should already been loaded into `mapStyle.mapStyles`\n * @memberof mapStyleActions\n * @param styleType the style to change to\n * @param onSuccess optional success callback function when an asynchronous basemap syle has loaded\n * @public\n */\nexport const mapStyleChange: (\n styleType: MapStyleChangeUpdaterAction['payload']['styleType'],\n onSuccess?: MapStyleChangeUpdaterAction['payload']['onSuccess']\n) => Merge<MapStyleChangeUpdaterAction, {type: typeof ActionTypes.MAP_STYLE_CHANGE}> = createAction(\n ActionTypes.MAP_STYLE_CHANGE,\n (\n styleType: MapStyleChangeUpdaterAction['payload']['styleType'],\n onSuccess?: MapStyleChangeUpdaterAction['payload']['onSuccess']\n ) => ({payload: {styleType, onSuccess}})\n);\n\n/** LOAD_CUSTOM_MAP_STYLE */\nexport type LoadCustomMapStyleUpdaterAction = {\n payload: {\n icon?: string;\n style?: object;\n error?: object | boolean;\n };\n};\n/**\n * Callback when a custom map style object is received\n * @memberof mapStyleActions\n * @param customMapStyle\n * @param customMapStyle.icon\n * @param customMapStyle.style\n * @param customMapStyle.error\n * @public\n */\nexport const loadCustomMapStyle: (\n customMapStyle: LoadCustomMapStyleUpdaterAction['payload']\n) => Merge<LoadCustomMapStyleUpdaterAction, {type: typeof ActionTypes.LOAD_CUSTOM_MAP_STYLE}> =\n createAction(\n ActionTypes.LOAD_CUSTOM_MAP_STYLE,\n (customMapStyle: LoadCustomMapStyleUpdaterAction['payload']) => ({payload: customMapStyle})\n );\n\n/** SET_3D_BUILDING_COLOR */\nexport type Set3dBuildingColorUpdaterAction = {\n payload: RGBColor;\n};\n// SET_3D_BUILDING_COLOR\n/**\n * Set 3d building layer group color\n * @memberof mapStyleActions\n * @param color - [r, g, b]\n * @public\n */\nexport const set3dBuildingColor: (\n color: Set3dBuildingColorUpdaterAction['payload']\n) => Merge<Set3dBuildingColorUpdaterAction, {type: typeof ActionTypes.SET_3D_BUILDING_COLOR}> =\n createAction(\n ActionTypes.SET_3D_BUILDING_COLOR,\n (color: Set3dBuildingColorUpdaterAction['payload']) => ({payload: color})\n );\n\n/** SET_BACKGROUND_COLOR */\nexport type SetBackgroundColorUpdaterAction = {\n payload: RGBColor;\n};\n\n/**\n * Set background color\n * @memberof mapStyleActions\n * @param color - [r, g, b]\n * @public\n */\nexport const setBackgroundColor: (\n color: SetBackgroundColorUpdaterAction['payload']\n) => Merge<SetBackgroundColorUpdaterAction, {type: typeof ActionTypes.SET_BACKGROUND_COLOR}> =\n createAction(ActionTypes.SET_BACKGROUND_COLOR, (color: RGBColor) => ({payload: color}));\n\n/**\n * Actions handled mostly by `mapStyle` reducer.\n * They manage the display of base map, such as loading and receiving base map styles,\n * hiding and showing map layers, user input of custom map style url.\n *\n * @public\n */\n/* eslint-disable @typescript-eslint/no-unused-vars */\n// @ts-ignore\nconst mapStyleActions = null;\n/* eslint-enable @typescript-eslint/no-unused-vars */\n"],"mappings":"AAAA;AACA;;AAEA,SAAQA,YAAY,QAAO,kBAAkB;AAC7C,SAAQC,OAAO,IAAIC,WAAW,QAAO,gBAAgB;AAWrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,iBAEZ,GAAGH,YAAY,CAACE,WAAW,CAACE,oBAAoB,CAAC;AAQlD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,kBAEZ,GAAGL,YAAY,CAACE,WAAW,CAACI,qBAAqB,CAAC;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,oBAKZ,GAAGP,YAAY,CAACE,WAAW,CAACM,uBAAuB,EAAE,UAAAC,IAAA,EAAU;EAAA,IAARC,EAAE,GAAAD,IAAA,CAAFC,EAAE;EACxD,OAAO;IACLC,OAAO,EAAE;MACPD,EAAE,EAAFA;IACF;EACF,CAAC;AACH,CAAC,CAAC;;AAEF;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAME,aAGqE,GAAGZ,YAAY,CAC/FE,WAAW,CAACW,eAAe,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,SAA+D;EAAA,OAC3D;IAACX,OAAO,EAAE;MAACqB,SAAS,EAATA,SAAS;MAAEV,SAAS,EAATA;IAAS;EAAC,CAAC;AAAA,CACzC,CAAC;;AAED;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMW,kBAEgF,GAC3FjC,YAAY,CACVE,WAAW,CAACgC,qBAAqB,EACjC,UAACC,cAA0D;EAAA,OAAM;IAACxB,OAAO,EAAEwB;EAAc,CAAC;AAAA,CAC5F,CAAC;;AAEH;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,kBAEgF,GAC3FpC,YAAY,CACVE,WAAW,CAACmC,qBAAqB,EACjC,UAACC,KAAiD;EAAA,OAAM;IAAC3B,OAAO,EAAE2B;EAAK,CAAC;AAAA,CAC1E,CAAC;;AAEH;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,kBAE+E,GAC1FvC,YAAY,CAACE,WAAW,CAACsC,oBAAoB,EAAE,UAACF,KAAe;EAAA,OAAM;IAAC3B,OAAO,EAAE2B;EAAK,CAAC;AAAA,CAAC,CAAC;;AAEzF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMG,eAAe,GAAG,IAAI;AAC5B","ignoreList":[]}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// Copyright contributors to the kepler.gl project
|
|
3
|
+
|
|
4
|
+
import { createAction } from '@reduxjs/toolkit';
|
|
5
|
+
import { ACTION_PREFIX } from './action-types';
|
|
6
|
+
// eslint-disable-next-line prettier/prettier
|
|
7
|
+
var assignType = function assignType(obj) {
|
|
8
|
+
return obj;
|
|
9
|
+
};
|
|
10
|
+
export var ActionTypes = assignType({
|
|
11
|
+
EXPORT_FILE_TO_CLOUD: "".concat(ACTION_PREFIX, "EXPORT_FILE_TO_CLOUD"),
|
|
12
|
+
EXPORT_FILE_SUCCESS: "".concat(ACTION_PREFIX, "EXPORT_FILE_SUCCESS"),
|
|
13
|
+
EXPORT_FILE_ERROR: "".concat(ACTION_PREFIX, "EXPORT_FILE_ERROR"),
|
|
14
|
+
RESET_PROVIDER_STATUS: "".concat(ACTION_PREFIX, "RESET_PROVIDER_STATUS"),
|
|
15
|
+
POST_SAVE_LOAD_SUCCESS: "".concat(ACTION_PREFIX, "POST_SAVE_LOAD_SUCCESS"),
|
|
16
|
+
LOAD_CLOUD_MAP: "".concat(ACTION_PREFIX, "LOAD_CLOUD_MAP"),
|
|
17
|
+
LOAD_CLOUD_MAP_SUCCESS: "".concat(ACTION_PREFIX, "LOAD_CLOUD_MAP_SUCCESS"),
|
|
18
|
+
LOAD_CLOUD_MAP_SUCCESS_2: "".concat(ACTION_PREFIX, "LOAD_CLOUD_MAP_SUCCESS_2"),
|
|
19
|
+
LOAD_CLOUD_MAP_ERROR: "".concat(ACTION_PREFIX, "LOAD_CLOUD_MAP_ERROR")
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Call provider to upload file to cloud
|
|
24
|
+
* @param mapData
|
|
25
|
+
* @param provider
|
|
26
|
+
* @param options
|
|
27
|
+
* @param onSuccess
|
|
28
|
+
* @param onError
|
|
29
|
+
* @param closeModal
|
|
30
|
+
*/
|
|
31
|
+
export var exportFileToCloud = createAction(ActionTypes.EXPORT_FILE_TO_CLOUD, function (payload) {
|
|
32
|
+
return {
|
|
33
|
+
payload: payload
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
/** EXPORT_FILE_SUCCESS */
|
|
38
|
+
|
|
39
|
+
export var exportFileSuccess = createAction(ActionTypes.EXPORT_FILE_SUCCESS, function (payload) {
|
|
40
|
+
return {
|
|
41
|
+
payload: payload
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
/** EXPORT_FILE_ERROR */
|
|
46
|
+
|
|
47
|
+
export var exportFileError = createAction(ActionTypes.EXPORT_FILE_ERROR, function (payload) {
|
|
48
|
+
return {
|
|
49
|
+
payload: payload
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
/** POST_SAVE_LOAD_SUCCESS */
|
|
54
|
+
|
|
55
|
+
export var postSaveLoadSuccess = createAction(ActionTypes.POST_SAVE_LOAD_SUCCESS, function (message) {
|
|
56
|
+
return {
|
|
57
|
+
payload: message
|
|
58
|
+
};
|
|
59
|
+
});
|
|
60
|
+
export var resetProviderStatus = createAction(ActionTypes.RESET_PROVIDER_STATUS);
|
|
61
|
+
|
|
62
|
+
/** LOAD_CLOUD_MAP */
|
|
63
|
+
|
|
64
|
+
export var loadCloudMap = createAction(ActionTypes.LOAD_CLOUD_MAP, function (payload) {
|
|
65
|
+
return {
|
|
66
|
+
payload: payload
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
/** LOAD_CLOUD_MAP_SUCCESS */
|
|
71
|
+
|
|
72
|
+
export var loadCloudMapSuccess = createAction(ActionTypes.LOAD_CLOUD_MAP_SUCCESS, function (payload) {
|
|
73
|
+
return {
|
|
74
|
+
payload: payload
|
|
75
|
+
};
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
/** LOAD_CLOUD_MAP_SUCCESS_2 */
|
|
79
|
+
|
|
80
|
+
export var loadCloudMapSuccess2 = createAction(ActionTypes.LOAD_CLOUD_MAP_SUCCESS_2, function (payload) {
|
|
81
|
+
return {
|
|
82
|
+
payload: payload
|
|
83
|
+
};
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
/** LOAD_CLOUD_MAP_ERROR */
|
|
87
|
+
|
|
88
|
+
export var loadCloudMapError = createAction(ActionTypes.LOAD_CLOUD_MAP_ERROR, function (payload) {
|
|
89
|
+
return {
|
|
90
|
+
payload: payload
|
|
91
|
+
};
|
|
92
|
+
});
|
|
93
|
+
//# sourceMappingURL=provider-actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-actions.js","names":["createAction","ACTION_PREFIX","assignType","obj","ActionTypes","EXPORT_FILE_TO_CLOUD","concat","EXPORT_FILE_SUCCESS","EXPORT_FILE_ERROR","RESET_PROVIDER_STATUS","POST_SAVE_LOAD_SUCCESS","LOAD_CLOUD_MAP","LOAD_CLOUD_MAP_SUCCESS","LOAD_CLOUD_MAP_SUCCESS_2","LOAD_CLOUD_MAP_ERROR","exportFileToCloud","payload","exportFileSuccess","exportFileError","postSaveLoadSuccess","message","resetProviderStatus","loadCloudMap","loadCloudMapSuccess","loadCloudMapSuccess2","loadCloudMapError"],"sources":["../../src/provider-actions.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright contributors to the kepler.gl project\n\nimport {createAction} from '@reduxjs/toolkit';\nimport {ACTION_PREFIX} from './action-types';\nimport {\n ExportFileOptions,\n ExportFileToCloudPayload,\n OnErrorCallBack,\n OnSuccessCallBack\n} from '@kepler.gl/types';\nimport {Provider} from '@kepler.gl/cloud-providers';\n\n// eslint-disable-next-line prettier/prettier\nconst assignType = <T>(obj: T): {[K in keyof T]: `${typeof ACTION_PREFIX}${string & K}`} =>\n obj as any;\nexport const ActionTypes = assignType({\n EXPORT_FILE_TO_CLOUD: `${ACTION_PREFIX}EXPORT_FILE_TO_CLOUD`,\n EXPORT_FILE_SUCCESS: `${ACTION_PREFIX}EXPORT_FILE_SUCCESS`,\n EXPORT_FILE_ERROR: `${ACTION_PREFIX}EXPORT_FILE_ERROR`,\n RESET_PROVIDER_STATUS: `${ACTION_PREFIX}RESET_PROVIDER_STATUS`,\n POST_SAVE_LOAD_SUCCESS: `${ACTION_PREFIX}POST_SAVE_LOAD_SUCCESS`,\n LOAD_CLOUD_MAP: `${ACTION_PREFIX}LOAD_CLOUD_MAP`,\n LOAD_CLOUD_MAP_SUCCESS: `${ACTION_PREFIX}LOAD_CLOUD_MAP_SUCCESS`,\n LOAD_CLOUD_MAP_SUCCESS_2: `${ACTION_PREFIX}LOAD_CLOUD_MAP_SUCCESS_2`,\n LOAD_CLOUD_MAP_ERROR: `${ACTION_PREFIX}LOAD_CLOUD_MAP_ERROR`\n});\n\n/**\n * Call provider to upload file to cloud\n * @param mapData\n * @param provider\n * @param options\n * @param onSuccess\n * @param onError\n * @param closeModal\n */\nexport const exportFileToCloud: (p: ExportFileToCloudPayload) => {\n type: typeof ActionTypes.EXPORT_FILE_TO_CLOUD;\n payload: ExportFileToCloudPayload;\n} = createAction(ActionTypes.EXPORT_FILE_TO_CLOUD, (payload: ExportFileToCloudPayload) => ({\n payload\n}));\n\n/** EXPORT_FILE_SUCCESS */\nexport type ExportFileSuccessPayload = {\n response: any;\n provider: Provider;\n options?: ExportFileOptions;\n onSuccess?: OnSuccessCallBack;\n closeModal?: boolean;\n};\n\nexport const exportFileSuccess: (p: ExportFileSuccessPayload) => {\n type: typeof ActionTypes.EXPORT_FILE_SUCCESS;\n payload: ExportFileSuccessPayload;\n} = createAction(ActionTypes.EXPORT_FILE_SUCCESS, (payload: ExportFileSuccessPayload) => ({\n payload\n}));\n\n/** EXPORT_FILE_ERROR */\nexport type ExportFileErrorPayload = {\n error: any;\n provider: Provider;\n options?: ExportFileOptions;\n onError?: OnErrorCallBack;\n};\n\nexport const exportFileError: (p: ExportFileErrorPayload) => {\n type: typeof ActionTypes.EXPORT_FILE_ERROR;\n payload: ExportFileErrorPayload;\n} = createAction(ActionTypes.EXPORT_FILE_ERROR, (payload: ExportFileErrorPayload) => ({payload}));\n\n/** POST_SAVE_LOAD_SUCCESS */\nexport type PostSaveLoadSuccessPayload = string;\nexport const postSaveLoadSuccess: (p: PostSaveLoadSuccessPayload) => {\n type: typeof ActionTypes.POST_SAVE_LOAD_SUCCESS;\n payload: PostSaveLoadSuccessPayload;\n} = createAction(ActionTypes.POST_SAVE_LOAD_SUCCESS, (message: PostSaveLoadSuccessPayload) => ({\n payload: message\n}));\n\nexport const resetProviderStatus: () => {\n type: typeof ActionTypes.RESET_PROVIDER_STATUS;\n} = createAction(ActionTypes.RESET_PROVIDER_STATUS);\n\n/** LOAD_CLOUD_MAP */\nexport type LoadCloudMapPayload = {\n loadParams: any;\n provider: string;\n onSuccess?: any;\n onError?: OnErrorCallBack;\n};\nexport const loadCloudMap: (p: LoadCloudMapPayload) => {\n type: typeof ActionTypes.LOAD_CLOUD_MAP;\n payload: LoadCloudMapPayload;\n} = createAction(ActionTypes.LOAD_CLOUD_MAP, payload => ({payload}));\n\n/** LOAD_CLOUD_MAP_SUCCESS */\ntype LoadCloudMapSuccessCallback = (p: {response: any; loadParams: any; provider: Provider}) => any;\nexport type LoadCloudMapSuccessPayload = {\n response: any;\n loadParams: any;\n provider: Provider;\n onSuccess?: LoadCloudMapSuccessCallback;\n onError?: OnErrorCallBack;\n};\nexport const loadCloudMapSuccess: (p: LoadCloudMapSuccessPayload) => {\n type: typeof ActionTypes.LOAD_CLOUD_MAP_SUCCESS;\n payload: LoadCloudMapSuccessPayload;\n} = createAction(ActionTypes.LOAD_CLOUD_MAP_SUCCESS, (payload: LoadCloudMapSuccessPayload) => ({\n payload\n}));\n\n/** LOAD_CLOUD_MAP_SUCCESS_2 */\nexport type LoadCloudMapSuccess2Payload = LoadCloudMapSuccessPayload & {\n datasetsPayload: any;\n};\nexport const loadCloudMapSuccess2: (p: LoadCloudMapSuccess2Payload) => {\n type: typeof ActionTypes.LOAD_CLOUD_MAP_SUCCESS_2;\n payload: LoadCloudMapSuccess2Payload;\n} = createAction(ActionTypes.LOAD_CLOUD_MAP_SUCCESS_2, (payload: LoadCloudMapSuccess2Payload) => ({\n payload\n}));\n\n/** LOAD_CLOUD_MAP_ERROR */\nexport type LoadCloudMapErrorPayload = {\n error: any;\n provider: Provider;\n onError?: OnErrorCallBack;\n};\nexport const loadCloudMapError: (p: LoadCloudMapErrorPayload) => {\n type: typeof ActionTypes.LOAD_CLOUD_MAP_ERROR;\n payload: LoadCloudMapErrorPayload;\n} = createAction(ActionTypes.LOAD_CLOUD_MAP_ERROR, (payload: LoadCloudMapErrorPayload) => ({\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