@jbrowse/core 2.1.7 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/BaseFeatureWidget/BaseFeatureDetail.d.ts +3 -2
  2. package/BaseFeatureWidget/BaseFeatureDetail.js +43 -28
  3. package/BaseFeatureWidget/SequenceBox.js +4 -8
  4. package/BaseFeatureWidget/SequenceFeatureDetails.js +2 -1
  5. package/Plugin.d.ts +1 -1
  6. package/PluginLoader.d.ts +2 -2
  7. package/PluginManager.d.ts +6 -6
  8. package/ReExports/modules.d.ts +3 -3
  9. package/assemblyManager/assembly.d.ts +23 -17
  10. package/assemblyManager/assembly.js +75 -76
  11. package/assemblyManager/assemblyConfigSchema.d.ts +6 -2
  12. package/assemblyManager/assemblyConfigSchema.js +39 -2
  13. package/assemblyManager/assemblyManager.d.ts +76 -214
  14. package/assemblyManager/assemblyManager.js +17 -39
  15. package/configuration/configurationSchema.d.ts +2 -2
  16. package/data_adapters/BaseAdapter.d.ts +2 -2
  17. package/data_adapters/CytobandAdapter.js +7 -0
  18. package/data_adapters/dataAdapterCache.d.ts +1 -1
  19. package/package.json +2 -2
  20. package/pluggableElementTypes/AdapterType.d.ts +1 -1
  21. package/pluggableElementTypes/AddTrackWorkflowType.d.ts +2 -2
  22. package/pluggableElementTypes/RpcMethodType.d.ts +1 -1
  23. package/pluggableElementTypes/ViewType.d.ts +2 -2
  24. package/pluggableElementTypes/index.d.ts +2 -2
  25. package/pluggableElementTypes/models/BaseConnectionModelFactory.d.ts +23 -2
  26. package/pluggableElementTypes/models/BaseConnectionModelFactory.js +24 -2
  27. package/pluggableElementTypes/models/BaseDisplayModel.d.ts +62 -3
  28. package/pluggableElementTypes/models/BaseDisplayModel.js +138 -92
  29. package/pluggableElementTypes/models/BaseTrackModel.d.ts +49 -4
  30. package/pluggableElementTypes/models/BaseTrackModel.js +77 -26
  31. package/pluggableElementTypes/models/BaseViewModel.d.ts +22 -0
  32. package/pluggableElementTypes/models/BaseViewModel.js +41 -2
  33. package/pluggableElementTypes/models/InternetAccountModel.d.ts +53 -6
  34. package/pluggableElementTypes/models/InternetAccountModel.js +57 -6
  35. package/pluggableElementTypes/models/baseConnectionConfig.js +17 -1
  36. package/pluggableElementTypes/models/baseInternetAccountConfig.d.ts +2 -2
  37. package/pluggableElementTypes/models/baseInternetAccountConfig.js +27 -1
  38. package/pluggableElementTypes/models/baseTrackConfig.d.ts +5 -2
  39. package/pluggableElementTypes/models/baseTrackConfig.js +52 -1
  40. package/pluggableElementTypes/renderers/BoxRendererType.d.ts +2 -2
  41. package/pluggableElementTypes/renderers/BoxRendererType.js +2 -0
  42. package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.d.ts +1 -1
  43. package/pluggableElementTypes/renderers/RendererType.d.ts +1 -1
  44. package/pluggableElementTypes/renderers/ServerSideRendererType.d.ts +1 -1
  45. package/pluggableElementTypes/renderers/util/serializableFilterChain.d.ts +2 -2
  46. package/rpc/MainThreadRpcDriver.d.ts +1 -1
  47. package/rpc/MainThreadRpcDriver.js +2 -2
  48. package/rpc/RpcManager.d.ts +2 -2
  49. package/rpc/WebWorkerRpcDriver.d.ts +5 -4
  50. package/rpc/WebWorkerRpcDriver.js +2 -2
  51. package/rpc/baseRpcConfig.d.ts +2 -0
  52. package/rpc/baseRpcConfig.js +18 -0
  53. package/rpc/configSchema.js +16 -10
  54. package/rpc/coreRpcMethods.d.ts +14 -14
  55. package/rpc/coreRpcMethods.js +60 -63
  56. package/rpc/mainThreadRpcConfig.d.ts +2 -0
  57. package/rpc/mainThreadRpcConfig.js +19 -0
  58. package/rpc/remoteAbortSignals.d.ts +1 -1
  59. package/rpc/webWorkerRpcConfig.d.ts +2 -0
  60. package/rpc/webWorkerRpcConfig.js +19 -0
  61. package/tsconfig.build.tsbuildinfo +1 -1
  62. package/ui/AboutDialog.js +2 -1
  63. package/ui/App.d.ts +2 -2
  64. package/ui/App.js +11 -10
  65. package/ui/AssemblySelector.d.ts +1 -1
  66. package/ui/AssemblySelector.js +12 -10
  67. package/ui/DrawerWidget.js +2 -1
  68. package/ui/EditableTypography.d.ts +4 -4
  69. package/ui/EditableTypography.js +7 -11
  70. package/ui/LoadingEllipses.d.ts +7 -0
  71. package/ui/LoadingEllipses.js +38 -0
  72. package/ui/Logo.d.ts +1 -1
  73. package/ui/Menu.d.ts +2 -2
  74. package/ui/Snackbar.d.ts +1 -1
  75. package/ui/ViewContainer.d.ts +2 -1
  76. package/ui/ViewContainer.js +34 -22
  77. package/ui/index.d.ts +1 -0
  78. package/ui/index.js +3 -1
  79. package/util/Base1DUtils.js +9 -3
  80. package/util/Base1DViewModel.d.ts +72 -2
  81. package/util/Base1DViewModel.js +94 -3
  82. package/util/blockTypes.d.ts +1 -1
  83. package/util/calculateDynamicBlocks.js +1 -1
  84. package/util/calculateStaticBlocks.js +1 -1
  85. package/util/index.d.ts +3 -1
  86. package/util/index.js +19 -9
  87. package/util/io/RemoteFileWithRangeCache.d.ts +1 -2
  88. package/util/io/RemoteFileWithRangeCache.js +2 -2
  89. package/util/io/index.js +3 -3
  90. package/util/jexl.d.ts +1 -1
  91. package/util/layouts/BaseLayout.d.ts +1 -1
  92. package/util/layouts/GranularRectLayout.d.ts +7 -2
  93. package/util/layouts/GranularRectLayout.js +29 -45
  94. package/util/layouts/MultiLayout.d.ts +2 -2
  95. package/util/layouts/MultiLayout.js +4 -6
  96. package/util/offscreenCanvasPonyfill.d.ts +2 -2
  97. package/util/offscreenCanvasUtils.d.ts +1 -1
  98. package/util/simpleFeature.d.ts +3 -0
  99. package/util/stats.d.ts +26 -0
  100. package/util/stats.js +9 -9
  101. package/util/tracks.d.ts +2 -2
  102. package/util/types/index.d.ts +15 -8
  103. package/util/types/index.js +8 -1
  104. package/util/types/util.d.ts +5 -5
