@jbrowse/plugin-config 5.0.0-beta.13 → 5.0.0-beta.14

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.
package/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # @jbrowse/plugin-config
2
+
3
+ JBrowse 2 config utilities
4
+
5
+ <!-- API_DOCS_START -->
6
+
7
+ ## API
8
+
9
+ Auto-generated from `#api` JSDoc tags in this package. Do not edit by hand.
10
+
11
+ ### registerConfigAdapters
12
+
13
+ Registers `FromConfigAdapter`, whose features a track config writes inline, and
14
+ the alias adapters an assembly's `refNameAliases` reads through, on a plugin
15
+ manager that wants them without the configuration editor, as a headless host
16
+ does.
17
+
18
+ ```js
19
+ // type signature
20
+ (pluginManager: PluginManager) => void
21
+ ```
22
+
23
+ [Source code](https://github.com/GMOD/jbrowse-components/blob/main/plugins/config/src/adapters.ts)
24
+
25
+ <!-- API_DOCS_END -->
@@ -1,6 +1,7 @@
1
1
  import type { ReactNode } from 'react';
2
- export default function AddNewField({ onAdd, testid, startAdornment, }: {
2
+ declare const AddNewField: ({ onAdd, testid, startAdornment, }: {
3
3
  onAdd: (value: string) => void;
4
4
  testid?: string;
5
5
  startAdornment?: ReactNode;
6
- }): import("react").JSX.Element;
6
+ }) => import("react").JSX.Element;
7
+ export default AddNewField;
@@ -2,9 +2,10 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useState } from 'react';
3
3
  import AddIcon from '@mui/icons-material/Add';
4
4
  import { IconButton, InputAdornment, TextField } from '@mui/material';
5
+ import { observer } from 'mobx-react';
5
6
  // shared "add new" entry field used by the string-array and map slot editors:
6
7
  // a text box that commits its contents via onAdd and clears itself
7
- export default function AddNewField({ onAdd, testid, startAdornment, }) {
8
+ const AddNewField = observer(function AddNewField({ onAdd, testid, startAdornment, }) {
8
9
  const [value, setValue] = useState('');
9
10
  function commit() {
10
11
  if (value !== '') {
@@ -26,4 +27,5 @@ export default function AddNewField({ onAdd, testid, startAdornment, }) {
26
27
  }, children: _jsx(AddIcon, {}) }) })),
27
28
  },
28
29
  } }));
