@jbrowse/plugin-menus 2.17.0 → 3.0.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.
Files changed (59) hide show
  1. package/dist/AboutWidget/components/AboutWidget.d.ts +2 -3
  2. package/dist/AboutWidget/components/AboutWidget.js +12 -34
  3. package/dist/AboutWidget/index.d.ts +2 -5
  4. package/dist/AboutWidget/index.js +49 -3
  5. package/dist/HelpWidget/components/HelpWidget.d.ts +2 -3
  6. package/dist/HelpWidget/components/HelpWidget.js +4 -19
  7. package/dist/HelpWidget/index.d.ts +2 -5
  8. package/dist/HelpWidget/index.js +49 -3
  9. package/dist/ImportSessionWidget/components/ImportError.d.ts +1 -2
  10. package/dist/ImportSessionWidget/components/ImportError.js +3 -9
  11. package/dist/ImportSessionWidget/components/ImportSessionWidget.d.ts +2 -3
  12. package/dist/ImportSessionWidget/components/ImportSessionWidget.js +7 -42
  13. package/dist/ImportSessionWidget/index.d.ts +2 -5
  14. package/dist/ImportSessionWidget/index.js +49 -3
  15. package/dist/SessionManager/components/SessionManager.d.ts +2 -3
  16. package/dist/SessionManager/components/SessionManager.js +93 -6
  17. package/dist/SessionManager/components/util.d.ts +18 -7
  18. package/dist/SessionManager/index.d.ts +2 -0
  19. package/dist/SessionManager/index.js +47 -0
  20. package/dist/index.d.ts +1 -1
  21. package/dist/index.js +8 -65
  22. package/esm/AboutWidget/components/AboutWidget.d.ts +2 -3
  23. package/esm/AboutWidget/components/AboutWidget.js +12 -31
  24. package/esm/AboutWidget/index.d.ts +2 -5
  25. package/esm/AboutWidget/index.js +15 -2
  26. package/esm/HelpWidget/components/HelpWidget.d.ts +2 -3
  27. package/esm/HelpWidget/components/HelpWidget.js +4 -16
  28. package/esm/HelpWidget/index.d.ts +2 -5
  29. package/esm/HelpWidget/index.js +15 -2
  30. package/esm/ImportSessionWidget/components/ImportError.d.ts +1 -2
  31. package/esm/ImportSessionWidget/components/ImportError.js +3 -9
  32. package/esm/ImportSessionWidget/components/ImportSessionWidget.d.ts +2 -3
  33. package/esm/ImportSessionWidget/components/ImportSessionWidget.js +7 -19
  34. package/esm/ImportSessionWidget/index.d.ts +2 -5
  35. package/esm/ImportSessionWidget/index.js +15 -2
  36. package/esm/SessionManager/components/SessionManager.d.ts +2 -3
  37. package/esm/SessionManager/components/SessionManager.js +93 -6
  38. package/esm/SessionManager/components/util.d.ts +18 -7
  39. package/esm/SessionManager/index.d.ts +2 -0
  40. package/esm/SessionManager/index.js +13 -0
  41. package/esm/index.d.ts +1 -1
  42. package/esm/index.js +8 -42
  43. package/package.json +3 -2
  44. package/dist/SessionManager/components/AutosavedSessionsList.d.ts +0 -6
  45. package/dist/SessionManager/components/AutosavedSessionsList.js +0 -25
  46. package/dist/SessionManager/components/DeleteSavedSessionDialog.d.ts +0 -6
  47. package/dist/SessionManager/components/DeleteSavedSessionDialog.js +0 -21
  48. package/dist/SessionManager/components/RegularSavedSessionsList.d.ts +0 -6
  49. package/dist/SessionManager/components/RegularSavedSessionsList.js +0 -67
  50. package/dist/SessionManager/components/SessionListItem.d.ts +0 -10
  51. package/dist/SessionManager/components/SessionListItem.js +0 -25
  52. package/esm/SessionManager/components/AutosavedSessionsList.d.ts +0 -6
  53. package/esm/SessionManager/components/AutosavedSessionsList.js +0 -20
  54. package/esm/SessionManager/components/DeleteSavedSessionDialog.d.ts +0 -6
  55. package/esm/SessionManager/components/DeleteSavedSessionDialog.js +0 -15
  56. package/esm/SessionManager/components/RegularSavedSessionsList.d.ts +0 -6
  57. package/esm/SessionManager/components/RegularSavedSessionsList.js +0 -39
  58. package/esm/SessionManager/components/SessionListItem.d.ts +0 -10
  59. package/esm/SessionManager/components/SessionListItem.js +0 -20
