@jbrowse/plugin-linear-genome-view 2.11.1 → 2.12.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 (53) hide show
  1. package/dist/BaseLinearDisplay/components/LinearBlocks.js +7 -7
  2. package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +17 -1
  3. package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js +21 -0
  4. package/dist/BaseLinearDisplay/models/configSchema.d.ts +10 -0
  5. package/dist/BaseLinearDisplay/models/configSchema.js +15 -3
  6. package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.js +1 -0
  7. package/dist/LinearBareDisplay/configSchema.d.ts +5 -0
  8. package/dist/LinearBareDisplay/model.d.ts +17 -2
  9. package/dist/LinearBasicDisplay/components/AddFiltersDialog.d.ts +10 -0
  10. package/dist/LinearBasicDisplay/components/AddFiltersDialog.js +94 -0
  11. package/dist/LinearBasicDisplay/components/{SetMaxHeight.js → SetMaxHeightDialog.js} +7 -7
  12. package/dist/LinearBasicDisplay/configSchema.d.ts +5 -0
  13. package/dist/LinearBasicDisplay/model.d.ts +56 -21
  14. package/dist/LinearBasicDisplay/model.js +36 -5
  15. package/dist/LinearGenomeView/components/Gridlines.js +3 -4
  16. package/dist/LinearGenomeView/components/Highlight.js +20 -21
  17. package/dist/LinearGenomeView/components/OverviewScalebar.js +1 -2
  18. package/dist/LinearGenomeView/components/Scalebar.js +4 -5
  19. package/dist/LinearGenomeView/components/TrackLabel.js +4 -4
  20. package/dist/LinearGenomeView/components/TrackRenderingContainer.js +10 -5
  21. package/dist/LinearGenomeView/components/hooks.d.ts +2 -2
  22. package/dist/LinearGenomeView/components/hooks.js +8 -13
  23. package/dist/LinearGenomeView/model.d.ts +5 -22
  24. package/dist/LinearGenomeView/model.js +2 -2
  25. package/dist/index.d.ts +60 -129
  26. package/esm/BaseLinearDisplay/components/LinearBlocks.js +7 -7
  27. package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +17 -1
  28. package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.js +21 -0
  29. package/esm/BaseLinearDisplay/models/configSchema.d.ts +10 -0
  30. package/esm/BaseLinearDisplay/models/configSchema.js +15 -3
  31. package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.js +1 -0
  32. package/esm/LinearBareDisplay/configSchema.d.ts +5 -0
  33. package/esm/LinearBareDisplay/model.d.ts +17 -2
  34. package/esm/LinearBasicDisplay/components/AddFiltersDialog.d.ts +10 -0
  35. package/esm/LinearBasicDisplay/components/AddFiltersDialog.js +69 -0
  36. package/esm/LinearBasicDisplay/components/{SetMaxHeight.js → SetMaxHeightDialog.js} +7 -7
  37. package/esm/LinearBasicDisplay/configSchema.d.ts +5 -0
  38. package/esm/LinearBasicDisplay/model.d.ts +56 -21
  39. package/esm/LinearBasicDisplay/model.js +37 -6
  40. package/esm/LinearGenomeView/components/Gridlines.js +3 -4
  41. package/esm/LinearGenomeView/components/Highlight.js +20 -21
  42. package/esm/LinearGenomeView/components/OverviewScalebar.js +1 -2
  43. package/esm/LinearGenomeView/components/Scalebar.js +4 -5
  44. package/esm/LinearGenomeView/components/TrackLabel.js +4 -4
  45. package/esm/LinearGenomeView/components/TrackRenderingContainer.js +10 -5
  46. package/esm/LinearGenomeView/components/hooks.d.ts +2 -2
  47. package/esm/LinearGenomeView/components/hooks.js +8 -10
  48. package/esm/LinearGenomeView/model.d.ts +5 -22
  49. package/esm/LinearGenomeView/model.js +3 -3
  50. package/esm/index.d.ts +60 -129
  51. package/package.json +2 -4
  52. /package/dist/LinearBasicDisplay/components/{SetMaxHeight.d.ts → SetMaxHeightDialog.d.ts} +0 -0
  53. /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
  })));
@@ -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
  }
@@ -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 };
@@ -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;
@@ -2,6 +2,7 @@
2
2
  import { AnyConfigurationSchemaType } from '@jbrowse/core/configuration';
3
3
  import { MenuItem } from '@jbrowse/core/ui';
4
4
  import { Instance } from 'mobx-state-tree';
5
+ import SerializableFilterChain from '@jbrowse/core/pluggableElementTypes/renderers/util/serializableFilterChain';
5
6
  /**
6
7
  * #stateModel LinearBasicDisplay
7
8
  * #category display
@@ -50,11 +51,11 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
50
51
  model: {
51
52
  error?: unknown;
52
53
  reload: () => void;
53
- message: import("react").ReactNode;
54
- filled?: boolean | undefined;
55
- status?: string | undefined; /**
56
- * #getter
54
+ message: import("react").ReactNode; /**
55
+ * #property
57
56
  */
