/** * Copyright (c) 2018-2025 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author Alexander Rose * @author David Sehnal */ import { ParamDefinition as PD } from '../mol-util/param-definition.js'; import { WebGLContext } from '../mol-gl/webgl/context.js'; import { ColorTheme } from '../mol-theme/color.js'; import { SizeTheme } from '../mol-theme/size.js'; import { ThemeRegistryContext, Theme } from '../mol-theme/theme.js'; import { Subject } from 'rxjs'; import { GraphicsRenderObject } from '../mol-gl/render-object.js'; import { Task } from '../mol-task/index.js'; import { PickingId } from '../mol-geo/geometry/picking.js'; import { MarkerAction, MarkerActions } from '../mol-util/marker-action.js'; import { Loci as ModelLoci } from '../mol-model/loci.js'; import { Overpaint } from '../mol-theme/overpaint.js'; import { Transparency } from '../mol-theme/transparency.js'; import { Mat4 } from '../mol-math/linear-algebra.js'; import { LocationCallback } from './util.js'; import { BaseGeometry } from '../mol-geo/geometry/base.js'; import { CustomProperty } from '../mol-model-props/common/custom-property.js'; import { Clipping } from '../mol-theme/clipping.js'; import { Substance } from '../mol-theme/substance.js'; import { Emissive } from '../mol-theme/emissive.js'; import { Location } from '../mol-model/location.js'; export type RepresentationProps = { [k: string]: any; }; export interface RepresentationContext { readonly webgl?: WebGLContext; readonly colorThemeRegistry: ColorTheme.Registry; readonly sizeThemeRegistry: SizeTheme.Registry; } export type RepresentationParamsGetter = (ctx: ThemeRegistryContext, data: D) => P; export type RepresentationFactory = (ctx: RepresentationContext, getParams: RepresentationParamsGetter) => Representation; export interface RepresentationProvider { readonly name: Id; readonly label: string; readonly description: string; readonly factory: RepresentationFactory; readonly getParams: RepresentationParamsGetter; readonly defaultValues: PD.Values

; readonly defaultColorTheme: { name: string; props?: {}; }; readonly defaultSizeTheme: { name: string; props?: {}; }; readonly isApplicable: (data: D) => boolean; readonly ensureCustomProperties?: { attach: (ctx: CustomProperty.Context, data: D) => Promise; detach: (data: D) => void; }; readonly getData?: (data: D, props: PD.Values

) => D; readonly mustRecreate?: (oldProps: PD.Values

, newProps: PD.Values

) => boolean; readonly locationKinds?: ReadonlyArray; } export declare namespace RepresentationProvider { type ParamValues> = R extends RepresentationProvider ? PD.Values

: never; function getDefaultParams, D>(r: R, ctx: ThemeRegistryContext, data: D): PD.Values; } export type AnyRepresentationProvider = RepresentationProvider; export declare const EmptyRepresentationProvider: RepresentationProvider; export declare class RepresentationRegistry { private _list; private _map; private _name; get default(): { name: string; provider: RepresentationProvider; }; get types(): [string, string][]; constructor(); add

(provider: RepresentationProvider): void; getName(provider: RepresentationProvider): string; remove(provider: RepresentationProvider): void; get

(name: string): RepresentationProvider; get list(): { name: string; provider: RepresentationProvider; }[]; getApplicableList(data: D): { name: string; provider: RepresentationProvider; }[]; getApplicableTypes(data: D): [string, string][]; clear(): void; } export { Representation }; interface Representation { readonly label: string; readonly updated: Subject; /** Number of addressable groups in all visuals of the representation */ readonly groupCount: number; readonly renderObjects: ReadonlyArray; readonly geometryVersion: number; readonly props: Readonly>; readonly params: Readonly

; readonly state: Readonly; readonly theme: Readonly; createOrUpdate: (props?: Partial>, data?: D) => Task; setState: (state: Partial) => void; setTheme: (theme: Theme) => void; getLoci: (pickingId: PickingId) => ModelLoci; getAllLoci: () => ModelLoci[]; eachLocation: (cb: LocationCallback) => void; mark: (loci: ModelLoci, action: MarkerAction) => boolean; destroy: () => void; } declare namespace Representation { interface Loci { loci: T; repr?: Representation.Any; } namespace Loci { function areEqual(a: Loci, b: Loci): boolean; function isEmpty(a: Loci): boolean; const Empty: Loci; } interface State { /** Controls if the representation's renderobjects are rendered or not */ visible: boolean; /** A factor applied to alpha value of the representation's renderobjects */ alphaFactor: number; /** Controls if the representation's renderobjects are pickable or not */ pickable: boolean; /** Controls if the representation's renderobjects is rendered in color pass (i.e., not pick and depth) or not */ colorOnly: boolean; /** Overpaint applied to the representation's renderobjects */ overpaint: Overpaint; /** Per group transparency applied to the representation's renderobjects */ transparency: Transparency; /** Per group emissive applied to the representation's renderobjects */ emissive: Emissive; /** Per group material applied to the representation's renderobjects */ substance: Substance; /** Bit mask of per group clipping applied to the representation's renderobjects */ clipping: Clipping; /** Strength of the representations overpaint, transparency, emmissive, substance*/ themeStrength: { overpaint: number; transparency: number; emissive: number; substance: number; }; /** Controls if the representation's renderobjects are synced automatically with GPU or not */ syncManually: boolean; /** A transformation applied to the representation's renderobjects */ transform: Mat4; /** Bit mask of allowed marker actions */ markerActions: MarkerActions; } function createState(): State; function updateState(state: State, update: Partial): void; interface StateBuilder { create(): S; update(state: S, update: Partial): void; } const StateBuilder: StateBuilder; type Any

= Representation; const Empty: Any; function createEmpty(): Any; type Def = { [k: string]: RepresentationFactory; }; class GeometryState { private curr; private next; private _version; get version(): number; add(id: number, version: number): void; snapshot(): void; } function createMulti(label: string, ctx: RepresentationContext, getParams: RepresentationParamsGetter, stateBuilder: StateBuilder, reprDefs: Def): Representation; function fromRenderObject(label: string, renderObject: GraphicsRenderObject): Representation; }