@jbrowse/plugin-config 5.0.0-beta.10 → 5.0.0-beta.11
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.
|
@@ -9,6 +9,7 @@ export default function registerConfigurationEditorWidget(pluginManager) {
|
|
|
9
9
|
pluginManager.addWidgetType(() => {
|
|
10
10
|
return new WidgetType({
|
|
11
11
|
name: 'ConfigurationEditorWidget',
|
|
12
|
+
discardOnClose: true,
|
|
12
13
|
HeadingComponent,
|
|
13
14
|
configSchema,
|
|
14
15
|
stateModel: stateModelFactory(pluginManager),
|
|
@@ -15,4 +15,5 @@ export default function stateModelFactory(_pluginManager: PluginManager): import
|
|
|
15
15
|
setTarget(newTarget: AnyConfigurationModel | undefined): void;
|
|
16
16
|
setExpandedDisplayId(displayId: string | undefined): void;
|
|
17
17
|
afterCreate(): void;
|
|
18
|
+
beforeDetach(): void;
|
|
18
19
|
}, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>;
|
|
@@ -23,49 +23,54 @@ export default function stateModelFactory(_pluginManager) {
|
|
|
23
23
|
// (incompatible/inactive) displays start collapsed
|
|
24
24
|
expandedDisplayId: undefined,
|
|
25
25
|
}))
|
|
26
|
-
.actions(self =>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
26
|
+
.actions(self => {
|
|
27
|
+
let timeout;
|
|
28
|
+
let unsaved;
|
|
29
|
+
function save() {
|
|
30
|
+
clearTimeout(timeout);
|
|
31
|
+
if (unsaved) {
|
|
32
|
+
const session = getSession(self);
|
|
33
|
+
session.updateTrackConfiguration(unsaved);
|
|
34
|
+
unsaved = undefined;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
setTarget(newTarget) {
|
|
39
|
+
self.target = newTarget;
|
|
40
|
+
},
|
|
41
|
+
setExpandedDisplayId(displayId) {
|
|
42
|
+
self.expandedDisplayId = displayId;
|
|
43
|
+
},
|
|
44
|
+
afterCreate() {
|
|
45
|
+
// Auto-save configuration changes with 400ms debounce, through
|
|
46
|
+
// updateTrackConfiguration, which routes admin edits to the jbrowse
|
|
47
|
+
// config in place and everyone else's to a shareable per-track delta
|
|
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.
|
|
51
|
+
//
|
|
52
|
+
// BaseTrackModel's afterAttach runs a sibling debounced save for
|
|
53
|
+
// direct setSlot quick-edits on a *shown* track. Both intentionally
|
|
54
|
+
// coexist: this widget also handles an unshown track edited from the
|
|
55
|
+
// selector, which has no BaseTrackModel. When both fire they compute
|
|
56
|
+
// an identical delta, deduped in updateTrackConfiguration — don't
|
|
57
|
+
// drop one to "simplify".
|
|
58
|
+
addDisposer(self, autorun(() => {
|
|
59
|
+
if (self.target) {
|
|
60
|
+
unsaved = getSnapshot(self.target);
|
|
61
|
+
clearTimeout(timeout);
|
|
62
|
+
timeout = setTimeout(save, 400);
|
|
63
|
+
}
|
|
64
|
+
}));
|
|
65
|
+
addDisposer(self, () => {
|
|
57
66
|
clearTimeout(timeout);
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
clearTimeout(timeout);
|
|
68
|
-
});
|
|
69
|
-
},
|
|
70
|
-
}));
|
|
67
|
+
});
|
|
68
|
+
},
|
|
69
|
+
// closing the editor detaches it from the session, so an edit still
|
|
70
|
+
// inside the debounce saves now, while getSession(self) resolves
|
|
71
|
+
beforeDetach() {
|
|
72
|
+
save();
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
});
|
|
71
76
|
}
|
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.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "JBrowse 2 config utilities",
|
|
6
6
|
"keywords": [
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
"esm"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@jbrowse/mobx-state-tree": "^6.
|
|
24
|
+
"@jbrowse/mobx-state-tree": "^6.7.0",
|
|
25
25
|
"@mui/icons-material": "^9.4.0",
|
|
26
26
|
"@mui/material": "^9.4.0",
|
|
27
27
|
"mobx": "^7.0.5",
|
|
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.11"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"react": ">=19.0.0",
|