terra-draw 1.0.0-beta.8 → 1.0.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 (153) hide show
  1. package/.versionrc.cjs +9 -0
  2. package/README.md +4 -47
  3. package/dist/common/adapter-listener.spec.d.ts +1 -0
  4. package/dist/{adapters/common → common}/base.adapter.d.ts +1 -1
  5. package/dist/common.d.ts +11 -6
  6. package/dist/extend.d.ts +4 -3
  7. package/dist/geometry/boolean/is-valid-coordinate.spec.d.ts +1 -0
  8. package/dist/geometry/boolean/point-in-polygon.spec.d.ts +1 -0
  9. package/dist/geometry/boolean/self-intersects.spec.d.ts +1 -0
  10. package/dist/geometry/calculate-relative-angle.d.ts +2 -10
  11. package/dist/geometry/calculate-relative-angle.spec.d.ts +1 -0
  12. package/dist/geometry/centroid.spec.d.ts +1 -0
  13. package/dist/geometry/clockwise.d.ts +2 -10
  14. package/dist/geometry/clockwise.spec.d.ts +1 -0
  15. package/dist/geometry/coordinates-identical.spec.d.ts +1 -0
  16. package/dist/geometry/determine-halfplane.d.ts +2 -10
  17. package/dist/geometry/determine-halfplane.spec.d.ts +1 -0
  18. package/dist/geometry/get-coordinates-as-points.spec.d.ts +1 -0
  19. package/dist/geometry/get-midpoint.spec.d.ts +1 -0
  20. package/dist/geometry/limit-decimal-precision.spec.d.ts +1 -0
  21. package/dist/geometry/measure/bearing.d.ts +2 -7
  22. package/dist/geometry/measure/bearing.spec.d.ts +1 -0
  23. package/dist/geometry/measure/desination.spec.d.ts +1 -0
  24. package/dist/geometry/measure/destination.d.ts +2 -7
  25. package/dist/geometry/measure/haversine-distance.spec.d.ts +1 -0
  26. package/dist/geometry/measure/pixel-distance-to-line.d.ts +2 -10
  27. package/dist/geometry/measure/pixel-distance-to-line.spec.d.ts +1 -0
  28. package/dist/geometry/measure/pixel-distance.d.ts +2 -7
  29. package/dist/geometry/measure/pixel-distance.spec.d.ts +1 -0
  30. package/dist/geometry/measure/rhumb-bearing.spec.d.ts +1 -0
  31. package/dist/geometry/measure/rhumb-destination.spec.d.ts +1 -0
  32. package/dist/geometry/measure/rhumb-distance.spec.d.ts +1 -0
  33. package/dist/geometry/point-on-line.d.ts +5 -0
  34. package/dist/geometry/point-on-line.spec.d.ts +1 -0
  35. package/dist/geometry/project/web-mercator.d.ts +2 -4
  36. package/dist/geometry/project/web-mercator.spec.d.ts +1 -0
  37. package/dist/geometry/shape/create-bbox.spec.d.ts +1 -0
  38. package/dist/geometry/shape/create-circle.spec.d.ts +1 -0
  39. package/dist/geometry/shape/great-circle-coordinates.spec.d.ts +1 -0
  40. package/dist/geometry/shape/web-mercator-distortion.spec.d.ts +1 -0
  41. package/dist/geometry/transform/rotate.spec.d.ts +1 -0
  42. package/dist/geometry/transform/scale.spec.d.ts +1 -0
  43. package/dist/geometry/web-mercator-centroid.d.ts +2 -4
  44. package/dist/geometry/web-mercator-centroid.spec.d.ts +1 -0
  45. package/dist/geometry/web-mercator-point-on-line.d.ts +11 -0
  46. package/dist/geometry/web-mercator-point-on-line.spec.d.ts +1 -0
  47. package/dist/modes/angled-rectangle/angled-rectangle.mode.d.ts +2 -3
  48. package/dist/modes/angled-rectangle/angled-rectangle.mode.spec.d.ts +1 -0
  49. package/dist/modes/base.mode.d.ts +3 -1
  50. package/dist/modes/circle/circle.mode.d.ts +3 -2
  51. package/dist/modes/circle/circle.mode.spec.d.ts +1 -0
  52. package/dist/modes/click-bounding-box.behavior.spec.d.ts +1 -0
  53. package/dist/modes/coordinate-snapping.behavior.d.ts +16 -0
  54. package/dist/modes/coordinate-snapping.behavior.spec.d.ts +1 -0
  55. package/dist/modes/freehand/freehand.mode.d.ts +8 -2
  56. package/dist/modes/freehand/freehand.mode.spec.d.ts +1 -0
  57. package/dist/modes/insert-coordinates.behavior.spec.d.ts +1 -0
  58. package/dist/modes/{snapping.behavior.d.ts → line-snapping.behavior.d.ts} +1 -1
  59. package/dist/modes/line-snapping.behavior.spec.d.ts +1 -0
  60. package/dist/modes/linestring/linestring.mode.d.ts +16 -5
  61. package/dist/modes/linestring/linestring.mode.spec.d.ts +1 -0
  62. package/dist/modes/pixel-distance.behavior.spec.d.ts +1 -0
  63. package/dist/modes/point/point.mode.d.ts +2 -2
  64. package/dist/modes/point/point.mode.spec.d.ts +1 -0
  65. package/dist/modes/polygon/behaviors/closing-points.behavior.spec.d.ts +1 -0
  66. package/dist/modes/polygon/polygon.mode.d.ts +17 -4
  67. package/dist/modes/polygon/polygon.mode.spec.d.ts +1 -0
  68. package/dist/modes/rectangle/rectangle.mode.d.ts +2 -2
  69. package/dist/modes/rectangle/rectangle.mode.spec.d.ts +1 -0
  70. package/dist/modes/render/render.mode.d.ts +2 -1
  71. package/dist/modes/render/render.mode.spec.d.ts +1 -0
  72. package/dist/modes/sector/sector.mode.d.ts +2 -2
  73. package/dist/modes/sector/sector.mode.spec.d.ts +1 -0
  74. package/dist/modes/select/behaviors/drag-coordinate-resize.behavior.spec.d.ts +1 -0
  75. package/dist/modes/select/behaviors/drag-coordinate.behavior.spec.d.ts +1 -0
  76. package/dist/modes/select/behaviors/drag-feature.behavior.d.ts +2 -2
  77. package/dist/modes/select/behaviors/drag-feature.behavior.spec.d.ts +1 -0
  78. package/dist/modes/select/behaviors/feature-at-pointer-event.behavior.spec.d.ts +1 -0
  79. package/dist/modes/select/behaviors/midpoint.behavior.spec.d.ts +1 -0
  80. package/dist/modes/select/behaviors/rotate-feature.behavior.spec.d.ts +1 -0
  81. package/dist/modes/select/behaviors/scale-feature.behavior.spec.d.ts +1 -0
  82. package/dist/modes/select/behaviors/selection-point.behavior.spec.d.ts +1 -0
  83. package/dist/modes/select/select.mode.spec.d.ts +1 -0
  84. package/dist/modes/sensor/sensor.mode.d.ts +2 -2
  85. package/dist/modes/sensor/sensor.mode.spec.d.ts +1 -0
  86. package/dist/modes/static/static.mode.spec.d.ts +1 -0
  87. package/dist/store/spatial-index/quickselect.spec.d.ts +1 -0
  88. package/dist/store/spatial-index/rbush.spec.d.ts +1 -0
  89. package/dist/store/spatial-index/spatial-index.spec.d.ts +1 -0
  90. package/dist/store/store-feature-validation.d.ts +8 -2
  91. package/dist/store/store-validation.spec.d.ts +1 -0
  92. package/dist/store/store.d.ts +5 -1
  93. package/dist/store/store.spec.d.ts +1 -0
  94. package/dist/terra-draw.cjs +1 -1
  95. package/dist/terra-draw.cjs.map +1 -1
  96. package/dist/terra-draw.d.ts +13 -14
  97. package/dist/terra-draw.extensions.spec.d.ts +28 -0
  98. package/dist/terra-draw.modern.js +1 -1
  99. package/dist/terra-draw.modern.js.map +1 -1
  100. package/dist/terra-draw.module.js +1 -1
  101. package/dist/terra-draw.module.js.map +1 -1
  102. package/dist/terra-draw.spec.d.ts +1 -0
  103. package/dist/terra-draw.umd.js +1 -1
  104. package/dist/terra-draw.umd.js.map +1 -1
  105. package/dist/test/create-store-features.d.ts +6 -0
  106. package/dist/test/jest.matchers.d.ts +1 -0
  107. package/dist/test/mock-behavior-config.d.ts +2 -0
  108. package/dist/test/mock-callbacks.d.ts +2 -0
  109. package/dist/test/mock-cursor-event.d.ts +6 -0
  110. package/dist/test/mock-features.d.ts +4 -0
  111. package/dist/test/mock-keyboard-event.d.ts +5 -0
  112. package/dist/test/mock-mode-config.d.ts +21 -0
  113. package/dist/test/mock-pointer-event.d.ts +1 -0
  114. package/dist/util/geom.spec.d.ts +1 -0
  115. package/dist/util/id.spec.d.ts +1 -0
  116. package/dist/util/styling.spec.d.ts +1 -0
  117. package/dist/validation-reasons.d.ts +13 -0
  118. package/dist/validations/common-validations.d.ts +2 -0
  119. package/dist/validations/linestring.validation.d.ts +4 -1
  120. package/dist/validations/linestring.validation.spec.d.ts +1 -0
  121. package/dist/validations/max-size.validation.d.ts +3 -1
  122. package/dist/validations/max-size.validation.spec.d.ts +1 -0
  123. package/dist/validations/min-size.validation.d.ts +3 -1
  124. package/dist/validations/min-size.validation.spec.d.ts +1 -0
  125. package/dist/validations/not-self-intersecting.validation.d.ts +4 -1
  126. package/dist/validations/not-self-intersecting.validation.spec.d.ts +1 -0
  127. package/dist/validations/point.validation.d.ts +4 -1
  128. package/dist/validations/point.validation.spec.d.ts +1 -0
  129. package/dist/validations/polygon.validation.d.ts +8 -2
  130. package/dist/validations/polygon.validation.spec.d.ts +1 -0
  131. package/jest.nocheck.config.ts +5 -14
  132. package/package.json +12 -137
  133. package/tsconfig.json +6 -25
  134. package/.devcontainer/Dockerfile +0 -8
  135. package/.devcontainer/devcontainer.json +0 -27
  136. package/.devcontainer/post-create.sh +0 -16
  137. package/LICENSE +0 -8
  138. package/dist/adapters/arcgis-maps-sdk.adapter.d.ts +0 -106
  139. package/dist/adapters/google-maps.adapter.d.ts +0 -90
  140. package/dist/adapters/leaflet.adapter.d.ts +0 -99
  141. package/dist/adapters/mapbox-gl.adapter.d.ts +0 -90
  142. package/dist/adapters/maplibre-gl.adapter.d.ts +0 -72
  143. package/dist/adapters/openlayers.adapter.d.ts +0 -121
  144. package/e2e/README.md +0 -29
  145. package/e2e/package-lock.json +0 -4274
  146. package/e2e/package.json +0 -26
  147. package/e2e/playwright.config.ts +0 -77
  148. package/e2e/public/favicon.ico +0 -0
  149. package/e2e/public/index.html +0 -55
  150. package/e2e/tests/leaflet.spec.ts +0 -1040
  151. package/e2e/tests/setup.ts +0 -208
  152. package/e2e/webpack.config.js +0 -36
  153. /package/dist/{adapters/common → common}/adapter-listener.d.ts +0 -0
