@jbrowse/core 2.15.3 → 2.16.0

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.
@@ -7,7 +7,7 @@ exports.Attributes = exports.BaseAttributes = exports.BaseCoreDetails = void 0;
7
7
  exports.BaseCard = BaseCard;
8
8
  exports.FeatureDetails = FeatureDetails;
9
9
  const react_1 = __importDefault(require("react"));
10
- const react_error_boundary_1 = require("react-error-boundary");
10
+ const ErrorBoundary_1 = require("@jbrowse/core/ui/ErrorBoundary");
11
11
  const material_1 = require("@mui/material");
12
12
  const mui_1 = require("tss-react/mui");
13
13
  const mobx_react_1 = require("mobx-react");
@@ -120,7 +120,7 @@ function FeatureDetails(props) {
120
120
  react_1.default.createElement(material_1.Divider, null),
121
121
  react_1.default.createElement(material_1.Typography, null, "Attributes"),
122
122
  react_1.default.createElement(Attributes_1.default, { attributes: feature, ...props, omit: omit, omitSingleLevel: coreDetails }),
123
- react_1.default.createElement(react_error_boundary_1.ErrorBoundary, { FallbackComponent: e => react_1.default.createElement(ui_1.ErrorMessage, { error: e.error }) },
123
+ react_1.default.createElement(ErrorBoundary_1.ErrorBoundary, { FallbackComponent: e => react_1.default.createElement(ui_1.ErrorMessage, { error: e.error }) },
124
124
  react_1.default.createElement(SequenceFeatureDetails_1.default, { ...props })),
125
125
  ExtraPanel ? (react_1.default.createElement(react_1.default.Fragment, null,
126
126
  react_1.default.createElement(material_1.Divider, null),
@@ -106,6 +106,7 @@ export default class PluginManager {
106
106
  addElementType(groupName: PluggableElementTypeGroup, creationCallback: (pluginManager: PluginManager) => PluggableElementType): this;
107
107
  getElementType(groupName: PluggableElementTypeGroup, typeName: string): PluggableElementBase | undefined;
108
108
  getElementTypesInGroup(groupName: PluggableElementTypeGroup): PluggableElementBase[];
109
+ getViewElements(): ViewType[];
109
110
  getTrackElements(): TrackType[];
110
111
  getConnectionElements(): ConnectionType[];
111
112
  getAddTrackWorkflowElements(): AddTrackWorkflowType[];
package/PluginManager.js CHANGED
@@ -242,6 +242,9 @@ class PluginManager {
242
242
  getElementTypesInGroup(groupName) {
243
243
  return this.getElementTypeRecord(groupName).all();
244
244
  }
245
+ getViewElements() {
246
+ return this.getElementTypesInGroup('view');
247
+ }
245
248
  getTrackElements() {
246
249
  return this.getElementTypesInGroup('track');
247
250
  }
@@ -572,12 +572,5 @@ declare function assemblyManagerFactory(conf: IAnyType, pm: PluginManager): impo
572
572
  * used as a reference. snapshots cannot be used
573
573
  */
574
574
  addAssembly(configuration: any): void;
575
- /**
576
- * #action
577
- * private: you would generally want to add to manipulate
578
- * jbrowse.assemblies, session.sessionAssemblies, or
579
- * session.temporaryAssemblies instead of using this directly
580
- */
581
- replaceAssembly(idx: number, configuration: any): void;
582
575
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
583
576
  export default assemblyManagerFactory;
@@ -4,8 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const mobx_state_tree_1 = require("mobx-state-tree");
7
- const util_1 = require("../util");
8
7
  const mobx_1 = require("mobx");
8
+ // locals
9
+ const util_1 = require("../util");
9
10
  const configuration_1 = require("../configuration");
10
11
  const assembly_1 = __importDefault(require("./assembly"));
11
12
  /**
@@ -130,16 +131,17 @@ function assemblyManagerFactory(conf, pm) {
130
131
  .actions(self => ({
131
132
  afterAttach() {
132
133
  (0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.reaction)(() => self.assemblyList, assemblyConfs => {
133
- self.assemblies.forEach(asm => {
134
+ for (const asm of self.assemblies) {
134
135
  if (!asm.configuration) {
135
136
  this.removeAssembly(asm);
136
137
  }
137
- });
138
- assemblyConfs.forEach(conf => {
139
- if (!self.assemblies.some(a => a.name === (0, configuration_1.readConfObject)(conf, 'name'))) {
138
+ }
139
+ for (const conf of assemblyConfs) {
140
+ const name = (0, configuration_1.readConfObject)(conf, 'name');
141
+ if (!self.assemblies.some(a => a.name === name)) {
140
142
  this.addAssembly(conf);
141
143
  }
142
- });
144
+ }
143
145
  }, { fireImmediately: true, name: 'assemblyManagerAfterAttach' }));
144
146
  },
145
147
  /**
@@ -164,15 +166,6 @@ function assemblyManagerFactory(conf, pm) {
164
166
  addAssembly(configuration) {
165
167
  self.assemblies.push({ configuration });
166
168
  },
167
- /**
168
- * #action
169
- * private: you would generally want to add to manipulate
170
- * jbrowse.assemblies, session.sessionAssemblies, or
171
- * session.temporaryAssemblies instead of using this directly
172
- */
173
- replaceAssembly(idx, configuration) {
174
- self.assemblies[idx] = (0, mobx_state_tree_1.cast)({ configuration });
175
- },
176
169
  }));
177
170
  }
178
171
  exports.default = assemblyManagerFactory;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/core",
3
- "version": "2.15.3",
3
+ "version": "2.16.0",
4
4
  "description": "JBrowse 2 core libraries used by plugins",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -54,7 +54,6 @@
54
54
  "load-script": "^2.0.0",
55
55
  "material-ui-popup-state": "^5.0.0",
56
56
  "rbush": "^3.0.1",
57
- "react-error-boundary": "^4.0.3",
58
57
  "serialize-error": "^8.0.0",
59
58
  "source-map-js": "^1.0.2",
60
59
  "svg-path-generator": "^1.1.0"
@@ -73,5 +72,5 @@
73
72
  "access": "public",
74
73
  "directory": "dist"
75
74
  },
76
- "gitHead": "c0f82fe7b210622dd462e702641cc6da01109c6e"
75
+ "gitHead": "1e6d4fbc27ce684eed19e3c217f34bd2da24ab75"
77
76
  }
