terra-draw 0.0.1-alpha.9 → 1.0.0-beta.0

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 (119) hide show
  1. package/.devcontainer/Dockerfile +8 -0
  2. package/.devcontainer/devcontainer.json +27 -0
  3. package/.devcontainer/post-create.sh +16 -0
  4. package/README.md +23 -13
  5. package/dist/adapters/arcgis-maps-sdk.adapter.d.ts +106 -0
  6. package/dist/adapters/google-maps.adapter.d.ts +90 -39
  7. package/dist/adapters/leaflet.adapter.d.ts +99 -33
  8. package/dist/adapters/mapbox-gl.adapter.d.ts +91 -37
  9. package/dist/adapters/maplibre-gl.adapter.d.ts +72 -0
  10. package/dist/adapters/openlayers.adapter.d.ts +120 -0
  11. package/dist/common.d.ts +118 -98
  12. package/dist/geometry/boolean/is-valid-coordinate.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 +14 -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/area.d.ts +2 -0
  22. package/dist/geometry/measure/bearing.d.ts +9 -0
  23. package/dist/geometry/measure/destination.d.ts +2 -0
  24. package/dist/geometry/measure/haversine-distance.d.ts +2 -2
  25. package/dist/geometry/measure/pixel-distance-to-line.d.ts +10 -10
  26. package/dist/geometry/measure/pixel-distance.d.ts +7 -7
  27. package/dist/geometry/measure/rhumb-bearing.d.ts +2 -2
  28. package/dist/geometry/measure/rhumb-destination.d.ts +2 -2
  29. package/dist/geometry/measure/rhumb-distance.d.ts +2 -2
  30. package/dist/geometry/measure/slice-along.d.ts +2 -0
  31. package/dist/geometry/midpoint-coordinate.d.ts +4 -2
  32. package/dist/geometry/project/web-mercator.d.ts +20 -0
  33. package/dist/geometry/shape/create-bbox.d.ts +10 -0
  34. package/dist/geometry/shape/create-circle.d.ts +13 -7
  35. package/dist/geometry/shape/great-circle-coordinates.d.ts +2 -0
  36. package/dist/geometry/shape/web-mercator-distortion.d.ts +2 -0
  37. package/dist/geometry/transform/rotate.d.ts +9 -2
  38. package/dist/geometry/transform/scale.d.ts +9 -2
  39. package/dist/geometry/web-mercator-centroid.d.ts +11 -0
  40. package/dist/modes/base.behavior.d.ts +21 -19
  41. package/dist/modes/base.mode.d.ts +66 -33
  42. package/dist/modes/circle/circle.mode.d.ts +66 -37
  43. package/dist/modes/click-bounding-box.behavior.d.ts +6 -7
  44. package/dist/modes/freehand/freehand.mode.d.ts +63 -43
  45. package/dist/modes/insert-coordinates.behavior.d.ts +9 -0
  46. package/dist/modes/linestring/linestring.mode.d.ts +78 -47
  47. package/dist/modes/pixel-distance.behavior.d.ts +7 -7
  48. package/dist/modes/point/point.mode.d.ts +44 -26
  49. package/dist/modes/polygon/behaviors/closing-points.behavior.d.ts +19 -19
  50. package/dist/modes/polygon/polygon.mode.d.ts +69 -51
  51. package/dist/modes/rectangle/rectangle.mode.d.ts +55 -0
  52. package/dist/modes/render/render.mode.d.ts +52 -23
  53. package/dist/modes/select/behaviors/drag-coordinate-resize.behavior.d.ts +62 -0
  54. package/dist/modes/select/behaviors/drag-coordinate.behavior.d.ts +20 -13
  55. package/dist/modes/select/behaviors/drag-feature.behavior.d.ts +20 -17
  56. package/dist/modes/select/behaviors/{features-at-mouse-event.behavior.d.ts → feature-at-pointer-event.behavior.d.ts} +15 -15
  57. package/dist/modes/select/behaviors/midpoint.behavior.d.ts +19 -18
  58. package/dist/modes/select/behaviors/rotate-feature.behavior.d.ts +14 -13
  59. package/dist/modes/select/behaviors/scale-feature.behavior.d.ts +14 -13
  60. package/dist/modes/select/behaviors/selection-point.behavior.d.ts +19 -18
  61. package/dist/modes/select/select.mode.d.ts +119 -78
  62. package/dist/modes/snapping.behavior.d.ts +16 -13
  63. package/dist/modes/static/static.mode.d.ts +32 -30
  64. package/dist/store/spatial-index/quickselect.d.ts +2 -2
  65. package/dist/store/spatial-index/rbush.d.ts +35 -35
  66. package/dist/store/spatial-index/spatial-index.d.ts +18 -18
  67. package/dist/store/store-feature-validation.d.ts +16 -0
  68. package/dist/store/store.d.ts +59 -48
  69. package/dist/terra-draw.cjs +1 -1
  70. package/dist/terra-draw.cjs.map +1 -1
  71. package/dist/terra-draw.d.ts +222 -48
  72. package/dist/terra-draw.modern.js +1 -1
  73. package/dist/terra-draw.modern.js.map +1 -1
  74. package/dist/terra-draw.module.js +1 -1
  75. package/dist/terra-draw.module.js.map +1 -1
  76. package/dist/terra-draw.umd.js +1 -1
  77. package/dist/terra-draw.umd.js.map +1 -1
  78. package/dist/util/geoms.d.ts +3 -3
  79. package/dist/util/id.d.ts +1 -1
  80. package/dist/util/styling.d.ts +2 -2
  81. package/dist/validations/linestring.validation.d.ts +2 -0
  82. package/dist/validations/max-size.validation.d.ts +2 -0
  83. package/dist/validations/min-size.validation.d.ts +2 -0
  84. package/dist/validations/not-self-intersecting.validation.d.ts +2 -0
  85. package/dist/validations/point.validation.d.ts +2 -0
  86. package/dist/validations/polygon.validation.d.ts +3 -0
  87. package/e2e/README.md +29 -0
  88. package/e2e/package-lock.json +4274 -0
  89. package/e2e/package.json +26 -0
  90. package/e2e/playwright.config.ts +77 -0
  91. package/e2e/public/favicon.ico +0 -0
  92. package/e2e/public/index.html +52 -0
  93. package/e2e/tests/leaflet.spec.ts +657 -0
  94. package/e2e/tests/setup.ts +181 -0
  95. package/e2e/webpack.config.js +36 -0
  96. package/jest.nocheck.config.ts +17 -0
  97. package/package.json +159 -87
  98. package/readme.gif +0 -0
  99. package/tsconfig.json +25 -12
  100. package/CODE_OF_CONDUCT.md +0 -36
  101. package/CONTRIBUTING.md +0 -17
  102. package/DEVELOPMENT.md +0 -77
  103. package/dist/bundle.js +0 -6
  104. package/dist/bundle.js.LICENSE.txt +0 -4
  105. package/dist/geometry/create-circle.d.ts +0 -6
  106. package/dist/geometry/get-pixel-distance-to-line.d.ts +0 -10
  107. package/dist/geometry/get-pixel-distance.d.ts +0 -7
  108. package/dist/geometry/haversine-distance.d.ts +0 -1
  109. package/dist/geometry/point-in-polygon.d.ts +0 -1
  110. package/dist/geometry/self-intersects.d.ts +0 -2
  111. package/dist/modes/circle.mode.d.ts +0 -18
  112. package/dist/modes/freehand.mode.d.ts +0 -20
  113. package/dist/modes/line-string.mode.d.ts +0 -21
  114. package/dist/modes/point.mode.d.ts +0 -14
  115. package/dist/modes/polygon/behaviors/start-end-point.behavior.d.ts +0 -11
  116. package/dist/modes/polygon.mode.d.ts +0 -21
  117. package/dist/modes/select.mode.d.ts +0 -21
  118. package/dist/modes/static.mode.d.ts +0 -10
  119. package/jest.config.ts +0 -27
