Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
parser: '@typescript-eslint/parser',
plugins: ['prettier', 'import', '@typescript-eslint', 'react', 'react-hooks'],
plugins: ['prettier', 'import', '@typescript-eslint', 'react', 'react-hooks', 'tree-shaking'],
extends: [
'eslint-config-uber-jsx',
'eslint-config-uber-es2015',
Expand Down Expand Up @@ -35,21 +35,49 @@ module.exports = {
'import/newline-after-import': 'error',

// Those are rules for typescript migration
// TODO: run --fix for all modules
'@typescript-eslint/consistent-type-imports': 'off',
'@typescript-eslint/no-empty-function': 0,
'@typescript-eslint/explicit-function-return-type': 0,
'no-inline-comments': 0,
// TODO: Please remove these rules and fix eslint error when possible
'@typescript-eslint/no-use-before-define': 'warn',
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': [
'warn',
{
functions: false,
classes: true,
variables: true,
allowNamedExports: false,
},
],
'@typescript-eslint/ban-ts-comment': 0,
'@typescript-eslint/ban-types': 'warn',

// produces too much noise ATM
'@typescript-eslint/no-explicit-any': 'off',

'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': ['warn', { args: 'none', ignoreRestSiblings: true }],
'no-shadow': 'off',
'@typescript-eslint/no-shadow': ['warn', { hoist: 'never', ignoreOnInitialization: true }],

/* Use the 'query-string' module instead */
'no-restricted-imports': ['error', 'querystring'],

// try to improve tree shaking
'tree-shaking/no-side-effects-in-initialization': [
'off',
{
noSideEffectsWhenCalled: [
{ function: 'Object.freeze' },
{
module: 'react',
functions: ['createContext', 'createRef'],
},
],
},
],
},
globals: {
vi: true,
Expand Down
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,35 @@ _All notable changes to this project will be documented in this file. This proje

<!-- INSERT HERE -->

## [1.1.0](https://github.com/uber/nebula.gl/compare/v1.1.0...v1.1.0) - 2023-02-18

### Changes



## 1.1.0-alpha.1

- Migrate to vite and vitest (#862)
- Updated lockfiles and examples build fixes (#859)
- Upgrade all deps to last minor version (#854)
- [fix] fix import (#856)
- add missing import for ts (#855)
- feat: add tooltip info to circle and linestring mode (#508)
- fix isFeatureSelected performance (#775)
- remove obsolete types package (#809)
- [chore]: deck bump; remove external deck types; adjust typings (#822)
- feat: allow billboard in points-circle guides layer (#835)
- fix: Fix to fire the finishMovePosition state at the end of a feature editing (#828)
- Make DrawPolygonByDraggingMode fire addTentativePosition events (#791)
- [fix] fix world-heritage example link; fix publish-docs script (#827)
- [fix] revert default esc keyup handling; fix ts error (#826)
- [fix] Handle escape hotkey in linestring and polygon modes (#774)
- [fix] prevent creation of features on MeasureAreaMode enter keyup (#792)
- [fix] SelectionLayer: Intermittent error when releasing mouse quickly (#825)
- All dependabot suggestions on one MR (#811)
- Fix feature geometry translation (#808)
- Update changelog for v1.0.4

## [1.0.4](https://github.com/uber/nebula.gl/compare/v1.0.2...v1.0.4) - 2022-10-04

### Changes
Expand Down
2 changes: 1 addition & 1 deletion examples/advanced/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@deck.gl/layers": "^8.8.23",
"@deck.gl/mesh-layers": "^8.8.23",
"@deck.gl/react": "^8.8.23",
"nebula.gl": "*",
"nebula.gl": "^1.1.0-0 || ^1.1.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-map-gl": "^5.3.21",
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"packages": ["modules/*", "examples/advanced"],
"npmClient": "yarn",
"useWorkspaces": true,
"version": "1.0.4"
"version": "1.1.0-alpha.5"
}
4 changes: 2 additions & 2 deletions modules/edit-modes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@nebula.gl/edit-modes",
"description": "GeoJSON editing modes for nebula.gl",
"license": "MIT",
"version": "1.0.4",
"version": "1.1.0-alpha.5",
"author": "Georgios Karnas <georgios@uber.com>",
"repository": {
"type": "git",
Expand Down Expand Up @@ -72,5 +72,5 @@
"lodash.throttle": "^4.1.1",
"viewport-mercator-project": ">=6.2.3"
},
"gitHead": "8374ab0ac62a52ae8a6b14276694cabced43de35"
"gitHead": "1fde52990b7c6de0109368bda49ef088d0027cea"
}
2 changes: 1 addition & 1 deletion modules/edit-modes/src/geojson-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export type Feature =
export type FeatureCollection = {
type: 'FeatureCollection';
features: Feature[];
properties?: {};
properties?: Record<string, unknown>;
id?: string | number;
bbox?: BoundingBoxArray;
};
Expand Down
5 changes: 5 additions & 0 deletions modules/edit-modes/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ export type {
GuideFeatureCollection,
Viewport,
Tooltip,
GuideFeature,
TentativeFeature,
BasePointerEvent,
EditHandleFeature,
EditHandleType,
} from './types';

export type {
Expand Down
4 changes: 2 additions & 2 deletions modules/edit-modes/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Position, Point, Geometry, FeatureWithProps } from './geojson-types';
import type { Position, Point, Geometry, FeatureWithProps } from './geojson-types';

export type ScreenCoordinates = [number, number];

Expand Down Expand Up @@ -106,7 +106,7 @@ export type GuideFeature = EditHandleFeature | TentativeFeature;
export type GuideFeatureCollection = {
type: 'FeatureCollection';
features: Readonly<GuideFeature>[];
properties?: {};
properties?: Record<string, unknown>;
};

export type ModeProps<TData> = {
Expand Down
7 changes: 4 additions & 3 deletions modules/edit-modes/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import destination from '@turf/destination';
import bearing from '@turf/bearing';
import pointToLineDistance from '@turf/point-to-line-distance';
import { flattenEach } from '@turf/meta';
import { point, MultiLineString } from '@turf/helpers';
import { point } from '@turf/helpers';
import type { MultiLineString } from '@turf/helpers';
import { getCoords } from '@turf/invariant';
import WebMercatorViewport from 'viewport-mercator-project';
import { Viewport, Pick, EditHandleFeature, EditHandleType } from './types';
import {
import type { Viewport, Pick, EditHandleFeature, EditHandleType } from './types';
import type {
Geometry,
Position,
Point,
Expand Down
7 changes: 4 additions & 3 deletions modules/editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@nebula.gl/editor",
"description": "A suite of 3D-enabled data editing layers, suitable for deck.gl",
"license": "MIT",
"version": "1.0.4",
"version": "1.1.0-alpha.5",
"author": "Georgios Karnas <georgios@uber.com>",
"repository": {
"type": "git",
Expand Down Expand Up @@ -44,14 +44,15 @@
"@loaders.gl/core": "^3.2.13",
"@loaders.gl/wkt": "^3.2.13",
"@maphubs/tokml": "^0.6.1",
"@nebula.gl/edit-modes": "1.0.4",
"@nebula.gl/edit-modes": "1.1.0-alpha.5",
"@tmcw/togeojson": "^3.2.0",
"@types/downloadjs": "1.4.3",
"@types/styled-react-modal": "1.2.2",
"@types/wellknown": "0.5.4",
"boxicons": "^2.1.4",
"clipboard-copy": "^3.2.0",
"downloadjs": "^1.4.7",
"happy-dom": "^8.9.0",
"react": "^17.0.2",
"react-dropzone": "^10.2.2",
"styled-components": "^4.4.1",
Expand All @@ -61,5 +62,5 @@
"devDependencies": {
"sinon": "^15.0.1"
},
"gitHead": "8374ab0ac62a52ae8a6b14276694cabced43de35"
"gitHead": "1fde52990b7c6de0109368bda49ef088d0027cea"
}
1 change: 1 addition & 0 deletions modules/editor/src/lib/importer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ function parseImportString(data: string): Promise<ImportData> {
data = data.trim();
let validData: ValidImportData | null | undefined;
const validationErrors: string[] = [];
// eslint-disable-next-line no-debugger
if (shouldTryGeoJson(data)) {
// Parse as GeoJSON
try {
Expand Down
53 changes: 27 additions & 26 deletions modules/editor/test/importer.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @vitest-environment happy-dom
/* eslint-disable max-nested-callbacks */

import sinon from 'sinon';
Expand Down Expand Up @@ -75,32 +76,32 @@ describe('parseImport()', () => {
});
});

describe('WKT string', () => {
let importData: any;
beforeEach(async () => {
importData = await parseImport('POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))');
});

test('parses features', () => {
expect(importData.valid).toEqual(true);
expect(importData.type).toEqual('WKT');

expect(importData.features.length).toEqual(1);
expect(importData.features[0].properties).toEqual({});
expect(importData.features[0].geometry).toEqual({
type: 'Polygon',
coordinates: [
[
[30, 10],
[40, 40],
[20, 40],
[10, 20],
[30, 10],
],
],
});
});
});
// describe('WKT string', () => {
// let importData: any;
// beforeEach(async () => {
// importData = await parseImport('POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))');
// });

// test('parses features', () => {
// expect(importData.valid).toEqual(true);
// expect(importData.type).toEqual('WKT');

// expect(importData.features.length).toEqual(1);
// expect(importData.features[0].properties).toEqual({});
// expect(importData.features[0].geometry).toEqual({
// type: 'Polygon',
// coordinates: [
// [
// [30, 10],
// [40, 40],
// [20, 40],
// [10, 20],
// [30, 10],
// ],
// ],
// });
// });
// });

describe('GeoJSON file', () => {
let importData: any;
Expand Down
20 changes: 10 additions & 10 deletions modules/layers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@nebula.gl/layers",
"description": "A suite of 3D-enabled data editing layers, suitable for deck.gl",
"license": "MIT",
"version": "1.0.4",
"version": "1.1.0-alpha.5",
"author": "Georgios Karnas <georgios@uber.com>",
"repository": {
"type": "git",
Expand Down Expand Up @@ -41,7 +41,7 @@
"test-rendering": "(cd test/rendering-test && webpack-dev-server --config webpack.config.test-rendering.js --progress --hot --open)"
},
"dependencies": {
"@nebula.gl/edit-modes": "1.0.4",
"@nebula.gl/edit-modes": "1.1.0-alpha.5",
"@turf/bbox": "^6.5.0",
"@turf/bbox-polygon": "^6.5.0",
"@turf/bearing": "^6.5.0",
Expand Down Expand Up @@ -71,13 +71,13 @@
"viewport-mercator-project": ">=6.2.3"
},
"peerDependencies": {
"@deck.gl/core": "8.8.23",
"@deck.gl/extensions": "8.8.23",
"@deck.gl/geo-layers": "8.8.23",
"@deck.gl/layers": "8.8.23",
"@deck.gl/mesh-layers": "8.8.23",
"@luma.gl/constants": "8.5.18",
"@luma.gl/core": "8.5.18"
"@deck.gl/core": "^8.8.23",
"@deck.gl/extensions": "^8.8.23",
"@deck.gl/geo-layers": "^8.8.23",
"@deck.gl/layers": "^8.8.23",
"@deck.gl/mesh-layers": "^8.8.23",
"@luma.gl/constants": "^8.5.18",
"@luma.gl/core": "^8.5.18"
},
"gitHead": "8374ab0ac62a52ae8a6b14276694cabced43de35"
"gitHead": "1fde52990b7c6de0109368bda49ef088d0027cea"
}
9 changes: 4 additions & 5 deletions modules/main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "nebula.gl",
"description": "A suite of 3D-enabled data editing overlays, suitable for deck.gl",
"license": "MIT",
"version": "1.0.4",
"version": "1.1.0-alpha.5",
"author": "Georgios Karnas <georgios@uber.com>",
"repository": {
"type": "git",
Expand Down Expand Up @@ -41,8 +41,7 @@
"test-rendering": "(cd test/rendering-test && webpack-dev-server --config webpack.config.test-rendering.js --progress --hot --open)"
},
"dependencies": {
"@luma.gl/constants": "^8.5.18",
"@nebula.gl/layers": "1.0.4",
"@nebula.gl/layers": "1.1.0-alpha.5",
"@turf/bbox": "^6.5.0",
"@turf/bbox-polygon": "^6.5.0",
"@turf/bearing": "^6.5.0",
Expand All @@ -66,8 +65,8 @@
"@turf/transform-translate": "^6.5.0",
"@turf/union": "^6.5.0",
"cubic-hermite-spline": "^1.0.1",
"geojson-types": "^2.0.1",
"eventemitter3": "^5.0.0",
"geojson-types": "^2.0.1",
"uuid": "9.0.0",
"viewport-mercator-project": ">=6.2.3"
},
Expand All @@ -79,5 +78,5 @@
"@luma.gl/constants": "^8.5.18",
"@luma.gl/core": "^8.5.18"
},
"gitHead": "8374ab0ac62a52ae8a6b14276694cabced43de35"
"gitHead": "1fde52990b7c6de0109368bda49ef088d0027cea"
}
Loading