/** * Copyright (c) 2019-2020 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author Alexander Rose */ import { RuntimeContext } from '../../mol-task/index.js'; import { CustomPropertyDescriptor } from '../../mol-model/custom-property.js'; import { ParamDefinition as PD } from '../../mol-util/param-definition.js'; import { ValueBox } from '../../mol-util/index.js'; import { AssetManager, Asset } from '../../mol-util/assets.js'; import { ErrorContext } from '../../mol-util/error-context.js'; export { CustomProperty }; declare namespace CustomProperty { interface Context { runtime: RuntimeContext; assetManager: AssetManager; errorContext?: ErrorContext; } type Data = { value: V; assets?: Asset.Wrapper[]; }; interface Container { readonly props: P; readonly data: ValueBox; } interface Provider { readonly label: string; readonly descriptor: CustomPropertyDescriptor; /** hides property in ui and always attaches */ readonly isHidden?: boolean; readonly getParams: (data: Data) => Params; readonly defaultParams: Params; readonly isApplicable: (data: Data) => boolean; readonly attach: (ctx: Context, data: Data, props?: Partial>, addRef?: boolean) => Promise; readonly ref: (data: Data, add: boolean) => void; readonly get: (data: Data) => ValueBox; readonly set: (data: Data, props: PD.Values, value?: Value) => void; readonly props: (data: Data) => PD.Values; } class Registry { private providers; private defaultAutoAttachValues; /** Get params for all applicable property providers */ getParams(data?: Data): { autoAttach: PD.MultiSelect; properties: PD.Group>; }; setDefaultAutoAttach(name: string, value: boolean): void; get(name: string): Provider | undefined; register(provider: Provider, defaultAutoAttach: boolean): void; unregister(name: string): void; } }