@jbrowse/product-core 3.7.0 → 4.0.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 (97) hide show
  1. package/esm/RootModel/BaseRootModel.d.ts +52 -37
  2. package/esm/RootModel/BaseRootModel.js +1 -1
  3. package/esm/RootModel/FormatAbout.d.ts +2 -2
  4. package/esm/RootModel/FormatDetails.d.ts +2 -2
  5. package/esm/RootModel/HierarchicalConfig.d.ts +6 -6
  6. package/esm/RootModel/InternetAccounts.d.ts +4 -4
  7. package/esm/RootModel/InternetAccounts.js +3 -3
  8. package/esm/RootModel/index.d.ts +5 -5
  9. package/esm/RootModel/index.js +5 -5
  10. package/esm/Session/BaseSession.d.ts +12 -8
  11. package/esm/Session/BaseSession.js +12 -2
  12. package/esm/Session/Connections.d.ts +7 -144
  13. package/esm/Session/Connections.js +13 -3
  14. package/esm/Session/DialogQueue.d.ts +3 -3
  15. package/esm/Session/DialogQueue.js +4 -6
  16. package/esm/Session/DrawerWidgets.d.ts +17 -9
  17. package/esm/Session/DrawerWidgets.js +32 -8
  18. package/esm/Session/MultipleViews.d.ts +189 -127
  19. package/esm/Session/MultipleViews.js +27 -10
  20. package/esm/Session/ReferenceManagement.d.ts +3 -3
  21. package/esm/Session/ReferenceManagement.js +10 -4
  22. package/esm/Session/SessionTracks.d.ts +178 -122
  23. package/esm/Session/SessionTracks.js +13 -3
  24. package/esm/Session/Themes.d.ts +3 -3
  25. package/esm/Session/Themes.js +3 -3
  26. package/esm/Session/Tracks.d.ts +175 -121
  27. package/esm/Session/Tracks.js +16 -3
  28. package/esm/Session/index.d.ts +10 -10
  29. package/esm/Session/index.js +10 -10
  30. package/esm/index.d.ts +4 -4
  31. package/esm/index.js +4 -4
  32. package/esm/rpcWorker.d.ts +6 -0
  33. package/esm/rpcWorker.js +12 -6
  34. package/esm/ui/AboutDialog.d.ts +4 -2
  35. package/esm/ui/AboutDialog.js +4 -5
  36. package/esm/ui/AboutDialogContents.d.ts +4 -2
  37. package/esm/ui/AboutDialogContents.js +13 -12
  38. package/esm/ui/FileInfoPanel.d.ts +4 -2
  39. package/esm/ui/FileInfoPanel.js +6 -7
  40. package/esm/ui/HeaderButtons.js +4 -4
  41. package/esm/ui/RefNameInfoDialog.d.ts +4 -2
  42. package/esm/ui/RefNameInfoDialog.js +13 -13
  43. package/esm/ui/index.d.ts +1 -1
  44. package/esm/ui/index.js +1 -1
  45. package/esm/ui/util.d.ts +5 -2
  46. package/esm/ui/util.js +23 -5
  47. package/package.json +24 -34
  48. package/dist/RootModel/BaseRootModel.d.ts +0 -534
  49. package/dist/RootModel/BaseRootModel.js +0 -57
  50. package/dist/RootModel/FormatAbout.d.ts +0 -12
  51. package/dist/RootModel/FormatAbout.js +0 -18
  52. package/dist/RootModel/FormatDetails.d.ts +0 -24
  53. package/dist/RootModel/FormatDetails.js +0 -30
  54. package/dist/RootModel/HierarchicalConfig.d.ts +0 -26
  55. package/dist/RootModel/HierarchicalConfig.js +0 -32
  56. package/dist/RootModel/InternetAccounts.d.ts +0 -15
  57. package/dist/RootModel/InternetAccounts.js +0 -79
  58. package/dist/RootModel/index.d.ts +0 -5
  59. package/dist/RootModel/index.js +0 -21
  60. package/dist/Session/BaseSession.d.ts +0 -31
  61. package/dist/Session/BaseSession.js +0 -63
  62. package/dist/Session/Connections.d.ts +0 -158
  63. package/dist/Session/Connections.js +0 -84
  64. package/dist/Session/DialogQueue.d.ts +0 -15
  65. package/dist/Session/DialogQueue.js +0 -37
  66. package/dist/Session/DrawerWidgets.d.ts +0 -28
  67. package/dist/Session/DrawerWidgets.js +0 -107
  68. package/dist/Session/MultipleViews.d.ts +0 -1681
  69. package/dist/Session/MultipleViews.js +0 -75
  70. package/dist/Session/ReferenceManagement.d.ts +0 -15
  71. package/dist/Session/ReferenceManagement.js +0 -71
  72. package/dist/Session/SessionTracks.d.ts +0 -1664
  73. package/dist/Session/SessionTracks.js +0 -54
  74. package/dist/Session/Themes.d.ts +0 -18
  75. package/dist/Session/Themes.js +0 -47
  76. package/dist/Session/Tracks.d.ts +0 -1657
  77. package/dist/Session/Tracks.js +0 -36
  78. package/dist/Session/index.d.ts +0 -10
  79. package/dist/Session/index.js +0 -26
  80. package/dist/index.d.ts +0 -4
  81. package/dist/index.js +0 -20
  82. package/dist/rpcWorker.d.ts +0 -6
  83. package/dist/rpcWorker.js +0 -57
  84. package/dist/ui/AboutDialog.d.ts +0 -5
  85. package/dist/ui/AboutDialog.js +0 -18
  86. package/dist/ui/AboutDialogContents.d.ts +0 -5
  87. package/dist/ui/AboutDialogContents.js +0 -41
  88. package/dist/ui/FileInfoPanel.d.ts +0 -4
  89. package/dist/ui/FileInfoPanel.js +0 -43
  90. package/dist/ui/HeaderButtons.d.ts +0 -6
  91. package/dist/ui/HeaderButtons.js +0 -31
  92. package/dist/ui/RefNameInfoDialog.d.ts +0 -6
  93. package/dist/ui/RefNameInfoDialog.js +0 -87
  94. package/dist/ui/index.d.ts +0 -1
  95. package/dist/ui/index.js +0 -17
  96. package/dist/ui/util.d.ts +0 -12
  97. package/dist/ui/util.js +0 -28
