@jbrowse/product-core 2.11.2 → 2.12.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 (38) hide show
  1. package/dist/RootModel/BaseRootModel.d.ts +14 -144
  2. package/dist/RootModel/BaseRootModel.js +2 -3
  3. package/dist/RootModel/FormatAbout.js +1 -2
  4. package/dist/RootModel/FormatDetails.js +1 -2
  5. package/dist/RootModel/HierarchicalConfig.js +1 -2
  6. package/dist/RootModel/InternetAccounts.js +1 -2
  7. package/dist/Session/BaseSession.d.ts +10 -8
  8. package/dist/Session/BaseSession.js +3 -4
  9. package/dist/Session/Connections.d.ts +29 -71
  10. package/dist/Session/Connections.js +2 -3
  11. package/dist/Session/DialogQueue.js +2 -3
  12. package/dist/Session/DrawerWidgets.js +2 -3
  13. package/dist/Session/MultipleViews.d.ts +84 -461
  14. package/dist/Session/MultipleViews.js +2 -3
  15. package/dist/Session/ReferenceManagement.js +2 -3
  16. package/dist/Session/SessionTracks.d.ts +69 -525
  17. package/dist/Session/SessionTracks.js +2 -3
  18. package/dist/Session/Themes.js +2 -3
  19. package/dist/Session/Tracks.d.ts +62 -535
  20. package/dist/Session/Tracks.js +2 -3
  21. package/dist/rpcWorker.js +1 -2
  22. package/dist/ui/AboutDialog.js +1 -2
  23. package/dist/ui/AboutDialogContents.d.ts +3 -2
  24. package/dist/ui/AboutDialogContents.js +19 -10
  25. package/dist/ui/FileInfoPanel.js +1 -1
  26. package/dist/ui/RefNameInfoDialog.d.ts +7 -0
  27. package/dist/ui/RefNameInfoDialog.js +110 -0
  28. package/esm/RootModel/BaseRootModel.d.ts +14 -144
  29. package/esm/Session/BaseSession.d.ts +10 -8
  30. package/esm/Session/Connections.d.ts +29 -71
  31. package/esm/Session/MultipleViews.d.ts +84 -461
  32. package/esm/Session/SessionTracks.d.ts +69 -525
  33. package/esm/Session/Tracks.d.ts +62 -535
  34. package/esm/ui/AboutDialogContents.d.ts +3 -2
  35. package/esm/ui/AboutDialogContents.js +19 -9
  36. package/esm/ui/RefNameInfoDialog.d.ts +7 -0
  37. package/esm/ui/RefNameInfoDialog.js +82 -0
  38. package/package.json +3 -3
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { AnyConfigurationModel } from '@jbrowse/core/configuration';
3
- export default function AboutContents({ config, }: {
3
+ declare const AboutDialogContents: ({ config, }: {
4
4
  config: AnyConfigurationModel;
5
- }): React.JSX.Element;
5
+ }) => React.JSX.Element;
6
+ export default AboutDialogContents;
@@ -1,4 +1,5 @@
1
1
  import React, { useState } from 'react';
2
+ import { observer } from 'mobx-react';
2
3
  import clone from 'clone';
3
4
  import copy from 'copy-to-clipboard';
4
5
  import { Button } from '@mui/material';
@@ -7,10 +8,14 @@ import { getConf, readConfObject, } from '@jbrowse/core/configuration';
7
8
  import { getSession, getEnv } from '@jbrowse/core/util';
8
9
  import { BaseCard, Attributes, } from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail';
9
10
  import FileInfoPanel from './FileInfoPanel';
11
+ import RefNameInfoDialog from './RefNameInfoDialog';
10
12
  const useStyles = makeStyles()({
11
13
  content: {
12
14
  minWidth: 800,
13
15
  },
16
+ button: {
17
+ float: 'right',
18
+ },
14
19
  });
