/** * `FakeAdapter` — an in-memory {@link MapAdapter} for unit-testing a controller * without a real map. It records overlays and replays pointer events. Both * `sigmet-draw` and `sigwx-draw` build their `controller.test.ts` on top of it. */ import type { FeatureCollection, Feature } from "geojson"; import type { HighlightStyle, KeyEvent, LatLng, LngLatBounds, MapAdapter, MarkerWidget, PointerEvent, ProjectionSpec, SnapshotOptions, SymbolSprites, ToolbarItem, ToolbarOptions, TooltipStyle, WidgetEdit } from "./index.js"; export declare class FakeAdapter implements MapAdapter { private centre; snapshotSupported: boolean; overlays: Record; tooltip: { text: string | null; at: LatLng; style?: TooltipStyle; } | undefined; cursor: string; panEnabled: boolean; doubleClickZoom: boolean; interactive: boolean; cb?: (e: PointerEvent) => void; keyCb?: (e: KeyEvent) => void; blurCb?: () => void; viewCb?: () => void; widgets: MarkerWidget[]; widgetEditCb?: (e: WidgetEdit) => void; widgetDeleteCb?: (e: { id: string; }) => void; widgetActionCb?: (e: { id: string; event: string; }) => void; coordFormat?: (ll: LatLng) => string; overlayVisible: Record; fittedBounds?: LngLatBounds; container?: HTMLElement; constructor(centre?: LatLng); ready(): Promise; registerSymbols(_: SymbolSprites): Promise; setOverlay(id: string, d: FeatureCollection): void; setOverlayVisible(id: string, visible: boolean): void; snapshot(_?: SnapshotOptions): Promise; setTooltip(text: string | null, at: LatLng, style?: TooltipStyle): void; addToolbar(_items: ToolbarItem[], _options?: ToolbarOptions): HTMLElement; /** Last `setActiveTool` argument (records the consumer-driven active-tool calls). */ activeTool: string | null; setActiveTool(id: string | null): void; getCenter(): LatLng; getViewSpan(): number; getBounds(): LngLatBounds; getZoom(): number; getContainer(): HTMLElement; fitBounds(bbox: LngLatBounds): void; /** Last `setProjection` argument. */ projection: ProjectionSpec; setProjection(projection: ProjectionSpec): void; /** Last `viewArea` request (extent + opts). */ viewedArea: { extent: LngLatBounds; opts?: { padding?: number; duration?: number; }; } | undefined; viewArea(extent: LngLatBounds, opts?: { padding?: number; duration?: number; }): void; /** Last `highlightArea` extent (`null` once cleared) + its style. */ highlightedArea: LngLatBounds | null; highlightStyle: HighlightStyle | undefined; highlightArea(extent: LngLatBounds | null, style?: HighlightStyle): void; project(_: LatLng): [number, number]; unproject(_: [number, number]): LatLng; onViewChange(cb: () => void): void; setPanEnabled(enabled: boolean): void; setDoubleClickZoom(enabled: boolean): void; setInteractive(enabled: boolean): void; setCursor(cursor: string): void; onPointer(cb: (e: PointerEvent) => void): void; onKey(cb: (e: KeyEvent) => void): void; onBlur(cb: () => void): void; setWidgets(widgets: MarkerWidget[]): void; onWidgetEdit(cb: (e: WidgetEdit) => void): void; onWidgetDelete(cb: (e: { id: string; }) => void): void; onWidgetAction(cb: (e: { id: string; event: string; }) => void): void; setCoordFormat(fn: (ll: LatLng) => string): void; destroy(): void; /** Replay a pointer event, optionally over an overlay hit and with held modifiers * (default all false) — e.g. `send("move", 1, 2, undefined, undefined, { ctrlKey: true })` * to test a modifier-gated drag. */ send(type: PointerEvent["type"], lat: number, lon: number, overlay?: string, props?: Record, mods?: Partial>): void; /** Find a pushed feature in `overlay` by its `role` prop. */ feature(overlay: string, role: string): Feature | undefined; /** Replay a key event (e.g. `key("Backspace", { meta: true })`). */ key(key: string, mods?: Partial>): void; /** Simulate the window losing focus ⇒ fires the `onBlur` callback. */ blur(): void; /** Simulate a change in an editable widget control ⇒ fires `onWidgetEdit({ id, name?, value })` * (a keystroke in an input, or a picker choice when `name` is given). */ editWidget(id: string, value: string, name?: string): void; /** Simulate dragging a gauge/dial cursor `name` to `value` ⇒ fires * `onWidgetEdit({ id, name, value: String(value) })` (the value is emitted as a string). */ dragGauge(id: string, name: string, value: number): void; /** Simulate a click on a widget's delete button ⇒ fires `onWidgetDelete({ id })`. */ deleteWidget(id: string): void; /** Simulate a click on a widget action button ⇒ fires `onWidgetAction({ id, event })`. */ actionWidget(id: string, event: string): void; /** Find a declared widget by `id` (the full set last passed to `setWidgets`). */ widget(id: string): MarkerWidget | undefined; /** Surface a card click through `onPointer` as a `{ overlay: "widget", props: { id } }` hit * (the same shape the engine adapters emit) — sugar over `send("click", …, "widget", { id })`. */ clickWidget(id: string, lat?: number, lon?: number): void; } //# sourceMappingURL=testing.d.ts.map