@vertigis/viewer-spec
Version:
VertiGIS Viewer Specification
146 lines (145 loc) • 4.11 kB
TypeScript
import type { EntityProperties } from "@vertigis/arcgis-extensions/Entity";
import type { Command } from "../Command.js";
import { CommandRegistry } from "../CommandRegistry.js";
import type { Event } from "../Event.js";
import { EventRegistry } from "../EventRegistry.js";
import type { Operation } from "../Operation.js";
import { OperationRegistry } from "../OperationRegistry.js";
import type { Model } from "../common.js";
export declare class ViewerCommands extends CommandRegistry {
protected readonly _prefix = "viewer";
/**
* Loads a new layout. Can be a layout URL or layout XML, or a Layout
* object. Web only.
*
* @webOnly
*/
get loadLayout(): Command<string | Model>;
/**
* Writes the operation context object to the console or log viewer at the
* debug level.
*/
get logDebug(): Command<unknown>;
/**
* Post a message to the parent frame of the viewer. Web only.
*
* @webOnly
*/
get postMessage(): Command<unknown>;
/**
* Publish an event with specified parameters "name" and "arguments". This
* command supports sending custom events (i.e. you use your own namespaced
* eventname) as well as built-in events. Mobile only.
*
* @mobileOnly
*/
get publishEvent(): Command<PublishEventArgs>;
/**
* Turn the debug mode of the viewer on or off. This can also be done using
* the debug=true URL parameter. Web only.
*
* @webOnly
*/
get setDebugMode(): Command<boolean>;
}
export declare class ViewerEvents extends EventRegistry {
protected readonly _prefix = "viewer";
/**
* Raised when the viewer finishes loading a layout. Web only.
*
* @webOnly
*/
get layoutChanged(): Event;
}
export declare class ViewerOperations extends OperationRegistry {
protected readonly _prefix = "viewer";
/**
* Gets all Layout models from the application. Web only.
*
* @webOnly
*/
get getAllLayouts(): Operation<void, Model[]>;
/**
* Gets the current Layout model from the application. Web only.
*
* @webOnly
*/
get getCurrentLayout(): Operation<void, Model>;
/**
* Gets information about the current viewer instance. Web only.
*
* @webOnly
*/
get getCapabilities(): Operation<void, ViewerCapabilities>;
/**
* Get whether the viewer is in debug mode. Web only.
*
* @webOnly
*/
get getInDebugMode(): Operation<void, boolean>;
/**
* Gets the version of the viewer. (i.e. the current version of web). Web
* only.
*
* @webOnly
*/
get getVersion(): Operation<void, string>;
/**
* Post a message to the parent frame of the viewer and await the reply. Web
* only.
*
* @webOnly
*/
get postMessageAwaitReply(): Operation<unknown, unknown>;
}
/**
* Arguments for the 'viewer.publish-event' command.
*/
export interface PublishEventArgs {
/**
* The name of the event to be published.
*/
name: string;
/**
* The event arguments to be used when publishing the event.
*/
arguments: EntityProperties;
}
/**
* An orientation for the layout.
*/
export type Orientation = "portrait" | "landscape";
/**
* Result of the "viewer.get-capabilities" operation.
*/
export interface ViewerCapabilities {
/**
* The height of the viewer's host element in pixels.
*/
height: number;
/**
* The width of the viewer's host element in pixels.
*/
width: number;
/**
* The aspect ratio of the viewer's host element (width / height).
*/
aspectRatio: number;
/**
* The orientation of the viewer's host element. The orientation is portrait
* if height >= width.
*/
orientation: Orientation;
/**
* Whether the device supports touch.
*/
supportsTouch: boolean;
/**
* Whether the device supports a pointer (e.g. mouse).
*/
supportsPointer: boolean;
/**
* Whether the device supports hover.
*/
supportsHover: boolean;
}