terra-draw 0.0.1-alpha.3 → 0.0.1-alpha.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/CHANGELOG.md +311 -0
  2. package/README.md +25 -4
  3. package/dist/adapters/common/adapter-listener.d.ts +22 -0
  4. package/dist/adapters/common/base-adapter.d.ts +31 -0
  5. package/dist/adapters/common/base.adapter.d.ts +47 -0
  6. package/dist/adapters/google-maps.adapter.d.ts +87 -38
  7. package/dist/adapters/leaflet.adapter.d.ts +98 -35
  8. package/dist/adapters/mapbox-gl.adapter.d.ts +85 -36
  9. package/dist/adapters/maplibre-gl.adapter.d.ts +72 -0
  10. package/dist/adapters/openlayers.adapter.d.ts +117 -0
  11. package/dist/common.d.ts +90 -99
  12. package/dist/extend-types.d.ts +4 -0
  13. package/dist/geometry/boolean/point-in-polygon.d.ts +2 -2
  14. package/dist/geometry/boolean/self-intersects.d.ts +2 -2
  15. package/dist/geometry/centroid.d.ts +2 -2
  16. package/dist/geometry/coordinates-identical.d.ts +2 -2
  17. package/dist/geometry/get-coordinates-as-points.d.ts +6 -6
  18. package/dist/geometry/get-midpoints.d.ts +8 -7
  19. package/dist/geometry/helpers.d.ts +4 -4
  20. package/dist/geometry/limit-decimal-precision.d.ts +1 -1
  21. package/dist/geometry/measure/haversine-distance.d.ts +2 -2
  22. package/dist/geometry/measure/pixel-distance-to-line.d.ts +10 -10
  23. package/dist/geometry/measure/pixel-distance.d.ts +7 -7
  24. package/dist/geometry/measure/rhumb-bearing.d.ts +2 -2
  25. package/dist/geometry/measure/rhumb-destination.d.ts +2 -2
  26. package/dist/geometry/measure/rhumb-distance.d.ts +2 -2
  27. package/dist/geometry/midpoint-coordinate.d.ts +3 -2
  28. package/dist/geometry/shape/create-circle.d.ts +8 -7
  29. package/dist/geometry/shape/great-circle-line.d.ts +12 -0
  30. package/dist/geometry/transform/rotate.d.ts +2 -2
  31. package/dist/geometry/transform/scale.d.ts +2 -2
  32. package/dist/modes/base.behavior.d.ts +19 -19
  33. package/dist/modes/base.mode.d.ts +46 -30
  34. package/dist/modes/circle/circle.mode.d.ts +48 -27
  35. package/dist/modes/click-bounding-box.behavior.d.ts +7 -7
  36. package/dist/modes/freehand/freehand.mode.d.ts +54 -29
  37. package/dist/modes/great-circle-snapping.behavior.d.ts +13 -0
  38. package/dist/modes/greatcircle/great-circle.mode.d.ts +57 -0
  39. package/dist/modes/linestring/linestring.mode.d.ts +60 -34
  40. package/dist/modes/pixel-distance.behavior.d.ts +7 -7
  41. package/dist/modes/point/point.mode.d.ts +38 -18
  42. package/dist/modes/polygon/behaviors/closing-points.behavior.d.ts +19 -0
  43. package/dist/modes/polygon/polygon.mode.d.ts +63 -37
  44. package/dist/modes/rectangle/rectangle.mode.d.ts +48 -0
  45. package/dist/modes/render/render.mode.d.ts +36 -0
  46. package/dist/modes/select/behaviors/drag-coordinate.behavior.d.ts +13 -13
  47. package/dist/modes/select/behaviors/drag-feature.behavior.d.ts +17 -17
  48. package/dist/modes/select/behaviors/features-at-mouse-event.behavior.d.ts +15 -15
  49. package/dist/modes/select/behaviors/midpoint.behavior.d.ts +18 -18
  50. package/dist/modes/select/behaviors/rotate-feature.behavior.d.ts +13 -13
  51. package/dist/modes/select/behaviors/scale-feature.behavior.d.ts +13 -13
  52. package/dist/modes/select/behaviors/selection-point.behavior.d.ts +18 -18
  53. package/dist/modes/select/select.mode.d.ts +89 -62
  54. package/dist/modes/snapping.behavior.d.ts +13 -13
  55. package/dist/modes/static/static.mode.d.ts +31 -13
  56. package/dist/store/spatial-index/quickselect.d.ts +2 -2
  57. package/dist/store/spatial-index/rbush.d.ts +35 -35
  58. package/dist/store/spatial-index/spatial-index.d.ts +18 -18
  59. package/dist/store/store.d.ts +50 -48
  60. package/dist/terra-draw.cjs +1 -1
  61. package/dist/terra-draw.cjs.map +1 -1
  62. package/dist/terra-draw.d.ts +139 -47
  63. package/dist/terra-draw.modern.js +1 -1
  64. package/dist/terra-draw.modern.js.map +1 -1
  65. package/dist/terra-draw.module.js +1 -1
  66. package/dist/terra-draw.module.js.map +1 -1
  67. package/dist/terra-draw.umd.js +1 -1
  68. package/dist/terra-draw.umd.js.map +1 -1
  69. package/dist/util/geoms.d.ts +3 -3
  70. package/dist/util/id.d.ts +1 -1
  71. package/dist/util/styling.d.ts +2 -2
  72. package/{CONTRIBUTING.md → guides/CONTRIBUTING.md} +7 -7
  73. package/guides/DEVELOPMENT.md +156 -0
  74. package/guides/GETTING_STARTED.md +211 -0
  75. package/jest.config.ts +22 -22
  76. package/logo.png +0 -0
  77. package/package.json +151 -87
  78. package/readme.gif +0 -0
  79. package/scratch/release.sh +6 -0
  80. package/tsconfig.json +20 -12
  81. package/DEVELOPMENT.md +0 -77
  82. /package/{CODE_OF_CONDUCT.md → guides/CODE_OF_CONDUCT.md} +0 -0