@@ -22,8 +22,8 @@ export interface AnyConfigurationSchemaType extends ReturnType<typeof makeConfig
22
22
  jbrowseSchemaOptions: ConfigurationSchemaOptions;
23
23
  type: string;
24
24
  }
25
- export declare type AnyConfigurationModel = Instance<AnyConfigurationSchemaType>;
26
- export declare type ConfigurationModel<SCHEMA extends AnyConfigurationSchemaType> = Instance<SCHEMA>;
25
+ export type AnyConfigurationModel = Instance<AnyConfigurationSchemaType>;
26
+ export type ConfigurationModel<SCHEMA extends AnyConfigurationSchemaType> = Instance<SCHEMA>;
27
27
  export declare function ConfigurationSchema<DEFINITION extends ConfigurationSchemaDefinition, OPTIONS extends ConfigurationSchemaOptions>(modelName: string, inputSchemaDefinition: DEFINITION, inputOptions?: OPTIONS): AnyConfigurationSchemaType;
28
28
  export declare function ConfigurationReference(schemaType: IAnyType): import("mobx-state-tree").ITypeUnion<any, any, any>;
29
29
  export {};
@@ -13,7 +13,7 @@ export interface BaseOptions {
13
13
  headers?: Record<string, string>;
14
14
  [key: string]: unknown;
15
15
  }