@@ -0,0 +1,6 @@
1
+ import { Position } from "geojson";
2
+ import { BehaviorConfig } from "../modes/base.behavior";
3
+ export declare const createStoreMidPoint: (config: BehaviorConfig, coordinates?: Position) => import("../extend").FeatureId;
4
+ export declare const createStorePoint: (config: BehaviorConfig, coordinates?: Position, selected?: boolean) => import("../extend").FeatureId;
5
+ export declare const createStorePolygon: (config: BehaviorConfig, coordinates?: Position[][], selected?: boolean, mode?: string) => import("../extend").FeatureId;
6
+ export declare const createStoreLineString: (config: BehaviorConfig, coordinates?: Position[], selected?: boolean) => import("../extend").FeatureId;
@@ -0,0 +1 @@
1
+ declare const uuidRegExp: RegExp;
@@ -0,0 +1,2 @@
1
+ import { BehaviorConfig } from "../modes/base.behavior";
2
+ export declare const MockBehaviorConfig: (mode: string, projection?: "web-mercator" | "globe") => BehaviorConfig;
@@ -0,0 +1,2 @@
1
+ import { TerraDrawCallbacks } from "../common";
2
+ export declare const MockCallbacks: (overrides?: Partial<TerraDrawCallbacks>) => TerraDrawCallbacks;
@@ -0,0 +1,6 @@
1
+ import { TerraDrawMouseEvent } from "../common";
2
+ export declare const MockCursorEvent: ({ lng, lat, button, }: {
3
+ lng: TerraDrawMouseEvent["lng"];
4
+ lat: TerraDrawMouseEvent["lat"];
5
+ button?: TerraDrawMouseEvent["button"];
6
+ }) => TerraDrawMouseEvent;
@@ -0,0 +1,4 @@
1
+ import { Feature, LineString, Point, Polygon } from "geojson";
2
+ export declare function MockPolygonSquare(id?: string, squareStart?: number, squareEnd?: number): Feature<Polygon>;
3
+ export declare function MockPoint(id?: string, lng?: number, lat?: number): Feature<Point>;
4
+ export declare function MockLineString(id?: string): Feature<LineString>;
@@ -0,0 +1,5 @@
1
+ import { TerraDrawKeyboardEvent } from "../common";
2
+ export declare const MockKeyboardEvent: ({ key, heldKeys, }: {
3
+ key: TerraDrawKeyboardEvent["key"];
4
+ heldKeys?: TerraDrawKeyboardEvent["heldKeys"];
5
+ }) => TerraDrawKeyboardEvent;
@@ -0,0 +1,21 @@
1
+ import { GeoJSONStore } from "../store/store";
2
+ export declare function MockModeConfig(mode: string): {
3
+ mode: string;
4
+ store: GeoJSONStore<import("../store/store").FeatureId>;
5
+ setCursor: jest.Mock<any, any, any>;
6
+ onChange: jest.Mock<any, any, any>;
7
+ onSelect: jest.Mock<any, any, any>;
8
+ onDeselect: jest.Mock<any, any, any>;
9
+ project: jest.Mock<{
10
+ x: number;
11
+ y: number;
12
+ }, [lng: any, lat: any], any>;
13
+ unproject: jest.Mock<{
14
+ lng: number;
15
+ lat: number;
16
+ }, [x: any, y: any], any>;
17
+ setDoubleClickToZoom: jest.Mock<any, any, any>;
18
+ onFinish: jest.Mock<any, any, any>;
19
+ coordinatePrecision: number;
20
+ projection: string;
21
+ };
@@ -0,0 +1 @@
1
+ export declare const MockPointerEvent: () => PointerEvent;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ export declare const ValidationReasons: {
2
+ ValidationReasonFeatureNotPoint: string;
3
+ ValidationReasonFeatureInvalidCoordinates: string;
4
+ ValidationReasonFeatureNotPolygon: string;
5
+ ValidationReasonFeatureHasHoles: string;
6
+ ValidationReasonFeatureLessThanFourCoordinates: string;
7
+ ValidationReasonFeatureHasInvalidCoordinates: string;
8
+ ValidationReasonFeatureCoordinatesNotClosed: string;
9
+ ValidationReasonFeatureNotPolygonOrLineString: string;
10
+ ValidationReasonFeatureSelfIntersects: string;
11
+ ValidationReasonFeatureLessThanMinSize: string;
12
+ ValidationReasonModeMismatch: string;
13
+ };
@@ -0,0 +1,2 @@
1
+ export declare const ValidationReasonFeatureNotPolygon = "Feature is not a Polygon";
2
+ export declare const ValidationReasonModeMismatch = "Feature mode property does not match the mode being added to";
@@ -1,2 +1,5 @@
1
+ import { Validation } from "../common";
1
2
  import { GeoJSONStoreFeatures } from "../terra-draw";
