types.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /**
  2. * Copyright (c) 2019-2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
  3. *
  4. * @author Alexander Rose <alexander.rose@weirdbyte.de>
  5. */
  6. import { BehaviorSubject } from 'rxjs';
  7. import { ModelLoader } from './helpers/model';
  8. import { PluginContext } from 'molstar/lib/mol-plugin/context';
  9. import { BuiltInTrajectoryFormat } from 'molstar/lib/mol-plugin-state/formats/trajectory';
  10. export type ModelUrlProvider = (pdbId: string) => {
  11. url: string,
  12. format: BuiltInTrajectoryFormat,
  13. isBinary: boolean
  14. }
  15. export interface LoadParams {
  16. /** A File object or URL representing a structure file */
  17. fileOrUrl: File | string,
  18. /** A supported file format extension string */
  19. format: BuiltInTrajectoryFormat,
  20. /** Set to true is the data is binary, e.g. bcif mmCIF files */
  21. isBinary: boolean
  22. }
  23. export type CollapsedState = {
  24. selection: boolean
  25. measurements: boolean
  26. superposition: boolean
  27. component: boolean
  28. volume: boolean
  29. custom: boolean
  30. }
  31. export interface ViewerState {
  32. showImportControls: boolean
  33. showSessionControls: boolean
  34. modelLoader: ModelLoader
  35. collapsed: BehaviorSubject<CollapsedState>
  36. }
  37. export function ViewerState(plugin: PluginContext) {
  38. return plugin.customState as ViewerState
  39. }