terra-draw 0.0.1-alpha.30 → 0.0.1-alpha.32
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.
- package/CHANGELOG.md +24 -0
- package/dist/common.d.ts +1 -0
- package/dist/geometry/boolean/is-valid-coordinate.d.ts +4 -0
- package/dist/geometry/boolean/is-valid-linestring-feature.d.ts +2 -0
- package/dist/geometry/boolean/is-valid-point.d.ts +2 -0
- package/dist/geometry/boolean/is-valid-polygon-feature.d.ts +3 -0
- package/dist/modes/base.mode.d.ts +2 -0
- package/dist/modes/circle/circle.mode.d.ts +1 -0
- package/dist/modes/freehand/freehand.mode.d.ts +1 -0
- package/dist/modes/greatcircle/great-circle.mode.d.ts +1 -0
- package/dist/modes/linestring/linestring.mode.d.ts +1 -0
- package/dist/modes/point/point.mode.d.ts +1 -0
- package/dist/modes/polygon/polygon.mode.d.ts +1 -0
- package/dist/modes/rectangle/rectangle.mode.d.ts +2 -0
- package/dist/modes/render/render.mode.d.ts +2 -0
- package/dist/store/store-feature-validation.d.ts +15 -0
- package/dist/store/store.d.ts +1 -3
- package/dist/terra-draw.cjs +1 -1
- package/dist/terra-draw.cjs.map +1 -1
- package/dist/terra-draw.d.ts +12 -1
- package/dist/terra-draw.modern.js +1 -1
- package/dist/terra-draw.modern.js.map +1 -1
- package/dist/terra-draw.module.js +1 -1
- package/dist/terra-draw.module.js.map +1 -1
- package/dist/terra-draw.umd.js +1 -1
- package/dist/terra-draw.umd.js.map +1 -1
- package/guides/GETTING_STARTED.md +41 -0
- package/package.json +1 -1
- package/scratch/release.sh +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.0.1-alpha.32](https://github.com/JamesLMilner/terra-draw/compare/v0.0.1-alpha.31...v0.0.1-alpha.32) (2023-06-04)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* add the addFeatures method to allow adding of external data ([b6e0043](https://github.com/JamesLMilner/terra-draw/commit/b6e004377f1baff78e01f9324413469677f2df5b))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Chore
|
|
14
|
+
|
|
15
|
+
* update docs ([36997cc](https://github.com/JamesLMilner/terra-draw/commit/36997cc7c7071af1af1a27ad457cab0361f3e5e9))
|
|
16
|
+
|
|
17
|
+
### [0.0.1-alpha.31](https://github.com/JamesLMilner/terra-draw/compare/v0.0.1-alpha.30...v0.0.1-alpha.31) (2023-05-22)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* add onFinish event to terra draw ([fb36988](https://github.com/JamesLMilner/terra-draw/commit/fb36988ce3e291f4198e38a455d385eb40db326b))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Chore
|
|
26
|
+
|
|
27
|
+
* update docs ([ed78e25](https://github.com/JamesLMilner/terra-draw/commit/ed78e2575b789429f08a4c0b96041bdf4deed5b9))
|
|
28
|
+
|
|
5
29
|
### [0.0.1-alpha.30](https://github.com/JamesLMilner/terra-draw/compare/v0.0.1-alpha.29...v0.0.1-alpha.30) (2023-05-21)
|
|
6
30
|
|
|
7
31
|
|
package/dist/common.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ export interface TerraDrawModeRegisterConfig {
|
|
|
45
45
|
onChange: StoreChangeHandler;
|
|
46
46
|
onSelect: (selectedId: string) => void;
|
|
47
47
|
onDeselect: (deselectedId: string) => void;
|
|
48
|
+
onFinish: (finishedId: string) => void;
|
|
48
49
|
project: Project;
|
|
49
50
|
unproject: Unproject;
|
|
50
51
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function validLatitude(lat: number): boolean;
|
|
2
|
+
export declare function validLongitude(lng: number): boolean;
|
|
3
|
+
export declare function coordinateIsValid(coordinate: unknown[], coordinatePrecision: number): boolean;
|
|
4
|
+
export declare function getDecimalPlaces(value: number): number;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { GeoJSONStoreFeatures } from "../../terra-draw";
|
|
2
|
+
export declare function isValidPolygonFeature(feature: GeoJSONStoreFeatures, coordinatePrecision: number): boolean;
|
|
3
|
+
export declare function isValidNonIntersectingPolygonFeature(feature: GeoJSONStoreFeatures, coordinatePrecision: number): boolean;
|
|
@@ -29,10 +29,12 @@ export declare abstract class TerraDrawBaseDrawMode<T extends CustomStyling> {
|
|
|
29
29
|
protected setStarted(): void;
|
|
30
30
|
protected setStopped(): void;
|
|
31
31
|
register(config: TerraDrawModeRegisterConfig): void;
|
|
32
|
+
validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
|
|
32
33
|
abstract start(): void;
|
|
33
34
|
abstract stop(): void;
|
|
34
35
|
abstract cleanUp(): void;
|
|
35
36
|
abstract styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
37
|
+
onFinish(finishedId: string): void;
|
|
36
38
|
onDeselect(deselectedId: string): void;
|
|
37
39
|
onSelect(selectedId: string): void;
|
|
38
40
|
onKeyDown(event: TerraDrawKeyboardEvent): void;
|
|
@@ -44,5 +44,6 @@ export declare class TerraDrawCircleMode extends TerraDrawBaseDrawMode<FreehandP
|
|
|
44
44
|
cleanUp(): void;
|
|
45
45
|
/** @internal */
|
|
46
46
|
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
47
|
+
validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
|
|
47
48
|
}
|
|
48
49
|
export {};
|
|
@@ -50,5 +50,6 @@ export declare class TerraDrawFreehandMode extends TerraDrawBaseDrawMode<Freehan
|
|
|
50
50
|
cleanUp(): void;
|
|
51
51
|
/** @internal */
|
|
52
52
|
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
53
|
+
validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
|
|
53
54
|
}
|
|
54
55
|
export {};
|
|
@@ -53,5 +53,6 @@ export declare class TerraDrawGreatCircleMode extends TerraDrawBaseDrawMode<Grea
|
|
|
53
53
|
cleanUp(): void;
|
|
54
54
|
/** @internal */
|
|
55
55
|
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
56
|
+
validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
|
|
56
57
|
}
|
|
57
58
|
export {};
|
|
@@ -56,5 +56,6 @@ export declare class TerraDrawLineStringMode extends TerraDrawBaseDrawMode<LineS
|
|
|
56
56
|
cleanUp(): void;
|
|
57
57
|
/** @internal */
|
|
58
58
|
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
59
|
+
validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
|
|
59
60
|
}
|
|
60
61
|
export {};
|
|
@@ -34,5 +34,6 @@ export declare class TerraDrawPointMode extends TerraDrawBaseDrawMode<PointModeS
|
|
|
34
34
|
onDragEnd(): void;
|
|
35
35
|
/** @internal */
|
|
36
36
|
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
37
|
+
validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
|
|
37
38
|
}
|
|
38
39
|
export {};
|
|
@@ -59,5 +59,6 @@ export declare class TerraDrawPolygonMode extends TerraDrawBaseDrawMode<PolygonS
|
|
|
59
59
|
cleanUp(): void;
|
|
60
60
|
/** @internal */
|
|
61
61
|
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
62
|
+
validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
|
|
62
63
|
}
|
|
63
64
|
export {};
|
|
@@ -21,6 +21,7 @@ export declare class TerraDrawRectangleMode extends TerraDrawBaseDrawMode<Rectan
|
|
|
21
21
|
styles?: Partial<RectanglePolygonStyling>;
|
|
22
22
|
keyEvents?: TerraDrawRectangleModeKeyEvents | null;
|
|
23
23
|
});
|
|
24
|
+
private updateRectangle;
|
|
24
25
|
private close;
|
|
25
26
|
/** @internal */
|
|
26
27
|
start(): void;
|
|
@@ -44,5 +45,6 @@ export declare class TerraDrawRectangleMode extends TerraDrawBaseDrawMode<Rectan
|
|
|
44
45
|
cleanUp(): void;
|
|
45
46
|
/** @internal */
|
|
46
47
|
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
48
|
+
validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
|
|
47
49
|
}
|
|
48
50
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { TerraDrawAdapterStyling } from "../../common";
|
|
2
2
|
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
3
|
import { BehaviorConfig } from "../base.behavior";
|
|
4
|
+
import { GeoJSONStoreFeatures } from "../../terra-draw";
|
|
4
5
|
type RenderModeStylingExt<T extends TerraDrawAdapterStyling> = {};
|
|
5
6
|
type RenderModeStyling = RenderModeStylingExt<TerraDrawAdapterStyling>;
|
|
6
7
|
export declare class TerraDrawRenderMode extends TerraDrawBaseDrawMode<RenderModeStyling> {
|
|
@@ -32,5 +33,6 @@ export declare class TerraDrawRenderMode extends TerraDrawBaseDrawMode<RenderMod
|
|
|
32
33
|
cleanUp(): void;
|
|
33
34
|
/** @internal */
|
|
34
35
|
styleFeature(): TerraDrawAdapterStyling;
|
|
36
|
+
validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
|
|
35
37
|
}
|
|
36
38
|
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { GeoJSONStoreFeatures } from "./store";
|
|
2
|
+
export declare const StoreValidationErrors: {
|
|
3
|
+
readonly FeatureHasNoId: "Feature has no id";
|
|
4
|
+
readonly FeatureIsNotObject: "Feature is not object";
|
|
5
|
+
readonly InvalidTrackedProperties: "updatedAt and createdAt are not valid timestamps";
|
|
6
|
+
readonly FeatureHasNoMode: "Feature does not have a set mode";
|
|
7
|
+
readonly FeatureIdIsNotUUID4: "Feature must have UUID4 id";
|
|
8
|
+
readonly FeatureHasNoGeometry: "Feature has no geometry";
|
|
9
|
+
readonly FeatureHasNoProperties: "Feature has no properties";
|
|
10
|
+
readonly FeatureGeometryNotSupported: "Feature is not Point, LineString or Polygon";
|
|
11
|
+
readonly FeatureCoordinatesNotAnArray: "Feature coordinates is not an array";
|
|
12
|
+
readonly InvalidModeProperty: "Feature does not have a valid mode property";
|
|
13
|
+
};
|
|
14
|
+
export declare function isValidTimestamp(timestamp: unknown): boolean;
|
|
15
|
+
export declare function isValidStoreFeature(feature: unknown): feature is GeoJSONStoreFeatures;
|
package/dist/store/store.d.ts
CHANGED
|
@@ -11,9 +11,7 @@ export type GeoJSONStoreFeatures = Feature<GeoJSONStoreGeometries, DefinedProper
|
|
|
11
11
|
export type StoreChangeEvents = "delete" | "create" | "update" | "styling";
|
|
12
12
|
export type StoreChangeHandler = (ids: string[], change: StoreChangeEvents) => void;
|
|
13
13
|
export type GeoJSONStoreConfig = {
|
|
14
|
-
data?: GeoJSONStoreFeatures[];
|
|
15
14
|
tracked?: boolean;
|
|
16
|
-
validateFeature?: (feature: unknown, tracked?: boolean) => void;
|
|
17
15
|
};
|
|
18
16
|
export declare class GeoJSONStore {
|
|
19
17
|
constructor(config?: GeoJSONStoreConfig);
|
|
@@ -24,7 +22,7 @@ export declare class GeoJSONStore {
|
|
|
24
22
|
private getId;
|
|
25
23
|
private clone;
|
|
26
24
|
has(id: string): boolean;
|
|
27
|
-
load(data: GeoJSONStoreFeatures[], featureValidation?: (feature: unknown, tracked?: boolean) =>
|
|
25
|
+
load(data: GeoJSONStoreFeatures[], featureValidation?: (feature: unknown, tracked?: boolean) => boolean): void;
|
|
28
26
|
search(bbox: BBoxPolygon, filter?: (feature: GeoJSONStoreFeatures) => boolean): GeoJSONStoreFeatures[];
|
|
29
27
|
registerOnChange(onChange: StoreChangeHandler): void;
|
|
30
28
|
getGeometryCopy<T extends GeoJSONStoreGeometries>(id: string): T;
|