2
- export declare function ValidateLineStringFeature(feature: GeoJSONStoreFeatures, coordinatePrecision: number): boolean;
3
+ export declare const ValidationReasonFeatureIsNotALineString = "Feature is not a LineString";
4
+ export declare const ValidationReasonFeatureHasLessThanTwoCoordinates = "Feature has less than 2 coordinates";
5
+ export declare function ValidateLineStringFeature(feature: GeoJSONStoreFeatures, coordinatePrecision: number): ReturnType<Validation>;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,2 +1,4 @@
1
+ import { Validation } from "../common";
1
2
  import { GeoJSONStoreFeatures } from "../terra-draw";
2
- export declare const ValidateMaxAreaSquareMeters: (feature: GeoJSONStoreFeatures, maxSize: number) => boolean;
3
+ export declare const ValidationMaxAreaSquareMetersReason = "Feature is larger than the maximum area";
4
+ export declare const ValidateMaxAreaSquareMeters: (feature: GeoJSONStoreFeatures, maxSize: number) => ReturnType<Validation>;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,2 +1,4 @@
1
+ import { Validation } from "../common";
1
2
  import { GeoJSONStoreFeatures } from "../terra-draw";
2
- export declare const ValidateMinAreaSquareMeters: (feature: GeoJSONStoreFeatures, minSize: number) => boolean;
3
+ export declare const ValidationReasonFeatureLessThanMinSize = "Feature is smaller than the minimum area";
4
+ export declare const ValidateMinAreaSquareMeters: (feature: GeoJSONStoreFeatures, minSize: number) => ReturnType<Validation>;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,2 +1,5 @@
1
1
  import { GeoJSONStoreFeatures } from "../terra-draw";
