/** * Copyright (c) 2018-2026 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author David Sehnal * @author Alexander Rose */ import { List } from 'immutable'; import { Subscription } from 'rxjs'; import { Canvas3D, Canvas3DContext } from '../mol-canvas3d/canvas3d.js'; import { CustomProperty } from '../mol-model-props/common/custom-property.js'; import { Model, Structure } from '../mol-model/structure.js'; import { DataBuilder } from '../mol-plugin-state/builder/data.js'; import { StructureBuilder } from '../mol-plugin-state/builder/structure.js'; import { DataFormatRegistry } from '../mol-plugin-state/formats/registry.js'; import { StructureSelectionQueryRegistry } from '../mol-plugin-state/helpers/structure-selection-query.js'; import { PluginAnimationManager } from '../mol-plugin-state/manager/animation.js'; import { CameraManager } from '../mol-plugin-state/manager/camera.js'; import { InteractivityManager } from '../mol-plugin-state/manager/interactivity.js'; import { LociLabel, LociLabelManager } from '../mol-plugin-state/manager/loci-label.js'; import { PluginStateSnapshotManager } from '../mol-plugin-state/manager/snapshots.js'; import { StructureComponentManager } from '../mol-plugin-state/manager/structure/component.js'; import { StructureFocusManager } from '../mol-plugin-state/manager/structure/focus.js'; import { StructureHierarchyManager } from '../mol-plugin-state/manager/structure/hierarchy.js'; import { StructureHierarchyRef } from '../mol-plugin-state/manager/structure/hierarchy-state.js'; import { StructureMeasurementManager } from '../mol-plugin-state/manager/structure/measurement.js'; import { StructureSelectionManager } from '../mol-plugin-state/manager/structure/selection.js'; import { VolumeHierarchyManager } from '../mol-plugin-state/manager/volume/hierarchy.js'; import { MarkdownExtensionManager } from '../mol-plugin-state/manager/markdown-extensions.js'; import { LeftPanelTabName, PluginLayout } from './layout.js'; import { StructureRepresentationRegistry } from '../mol-repr/structure/registry.js'; import { VolumeRepresentationRegistry } from '../mol-repr/volume/registry.js'; import { RuntimeContext, Task } from '../mol-task/index.js'; import { ThemeRegistryContext } from '../mol-theme/theme.js'; import { AssetManager } from '../mol-util/assets.js'; import { ajaxGet } from '../mol-util/data-source.js'; import { KeyInput } from '../mol-util/input/input-observer.js'; import { LogEntry } from '../mol-util/log-entry.js'; import { PluginAnimationLoop } from './animation-loop.js'; import { PluginCommandManager } from './command.js'; import { PluginConfigManager } from './config.js'; import { PluginSpec } from './spec.js'; import { PluginState } from './state.js'; import { SubstructureParentHelper } from './util/substructure-parent-helper.js'; import { TaskManager } from './util/task-manager.js'; import { PluginToastManager } from './util/toast.js'; import { ViewportScreenshotHelper } from './util/viewport-screenshot.js'; import { DragAndDropManager } from '../mol-plugin-state/manager/drag-and-drop.js'; import { ErrorContext } from '../mol-util/error-context.js'; import { Volume } from '../mol-model/volume.js'; export type PluginInitializedState = { kind: 'no'; } | { kind: 'yes'; } | { kind: 'error'; error: any; }; export declare class PluginContext { spec: PluginSpec; runTask: (task: Task, params?: { useOverlay?: boolean; }) => Promise; resolveTask: (object: Task | T | undefined) => NonNullable | Promise | undefined; protected subs: Subscription[]; private initCanvas3dPromiseCallbacks; private _isInitialized; private initializedPromiseCallbacks; private disposed; private container; private ev; readonly config: PluginConfigManager; readonly state: PluginState; readonly commands: PluginCommandManager; private canvas3dInit; readonly behaviors: { readonly state: { readonly isAnimating: import("rxjs").BehaviorSubject; readonly isUpdating: import("rxjs").BehaviorSubject; readonly isBusy: import("rxjs").BehaviorSubject; }; readonly interaction: { readonly hover: import("rxjs").BehaviorSubject; readonly click: import("rxjs").BehaviorSubject; readonly drag: import("rxjs").BehaviorSubject; readonly key: import("rxjs").BehaviorSubject; readonly keyReleased: import("rxjs").BehaviorSubject; readonly selectionMode: import("rxjs").BehaviorSubject; }; readonly labels: { readonly highlight: import("rxjs").BehaviorSubject<{ labels: ReadonlyArray; }>; }; readonly layout: { readonly leftPanelTabName: import("rxjs").BehaviorSubject; }; readonly canvas3d: { readonly initialized: import("rxjs").Observable; }; }; readonly canvas3dInitialized: Promise; readonly initialized: Promise; get isInitialized(): boolean; readonly canvas3dContext: Canvas3DContext | undefined; readonly canvas3d: Canvas3D | undefined; readonly layout: PluginLayout; readonly animationLoop: PluginAnimationLoop; readonly representation: { readonly structure: { readonly registry: StructureRepresentationRegistry; readonly themes: ThemeRegistryContext; }; readonly volume: { readonly registry: VolumeRepresentationRegistry; readonly themes: ThemeRegistryContext; }; }; readonly query: { readonly structure: { readonly registry: StructureSelectionQueryRegistry; }; }; readonly dataFormats: DataFormatRegistry; readonly builders: { data: DataBuilder; structure: StructureBuilder; }; build(): import("../mol-state/index.js").StateBuilder.Root; readonly helpers: { readonly substructureParent: SubstructureParentHelper; readonly viewportScreenshot: ViewportScreenshotHelper | undefined; }; readonly managers: { readonly structure: { readonly hierarchy: StructureHierarchyManager; readonly component: StructureComponentManager; readonly measurement: StructureMeasurementManager; readonly selection: StructureSelectionManager; readonly focus: StructureFocusManager; }; readonly volume: { readonly hierarchy: VolumeHierarchyManager; }; readonly interactivity: InteractivityManager; readonly camera: CameraManager; readonly animation: PluginAnimationManager; readonly snapshot: PluginStateSnapshotManager; readonly lociLabels: LociLabelManager; readonly toast: PluginToastManager; readonly asset: AssetManager; readonly task: TaskManager; readonly markdownExtensions: MarkdownExtensionManager; readonly dragAndDrop: DragAndDropManager; }; readonly events: { readonly log: import("rxjs").Subject; readonly task: { progress: import("rxjs").Subject; finished: import("rxjs").Subject<{ id: number; }>; }; readonly canvas3d: { readonly settingsUpdated: import("rxjs").Subject; }; }; readonly customModelProperties: CustomProperty.Registry; readonly customStructureProperties: CustomProperty.Registry; readonly customVolumeProperties: CustomProperty.Registry; readonly customStructureControls: Map any>; readonly customImportControls: Map any>; readonly genericRepresentationControls: Map [StructureHierarchyRef[], string]>; /** * A helper for collecting and notifying errors * in async contexts such as custom properties. * * Individual extensions are responsible for using this * context and displaying the errors in appropriate ways. */ readonly errorContext: ErrorContext; /** * Used to store application specific custom state which is then available * to State Actions and similar constructs via the PluginContext. */ readonly customState: unknown; initViewerAsync(canvas: HTMLCanvasElement, container: HTMLDivElement, canvas3dContext?: Canvas3DContext): Promise; initContainerAsync(options?: { canvas3dContext?: Canvas3DContext; checkeredCanvasBackground?: boolean; }): Promise; mountAsync(target: HTMLElement, initOptions?: { canvas3dContext?: Canvas3DContext; checkeredCanvasBackground?: boolean; }): Promise; private _initContainer; /** * Mount the plugin into the target element (assumes the target has "relative"-like positioninig). * If initContainer wasn't called separately before, initOptions will be passed to it. */ private _mount; unmount(): void; private _initViewer; handleResize: () => void; readonly log: { entries: List; entry: (e: LogEntry) => void; error: (msg: string) => void; message: (msg: string) => void; info: (msg: string) => void; warn: (msg: string) => void; }; /** * This should be used in all transform related request so that it could be "spoofed" to allow * "static" access to resources. */ readonly fetch: typeof ajaxGet; /** return true is animating or updating */ get isBusy(): boolean; get selectionMode(): boolean; set selectionMode(mode: boolean); dataTransaction(f: (ctx: RuntimeContext) => Promise | void, options?: { canUndo?: string | boolean; rethrowErrors?: boolean; }): Promise; clear(resetViewportSettings?: boolean): Promise; dispose(options?: { doNotForceWebGLContextLoss?: boolean; doNotDisposeCanvas3DContext?: boolean; }): void; private initBehaviorEvents; private initBuiltInBehavior; private initBehaviors; private initCustomFormats; private initAnimations; private initDataActions; init(): Promise; constructor(spec: PluginSpec); }