@apollo-annotation/jbrowse-plugin-apollo 0.1.19 → 0.1.21

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.
package/dist/index.esm.js CHANGED
@@ -49,7 +49,7 @@ import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
49
49
  import ErrorIcon from '@mui/icons-material/Error';
50
50
  import SaveIcon from '@mui/icons-material/Save';
51
51
 
52
- var version = "0.1.19";
52
+ var version = "0.1.21";
53
53
 
54
54
  const ApolloConfigSchema = ConfigurationSchema('ApolloInternetAccount', {
55
55
  baseURL: {
@@ -312,7 +312,7 @@ function AddAssembly({ changeManager, handleClose, session, }) {
312
312
  const fileUploadChangeBase = {
313
313
  assembly: new ObjectID().toHexString(),
314
314
  assemblyName,
315
- fileId,
315
+ fileIds: { fa: fileId },
316
316
  };
317
317
  change =
318
318
  fileType === FileType.GFF3 && importFeatures
@@ -2421,7 +2421,26 @@ function ManageUsers({ changeManager, handleClose, session, }) {
2421
2421
  headerName: 'Role',
2422
2422
  width: 140,
2423
2423
  type: 'singleSelect',
2424
- valueOptions: ['', 'readOnly', 'user', 'admin'],
2424
+ valueOptions: ['readOnly', 'user', 'admin', 'none'],
2425
+ getOptionLabel(value) {
2426
+ switch (value) {
2427
+ case 'readOnly': {
2428
+ return 'Read-only';
2429
+ }
2430
+ case 'user': {
2431
+ return 'User';
2432
+ }
2433
+ case 'admin': {
2434
+ return 'Admin';
2435
+ }
2436
+ case 'none': {
2437
+ return 'None';
2438
+ }
2439
+ default: {
2440
+ return 'unknown';
2441
+ }
2442
+ }
2443
+ },
2425
2444
  editable: true,
2426
2445
  },
2427
2446
  {
@@ -4037,7 +4056,7 @@ class ApolloSequenceAdapter extends BaseSequenceAdapter {
4037
4056
  freeResources( /* { region } */) { }
4038
4057
  }
4039
4058
 
4040
- var configSchema$2 = ConfigurationSchema('ApolloSequenceAdapter', {
4059
+ var configSchema$3 = ConfigurationSchema('ApolloSequenceAdapter', {
4041
4060
  assemblyId: {
4042
4061
  type: 'string',
4043
4062
  defaultValue: '',
@@ -4047,7 +4066,7 @@ var configSchema$2 = ConfigurationSchema('ApolloSequenceAdapter', {
4047
4066
  function installApolloSequenceAdapter(pluginManager) {
4048
4067
  pluginManager.addAdapterType(() => new AdapterType({
4049
4068
  name: 'ApolloSequenceAdapter',
4050
- configSchema: configSchema$2,
4069
+ configSchema: configSchema$3,
4051
4070
  adapterMetadata: {
4052
4071
  category: undefined,
4053
4072
  hiddenFromGUI: true,
@@ -4641,7 +4660,7 @@ class ApolloTextSearchAdapter extends BaseAdapter {
4641
4660
  freeResources() { }
4642
4661
  }
4643
4662
 
4644
- var configSchema$1 = ConfigurationSchema('ApolloTextSearchAdapter', {
4663
+ var configSchema$2 = ConfigurationSchema('ApolloTextSearchAdapter', {
4645
4664
  assemblyNames: {
4646
4665
  type: 'stringArray',
4647
4666
  defaultValue: [],
@@ -4664,7 +4683,7 @@ function installApolloTextSearchAdapter(pluginManager) {
4664
4683
  pluginManager.addTextSearchAdapterType(() => new TextSearchAdapterType({
4665
4684
  name: 'ApolloTextSearchAdapter',
4666
4685
  displayName: 'Apollo text search adapter',
4667
- configSchema: configSchema$1,
4686
+ configSchema: configSchema$2,
4668
4687
  AdapterClass: ApolloTextSearchAdapter,
4669
4688
  description: 'Apollo Text Search adapter',
4670
4689
  }));
@@ -5967,11 +5986,7 @@ const ApolloTranscriptDetailsWidget = observer(function ApolloTranscriptDetails(
5967
5986
  React__default.createElement(TranscriptSequence, { feature: feature, session: apolloSession, assembly: currentAssembly._id || '', refName: refName })));
5968
5987
  });
5969
5988
 
5970
- function configSchemaFactory$1(pluginManager) {
5971
- const LGVPlugin = pluginManager.getPlugin('LinearGenomeViewPlugin');
5972
- const { baseLinearDisplayConfigSchema } = LGVPlugin.exports;
5973
- return ConfigurationSchema('LinearApolloDisplay', { height: { type: 'number', defaultValue: 500 } }, { baseConfiguration: baseLinearDisplayConfigSchema, explicitlyTyped: true });
5974
- }
5989
+ const configSchema$1 = ConfigurationSchema('LinearApolloDisplay', {}, { explicitIdentifier: 'displayId', explicitlyTyped: true });
5975
5990
 
5976
5991
  function handleFeatureTypeChange(changeManager, feature, oldType, newType) {
5977
5992
  const featureId = feature._id;
@@ -6215,56 +6230,16 @@ const NumberCell = observer(function NumberCell({ initialValue, notifyError, onC
6215
6230
  } })));
6216
6231
  });
6217
6232
 
6218
- // TODO: get this added to LGV runtime exports so we don't have to duplicate it
6219
6233
  const minDisplayHeight = 20;
6220
- /**
6221
- * #stateModel TrackHeightMixin
6222
- * #category display
6223
- */
6224
- const TrackHeightMixin = types
6225
- .model({
6226
- heightPreConfig: types.maybe(types.refinement('displayHeight', types.number, (n) => n >= minDisplayHeight)),
6227
- })
6228
- .volatile(() => ({
6229
- scrollTop: 0,
6230
- }))
6231
- .views((self) => ({
6232
- get height() {
6233
- // @ts-expect-error getConf needs self.configuration
6234
- return self.heightPreConfig ?? getConf(self, 'height');
6235
- },
6236
- }))
6237
- .actions((self) => ({
6238
- setScrollTop(scrollTop) {
6239
- self.scrollTop = scrollTop;
6240
- },
6241
- setHeight(displayHeight) {
6242
- self.heightPreConfig = Math.max(displayHeight, minDisplayHeight);
6243
- return self.height;
6244
- },
6245
- resizeHeight(distance) {
6246
- const oldHeight = self.height;
6247
- const newHeight = this.setHeight(self.height + distance);
6248
- return newHeight - oldHeight;
6249
- },
6250
- }));
6251
-
6252
6234
  function baseModelFactory(_pluginManager, configSchema) {
6253
- // TODO: Restore this when TRackHeightMixin is in LGV runtime exports
6254
- // const LGVPlugin = pluginManager.getPlugin(
6255
- // 'LinearGenomeViewPlugin',
6256
- // ) as LinearGenomeViewPlugin
6257
- // const { TrackHeightMixin } = LGVPlugin.exports
6258
- return types
6259
- .compose(BaseDisplay, TrackHeightMixin)
6260
- .named('BaseLinearApolloDisplay')
6235
+ return BaseDisplay.named('BaseLinearApolloDisplay')
6261
6236
  .props({
6262
6237
  type: types.literal('LinearApolloDisplay'),
6263
6238
  configuration: ConfigurationReference(configSchema),
6239
+ graphical: true,
6240
+ table: false,
6241
+ heightPreConfig: types.maybe(types.refinement('displayHeight', types.number, (n) => n >= minDisplayHeight)),
6264
6242
  })
6265
- .volatile((self) => ({
6266
- lgv: getContainingView(self),
6267
- }))
6268
6243
  .views((self) => {
6269
6244
  const { configuration, renderProps: superRenderProps } = self;
6270
6245
  return {
@@ -6277,6 +6252,26 @@ function baseModelFactory(_pluginManager, configSchema) {
6277
6252
  },
6278
6253
  };
6279
6254
  })
6255
+ .volatile(() => ({
6256
+ scrollTop: 0,
6257
+ }))
6258
+ .views((self) => ({
6259
+ get lgv() {
6260
+ return getContainingView(self);
6261
+ },
6262
+ get height() {
6263
+ if (self.heightPreConfig) {
6264
+ return self.heightPreConfig;
6265
+ }
6266
+ if (self.graphical && self.table) {
6267
+ return 500;
6268
+ }
6269
+ if (self.graphical) {
6270
+ return 200;
6271
+ }
6272
+ return 300;
6273
+ },
6274
+ }))
6280
6275
  .views((self) => ({
6281
6276
  get rendererTypeName() {
6282
6277
  return self.configuration.renderer.type;
@@ -6333,6 +6328,73 @@ function baseModelFactory(_pluginManager, configSchema) {
6333
6328
  .apolloSelectedFeature;
6334
6329
  },
6335
6330
  }))
6331
+ .actions((self) => ({
6332
+ setScrollTop(scrollTop) {
6333
+ self.scrollTop = scrollTop;
6334
+ },
6335
+ setHeight(displayHeight) {
6336
+ self.heightPreConfig = Math.max(displayHeight, minDisplayHeight);
6337
+ return self.height;
6338
+ },
6339
+ resizeHeight(distance) {
6340
+ const oldHeight = self.height;
6341
+ const newHeight = this.setHeight(self.height + distance);
6342
+ return newHeight - oldHeight;
6343
+ },
6344
+ showGraphicalOnly() {
6345
+ self.graphical = true;
6346
+ self.table = false;
6347
+ },
6348
+ showTableOnly() {
6349
+ self.graphical = false;
6350
+ self.table = true;
6351
+ },
6352
+ showGraphicalAndTable() {
6353
+ self.graphical = true;
6354
+ self.table = true;
6355
+ },
6356
+ }))
6357
+ .views((self) => {
6358
+ const { trackMenuItems: superTrackMenuItems } = self;
6359
+ return {
6360
+ trackMenuItems() {
6361
+ const { graphical, table } = self;
6362
+ return [
6363
+ ...superTrackMenuItems(),
6364
+ {
6365
+ type: 'subMenu',
6366
+ label: 'Appearance',
6367
+ subMenu: [
6368
+ {
6369
+ label: 'Show graphical display',
6370
+ type: 'radio',
6371
+ checked: graphical && !table,
6372
+ onClick: () => {
6373
+ self.showGraphicalOnly();
6374
+ },
6375
+ },
6376
+ {
6377
+ label: 'Show table display',
6378
+ type: 'radio',
6379
+ checked: table && !graphical,
6380
+ onClick: () => {
6381
+ self.showTableOnly();
6382
+ },
6383
+ },
6384
+ {
6385
+ label: 'Show both graphical and table display',
6386
+ type: 'radio',
6387
+ checked: table && graphical,
6388
+ onClick: () => {
6389
+ self.showGraphicalAndTable();
6390
+ },
6391
+ },
6392
+ ],
6393
+ },
6394
+ ];
6395
+ },
6396
+ };
6397
+ })
6336
6398
  .actions((self) => ({
6337
6399
  setSelectedFeature(feature) {
6338
6400
  self.session.apolloSetSelectedFeature(feature);
@@ -8346,7 +8408,7 @@ const useStyles$1 = makeStyles()((theme) => ({
8346
8408
  const LinearApolloDisplay = observer(function LinearApolloDisplay(props) {
8347
8409
  const theme = useTheme();
8348
8410
  const { model } = props;
8349
- const { apolloRowHeight, contextMenuItems: getContextMenuItems, cursor, featuresHeight, isShown, onMouseDown, onMouseLeave, onMouseMove, onMouseUp, regionCannotBeRendered, session, setCanvas, setCollaboratorCanvas, setOverlayCanvas, setSeqTrackCanvas, setSeqTrackOverlayCanvas, setTheme, tabularEditor, } = model;
8411
+ const { apolloRowHeight, contextMenuItems: getContextMenuItems, cursor, featuresHeight, isShown, onMouseDown, onMouseLeave, onMouseMove, onMouseUp, regionCannotBeRendered, session, setCanvas, setCollaboratorCanvas, setOverlayCanvas, setSeqTrackCanvas, setSeqTrackOverlayCanvas, setTheme, } = model;
8350
8412
  const { classes } = useStyles$1();
8351
8413
  const lgv = getContainingView(model);
8352
8414
  useEffect(() => {
@@ -8403,9 +8465,7 @@ const LinearApolloDisplay = observer(function LinearApolloDisplay(props) {
8403
8465
  React__default.createElement("canvas", { ref: async (node) => {
8404
8466
  await Promise.resolve();
8405
8467
  setOverlayCanvas(node);
8406
- }, width: lgv.dynamicBlocks.totalWidthPx, height: featuresHeight, onMouseMove: onMouseMove, onMouseLeave: onMouseLeave, onMouseDown: onMouseDown, onMouseUp: onMouseUp, onClick: () => {
8407
- tabularEditor.showPane();
8408
- }, className: classes.canvas, style: { cursor: cursor ?? 'default' }, "data-testid": "overlayCanvas" }),
8468
+ }, width: lgv.dynamicBlocks.totalWidthPx, height: featuresHeight, onMouseMove: onMouseMove, onMouseLeave: onMouseLeave, onMouseDown: onMouseDown, onMouseUp: onMouseUp, className: classes.canvas, style: { cursor: cursor ?? 'default' }, "data-testid": "overlayCanvas" }),
8409
8469
  lgv.displayedRegions.flatMap((region, idx) => {
8410
8470
  const assembly = assemblyManager.get(region.assemblyName);
8411
8471
  return [...session.apolloDataStore.checkResults.values()]
@@ -8541,25 +8601,33 @@ const AccordionControl = observer(function AccordionControl({ onClick, onResize,
8541
8601
  });
8542
8602
  const DisplayComponent = observer(function DisplayComponent({ model, ...other }) {
8543
8603
  const { classes } = useStyles();
8544
- const { height: overallHeight, isShown, selectedFeature, tabularEditor, toggleShown, } = model;
8545
- const detailsHeight = tabularEditor.isShown ? model.detailsHeight : 0;
8546
- const featureAreaHeight = isShown
8547
- ? overallHeight - detailsHeight - accordionControlHeight * 2
8548
- : 0;
8549
- const onDetailsResize = (delta) => {
8550
- model.setDetailsHeight(model.detailsHeight - delta);
8551
- };
8604
+ const { detailsHeight, graphical, height: overallHeight, isShown, selectedFeature, table, tabularEditor, toggleShown, } = model;
8552
8605
  const canvasScrollContainerRef = useRef(null);
8553
8606
  useEffect(() => {
8554
8607
  scrollSelectedFeatureIntoView(model, canvasScrollContainerRef);
8555
8608
  }, [model, selectedFeature]);
8609
+ const onDetailsResize = (delta) => {
8610
+ model.setDetailsHeight(detailsHeight - delta);
8611
+ };
8612
+ if (graphical && table) {
8613
+ const tabularHeight = tabularEditor.isShown ? detailsHeight : 0;
8614
+ const featureAreaHeight = isShown
8615
+ ? overallHeight - detailsHeight - accordionControlHeight * 2
8616
+ : 0;
8617
+ return (React__default.createElement("div", { style: { height: overallHeight } },
8618
+ React__default.createElement(AccordionControl, { open: isShown, title: "Graphical", onClick: toggleShown }),
8619
+ React__default.createElement("div", { className: classes.shading, ref: canvasScrollContainerRef, style: { height: featureAreaHeight } },
8620
+ React__default.createElement(LinearApolloDisplay, { model: model, ...other })),
8621
+ React__default.createElement(AccordionControl, { title: "Table", open: tabularEditor.isShown, onClick: tabularEditor.togglePane, onResize: onDetailsResize }),
8622
+ React__default.createElement("div", { className: classes.details, style: { height: tabularHeight } },
8623
+ React__default.createElement(TabularEditorPane, { model: model }))));
8624
+ }
8625
+ if (graphical) {
8626
+ return (React__default.createElement("div", { className: classes.shading, ref: canvasScrollContainerRef, style: { height: overallHeight } },
8627
+ React__default.createElement(LinearApolloDisplay, { model: model, ...other })));
8628
+ }
8556
8629
  return (React__default.createElement("div", { className: classes.details, style: { height: overallHeight } },
8557
- React__default.createElement(AccordionControl, { open: isShown, title: "Graphical", onClick: toggleShown }),
8558
- React__default.createElement("div", { className: classes.shading, ref: canvasScrollContainerRef, style: { height: featureAreaHeight } },
8559
- React__default.createElement(LinearApolloDisplay, { model: model, ...other })),
8560
- React__default.createElement(AccordionControl, { title: "Table", open: tabularEditor.isShown, onClick: tabularEditor.togglePane, onResize: onDetailsResize }),
8561
- React__default.createElement("div", { style: { height: detailsHeight } },
8562
- React__default.createElement(TabularEditorPane, { model: model }))));
8630
+ React__default.createElement(TabularEditorPane, { model: model })));
8563
8631
  });
8564
8632
  function makeSixFrameDisplayComponent(pluginManager) {
8565
8633
  const LGVPlugin = pluginManager.getPlugin('LinearGenomeViewPlugin');
@@ -9680,9 +9748,9 @@ function extendSession(pluginManager, sessionModel) {
9680
9748
  if (Object.keys(filteredConfig).length === 0) {
9681
9749
  filteredConfig = undefined;
9682
9750
  }
9683
- let trackConfigSnapshot = getSnapshot(conf);
9751
+ const trackConfigSnapshot = getSnapshot(conf);
9684
9752
  const newTrackId = trackId.slice(0, trackId.length - sessionTrackIdentifier.length);
9685
- trackConfigSnapshot = {
9753
+ const newTrackConfigSnapshot = {
9686
9754
  ...trackConfigSnapshot,
9687
9755
  trackId: newTrackId,
9688
9756
  };
@@ -9697,7 +9765,7 @@ function extendSession(pluginManager, sessionModel) {
9697
9765
  ...filteredConfig,
9698
9766
  tracks: filteredConfig?.tracks && [
9699
9767
  ...filteredConfig.tracks,
9700
- trackConfigSnapshot,
9768
+ newTrackConfigSnapshot,
9701
9769
  ],
9702
9770
  },
9703
9771
  });
@@ -9708,6 +9776,10 @@ function extendSession(pluginManager, sessionModel) {
9708
9776
  const { notify } = self;
9709
9777
  notify('Track added', 'success');
9710
9778
  }
9779
+ // @ts-expect-error This method is missing in the JB types
9780
+ self.deleteTrackConf(conf);
9781
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call
9782
+ jbrowse.addTrackConf(newTrackConfigSnapshot);
9711
9783
  },
9712
9784
  icon: SaveIcon,
9713
9785
  },
@@ -9744,6 +9816,10 @@ function extendSession(pluginManager, sessionModel) {
9744
9816
  const { notify } = self;
9745
9817
  notify('Track removed', 'success');
9746
9818
  }
9819
+ // @ts-expect-error This method is missing in the JB types
9820
+ self.deleteTrackConf(conf);
9821
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call
9822
+ jbrowse.deleteTrackConf(conf);
9747
9823
  },
9748
9824
  icon: SaveIcon,
9749
9825
  },
@@ -10271,7 +10347,7 @@ class ApolloPlugin extends Plugin {
10271
10347
  });
10272
10348
  });
10273
10349
  pluginManager.addDisplayType(() => {
10274
- const configSchema = configSchemaFactory$1(pluginManager);
10350
+ const configSchema = configSchema$1;
10275
10351
  return new DisplayType({
10276
10352
  name: 'LinearApolloDisplay',
10277
10353
  configSchema,