the editable site (validation-lab)

This commit is contained in:
kpgarrod committed 2026-11-21 08:03:55 +01:00
commit 3ac81d5a52
13454 files changed
+2227005

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
import { Position } from "geojson";
import { BehaviorConfig } from "../modes/base.behavior";
export declare const createStoreMidPoint: (config: BehaviorConfig, coordinates?: Position) => import("../extend").FeatureId;
export declare const createStorePoint: (config: BehaviorConfig, coordinates?: Position, selected?: boolean) => import("../extend").FeatureId;
export declare const createStorePolygon: (config: BehaviorConfig, coordinates?: Position[][], selected?: boolean, mode?: string) => import("../extend").FeatureId;
export declare const createStoreLineString: (config: BehaviorConfig, coordinates?: Position[], selected?: boolean) => import("../extend").FeatureId;
+3
View File
@@ -0,0 +1,3 @@
import { Projection } from "../common";
import { BehaviorConfig } from "../modes/base.behavior";
export declare const MockBehaviorConfig: (mode: string, projection?: Projection, coordinatePrecision?: number) => BehaviorConfig;
+7
View File
@@ -0,0 +1,7 @@
import { TerraDrawMouseEvent } from "../common";
export declare const MockCursorEvent: ({ lng, lat, button, isContextMenu, }: {
lng: TerraDrawMouseEvent["lng"];
lat: TerraDrawMouseEvent["lat"];
button?: TerraDrawMouseEvent["button"];
isContextMenu?: TerraDrawMouseEvent["isContextMenu"];
}) => TerraDrawMouseEvent;
+4
View File
@@ -0,0 +1,4 @@
import { Feature, LineString, Point, Polygon } from "geojson";
export declare function MockPolygonSquare(id?: string, squareStart?: number, squareEnd?: number): Feature<Polygon>;
export declare function MockPoint(id?: string, lng?: number, lat?: number): Feature<Point>;
export declare function MockLineString(id?: string): Feature<LineString>;
+5
View File
@@ -0,0 +1,5 @@
import { TerraDrawKeyboardEvent } from "../common";
export declare const MockKeyboardEvent: ({ key, heldKeys, }: {
key: TerraDrawKeyboardEvent["key"];
heldKeys?: TerraDrawKeyboardEvent["heldKeys"];
}) => TerraDrawKeyboardEvent;
+22
View File
@@ -0,0 +1,22 @@
import { TerraDrawOnChangeContext } from "../common";
import { GeoJSONStore } from "../store/store";
export declare function MockModeConfig(mode: string): {
mode: string;
store: GeoJSONStore<TerraDrawOnChangeContext | undefined, import("../store/store").FeatureId>;
setCursor: jest.Mock<any, any, any>;
onChange: jest.Mock<any, any, any>;
onSelect: jest.Mock<any, any, any>;
onDeselect: jest.Mock<any, any, any>;
project: jest.Mock<{
x: number;
y: number;
}, [lng: any, lat: any], any>;
unproject: jest.Mock<{
lng: number;
lat: number;
}, [x: any, y: any], any>;
setDoubleClickToZoom: jest.Mock<any, any, any>;
onFinish: jest.Mock<any, any, any>;
coordinatePrecision: number;
projection: string;
};
+44
View File
@@ -0,0 +1,44 @@
import { Project, Unproject, SetCursor, GetLngLatFromEvent, TerraDrawChanges, TerraDrawStylingFunction, TerraDrawAdapterStyling } from "../common";
import { TerraDrawBaseAdapter, CustomStyling, TerraDrawBaseDrawMode } from "../extend";
import { TerraDrawExtend, GeoJSONStoreFeatures, BehaviorConfig } from "../terra-draw";
/**
* A mock implementation of a custom adapter - this is to ensure that it is possible to write
* custom adapters for Terra Draw exclusively relying on the public API of the library.
*/
export declare class TerraDrawTestAdapter extends TerraDrawBaseAdapter {
constructor(config: {
lib: Record<string, unknown>;
} & TerraDrawExtend.BaseAdapterConfig);
getMapEventElement(): HTMLElement;
clear(): void;
project(lng: number, lat: number): ReturnType<Project>;
unproject(x: number, y: number): ReturnType<Unproject>;
setCursor(_: TerraDrawExtend.Cursor): ReturnType<SetCursor>;
getLngLatFromEvent(_: PointerEvent | MouseEvent): ReturnType<GetLngLatFromEvent>;
setDraggability(_: boolean): void;
setDoubleClickToZoom(_: boolean): void;
render(_1: TerraDrawChanges, _2: TerraDrawStylingFunction): void;
register(callbacks: TerraDrawExtend.TerraDrawCallbacks): void;
unregister(): void;
}
/**
* A mock implementation for a custom draw mode - this is to ensure that it is possible to write
* custom draw modes for Terra Draw exclusively relying on the public API of the library.
*/
interface TerraDrawTestModeOptions<T extends CustomStyling> extends TerraDrawExtend.BaseModeOptions<T> {
customProperty: string;
}
interface TestModeStyling extends CustomStyling {
fillColor: TerraDrawExtend.HexColorStyling;
outlineWidth: TerraDrawExtend.NumericStyling;
}
export declare class TerraDrawTestMode extends TerraDrawBaseDrawMode<TestModeStyling> {
private customProperty;
constructor(options?: TerraDrawTestModeOptions<TestModeStyling>);
styleFeature(_: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
registerBehaviors(_: BehaviorConfig): void;
start(): void;
stop(): void;
cleanUp(): void;
}
export {};