57
+ filled?: boolean | undefined;
58
+ status?: string | undefined;
58
59
  reactElement?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
59
60
  };
60
61
  }) => import("react").JSX.Element | undefined;
@@ -63,7 +64,9 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
63
64
  doReload(): void;
64
65
  afterAttach(): void;
65
66
  setStatus(message: string): void;
66
- setLoading(abortController: AbortController): void;
67
+ setLoading(abortController: AbortController): void; /**
68
+ * #getter
69
+ */
67
70
  setMessage(messageText: string): void;
68
71
  setRendered(props: {
69
72
  reactElement: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
@@ -94,10 +97,17 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
94
97
  };
95
98
  mouseover: {
96
99
  type: string;
97
- description: string;
100
+ description: string; /**
101
+ * #property
102
+ */
98
103
  defaultValue: string;
99
104
  contextVariable: string[];
100
105
  };
106
+ jexlFilters: {
107
+ type: string;
108
+ description: string;
109
+ defaultValue: never[];
110
+ };
101
111
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "displayId">>;
102
112
  } & {
103
113
  /**
@@ -124,6 +134,10 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
124
134
  * #property
125
135
  */
126
136
  configuration: AnyConfigurationSchemaType;
137
+ /**
138
+ * #property
139
+ */
140
+ jexlFilters: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IArrayType<import("mobx-state-tree").ISimpleType<string>>>;
127
141
  }, {
128
142
  rendererTypeName: string;
129
143
  error: unknown;
@@ -140,7 +154,9 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
140
154
  message: string | undefined;
141
155
  } & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
142
156
  id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
143
- type: import("mobx-state-tree").ISimpleType<string>;
157
+ type: import("mobx-state-tree").ISimpleType<string>; /**
158
+ * #property
159
+ */
144
160
  rpcDriverName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
145
161
  }, {
146
162
  rendererTypeName: string;
@@ -166,11 +182,11 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
166
182
  }, {
167
183
  rendererTypeName: string;
168
184
  error: unknown;
169
- message: string | undefined; /**
170
- * #action
171
- */
185
+ message: string | undefined;
172
186
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
173
- }> | null;
187
+ }> | null; /**
188
+ * #getter
189
+ */
174
190
  readonly adapterConfig: any;
175
191
  readonly parentTrack: any;
176
192
  renderProps(): any;
@@ -208,13 +224,13 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
208
224
  setCurrStatsBpPerPx(n: number): void;
209
225
  setFeatureDensityStatsLimit(stats?: import("@jbrowse/core/data_adapters/BaseAdapter").FeatureDensityStats | undefined): void;
210
226
  getFeatureDensityStats(): Promise<import("@jbrowse/core/data_adapters/BaseAdapter").FeatureDensityStats>;
211
- setFeatureDensityStatsP(arg: any): void; /**
212
- * #method
213
- */
227
+ setFeatureDensityStatsP(arg: any): void;
214
228
  setFeatureDensityStats(featureDensityStats?: import("@jbrowse/core/data_adapters/BaseAdapter").FeatureDensityStats | undefined): void;
215
229
  clearFeatureDensityStats(): void;
216
230
  } & {
217
- readonly regionTooLarge: boolean;
231
+ readonly regionTooLarge: boolean; /**
232
+ * #method
233
+ */
218
234
  readonly regionTooLargeReason: string;
219
235
  } & {
220
236
  regionCannotBeRenderedText(_region: import("@jbrowse/core/util").Region): "" | "Force load to see features";
@@ -240,6 +256,7 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
240
256
  addBlock(key: string, block: import("@jbrowse/core/util/blockTypes").BaseBlock): void;
241
257
  deleteBlock(key: string): void;
242
258
  selectFeature(feature: import("@jbrowse/core/util").Feature): void;
259
+ navToFeature(feature: import("@jbrowse/core/util").Feature): void;
243
260
  clearFeatureSelection(): void;
244
261
  setFeatureIdUnderMouse(feature?: string | undefined): void;
245
262
  setContextMenuFeature(feature?: import("@jbrowse/core/util").Feature | undefined): void;
@@ -253,6 +270,10 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
253
270
  renderSvg(opts: import("../BaseLinearDisplay").ExportSvgDisplayOptions): Promise<import("react").JSX.Element>;
254
271
  afterAttach(): void;
255
272
  } & {
273
+ /**
274
+ * #getter
275
+ */
276
+ readonly activeFilters: any;
256
277
  /**
257
278
  * #getter
258
279
  */
@@ -283,6 +304,10 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
283
304
  setSubschema(slotName: string, data: unknown): any;
284
305
  } & import("mobx-state-tree").IStateTreeNode<AnyConfigurationSchemaType>;
285
306
  } & {
307
+ /**
308
+ * #action
309
+ */
310
+ setJexlFilters(f?: string[]): void;
286
311
  /**
287
312
  * #action
288
313
  */
@@ -309,6 +334,7 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
309
334
  } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
