@jbrowse/plugin-config 5.0.0-beta.4 → 5.0.0-beta.7
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/esm/ConfigurationEditorWidget/components/BooleanEditor.d.ts +0 -1
- package/esm/ConfigurationEditorWidget/components/BooleanEditor.js +1 -14
- package/esm/ConfigurationEditorWidget/components/JsonEditor.d.ts +0 -1
- package/esm/ConfigurationEditorWidget/components/JsonEditor.js +5 -10
- package/esm/ConfigurationEditorWidget/components/NumberEditor.d.ts +0 -1
- package/esm/ConfigurationEditorWidget/components/NumberEditor.js +1 -10
- package/esm/ConfigurationEditorWidget/components/SlotEditor.js +1 -11
- package/esm/normalizeUriSnapshot.js +3 -3
- package/package.json +2 -2
|
@@ -4,20 +4,7 @@ import { FormControl, FormHelperText } from '@mui/material';
|
|
|
4
4
|
import { observer } from 'mobx-react';
|
|
5
5
|
/** #slotEditor checkbox */
|
|
6
6
|
const BooleanEditor = observer(function BooleanEditor({ slot, }) {
|
|
7
|
-
return (_jsxs(FormControl, { children: [_jsx(LabeledCheckbox, { label: slot.name,
|
|
8
|
-
// An unset promotable slot renders its `promotedBase`, not `false`.
|
|
9
|
-
// Coercing every unset slot to unchecked mis-stated the three whose
|
|
10
|
-
// base is `true` (displayDirectionalChevrons, showSashimiArcs,
|
|
11
|
-
// readConnectionsDown): the box read unchecked on a track that was
|
|
12
|
-
// drawing chevrons, and ticking it wrote the value the track already
|
|
13
|
-
// had — no visible change, but the slot silently left the cascade and
|
|
14
|
-
// stopped following later session-wide defaults. The reset button
|
|
15
|
-
// (SlotEditor's `modified`) is what still separates inherited from
|
|
16
|
-
// customized; this only fixes which state is *shown*. The session tier
|
|
17
|
-
// is out of reach here, so a value promoted this session isn't
|
|
18
|
-
// reflected — see agent-docs/ideas/promotable-slot-ui.md, which is
|
|
19
|
-
// where that raw-vs-resolved gap is worked out.
|
|
20
|
-
checked: slot.value ?? !!slot.promotedBase, onChange: val => {
|
|
7
|
+
return (_jsxs(FormControl, { children: [_jsx(LabeledCheckbox, { label: slot.name, checked: !!slot.value, onChange: val => {
|
|
21
8
|
slot.set(val);
|
|
22
9
|
} }), _jsx(FormHelperText, { children: slot.description })] }));
|
|
23
10
|
});
|
|
@@ -15,16 +15,11 @@ const useStyles = makeStyles()(theme => ({
|
|
|
15
15
|
/** #slotEditor monospace textarea holding arbitrary JSON */
|
|
16
16
|
const JsonEditor = observer(function JsonEditor({ slot, }) {
|
|
17
17
|
const { classes } = useStyles();
|
|
18
|
-
// A `maybeFrozen` slot is `undefined` when unset
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
|
|
23
|
-
// Show what unset resolves to instead, as BooleanEditor does.
|
|
24
|
-
const [contents, setContents] = useState(() => {
|
|
25
|
-
const shown = slot.value ?? slot.promotedBase;
|
|
26
|
-
return shown === undefined ? '' : JSON.stringify(shown, null, 2);
|
|
27
|
-
});
|
|
18
|
+
// A `maybeFrozen` slot is `undefined` when unset, and `JSON.stringify(undefined)`
|
|
19
|
+
// returns the *value* `undefined` rather than a string — which handed
|
|
20
|
+
// MonospaceTextField an undefined `value` and made the field uncontrolled
|
|
21
|
+
// until the first keystroke (React then warns on the switch).
|
|
22
|
+
const [contents, setContents] = useState(() => slot.value === undefined ? '' : JSON.stringify(slot.value, null, 2));
|
|
28
23
|
const [error, setError] = useState();
|
|
29
24
|
return (_jsx(MonospaceTextField, { className: classes.jsonEditor, label: slot.name, value: contents, error: error, helperText: slot.description, onChange: val => {
|
|
30
25
|
setContents(val);
|
|
@@ -5,16 +5,7 @@ import ConfigurationTextField from './ConfigurationTextField.js';
|
|
|
5
5
|
/** #slotEditor numeric text field */
|
|
6
6
|
const NumberEditor = observer(function NumberEditor({ slot, integer = false, }) {
|
|
7
7
|
const [val, setVal] = useState(slot.value === undefined ? '' : String(slot.value));
|
|
8
|
-
|
|
9
|
-
// empty box is the honest rendering of it — a number field, unlike a
|
|
10
|
-
// checkbox, has a state for "nothing". What it did not say is what the track
|
|
11
|
-
// is therefore drawing at, so `featureHeight` read as a blank with no clue
|
|
12
|
-
// that reads are 7px tall. The placeholder is that, in the affordance meant
|
|
13
|
-
// for it; the label has to float for MUI to draw one over a labelled field.
|
|
14
|
-
const placeholder = slot.value === undefined && slot.promotedBase !== undefined
|
|
15
|
-
? String(slot.promotedBase)
|
|
16
|
-
: undefined;
|
|
17
|
-
return (_jsx(ConfigurationTextField, { label: slot.name, helperText: slot.description, placeholder: placeholder, slotProps: placeholder ? { inputLabel: { shrink: true } } : undefined, value: val, onChange: evt => {
|
|
8
|
+
return (_jsx(ConfigurationTextField, { label: slot.name, helperText: slot.description, value: val, onChange: evt => {
|
|
18
9
|
const v = evt.target.value;
|
|
19
10
|
setVal(v);
|
|
20
11
|
const num = Number(v);
|
|
@@ -36,18 +36,10 @@ const UNSET_CHOICE = '';
|
|
|
36
36
|
/** #slotEditor dropdown of the `model`'s members */
|
|
37
37
|
const StringEnumEditor = observer(function StringEnumEditor({ slot, }) {
|
|
38
38
|
const nullable = slot.type === 'maybeStringEnum';
|
|
39
|
-
// Naming the member unset resolves to, rather than a bare "default": every
|
|
40
|
-
// other choice in the list is a value the user can read off the plot, and
|
|
41
|
-
// this one was the only one that said nothing about what picking it draws.
|
|
42
|
-
// `promotedBase` is the honest half to show — the editor's target is often a
|
|
43
|
-
// detached config node, so it cannot see a value promoted this session.
|
|
44
|
-
const unsetLabel = typeof slot.promotedBase === 'string'
|
|
45
|
-
? `default (${slot.promotedBase})`
|
|
46
|
-
: 'default';
|
|
47
39
|
return (_jsxs(ConfigurationTextField, { value: slot.value ?? UNSET_CHOICE, label: slot.name, select: true, helperText: slot.description, onChange: evt => {
|
|
48
40
|
const { value } = evt.target;
|
|
49
41
|
slot.set(value === UNSET_CHOICE ? undefined : value);
|
|
50
|
-
}, children: [nullable ? (_jsx(MenuItem, { value: UNSET_CHOICE, children: _jsx("em", { children:
|
|
42
|
+
}, children: [nullable ? (_jsx(MenuItem, { value: UNSET_CHOICE, children: _jsx("em", { children: "default" }) })) : null, (slot.choices ?? []).map(str => (_jsx(MenuItem, { value: str, children: str }, str)))] }));
|
|
51
43
|
});
|
|
52
44
|
/** #slotEditor URL, local file path (desktop) or file blob (browser) */
|
|
53
45
|
const FileSelectorWrapper = observer(function FileSelectorWrapper({ slot, }) {
|
|
@@ -98,8 +90,6 @@ const SlotEditor = observer(function SlotEditor({ slot, }) {
|
|
|
98
90
|
const ValueComponent = callbackMode
|
|
99
91
|
? CallbackEditor
|
|
100
92
|
: (TypedComponent ?? StringEditor);
|
|
101
|
-
// a promotable slot's default is its inherit sentinel, so resetting it here
|
|
102
|
-
// doubles as "un-pin / follow the session-wide default"
|
|
103
93
|
const { modified } = slot;
|
|
104
94
|
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: () => {
|
|
105
95
|
slot.set(slot.defaultValue);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { fillLocations } from '@jbrowse/core/configuration';
|
|
1
2
|
// allows a minimal config of `{ uri: "..." }` by lifting `uri`/`baseUri` into
|
|
2
3
|
// a proper `location` fileLocation slot. Shared by the alias adapters.
|
|
3
4
|
export function normalizeUriSnapshot(snap) {
|
|
4
5
|
return snap.uri
|
|
5
|
-
? {
|
|
6
|
-
...snap,
|
|
6
|
+
? fillLocations(snap, {
|
|
7
7
|
location: {
|
|
8
8
|
uri: snap.uri,
|
|
9
9
|
baseUri: snap.baseUri,
|
|
10
10
|
},
|
|
11
|
-
}
|
|
11
|
+
})
|
|
12
12
|
: snap;
|
|
13
13
|
}
|
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.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "JBrowse 2 config utilities",
|
|
6
6
|
"keywords": [
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"mobx": "^7.0.3",
|
|
28
28
|
"mobx-react": "^10.0.2",
|
|
29
29
|
"rxjs": "^7.8.2",
|
|
30
|
-
"@jbrowse/core": "^5.0.0-beta.
|
|
30
|
+
"@jbrowse/core": "^5.0.0-beta.7"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"react": ">=19.0.0",
|