@jbrowse/plugin-config 2.16.1 → 2.18.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 (90) hide show
  1. package/dist/ConfigurationEditorWidget/components/BooleanEditor.js +1 -1
  2. package/dist/ConfigurationEditorWidget/components/CallbackEditor.js +8 -11
  3. package/dist/ConfigurationEditorWidget/components/ColorEditor.js +2 -2
  4. package/dist/ConfigurationEditorWidget/components/ConfigurationEditor.d.ts +2 -2
  5. package/dist/ConfigurationEditorWidget/components/ConfigurationEditor.js +4 -11
  6. package/dist/ConfigurationEditorWidget/components/ConfigurationTextField.d.ts +1 -1
  7. package/dist/ConfigurationEditorWidget/components/ConfigurationTextField.js +6 -6
  8. package/dist/ConfigurationEditorWidget/components/JsonEditor.js +6 -6
  9. package/dist/ConfigurationEditorWidget/components/NumberMapEditor.js +12 -11
  10. package/dist/ConfigurationEditorWidget/components/SlotEditor.d.ts +1 -1
  11. package/dist/ConfigurationEditorWidget/components/SlotEditor.js +11 -16
  12. package/dist/ConfigurationEditorWidget/components/StringArrayEditor.js +24 -21
  13. package/dist/ConfigurationEditorWidget/components/StringArrayMapEditor.js +12 -12
  14. package/dist/ConfigurationEditorWidget/components/TypeSelector.d.ts +1 -1
  15. package/dist/ConfigurationEditorWidget/index.d.ts +1 -1
  16. package/dist/ConfigurationEditorWidget/index.js +1 -1
  17. package/dist/ConfigurationEditorWidget/model.d.ts +1 -1
  18. package/dist/ConfigurationEditorWidget/model.js +1 -3
  19. package/dist/FromConfigAdapter/FromConfigAdapter.d.ts +5 -5
  20. package/dist/FromConfigAdapter/FromConfigAdapter.js +3 -4
  21. package/dist/FromConfigAdapter/configSchema.d.ts +0 -3
  22. package/dist/FromConfigAdapter/configSchema.js +1 -7
  23. package/dist/FromConfigAdapter/index.d.ts +1 -1
  24. package/dist/FromConfigRegionsAdapter/FromConfigRegionsAdapter.d.ts +5 -12
  25. package/dist/FromConfigRegionsAdapter/FromConfigRegionsAdapter.js +2 -12
  26. package/dist/FromConfigRegionsAdapter/configSchema.d.ts +0 -3
  27. package/dist/FromConfigRegionsAdapter/configSchema.js +1 -8
  28. package/dist/FromConfigRegionsAdapter/index.d.ts +1 -1
  29. package/dist/FromConfigSequenceAdapter/FromConfigSequenceAdapter.d.ts +3 -16
  30. package/dist/FromConfigSequenceAdapter/FromConfigSequenceAdapter.js +3 -18
  31. package/dist/FromConfigSequenceAdapter/configSchema.d.ts +0 -3
  32. package/dist/FromConfigSequenceAdapter/configSchema.js +1 -7
  33. package/dist/FromConfigSequenceAdapter/index.d.ts +1 -1
  34. package/dist/NcbiSequenceReportAliasAdapter/NcbiSequenceReportAliasAdapter.d.ts +2 -1
  35. package/dist/NcbiSequenceReportAliasAdapter/configSchema.d.ts +0 -3
  36. package/dist/NcbiSequenceReportAliasAdapter/configSchema.js +1 -8
  37. package/dist/NcbiSequenceReportAliasAdapter/index.d.ts +1 -1
  38. package/dist/RefNameAliasAdapter/RefNameAliasAdapter.d.ts +2 -1
  39. package/dist/RefNameAliasAdapter/configSchema.d.ts +0 -8
  40. package/dist/RefNameAliasAdapter/configSchema.js +1 -14
  41. package/dist/RefNameAliasAdapter/index.d.ts +1 -1
  42. package/dist/index.d.ts +1 -1
  43. package/dist/index.js +2 -2
  44. package/esm/ConfigurationEditorWidget/components/BooleanEditor.js +1 -1
  45. package/esm/ConfigurationEditorWidget/components/CallbackEditor.js +8 -11
  46. package/esm/ConfigurationEditorWidget/components/ColorEditor.js +2 -2
  47. package/esm/ConfigurationEditorWidget/components/ConfigurationEditor.d.ts +2 -2
  48. package/esm/ConfigurationEditorWidget/components/ConfigurationEditor.js +5 -12
  49. package/esm/ConfigurationEditorWidget/components/ConfigurationTextField.d.ts +1 -1
  50. package/esm/ConfigurationEditorWidget/components/ConfigurationTextField.js +6 -6
  51. package/esm/ConfigurationEditorWidget/components/HeadingComponent.js +1 -1
  52. package/esm/ConfigurationEditorWidget/components/JsonEditor.js +6 -6
  53. package/esm/ConfigurationEditorWidget/components/NumberMapEditor.js +12 -11
  54. package/esm/ConfigurationEditorWidget/components/SlotEditor.d.ts +1 -1
  55. package/esm/ConfigurationEditorWidget/components/SlotEditor.js +12 -17
  56. package/esm/ConfigurationEditorWidget/components/StringArrayEditor.js +24 -21
  57. package/esm/ConfigurationEditorWidget/components/StringArrayMapEditor.js +12 -12
  58. package/esm/ConfigurationEditorWidget/components/TypeSelector.d.ts +1 -1
  59. package/esm/ConfigurationEditorWidget/index.d.ts +1 -1
  60. package/esm/ConfigurationEditorWidget/index.js +1 -1
  61. package/esm/ConfigurationEditorWidget/model.d.ts +1 -1
  62. package/esm/ConfigurationEditorWidget/model.js +1 -3
  63. package/esm/FromConfigAdapter/FromConfigAdapter.d.ts +5 -5
  64. package/esm/FromConfigAdapter/FromConfigAdapter.js +3 -4
  65. package/esm/FromConfigAdapter/configSchema.d.ts +0 -3
  66. package/esm/FromConfigAdapter/configSchema.js +1 -7
  67. package/esm/FromConfigAdapter/index.d.ts +1 -1
  68. package/esm/FromConfigRegionsAdapter/FromConfigRegionsAdapter.d.ts +5 -12
  69. package/esm/FromConfigRegionsAdapter/FromConfigRegionsAdapter.js +3 -13
  70. package/esm/FromConfigRegionsAdapter/configSchema.d.ts +0 -3
  71. package/esm/FromConfigRegionsAdapter/configSchema.js +1 -8
  72. package/esm/FromConfigRegionsAdapter/index.d.ts +1 -1
  73. package/esm/FromConfigSequenceAdapter/FromConfigSequenceAdapter.d.ts +3 -16
  74. package/esm/FromConfigSequenceAdapter/FromConfigSequenceAdapter.js +3 -18
  75. package/esm/FromConfigSequenceAdapter/configSchema.d.ts +0 -3
  76. package/esm/FromConfigSequenceAdapter/configSchema.js +1 -7
  77. package/esm/FromConfigSequenceAdapter/index.d.ts +1 -1
  78. package/esm/NcbiSequenceReportAliasAdapter/NcbiSequenceReportAliasAdapter.d.ts +2 -1
  79. package/esm/NcbiSequenceReportAliasAdapter/NcbiSequenceReportAliasAdapter.js +1 -1
  80. package/esm/NcbiSequenceReportAliasAdapter/configSchema.d.ts +0 -3
  81. package/esm/NcbiSequenceReportAliasAdapter/configSchema.js +1 -8
  82. package/esm/NcbiSequenceReportAliasAdapter/index.d.ts +1 -1
  83. package/esm/RefNameAliasAdapter/RefNameAliasAdapter.d.ts +2 -1
  84. package/esm/RefNameAliasAdapter/RefNameAliasAdapter.js +1 -1
  85. package/esm/RefNameAliasAdapter/configSchema.d.ts +0 -8
  86. package/esm/RefNameAliasAdapter/configSchema.js +1 -14
  87. package/esm/RefNameAliasAdapter/index.d.ts +1 -1
  88. package/esm/index.d.ts +1 -1
  89. package/esm/index.js +2 -2
  90. package/package.json +2 -2
