@jbrowse/plugin-linear-genome-view 2.11.0 → 2.11.2

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 (73) hide show
  1. package/dist/BaseLinearDisplay/components/LinearBlocks.js +7 -7
  2. package/dist/BaseLinearDisplay/components/Tooltip.js +1 -0
  3. package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +17 -1
  4. package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js +21 -0
  5. package/dist/BaseLinearDisplay/models/configSchema.d.ts +10 -0
  6. package/dist/BaseLinearDisplay/models/configSchema.js +15 -3
  7. package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.js +1 -0
  8. package/dist/BasicTrack/index.d.ts +1 -2
  9. package/dist/BasicTrack/index.js +3 -2
  10. package/dist/FeatureTrack/index.d.ts +1 -2
  11. package/dist/FeatureTrack/index.js +3 -2
  12. package/dist/LaunchLinearGenomeView/index.d.ts +1 -2
  13. package/dist/LaunchLinearGenomeView/index.js +3 -2
  14. package/dist/LinearBareDisplay/configSchema.d.ts +5 -0
  15. package/dist/LinearBareDisplay/index.d.ts +1 -2
  16. package/dist/LinearBareDisplay/index.js +3 -2
  17. package/dist/LinearBareDisplay/model.d.ts +17 -2
  18. package/dist/LinearBasicDisplay/components/AddFiltersDialog.d.ts +10 -0
  19. package/dist/LinearBasicDisplay/components/AddFiltersDialog.js +94 -0
  20. package/dist/LinearBasicDisplay/components/{SetMaxHeight.js → SetMaxHeightDialog.js} +7 -7
  21. package/dist/LinearBasicDisplay/configSchema.d.ts +5 -0
  22. package/dist/LinearBasicDisplay/index.d.ts +1 -2
  23. package/dist/LinearBasicDisplay/index.js +3 -2
  24. package/dist/LinearBasicDisplay/model.d.ts +56 -21
  25. package/dist/LinearBasicDisplay/model.js +36 -5
  26. package/dist/LinearGenomeView/components/Cytobands.js +11 -12
  27. package/dist/LinearGenomeView/components/Gridlines.js +3 -4
  28. package/dist/LinearGenomeView/components/Highlight.js +20 -21
  29. package/dist/LinearGenomeView/components/OverviewScalebar.js +1 -2
  30. package/dist/LinearGenomeView/components/OverviewScalebarPolygon.js +2 -1
  31. package/dist/LinearGenomeView/components/Scalebar.js +4 -5
  32. package/dist/LinearGenomeView/model.d.ts +1 -0
  33. package/dist/LinearGenomeView/svgcomponents/SVGHeader.js +1 -1
  34. package/dist/LinearGenomeView/svgcomponents/SVGTrackLabel.js +1 -1
  35. package/dist/index.d.ts +39 -0
  36. package/esm/BaseLinearDisplay/components/LinearBlocks.js +7 -7
  37. package/esm/BaseLinearDisplay/components/Tooltip.js +1 -0
  38. package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +17 -1
  39. package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.js +21 -0
  40. package/esm/BaseLinearDisplay/models/configSchema.d.ts +10 -0
  41. package/esm/BaseLinearDisplay/models/configSchema.js +15 -3
  42. package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.js +1 -0
  43. package/esm/BasicTrack/index.d.ts +1 -2
  44. package/esm/BasicTrack/index.js +2 -2
  45. package/esm/FeatureTrack/index.d.ts +1 -2
  46. package/esm/FeatureTrack/index.js +2 -2
  47. package/esm/LaunchLinearGenomeView/index.d.ts +1 -2
  48. package/esm/LaunchLinearGenomeView/index.js +2 -2
  49. package/esm/LinearBareDisplay/configSchema.d.ts +5 -0
  50. package/esm/LinearBareDisplay/index.d.ts +1 -2
  51. package/esm/LinearBareDisplay/index.js +2 -2
  52. package/esm/LinearBareDisplay/model.d.ts +17 -2
  53. package/esm/LinearBasicDisplay/components/AddFiltersDialog.d.ts +10 -0
  54. package/esm/LinearBasicDisplay/components/AddFiltersDialog.js +69 -0
  55. package/esm/LinearBasicDisplay/components/{SetMaxHeight.js → SetMaxHeightDialog.js} +7 -7
  56. package/esm/LinearBasicDisplay/configSchema.d.ts +5 -0
  57. package/esm/LinearBasicDisplay/index.d.ts +1 -2
  58. package/esm/LinearBasicDisplay/index.js +2 -2
  59. package/esm/LinearBasicDisplay/model.d.ts +56 -21
  60. package/esm/LinearBasicDisplay/model.js +37 -6
  61. package/esm/LinearGenomeView/components/Cytobands.js +11 -12
  62. package/esm/LinearGenomeView/components/Gridlines.js +3 -4
  63. package/esm/LinearGenomeView/components/Highlight.js +20 -21
  64. package/esm/LinearGenomeView/components/OverviewScalebar.js +1 -2
  65. package/esm/LinearGenomeView/components/OverviewScalebarPolygon.js +2 -1
  66. package/esm/LinearGenomeView/components/Scalebar.js +4 -5
  67. package/esm/LinearGenomeView/model.d.ts +1 -0
  68. package/esm/LinearGenomeView/svgcomponents/SVGHeader.js +1 -1
  69. package/esm/LinearGenomeView/svgcomponents/SVGTrackLabel.js +2 -2
  70. package/esm/index.d.ts +39 -0
  71. package/package.json +2 -2
  72. /package/dist/LinearBasicDisplay/components/{SetMaxHeight.d.ts → SetMaxHeightDialog.d.ts} +0 -0
  73. /package/esm/LinearBasicDisplay/components/{SetMaxHeight.d.ts → SetMaxHeightDialog.d.ts} +0 -0
