@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.
Files changed (57) hide show
  1. package/dist/action-types.d.ts +103 -1
  2. package/dist/action-wrapper.d.ts +22 -17
  3. package/dist/actions.d.ts +13 -0
  4. package/dist/cjs/action-types.js +266 -0
  5. package/dist/cjs/action-types.js.map +1 -0
  6. package/dist/cjs/action-wrapper.js +177 -0
  7. package/dist/cjs/action-wrapper.js.map +1 -0
  8. package/dist/cjs/actions.js +193 -0
  9. package/dist/cjs/actions.js.map +1 -0
  10. package/dist/cjs/identity-actions.js +86 -0
  11. package/dist/cjs/identity-actions.js.map +1 -0
  12. package/dist/cjs/index.js +182 -0
  13. package/dist/cjs/index.js.map +1 -0
  14. package/dist/cjs/map-state-actions.js +174 -0
  15. package/dist/cjs/map-state-actions.js.map +1 -0
  16. package/dist/cjs/map-style-actions.js +211 -0
  17. package/dist/cjs/map-style-actions.js.map +1 -0
  18. package/dist/cjs/provider-actions.js +99 -0
  19. package/dist/cjs/provider-actions.js.map +1 -0
  20. package/dist/cjs/ui-state-actions.js +463 -0
  21. package/dist/cjs/ui-state-actions.js.map +1 -0
  22. package/dist/cjs/vis-state-actions.js +1859 -0
  23. package/dist/cjs/vis-state-actions.js.map +1 -0
  24. package/dist/esm/action-types.js +260 -0
  25. package/dist/esm/action-types.js.map +1 -0
  26. package/dist/esm/action-wrapper.js +171 -0
  27. package/dist/esm/action-wrapper.js.map +1 -0
  28. package/dist/esm/actions.js +186 -0
  29. package/dist/esm/actions.js.map +1 -0
  30. package/dist/esm/identity-actions.js +79 -0
  31. package/dist/esm/identity-actions.js.map +1 -0
  32. package/dist/esm/index.js +27 -0
  33. package/dist/esm/index.js.map +1 -0
  34. package/dist/esm/map-state-actions.js +167 -0
  35. package/dist/esm/map-state-actions.js.map +1 -0
  36. package/dist/esm/map-style-actions.js +204 -0
  37. package/dist/esm/map-style-actions.js.map +1 -0
  38. package/dist/esm/provider-actions.js +93 -0
  39. package/dist/esm/provider-actions.js.map +1 -0
  40. package/dist/esm/ui-state-actions.js +456 -0
  41. package/dist/esm/ui-state-actions.js.map +1 -0
  42. package/dist/esm/vis-state-actions.js +1728 -0
  43. package/dist/esm/vis-state-actions.js.map +1 -0
  44. package/dist/map-state-actions.d.ts +51 -3
  45. package/dist/ui-state-actions.d.ts +77 -2
  46. package/dist/vis-state-actions.d.ts +573 -21
  47. package/package.json +25 -22
  48. package/dist/action-types.js +0 -213
  49. package/dist/action-wrapper.js +0 -174
  50. package/dist/actions.js +0 -187
  51. package/dist/identity-actions.js +0 -86
  52. package/dist/index.js +0 -183
  53. package/dist/map-state-actions.js +0 -129
  54. package/dist/map-style-actions.js +0 -211
  55. package/dist/provider-actions.js +0 -99
  56. package/dist/ui-state-actions.js +0 -388
  57. package/dist/vis-state-actions.js +0 -1299