@@ -1,6 +1,6 @@
1
- import { types } from 'mobx-state-tree';
2
- import { BaseSessionModel, isBaseSession } from './BaseSession';
3
- import { ReferenceManagementSessionMixin } from './ReferenceManagement';
1
+ import { types } from '@jbrowse/mobx-state-tree';
2
+ import { BaseSessionModel, isBaseSession } from "./BaseSession.js";
3
+ import { ReferenceManagementSessionMixin } from "./ReferenceManagement.js";
4
4
  export function TracksManagerSessionMixin(pluginManager) {
5
5
  return types
6
6
  .compose('TracksManagerSessionMixin', BaseSessionModel(pluginManager), ReferenceManagementSessionMixin(pluginManager))
@@ -8,6 +8,19 @@ export function TracksManagerSessionMixin(pluginManager) {
8
8
  get tracks() {
9
9
  return self.jbrowse.tracks;
10
10
  },
11
+ get assemblies() {
12
+ return self.jbrowse.assemblies;
13
+ },
14
+ get tracksById() {
15
+ const temporaryAssemblies = 'temporaryAssemblies' in self
16
+ ? self.temporaryAssemblies
17
+ : [];
18
+ return Object.fromEntries([
19
+ ...this.tracks.map(t => [t.trackId, t]),
20
+ ...this.assemblies.map(a => [a.sequence.trackId, a.sequence]),
21
+ ...temporaryAssemblies.map(a => [a.sequence.trackId, a.sequence]),
22
+ ]);
23
+ },
11
24
  }))