@@ -8,7 +8,6 @@ const react_1 = __importDefault(require("react"));
8
8
  const mui_1 = require("tss-react/mui");
9
9
  const util_1 = require("@jbrowse/core/util");
10
10
  const mobx_react_1 = require("mobx-react");
11
- const blockTypes_1 = require("@jbrowse/core/util/blockTypes");
12
11
  const Block_1 = require("./Block");
13
12
  const useStyles = (0, mui_1.makeStyles)()({
14
13
  linearBlocks: {
@@ -35,9 +34,10 @@ const RenderedBlocks = (0, mobx_react_1.observer)(function ({ model, }) {
35
34
  const { classes } = useStyles();
36
35
  const { blockDefinitions, blockState } = model;
37
36
  return (react_1.default.createElement(react_1.default.Fragment, null, blockDefinitions.map(block => {
38
- if (block instanceof blockTypes_1.ContentBlock) {
37
+ const key = `${model.id}-${block.key}`;
38
+ if (block.type === 'ContentBlock') {
39
39
  const state = blockState.get(block.key);
40
- return (react_1.default.createElement(Block_1.ContentBlock, { block: block, key: `${model.id}-${block.key}` },
40
+ return (react_1.default.createElement(Block_1.ContentBlock, { block: block, key: key },
41
41
  (state === null || state === void 0 ? void 0 : state.ReactComponent) ? (react_1.default.createElement(state.ReactComponent, { model: state })) : null,
42
42
  (state === null || state === void 0 ? void 0 : state.maxHeightReached) ? (react_1.default.createElement("div", { className: classes.heightOverflowed, style: {
43
43
  top: state.layout.getTotalHeight() - 16,
@@ -45,11 +45,11 @@ const RenderedBlocks = (0, mobx_react_1.observer)(function ({ model, }) {
45
45
  height: 16,
46
46
  } }, "Max height reached")) : null));
47
47
  }
48
- if (block instanceof blockTypes_1.ElidedBlock) {
49
- return (react_1.default.createElement(Block_1.ElidedBlock, { key: `${model.id}-${block.key}`, width: block.widthPx }));
48
+ else if (block.type === 'ElidedBlock') {
49
+ return react_1.default.createElement(Block_1.ElidedBlock, { key: key, width: block.widthPx });
50
50
  }
51
- if (block instanceof blockTypes_1.InterRegionPaddingBlock) {
52
- return (react_1.default.createElement(Block_1.InterRegionPaddingBlock, { key: block.key, width: block.widthPx, style: { background: 'none' }, boundary: block.variant === 'boundary' }));
51
+ else if (block.type === 'InterRegionPaddingBlock') {
52
+ return (react_1.default.createElement(Block_1.InterRegionPaddingBlock, { key: key, width: block.widthPx, style: { background: 'none' }, boundary: block.variant === 'boundary' }));
53
53
  }
54
54
  throw new Error(`invalid block type ${JSON.stringify(block)}`);
55
55
  })));
@@ -40,6 +40,7 @@ const Tooltip = (0, mobx_react_1.observer)(function ({ model, clientMouseCoord,
40
40
  const y = clientMouseCoord[1];
41
41
  const { refs, floatingStyles, context } = (0, react_2.useFloating)({
42
42
  placement: 'right',
43
+ strategy: 'fixed',
43
44
  });
44
45
  const clientPoint = (0, react_2.useClientPoint)(context, { x, y });
45
46
  const { getFloatingProps } = (0, react_2.useInteractions)([clientPoint]);
@@ -110,6 +110,11 @@ export declare const BaseLinearDisplay: import("mobx-state-tree").IModelType<{
110
110
  defaultValue: string;
111
111
  contextVariable: string[];
112
112
  };
113
+ jexlFilters: {
114
+ type: string;
115
+ description: string;
116
+ defaultValue: never[];
117
+ };
113
118
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "displayId">>;
114
119
  }, {
115
120
  rendererTypeName: string;
@@ -200,7 +205,9 @@ export declare const BaseLinearDisplay: import("mobx-state-tree").IModelType<{
200
205
  readonly regionTooLarge: boolean;
201
206
  readonly regionTooLargeReason: string;
202
207
  } & {
203
- regionCannotBeRenderedText(_region: import("@jbrowse/core/util").Region): "" | "Force load to see features";
208
+ regionCannotBeRenderedText(_region: import("@jbrowse/core/util").Region): "" | "Force load to see features"; /**
209
+ * #action
210
+ */
204
211
  regionCannotBeRendered(_region: import("@jbrowse/core/util").Region): React.JSX.Element | null;
205
212
  } & {
206
213
  featureIdUnderMouse: string | undefined;
@@ -273,6 +280,10 @@ export declare const BaseLinearDisplay: import("mobx-state-tree").IModelType<{
273
280
  * #action
274
281
  */
275
282
  selectFeature(feature: Feature): void;
283
+ /**
284
+ * #action
285
+ */
286
+ navToFeature(feature: Feature): void;
276
287
  /**
277
288
  * #action
278
289
  */
@@ -401,6 +412,11 @@ export declare const BaseLinearDisplay: import("mobx-state-tree").IModelType<{
401
412
  defaultValue: string;
402
413
  contextVariable: string[];
403
414
  };
415
+ jexlFilters: {
416
+ type: string;
417
+ description: string;
418
+ defaultValue: never[];
419
+ };
404
420
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "displayId">>;
405
421
  }>>, {
406
422
  type: string;
@@ -36,6 +36,7 @@ const mobx_1 = require("mobx");
36
36
  const mobx_state_tree_1 = require("mobx-state-tree");
37
37
  // icons
38
38
  const MenuOpen_1 = __importDefault(require("@mui/icons-material/MenuOpen"));
39
+ const CenterFocusStrong_1 = __importDefault(require("@mui/icons-material/CenterFocusStrong"));
39
40
  const BaseLinearDisplay_1 = require("../components/BaseLinearDisplay");
40
41
  const serverSideRenderedBlock_1 = __importDefault(require("./serverSideRenderedBlock"));
41
42
  const configSchema_1 = __importDefault(require("./configSchema"));
@@ -211,6 +212,17 @@ function stateModelFactory() {
211
212
  session.setSelection(feature);
212
213
  }
213
214
  },
215
+ /**
216
+ * #action
217
+ */
218
+ navToFeature(feature) {
219
+ const view = (0, util_1.getContainingView)(self);
220
+ view.navTo({
221
+ refName: feature.get('refName'),
222
+ start: feature.get('start'),
223
+ end: feature.get('end'),
224
+ });
225
+ },
214
226
  /**
215
227
  * #action
216
228
  */
@@ -268,6 +280,15 @@ function stateModelFactory() {
268
280
  }
269
281
  },
270
282
  },
283
+ {
284
+ label: 'Zoom to feature',
285
+ icon: CenterFocusStrong_1.default,
286
+ onClick: () => {
287
+ if (self.contextMenuFeature) {
288
+ self.navToFeature(self.contextMenuFeature);
289
+ }
290
+ },
291
+ },
271
292
  ]
272
293
  : []),
273
294
  ];
@@ -32,5 +32,15 @@ declare const baseLinearDisplayConfigSchema: import("@jbrowse/core/configuration
32
32
  defaultValue: string;
33
33
  contextVariable: string[];
34
34
  };
35
+ /**
36
+ * #slot
37
+ * config jexlFilters are deferred evaluated so they are prepended with
38
+ * jexl at runtime rather than being stored with jexl in the config
39
+ */
40
+ jexlFilters: {
41
+ type: string;
42
+ description: string;
43
+ defaultValue: never[];
44
+ };
35
45
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "displayId">>;
36
46
  export default baseLinearDisplayConfigSchema;
@@ -4,9 +4,11 @@ const configuration_1 = require("@jbrowse/core/configuration");
4
4
  /**
5
5
  * #config BaseLinearDisplay
6
6
  * #category display
7
- * `BaseLinearDisplay` is a "base" config that is extended by classes like
8
- * `LinearBasicDisplay` (used for feature tracks, etc) and `LinearBareDisplay`
9
- * (more stripped down than even the basic display, not commonly used)
7
+ *
8
+ * `BaseLinearDisplay` is a "base" config that is extended by other configs including
9
+ * - `LinearBasicDisplay` (used for feature tracks, etc)
10
+ * - `LinearBareDisplay` (more stripped down than even the basic display, not
11
+ * commonly used)
10
12
  */
11
13
  function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
12
14
  const baseLinearDisplayConfigSchema = (0, configuration_1.ConfigurationSchema)('BaseLinearDisplay', {
@@ -43,6 +45,16 @@ const baseLinearDisplayConfigSchema = (0, configuration_1.ConfigurationSchema)('
43
45
  defaultValue: `jexl:get(feature,'name')`,
44
46
  contextVariable: ['feature'],
45
47
  },
48
+ /**
49
+ * #slot
50
+ * config jexlFilters are deferred evaluated so they are prepended with
51
+ * jexl at runtime rather than being stored with jexl in the config
52
+ */
53
+ jexlFilters: {
54
+ type: 'stringArray',
55
+ description: 'default set of jexl filters to apply to a track. note: these do not use the jexl prefix because they have a deferred evaluation system',
56
+ defaultValue: [],
57
+ },
46
58
  }, {
47
59
  /**
48
60
  * #identifier
@@ -102,6 +102,7 @@ const blockState = mobx_state_tree_1.types
102
102
  renderInProgress = undefined;
103
103
  },
104
104
  setError(error) {
105
+ console.error(error);
105
106
  if (renderInProgress && !renderInProgress.signal.aborted) {
106
107
  renderInProgress.abort();
107
108
  }
@@ -1,3 +1,2 @@
1
1
  import PluginManager from '@jbrowse/core/PluginManager';
2
- declare const _default: (pm: PluginManager) => void;
3
- export default _default;
2
+ export default function BasicTrackF(pm: PluginManager): void;
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const pluggableElementTypes_1 = require("@jbrowse/core/pluggableElementTypes");
7
7
  const configSchema_1 = __importDefault(require("./configSchema"));
8
- exports.default = (pm) => {
8
+ function BasicTrackF(pm) {
9
9
  pm.addTrackType(() => {
10
10
  const configSchema = (0, configSchema_1.default)(pm);
11
11
  return new pluggableElementTypes_1.TrackType({
@@ -14,4 +14,5 @@ exports.default = (pm) => {
14
14
  stateModel: (0, pluggableElementTypes_1.createBaseTrackModel)(pm, 'BasicTrack', configSchema),
15
15
  });
16
16
  });
17
- };
17
+ }
18
+ exports.default = BasicTrackF;
@@ -1,3 +1,2 @@
1
1
  import PluginManager from '@jbrowse/core/PluginManager';
2
- declare const _default: (pm: PluginManager) => void;
3
- export default _default;
2
+ export default function FeatureTrackF(pm: PluginManager): void;
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const pluggableElementTypes_1 = require("@jbrowse/core/pluggableElementTypes");
7
7
  const configSchema_1 = __importDefault(require("./configSchema"));
8
- exports.default = (pm) => {
8
+ function FeatureTrackF(pm) {
9
9
  pm.addTrackType(() => {
10
10
  const configSchema = (0, configSchema_1.default)(pm);
11
11
  return new pluggableElementTypes_1.TrackType({
@@ -15,4 +15,5 @@ exports.default = (pm) => {
15
15
  stateModel: (0, pluggableElementTypes_1.createBaseTrackModel)(pm, 'FeatureTrack', configSchema),
16
16
  });
17
17
  });
18
- };
18
+ }
19
+ exports.default = FeatureTrackF;
@@ -1,3 +1,2 @@
1
1
  import PluginManager from '@jbrowse/core/PluginManager';
2
- declare const _default: (pluginManager: PluginManager) => void;
3
- export default _default;
2
+ export default function LaunchLinearGenomeViewF(pluginManager: PluginManager): void;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const util_1 = require("@jbrowse/core/util");
4
4
  const searchUtils_1 = require("../searchUtils");
5
- exports.default = (pluginManager) => {
5
+ function LaunchLinearGenomeViewF(pluginManager) {
6
6
  pluginManager.addToExtensionPoint('LaunchView-LinearGenomeView',
7
7
  // @ts-expect-error
8
8
  async ({ session, assembly, loc, tracks = [], tracklist, nav, highlight, }) => {
@@ -51,7 +51,8 @@ exports.default = (pluginManager) => {
51
51
  throw e;
52
52
  }
53
53
  });
54
- };
54
+ }
55
+ exports.default = LaunchLinearGenomeViewF;
55
56
  function tryTrack(model, trackId, idsNotFound) {
56
57
  try {
57
58
  model.showTrack(trackId);
@@ -30,5 +30,10 @@ declare function configSchemaFactory(pluginManager: PluginManager): import("@jbr
30
30
  defaultValue: string;
31
31
  contextVariable: string[];
32
32
  };
33
+ jexlFilters: {
34
+ type: string;
35
+ description: string;
36
+ defaultValue: never[];
37
+ };
33
38
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "displayId">>, undefined>>;
34
39
  export { configSchemaFactory };
@@ -1,5 +1,4 @@
1
1
  import PluginManager from '@jbrowse/core/PluginManager';
2
- declare const _default: (pluginManager: PluginManager) => void;
3
- export default _default;
2
+ export default function LinearBareDisplayF(pluginManager: PluginManager): void;
4
3
  export { configSchemaFactory } from './configSchema';
5
4
  export { stateModelFactory } from './model';
@@ -6,7 +6,7 @@ const pluggableElementTypes_1 = require("@jbrowse/core/pluggableElementTypes");
6
6
  const configSchema_1 = require("./configSchema");
7
7
  const model_1 = require("./model");
8
8
  const BaseLinearDisplay_1 = require("../BaseLinearDisplay/");
9
- exports.default = (pluginManager) => {
9
+ function LinearBareDisplayF(pluginManager) {
10
10
  pluginManager.addDisplayType(() => {
11
11
  const configSchema = (0, configSchema_1.configSchemaFactory)(pluginManager);
12
12
  return new pluggableElementTypes_1.DisplayType({
@@ -19,7 +19,8 @@ exports.default = (pluginManager) => {
19
19
  ReactComponent: BaseLinearDisplay_1.BaseLinearDisplayComponent,
20
20
  });
21
21
  });
22
- };
22
+ }
23
+ exports.default = LinearBareDisplayF;
23
24
  var configSchema_2 = require("./configSchema");
24
25
  Object.defineProperty(exports, "configSchemaFactory", { enumerable: true, get: function () { return configSchema_2.configSchemaFactory; } });
25
26
  var model_2 = require("./model");
@@ -77,7 +77,9 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
77
77
  };
78
78
  fetchSizeLimit: {
79
79
  type: string;
80
- defaultValue: number;
80
+ defaultValue: number; /**
81
+ * #method
82
+ */
81
83
  description: string;
82
84
  };
83
85
  height: {
@@ -91,6 +93,11 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
91
93
  defaultValue: string;
92
94
  contextVariable: string[];
93
95
  };
96
+ jexlFilters: {
97
+ type: string;
98
+ description: string;
99
+ defaultValue: never[];
100
+ };
94
101
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "displayId">>;
95
102
  } & {
96
103
  /**
@@ -215,6 +222,7 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
215
222
  addBlock(key: string, block: import("@jbrowse/core/util/blockTypes").BaseBlock): void;
216
223
  deleteBlock(key: string): void;
217
224
  selectFeature(feature: import("@jbrowse/core/util").Feature): void;
225
+ navToFeature(feature: import("@jbrowse/core/util").Feature): void;
218
226
  clearFeatureSelection(): void;
219
227
  setFeatureIdUnderMouse(feature?: string | undefined): void;
220
228
  setContextMenuFeature(feature?: import("@jbrowse/core/util").Feature | undefined): void;
@@ -309,7 +317,9 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
309
317
  };
310
318
  fetchSizeLimit: {
311
319
  type: string;
312
- defaultValue: number;
320
+ defaultValue: number; /**
321
+ * #method
322
+ */
313
323
  description: string;
314
324
  };
315
325
  height: {
@@ -323,6 +333,11 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
323
333
  defaultValue: string;
324
334
  contextVariable: string[];
325
335
  };
336
+ jexlFilters: {
337
+ type: string;
338
+ description: string;
339
+ defaultValue: never[];
340
+ };
326
341
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "displayId">>;
327
342
  }>> & import("mobx-state-tree/dist/internal").NonEmptyObject & import("mobx-state-tree")._NotCustomized, {
328
343
  type: string;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ declare const AddFiltersDialog: ({ model, handleClose, }: {
3
+ model: {
4
+ jexlFilters?: string[];
5
+ activeFilters: string[];
6
+ setJexlFilters: (arg?: string[]) => void;
7
+ };
8
+ handleClose: () => void;
9
+ }) => React.JSX.Element;
10
+ export default AddFiltersDialog;
@@ -0,0 +1,94 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ const react_1 = __importStar(require("react"));
27
+ const mobx_react_1 = require("mobx-react");
28
+ const ui_1 = require("@jbrowse/core/ui");
29
+ const material_1 = require("@mui/material");
30
+ const mui_1 = require("tss-react/mui");
31
+ const jexlStrings_1 = require("@jbrowse/core/util/jexlStrings");
32
+ const useStyles = (0, mui_1.makeStyles)()({
33
+ dialogContent: {
34
+ width: '80em',
35
+ },
36
+ textAreaFont: {
37
+ fontFamily: 'Courier New',
38
+ },
39
+ error: {
40
+ color: 'red',
41
+ fontSize: '0.8em',
42
+ },
43
+ });
44
+ function checkJexl(code) {
45
+ (0, jexlStrings_1.stringToJexlExpression)(code);
46
+ }
47
+ const AddFiltersDialog = (0, mobx_react_1.observer)(function ({ model, handleClose, }) {
48
+ const { classes } = useStyles();
49
+ const { activeFilters } = model;
50
+ const [data, setData] = (0, react_1.useState)(activeFilters.join('\n'));
51
+ const [error, setError] = (0, react_1.useState)();
52
+ (0, react_1.useEffect)(() => {
53
+ try {
54
+ data
55
+ .split('\n')
56
+ .map(line => line.trim())
57
+ .filter(line => !!line)
58
+ .map(line => checkJexl(line.trim()));
59
+ setError(undefined);
60
+ }
61
+ catch (e) {
62
+ console.error(e);
63
+ setError(e);
64
+ }
65
+ }, [data]);
66
+ return (react_1.default.createElement(ui_1.Dialog, { maxWidth: "xl", open: true, onClose: handleClose, title: "Add track filters" },
67
+ react_1.default.createElement(material_1.DialogContent, null,
68
+ react_1.default.createElement("div", null,
69
+ "Add filters, in jexl format, one per line, starting with the string jexl:. Examples:",
70
+ ' ',
71
+ react_1.default.createElement("ul", null,
72
+ react_1.default.createElement("li", null,
73
+ react_1.default.createElement("code", null, "jexl:get(feature,'name')=='BRCA1'"),
74
+ " - show only feature where the name attribute is BRCA1"),
75
+ react_1.default.createElement("li", null,
76
+ react_1.default.createElement("code", null, "jexl:get(feature,'type')=='gene'"),
77
+ " - show only gene type features in a GFF that has many other feature types"),
78
+ react_1.default.createElement("li", null,
79
+ react_1.default.createElement("code", null, "jexl:get(feature,'score') > 400"),
80
+ " - show only features that have a score greater than 400"))),
81
+ error ? react_1.default.createElement("p", { className: classes.error }, `${error}`) : null,
82
+ react_1.default.createElement(material_1.TextField, { variant: "outlined", multiline: true, minRows: 5, maxRows: 10, className: classes.dialogContent, fullWidth: true, value: data, onChange: event => setData(event.target.value), InputProps: {
83
+ classes: {
84
+ input: classes.textAreaFont,
85
+ },
86
+ } })),
87
+ react_1.default.createElement(material_1.DialogActions, null,
88
+ react_1.default.createElement(material_1.Button, { variant: "contained", color: "primary", type: "submit", autoFocus: true, disabled: !!error, onClick: () => {
89
+ model.setJexlFilters(data.split('\n'));
90
+ handleClose();
91
+ } }, "Submit"),
92
+ react_1.default.createElement(material_1.Button, { variant: "contained", color: "secondary", onClick: () => handleClose() }, "Cancel"))));
93
+ });
94
+ exports.default = AddFiltersDialog;
@@ -40,12 +40,12 @@ const SetMaxHeightDialog = (0, mobx_react_1.observer)(function ({ model, handleC
40
40
  return (react_1.default.createElement(ui_1.Dialog, { open: true, onClose: handleClose, title: "Set max height" },
41
41
  react_1.default.createElement(material_1.DialogContent, { className: classes.root },
42
42
  react_1.default.createElement(material_1.Typography, null, "Set max height for the track. For example, you can increase this if the layout says \"Max height reached\""),
43
- react_1.default.createElement(material_1.TextField, { value: max, onChange: event => setMax(event.target.value), placeholder: "Enter max score" }),
44
- react_1.default.createElement(material_1.DialogActions, null,
45
- react_1.default.createElement(material_1.Button, { variant: "contained", color: "primary", type: "submit", autoFocus: true, onClick: () => {
46
- model.setMaxHeight(max !== '' && !Number.isNaN(+max) ? +max : undefined);
47
- handleClose();
48
- } }, "Submit"),
49
- react_1.default.createElement(material_1.Button, { variant: "contained", color: "secondary", onClick: () => handleClose() }, "Cancel")))));
43
+ react_1.default.createElement(material_1.TextField, { value: max, onChange: event => setMax(event.target.value), placeholder: "Enter max score" })),
44
+ react_1.default.createElement(material_1.DialogActions, null,
45
+ react_1.default.createElement(material_1.Button, { variant: "contained", color: "primary", type: "submit", autoFocus: true, onClick: () => {
46
+ model.setMaxHeight(max !== '' && !Number.isNaN(+max) ? +max : undefined);
47
+ handleClose();
48
+ } }, "Submit"),
49
+ react_1.default.createElement(material_1.Button, { variant: "contained", color: "secondary", onClick: () => handleClose() }, "Cancel"))));
50
50
  });
51
51
  exports.default = SetMaxHeightDialog;
@@ -30,5 +30,10 @@ declare function configSchemaFactory(pluginManager: PluginManager): import("@jbr
30
30
  defaultValue: string;
31
31
  contextVariable: string[];
32
32
  };
33
+ jexlFilters: {
34
+ type: string;
35
+ description: string;
36
+ defaultValue: never[];
37
+ };
33
38
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "displayId">>, undefined>>;
34
39
  export default configSchemaFactory;
@@ -1,5 +1,4 @@
1
1
  import PluginManager from '@jbrowse/core/PluginManager';
2
- declare const _default: (pluginManager: PluginManager) => void;
3
- export default _default;
2
+ export default function LinearBasicDisplay(pluginManager: PluginManager): void;
4
3
  export { default as modelFactory } from './model';
5
4
  export { default as configSchema } from './configSchema';
@@ -9,7 +9,7 @@ const BaseLinearDisplay_1 = require("../BaseLinearDisplay");
9
9
  // locals
10
10
  const configSchema_1 = __importDefault(require("./configSchema"));
11
11
  const model_1 = __importDefault(require("./model"));
12
- exports.default = (pluginManager) => {
12
+ function LinearBasicDisplay(pluginManager) {
13
13
  pluginManager.addDisplayType(() => {
14
14
  const config = (0, configSchema_1.default)(pluginManager);
15
15
  return new pluggableElementTypes_1.DisplayType({
@@ -22,7 +22,8 @@ exports.default = (pluginManager) => {
22
22
  ReactComponent: BaseLinearDisplay_1.BaseLinearDisplayComponent,
23
23
  });
24
24
  });
25
- };
25
+ }
26
+ exports.default = LinearBasicDisplay;
26
27
  var model_2 = require("./model");
27
28
  Object.defineProperty(exports, "modelFactory", { enumerable: true, get: function () { return __importDefault(model_2).default; } });
28
29
  var configSchema_2 = require("./configSchema");