@@ -1,26 +1,13 @@
1
- import { Feature } from '@jbrowse/core/util/simpleFeature';
2
- import { NoAssemblyRegion } from '@jbrowse/core/util/types';
3
- import { RegionsAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
4
1
  import FromConfigAdapter from '../FromConfigAdapter/FromConfigAdapter';
2
+ import type { RegionsAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
3
+ import type { Feature } from '@jbrowse/core/util/simpleFeature';
4
+ import type { NoAssemblyRegion } from '@jbrowse/core/util/types';
5
5
  export default class FromConfigSequenceAdapter extends FromConfigAdapter implements RegionsAdapter {
6
- /**
7
- * Fetch features for a certain region
8
- * @param region - Region
9
- * @returns Observable of Feature objects in the region
10
- */
11
6
  getFeatures(region: NoAssemblyRegion): import("rxjs").Observable<Feature>;
12
- /**
13
- * Get refName, start, and end for all features after collapsing any overlaps
14
- */
15
7
  getRegions(): Promise<{
16
8
  start: number;
17
9
  end: number;
18
10
  refName: string;
19
11
  }[]>;
20
- /**
21
- * called to provide a hint that data tied to a certain region
22
- * will not be needed for the foreseeable future and can be purged
23
- * from caches, etc
24
- */
25
12
  freeResources(): void;
26
13
  }
@@ -3,18 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const simpleFeature_1 = __importDefault(require("@jbrowse/core/util/simpleFeature"));
7
6
  const rxjs_1 = require("@jbrowse/core/util/rxjs");
7
+ const simpleFeature_1 = __importDefault(require("@jbrowse/core/util/simpleFeature"));
8
+ const rxjs_2 = require("rxjs");
8
9
  const operators_1 = require("rxjs/operators");
9
- // locals
10
10
  const FromConfigAdapter_1 = __importDefault(require("../FromConfigAdapter/FromConfigAdapter"));
11
- const rxjs_2 = require("rxjs");
12
11
  class FromConfigSequenceAdapter extends FromConfigAdapter_1.default {
13
- /**
14
- * Fetch features for a certain region
15
- * @param region - Region
16
- * @returns Observable of Feature objects in the region
17
- */
18
12
  getFeatures(region) {
19
13
  return (0, rxjs_1.ObservableCreate)(async (observer) => {
20
14
  const feats = await (0, rxjs_2.firstValueFrom)(super.getFeatures(region).pipe((0, operators_1.toArray)()));
@@ -31,12 +25,8 @@ class FromConfigSequenceAdapter extends FromConfigAdapter_1.default {
31
25
  observer.complete();
32
26
  });
33
27
  }
34
- /**
35
- * Get refName, start, and end for all features after collapsing any overlaps
36
- */
37
28
  async getRegions() {
38
29
  const regions = [];
39
- // recall: features are stored in this object sorted by start coordinate
40
30
  for (const [refName, features] of this.features) {
41
31
  let currentRegion;
42
32
  for (const feature of features) {
@@ -62,11 +52,6 @@ class FromConfigSequenceAdapter extends FromConfigAdapter_1.default {
62
52
  }
63
53
  return regions;
64
54
  }
65
- /**
66
- * called to provide a hint that data tied to a certain region
67
- * will not be needed for the foreseeable future and can be purged
68
- * from caches, etc
69
- */
70
- freeResources( /* { region } */) { }
55
+ freeResources() { }
71
56
  }
72
57
  exports.default = FromConfigSequenceAdapter;
@@ -1,7 +1,4 @@
1
1
  declare const sequenceConfigSchema: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
2
- /**
3
- * #slot
4
- */
5
2
  features: {
6
3
  type: string;
7
4
  defaultValue: never[];
@@ -1,14 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const configuration_1 = require("@jbrowse/core/configuration");
4
- /**
5
- * #config FromConfigSequenceAdapter
6
- */
7
- function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ function x() { }
8
5
  const sequenceConfigSchema = (0, configuration_1.ConfigurationSchema)('FromConfigSequenceAdapter', {
9
- /**
10
- * #slot
11
- */
12
6
  features: {
13
7
  type: 'frozen',
14
8
  defaultValue: [],
@@ -1,2 +1,2 @@
1
- import PluginManager from '@jbrowse/core/PluginManager';
1
+ import type PluginManager from '@jbrowse/core/PluginManager';
2
2
  export default function FromConfigSequenceAdapterF(pluginManager: PluginManager): void;
@@ -1,4 +1,5 @@
1
- import { BaseRefNameAliasAdapter, BaseAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
1
+ import { BaseAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
2
+ import type { BaseRefNameAliasAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
2
3
  export default class NcbiSequenceReportAliasAdapter extends BaseAdapter implements BaseRefNameAliasAdapter {
3
4
  getRefNameAliases(): Promise<{
4
5
  refName: string;
@@ -1,7 +1,4 @@
1
1
  declare const NcbiSequenceReportAliasAdapterConfigSchema: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
2
- /**
3
- * #slot
4
- */
5
2
  location: {
6
3
  type: string;
7
4
  defaultValue: {
@@ -1,15 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const configuration_1 = require("@jbrowse/core/configuration");
4
- /**
5
- * #config NcbiSequenceReportAliasAdapter
6
- * can read "sequence_report.tsv" type files from NCBI
7
- */
8
- function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ function x() { }
9
5
  const NcbiSequenceReportAliasAdapterConfigSchema = (0, configuration_1.ConfigurationSchema)('NcbiSequenceReportAliasAdapter', {
10
- /**
11
- * #slot
12
- */
13
6
  location: {
14
7
  type: 'fileLocation',
15
8
  defaultValue: {
@@ -1,2 +1,2 @@
1
- import PluginManager from '@jbrowse/core/PluginManager';
1
+ import type PluginManager from '@jbrowse/core/PluginManager';
2
2
  export default function NcbiSequenceReportAliasAdapterF(pluginManager: PluginManager): void;
@@ -1,4 +1,5 @@
1
- import { BaseRefNameAliasAdapter, BaseAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
1
+ import { BaseAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
2
+ import type { BaseRefNameAliasAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
2
3
  export default class RefNameAliasAdapter extends BaseAdapter implements BaseRefNameAliasAdapter {
3
4
  getRefNameAliases(): Promise<{
4
5
  refName: string;
@@ -1,7 +1,4 @@
1
1
  declare const RefNameAliasAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
2
- /**
3
- * #slot
4
- */
5
2
  location: {
6
3
  type: string;
7
4
  defaultValue: {
@@ -9,11 +6,6 @@ declare const RefNameAliasAdapter: import("@jbrowse/core/configuration/configura
9
6
  locationType: string;
10
7
  };
11
8
  };
12
- /**
13
- * #slot
14
- * by default, the "ref names that match the fasta" are assumed to be in the
15
- * first column (0), change this variable if needed
16
- */
17
9
  refNameColumn: {
18
10
  type: string;
19
11
  defaultValue: number;
@@ -1,16 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const configuration_1 = require("@jbrowse/core/configuration");
4
- /**
5
- * #config RefNameAliasAdapter
6
- * can read "chromAliases" type files from UCSC or any tab separated file of
7
- * refName aliases
8
- */
9
- function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ function x() { }
10
5
  const RefNameAliasAdapter = (0, configuration_1.ConfigurationSchema)('RefNameAliasAdapter', {
11
- /**
12
- * #slot
13
- */
14
6
  location: {
15
7
  type: 'fileLocation',
16
8
  defaultValue: {
@@ -18,11 +10,6 @@ const RefNameAliasAdapter = (0, configuration_1.ConfigurationSchema)('RefNameAli
18
10
  locationType: 'UriLocation',
19
11
  },
20
12
  },
21
- /**
22
- * #slot
23
- * by default, the "ref names that match the fasta" are assumed to be in the
24
- * first column (0), change this variable if needed
25
- */
26
13
  refNameColumn: {
27
14
  type: 'number',
28
15
  defaultValue: 0,
@@ -1,2 +1,2 @@
1
- import PluginManager from '@jbrowse/core/PluginManager';
1
+ import type PluginManager from '@jbrowse/core/PluginManager';
2
2
  export default function RefNameAliasAdapterF(pluginManager: PluginManager): void;
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
  declare const LazyConfigurationEditorComponent: import("react").LazyExoticComponent<({ model, }: {
4
4
  model: {
5
5
  target: import("@jbrowse/core/configuration").AnyConfigurationModel;
package/dist/index.js CHANGED
@@ -29,12 +29,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.ConfigurationEditor = void 0;
30
30
  const react_1 = require("react");
31
31
  const Plugin_1 = __importDefault(require("@jbrowse/core/Plugin"));
32
+ const ConfigurationEditorWidget_1 = __importDefault(require("./ConfigurationEditorWidget"));
32
33
  const FromConfigAdapter_1 = __importDefault(require("./FromConfigAdapter"));
33
34
  const FromConfigRegionsAdapter_1 = __importDefault(require("./FromConfigRegionsAdapter"));
34
35
  const FromConfigSequenceAdapter_1 = __importDefault(require("./FromConfigSequenceAdapter"));
35
- const RefNameAliasAdapter_1 = __importDefault(require("./RefNameAliasAdapter"));
36
- const ConfigurationEditorWidget_1 = __importDefault(require("./ConfigurationEditorWidget"));
37
36
  const NcbiSequenceReportAliasAdapter_1 = __importDefault(require("./NcbiSequenceReportAliasAdapter"));
37
+ const RefNameAliasAdapter_1 = __importDefault(require("./RefNameAliasAdapter"));
38
38
  const LazyConfigurationEditorComponent = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./ConfigurationEditorWidget/components/ConfigurationEditor'))));
39
39
  exports.ConfigurationEditor = LazyConfigurationEditorComponent;
40
40
  class ConfigurationPlugin extends Plugin_1.default {
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { observer } from 'mobx-react';
3
2
  import { Checkbox, FormControl, FormControlLabel, FormHelperText, } from '@mui/material';
3
+ import { observer } from 'mobx-react';
4
4
  const BooleanEditor = observer(function ({ slot, }) {
5
5
  return (React.createElement(FormControl, null,
6
6
  React.createElement(FormControlLabel, { label: slot.name, control: React.createElement(Checkbox, { checked: slot.value, onChange: evt => {
@@ -1,14 +1,11 @@
1
1
  import React, { useEffect, useState } from 'react';
2
- import { Tooltip, IconButton, TextField } from '@mui/material';
3
2
  import { useDebounce } from '@jbrowse/core/util';
4
3
  import { stringToJexlExpression } from '@jbrowse/core/util/jexlStrings';
5
- import { getEnv } from 'mobx-state-tree';
4
+ import HelpIcon from '@mui/icons-material/Help';
5
+ import { IconButton, TextField, Tooltip } from '@mui/material';
6
6
  import { observer } from 'mobx-react';
7
+ import { getEnv } from 'mobx-state-tree';
7
8
  import { makeStyles } from 'tss-react/mui';
8
- // icons
9
- import HelpIcon from '@mui/icons-material/Help';
10
- // Optimize by using system default fonts:
11
- // https://css-tricks.com/snippets/css/font-stacks/
12
9
  const fontFamily = 'Consolas, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", Monaco, "Courier New", Courier, monospace';
13
10
  const useStyles = makeStyles()(theme => ({
14
11
  callbackEditor: {
@@ -52,16 +49,16 @@ const CallbackEditor = observer(function ({ slot, }) {
52
49
  setCodeError(e);
53
50
  }
54
51
  }, [debouncedCode, slot]);
55
- // if default value is a callback, will have to remove jexl:
56
- // do this last
57
52
  return (React.createElement(React.Fragment, null,
58
53
  error ? React.createElement("p", { className: classes.error }, `${error}`) : null,
59
54
  React.createElement("div", { className: classes.callbackContainer },
60
55
  React.createElement(TextField, { multiline: true, className: classes.callbackEditor, value: code.startsWith('jexl:') ? code.split('jexl:')[1] : code, onChange: event => {
61
56
  setCode(event.target.value);
62
- }, style: { background: error ? '#fdd' : undefined }, InputProps: {
63
- classes: {
64
- input: classes.textAreaFont,
57
+ }, style: { background: error ? '#fdd' : undefined }, slotProps: {
58
+ input: {
59
+ classes: {
60
+ input: classes.textAreaFont,
61
+ },
65
62
  },
66
63
  } }),
67
64
  React.createElement("p", null, slot.description),
@@ -1,7 +1,7 @@
1
1
  import React, { useState } from 'react';
2
- import { observer } from 'mobx-react';
3
- import { TextField } from '@mui/material';
4
2
  import ColorPicker from '@jbrowse/core/ui/ColorPicker';
3
+ import { TextField } from '@mui/material';
4
+ import { observer } from 'mobx-react';
5
5
  export const ColorSlot = (props) => {
6
6
  const { value = '#000', label = '', TextFieldProps = {}, onChange } = props;
7
7
  const [displayed, setDisplayed] = useState(false);
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { AbstractSessionModel } from '@jbrowse/core/util';
3
- import { AnyConfigurationModel } from '@jbrowse/core/configuration';
2
+ import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
3
+ import type { AbstractSessionModel } from '@jbrowse/core/util';
4
4
  declare const ConfigurationEditor: ({ model, }: {
5
5
  model: {
6
6
  target: AnyConfigurationModel;
@@ -1,14 +1,12 @@
1
1
  import React from 'react';
2
- import { FormGroup, Accordion, AccordionDetails, AccordionSummary, Typography, } from '@mui/material';
3
- import { makeStyles } from 'tss-react/mui';
2
+ import { getTypeNamesFromExplicitlyTypedUnion, isConfigurationSchemaType, isConfigurationSlotType, readConfObject, } from '@jbrowse/core/configuration';
3
+ import SanitizedHTML from '@jbrowse/core/ui/SanitizedHTML';
4
+ import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
5
+ import { Accordion, AccordionDetails, AccordionSummary, FormGroup, Typography, } from '@mui/material';
4
6
  import { observer } from 'mobx-react';
5
7
  import { getMembers } from 'mobx-state-tree';
6
8
  import { singular } from 'pluralize';
7
- import SanitizedHTML from '@jbrowse/core/ui/SanitizedHTML';
8
- import { readConfObject, getTypeNamesFromExplicitlyTypedUnion, isConfigurationSchemaType, isConfigurationSlotType, } from '@jbrowse/core/configuration';
9
- // icons
10
- import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
11
- // locals
9
+ import { makeStyles } from 'tss-react/mui';
12
10
  import SlotEditor from './SlotEditor';
13
11
  import TypeSelector from './TypeSelector';
14
12
  const useStyles = makeStyles()(theme => ({
@@ -39,8 +37,6 @@ const Member = observer(function (props) {
39
37
  return React.createElement(Member, { key: key, ...props, slot: subslot, slotName: key });
40
38
  });
41
39
  }
42
- // if this is an explicitly typed schema, make a type-selecting dropdown
43
- // that can be used to change its type
44
40
  const typeNameChoices = getTypeNamesFromExplicitlyTypedUnion(slotSchema);
45
41
  return (React.createElement(Accordion, { defaultExpanded: true, className: classes.accordion },
46
42
  React.createElement(AccordionSummary, { expandIcon: React.createElement(ExpandMoreIcon, { className: classes.icon }) },
@@ -67,9 +63,6 @@ const Schema = observer(function ({ schema, path = [], }) {
67
63
  });
68
64
  const ConfigurationEditor = observer(function ({ model, }) {
69
65
  const { classes } = useStyles();
70
- // key forces a re-render, otherwise the same field can end up being used for
71
- // different tracks since only the backing model changes for example see pr
72
- // #804
73
66
  const { target } = model;
74
67
  const key = readConfObject(target, 'trackId');
75
68
  const name = readConfObject(target, 'name');
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { TextFieldProps } from '@mui/material';
2
+ import type { TextFieldProps } from '@mui/material';
3
3
  export default function ConfigurationTextField(props: {
4
4
  helperText?: string;
5
5
  } & TextFieldProps): React.JSX.Element;
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
- import { TextField } from '@mui/material';
3
2
  import { SanitizedHTML } from '@jbrowse/core/ui';
4
- // adds ability to have html in helperText. note that FormHelperTextProps is
5
- // div because the default is p which does not like div children
3
+ import { TextField } from '@mui/material';
6
4
  export default function ConfigurationTextField(props) {
7
5
  const { helperText } = props;
8
- return (React.createElement(TextField, { ...props, helperText: React.createElement(SanitizedHTML, { html: helperText || '' }), FormHelperTextProps: {
9
- component: 'div',
10
- }, fullWidth: true }));
6
+ return (React.createElement(TextField, { ...props, helperText: React.createElement(SanitizedHTML, { html: helperText || '' }), fullWidth: true, slotProps: {
7
+ formHelperText: {
8
+ component: 'div',
9
+ },
10
+ } }));
11
11
  }
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { observer } from 'mobx-react';
3
- import { isStateTreeNode, getType } from 'mobx-state-tree';
3
+ import { getType, isStateTreeNode } from 'mobx-state-tree';
4
4
  const HeadingComponent = observer(function ({ model, }) {
5
5
  if (model === null || model === void 0 ? void 0 : model.target) {
6
6
  if (model.target.type) {
@@ -1,10 +1,8 @@
1
1
  import React, { useEffect, useState } from 'react';
2
2
  import { InputLabel, TextField } from '@mui/material';
3
- import { makeStyles } from 'tss-react/mui';
4
3
  import { observer } from 'mobx-react';
5
- // fontSize and fontFamily have to match between Editor and SyntaxHighlighter
4
+ import { makeStyles } from 'tss-react/mui';
6
5
  const fontSize = '12px';
7
- // Optimize by using system default fonts: https://css-tricks.com/snippets/css/font-stacks/
8
6
  const fontFamily = 'Consolas, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", Monaco, "Courier New", Courier, monospace';
9
7
  const useStyles = makeStyles()(theme => ({
10
8
  error: {
@@ -47,9 +45,11 @@ const JsonEditor = observer(function JsonEditor({ slot, }) {
47
45
  React.createElement(InputLabel, { shrink: true, htmlFor: "json-editor" }, slot.name),
48
46
  React.createElement(TextField, { id: "json-editor", className: classes.callbackEditor, value: contents, helperText: slot.description, multiline: true, onChange: event => {
49
47
  setContents(event.target.value);
50
- }, style: { background: error ? '#fdd' : undefined }, InputProps: {
51
- classes: {
52
- input: classes.textAreaFont,
48
+ }, style: { background: error ? '#fdd' : undefined }, slotProps: {
49
+ input: {
50
+ classes: {
51
+ input: classes.textAreaFont,
52
+ },
53
53
  },
54
54
  } }))));
55
55
  });
@@ -1,10 +1,9 @@
1
1
  import React, { useState } from 'react';
2
- import { observer } from 'mobx-react';
2
+ import AddIcon from '@mui/icons-material/Add';
3
+ import DeleteIcon from '@mui/icons-material/Delete';
3
4
  import { Card, CardContent, CardHeader, FormHelperText, IconButton, InputAdornment, InputLabel, TextField, } from '@mui/material';
5
+ import { observer } from 'mobx-react';
4
6
  import { makeStyles } from 'tss-react/mui';
5
- // icons
6
- import DeleteIcon from '@mui/icons-material/Delete';
7
- import AddIcon from '@mui/icons-material/Add';
8
7
  import NumberEditor from './NumberEditor';
9
8
  const useStyles = makeStyles()(theme => ({
10
9
  card: {
@@ -31,13 +30,15 @@ const NumberMapEditor = observer(function ({ slot, }) {
31
30
  React.createElement(Card, { raised: true, className: classes.card },
32
31
  React.createElement(CardHeader, { disableTypography: true, title: React.createElement(TextField, { fullWidth: true, value: value, placeholder: "add new", onChange: event => {
33
32
  setValue(event.target.value);
34
- }, InputProps: {
35
- endAdornment: (React.createElement(InputAdornment, { position: "end" },
36
- React.createElement(IconButton, { disabled: value === '', onClick: () => {
37
- slot.add(value, 0);
38
- setValue('');
39
- } },
40
- React.createElement(AddIcon, null)))),
33
+ }, slotProps: {
34
+ input: {
35
+ endAdornment: (React.createElement(InputAdornment, { position: "end" },
36
+ React.createElement(IconButton, { disabled: value === '', onClick: () => {
37
+ slot.add(value, 0);
38
+ setValue('');
39
+ } },
40
+ React.createElement(AddIcon, null)))),
41
+ },
41
42
  } }) })),
42
43
  React.createElement(FormHelperText, null, slot.description)));
43
44
  });
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { IAnyType } from 'mobx-state-tree';
2
+ import type { IAnyType } from 'mobx-state-tree';
3
3
  declare const SlotEditor: ({ slot, slotSchema, }: {
4
4
  slot: any;
5
5
  slotSchema: IAnyType;
@@ -1,22 +1,20 @@
1
1
  import React, { useEffect, useState } from 'react';
2
- import { observer } from 'mobx-react';
3
- import { getPropertyMembers } from 'mobx-state-tree';
4
- import { getEnv } from '@jbrowse/core/util';
5
2
  import { FileSelector } from '@jbrowse/core/ui';
6
- import { getSubType, getUnionSubTypes, } from '@jbrowse/core/util/mst-reflection';
7
- import { IconButton, MenuItem, Paper, SvgIcon, TextField } from '@mui/material';
8
- // icons
3
+ import { getEnv } from '@jbrowse/core/util';
4
+ import { getSubType, getUnionSubTypes } from '@jbrowse/core/util/mst-reflection';
9
5
  import RadioButtonUncheckedIcon from '@mui/icons-material/RadioButtonUnchecked';
10
- // locals
11
- import StringArrayEditor from './StringArrayEditor';
6
+ import { IconButton, MenuItem, Paper, SvgIcon, TextField } from '@mui/material';
7
+ import { observer } from 'mobx-react';
8
+ import { getPropertyMembers } from 'mobx-state-tree';
9
+ import BooleanEditor from './BooleanEditor';
12
10
  import CallbackEditor from './CallbackEditor';
13
11
  import ColorEditor from './ColorEditor';
14
- import JsonEditor from './JsonEditor';
15
- import StringArrayMapEditor from './StringArrayMapEditor';
16
12
  import ConfigurationTextField from './ConfigurationTextField';
17
- import NumberMapEditor from './NumberMapEditor';
13
+ import JsonEditor from './JsonEditor';
18
14
  import NumberEditor from './NumberEditor';
19
- import BooleanEditor from './BooleanEditor';
15
+ import NumberMapEditor from './NumberMapEditor';
16
+ import StringArrayEditor from './StringArrayEditor';
17
+ import StringArrayMapEditor from './StringArrayMapEditor';
20
18
  import { useSlotEditorStyles } from './useSlotEditorStyles';
21
19
  const StringEditor = observer(function ({ slot, }) {
22
20
  return (React.createElement(ConfigurationTextField, { label: slot.name, helperText: slot.description, value: slot.value, onChange: evt => {
@@ -28,7 +26,6 @@ const TextEditor = observer(function ({ slot, }) {
28
26
  slot.set(evt.target.value);
29
27
  } }));
30
28
  });
31
- // checked checkbox, looks like a styled (x)
32
29
  const SvgCheckbox = () => (React.createElement(SvgIcon, null,
33
30
  React.createElement("path", { d: "M20.41,3C21.8,5.71 22.35,8.84 22,12C21.8,15.16 20.7,18.29 18.83,21L17.3,20C18.91,17.57 19.85,14.8 20,12C20.34,9.2 19.89,6.43 18.7,4L20.41,3M5.17,3L6.7,4C5.09,6.43 4.15,9.2 4,12C3.66,14.8 4.12,17.57 5.3,20L3.61,21C2.21,18.29 1.65,15.17 2,12C2.2,8.84 3.3,5.71 5.17,3M12.08,10.68L14.4,7.45H16.93L13.15,12.45L15.35,17.37H13.09L11.71,14L9.28,17.33H6.76L10.66,12.21L8.53,7.45H10.8L12.08,10.68Z" })));
34
31
  const IntegerEditor = observer(function ({ slot, }) {
@@ -54,9 +51,7 @@ const FileSelectorWrapper = observer(function ({ slot, }) {
54
51
  var _a;
55
52
  return (React.createElement(FileSelector, { location: slot.value, setLocation: location => {
56
53
  slot.set(location);
57
- }, name: slot.name, description: slot.description,
58
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
59
- rootModel: (_a = getEnv(slot).pluginManager) === null || _a === void 0 ? void 0 : _a.rootModel }));
54
+ }, name: slot.name, description: slot.description, rootModel: (_a = getEnv(slot).pluginManager) === null || _a === void 0 ? void 0 : _a.rootModel }));
60
55
  });
61
56
  const valueComponents = {
62
57
  string: StringEditor,
@@ -78,7 +73,7 @@ const SlotEditor = observer(function ({ slot, slotSchema, }) {
78
73
  const { type } = slot;
79
74
  let ValueComponent = slot.isCallback
80
75
  ? CallbackEditor
81
- : // @ts-expect-error
76
+ :
82
77
  valueComponents[type];
83
78
  if (!ValueComponent) {
84
79
  console.warn(`no slot editor defined for ${type}, editing as string`);
@@ -1,8 +1,7 @@
1
1
  import React, { useState } from 'react';
2
- import { observer } from 'mobx-react';
3
- import { Button, FormHelperText, IconButton, InputAdornment, InputLabel, List, ListItem, TextField, } from '@mui/material';
4
- // icons
5
2
  import DeleteIcon from '@mui/icons-material/Delete';
3
+ import { Button, FormHelperText, IconButton, InputAdornment, InputLabel, List, ListItem, TextField, } from '@mui/material';
4
+ import { observer } from 'mobx-react';
6
5
  const StringArrayEditor = observer(function ({ slot, }) {
7
6
  const [value, setValue] = useState('');
8
7
  const [addNew, setAddNew] = useState(false);
@@ -12,28 +11,32 @@ const StringArrayEditor = observer(function ({ slot, }) {
12
11
  slot.value.map((val, idx) => (React.createElement(ListItem, { key: `${JSON.stringify(val)}-${idx}`, disableGutters: true },
13
12
  React.createElement(TextField, { value: val, onChange: evt => {
14
13
  slot.setAtIndex(idx, evt.target.value);
15
- }, InputProps: {
16
- endAdornment: (React.createElement(InputAdornment, { position: "end" },
17
- React.createElement(IconButton, { onClick: () => {
18
- slot.removeAtIndex(idx);
19
- } },
20
- React.createElement(DeleteIcon, null)))),
14
+ }, slotProps: {
15
+ input: {
16
+ endAdornment: (React.createElement(InputAdornment, { position: "end" },
17
+ React.createElement(IconButton, { onClick: () => {
18
+ slot.removeAtIndex(idx);
19
+ } },
20
+ React.createElement(DeleteIcon, null)))),
21
+ },
21
22
  } })))),
22
23
  addNew ? (React.createElement(ListItem, { disableGutters: true },
23
24
  React.createElement(TextField, { value: value, placeholder: "add new", onChange: event => {
24
25
  setValue(event.target.value);
25
- }, InputProps: {
26
- endAdornment: (React.createElement(InputAdornment, { position: "end" },
27
- React.createElement(React.Fragment, null,
28
- React.createElement(Button, { color: "primary", variant: "contained", style: { margin: 2 }, "data-testid": `stringArrayAdd-${slot.name}`, onClick: () => {
29
- setAddNew(false);
30
- slot.add(value);
31
- setValue('');
32
- } }, "OK"),
33
- React.createElement(Button, { color: "primary", variant: "contained", style: { margin: 2 }, onClick: () => {
34
- setAddNew(false);
35
- setValue('');
36
- } }, "Cancel")))),
26
+ }, slotProps: {
27
+ input: {
28
+ endAdornment: (React.createElement(InputAdornment, { position: "end" },
29
+ React.createElement(React.Fragment, null,
30
+ React.createElement(Button, { color: "primary", variant: "contained", style: { margin: 2 }, "data-testid": `stringArrayAdd-${slot.name}`, onClick: () => {
31
+ setAddNew(false);
32
+ slot.add(value);
33
+ setValue('');
34
+ } }, "OK"),
35
+ React.createElement(Button, { color: "primary", variant: "contained", style: { margin: 2 }, onClick: () => {
36
+ setAddNew(false);
37
+ setValue('');
38
+ } }, "Cancel")))),
39
+ },
37
40
  } }))) : null,
38
41
  React.createElement(Button, { color: "primary", variant: "contained", style: { margin: 4 }, disabled: addNew, onClick: () => {
39
42
  setAddNew(true);
@@ -1,11 +1,9 @@
1
1
  import React, { useState } from 'react';
2
- import { observer } from 'mobx-react';
2
+ import AddIcon from '@mui/icons-material/Add';
3
+ import DeleteIcon from '@mui/icons-material/Delete';
3
4
  import { Card, CardContent, CardHeader, FormHelperText, IconButton, InputAdornment, InputLabel, TextField, } from '@mui/material';
5
+ import { observer } from 'mobx-react';
4
6
  import { makeStyles } from 'tss-react/mui';
5
- // icons
6
- import DeleteIcon from '@mui/icons-material/Delete';
7
- import AddIcon from '@mui/icons-material/Add';
8
- // locals
9
7
  import StringArrayEditor from './StringArrayEditor';
10
8
  const useStyles = makeStyles()(theme => ({
11
9
  card: {
@@ -40,13 +38,15 @@ const StringArrayMapEditor = observer(function ({ slot, }) {
40
38
  React.createElement(Card, { raised: true, className: classes.card },
41
39
  React.createElement(CardHeader, { disableTypography: true, title: React.createElement(TextField, { fullWidth: true, value: value, placeholder: "add new", onChange: event => {
42
40
  setValue(event.target.value);
43
- }, InputProps: {
44
- endAdornment: (React.createElement(InputAdornment, { position: "end" },
45
- React.createElement(IconButton, { disabled: value === '', onClick: () => {
46
- slot.add(value, []);
47
- setValue('');
48
- } },
49
- React.createElement(AddIcon, null)))),
41
+ }, slotProps: {
42
+ input: {
43
+ endAdornment: (React.createElement(InputAdornment, { position: "end" },
44
+ React.createElement(IconButton, { disabled: value === '', onClick: () => {
45
+ slot.add(value, []);
46
+ setValue('');
47
+ } },
48
+ React.createElement(AddIcon, null)))),
49
+ },
50
50
  } }) })),
51
51
  React.createElement(FormHelperText, null, slot.description)));
52
52
  });