import { MapWidgetModel } from 'map-widget/api'; import { TocItem } from './Item.js'; import '@arcgis/core/layers/Layer'; import '@arcgis/core/layers/support/Sublayer'; import '@arcgis/core/layers/support/WMSSublayer'; import '@arcgis/core/Map'; /** * A state checker can add additional messages (such as warnings) * to an item displayed by the TOC. * * A custom StateChecker has to be registered as `toc.StateChecker`. */ interface StateChecker { /** * This method is called if the viewpoint of the map changes * or a layer is added/loaded. */ checkState(options: CheckStateOptions): CheckStateResult | Promise; } /** * Options passed to a {@link StateChecker}. */ interface CheckStateOptions { tocItem: TocItem; mapWidgetModel: MapWidgetModel; } /** * Result returned by a {@link StateChecker}. */ type CheckStateResult = void | undefined | CheckStateMessages; /** * Messages produced by a {@link StateChecker}. */ interface CheckStateMessages { /** Info messages. */ infos?: string[]; /** Warning messages. */ warnings?: string[]; /** Error messages. */ errors?: string[]; } export type { CheckStateMessages, CheckStateOptions, CheckStateResult, StateChecker };