310
335
  setSubschema(slotName: string, data: unknown): any;
311
336
  } & import("mobx-state-tree").IStateTreeNode<AnyConfigurationSchemaType>;
337
+ filters: SerializableFilterChain;
312
338
  };
313
339
  /**
314
340
  * #method
@@ -355,11 +381,11 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
355
381
  model: {
356
382
  error?: unknown;
357
383
  reload: () => void;
358
- message: import("react").ReactNode;
359
- filled?: boolean | undefined;
360
- status?: string | undefined; /**
361
- * #getter
384
+ message: import("react").ReactNode; /**
385
+ * #property
362
386
  */
387
+ filled?: boolean | undefined;
388
+ status?: string | undefined;
363
389
  reactElement?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
364
390
  };
365
391
  }) => import("react").JSX.Element | undefined;
@@ -368,7 +394,9 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
368
394
  doReload(): void;
369
395
  afterAttach(): void;
370
396
  setStatus(message: string): void;
371
- setLoading(abortController: AbortController): void;
397
+ setLoading(abortController: AbortController): void; /**
398
+ * #getter
399
+ */
372
400
  setMessage(messageText: string): void;
373
401
  setRendered(props: {
374
402
  reactElement: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
@@ -399,10 +427,17 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
399
427
  };
400
428
  mouseover: {
401
429
  type: string;
402
- description: string;
430
+ description: string; /**
431
+ * #property
432
+ */
403
433
  defaultValue: string;
404
434
  contextVariable: string[];
405
435
  };
436
+ jexlFilters: {
437
+ type: string;
438
+ description: string;
439
+ defaultValue: never[];
440
+ };
406
441
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "displayId">>;
407
442
  }>> & import("mobx-state-tree/dist/internal").NonEmptyObject & import("mobx-state-tree")._NotCustomized, {
408
443
  type: string;
@@ -34,7 +34,9 @@ const mobx_state_tree_1 = require("mobx-state-tree");
34
34
  const Visibility_1 = __importDefault(require("@mui/icons-material/Visibility"));
35
35
  // locals
36
36
  const BaseLinearDisplay_1 = require("../BaseLinearDisplay");
37
- const SetMaxHeightDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./components/SetMaxHeight'))));
37
+ const serializableFilterChain_1 = __importDefault(require("@jbrowse/core/pluggableElementTypes/renderers/util/serializableFilterChain"));
38
+ const SetMaxHeightDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./components/SetMaxHeightDialog'))));
39
+ const AddFiltersDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./components/AddFiltersDialog'))));
38
40
  /**
39
41
  * #stateModel LinearBasicDisplay
40
42
  * #category display
@@ -71,8 +73,21 @@ function stateModelFactory(configSchema) {
71
73
  * #property
72
74
  */
73
75
  configuration: (0, configuration_1.ConfigurationReference)(configSchema),
76
+ /**
77
+ * #property
78
+ */
79
+ jexlFilters: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.array(mobx_state_tree_1.types.string)),
74
80
  }))
75
81
  .views(self => ({
82
+ /**
83
+ * #getter
84
+ */
85
+ get activeFilters() {
86
+ var _a;
87
+ // config jexlFilters are deferred evaluated so they are prepended with
88
+ // jexl at runtime rather than being stored with jexl in the config
89
+ return ((_a = self.jexlFilters) !== null && _a !== void 0 ? _a : (0, configuration_1.getConf)(self, 'jexlFilters').map((r) => `jexl:${r}`));
90
+ },
76
91
  /**
77
92
  * #getter
78
93
  */
@@ -125,6 +140,12 @@ function stateModelFactory(configSchema) {
125
140
  },
126
141
  }))
127
142
  .actions(self => ({
143
+ /**
144
+ * #action
145
+ */
146
+ setJexlFilters(f) {
147
+ self.jexlFilters = (0, mobx_state_tree_1.cast)(f);
148
+ },
128
149
  /**
129
150
  * #action
130
151
  */
@@ -157,12 +178,13 @@ function stateModelFactory(configSchema) {
157
178
  * #method
158
179
  */
159
180
  renderProps() {
160
- const config = self.rendererConfig;
161
181
  const superProps = superRenderProps();
162
- const superPropsOmit = superProps;
163
182
  return {
164
- ...superPropsOmit,
165
- config,
183
+ ...superProps,
184
+ config: self.rendererConfig,
185
+ filters: new serializableFilterChain_1.default({
186
+ filters: self.activeFilters,
187
+ }),
166
188
  };
167
189
  },
168
190
  /**
@@ -207,6 +229,15 @@ function stateModelFactory(configSchema) {
207
229
  ]);
208
230
  },
209
231
  },
232
+ {
233
+ label: 'Edit filters',
234
+ onClick: () => {
235
+ (0, util_1.getSession)(self).queueDialog(handleClose => [
236
+ AddFiltersDialog,
237
+ { model: self, handleClose },
238
+ ]);
239
+ },
240
+ },
210
241
  ];
211
242
  },
212
243
  };