terra-draw 0.0.1-alpha.6 → 0.0.1-alpha.61

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 (112) hide show
  1. package/.devcontainer/Dockerfile +8 -0
  2. package/.devcontainer/devcontainer.json +21 -0
  3. package/.devcontainer/post-create.sh +16 -0
  4. package/README.md +30 -6
  5. package/dist/adapters/arcgis-maps-sdk.adapter.d.ts +105 -0
  6. package/dist/adapters/common/adapter-listener.d.ts +22 -0
  7. package/dist/adapters/common/base.adapter.d.ts +59 -0
  8. package/dist/adapters/google-maps.adapter.d.ts +90 -39
  9. package/dist/adapters/leaflet.adapter.d.ts +97 -33
  10. package/dist/adapters/mapbox-gl.adapter.d.ts +89 -37
  11. package/dist/adapters/maplibre-gl.adapter.d.ts +71 -0
  12. package/dist/adapters/openlayers.adapter.d.ts +118 -0
  13. package/dist/common.d.ts +103 -98
  14. package/dist/geometry/boolean/is-valid-coordinate.d.ts +4 -0
  15. package/dist/geometry/boolean/is-valid-linestring-feature.d.ts +2 -0
  16. package/dist/geometry/boolean/is-valid-point.d.ts +2 -0
  17. package/dist/geometry/boolean/is-valid-polygon-feature.d.ts +3 -0
  18. package/dist/geometry/boolean/point-in-polygon.d.ts +2 -2
  19. package/dist/geometry/boolean/self-intersects.d.ts +2 -2
  20. package/dist/geometry/centroid.d.ts +2 -2
  21. package/dist/geometry/coordinates-identical.d.ts +2 -2
  22. package/dist/geometry/get-coordinates-as-points.d.ts +6 -6
  23. package/dist/geometry/get-midpoints.d.ts +8 -7
  24. package/dist/geometry/helpers.d.ts +4 -4
  25. package/dist/geometry/limit-decimal-precision.d.ts +1 -1
  26. package/dist/geometry/measure/haversine-distance.d.ts +2 -2
  27. package/dist/geometry/measure/pixel-distance-to-line.d.ts +10 -10
  28. package/dist/geometry/measure/pixel-distance.d.ts +7 -7
  29. package/dist/geometry/measure/rhumb-bearing.d.ts +2 -2
  30. package/dist/geometry/measure/rhumb-destination.d.ts +2 -2
  31. package/dist/geometry/measure/rhumb-distance.d.ts +2 -2
  32. package/dist/geometry/midpoint-coordinate.d.ts +3 -2
  33. package/dist/geometry/shape/create-bbox.d.ts +10 -0
  34. package/dist/geometry/shape/create-circle.d.ts +7 -7
  35. package/dist/geometry/shape/great-circle-line.d.ts +12 -0
  36. package/dist/geometry/transform/rotate.d.ts +2 -2
  37. package/dist/geometry/transform/scale.d.ts +2 -2
  38. package/dist/modes/base.behavior.d.ts +19 -19
  39. package/dist/modes/base.mode.d.ts +62 -33
  40. package/dist/modes/circle/circle.mode.d.ts +55 -35
  41. package/dist/modes/click-bounding-box.behavior.d.ts +6 -7
  42. package/dist/modes/freehand/freehand.mode.d.ts +63 -37
  43. package/dist/modes/great-circle-snapping.behavior.d.ts +14 -0
  44. package/dist/modes/greatcircle/great-circle.mode.d.ts +64 -0
  45. package/dist/modes/linestring/linestring.mode.d.ts +67 -40
  46. package/dist/modes/pixel-distance.behavior.d.ts +7 -7
  47. package/dist/modes/point/point.mode.d.ts +44 -26
  48. package/dist/modes/polygon/behaviors/closing-points.behavior.d.ts +19 -19
  49. package/dist/modes/polygon/polygon.mode.d.ts +70 -49
  50. package/dist/modes/rectangle/rectangle.mode.d.ts +55 -0
  51. package/dist/modes/render/render.mode.d.ts +52 -23
  52. package/dist/modes/select/behaviors/drag-coordinate-resize.behavior.d.ts +28 -0
  53. package/dist/modes/select/behaviors/drag-coordinate.behavior.d.ts +20 -13
  54. package/dist/modes/select/behaviors/drag-feature.behavior.d.ts +20 -17
  55. package/dist/modes/select/behaviors/{features-at-mouse-event.behavior.d.ts → feature-at-pointer-event.behavior.d.ts} +15 -15
  56. package/dist/modes/select/behaviors/midpoint.behavior.d.ts +19 -18
  57. package/dist/modes/select/behaviors/rotate-feature.behavior.d.ts +14 -13
  58. package/dist/modes/select/behaviors/scale-feature.behavior.d.ts +14 -13
  59. package/dist/modes/select/behaviors/selection-point.behavior.d.ts +19 -18
  60. package/dist/modes/select/select.mode.d.ts +117 -78
  61. package/dist/modes/snapping.behavior.d.ts +16 -13
  62. package/dist/modes/static/static.mode.d.ts +32 -30
  63. package/dist/store/spatial-index/quickselect.d.ts +2 -2
  64. package/dist/store/spatial-index/rbush.d.ts +35 -35
  65. package/dist/store/spatial-index/spatial-index.d.ts +18 -18
  66. package/dist/store/store-feature-validation.d.ts +16 -0
  67. package/dist/store/store.d.ts +59 -48
  68. package/dist/terra-draw.cjs +1 -1
  69. package/dist/terra-draw.cjs.map +1 -1
  70. package/dist/terra-draw.d.ts +220 -48
  71. package/dist/terra-draw.modern.js +1 -1
  72. package/dist/terra-draw.modern.js.map +1 -1
  73. package/dist/terra-draw.module.js +1 -1
  74. package/dist/terra-draw.module.js.map +1 -1
  75. package/dist/terra-draw.umd.js +1 -1
  76. package/dist/terra-draw.umd.js.map +1 -1
  77. package/dist/util/geoms.d.ts +3 -3
  78. package/dist/util/id.d.ts +1 -1
  79. package/dist/util/styling.d.ts +2 -2
  80. package/e2e/README.md +29 -0
  81. package/e2e/package-lock.json +4249 -0
  82. package/e2e/package.json +26 -0
  83. package/e2e/playwright.config.ts +77 -0
  84. package/e2e/public/index.html +53 -0
  85. package/e2e/src/index.ts +165 -0
  86. package/e2e/tests/leaflet.spec.ts +413 -0
  87. package/e2e/tests/setup.ts +164 -0
  88. package/e2e/webpack.config.js +36 -0
  89. package/jest.nocheck.config.ts +17 -0
  90. package/package.json +157 -87
  91. package/readme.gif +0 -0
  92. package/tsconfig.json +17 -12
  93. package/CODE_OF_CONDUCT.md +0 -36
  94. package/CONTRIBUTING.md +0 -17
  95. package/DEVELOPMENT.md +0 -77
  96. package/dist/bundle.js +0 -6
  97. package/dist/bundle.js.LICENSE.txt +0 -4
  98. package/dist/geometry/create-circle.d.ts +0 -6
  99. package/dist/geometry/get-pixel-distance-to-line.d.ts +0 -10
  100. package/dist/geometry/get-pixel-distance.d.ts +0 -7
  101. package/dist/geometry/haversine-distance.d.ts +0 -1
  102. package/dist/geometry/point-in-polygon.d.ts +0 -1
  103. package/dist/geometry/self-intersects.d.ts +0 -2
  104. package/dist/modes/circle.mode.d.ts +0 -18
  105. package/dist/modes/freehand.mode.d.ts +0 -20
  106. package/dist/modes/line-string.mode.d.ts +0 -21
  107. package/dist/modes/point.mode.d.ts +0 -14
  108. package/dist/modes/polygon/behaviors/start-end-point.behavior.d.ts +0 -11
  109. package/dist/modes/polygon.mode.d.ts +0 -21
  110. package/dist/modes/select.mode.d.ts +0 -21
  111. package/dist/modes/static.mode.d.ts +0 -10
  112. package/jest.config.ts +0 -27
