terra-draw
Advanced tools
Comparing version 0.0.1-alpha.51 to 0.0.1-alpha.53
@@ -36,2 +36,8 @@ import { Project, Unproject, TerraDrawCallbacks, TerraDrawChanges, TerraDrawMouseEvent, SetCursor, TerraDrawStylingFunction, GetLngLatFromEvent } from "../../common"; | ||
register(callbacks: TerraDrawCallbacks): void; | ||
/** | ||
* Gets the coordinate precision. | ||
* @returns {number} The coordinate precision. | ||
* @description The coordinate precision is the number of decimal places. Note that the precision will be overriden by the precision of the TerraDraw Adapter. | ||
*/ | ||
getCoordinatePrecision(): number; | ||
private getAdapterListeners; | ||
@@ -38,0 +44,0 @@ /** |
@@ -59,2 +59,3 @@ import { StoreChangeHandler, GeoJSONStore, GeoJSONStoreFeatures } from "./store/store"; | ||
unproject: Unproject; | ||
coordinatePrecision: number; | ||
} | ||
@@ -93,2 +94,3 @@ export type TerraDrawModeState = "unregistered" | "registered" | "started" | "drawing" | "selecting" | "stopped"; | ||
clear(): void; | ||
getCoordinatePrecision(): number; | ||
} | ||
@@ -95,0 +97,0 @@ export declare const SELECT_PROPERTIES: { |
import { BehaviorConfig, TerraDrawModeBehavior } from "./base.behavior"; | ||
import { HexColor, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, TerraDrawModeRegisterConfig, TerraDrawModeState, TerraDrawMouseEvent } from "../common"; | ||
import { GeoJSONStore, GeoJSONStoreFeatures, StoreChangeHandler } from "../store/store"; | ||
type CustomStyling = Record<string, string | number | ((feature: GeoJSONStoreFeatures) => HexColor) | ((feature: GeoJSONStoreFeatures) => number)>; | ||
export type CustomStyling = Record<string, string | number | ((feature: GeoJSONStoreFeatures) => HexColor) | ((feature: GeoJSONStoreFeatures) => number)>; | ||
export declare enum ModeTypes { | ||
@@ -11,2 +11,6 @@ Drawing = "drawing", | ||
} | ||
export type BaseModeOptions<T extends CustomStyling> = { | ||
styles?: Partial<T>; | ||
pointerDistance?: number; | ||
}; | ||
export declare abstract class TerraDrawBaseDrawMode<T extends CustomStyling> { | ||
@@ -29,7 +33,3 @@ protected _state: TerraDrawModeState; | ||
protected registerBehaviors(behaviorConfig: BehaviorConfig): void; | ||
constructor(options?: { | ||
styles?: Partial<T>; | ||
pointerDistance?: number; | ||
coordinatePrecision?: number; | ||
}); | ||
constructor(options?: BaseModeOptions<T>); | ||
type: ModeTypes; | ||
@@ -60,2 +60,1 @@ mode: string; | ||
} | ||
export {}; |
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling, Cursor } from "../../common"; | ||
import { GeoJSONStoreFeatures } from "../../store/store"; | ||
import { TerraDrawBaseDrawMode } from "../base.mode"; | ||
import { BaseModeOptions, CustomStyling, TerraDrawBaseDrawMode } from "../base.mode"; | ||
type TerraDrawCircleModeKeyEvents = { | ||
@@ -17,2 +17,6 @@ cancel: KeyboardEvent["key"] | null; | ||
} | ||
interface TerraDrawCircleModeOptions<T extends CustomStyling> extends BaseModeOptions<T> { | ||
keyEvents?: TerraDrawCircleModeKeyEvents | null; | ||
cursors?: Cursors; | ||
} | ||
export declare class TerraDrawCircleMode extends TerraDrawBaseDrawMode<CirclePolygonStyling> { | ||
@@ -25,7 +29,3 @@ mode: string; | ||
private cursors; | ||
constructor(options?: { | ||
styles?: Partial<CirclePolygonStyling>; | ||
keyEvents?: TerraDrawCircleModeKeyEvents | null; | ||
cursors?: Cursors; | ||
}); | ||
constructor(options?: TerraDrawCircleModeOptions<CirclePolygonStyling>); | ||
private close; | ||
@@ -55,3 +55,4 @@ /** @internal */ | ||
validateFeature(feature: unknown): feature is GeoJSONStoreFeatures; | ||
private createCircle; | ||
} | ||
export {}; |
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling, Cursor } from "../../common"; | ||
import { TerraDrawBaseDrawMode } from "../base.mode"; | ||
import { BaseModeOptions, CustomStyling, TerraDrawBaseDrawMode } from "../base.mode"; | ||
import { GeoJSONStoreFeatures } from "../../store/store"; | ||
@@ -22,2 +22,8 @@ type TerraDrawFreehandModeKeyEvents = { | ||
} | ||
interface TerraDrawFreehandModeOptions<T extends CustomStyling> extends BaseModeOptions<T> { | ||
minDistance?: number; | ||
preventPointsNearClose?: boolean; | ||
keyEvents?: TerraDrawFreehandModeKeyEvents | null; | ||
cursors?: Cursors; | ||
} | ||
export declare class TerraDrawFreehandMode extends TerraDrawBaseDrawMode<FreehandPolygonStyling> { | ||
@@ -32,9 +38,3 @@ mode: string; | ||
private preventPointsNearClose; | ||
constructor(options?: { | ||
styles?: Partial<FreehandPolygonStyling>; | ||
minDistance?: number; | ||
preventPointsNearClose?: boolean; | ||
keyEvents?: TerraDrawFreehandModeKeyEvents | null; | ||
cursors?: Cursors; | ||
}); | ||
constructor(options?: TerraDrawFreehandModeOptions<FreehandPolygonStyling>); | ||
private close; | ||
@@ -41,0 +41,0 @@ /** @internal */ |
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling, Cursor } from "../../common"; | ||
import { TerraDrawBaseDrawMode } from "../base.mode"; | ||
import { BaseModeOptions, CustomStyling, TerraDrawBaseDrawMode } from "../base.mode"; | ||
import { BehaviorConfig } from "../base.behavior"; | ||
@@ -21,2 +21,8 @@ import { GeoJSONStoreFeatures } from "../../store/store"; | ||
} | ||
interface TerraDrawGreatCircleModeOptions<T extends CustomStyling> extends BaseModeOptions<T> { | ||
snapping?: boolean; | ||
pointerDistance?: number; | ||
keyEvents?: TerraDrawGreateCircleModeKeyEvents | null; | ||
cursors?: Cursors; | ||
} | ||
export declare class TerraDrawGreatCircleMode extends TerraDrawBaseDrawMode<GreateCircleStyling> { | ||
@@ -31,9 +37,3 @@ mode: string; | ||
private snapping; | ||
constructor(options?: { | ||
snapping?: boolean; | ||
pointerDistance?: number; | ||
styles?: Partial<GreateCircleStyling>; | ||
keyEvents?: TerraDrawGreateCircleModeKeyEvents | null; | ||
cursors?: Cursors; | ||
}); | ||
constructor(options?: TerraDrawGreatCircleModeOptions<GreateCircleStyling>); | ||
private close; | ||
@@ -40,0 +40,0 @@ /** @internal */ |
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling, Cursor } from "../../common"; | ||
import { TerraDrawBaseDrawMode } from "../base.mode"; | ||
import { BaseModeOptions, CustomStyling, TerraDrawBaseDrawMode } from "../base.mode"; | ||
import { BehaviorConfig } from "../base.behavior"; | ||
@@ -21,2 +21,9 @@ import { GeoJSONStoreFeatures } from "../../store/store"; | ||
} | ||
interface TerraDrawLineStringModeOptions<T extends CustomStyling> extends BaseModeOptions<T> { | ||
snapping?: boolean; | ||
allowSelfIntersections?: boolean; | ||
pointerDistance?: number; | ||
keyEvents?: TerraDrawLineStringModeKeyEvents | null; | ||
cursors?: Cursors; | ||
} | ||
export declare class TerraDrawLineStringMode extends TerraDrawBaseDrawMode<LineStringStyling> { | ||
@@ -33,10 +40,3 @@ mode: string; | ||
private snapping; | ||
constructor(options?: { | ||
snapping?: boolean; | ||
allowSelfIntersections?: boolean; | ||
pointerDistance?: number; | ||
styles?: Partial<LineStringStyling>; | ||
keyEvents?: TerraDrawLineStringModeKeyEvents | null; | ||
cursors?: Cursors; | ||
}); | ||
constructor(options?: TerraDrawLineStringModeOptions<LineStringStyling>); | ||
private close; | ||
@@ -43,0 +43,0 @@ /** @internal */ |
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, NumericStyling, HexColorStyling, Cursor } from "../../common"; | ||
import { GeoJSONStoreFeatures } from "../../store/store"; | ||
import { TerraDrawBaseDrawMode } from "../base.mode"; | ||
import { BaseModeOptions, CustomStyling, TerraDrawBaseDrawMode } from "../base.mode"; | ||
type PointModeStyling = { | ||
@@ -13,9 +13,9 @@ pointWidth: NumericStyling; | ||
} | ||
interface TerraDrawPointModeOptions<T extends CustomStyling> extends BaseModeOptions<T> { | ||
cursors?: Cursors; | ||
} | ||
export declare class TerraDrawPointMode extends TerraDrawBaseDrawMode<PointModeStyling> { | ||
mode: string; | ||
private cursors; | ||
constructor(options?: { | ||
styles?: Partial<PointModeStyling>; | ||
cursors?: Cursors; | ||
}); | ||
constructor(options?: TerraDrawPointModeOptions<PointModeStyling>); | ||
/** @internal */ | ||
@@ -22,0 +22,0 @@ start(): void; |
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling, Cursor } from "../../common"; | ||
import { TerraDrawBaseDrawMode } from "../base.mode"; | ||
import { TerraDrawBaseDrawMode, BaseModeOptions, CustomStyling } from "../base.mode"; | ||
import { BehaviorConfig } from "../base.behavior"; | ||
@@ -23,2 +23,9 @@ import { GeoJSONStoreFeatures } from "../../store/store"; | ||
} | ||
interface TerraDrawPolygonModeOptions<T extends CustomStyling> extends BaseModeOptions<T> { | ||
allowSelfIntersections?: boolean; | ||
snapping?: boolean; | ||
pointerDistance?: number; | ||
keyEvents?: TerraDrawPolygonModeKeyEvents | null; | ||
cursors?: Cursors; | ||
} | ||
export declare class TerraDrawPolygonMode extends TerraDrawBaseDrawMode<PolygonStyling> { | ||
@@ -36,10 +43,3 @@ mode: string; | ||
private mouseMove; | ||
constructor(options?: { | ||
allowSelfIntersections?: boolean; | ||
snapping?: boolean; | ||
pointerDistance?: number; | ||
styles?: Partial<PolygonStyling>; | ||
keyEvents?: TerraDrawPolygonModeKeyEvents | null; | ||
cursors?: Cursors; | ||
}); | ||
constructor(options?: TerraDrawPolygonModeOptions<PolygonStyling>); | ||
private close; | ||
@@ -46,0 +46,0 @@ /** @internal */ |
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling, Cursor } from "../../common"; | ||
import { GeoJSONStoreFeatures } from "../../store/store"; | ||
import { TerraDrawBaseDrawMode } from "../base.mode"; | ||
import { BaseModeOptions, CustomStyling, TerraDrawBaseDrawMode } from "../base.mode"; | ||
type TerraDrawRectangleModeKeyEvents = { | ||
@@ -17,2 +17,6 @@ cancel: KeyboardEvent["key"] | null; | ||
} | ||
interface TerraDrawRectangleModeOptions<T extends CustomStyling> extends BaseModeOptions<T> { | ||
keyEvents?: TerraDrawRectangleModeKeyEvents | null; | ||
cursors?: Cursors; | ||
} | ||
export declare class TerraDrawRectangleMode extends TerraDrawBaseDrawMode<RectanglePolygonStyling> { | ||
@@ -25,7 +29,3 @@ mode: string; | ||
private cursors; | ||
constructor(options?: { | ||
styles?: Partial<RectanglePolygonStyling>; | ||
keyEvents?: TerraDrawRectangleModeKeyEvents | null; | ||
cursors?: Cursors; | ||
}); | ||
constructor(options?: TerraDrawRectangleModeOptions<RectanglePolygonStyling>); | ||
private updateRectangle; | ||
@@ -32,0 +32,0 @@ private close; |
import { HexColorStyling, NumericStyling, TerraDrawAdapterStyling } from "../../common"; | ||
import { ModeTypes, TerraDrawBaseDrawMode } from "../base.mode"; | ||
import { BaseModeOptions, CustomStyling, ModeTypes, TerraDrawBaseDrawMode } from "../base.mode"; | ||
import { BehaviorConfig } from "../base.behavior"; | ||
@@ -18,9 +18,10 @@ import { GeoJSONStoreFeatures } from "../../terra-draw"; | ||
}; | ||
interface TerraDrawRenderModeOptions<T extends CustomStyling> extends BaseModeOptions<T> { | ||
modeName: string; | ||
styles: Partial<T>; | ||
} | ||
export declare class TerraDrawRenderMode extends TerraDrawBaseDrawMode<RenderModeStyling> { | ||
type: ModeTypes; | ||
mode: string; | ||
constructor(options: { | ||
modeName: string; | ||
styles: Partial<RenderModeStyling>; | ||
}); | ||
constructor(options: TerraDrawRenderModeOptions<RenderModeStyling>); | ||
/** @internal */ | ||
@@ -27,0 +28,0 @@ registerBehaviors(behaviorConfig: BehaviorConfig): void; |
import { TerraDrawMouseEvent, TerraDrawKeyboardEvent, TerraDrawAdapterStyling, HexColorStyling, NumericStyling, Cursor } from "../../common"; | ||
import { ModeTypes, TerraDrawBaseDrawMode } from "../base.mode"; | ||
import { BaseModeOptions, CustomStyling, ModeTypes, TerraDrawBaseDrawMode } from "../base.mode"; | ||
import { BehaviorConfig } from "../base.behavior"; | ||
@@ -50,2 +50,11 @@ import { GeoJSONStoreFeatures } from "../../store/store"; | ||
} | ||
interface TerraDrawSelectModeOptions<T extends CustomStyling> extends BaseModeOptions<T> { | ||
pointerDistance?: number; | ||
flags?: { | ||
[mode: string]: ModeFlags; | ||
}; | ||
keyEvents?: TerraDrawSelectModeKeyEvents | null; | ||
dragEventThrottle?: number; | ||
cursors?: Cursors; | ||
} | ||
export declare class TerraDrawSelectMode extends TerraDrawBaseDrawMode<SelectionStyling> { | ||
@@ -69,12 +78,3 @@ type: ModeTypes; | ||
private cursors; | ||
constructor(options?: { | ||
styles?: Partial<SelectionStyling>; | ||
pointerDistance?: number; | ||
flags?: { | ||
[mode: string]: ModeFlags; | ||
}; | ||
keyEvents?: TerraDrawSelectModeKeyEvents | null; | ||
dragEventThrottle?: number; | ||
cursors?: Cursors; | ||
}); | ||
constructor(options?: TerraDrawSelectModeOptions<SelectionStyling>); | ||
setSelecting(): void; | ||
@@ -81,0 +81,0 @@ registerBehaviors(config: BehaviorConfig): void; |
@@ -6,2 +6,3 @@ import { TerraDrawGoogleMapsAdapter } from "./adapters/google-maps.adapter"; | ||
import { TerraDrawOpenLayersAdapter } from "./adapters/openlayers.adapter"; | ||
import { TerraDrawArcGISMapsSDKAdapter } from "./adapters/arcgis-maps-sdk.adapter"; | ||
import { TerraDrawAdapter, TerraDrawAdapterStyling, GetLngLatFromEvent, Project, SetCursor, TerraDrawChanges, TerraDrawStylingFunction, Unproject, HexColor, TerraDrawKeyboardEvent, TerraDrawMouseEvent } from "./common"; | ||
@@ -184,2 +185,2 @@ import { TerraDrawBaseAdapter } from "./adapters/common/base.adapter"; | ||
}; | ||
export { TerraDraw, TerraDrawSelectMode, TerraDrawPointMode, TerraDrawLineStringMode, TerraDrawGreatCircleMode, TerraDrawPolygonMode, TerraDrawCircleMode, TerraDrawFreehandMode, TerraDrawRenderMode, TerraDrawRectangleMode, TerraDrawGoogleMapsAdapter, TerraDrawMapboxGLAdapter, TerraDrawLeafletAdapter, TerraDrawMapLibreGLAdapter, TerraDrawOpenLayersAdapter, TerraDrawExtend, BehaviorConfig, GeoJSONStoreFeatures, HexColor, TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, TerraDrawChanges, TerraDrawStylingFunction, Project, Unproject, SetCursor, GetLngLatFromEvent, }; | ||
export { TerraDraw, TerraDrawSelectMode, TerraDrawPointMode, TerraDrawLineStringMode, TerraDrawGreatCircleMode, TerraDrawPolygonMode, TerraDrawCircleMode, TerraDrawFreehandMode, TerraDrawRenderMode, TerraDrawRectangleMode, TerraDrawGoogleMapsAdapter, TerraDrawMapboxGLAdapter, TerraDrawLeafletAdapter, TerraDrawMapLibreGLAdapter, TerraDrawOpenLayersAdapter, TerraDrawArcGISMapsSDKAdapter, TerraDrawExtend, BehaviorConfig, GeoJSONStoreFeatures, HexColor, TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, TerraDrawChanges, TerraDrawStylingFunction, Project, Unproject, SetCursor, GetLngLatFromEvent, }; |
@@ -7,4 +7,12 @@ console.log("===== Using @swc/jest ======"); | ||
}, | ||
coveragePathIgnorePatterns: ["<rootDir>/src/test/"], | ||
testPathIgnorePatterns: [ | ||
"<rootDir>/node_modules/", | ||
"<rootDir>/e2e/", | ||
"<rootDir>/docs/", | ||
"<rootDir>/coverage/", | ||
"<rootDir>/scripts/", | ||
"<rootDir>/guides/", | ||
], | ||
coveragePathIgnorePatterns: ["<rootDir>/src/test/", "<rootDir>/e2e/"], | ||
setupFilesAfterEnv: ["<rootDir>/src/test/jest.matchers.ts"], | ||
}; |
{ | ||
"name": "terra-draw", | ||
"version": "0.0.1-alpha.51", | ||
"version": "0.0.1-alpha.53", | ||
"description": "Frictionless map drawing across mapping provider", | ||
@@ -9,3 +9,4 @@ "scripts": { | ||
"release": "standard-version", | ||
"release:alpha:next": "ts-node --esm ./scripts/next-alpha-version.ts", | ||
"release:alpha:changelog": "tsx ./scripts/changelog-valid.ts", | ||
"release:alpha:next": "tsx ./scripts/next-alpha-version.ts", | ||
"build": "microbundle", | ||
@@ -82,3 +83,3 @@ "watch": "microbundle --watch --format modern", | ||
"ts-loader": "^9.4.2", | ||
"ts-node": "^10.9.1", | ||
"tsx": "^4.7.0", | ||
"typedoc": "^0.25.1", | ||
@@ -85,0 +86,0 @@ "typescript": "^5.2.2" |
@@ -25,7 +25,7 @@ <img src="./logo.png" alt="Terra Draw Logo" width="400"/> | ||
Please see the [the getting started guide](./guides/GETTING_STARTED.md) - this provides a host of information on how to get up and running with Terra Draw. You may also find some useful pointers for things you may be finding yourself wanting to do in the [common patterns guide](./guides/COMMON_PATTERNS.md). | ||
Please see the [the getting started guide](./guides/1.GETTING_STARTED.md) - this provides a host of information on how to get up and running with Terra Draw. | ||
### Development | ||
Please see the [the development documentation](./guides/DEVELOPMENT.md) | ||
Please see the [the development documentation](./guides/6.DEVELOPMENT.md) | ||
@@ -32,0 +32,0 @@ ### Contributing |
@@ -18,6 +18,3 @@ { | ||
"skipErrorChecking": true | ||
// "compilerOptions": { | ||
// "skipLibCheck": true | ||
// } | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3907897
92
8242