2
- export declare const ValidateNotSelfIntersecting: (feature: GeoJSONStoreFeatures) => boolean;
2
+ import { Validation } from "../common";
3
+ export declare const ValidationReasonFeatureNotPolygonOrLineString = "Feature is not a Polygon or LineString";
4
+ export declare const ValidationReasonFeatureSelfIntersects = "Feature intersects itself";
5
+ export declare const ValidateNotSelfIntersecting: (feature: GeoJSONStoreFeatures) => ReturnType<Validation>;
@@ -1,2 +1,5 @@
1
+ import { Validation } from "../common";
1
2
  import { GeoJSONStoreFeatures } from "../terra-draw";
2
- export declare function ValidatePointFeature(feature: GeoJSONStoreFeatures, coordinatePrecision: number): boolean;
3
+ export declare const ValidationReasonFeatureNotPoint = "Feature is not a Point";
4
+ export declare const ValidationReasonFeatureInvalidCoordinates = "Feature has invalid coordinates";
5
+ export declare function ValidatePointFeature(feature: GeoJSONStoreFeatures, coordinatePrecision: number): ReturnType<Validation>;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,9 @@
1
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;
2
+ import { Validation } from "../common";
3
+ export declare const ValidationReasonFeatureNotPolygon = "Feature is not a Polygon";
4
+ export declare const ValidationReasonFeatureHasHoles = "Feature has holes";
5
+ export declare const ValidationReasonFeatureLessThanFourCoordinates = "Feature has less than 4 coordinates";
6
+ export declare const ValidationReasonFeatureHasInvalidCoordinates = "Feature has invalid coordinates";
7
+ export declare const ValidationReasonFeatureCoordinatesNotClosed = "Feature coordinates are not closed";
8
+ export declare function ValidatePolygonFeature(feature: GeoJSONStoreFeatures, coordinatePrecision: number): ReturnType<Validation>;
9
+ export declare function ValidateNonIntersectingPolygonFeature(feature: GeoJSONStoreFeatures, coordinatePrecision: number): ReturnType<Validation>;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,17 +1,8 @@
1
- console.log("===== Using @swc/jest ======");
1
+ const noCheckConfig = require("../../jest.nocheck.config");
2
2
 