@@ -7,17 +7,22 @@ type BasicView = React.ComponentType<{
7
7
  session?: IAnyStateTreeNode;
8
8
  }>;
9
9
  type ViewComponentType = React.LazyExoticComponent<BasicView> | BasicView;
10
+ interface ViewMetadata {
11
+ hiddenFromGUI?: boolean;
12
+ }
10
13
  export default class ViewType extends PluggableElementBase {
11
14
  ReactComponent: ViewComponentType;
12
15
  stateModel: IAnyModelType;
13
16
  displayTypes: DisplayType[];
17
+ viewMetadata: ViewMetadata;
14
18
  extendedName?: string;
15
19
  constructor(stuff: {
16
20
  name: string;
17
21
  displayName?: string;
18
- ReactComponent: ViewComponentType;
19
22
  stateModel: IAnyModelType;
20
23
  extendedName?: string;
24
+ viewMetadata?: ViewMetadata;
25
+ ReactComponent: ViewComponentType;
21
26
  });
22
27
  addDisplayType(display: DisplayType): void;
23
28
  }
@@ -8,7 +8,9 @@ class ViewType extends PluggableElementBase_1.default {
8
8
  constructor(stuff) {
9
9
  super(stuff);
10
10
  this.displayTypes = [];
11
+ this.viewMetadata = {};
11
12
  this.ReactComponent = stuff.ReactComponent;
13
+ this.viewMetadata = stuff.viewMetadata || {};
12
14
  this.stateModel = stuff.stateModel;
13
15
  this.extendedName = stuff.extendedName;
14
16
  }
@@ -72,7 +72,6 @@ const OldHydrate = (0, mobx_react_1.observer)(function OldHydrate(props) {
72
72
  function doHydrate() {
73
73
  if (domNode && html) {
74
74
  if (domNode.innerHTML) {
75
- // eslint-disable-next-line @typescript-eslint/no-deprecated
76
75
  (0, react_dom_1.unmountComponentAtNode)(domNode);
77
76
  }
78
77
  // setting outline:none fixes react "focusable" element issue. see
@@ -83,7 +82,6 @@ const OldHydrate = (0, mobx_react_1.observer)(function OldHydrate(props) {
83
82
  // hydration for when we have some free time. helps keep the
84
83
  // framerate up.
85
84
  (0, util_1.rIC)(() => {
86
- // eslint-disable-next-line @typescript-eslint/no-deprecated
87
85
  (0, react_dom_1.hydrate)(react_1.default.createElement(RenderingComponent, { ...props }), domNode);
88
86
  });
89
87
  }
@@ -91,7 +89,6 @@ const OldHydrate = (0, mobx_react_1.observer)(function OldHydrate(props) {
91
89
  doHydrate();
92
90
  return () => {
93
91
  if (domNode) {
94
- // eslint-disable-next-line @typescript-eslint/no-deprecated
95
92
  (0, react_dom_1.unmountComponentAtNode)(domNode);
96
93
  }
97
94
  };
@@ -75,11 +75,9 @@ const OldHydrate = (0, mobx_react_1.observer)(function ({ theme, html, Rendering
75
75
  const domNode = ref.current;
76
76
  function doHydrate() {
77
77
  if (domNode) {
78
- // eslint-disable-next-line @typescript-eslint/no-deprecated
79
78
  (0, react_dom_1.unmountComponentAtNode)(domNode);
80
79
  domNode.innerHTML = html;
81
80
  (0, util_1.rIC)(() => {
82
- // eslint-disable-next-line @typescript-eslint/no-deprecated
83
81
  (0, react_dom_1.hydrate)(react_1.default.createElement(styles_1.ThemeProvider, { theme: jbrowseTheme },
84
82
  react_1.default.createElement(RenderingComponent, { ...rest })), domNode);
85
83
  });
@@ -88,7 +86,6 @@ const OldHydrate = (0, mobx_react_1.observer)(function ({ theme, html, Rendering
88
86
  doHydrate();
89
87
  return () => {
90
88
  if (domNode) {
91
- // eslint-disable-next-line @typescript-eslint/no-deprecated
92
89
  (0, react_dom_1.unmountComponentAtNode)(domNode);
93
90
  }
94
91
  };
@@ -5,7 +5,7 @@ const mobx_state_tree_1 = require("mobx-state-tree");
5
5
  const util_1 = require("../util");
6
6
  const remoteAbortSignals_1 = require("./remoteAbortSignals");
7
7
  const configuration_1 = require("../configuration");
8
- function isClonable(thing) {
8
+ function isCloneable(thing) {
9
9
  return !(typeof thing === 'function') && !(thing instanceof Error);
10
10
  }
11
11
  // watches the given worker object, returns a promise that will be rejected if
@@ -64,11 +64,11 @@ class BaseRpcDriver {
64
64
  this.workerCheckFrequency = 5000;
65
65
  this.config = args.config;
66
66
  }
67
- // filter the given object and just remove any non-clonable things from it
67
+ // filter the given object and just remove any non-cloneable things from it
68
68
  filterArgs(thing, sessionId) {
69
69
  if (Array.isArray(thing)) {
70
70
  return thing
71
- .filter(thing => isClonable(thing))
71
+ .filter(thing => isCloneable(thing))
72
72
  .map(t => this.filterArgs(t, sessionId));
73
73
  }
74
74
  if (typeof thing === 'object' && thing !== null) {
@@ -85,7 +85,7 @@ class BaseRpcDriver {
85
85
  return thing;
86
86
  }
87
87
  return Object.fromEntries(Object.entries(thing)
88
- .filter(e => isClonable(e[1]))
88
+ .filter(e => isCloneable(e[1]))
89
89
  .map(([k, v]) => [k, this.filterArgs(v, sessionId)]));
90
90
  }
91
91
  return thing;