package/package.json CHANGED
@@ -1,88 +1,158 @@
1
1
  {
2
- "name": "terra-draw",
3
- "version": "0.0.1-alpha.6",
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/terra-draw.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.61",
4
+ "description": "Frictionless map drawing across mapping provider",
5
+ "scripts": {
6
+ "docs": "typedoc",
7
+ "docs:serve": "serve ./docs",
8
+ "release": "standard-version",
9
+ "release:alpha:changelog": "tsx ./scripts/changelog-valid.ts",
10
+ "release:alpha:next": "tsx ./scripts/next-alpha-version.ts",
11
+ "build": "microbundle",
12
+ "watch": "microbundle --watch --format modern",
13
+ "test": "jest --config jest.config.ts",
14
+ "test:coverage": "jest --config jest.config.ts --coverage",
15
+ "test:nocheck": "jest --config jest.nocheck.config.ts",
16
+ "test:nocheck:coverage": "jest --config jest.nocheck.config.ts --coverage",
17
+ "lint": "eslint --ext .ts src/",
18
+ "lint:quiet": "eslint --ext .ts --quiet src/",
19
+ "lint:fix": "eslint --fix --ext .ts src/",
20
+ "lint:fix:quiet": "eslint --fix --quiet --ext .ts src/",
21
+ "format": "prettier --ignore-path .gitignore --write \"**/*.+(js|ts|json)\"",
22
+ "format:quiet": "prettier --ignore-path .gitignore --write \"**/*.+(js|ts|json)\" --log-level=silent",
23
+ "prepare": "husky install"
24
+ },
25
+ "type": "module",
26
+ "source": "src/terra-draw.ts",
27
+ "exports": {
28
+ "types": "./dist/terra-draw.d.ts",
29
+ "require": "./dist/terra-draw.cjs",
30
+ "default": "./dist/terra-draw.modern.js"
31
+ },
32
+ "types": "./dist/terra-draw.d.ts",
33
+ "main": "./dist/terra-draw.cjs",
34
+ "module": "./dist/terra-draw.module.js",
35
+ "unpkg": "./dist/terra-draw.umd.js",
36
+ "author": "James Milner",
37
+ "license": "MIT",
38
+ "repository": "JamesLMilner/terra-draw",
39
+ "keywords": [
40
+ "map",
41
+ "drawing",
42
+ "draw",
43
+ "map drawing",
44
+ "geometry",
45
+ "leaflet",
46
+ "leafletjs",
47
+ "mapbox",
48
+ "mapboxgl",
49
+ "google maps",
50
+ "openlayers",
51
+ "maplibre"
52
+ ],
53
+ "devDependencies": {
54
+ "@arcgis/core": "^4.27.6",
55
+ "@commitlint/cli": "^17.1.2",
56
+ "@commitlint/config-conventional": "^17.1.0",
57
+ "@googlemaps/js-api-loader": "^1.14.3",
58
+ "@swc/jest": "^0.2.29",
59
+ "@types/geojson": "^7946.0.8",
60
+ "@types/google.maps": "^3.49.2",
61
+ "@types/jest": "^28.1.5",
62
+ "@types/leaflet": "^1.7.11",
63
+ "@types/mapbox-gl": "^2.7.3",
64
+ "@types/rbush": "^3.0.0",
65
+ "@typescript-eslint/eslint-plugin": "^6.7.4",
66
+ "@typescript-eslint/parser": "^6.7.4",
67
+ "eslint": "^8.24.0",
68
+ "eslint-config-prettier": "^9.0.0",
69
+ "eslint-plugin-prettier": "^5.0.0",
70
+ "husky": "^7.0.0",
71
+ "jest": "^29.3.1",
72
+ "jest-environment-jsdom": "^29.7.0",
73
+ "leaflet": "^1.8.0",
74
+ "mapbox-gl": "^2.13.0",
75
+ "maplibre-gl": "3.2.0",
76
+ "microbundle": "^0.15.0",
77
+ "ol": "^7.1.0",
78
+ "serve": "^14.1.2",
79
+ "standard-version": "^9.5.0",
80
+ "ts-jest": "^29.1.0",
81
+ "ts-loader": "^9.4.2",
82
+ "tsx": "^4.7.0",
83
+ "typedoc": "^0.25.1",
84
+ "typescript": "^5.2.2"
85
+ },
86
+ "commitlint": {
87
+ "extends": [
88
+ "@commitlint/config-conventional"
89
+ ]
90
+ },
91
+ "eslintConfig": {
92
+ "parser": "@typescript-eslint/parser",
93
+ "plugins": [
94
+ "@typescript-eslint"
95
+ ],
96
+ "rules": {
97
+ "@typescript-eslint/no-empty-function": "warn",
98
+ "@typescript-eslint/no-explicit-any": "warn"
99
+ },
100
+ "extends": [
101
+ "plugin:@typescript-eslint/recommended",
102
+ "prettier"
103
+ ]
104
+ },
105
+ "prettier": {
106
+ "printWidth": 80,
107
+ "semi": true,
108
+ "useTabs": true
109
+ },
110
+ "standard-version": {
111
+ "types": [
112
+ {
113
+ "type": "feat",
114
+ "section": "Features"
115
+ },
116
+ {
117
+ "type": "fix",
118
+ "section": "Bug Fixes"
119
+ },
120
+ {
121
+ "type": "docs",
122
+ "section": "Documentation"
123
+ },
124
+ {
125
+ "type": "style",
126
+ "section": "Styling"
127
+ },
128
+ {
129
+ "type": "refactor",
130
+ "section": "Refactors"
131
+ },
132
+ {
133
+ "type": "perf",
134
+ "section": "Performance"
135
+ },
136
+ {
137
+ "type": "test",
138
+ "section": "Tests"
139
+ },
140
+ {
141
+ "type": "build",
142
+ "section": "Build System"
143
+ },
144
+ {
145
+ "type": "ci",
146
+ "section": "CI"
147
+ },
148
+ {
149
+ "type": "chore",
150
+ "section": "Chore"
151
+ },
152
+ {
153
+ "type": "revert",
154
+ "section": "Reverts"
155
+ }
156
+ ]
157
+ }
158
+ }
package/readme.gif ADDED
Binary file
package/tsconfig.json CHANGED
@@ -1,14 +1,19 @@
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
+ }
14
19
  }