3
3
  module.exports = {
4
- transform: {
5
- "^.+\\.(t|j)sx?$": "@swc/jest",
6
- },
7
- testPathIgnorePatterns: [
8
- "<rootDir>/node_modules/",
9
- "<rootDir>/e2e/",
10
- "<rootDir>/docs/",
11
- "<rootDir>/coverage/",
12
- "<rootDir>/scripts/",
13
- "<rootDir>/guides/",
14
- ],
15
- coveragePathIgnorePatterns: ["<rootDir>/src/test/", "<rootDir>/e2e/"],
16
- setupFilesAfterEnv: ["<rootDir>/src/test/jest.matchers.ts"],
4
+ ...noCheckConfig,
5
+ testPathIgnorePatterns: ["<rootDir>/dist"],
6
+ coveragePathIgnorePatterns: ["<rootDir>/src/test/", "<rootDir>/dist"],
7
+ collectCoverageFrom: ["./src/**"],
17
8
  };
package/package.json CHANGED
@@ -1,13 +1,10 @@
1
1
  {
2
2
  "name": "terra-draw",
3
- "version": "1.0.0-beta.8",
3
+ "version": "1.0.0",
4
4
  "description": "Frictionless map drawing across mapping provider",
5
5
  "scripts": {
6
- "docs": "typedoc",
7
- "docs:serve": "serve ./docs",
8
- "release:beta:increment": "standard-version --prerelease beta",
9
- "release:beta:changelog": "tsx ./scripts/changelog-valid.ts",
10
- "release:beta:next": "tsx ./scripts/next-beta-version.ts",
6
+ "release": "commit-and-tag-version .versionrc.cjs",
7
+ "release:dryrun": "commit-and-tag-version .versionrc.cjs -t terra-draw@ --dry-run",
11
8
  "build": "microbundle",
12
9
  "watch": "microbundle --watch --format modern",
13
10
  "unused": "knip",
@@ -15,13 +12,12 @@
15
12
  "test:coverage": "jest --config jest.config.ts --coverage",
16
13
  "test:nocheck": "jest --config jest.nocheck.config.ts",
17
14
  "test:nocheck:coverage": "jest --config jest.nocheck.config.ts --coverage",
18
- "lint": "eslint --ext .ts src/",
19
- "lint:quiet": "eslint --ext .ts --quiet src/",
20
- "lint:fix": "eslint --fix --ext .ts src/",
21
- "lint:fix:quiet": "eslint --fix --quiet --ext .ts src/",
15
+ "lint": "eslint src/",
16
+ "lint:quiet": "eslint --quiet src/",
17
+ "lint:fix": "eslint --fix src/",
18
+ "lint:fix:quiet": "eslint --fix --quiet src/",
22
19
  "format": "prettier --ignore-path .gitignore --write \"**/*.+(js|ts|json)\"",
23
- "format:quiet": "prettier --ignore-path .gitignore --write \"**/*.+(js|ts|json)\" --log-level=silent",
24
- "prepare": "husky install"
20
+ "format:quiet": "prettier --ignore-path .gitignore --write \"**/*.+(js|ts|json)\" --log-level=silent"
25
21
  },
26
22
  "type": "module",
27
23
  "source": "src/terra-draw.ts",
@@ -43,132 +39,11 @@
43
39
  "draw",
44
40
  "map drawing",
45
41
  "geometry",
42
+ "arcgis",
46
43
  "leaflet",
47
- "leafletjs",
48
- "mapbox",
49
- "mapboxgl",
50
- "google maps",
44
+ "maplibre",
51
45
  "openlayers",
52
- "maplibre"
46
+ "mapbox"
53
47
  ],