29
- }
30
+ });
31
+ export default AddNewField;
@@ -24,7 +24,7 @@ const useStyles = makeStyles()({
24
24
  // in the field and reaches the slot once it does; leaving the field drops an
25
25
  // unparsed draft. "Unset" is reachable through the slot's reset button, which
26
26
  // is where every other slot type puts it. Only a slot declaring a
27
- // `contextVariable` takes a `jexl:` callback, which an entry of a colour list
27
+ // `contextVariable` takes a `jexl:` callback, which an entry of a color list
28
28
  // never does.
29
29
  /** #slotEditor text field beside a swatch that opens a color picker */
30
30
  const ColorEditor = observer(function ColorEditor({ slot, }) {
@@ -1,4 +1,5 @@
1
1
  import type { TextFieldProps } from '@mui/material';
2
- export default function ConfigurationTextField(props: {
2
+ declare const ConfigurationTextField: (props: {
3
3
  helperText?: string;
4
- } & TextFieldProps): import("react").JSX.Element;
4
+ } & TextFieldProps) => import("react").JSX.Element;
5
+ export default ConfigurationTextField;
@@ -1,9 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { SanitizedHTML } from '@jbrowse/core/ui';
3
3
  import { TextField } from '@mui/material';
4
+ import { observer } from 'mobx-react';
4
5
  // adds ability to have html in helperText. note that FormHelperTextProps is
5
6
  // div because the default is p which does not like div children
6
- export default function ConfigurationTextField(props) {
7
+ const ConfigurationTextField = observer(function ConfigurationTextField(props) {
7
8
  const { helperText, slotProps, ...rest } = props;
8
9
  return (_jsx(TextField, { ...rest, helperText: _jsx(SanitizedHTML, { html: helperText || '' }), fullWidth: true,
9
10
  // merged, not replaced: this component owns `formHelperText` (the div
@@ -16,4 +17,5 @@ export default function ConfigurationTextField(props) {
16
17
  component: 'div',
17
18
  },
18
19
  } }));
19
- }
20
+ });
21
+ export default ConfigurationTextField;
@@ -1,8 +1,9 @@
1
- export default function MapEntryCard({ title, onDelete, children, }: {
1
+ declare const MapEntryCard: ({ title, onDelete, children, }: {
2
2
  title: string;
3
3
  onDelete: () => void;
4
4
  children: React.ReactNode;
5
- }): import("react").JSX.Element;
6
- export declare function MapAddCard({ onAdd }: {
5
+ }) => import("react").JSX.Element;
6
+ export default MapEntryCard;
7
+ export declare const MapAddCard: ({ onAdd, }: {
7
8
  onAdd: (key: string) => void;
8
- }): import("react").JSX.Element;
9
+ }) => import("react").JSX.Element;
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { makeStyles } from '@jbrowse/core/util/tss-react';
3
3
  import DeleteIcon from '@mui/icons-material/Delete';
4
4
  import { Card, CardContent, CardHeader, IconButton } from '@mui/material';
5
+ import { observer } from 'mobx-react';
5
6
  import AddNewField from './AddNewField.js';
6
7
  const useStyles = makeStyles()(theme => ({
7
8
  card: {
@@ -10,14 +11,15 @@ const useStyles = makeStyles()(theme => ({
10
11
  }));
11
12
  // shared card for a single key in a map slot editor: a titled card with a
12
13
  // delete button wrapping the per-value editor passed as children
13
- export default function MapEntryCard({ title, onDelete, children, }) {
14
+ const MapEntryCard = observer(function MapEntryCard({ title, onDelete, children, }) {
14
15
  const { classes } = useStyles();
15
16
  return (_jsxs(Card, { raised: true, className: classes.card, children: [_jsx(CardHeader, { title: title, action: _jsx(IconButton, { onClick: () => {
16
17
  onDelete();
17
18
  }, children: _jsx(DeleteIcon, {}) }) }), _jsx(CardContent, { children: children })] }));
18
- }
19
+ });
20
+ export default MapEntryCard;
19
21
  // trailing card in a map slot editor holding the "add new key" field
20
- export function MapAddCard({ onAdd }) {
22
+ export const MapAddCard = observer(function MapAddCard({ onAdd, }) {
21
23
  const { classes } = useStyles();
22
24
  return (_jsx(Card, { raised: true, className: classes.card, children: _jsx(CardHeader, { disableTypography: true, title: _jsx(AddNewField, { onAdd: onAdd }) }) }));
23
- }
25
+ });
@@ -1,8 +1,9 @@
1
- export default function MapSlotEditor<V>({ name, description, entries, emptyValue, setMap, renderValue, }: {
1
+ declare const MapSlotEditor: <V>({ name, description, entries, emptyValue, setMap, renderValue, }: {
2
2
  name: string;
3
3
  description: string;
4
4
  entries: [string, V][];
5
5
  emptyValue: V;
6
6
  setMap: (val: Record<string, V>) => void;
7
7
  renderValue: (val: V, set: (val: V) => void, key: string) => React.ReactNode;
8
- }): import("react").JSX.Element;
8
+ }) => import("react").JSX.Element;
9
+ export default MapSlotEditor;
@@ -1,11 +1,12 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { FormHelperText, InputLabel } from '@mui/material';
3
+ import { observer } from 'mobx-react';
3
4
  import MapEntryCard, { MapAddCard } from './MapEntryCard.js';
4
5
  // shared shell for map slot editors (numberMap, stringArrayMap): a labelled
5
6
  // list of per-key cards plus an "add key" card. The owning wrapper stays the
6
7
  // observer and passes plain entries in, so this stays a non-observer generic
7
8
  // (which keeps JSX type args working at the call sites).
8
- export default function MapSlotEditor({ name, description, entries, emptyValue, setMap, renderValue, }) {
9
+ const MapSlotEditor = observer(function MapSlotEditor({ name, description, entries, emptyValue, setMap, renderValue, }) {
9
10
  const obj = Object.fromEntries(entries);
10
11
  return (_jsxs(_Fragment, { children: [_jsx(InputLabel, { children: name }), entries.map(([key, val]) => (_jsx(MapEntryCard, { title: key, onDelete: () => {
11
12
  const { [key]: _omit, ...rest } = obj;
@@ -15,4 +16,5 @@ export default function MapSlotEditor({ name, description, entries, emptyValue,
15
16
  }, key) }, key))), _jsx(MapAddCard, { onAdd: key => {
16
17
  setMap({ ...obj, [key]: emptyValue });
17
18
  } }), _jsx(FormHelperText, { children: description })] }));
18
- }
19
+ });
20
+ export default MapSlotEditor;
@@ -2,8 +2,8 @@
2
2
  * #config FromConfigAdapter
3
3
  * #trackType FeatureTrack
4
4
  * #fileFormat inline | Inline features | Features written straight into config.json
5
- * supplies features inline in the config instead of reading a file, useful for
6
- * small feature sets added via a URL or session spec
5
+ * Supplies features written inline in the config, for a small feature set
6
+ * added through a URL or session spec.
7
7
  *
8
8
  * #example
9
9
  * ```js
@@ -3,8 +3,8 @@ import { ConfigurationSchema } from '@jbrowse/core/configuration';
3
3
  * #config FromConfigAdapter
4
4
  * #trackType FeatureTrack
5
5
  * #fileFormat inline | Inline features | Features written straight into config.json
6
- * supplies features inline in the config instead of reading a file, useful for
7
- * small feature sets added via a URL or session spec
6
+ * Supplies features written inline in the config, for a small feature set
7
+ * added through a URL or session spec.
8
8
  *
9
9
  * #example
10
10
  * ```js
@@ -37,5 +37,11 @@ const configSchema = ConfigurationSchema('FromConfigAdapter', {
37
37
  type: 'frozen',
38
38
  defaultValue: [],
39
39
  },
40
- }, { explicitlyTyped: true });
40
+ },
41
+ // v1 named the feature class the adapter built
42
+ {
43
+ explicitlyTyped: true,
44
+ closed: true,
45
+ retired: { featureClass: () => ({}) },
46
+ });
41
47
  export default configSchema;
@@ -2,7 +2,8 @@
2
2
  * #config FromConfigRegionsAdapter
3
3
  * #trackType ReferenceSequenceTrack
4
4
  * #fileFormat inline | Inline regions | refNames and sizes only, no sequence
5
- * used for specifying refNames+sizes of an assembly
5
+ * Supplies an assembly's reference names and sizes inline in the config, with
6
+ * no sequence.
6
7
  *
7
8
  * #example
8
9
  * Supplies refNames+sizes with no sequence, as the adapter of an assembly's
@@ -3,7 +3,8 @@ import { ConfigurationSchema } from '@jbrowse/core/configuration';
3
3
  * #config FromConfigRegionsAdapter
4
4
  * #trackType ReferenceSequenceTrack
5
5
  * #fileFormat inline | Inline regions | refNames and sizes only, no sequence
6
- * used for specifying refNames+sizes of an assembly
6
+ * Supplies an assembly's reference names and sizes inline in the config, with
7
+ * no sequence.
7
8
  *
8
9
  * #example
9
10
  * Supplies refNames+sizes with no sequence, as the adapter of an assembly's
@@ -45,5 +46,7 @@ const regionsConfigSchema = ConfigurationSchema('FromConfigRegionsAdapter', {
45
46
  },
46
47
  }, {
47
48
  explicitlyTyped: true,
49
+ closed: true,
50
+ retired: { featureClass: () => ({}) },
48
51
  });
49
52
  export default regionsConfigSchema;
@@ -2,8 +2,8 @@
2
2
  * #config FromConfigSequenceAdapter
3
3
  * #trackType ReferenceSequenceTrack
4
4
  * #fileFormat inline | Inline sequence | Each feature's `seq` holds the bases for its region
5
- * supplies reference sequence inline in the config; each feature's `seq` holds
6
- * the bases for its region
5
+ * Supplies a reference sequence inline in the config, as features whose `seq`
6
+ * holds the bases for each region.
7
7
  *
8
8
  * #example
9
9
  * Used as the adapter of an assembly's `sequence` (a `ReferenceSequenceTrack`):
@@ -3,8 +3,8 @@ import { ConfigurationSchema } from '@jbrowse/core/configuration';
3
3
  * #config FromConfigSequenceAdapter
4
4
  * #trackType ReferenceSequenceTrack
5
5
  * #fileFormat inline | Inline sequence | Each feature's `seq` holds the bases for its region
6
- * supplies reference sequence inline in the config; each feature's `seq` holds
7
- * the bases for its region
6
+ * Supplies a reference sequence inline in the config, as features whose `seq`
7
+ * holds the bases for each region.
8
8
  *
9
9
  * #example
10
10
  * Used as the adapter of an assembly's `sequence` (a `ReferenceSequenceTrack`):
@@ -44,5 +44,7 @@ const sequenceConfigSchema = ConfigurationSchema('FromConfigSequenceAdapter', {
44
44
  },
45
45
  }, {
46
46
  explicitlyTyped: true,
47
+ closed: true,
48
+ retired: { featureClass: () => ({}) },
47
49
  });
48
50
  export default sequenceConfigSchema;
@@ -2,7 +2,8 @@ import type { Instance } from '@jbrowse/mobx-state-tree';
2
2
  export declare function normalizeSnapshot(snap: Record<string, unknown>): Record<string, unknown>;
3
3
  /**
4
4
  * #config NcbiSequenceReportAliasAdapter
5
- * can read "sequence_report.tsv" type files from NCBI
5
+ * Reads refName aliases for an assembly from an NCBI `sequence_report.tsv`
6
+ * file.
6
7
  *
7
8
  * #example
8
9
  * Goes on an ASSEMBLY, under `refNameAliases` — not on a track. The file ships
@@ -4,7 +4,8 @@ export function normalizeSnapshot(snap) {
4
4
  }
5
5
  /**
6
6
  * #config NcbiSequenceReportAliasAdapter
7
- * can read "sequence_report.tsv" type files from NCBI
7
+ * Reads refName aliases for an assembly from an NCBI `sequence_report.tsv`
8
+ * file.
8
9
  *
9
10
  * #example
10
11
  * Goes on an ASSEMBLY, under `refNameAliases` — not on a track. The file ships
@@ -77,6 +78,11 @@ const NcbiSequenceReportAliasAdapterConfigSchema = ConfigurationSchema('NcbiSequ
77
78
  },
78
79
  }, {
79
80
  explicitlyTyped: true,
81
+ closed: true,
82
+ retired: {
83
+ // eslint-disable-next-line @eslint-react/no-unnecessary-use-prefix -- the retired slot's own name
84
+ useUcscNameOverride: useNameOverride => ({ useNameOverride }),
85
+ },
80
86
  /**
81
87
  * #preProcessSnapshot
82
88
  *
@@ -2,8 +2,8 @@ import type { Instance } from '@jbrowse/mobx-state-tree';
2
2
  export declare function normalizeSnapshot(snap: Record<string, unknown>): Record<string, unknown>;
3
3
  /**
4
4
  * #config RefNameAliasAdapter
5
- * can read "chromAliases" type files from UCSC or any tab separated file of
6
- * refName aliases
5
+ * Reads refName aliases for an assembly from a UCSC `chromAlias` file or any
6
+ * other tab-separated table of aliases.
7
7
  *
8
8
  * #example
9
9
  * Goes on an ASSEMBLY, under `refNameAliases` — not on a track. Writing
@@ -4,8 +4,8 @@ export function normalizeSnapshot(snap) {
4
4
  }
5
5
  /**
6
6
  * #config RefNameAliasAdapter
7
- * can read "chromAliases" type files from UCSC or any tab separated file of
8
- * refName aliases
7
+ * Reads refName aliases for an assembly from a UCSC `chromAlias` file or any
8
+ * other tab-separated table of aliases.
9
9
  *
10
10
  * #example
11
11
  * Goes on an ASSEMBLY, under `refNameAliases` — not on a track. Writing
@@ -88,6 +88,7 @@ const RefNameAliasAdapter = ConfigurationSchema('RefNameAliasAdapter', {
88
88
  },
89
89
  }, {
90
90
  explicitlyTyped: true,
91
+ closed: true,
91
92
  /**
92
93
  * #preProcessSnapshot
93
94
  *
@@ -0,0 +1,9 @@
1
+ import type PluginManager from '@jbrowse/core/PluginManager';
2
+ /**
3
+ * #api
4
+ * Registers `FromConfigAdapter`, whose features a track config writes inline,
5
+ * and the alias adapters an assembly's `refNameAliases` reads through, on a
6
+ * plugin manager that wants them without the configuration editor, as a
7
+ * headless host does.
8
+ */
9
+ export declare function registerConfigAdapters(pluginManager: PluginManager): void;
@@ -0,0 +1,15 @@
1
+ import FromConfigAdapterF from './FromConfigAdapter/index.js';
2
+ import NcbiSequenceReportAliasAdapterF from './NcbiSequenceReportAliasAdapter/index.js';
3
+ import RefNameAliasAdapterF from './RefNameAliasAdapter/index.js';
4
+ /**
5
+ * #api
6
+ * Registers `FromConfigAdapter`, whose features a track config writes inline,
7
+ * and the alias adapters an assembly's `refNameAliases` reads through, on a
8
+ * plugin manager that wants them without the configuration editor, as a
9
+ * headless host does.
10
+ */
11
+ export function registerConfigAdapters(pluginManager) {
12
+ FromConfigAdapterF(pluginManager);
13
+ RefNameAliasAdapterF(pluginManager);
14
+ NcbiSequenceReportAliasAdapterF(pluginManager);
15
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-config",
3
- "version": "5.0.0-beta.13",
3
+ "version": "5.0.0-beta.14",
4
4
  "type": "module",
5
5
  "description": "JBrowse 2 config utilities",
6
6
  "keywords": [
@@ -17,17 +17,21 @@
17
17
  },
18
18
  "author": "JBrowse Team",
19
19
  "main": "esm/index.js",
20
+ "exports": {
21
+ ".": "./esm/index.js",
22
+ "./adapters": "./esm/adapters.js"
23
+ },
20
24
  "files": [
21
25
  "esm"
22
26
  ],
23
27
  "dependencies": {
24
- "@jbrowse/mobx-state-tree": "^6.7.0",
25
- "@mui/icons-material": "^9.4.0",
26
- "@mui/material": "^9.4.0",
28
+ "@jbrowse/mobx-state-tree": "^6.9.0",
29
+ "@mui/icons-material": "^9.5.0",
30
+ "@mui/material": "^9.5.0",
27
31
  "mobx": "^7.0.6",
28
32
  "mobx-react": "^10.0.2",
29
33
  "rxjs": "^7.8.2",
30
- "@jbrowse/core": "^5.0.0-beta.13"
34
+ "@jbrowse/core": "^5.0.0-beta.14"
31
35
  },
32
36
  "peerDependencies": {
33
37
  "react": ">=19.0.0",
@@ -44,8 +48,5 @@
44
48
  "build:esm": "node ../../node_modules/typescript7/bin/tsc --build tsconfig.build.esm.json",
45
49
  "clean": "rimraf esm *.tsbuildinfo"
46
50
  },
47
- "types": "esm/index.d.ts",
48
- "exports": {
49
- ".": "./esm/index.js"
50
- }
51
+ "types": "esm/index.d.ts"
51
52
  }