import { Mutable } from 'apprt-core/Mutable'; import Basemap from '@arcgis/core/Basemap'; /** * Documentation for the members of {@link BasemapsModel}. */ interface BasemapsModelMembers { /** The view currently used for the view */ viewMode?: "2D" | "3D" | undefined; /** * Id of selected basemap item. */ selectedId: string | undefined; /** * Getter for the selected basemap item. */ readonly selected: BasemapItem | undefined; /** * Array of basemap items filtered by conditions. * Currently the condition is the view mode. * @returns {BasemapItem[]} The filtered basemaps. */ get filteredBasemaps(): BasemapItem[]; /** * Array of basemap items. */ get basemaps(): BasemapItem[]; /** * Setter for the basemap items array. */ set basemaps(value: (BasemapItem | BasemapItemProps)[]); /** * Object lookup for style classes. */ styleLookup: Record | undefined; /** * Adds the basemap item to the basemaps array. */ add(item: BasemapItem | BasemapItemProps): BasemapsModel; /** * Removes basemap item from the basemaps array. */ remove(item: Pick): BasemapsModel; /** * Removes the basemap item with the given `id` from the basemaps array. */ removeById(id: string): BasemapsModel; /** * Removes all basemap items and selectedId state. */ clear(): BasemapsModel; /** * Returns `true` if basemaps are empty. */ isEmpty(): boolean; /** * Finds the first item with the given id. */ findItemById(id: string): BasemapItem | undefined; /** * Finds the first item referencing the given Basemap. */ findItemByBasemap(basemap: Basemap): BasemapItem | undefined; } /** * The `BasemapsModel` contains a list of BasemapItems. */ type BasemapsModel = Mutable; /** * Documentation for the members of {@link BasemapItem}. */ interface BasemapItemMembers { /** * A basemap item needs an id. */ id: string; /** * The title of the item. */ title: string | undefined; /** * The description of the item. */ description: string | undefined; /** * The esri.Basemap instance. */ basemap: Basemap | undefined; /** * An optional thumbnail url. */ thumbnailUrl: string | undefined; /** * Restricts this basemap to a view mode. If not set, basemaps applies to all view modes. */ viewmode: "2D" | "3D" | undefined; } /** * Represents a basemap in the {@link BasemapsModel}. */ type BasemapItem = Mutable; type BasemapItemProps = Partial; /** * Registers {@link BasemapsModel | BasemapsModels} with the system. * * Use `"map-basemaps-api.BasemapsModelRegistration"` to inject an instance of this service. */ interface BasemapModelRegistration { /** * Registers a given BasemapsModel with the system. */ register(options: { basemaps: BasemapsModel; }): void; /** * Unregister the BasemapsModel instance. */ unregister(keepInstances?: boolean): void; } export type { BasemapItem, BasemapItemMembers, BasemapItemProps, BasemapModelRegistration, BasemapsModel, BasemapsModelMembers };