Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
[chore] export types, add script to build types (#1636)
Shan He52993525a661
diff --git a/docs/api-reference/localization/README.md b/docs/api-reference/localization/README.mdindex bbace21b2..2f181e6b4 100644--- a/docs/api-reference/localization/README.md+++ b/docs/api-reference/localization/README.md@@ -41,7 +41,7 @@ const reducers = combineReducers({Let's say we want to add the Swedish language to kepler.gl. Easiest way to add translation of new language is to follow these 3 steps:- Find out the [language code][language-codes] for Swedish: `sv`-- Add new translation file `src/localization/sv.js` by copying `src/localization/en.js` and translating the strings+- Add new translation file `src/localization/translations/sv.js` by copying `src/localization/translations/en.js` and translating the strings- Update _LOCALES_ in `src/localization/locales.js` to include new language translation:```javascriptdiff --git a/examples/demo-app/src/cloud-providers/carto/carto-provider.js b/examples/demo-app/src/cloud-providers/carto/carto-provider.jsindex 3fbff16b8..23f9ea61b 100644--- a/examples/demo-app/src/cloud-providers/carto/carto-provider.js+++ b/examples/demo-app/src/cloud-providers/carto/carto-provider.js@@ -23,7 +23,7 @@ import Console from 'global/console';import CartoIcon from './carto-icon';import {formatCsv} from 'kepler.gl/processors';import {Provider} from 'kepler.gl/cloud-providers';-import {createDataContainer} from 'kepler.gl';+import {createDataContainer} from 'kepler.gl/utils';const NAME = 'carto';const DISPLAY_NAME = 'CARTO';diff --git a/examples/webpack.config.local.js b/examples/webpack.config.local.jsindex 1b081910e..64722f194 100644--- a/examples/webpack.config.local.js+++ b/examples/webpack.config.local.js@@ -104,10 +104,7 @@ function makeLocalDevConfig(env, EXAMPLE_DIR = LIB_DIR, externals = {}) {return {// suppress warnings about bundle sizedevServer: {- historyApiFallback: true,- stats: {- warnings: false- }+ historyApiFallback: true},devtool: 'source-map',diff --git a/package.json b/package.jsonindex b230ca146..bb5158a21 100644--- a/package.json+++ b/package.json@@ -5,6 +5,7 @@"description": "kepler.gl is a webgl based application to visualize large scale location data in the browser","license": "MIT","main": "dist/index.js",+ "types": "./types.d.ts","keywords": ["babel","es6",@@ -43,11 +44,12 @@"start:e2e": "npm run install-and-start -- examples/demo-app start-local-e2e","build": "rm -fr dist && babel src --out-dir dist --source-maps inline","build:umd": "webpack --config ./webpack/umd.js --progress --env.prod",+ "build:types": "webpack --config ./webpack/build_types.js --progress","analyze": "npm run analyze:bundle","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",+ "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",@@ -196,6 +198,7 @@"babel-tape-runner": "^3.0.0","babelify": "^10.0.0","documentation": "^9.1.1",+ "dts-bundle-webpack": "^1.0.2","enzyme": "^3.9.0","enzyme-adapter-react-16": "^1.10.0","eslint": "^5.16.0",@@ -286,4 +289,4 @@"node": "12.19.0","yarn": "1.22.17"}-}+}\ No newline at end of filediff --git a/src/components/common/action-panel.d.ts b/src/components/common/action-panel.d.tsindex a0980ed00..3076cf1b5 100644--- a/src/components/common/action-panel.d.ts+++ b/src/components/common/action-panel.d.ts@@ -1,9 +1,9 @@-import {FunctionComponent, PropsWithChildren, ComponentType, CSSProperties} from 'react';+import {FunctionComponent, PropsWithChildren, ElementType, CSSProperties} from 'react';export type ActionPanelItemProps = PropsWithChildren<{color?: string,className?: string,- Icon?: ComponentType<any>,+ Icon?: ElementType,label: string,onClick?: () => void,isSelection?: boolean,diff --git a/src/components/common/checkbox.d.ts b/src/components/common/checkbox.d.tsnew file mode 100644index 000000000..4e12c64f5--- /dev/null+++ b/src/components/common/checkbox.d.ts@@ -0,0 +1,3 @@+export const Checkbox: (...props: any[]) => JSX.Element;++export default Checkbox;diff --git a/src/components/common/file-uploader/file-drop.d.ts b/src/components/common/file-uploader/file-drop.d.tsindex 765a0ee29..e0cdb4345 100644--- a/src/components/common/file-uploader/file-drop.d.ts+++ b/src/components/common/file-uploader/file-drop.d.ts@@ -15,5 +15,5 @@ export type FileDropProps = {onFrameDrop?: (event: any) => void;};-const FileDrop: React.FunctionComponent<FileDropProps>;+export const FileDrop: React.FunctionComponent<FileDropProps>;export default FileDrop;diff --git a/src/components/common/file-uploader/upload-button.d.ts b/src/components/common/file-uploader/upload-button.d.tsnew file mode 100644index 000000000..1ffd85da2--- /dev/null+++ b/src/components/common/file-uploader/upload-button.d.ts@@ -0,0 +1,8 @@+import React from 'react';++export type UploadButtonProps = {+ onUpload: (files: FileList, event: any) => void;+};++export const UploadButton: React.FC<UploadButtonProps>;+export default UploadButton;diff --git a/src/components/common/file-uploader/upload-button.d.ts.wip b/src/components/common/file-uploader/upload-button.d.ts.wipdeleted file mode 100644index f889aa011..000000000--- a/src/components/common/file-uploader/upload-button.d.ts.wip+++ /dev/null@@ -1,11 +0,0 @@-// For some reason these types don't work-// JSX element type 'UploadButton' does not have any construct or call signatures.--import React from 'react';--export type UploadButtonProps = {- onUpload: (files: FileList, event: any) => void;-};--export const UploadButton: React.Component<UploadButtonProps>;-export default UploadButton;diff --git a/src/components/common/file-uploader/upload-button.js b/src/components/common/file-uploader/upload-button.jsindex 4565845f3..78a4c6ffe 100644--- a/src/components/common/file-uploader/upload-button.js+++ b/src/components/common/file-uploader/upload-button.js@@ -18,15 +18,9 @@// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN// THE SOFTWARE.-import React, {Component, createRef} from 'react';+import React, {useCallback, useRef} from 'react';import styled from 'styled-components';-/**-@typedef {{- onUpload: (files: FileList, event: any) => void;-}} UploadButtonProps-*/-const Wrapper = styled.div`display: inline-block;color: ${props => props.theme.textColorLT};@@ -38,46 +32,53 @@ const Wrapper = styled.div`font-weight: 500;}`;+const inputStyle = {display: 'none'};+/*Inspired by https://github.com/okonet/react-dropzone/blob/master/src/index.js*/-/** @augments React.Component<UploadButtonProps> */-export class UploadButton extends Component {- _fileInput = createRef();+/** @type {typeof import('./upload-button').UploadButton} */+const UploadButton = ({onUpload, children}) => {+ const _fileInput = useRef(null);- _onClick = () => {- this._fileInput.current.value = null;- this._fileInput.current.click();- };+ const _onClick = useCallback(() => {+ if (_fileInput.current) {+ // @ts-ignore create ref with useRef<HTMLInputElement>+ _fileInput.current.value = null;+ // @ts-ignore create ref with useRef<HTMLInputElement>+ _fileInput.current.click();+ }+ }, [_fileInput]);- _onChange = event => {- const {- target: {files}- } = event;+ const _onChange = useCallback(+ event => {+ const {+ target: {files}+ } = event;- if (!files) {- return;- }+ if (!files) {+ return;+ }- this.props.onUpload(files, event);- };+ onUpload(files, event);+ },+ [onUpload]+ );- render() {- return (- <Wrapper className="upload-button">- <input- type="file"- ref={this._fileInput}- style={{display: 'none'}}- onChange={this._onChange}- className="upload-button-input"- />- <span className="file-upload__upload-button-span" onClick={this._onClick}>- {this.props.children}- </span>- </Wrapper>- );- }-}+ return (+ <Wrapper className="upload-button">+ <input+ type="file"+ ref={_fileInput}+ style={inputStyle}+ onChange={_onChange}+ className="upload-button-input"+ />+ <span className="file-upload__upload-button-span" onClick={_onClick}>+ {children}+ </span>+ </Wrapper>+ );+};export default UploadButton;diff --git a/src/components/common/icons/index.d.ts b/src/components/common/icons/index.d.tsnew file mode 100644index 000000000..7da7df421--- /dev/null+++ b/src/components/common/icons/index.d.ts@@ -0,0 +1,76 @@+import React from 'react';++export const Add: React.ElementType;+export const AnchorWindow: React.ElementType;+export const ArrowDown: React.ElementType;+export const ArrowDownAlt: React.ElementType;+export const ArrowDownSolid: React.ElementType;+export const ArrowLeft: React.ElementType;+export const ArrowRight: React.ElementType;+export const ArrowUpSolid: React.ElementType;+export const ArrowUpAlt: React.ElementType;+export const ArrowUp: React.ElementType;+export const Base: React.ElementType;+export const Bug: React.ElementType;+export const Cancel: React.ElementType;+export const Checkmark: React.ElementType;+export const Clipboard: React.ElementType;+export const Clock: React.ElementType;+export const Close: React.ElementType;+export const Copy: React.ElementType;+export const Crosshairs: React.ElementType;+export const Cube3d: React.ElementType;+export const CursorClick: React.ElementType;+export const DataTable: React.ElementType;+export const Db: React.ElementType;+export const Delete: React.ElementType;+export const Docs: React.ElementType;+export const DragNDrop: React.ElementType;+export const Email: React.ElementType;+export const Expand: React.ElementType;+export const EyeSeen: React.ElementType;+export const EyeUnseen: React.ElementType;+export const File: React.ElementType;+export const Files: React.ElementType;+export const FileType: React.ElementType;+export const FilterFunnel: React.ElementType;+export const FreeWindow: React.ElementType;+export const Gear: React.ElementType;+export const Hash: React.ElementType;+export const Histogram: React.ElementType;+export const Info: React.ElementType;+export const Layers: React.ElementType;+export const LeftArrow: React.ElementType;+export const Legend: React.ElementType;+export const LineChart: React.ElementType;+export const Logout: React.ElementType;+export const Login: React.ElementType;+export const Map: React.ElementType;+export const MapIcon: React.ElementType;+export const Minus: React.ElementType;+export const Messages: React.ElementType;+export const Pause: React.ElementType;+export const Picture: React.ElementType;+export const Pin: React.ElementType;+export const Play: React.ElementType;+export const Reduce: React.ElementType;+export const Reset: React.ElementType;+export const Rocket: React.ElementType;+export const Save: React.ElementType;+export const Save2: React.ElementType;+export const Share: React.ElementType;+export const SquareSelect: React.ElementType;+export const Settings: React.ElementType;+export const Search: React.ElementType;+export const Split: React.ElementType;+export const Table: React.ElementType;+export const Trash: React.ElementType;+export const Upload: React.ElementType;+export const VertDots: React.ElementType;+export const VertThreeDots: React.ElementType;+export const IconWrapper: React.ElementType;+export const CodeAlt: React.ElementType;+export const Warning: React.ElementType;+export const DrawPolygon: React.ElementType;+export const Polygon: React.ElementType;+export const Rectangle: React.ElementType;diff --git a/src/components/common/styled-components.d.ts b/src/components/common/styled-components.d.tsnew file mode 100644index 000000000..f9c177126--- /dev/null+++ b/src/components/common/styled-components.d.ts@@ -0,0 +1,48 @@+export type ReactElement = (...props: any[]) => JSX.Element;++export const Tooltip: ReactElement;+export const BottomWidgetInner: ReactElement;+export const CenterFlexbox: ReactElement;+export const DatasetSquare: ReactElement;+export const TruncatedTitleText: ReactElement;+export const Button: ReactElement;+export const Input: ReactElement;+export const PanelLabel: ReactElement;+export const StyledFilterContent: ReactElement;+export const PanelLabel: ReactElement;+export const SidePanelSection: ReactElement;+export const SelectTextBold: ReactElement;+export const IconRoundSmall: ReactElement;+export const StyledAttrbution: ReactElement;+export const MapControlButton: ReactElement;+export const IconRoundSmall: ReactElement;+export const StyledModalContent: ReactElement;+export const InputLight: ReactElement;+export const StyledMapContainer: ReactElement;+export const StyledModalVerticalPanel: ReactElement;+export const StyledModalSection: ReactElement;+export const CenterVerticalFlexbox: ReactElement;+export const CheckMark: ReactElement;+export const StyledExportSection: ReactElement;+export const StyledFilteredOption: ReactElement;+export const StyledModalContent: ReactElement;+export const StyledType: ReactElement;+export const SelectionButton: ReactElement;+export const TextAreaLight: ReactElement;+export const StyledModalInputFootnote: ReactElement;+export const SidePanelDivider: ReactElement;+export const StyledPanelHeader: ReactElement;+export const PanelHeaderTitle: ReactElement;+export const PanelHeaderContent: ReactElement;+export const PanelContent: ReactElement;+export const SBFlexboxNoMargin: ReactElement;+export const StyledPanelDropdown: ReactElement;+export const InlineInput: ReactElement;+export const SBFlexboxItem: ReactElement;+export const SpaceBetweenFlexbox: ReactElement;+export const PanelLabelWrapper: ReactElement;+export const PanelLabelBold: ReactElement;+export const PanelHeaderContent: ReactElement;+++diff --git a/src/components/container.d.ts b/src/components/container.d.tsnew file mode 100644index 000000000..62f48e8eb--- /dev/null+++ b/src/components/container.d.ts@@ -0,0 +1,8 @@+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/index.d.ts b/src/components/index.d.tsnew file mode 100644index 000000000..292ebff4a--- /dev/null+++ b/src/components/index.d.ts@@ -0,0 +1,49 @@+import React from 'react';+import {FeatureFlags} from './context';++export {withState} from './injector';++export * from './context';+export * from './bottom-widget';+export * from './kepler-gl';+export * from './map-container';+export * from './maps-layout';+export * from './modal-container';+export * from './side-panel';+export * from './container';++// TODO: we need more specific types for the following components+export * from './map/map-legend';+export * from './map/split-map-button';+export * from './side-panel/common/dataset-tag';+export * from './common/checkbox';+export * from './common/styled-components';+export * from './common/tippy-tooltip'+export * as Icons from './common/icons';+export * from './common/file-uploader/file-drop';+export * from './common/file-uploader/upload-button';+export {default as Portaled} from './common/portaled';++export const PanelHeaderAction: (...props: any[]) => JSX.Element;+export const TippyTooltip: (...props: any[]) => JSX.Element;+export const Toggle3dButtonFactory: (...deps: any) => React.ElementType;+export const ToggleGlobeButtonFactory: (...deps: any) => React.ElementType;+export const MapsLayoutFactory: (...deps: any) => React.ElementType;+export const PanelHeaderDropdownFactory: (...deps: any) => React.ElementType;+export const NotificationItemFactory: (...deps: any) => React.ElementType;+export const DropdownList: React.ElementType;+export const VerticalToolbar: React.ElementType;+export const ToolbarItem: React.ElementType;+export const ModalTitle: React.ElementType;+export const ItemSelector: React.ElementType;+export const Slider: React.ElementType;+export const LoadingSpinner: React.ElementType;+export const LayerConfigGroup: React.ElementType;+export const ChannelByValueSelector: React.ElementType;+export const LayerColorRangeSelector: React.ElementType;+export const LayerColorSelector: React.ElementType;+export const VisConfigSlider: React.ElementType;+export const ConfigGroupCollapsibleContent: React.ElementType;+export const PanelLabel: React.ElementType;++export const useFeatureFlags: () => FeatureFlags;diff --git a/src/components/injector.d.ts b/src/components/injector.d.tsnew file mode 100644index 000000000..deb31b343--- /dev/null+++ b/src/components/injector.d.ts@@ -0,0 +1,26 @@+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/map-container.d.ts b/src/components/map-container.d.tsindex eb90b3bb0..798870c2a 100644--- a/src/components/map-container.d.ts+++ b/src/components/map-container.d.ts@@ -1,13 +1,5 @@-import {Layer} from '../layers';-import {SplitMapLayers} from '../reducers/vis-state-updaters';import React from 'react';-export function prepareLayersToRender(- layers: Layer[],- layerData: any[],- mapLayers: SplitMapLayers | undefined-): {[id: string]: boolean};-export type MapContainerProps = {// TODOprimary: boolean;diff --git a/src/components/map/map-control-tooltip.js b/src/components/map/map-control-tooltip.jsindex 899720252..a605d5d87 100644--- a/src/components/map/map-control-tooltip.js+++ b/src/components/map/map-control-tooltip.js@@ -19,7 +19,7 @@// THE SOFTWARE.import React from 'react';-import {Tooltip} from '..';+import {Tooltip} from 'components/common/styled-components';import {FormattedMessage} from 'localization';function MapControlTooltipFactory() {diff --git a/src/components/modal-container.js b/src/components/modal-container.jsindex f7af49aba..4dd6f02ac 100644--- a/src/components/modal-container.js+++ b/src/components/modal-container.js@@ -178,7 +178,8 @@ export default function ModalContainerFactory(_onExportImage = () => {if (!this.props.uiState.exportImage.processing) {- exportImage(this.props, `${this.props.appName}.png`);+ // @ts-ignore TODO: fix exportImage method+ exportImage(this.props.uiState.exportImage, `${this.props.appName}.png`);this.props.uiStateActions.cleanupExportImage();this._closeModal();}diff --git a/src/components/side-panel/common/dataset-tag.d.ts b/src/components/side-panel/common/dataset-tag.d.tsnew file mode 100644index 000000000..0fc9d6c55--- /dev/null+++ b/src/components/side-panel/common/dataset-tag.d.ts@@ -0,0 +1,3 @@+import React from 'react';++export const DatasetTagFactory: (...deps: any) => React.ElementType;diff --git a/src/components/side-panel/layer-panel/column-selector.js b/src/components/side-panel/layer-panel/column-selector.jsindex e7d4b35a4..08f46bc72 100644--- a/src/components/side-panel/layer-panel/column-selector.js+++ b/src/components/side-panel/layer-panel/column-selector.js@@ -21,7 +21,7 @@import React from 'react';import styled from 'styled-components';import {FormattedMessage} from 'localization';-import {PanelLabel} from '../..';+import {PanelLabel} from 'components/common/styled-components';import FieldSelectorFactory from 'components/common/field-selector';import {validateColumn} from 'reducers/vis-state-merger';diff --git a/src/constants/default-settings.d.ts b/src/constants/default-settings.d.tsnew file mode 100644index 000000000..b8c9cd6d3--- /dev/null+++ b/src/constants/default-settings.d.ts@@ -0,0 +1,390 @@+import {Component} from 'react';++export const ALL_FIELD_TYPES: {+ boolean: 'boolean';+ date: 'date';+ geojson: 'geojson';+ integer: 'integer';+ real: 'real';+ string: 'string';+ timestamp: 'timestamp';+ point: 'point';+};++export const ANIMATION_WINDOW: {+ free: 'free';+ incremental: 'incremental';+ point: 'point';+ interval: 'interval';+};++export const FILTER_TYPES: {+ range: 'range';+ select: 'select';+ input: 'input';+ timeRange: 'timeRange';+ multiSelect: 'multiSelect';+ polygon: 'polygon';+};++export const DEFAULT_TIME_FORMAT: string;++export const BASE_SPEED: number;+export const FPS: number;+export const SPEED_CONTROL_RANGE: [number, number];+export const SPEED_CONTROL_STEP: number;++export type SCALE_TYPES_DEF = {+ ordinal: 'ordinal';+ quantile: 'quantile';+ quantize: 'quantize';+ linear: 'linear';+ sqrt: 'sqrt',+ log: 'log';+ point: 'point';+}++export const SCALE_TYPES: SCALE_TYPES_DEF;++export type SCALE_FUNC_TYPE = {+ [key: keyof SCALE_TYPES_DEF]: () => number+}++export const SCALE_FUNC: SCALE_FUNC_TYPE;++export const SORT_ORDER: {+ ASCENDING: 'ASCENDING';+ DESCENDING: 'DESCENDING';+ UNSORT: 'UNSORT';+};++export type TABLE_OPTION_TYPE = {+ SORT_ASC: 'SORT_ASC';+ SORT_DES: 'SORT_DES';+ UNSORT: 'UNSORT';+ PIN: 'PIN';+ UNPIN: 'UNPIN';+ COPY: 'COPY';+};++export const TABLE_OPTION: TABLE_OPTION_TYPE;++export type TABLE_OPTION = {+ value: keyof TABLE_OPTION_TYPE;+ display: string;+ icon: Component;+ condition: (props: any) => boolean;+};++export const TABLE_OPTION_LIST: TABLE_OPTION[];++export type FILED_TYPE_DISPLAY_TYPE = {+ label: string;+ color: string;+}+export const FILED_TYPE_DISPLAY: {[key: keyof ALL_FIELD_TYPES_DEF]: FILED_TYPE_DISPLAY_TYPE};++export const FIELD_COLORS: {default: string};++export const KEPLER_GL_NAME: string;+export const KEPLER_GL_VERSION: string;+export const KEPLER_GL_WEBSITE: string;++export const EDITOR_MODES: {+ READ_ONLY: 'READ_ONLY';+ DRAW_POLYGON: 'DRAW_POLYGON';+ DRAW_RECTANGLE: 'DRAW_RECTANGLE';+ EDIT: 'EDIT';+};++export type LAYER_TYPES = {+ point: 'point';+ arc: 'arc';+ line: 'line';+ grid: 'grid';+ hexagon: 'hexagon';+ geojson: 'geojson';+ cluster: 'cluster';+ icon: 'icon';+ heatmap: 'heatmap';+ hexagonId: 'hexagonId';+ '3D': '3D';+ trip: 'trip';+ s2: 's2';+}++export type EDITOR_AVAILABLE_LAYERS_DEF = {+ point: 'point';+ arc: 'arc';+ line: 'line';+ hexagon: 'hexagon';+ hexagonId: 'hexagonId';+}++export const EDITOR_AVAILABLE_LAYERS: (keyof EDITOR_AVAILABLE_LAYERS_DEF)[];++export const GEOCODER_DATASET_NAME: string;+export const GEOCODER_LAYER_ID: string;+export const GEOCODER_GEO_OFFSET: number;+export const GEOCODER_ICON_COLOR: [number, number, number];+export const GEOCODER_ICON_SIZE: number;++export const DIMENSIONS: {+ sidePanel: {+ width: number;+ margin: {+ top: number;+ left: number;+ bottom: number;+ right: number;+ },+ headerHeight: number;+ };+ mapControl: {+ width: number;+ padding: number;+ mapLegend: {+ pinned: {+ bottom: number;+ right: number;+ }+ }+ }+};++export const THEME: {+ light: 'light';+ dark: 'dark';+ base: 'base';+};++export const DEFAULT_MAPBOX_API_URL: string;++export const THROTTLE_NOTIFICATION_TIME: number;++export const CHANNEL_SCALES: {+ color: 'color';+ radius: 'radius';+ size: 'size';+ colorAggr: 'colorAggr';+ sizeAggr: 'sizeAggr';+};++export const EXPORT_DATA_TYPE: {+ CSV: string;+};++export type EXPORT_DATA_TYPE_OPTION = {+ id: keyof EXPORT_DATA_TYPE_DEF;+ label: string;+ available: boolean+}+export const EXPORT_DATA_TYPE_OPTIONS: EXPORT_DATA_TYPE_OPTION[];++export const EXPORT_MAP_FORMATS: {+ HTML: 'HTML';+ JSON: 'JSON';+};++export const EXPORT_IMG_RATIOS: {+ SCREEN: 'SCREEN';+ FOUR_BY_THREE: 'FOUR_BY_THREE';+ SIXTEEN_BY_NINE: 'SIXTEEN_BY_NINE';+ CUSTOM: 'CUSTOM';+};++export type EXPORT_IMG_RATIO_OPTION = {+ id: keyof EXPORT_IMG_RATIOS_TYPE;+ label: string;+ getSize: (screenW: number, screenH: number) => {width: number, height: number};+ hidden?: boolean;+}++export const EXPORT_IMG_RATIO_OPTIONS: EXPORT_IMG_RATIO_OPTION[];++export const RESOLUTIONS: {+ ONE_X: 'ONE_X';+ TWO_X: 'TWO_X';+};++export type EXPORT_IMG_RESOLUTION_OPTION = EXPORT_IMG_RATIO_OPTION & {+ available: boolean;+ scale: number;+}+export const EXPORT_IMG_RESOLUTION_OPTIONS: EXPORT_IMG_RESOLUTION_OPTION[];++export const EXPORT_HTML_MAP_MODES: {+ READ: 'READ';+ EDIT: 'EDIT';+};++export type EXPORT_HTML_MAP_MODE_OPTION = {+ id: keyof EXPORT_HTML_MAP_MODES_TYPE;+ label: string;+ available: boolean;+ url: string;+};+export const EXPORT_HTML_MAP_MODE_OPTIONS: EXPORT_HTML_MAP_MODE_OPTION[];++export type EXPORT_MAP_FORMAT_OPTION = {+ id: keyof EXPORT_MAP_FORMATS_TYPE,+ label: string;+ available: string;+};+export const EXPORT_MAP_FORMAT_OPTIONS: EXPORT_MAP_FORMAT_OPTION[];++export type MAP_THUMBNAIL_DIMENSION_TYPE = {+ width: number;+ height: number;+};+export const MAP_THUMBNAIL_DIMENSION: MAP_THUMBNAIL_DIMENSION_TYPE;++export const LOADING_METHODS: {+ upload: 'upload';+ storage: 'storage';+};++export type MAP_INFO_CHARACTER_TYPE = {+ title: number;+ description: number;+}+export const MAP_INFO_CHARACTER: MAP_INFO_CHARACTER_TYPE;++export type FIELD_OPT = {+ type: string;+ scale: object;+ format: object;+};+export const FIELD_OPTS: {+ string: FIELD_OPT,+ real: FIELD_OPT,+ timestamp: FIELD_OPT,+ integer: FIELD_OPT,+ boolean: FIELD_OPT,+ date: FIELD_OPT,+ geojson: FIELD_OPT+}++export type DEFAULT_NOTIFICATION_TOPICS_TYPE = {+ global: string;+ field: string;+};+export const DEFAULT_NOTIFICATION_TOPICS: DEFAULT_NOTIFICATION_TOPICS_TYPE;+export type SIDEBAR_PANELS_TYPE = {+ id: string;+ label: string;+ iconComponent: Component;+ onClick: () => void;+};+export const SIDEBAR_PANELS: SIDEBAR_PANELS_TYPE[];+export const PANELS: SIDEBAR_PANELS_TYPE[];++export type DEFAULT_LAYER_GROUP = {+ slug: string;+ filter: (value) => boolean;+ defaultVisibility: boolean;+};+export const DEFAULT_LAYER_GROUPS: DEFAULT_LAYER_GROUP[];++export const AGGREGATION_TYPES: {+ count: string;+ average: string;+ maximum: string;+ minimum: string;+ median: string;+ stdev: string;+ sum: string;+ variance: string;+ mode: string;+ countUnique: string;+};++export const DATASET_FORMATS: {+ row: string;+ geojson: string;+ csv: string;+ keplergl: string;+};++export const DEFAULT_MAP_STYLES: {+ id: string;+ label: string;+ url: string;+ icon: string;+ layerGroup: DEFAULT_LAYER_GROUPS;+}[];++export type LAYER_BLENDING_TYPE = {+ label: string;+ blendFunc: string[];+ blendEquation: string | string[];+}+export const LAYER_BLENDINGS: {+ additive: LAYER_BLENDING_TYPE;+ normal: LAYER_BLENDING_TYPE;+ subtractive: LAYER_BLENDING_TYPE;+};++export type DEFAULT_NOTIFICATION_TYPES_DEF = {+ info: string;+ error: string;+ warning: string;+ success: string;+};+export const DEFAULT_NOTIFICATION_TYPES: DEFAULT_NOTIFICATION_TYPES_DEF;++export const TRIP_ARC_FIELDS: {+ lat0: string;+ lng0: string;+ lat1: string;+ lng1: string;+}++export const TRIP_POINT_FIELDS: [string, string][];++export const GEOJSON_FIELDS: {+ geojson: string[];+}++export const ICON_FIELDS: {+ icon: string[];+}++export const MAP_CONTROLS: {+ visibleLayers: 'visibleLayers';+ mapLegend: 'mapLegend';+ toggle3d: 'toggle3d';+ toggleGlobe: 'toggleGlobe';+ splitMap: 'splitMap';+ mapDraw: 'mapDraw';+ mapLocale: 'mapLocale';+}++export const DEFAULT_LAYER_COLOR: {+ tripArc: string;+ begintrip_lat: string;+ dropoff_lat: string;+ request_lat: string;+};++export const CHANNEL_SCALE_SUPPORTED_FIELDS: object;+export const CLOUDFRONT: string;+export const MAX_DEFAULT_TOOLTIPS: number;+export const NO_VALUE_COLOR: [number, number, number, number];+export const MAX_GPU_FILTERS: number;+export const DEFAULT_TOOLTIP_FIELDS: {name: string}[];+export const DEFAULT_NOTIFICATION_MESSAGE: string;+export const DEFAULT_UUID_COUNT: number;++// modals+export const DATA_TABLE_ID: string;+export const ADD_DATA_ID: string;+export const DELETE_DATA_ID: string;+export const EXPORT_IMAGE_ID: string;+export const EXPORT_DATA_ID: string;+export const ADD_MAP_STYLE_ID: string;+export const EXPORT_MAP_ID: string;+export const SAVE_MAP_ID: string;+export const OVERWRITE_MAP_ID: string;+export const SHARE_MAP_ID: string;+diff --git a/src/constants/index.d.ts b/src/constants/index.d.tsnew file mode 100644index 000000000..67d01e0e8--- /dev/null+++ b/src/constants/index.d.ts@@ -0,0 +1,6 @@+export {PLOT_TYPES} from '../utils/filter-utils';++export * from './action-types';+export * from './default-settings';+export * as KeyEvent from './keyevent';+diff --git a/src/constants/keyevent.d.ts b/src/constants/keyevent.d.tsnew file mode 100644index 000000000..4f20ae0f2--- /dev/null+++ b/src/constants/keyevent.d.ts@@ -0,0 +1,8 @@+export const DOM_VK_UP: string|number;+export const DOM_VK_DOWN: string|number;+export const DOM_VK_BACK_SPACE: string|number;+export const DOM_VK_RETURN: string|number;+export const DOM_VK_ENTER: string|number;+export const DOM_VK_ESCAPE: string|number;+export const DOM_VK_TAB: string|number;+export const DOM_VK_DELETE: string|number;diff --git a/src/index.d.ts b/src/index.d.tsnew file mode 100644index 000000000..3c46ed49d--- /dev/null+++ b/src/index.d.ts@@ -0,0 +1,2 @@+export * from './actions';+export * from './components';diff --git a/src/layers/trip-layer/trip-utils.d.ts b/src/layers/trip-layer/trip-utils.d.tsnew file mode 100644index 000000000..4e9884d18--- /dev/null+++ b/src/layers/trip-layer/trip-utils.d.ts@@ -0,0 +1,3 @@+import {Field} from '../../reducers';++export const containValidTime: (timestamps: string[]) => Field | null;diff --git a/src/layers/trip-layer/trip-utils.js b/src/layers/trip-layer/trip-utils.jsindex 4fde96f6d..913ebc1e9 100644--- a/src/layers/trip-layer/trip-utils.js+++ b/src/layers/trip-layer/trip-utils.js@@ -57,7 +57,7 @@ export function containValidTime(timestamps) {const analyzedType = Analyzer.computeColMeta(formattedTimeStamps, [], {ignoredDataTypes})[0];if (!analyzedType || analyzedType.category !== 'TIME') {- return false;+ return null;}return analyzedType;}diff --git a/src/localization/formatted-message.d.ts b/src/localization/formatted-message.d.tsnew file mode 100644index 000000000..81d7df828--- /dev/null+++ b/src/localization/formatted-message.d.ts@@ -0,0 +1,15 @@+import React from 'react';++declare type FormattedMessageType = {+ id: string;+ defaultMessage?: string;+ defaultValue?: string;+ values?: {+ [key: string]: string | number;+ };+ children?: () => React.ReactElement;+};++declare const EnhancedFormattedMessage: React.FC<FormattedMessageType>;++export default EnhancedFormattedMessage;diff --git a/src/localization/formatted-message.js b/src/localization/formatted-message.jsindex 7b3c67ccf..dbba09d88 100644--- a/src/localization/formatted-message.js+++ b/src/localization/formatted-message.js@@ -21,13 +21,12 @@import React from 'react';import {FormattedMessage} from 'react-intl';-const ExhancedFormattedMessage = props => (+const EnhancedFormattedMessage = props => (<FormattedMessage- id={props.id}// Us id as default Message to prevent error being throwndefaultMessage={props.defaultMessage || props.id}{...props}/>);-export default ExhancedFormattedMessage;+export default EnhancedFormattedMessage;diff --git a/src/localization/index.d.ts b/src/localization/index.d.tsnew file mode 100644index 000000000..a9cb68800--- /dev/null+++ b/src/localization/index.d.ts@@ -0,0 +1,3 @@+export {LOCALE_CODES, LOCALES} from './locales';+export {default as FormattedMessage} from './formatted-message';+export {messages} from './messages';diff --git a/src/localization/index.js b/src/localization/index.jsindex ab24253c0..25749d184 100644--- a/src/localization/index.js+++ b/src/localization/index.js@@ -18,20 +18,6 @@// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN// THE SOFTWARE.-import en from './en';-import {flattenMessages} from 'utils/locale-utils';-import {LOCALE_CODES} from './locales';--const enFlat = flattenMessages(en);--export const messages = Object.keys(LOCALE_CODES).reduce(- (acc, key) => ({- ...acc,- [key]: key === 'en' ? enFlat : {...enFlat, ...flattenMessages(require(`./${key}`).default)}- }),- {}-);-+export {messages} from './messages';export {LOCALE_CODES, LOCALES} from './locales';-export {default as FormattedMessage} from './formatted-message';diff --git a/src/localization/locales.d.ts b/src/localization/locales.d.tsnew file mode 100644index 000000000..4928c2dd7--- /dev/null+++ b/src/localization/locales.d.ts@@ -0,0 +1,12 @@+export declare const LOCALES: {+ en: string;+ fi: string;+ pt: string;+ es: string;+ ca: string;+ ja: string;+ cn: string;+ ru: string;+};++export declare const LOCALE_CODES: {[key: string]: string};diff --git a/src/localization/messages.d.ts b/src/localization/messages.d.tsnew file mode 100644index 000000000..b0c4f1836--- /dev/null+++ b/src/localization/messages.d.ts@@ -0,0 +1,5 @@+export declare const messages: {+ [key: string]: string;+};++export default messages;diff --git a/src/localization/messages.js b/src/localization/messages.jsnew file mode 100644index 000000000..93f2bc8e9--- /dev/null+++ b/src/localization/messages.js@@ -0,0 +1,18 @@+import en from './translations/en';+import {flattenMessages} from '../utils/locale-utils';+import {LOCALE_CODES} from './locales';++const enFlat = flattenMessages(en);++export const messages = Object.keys(LOCALE_CODES).reduce(+ (acc, key) => ({+ ...acc,+ [key]:+ key === 'en'+ ? enFlat+ : {...enFlat, ...flattenMessages(require(`./translations/${key}.js`).default)}+ }),+ {}+);++export default messages;diff --git a/src/localization/ca.js b/src/localization/translations/ca.jssimilarity index 99%rename from src/localization/ca.jsrename to src/localization/translations/ca.jsindex f740bc6a0..0724b52ae 100644--- a/src/localization/ca.js+++ b/src/localization/translations/ca.js@@ -18,7 +18,7 @@// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN// THE SOFTWARE.-import {LOCALES} from './locales';+import {LOCALES} from '../locales';export default {property: {diff --git a/src/localization/cn.js b/src/localization/translations/cn.jssimilarity index 99%rename from src/localization/cn.jsrename to src/localization/translations/cn.jsindex 14226e593..922c393ca 100644--- a/src/localization/cn.js+++ b/src/localization/translations/cn.js@@ -18,7 +18,7 @@// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN// THE SOFTWARE.-import {LOCALES} from './locales';+import {LOCALES} from '../locales';export default {property: {diff --git a/src/localization/en.js b/src/localization/translations/en.jssimilarity index 99%rename from src/localization/en.jsrename to src/localization/translations/en.jsindex 7dcd3b9f7..8618a7a07 100644--- a/src/localization/en.js+++ b/src/localization/translations/en.js@@ -18,7 +18,7 @@// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN// THE SOFTWARE.-import {LOCALES} from './locales';+import {LOCALES} from '../locales';export default {property: {diff --git a/src/localization/es.js b/src/localization/translations/es.jssimilarity index 99%rename from src/localization/es.jsrename to src/localization/translations/es.jsindex 601cb33eb..663e48e54 100644--- a/src/localization/es.js+++ b/src/localization/translations/es.js@@ -18,7 +18,7 @@// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN// THE SOFTWARE.-import {LOCALES} from './locales';+import {LOCALES} from '../locales';export default {property: {diff --git a/src/localization/fi.js b/src/localization/translations/fi.jssimilarity index 99%rename from src/localization/fi.jsrename to src/localization/translations/fi.jsindex d7f73805d..3fced0d05 100644--- a/src/localization/fi.js+++ b/src/localization/translations/fi.js@@ -18,7 +18,7 @@// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN// THE SOFTWARE.-import {LOCALES} from './locales';+import {LOCALES} from '../locales';export default {property: {diff --git a/src/localization/ja.js b/src/localization/translations/ja.jssimilarity index 99%rename from src/localization/ja.jsrename to src/localization/translations/ja.jsindex 5d23d68d2..04a33aefc 100644--- a/src/localization/ja.js+++ b/src/localization/translations/ja.js@@ -18,7 +18,7 @@// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN// THE SOFTWARE.-import {LOCALES} from './locales';+import {LOCALES} from '../locales';export default {property: {diff --git a/src/localization/pt.js b/src/localization/translations/pt.jssimilarity index 99%rename from src/localization/pt.jsrename to src/localization/translations/pt.jsindex e39218ec2..83b48885e 100644--- a/src/localization/pt.js+++ b/src/localization/translations/pt.js@@ -18,7 +18,7 @@// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN// THE SOFTWARE.-import {LOCALES} from './locales';+import {LOCALES} from '../locales';export default {property: {diff --git a/src/localization/ru.js b/src/localization/translations/ru.jssimilarity index 99%rename from src/localization/ru.jsrename to src/localization/translations/ru.jsindex 9f4677825..1028107e5 100644--- a/src/localization/ru.js+++ b/src/localization/translations/ru.js@@ -18,7 +18,7 @@// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN// THE SOFTWARE.-import {LOCALES} from './locales';+import {LOCALES} from '../locales';export default {property: {diff --git a/src/middleware/index.d.ts b/src/middleware/index.d.tsnew file mode 100644index 000000000..a15dc6924--- /dev/null+++ b/src/middleware/index.d.ts@@ -0,0 +1,3 @@+import {Middleware} from 'redux';++export const enhanceReduxMiddleware: (middlewares: Middleware[]) => Middleware[];diff --git a/src/processors/index.d.ts b/src/processors/index.d.tsnew file mode 100644index 000000000..cf01a97de--- /dev/null+++ b/src/processors/index.d.ts@@ -0,0 +1,2 @@+export * from './data-processor';+export * from './file-handler';diff --git a/src/reducers/vis-state-updaters.js b/src/reducers/vis-state-updaters.jsindex d29c3f65d..6e2670c5f 100644--- a/src/reducers/vis-state-updaters.js+++ b/src/reducers/vis-state-updaters.js@@ -91,7 +91,7 @@ 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 {isRgbColor} from 'utils/color-utils';// type imports/** @typedef {import('./vis-state-updaters').Field} Field */@@ -1145,7 +1145,7 @@ export const updateTableColorUpdater = (state, action) => {const {dataId, newColor} = action;const {datasets} = state;- if (isRGBColor(newColor)) {+ if (isRgbColor(newColor)) {const existing = datasets[dataId];existing.updateTableColor(newColor);diff --git a/src/styles/base.d.ts b/src/styles/base.d.tsnew file mode 100644index 000000000..7e3f4b238--- /dev/null+++ b/src/styles/base.d.ts@@ -0,0 +1,5 @@+export const transition: string;+export const themeLT: object;+export const theme: object;+export const themeBS: object;+export const inputBoxShadowActiveLT: string;diff --git a/src/styles/index.d.ts b/src/styles/index.d.tsnew file mode 100644index 000000000..cb5ddffa8--- /dev/null+++ b/src/styles/index.d.ts@@ -0,0 +1,2 @@+export * from './media-breakpoints';+export * from './base';diff --git a/src/styles/media-breakpoints.d.ts b/src/styles/media-breakpoints.d.tsnew file mode 100644index 000000000..c467dec5c--- /dev/null+++ b/src/styles/media-breakpoints.d.ts@@ -0,0 +1,14 @@+export type breakPointValuesType = {+ palm: number;+ desk: number;+}++export const breakPointValues: breakPointValuesType;++export type mediaType = {+ palm: (...args: any) => string;+ portable: (...args: any) => string;+ desk: (...args: any) => string;+}++export const media: mediaType;diff --git a/src/tasks/index.d.ts b/src/tasks/index.d.tsnew file mode 100644index 000000000..ef08e2533--- /dev/null+++ b/src/tasks/index.d.ts@@ -0,0 +1 @@+module.exports = require('./dist/constants');diff --git a/src/templates/index.d.ts b/src/templates/index.d.tsnew file mode 100644index 000000000..e69de29bbdiff --git a/src/utils/color-utils.d.ts b/src/utils/color-utils.d.tsnew file mode 100644index 000000000..1d13a8a33--- /dev/null+++ b/src/utils/color-utils.d.ts@@ -0,0 +1,9 @@+import {ColorRange} from '../layers/layer-factory';++export const hexToRgb: (hex: string) => [number, number, number];+export const createLinearGradient: (string: direction, colors: number[]) => string;+export const reverseColorRange: (reversed: boolean, colorRange: ColorRange) => object;+export const rgbToHex: (colors: [number, number, number]) => string;++export const getColorGroupByName: (ColorRange) => ColorRange;+export function isRgbColor(color: unknown): color is RGBColor;diff --git a/src/utils/color-utils.js b/src/utils/color-utils.jsindex e6a2518c8..c15a603fd 100644--- a/src/utils/color-utils.js+++ b/src/utils/color-utils.js@@ -106,11 +106,11 @@ export function createLinearGradient(direction, colors) {}/**- * Checking if color is RGB- * @param {*} color- * @returns boolean+ * Whether color is rgb+ * @type {typeof import('./color-utils').isRgbColor}+ * @returns*/-export function isRGBColor(color) {+export function isRgbColor(color) {if (color &&Array.isArray(color) &&diff --git a/src/utils/export-utils.d.ts b/src/utils/export-utils.d.tsnew file mode 100644index 000000000..fa4255d1d--- /dev/null+++ b/src/utils/export-utils.d.ts@@ -0,0 +1,16 @@+import {ExportImage} from 'reducers/ui-state-updaters';++export const downloadFile: (fileBlob: Blob, fileName: string) => void;+export const exportJson: (state: any, options: object) => void;+export const exportHtml: (state: any, options: object) => void;+export const exportData: (state: any, options: object) => void;+export const exportMap: (state: any, options?: object) => void;+export const exportImage: (uiStateExportImage: ExportImage, fileName?: string) => void;+export const convertToPng: (sourceElem: HTMLElement, options: object) => Promise;+export const getScaleFromImageSize: (+ imageW: number,+ imageH: number,+ mapW: number,+ mapH: number+) => number;+export const dataURItoBlob: (dataURI: string) => Blob;diff --git a/src/utils/export-utils.js b/src/utils/export-utils.jsindex d9983ef56..010647514 100644--- a/src/utils/export-utils.js+++ b/src/utils/export-utils.js@@ -135,8 +135,13 @@ export function downloadFile(fileBlob, fileName) {}}-export function exportImage(state, filename = DEFAULT_IMAGE_NAME) {- const {imageDataUri} = state.uiState.exportImage;+/**+ * Whether color is rgb+ * @type {typeof import('./export-utils').exportImage}+ * @returns+ */+export function exportImage(uiStateExportImage, filename = DEFAULT_IMAGE_NAME) {+ const {imageDataUri} = uiStateExportImage;if (imageDataUri) {const file = dataURItoBlob(imageDataUri);downloadFile(file, filename);@@ -190,10 +195,10 @@ export function exportHtml(state, options) {downloadFile(fileBlob, state.appName ? `${state.appName}.html` : DEFAULT_HTML_NAME);}-export function exportData(state, option) {+export function exportData(state, options) {const {visState, appName} = state;const {datasets} = visState;- const {selectedDataset, dataType, filtered} = option;+ const {selectedDataset, dataType, filtered} = options;// get the selected dataconst filename = appName ? appName : DEFAULT_DATA_NAME;const selectedDatasets = datasets[selectedDataset]@@ -226,10 +231,10 @@ export function exportData(state, option) {});}-export function exportMap(state, option) {+export function exportMap(state, options) {const {imageDataUri} = state.uiState.exportImage;const thumbnail = imageDataUri ? dataURItoBlob(imageDataUri) : null;- const mapToSave = getMapJSON(state, option);+ const mapToSave = getMapJSON(state, options);return {map: mapToSave,diff --git a/src/utils/index.d.ts b/src/utils/index.d.tsindex 932a43e11..4ccd92b1b 100644--- a/src/utils/index.d.ts+++ b/src/utils/index.d.ts@@ -1,5 +1,14 @@--export {maybeToDate, roundValToStep} from './data-utils';export {updateAllLayerDomainData} from '../reducers/vis-state-updaters';-// export {getHexFields} from '../layers/h3-hexagon-layer/h3-utils';-export {default as KeplerTable, Field, findPointFieldPairs, copyTableAndUpdate} from './table-utils/kepler-table';\ No newline at end of file+export {default as KeplerTable, Field, findPointFieldPairs, copyTableAndUpdate} from './table-utils/kepler-table';+export {downloadFile} from './export-utils';+export {containValidTime} from '../layers/trip-layer/trip-utils';+export {validateLayersByDatasets} from '../reducers/vis-state-merger';+export * from './color-utils';+export * from './data-scale-utils';+export * from './data-utils';+export * from './dataset-utils';+export * from './filter-utils';+export * from './gpu-filter-utils';+export * from './interaction-utils';+export * from './layer-utils';+export * from './observe-dimensions';diff --git a/src/utils/index.js b/src/utils/index.jsindex c40f7b68c..3429baf14 100644--- a/src/utils/index.js+++ b/src/utils/index.js@@ -47,5 +47,9 @@ export {updateAllLayerDomainData} from '../reducers/vis-state-updaters';export {getHexFields} from '../layers/h3-hexagon-layer/h3-utils';export {containValidTime} from '../layers/trip-layer/trip-utils';-export {KeplerTable, findPointFieldPairs, copyTableAndUpdate} from './table-utils/kepler-table';+export {+ default as KeplerTable,+ findPointFieldPairs,+ copyTableAndUpdate+} from './table-utils/kepler-table';export {createDataContainer, createIndexedDataContainer} from './table-utils/data-container-utils';diff --git a/src/utils/interaction-utils.js b/src/utils/interaction-utils.jsindex c3f94da67..2be3bab45 100644--- a/src/utils/interaction-utils.js+++ b/src/utils/interaction-utils.js@@ -90,6 +90,7 @@ export function findFieldsToShow({fields, id, maxDefaultTooltips}) {// first find default tooltip fields for tripsconst fieldsToShow = DEFAULT_TOOLTIP_FIELDS.reduce((prev, curr) => {if (fields.find(({name}) => curr.name === name)) {+ // @ts-ignoreprev.push(curr);}return prev;diff --git a/src/utils/table-utils/kepler-table.js b/src/utils/table-utils/kepler-table.jsindex ffb3286f9..fab017cd8 100644--- a/src/utils/table-utils/kepler-table.js+++ b/src/utils/table-utils/kepler-table.js@@ -445,7 +445,7 @@ export function sortDatasetByColumn(dataset, column, mode) {return dataset;}- const sortBy = SORT_ORDER[mode] || SORT_ORDER.ASCENDING;+ const sortBy = SORT_ORDER[mode || ''] || SORT_ORDER.ASCENDING;if (sortBy === SORT_ORDER.UNSORT) {dataset.sortColumn = {};diff --git a/webpack/build_types.js b/webpack/build_types.jsnew file mode 100644index 000000000..4a54c0c58--- /dev/null+++ b/webpack/build_types.js@@ -0,0 +1,58 @@+// Copyright (c) 2020 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 DtsBundleWebpack = require('dts-bundle-webpack');++const SRC_DIR = resolve(__dirname, '../src');+const OUTPUT_DIR = resolve(__dirname, '../dist');++const LIBRARY_BUNDLE_CONFIG = env => ({+ // Silence warnings about big bundles+ stats: {+ warnings: false+ },++ // let's put everything in+ module: {+ rules: [+ {+ test: /\.js$/,+ loader: 'babel-loader',+ include: [SRC_DIR]+ }+ ]+ },++ node: {+ fs: 'empty'+ },++ plugins: [+ new DtsBundleWebpack({+ name: 'kepler.gl',+ main: `${SRC_DIR}/index.d.ts`,+ out: `${OUTPUT_DIR}/types.d.ts`,+ outputAsModuleFolder: true+ })+ ]+});++module.exports = env => LIBRARY_BUNDLE_CONFIG(env);