@jbrowse/core 2.1.3 → 2.1.5

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.
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import { IAnyStateTreeNode } from 'mobx-state-tree';
3
- import { SimpleFeatureSerialized } from '../util/simpleFeature';
3
+ import { SimpleFeatureSerializedNoId } from '../util/simpleFeature';
4
4
  import { AbstractViewModel } from '../util';
5
5
  export interface BaseProps extends BaseCardProps {
6
- feature: SimpleFeatureSerialized;
6
+ feature: SimpleFeatureSerializedNoId;
7
7
  formatter?: (val: unknown, key: string) => React.ReactNode;
8
8
  descriptions?: Record<string, React.ReactNode>;
9
9
  model?: IAnyStateTreeNode & {
@@ -11,8 +11,8 @@ export interface ParentFeat extends Feat {
11
11
  }
12
12
  export interface SeqState {
13
13
  seq: string;
14
- upstream: string;
15
- downstream: string;
14
+ upstream?: string;
15
+ downstream?: string;
16
16
  }
17
17
  export declare function stitch(subfeats: Feat[], sequence: string): string;
18
18
  export declare function dedupe(list: Feat[]): Feat[];
@@ -279,8 +279,8 @@ export default class PluginManager {
279
279
  addRpcMethod(cb: (pm: PluginManager) => RpcMethodType): this;
280
280
  addInternetAccountType(cb: (pm: PluginManager) => InternetAccountType): this;
281
281
  addAddTrackWorkflowType(cb: (pm: PluginManager) => AddTrackWorkflowType): this;
282
- addToExtensionPoint<T>(extensionPointName: string, callback: (extendee: T) => T): void;
283
- evaluateExtensionPoint(extensionPointName: string, extendee: unknown): unknown;
284
- evaluateAsyncExtensionPoint(extensionPointName: string, extendee: unknown): Promise<unknown>;
282
+ addToExtensionPoint<T>(extensionPointName: string, callback: (extendee: T, props: Record<string, unknown>) => T): void;
283
+ evaluateExtensionPoint(extensionPointName: string, extendee: unknown, props?: Record<string, unknown>): unknown;
284
+ evaluateAsyncExtensionPoint(extensionPointName: string, extendee: unknown, props?: Record<string, unknown>): Promise<unknown>;
285
285
  }
286
286
  export {};
package/PluginManager.js CHANGED
@@ -329,7 +329,9 @@ class PluginManager {
329
329
  const displays = this.getElementTypesInGroup('display');
330
330
  displays.forEach(display => {
331
331
  // view may have already added the displayType in its callback
332
- if (display.viewType === newView.name &&
332
+ // see ViewType for description of extendedName
333
+ if ((display.viewType === newView.name ||
334
+ display.viewType === newView.extendedName) &&
333
335
  !newView.displayTypes.includes(display)) {
334
336
  newView.addDisplayType(display);
335
337
  }
@@ -361,13 +363,13 @@ class PluginManager {
361
363
  }
362
364
  callbacks.push(callback);
363
365
  }
364
- evaluateExtensionPoint(extensionPointName, extendee) {
366
+ evaluateExtensionPoint(extensionPointName, extendee, props) {
365
367
  const callbacks = this.extensionPoints.get(extensionPointName);
366
368
  let accumulator = extendee;
367
369
  if (callbacks) {
368
370
  for (const callback of callbacks) {
369
371
  try {
370
- accumulator = callback(accumulator);
372
+ accumulator = callback(accumulator, props);
371
373
  }
372
374
  catch (error) {
373
375
  console.error(error);
@@ -376,13 +378,13 @@ class PluginManager {
376
378
  }
377
379
  return accumulator;
378
380
  }
379
- async evaluateAsyncExtensionPoint(extensionPointName, extendee) {
381
+ async evaluateAsyncExtensionPoint(extensionPointName, extendee, props) {
380
382
  const callbacks = this.extensionPoints.get(extensionPointName);
381
383
  let accumulator = extendee;
382
384
  if (callbacks) {
383
385
  for (const callback of callbacks) {
384
386
  try {
385
- accumulator = await callback(accumulator);
387
+ accumulator = await callback(accumulator, props);
386
388
  }
387
389
  catch (error) {
388
390
  console.error(error);
@@ -24,12 +24,13 @@ function assemblyManagerFactory(assemblyConfigType, pluginManager) {
24
24
  get assemblyList() {
25
25
  // name is the explicit identifier and can be accessed without getConf,
26
26
  // hence the union with {name:string}
27
- const { jbrowse: { assemblies }, session: { sessionAssemblies = [] } = {},
27
+ const { jbrowse: { assemblies }, session: { sessionAssemblies = [], temporaryAssemblies = [] } = {},
28
28
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
29
  } = (0, mobx_state_tree_1.getParent)(self);
30
30
  return [
31
31
  ...assemblies,
32
32
  ...sessionAssemblies,
33
+ ...temporaryAssemblies,
33
34
  ];
34
35
  },
35
36
  get rpcManager() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/core",
3
- "version": "2.1.3",
3
+ "version": "2.1.5",
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": "ebd548ceb52adb36cf6ab437082b5b5feac1338e"
76
+ "gitHead": "bc5253ecdddeceeb999fffebf6dc6cf5f444e1c9"
77
77
  }
@@ -11,10 +11,12 @@ export default class ViewType extends PluggableElementBase {
11
11
  ReactComponent: ViewReactComponent;
12
12
  stateModel: IAnyModelType;
13
13
  displayTypes: DisplayType[];
14
+ extendedName?: string;
14
15
  constructor(stuff: {
15
16
  name: string;
16
17
  ReactComponent: ViewReactComponent;
17
18
  stateModel: IAnyModelType;
19
+ extendedName?: string;
18
20
  });
19
21
  addDisplayType(display: DisplayType): void;
20
22
  }
@@ -10,6 +10,7 @@ class ViewType extends PluggableElementBase_1.default {
10
10
  this.displayTypes = [];
11
11
  this.ReactComponent = stuff.ReactComponent;
12
12
  this.stateModel = stuff.stateModel;
13
+ this.extendedName = stuff.extendedName;
13
14
  if (!this.ReactComponent) {
14
15
  throw new Error(`no ReactComponent defined for view ${this.name}`);
15
16
  }
@@ -1,11 +1,13 @@
1
- declare function _default(pluginManager: any): import("mobx-state-tree").IModelType<{
1
+ import { AnyConfigurationModel } from '../../configuration';
2
+ import PluginManager from '../../PluginManager';
3
+ declare const _default: (pluginManager: PluginManager) => import("mobx-state-tree").IModelType<{
2
4
  name: import("mobx-state-tree").ISimpleType<string>;
3
- tracks: import("mobx-state-tree").IArrayType<any>;
5
+ tracks: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyModelType>;
4
6
  }, {
5
7
  afterAttach(): void;
6
- addTrackConf(trackConf: any): any;
7
- addTrackConfs(trackConfs: any): any[];
8
- setTrackConfs(trackConfs: any): import("mobx-state-tree").IMSTArray<any> & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IArrayType<any>>;
8
+ addTrackConf(trackConf: AnyConfigurationModel): any;
9
+ addTrackConfs(trackConfs: AnyConfigurationModel[]): any[];
10
+ 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>>;
9
11
  clear(): void;
10
12
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
11
13
  export default _default;
@@ -1,7 +1,7 @@
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
+ exports.default = (pluginManager) => {
5
5
  return mobx_state_tree_1.types
6
6
  .model('Connection', {
7
7
  name: mobx_state_tree_1.types.identifier,
@@ -10,6 +10,7 @@ exports.default = pluginManager => {
10
10
  .actions(self => ({
11
11
  afterAttach() {
12
12
  if (!self.tracks.length) {
13
+ // @ts-ignore
13
14
  self.connect(self.configuration);
14
15
  }
15
16
  },
@@ -22,7 +23,7 @@ exports.default = pluginManager => {
22
23
  return self.tracks.slice(length - 1 - trackConfs.length, length - 1);
23
24
  },
24
25
  setTrackConfs(trackConfs) {
25
- self.tracks = trackConfs;
26
+ self.tracks = (0, mobx_state_tree_1.cast)(trackConfs);
26
27
  return self.tracks;
27
28
  },
28
29
  clear() { },