@@ -1,36 +0,0 @@
1
- Contributor Covenant Code of Conduct
2
- Our Pledge
3
- In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
4
-
5
- Our Standards
6
- Examples of behavior that contributes to creating a positive environment include:
7
-
8
- Using welcoming and inclusive language
9
- Being respectful of differing viewpoints and experiences
10
- Gracefully accepting constructive criticism
11
- Focusing on what is best for the community
12
- Showing empathy towards other community members
13
- Examples of unacceptable behavior by participants include:
14
-
15
- The use of sexualized language or imagery and unwelcome sexual attention or advances
16
- Trolling, insulting/derogatory comments, and personal or political attacks
17
- Public or private harassment
18
- Publishing others' private information, such as a physical or electronic address, without explicit permission
19
- Other conduct which could reasonably be considered inappropriate in a professional setting
20
- Our Responsibilities
21
- Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
22
-
23
- Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
24
-
25
- Scope
26
- This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
27
-
28
- Enforcement
29
- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at codeofconduct@loxo.industries. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
30
-
31
- Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
32
-
33
- Attribution
34
- This Code of Conduct is adapted from the Contributor Covenant, version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
35
-
36
- For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq
package/CONTRIBUTING.md DELETED
@@ -1,17 +0,0 @@
1
- # Contributing
2
-
3
- ## Instructions
4
-
5
- This document will receive a more thorough update in the future. For the time being, if you wish to contribute to Terra Draw, we request that you:
6
-
7
- 1) Make an issue on GitHub describing the bug you intend to fix or the feature you intend to add.
8
- 2) Create a fork of the project, and work on a branch that represents the issue
9
- 3) Ensure that the work you have done is unit tested, aiming for 80% code coverage
10
- 4) Create a PR that represents this work. Please refer to the issue from the PR
11
- 5) We will address the PR and give you feedback
12
-
13
- Please note that we can not garauntee that all PRs will be merged. There are cases where a PR may deviate from the long-term vision for Terra Draw and hence we may have to decline it. Creating the issue in advance helps us discuss any potential issues upfront before the PR is made.
14
-
15
- ## Code of Conduct
16
-
17
- We have a code of conduct which we expect individuals interacting with the project to respect. Please see the [full Code of Conduct in the repository](./CODE_OF_CONDUCT.md).
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.
package/dist/bundle.js DELETED
@@ -1,6 +0,0 @@
1
- /******/ (() => { // webpackBootstrap
2
- /******/ "use strict";
3
- /******/
4
- /******/
5
- /******/ })()
6
- ;
@@ -1,4 +0,0 @@
1
- /* @preserve
2
- * Leaflet 1.8.0, a JS library for interactive maps. https://leafletjs.com
3
- * (c) 2010-2022 Vladimir Agafonkin, (c) 2010-2011 CloudMade
4
- */
@@ -1,6 +0,0 @@
1
- import { Feature, Polygon } from "geojson";
2
- export declare function circle(options: {
3
- center: [number, number];
4
- radiusKilometers: number;
5
- steps?: number;
6
- }): Feature<Polygon>;
@@ -1,10 +0,0 @@
1
- export declare const getPixelDistanceToLine: (point: {
2
- x: number;
3
- y: number;
4
- }, linePointOne: {
5
- x: number;
6
- y: number;
7
- }, linePointTwo: {
8
- x: number;
9
- y: number;
10
- }) => number;
@@ -1,7 +0,0 @@
1
- export declare const getPixelDistance: (pointOne: {
2
- x: number;
3
- y: number;
4
- }, pointTwo: {
5
- x: number;
6
- y: number;
7
- }) => number;
@@ -1 +0,0 @@
1
- export declare function haversineDistanceKilometers(pointOne: [lng: number, lat: number], pointTwo: [lng: number, lat: number]): number;
@@ -1 +0,0 @@
1
- export declare function pointInPolygon(point: [number, number], rings: [number, number][][]): boolean;
@@ -1,2 +0,0 @@
1
- import { Feature, LineString, Polygon } from "geojson";
2
- export declare function selfIntersects(feature: Feature<Polygon> | Feature<LineString>): boolean;
@@ -1,18 +0,0 @@
1
- import { TerraDrawMouseEvent, TerraDrawMode, TerraDrawModeRegisterConfig, TerraDrawAdapterStyling, TerraDrawKeyboardEvent } from "../common";
2
- export declare class TerraDrawCircleMode implements TerraDrawMode {
3
- mode: string;
4
- private store;
5
- private project;
6
- private center;
7
- private clickCount;
8
- private currentCircleId;
9
- constructor(options?: {
10
- styling?: Partial<TerraDrawAdapterStyling>;
11
- });
12
- styling: TerraDrawAdapterStyling;
13
- register(config: TerraDrawModeRegisterConfig): void;
14
- onClick(event: TerraDrawMouseEvent): void;
15
- onMouseMove(event: TerraDrawMouseEvent): void;
16
- onKeyPress(event: TerraDrawKeyboardEvent): void;
17
- cleanUp(): void;
18
- }
@@ -1,20 +0,0 @@
1
- import { TerraDrawMouseEvent, TerraDrawMode, TerraDrawModeRegisterConfig, TerraDrawAdapterStyling, TerraDrawKeyboardEvent } from "../common";
2
- export declare class TerraDrawFreehandMode implements TerraDrawMode {
3
- mode: string;
4
- private store;
5
- private project;
6
- private startingClick;
7
- private currentId;
8
- private skip;
9
- private everyNthMouseEvent;
10
- constructor(options?: {
11
- styling?: Partial<TerraDrawAdapterStyling>;
12
- everyNthMouseEvent?: number;
13
- });
14
- styling: TerraDrawAdapterStyling;
15
- register(config: TerraDrawModeRegisterConfig): void;
16
- onMouseMove(event: TerraDrawMouseEvent): void;
17
- onClick(event: TerraDrawMouseEvent): void;
18
- onKeyPress(event: TerraDrawKeyboardEvent): void;
19
- cleanUp(): void;
20
- }
@@ -1,21 +0,0 @@
1
- import { TerraDrawMouseEvent, TerraDrawMode, TerraDrawModeRegisterConfig, TerraDrawAdapterStyling, TerraDrawKeyboardEvent } from "../common";
2
- export declare class TerraDrawLineStringMode implements TerraDrawMode {
3
- mode: string;
4
- private store;
5
- private project;
6
- private pointerDistance;
7
- private currentCoordinate;
8
- private currentId;
9
- private allowSelfIntersections;
10
- constructor(options?: {
11
- allowSelfIntersections?: boolean;
12
- styling?: Partial<TerraDrawAdapterStyling>;
13
- pointerDistance?: number;
14
- });
15
- styling: TerraDrawAdapterStyling;
16
- register(config: TerraDrawModeRegisterConfig): void;
17
- onMouseMove(event: TerraDrawMouseEvent): void;
18
- onClick(event: TerraDrawMouseEvent): void;
19
- onKeyPress(event: TerraDrawKeyboardEvent): void;
20
- cleanUp(): void;
21
- }
@@ -1,14 +0,0 @@
1
- import { TerraDrawMouseEvent, TerraDrawMode, TerraDrawModeRegisterConfig, TerraDrawAdapterStyling } from "../common";
2
- export declare class TerraDrawPointMode implements TerraDrawMode {
3
- mode: string;
4
- private store;
5
- constructor(options?: {
6
- styling?: Partial<TerraDrawAdapterStyling>;
7
- });
8
- styling: TerraDrawAdapterStyling;
9
- register(config: TerraDrawModeRegisterConfig): void;
10
- onClick(event: TerraDrawMouseEvent): void;
11
- onMouseMove(): void;
12
- onKeyPress(): void;
13
- cleanUp(): void;
14
- }
@@ -1,11 +0,0 @@
1
- import { Position } from "geojson";
2
- import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
3
- export declare class StartEndPointBehavior extends TerraDrawModeBehavior {
4
- constructor(config: BehaviorConfig);
5
- private _startEndPoints;
6
- get ids(): string[];
7
- set ids(_: string[]);
8
- create(selectedCoords: Position[], mode: string): void;
9
- delete(): void;
10
- update(updatedCoordinates: Position[]): void;
11
- }
@@ -1,21 +0,0 @@
1
- import { TerraDrawMouseEvent, TerraDrawMode, TerraDrawModeRegisterConfig, TerraDrawAdapterStyling, TerraDrawKeyboardEvent } from "../common";
2
- export declare class TerraDrawPolygonMode implements TerraDrawMode {
3
- mode: string;
4
- private store;
5
- private project;
6
- private currentCoordinate;
7
- private currentId;
8
- private allowSelfIntersections;
9
- private pointerDistance;
10
- constructor(options?: {
11
- allowSelfIntersections?: boolean;
12
- styling?: Partial<TerraDrawAdapterStyling>;
13
- pointerDistance?: number;
14
- });
15
- styling: TerraDrawAdapterStyling;
16
- register(config: TerraDrawModeRegisterConfig): void;
17
- onMouseMove(event: TerraDrawMouseEvent): void;
18
- onClick(event: TerraDrawMouseEvent): void;
19
- onKeyPress(event: TerraDrawKeyboardEvent): void;
20
- cleanUp(): void;
21
- }
@@ -1,21 +0,0 @@
1
- import { TerraDrawMouseEvent, TerraDrawMode, TerraDrawModeRegisterConfig, TerraDrawKeyboardEvent, TerraDrawAdapterStyling } from "../common";
2
- export declare class TerraDrawSelectMode implements TerraDrawMode {
3
- mode: string;
4
- private store;
5
- private project;
6
- private selected;
7
- private pointerDistance;
8
- private selectionPoints;
9
- constructor(options?: {
10
- styling?: Partial<TerraDrawAdapterStyling>;
11
- pointerDistance?: number;
12
- });
13
- styling: TerraDrawAdapterStyling;
14
- onClick(event: TerraDrawMouseEvent): void;
15
- onKeyPress(event: TerraDrawKeyboardEvent): void;
16
- cleanUp(): void;
17
- onMouseMove(): void;
18
- register(config: TerraDrawModeRegisterConfig): void;
19
- onDeselect(deselectedId: string): void;
20
- onSelect(selectedId: string): void;
21
- }
@@ -1,10 +0,0 @@
1
- import { TerraDrawAdapterStyling, TerraDrawMode } from "../common";
2
- export declare class TerraDrawStaticMode implements TerraDrawMode {
3
- mode: string;
4
- styling: TerraDrawAdapterStyling;
5
- register(): void;
6
- onKeyPress(): void;
7
- onClick(): void;
8
- onMouseMove(): void;
9
- cleanUp(): void;
10
- }
package/jest.config.ts DELETED
@@ -1,27 +0,0 @@
1
-
2
- let options = {}
3
-
4
- if (process.env.NO_CHECK) {
5
- options = {
6
- "transform": {
7
- "^.+\\.(t|j)sx?$": "@swc/jest"
8
- },
9
- "setupFilesAfterEnv": ["<rootDir>/src/test/jest.matchers.ts"],
10
- }
11
- } else {
12
- options = {
13
- "preset": "ts-jest",
14
- "testEnvironment": "node",
15
- "coveragePathIgnorePatterns": ["<rootDir>/src/test/"],
16
- "setupFilesAfterEnv": ["<rootDir>/src/test/jest.matchers.ts"],
17
- "collectCoverage": true,
18
- "collectCoverageFrom": ["./src/**"],
19
- "coverageThreshold": {
20
- "global": {
21
- "lines": 65
22
- }
23
- }
24
- }
25
- }
26
-
27
- module.exports = options