@@ -1,3 +1,3 @@
1
- import { Feature, LineString, Polygon, Position } from "geojson";
2
- export declare function createPolygon(coordinates?: Position[][]): Feature<Polygon>;
3
- export declare function createLineString(coordinates: Position[]): Feature<LineString>;
1
+ import { Feature, LineString, Polygon, Position } from "geojson";
2
+ export declare function createPolygon(coordinates?: Position[][]): Feature<Polygon>;
3
+ export declare function createLineString(coordinates: Position[]): Feature<LineString>;
package/dist/util/id.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const uuid4: () => string;
1
+ export declare const uuid4: () => string;
@@ -1,2 +1,2 @@
1
- import { TerraDrawAdapterStyling } from "../common";
2
- export declare const getDefaultStyling: () => TerraDrawAdapterStyling;
1
+ import { TerraDrawAdapterStyling } from "../common";
2
+ export declare const getDefaultStyling: () => TerraDrawAdapterStyling;
@@ -0,0 +1,2 @@
1
+ import { GeoJSONStoreFeatures } from "../terra-draw";
2
+ export declare function ValidateLineStringFeature(feature: GeoJSONStoreFeatures, coordinatePrecision: number): boolean;
@@ -0,0 +1,2 @@
1
+ import { GeoJSONStoreFeatures } from "../terra-draw";
2
+ export declare const ValidateMaxAreaSquareMeters: (feature: GeoJSONStoreFeatures, maxSize: number) => boolean;
@@ -0,0 +1,2 @@
1
+ import { GeoJSONStoreFeatures } from "../terra-draw";
2
+ export declare const ValidateMinAreaSquareMeters: (feature: GeoJSONStoreFeatures, minSize: number) => boolean;
@@ -0,0 +1,2 @@
1
+ import { GeoJSONStoreFeatures } from "../terra-draw";
2
+ export declare const ValidateNotSelfIntersecting: (feature: GeoJSONStoreFeatures) => boolean;
@@ -0,0 +1,2 @@
1
+ import { GeoJSONStoreFeatures } from "../terra-draw";
2
+ export declare function ValidatePointFeature(feature: GeoJSONStoreFeatures, coordinatePrecision: number): boolean;
@@ -0,0 +1,3 @@
1
+ import { GeoJSONStoreFeatures } from "../terra-draw";
2
+ export declare function ValidatePolygonFeature(feature: GeoJSONStoreFeatures, coordinatePrecision: number): boolean;
3
+ export declare function ValidateNonIntersectingPolygonFeature(feature: GeoJSONStoreFeatures, coordinatePrecision: number): boolean;
package/e2e/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # E2E Testing with Playwright
2
+
3
+ We provide a basic end-to-end (E2E) test suite via Playwright, testing against the Leaflet Adapter. The test suite aims to emulate how an end user would interact with and use Terra Draw. Here we can attempt to catch bugs earlier in the pipeline and ensure that new behaviours in the future adhere to a given specification.
4
+
5
+ ## Installation
6
+
7
+ Installation can be down via npm like so:
8
+
9
+ ```shell
10
+ npm install
11
+ ```
12
+
13
+ ## Running
14
+
15
+ You can run the tests headless (i.e. no opening of Chromimum) like so:
16
+
17
+ ```shell
18
+ npm run test
19
+ ```
20
+
21
+ Or you can run them headed (i.e. Chromimum will open and you will see the tests run) like so:
22
+
23
+ ```shell
24
+ npm run test:headed
25
+ ```
26
+
27
+ ## Tests
28
+
29
+ Tests are located in the `tests` folder. You will see the `leaflet.spec.ts` file, this is where the tests are kept for the E2E tests written for the Leaflet Adapter. There are also some convienence methods written in the `setup.ts` file which can be leveraged to write tests more easily.