@@ -1,7 +1,43 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.stateModel = exports.configSchema = void 0;
37
+ exports.default = SessionManagerF;
38
+ const react_1 = require("react");
4
39
  const configuration_1 = require("@jbrowse/core/configuration");
40
+ const pluggableElementTypes_1 = require("@jbrowse/core/pluggableElementTypes");
5
41
  const mst_1 = require("@jbrowse/core/util/types/mst");
6
42
  const mobx_state_tree_1 = require("mobx-state-tree");
7
43
  exports.configSchema = (0, configuration_1.ConfigurationSchema)('SessionManager', {});
@@ -9,3 +45,14 @@ exports.stateModel = mobx_state_tree_1.types.model('SessionManager', {
9
45
  id: mst_1.ElementId,
10
46
  type: mobx_state_tree_1.types.literal('SessionManager'),
11
47
  });
48
+ function SessionManagerF(pluginManager) {
49
+ pluginManager.addWidgetType(() => {
50
+ return new pluggableElementTypes_1.WidgetType({
51
+ name: 'SessionManager',
52
+ heading: 'Recent sessions',
53
+ configSchema: exports.configSchema,
54
+ stateModel: exports.stateModel,
55
+ ReactComponent: (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./components/SessionManager')))),
56
+ });
57
+ });
58
+ }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import Plugin from '@jbrowse/core/Plugin';
2
- import PluginManager from '@jbrowse/core/PluginManager';
2
+ import type PluginManager from '@jbrowse/core/PluginManager';
3
3
  export default class MenusPlugin extends Plugin {
4
4
  name: string;
5
5
  install(pluginManager: PluginManager): void;
package/dist/index.js CHANGED
@@ -1,83 +1,26 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
4
  };
28
5
  Object.defineProperty(exports, "__esModule", { value: true });
29
- const react_1 = require("react");
30
- const WidgetType_1 = __importDefault(require("@jbrowse/core/pluggableElementTypes/WidgetType"));
31
6
  const Plugin_1 = __importDefault(require("@jbrowse/core/Plugin"));
32
7
  const util_1 = require("@jbrowse/core/util");
33
8
  const Help_1 = __importDefault(require("@mui/icons-material/Help"));
34
9
  const Info_1 = __importDefault(require("@mui/icons-material/Info"));
35
- const AboutWidget_1 = require("./AboutWidget");
36
- const HelpWidget_1 = require("./HelpWidget");
37
- const ImportSessionWidget_1 = require("./ImportSessionWidget");
38
- const SessionManager_1 = require("./SessionManager");
10
+ const AboutWidget_1 = __importDefault(require("./AboutWidget"));
11
+ const HelpWidget_1 = __importDefault(require("./HelpWidget"));
12
+ const ImportSessionWidget_1 = __importDefault(require("./ImportSessionWidget"));
13
+ const SessionManager_1 = __importDefault(require("./SessionManager"));
39
14
  class MenusPlugin extends Plugin_1.default {
40
15
  constructor() {
41
16
  super(...arguments);
42
17
  this.name = 'MenusPlugin';
43
18
  }
44
19
  install(pluginManager) {
45
- pluginManager.addWidgetType(() => {
46
- return new WidgetType_1.default({
47
- name: 'AboutWidget',
48
- heading: 'About',
49
- configSchema: AboutWidget_1.configSchema,
50
- stateModel: AboutWidget_1.stateModel,
51
- ReactComponent: (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./AboutWidget/components/AboutWidget')))),
52
- });
53
- });
54
- pluginManager.addWidgetType(() => {
55
- return new WidgetType_1.default({
56
- name: 'HelpWidget',
57
- heading: 'Help',
58
- configSchema: HelpWidget_1.configSchema,
59
- stateModel: HelpWidget_1.stateModel,
60
- ReactComponent: (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./HelpWidget/components/HelpWidget')))),
61
- });
62
- });
63
- pluginManager.addWidgetType(() => {
64
- return new WidgetType_1.default({
65
- name: 'ImportSessionWidget',
66
- heading: 'Import session',
67
- configSchema: ImportSessionWidget_1.configSchema,
68
- stateModel: ImportSessionWidget_1.stateModel,
69
- ReactComponent: (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./ImportSessionWidget/components/ImportSessionWidget')))),
70
- });
71
- });
72
- pluginManager.addWidgetType(() => {
73
- return new WidgetType_1.default({
74
- name: 'SessionManager',
75
- heading: 'Sessions',
76
- configSchema: SessionManager_1.configSchema,
77
- stateModel: SessionManager_1.stateModel,
78
- ReactComponent: (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./SessionManager/components/SessionManager')))),
79
- });
80
- });
20
+ (0, AboutWidget_1.default)(pluginManager);
21
+ (0, HelpWidget_1.default)(pluginManager);
22
+ (0, ImportSessionWidget_1.default)(pluginManager);
23
+ (0, SessionManager_1.default)(pluginManager);
81
24
  }
82
25
  configure(pluginManager) {
83
26
  if ((0, util_1.isAbstractMenuManager)(pluginManager.rootModel)) {
@@ -1,6 +1,5 @@
1
- import React from 'react';
2
- import { IAnyStateTreeNode } from 'mobx-state-tree';
1
+ import type { IAnyStateTreeNode } from 'mobx-state-tree';
3
2
  declare const AboutWidget: ({ model, }: {
4
3
  model: IAnyStateTreeNode;
5
- }) => React.JSX.Element;
4
+ }) => import("react/jsx-runtime").JSX.Element;
6
5
  export default AboutWidget;
@@ -1,8 +1,8 @@
1
- import React from 'react';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { getSession } from '@jbrowse/core/util';
3
+ import { Link, Typography } from '@mui/material';
2
4
  import { observer } from 'mobx-react';
3
5
  import { getEnv } from 'mobx-state-tree';
4
- import { getSession } from '@jbrowse/core/util';
5
- import { Typography, Link } from '@mui/material';
6
6
  import { makeStyles } from 'tss-react/mui';
7
7
  const useStyles = makeStyles()(theme => ({
8
8
  root: {
@@ -25,33 +25,14 @@ const AboutWidget = observer(function ({ model, }) {
25
25
  const corePlugins = new Set(plugins
26
26
  .filter(p => { var _a; return (_a = pluginManager.pluginMetadata[p.name]) === null || _a === void 0 ? void 0 : _a.isCore; })
27
27
  .map(p => p.name));
28
- return (React.createElement("div", { className: classes.root },
29
- React.createElement(Typography, { variant: "h4", align: "center" }, "JBrowse 2"),
30
- React.createElement(Typography, { variant: "h6", align: "center", className: classes.subtitle }, version),
31
- React.createElement(Typography, { align: "center" },
32
- "JBrowse is a",
33
- ' ',
34
- React.createElement(Link, { href: "http://gmod.org/", target: "_blank", rel: "noopener noreferrer" }, "GMOD"),
35
- ' ',
36
- "project"),
37
- React.createElement("br", null),
38
- React.createElement(Typography, { align: "center" }, "\u00A9 2019-2022 The Evolutionary Software Foundation"),
39
- React.createElement("div", { className: classes.pluginList },
40
- React.createElement(Typography, null, "External plugins loaded"),
41
- React.createElement("ul", null, plugins
42
- .filter(plugin => !corePlugins.has(plugin.name))
43
- .map(plugin => {
44
- const { url, name, version = '' } = plugin;
45
- const text = `${name} ${version || ''}`;
46
- return (React.createElement("li", { key: plugin.name }, plugin.url ? (React.createElement(Link, { target: "_blank", rel: "noopener noreferrer", href: url }, text)) : (React.createElement(Typography, null, text))));
47
- })),
48
- React.createElement(Typography, null, "Core plugins loaded"),
49
- React.createElement("ul", null, plugins
50
- .filter(plugin => corePlugins.has(plugin.name))
51
- .map(plugin => (React.createElement("li", { key: plugin.name },
52
- React.createElement(Typography, null,
53
- plugin.name,
54
- " ",
55
- plugin.version || ''))))))));
28
+ return (_jsxs("div", { className: classes.root, children: [_jsx(Typography, { variant: "h4", align: "center", children: "JBrowse 2" }), _jsx(Typography, { variant: "h6", align: "center", className: classes.subtitle, children: version }), _jsxs(Typography, { align: "center", children: ["JBrowse is a", ' ', _jsx(Link, { href: "http://gmod.org/", target: "_blank", rel: "noopener noreferrer", children: "GMOD" }), ' ', "project"] }), _jsx("br", {}), _jsx(Typography, { align: "center", children: "\u00A9 2019-2022 The Evolutionary Software Foundation" }), _jsxs("div", { className: classes.pluginList, children: [_jsx(Typography, { children: "External plugins loaded" }), _jsx("ul", { children: plugins
29
+ .filter(plugin => !corePlugins.has(plugin.name))
30
+ .map(plugin => {
31
+ const { url, name, version = '' } = plugin;
32
+ const text = `${name} ${version || ''}`;
33
+ return (_jsx("li", { children: plugin.url ? (_jsx(Link, { target: "_blank", rel: "noopener noreferrer", href: url, children: text })) : (_jsx(Typography, { children: text })) }, plugin.name));
34
+ }) }), _jsx(Typography, { children: "Core plugins loaded" }), _jsx("ul", { children: plugins
35
+ .filter(plugin => corePlugins.has(plugin.name))
36
+ .map(plugin => (_jsx("li", { children: _jsxs(Typography, { children: [plugin.name, " ", plugin.version || ''] }) }, plugin.name))) })] })] }));
56
37
  });
57
38
  export default AboutWidget;
@@ -1,5 +1,2 @@
1
- export declare const configSchema: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
2
- export declare const stateModel: import("mobx-state-tree").IModelType<{
3
- id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
4
- type: import("mobx-state-tree").ISimpleType<"AboutWidget">;
5
- }, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
1
+ import type PluginManager from '@jbrowse/core/PluginManager';
2
+ export default function AboutWidgetF(pluginManager: PluginManager): void;
@@ -1,8 +1,21 @@
1
+ import { lazy } from 'react';
1
2
  import { ConfigurationSchema } from '@jbrowse/core/configuration';
3
+ import { WidgetType } from '@jbrowse/core/pluggableElementTypes';
2
4
  import { ElementId } from '@jbrowse/core/util/types/mst';
3
5
  import { types } from 'mobx-state-tree';
4
- export const configSchema = ConfigurationSchema('AboutWidget', {});
5
- export const stateModel = types.model('AboutWidget', {
6
+ const configSchema = ConfigurationSchema('AboutWidget', {});
7
+ const stateModel = types.model('AboutWidget', {
6
8
  id: ElementId,
7
9
  type: types.literal('AboutWidget'),
8
10
  });
11
+ export default function AboutWidgetF(pluginManager) {
12
+ pluginManager.addWidgetType(() => {
13
+ return new WidgetType({
14
+ name: 'AboutWidget',
15
+ heading: 'About',
16
+ configSchema,
17
+ stateModel,
18
+ ReactComponent: lazy(() => import('./components/AboutWidget')),
19
+ });
20
+ });
21
+ }
@@ -1,6 +1,5 @@
1
- import React from 'react';
2
- import { IAnyStateTreeNode } from 'mobx-state-tree';
1
+ import type { IAnyStateTreeNode } from 'mobx-state-tree';
3
2
  declare const HelpWidget: ({ model, }: {
4
3
  model?: IAnyStateTreeNode;
5
- }) => React.JSX.Element;
4
+ }) => import("react/jsx-runtime").JSX.Element;
6
5
  export default HelpWidget;
@@ -1,8 +1,8 @@
1
- import React from 'react';
2
- import { observer } from 'mobx-react';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
2
  import { getSession } from '@jbrowse/core/util';
4
- import { makeStyles } from 'tss-react/mui';
5
3
  import { Link, Typography } from '@mui/material';
4
+ import { observer } from 'mobx-react';
5
+ import { makeStyles } from 'tss-react/mui';
6
6
  const useStyles = makeStyles()(theme => ({
7
7
  root: {
8
8
  margin: theme.spacing(2),
@@ -14,18 +14,6 @@ const useStyles = makeStyles()(theme => ({
14
14
  const HelpWidget = observer(function Help({ model, }) {
15
15
  const { classes } = useStyles();
16
16
  const root = model ? getSession(model) : { version: '' };
17
- return (React.createElement("div", { className: classes.root },
18
- React.createElement(Typography, { variant: "h4", align: "center" }, "JBrowse 2"),
19
- React.createElement(Typography, { variant: "h6", align: "center", className: classes.subtitle }, root.version),
20
- React.createElement(Typography, null, "Here are some resources to get help. Please report the version number above when asking questions. Thanks!"),
21
- React.createElement("ul", null,
22
- React.createElement("li", null,
23
- React.createElement(Link, { href: "https://github.com/GMOD/jbrowse-components/discussions", target: "_blank", rel: "noopener noreferrer" }, "Question & answer forum")),
24
- React.createElement("li", null,
25
- React.createElement(Link, { href: "https://github.com/GMOD/jbrowse-components/issues/new/choose", target: "_blank", rel: "noopener noreferrer" }, "Report a bug")),
26
- React.createElement("li", null,
27
- React.createElement(Link, { href: "https://jbrowse.org/jb2/docs/user_guide", target: "_blank", rel: "noopener noreferrer" }, "User guide")),
28
- React.createElement("li", null,
29
- React.createElement(Link, { href: "https://jbrowse.org/jb2/docs/", target: "_blank", rel: "noopener noreferrer" }, "Documentation")))));
17
+ return (_jsxs("div", { className: classes.root, children: [_jsx(Typography, { variant: "h4", align: "center", children: "JBrowse 2" }), _jsx(Typography, { variant: "h6", align: "center", className: classes.subtitle, children: root.version }), _jsx(Typography, { children: "Here are some resources to get help. Please report the version number above when asking questions. Thanks!" }), _jsxs("ul", { children: [_jsx("li", { children: _jsx(Link, { href: "https://github.com/GMOD/jbrowse-components/discussions", target: "_blank", rel: "noopener noreferrer", children: "Question & answer forum" }) }), _jsx("li", { children: _jsx(Link, { href: "https://github.com/GMOD/jbrowse-components/issues/new/choose", target: "_blank", rel: "noopener noreferrer", children: "Report a bug" }) }), _jsx("li", { children: _jsx(Link, { href: "https://jbrowse.org/jb2/docs/user_guide", target: "_blank", rel: "noopener noreferrer", children: "User guide" }) }), _jsx("li", { children: _jsx(Link, { href: "https://jbrowse.org/jb2/docs/", target: "_blank", rel: "noopener noreferrer", children: "Documentation" }) })] })] }));
30
18
  });
31
19
  export default HelpWidget;
@@ -1,5 +1,2 @@
1
- export declare const configSchema: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
2
- export declare const stateModel: import("mobx-state-tree").IModelType<{
3
- id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
4
- type: import("mobx-state-tree").ISimpleType<"HelpWidget">;
5
- }, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
1
+ import type PluginManager from '@jbrowse/core/PluginManager';
2
+ export default function HelpWidgetF(pluginManager: PluginManager): void;
@@ -1,8 +1,21 @@
1
+ import { lazy } from 'react';
1
2
  import { ConfigurationSchema } from '@jbrowse/core/configuration';
3
+ import { WidgetType } from '@jbrowse/core/pluggableElementTypes';
2
4
  import { ElementId } from '@jbrowse/core/util/types/mst';
3
5
  import { types } from 'mobx-state-tree';
4
- export const configSchema = ConfigurationSchema('HelpWidget', {});
5
- export const stateModel = types.model('HelpWidget', {
6
+ const configSchema = ConfigurationSchema('HelpWidget', {});
7
+ const stateModel = types.model('HelpWidget', {
6
8
  id: ElementId,
7
9
  type: types.literal('HelpWidget'),
8
10
  });
11
+ export default function HelpWidgetF(pluginManager) {
12
+ pluginManager.addWidgetType(() => {
13
+ return new WidgetType({
14
+ name: 'HelpWidget',
15
+ heading: 'Help',
16
+ configSchema,
17
+ stateModel,
18
+ ReactComponent: lazy(() => import('./components/HelpWidget')),
19
+ });
20
+ });
21
+ }
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  export default function ImportError({ error }: {
3
2
  error: unknown;
4
- }): React.JSX.Element;
3
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,7 @@
1
- import React from 'react';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import ErrorIcon from '@mui/icons-material/Error';
2
3
  import { Paper, Typography } from '@mui/material';
3
4
  import { makeStyles } from 'tss-react/mui';
4
- // icons
5
- import ErrorIcon from '@mui/icons-material/Error';
6
5
  const useStyles = makeStyles()(theme => ({
7
6
  error: {
8
7
  margin: theme.spacing(2),
@@ -19,10 +18,5 @@ const useStyles = makeStyles()(theme => ({
19
18
  }));
20
19
  export default function ImportError({ error }) {
21
20
  const { classes } = useStyles();
22
- return (React.createElement(Paper, { className: classes.error },
23
- React.createElement("div", { className: classes.errorHeader },
24
- React.createElement(ErrorIcon, { color: "inherit", fontSize: "large" }),
25
- React.createElement("div", null,
26
- React.createElement(Typography, { variant: "h6", color: "inherit", align: "center" }, "Import error"))),
27
- React.createElement(Typography, { className: classes.errorMessage }, `${error}`)));
21
+ return (_jsxs(Paper, { className: classes.error, children: [_jsxs("div", { className: classes.errorHeader, children: [_jsx(ErrorIcon, { color: "inherit", fontSize: "large" }), _jsx("div", { children: _jsx(Typography, { variant: "h6", color: "inherit", align: "center", children: "Import error" }) })] }), _jsx(Typography, { className: classes.errorMessage, children: `${error}` })] }));
28
22
  }
@@ -1,6 +1,5 @@
1
- import React from 'react';
2
- import { IAnyStateTreeNode } from 'mobx-state-tree';
1
+ import type { IAnyStateTreeNode } from 'mobx-state-tree';
3
2
  declare const ImportSessionWidget: ({ model, }: {
4
3
  model: IAnyStateTreeNode;
5
- }) => React.JSX.Element;
4
+ }) => import("react/jsx-runtime").JSX.Element;
6
5
  export default ImportSessionWidget;
@@ -1,18 +1,16 @@
1
- import React, { useState } from 'react';
2
- import { Button, Paper, Typography, alpha } from '@mui/material';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
3
  import { getSession } from '@jbrowse/core/util';
4
- import { makeStyles } from 'tss-react/mui';
4
+ import CloudUploadIcon from '@mui/icons-material/CloudUpload';
5
+ import { Button, Paper, Typography, alpha } from '@mui/material';
5
6
  import { observer } from 'mobx-react';
6
7
  import { useDropzone } from 'react-dropzone';
7
- // icons
8
- import CloudUploadIcon from '@mui/icons-material/CloudUpload';
9
- // locals
8
+ import { makeStyles } from 'tss-react/mui';
10
9
  import ImportError from './ImportError';
11
- const MAX_FILE_SIZE = 512 * 1024 ** 2; // 512 MiB
10
+ const MAX_FILE_SIZE = 512 * 1024 ** 2;
12
11
  function styledBy(property, mapping) {
13
12
  return (props) => mapping[props[property]];
14
13
  }
15
- // @ts-expect-error
16
14
  const useStyles = makeStyles()(theme => ({
17
15
  root: {
18
16
  margin: theme.spacing(1),
@@ -49,7 +47,6 @@ const useStyles = makeStyles()(theme => ({
49
47
  const ImportSessionWidget = observer(function ({ model, }) {
50
48
  const [error, setError] = useState();
51
49
  const { getRootProps, getInputProps, isDragActive } = useDropzone({
52
- // @ts-expect-error
53
50
  accept: 'application/json',
54
51
  maxSize: MAX_FILE_SIZE,
55
52
  multiple: false,
@@ -68,16 +65,7 @@ const ImportSessionWidget = observer(function ({ model, }) {
68
65
  }
69
66
  },
70
67
  });
71
- // @ts-expect-error
72
68
  const { classes } = useStyles({ isDragActive });
73
- return (React.createElement("div", { className: classes.root },
74
- React.createElement(Paper, { className: classes.paper },
75
- React.createElement("div", { ...getRootProps({ className: classes.dropZone }) },
76
- React.createElement("input", { ...getInputProps() }),
77
- React.createElement(CloudUploadIcon, { className: classes.uploadIcon, fontSize: "large" }),
78
- React.createElement(Typography, { color: "textSecondary", align: "center", variant: "body1" }, "Drag and drop files here"),
79
- React.createElement(Typography, { color: "textSecondary", align: "center", variant: "body2" }, "or"),
80
- React.createElement(Button, { color: "primary", variant: "contained" }, "Browse Files"))),
81
- error ? React.createElement(ImportError, { error: error }) : null));
69
+ return (_jsxs("div", { className: classes.root, children: [_jsx(Paper, { className: classes.paper, children: _jsxs("div", { ...getRootProps({ className: classes.dropZone }), children: [_jsx("input", { ...getInputProps() }), _jsx(CloudUploadIcon, { className: classes.uploadIcon, fontSize: "large" }), _jsx(Typography, { color: "textSecondary", align: "center", variant: "body1", children: "Drag and drop files here" }), _jsx(Typography, { color: "textSecondary", align: "center", variant: "body2", children: "or" }), _jsx(Button, { color: "primary", variant: "contained", children: "Browse Files" })] }) }), error ? _jsx(ImportError, { error: error }) : null] }));
82
70
  });
83
71
  export default ImportSessionWidget;
@@ -1,5 +1,2 @@
1
- export declare const configSchema: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
2
- export declare const stateModel: import("mobx-state-tree").IModelType<{
3
- id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
4
- type: import("mobx-state-tree").ISimpleType<"ImportSessionWidget">;
5
- }, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
1
+ import type PluginManager from '@jbrowse/core/PluginManager';
2
+ export default function ImportSessionWidgetF(pluginManager: PluginManager): void;
@@ -1,8 +1,21 @@
1
+ import { lazy } from 'react';
1
2
  import { ConfigurationSchema } from '@jbrowse/core/configuration';
3
+ import { WidgetType } from '@jbrowse/core/pluggableElementTypes';
2
4
  import { ElementId } from '@jbrowse/core/util/types/mst';
3
5
  import { types } from 'mobx-state-tree';
4
- export const configSchema = ConfigurationSchema('ImportSessionWidget', {});
5
- export const stateModel = types.model('ImportSessionWidget', {
6
+ const configSchema = ConfigurationSchema('ImportSessionWidget', {});
7
+ const stateModel = types.model('ImportSessionWidget', {
6
8
  id: ElementId,
7
9
  type: types.literal('ImportSessionWidget'),
8
10
  });
11
+ export default function ImportSessionWidgetF(pluginManager) {
12
+ pluginManager.addWidgetType(() => {
13
+ return new WidgetType({
14
+ name: 'ImportSessionWidget',
15
+ heading: 'Import session',
16
+ configSchema,
17
+ stateModel,
18
+ ReactComponent: lazy(() => import('./components/ImportSessionWidget')),
19
+ });
20
+ });
21
+ }
@@ -1,6 +1,5 @@
1
- import React from 'react';
2
- import { SessionModel } from './util';
1
+ import type { SessionModel } from './util';
3
2
  declare const SessionManager: ({ session, }: {
4
3
  session: SessionModel;
5
- }) => React.JSX.Element;
4
+ }) => import("react/jsx-runtime").JSX.Element;
6
5
  export default SessionManager;
@@ -1,10 +1,97 @@
1
- import React from 'react';
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { measureGridWidth, useLocalStorage } from '@jbrowse/core/util';
3
+ import DeleteIcon from '@mui/icons-material/Delete';
4
+ import StarIcon from '@mui/icons-material/Star';
5
+ import StarBorderIcon from '@mui/icons-material/StarBorder';
6
+ import { Button, Checkbox, FormControlLabel, IconButton, Link, Tooltip, } from '@mui/material';
7
+ import { DataGrid } from '@mui/x-data-grid';
8
+ import { differenceInDays, formatDistanceToNow } from 'date-fns';
2
9
  import { observer } from 'mobx-react';
3
- import AutosaveSessionsList from './AutosavedSessionsList';
4
- import RegularSavedSessionsList from './RegularSavedSessionsList';
10
+ import { makeStyles } from 'tss-react/mui';
11
+ const useStyles = makeStyles()(theme => ({
12
+ mb: {
13
+ margin: theme.spacing(1),
14
+ marginBottom: theme.spacing(4),
15
+ },
16
+ }));
5
17
  const SessionManager = observer(function ({ session, }) {
6
- return (React.createElement(React.Fragment, null,
7
- React.createElement(AutosaveSessionsList, { session: session }),
8
- React.createElement(RegularSavedSessionsList, { session: session })));
18
+ var _a;
19
+ const { classes } = useStyles();
20
+ const [showOnlyFavs, setShowOnlyFavs] = useLocalStorage('sessionManager-showOnlyFavs', false);
21
+ const rows = (_a = session.savedSessionMetadata) === null || _a === void 0 ? void 0 : _a.map(r => ({
22
+ id: r.id,
23
+ name: r.name,
24
+ createdAt: r.createdAt,
25
+ fav: r.favorite,
26
+ })).filter(f => (showOnlyFavs ? f.fav : true));
27
+ return (_jsxs("div", { children: [_jsxs("div", { className: classes.mb, children: [_jsx(FormControlLabel, { control: _jsx(Checkbox, { checked: showOnlyFavs, onChange: () => {
28
+ setShowOnlyFavs(val => !val);
29
+ } }), label: "Show only favorites?" }), _jsx(Button, { variant: "contained", onClick: () => {
30
+ var _a;
31
+ let i = 0;
32
+ (_a = session.savedSessionMetadata) === null || _a === void 0 ? void 0 : _a.forEach(elt => {
33
+ if (differenceInDays(+Date.now(), elt.createdAt) > 1 &&
34
+ !elt.favorite) {
35
+ session.deleteSavedSession(elt.id);
36
+ i++;
37
+ }
38
+ });
39
+ session.notify(`${i} sessions deleted`, 'info');
40
+ }, children: "Delete non-fav sessions older than 7 days?" })] }), rows ? (_jsx("div", { style: { display: 'flex', flexDirection: 'column' }, children: _jsx(DataGrid, { disableRowSelectionOnClick: true, columnHeaderHeight: 35, rowHeight: 25, hideFooter: rows.length < 100, slotProps: {
41
+ toolbar: {
42
+ showQuickFilter: true,
43
+ },
44
+ }, rows: rows, columns: [
45
+ {
46
+ field: 'fav',
47
+ headerName: 'Fav',
48
+ width: 20,
49
+ renderCell: ({ row }) => {
50
+ return (_jsx(IconButton, { onClick: () => {
51
+ if (row.fav) {
52
+ session.unfavoriteSavedSession(row.id);
53
+ }
54
+ else {
55
+ session.favoriteSavedSession(row.id);
56
+ }
57
+ }, children: row.fav ? _jsx(StarIcon, {}) : _jsx(StarBorderIcon, {}) }));
58
+ },
59
+ },
60
+ {
61
+ field: 'name',
62
+ headerName: 'Name',
63
+ editable: true,
64
+ width: measureGridWidth(rows.map(r => r.name)),
65
+ renderCell: ({ row }) => {
66
+ return (_jsxs(_Fragment, { children: [_jsx(Link, { href: "#", onClick: event => {
67
+ event.preventDefault();
68
+ session.activateSession(row.id);
69
+ }, children: row.name }), session.id === row.id ? ' (current)' : ''] }));
70
+ },
71
+ },
72
+ {
73
+ headerName: 'Created at',
74
+ field: 'createdAt',
75
+ renderCell: ({ row }) => {
76
+ return (_jsx(Tooltip, { disableInteractive: true, slotProps: {
77
+ transition: {
78
+ timeout: 0,
79
+ },
80
+ }, title: row.createdAt.toLocaleString(), children: _jsx("div", { children: formatDistanceToNow(row.createdAt, {
81
+ addSuffix: true,
82
+ }) }) }));
83
+ },
84
+ },
85
+ {
86
+ field: 'delete',
87
+ width: 10,
88
+ headerName: 'Delete',
89
+ renderCell: ({ row }) => {
90
+ return (_jsx(IconButton, { onClick: () => {
91
+ session.deleteSavedSession(row.id);
92
+ }, children: _jsx(DeleteIcon, {}) }));
93
+ },
94
+ },
95
+ ] }) })) : (_jsx("div", { children: "No sessions loaded" }))] }));
9
96
  });
10
97
  export default SessionManager;
@@ -1,13 +1,24 @@
1
- import { AbstractSessionModel } from '@jbrowse/core/util';
2
- export interface SessionSnap {
1
+ import type { AbstractSessionModel } from '@jbrowse/core/util';
2
+ export interface SessionMetadata {
3
+ id: string;
3
4
  name: string;
4
- views?: {
5
- tracks?: unknown[];
6
- }[];
7
- [key: string]: unknown;
5
+ createdAt: Date;
6
+ configPath: string;
7
+ favorite: boolean;
8
+ }
9
+ export interface SessionSnap {
10
+ createdAt: Date;
11
+ session: {
12
+ name: string;
13
+ id: string;
14
+ views?: {
15
+ tracks?: unknown[];
16
+ }[];
17
+ [key: string]: unknown;
18
+ };
8
19
  }
9
20
  export interface SessionModel extends AbstractSessionModel {
10
- savedSessions: SessionSnap[];
21
+ savedSessionMetadata?: SessionMetadata[];
11
22
  removeSavedSession: (arg: SessionSnap) => void;
12
23
  activateSession: (arg: string) => void;
13
24
  loadAutosaveSession: () => void;
@@ -1,5 +1,7 @@
1
+ import type PluginManager from '@jbrowse/core/PluginManager';
1
2
  export declare const configSchema: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
2
3
  export declare const stateModel: import("mobx-state-tree").IModelType<{
3
4
  id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
4
5
  type: import("mobx-state-tree").ISimpleType<"SessionManager">;
5
6
  }, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
7
+ export default function SessionManagerF(pluginManager: PluginManager): void;