import type { BackstageItem, FrontstageProvider, IModelViewportControlOptions, StandardFrontstageProps, UiItemsProvider } from "@itwin/appui-react"; import type { Cartographic, ColorDef, EcefLocationProps, RenderMode } from "@itwin/core-common"; import type { ExtensionProvider, IModelAppOptions, IModelConnection, ScreenViewport, ViewChangeOptions, ViewCreator3dOptions, ViewState } from "@itwin/core-frontend"; import type { Range3dProps, Vector3d, XAndY, XYAndZ } from "@itwin/core-geometry"; import type { PresentationProps } from "@itwin/presentation-frontend"; import type { computeSelection, SelectionStorage } from "@itwin/unified-selection"; export type Without = { [P in Exclude]?: never; }; export type XOR = T1 | T2 extends Record ? (Without & T2) | (Without & T1) : T1 | T2; type AllOrNone = T | { [K in keyof T]?: never; }; /** * Converts the following optional arg foo of type T * foo?: T * to a required arg with union of type T and undefined * foo: T | undefined */ export type OptionalToUndefinedUnion = { [P in keyof Required]: T[P] | undefined; }; /** * options for configuration of 3D view */ export interface ViewerViewCreator3dOptions extends ViewCreator3dOptions { /** optional function to configure the viewport on load */ viewportConfigurer?: (viewport: ScreenViewport) => void; } export interface ViewerFrontstage { /** frontstage provider to register */ provider: FrontstageProvider; /** should this be the default frontstage? If multiple are defined as default, the last will be used */ default?: boolean; /** the frontstage requires an iModel connection */ requiresIModelConnection?: boolean; } export type ViewerBackstageItem = BackstageItem & { labeli18nKey?: string; }; export interface ViewerViewportControlOptions extends Omit { /** ViewState or a function to return a ViewState */ viewState?: ViewState | ((iModelConnection: IModelConnection) => ViewState) | ((iModelConnection: IModelConnection) => Promise); } export interface UnifiedSelectionProps { /** Unified selection storage to synchronize viewport selection with. */ selectionStorage: SelectionStorage; } export declare function isUnifiedSelectionProps(props: AllOrNone | undefined): props is UnifiedSelectionProps; export interface SelectionScopesProps { /** A map of available selection scopes. The key is the scope id and the value is the scope label and definition. */ available: { [scopeId: string]: { label: string; def: Parameters[0]["scope"]; }; }; /** Id of the active selection scope. An element with this id must exist in `available` map. */ active: string; /** * A callback that's invoked when active scope changes. It's guaranteed that `id` is a key of one of entries * in `available` map. * * When this callback is not supplied, the `active` scope works as the initial value, and the actually * active scope is managed internally. When it is supplied, it's consumer's responsibility to update the * `active` scope based on the callback's input. */ onChange?: (id: string) => void; } export type LoaderProps = AllOrNone & { /** Default UI configuration */ defaultUiConfig?: ViewerDefaultFrontstageConfig; /** Optional callback function when iModel is connected */ onIModelConnected?: ((iModel: IModelConnection) => void) | ((iModel: IModelConnection) => Promise); /** additional frontstages to register */ frontstages?: ViewerFrontstage[]; /** additional viewport options for the default frontstage's viewport control */ viewportOptions?: ViewerViewportControlOptions; /** [UI Providers](https://www.itwinjs.org/learning/ui/abstract/uiitemsprovider/) to register. Should be memoized. */ uiProviders?: UiItemsProvider[]; /** options for creating the default viewState */ viewCreatorOptions?: ViewerViewCreator3dOptions; /** Component to show when loading iModel key */ loadingComponent?: React.ReactNode; /** Props for managing selection scopes. When not supplied, `Presentation.selection.scopes` is used. */ selectionScopes?: SelectionScopesProps; }; export type ViewerCommonProps = ViewerInitializerParams & LoaderProps; export type ViewerIModelAppOptions = Pick; export interface ViewerInitializerParams extends ViewerIModelAppOptions { /** * Enable reporting data from timed events in the iTwin Viewer. * The data is anonymous numerics and will help to increase Viewer performance in future releases. * See the [Web](https://www.npmjs.com/package/@itwin/web-viewer-react) or * [Desktop](https://www.npmjs.com/package/@itwin/desktop-viewer-react) Viewer package READMEs for additional details. */ enablePerformanceMonitors: boolean; /** GPRID for the consuming application. Will default to the iTwin Viewer GPRID */ productId?: string; /** urlTemplate for querying i18n json files */ i18nUrlTemplate?: string; /** callback after iModelApp is initialized */ onIModelAppInit?: () => void; /** additional i18n namespaces to register */ additionalI18nNamespaces?: string[]; /** array of iTwin.js Extensions */ extensions?: ExtensionProvider[]; /** Props for presentation initialization */ presentationProps?: PresentationProps; } export type RequiredViewerProps = XOR, BlankViewerProps>; export type ModelLoaderProps = Partial & LoaderProps; export type ViewerProps = RequiredViewerProps & ViewerCommonProps; export type ViewerLoaderProps = RequiredViewerProps & LoaderProps; export type ConnectedViewerProps = { iTwinId: string; iModelId: string; changeSetId?: string; }; export type FileViewerProps = { /** Path to local snapshot or briefcase */ filePath: string; /** @alpha If false, open the briefcase in write mode; defaults to true */ readonly?: boolean; }; export type BlankViewerProps = { blankConnectionViewState?: BlankConnectionViewState; location?: Cartographic | EcefLocationProps; extents?: Range3dProps; iTwinId?: string; }; export declare const iTwinViewerInitializerParamList: string[]; /** * Blank connection ViewState types */ export interface BlankConnectionViewStateLookAt { eyePoint: XYAndZ; targetPoint: XYAndZ; upVector: Vector3d; newExtents?: XAndY; frontDistance?: number; backDistance?: number; opts?: ViewChangeOptions; } export interface BlankConnectionViewStateDisplayStyle { backgroundColor?: ColorDef; } export interface BlankConnectionViewStateViewFlags { grid?: boolean; renderMode?: RenderMode; backgroundMap?: boolean; } export interface BlankConnectionViewState { setAllow3dManipulations?: boolean; lookAt?: BlankConnectionViewStateLookAt; displayStyle?: BlankConnectionViewStateDisplayStyle; viewFlags?: BlankConnectionViewStateViewFlags; } /** * Defines what items to include from the default status bar. If any items are * specified then only those items will be added to statusbar. */ export interface ViewerDefaultStatusbarItems { messageCenter?: boolean; preToolAssistanceSeparator?: boolean; toolAssistance?: boolean; postToolAssistanceSeparator?: boolean; accuSnapModePicker?: boolean; tileLoadIndicator?: boolean; selectionScope?: boolean; selectionInfo?: boolean; } export type ViewerDefaultFrontstageConfig = Pick; export {}; //# sourceMappingURL=types.d.ts.map