54
- "devDependencies": {
55
- "@arcgis/core": "4.27.6",
56
- "@commitlint/cli": "17.1.2",
57
- "@commitlint/config-conventional": "17.1.0",
58
- "@googlemaps/js-api-loader": "1.14.3",
59
- "@swc/jest": "0.2.36",
60
- "@types/geojson": "7946.0.8",
61
- "@types/google.maps": "3.49.2",
62
- "@types/jest": "29.5.12",
63
- "@types/leaflet": "^1.9.12",
64
- "@types/mapbox-gl": "2.7.3",
65
- "@types/rbush": "3.0.0",
66
- "@typescript-eslint/eslint-plugin": "7.14.1",
67
- "@typescript-eslint/parser": "7.14.1",
68
- "eslint": "8.57.0",
69
- "eslint-config-prettier": "9.0.0",
70
- "eslint-plugin-prettier": "5.0.0",
71
- "husky": "7.0.0",
72
- "jest": "29.7.0",
73
- "jest-environment-jsdom": "29.7.0",
74
- "knip": "^5.30.2",
75
- "leaflet": "^1.9.4",
76
- "mapbox-gl": "2.13.0",
77
- "maplibre-gl": "3.2.0",
78
- "microbundle": "0.15.0",
79
- "ol": "10.0.0",
80
- "serve": "14.1.2",
81
- "standard-version": "9.5.0",
82
- "ts-jest": "29.1.2",
83
- "ts-loader": "9.5.1",
84
- "tsx": "4.7.2",
85
- "typedoc": "^0.26.6",
86
- "typescript": "5.5.2"
87
- },
88
- "commitlint": {
89
- "extends": [
90
- "@commitlint/config-conventional"
91
- ]
92
- },
93
- "eslintConfig": {
94
- "parser": "@typescript-eslint/parser",
95
- "plugins": [
96
- "@typescript-eslint"
97
- ],
98
- "rules": {
99
- "@typescript-eslint/no-empty-function": "warn",
100
- "@typescript-eslint/no-explicit-any": "warn"
101
- },
102
- "extends": [
103
- "plugin:@typescript-eslint/recommended",
104
- "prettier"
105
- ]
106
- },
107
- "prettier": {
108
- "printWidth": 80,
109
- "semi": true,
110
- "useTabs": true
111
- },
112
- "standard-version": {
113
- "types": [
114
- {
115
- "type": "feat",
116
- "section": "Features"
117
- },
118
- {
119
- "type": "fix",
120
- "section": "Bug Fixes"
121
- },
122
- {
123
- "type": "docs",
124
- "section": "Documentation"
125
- },
126
- {
127
- "type": "style",
128
- "section": "Styling"
129
- },
130
- {
131
- "type": "refactor",
132
- "section": "Refactors"
133
- },
134
- {
135
- "type": "perf",
136
- "section": "Performance"
137
- },
138
- {
139
- "type": "test",
140
- "section": "Tests"
141
- },
142
- {
143
- "type": "build",
144
- "section": "Build System"
145
- },
146
- {
147
- "type": "ci",
148
- "section": "CI"
149
- },
150
- {
151
- "type": "chore",
152
- "section": "Chore"
153
- },
154
- {
155
- "type": "revert",
156
- "section": "Reverts"
157
- }
158
- ]
159
- },
160
- "sideEffects": false,
161
- "knip": {
162
- "$schema": "https://unpkg.com/knip@5/schema.json",
163
- "entry": [
164
- "src/terra-draw.ts"
165
- ],
166
- "project": [
167
- "src/**/*.ts"
168
- ],
169
- "include": [
170
- "files",
171
- "types"
172
- ]
173
- }
48
+ "sideEffects": false
174
49
  }