package/package.json CHANGED
@@ -1,88 +1,152 @@
1
1
  {
2
- "name": "terra-draw",
3
- "version": "0.0.1-alpha.3",
4
- "description": "Frictionless map drawing across mapping provider",
5
- "scripts": {
6
- "build": "microbundle",
7
- "watch": "microbundle --watch --format modern",
8
- "test": "jest --config jest.config.ts",
9
- "test:coverage": "jest --config jest.config.ts --coverage",
10
- "test:nocheck": "NO_CHECK=true jest --config jest.config.ts",
11
- "test:nocheck:coverage": "NO_CHECK=true jest --config jest.config.ts --coverage",
12
- "lint": "eslint --ext .ts src/",
13
- "lint:quiet": "eslint --ext .ts --quiet src/",
14
- "lint:fix": "eslint --fix --ext .ts src/",
15
- "lint:fix:quiet": "eslint --fix --quiet --ext .ts src/",
16
- "prepare": "husky install"
17
- },
18
- "type": "module",
19
- "source": "src/terra-draw.ts",
20
- "exports": {
21
- "require": "./dist/terra-draw.cjs",
22
- "default": "./dist/terra-draw.modern.js",
23
- "types": "./dist/terra-draw.d.ts"
24
- },
25
- "types": "./dist/foo.d.ts",
26
- "main": "./dist/terra-draw.cjs",
27
- "module": "./dist/terra-draw.module.js",
28
- "unpkg": "./dist/terra-draw.umd.js",
29
- "author": "James Milner",
30
- "license": "MIT",
31
- "repository": "JamesLMilner/terra-draw",
32
- "devDependencies": {
33
- "@commitlint/cli": "^17.1.2",
34
- "@commitlint/config-conventional": "^17.1.0",
35
- "@googlemaps/js-api-loader": "^1.14.3",
36
- "@swc/jest": "^0.2.22",
37
- "@types/geojson": "^7946.0.8",
38
- "@types/google.maps": "^3.49.2",
39
- "@types/jest": "^28.1.5",
40
- "@types/leaflet": "^1.7.11",
41
- "@types/mapbox-gl": "^2.7.3",
42
- "@types/rbush": "^3.0.0",
43
- "@typescript-eslint/eslint-plugin": "^5.38.1",
44
- "@typescript-eslint/parser": "^5.38.1",
45
- "eslint": "^8.24.0",
46
- "eslint-config-prettier": "^8.5.0",
47
- "eslint-plugin-prettier": "^4.2.1",
48
- "husky": "^7.0.0",
49
- "jest": "^28.1.2",
50
- "leaflet": "^1.8.0",
51
- "mapbox-gl": "^2.9.1",
52
- "microbundle": "^0.15.0",
53
- "serve": "^13.0.4",
54
- "ts-jest": "^28.0.5",
55
- "ts-loader": "^9.3.1",
56
- "typescript": "^4.7.4"
57
- },
58
- "commitlint": {
59
- "extends": [
60
- "@commitlint/config-conventional"
61
- ]
62
- },
63
- "eslintConfig": {
64
- "parser": "@typescript-eslint/parser",
65
- "plugins": [
66
- "@typescript-eslint"
67
- ],
68
- "rules": {
69
- "indent": [
70
- "error",
71
- 4
72
- ],
73
- "semi": [
74
- "error",
75
- "always"
76
- ],
77
- "@typescript-eslint/no-empty-function": "warn"
78
- },
79
- "extends": [
80
- "plugin:@typescript-eslint/recommended",
81
- "prettier"
82
- ]
83
- },
84
- "prettier": {
85
- "printWidth": 80,
86
- "semi": true
87
- }
88
- }
2
+ "name": "terra-draw",
3
+ "version": "0.0.1-alpha.30",
4
+ "description": "Frictionless map drawing across mapping provider",
5
+ "scripts": {
6
+ "docs": "typedoc",
7
+ "docs:serve": "serve ./docs",
8
+ "release": "standard-version",
9
+ "build": "microbundle",
10
+ "watch": "microbundle --watch --format modern",
11
+ "test": "jest --config jest.config.ts",
12
+ "test:coverage": "jest --config jest.config.ts --coverage",
13
+ "test:nocheck": "NO_CHECK=true jest --config jest.config.ts",
14
+ "test:nocheck:coverage": "NO_CHECK=true jest --config jest.config.ts --coverage",
15
+ "lint": "eslint --ext .ts src/",
16
+ "lint:quiet": "eslint --ext .ts --quiet src/",
17
+ "lint:fix": "eslint --fix --ext .ts src/",
18
+ "lint:fix:quiet": "eslint --fix --quiet --ext .ts src/",
19
+ "format": "prettier --ignore-path .gitignore --write \"**/*.+(js|ts|json)\"",
20
+ "format:quiet": "prettier --ignore-path .gitignore --write \"**/*.+(js|ts|json)\" --loglevel=silent",
21
+ "prepare": "husky install"
22
+ },
23
+ "type": "module",
24
+ "source": "src/terra-draw.ts",
25
+ "exports": {
26
+ "types": "./dist/terra-draw.d.ts",
27
+ "require": "./dist/terra-draw.cjs",
28
+ "default": "./dist/terra-draw.modern.js"
29
+ },
30
+ "types": "./dist/terra-draw.d.ts",
31
+ "main": "./dist/terra-draw.cjs",
32
+ "module": "./dist/terra-draw.module.js",
33
+ "unpkg": "./dist/terra-draw.umd.js",
34
+ "author": "James Milner",
35
+ "license": "MIT",
36
+ "repository": "JamesLMilner/terra-draw",
37
+ "keywords": [
38
+ "map",
39
+ "drawing",
40
+ "draw",
41
+ "map drawing",
42
+ "geometry",
43
+ "leaflet",
44
+ "leafletjs",
45
+ "mapbox",
46
+ "mapboxgl",
47
+ "google maps",
48
+ "openlayers",
49
+ "maplibre"
50
+ ],
51
+ "devDependencies": {
52
+ "@commitlint/cli": "^17.1.2",
53
+ "@commitlint/config-conventional": "^17.1.0",
54
+ "@googlemaps/js-api-loader": "^1.14.3",
55
+ "@swc/jest": "^0.2.24",
56
+ "@types/geojson": "^7946.0.8",
57
+ "@types/google.maps": "^3.49.2",
58
+ "@types/jest": "^28.1.5",
59
+ "@types/leaflet": "^1.7.11",
60
+ "@types/mapbox-gl": "^2.7.3",
61
+ "@types/rbush": "^3.0.0",
62
+ "@typescript-eslint/eslint-plugin": "^5.57.0",
63
+ "@typescript-eslint/parser": "^5.57.0",
64
+ "eslint": "^8.24.0",
65
+ "eslint-config-prettier": "^8.5.0",
66
+ "eslint-plugin-prettier": "^4.2.1",
67
+ "husky": "^7.0.0",
68
+ "jest": "^29.3.1",
69
+ "leaflet": "^1.8.0",
70
+ "mapbox-gl": "^2.13.0",
71
+ "maplibre-gl": "^2.4.0",
72
+ "microbundle": "^0.15.0",
73
+ "ol": "^7.1.0",
74
+ "serve": "^14.1.2",
75
+ "standard-version": "^9.5.0",
76
+ "ts-jest": "^29.0.3",
77
+ "ts-loader": "^9.4.2",
78
+ "typedoc": "^0.23.28",
79
+ "typescript": "^5.0.3"
80
+ },
81
+ "commitlint": {
82
+ "extends": [
83
+ "@commitlint/config-conventional"
84
+ ]
85
+ },
86
+ "eslintConfig": {
87
+ "parser": "@typescript-eslint/parser",
88
+ "plugins": [
89
+ "@typescript-eslint"
90
+ ],
91
+ "rules": {
92
+ "@typescript-eslint/no-empty-function": "warn"
93
+ },
94
+ "extends": [
95
+ "plugin:@typescript-eslint/recommended",
96
+ "prettier"
97
+ ]
98
+ },
99
+ "prettier": {
100
+ "printWidth": 80,
101
+ "semi": true,
102
+ "useTabs": true
103
+ },
104
+ "standard-version": {
105
+ "types": [
106
+ {
107
+ "type": "feat",
108
+ "section": "Features"
109
+ },
110
+ {
111
+ "type": "fix",
112
+ "section": "Bug Fixes"
113
+ },
114
+ {
115
+ "type": "docs",
116
+ "section": "Documentation"
117
+ },
118
+ {
119
+ "type": "style",
120
+ "section": "Styling"
121
+ },
122
+ {
123
+ "type": "refactor",
124
+ "section": "Refactors"
125
+ },
126
+ {
127
+ "type": "perf",
128
+ "section": "Performance"
129
+ },
130
+ {
131
+ "type": "test",
132
+ "section": "Tests"
133
+ },
134
+ {
135
+ "type": "build",
136
+ "section": "Build System"
137
+ },
138
+ {
139
+ "type": "ci",
140
+ "section": "CI"
141
+ },
142
+ {
143
+ "type": "chore",
144
+ "section": "Chore"
145
+ },
146
+ {
147
+ "type": "revert",
148
+ "section": "Reverts"
149
+ }
150
+ ]
151
+ }
152
+ }
package/readme.gif ADDED
Binary file
@@ -0,0 +1,6 @@
1
+ npm run docs
2
+
3
+ npm run build
4
+ npm run release -- --prerelease --release-as 0.0.1-alpha.30
5
+ git push origin main --tags
6
+ npm publish
package/tsconfig.json CHANGED
@@ -1,14 +1,22 @@
1
1
  {
2
- "compilerOptions": {
3
- "outDir": "./dist/",
4
- "strict": true,
5
- "noImplicitAny": true,
6
- "module": "es6",
7
- "target": "es6",
8
- "jsx": "react",
9
- "sourceMap": true,
10
- "allowJs": true,
11
- "moduleResolution": "node",
12
- "allowSyntheticDefaultImports": true
13
- }
2
+ "compilerOptions": {
3
+ "outDir": "./dist/",
4
+ "strict": true,
5
+ "module": "es6",
6
+ "target": "es6",
7
+ "jsx": "react",
8
+ "sourceMap": true,
9
+ "allowJs": true,
10
+ "moduleResolution": "node",
11
+ "allowSyntheticDefaultImports": true
12
+ },
13
+ "typedocOptions": {
14
+ "entryPoints": ["src/terra-draw.ts"],
15
+ "exclude": ["src/geometry/**/*.ts", "src/test/**/*.ts", "src/util/**/*.ts"],
16
+ "out": "docs",
17
+ "skipErrorChecking": true
18
+ // "compilerOptions": {
19
+ // "skipLibCheck": true
20
+ // }
21
+ }
14
22
  }
