Skip to content

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.

[Chore]: Technical: constants and types modules isolation (#1840)

dariaterekhovaae10868ecfb371
diff --git a/.eslintrc b/.eslintrc
index b3f34cb19..272deb658 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -19,7 +19,7 @@
"context": true,
"jestPuppeteer": true
},
- "parser": "@babel/eslint-parser",
+ "parser": "@typescript-eslint/parser",
"plugins": ["babel", "prettier", "react", "@typescript-eslint"],
"rules": {
"valid-jsdoc": 0,
@@ -27,6 +27,7 @@
"max-len": 0,
"react/no-did-mount-set-state": 0,
"react/no-multi-comp": 0,
+ "no-use-before-define": "off",
"prefer-spread": 1,
"prefer-template": 1,
"prettier/prettier": "error",
diff --git a/.gitignore b/.gitignore
index 8725630bf..ea1e126db 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,3 +23,11 @@ package-lock.json
/index.html
npm-debug.log
+
+.pnp.*
+.yarn/*
+!.yarn/patches
+!.yarn/plugins
+!.yarn/releases
+!.yarn/sdks
+!.yarn/versions
\ No newline at end of file
diff --git a/package.json b/package.json
index 882e2c60a..b43d0174e 100644
--- a/package.json
+++ b/package.json
@@ -14,6 +14,11 @@
"visualization",
"deck.gl"
],
+ "private": true,
+ "workspaces": [
+ "./src/constants",
+ "./src/types"
+ ],
"repository": {
"type": "git",
"url": "https://github.com/keplergl/kepler.gl.git"
@@ -50,12 +55,12 @@
"analyze:bundle": "webpack --config ./webpack/bundle.js --progress --env.prod",
"check-licence": "uber-licence --dry",
"add-licence": "uber-licence",
- "prepublish": "uber-licence && yarn build && yarn build:umd && yarn build:types",
+ "prepublish": "yarn workspaces run prepublish && uber-licence && yarn build && yarn build:umd && yarn build:types",
"docs": "babel-node ./scripts/documentation.js",
"typedoc": "typedoc --theme markdown --out typedoc --inputFiles ./src/reducers --inputFiles ./src/actions --excludeExternals --excludeNotExported --excludePrivate",
"example-version": "babel-node ./scripts/edit-version.js",
"prettier-all": "prettier --write '{src,examples,test}/**/*.{js,tsx,ts}'",
- "lint": "yarn typescript && eslint src test webpack examples/*.js examples/**/src/*.{js,tsx,ts} website/*.js website/src --fix",
+ "lint": "yarn typescript && eslint src/*/src/*.{js,tsx,ts} test webpack examples/*.js examples/**/src/*.{js,tsx,ts} website/*.js website/src --fix",
"lint:css": "stylelint './src/**/*.js'",
"typescript": "tsc --noEmit",
"web": "(yarn && yarn install:web && yarn start:web)",
@@ -132,6 +137,7 @@
"@types/react-virtualized": "^9.21.20",
"@types/react-vis": "^1.8.0",
"@types/styled-components": "^5.1.25",
+ "@typescript-eslint/parser": "^5.27.0",
"classnames": "^2.2.1",
"colorbrewer": "^1.5.0",
"copy-to-clipboard": "^3.3.1",
diff --git a/src/constants/action-types.ts b/src/actions/action-types.ts
similarity index 99%
rename from src/constants/action-types.ts
rename to src/actions/action-types.ts
index 7f3c58a96..818746de9 100644
--- a/src/constants/action-types.ts
+++ b/src/actions/action-types.ts
@@ -183,6 +183,7 @@ const ActionTypes = {
START_SAVE_STORAGE: `${ACTION_PREFIX}START_SAVE_STORAGE`
};
+// eslint-disable-line
const assignType = <T>(obj: T): { [K in keyof T]: `${typeof ACTION_PREFIX}${string & K}`; } => obj as any
export default assignType(ActionTypes);
diff --git a/src/actions/actions.ts b/src/actions/actions.ts
index ab6081728..84dc381dd 100644
--- a/src/actions/actions.ts
+++ b/src/actions/actions.ts
@@ -18,11 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import ActionTypes from 'constants/action-types';
+import {default as ActionTypes} from './action-types';
import {createAction} from '@reduxjs/toolkit';
import {ParsedConfig} from '../schemas';
-import {RGBColor} from 'reducers/types';
+import {RGBColor} from '@kepler.gl/types';
import {Bounds} from 'reducers/map-state-updaters';
import {MapInfo} from 'reducers/vis-state-updaters';
import {UiState} from 'reducers/ui-state-updaters';
diff --git a/src/actions/identity-actions.ts b/src/actions/identity-actions.ts
index c28e86ac4..723be28a3 100644
--- a/src/actions/identity-actions.ts
+++ b/src/actions/identity-actions.ts
@@ -19,7 +19,7 @@
// THE SOFTWARE.
import {createAction} from '@reduxjs/toolkit';
-import ActionTypes from 'constants/action-types';
+import {default as ActionTypes} from './action-types';
import {UiState} from 'reducers/ui-state-updaters';
export type RegisterEntryUpdaterAction = {
diff --git a/src/actions/index.ts b/src/actions/index.ts
index 6d299fb4a..a37ce695c 100644
--- a/src/actions/index.ts
+++ b/src/actions/index.ts
@@ -39,4 +39,5 @@ export {
wrapTo
} from './action-wrapper';
-export {default as ActionTypes} from '../constants/action-types';
+export {ACTION_PREFIX} from './action-types';
+export {default as ActionTypes} from './action-types';
diff --git a/src/actions/map-state-actions.ts b/src/actions/map-state-actions.ts
index 9f5c48fb9..931cb7e30 100644
--- a/src/actions/map-state-actions.ts
+++ b/src/actions/map-state-actions.ts
@@ -19,8 +19,8 @@
// THE SOFTWARE.
import {createAction} from '@reduxjs/toolkit';
-import ActionTypes from 'constants/action-types';
-import {Merge} from '../reducers/types';
+import {default as ActionTypes} from './action-types';
+import {Merge} from '@kepler.gl/types';
import {Bounds, Viewport} from '../reducers/map-state-updaters';
export type TogglePerspectiveUpdaterAction = {};
diff --git a/src/actions/map-style-actions.ts b/src/actions/map-style-actions.ts
index 038181ae7..80ead5b4c 100644
--- a/src/actions/map-style-actions.ts
+++ b/src/actions/map-style-actions.ts
@@ -19,8 +19,8 @@
// THE SOFTWARE.
import {createAction} from '@reduxjs/toolkit';
-import ActionTypes from 'constants/action-types';
-import {Merge, RGBColor} from '../reducers/types';
+import {default as ActionTypes} from './action-types';
+import {Merge, RGBColor} from '@kepler.gl/types';
import {InputStyle, MapStyles, VisibleLayerGroups} from '../reducers/map-style-updaters';
import {MapState} from '../reducers/map-state-updaters';
diff --git a/src/actions/provider-actions.ts b/src/actions/provider-actions.ts
index fb07438a6..bc4393e68 100644
--- a/src/actions/provider-actions.ts
+++ b/src/actions/provider-actions.ts
@@ -19,7 +19,7 @@
// THE SOFTWARE.
import {createAction} from '@reduxjs/toolkit';
-import {ACTION_PREFIX} from 'constants/action-types';
+import {ACTION_PREFIX} from './action-types';
import {SavedMap} from 'schemas';
import {MapListItem, Provider} from 'cloud-providers';
diff --git a/src/actions/ui-state-actions.ts b/src/actions/ui-state-actions.ts
index 088346fb8..f01f6320f 100644
--- a/src/actions/ui-state-actions.ts
+++ b/src/actions/ui-state-actions.ts
@@ -19,8 +19,8 @@
// THE SOFTWARE.
import {createAction} from '@reduxjs/toolkit';
-import ActionTypes from 'constants/action-types';
-import {Merge} from '../reducers/types';
+import {default as ActionTypes} from './action-types';
+import {Merge} from '@kepler.gl/types';
import {ExportImage} from '../reducers/ui-state-updaters';
/** TOGGLE_SIDE_PANEL */
diff --git a/src/actions/vis-state-actions.ts b/src/actions/vis-state-actions.ts
index 34175eaea..36f3a27e0 100644
--- a/src/actions/vis-state-actions.ts
+++ b/src/actions/vis-state-actions.ts
@@ -19,12 +19,12 @@
// THE SOFTWARE.
// vis-state-reducer
-import ActionTypes from 'constants/action-types';
+import {default as ActionTypes} from './action-types';
import {AddDataToMapPayload} from '../actions/actions';
import {FileCacheItem} from '../processors/types';
import {Layer, LayerBaseConfig, LayerVisConfig} from 'layers';
import {Feature, InteractionConfig} from 'reducers/vis-state-updaters';
-import {ValueOf, Merge, RGBColor, NestedPartial} from '../reducers/types';
+import {ValueOf, Merge, RGBColor, NestedPartial} from '@kepler.gl/types';
import {ColorUI} from 'layers/layer-factory';
// TODO - import LoaderObject type from @loaders.gl/core when supported
// TODO - import LoadOptions type from @loaders.gl/core when supported
diff --git a/src/components/bottom-widget.tsx b/src/components/bottom-widget.tsx
index 235be0131..208e51ea2 100644
--- a/src/components/bottom-widget.tsx
+++ b/src/components/bottom-widget.tsx
@@ -23,7 +23,7 @@ import styled from 'styled-components';
import TimeWidgetFactory from './filters/time-widget';
import AnimationControlFactory from './common/animation-control/animation-control';
import AnimationControllerFactory from './common/animation-control/animation-controller';
-import {ANIMATION_WINDOW, DIMENSIONS, FILTER_TYPES} from 'constants/default-settings';
+import {ANIMATION_WINDOW, DIMENSIONS, FILTER_TYPES} from '@kepler.gl/constants';
import {getIntervalBins} from 'utils/filter-utils';
import {media} from 'styles/media-breakpoints';
import {AnimationConfig, TimeRangeFilter} from 'reducers';
diff --git a/src/components/common/animation-control/animation-control.tsx b/src/components/common/animation-control/animation-control.tsx
index bf95bb3ab..90d7b7bcb 100644
--- a/src/components/common/animation-control/animation-control.tsx
+++ b/src/components/common/animation-control/animation-control.tsx
@@ -27,7 +27,7 @@ import {BottomWidgetInner} from 'components/common/styled-components';
import PlaybackControlsFactory from './playback-controls';
import FloatingTimeDisplayFactory from './floating-time-display';
import {snapToMarks, datetimeFormatter} from 'utils/data-utils';
-import {DEFAULT_TIME_FORMAT} from 'constants/default-settings';
+import {DEFAULT_TIME_FORMAT} from '@kepler.gl/constants';
const SliderWrapper = styled.div`
display: flex;
diff --git a/src/components/common/animation-control/animation-controller.ts b/src/components/common/animation-control/animation-controller.ts
index e42a61c3c..d7efddf52 100644
--- a/src/components/common/animation-control/animation-controller.ts
+++ b/src/components/common/animation-control/animation-controller.ts
@@ -22,7 +22,7 @@ import {Component} from 'react';
import {bisectLeft} from 'd3-array';
import {requestAnimationFrame, cancelAnimationFrame} from 'global/window';
import Console from 'global/console';
-import {BASE_SPEED, FPS, ANIMATION_WINDOW} from 'constants/default-settings';
+import {BASE_SPEED, FPS, ANIMATION_WINDOW} from '@kepler.gl/constants';
interface AnimationControllerProps<T extends number | number[]> {
isAnimating?: boolean;
diff --git a/src/components/common/animation-control/animation-speed-slider.tsx b/src/components/common/animation-control/animation-speed-slider.tsx
index 82478ec81..d71965103 100644
--- a/src/components/common/animation-control/animation-speed-slider.tsx
+++ b/src/components/common/animation-control/animation-speed-slider.tsx
@@ -22,7 +22,7 @@ import React, {Component, ComponentType} from 'react';
import styled from 'styled-components';
import RangeSliderFactory from 'components/common/range-slider';
import onClickOutside from 'react-onclickoutside';
-import {SPEED_CONTROL_RANGE, SPEED_CONTROL_STEP} from 'constants/default-settings';
+import {SPEED_CONTROL_RANGE, SPEED_CONTROL_STEP} from '@kepler.gl/constants';
const SliderWrapper = styled.div`
position: relative;
diff --git a/src/components/common/animation-control/floating-time-display.tsx b/src/components/common/animation-control/floating-time-display.tsx
index 456376eef..6d8653d2a 100644
--- a/src/components/common/animation-control/floating-time-display.tsx
+++ b/src/components/common/animation-control/floating-time-display.tsx
@@ -22,7 +22,7 @@ import React, {useMemo} from 'react';
import styled from 'styled-components';
import classnames from 'classnames';
import {Minus} from 'components/common/icons';
-import {DEFAULT_TIME_FORMAT} from 'constants/default-settings';
+import {DEFAULT_TIME_FORMAT} from '@kepler.gl/constants';
import {CenterFlexbox} from 'components/common/styled-components';
import {datetimeFormatter} from 'utils/data-utils';
diff --git a/src/components/common/animation-control/playback-controls.tsx b/src/components/common/animation-control/playback-controls.tsx
index 60602ee94..62e91e6ee 100644
--- a/src/components/common/animation-control/playback-controls.tsx
+++ b/src/components/common/animation-control/playback-controls.tsx
@@ -25,7 +25,7 @@ import {FormattedMessage} from 'localization';
import {Button, Tooltip, ButtonProps} from 'components/common/styled-components';
import AnimationSpeedSliderFactory from './animation-speed-slider';
import {Reset, Play, Pause, Rocket, AnchorWindow, FreeWindow} from 'components/common/icons';
-import {ANIMATION_WINDOW} from 'constants/default-settings';
+import {ANIMATION_WINDOW} from '@kepler.gl/constants';
import {preciseRound} from 'utils/data-utils';
import {ReactComponentLike} from 'prop-types';
diff --git a/src/components/common/color-legend.tsx b/src/components/common/color-legend.tsx
index a4462febd..8c2af4ade 100644
--- a/src/components/common/color-legend.tsx
+++ b/src/components/common/color-legend.tsx
@@ -23,7 +23,7 @@ import styled from 'styled-components';
import {createSelector} from 'reselect';
import {format} from 'd3-format';
import moment from 'moment';
-import {SCALE_TYPES, SCALE_FUNC, ALL_FIELD_TYPES} from 'constants/default-settings';
+import {SCALE_TYPES, SCALE_FUNC, ALL_FIELD_TYPES} from '@kepler.gl/constants';
import {getTimeWidgetHintFormatter} from 'utils/filter-utils';
const ROW_H = 10;
diff --git a/src/components/common/data-table/index.tsx b/src/components/common/data-table/index.tsx
index bd7e35452..51da236f6 100644
--- a/src/components/common/data-table/index.tsx
+++ b/src/components/common/data-table/index.tsx
@@ -35,7 +35,7 @@ import {ArrowUp, ArrowDown, VertThreeDots} from 'components/common/icons';
import {parseFieldValue} from 'utils/data-utils';
import {adjustCellsToContainer} from './cell-size';
-import {ALL_FIELD_TYPES, SORT_ORDER} from 'constants/default-settings';
+import {ALL_FIELD_TYPES, SORT_ORDER} from '@kepler.gl/constants';
import FieldTokenFactory from 'components/common/field-token';
import {DataContainerInterface} from 'utils/table-utils/data-container-interface';
diff --git a/src/components/common/data-table/option-dropdown.tsx b/src/components/common/data-table/option-dropdown.tsx
index 82fc49212..4f8ee4381 100644
--- a/src/components/common/data-table/option-dropdown.tsx
+++ b/src/components/common/data-table/option-dropdown.tsx
@@ -22,7 +22,8 @@ import React, {useCallback} from 'react';
import styled from 'styled-components';
import Portaled from 'components/common/portaled';
import DropdownList from 'components/common/item-selector/dropdown-list';
-import {SORT_ORDER, TABLE_OPTION, TABLE_OPTION_LIST} from 'constants/default-settings';
+import {SORT_ORDER, TABLE_OPTION, TABLE_OPTION_LIST} from '@kepler.gl/constants';
+import {Pin, ArrowDown, ArrowUp, Clipboard, Cancel} from 'components/common/icons';
const ListItem = ({value}) => (
<div>
@@ -102,7 +103,18 @@ const OptionDropdown = (props: OptionDropdownProps) => {
[column, sortTableColumn, pinTableColumn, copyTableColumn, toggleMoreOptions]
);
- const options = TABLE_OPTION_LIST.filter(op => !op.condition || op.condition(props));
+ const TABLE_OPTION_LIST_ICONS = {
+ Pin: Pin,
+ ArrowDown: ArrowDown,
+ ArrowUp: ArrowUp,
+ Clipboard: Clipboard,
+ Cancel: Cancel
+ };
+
+ const options = TABLE_OPTION_LIST.filter(op => !op.condition || op.condition(props)).map(op => ({
+ ...op,
+ icon: TABLE_OPTION_LIST_ICONS[op.icon]
+ }));
return (
<Portaled right={120} top={20} isOpened={isOpened} onClose={() => toggleMoreOptions(column)}>
diff --git a/src/components/common/dataset-label.tsx b/src/components/common/dataset-label.tsx
index 684fc07b7..3b254715a 100644
--- a/src/components/common/dataset-label.tsx
+++ b/src/components/common/dataset-label.tsx
@@ -21,7 +21,7 @@
import React from 'react';
import styled from 'styled-components';
import {CenterFlexbox, DatasetSquare} from 'components/common/styled-components';
-import {RGBColor} from 'reducers';
+import {RGBColor} from '@kepler.gl/types';
const DatasetName = styled.div.attrs({
className: 'dataset-name'
diff --git a/src/components/common/field-token.tsx b/src/components/common/field-token.tsx
index abb246f22..731de4173 100644
--- a/src/components/common/field-token.tsx
+++ b/src/components/common/field-token.tsx
@@ -20,7 +20,7 @@
import React from 'react';
import styled from 'styled-components';
-import {FILED_TYPE_DISPLAY, FIELD_COLORS} from 'constants/default-settings';
+import {FILED_TYPE_DISPLAY, FIELD_COLORS} from '@kepler.gl/constants';
function FieldTokenFactory(
fieldTypeDisplay: ReturnType<typeof getFieldTypes>,
diff --git a/src/components/common/file-uploader/file-upload.tsx b/src/components/common/file-uploader/file-upload.tsx
index 62b5ed6cf..ebac45b65 100644
--- a/src/components/common/file-uploader/file-upload.tsx
+++ b/src/components/common/file-uploader/file-upload.tsx
@@ -28,7 +28,7 @@ import FileDrop from './file-drop';
import {FileLoading, FileLoadingProgress} from 'reducers/vis-state-updaters';
import {isChrome} from 'utils/utils';
-import {GUIDES_FILE_FORMAT_DOC} from 'constants/user-guides';
+import {GUIDES_FILE_FORMAT_DOC} from '@kepler.gl/constants';
import ReactMarkdown from 'react-markdown';
// Breakpoints
import {media} from 'styles/media-breakpoints';
diff --git a/src/components/common/item-selector/typeahead.tsx b/src/components/common/item-selector/typeahead.tsx
index 9718d2d40..d530efb56 100644
--- a/src/components/common/item-selector/typeahead.tsx
+++ b/src/components/common/item-selector/typeahead.tsx
@@ -28,7 +28,7 @@ import {console as Console} from 'global/window';
import Accessor from './accessor';
import DropdownList, {ListItem} from './dropdown-list';
import {Search} from 'components/common/icons';
-import KeyEvent from 'constants/keyevent';
+import {KeyEvent} from '@kepler.gl/constants';
const DEFAULT_CLASS = 'typeahead';
/**
diff --git a/src/components/common/logo.tsx b/src/components/common/logo.tsx
index 8551d1071..41b9c92c7 100644
--- a/src/components/common/logo.tsx
+++ b/src/components/common/logo.tsx
@@ -20,7 +20,7 @@
import React from 'react';
import styled from 'styled-components';
-import {KEPLER_GL_NAME, KEPLER_GL_VERSION, KEPLER_GL_WEBSITE} from 'constants/default-settings';
+import {KEPLER_GL_NAME, KEPLER_GL_VERSION, KEPLER_GL_WEBSITE} from '@kepler.gl/constants';
const LogoTitle = styled.div`
display: inline-block;
diff --git a/src/components/common/styled-components.tsx b/src/components/common/styled-components.tsx
index 447f41101..663f6e061 100644
--- a/src/components/common/styled-components.tsx
+++ b/src/components/common/styled-components.tsx
@@ -22,7 +22,7 @@ import styled from 'styled-components';
import ReactTooltip from 'react-tooltip';
import {media} from 'styles/media-breakpoints';
import classnames from 'classnames';
-import {RGBColor} from 'reducers';
+import {RGBColor} from '@kepler.gl/types';
export const SelectText = styled.span`
color: ${props => props.theme.labelColor};
diff --git a/src/components/container.d.ts b/src/components/container.d.ts
deleted file mode 100644
index 62f48e8eb..000000000
--- a/src/components/container.d.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import {Component} from 'react';
-import {InjectorType, ProvideRecipesToInjectorType} from './injector';
-
-export const appInjector: InjectorType;
-
-export const injectComponents: (recipes: any[]) => ProvideRecipesToInjectorType;
-
-export const ContainerFactory: (KeplerGl: Component) => Component;
diff --git a/src/components/container.tsx b/src/components/container.tsx
index a6ef9d0d5..4c1452858 100644
--- a/src/components/container.tsx
+++ b/src/components/container.tsx
@@ -95,17 +95,6 @@ export function ContainerFactory(
mint: true
};
- getSelector = memoize((id, getState) => state => {
- if (!getState(state)) {
- // log error
- Console.error(ERROR_MSG.noState);
-
- return null;
- }
- return getState(state)[id];
- });
- getDispatch = memoize((id, dispatch) => forwardTo(id, dispatch));
-
componentDidMount() {
const {
id,
@@ -147,6 +136,17 @@ export function ContainerFactory(
}
}
+ getSelector = memoize((id, getState) => state => {
+ if (!getState(state)) {
+ // log error
+ Console.error(ERROR_MSG.noState);
+
+ return null;
+ }
+ return getState(state)[id];
+ });
+ getDispatch = memoize((id, dispatch) => forwardTo(id, dispatch));
+
render() {
const {id, getState, dispatch, state} = this.props;
const selector = this.getSelector(id, getState);
diff --git a/src/components/editor/editor.tsx b/src/components/editor/editor.tsx
index 7cdeaae5e..bac394ec0 100644
--- a/src/components/editor/editor.tsx
+++ b/src/components/editor/editor.tsx
@@ -27,11 +27,11 @@ import get from 'lodash.get';
import {createSelector} from 'reselect';
import FeatureActionPanelFactory, {FeatureActionPanelProps} from './feature-action-panel';
-import {FILTER_TYPES, EDITOR_MODES, EDITOR_AVAILABLE_LAYERS} from 'constants/default-settings';
+import {FILTER_TYPES, EDITOR_MODES, KeyEvent} from '@kepler.gl/constants';
+import {EDITOR_AVAILABLE_LAYERS} from 'layers/types';
import {DEFAULT_RADIUS, getStyle as getFeatureStyle} from './feature-styles';
import {getStyle as getEditHandleStyle, getEditHandleShape} from './handle-style';
-import KeyEvent from 'constants/keyevent';
import {Layer} from 'layers';
import {Datasets, Filter} from 'reducers';
import {Feature} from '@nebula.gl/edit-modes';
diff --git a/src/components/filters/time-range-filter.tsx b/src/components/filters/time-range-filter.tsx
index 999324b9c..d6f7a02ff 100644
--- a/src/components/filters/time-range-filter.tsx
+++ b/src/components/filters/time-range-filter.tsx
@@ -20,10 +20,9 @@
import React from 'react';
import TimeRangeSliderFactory from 'components/common/time-range-slider';
-import {DEFAULT_TIME_FORMAT} from 'constants/default-settings';
+import {DEFAULT_TIME_FORMAT} from '@kepler.gl/constants';
import {TimeRangeFilter} from 'reducers';
import {TimeRangeFilterProps} from './types';
-
/*
* TimeRangeFilter -> TimeRangeSlider -> RangeSlider
*/
diff --git a/src/components/geocoder-panel.tsx b/src/components/geocoder-panel.tsx
index 4c454cdc6..07ed5c107 100644
--- a/src/components/geocoder-panel.tsx
+++ b/src/components/geocoder-panel.tsx
@@ -32,7 +32,7 @@ import {
GEOCODER_GEO_OFFSET,
GEOCODER_ICON_COLOR,
GEOCODER_ICON_SIZE
-} from 'constants/default-settings';
+} from '@kepler.gl/constants';
import {MapState, Viewport} from 'reducers';
const ICON_LAYER = {
diff --git a/src/components/geocoder/geocoder.tsx b/src/components/geocoder/geocoder.tsx
index 4744c47d1..95cd53d7b 100644
--- a/src/components/geocoder/geocoder.tsx
+++ b/src/components/geocoder/geocoder.tsx
@@ -24,7 +24,7 @@ import classnames from 'classnames';
import MapboxClient from 'mapbox';
import {injectIntl, IntlShape} from 'react-intl';
import {WebMercatorViewport} from 'viewport-mercator-project';
-import KeyEvent from 'constants/keyevent';
+import {KeyEvent} from '@kepler.gl/constants';
import {Input} from 'components/common/styled-components';
import {Search, Delete} from 'components/common/icons';
import {Viewport} from 'reducers/map-state-updaters';
diff --git a/src/components/injector.d.ts b/src/components/injector.d.ts
deleted file mode 100644
index 35e13ac13..000000000
--- a/src/components/injector.d.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-import {Component, FunctionComponent, FC} from 'react';
-
-export const ERROR_MSG: {
- wrongRecipeType: string;
- noDep: (fac: any, parent: any) => string;
- noFunc: string;
-};
-
-export type FactoryElement = (...args) => Component;
-export type Factory = FactoryElement & {
- deps: FactoryElement[];
-};
-export type InjectorType = {
- provide: (factory: any, replacement: any) => InjectorType;
- get: (fac: any, parent?: any) => any;
-};
-
-export const injector: (map?: Map) => InjectorType;
-
-export type ProvideRecipesToInjectorType = (
- factories: Factory[],
- appInjector: InjectorType
-) => InjectorType;
-
-export const provideRecipesToInjector: ProvideRecipesToInjectorType;
-
-export const flattenDeps: (deps: Factory[], replacement: any) => Factory[];
-
-export const withState: (
- lenses: any,
- mapStateToProps: (state: object) => object,
- actions: object
-) => (Component: Component<any> | FunctionComponent<any> | FC<any>) => Component;
diff --git a/src/components/kepler-gl.d.ts b/src/components/kepler-gl.d.ts
deleted file mode 100644
index c800e4184..000000000
--- a/src/components/kepler-gl.d.ts
+++ /dev/null
@@ -1,58 +0,0 @@
-import {ComponentClass} from 'react';
-import {OnErrorCallBack, OnSuccessCallBack} from 'actions/provider-actions';
-import {MapState} from 'reducers/map-state-updaters';
-import {MapStyle} from 'reducers/map-style-updaters';
-import {UiState} from 'reducers/ui-state-updaters';
-import {VisState} from 'reducers/vis-state-updaters';
-import {ProviderState} from 'reducers/provider-state-updaters';
-import * as VisStateActions from 'actions/vis-state-actions';
-import * as MapStateActions from 'actions/map-state-actions';
-import * as MapStyleActions from 'actions/map-style-actions';
-import * as UIStateActions from 'actions/ui-state-actions';
-import * as ProviderActions from 'actions/provider-actions';
-
-export type KeplerGlProps = {
- id: string;
- appWebsite: any;
- onSaveMap?: () => void;
- onViewStateChange?: () => void;
- onDeckInitialized?: () => void;
- onKeplerGlInitialized?: () => void;
- mapboxApiAccessToken: string;
- mapboxApiUrl: string;
- getMapboxRef: () => React.RefType<any>;
- mapStyles: {id: string; style?: object}[];
- mapStylesReplaceDefault: boolean;
- mapboxApiUrl: string;
- width: number;
- height: number;
- appName: string;
- version: string;
- sidePanelWidth: number;
- theme: object;
- cloudProviders: object[];
- deckGlProps?: object;
- onLoadCloudMapSuccess?: OnSuccessCallBack;
- onLoadCloudMapError?: OnErrorCallBack;
- onExportToCloudSuccess?: OnSuccessCallBack;
- onExportToCloudError?: OnErrorCallBack;
- readOnly?: boolean;
-};
-
-export type UnconnectedKeplerGlProps = KeplerGlProps & {
- mapState: MapState;
- mapStyle: MapStyle;
- uiState: UiState;
- visState: VisState;
- providerState: ProviderState;
- visStateActions: typeof VisStateActions;
- uiStateActions: typeof UIStateActions;
- mapStateActions: typeof MapStateActions;
- mapStyleActions: typeof MapStyleActions;
- providerActions: typeof ProviderActions;
-};
-
-export type KeplerGlComponent = ComponentClass<UnconnectedKeplerGlProps>;
-export const DEFAULT_KEPLER_GL_PROPS: Partial<KeplerGlProps>;
-
-export default function KeplerGlFactory(): ComponentClass<KeplerGlProps>;
diff --git a/src/components/kepler-gl.tsx b/src/components/kepler-gl.tsx
index 031cffc7e..93b6b7fb6 100644
--- a/src/components/kepler-gl.tsx
+++ b/src/components/kepler-gl.tsx
@@ -49,9 +49,9 @@ import {
KEPLER_GL_VERSION,
THEME,
DEFAULT_MAPBOX_API_URL,
- GEOCODER_DATASET_NAME
-} from 'constants/default-settings';
-import {MISSING_MAPBOX_TOKEN} from 'constants/user-feedbacks';
+ GEOCODER_DATASET_NAME,
+ MISSING_MAPBOX_TOKEN
+} from '@kepler.gl/constants';
import SidePanelFactory from './side-panel';
import MapContainerFactory from './map-container';
diff --git a/src/components/map-container.tsx b/src/components/map-container.tsx
index feb6ae5f6..6b18d6b20 100644
--- a/src/components/map-container.tsx
+++ b/src/components/map-container.tsx
@@ -51,11 +51,7 @@ import {
// default-settings
import ThreeDBuildingLayer from 'deckgl-layers/3d-building-layer/3d-building-layer';
-import {
- FILTER_TYPES,
- GEOCODER_LAYER_ID,
- THROTTLE_NOTIFICATION_TIME
-} from 'constants/default-settings';
+import {FILTER_TYPES, GEOCODER_LAYER_ID, THROTTLE_NOTIFICATION_TIME} from '@kepler.gl/constants';
import ErrorBoundary from 'components/common/error-boundary';
import {observeDimensions, unobserveDimensions} from '../utils/observe-dimensions';
@@ -173,10 +169,7 @@ export default function MapContainerFactory(
Editor
): React.ComponentType<MapContainerProps> {
class MapContainer extends Component<MapContainerProps> {
- static propTypes = {
- // required
- };
-
+ displayName = 'MapContainer';
static defaultProps = {
MapComponent: MapboxGLMap,
deckGlProps: {},
@@ -184,17 +177,6 @@ export default function MapContainerFactory(
primary: true
};
- previousLayers = {
- // [layers.id]: mapboxLayerConfig
- };
-
- displayName = 'MapContainer';
-
- _deck: any = null;
- _map: mapboxgl.Map | null = null;
- _ref = createRef<HTMLDivElement>();
- _deckGLErrorsElapsed: {[id: string]: number} = {};
-
constructor(props) {
super(props);
}
@@ -218,6 +200,15 @@ export default function MapContainerFactory(
unobserveDimensions(this._ref.current);
}
+ _deck: any = null;
+ _map: mapboxgl.Map | null = null;
+ _ref = createRef<HTMLDivElement>();
+ _deckGLErrorsElapsed: {[id: string]: number} = {};
+
+ previousLayers = {
+ // [layers.id]: mapboxLayerConfig
+ };
+
_handleResize = dimensions => {
const {primary} = this.props;
if (primary) {
diff --git a/src/components/map/map-draw-panel.tsx b/src/components/map/map-draw-panel.tsx
index a5a8037e6..04b080978 100644
--- a/src/components/map/map-draw-panel.tsx
+++ b/src/components/map/map-draw-panel.tsx
@@ -21,7 +21,7 @@
import React, {useCallback} from 'react';
import classnames from 'classnames';
-import {EDITOR_MODES} from 'constants/default-settings';
+import {EDITOR_MODES} from '@kepler.gl/constants';
import {
CursorClick,
DrawPolygon,
diff --git a/src/components/map/map-legend-panel.tsx b/src/components/map/map-legend-panel.tsx
index 82c931c7c..1b4c9e24c 100644
--- a/src/components/map/map-legend-panel.tsx
+++ b/src/components/map/map-legend-panel.tsx
@@ -29,7 +29,7 @@ import MapLegendFactory from './map-legend';
import Tippy from '@tippyjs/react/headless';
import TippyTooltip from 'components/common/tippy-tooltip';
import {createPortal} from 'react-dom';
-import {DIMENSIONS} from 'constants/default-settings';
+import {DIMENSIONS} from '@kepler.gl/constants';
import {MapControl, MapControls} from 'reducers';
import {Layer} from 'layers';
diff --git a/src/components/map/map-legend.tsx b/src/components/map/map-legend.tsx
index 67add194a..0848c9027 100644
--- a/src/components/map/map-legend.tsx
+++ b/src/components/map/map-legend.tsx
@@ -22,7 +22,7 @@ import React from 'react';
import styled from 'styled-components';
import {rgb} from 'd3-color';
import ColorLegend from 'components/common/color-legend';
-import {CHANNEL_SCALES, DIMENSIONS} from 'constants/default-settings';
+import {CHANNEL_SCALES, DIMENSIONS} from '@kepler.gl/constants';
import {FormattedMessage} from 'localization';
import Layer, {LayerBaseConfig, VisualChannel, VisualChannelDescription} from 'layers/base-layer';
diff --git a/src/components/modal-container.tsx b/src/components/modal-container.tsx
index f06f20768..244eac91c 100644
--- a/src/components/modal-container.tsx
+++ b/src/components/modal-container.tsx
@@ -24,7 +24,7 @@ import {createSelector} from 'reselect';
import get from 'lodash.get';
import document from 'global/document';
-import {EXPORT_DATA_TYPE_OPTIONS, EXPORT_MAP_FORMATS} from 'constants/default-settings';
+import {EXPORT_DATA_TYPE_OPTIONS, EXPORT_MAP_FORMATS} from '@kepler.gl/constants';
import ModalDialogFactory from './modals/modal-dialog';
import {exportJson, exportHtml, exportData, exportImage, exportMap} from 'utils/export-utils';
import {isValidMapInfo} from 'utils/map-info-utils';
@@ -56,9 +56,9 @@ import {
SAVE_MAP_ID,
SHARE_MAP_ID,
OVERWRITE_MAP_ID
-} from 'constants/default-settings';
+} from '@kepler.gl/constants';
-import KeyEvent from 'constants/keyevent';
+import {KeyEvent} from '@kepler.gl/constants';
import {getFileFormatNames, getFileExtensions} from '../reducers/vis-state-selectors';
import {MapState, MapStyle, UiState, VisState} from 'reducers';
import {OnSuccessCallBack, OnErrorCallBack} from 'actions';
diff --git a/src/components/modals/data-table-modal.tsx b/src/components/modals/data-table-modal.tsx
index 1eca6b3ee..b3f64476b 100644
--- a/src/components/modals/data-table-modal.tsx
+++ b/src/components/modals/data-table-modal.tsx
@@ -114,7 +114,9 @@ interface DataTableModalProps {
showTab?: boolean;
}
-function DataTableModalFactory(DataTable: ReturnType<typeof DataTableFactory>): React.ComponentType<Omit<DataTableModalProps, "theme">> {
+function DataTableModalFactory(
+ DataTable: ReturnType<typeof DataTableFactory>
+): React.ComponentType<Omit<DataTableModalProps, 'theme'>> {
class DataTableModal extends React.Component<DataTableModalProps> {
datasetCellSizeCache = {};
dataId = ({dataId = ''}: DataTableModalProps) => dataId;
diff --git a/src/components/modals/export-data-modal.tsx b/src/components/modals/export-data-modal.tsx
index dbeed73d4..fcf84cf9b 100644
--- a/src/components/modals/export-data-modal.tsx
+++ b/src/components/modals/export-data-modal.tsx
@@ -20,7 +20,7 @@
import React, {Component} from 'react';
-import {EXPORT_DATA_TYPE_OPTIONS} from 'constants/default-settings';
+import {EXPORT_DATA_TYPE_OPTIONS} from '@kepler.gl/constants';
import {FileType} from 'components/common/icons';
import {
StyledExportSection,
diff --git a/src/components/modals/export-image-modal.tsx b/src/components/modals/export-image-modal.tsx
index 1fd801ca0..127e7534d 100644
--- a/src/components/modals/export-image-modal.tsx
+++ b/src/components/modals/export-image-modal.tsx
@@ -23,7 +23,7 @@ import styled from 'styled-components';
import ImagePreview from 'components/common/image-preview';
import {SetExportImageSettingUpdaterAction} from '../../actions';
-import {EXPORT_IMG_RATIO_OPTIONS, EXPORT_IMG_RESOLUTION_OPTIONS} from 'constants/default-settings';
+import {EXPORT_IMG_RATIO_OPTIONS, EXPORT_IMG_RESOLUTION_OPTIONS} from '@kepler.gl/constants';
import {StyledModalContent, SelectionButton, CheckMark} from 'components/common/styled-components';
import Switch from 'components/common/switch';
diff --git a/src/components/modals/export-map-modal/export-html-map.tsx b/src/components/modals/export-map-modal/export-html-map.tsx
index a50e0c42a..7d35a830b 100644
--- a/src/components/modals/export-map-modal/export-html-map.tsx
+++ b/src/components/modals/export-map-modal/export-html-map.tsx
@@ -21,8 +21,11 @@
import React from 'react';
import {StyledExportSection, StyledType, CheckMark} from 'components/common/styled-components';
import {StyledExportMapSection, StyledWarning, ExportMapLink} from './components';
-import {EXPORT_HTML_MAP_MODE_OPTIONS} from 'constants/default-settings';
-import {EXPORT_HTML_MAP_DOC, EXPORT_HTML_MAP_MODES_DOC} from 'constants/user-guides';
+import {
+ EXPORT_HTML_MAP_MODE_OPTIONS,
+ EXPORT_HTML_MAP_DOC,
+ EXPORT_HTML_MAP_MODES_DOC
+} from '@kepler.gl/constants';
import styled from 'styled-components';
import {injectIntl} from 'react-intl';
import {FormattedMessage} from 'localization';
diff --git a/src/components/modals/export-map-modal/export-json-map.tsx b/src/components/modals/export-map-modal/export-json-map.tsx
index 7cb5764d7..2fa5efb1d 100644
--- a/src/components/modals/export-map-modal/export-json-map.tsx
+++ b/src/components/modals/export-map-modal/export-json-map.tsx
@@ -20,7 +20,7 @@
import React, {useState} from 'react';
import JSONPretty from 'react-json-pretty';
-import {ADD_DATA_TO_MAP_DOC} from 'constants/user-guides';
+import {ADD_DATA_TO_MAP_DOC} from '@kepler.gl/constants';
import styled from 'styled-components';
import {StyledExportSection, Button} from 'components/common/styled-components';
import {StyledExportMapSection, StyledWarning, ExportMapLink} from './components';
diff --git a/src/components/modals/export-map-modal/export-map-modal.tsx b/src/components/modals/export-map-modal/export-map-modal.tsx
index c8a863d1a..c90d66a30 100644
--- a/src/components/modals/export-map-modal/export-map-modal.tsx
+++ b/src/components/modals/export-map-modal/export-map-modal.tsx
@@ -22,7 +22,7 @@ import React from 'react';
import {FileType} from 'components/common/icons';
import {StyledModalContent, StyledType, CheckMark} from 'components/common/styled-components';
-import {EXPORT_MAP_FORMATS, EXPORT_MAP_FORMAT_OPTIONS} from 'constants/default-settings';
+import {EXPORT_MAP_FORMATS, EXPORT_MAP_FORMAT_OPTIONS} from '@kepler.gl/constants';
import {StyledExportMapSection} from './components';
import ExportHtmlMapFactory from './export-html-map';
import ExportJsonMapFactory from './export-json-map';
diff --git a/src/components/modals/image-modal-container.tsx b/src/components/modals/image-modal-container.tsx
index 1115e15e8..fe5662177 100644
--- a/src/components/modals/image-modal-container.tsx
+++ b/src/components/modals/image-modal-container.tsx
@@ -21,7 +21,7 @@
import React, {useEffect} from 'react';
import get from 'lodash.get';
-import {MAP_THUMBNAIL_DIMENSION, EXPORT_IMG_RATIOS} from 'constants/default-settings';
+import {MAP_THUMBNAIL_DIMENSION, EXPORT_IMG_RATIOS} from '@kepler.gl/constants';
import {SetExportImageSettingUpdaterAction} from 'actions';
import {Provider} from 'cloud-providers';
diff --git a/src/components/modals/load-data-modal.tsx b/src/components/modals/load-data-modal.tsx
index fcc438878..4a0708065 100644
--- a/src/components/modals/load-data-modal.tsx
+++ b/src/components/modals/load-data-modal.tsx
@@ -28,7 +28,7 @@ import LoadStorageMapFactory from './load-storage-map';
import ModalTabsFactory from './modal-tabs';
import LoadingDialog from './loading-dialog';
-import {LOADING_METHODS} from 'constants/default-settings';
+import {LOADING_METHODS} from '@kepler.gl/constants';
import {FileLoading} from 'reducers/vis-state-updaters';
/** @typedef {import('./load-data-modal').LoadDataModalProps} LoadDataModalProps */
diff --git a/src/components/modals/save-map-modal.tsx b/src/components/modals/save-map-modal.tsx
index 2a1bd195b..0493c2bd8 100644
--- a/src/components/modals/save-map-modal.tsx
+++ b/src/components/modals/save-map-modal.tsx
@@ -25,7 +25,7 @@ import ImageModalContainer, {ImageModalContainerProps} from './image-modal-conta
import ProviderModalContainer, {ProviderModalContainerProps} from './provider-modal-container';
import StatusPanel, {UploadAnimation} from './status-panel';
-import {MAP_THUMBNAIL_DIMENSION, MAP_INFO_CHARACTER} from 'constants/default-settings';
+import {MAP_THUMBNAIL_DIMENSION, MAP_INFO_CHARACTER} from '@kepler.gl/constants';
import {
StyledModalContent,
@@ -139,7 +139,8 @@ export const MapInfoPanel: React.FC<MapInfoPanelProps> = ({
</div>
<StyledModalInputFootnote
error={
- Boolean(characterLimits?.description) && mapInfo.description.length > Number(characterLimits?.description)
+ Boolean(characterLimits?.description) &&
+ mapInfo.description.length > Number(characterLimits?.description)
}
>
{mapInfo.description.length}/
diff --git a/src/components/notification-panel.tsx b/src/components/notification-panel.tsx
index 591af4ec2..b5a2f32d3 100644
--- a/src/components/notification-panel.tsx
+++ b/src/components/notification-panel.tsx
@@ -22,7 +22,7 @@ import React, {Component} from 'react';
import styled from 'styled-components';
import NotificationItemFactory from './notification-panel/notification-item';
-import {DEFAULT_NOTIFICATION_TOPICS} from 'constants/default-settings';
+import {DEFAULT_NOTIFICATION_TOPICS} from '@kepler.gl/constants';
import {Notifications} from 'reducers';
import {removeNotification} from 'actions/ui-state-actions';
diff --git a/src/components/plot-container.tsx b/src/components/plot-container.tsx
index 68dcf8482..202d0e48d 100644
--- a/src/components/plot-container.tsx
+++ b/src/components/plot-container.tsx
@@ -32,7 +32,7 @@ import {scaleMapStyleByResolution} from 'utils/map-style-utils/mapbox-gl-style-e
import {findMapBounds} from 'utils/data-utils';
import {getCenterAndZoomFromBounds} from 'utils/projection-utils';
-import {GEOCODER_LAYER_ID} from 'constants/default-settings';
+import {GEOCODER_LAYER_ID} from '@kepler.gl/constants';
import {ExportImage, SplitMap} from 'reducers';
import {setExportImageDataUri, setExportImageError, setExportImageSetting} from 'actions';
import {mapFieldsSelector} from './kepler-gl';
diff --git a/src/components/side-panel.tsx b/src/components/side-panel.tsx
index 22bc3845d..633fd7634 100644
--- a/src/components/side-panel.tsx
+++ b/src/components/side-panel.tsx
@@ -31,7 +31,9 @@ import {
EXPORT_IMAGE_ID,
ADD_DATA_ID,
ADD_MAP_STYLE_ID
-} from 'constants/default-settings';
+} from '@kepler.gl/constants';
+
+import {Layers, FilterFunnel, Settings, CursorClick} from 'components/common/icons';
import SidebarFactory from './side-panel/side-bar';
import PanelHeaderFactory from './side-panel/panel-header';
@@ -95,10 +97,18 @@ export default function SidePanelFactory(
map: MapManager
};
+ const SIDEBAR_ICONS = {
+ layer: Layers,
+ filter: FilterFunnel,
+ interaction: Settings,
+ map: CursorClick
+ };
+
// We should defined sidebar panels here but keeping them for backward compatible
const fullPanels = SIDEBAR_PANELS.map(component => ({
...component,
- component: SIDEBAR_COMPONENTS[component.id]
+ component: SIDEBAR_COMPONENTS[component.id],
+ iconComponent: SIDEBAR_ICONS[component.id]
}));
const getCustomPanelProps = get(CustomPanels, ['defaultProps', 'getProps']) || (() => ({}));
diff --git a/src/components/side-panel/filter-panel/filter-panel-header.tsx b/src/components/side-panel/filter-panel/filter-panel-header.tsx
index 201a151a4..6111ec5f7 100644
--- a/src/components/side-panel/filter-panel/filter-panel-header.tsx
+++ b/src/components/side-panel/filter-panel/filter-panel-header.tsx
@@ -24,7 +24,8 @@ import PanelHeaderActionFactory from 'components/side-panel/panel-header-action'
import {Trash} from 'components/common/icons';
import {createLinearGradient} from 'utils/color-utils';
import {StyledPanelHeader, StyledPanelHeaderProps} from 'components/common/styled-components';
-import {Filter, RGBColor} from 'reducers';
+import {Filter} from 'reducers';
+import {RGBColor} from '@kepler.gl/types';
import KeplerTable from 'utils/table-utils/kepler-table';
interface StyledFilterHeaderProps extends StyledPanelHeaderProps {
diff --git a/src/components/side-panel/filter-panel/filter-panel.tsx b/src/components/side-panel/filter-panel/filter-panel.tsx
index 8c9ed3852..cdf8ee33f 100644
--- a/src/components/side-panel/filter-panel/filter-panel.tsx
+++ b/src/components/side-panel/filter-panel/filter-panel.tsx
@@ -22,7 +22,7 @@ import React, {Component} from 'react';
import {createSelector} from 'reselect';
import styled from 'styled-components';
import get from 'lodash.get';
-import {ALL_FIELD_TYPES, FILTER_TYPES} from 'constants/default-settings';
+import {ALL_FIELD_TYPES, FILTER_TYPES} from '@kepler.gl/constants';
import NewFilterPanelFactory from 'components/filters/filter-panels/new-filter-panel';
import TimeRangeFilterPanelFactory from 'components/filters/filter-panels/time-range-filter-panel';
diff --git a/src/components/side-panel/interaction-panel/tooltip-config.tsx b/src/components/side-panel/interaction-panel/tooltip-config.tsx
index 43087ca90..66c1f0839 100644
--- a/src/components/side-panel/interaction-panel/tooltip-config.tsx
+++ b/src/components/side-panel/interaction-panel/tooltip-config.tsx
@@ -33,9 +33,8 @@ import DatasetTagFactory from 'components/side-panel/common/dataset-tag';
import TooltipChickletFactory from './tooltip-config/tooltip-chicklet';
import Switch from 'components/common/switch';
import ItemSelector from 'components/common/item-selector/item-selector';
-import {COMPARE_TYPES} from 'constants/tooltip';
+import {COMPARE_TYPES, GEOCODER_DATASET_NAME} from '@kepler.gl/constants';
import FieldSelectorFactory from '../../common/field-selector';
-import {GEOCODER_DATASET_NAME} from 'constants/default-settings';
import KeplerTable from 'utils/table-utils/kepler-table';
import {Datasets} from 'reducers';
diff --git a/src/components/side-panel/interaction-panel/tooltip-config/tooltip-chicklet.tsx b/src/components/side-panel/interaction-panel/tooltip-config/tooltip-chicklet.tsx
index d0bed8289..1d9bc0745 100644
--- a/src/components/side-panel/interaction-panel/tooltip-config/tooltip-chicklet.tsx
+++ b/src/components/side-panel/interaction-panel/tooltip-config/tooltip-chicklet.tsx
@@ -25,8 +25,8 @@ import {Hash, Delete} from 'components/common/icons';
import DropdownList from 'components/common/item-selector/dropdown-list';
import {FormattedMessage} from 'localization';
import onClickOutside from 'react-onclickoutside';
-import {FIELD_OPTS} from 'constants/default-settings';
-import {TOOLTIP_FORMATS, TOOLTIP_FORMAT_TYPES, TOOLTIP_KEY} from 'constants/tooltip';
+import {FIELD_OPTS} from '@kepler.gl/constants';
+import {TOOLTIP_FORMATS, TOOLTIP_FORMAT_TYPES, TOOLTIP_KEY} from '@kepler.gl/constants';
import {getFormatter} from 'utils/data-utils';
import TippyTooltip from 'components/common/tippy-tooltip';
diff --git a/src/components/side-panel/layer-manager.tsx b/src/components/side-panel/layer-manager.tsx
index 22f4afefb..2a2d5e9c7 100644
--- a/src/components/side-panel/layer-manager.tsx
+++ b/src/components/side-panel/layer-manager.tsx
@@ -34,7 +34,7 @@ import AddLayerButtonFactory from './layer-panel/add-layer-button';
import ItemSelector from 'components/common/item-selector/item-selector';
import {PanelLabel, SidePanelDivider, SidePanelSection} from 'components/common/styled-components';
-import {LAYER_BLENDINGS} from 'constants/default-settings';
+import {LAYER_BLENDINGS} from '@kepler.gl/constants';
import {Datasets} from 'reducers';
import {Layer, LayerClassesType} from 'layers';
import * as UiStateActions from 'actions/ui-state-actions';
diff --git a/src/components/side-panel/layer-panel/add-layer-button.tsx b/src/components/side-panel/layer-panel/add-layer-button.tsx
index b09b73bf7..ae64b838c 100644
--- a/src/components/side-panel/layer-panel/add-layer-button.tsx
+++ b/src/components/side-panel/layer-panel/add-layer-button.tsx
@@ -29,7 +29,8 @@ import {Button} from 'components/common/styled-components';
import {DatasetSquare} from 'components';
import Typeahead from 'components/common/item-selector/typeahead';
import Accessor from 'components/common/item-selector/accessor';
-import {Datasets, RGBColor} from 'reducers';
+import {Datasets} from 'reducers';
+import {RGBColor} from '@kepler.gl/types';
type AddLayerButtonProps = {
datasets: Datasets;
diff --git a/src/components/side-panel/layer-panel/color-palette.tsx b/src/components/side-panel/layer-panel/color-palette.tsx
index 5b383b753..a58ed0ee1 100644
--- a/src/components/side-panel/layer-panel/color-palette.tsx
+++ b/src/components/side-panel/layer-panel/color-palette.tsx
@@ -19,7 +19,7 @@
// THE SOFTWARE.
import React from 'react';
-import {HexColor, RGBColor} from 'reducers';
+import {HexColor, RGBColor} from '@kepler.gl/types';
import styled from 'styled-components';
import classnames from 'classnames';
diff --git a/src/components/side-panel/layer-panel/color-range-selector.tsx b/src/components/side-panel/layer-panel/color-range-selector.tsx
index 5a3fc4b0e..c6c2aa938 100644
--- a/src/components/side-panel/layer-panel/color-range-selector.tsx
+++ b/src/components/side-panel/layer-panel/color-range-selector.tsx
@@ -28,12 +28,12 @@ import {PanelLabel} from 'components/common/styled-components';
import Switch from 'components/common/switch';
import ColorPalette from './color-palette';
import CustomPalette from './custom-palette';
-import {COLOR_RANGES, ColorRange} from 'constants/color-ranges';
+import {COLOR_RANGES, ColorRange} from '@kepler.gl/constants';
import {numberSort} from 'utils/data-utils';
import {reverseColorRange} from 'utils/color-utils';
import {FormattedMessage} from 'localization';
import {ColorUI} from 'layers/layer-factory';
-import {NestedPartial} from 'reducers';
+import {NestedPartial} from '@kepler.gl/types';
type ColorRangeSelectorProps = {
colorPaletteUI: ColorUI;
diff --git a/src/components/side-panel/layer-panel/color-selector.tsx b/src/components/side-panel/layer-panel/color-selector.tsx
index 213d4f078..0fa29e589 100644
--- a/src/components/side-panel/layer-panel/color-selector.tsx
+++ b/src/components/side-panel/layer-panel/color-selector.tsx
@@ -27,8 +27,8 @@ import ColorPalette from './color-palette';
import {StyledPanelDropdown} from 'components/common/styled-components';
import onClickOutside from 'react-onclickoutside';
import {ColorUI} from 'layers/layer-factory';
-import {ColorRange} from 'constants/color-ranges';
-import {NestedPartial, RGBColor} from 'reducers';
+import {ColorRange} from '@kepler.gl/constants';
+import {NestedPartial, RGBColor} from '@kepler.gl/types';
type ColorSelectorInputProps = {
active: boolean;
diff --git a/src/components/side-panel/layer-panel/custom-palette.tsx b/src/components/side-panel/layer-panel/custom-palette.tsx
index 4766fac8e..f4f06b920 100644
--- a/src/components/side-panel/layer-panel/custom-palette.tsx
+++ b/src/components/side-panel/layer-panel/custom-palette.tsx
@@ -29,8 +29,8 @@ import {VertDots, Trash} from 'components/common/icons';
import ColorPalette from './color-palette';
import CustomPicker from './custom-picker';
import {arrayMove} from 'utils/data-utils';
-import {ColorRange} from 'constants/color-ranges';
-import {NestedPartial} from 'reducers';
+import {ColorRange} from '@kepler.gl/constants';
+import {NestedPartial} from '@kepler.gl/types';
type CustomPaletteProps = {
customPalette: ColorRange;
diff --git a/src/components/side-panel/layer-panel/layer-configurator.tsx b/src/components/side-panel/layer-panel/layer-configurator.tsx
index a4947de33..2602230f2 100644
--- a/src/components/side-panel/layer-panel/layer-configurator.tsx
+++ b/src/components/side-panel/layer-panel/layer-configurator.tsx
@@ -39,16 +39,16 @@ import TextLabelPanelFactory from './text-label-panel';
import {capitalizeFirstLetter} from 'utils/utils';
-import {CHANNEL_SCALE_SUPPORTED_FIELDS} from 'constants/default-settings';
-import {LAYER_TYPES} from 'layers/types';
+import {CHANNEL_SCALE_SUPPORTED_FIELDS, ColorRange} from '@kepler.gl/constants';
import {Layer, LayerBaseConfig, LayerVisConfig} from 'layers';
-import {Datasets, NestedPartial, RGBColor} from 'reducers';
+import {LAYER_TYPES} from 'layers/types';
+import {Datasets} from 'reducers';
+import {NestedPartial, RGBColor} from '@kepler.gl/types';
import {ColorUI} from 'layers/layer-factory';
import {VisualChannel} from 'layers/base-layer';
import AggregationLayer from 'layers/aggregation-layer';
import {Field} from 'utils/table-utils/kepler-table';
import {toggleModal} from 'actions/ui-state-actions';
-import {ColorRange} from 'constants/color-ranges';
import {ActionHandler} from 'actions';
type LayerConfiguratorProps = {
diff --git a/src/components/side-panel/layer-panel/layer-panel-header.tsx b/src/components/side-panel/layer-panel/layer-panel-header.tsx
index 0c266d4d6..fb7a7811b 100644
--- a/src/components/side-panel/layer-panel/layer-panel-header.tsx
+++ b/src/components/side-panel/layer-panel/layer-panel-header.tsx
@@ -33,7 +33,7 @@ import {Copy, ArrowDown, EyeSeen, EyeUnseen, Trash, VertDots} from 'components/c
import {InlineInput, StyledPanelHeader} from 'components/common/styled-components';
import {FormattedMessage} from 'localization';
-import {RGBColor} from 'reducers';
+import {RGBColor} from '@kepler.gl/types';
import {BaseProps} from 'components/common/icons/base';
type LayerLabelEditorProps = {
diff --git a/src/components/side-panel/layer-panel/layer-panel.tsx b/src/components/side-panel/layer-panel/layer-panel.tsx
index 129b0e363..eb7087be7 100644
--- a/src/components/side-panel/layer-panel/layer-panel.tsx
+++ b/src/components/side-panel/layer-panel/layer-panel.tsx
@@ -29,7 +29,8 @@ import styled from 'styled-components';
import LayerConfiguratorFactory from './layer-configurator';
import LayerPanelHeaderFactory from './layer-panel-header';
-import {Datasets, NestedPartial} from 'reducers';
+import {Datasets} from 'reducers';
+import {NestedPartial} from '@kepler.gl/types';
import {Layer, LayerBaseConfig, LayerVisConfig} from 'layers';
import {toggleModal} from 'actions/ui-state-actions';
import * as VisStateActions from 'actions/vis-state-actions';
diff --git a/src/components/side-panel/layer-panel/layer-type-list-item.tsx b/src/components/side-panel/layer-panel/layer-type-list-item.tsx
index 625069134..f997b2171 100644
--- a/src/components/side-panel/layer-panel/layer-type-list-item.tsx
+++ b/src/components/side-panel/layer-panel/layer-type-list-item.tsx
@@ -20,7 +20,7 @@
import React, {ComponentType} from 'react';
import styled from 'styled-components';
-import {CLOUDFRONT} from 'constants/default-settings';
+import {CLOUDFRONT} from '@kepler.gl/constants';
import classNames from 'classnames';
import {FormattedMessage} from 'localization';
import {BaseProps} from 'components/common/icons/base';
diff --git a/src/components/side-panel/layer-panel/single-color-palette.tsx b/src/components/side-panel/layer-panel/single-color-palette.tsx
index d9c22c387..0a6e511f3 100644
--- a/src/components/side-panel/layer-panel/single-color-palette.tsx
+++ b/src/components/side-panel/layer-panel/single-color-palette.tsx
@@ -23,9 +23,8 @@ import {range} from 'd3-array';
import styled from 'styled-components';
import {hexToRgb} from 'utils/color-utils';
-import {ColorsByTheme, Themes} from 'constants/color-palette';
-import {RGBColor} from 'reducers';
-import {ColorRange} from 'constants/color-ranges';
+import {ColorsByTheme, Themes, ColorRange} from '@kepler.gl/constants';
+import {RGBColor} from '@kepler.gl/types';
type SingleColorPaletteProps = {
onSelectColor: (color: RGBColor | ColorRange, e: MouseEvent) => void;
diff --git a/src/components/side-panel/layer-panel/text-label-panel.tsx b/src/components/side-panel/layer-panel/text-label-panel.tsx
index d2f134afc..f594d0bc7 100644
--- a/src/components/side-panel/layer-panel/text-label-panel.tsx
+++ b/src/components/side-panel/layer-panel/text-label-panel.tsx
@@ -40,7 +40,7 @@ import RangeSliderFactory from 'components/common/range-slider';
import {LayerTextLabel, LAYER_TEXT_CONFIGS} from 'layers/layer-factory';
import FieldSelectorFactory from '../../common/field-selector';
import {Field} from 'utils/table-utils/kepler-table';
-import {RGBColor} from 'reducers';
+import {RGBColor} from '@kepler.gl/types';
type TextLabelPanelProps = {
fields: Field[];
diff --git a/src/components/side-panel/layer-panel/vis-config-slider.tsx b/src/components/side-panel/layer-panel/vis-config-slider.tsx
index 006c9962b..643b800b9 100644
--- a/src/components/side-panel/layer-panel/vis-config-slider.tsx
+++ b/src/components/side-panel/layer-panel/vis-config-slider.tsx
@@ -24,7 +24,7 @@ import styled from 'styled-components';
import {PanelLabel, SidePanelSection} from 'components/common/styled-components';
import RangeSliderFactory from 'components/common/range-slider';
import {FormattedMessage} from 'localization';
-import KeyEvent from 'constants/keyevent';
+import {KeyEvent} from '@kepler.gl/constants';
import {Checkbox} from 'components';
import {clamp} from 'utils/data-utils';
import {isInRange} from 'utils/filter-utils';
diff --git a/src/constants/babel.config.js b/src/constants/babel.config.js
new file mode 100644
index 000000000..7aec54a78
--- /dev/null
+++ b/src/constants/babel.config.js
@@ -0,0 +1,65 @@
+// Copyright (c) 2022 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+const KeplerPackage = require('./package');
+
+const PRESETS = ['@babel/preset-env', '@babel/preset-react', '@babel/preset-typescript'];
+const PLUGINS = [
+ ['@babel/plugin-transform-typescript', {isTSX: true, allowDeclareFields: true}],
+ '@babel/plugin-transform-modules-commonjs',
+ '@babel/plugin-proposal-export-namespace-from',
+ '@babel/plugin-proposal-optional-chaining',
+ [
+ '@babel/transform-runtime',
+ {
+ regenerator: true
+ }
+ ],
+ [
+ 'search-and-replace',
+ {
+ rules: [
+ {
+ search: '__PACKAGE_VERSION__',
+ replace: KeplerPackage.version
+ }
+ ]
+ }
+ ]
+];
+const ENV = {
+ test: {
+ plugins: ['istanbul']
+ },
+ debug: {
+ sourceMaps: 'inline',
+ retainLines: true
+ }
+};
+
+module.exports = function babel(api) {
+ api.cache(true);
+
+ return {
+ presets: PRESETS,
+ plugins: PLUGINS,
+ env: ENV
+ };
+};
diff --git a/src/constants/index.ts b/src/constants/index.ts
deleted file mode 100644
index 3d4d73625..000000000
--- a/src/constants/index.ts
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright (c) 2022 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-// Constants
-export {
- ADD_DATA_ID,
- ADD_MAP_STYLE_ID,
- AGGREGATION_TYPES,
- ALL_FIELD_TYPES,
- CHANNEL_SCALES,
- DATA_TABLE_ID,
- DATASET_FORMATS,
- DEFAULT_LAYER_GROUPS,
- DEFAULT_MAP_STYLES,
- DEFAULT_NOTIFICATION_TOPICS,
- DEFAULT_NOTIFICATION_TYPES,
- DELETE_DATA_ID,
- DIMENSIONS,
- EDITOR_MODES,
- EXPORT_DATA_ID,
- EXPORT_DATA_TYPE_OPTIONS,
- EXPORT_IMAGE_ID,
- EXPORT_IMG_RATIO_OPTIONS,
- EXPORT_IMG_RATIOS,
- EXPORT_IMG_RESOLUTION_OPTIONS,
- EXPORT_MAP_FORMAT_OPTIONS,
- EXPORT_MAP_FORMATS,
- EXPORT_MAP_ID,
- FIELD_OPTS,
- FILTER_TYPES,
- GEOJSON_FIELDS,
- ICON_FIELDS,
- KEPLER_GL_NAME,
- KEPLER_GL_VERSION,
- KEPLER_GL_WEBSITE,
- LAYER_BLENDINGS,
- MAX_DEFAULT_TOOLTIPS,
- PANELS,
- SIDEBAR_PANELS,
- SCALE_TYPES,
- THEME,
- TRIP_ARC_FIELDS,
- TRIP_POINT_FIELDS,
- BASE_SPEED,
- FPS,
- ANIMATION_WINDOW,
- DEFAULT_TIME_FORMAT,
- SPEED_CONTROL_RANGE,
- RESOLUTIONS,
- SORT_ORDER,
- MAP_CONTROLS
-} from './default-settings';
-
-export {BUG_REPORT_LINK, USER_GUIDE_DOC} from './user-guides';
-
-export {VizColorPalette, DataVizColors} from './custom-color-ranges';
-export {COLOR_RANGES, DEFAULT_COLOR_RANGE} from './color-ranges';
-export {default as KeyEvent} from './keyevent';
-export {LAYER_TYPES} from 'layers/types';
-export {PLOT_TYPES} from 'utils/filter-utils';
diff --git a/src/constants/package.json b/src/constants/package.json
new file mode 100644
index 000000000..a01e5fc20
--- /dev/null
+++ b/src/constants/package.json
@@ -0,0 +1,62 @@
+{
+ "name": "@kepler.gl/constants",
+ "author": "Shan He <[email protected]>",
+ "version": "2.5.5",
+ "description": "kepler.gl constants used by kepler.gl components, actions and reducers",
+ "license": "MIT",
+ "main": "dist/index.js",
+ "types": "index.d.ts",
+ "keywords": [
+ "babel",
+ "es6",
+ "react",
+ "webgl",
+ "visualization",
+ "deck.gl"
+ ],
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/keplergl/kepler.gl.git"
+ },
+ "scripts": {
+ "build": "rm -fr dist && babel src --out-dir dist --source-maps inline --extensions '.ts,.tsx,.js,.jsx' --ignore '**/*.d.ts'",
+ "build:umd": "webpack --config ./webpack/umd.js --progress --env.prod",
+ "build:types": "tsc --project ./tsconfig.production.json",
+ "prepublish": "uber-licence && yarn build && yarn build:umd && yarn build:types"
+ },
+ "files": [
+ "dist",
+ "umd"
+ ],
+ "dependencies": {
+ "colorbrewer": "^1.5.0",
+ "d3-scale": "^3.2.3",
+ "global": "^4.3.0",
+ "keymirror": "^0.1.1",
+ "react-map-gl-draw": "0.14.8"
+ },
+ "exports": {
+ ".": "./dist/index.js",
+ "./*": "./dist/*"
+ },
+ "typesVersions": {
+ "*": {
+ "*": ["dist/*"]
+ }
+ },
+ "nyc": {
+ "sourceMap": false,
+ "instrument": false
+ },
+ "engines": {
+ "node": ">=12.0.0"
+ },
+ "maintainers": [
+ "Shan He <[email protected]>",
+ "Giuseppe Macri <[email protected]>"
+ ],
+ "volta": {
+ "node": "12.22.0",
+ "yarn": "1.22.17"
+ }
+}
diff --git a/src/constants/color-palette.ts b/src/constants/src/color-palette.ts
similarity index 100%
rename from src/constants/color-palette.ts
rename to src/constants/src/color-palette.ts
diff --git a/src/constants/color-ranges.ts b/src/constants/src/color-ranges.ts
similarity index 98%
rename from src/constants/color-ranges.ts
rename to src/constants/src/color-ranges.ts
index 7e9f11928..485d4f2f5 100644
--- a/src/constants/color-ranges.ts
+++ b/src/constants/src/color-ranges.ts
@@ -19,7 +19,7 @@
// THE SOFTWARE.
import colorbrewer from 'colorbrewer';
-import {HexColor} from 'reducers';
+import {HexColor} from '@kepler.gl/types';
import {VizColorPalette} from './custom-color-ranges';
export type ColorMap = [string | number | null, HexColor][];
diff --git a/src/constants/custom-color-ranges.ts b/src/constants/src/custom-color-ranges.ts
similarity index 100%
rename from src/constants/custom-color-ranges.ts
rename to src/constants/src/custom-color-ranges.ts
diff --git a/src/constants/default-settings.ts b/src/constants/src/default-settings.ts
similarity index 96%
rename from src/constants/default-settings.ts
rename to src/constants/src/default-settings.ts
index 97ed8cc56..122625848 100644
--- a/src/constants/default-settings.ts
+++ b/src/constants/src/default-settings.ts
@@ -30,21 +30,8 @@ import {
scaleLog,
scalePoint
} from 'd3-scale';
-import {
- Layers,
- FilterFunnel,
- Settings,
- CursorClick,
- Pin,
- ArrowDown,
- ArrowUp,
- Clipboard,
- Cancel
-} from 'components/common/icons';
-import {getHTMLMapModeTileUrl} from 'utils/utils';
import {TOOLTIP_FORMAT_TYPES} from './tooltip';
-import {LAYER_TYPES} from 'layers/types';
-import {RGBAColor} from 'reducers';
+import {RGBAColor} from '@kepler.gl/types';
export const ACTION_PREFIX = '@@kepler.gl/';
export const CLOUDFRONT = 'https://d1a3f4spazzrp4.cloudfront.net/kepler.gl';
@@ -171,25 +158,21 @@ export const SIDEBAR_PANELS = [
{
id: 'layer',
label: 'sidebar.panels.layer',
- iconComponent: Layers,
onClick: null
},
{
id: 'filter',
label: 'sidebar.panels.filter',
- iconComponent: FilterFunnel,
onClick: null
},
{
id: 'interaction',
label: 'sidebar.panels.interaction',
- iconComponent: CursorClick,
onClick: null
},
{
id: 'map',
label: 'sidebar.panels.basemap',
- iconComponent: Settings,
onClick: null
}
];
@@ -363,29 +346,34 @@ export const TABLE_OPTION_LIST = [
{
value: TABLE_OPTION.SORT_ASC,
display: 'Sort Ascending',
- icon: ArrowUp,
+ icon: 'ArrowUp',
condition: props => props.sortMode !== SORT_ORDER.ASCENDING
},
{
value: TABLE_OPTION.SORT_DES,
display: 'Sort Descending',
- icon: ArrowDown,
+ icon: 'ArrowDown',
condition: props => props.sortMode !== SORT_ORDER.DESCENDING
},
{
value: TABLE_OPTION.UNSORT,
display: 'Unsort Column',
- icon: Cancel,
+ icon: 'Cancel',
condition: props => props.isSorted
},
- {value: TABLE_OPTION.PIN, display: 'Pin Column', icon: Pin, condition: props => !props.isPinned},
+ {
+ value: TABLE_OPTION.PIN,
+ display: 'Pin Column',
+ icon: 'Pin',
+ condition: props => !props.isPinned
+ },
{
value: TABLE_OPTION.UNPIN,
display: 'Unpin Column',
- icon: Cancel,
+ icon: 'Cancel',
condition: props => props.isPinned
},
- {value: TABLE_OPTION.COPY, display: 'Copy Column', icon: Clipboard}
+ {value: TABLE_OPTION.COPY, display: 'Copy Column', icon: 'Clipboard'}
];
const ORANGE = '248, 194, 28';
@@ -642,7 +630,7 @@ export const CHANNEL_SCALE_SUPPORTED_FIELDS = Object.keys(CHANNEL_SCALES).reduce
...accu,
[key]: Object.keys(FIELD_OPTS).filter(ft => Object.keys(FIELD_OPTS[ft].scale[key]).length)
}),
- {}
+ {} as {[id: string]: string[]}
);
export const DEFAULT_LAYER_COLOR = {
@@ -824,6 +812,10 @@ export const EXPORT_MAP_FORMAT_OPTIONS = Object.entries(EXPORT_MAP_FORMATS).map(
})
);
+export function getHTMLMapModeTileUrl(mode) {
+ return `https://d1a3f4spazzrp4.cloudfront.net/kepler.gl/documentation/map-${mode.toLowerCase()}-mode.png`;
+}
+
export const EXPORT_HTML_MAP_MODE_OPTIONS = Object.entries(EXPORT_HTML_MAP_MODES).map(
(entry: [string, any]) => ({
id: entry[0],
@@ -905,13 +897,11 @@ export const EDITOR_MODES = {
EDIT: EditorModes.EDIT_VERTEX
};
-export const EDITOR_AVAILABLE_LAYERS: string[] = [
- LAYER_TYPES.point,
- LAYER_TYPES.hexagon,
- LAYER_TYPES.arc,
- LAYER_TYPES.line,
- LAYER_TYPES.hexagonId
-];
+export const PLOT_TYPES = keyMirror({
+ histogram: null,
+ lineChart: null
+});
+
// GPU Filtering
/**
* Max number of filter value buffers that deck.gl provides
diff --git a/src/constants/src/index.ts b/src/constants/src/index.ts
new file mode 100644
index 000000000..c1a671c54
--- /dev/null
+++ b/src/constants/src/index.ts
@@ -0,0 +1,30 @@
+// Copyright (c) 2022 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+// Constants
+
+export * from './color-palette';
+export * from './color-ranges';
+export * from './custom-color-ranges';
+export * from './default-settings';
+export {default as KeyEvent} from './keyevent';
+export * from './tooltip';
+export * from './user-feedbacks';
+export * from './user-guides';
diff --git a/src/constants/keyevent.ts b/src/constants/src/keyevent.ts
similarity index 100%
rename from src/constants/keyevent.ts
rename to src/constants/src/keyevent.ts
diff --git a/src/constants/tooltip.ts b/src/constants/src/tooltip.ts
similarity index 100%
rename from src/constants/tooltip.ts
rename to src/constants/src/tooltip.ts
diff --git a/src/constants/user-feedbacks.ts b/src/constants/src/user-feedbacks.ts
similarity index 100%
rename from src/constants/user-feedbacks.ts
rename to src/constants/src/user-feedbacks.ts
diff --git a/src/constants/user-guides.ts b/src/constants/src/user-guides.ts
similarity index 100%
rename from src/constants/user-guides.ts
rename to src/constants/src/user-guides.ts
diff --git a/src/constants/tsconfig.production.json b/src/constants/tsconfig.production.json
new file mode 100644
index 000000000..07c5bef6e
--- /dev/null
+++ b/src/constants/tsconfig.production.json
@@ -0,0 +1,38 @@
+{
+ "compilerOptions": {
+ "target": "es2020",
+ "allowJs": false,
+ "checkJs": false,
+ "jsx": "react",
+ "module": "esnext",
+ "moduleResolution": "node",
+ "declaration":true,
+ "emitDeclarationOnly":true,
+ "noImplicitAny": false,
+ "noImplicitReturns": true,
+ "noImplicitThis": true,
+ "noUnusedLocals": true,
+ "outDir": "dist",
+ "sourceMap": true,
+ "strictNullChecks": true,
+ "suppressImplicitAnyIndexErrors": false,
+ "esModuleInterop": true,
+ "allowSyntheticDefaultImports": true,
+ "skipLibCheck": true,
+ "strict": true,
+ "resolveJsonModule": true,
+ "isolatedModules": true,
+ "baseUrl": "./src",
+ "paths": {
+ "*": ["*"]
+ }
+ },
+ "include": [
+ "src"
+ ],
+ "exclude": [
+ "*/actions/**/*",
+ "*/utils/**/*",
+ "../components/**/*"
+ ]
+}
diff --git a/src/constants/webpack/umd.js b/src/constants/webpack/umd.js
new file mode 100644
index 000000000..3eb025d5e
--- /dev/null
+++ b/src/constants/webpack/umd.js
@@ -0,0 +1,120 @@
+// Copyright (c) 2022 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+const resolve = require('path').resolve;
+const join = require('path').join;
+
+// Import package.json to read version
+const KeplerPackage = require('../package');
+
+const SRC_DIR = resolve(__dirname, '../src');
+const OUTPUT_DIR = resolve(__dirname, '../umd');
+
+const LIBRARY_BUNDLE_CONFIG = env => ({
+ entry: {
+ KeplerGl: join(SRC_DIR, 'index.ts')
+ },
+
+ // Silence warnings about big bundles
+ stats: {
+ warnings: false
+ },
+
+ output: {
+ // Generate the bundle in dist folder
+ path: OUTPUT_DIR,
+ filename: 'keplergl.min.js',
+ globalObject: 'this',
+ library: '[name]',
+ libraryTarget: 'umd'
+ },
+
+ // let's put everything in
+ externals: {
+ react: {
+ root: 'React',
+ commonjs2: 'react',
+ commonjs: 'react',
+ amd: 'react',
+ umd: 'react'
+ },
+ 'react-dom': {
+ root: 'ReactDOM',
+ commonjs2: 'react-dom',
+ commonjs: 'react-dom',
+ amd: 'react-dom',
+ umd: 'react-dom'
+ },
+ redux: {
+ root: 'Redux',
+ commonjs2: 'redux',
+ commonjs: 'redux',
+ amd: 'redux',
+ umd: 'redux'
+ },
+ 'react-redux': {
+ root: 'ReactRedux',
+ commonjs2: 'react-redux',
+ commonjs: 'react-redux',
+ amd: 'react-redux',
+ umd: 'react-redux'
+ },
+ 'styled-components': {
+ commonjs: 'styled-components',
+ commonjs2: 'styled-components',
+ amd: 'styled-components',
+ root: 'styled'
+ }
+ },
+ resolve: {
+ extensions: ['.tsx', '.ts', '.js'],
+ modules: ['node_modules', SRC_DIR]
+ },
+ module: {
+ rules: [
+ {
+ test: /\.(js|ts|tsx)$/,
+ loader: 'babel-loader',
+ include: [SRC_DIR],
+ options: {
+ plugins: [
+ [
+ 'search-and-replace',
+ {
+ rules: [
+ {
+ search: '__PACKAGE_VERSION__',
+ replace: KeplerPackage.version
+ }
+ ]
+ }
+ ]
+ ]
+ }
+ }
+ ]
+ },
+
+ node: {
+ fs: 'empty'
+ }
+});
+
+module.exports = env => LIBRARY_BUNDLE_CONFIG(env);
diff --git a/src/deckgl-layers/3d-building-layer/types.ts b/src/deckgl-layers/3d-building-layer/types.ts
index 980b6daf5..649249b39 100644
--- a/src/deckgl-layers/3d-building-layer/types.ts
+++ b/src/deckgl-layers/3d-building-layer/types.ts
@@ -1,4 +1,4 @@
-import {RGBColor} from '../../reducers';
+import {RGBColor} from '@kepler.gl/types';
export type ThreeDBuildingLayerProps = {
id: string;
diff --git a/src/deckgl-layers/cluster-layer/cluster-layer.js b/src/deckgl-layers/cluster-layer/cluster-layer.js
index 19e43deeb..f33b56440 100644
--- a/src/deckgl-layers/cluster-layer/cluster-layer.js
+++ b/src/deckgl-layers/cluster-layer/cluster-layer.js
@@ -30,8 +30,7 @@ import {getDistanceScales} from 'viewport-mercator-project';
import {max} from 'd3-array';
import {LAYER_VIS_CONFIGS} from 'layers/layer-factory';
-import {SCALE_TYPES} from 'constants/default-settings';
-import {DEFAULT_COLOR_RANGE} from 'constants/color-ranges';
+import {SCALE_TYPES, DEFAULT_COLOR_RANGE} from '@kepler.gl/constants';
import ClusterBuilder, {getGeoJSON} from '../layer-utils/cluster-utils';
const defaultRadius = LAYER_VIS_CONFIGS.clusterRadius.defaultValue;
diff --git a/src/deckgl-layers/layer-utils/cpu-aggregator.ts b/src/deckgl-layers/layer-utils/cpu-aggregator.ts
index 212a5e1a4..206aa7140 100644
--- a/src/deckgl-layers/layer-utils/cpu-aggregator.ts
+++ b/src/deckgl-layers/layer-utils/cpu-aggregator.ts
@@ -23,8 +23,8 @@ import {AGGREGATION_OPERATION, _BinSorter as BinSorter} from '@deck.gl/aggregati
import {console as Console} from 'global/window';
import {aggregate} from '../../utils/aggregate-utils';
-import {AGGREGATION_TYPES, SCALE_FUNC} from '../../constants/default-settings';
-import {RGBAColor} from '../../reducers';
+import {AGGREGATION_TYPES, SCALE_FUNC} from '@kepler.gl/constants';
+import {RGBAColor} from '@kepler.gl/types';
export type UpdaterType = (this: CPUAggregator, step, props, dimensionUpdater) => void;
export type BindedUpdaterType = () => void;
diff --git a/src/deckgl-layers/svg-icon-layer/svg-icon-layer.ts b/src/deckgl-layers/svg-icon-layer/svg-icon-layer.ts
index 28a52e794..97a2650bf 100644
--- a/src/deckgl-layers/svg-icon-layer/svg-icon-layer.ts
+++ b/src/deckgl-layers/svg-icon-layer/svg-icon-layer.ts
@@ -21,7 +21,7 @@
import {CompositeLayer} from '@deck.gl/core';
import {CompositeLayerProps} from '@deck.gl/core/lib/composite-layer';
import {Position, RGBAColor} from 'deck.gl';
-import {RGBColor} from 'reducers';
+import {RGBColor} from '@kepler.gl/types';
import ScatterplotIconLayer from './scatterplot-icon-layer';
// default icon geometry is a square
diff --git a/src/index.js b/src/index.js
index a60ebdacb..bb72caecd 100644
--- a/src/index.js
+++ b/src/index.js
@@ -28,7 +28,7 @@ export * from './schemas';
export * from './actions';
// Constants
-export * from './constants';
+export * from '@kepler.gl/constants';
// Processors
export * from './processors';
diff --git a/src/layers/aggregation-layer.ts b/src/layers/aggregation-layer.ts
index 3c6bc5046..baa69456b 100644
--- a/src/layers/aggregation-layer.ts
+++ b/src/layers/aggregation-layer.ts
@@ -33,10 +33,11 @@ import {
HIGHLIGH_COLOR_3D,
CHANNEL_SCALES,
FIELD_OPTS,
- DEFAULT_AGGREGATION
-} from '../constants/default-settings';
-import {Datasets, Merge} from '../reducers';
-import {ColorRange} from '../constants/color-ranges';
+ DEFAULT_AGGREGATION,
+ ColorRange
+} from '@kepler.gl/constants';
+import {Datasets} from '../reducers';
+import {Merge} from '@kepler.gl/types';
import {KeplerTable} from '../utils';
type AggregationLayerColumns = {
diff --git a/src/layers/arc-layer/arc-layer.ts b/src/layers/arc-layer/arc-layer.ts
index c8904d9e8..0e1649f57 100644
--- a/src/layers/arc-layer/arc-layer.ts
+++ b/src/layers/arc-layer/arc-layer.ts
@@ -30,9 +30,9 @@ import {ArcLayer as DeckArcLayer} from '@deck.gl/layers';
import {hexToRgb} from '../../utils/color-utils';
import ArcLayerIcon from './arc-layer-icon';
-import {DEFAULT_LAYER_COLOR} from '../../constants/default-settings';
+import {DEFAULT_LAYER_COLOR, ColorRange} from '@kepler.gl/constants';
import {DataContainerInterface} from '../../utils/table-utils/data-container-interface';
-import {RGBColor, Merge} from '../../reducers';
+import {RGBColor, Merge} from '@kepler.gl/types';
import {
VisConfigColorRange,
@@ -40,7 +40,6 @@ import {
VisConfigNumber,
VisConfigRange
} from '../layer-factory';
-import {ColorRange} from '../../constants/color-ranges';
import KeplerTable from '../../utils/table-utils/kepler-table';
export type ArcLayerVisConfigSettings = {
diff --git a/src/layers/base-layer.ts b/src/layers/base-layer.ts
index f71e3d396..93bb7b0af 100644
--- a/src/layers/base-layer.ts
+++ b/src/layers/base-layer.ts
@@ -35,10 +35,11 @@ import {
FIELD_OPTS,
SCALE_FUNC,
CHANNEL_SCALE_SUPPORTED_FIELDS,
- MAX_GPU_FILTERS
-} from 'constants/default-settings';
-import {ColorRange, COLOR_RANGES} from 'constants/color-ranges';
-import {DataVizColors} from 'constants/custom-color-ranges';
+ MAX_GPU_FILTERS,
+ ColorRange,
+ COLOR_RANGES,
+ DataVizColors
+} from '@kepler.gl/constants';
import {
LAYER_VIS_CONFIGS,
DEFAULT_TEXT_LABEL,
@@ -57,7 +58,8 @@ import {getSampleData} from 'utils/table-utils/data-container-utils';
import {hexToRgb, getColorGroupByName, reverseColorRange} from 'utils/color-utils';
-import {RGBColor, RGBAColor, MapState, Filter, Datasets, ValueOf, NestedPartial} from 'reducers';
+import {MapState, Filter, Datasets} from 'reducers';
+import {RGBColor, RGBAColor, ValueOf, NestedPartial} from '@kepler.gl/types';
import {LayerTextLabel, ColorUI} from './layer-factory';
import {KeplerTable} from '../utils';
import {DataContainerInterface} from 'utils/table-utils/data-container-interface';
diff --git a/src/layers/cluster-layer/cluster-layer.ts b/src/layers/cluster-layer/cluster-layer.ts
index 8178d9b51..59e50ef3a 100644
--- a/src/layers/cluster-layer/cluster-layer.ts
+++ b/src/layers/cluster-layer/cluster-layer.ts
@@ -22,7 +22,7 @@ import AggregationLayer, {AggregationLayerConfig} from '../aggregation-layer';
import {ScatterplotLayer} from '@deck.gl/layers';
import DeckGLClusterLayer from 'deckgl-layers/cluster-layer/cluster-layer';
-import {CHANNEL_SCALES} from 'constants/default-settings';
+import {CHANNEL_SCALES} from '@kepler.gl/constants';
import ClusterLayerIcon from './cluster-layer-icon';
import {
AggregationTypes,
@@ -31,8 +31,8 @@ import {
VisConfigRange,
VisConfigSelection
} from '../layer-factory';
-import {ColorRange} from '../../constants/color-ranges';
-import {Merge} from '../../reducers';
+import {ColorRange} from '@kepler.gl/constants';
+import {Merge} from '@kepler.gl/types';
import {VisualChannels} from '../base-layer';
export type ClusterLayerVisConfigSettings = {
diff --git a/src/layers/geojson-layer/geojson-layer.ts b/src/layers/geojson-layer/geojson-layer.ts
index 90590ef16..520b10141 100644
--- a/src/layers/geojson-layer/geojson-layer.ts
+++ b/src/layers/geojson-layer/geojson-layer.ts
@@ -39,7 +39,7 @@ import {
GeojsonDataMaps
} from './geojson-utils';
import GeojsonLayerIcon from './geojson-layer-icon';
-import {GEOJSON_FIELDS, HIGHLIGH_COLOR_3D, CHANNEL_SCALES} from '../../constants/default-settings';
+import {GEOJSON_FIELDS, HIGHLIGH_COLOR_3D, CHANNEL_SCALES, ColorRange} from '@kepler.gl/constants';
import {
LAYER_VIS_CONFIGS,
VisConfigNumber,
@@ -49,8 +49,7 @@ import {
VisConfigBoolean
} from '../layer-factory';
import {DataContainerInterface} from '../../utils/table-utils/data-container-interface';
-import {Merge, RGBColor} from '../../reducers';
-import {ColorRange} from '../../constants/color-ranges';
+import {Merge, RGBColor} from '@kepler.gl/types';
import {KeplerTable} from '../../utils';
const SUPPORTED_ANALYZER_TYPES = {
diff --git a/src/layers/grid-layer/grid-layer.ts b/src/layers/grid-layer/grid-layer.ts
index bd415fd58..6d42339d8 100644
--- a/src/layers/grid-layer/grid-layer.ts
+++ b/src/layers/grid-layer/grid-layer.ts
@@ -31,8 +31,8 @@ import {
VisConfigRange,
VisConfigSelection
} from '../layer-factory';
-import {ColorRange} from '../../constants/color-ranges';
-import {Merge} from '../../reducers';
+import {ColorRange} from '@kepler.gl/constants';
+import {Merge} from '@kepler.gl/types';
export type GridLayerVisConfigSettings = {
opacity: VisConfigNumber;
diff --git a/src/layers/h3-hexagon-layer/h3-hexagon-layer.ts b/src/layers/h3-hexagon-layer/h3-hexagon-layer.ts
index a7cd78737..004903e37 100644
--- a/src/layers/h3-hexagon-layer/h3-hexagon-layer.ts
+++ b/src/layers/h3-hexagon-layer/h3-hexagon-layer.ts
@@ -31,7 +31,7 @@ import {H3HexagonLayer} from '@deck.gl/geo-layers';
import EnhancedColumnLayer from 'deckgl-layers/column-layer/enhanced-column-layer';
import {getCentroid, idToPolygonGeo, h3IsValid, getHexFields, Centroid} from './h3-utils';
import H3HexagonLayerIcon from './h3-hexagon-layer-icon';
-import {CHANNEL_SCALES, HIGHLIGH_COLOR_3D} from 'constants/default-settings';
+import {CHANNEL_SCALES, HIGHLIGH_COLOR_3D, ColorRange} from '@kepler.gl/constants';
import {createDataContainer} from 'utils/table-utils';
import {
@@ -40,9 +40,8 @@ import {
VisConfigNumber,
VisConfigRange
} from '../layer-factory';
-import {Merge} from '../../reducers';
+import {Merge} from '@kepler.gl/types';
import {DataContainerInterface} from '../../utils/table-utils/data-container-interface';
-import {ColorRange} from '../../constants/color-ranges';
import {KeplerTable} from '../../utils';
export type HexagonIdLayerColumnsConfig = {
diff --git a/src/layers/h3-hexagon-layer/h3-utils.ts b/src/layers/h3-hexagon-layer/h3-utils.ts
index 36891fd80..07d6afcf1 100644
--- a/src/layers/h3-hexagon-layer/h3-utils.ts
+++ b/src/layers/h3-hexagon-layer/h3-utils.ts
@@ -19,7 +19,7 @@
// THE SOFTWARE.
import {h3GetResolution, H3Index, h3IsValid, h3ToGeo, h3ToGeoBoundary} from 'h3-js';
-import {ALL_FIELD_TYPES} from 'constants/default-settings';
+import {ALL_FIELD_TYPES} from '@kepler.gl/constants';
import {notNullorUndefined} from 'utils/data-utils';
export {h3GetResolution, h3IsValid};
diff --git a/src/layers/heatmap-layer/heatmap-layer.ts b/src/layers/heatmap-layer/heatmap-layer.ts
index 9c6f52baf..51ddd7d74 100644
--- a/src/layers/heatmap-layer/heatmap-layer.ts
+++ b/src/layers/heatmap-layer/heatmap-layer.ts
@@ -20,15 +20,14 @@
import {createSelector} from 'reselect';
import memoize from 'lodash.memoize';
-import {CHANNEL_SCALES, SCALE_FUNC, ALL_FIELD_TYPES} from 'constants/default-settings';
+import {CHANNEL_SCALES, SCALE_FUNC, ALL_FIELD_TYPES, ColorRange} from '@kepler.gl/constants';
import {hexToRgb} from 'utils/color-utils';
import MapboxGLLayer, {MapboxLayerGLConfig} from '../mapboxgl-layer';
import HeatmapLayerIcon from './heatmap-layer-icon';
import {LayerColumn, LayerWeightConfig, VisualChannels} from '../base-layer';
import {DataContainerInterface} from 'utils/table-utils/data-container-interface';
import {VisConfigColorRange, VisConfigNumber} from '../layer-factory';
-import {ColorRange} from 'constants/color-ranges';
-import {HexColor, Merge} from 'reducers';
+import {HexColor, Merge} from '@kepler.gl/types';
export type HeatmapLayerVisConfigSettings = {
opacity: VisConfigNumber;
diff --git a/src/layers/hexagon-layer/hexagon-layer.ts b/src/layers/hexagon-layer/hexagon-layer.ts
index fee174057..38f37fa99 100644
--- a/src/layers/hexagon-layer/hexagon-layer.ts
+++ b/src/layers/hexagon-layer/hexagon-layer.ts
@@ -24,7 +24,7 @@ import EnhancedHexagonLayer from 'deckgl-layers/hexagon-layer/enhanced-hexagon-l
import {hexagonToPolygonGeo} from './hexagon-utils';
import HexagonLayerIcon from './hexagon-layer-icon';
import {clamp} from 'utils/data-utils';
-import {Merge} from '../../reducers';
+import {Merge} from '@kepler.gl/types';
import {
AggregationTypes,
VisConfigBoolean,
@@ -33,7 +33,7 @@ import {
VisConfigRange,
VisConfigSelection
} from '../layer-factory';
-import {ColorRange} from '../../constants/color-ranges';
+import {ColorRange} from '@kepler.gl/constants';
export type HexagonLayerVisConfigSettings = {
opacity: VisConfigNumber;
diff --git a/src/layers/icon-layer/icon-layer.ts b/src/layers/icon-layer/icon-layer.ts
index bc66f71dd..3a5aab802 100644
--- a/src/layers/icon-layer/icon-layer.ts
+++ b/src/layers/icon-layer/icon-layer.ts
@@ -23,7 +23,7 @@ import {BrushingExtension} from '@deck.gl/extensions';
import SvgIconLayer from 'deckgl-layers/svg-icon-layer/svg-icon-layer';
import IconLayerIcon from './icon-layer-icon';
-import {ICON_FIELDS, CLOUDFRONT} from 'constants/default-settings';
+import {ICON_FIELDS, CLOUDFRONT} from '@kepler.gl/constants';
import IconInfoModalFactory from './icon-info-modal';
import Layer, {LayerBaseConfig, LayerColumn} from '../base-layer';
import {getTextOffsetByRadius, formatTextLabelData} from '../layer-text-label';
@@ -34,8 +34,8 @@ import {
VisConfigNumber,
VisConfigRange
} from '../layer-factory';
-import {ColorRange} from '../../constants/color-ranges';
-import {Merge} from '../../reducers';
+import {ColorRange} from '@kepler.gl/constants';
+import {Merge} from '@kepler.gl/types';
import {KeplerTable} from '../../utils';
export type IconLayerColumnsConfig = {
diff --git a/src/layers/index.ts b/src/layers/index.ts
index cf42495da..f71926915 100644
--- a/src/layers/index.ts
+++ b/src/layers/index.ts
@@ -31,8 +31,7 @@ import {default as H3Layer} from './h3-hexagon-layer/h3-hexagon-layer';
import {default as ScenegraphLayer} from './scenegraph-layer/scenegraph-layer';
import {default as TripLayer} from './trip-layer/trip-layer';
import {default as S2GeometryLayer} from './s2-geometry-layer/s2-geometry-layer';
-import {LAYER_TYPES} from './types';
-
+import {LAYER_TYPES} from 'layers/types';
// base layer
export {default as Layer, OVERLAY_TYPE, LAYER_ID_LENGTH, colorMaker} from './base-layer';
export type {LayerBaseConfig, LayerColumns, LayerColumn} from './base-layer';
diff --git a/src/layers/layer-factory.ts b/src/layers/layer-factory.ts
index 869ee97a0..436bcff80 100644
--- a/src/layers/layer-factory.ts
+++ b/src/layers/layer-factory.ts
@@ -20,10 +20,9 @@
import keyMirror from 'keymirror';
-import {AGGREGATION_TYPES} from '../constants/default-settings';
-import {ColorRange, DEFAULT_COLOR_RANGE} from '../constants/color-ranges';
+import {AGGREGATION_TYPES, ColorRange, DEFAULT_COLOR_RANGE} from '@kepler.gl/constants';
-import {RGBColor, RGBAColor} from '../reducers';
+import {RGBColor, RGBAColor} from '@kepler.gl/types';
import {Field} from '../utils/table-utils/kepler-table';
import {
LayerBaseConfig,
diff --git a/src/layers/line-layer/line-layer.ts b/src/layers/line-layer/line-layer.ts
index 05d535035..2c94ba84b 100644
--- a/src/layers/line-layer/line-layer.ts
+++ b/src/layers/line-layer/line-layer.ts
@@ -31,8 +31,8 @@ import {
VisConfigNumber,
VisConfigRange
} from '../layer-factory';
-import {ColorRange} from '../../constants/color-ranges';
-import {Merge, RGBColor} from '../../reducers';
+import {ColorRange} from '@kepler.gl/constants';
+import {Merge, RGBColor} from '@kepler.gl/types';
import {DataContainerInterface} from 'utils/table-utils/data-container-interface';
import {KeplerTable} from '../../utils';
diff --git a/src/layers/mapboxgl-layer.ts b/src/layers/mapboxgl-layer.ts
index 4858d4b6a..a3400ecfa 100644
--- a/src/layers/mapboxgl-layer.ts
+++ b/src/layers/mapboxgl-layer.ts
@@ -23,7 +23,7 @@ import {createSelector} from 'reselect';
import {geoJsonFromData, prefixGpuField, gpuFilterToMapboxFilter} from './mapbox-utils';
import KeplerTable from '../utils/table-utils/kepler-table';
-import {Merge} from '../reducers';
+import {Merge} from '@kepler.gl/types';
type MapboxLayerGLColumns = {
lat: LayerColumn;
diff --git a/src/layers/point-layer/point-layer.ts b/src/layers/point-layer/point-layer.ts
index b2879a7f9..808922e68 100644
--- a/src/layers/point-layer/point-layer.ts
+++ b/src/layers/point-layer/point-layer.ts
@@ -31,10 +31,10 @@ import Layer, {
import {hexToRgb} from 'utils/color-utils';
import {findDefaultColorField} from 'utils/dataset-utils';
import PointLayerIcon from './point-layer-icon';
-import {DEFAULT_LAYER_COLOR, CHANNEL_SCALES} from 'constants/default-settings';
+import {DEFAULT_LAYER_COLOR, CHANNEL_SCALES, ColorRange} from '@kepler.gl/constants';
import {getTextOffsetByRadius, formatTextLabelData} from '../layer-text-label';
-import {Merge, RGBColor} from '../../reducers';
+import {Merge, RGBColor} from '@kepler.gl/types';
import {
VisConfigBoolean,
VisConfigColorRange,
@@ -42,7 +42,6 @@ import {
VisConfigNumber,
VisConfigRange
} from '../layer-factory';
-import {ColorRange} from '../../constants/color-ranges';
import {LAYER_VIS_CONFIGS} from '../layer-factory';
import {KeplerTable} from '../../utils';
diff --git a/src/layers/s2-geometry-layer/s2-geometry-layer.ts b/src/layers/s2-geometry-layer/s2-geometry-layer.ts
index 599cb5040..11e9950f6 100644
--- a/src/layers/s2-geometry-layer/s2-geometry-layer.ts
+++ b/src/layers/s2-geometry-layer/s2-geometry-layer.ts
@@ -19,12 +19,11 @@
// THE SOFTWARE.
import {S2Layer} from '@deck.gl/geo-layers';
-import {HIGHLIGH_COLOR_3D, CHANNEL_SCALES} from 'constants/default-settings';
+import {HIGHLIGH_COLOR_3D, CHANNEL_SCALES, ColorRange} from '@kepler.gl/constants';
import {LAYER_VIS_CONFIGS} from 'layers/layer-factory';
import {KeplerTable} from '../../utils';
import {createDataContainer} from 'utils/table-utils';
-import {ColorRange} from '../../constants/color-ranges';
-import {Merge, RGBColor} from '../../reducers';
+import {Merge, RGBColor} from '@kepler.gl/types';
import {DataContainerInterface} from '../../utils/table-utils/data-container-interface';
import Layer, {
LayerBaseConfig,
diff --git a/src/layers/scenegraph-layer/scenegraph-layer.ts b/src/layers/scenegraph-layer/scenegraph-layer.ts
index 8b3f189e2..26f0a4cd5 100644
--- a/src/layers/scenegraph-layer/scenegraph-layer.ts
+++ b/src/layers/scenegraph-layer/scenegraph-layer.ts
@@ -27,8 +27,8 @@ import ScenegraphLayerIcon from './scenegraph-layer-icon';
import ScenegraphInfoModalFactory from './scenegraph-info-modal';
import {LAYER_VIS_CONFIGS} from 'layers/layer-factory';
import {VisConfigColorRange, VisConfigNumber} from '../layer-factory';
-import {ColorRange} from '../../constants/color-ranges';
-import {Merge} from '../../reducers';
+import {ColorRange} from '@kepler.gl/constants';
+import {Merge} from '@kepler.gl/types';
import {DataContainerInterface} from '../../utils/table-utils/data-container-interface';
import {KeplerTable} from '../../utils';
diff --git a/src/layers/trip-layer/trip-layer.ts b/src/layers/trip-layer/trip-layer.ts
index 5df1f14a6..5ebdb7fef 100644
--- a/src/layers/trip-layer/trip-layer.ts
+++ b/src/layers/trip-layer/trip-layer.ts
@@ -23,7 +23,7 @@ import uniq from 'lodash.uniq';
import Layer, {LayerBaseConfig, LayerColumn} from '../base-layer';
import {TripsLayer as DeckGLTripsLayer} from '@deck.gl/geo-layers';
-import {GEOJSON_FIELDS} from 'constants/default-settings';
+import {GEOJSON_FIELDS, ColorRange} from '@kepler.gl/constants';
import TripLayerIcon from './trip-layer-icon';
import {
@@ -36,9 +36,8 @@ import {
import {isTripGeoJsonField, parseTripGeoJsonTimestamp} from './trip-utils';
import TripInfoModalFactory from './trip-info-modal';
import {DataContainerInterface} from '../../utils/table-utils/data-container-interface';
-import {ColorRange} from '../../constants/color-ranges';
import {VisConfigColorRange, VisConfigNumber, VisConfigRange} from '../layer-factory';
-import {Merge} from '../../reducers';
+import {Merge} from '@kepler.gl/types';
import {KeplerTable} from '../../utils';
export type TripLayerVisConfigSettings = {
diff --git a/src/layers/types.ts b/src/layers/types.ts
index 374a5cefd..80e2e0281 100644
--- a/src/layers/types.ts
+++ b/src/layers/types.ts
@@ -1,37 +1,25 @@
-// Copyright (c) 2022 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
import keyMirror from 'keymirror';
export const LAYER_TYPES = keyMirror({
- point: null,
- arc: null,
- line: null,
- grid: null,
- hexagon: null,
- geojson: null,
- cluster: null,
- icon: null,
- heatmap: null,
- hexagonId: null,
- '3D': null,
- trip: null,
- s2: null
-});
+ point: null,
+ arc: null,
+ line: null,
+ grid: null,
+ hexagon: null,
+ geojson: null,
+ cluster: null,
+ icon: null,
+ heatmap: null,
+ hexagonId: null,
+ '3D': null,
+ trip: null,
+ s2: null
+ });
+
+ export const EDITOR_AVAILABLE_LAYERS: string[] = [
+ LAYER_TYPES.point,
+ LAYER_TYPES.hexagon,
+ LAYER_TYPES.arc,
+ LAYER_TYPES.line,
+ LAYER_TYPES.hexagonId
+ ];
\ No newline at end of file
diff --git a/src/processors/data-processor.ts b/src/processors/data-processor.ts
index 9a23dbd4c..61bd095c0 100644
--- a/src/processors/data-processor.ts
+++ b/src/processors/data-processor.ts
@@ -24,11 +24,10 @@ import {console as globalConsole} from 'global/window';
import assert from 'assert';
import {Analyzer, DATA_TYPES as AnalyzerDATA_TYPES} from 'type-analyzer';
import normalize from '@mapbox/geojson-normalize';
-import {ALL_FIELD_TYPES, DATASET_FORMATS} from 'constants/default-settings';
+import {ALL_FIELD_TYPES, DATASET_FORMATS, GUIDES_FILE_FORMAT_DOC} from '@kepler.gl/constants';
import {notNullorUndefined, parseFieldValue} from 'utils/data-utils';
import KeplerGlSchema, {SavedMap, ParsedDataset} from 'schemas';
import {LoadedMap} from 'schemas/schema-manager';
-import {GUIDES_FILE_FORMAT_DOC} from 'constants/user-guides';
import {hasOwnProperty, isPlainObject, toArray} from 'utils/utils';
import {Field} from 'utils/table-utils/kepler-table';
import {DataContainerInterface} from 'utils/table-utils/data-container-interface';
diff --git a/src/processors/file-handler.ts b/src/processors/file-handler.ts
index 009058cbe..b2952f583 100644
--- a/src/processors/file-handler.ts
+++ b/src/processors/file-handler.ts
@@ -24,7 +24,7 @@ import {JSONLoader, _JSONPath} from '@loaders.gl/json';
import {CSVLoader} from '@loaders.gl/csv';
import {processGeojson, processKeplerglJSON, processRowObject} from './data-processor';
import {isPlainObject, generateHashId} from 'utils/utils';
-import {DATASET_FORMATS} from 'constants/default-settings';
+import {DATASET_FORMATS} from '@kepler.gl/constants';
import {LoaderObject} from '@loaders.gl/loader-utils';
import {AddDataToMapPayload} from 'actions/actions';
import {FileCacheItem, ValidKeplerGlMap} from './types';
diff --git a/src/reducers/composers.ts b/src/reducers/composers.ts
index 6f206994e..cb7a9f73e 100644
--- a/src/reducers/composers.ts
+++ b/src/reducers/composers.ts
@@ -18,7 +18,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import ActionTypes from 'constants/action-types';
+import {ActionTypes} from 'actions';
import * as combinedUpdaters from './combined-updaters';
/**
diff --git a/src/reducers/index.ts b/src/reducers/index.ts
index c2eda9e5d..37f0637f0 100644
--- a/src/reducers/index.ts
+++ b/src/reducers/index.ts
@@ -112,5 +112,3 @@ export type {
Notifications,
UiState
} from './ui-state-updaters';
-
-export * from './types';
diff --git a/src/reducers/map-state-updaters.ts b/src/reducers/map-state-updaters.ts
index 3c953e539..72702ddc1 100644
--- a/src/reducers/map-state-updaters.ts
+++ b/src/reducers/map-state-updaters.ts
@@ -21,7 +21,7 @@
import {getCenterAndZoomFromBounds} from 'utils/projection-utils';
import * as MapStateActions from 'actions/map-state-actions';
import {ReceiveMapConfigPayload} from '../actions/actions';
-import ActionTypes from '../constants/action-types';
+import {ActionTypes} from 'actions';
export type MapState = {
pitch: number;
diff --git a/src/reducers/map-state.ts b/src/reducers/map-state.ts
index 794b31ae7..42943ca5f 100644
--- a/src/reducers/map-state.ts
+++ b/src/reducers/map-state.ts
@@ -19,7 +19,7 @@
// THE SOFTWARE.
import {handleActions} from 'redux-actions';
-import ActionTypes from 'constants/action-types';
+import {ActionTypes} from 'actions';
import * as mapStateUpdaters from './map-state-updaters';
/**
diff --git a/src/reducers/map-style-updaters.ts b/src/reducers/map-style-updaters.ts
index 154283c94..02bf3145b 100644
--- a/src/reducers/map-style-updaters.ts
+++ b/src/reducers/map-style-updaters.ts
@@ -35,15 +35,15 @@ import {
DEFAULT_MAP_STYLES,
DEFAULT_LAYER_GROUPS,
DEFAULT_MAPBOX_API_URL
-} from 'constants/default-settings';
+} from '@kepler.gl/constants';
+import {ActionTypes} from 'actions';
import {generateHashId} from 'utils/utils';
import {LOAD_MAP_STYLE_TASK} from 'tasks/tasks';
import {loadMapStyles, loadMapStyleErr} from 'actions/map-style-actions';
import {rgb} from 'd3-color';
import {hexToRgb} from 'utils/color-utils';
-import {RGBColor} from './types';
-import ActionTypes from 'constants/action-types';
+import {RGBColor} from '@kepler.gl/types';
import {ReceiveMapConfigPayload, KeplerGlInitPayload} from '../actions/actions';
import * as MapStyleActions from '../actions/map-style-actions';
diff --git a/src/reducers/map-style.ts b/src/reducers/map-style.ts
index cc75fc61a..96ad5e36a 100644
--- a/src/reducers/map-style.ts
+++ b/src/reducers/map-style.ts
@@ -19,7 +19,7 @@
// THE SOFTWARE.
import {handleActions} from 'redux-actions';
-import ActionTypes from 'constants/action-types';
+import {ActionTypes} from 'actions';
import * as mapStyleUpdaters from './map-style-updaters';
/**
diff --git a/src/reducers/provider-state-updaters.ts b/src/reducers/provider-state-updaters.ts
index bb539f30f..8fafa21ad 100644
--- a/src/reducers/provider-state-updaters.ts
+++ b/src/reducers/provider-state-updaters.ts
@@ -45,7 +45,7 @@ import {
DEFAULT_NOTIFICATION_TOPICS,
DATASET_FORMATS,
OVERWRITE_MAP_ID
-} from '../constants/default-settings';
+} from '@kepler.gl/constants';
import {FILE_CONFLICT_MSG} from '../cloud-providers';
import {DATASET_HANDLERS} from '../processors/data-processor';
diff --git a/src/reducers/root.ts b/src/reducers/root.ts
index 1d17463ce..17e677c06 100644
--- a/src/reducers/root.ts
+++ b/src/reducers/root.ts
@@ -23,7 +23,7 @@ import {handleActions} from 'redux-actions';
import {_actionFor, _updateProperty} from '../actions/action-wrapper';
import {keplerGlInit} from '../actions/actions';
import {coreReducerFactory} from './core';
-import ActionTypes from 'constants/action-types';
+import {ActionTypes} from 'actions';
// INITIAL_STATE
const initialCoreState = {};
diff --git a/src/reducers/ui-state-updaters.ts b/src/reducers/ui-state-updaters.ts
index fa5cc4fd7..a73741bfa 100644
--- a/src/reducers/ui-state-updaters.ts
+++ b/src/reducers/ui-state-updaters.ts
@@ -29,13 +29,13 @@ import {
EXPORT_MAP_FORMATS,
RESOLUTIONS,
MAP_CONTROLS
-} from 'constants/default-settings';
+} from '@kepler.gl/constants';
+import {ActionTypes} from 'actions';
import {LOCALE_CODES} from 'localization/locales';
import {createNotification, errorNotification} from 'utils/notifications-utils';
import {calculateExportImageSize} from '../utils/export-utils';
import {payload_, apply_, compose_} from './composer-helpers';
-import ActionTypes from '../constants/action-types';
import * as UiStateActions from 'actions/ui-state-actions';
import {KeplerGlInitPayload, LoadFilesErrUpdaterAction} from '../actions';
diff --git a/src/reducers/ui-state.ts b/src/reducers/ui-state.ts
index 4ca069d51..357ff2384 100644
--- a/src/reducers/ui-state.ts
+++ b/src/reducers/ui-state.ts
@@ -19,7 +19,7 @@
// THE SOFTWARE.
import {handleActions} from 'redux-actions';
-import ActionTypes from 'constants/action-types';
+import {ActionTypes} from 'actions';
import * as uiStateUpdaters from './ui-state-updaters';
/**
diff --git a/src/reducers/vis-state-merger.ts b/src/reducers/vis-state-merger.ts
index b89d31d93..8ab63e197 100644
--- a/src/reducers/vis-state-merger.ts
+++ b/src/reducers/vis-state-merger.ts
@@ -26,7 +26,7 @@ import {applyFiltersToDatasets, validateFiltersUpdateDatasets} from 'utils/filte
import {getInitialMapLayersForSplitMap} from 'utils/split-map-utils';
import {resetFilterGpuMode, assignGpuChannels} from 'utils/gpu-filter-utils';
-import {LAYER_BLENDINGS} from 'constants/default-settings';
+import {LAYER_BLENDINGS} from '@kepler.gl/constants';
import {CURRENT_VERSION, visStateSchema} from 'schemas';
import {VisState, Datasets} from './vis-state-updaters';
diff --git a/src/reducers/vis-state-updaters.ts b/src/reducers/vis-state-updaters.ts
index 88636536a..55700aee4 100644
--- a/src/reducers/vis-state-updaters.ts
+++ b/src/reducers/vis-state-updaters.ts
@@ -88,18 +88,18 @@ import {
SORT_ORDER,
FILTER_TYPES,
MAX_DEFAULT_TOOLTIPS
-} from 'constants/default-settings';
+} from '@kepler.gl/constants';
+import {ActionTypes} from 'actions';
import {pick_, merge_, swap_} from './composer-helpers';
import {processFileContent} from 'actions/vis-state-actions';
import KeplerGLSchema from 'schemas';
import {isRgbColor} from 'utils/color-utils';
-import {Millisecond} from './types';
+import {Millisecond} from '@kepler.gl/types';
import {ReceiveMapConfigPayload} from '../actions/actions';
import * as VisStateActions from 'actions/vis-state-actions';
import * as MapStateActions from 'actions/map-state-actions';
-import ActionTypes from 'constants/action-types';
import {LoaderObject} from '@loaders.gl/loader-utils';
import {KeplerTable} from '../utils';
diff --git a/src/reducers/vis-state.ts b/src/reducers/vis-state.ts
index 4d3f1a290..a1ac2ae59 100644
--- a/src/reducers/vis-state.ts
+++ b/src/reducers/vis-state.ts
@@ -18,7 +18,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import ActionTypes from 'constants/action-types';
+import {ActionTypes} from 'actions';
import {handleActions} from 'redux-actions';
import * as visStateUpdaters from './vis-state-updaters';
diff --git a/src/schemas/schema-manager.ts b/src/schemas/schema-manager.ts
index a3de7f5ad..54c3f42d3 100644
--- a/src/schemas/schema-manager.ts
+++ b/src/schemas/schema-manager.ts
@@ -34,12 +34,11 @@ import {
TooltipInfo,
SplitMap,
AnimationConfig,
- VisState,
- RGBColor,
- Merge,
- RGBAColor
+ VisState
} from '../reducers';
+import {RGBColor, Merge, RGBAColor} from '@kepler.gl/types';
+
import {LayerTextLabel} from '../layers/layer-factory';
export type SavedFilter = {
diff --git a/src/styles/base.ts b/src/styles/base.ts
index 5bc9c6901..bfeda02c0 100644
--- a/src/styles/base.ts
+++ b/src/styles/base.ts
@@ -19,7 +19,7 @@
// THE SOFTWARE.
import {css} from 'styled-components';
-import {DIMENSIONS} from 'constants/default-settings';
+import {DIMENSIONS} from '@kepler.gl/constants';
type InputProps = {
active: boolean;
diff --git a/src/templates/export-map-html.ts b/src/templates/export-map-html.ts
index 7b22f14fd..16a650ec0 100644
--- a/src/templates/export-map-html.ts
+++ b/src/templates/export-map-html.ts
@@ -19,7 +19,7 @@
// THE SOFTWARE.
// @ts-nocheck
-import {KEPLER_GL_VERSION, EXPORT_HTML_MAP_MODES} from 'constants/default-settings';
+import {KEPLER_GL_VERSION, EXPORT_HTML_MAP_MODES} from '@kepler.gl/constants';
/**
* This method is used to create an html file which will inlcude kepler and map data
diff --git a/src/types/package.json b/src/types/package.json
new file mode 100644
index 000000000..c83a54a22
--- /dev/null
+++ b/src/types/package.json
@@ -0,0 +1,38 @@
+{
+ "name": "@kepler.gl/types",
+ "author": "Shan He <[email protected]>",
+ "version": "2.5.5",
+ "description": "kepler.gl types used by kepler.gl components, actions and reducers",
+ "license": "MIT",
+ "types": "types.d.ts",
+ "keywords": [
+ "babel",
+ "es6",
+ "react",
+ "webgl",
+ "visualization",
+ "deck.gl"
+ ],
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/keplergl/kepler.gl.git"
+ },
+ "scripts": {
+ "prepublish": " "
+ },
+ "nyc": {
+ "sourceMap": false,
+ "instrument": false
+ },
+ "engines": {
+ "node": ">=12.0.0"
+ },
+ "maintainers": [
+ "Shan He <[email protected]>",
+ "Giuseppe Macri <[email protected]>"
+ ],
+ "volta": {
+ "node": "12.22.0",
+ "yarn": "1.22.17"
+ }
+}
diff --git a/src/reducers/types.ts b/src/types/types.d.ts
similarity index 100%
rename from src/reducers/types.ts
rename to src/types/types.d.ts
diff --git a/src/utils/aggregate-utils.ts b/src/utils/aggregate-utils.ts
index 0751a0c2b..3c7b2d429 100644
--- a/src/utils/aggregate-utils.ts
+++ b/src/utils/aggregate-utils.ts
@@ -19,7 +19,7 @@
// THE SOFTWARE.
import {deviation, min, max, mean, median, sum, variance} from 'd3-array';
-import {AGGREGATION_TYPES} from '../constants/default-settings';
+import {AGGREGATION_TYPES} from '@kepler.gl/constants';
export const getFrequency = data =>
data.reduce(
diff --git a/src/utils/color-utils.ts b/src/utils/color-utils.ts
index 0d2d123de..5d2d6a16a 100644
--- a/src/utils/color-utils.ts
+++ b/src/utils/color-utils.ts
@@ -18,8 +18,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import {ColorRange} from 'constants/color-ranges';
-import {HexColor, RGBColor} from 'reducers';
+import {ColorRange} from '@kepler.gl/constants';
+import {HexColor, RGBColor} from '@kepler.gl/types';
/**
* get r g b from hex code
diff --git a/src/utils/data-utils.ts b/src/utils/data-utils.ts
index 6b9514255..7e7c62cbe 100644
--- a/src/utils/data-utils.ts
+++ b/src/utils/data-utils.ts
@@ -19,13 +19,13 @@
// THE SOFTWARE.
import assert from 'assert';
-import {ALL_FIELD_TYPES} from 'constants/default-settings';
-import {TOOLTIP_FORMATS, TOOLTIP_FORMAT_TYPES, TOOLTIP_KEY} from 'constants/tooltip';
+import {ALL_FIELD_TYPES} from '@kepler.gl/constants';
+import {TOOLTIP_FORMATS, TOOLTIP_FORMAT_TYPES, TOOLTIP_KEY} from '@kepler.gl/constants';
import {format as d3Format} from 'd3-format';
import {bisectLeft} from 'd3-array';
import moment from 'moment-timezone';
-import {Millisecond} from 'reducers/types';
+import {Millisecond} from '@kepler.gl/types';
import {Layer} from 'layers';
import {Bounds} from 'reducers/map-state-updaters';
import {DataContainerInterface} from './table-utils/data-container-interface';
diff --git a/src/utils/dataset-utils.ts b/src/utils/dataset-utils.ts
index eee71dd68..9676d86b5 100644
--- a/src/utils/dataset-utils.ts
+++ b/src/utils/dataset-utils.ts
@@ -20,13 +20,13 @@
import {hexToRgb} from './color-utils';
import uniq from 'lodash.uniq';
-import {ALL_FIELD_TYPES} from 'constants/default-settings';
+import {ALL_FIELD_TYPES} from '@kepler.gl/constants';
import {validateInputData} from 'processors/data-processor';
import KeplerTable, {Field} from './table-utils/kepler-table';
import {Datasets} from '../reducers/vis-state-updaters';
import {ProtoDataset} from '../actions';
-import {RGBColor} from 'reducers/types';
+import {RGBColor} from '@kepler.gl/types';
// apply a color for each dataset
// to use as label colors
diff --git a/src/utils/dom-to-image.ts b/src/utils/dom-to-image.ts
index 692ac4b6a..027b40f5f 100644
--- a/src/utils/dom-to-image.ts
+++ b/src/utils/dom-to-image.ts
@@ -27,7 +27,7 @@ import window from 'global/window';
import document from 'global/document';
import console from 'global/console';
import svgToMiniDataURI from 'mini-svg-data-uri';
-import {IMAGE_EXPORT_ERRORS} from 'constants/user-feedbacks';
+import {IMAGE_EXPORT_ERRORS} from '@kepler.gl/constants';
import {
canvasToBlob,
escape,
diff --git a/src/utils/dom-utils.ts b/src/utils/dom-utils.ts
index bfeb8bc77..5e2b0c8e1 100644
--- a/src/utils/dom-utils.ts
+++ b/src/utils/dom-utils.ts
@@ -21,7 +21,7 @@
import console from 'global/console';
import window from 'global/window';
import document from 'global/document';
-import {IMAGE_EXPORT_ERRORS} from 'constants/user-feedbacks';
+import {IMAGE_EXPORT_ERRORS} from '@kepler.gl/constants';
export function processClone(original, clone) {
if (!(clone instanceof window.Element)) {
diff --git a/src/utils/export-utils.ts b/src/utils/export-utils.ts
index c8ecf23c2..4af5df14e 100644
--- a/src/utils/export-utils.ts
+++ b/src/utils/export-utils.ts
@@ -28,7 +28,7 @@ import {
EXPORT_DATA_TYPE,
FourByThreeRatioOption,
OneXResolutionOption
-} from 'constants/default-settings';
+} from '@kepler.gl/constants';
import {exportMapToHTML} from 'templates/export-map-html';
import {formatCsv} from 'processors/data-processor';
import get from 'lodash.get';
diff --git a/src/utils/filter-utils.ts b/src/utils/filter-utils.ts
index 447904a38..d7772bb5c 100644
--- a/src/utils/filter-utils.ts
+++ b/src/utils/filter-utils.ts
@@ -27,10 +27,15 @@ import isEqual from 'lodash.isequal';
import booleanWithin from '@turf/boolean-within';
import {point as turfPoint} from '@turf/helpers';
import {Decimal} from 'decimal.js';
-import {ALL_FIELD_TYPES, FILTER_TYPES, ANIMATION_WINDOW} from 'constants/default-settings';
+import {
+ ALL_FIELD_TYPES,
+ FILTER_TYPES,
+ ANIMATION_WINDOW,
+ PLOT_TYPES
+} from '@kepler.gl/constants';
+import {LAYER_TYPES} from 'layers/types';
import {notNullorUndefined, unique, timeToUnixMilli} from './data-utils';
import * as ScaleUtils from './data-scale-utils';
-import {LAYER_TYPES} from 'layers/types';
import {generateHashId, set, toArray} from './utils';
import {getCentroid, h3IsValid} from 'layers/h3-hexagon-layer/h3-utils';
@@ -54,7 +59,7 @@ import {Layer} from 'layers';
import {ParsedFilter} from 'schemas';
import {DataContainerInterface} from './table-utils/data-container-interface';
import {Millisecond} from 'cloud-providers';
-import {Entries} from 'reducers';
+import {Entries} from '@kepler.gl/types';
export type FilterResult = {
filteredIndexForDomain?: number[];
@@ -89,11 +94,6 @@ const durationDay = durationHour * 24;
const durationWeek = durationDay * 7;
const durationYear = durationDay * 365;
-export const PLOT_TYPES = keyMirror({
- histogram: null,
- lineChart: null
-});
-
export const FILTER_UPDATER_PROPS = keyMirror({
dataId: null,
name: null,
diff --git a/src/utils/gl-utils.ts b/src/utils/gl-utils.ts
index 943792258..c28663e55 100644
--- a/src/utils/gl-utils.ts
+++ b/src/utils/gl-utils.ts
@@ -19,7 +19,7 @@
// THE SOFTWARE.
import {setParameters} from '@luma.gl/core';
-import {LAYER_BLENDINGS} from 'constants/default-settings';
+import {LAYER_BLENDINGS} from '@kepler.gl/constants';
import GL from '@luma.gl/constants';
const getGlConst = d => GL[d];
diff --git a/src/utils/gpu-filter-utils.ts b/src/utils/gpu-filter-utils.ts
index 7aefc0293..668992afa 100644
--- a/src/utils/gpu-filter-utils.ts
+++ b/src/utils/gpu-filter-utils.ts
@@ -19,7 +19,7 @@
// THE SOFTWARE.
import {set, toArray} from './utils';
-import {MAX_GPU_FILTERS, FILTER_TYPES} from 'constants/default-settings';
+import {MAX_GPU_FILTERS, FILTER_TYPES} from '@kepler.gl/constants';
import {notNullorUndefined} from './data-utils';
import moment from 'moment';
import {Filter} from 'reducers/vis-state-updaters';
diff --git a/src/utils/interaction-utils.ts b/src/utils/interaction-utils.ts
index fc7d5dad6..39bcae9a3 100644
--- a/src/utils/interaction-utils.ts
+++ b/src/utils/interaction-utils.ts
@@ -21,8 +21,11 @@
import {
DEFAULT_TOOLTIP_FIELDS,
ALL_FIELD_TYPES,
- TRIP_POINT_FIELDS
-} from 'constants/default-settings';
+ TRIP_POINT_FIELDS,
+ TOOLTIP_FORMATS,
+ TOOLTIP_KEY,
+ COMPARE_TYPES
+} from '@kepler.gl/constants';
import {
parseFieldValue,
getFormatter,
@@ -31,7 +34,6 @@ import {
notNullorUndefined
} from 'utils/data-utils';
import {Messages, Crosshairs, CursorClick, Pin} from 'components/common/icons/index';
-import {TOOLTIP_FORMATS, TOOLTIP_KEY, COMPARE_TYPES} from 'constants/tooltip';
import {InteractionConfig, TooltipField, CompareType} from '../reducers/vis-state-updaters';
import {DataRow} from './table-utils/data-row';
diff --git a/src/utils/layer-utils.ts b/src/utils/layer-utils.ts
index 94f7e1bae..c9aa416f3 100644
--- a/src/utils/layer-utils.ts
+++ b/src/utils/layer-utils.ts
@@ -19,7 +19,7 @@
// THE SOFTWARE.
import {FindDefaultLayerPropsReturnValue, OVERLAY_TYPE} from 'layers/base-layer';
-import {GEOCODER_LAYER_ID} from 'constants/default-settings';
+import {GEOCODER_LAYER_ID} from '@kepler.gl/constants';
import {Layer, LayerClassesType} from 'layers';
import {VisState, TooltipField, CompareType, SplitMapLayers} from 'reducers/vis-state-updaters';
import KeplerTable, {Field} from './table-utils/kepler-table';
diff --git a/src/utils/map-info-utils.ts b/src/utils/map-info-utils.ts
index 0129d4004..58d8e9f5c 100644
--- a/src/utils/map-info-utils.ts
+++ b/src/utils/map-info-utils.ts
@@ -18,7 +18,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import {MAP_INFO_CHARACTER} from 'constants/default-settings';
+import {MAP_INFO_CHARACTER} from '@kepler.gl/constants';
export function isValidMapInfo(mapInfo) {
return (
diff --git a/src/utils/map-style-utils/mapbox-gl-style-editor.ts b/src/utils/map-style-utils/mapbox-gl-style-editor.ts
index bc50b20e9..738e7f556 100644
--- a/src/utils/map-style-utils/mapbox-gl-style-editor.ts
+++ b/src/utils/map-style-utils/mapbox-gl-style-editor.ts
@@ -20,7 +20,7 @@
import memoize from 'lodash.memoize';
import clondDeep from 'lodash.clonedeep';
-import {DEFAULT_LAYER_GROUPS, DEFAULT_MAPBOX_API_URL} from 'constants/default-settings';
+import {DEFAULT_LAYER_GROUPS, DEFAULT_MAPBOX_API_URL} from '@kepler.gl/constants';
import {BaseMapStyle, LayerGroup, MapState} from 'reducers';
const mapUrlRg = /^mapbox:\/\/styles\/[-a-z0-9]{2,256}\/[-a-z0-9]{2,256}/;
diff --git a/src/utils/notifications-utils.ts b/src/utils/notifications-utils.ts
index 17ddef38b..9141a6c02 100644
--- a/src/utils/notifications-utils.ts
+++ b/src/utils/notifications-utils.ts
@@ -24,10 +24,9 @@ import {
DEFAULT_NOTIFICATION_MESSAGE,
DEFAULT_NOTIFICATION_TOPICS,
DEFAULT_NOTIFICATION_TYPES,
- DEFAULT_UUID_COUNT
-} from 'constants/default-settings';
-
-import {BUG_REPORT_LINK} from 'constants/user-guides';
+ DEFAULT_UUID_COUNT,
+ BUG_REPORT_LINK
+} from '@kepler.gl/constants';
/**
* Creates a notification
diff --git a/src/utils/table-utils/kepler-table.ts b/src/utils/table-utils/kepler-table.ts
index c6532df3e..a09da0933 100644
--- a/src/utils/table-utils/kepler-table.ts
+++ b/src/utils/table-utils/kepler-table.ts
@@ -19,7 +19,7 @@
// THE SOFTWARE.
import {console as Console} from 'global/console';
-import {TRIP_POINT_FIELDS, SORT_ORDER} from 'constants/default-settings';
+import {TRIP_POINT_FIELDS, SORT_ORDER, ALL_FIELD_TYPES, SCALE_TYPES} from '@kepler.gl/constants';
import {ascending, descending} from 'd3-array';
// import {validateInputData} from 'processors/data-processor';
@@ -43,11 +43,9 @@ import {
getLinearDomain
} from 'utils/data-scale-utils';
-import {ALL_FIELD_TYPES, SCALE_TYPES} from 'constants/default-settings';
-
import {createDataContainer} from './data-container-utils';
-import {RGBColor} from 'reducers/types';
+import {RGBColor} from '@kepler.gl/types';
import {Layer} from 'layers';
import {FieldDomain, Filter} from 'reducers/vis-state-updaters';
import {DataContainerInterface} from './data-container-interface';
diff --git a/src/utils/utils.ts b/src/utils/utils.ts
index a4e770977..82de97975 100644
--- a/src/utils/utils.ts
+++ b/src/utils/utils.ts
@@ -98,9 +98,7 @@ export const camelize = str => {
* @param mode export option
* @return {string} url
*/
-export function getHTMLMapModeTileUrl(mode) {
- return `https://d1a3f4spazzrp4.cloudfront.net/kepler.gl/documentation/map-${mode.toLowerCase()}-mode.png`;
-}
+export {getHTMLMapModeTileUrl} from '@kepler.gl/constants';
/**
* Converts non-arrays to arrays. Leaves arrays alone. Converts
diff --git a/test/browser/components/container-test.js b/test/browser/components/container-test.js
index 45c5f12c9..d6157cedd 100644
--- a/test/browser/components/container-test.js
+++ b/test/browser/components/container-test.js
@@ -32,7 +32,7 @@ import coreReducer from 'reducers/core';
import {keplerGlInit} from 'actions/actions';
import Container, {ERROR_MSG} from 'components/container';
-import {DEFAULT_MAPBOX_API_URL} from 'constants/default-settings';
+import {DEFAULT_MAPBOX_API_URL} from '@kepler.gl/constants';
const initialCoreState = coreReducer(undefined, keplerGlInit());
const initialState = {
keplerGl: {}
diff --git a/test/browser/components/kepler-gl-test.js b/test/browser/components/kepler-gl-test.js
index d12a36a0c..25bcebc9f 100644
--- a/test/browser/components/kepler-gl-test.js
+++ b/test/browser/components/kepler-gl-test.js
@@ -41,7 +41,7 @@ import {
import NotificationPanelFactory from 'components/notification-panel';
import {ActionTypes} from 'actions';
import {DEFAULT_MAP_STYLES, EXPORT_IMAGE_ID} from 'constants';
-import {GEOCODER_DATASET_NAME} from 'constants/default-settings';
+import {GEOCODER_DATASET_NAME} from '@kepler.gl/constants';
// mock state
import {StateWithGeocoderDataset} from 'test/helpers/mock-state';
diff --git a/test/browser/components/side-panel/color-selector-test.js b/test/browser/components/side-panel/color-selector-test.js
index f2bf4cd5a..62f3e394c 100644
--- a/test/browser/components/side-panel/color-selector-test.js
+++ b/test/browser/components/side-panel/color-selector-test.js
@@ -46,7 +46,7 @@ import CustomPalette from 'components/side-panel/layer-panel/custom-palette';
import CustomPicker from 'components/side-panel/layer-panel/custom-picker';
import {Button} from 'components/common/styled-components';
-import {COLOR_RANGES} from 'constants/color-ranges';
+import {COLOR_RANGES} from '@kepler.gl/constants';
import {StateWFilesFiltersLayerColor, StateWTrips} from 'test/helpers/mock-state';
import {IntlWrapper, mountWithTheme} from 'test/helpers/component-utils';
diff --git a/test/browser/components/side-panel/filter-manager-test.js b/test/browser/components/side-panel/filter-manager-test.js
index 5448b6461..d98e07db1 100644
--- a/test/browser/components/side-panel/filter-manager-test.js
+++ b/test/browser/components/side-panel/filter-manager-test.js
@@ -37,7 +37,7 @@ import {mountWithTheme, IntlWrapper} from 'test/helpers/component-utils';
import keplerGlReducer from 'reducers/core';
import * as VisStateActions from 'actions/vis-state-actions';
import {testFields, testAllData} from 'test/fixtures/test-csv-data';
-import {ALL_FIELD_TYPES} from 'constants/default-settings';
+import {ALL_FIELD_TYPES} from '@kepler.gl/constants';
import {assertDatasetIsTable} from '../../../helpers/comparison-utils';
// components
diff --git a/test/browser/components/side-panel/side-panel-test.js b/test/browser/components/side-panel/side-panel-test.js
index 528b29219..389514d14 100644
--- a/test/browser/components/side-panel/side-panel-test.js
+++ b/test/browser/components/side-panel/side-panel-test.js
@@ -55,7 +55,7 @@ const SaveExportDropdown = appInjector.get(SaveExportDropdownFactory);
import {InitialState} from 'test/helpers/mock-state';
// Constants
-import {EXPORT_DATA_ID, EXPORT_MAP_ID, EXPORT_IMAGE_ID} from 'constants/default-settings';
+import {EXPORT_DATA_ID, EXPORT_MAP_ID, EXPORT_IMAGE_ID} from '@kepler.gl/constants';
// default props from initial state
const defaultProps = {
diff --git a/test/helpers/comparison-utils.js b/test/helpers/comparison-utils.js
index 42b3f650f..cbb518a28 100644
--- a/test/helpers/comparison-utils.js
+++ b/test/helpers/comparison-utils.js
@@ -18,7 +18,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import {FILTER_TYPES} from 'constants/default-settings';
+import {FILTER_TYPES} from '@kepler.gl/constants';
import {toArray} from '../../src/utils/utils';
import KeplerTable from '../../src/utils/table-utils/kepler-table';
diff --git a/test/helpers/mock-state.js b/test/helpers/mock-state.js
index 67909f4d7..8cb3e9a8e 100644
--- a/test/helpers/mock-state.js
+++ b/test/helpers/mock-state.js
@@ -22,7 +22,7 @@ import test from 'tape-catch';
import cloneDeep from 'lodash.clonedeep';
import {drainTasksForTesting} from 'react-palm/tasks';
-import {VizColorPalette} from 'constants/custom-color-ranges';
+import {VizColorPalette, COMPARE_TYPES} from '@kepler.gl/constants';
import {getInitialInputStyle} from 'reducers/map-style-updaters';
import keplerGlReducer from 'reducers/core';
@@ -54,7 +54,6 @@ import {
} from 'test/fixtures/test-trip-data';
import tripGeojson, {tripDataInfo} from 'test/fixtures/trip-geojson';
import {processCsvData, processGeojson} from 'processors/data-processor';
-import {COMPARE_TYPES} from 'constants/tooltip';
import {MOCK_MAP_STYLE} from './mock-map-styles';
import {getUpdateVisDataPayload} from 'components/geocoder-panel';
diff --git a/test/node/reducers/map-style-test.js b/test/node/reducers/map-style-test.js
index 458b6c8a6..66f3f6b48 100644
--- a/test/node/reducers/map-style-test.js
+++ b/test/node/reducers/map-style-test.js
@@ -29,7 +29,7 @@ import {
} from 'reducers/map-style-updaters';
import {keplerGlInit, receiveMapConfig} from 'actions/actions';
import SchemaManager from 'schemas';
-import {DEFAULT_MAP_STYLES, DEFAULT_MAPBOX_API_URL} from 'constants/default-settings';
+import {DEFAULT_MAP_STYLES, DEFAULT_MAPBOX_API_URL} from '@kepler.gl/constants';
// helpers
import {StateWCustomMapStyle} from 'test/helpers/mock-state';
diff --git a/test/node/reducers/provider-state-test.js b/test/node/reducers/provider-state-test.js
index b7795dca8..6074ad8df 100644
--- a/test/node/reducers/provider-state-test.js
+++ b/test/node/reducers/provider-state-test.js
@@ -22,7 +22,7 @@ import test from 'tape';
import {drainTasksForTesting, succeedTaskInTest, errorTaskInTest} from 'react-palm/tasks';
import sinon from 'sinon';
import {default as Console} from 'global/console';
-import ActionTypes from 'constants/action-types';
+import {ActionTypes} from 'actions';
import {exportFileToCloud, resetProviderStatus, setCloudProvider} from 'actions/provider-actions';
import reducer, {providerStateReducerFactory} from 'reducers/provider-state';
diff --git a/test/node/reducers/ui-state-test.js b/test/node/reducers/ui-state-test.js
index f7c4c8779..059c52f32 100644
--- a/test/node/reducers/ui-state-test.js
+++ b/test/node/reducers/ui-state-test.js
@@ -43,7 +43,7 @@ import {
RESOLUTIONS,
DEFAULT_NOTIFICATION_TOPICS,
DEFAULT_NOTIFICATION_TYPES
-} from 'constants/default-settings';
+} from '@kepler.gl/constants';
test('#uiStateReducer', t => {
t.deepEqual(
diff --git a/test/node/reducers/vis-state-test.js b/test/node/reducers/vis-state-test.js
index 9144ab1f5..020e877b2 100644
--- a/test/node/reducers/vis-state-test.js
+++ b/test/node/reducers/vis-state-test.js
@@ -38,7 +38,7 @@ import {createNewDataEntry} from 'utils/dataset-utils';
import {maybeToDate} from 'utils/data-utils';
import {processCsvData, processGeojson} from 'processors/data-processor';
import {Layer, KeplerGlLayers} from 'layers';
-import {ALL_FIELD_TYPES, EDITOR_MODES} from 'constants/default-settings';
+import {ALL_FIELD_TYPES, EDITOR_MODES} from '@kepler.gl/constants';
const {ArcLayer, PointLayer, GeojsonLayer, LineLayer, TripLayer} = KeplerGlLayers;
diff --git a/test/node/utils/aggregate-utils-test.js b/test/node/utils/aggregate-utils-test.js
index 06a8745b7..11ea35668 100644
--- a/test/node/utils/aggregate-utils-test.js
+++ b/test/node/utils/aggregate-utils-test.js
@@ -20,7 +20,7 @@
import test from 'tape';
import {getFrequency, getMode, aggregate} from 'utils/aggregate-utils';
-import {AGGREGATION_TYPES} from 'constants/default-settings';
+import {AGGREGATION_TYPES} from '@kepler.gl/constants';
test('AggregateUtils - GetFrequency', t => {
t.deepEqual(
diff --git a/test/node/utils/data-processor-test.js b/test/node/utils/data-processor-test.js
index a9e2a47ca..523915444 100644
--- a/test/node/utils/data-processor-test.js
+++ b/test/node/utils/data-processor-test.js
@@ -57,7 +57,7 @@ import {
import {createDataContainer} from 'utils/table-utils';
-import {ALL_FIELD_TYPES} from 'constants/default-settings';
+import {ALL_FIELD_TYPES} from '@kepler.gl/constants';
import {cmpFields} from '../../helpers/comparison-utils';
test('Processor -> getFieldsFromData', t => {
diff --git a/test/node/utils/filter-utils-test.js b/test/node/utils/filter-utils-test.js
index 69153fece..aea2195f2 100644
--- a/test/node/utils/filter-utils-test.js
+++ b/test/node/utils/filter-utils-test.js
@@ -36,7 +36,7 @@ import {
import {getDatasetFieldIndexForFilter} from 'utils/gpu-filter-utils';
-import {FILTER_TYPES} from 'constants/default-settings';
+import {FILTER_TYPES} from '@kepler.gl/constants';
import {mockPolygonFeature, mockPolygonData} from '../../fixtures/polygon';
import {createDataContainer} from 'utils/table-utils';
diff --git a/test/node/utils/interaction-utils-test.js b/test/node/utils/interaction-utils-test.js
index 700495084..7ee6b3837 100644
--- a/test/node/utils/interaction-utils-test.js
+++ b/test/node/utils/interaction-utils-test.js
@@ -25,9 +25,8 @@ import {
getTooltipDisplayDeltaValue,
TOOLTIP_MINUS_SIGN
} from 'utils/interaction-utils';
-import {DEFAULT_TOOLTIP_FIELDS} from 'constants/default-settings';
+import {DEFAULT_TOOLTIP_FIELDS, COMPARE_TYPES} from '@kepler.gl/constants';
import {StateWTooltipFormat, testGeoJsonDataId} from 'test/helpers/mock-state';
-import {COMPARE_TYPES} from 'constants/tooltip';
const fields = [
{
diff --git a/test/node/utils/kepler-gl-utils-test.js b/test/node/utils/kepler-gl-utils-test.js
index 4abac40df..590598e8c 100644
--- a/test/node/utils/kepler-gl-utils-test.js
+++ b/test/node/utils/kepler-gl-utils-test.js
@@ -19,7 +19,7 @@
// THE SOFTWARE.
import test from 'tape';
-import {GEOCODER_DATASET_NAME} from 'constants/default-settings';
+import {GEOCODER_DATASET_NAME} from '@kepler.gl/constants';
import {getVisibleDatasets} from 'components/kepler-gl';
test('kepler-gl utils -> getVisibleDatasets', t => {
diff --git a/test/node/utils/kepler-table-test.js b/test/node/utils/kepler-table-test.js
index 6a53ab7ba..7992b6ed7 100644
--- a/test/node/utils/kepler-table-test.js
+++ b/test/node/utils/kepler-table-test.js
@@ -28,7 +28,7 @@ import {createNewDataEntry} from 'utils/dataset-utils';
import {processCsvData} from 'processors/data-processor';
import {cmpFields} from '../../helpers/comparison-utils';
-import {FILTER_TYPES} from 'constants/default-settings';
+import {FILTER_TYPES} from '@kepler.gl/constants';
function testGetTimeFieldDomain(table, t) {
const test_cases = [
diff --git a/test/node/utils/layer-utils-test.js b/test/node/utils/layer-utils-test.js
index 410a2a190..1c18b11ee 100644
--- a/test/node/utils/layer-utils-test.js
+++ b/test/node/utils/layer-utils-test.js
@@ -24,7 +24,7 @@ import {findDefaultLayer, getLayerHoverProp} from 'utils/layer-utils';
import {createNewDataEntry} from 'utils/dataset-utils';
import KeplerTable, {findPointFieldPairs} from 'utils/table-utils/kepler-table';
import {processCsvData, processGeojson} from 'processors/data-processor';
-import {GEOJSON_FIELDS} from 'constants/default-settings';
+import {GEOJSON_FIELDS} from '@kepler.gl/constants';
import {LayerClasses, KeplerGlLayers} from 'layers';
import {StateWTripGeojson, StateWFiles} from 'test/helpers/mock-state';
diff --git a/yarn.lock b/yarn.lock
index aa20fd520..66944d39d 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3626,6 +3626,16 @@
semver "^7.3.5"
tsutils "^3.21.0"
+"@typescript-eslint/parser@^5.27.0":
+ version "5.27.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.27.0.tgz#62bb091ed5cf9c7e126e80021bb563dcf36b6b12"
+ integrity sha512-8oGjQF46c52l7fMiPPvX4It3u3V3JipssqDfHQ2hcR0AeR8Zge+OYyKUCm5b70X72N1qXt0qgHenwN6Gc2SXZA==
+ dependencies:
+ "@typescript-eslint/scope-manager" "5.27.0"
+ "@typescript-eslint/types" "5.27.0"
+ "@typescript-eslint/typescript-estree" "5.27.0"
+ debug "^4.3.4"
+
"@typescript-eslint/[email protected]":
version "5.12.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.12.0.tgz#59619e6e5e2b1ce6cb3948b56014d3a24da83f5e"
@@ -3634,6 +3644,14 @@
"@typescript-eslint/types" "5.12.0"
"@typescript-eslint/visitor-keys" "5.12.0"
+"@typescript-eslint/[email protected]":
+ version "5.27.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.27.0.tgz#a272178f613050ed62f51f69aae1e19e870a8bbb"
+ integrity sha512-VnykheBQ/sHd1Vt0LJ1JLrMH1GzHO+SzX6VTXuStISIsvRiurue/eRkTqSrG0CexHQgKG8shyJfR4o5VYioB9g==
+ dependencies:
+ "@typescript-eslint/types" "5.27.0"
+ "@typescript-eslint/visitor-keys" "5.27.0"
+
"@typescript-eslint/[email protected]":
version "5.12.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.12.0.tgz#aaf45765de71c6d9707c66ccff76ec2b9aa31bb6"
@@ -3648,6 +3666,11 @@
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.12.0.tgz#5b4030a28222ee01e851836562c07769eecda0b8"
integrity sha512-JowqbwPf93nvf8fZn5XrPGFBdIK8+yx5UEGs2QFAYFI8IWYfrzz+6zqlurGr2ctShMaJxqwsqmra3WXWjH1nRQ==
+"@typescript-eslint/[email protected]":
+ version "5.27.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.27.0.tgz#c3f44b9dda6177a9554f94a74745ca495ba9c001"
+ integrity sha512-lY6C7oGm9a/GWhmUDOs3xAVRz4ty/XKlQ2fOLr8GAIryGn0+UBOoJDWyHer3UgrHkenorwvBnphhP+zPmzmw0A==
+
"@typescript-eslint/[email protected]":
version "5.12.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.12.0.tgz#cabf545fd592722f0e2b4104711e63bf89525cd2"
@@ -3661,6 +3684,19 @@
semver "^7.3.5"
tsutils "^3.21.0"
+"@typescript-eslint/[email protected]":
+ version "5.27.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.27.0.tgz#7965f5b553c634c5354a47dcce0b40b94611e995"
+ integrity sha512-QywPMFvgZ+MHSLRofLI7BDL+UczFFHyj0vF5ibeChDAJgdTV8k4xgEwF0geFhVlPc1p8r70eYewzpo6ps+9LJQ==
+ dependencies:
+ "@typescript-eslint/types" "5.27.0"
+ "@typescript-eslint/visitor-keys" "5.27.0"
+ debug "^4.3.4"
+ globby "^11.1.0"
+ is-glob "^4.0.3"
+ semver "^7.3.7"
+ tsutils "^3.21.0"
+
"@typescript-eslint/[email protected]":
version "5.12.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.12.0.tgz#92fd3193191621ab863add2f553a7b38b65646af"
@@ -3681,6 +3717,14 @@
"@typescript-eslint/types" "5.12.0"
eslint-visitor-keys "^3.0.0"
+"@typescript-eslint/[email protected]":
+ version "5.27.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.27.0.tgz#97aa9a5d2f3df8215e6d3b77f9d214a24db269bd"
+ integrity sha512-46cYrteA2MrIAjv9ai44OQDUoCZyHeGIc4lsjCUX2WT6r4C+kidz1bNiR4017wHOPUythYeH+Sc7/cFP97KEAA==
+ dependencies:
+ "@typescript-eslint/types" "5.27.0"
+ eslint-visitor-keys "^3.3.0"
+
"@webassemblyjs/[email protected]":
version "1.9.0"
resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.9.0.tgz#bd850604b4042459a5a41cd7d338cbed695ed964"
@@ -6091,6 +6135,13 @@ debug@^4.3.2:
dependencies:
ms "2.1.2"
+debug@^4.3.4:
+ version "4.3.4"
+ resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865"
+ integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==
+ dependencies:
+ ms "2.1.2"
+
decamelize-keys@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/decamelize-keys/-/decamelize-keys-1.1.0.tgz#d171a87933252807eb3cb61dc1c1445d078df2d9"
@@ -7047,7 +7098,7 @@ eslint-visitor-keys@^2.0.0, eslint-visitor-keys@^2.1.0:
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303"
integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==
-eslint-visitor-keys@^3.0.0:
+eslint-visitor-keys@^3.0.0, eslint-visitor-keys@^3.3.0:
version "3.3.0"
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz#f6480fa6b1f30efe2d1968aa8ac745b862469826"
integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==
@@ -8202,7 +8253,7 @@ globby@^11.0.1:
merge2 "^1.3.0"
slash "^3.0.0"
-globby@^11.0.4:
+globby@^11.0.4, globby@^11.1.0:
version "11.1.0"
resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b"
integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==
@@ -13828,6 +13879,13 @@ semver@^7.3.5:
dependencies:
lru-cache "^6.0.0"
+semver@^7.3.7:
+ version "7.3.7"
+ resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.7.tgz#12c5b649afdbf9049707796e22a4028814ce523f"
+ integrity sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==
+ dependencies:
+ lru-cache "^6.0.0"
+
version "0.17.1"
resolved "https://registry.yarnpkg.com/send/-/send-0.17.1.tgz#c1d8b059f7900f7466dd4938bdc44e11ddb376c8"