package/tsconfig.json CHANGED
@@ -1,28 +1,9 @@
1
1
  {
2
+ "extends": "./../../tsconfig.base.json",
3
+ "include": ["src"],
2
4
  "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
- "sourceLinkExternal": true
19
- },
20
- "exclude": [
21
- "node_modules/",
22
- "guides/",
23
- "docs/",
24
- "dist/",
25
- "development/dist",
26
- "development/node_modules"
27
- ]
5
+ "composite": true,
6
+ "outDir": "dist",
7
+ "rootDir": "src"
8
+ }
28
9
  }
@@ -1,8 +0,0 @@
1
- ARG NODE_MAJOR_VERSION
2
-
3
- FROM mcr.microsoft.com/devcontainers/javascript-node:${NODE_MAJOR_VERSION}
4
-
5
- ENV EDITOR="code -w" VISUAL="code -w" CHOKIDAR_USEPOLLING="1"
6
-
7
- # uncomment to install additional npm packages
8
- # RUN su node -c 'npm i -g cowsay@1.5.0'
@@ -1,27 +0,0 @@
1
- {
2
- "name": "terra-draw",
3
- "dockerFile": "Dockerfile",
4
- "build": {
5
- "args": {
6
- "NODE_MAJOR_VERSION": "20"
7
- }
8
- },
9
- "postCreateCommand": [".devcontainer/post-create.sh"],
10
- "portsAttributes": {
11
- "3000": {
12
- "label": "Docs"
13
- },
14
- "9000": {
15
- "label": "Development"
16
- }
17
- },
18
- "customizations": {
19
- "vscode": {
20
- "extensions": [
21
- "dbaeumer.vscode-eslint",
22
- "esbenp.prettier-vscode",
23
- "mikestead.dotenv"
24
- ]
25
- }
26
- }
27
- }
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- set -eo pipefail
4
-
5
- # when in a VS Code or GitHub Codespaces devcontainer
6
- if [ -n "${REMOTE_CONTAINERS}" ] || [ -n "${CODESPACES}" ]; then
7
- this_dir=$(cd -P -- "$(dirname -- "$(command -v -- "$0")")" && pwd -P)
8
- workspace_root=$(realpath ${this_dir}/..)
9
-
10
- # perform additional one-time setup just after
11
- # the devcontainer is created
12
- npm ci --prefix "${workspace_root}" # install lib node dependencies
13
- npm ci --prefix "${workspace_root}/development" # install dev node dependencies
14
- touch "${workspace_root}/development/.env" # ensure dev .env file exists
15
-
16
- fi
package/LICENSE DELETED
@@ -1,8 +0,0 @@
1
- Copyright 2022 James Milner
2
-
3
- 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:
4
-
5
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
-
7
- 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.
8
-
@@ -1,106 +0,0 @@
1
- import { SetCursor, TerraDrawCallbacks, TerraDrawChanges, TerraDrawStylingFunction } from "../common";
2
- import { BaseAdapterConfig, TerraDrawBaseAdapter } from "./common/base.adapter";
3
- import MapView from "@arcgis/core/views/MapView";
4
- import Point from "@arcgis/core/geometry/Point";
5
- import Polyline from "@arcgis/core/geometry/Polyline";
6
- import Polygon from "@arcgis/core/geometry/Polygon";
7
- import GraphicsLayer from "@arcgis/core/layers/GraphicsLayer";
8
- import Graphic from "@arcgis/core/Graphic";
9
- import SimpleMarkerSymbol from "@arcgis/core/symbols/SimpleMarkerSymbol";
10
- import SimpleLineSymbol from "@arcgis/core/symbols/SimpleLineSymbol";
11
- import SimpleFillSymbol from "@arcgis/core/symbols/SimpleFillSymbol";
12
- import Color from "@arcgis/core/Color";
13
- type InjectableArcGISMapsSDK = {
14
- GraphicsLayer: typeof GraphicsLayer;
15
- Point: typeof Point;
16
- Polyline: typeof Polyline;
17
- Polygon: typeof Polygon;
18
- SimpleLineSymbol: typeof SimpleLineSymbol;
19
- SimpleMarkerSymbol: typeof SimpleMarkerSymbol;
20
- SimpleFillSymbol: typeof SimpleFillSymbol;
21
- Graphic: typeof Graphic;
22
- Color: typeof Color;
23
- };
24
- export declare class TerraDrawArcGISMapsSDKAdapter extends TerraDrawBaseAdapter {
25
- private readonly _lib;
26
- private readonly _mapView;
27
- private readonly _container;
28
- private readonly _featureIdAttributeName;
29
- private readonly _featureLayerName;
30
- private readonly _featureLayer;
31
- private _dragEnabled;
32
- private _zoomEnabled;
33
- private _dragHandler;
34
- private _doubleClickHandler;
35
- constructor(config: {
36
- map: MapView;
37
- lib: InjectableArcGISMapsSDK;
38
- } & BaseAdapterConfig);
39
- register(callbacks: TerraDrawCallbacks): void;
40
- unregister(): void;
41
- getCoordinatePrecision(): number;
42
- /**
43
- * Returns the longitude and latitude coordinates from a given PointerEvent on the map.
44
- * @param event The PointerEvent or MouseEvent containing the screen coordinates of the pointer.
45
- * @returns An object with 'lng' and 'lat' properties representing the longitude and latitude, or null if the conversion is not possible.
46
- */
47
- getLngLatFromEvent(event: PointerEvent | MouseEvent): {
48
- lng: number;
49
- lat: number;
50
- };
51
- /**
52
- * Retrieves the HTML element of the ArcGIS element that handles interaction events
53
- * @returns The HTMLElement representing the map container.
54
- */
55
- getMapEventElement(): HTMLElement;
56
- /**
57
- * Enables or disables the draggable functionality of the map.
58
- * @param enabled Set to true to enable map dragging, or false to disable it.
59
- */
60
- setDraggability(enabled: boolean): void;
61
- /**
62
- * Converts longitude and latitude coordinates to pixel coordinates in the map container.
63
- * @param lng The longitude coordinate to project.
64
- * @param lat The latitude coordinate to project.
65
- * @returns An object with 'x' and 'y' properties representing the pixel coordinates within the map container.
66
- */
67
- project(lng: number, lat: number): {
68
- x: number;
69
- y: number;
70
- };
71
- /**
72
- * Converts pixel coordinates in the map container to longitude and latitude coordinates.
73
- * @param x The x-coordinate in the map container to unproject.
74
- * @param y The y-coordinate in the map container to unproject.
75
- * @returns An object with 'lng' and 'lat' properties representing the longitude and latitude coordinates.
76
- */
77
- unproject(x: number, y: number): {
78
- lng: number;
79
- lat: number;
80
- };
81
- /**
82
- * Sets the cursor style for the map container.
83
- * @param cursor The CSS cursor style to apply, or 'unset' to remove any previously applied cursor style.
84
- */
85
- setCursor(cursor: Parameters<SetCursor>[0]): void;
86
- /**
87
- * Enables or disables the double-click to zoom functionality on the map.
88
- * @param enabled Set to true to enable double-click to zoom, or false to disable it.
89
- */
90
- setDoubleClickToZoom(enabled: boolean): void;
91
- /**
92
- * Renders GeoJSON features on the map using the provided styling configuration.
93
- * @param changes An object containing arrays of created, updated, and unchanged features to render.
94
- * @param styling An object mapping draw modes to feature styling functions
95
- */
96
- render(changes: TerraDrawChanges, styling: TerraDrawStylingFunction): void;
97
- /**
98
- * Clears the map and store of all rendered data layers
99
- * @returns void
100
- * */
101
- clear(): void;
102
- private removeFeatureById;
103
- private addFeature;
104
- private getColorFromHex;
105
- }
106
- export {};