package/DEVELOPMENT.md DELETED
@@ -1,77 +0,0 @@
1
- # Development
2
-
3
- This file acts as a way to document how to develop the Terra Draw project locally.
4
-
5
- ### Prerequisites
6
-
7
- A few things you will need to have installed in order to develop on this project:
8
-
9
- * git
10
- * Node LTS - currently v16
11
- * npm 8
12
-
13
- ### Folder Structure
14
-
15
-
16
- * `.github` - used for all GitHub related configuration such as the GitHub Actions work flows
17
- * `.husky` - used to storing the precommit hooks that are used on the project
18
- * `src` - source files for the project
19
- * `dist` - the bundled distributed files of the project
20
- * `docs` - the demo app that is published to GitHub pages
21
- * `development` - the local development app that is used for developing locally (see below)
22
- * `common` - code that is used across `development` and `docs` folder`
23
-
24
- ### Technologies Used
25
-
26
- Terra Draw
27
-
28
- * [TypeScript](https://www.typescriptlang.org/) - provides strong compile time typing for JavaScript
29
- * Jest - used for testing (see more information below)
30
- * microbundle - used for the production bundle
31
- * Webpack - used for bundling locally in development (`development` and `docs` folders)
32
- * esno - for running tests quickly without type checking
33
-
34
- ### Precommit Hooks
35
-
36
- It is probably useful to be aware of the precommit hooks you will face when trying to run a git commit on the project. There are two currently in use, namely:
37
-
38
- * Uses pre-commit hook to run lint rules (eslint/prettier) on code before commit
39
- * Uses pre-commit hook to ensure [conventional commit messages](https://www.conventionalcommits.org/en/v1.0.0/) are used
40
-
41
- ### Testing
42
-
43
- Terra Draw uses [jest](https://jestjs.io/) as it's testing framework. You can distinguish a test by it's `.spec.ts` prefix on the file name.
44
-
45
- To run the tests as they would run in CI:
46
-
47
- ```
48
- npm run test
49
- ```
50
-
51
- You can also check the coverage by running:
52
-
53
-
54
- ```
55
- npm run test:coverage
56
- ```
57
-
58
- For local development you may benefit from the `nocheck` option which allows you to avoid running TypeScript type checking when running the tests. This option also only checks files which are explicitly tested (i.e. have a spec file.)
59
-
60
- ```
61
- npm run test:nocheck
62
- npm run test:nocheck:coverage
63
- ```
64
-
65
- ### Developing Locally
66
-
67
- A folder called `development` has been set up locally to allow you to test developing Terra Draw locally more easily. It allows you to run the different adapters and test different map providers in parallel, ensuring. You will need to update the .env file in the `development` folder in order to use the related adapters working. An example `.env` file in the `development` folder:
68
-
69
-
70
- ```
71
- GOOGLE_API_KEY=YOUR_KEY_HERE
72
- MAPBOX_ACCESS_TOKEN=YOUR_KEY_HERE
73
- ```
74
-
75
- ### GitHub Pages Example
76
-
77
- We also provide a GitHub Pages example that can developed on in the `docs` folder. This automatically deploys from the `main` branch.