12
25
  .actions(self => ({
13
26
  addTrackConf(trackConf) {
@@ -1,10 +1,10 @@
1
- export * from './ReferenceManagement';
2
- export * from './Connections';
3
- export * from './DrawerWidgets';
4
- export * from './DialogQueue';
5
- export * from './Themes';
6
- export * from './Tracks';
7
- export * from './MultipleViews';
8
- export * from './BaseSession';
9
- export * from './SessionTracks';
10
- export * from './BaseSession';
1
+ export * from './ReferenceManagement.ts';
2
+ export * from './Connections.ts';
3
+ export * from './DrawerWidgets.ts';
4
+ export * from './DialogQueue.ts';
5
+ export * from './Themes.ts';
6
+ export * from './Tracks.ts';
7
+ export * from './MultipleViews.ts';
8
+ export * from './BaseSession.ts';
9
+ export * from './SessionTracks.ts';
10
+ export * from './BaseSession.ts';
@@ -1,10 +1,10 @@
1
- export * from './ReferenceManagement';
2
- export * from './Connections';
3
- export * from './DrawerWidgets';
4
- export * from './DialogQueue';
5
- export * from './Themes';
6
- export * from './Tracks';
7
- export * from './MultipleViews';
8
- export * from './BaseSession';
9
- export * from './SessionTracks';
10
- export * from './BaseSession';
1
+ export * from "./ReferenceManagement.js";
2
+ export * from "./Connections.js";
3
+ export * from "./DrawerWidgets.js";
4
+ export * from "./DialogQueue.js";
5
+ export * from "./Themes.js";
6
+ export * from "./Tracks.js";
7
+ export * from "./MultipleViews.js";
8
+ export * from "./BaseSession.js";
9
+ export * from "./SessionTracks.js";
10
+ export * from "./BaseSession.js";
package/esm/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export * from './RootModel';
2
- export * from './Session';
3
- export * from './ui';
4
- export * from './rpcWorker';
1
+ export * from './RootModel/index.ts';
2
+ export * from './Session/index.ts';
3
+ export * from './ui/index.ts';
4
+ export * from './rpcWorker.ts';
package/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export * from './RootModel';
2
- export * from './Session';
3
- export * from './ui';
4
- export * from './rpcWorker';
1
+ export * from "./RootModel/index.js";
2
+ export * from "./Session/index.js";
3
+ export * from "./ui/index.js";
4
+ export * from "./rpcWorker.js";
@@ -1,5 +1,11 @@
1
+ import { RpcServer } from '@jbrowse/core/util/librpc';
1
2
  import type { PluginConstructor } from '@jbrowse/core/Plugin';
2
3
  import type { LoadedPlugin } from '@jbrowse/core/PluginLoader';
4
+ declare global {
5
+ interface Window {
6
+ rpcServer?: RpcServer;
7
+ }
8
+ }
3
9
  export declare function initializeWorker(corePlugins: PluginConstructor[], opts: {
4
10
  fetchESM?: (url: string) => Promise<LoadedPlugin>;
5
11
  fetchCJS?: (url: string) => Promise<LoadedPlugin>;
package/esm/rpcWorker.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import PluginLoader from '@jbrowse/core/PluginLoader';
2
2
  import PluginManager from '@jbrowse/core/PluginManager';
3
- import RpcServer from 'librpc-web-mod';
4
- import { serializeError } from 'serialize-error';
3
+ import { RpcServer, serializeError } from '@jbrowse/core/util/librpc';
5
4
  function receiveConfiguration() {
6
5
  const configurationP = new Promise(resolve => {
7
6
  function listener(e) {
@@ -27,22 +26,29 @@ async function getPluginManager(corePlugins, opts) {
27
26
  }
28
27
  function wrapForRpc(func) {
29
28
  return (args) => {
30
- const { channel, rpcDriverClassName } = args;
29
+ const wrappedArgs = args;
30
+ const { channel, rpcDriverClassName } = wrappedArgs;
31
31
  return func({
32
- ...args,
32
+ ...wrappedArgs,
33
33
  statusCallback: (message) => {
34
- self.rpcServer.emit(channel, message);
34
+ self.rpcServer?.emit(channel, message);
35
35
  },
36
36
  }, rpcDriverClassName);
37
37
  };
38
38
  }
39
39
  export async function initializeWorker(corePlugins, opts) {
40
+ self.addEventListener('error', event => {
41
+ console.error('[Worker uncaught error]', event.error || event.message);
42
+ });
43
+ self.addEventListener('unhandledrejection', event => {
44
+ console.error('[Worker unhandled rejection]', event.reason);
45
+ });
40
46
  try {
41
47
  const pluginManager = await getPluginManager(corePlugins, opts);
42
48
  const rpcConfig = Object.fromEntries(pluginManager
43
49
  .getRpcElements()
44
50
  .map(e => [e.name, wrapForRpc(e.execute.bind(e))]));
45
- self.rpcServer = new RpcServer.Server(rpcConfig);
51
+ self.rpcServer = new RpcServer(rpcConfig);
46
52
  postMessage({ message: 'ready' });
47
53
  }
48
54
  catch (e) {
@@ -1,5 +1,7 @@
1
1
  import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
2
- export declare function AboutDialog({ config, handleClose, }: {
3
- config: AnyConfigurationModel;
2
+ import type { AbstractSessionModel } from '@jbrowse/core/util';
3
+ export declare function AboutDialog({ config, session, handleClose, }: {
4
+ config: AnyConfigurationModel | Record<string, unknown>;
5
+ session: AbstractSessionModel;
4
6
  handleClose: () => void;
5
7
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,12 +1,11 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import Dialog from '@jbrowse/core/ui/Dialog';
3
- import { getEnv, getSession } from '@jbrowse/core/util';
3
+ import { getEnv } from '@jbrowse/core/util';
4
4
  import { getTrackName } from '@jbrowse/core/util/tracks';
5
- import AboutContents from './AboutDialogContents';
6
- export function AboutDialog({ config, handleClose, }) {
7
- const session = getSession(config);
5
+ import AboutContents from "./AboutDialogContents.js";
6
+ export function AboutDialog({ config, session, handleClose, }) {
8
7
  const trackName = getTrackName(config, session);
9
8
  const { pluginManager } = getEnv(session);
10
9
  const AboutComponent = pluginManager.evaluateExtensionPoint('Core-replaceAbout', AboutContents, { session, config });
11
- return (_jsx(Dialog, { open: true, onClose: handleClose, title: trackName, maxWidth: "xl", children: _jsx(AboutComponent, { config: config }) }));
10
+ return (_jsx(Dialog, { open: true, onClose: handleClose, title: trackName, maxWidth: "xl", children: _jsx(AboutComponent, { config: config, session: session }) }));
12
11
  }
@@ -1,5 +1,7 @@
1
1
  import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
2
- declare const AboutDialogContents: ({ config, }: {
3
- config: AnyConfigurationModel;
2
+ import type { AbstractSessionModel } from '@jbrowse/core/util';
3
+ declare const AboutDialogContents: ({ config, session, }: {
4
+ config: AnyConfigurationModel | Record<string, unknown>;
5
+ session: AbstractSessionModel;
4
6
  }) => import("react/jsx-runtime").JSX.Element;
5
7
  export default AboutDialogContents;
@@ -2,34 +2,35 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState } from 'react';
3
3
  import Attributes from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail/Attributes';
4
4
  import BaseCard from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail/BaseCard';
5
- import { getConf, readConfObject } from '@jbrowse/core/configuration';
6
- import { getEnv, getSession } from '@jbrowse/core/util';
5
+ import { getConf } from '@jbrowse/core/configuration';
6
+ import { getEnv } from '@jbrowse/core/util';
7
+ import { makeStyles } from '@jbrowse/core/util/tss-react';
8
+ import { getSnapshot, isStateTreeNode } from '@jbrowse/mobx-state-tree';
7
9
  import { observer } from 'mobx-react';
8
- import { makeStyles } from 'tss-react/mui';
9
- import FileInfoPanel from './FileInfoPanel';
10
- import HeaderButtons from './HeaderButtons';
11
- import RefNameInfoDialog from './RefNameInfoDialog';
12
- import { generateDisplayableConfig } from './util';
10
+ import FileInfoPanel from "./FileInfoPanel.js";
11
+ import HeaderButtons from "./HeaderButtons.js";
12
+ import RefNameInfoDialog from "./RefNameInfoDialog.js";
13
+ import { generateDisplayableConfig, readConf } from "./util.js";
13
14
  const useStyles = makeStyles()({
14
15
  content: {
15
16
  minWidth: 800,
16
17
  },
17
18
  });
18
- const AboutDialogContents = observer(function ({ config, }) {
19
- const conf = readConfObject(config);
20
- const session = getSession(config);
19
+ const AboutDialogContents = observer(function AboutDialogContents({ config, session, }) {
20
+ const conf = isStateTreeNode(config) ? getSnapshot(config) : config;
21
21
  const { classes } = useStyles();
22
22
  const [showRefNames, setShowRefNames] = useState(false);
23
23
  const hideUris = getConf(session, ['formatAbout', 'hideUris']) ||
24
- readConfObject(config, ['formatAbout', 'hideUris']);
24
+ readConf(config, ['formatAbout', 'hideUris']);
25
25
  const { pluginManager } = getEnv(session);
26
26
  const confPostExt = generateDisplayableConfig({
27
27
  config,
28
+ session,
28
29
  pluginManager,
29
30
  });
30
31
  const ExtraPanel = pluginManager.evaluateExtensionPoint('Core-extraAboutPanel', null, { session, config });
31
32
  const hideFields = ['displays', 'baseUri', 'refNames', 'formatAbout'];
32
- return (_jsxs("div", { className: classes.content, children: [_jsxs(BaseCard, { title: "Configuration", children: [!hideUris ? (_jsx(HeaderButtons, { conf: conf, setShowRefNames: setShowRefNames })) : null, _jsx(Attributes, { attributes: confPostExt.config, omit: [...hideFields, 'metadata'], hideUris: hideUris })] }), confPostExt.config.metadata ? (_jsx(BaseCard, { title: "Metadata", children: _jsx(Attributes, { attributes: confPostExt.config.metadata, omit: hideFields, hideUris: hideUris }) })) : null, ExtraPanel ? (_jsx(BaseCard, { title: ExtraPanel.name, children: _jsx(ExtraPanel.Component, { config: config }) })) : null, _jsx(FileInfoPanel, { config: config }), showRefNames ? (_jsx(RefNameInfoDialog, { config: config, onClose: () => {
33
+ return (_jsxs("div", { className: classes.content, children: [_jsxs(BaseCard, { title: "Configuration", children: [!hideUris ? (_jsx(HeaderButtons, { conf: conf, setShowRefNames: setShowRefNames })) : null, _jsx(Attributes, { attributes: confPostExt.config, omit: [...hideFields, 'metadata'], hideUris: hideUris })] }), confPostExt.config.metadata ? (_jsx(BaseCard, { title: "Metadata", children: _jsx(Attributes, { attributes: confPostExt.config.metadata, omit: hideFields, hideUris: hideUris }) })) : null, ExtraPanel ? (_jsx(BaseCard, { title: ExtraPanel.name, children: _jsx(ExtraPanel.Component, { config: config }) })) : null, _jsx(FileInfoPanel, { config: config, session: session }), showRefNames ? (_jsx(RefNameInfoDialog, { session: session, config: config, onClose: () => {
33
34
  setShowRefNames(false);
34
35
  } })) : null] }));
35
36
  });
@@ -1,4 +1,6 @@
1
1
  import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
2
- export default function FileInfoPanel({ config, }: {
3
- config: AnyConfigurationModel;
2
+ import type { AbstractSessionModel } from '@jbrowse/core/util';
3
+ export default function FileInfoPanel({ config, session, }: {
4
+ config: AnyConfigurationModel | Record<string, unknown>;
5
+ session: AbstractSessionModel;
4
6
  }): import("react/jsx-runtime").JSX.Element;
@@ -2,20 +2,19 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useEffect, useState } from 'react';
3
3
  import Attributes from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail/Attributes';
4
4
  import BaseCard from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail/BaseCard';
5
- import { readConfObject } from '@jbrowse/core/configuration';
6
5
  import { ErrorMessage, LoadingEllipses } from '@jbrowse/core/ui';
7
- import { getSession } from '@jbrowse/core/util';
8
- export default function FileInfoPanel({ config, }) {
6
+ import { readConf } from "./util.js";
7
+ export default function FileInfoPanel({ config, session, }) {
9
8
  const [error, setError] = useState();
10
9
  const [info, setInfo] = useState();
11
- const session = getSession(config);
12
10
  const { rpcManager } = session;
11
+ const trackId = readConf(config, 'trackId');
13
12
  useEffect(() => {
14
13
  ;
15
14
  (async () => {
16
15
  try {
17
- const adapterConfig = readConfObject(config, 'adapter');
18
- const result = await rpcManager.call(config.trackId, 'CoreGetInfo', {
16
+ const adapterConfig = readConf(config, 'adapter');
17
+ const result = await rpcManager.call(trackId, 'CoreGetInfo', {
19
18
  adapterConfig,
20
19
  });
21
20
  setInfo(result);
@@ -25,7 +24,7 @@ export default function FileInfoPanel({ config, }) {
25
24
  setError(e);
26
25
  }
27
26
  })();
28
- }, [config, rpcManager]);
27
+ }, [config, rpcManager, trackId]);
29
28
  const details = typeof info === 'string'
30
29
  ? {
31
30
  header: `<pre>${info
@@ -1,9 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState } from 'react';
3
+ import { makeStyles } from '@jbrowse/core/util/tss-react';
3
4
  import { Button } from '@mui/material';
4
- import copy from 'copy-to-clipboard';
5
- import { makeStyles } from 'tss-react/mui';
6
- import { removeAttr } from './util';
5
+ import { removeAttr } from "./util.js";
7
6
  const useStyles = makeStyles()({
8
7
  button: {
9
8
  float: 'right',
@@ -14,7 +13,8 @@ function HeaderButtons({ conf, setShowRefNames }) {
14
13
  const { classes } = useStyles();
15
14
  return (_jsxs("span", { className: classes.button, children: [_jsx(Button, { variant: "contained", color: "secondary", onClick: () => {
16
15
  setShowRefNames(true);
17
- }, children: "Show ref names" }), _jsx(Button, { variant: "contained", onClick: () => {
16
+ }, children: "Show ref names" }), _jsx(Button, { variant: "contained", onClick: async () => {
17
+ const { default: copy } = await import('copy-to-clipboard');
18
18
  const snap = removeAttr(structuredClone(conf), 'baseUri');
19
19
  copy(JSON.stringify(snap, null, 2));
20
20
  setCopied(true);
@@ -1,6 +1,8 @@
1
1
  import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
2
- declare const RefNameInfoDialog: ({ config, onClose, }: {
3
- config: AnyConfigurationModel;
2
+ import type { AbstractSessionModel } from '@jbrowse/core/util';
3
+ declare const RefNameInfoDialog: ({ config, session, onClose, }: {
4
+ config: AnyConfigurationModel | Record<string, unknown>;
5
+ session: AbstractSessionModel;
4
6
  onClose: () => void;
5
7
  }) => import("react/jsx-runtime").JSX.Element;
6
8
  export default RefNameInfoDialog;
@@ -1,14 +1,11 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useState } from 'react';
3
- import { readConfObject } from '@jbrowse/core/configuration';
4
3
  import { Dialog, ErrorMessage, LoadingEllipses } from '@jbrowse/core/ui';
5
- import { getSession } from '@jbrowse/core/util';
6
- import { getConfAssemblyNames } from '@jbrowse/core/util/tracks';
4
+ import { makeStyles } from '@jbrowse/core/util/tss-react';
7
5
  import { Button, DialogContent } from '@mui/material';
8
- import copy from 'copy-to-clipboard';
9
6
  import { observer } from 'mobx-react';
10
- import { makeStyles } from 'tss-react/mui';
11
- const MAX_REF_NAMES = 10000;
7
+ import { readConf } from "./util.js";
8
+ const MAX_REF_NAMES = 10_000;
12
9
  const useStyles = makeStyles()(theme => ({
13
10
  container: {
14
11
  minWidth: 800,
@@ -20,21 +17,23 @@ const useStyles = makeStyles()(theme => ({
20
17
  background: theme.palette.background.default,
21
18
  },
22
19
  }));
23
- const RefNameInfoDialog = observer(function ({ config, onClose, }) {
20
+ const RefNameInfoDialog = observer(function RefNameInfoDialog({ config, session, onClose, }) {
24
21
  const { classes } = useStyles();
25
22
  const [error, setError] = useState();
26
23
  const [refNames, setRefNames] = useState();
27
24
  const [copied, setCopied] = useState(false);
28
- const { rpcManager } = getSession(config);
25
+ const { rpcManager } = session;
26
+ const trackId = readConf(config, 'trackId');
27
+ const assemblyNames = readConf(config, 'assemblyNames');
29
28
  useEffect(() => {
30
29
  ;
31
30
  (async () => {
32
31
  try {
33
- const map = await Promise.all([...new Set(getConfAssemblyNames(config))].map(async (assemblyName) => {
34
- const adapterConfig = readConfObject(config, 'adapter');
32
+ const map = await Promise.all([...new Set(assemblyNames)].map(async (assemblyName) => {
33
+ const adapterConfig = readConf(config, 'adapter');
35
34
  return [
36
35
  assemblyName,
37
- (await rpcManager.call(config.trackId, 'CoreGetRefNames', {
36
+ (await rpcManager.call(trackId, 'CoreGetRefNames', {
38
37
  adapterConfig,
39
38
  regions: [
40
39
  {
@@ -51,7 +50,7 @@ const RefNameInfoDialog = observer(function ({ config, onClose, }) {
51
50
  setError(e);
52
51
  }
53
52
  })();
54
- }, [config, rpcManager]);
53
+ }, [config, rpcManager, trackId, assemblyNames]);
55
54
  const names = refNames ? Object.entries(refNames) : [];
56
55
  const result = names
57
56
  .flatMap(([assemblyName, refNames]) => {
@@ -65,7 +64,8 @@ const RefNameInfoDialog = observer(function ({ config, onClose, }) {
65
64
  })
66
65
  .filter(f => !!f)
67
66
  .join('\n');
68
- return (_jsx(Dialog, { open: true, title: "Reference sequence names used in track", onClose: onClose, maxWidth: "xl", children: _jsx(DialogContent, { className: classes.container, children: error ? (_jsx(ErrorMessage, { error: error })) : refNames === undefined ? (_jsx(LoadingEllipses, { message: "Loading refNames" })) : (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "contained", onClick: () => {
67
+ return (_jsx(Dialog, { open: true, title: "Reference sequence names used in track", onClose: onClose, maxWidth: "xl", children: _jsx(DialogContent, { className: classes.container, children: error ? (_jsx(ErrorMessage, { error: error })) : refNames === undefined ? (_jsx(LoadingEllipses, { message: "Loading refNames" })) : (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "contained", onClick: async () => {
68
+ const { default: copy } = await import('copy-to-clipboard');
69
69
  copy(names
70
70
  .flatMap(([assemblyName, refNames]) => [
71
71
  `--- ${assemblyName} ---`,
package/esm/ui/index.d.ts CHANGED
@@ -1 +1 @@
1
- export * from './AboutDialog';
1
+ export * from './AboutDialog.tsx';
package/esm/ui/index.js CHANGED
@@ -1 +1 @@
1
- export * from './AboutDialog';
1
+ export * from "./AboutDialog.js";
package/esm/ui/util.d.ts CHANGED
@@ -1,8 +1,11 @@
1
1
  import type PluginManager from '@jbrowse/core/PluginManager';
2
2
  import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
3
+ import type { AbstractSessionModel } from '@jbrowse/core/util';
3
4
  export declare function removeAttr(obj: Record<string, unknown>, attr: string): Record<string, unknown>;
4
- export declare function generateDisplayableConfig({ config, pluginManager, }: {
5
- config: AnyConfigurationModel;
5
+ export declare function readConf(config: AnyConfigurationModel | Record<string, unknown>, slotPath?: string | string[]): any;
6
+ export declare function generateDisplayableConfig({ config, session, pluginManager, }: {
7
+ config: AnyConfigurationModel | Record<string, unknown>;
8
+ session: AbstractSessionModel;
6
9
  pluginManager: PluginManager;
7
10
  }): {
8
11
  config: {
package/esm/ui/util.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { getConf, readConfObject } from '@jbrowse/core/configuration';
2
- import { getSession } from '@jbrowse/core/util';
2
+ import { getSnapshot, isStateTreeNode } from '@jbrowse/mobx-state-tree';
3
3
  export function removeAttr(obj, attr) {
4
4
  for (const prop in obj) {
5
5
  if (prop === attr) {
@@ -11,14 +11,32 @@ export function removeAttr(obj, attr) {
11
11
  }
12
12
  return obj;
13
13
  }
14
- export function generateDisplayableConfig({ config, pluginManager, }) {
15
- const session = getSession(config);
16
- const conf = readConfObject(config);
14
+ export function readConf(config, slotPath) {
15
+ if (isStateTreeNode(config)) {
16
+ return slotPath
17
+ ? readConfObject(config, slotPath)
18
+ : getSnapshot(config);
19
+ }
20
+ if (!slotPath) {
21
+ return config;
22
+ }
23
+ if (typeof slotPath === 'string') {
24
+ return config[slotPath];
25
+ }
26
+ let result = config;
27
+ for (const key of slotPath) {
28
+ result = result?.[key];
29
+ }
30
+ return result;
31
+ }
32
+ export function generateDisplayableConfig({ config, session, pluginManager, }) {
33
+ const conf = isStateTreeNode(config) ? readConfObject(config) : config;
34
+ const formatAboutConfig = readConf(config, ['formatAbout', 'config']) || {};
17
35
  return pluginManager.evaluateExtensionPoint('Core-customizeAbout', {
18
36
  config: {
19
37
  ...conf,
20
38
  ...getConf(session, ['formatAbout', 'config'], { config: conf }),
21
- ...readConfObject(config, ['formatAbout', 'config'], { config: conf }),
39
+ ...formatAboutConfig,
22
40
  },
23
41
  }, { session, config });
24
42
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/product-core",
3
- "version": "3.7.0",
3
+ "version": "4.0.1",
4
4
  "sideEffects": false,
5
5
  "description": "JBrowse 2 code shared between products but not used by plugins",
6
6
  "keywords": [
@@ -19,41 +19,18 @@
19
19
  "directory": "packages/product-core"
20
20
  },
21
21
  "author": "JBrowse Team",
22
- "distMain": "dist/index.js",
23
- "distModule": "esm/index.js",
24
- "srcMain": "src/index.ts",
25
- "srcModule": "src/index.ts",
26
- "main": "dist/index.js",
27
- "module": "esm/index.js",
22
+ "main": "esm/index.js",
28
23
  "files": [
29
- "dist",
30
24
  "esm"
31
25
  ],
32
- "scripts": {
33
- "build:esm": "tsc --build tsconfig.build.esm.json",
34
- "build:commonjs": "tsc --build tsconfig.build.commonjs.json",
35
- "build": "npm run build:esm && npm run build:commonjs",
36
- "test": "cd ../..; jest --passWithNoTests packages/product-core",
37
- "clean": "rimraf dist esm *.tsbuildinfo",
38
- "prebuild": "yarn clean",
39
- "prepack": "yarn build && yarn useDist",
40
- "postpack": "yarn useSrc",
41
- "useDist": "node ../../scripts/useDist.js",
42
- "useSrc": "node ../../scripts/useSrc.js"
43
- },
44
26
  "dependencies": {
45
- "@babel/runtime": "^7.16.3",
46
- "@jbrowse/core": "^3.7.0",
47
- "@mui/icons-material": "^7.0.0",
48
- "@mui/material": "^7.0.0",
49
- "copy-to-clipboard": "^3.3.1",
50
- "librpc-web-mod": "^1.0.0",
51
- "mobx": "^6.0.0",
52
- "mobx-react": "^9.0.0",
53
- "mobx-state-tree": "^5.0.0",
54
- "rxjs": "^7.0.0",
55
- "serialize-error": "^8.0.0",
56
- "tss-react": "^4.0.0"
27
+ "@jbrowse/mobx-state-tree": "^5.5.0",
28
+ "@mui/material": "^7.3.6",
29
+ "copy-to-clipboard": "^3.3.3",
30
+ "librpc-web-mod": "^2.1.1",
31
+ "mobx": "^6.15.0",
32
+ "mobx-react": "^9.2.1",
33
+ "@jbrowse/core": "^4.0.1"
57
34
  },
58
35
  "peerDependencies": {
59
36
  "react": ">=18.0.0",
@@ -62,5 +39,18 @@
62
39
  "publishConfig": {
63
40
  "access": "public"
64
41
  },
65
- "gitHead": "85bdd0d58286b7adbfd408146b15847676317635"
66
- }
42
+ "scripts": {
43
+ "build:esm": "tsc -p tsconfig.build.esm.json",
44
+ "build": "pnpm build:esm",
45
+ "test": "cd ../..; jest --passWithNoTests packages/product-core",
46
+ "clean": "rimraf esm *.tsbuildinfo",
47
+ "prebuild": "pnpm clean"
48
+ },
49
+ "types": "esm/index.d.ts",
50
+ "exports": {
51
+ ".": {
52
+ "types": "./esm/index.d.ts",
53
+ "import": "./esm/index.js"
54
+ }
55
+ }
56
+ }