@jbrowse/plugin-config 5.0.0-beta.11 → 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 +25 -0
- package/esm/ConfigurationEditorWidget/components/AddNewField.d.ts +3 -2
- package/esm/ConfigurationEditorWidget/components/AddNewField.js +4 -2
- package/esm/ConfigurationEditorWidget/components/ColorEditor.js +1 -1
- package/esm/ConfigurationEditorWidget/components/ConfigurationEditor.js +4 -4
- package/esm/ConfigurationEditorWidget/components/ConfigurationTextField.d.ts +3 -2
- package/esm/ConfigurationEditorWidget/components/ConfigurationTextField.js +4 -2
- package/esm/ConfigurationEditorWidget/components/MapEntryCard.d.ts +5 -4
- package/esm/ConfigurationEditorWidget/components/MapEntryCard.js +6 -4
- package/esm/ConfigurationEditorWidget/components/MapSlotEditor.d.ts +3 -2
- package/esm/ConfigurationEditorWidget/components/MapSlotEditor.js +4 -2
- package/esm/ConfigurationEditorWidget/components/SlotEditor.js +4 -10
- package/esm/ConfigurationEditorWidget/model.d.ts +23 -1
- package/esm/ConfigurationEditorWidget/model.js +45 -17
- package/esm/FromConfigAdapter/configSchema.d.ts +2 -2
- package/esm/FromConfigAdapter/configSchema.js +9 -3
- package/esm/FromConfigRegionsAdapter/configSchema.d.ts +2 -1
- package/esm/FromConfigRegionsAdapter/configSchema.js +4 -1
- package/esm/FromConfigSequenceAdapter/configSchema.d.ts +2 -2
- package/esm/FromConfigSequenceAdapter/configSchema.js +4 -2
- package/esm/NcbiSequenceReportAliasAdapter/configSchema.d.ts +2 -1
- package/esm/NcbiSequenceReportAliasAdapter/configSchema.js +7 -1
- package/esm/RefNameAliasAdapter/configSchema.d.ts +2 -2
- package/esm/RefNameAliasAdapter/configSchema.js +3 -2
- package/esm/adapters.d.ts +9 -0
- package/esm/adapters.js +15 -0
- package/package.json +11 -10
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
|
-
|
|
2
|
+
declare const AddNewField: ({ onAdd, testid, startAdornment, }: {
|
|
3
3
|
onAdd: (value: string) => void;
|
|
4
4
|
testid?: string;
|
|
5
5
|
startAdornment?: ReactNode;
|
|
6
|
-
})
|
|
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
|
-
|
|
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
|
|
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, }) {
|
|
@@ -71,8 +71,8 @@ function schemaMatches(schema, query) {
|
|
|
71
71
|
const { properties } = getMembers(schema);
|
|
72
72
|
return Object.entries(properties).some(([slotName, slotSchema]) => memberMatches(schema, slotName, slotSchema, query));
|
|
73
73
|
}
|
|
74
|
-
//
|
|
75
|
-
function
|
|
74
|
+
// narrower than the About dialog's Advanced card, which also takes callbacks
|
|
75
|
+
function hidesBehindAdvancedToggle(schema, slotName) {
|
|
76
76
|
return (isConfigurationSlot(schema, slotName) &&
|
|
77
77
|
!!getSlotDefinition(schema, slotName).advanced);
|
|
78
78
|
}
|
|
@@ -176,8 +176,8 @@ const Schema = observer(function Schema({ schema, path = [], filter = '', expand
|
|
|
176
176
|
const query = filter.toLowerCase();
|
|
177
177
|
const properties = getMembers(schema).properties;
|
|
178
178
|
const visible = Object.entries(properties).filter(([slotName, slotSchema]) => !query || memberMatches(schema, slotName, slotSchema, query));
|
|
179
|
-
const normal = visible.filter(([slotName]) => !
|
|
180
|
-
const advanced = visible.filter(([slotName]) =>
|
|
179
|
+
const normal = visible.filter(([slotName]) => !hidesBehindAdvancedToggle(schema, slotName));
|
|
180
|
+
const advanced = visible.filter(([slotName]) => hidesBehindAdvancedToggle(schema, slotName));
|
|
181
181
|
const renderMember = ([slotName, slotSchema]) => (_jsx(Member, { slotName: slotName, slotSchema: slotSchema, path: path, schema: schema, filter: filter, expandedDisplayId: expandedDisplayId }, slotName));
|
|
182
182
|
return (_jsxs(_Fragment, { children: [normal.map(renderMember), advanced.length && !query ? (_jsxs(Button, { className: classes.advancedToggle, size: "small", startIcon: showAdvanced ? _jsx(ExpandLessIcon, {}) : _jsx(ExpandMoreIcon, {}), onClick: () => {
|
|
183
183
|
setShowAdvanced(!showAdvanced);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { TextFieldProps } from '@mui/material';
|
|
2
|
-
|
|
2
|
+
declare const ConfigurationTextField: (props: {
|
|
3
3
|
helperText?: string;
|
|
4
|
-
} & TextFieldProps)
|
|
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
|
-
|
|
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
|
-
|
|
1
|
+
declare const MapEntryCard: ({ title, onDelete, children, }: {
|
|
2
2
|
title: string;
|
|
3
3
|
onDelete: () => void;
|
|
4
4
|
children: React.ReactNode;
|
|
5
|
-
})
|
|
6
|
-
export
|
|
5
|
+
}) => import("react").JSX.Element;
|
|
6
|
+
export default MapEntryCard;
|
|
7
|
+
export declare const MapAddCard: ({ onAdd, }: {
|
|
7
8
|
onAdd: (key: string) => void;
|
|
8
|
-
})
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
})
|
|
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
|
-
|
|
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;
|
|
@@ -52,11 +52,9 @@ const FileSelectorWrapper = observer(function FileSelectorWrapper({ slot, }) {
|
|
|
52
52
|
slot.set(location);
|
|
53
53
|
}, name: slot.name, description: slot.description, rootModel: slot.pluginManager.rootModel }));
|
|
54
54
|
});
|
|
55
|
-
//
|
|
56
|
-
//
|
|
57
|
-
//
|
|
58
|
-
// type value as `unknown`, so no single registry prop type satisfies them all.
|
|
59
|
-
// The editors stay fully typed internally; only this lookup is untyped.
|
|
55
|
+
// The `any` is irreducible: each editor declares a narrow `slot.value` type, but
|
|
56
|
+
// makeSlotFacade can only type value as `unknown`. The keys are checked: a slot
|
|
57
|
+
// type with no editor is a compile error.
|
|
60
58
|
const valueComponents = {
|
|
61
59
|
string: StringEditor,
|
|
62
60
|
maybeString: StringEditor,
|
|
@@ -97,13 +95,9 @@ const SlotEditor = observer(function SlotEditor({ slot, }) {
|
|
|
97
95
|
// json, callback) seed internal state from slot.value only on mount, so an
|
|
98
96
|
// external set wouldn't otherwise show in the field
|
|
99
97
|
const [resetNonce, setResetNonce] = useState(0);
|
|
100
|
-
const TypedComponent = valueComponents[type];
|
|
101
|
-
if (!callbackMode && !TypedComponent) {
|
|
102
|
-
console.warn(`no slot editor defined for ${type}, editing as string`);
|
|
103
|
-
}
|
|
104
98
|
const ValueComponent = callbackMode
|
|
105
99
|
? CallbackEditor
|
|
106
|
-
:
|
|
100
|
+
: valueComponents[type];
|
|
107
101
|
const { modified } = slot;
|
|
108
102
|
return (_jsxs(Paper, { className: classes.paper, children: [_jsx("div", { className: classes.paperContent, children: _jsx(ValueComponent, { slot: slot }, resetNonce) }), modified ? (_jsx("div", { className: classes.resetButton, children: _jsx(Tooltip, { title: "Reset to default", children: _jsx(IconButton, { "aria-label": "reset to default", onClick: () => {
|
|
109
103
|
slot.set(slot.defaultValue);
|
|
@@ -8,10 +8,32 @@ import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
|
8
8
|
export default function stateModelFactory(_pluginManager: PluginManager): import("@jbrowse/mobx-state-tree").IModelType<{
|
|
9
9
|
id: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
10
10
|
type: import("@jbrowse/mobx-state-tree").ILiteralType<"ConfigurationEditorWidget">;
|
|
11
|
+
/**
|
|
12
|
+
* #property
|
|
13
|
+
* the track whose working copy this edits, re-resolved on every read so
|
|
14
|
+
* an undo that replaces the copy moves the editor with it
|
|
15
|
+
*/
|
|
16
|
+
trackId: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<string>>;
|
|
11
17
|
}, {
|
|
12
|
-
|
|
18
|
+
inlineTarget: AnyConfigurationModel | undefined;
|
|
13
19
|
expandedDisplayId: string | undefined;
|
|
14
20
|
} & {
|
|
21
|
+
/**
|
|
22
|
+
* #getter
|
|
23
|
+
*/
|
|
24
|
+
readonly target: AnyConfigurationModel | undefined;
|
|
25
|
+
} & {
|
|
26
|
+
/**
|
|
27
|
+
* #action
|
|
28
|
+
* edit the working copy of `trackId`, saving any edit still pending
|
|
29
|
+
* on the previous target first
|
|
30
|
+
*/
|
|
31
|
+
setTrackId(trackId: string): void;
|
|
32
|
+
/**
|
|
33
|
+
* #action
|
|
34
|
+
* edit a config node directly, saving any edit still pending on the
|
|
35
|
+
* previous target first
|
|
36
|
+
*/
|
|
15
37
|
setTarget(newTarget: AnyConfigurationModel | undefined): void;
|
|
16
38
|
setExpandedDisplayId(displayId: string | undefined): void;
|
|
17
39
|
afterCreate(): void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getSession } from '@jbrowse/core/util';
|
|
2
|
+
import { getEditableTrackConfigById } from '@jbrowse/core/util/types';
|
|
2
3
|
import { ElementId } from '@jbrowse/core/util/types/mst';
|
|
3
4
|
import { addDisposer, getSnapshot, types } from '@jbrowse/mobx-state-tree';
|
|
4
5
|
import { autorun } from 'mobx';
|
|
@@ -12,16 +13,31 @@ export default function stateModelFactory(_pluginManager) {
|
|
|
12
13
|
.model('ConfigurationEditorWidget', {
|
|
13
14
|
id: ElementId,
|
|
14
15
|
type: types.literal('ConfigurationEditorWidget'),
|
|
16
|
+
/**
|
|
17
|
+
* #property
|
|
18
|
+
* the track whose working copy this edits, re-resolved on every read so
|
|
19
|
+
* an undo that replaces the copy moves the editor with it
|
|
20
|
+
*/
|
|
21
|
+
trackId: types.maybe(types.string),
|
|
15
22
|
})
|
|
16
23
|
.volatile(() => ({
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
|
|
20
|
-
target: undefined,
|
|
24
|
+
// a config the session cannot resolve by trackId: an assembly, a
|
|
25
|
+
// connection, or a track a view holds inline
|
|
26
|
+
inlineTarget: undefined,
|
|
21
27
|
// displayId of the display active in the view this editor was opened
|
|
22
28
|
// from; its config accordion expands by default while the track's other
|
|
23
29
|
// (incompatible/inactive) displays start collapsed
|
|
24
30
|
expandedDisplayId: undefined,
|
|
31
|
+
}))
|
|
32
|
+
.views(self => ({
|
|
33
|
+
/**
|
|
34
|
+
* #getter
|
|
35
|
+
*/
|
|
36
|
+
get target() {
|
|
37
|
+
return self.trackId === undefined
|
|
38
|
+
? self.inlineTarget
|
|
39
|
+
: getEditableTrackConfigById(getSession(self), self.trackId);
|
|
40
|
+
},
|
|
25
41
|
}))
|
|
26
42
|
.actions(self => {
|
|
27
43
|
let timeout;
|
|
@@ -35,26 +51,38 @@ export default function stateModelFactory(_pluginManager) {
|
|
|
35
51
|
}
|
|
36
52
|
}
|
|
37
53
|
return {
|
|
54
|
+
/**
|
|
55
|
+
* #action
|
|
56
|
+
* edit the working copy of `trackId`, saving any edit still pending
|
|
57
|
+
* on the previous target first
|
|
58
|
+
*/
|
|
59
|
+
setTrackId(trackId) {
|
|
60
|
+
save();
|
|
61
|
+
self.inlineTarget = undefined;
|
|
62
|
+
self.trackId = trackId;
|
|
63
|
+
},
|
|
64
|
+
/**
|
|
65
|
+
* #action
|
|
66
|
+
* edit a config node directly, saving any edit still pending on the
|
|
67
|
+
* previous target first
|
|
68
|
+
*/
|
|
38
69
|
setTarget(newTarget) {
|
|
39
|
-
|
|
70
|
+
save();
|
|
71
|
+
self.trackId = undefined;
|
|
72
|
+
self.inlineTarget = newTarget;
|
|
40
73
|
},
|
|
41
74
|
setExpandedDisplayId(displayId) {
|
|
42
75
|
self.expandedDisplayId = displayId;
|
|
43
76
|
},
|
|
44
77
|
afterCreate() {
|
|
45
|
-
//
|
|
46
|
-
//
|
|
47
|
-
//
|
|
48
|
-
// (trackConfigDeltas) against the admin base. A config with no
|
|
49
|
-
// trackId (assembly/connection) finds no home there, so the edit
|
|
50
|
-
// stays on the live MST node for this session.
|
|
78
|
+
// Saves through updateTrackConfiguration as a per-track delta. A
|
|
79
|
+
// config with no trackId (assembly/connection) finds no home there,
|
|
80
|
+
// so the edit stays on the live MST node for this session.
|
|
51
81
|
//
|
|
52
|
-
// BaseTrackModel
|
|
53
|
-
//
|
|
54
|
-
//
|
|
55
|
-
//
|
|
56
|
-
// an identical delta, deduped in updateTrackConfiguration — don't
|
|
57
|
-
// drop one to "simplify".
|
|
82
|
+
// BaseTrackModel runs a sibling saver on a shown track's working
|
|
83
|
+
// copy, which this widget edits too; this one covers a track that is
|
|
84
|
+
// not shown. When both fire they compute an identical delta, deduped
|
|
85
|
+
// in updateTrackConfiguration.
|
|
58
86
|
addDisposer(self, autorun(() => {
|
|
59
87
|
if (self.target) {
|
|
60
88
|
unsaved = getSnapshot(self.target);
|
|
@@ -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
|
-
*
|
|
6
|
-
*
|
|
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
|
-
*
|
|
7
|
-
*
|
|
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
|
-
},
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
6
|
-
* the bases for
|
|
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
|
-
*
|
|
7
|
-
* the bases for
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
6
|
-
*
|
|
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
|
-
*
|
|
8
|
-
*
|
|
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;
|
package/esm/adapters.js
ADDED
|
@@ -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.
|
|
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.
|
|
25
|
-
"@mui/icons-material": "^9.
|
|
26
|
-
"@mui/material": "^9.
|
|
27
|
-
"mobx": "^7.0.
|
|
28
|
+
"@jbrowse/mobx-state-tree": "^6.9.0",
|
|
29
|
+
"@mui/icons-material": "^9.5.0",
|
|
30
|
+
"@mui/material": "^9.5.0",
|
|
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.
|
|
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
|
}
|