/** * Map commands over `postMessage` (doc 28 G6): a page that shows a map lets its host (an assistant panel, an * iframe parent) drive it, and tells the host what happens on the map. Only listed origins are heard; every run * is the runtime's `execute`, so it is checked whole and audited with its origin. * * host → map { kind: 'map-engine/command', id, version: 1, commands, origin? } * map → host { kind: 'map-engine/result', id, result } * map → host { kind: 'map-engine/event', event, payload } (the events the bridge forwards) */ import { type CommandResult, type MapCommand } from '../core/commands.js'; import type { MapRuntime, MapRuntimeEvents } from '../runtime/types.js'; export interface PostMessageBridgeOptions { /** Origins allowed to send commands and to receive events. Required: there is no "any origin". */ allowedOrigins: string[]; /** Where to listen. Default: `window`. */ listenOn?: Pick; /** Runtime events forwarded to the allowed host(s). Default: selection, proposal, annotation, command. */ forward?: Array; /** Where forwarded events go (e.g. `window.parent`). Default: the window that last sent a command. */ host?: Pick; } /** Starts the bridge; returns a function that stops it. */ export declare function createPostMessageBridge(runtime: MapRuntime, options: PostMessageBridgeOptions): () => void; /** The host side: send commands to a map in another window or frame and wait for the answer. */ export declare function connectToMap(mapWindow: Pick, mapOrigin: string, options?: { listenOn?: Pick; origin?: string; timeoutMs?: number; }): { execute(commands: MapCommand | MapCommand[]): Promise; close(): void; };