@@ -0,0 +1,171 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ // SPDX-License-Identifier: MIT
5
+ // Copyright contributors to the kepler.gl project
6
+
7
+ export var FORWARD = '@redux-forward/FORWARD';
8
+ export var ADDRESS_PREFIX = '@@KG_';
9
+ import curry from 'es-toolkit/compat/curry';
10
+ export var getActionForwardAddress = function getActionForwardAddress(id) {
11
+ return "".concat(ADDRESS_PREFIX).concat(id.toUpperCase());
12
+ };
13
+ function wrapToImpl(id, action) {
14
+ return {
15
+ // keep original action.type
16
+ type: action.type,
17
+ // actual action
18
+ payload: _objectSpread(_objectSpread({}, action), {}, {
19
+ meta: _objectSpread(_objectSpread({}, action.meta), {}, {
20
+ _id_: id
21
+ })
22
+ }),
23
+ // add forward signature to meta
24
+ meta: _objectSpread(_objectSpread({}, action.meta || {}), {}, {
25
+ _forward_: FORWARD,
26
+ _addr_: getActionForwardAddress(id)
27
+ })
28
+ };
29
+ }
30
+
31
+ // Explicit type so declaration emit does not need es-toolkit's unexported CurriedFunction2.
32
+
33
+ /**
34
+ * Wrap an action into a forward action that only modify the state of a specific
35
+ * kepler.gl instance. kepler.gl reducer will look for signatures in the action to
36
+ * determine whether it needs to be forwarded to a specific instance reducer.
37
+ *
38
+ * wrapTo can be curried. You can create a curried action wrapper by only supply the `id` argument
39
+ *
40
+ * A forward action looks like this
41
+ * ```js
42
+ * {
43
+ * type: "@@kepler.gl/LAYER_CONFIG_CHANGE",
44
+ * payload: {
45
+ * type: '@@kepler.gl/LAYER_CONFIG_CHANGE',
46
+ * payload: {},
47
+ * meta: {
48
+ * // id of instance
49
+ * _id_: id
50
+ * // other meta
51
+ * }
52
+ * },
53
+ * meta: {
54
+ * _forward_: '@redux-forward/FORWARD',
55
+ * _addr_: '@@KG_id'
56
+ * }
57
+ * };
58
+ * ```
59
+ *
60
+ * @memberof forwardActions
61
+ * @param {string} id - The id to forward to
62
+ * @param {Object} action - the action object {type: string, payload: *}
63
+ * @returns {{type: string, payload: {type: string, payload: *, meta: {_id_: string}, meta: {_forward_: string, _addr_: string}}}}
64
+ * @public
65
+ * @example
66
+ *
67
+ * import {wrapTo, togglePerspective} from '@kepler.gl/actions';
68
+ *
69
+ * // This action will only dispatch to the KeplerGl instance with `id: map_1`
70
+ * this.props.dispatch(wrapTo('map_1', togglePerspective()));
71
+ *
72
+ * // You can also create a curried action for each instance
73
+ * const wrapToMap1 = wrapTo('map_1');
74
+ * this.props.dispatch(wrapToMap1(togglePerspective()));
75
+ */
76
+ export var wrapTo = curry(wrapToImpl);
77
+
78
+ /**
79
+ * Whether an action is a forward action
80
+ * @memberof forwardActions
81
+ * @param {Object} action - the action object
82
+ * @returns {boolean} boolean - whether the action is a forward action
83
+ * @public
84
+ */
85
+ export var isForwardAction = function isForwardAction(action) {
86
+ return Boolean(action && action.meta && action.meta._forward_ === FORWARD);
87
+ };
88
+
89
+ /**
90
+ * Unwrap an action
91
+ * @memberof forwardActions
92
+ * @param {Object} action - the action object
93
+ * @returns {Object} - unwrapped action
94
+ * @public
95
+ */
96
+ var _unwrap = function unwrap(action) {
97
+ return isForwardAction(action) ? _unwrap(action.payload) : action;
98
+ };
99
+
100
+ /**
101
+ * Given an id, returns the action for that id.
102
+ * If the action is not a forward action, return the action
103
+ * @memberof forwardActions
104
+ * @param {String} id
105
+ * @param {Object} action
106
+ * @private
107
+ */
108
+ export { _unwrap as unwrap };
109
+ export var _actionFor = function _actionFor(id, action) {
110
+ var _action$meta;
111
+ return isForwardAction(action) ? ((_action$meta = action.meta) === null || _action$meta === void 0 ? void 0 : _action$meta._addr_) === getActionForwardAddress(id) ? action.payload : {} : action;
112
+ };
113
+
114
+ /**
115
+ * Returns an action dispatcher that wraps and forwards the actions to a specific instance
116
+ * @memberof forwardActions
117
+ * @param {string} id - instance id
118
+ * @param {Function} dispatch - action dispatcher
119
+ * @public
120
+ * @example
121
+ *
122
+ * // action and forward dispatcher
123
+ * import {toggleSplitMap, forwardTo} from '@kepler.gl/actions';
124
+ * import {connect} from 'react-redux';
125
+ *
126
+ * const MapContainer = props => (
127
+ * <div>
128
+ * <button onClick={() => props.keplerGlDispatch(toggleSplitMap())}/>
129
+ * </div>
130
+ * )
131
+ *
132
+ * const mapDispatchToProps = (dispatch, props) => ({
133
+ * dispatch,
134
+ * keplerGlDispatch: forwardTo(‘foo’, dispatch)
135
+ * });
136
+ *
137
+ * export default connect(
138
+ * state => state,
139
+ * mapDispatchToProps
140
+ * )(MapContainer);
141
+ */
142
+ export var forwardTo = function forwardTo(id, dispatch) {
143
+ return function (action) {
144
+ return dispatch(wrapTo(id, action));
145
+ };
146
+ };
147
+
148
+ /**
149
+ * Update the state of a kepler.gl instance
150
+ * @memberof forwardActions
151
+ * @param {Object} state
152
+ * @param {string} id
153
+ * @param {Object} nextState
154
+ * @private
155
+ */
156
+ export var _updateProperty = function _updateProperty(state, id, nextState) {
157
+ return state[id] === nextState ? state : _objectSpread(_objectSpread({}, state), {}, _defineProperty({}, id, nextState));
158
+ };
159
+
160
+ /**
161
+ * This declaration is needed to group actions in docs
162
+ */
163
+ /**
164
+ * A set of helpers to forward dispatch actions to a specific instance reducer
165
+ * @public
166
+ */
167
+ /* eslint-disable @typescript-eslint/no-unused-vars */
168
+ // @ts-ignore
169
+ var forwardActions = null;
170
+ /* eslint-enable @typescript-eslint/no-unused-vars */
171
+ //# sourceMappingURL=action-wrapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action-wrapper.js","names":["FORWARD","ADDRESS_PREFIX","curry","getActionForwardAddress","id","concat","toUpperCase","wrapToImpl","action","type","payload","_objectSpread","meta","_id_","_forward_","_addr_","wrapTo","isForwardAction","Boolean","unwrap","_unwrap","_actionFor","_action$meta","forwardTo","dispatch","_updateProperty","state","nextState","_defineProperty","forwardActions"],"sources":["../../src/action-wrapper.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright contributors to the kepler.gl project\n\nexport const FORWARD = '@redux-forward/FORWARD';\nexport const ADDRESS_PREFIX = '@@KG_';\nimport {Dispatch} from 'redux';\nimport {ActionTypes} from './action-types';\n\nimport curry from 'es-toolkit/compat/curry';\n\ninterface IKeplerGlAction {\n type: (typeof ActionTypes)[keyof typeof ActionTypes];\n // TODO: Construct a type depending on the payload\n payload?: any;\n meta?: {\n _forward_?: string;\n _addr_?: string;\n _id_?: string;\n [key: string]: any;\n };\n}\n\nexport const getActionForwardAddress = (id: string) => `${ADDRESS_PREFIX}${id.toUpperCase()}`;\n\nfunction wrapToImpl(id: string, action: IKeplerGlAction) {\n return {\n // keep original action.type\n type: action.type,\n\n // actual action\n payload: {\n ...action,\n meta: {\n ...action.meta,\n _id_: id\n }\n },\n\n // add forward signature to meta\n meta: {\n ...(action.meta || {}),\n _forward_: FORWARD,\n _addr_: getActionForwardAddress(id)\n }\n };\n}\n\n// Explicit type so declaration emit does not need es-toolkit's unexported CurriedFunction2.\ntype WrapTo = {\n (id: string, action: IKeplerGlAction): ReturnType<typeof wrapToImpl>;\n (id: string): (action: IKeplerGlAction) => ReturnType<typeof wrapToImpl>;\n};\n\n/**\n * Wrap an action into a forward action that only modify the state of a specific\n * kepler.gl instance. kepler.gl reducer will look for signatures in the action to\n * determine whether it needs to be forwarded to a specific instance reducer.\n *\n * wrapTo can be curried. You can create a curried action wrapper by only supply the `id` argument\n *\n * A forward action looks like this\n * ```js\n * {\n * type: \"@@kepler.gl/LAYER_CONFIG_CHANGE\",\n * payload: {\n * type: '@@kepler.gl/LAYER_CONFIG_CHANGE',\n * payload: {},\n * meta: {\n * // id of instance\n * _id_: id\n * // other meta\n * }\n * },\n * meta: {\n * _forward_: '@redux-forward/FORWARD',\n * _addr_: '@@KG_id'\n * }\n * };\n * ```\n *\n * @memberof forwardActions\n * @param {string} id - The id to forward to\n * @param {Object} action - the action object {type: string, payload: *}\n * @returns {{type: string, payload: {type: string, payload: *, meta: {_id_: string}, meta: {_forward_: string, _addr_: string}}}}\n * @public\n * @example\n *\n * import {wrapTo, togglePerspective} from '@kepler.gl/actions';\n *\n * // This action will only dispatch to the KeplerGl instance with `id: map_1`\n * this.props.dispatch(wrapTo('map_1', togglePerspective()));\n *\n * // You can also create a curried action for each instance\n * const wrapToMap1 = wrapTo('map_1');\n * this.props.dispatch(wrapToMap1(togglePerspective()));\n */\nexport const wrapTo: WrapTo = curry(wrapToImpl);\n\n/**\n * Whether an action is a forward action\n * @memberof forwardActions\n * @param {Object} action - the action object\n * @returns {boolean} boolean - whether the action is a forward action\n * @public\n */\nexport const isForwardAction = (action: IKeplerGlAction) => {\n return Boolean(action && action.meta && action.meta._forward_ === FORWARD);\n};\n\n/**\n * Unwrap an action\n * @memberof forwardActions\n * @param {Object} action - the action object\n * @returns {Object} - unwrapped action\n * @public\n */\nexport const unwrap = (action: IKeplerGlAction) =>\n isForwardAction(action) ? unwrap(action.payload) : action;\n\n/**\n * Given an id, returns the action for that id.\n * If the action is not a forward action, return the action\n * @memberof forwardActions\n * @param {String} id\n * @param {Object} action\n * @private\n */\nexport const _actionFor = (id: string, action: IKeplerGlAction) =>\n isForwardAction(action)\n ? action.meta?._addr_ === getActionForwardAddress(id)\n ? action.payload\n : {}\n : action;\n\n/**\n * Returns an action dispatcher that wraps and forwards the actions to a specific instance\n * @memberof forwardActions\n * @param {string} id - instance id\n * @param {Function} dispatch - action dispatcher\n * @public\n * @example\n *\n * // action and forward dispatcher\n * import {toggleSplitMap, forwardTo} from '@kepler.gl/actions';\n * import {connect} from 'react-redux';\n *\n * const MapContainer = props => (\n * <div>\n * <button onClick={() => props.keplerGlDispatch(toggleSplitMap())}/>\n * </div>\n * )\n *\n * const mapDispatchToProps = (dispatch, props) => ({\n * dispatch,\n * keplerGlDispatch: forwardTo(‘foo’, dispatch)\n * });\n *\n * export default connect(\n * state => state,\n * mapDispatchToProps\n * )(MapContainer);\n */\nexport const forwardTo =\n (id: string, dispatch: Dispatch<IKeplerGlAction>) => (action: IKeplerGlAction) =>\n dispatch(wrapTo(id, action));\n\n/**\n * Update the state of a kepler.gl instance\n * @memberof forwardActions\n * @param {Object} state\n * @param {string} id\n * @param {Object} nextState\n * @private\n */\nexport const _updateProperty = (state, id: string, nextState) =>\n state[id] === nextState\n ? state\n : {\n ...state,\n [id]: nextState\n };\n\n/**\n * This declaration is needed to group actions in docs\n */\n/**\n * A set of helpers to forward dispatch actions to a specific instance reducer\n * @public\n */\n/* eslint-disable @typescript-eslint/no-unused-vars */\n// @ts-ignore\nconst forwardActions = null;\n/* eslint-enable @typescript-eslint/no-unused-vars */\n"],"mappings":"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","ignoreList":[]}
@@ -0,0 +1,186 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // Copyright contributors to the kepler.gl project
3
+
4
+ import { default as ActionTypes } from './action-types';
5
+ import { createAction } from '@reduxjs/toolkit';
6
+ /**
7
+ * Add data to kepler.gl reducer, prepare map with preset configuration if config is passed.
8
+ * Kepler.gl provides a handy set of utils to parse data from different formats to the `data` object required in dataset. You rarely need to manually format the data obejct.
9
+ *
10
+ * Use `KeplerGlSchema.getConfigToSave` to generate a json blob of the currents instance config.
11
+ * The config object value will always have higher precedence than the options properties.
12
+ *
13
+ * Kepler.gl uses `dataId` in the config to match with loaded dataset. If you pass a config object, you need
14
+ * to match the `info.id` of your dataset to the `dataId` in each `layer`, `filter` and `interactionConfig.tooltips.fieldsToShow`
15
+ *
16
+ * @memberof main
17
+ * @param {Object} data
18
+ * @param {Array<Object>|Object} data.datasets - ***required** datasets can be a dataset or an array of datasets
19
+ * Each dataset object needs to have `info` and `data` property.
20
+ * @param {Object} data.datasets.info -info of a dataset
21
+ * @param {string} data.datasets.info.id - id of this dataset. If config is defined, `id` should matches the `dataId` in config.
22
+ * @param {string} data.datasets.info.label - A display name of this dataset
23
+ * @param {Object} data.datasets.data - ***required** The data object, in a tabular format with 2 properties `fields` and `rows`
24
+ * @param {Array<Object>} data.datasets.data.fields - ***required** Array of fields,
25
+ * @param {string} data.datasets.data.fields.name - ***required** Name of the field,
26
+ * @param {Array<Array>} data.datasets.data.rows - ***required** Array of rows, in a tabular format with `fields` and `rows`
27
+ *
28
+ * @param {Object} data.options
29
+ * @param {boolean} data.options.centerMap `default: true` if `centerMap` is set to `true` kepler.gl will
30
+ * place the map view within the data points boundaries. `options.centerMap` will override `config.mapState` if passed in.
31
+ * @param {Number|Object} data.options.padding padding in pixels applied when `centerMap` is true so data is not hidden
32
+ * under the side panel or other UI. Can be a number or `{top, bottom, left, right}`.
33
+ * @param {boolean} data.options.readOnly `default: false` if `readOnly` is set to `true`
34
+ * the left setting panel will be hidden
35
+ * @param {boolean} data.options.keepExistingConfig whether to keep exiting map data and associated layer filter interaction config `default: false`.
36
+ * To append, upsert, or delete rows on an existing in-memory row or Arrow dataset without replacing it or creating layers, use `addToDataset` / `removeFromDataset`. DuckDB tables do not support those actions yet.
37
+ * @param {Object} data.config this object will contain the full kepler.gl instance configuration {mapState, mapStyle, visState}
38
+ * @public
39
+ * @example
40
+ *
41
+ * // app.js
42
+ * import {addDataToMap} from '@kepler.gl/actions';
43
+ *
44
+ * const sampleTripData = {
45
+ * fields: [
46
+ * {name: 'tpep_pickup_datetime', format: 'YYYY-M-D H:m:s', type: 'timestamp'},
47
+ * {name: 'pickup_longitude', format: '', type: 'real'},
48
+ * {name: 'pickup_latitude', format: '', type: 'real'}
49
+ * ],
50
+ * rows: [
51
+ * ['2015-01-15 19:05:39 +00:00', -73.99389648, 40.75011063],
52
+ * ['2015-01-15 19:05:39 +00:00', -73.97642517, 40.73981094],
53
+ * ['2015-01-15 19:05:40 +00:00', -73.96870422, 40.75424576],
54
+ * ]
55
+ * };
56
+ *
57
+ * const sampleConfig = {
58
+ * visState: {
59
+ * filters: [
60
+ * {
61
+ * id: 'me',
62
+ * dataId: 'test_trip_data',
63
+ * name: 'tpep_pickup_datetime',
64
+ * type: 'timeRange',
65
+ * view: 'enlarged'
66
+ * }
67
+ * ]
68
+ * }
69
+ * }
70
+ *
71
+ * this.props.dispatch(
72
+ * addDataToMap({
73
+ * datasets: {
74
+ * info: {
75
+ * label: 'Sample Taxi Trips in New York City',
76
+ * id: 'test_trip_data'
77
+ * },
78
+ * data: sampleTripData
79
+ * },
80
+ * options: {
81
+ * centerMap: true,
82
+ * padding: {left: 300, top: 24, right: 24, bottom: 24},
83
+ * readOnly: false,
84
+ * keepExistingConfig: false
85
+ * },
86
+ * info: {
87
+ * title: 'Taro and Blue',
88
+ * description: 'This is my map'
89
+ * },
90
+ * config: sampleConfig
91
+ * })
92
+ * );
93
+ */
94
+ export var addDataToMap = createAction(ActionTypes.ADD_DATA_TO_MAP, function (data) {
95
+ return {
96
+ payload: data
97
+ };
98
+ });
99
+
100
+ /**
101
+ * Reset all sub-reducers to its initial state. This can be used to clear out all configuration in the reducer.
102
+ * @memberof main
103
+ * @public
104
+ */
105
+ export var resetMapConfig = createAction(ActionTypes.RESET_MAP_CONFIG);
106
+ /**
107
+ * Pass config to kepler.gl instance, prepare the state with preset configs.
108
+ * Calling `KeplerGlSchema.parseSavedConfig` to convert saved config before passing it in is required.
109
+ *
110
+ * You can call `receiveMapConfig` before passing in any data. The reducer will store layer and filter config, waiting for
111
+ * data to come in. When data arrives, you can call `addDataToMap` without passing any config, and the reducer will try to match
112
+ * preloaded configs. This behavior is designed to allow asynchronous data loading.
113
+ *
114
+ * It is also useful when you want to prepare the kepler.gl instance with some preset layer and filter settings.
115
+ * **Note** Sequence is important, `receiveMapConfig` needs to be called __before__ data is loaded. Currently kepler.gl doesn't allow calling `receiveMapConfig` after data is loaded.
116
+ * It will reset current configuration first then apply config to it.
117
+ * @memberof main
118
+ * @param {Object} config - ***required** The Config Object
119
+ * @param {Object} options - ***optional** The Option object
120
+ * @param {boolean} options.centerMap `default: true` if `centerMap` is set to `true` kepler.gl will
121
+ * place the map view within the data points boundaries
122
+ * @param {Number|Object} options.padding padding in pixels applied when `centerMap` is true so data is not hidden
123
+ * under the side panel or other UI. Can be a number or `{top, bottom, left, right}`.
124
+ * @param {boolean} options.readOnly `default: false` if `readOnly` is set to `true`
125
+ * the left setting panel will be hidden
126
+ * @param {boolean} options.keepExistingConfig whether to keep exiting layer filter and interaction config `default: false`.
127
+ * @param {boolean} options.autoCreateLayers whether to automatically create layers based on dataset columns `default: true`.
128
+ * @public
129
+ * @example
130
+ * import {receiveMapConfig} from '@kepler.gl/actions';
131
+ * import KeplerGlSchema from '@kepler.gl/schemas';
132
+ *
133
+ * const parsedConfig = KeplerGlSchema.parseSavedConfig(config);
134
+ * this.props.dispatch(receiveMapConfig(parsedConfig));
135
+ */
136
+ export var receiveMapConfig = createAction(ActionTypes.RECEIVE_MAP_CONFIG, function (config, options) {
137
+ return {
138
+ payload: {
139
+ config: config,
140
+ options: options
141
+ }
142
+ };
143
+ });
144
+ /**
145
+ * Initialize kepler.gl reducer. It is used to pass in `mapboxApiAccessToken` to `mapStyle` reducer.
146
+ * @memberof main
147
+ * @param {object} payload
148
+ * @param payload.mapboxApiAccessToken - mapboxApiAccessToken to be saved to mapStyle reducer
149
+ * @param payload.mapboxApiUrl - mapboxApiUrl to be saved to mapStyle reducer.
150
+ * @param payload.mapStylesReplaceDefault - mapStylesReplaceDefault to be saved to mapStyle reducer
151
+ * @param payload.initialUiState - initial ui state
152
+ * @public
153
+ */
154
+ // @ts-expect-error
155
+ export var keplerGlInit = createAction(ActionTypes.INIT, function (payload) {
156
+ return {
157
+ payload: payload
158
+ };
159
+ });
160
+ /**
161
+ * Initialize kepler.gl reducer. It is used to pass in `mapboxApiAccessToken` to `mapStyle` reducer.
162
+ * @memberof main
163
+ * @param payload
164
+ * @param payload.datasetToReplaceId - mapboxApiAccessToken to be saved to mapStyle reducer
165
+ * @param payload.datasetToUse - mapboxApiUrl to be saved to mapStyle reducer.
166
+ * @public
167
+ */
168
+ export var replaceDataInMap = createAction(ActionTypes.REPLACE_DATA_IN_MAP, function (payload) {
169
+ return {
170
+ payload: payload
171
+ };
172
+ });
173
+
174
+ /**
175
+ * This declaration is needed to group actions in docs
176
+ */
177
+ /**
178
+ * Main kepler.gl actions, these actions handles loading data and config into kepler.gl reducer. These actions
179
+ * is listened by all subreducers,
180
+ * @public
181
+ */
182
+ /* eslint-disable @typescript-eslint/no-unused-vars */
183
+ // @ts-ignore
184
+ var main = null;
185
+ /* eslint-enable @typescript-eslint/no-unused-vars */
186
+ //# sourceMappingURL=actions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actions.js","names":["default","ActionTypes","createAction","addDataToMap","ADD_DATA_TO_MAP","data","payload","resetMapConfig","RESET_MAP_CONFIG","receiveMapConfig","RECEIVE_MAP_CONFIG","config","options","keplerGlInit","INIT","replaceDataInMap","REPLACE_DATA_IN_MAP","main"],"sources":["../../src/actions.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright contributors to the kepler.gl project\n\nimport {default as ActionTypes} from './action-types';\nimport {createAction} from '@reduxjs/toolkit';\n\nimport {\n AddDataToMapOptions,\n AddDataToMapPayload,\n Bounds,\n UiState,\n ParsedConfig,\n ProtoDataset\n} from '@kepler.gl/types';\n\ntype Handler = (...args: any) => any;\n\nexport type ActionHandler<A extends Handler> = (...args: Parameters<A>) => void;\n\nexport type ActionHandlers<T extends {[k: string]: Handler}> = {\n [K in keyof T]: ActionHandler<T[K]>;\n};\n\n/**\n * Add data to kepler.gl reducer, prepare map with preset configuration if config is passed.\n * Kepler.gl provides a handy set of utils to parse data from different formats to the `data` object required in dataset. You rarely need to manually format the data obejct.\n *\n * Use `KeplerGlSchema.getConfigToSave` to generate a json blob of the currents instance config.\n * The config object value will always have higher precedence than the options properties.\n *\n * Kepler.gl uses `dataId` in the config to match with loaded dataset. If you pass a config object, you need\n * to match the `info.id` of your dataset to the `dataId` in each `layer`, `filter` and `interactionConfig.tooltips.fieldsToShow`\n *\n * @memberof main\n * @param {Object} data\n * @param {Array<Object>|Object} data.datasets - ***required** datasets can be a dataset or an array of datasets\n * Each dataset object needs to have `info` and `data` property.\n * @param {Object} data.datasets.info -info of a dataset\n * @param {string} data.datasets.info.id - id of this dataset. If config is defined, `id` should matches the `dataId` in config.\n * @param {string} data.datasets.info.label - A display name of this dataset\n * @param {Object} data.datasets.data - ***required** The data object, in a tabular format with 2 properties `fields` and `rows`\n * @param {Array<Object>} data.datasets.data.fields - ***required** Array of fields,\n * @param {string} data.datasets.data.fields.name - ***required** Name of the field,\n * @param {Array<Array>} data.datasets.data.rows - ***required** Array of rows, in a tabular format with `fields` and `rows`\n *\n * @param {Object} data.options\n * @param {boolean} data.options.centerMap `default: true` if `centerMap` is set to `true` kepler.gl will\n * place the map view within the data points boundaries. `options.centerMap` will override `config.mapState` if passed in.\n * @param {Number|Object} data.options.padding padding in pixels applied when `centerMap` is true so data is not hidden\n * under the side panel or other UI. Can be a number or `{top, bottom, left, right}`.\n * @param {boolean} data.options.readOnly `default: false` if `readOnly` is set to `true`\n * the left setting panel will be hidden\n * @param {boolean} data.options.keepExistingConfig whether to keep exiting map data and associated layer filter interaction config `default: false`.\n * To append, upsert, or delete rows on an existing in-memory row or Arrow dataset without replacing it or creating layers, use `addToDataset` / `removeFromDataset`. DuckDB tables do not support those actions yet.\n * @param {Object} data.config this object will contain the full kepler.gl instance configuration {mapState, mapStyle, visState}\n * @public\n * @example\n *\n * // app.js\n * import {addDataToMap} from '@kepler.gl/actions';\n *\n * const sampleTripData = {\n * fields: [\n * {name: 'tpep_pickup_datetime', format: 'YYYY-M-D H:m:s', type: 'timestamp'},\n * {name: 'pickup_longitude', format: '', type: 'real'},\n * {name: 'pickup_latitude', format: '', type: 'real'}\n * ],\n * rows: [\n * ['2015-01-15 19:05:39 +00:00', -73.99389648, 40.75011063],\n * ['2015-01-15 19:05:39 +00:00', -73.97642517, 40.73981094],\n * ['2015-01-15 19:05:40 +00:00', -73.96870422, 40.75424576],\n * ]\n * };\n *\n * const sampleConfig = {\n * visState: {\n * filters: [\n * {\n * id: 'me',\n * dataId: 'test_trip_data',\n * name: 'tpep_pickup_datetime',\n * type: 'timeRange',\n * view: 'enlarged'\n * }\n * ]\n * }\n * }\n *\n * this.props.dispatch(\n * addDataToMap({\n * datasets: {\n * info: {\n * label: 'Sample Taxi Trips in New York City',\n * id: 'test_trip_data'\n * },\n * data: sampleTripData\n * },\n * options: {\n * centerMap: true,\n * padding: {left: 300, top: 24, right: 24, bottom: 24},\n * readOnly: false,\n * keepExistingConfig: false\n * },\n * info: {\n * title: 'Taro and Blue',\n * description: 'This is my map'\n * },\n * config: sampleConfig\n * })\n * );\n */\nexport const addDataToMap: (data: AddDataToMapPayload) => {\n type: typeof ActionTypes.ADD_DATA_TO_MAP;\n payload: AddDataToMapPayload;\n} = createAction(ActionTypes.ADD_DATA_TO_MAP, (data: AddDataToMapPayload) => ({payload: data}));\n\n/**\n * Reset all sub-reducers to its initial state. This can be used to clear out all configuration in the reducer.\n * @memberof main\n * @public\n */\nexport const resetMapConfig: () => {type: typeof ActionTypes.RESET_MAP_CONFIG} = createAction(\n ActionTypes.RESET_MAP_CONFIG\n);\n\nexport type ReceiveMapConfigPayload = {\n config: ParsedConfig;\n options?: AddDataToMapOptions;\n bounds?: Bounds;\n};\n/**\n * Pass config to kepler.gl instance, prepare the state with preset configs.\n * Calling `KeplerGlSchema.parseSavedConfig` to convert saved config before passing it in is required.\n *\n * You can call `receiveMapConfig` before passing in any data. The reducer will store layer and filter config, waiting for\n * data to come in. When data arrives, you can call `addDataToMap` without passing any config, and the reducer will try to match\n * preloaded configs. This behavior is designed to allow asynchronous data loading.\n *\n * It is also useful when you want to prepare the kepler.gl instance with some preset layer and filter settings.\n * **Note** Sequence is important, `receiveMapConfig` needs to be called __before__ data is loaded. Currently kepler.gl doesn't allow calling `receiveMapConfig` after data is loaded.\n * It will reset current configuration first then apply config to it.\n * @memberof main\n * @param {Object} config - ***required** The Config Object\n * @param {Object} options - ***optional** The Option object\n * @param {boolean} options.centerMap `default: true` if `centerMap` is set to `true` kepler.gl will\n * place the map view within the data points boundaries\n * @param {Number|Object} options.padding padding in pixels applied when `centerMap` is true so data is not hidden\n * under the side panel or other UI. Can be a number or `{top, bottom, left, right}`.\n * @param {boolean} options.readOnly `default: false` if `readOnly` is set to `true`\n * the left setting panel will be hidden\n * @param {boolean} options.keepExistingConfig whether to keep exiting layer filter and interaction config `default: false`.\n * @param {boolean} options.autoCreateLayers whether to automatically create layers based on dataset columns `default: true`.\n * @public\n * @example\n * import {receiveMapConfig} from '@kepler.gl/actions';\n * import KeplerGlSchema from '@kepler.gl/schemas';\n *\n * const parsedConfig = KeplerGlSchema.parseSavedConfig(config);\n * this.props.dispatch(receiveMapConfig(parsedConfig));\n */\nexport const receiveMapConfig: (\n config: ReceiveMapConfigPayload['config'],\n options: ReceiveMapConfigPayload['options']\n) => {\n type: typeof ActionTypes.RECEIVE_MAP_CONFIG;\n payload: ReceiveMapConfigPayload;\n} = createAction(\n ActionTypes.RECEIVE_MAP_CONFIG,\n (config: ReceiveMapConfigPayload['config'], options: ReceiveMapConfigPayload['options']) => ({\n payload: {\n config,\n options\n }\n })\n);\n\nexport type KeplerGlInitPayload = {\n mapboxApiAccessToken?: string;\n mapboxApiUrl?: string;\n mapStylesReplaceDefault?: boolean;\n initialUiState?: Partial<UiState>;\n};\n/**\n * Initialize kepler.gl reducer. It is used to pass in `mapboxApiAccessToken` to `mapStyle` reducer.\n * @memberof main\n * @param {object} payload\n * @param payload.mapboxApiAccessToken - mapboxApiAccessToken to be saved to mapStyle reducer\n * @param payload.mapboxApiUrl - mapboxApiUrl to be saved to mapStyle reducer.\n * @param payload.mapStylesReplaceDefault - mapStylesReplaceDefault to be saved to mapStyle reducer\n * @param payload.initialUiState - initial ui state\n * @public\n */\n// @ts-expect-error\nexport const keplerGlInit: (options?: KeplerGlInitPayload) => {\n type: typeof ActionTypes.INIT;\n payload: KeplerGlInitPayload;\n} = createAction(ActionTypes.INIT, (payload: KeplerGlInitPayload) => ({payload}));\n\nexport type ReplaceDataToMapOptions = {\n centerMap?: boolean;\n padding?: AddDataToMapOptions['padding'];\n keepExistingConfig?: boolean;\n autoCreateLayers?: boolean;\n /**\n * Remove the dataset being replaced from the map.\n * Layers and filters are remapped onto the new dataset either way.\n * Defaults to `true`.\n */\n deleteOriginalDataset?: boolean;\n};\nexport type ReplaceDataInMapPayload = {\n datasetToReplaceId: string;\n datasetToUse: ProtoDataset;\n options?: ReplaceDataToMapOptions;\n};\n\n/**\n * Initialize kepler.gl reducer. It is used to pass in `mapboxApiAccessToken` to `mapStyle` reducer.\n * @memberof main\n * @param payload\n * @param payload.datasetToReplaceId - mapboxApiAccessToken to be saved to mapStyle reducer\n * @param payload.datasetToUse - mapboxApiUrl to be saved to mapStyle reducer.\n * @public\n */\nexport const replaceDataInMap: (payload: ReplaceDataInMapPayload) => {\n type: typeof ActionTypes.REPLACE_DATA_IN_MAP;\n payload: ReplaceDataInMapPayload;\n} = createAction(ActionTypes.REPLACE_DATA_IN_MAP, (payload: ReplaceDataInMapPayload) => ({\n payload\n}));\n\n/**\n * This declaration is needed to group actions in docs\n */\n/**\n * Main kepler.gl actions, these actions handles loading data and config into kepler.gl reducer. These actions\n * is listened by all subreducers,\n * @public\n */\n/* eslint-disable @typescript-eslint/no-unused-vars */\n// @ts-ignore\nconst main = null;\n/* eslint-enable @typescript-eslint/no-unused-vars */\n"],"mappings":"AAAA;AACA;;AAEA,SAAQA,OAAO,IAAIC,WAAW,QAAO,gBAAgB;AACrD,SAAQC,YAAY,QAAO,kBAAkB;AAmB7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,YAGZ,GAAGD,YAAY,CAACD,WAAW,CAACG,eAAe,EAAE,UAACC,IAAyB;EAAA,OAAM;IAACC,OAAO,EAAED;EAAI,CAAC;AAAA,CAAC,CAAC;;AAE/F;AACA;AACA;AACA;AACA;AACA,OAAO,IAAME,cAAiE,GAAGL,YAAY,CAC3FD,WAAW,CAACO,gBACd,CAAC;AAOD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,gBAMZ,GAAGP,YAAY,CACdD,WAAW,CAACS,kBAAkB,EAC9B,UAACC,MAAyC,EAAEC,OAA2C;EAAA,OAAM;IAC3FN,OAAO,EAAE;MACPK,MAAM,EAANA,MAAM;MACNC,OAAO,EAAPA;IACF;EACF,CAAC;AAAA,CACH,CAAC;AAQD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,YAGZ,GAAGX,YAAY,CAACD,WAAW,CAACa,IAAI,EAAE,UAACR,OAA4B;EAAA,OAAM;IAACA,OAAO,EAAPA;EAAO,CAAC;AAAA,CAAC,CAAC;AAoBjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMS,gBAGZ,GAAGb,YAAY,CAACD,WAAW,CAACe,mBAAmB,EAAE,UAACV,OAAgC;EAAA,OAAM;IACvFA,OAAO,EAAPA;EACF,CAAC;AAAA,CAAC,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMW,IAAI,GAAG,IAAI;AACjB","ignoreList":[]}
@@ -0,0 +1,79 @@
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
+ * Add a new kepler.gl instance in `keplerGlReducer`. This action is called under-the-hood when a `KeplerGl` component is **mounted** to the dom.
9
+ * Note that if you dispatch actions such as adding data to a kepler.gl instance before the React component is mounted, the action will not be
10
+ * performed. Instance reducer can only handle actions when it is instantiated.
11
+ * @memberof rootActions
12
+ * @param payload
13
+ * @param payload.id - ***required** The id of the instance
14
+ * @param payload.mint - Whether to use a fresh empty state, when `mint: true` it will *always* load a fresh state when the component is re-mounted.
15
+ * When `mint: false` it will register with existing instance state under the same `id`, when the component is unmounted then mounted again. Default: `true`
16
+ * @param payload.mapboxApiAccessToken - mapboxApiAccessToken to be saved in `map-style` reducer.
17
+ * @param payload.mapboxApiUrl - mapboxApiUrl to be saved in `map-style` reducer.
18
+ * @param payload.mapStylesReplaceDefault - mapStylesReplaceDefault to be saved in `map-style` reducer.
19
+ * @param payload.initialUiState - initial ui state
20
+ * @public
21
+ */
22
+ export var registerEntry = createAction(ActionTypes.REGISTER_ENTRY, function (payload) {
23
+ return {
24
+ payload: payload
25
+ };
26
+ });
27
+
28
+ /**
29
+ *
30
+ * Delete an instance from `keplerGlReducer`. This action is called under-the-hood when a `KeplerGl` component is **un-mounted** to the dom.
31
+ * If `mint` is set to be `true` in the component prop, the instance state will be deleted from the root reducer. Otherwise, the root reducer will keep
32
+ * the instance state and later transfer it to a newly mounted component with the same `id`
33
+ * @memberof rootActions
34
+ * @param {string} id - the id of the instance to be deleted
35
+ * @public
36
+ */
37
+ export var deleteEntry = createAction(ActionTypes.DELETE_ENTRY, function (id) {
38
+ return {
39
+ payload: {
40
+ id: id
41
+ }
42
+ };
43
+ });
44
+
45
+ /**
46
+ *
47
+ * Rename an instance in the root reducer, keep its entire state
48
+ *
49
+ * @memberof rootActions
50
+ * @param {string} oldId - ***required** old id
51
+ * @param {string} newId - ***required** new id
52
+ * @public
53
+ */
54
+ export var renameEntry = createAction(ActionTypes.RENAME_ENTRY, function (oldId, newId) {
55
+ return {
56
+ payload: {
57
+ oldId: oldId,
58
+ newId: newId
59
+ }
60
+ };
61
+ });
62
+
63
+ /**
64
+ * This declaration is needed to group actions in docs
65
+ */
66
+ /**
67
+ * Root actions managers adding and removing instances in root reducer.
68
+ * Under-the-hood, when a `KeplerGl` component is mounted or unmounted,
69
+ * it will automatically calls these actions to add itself to the root reducer.
70
+ * However, sometimes the data is ready before the component is registered in the reducer,
71
+ * in this case, you can manually call these actions or the corresponding updater to add it to the reducer.
72
+ *
73
+ * @public
74
+ */
75
+ /* eslint-disable @typescript-eslint/no-unused-vars */
76
+ // @ts-ignore
77
+ var rootActions = null;
78
+ /* eslint-enable @typescript-eslint/no-unused-vars */
79
+ //# sourceMappingURL=identity-actions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity-actions.js","names":["createAction","default","ActionTypes","registerEntry","REGISTER_ENTRY","payload","deleteEntry","DELETE_ENTRY","id","renameEntry","RENAME_ENTRY","oldId","newId","rootActions"],"sources":["../../src/identity-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 {UiState} from '@kepler.gl/types';\n\nexport type RegisterEntryUpdaterAction = {\n payload: {\n id: string;\n mint?: boolean;\n mapboxApiAccessToken?: string;\n mapboxApiUrl?: string;\n mapStylesReplaceDefault?: boolean;\n initialUiState?: Partial<UiState>;\n };\n};\n\nexport type RenameEntryUpdaterAction = {\n payload: {\n oldId: string;\n newId: string;\n };\n};\n/**\n *\n * Add a new kepler.gl instance in `keplerGlReducer`. This action is called under-the-hood when a `KeplerGl` component is **mounted** to the dom.\n * Note that if you dispatch actions such as adding data to a kepler.gl instance before the React component is mounted, the action will not be\n * performed. Instance reducer can only handle actions when it is instantiated.\n * @memberof rootActions\n * @param payload\n * @param payload.id - ***required** The id of the instance\n * @param payload.mint - Whether to use a fresh empty state, when `mint: true` it will *always* load a fresh state when the component is re-mounted.\n * When `mint: false` it will register with existing instance state under the same `id`, when the component is unmounted then mounted again. Default: `true`\n * @param payload.mapboxApiAccessToken - mapboxApiAccessToken to be saved in `map-style` reducer.\n * @param payload.mapboxApiUrl - mapboxApiUrl to be saved in `map-style` reducer.\n * @param payload.mapStylesReplaceDefault - mapStylesReplaceDefault to be saved in `map-style` reducer.\n * @param payload.initialUiState - initial ui state\n * @public\n */\nexport const registerEntry: (entry: RegisterEntryUpdaterAction['payload']) => {\n type: typeof ActionTypes.REGISTER_ENTRY;\n payload: RegisterEntryUpdaterAction['payload'];\n} = createAction(ActionTypes.REGISTER_ENTRY, (payload: RegisterEntryUpdaterAction['payload']) => ({\n payload\n}));\n\n/**\n *\n * Delete an instance from `keplerGlReducer`. This action is called under-the-hood when a `KeplerGl` component is **un-mounted** to the dom.\n * If `mint` is set to be `true` in the component prop, the instance state will be deleted from the root reducer. Otherwise, the root reducer will keep\n * the instance state and later transfer it to a newly mounted component with the same `id`\n * @memberof rootActions\n * @param {string} id - the id of the instance to be deleted\n * @public\n */\nexport const deleteEntry: (id: string) => {\n type: typeof ActionTypes.DELETE_ENTRY;\n payload: {id: string};\n} = createAction(ActionTypes.DELETE_ENTRY, (id: string) => ({payload: {id: id}}));\n\n/**\n *\n * Rename an instance in the root reducer, keep its entire state\n *\n * @memberof rootActions\n * @param {string} oldId - ***required** old id\n * @param {string} newId - ***required** new id\n * @public\n */\nexport const renameEntry: (\n oldId: string,\n newId: string\n) => {\n type: typeof ActionTypes.RENAME_ENTRY;\n payload: RenameEntryUpdaterAction['payload'];\n} = createAction(ActionTypes.RENAME_ENTRY, (oldId: string, newId: string) => ({\n payload: {\n oldId,\n newId\n }\n}));\n\n/**\n * This declaration is needed to group actions in docs\n */\n/**\n * Root actions managers adding and removing instances in root reducer.\n * Under-the-hood, when a `KeplerGl` component is mounted or unmounted,\n * it will automatically calls these actions to add itself to the root reducer.\n * However, sometimes the data is ready before the component is registered in the reducer,\n * in this case, you can manually call these actions or the corresponding updater to add it to the reducer.\n *\n * @public\n */\n/* eslint-disable @typescript-eslint/no-unused-vars */\n// @ts-ignore\nconst rootActions = 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;AAoBrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,aAGZ,GAAGH,YAAY,CAACE,WAAW,CAACE,cAAc,EAAE,UAACC,OAA8C;EAAA,OAAM;IAChGA,OAAO,EAAPA;EACF,CAAC;AAAA,CAAC,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,WAGZ,GAAGN,YAAY,CAACE,WAAW,CAACK,YAAY,EAAE,UAACC,EAAU;EAAA,OAAM;IAACH,OAAO,EAAE;MAACG,EAAE,EAAEA;IAAE;EAAC,CAAC;AAAA,CAAC,CAAC;;AAEjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,WAMZ,GAAGT,YAAY,CAACE,WAAW,CAACQ,YAAY,EAAE,UAACC,KAAa,EAAEC,KAAa;EAAA,OAAM;IAC5EP,OAAO,EAAE;MACPM,KAAK,EAALA,KAAK;MACLC,KAAK,EAALA;IACF;EACF,CAAC;AAAA,CAAC,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMC,WAAW,GAAG,IAAI;AACxB","ignoreList":[]}
@@ -0,0 +1,27 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // Copyright contributors to the kepler.gl project
3
+
4
+ import * as VisStateActions from './vis-state-actions';
5
+ import * as MapStateActions from './map-state-actions';
6
+ import * as UIStateActions from './ui-state-actions';
7
+ import * as MapStyleActions from './map-style-actions';
8
+ import * as ProviderActions from './provider-actions';
9
+
10
+ // Actions
11
+ export * from './actions';
12
+
13
+ // kepler.gl actions accessible outside component
14
+ export * from './action-wrapper';
15
+ export * from './vis-state-actions';
16
+ export * from './ui-state-actions';
17
+ export * from './map-state-actions';
18
+ export * from './map-style-actions';
19
+ export * from './identity-actions';
20
+ export * from './provider-actions';
21
+ export { VisStateActions, MapStateActions, UIStateActions, MapStyleActions, ProviderActions };
22
+
23
+ // Dispatch
24
+ export { _actionFor, forwardTo, getActionForwardAddress, isForwardAction, unwrap, wrapTo } from './action-wrapper';
25
+ export { default as ActionTypes, ACTION_PREFIX } from './action-types';
26
+ export { ActionTypes as ProviderActionTypes } from './provider-actions';
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["VisStateActions","MapStateActions","UIStateActions","MapStyleActions","ProviderActions","_actionFor","forwardTo","getActionForwardAddress","isForwardAction","unwrap","wrapTo","default","ActionTypes","ACTION_PREFIX","ProviderActionTypes"],"sources":["../../src/index.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright contributors to the kepler.gl project\n\nimport * as VisStateActions from './vis-state-actions';\nimport * as MapStateActions from './map-state-actions';\nimport * as UIStateActions from './ui-state-actions';\nimport * as MapStyleActions from './map-style-actions';\nimport * as ProviderActions from './provider-actions';\n\n// Actions\nexport * from './actions';\n\n// kepler.gl actions accessible outside component\nexport * from './action-wrapper';\nexport * from './vis-state-actions';\nexport * from './ui-state-actions';\nexport * from './map-state-actions';\nexport * from './map-style-actions';\nexport * from './identity-actions';\nexport * from './provider-actions';\n\nexport {VisStateActions, MapStateActions, UIStateActions, MapStyleActions, ProviderActions};\n\n// Dispatch\nexport {\n _actionFor,\n forwardTo,\n getActionForwardAddress,\n isForwardAction,\n unwrap,\n wrapTo\n} from './action-wrapper';\n\nexport {default as ActionTypes, ACTION_PREFIX} from './action-types';\nexport {ActionTypes as ProviderActionTypes} from './provider-actions';\n"],"mappings":"AAAA;AACA;;AAEA,OAAO,KAAKA,eAAe,MAAM,qBAAqB;AACtD,OAAO,KAAKC,eAAe,MAAM,qBAAqB;AACtD,OAAO,KAAKC,cAAc,MAAM,oBAAoB;AACpD,OAAO,KAAKC,eAAe,MAAM,qBAAqB;AACtD,OAAO,KAAKC,eAAe,MAAM,oBAAoB;;AAErD;AACA,cAAc,WAAW;;AAEzB;AACA,cAAc,kBAAkB;AAChC,cAAc,qBAAqB;AACnC,cAAc,oBAAoB;AAClC,cAAc,qBAAqB;AACnC,cAAc,qBAAqB;AACnC,cAAc,oBAAoB;AAClC,cAAc,oBAAoB;AAElC,SAAQJ,eAAe,EAAEC,eAAe,EAAEC,cAAc,EAAEC,eAAe,EAAEC,eAAe;;AAE1F;AACA,SACEC,UAAU,EACVC,SAAS,EACTC,uBAAuB,EACvBC,eAAe,EACfC,MAAM,EACNC,MAAM,QACD,kBAAkB;AAEzB,SAAQC,OAAO,IAAIC,WAAW,EAAEC,aAAa,QAAO,gBAAgB;AACpE,SAAQD,WAAW,IAAIE,mBAAmB,QAAO,oBAAoB","ignoreList":[]}