16
- export declare type SearchType = 'full' | 'prefix' | 'exact';
16
+ export type SearchType = 'full' | 'prefix' | 'exact';
17
17
  export interface BaseArgs {
18
18
  searchType?: SearchType;
19
19
  queryString: string;
@@ -24,7 +24,7 @@ export interface BaseArgs {
24
24
  export interface AnyAdapter {
25
25
  new (config: AnyConfigurationModel, getSubAdapter?: getSubAdapterType, pluginManager?: PluginManager | undefined): AnyDataAdapter;
26
26
  }
27
- export declare type AnyDataAdapter = BaseAdapter | BaseFeatureDataAdapter | BaseRefNameAliasAdapter | BaseTextSearchAdapter | RegionsAdapter | BaseSequenceAdapter;
27
+ export type AnyDataAdapter = BaseAdapter | BaseFeatureDataAdapter | BaseRefNameAliasAdapter | BaseTextSearchAdapter | RegionsAdapter | BaseSequenceAdapter;
28
28
  export interface SequenceAdapter extends BaseFeatureDataAdapter, RegionsAdapter {
29
29
  }
30
30
  export declare abstract class BaseAdapter {
@@ -8,7 +8,14 @@ const simpleFeature_1 = __importDefault(require("../util/simpleFeature"));
8
8
  const configuration_1 = require("../configuration");
9
9
  const io_1 = require("../util/io");
10
10
  const BaseAdapter_1 = require("./BaseAdapter");
11
+ /**
12
+ * #config CytobandAdapter
13
+ */
14
+ function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
11
15
  const configSchema = (0, configuration_1.ConfigurationSchema)('CytobandAdapter', {
16
+ /**
17
+ * #slot
18
+ */
12
19
  cytobandLocation: {
13
20
  type: 'fileLocation',
14
21
  defaultValue: { uri: '/path/to/cytoband.txt.gz' },
@@ -21,7 +21,7 @@ export declare function getAdapter(pluginManager: PluginManager, sessionId: stri
21
21
  * allows them to get any sub-adapters that they need
22
22
  * internally, staying with the same worker session ID
23
23
  */
24
- export declare type getSubAdapterType = (adapterConfigSnapshot: SnapshotIn<AnyConfigurationSchemaType>) => ReturnType<typeof getAdapter>;
24
+ export type getSubAdapterType = (adapterConfigSnapshot: SnapshotIn<AnyConfigurationSchemaType>) => ReturnType<typeof getAdapter>;
25
25
  export declare function freeAdapterResources(specification: Record<string, any>): number;
26
26
  export declare function clearAdapterCache(): void;
27
27
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/core",
3
- "version": "2.1.7",
3
+ "version": "2.2.1",
4
4
  "description": "JBrowse 2 core libraries used by plugins",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -73,5 +73,5 @@
73
73
  "access": "public",
74
74
  "directory": "dist"
75
75
  },
76
- "gitHead": "a1344081f61e22e0f597517efa7386023eef9f33"
76
+ "gitHead": "896d175c5d9345049faea8e1155f243c912aac42"
77
77
  }
@@ -1,7 +1,7 @@
1
1
  import PluggableElementBase from './PluggableElementBase';
2
2
  import { AnyConfigurationSchemaType } from '../configuration/configurationSchema';
3
3
  import { AnyAdapter } from '../data_adapters/BaseAdapter';
4
- export declare type AdapterMetadata = {
4
+ export type AdapterMetadata = {
5
5
  category: string | null;
6
6
  hiddenFromGUI: boolean | null;
7
7
  displayName: string | null;
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
2
  import { IAnyModelType } from 'mobx-state-tree';
3
3
  import PluggableElementBase from './PluggableElementBase';
4
- declare type BasicComponent = React.ComponentType<{
4
+ type BasicComponent = React.ComponentType<{
5
5
  model: any;
6
6
  }>;
7
- declare type AddTrackWorkflowComponent = React.LazyExoticComponent<BasicComponent> | BasicComponent;
7
+ type AddTrackWorkflowComponent = React.LazyExoticComponent<BasicComponent> | BasicComponent;
8
8
  export default class AddTrackWorkflow extends PluggableElementBase {
9
9
  ReactComponent: AddTrackWorkflowComponent;
10
10
  stateModel: IAnyModelType;
@@ -2,7 +2,7 @@ import PluginManager from '../PluginManager';
2
2
  import PluggableElementBase from './PluggableElementBase';
3
3
  import { UriLocation } from '../util/types';
4
4
  import { RemoteAbortSignal } from '../rpc/remoteAbortSignals';
5
- export declare type RpcMethodConstructor = new (pm: PluginManager) => RpcMethodType;
5
+ export type RpcMethodConstructor = new (pm: PluginManager) => RpcMethodType;
6
6
  export default abstract class RpcMethodType extends PluggableElementBase {
7
7
  pluginManager: PluginManager;
8
8
  name: string;
@@ -2,11 +2,11 @@ import React from 'react';
2
2
  import { IAnyModelType, IAnyStateTreeNode } from 'mobx-state-tree';
3
3
  import PluggableElementBase from './PluggableElementBase';
4
4
  import DisplayType from './DisplayType';
5
- declare type BasicView = React.ComponentType<{
5
+ type BasicView = React.ComponentType<{
6
6
  model: any;
7
7
  session?: IAnyStateTreeNode;
8
8
  }>;
9
- declare type ViewReactComponent = React.LazyExoticComponent<BasicView> | BasicView;
9
+ type ViewReactComponent = React.LazyExoticComponent<BasicView> | BasicView;
10
10
  export default class ViewType extends PluggableElementBase {
11
11
  ReactComponent: ViewReactComponent;
12
12
  stateModel: IAnyModelType;
@@ -12,5 +12,5 @@ import AddTrackWorkflowType from './AddTrackWorkflowType';
12
12
  export * from './renderers';
13
13
  export * from './models';
14
14
  export { AdapterType, ConnectionType, RendererType, WidgetType, TrackType, DisplayType, ViewType, RpcMethodType, InternetAccountType, TextSearchAdapterType, AddTrackWorkflowType, };
15
- export declare type PluggableElementType = AdapterType | ConnectionType | RendererType | WidgetType | TrackType | DisplayType | ViewType | RpcMethodType | InternetAccountType | TextSearchAdapterType | AddTrackWorkflowType;
16
- export declare type PluggableElementMember = keyof AdapterType | keyof ConnectionType | keyof RendererType | keyof WidgetType | keyof TrackType | keyof DisplayType | keyof ViewType | keyof RpcMethodType | keyof InternetAccountType | keyof TextSearchAdapterType | keyof AddTrackWorkflowType;
15
+ export type PluggableElementType = AdapterType | ConnectionType | RendererType | WidgetType | TrackType | DisplayType | ViewType | RpcMethodType | InternetAccountType | TextSearchAdapterType | AddTrackWorkflowType;
16
+ export type PluggableElementMember = keyof AdapterType | keyof ConnectionType | keyof RendererType | keyof WidgetType | keyof TrackType | keyof DisplayType | keyof ViewType | keyof RpcMethodType | keyof InternetAccountType | keyof TextSearchAdapterType | keyof AddTrackWorkflowType;
@@ -1,13 +1,34 @@
1
1
  import { AnyConfigurationModel } from '../../configuration';
2
2
  import PluginManager from '../../PluginManager';
3
- declare const _default: (pluginManager: PluginManager) => import("mobx-state-tree").IModelType<{
3
+ /**
4
+ * #stateModel BaseConnectionModel
5
+ */
6
+ declare function stateModelFactory(pluginManager: PluginManager): import("mobx-state-tree").IModelType<{
7
+ /**
8
+ * #property
9
+ */
4
10
  name: import("mobx-state-tree").ISimpleType<string>;
11
+ /**
12
+ * #property
13
+ */
5
14
  tracks: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyModelType>;
6
15
  }, {
7
16
  afterAttach(): void;
17
+ /**
18
+ * #action
19
+ */
8
20
  addTrackConf(trackConf: AnyConfigurationModel): any;
21
+ /**
22
+ * #action
23
+ */
9
24
  addTrackConfs(trackConfs: AnyConfigurationModel[]): any[];
25
+ /**
26
+ * #action
27
+ */
10
28
  setTrackConfs(trackConfs: AnyConfigurationModel[]): import("mobx-state-tree").IMSTArray<import("mobx-state-tree").IAnyModelType> & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyModelType>>;
29
+ /**
30
+ * #action
31
+ */
11
32
  clear(): void;
12
33
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
13
- export default _default;
34
+ export default stateModelFactory;
@@ -1,10 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const mobx_state_tree_1 = require("mobx-state-tree");
4
- exports.default = (pluginManager) => {
4
+ /**
5
+ * #stateModel BaseConnectionModel
6
+ */
7
+ function stateModelFactory(pluginManager) {
5
8
  return mobx_state_tree_1.types
6
9
  .model('Connection', {
10
+ /**
11
+ * #property
12
+ */
7
13
  name: mobx_state_tree_1.types.identifier,
14
+ /**
15
+ * #property
16
+ */
8
17
  tracks: mobx_state_tree_1.types.array(pluginManager.pluggableConfigSchemaType('track')),
9
18
  })
10
19
  .actions(self => ({
@@ -14,18 +23,31 @@ exports.default = (pluginManager) => {
14
23
  self.connect(self.configuration);
15
24
  }
16
25
  },
26
+ /**
27
+ * #action
28
+ */
17
29
  addTrackConf(trackConf) {
18
30
  const length = self.tracks.push(trackConf);
19
31
  return self.tracks[length - 1];
20
32
  },
33
+ /**
34
+ * #action
35
+ */
21
36
  addTrackConfs(trackConfs) {
22
37
  const length = self.tracks.push(...trackConfs);
23
38
  return self.tracks.slice(length - 1 - trackConfs.length, length - 1);
24
39
  },
40
+ /**
41
+ * #action
42
+ */
25
43
  setTrackConfs(trackConfs) {
26
44
  self.tracks = (0, mobx_state_tree_1.cast)(trackConfs);
27
45
  return self.tracks;
28
46
  },
47
+ /**
48
+ * #action
49
+ */
29
50
  clear() { },
30
51
  }));
31
- };
52
+ }
53
+ exports.default = stateModelFactory;
@@ -1,14 +1,26 @@
1
- import { Instance } from 'mobx-state-tree';
2
1
  import React from 'react';
2
+ import { Instance } from 'mobx-state-tree';
3
3
  import { MenuItem } from '../../ui';
4
4
  export declare const BaseDisplay: import("mobx-state-tree").IModelType<{
5
+ /**
6
+ * #property
7
+ */
5
8
  id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
9
+ /**
10
+ * #property
11
+ */
6
12
  type: import("mobx-state-tree").ISimpleType<string>;
13
+ /**
14
+ * #property
15
+ */
7
16
  rpcDriverName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
8
17
  }, {
9
18
  rendererTypeName: string;
10
19
  error: unknown;
11
20
  } & {
21
+ /**
22
+ * #getter
23
+ */
12
24
  readonly RenderingComponent: React.FC<{
13
25
  model: {
14
26
  id: string;
@@ -18,8 +30,17 @@ export declare const BaseDisplay: import("mobx-state-tree").IModelType<{
18
30
  rendererTypeName: string;
19
31
  error: unknown;
20
32
  } & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
33
+ /**
34
+ * #property
35
+ */
21
36
  id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
37
+ /**
38
+ * #property
39
+ */
22
40
  type: import("mobx-state-tree").ISimpleType<string>;
41
+ /**
42
+ * #property
43
+ */
23
44
  rpcDriverName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
24
45
  }, {
25
46
  rendererTypeName: string;
@@ -28,6 +49,9 @@ export declare const BaseDisplay: import("mobx-state-tree").IModelType<{
28
49
  onHorizontalScroll?: Function | undefined;
29
50
  blockState?: Record<string, any> | undefined;
30
51
  }>;
52
+ /**
53
+ * #getter
54
+ */
31
55
  readonly DisplayBlurb: React.FC<{
32
56
  model: {
33
57
  id: string;
@@ -37,34 +61,59 @@ export declare const BaseDisplay: import("mobx-state-tree").IModelType<{
37
61
  rendererTypeName: string;
38
62
  error: unknown;
39
63
  } & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
64
+ /**
65
+ * #property
66
+ */
40
67
  id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
68
+ /**
69
+ * #property
70
+ */
41
71
  type: import("mobx-state-tree").ISimpleType<string>;
72
+ /**
73
+ * #property
74
+ */
42
75
  rpcDriverName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
43
76
  }, {
44
77
  rendererTypeName: string;
45
78
  error: unknown;
46
79
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
47
80
  }> | null;
81
+ /**
82
+ * #getter
83
+ */
48
84
  readonly adapterConfig: any;
85
+ /**
86
+ * #getter
87
+ */
49
88
  readonly parentTrack: any;
50
89
  /**
90
+ * #method
51
91
  * the react props that are passed to the Renderer when data
52
92
  * is rendered in this display
53
93
  */
54
94
  renderProps(): any;
55
95
  /**
96
+ * #getter
56
97
  * the pluggable element type object for this display's
57
98
  * renderer
58
99
  */
59
100
  readonly rendererType: import("..").RendererType;
60
101
  /**
102
+ * #getter
61
103
  * if a display-level message should be displayed instead,
62
104
  * make this return a react component
63
105
  */
64
106
  readonly DisplayMessageComponent: React.FC<any> | undefined;
107
+ /**
108
+ * #method
109
+ */
65
110
  trackMenuItems(): MenuItem[];
111
+ /**
112
+ * #getter
113
+ */
66
114
  readonly viewMenuActions: MenuItem[];
67
115
  /**
116
+ * #method
68
117
  * @param region -
69
118
  * @returns falsy if the region is fine to try rendering. Otherwise,
70
119
  * return a react node + string of text.
@@ -73,9 +122,19 @@ export declare const BaseDisplay: import("mobx-state-tree").IModelType<{
73
122
  */
74
123
  regionCannotBeRendered(): undefined;
75
124
  } & {
125
+ /**
126
+ * #action
127
+ */
76
128
  setError(error?: unknown): void;
129
+ /**
130
+ * #action
131
+ */
77
132
  setRpcDriverName(rpcDriverName: string): void;
133
+ /**
134
+ * #action
135
+ * base display reload does nothing, see specialized displays for details
136
+ */
78
137
  reload(): void;
79
138
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
80
- export declare type BaseDisplayStateModel = typeof BaseDisplay;
81
- export declare type BaseDisplayModel = Instance<BaseDisplayStateModel>;
139
+ export type BaseDisplayStateModel = typeof BaseDisplay;
140
+ export type BaseDisplayModel = Instance<BaseDisplayStateModel>;
@@ -1,101 +1,147 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BaseDisplay = void 0;
4
- /* eslint-disable @typescript-eslint/no-explicit-any */
5
4
  const mobx_state_tree_1 = require("mobx-state-tree");
5
+ // locals
6
6
  const configuration_1 = require("../../configuration");
7
7
  const tracks_1 = require("../../util/tracks");
8
8
  const util_1 = require("../../util");
9
9
  const mst_1 = require("../../util/types/mst");
10
- exports.BaseDisplay = mobx_state_tree_1.types
11
- .model('BaseDisplay', {
12
- id: mst_1.ElementId,
13
- type: mobx_state_tree_1.types.string,
14
- rpcDriverName: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.string),
15
- })
16
- .volatile(() => ({
17
- rendererTypeName: '',
18
- error: undefined,
19
- }))
20
- .views(self => ({
21
- get RenderingComponent() {
22
- const { pluginManager } = (0, util_1.getEnv)(self);
23
- const displayType = pluginManager.getDisplayType(self.type);
24
- return displayType.ReactComponent;
25
- },
26
- get DisplayBlurb() {
27
- return null;
28
- },
29
- get adapterConfig() {
30
- return (0, configuration_1.getConf)(this.parentTrack, 'adapter');
31
- },
32
- get parentTrack() {
33
- let track = (0, mobx_state_tree_1.getParent)(self);
34
- while (!(track.configuration && (0, configuration_1.getConf)(track, 'trackId'))) {
35
- if ((0, mobx_state_tree_1.isRoot)(track)) {
36
- throw new Error(`No parent track found for ${self.type} ${self.id}`);
10
+ /**
11
+ * #stateModel BaseDisplay
12
+ */
13
+ function stateModelFactory() {
14
+ return mobx_state_tree_1.types
15
+ .model('BaseDisplay', {
16
+ /**
17
+ * #property
18
+ */
19
+ id: mst_1.ElementId,
20
+ /**
21
+ * #property
22
+ */
23
+ type: mobx_state_tree_1.types.string,
24
+ /**
25
+ * #property
26
+ */
27
+ rpcDriverName: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.string),
28
+ })
29
+ .volatile(() => ({
30
+ rendererTypeName: '',
31
+ error: undefined,
32
+ }))
33
+ .views(self => ({
34
+ /**
35
+ * #getter
36
+ */
37
+ get RenderingComponent() {
38
+ const { pluginManager } = (0, util_1.getEnv)(self);
39
+ const displayType = pluginManager.getDisplayType(self.type);
40
+ return displayType.ReactComponent;
41
+ },
42
+ /**
43
+ * #getter
44
+ */
45
+ get DisplayBlurb() {
46
+ return null;
47
+ },
48
+ /**
49
+ * #getter
50
+ */
51
+ get adapterConfig() {
52
+ return (0, configuration_1.getConf)(this.parentTrack, 'adapter');
53
+ },
54
+ /**
55
+ * #getter
56
+ */
57
+ get parentTrack() {
58
+ let track = (0, mobx_state_tree_1.getParent)(self);
59
+ while (!(track.configuration && (0, configuration_1.getConf)(track, 'trackId'))) {
60
+ if ((0, mobx_state_tree_1.isRoot)(track)) {
61
+ throw new Error(`No parent track found for ${self.type} ${self.id}`);
62
+ }
63
+ track = (0, mobx_state_tree_1.getParent)(track);
37
64
  }
38
- track = (0, mobx_state_tree_1.getParent)(track);
39
- }
40
- return track;
41
- },
42
- /**
43
- * the react props that are passed to the Renderer when data
44
- * is rendered in this display
45
- */
46
- renderProps() {
47
- return {
48
- ...(0, tracks_1.getParentRenderProps)(self),
49
- rpcDriverName: self.rpcDriverName,
50
- displayModel: self,
51
- };
52
- },
53
- /**
54
- * the pluggable element type object for this display's
55
- * renderer
56
- */
57
- get rendererType() {
58
- const { pluginManager } = (0, util_1.getEnv)(self);
59
- const RendererType = pluginManager.getRendererType(self.rendererTypeName);
60
- if (!RendererType) {
61
- throw new Error(`renderer "${self.rendererTypeName}" not found`);
62
- }
63
- if (!RendererType.ReactComponent) {
64
- throw new Error(`renderer ${self.rendererTypeName} has no ReactComponent, it may not be completely implemented yet`);
65
- }
66
- return RendererType;
67
- },
68
- /**
69
- * if a display-level message should be displayed instead,
70
- * make this return a react component
71
- */
72
- get DisplayMessageComponent() {
73
- return undefined;
74
- },
75
- trackMenuItems() {
76
- return [];
77
- },
78
- get viewMenuActions() {
79
- return [];
80
- },
81
- /**
82
- * @param region -
83
- * @returns falsy if the region is fine to try rendering. Otherwise,
84
- * return a react node + string of text.
85
- * string of text describes why it cannot be rendered
86
- * react node allows user to force load at current setting
87
- */
88
- regionCannotBeRendered( /* region */) {
89
- return undefined;
90
- },
91
- }))
92
- .actions(self => ({
93
- setError(error) {
94
- self.error = error;
95
- },
96
- setRpcDriverName(rpcDriverName) {
97
- self.rpcDriverName = rpcDriverName;
98
- },
99
- // base display reload does nothing, see specialized displays for details
100
- reload() { },
101
- }));
65
+ return track;
66
+ },
67
+ /**
68
+ * #method
69
+ * the react props that are passed to the Renderer when data
70
+ * is rendered in this display
71
+ */
72
+ renderProps() {
73
+ return {
74
+ ...(0, tracks_1.getParentRenderProps)(self),
75
+ rpcDriverName: self.rpcDriverName,
76
+ displayModel: self,
77
+ };
78
+ },
79
+ /**
80
+ * #getter
81
+ * the pluggable element type object for this display's
82
+ * renderer
83
+ */
84
+ get rendererType() {
85
+ const { pluginManager } = (0, util_1.getEnv)(self);
86
+ const RendererType = pluginManager.getRendererType(self.rendererTypeName);
87
+ if (!RendererType) {
88
+ throw new Error(`renderer "${self.rendererTypeName}" not found`);
89
+ }
90
+ if (!RendererType.ReactComponent) {
91
+ throw new Error(`renderer ${self.rendererTypeName} has no ReactComponent, it may not be completely implemented yet`);
92
+ }
93
+ return RendererType;
94
+ },
95
+ /**
96
+ * #getter
97
+ * if a display-level message should be displayed instead,
98
+ * make this return a react component
99
+ */
100
+ get DisplayMessageComponent() {
101
+ return undefined;
102
+ },
103
+ /**
104
+ * #method
105
+ */
106
+ trackMenuItems() {
107
+ return [];
108
+ },
109
+ /**
110
+ * #getter
111
+ */
112
+ get viewMenuActions() {
113
+ return [];
114
+ },
115
+ /**
116
+ * #method
117
+ * @param region -
118
+ * @returns falsy if the region is fine to try rendering. Otherwise,
119
+ * return a react node + string of text.
120
+ * string of text describes why it cannot be rendered
121
+ * react node allows user to force load at current setting
122
+ */
123
+ regionCannotBeRendered( /* region */) {
124
+ return undefined;
125
+ },
126
+ }))
127
+ .actions(self => ({
128
+ /**
129
+ * #action
130
+ */
131
+ setError(error) {
132
+ self.error = error;
133
+ },
134
+ /**
135
+ * #action
136
+ */
137
+ setRpcDriverName(rpcDriverName) {
138
+ self.rpcDriverName = rpcDriverName;
139
+ },
140
+ /**
141
+ * #action
142
+ * base display reload does nothing, see specialized displays for details
143
+ */
144
+ reload() { },
145
+ }));
146
+ }
147
+ exports.BaseDisplay = stateModelFactory();