15
20
  function removeAttr(obj, attr) {
16
21
  for (const prop in obj) {
@@ -23,11 +28,12 @@ function removeAttr(obj, attr) {
23
28
  }
24
29
  return obj;
25
30
  }
26
- export default function AboutContents({ config, }) {
31
+ const AboutDialogContents = observer(function ({ config, }) {
27
32
  const [copied, setCopied] = useState(false);
28
33
  const conf = readConfObject(config);
29
34
  const session = getSession(config);
30
35
  const { classes } = useStyles();
36
+ const [showRefNames, setShowRefNames] = useState(false);
31
37
  const hideUris = getConf(session, ['formatAbout', 'hideUris']) ||
32
38
  readConfObject(config, ['formatAbout', 'hideUris']);
33
39
  const { pluginManager } = getEnv(session);
@@ -41,14 +47,18 @@ export default function AboutContents({ config, }) {
41
47
  const ExtraPanel = pluginManager.evaluateExtensionPoint('Core-extraAboutPanel', null, { session, config });
42
48
  return (React.createElement("div", { className: classes.content },
43
49
  React.createElement(BaseCard, { title: "Configuration" },
44
- !hideUris ? (React.createElement(Button, { variant: "contained", style: { float: 'right' }, onClick: () => {
45
- const snap = removeAttr(clone(conf), 'baseUri');
46
- copy(JSON.stringify(snap, null, 2));
47
- setCopied(true);
48
- setTimeout(() => setCopied(false), 1000);
49
- } }, copied ? 'Copied to clipboard!' : 'Copy config')) : null,
50
+ !hideUris ? (React.createElement("span", { className: classes.button },
51
+ React.createElement(Button, { variant: "contained", color: "secondary", onClick: () => setShowRefNames(true) }, "Show ref names"),
52
+ React.createElement(Button, { variant: "contained", onClick: () => {
53
+ const snap = removeAttr(clone(conf), 'baseUri');
54
+ copy(JSON.stringify(snap, null, 2));
55
+ setCopied(true);
56
+ setTimeout(() => setCopied(false), 1000);
57
+ } }, copied ? 'Copied to clipboard!' : 'Copy config'))) : null,
50
58
  React.createElement(Attributes, { attributes: confPostExt, omit: ['displays', 'baseUri', 'refNames', 'formatAbout'], hideUris: hideUris })),
51
59
  ExtraPanel ? (React.createElement(BaseCard, { title: ExtraPanel.name },
52
60
  React.createElement(ExtraPanel.Component, { config: config }))) : null,
53
- React.createElement(FileInfoPanel, { config: config })));
54
- }
61
+ React.createElement(FileInfoPanel, { config: config }),
62
+ showRefNames ? (React.createElement(RefNameInfoDialog, { config: config, onClose: () => setShowRefNames(false) })) : null));
63
+ });
64
+ export default AboutDialogContents;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { AnyConfigurationModel } from '@jbrowse/core/configuration';
3
+ declare const RefNameInfoDialog: ({ config, onClose, }: {
4
+ config: AnyConfigurationModel;
5
+ onClose: () => void;
6
+ }) => React.JSX.Element;
7
+ export default RefNameInfoDialog;
@@ -0,0 +1,82 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import { Button, DialogContent, Typography } from '@mui/material';
3
+ import { readConfObject, } from '@jbrowse/core/configuration';
4
+ import { Dialog, LoadingEllipses } from '@jbrowse/core/ui';
5
+ import { getSession } from '@jbrowse/core/util';
6
+ import { getConfAssemblyNames } from '@jbrowse/core/util/tracks';
7
+ import { observer } from 'mobx-react';
8
+ import { makeStyles } from 'tss-react/mui';
9
+ import copy from 'copy-to-clipboard';
10
+ const MAX_REF_NAMES = 10000;
11
+ const useStyles = makeStyles()(theme => ({
12
+ container: {
13
+ minWidth: 800,
14
+ },
15
+ refNames: {
16
+ maxHeight: 300,
17
+ width: '100%',
18
+ overflow: 'auto',
19
+ flexGrow: 1,
20
+ background: theme.palette.background.default,
21
+ },
22
+ }));
23
+ const RefNameInfoDialog = observer(function ({ config, onClose, }) {
24
+ const [error, setError] = useState();
25
+ const [refNames, setRefNames] = useState();
26
+ const [copied, setCopied] = useState(false);
27
+ const { classes } = useStyles();
28
+ const session = getSession(config);
29
+ const { rpcManager } = session;
30
+ useEffect(() => {
31
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
32
+ ;
33
+ (async () => {
34
+ try {
35
+ const map = await Promise.all([...new Set(getConfAssemblyNames(config))].map(async (assemblyName) => {
36
+ const adapterConfig = readConfObject(config, 'adapter');
37
+ return [
38
+ assemblyName,
39
+ (await rpcManager.call(config.trackId, 'CoreGetRefNames', {
40
+ adapterConfig,
41
+ // hack for synteny adapters
42
+ regions: [{ assemblyName }],
43
+ })),
44
+ ];
45
+ }));
46
+ setRefNames(Object.fromEntries(map));
47
+ }
48
+ catch (e) {
49
+ console.error(e);
50
+ setError(e);
51
+ }
52
+ })();
53
+ }, [config, rpcManager]);
54
+ const names = refNames ? Object.entries(refNames) : [];
55
+ const result = names
56
+ .flatMap(([assemblyName, refNames]) => {
57
+ return [
58
+ `--- ${assemblyName} ---`,
59
+ ...refNames.slice(0, MAX_REF_NAMES),
60
+ `${refNames.length > MAX_REF_NAMES
61
+ ? `\nToo many refNames to show in browser for ${assemblyName}, use "Copy ref names" button to copy to clipboard`
62
+ : ''}`,
63
+ ];
64
+ })
65
+ .filter(f => !!f)
66
+ .join('\n');
67
+ return (React.createElement(Dialog, { open: true, title: "Reference sequence names used in track", onClose: onClose },
68
+ React.createElement(DialogContent, { className: classes.container }, error ? (React.createElement(Typography, { color: "error" }, `${error}`)) : refNames === undefined ? (React.createElement(LoadingEllipses, { message: "Loading refNames" })) : (React.createElement(React.Fragment, null,
69
+ React.createElement(Button, { variant: "contained", onClick: () => {
70
+ copy(names
71
+ .flatMap(([assemblyName, refNames]) => [
72
+ `--- ${assemblyName} ---`,
73
+ ...refNames,
74
+ ])
75
+ .filter(f => !!f)
76
+ .join('\n'));
77
+ setCopied(true);
78
+ setTimeout(() => setCopied(false), 1000);
79
+ } }, copied ? 'Copied to clipboard!' : 'Copy ref names'),
80
+ React.createElement("pre", { className: classes.refNames }, result))))));
81
+ });
82
+ export default RefNameInfoDialog;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/product-core",
3
- "version": "2.11.2",
3
+ "version": "2.12.1",
4
4
  "sideEffects": false,
5
5
  "description": "JBrowse 2 code shared between products but not used by plugins",
6
6
  "keywords": [
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@babel/runtime": "^7.16.3",
46
- "@jbrowse/core": "^2.11.2",
46
+ "@jbrowse/core": "^2.12.1",
47
47
  "@mui/icons-material": "^5.0.0",
48
48
  "@mui/material": "^5.10.17",
49
49
  "copy-to-clipboard": "^3.3.1",
@@ -63,5 +63,5 @@
63
63
  "publishConfig": {
64
64
  "access": "public"
65
65
  },
66
- "gitHead": "511048cb6965f0bf624c96de244e7fd47fce17d6"
66
+ "gitHead": "20f16ae5a56ae5e4806aaa373131e540b0b5b0fd"
67
67
  }