@jbrowse/core 1.7.11 → 2.1.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.
- package/BaseFeatureWidget/BaseFeatureDetail.d.ts +20 -4
- package/BaseFeatureWidget/BaseFeatureDetail.js +313 -558
- package/BaseFeatureWidget/SequenceFeatureDetails.js +213 -473
- package/BaseFeatureWidget/index.d.ts +2 -2
- package/BaseFeatureWidget/index.js +88 -124
- package/BaseFeatureWidget/types.d.ts +1 -0
- package/BaseFeatureWidget/types.js +1 -4
- package/BaseFeatureWidget/util.js +40 -75
- package/CorePlugin.js +55 -94
- package/Plugin.js +9 -34
- package/PluginLoader.js +153 -422
- package/PluginManager.d.ts +84 -117
- package/PluginManager.js +377 -666
- package/ReExports/Attributes.d.ts +2 -0
- package/ReExports/Attributes.js +5 -0
- package/ReExports/BaseCard.d.ts +2 -0
- package/ReExports/BaseCard.js +5 -0
- package/ReExports/DataGrid.d.ts +2 -0
- package/ReExports/DataGrid.js +6 -0
- package/ReExports/FeatureDetails.d.ts +2 -0
- package/ReExports/FeatureDetails.js +5 -0
- package/ReExports/index.js +6 -12
- package/ReExports/list.d.ts +5 -0
- package/ReExports/list.js +271 -7
- package/ReExports/material-ui-colors.d.ts +1 -19
- package/ReExports/material-ui-colors.js +16 -158
- package/ReExports/modules.d.ts +68 -109
- package/ReExports/modules.js +455 -244
- package/TextSearch/BaseResults.js +51 -123
- package/TextSearch/TextSearchManager.d.ts +3 -1
- package/TextSearch/TextSearchManager.js +66 -144
- package/assemblyManager/assembly.js +280 -554
- package/assemblyManager/assemblyConfigSchema.js +47 -64
- package/assemblyManager/assemblyManager.d.ts +12 -10
- package/assemblyManager/assemblyManager.js +126 -270
- package/assemblyManager/index.js +9 -22
- package/configuration/configurationSchema.js +167 -203
- package/configuration/configurationSlot.js +248 -326
- package/configuration/index.js +19 -35
- package/configuration/util.d.ts +1 -1
- package/configuration/util.js +131 -173
- package/data_adapters/BaseAdapter.d.ts +2 -2
- package/data_adapters/BaseAdapter.js +132 -521
- package/data_adapters/CytobandAdapter.js +40 -126
- package/data_adapters/dataAdapterCache.js +77 -158
- package/package.json +16 -18
- package/pluggableElementTypes/AdapterType.js +24 -79
- package/pluggableElementTypes/AddTrackWorkflowType.d.ts +17 -0
- package/pluggableElementTypes/AddTrackWorkflowType.js +20 -0
- package/pluggableElementTypes/ConnectionType.js +22 -65
- package/pluggableElementTypes/DisplayType.js +35 -82
- package/pluggableElementTypes/InternetAccountType.js +23 -64
- package/pluggableElementTypes/PluggableElementBase.js +8 -20
- package/pluggableElementTypes/RpcMethodType.js +85 -427
- package/pluggableElementTypes/TextSearchAdapterType.js +16 -55
- package/pluggableElementTypes/TrackType.js +26 -70
- package/pluggableElementTypes/ViewType.js +21 -63
- package/pluggableElementTypes/WidgetType.js +21 -64
- package/pluggableElementTypes/index.d.ts +4 -3
- package/pluggableElementTypes/index.js +42 -125
- package/pluggableElementTypes/models/BaseConnectionModelFactory.js +28 -43
- package/pluggableElementTypes/models/BaseDisplayModel.d.ts +10 -10
- package/pluggableElementTypes/models/BaseDisplayModel.js +58 -95
- package/pluggableElementTypes/models/BaseTrackModel.d.ts +1 -1
- package/pluggableElementTypes/models/BaseTrackModel.js +139 -200
- package/pluggableElementTypes/models/BaseViewModel.js +24 -40
- package/pluggableElementTypes/models/InternetAccountModel.js +116 -263
- package/pluggableElementTypes/models/baseConnectionConfig.js +14 -25
- package/pluggableElementTypes/models/baseInternetAccountConfig.js +29 -38
- package/pluggableElementTypes/models/baseTrackConfig.js +106 -133
- package/pluggableElementTypes/models/index.js +21 -70
- package/pluggableElementTypes/renderers/BoxRendererType.js +132 -291
- package/pluggableElementTypes/renderers/CircularChordRendererType.js +8 -38
- package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.js +60 -192
- package/pluggableElementTypes/renderers/FeatureRendererType.d.ts +0 -2
- package/pluggableElementTypes/renderers/FeatureRendererType.js +89 -255
- package/pluggableElementTypes/renderers/RendererType.js +31 -105
- package/pluggableElementTypes/renderers/ServerSideRenderedContent.js +61 -72
- package/pluggableElementTypes/renderers/ServerSideRendererType.d.ts +2 -2
- package/pluggableElementTypes/renderers/ServerSideRendererType.js +112 -265
- package/pluggableElementTypes/renderers/index.js +19 -62
- package/pluggableElementTypes/renderers/util/serializableFilterChain.js +27 -65
- package/rpc/BaseRpcDriver.js +169 -405
- package/rpc/MainThreadRpcDriver.js +27 -150
- package/rpc/RpcManager.js +58 -159
- package/rpc/WebWorkerRpcDriver.js +54 -171
- package/rpc/configSchema.js +25 -49
- package/rpc/coreRpcMethods.d.ts +1 -3
- package/rpc/coreRpcMethods.js +221 -959
- package/rpc/remoteAbortSignals.js +46 -70
- package/tsconfig.build.tsbuildinfo +1 -1
- package/ui/AboutDialog.js +107 -158
- package/ui/App.js +157 -261
- package/ui/AssemblySelector.d.ts +1 -1
- package/ui/AssemblySelector.js +59 -115
- package/ui/CascadingMenu.js +100 -199
- package/ui/ColorPicker.d.ts +16 -0
- package/ui/ColorPicker.js +97 -0
- package/ui/Drawer.js +28 -58
- package/ui/DrawerWidget.js +109 -209
- package/ui/DropDownMenu.d.ts +0 -8
- package/ui/DropDownMenu.js +60 -97
- package/ui/EditableTypography.d.ts +1 -1
- package/ui/EditableTypography.js +87 -155
- package/ui/ErrorMessage.js +41 -66
- package/ui/FactoryResetDialog.js +24 -57
- package/ui/FatalErrorDialog.js +59 -91
- package/ui/FileSelector/FileSelector.js +123 -189
- package/ui/FileSelector/LocalFileChooser.js +44 -71
- package/ui/FileSelector/UrlChooser.js +17 -38
- package/ui/FileSelector/index.js +6 -12
- package/ui/Icons.d.ts +1 -1
- package/ui/Icons.js +45 -69
- package/ui/Logo.js +57 -110
- package/ui/Menu.d.ts +1 -1
- package/ui/Menu.js +232 -355
- package/ui/PrerenderedCanvas.js +63 -78
- package/ui/ResizeHandle.js +87 -114
- package/ui/ReturnToImportFormDialog.js +32 -59
- package/ui/SanitizedHTML.js +63 -52
- package/ui/Snackbar.js +74 -99
- package/ui/SnackbarModel.js +37 -51
- package/ui/Tooltip.d.ts +3 -1
- package/ui/Tooltip.js +49 -74
- package/ui/ViewContainer.js +113 -183
- package/ui/colors.d.ts +10 -0
- package/ui/colors.js +78 -0
- package/ui/index.js +51 -181
- package/ui/react-colorful.d.ts +17 -0
- package/ui/react-colorful.js +455 -0
- package/ui/theme.d.ts +279 -131
- package/ui/theme.js +197 -225
- package/util/Base1DUtils.d.ts +32 -0
- package/util/Base1DUtils.js +174 -0
- package/util/Base1DViewModel.d.ts +16 -37
- package/util/Base1DViewModel.js +116 -295
- package/util/QuickLRU.js +84 -332
- package/util/TimeTraveller.d.ts +19 -0
- package/util/TimeTraveller.js +86 -0
- package/util/aborting.js +49 -127
- package/util/analytics.js +91 -154
- package/util/blockTypes.js +106 -240
- package/util/calculateDynamicBlocks.js +98 -128
- package/util/calculateStaticBlocks.js +105 -125
- package/util/color/cssColorsLevel4.js +156 -160
- package/util/color/index.js +33 -55
- package/util/compositeMap.js +49 -333
- package/util/formatFastaStrings.js +9 -14
- package/util/idMaker.js +18 -31
- package/util/index.d.ts +18 -39
- package/util/index.js +743 -1236
- package/util/io/RemoteFileWithRangeCache.js +88 -257
- package/util/io/index.js +95 -169
- package/util/jexl.js +60 -115
- package/util/jexlStrings.js +24 -29
- package/util/layouts/BaseLayout.js +1 -4
- package/util/layouts/GranularRectLayout.js +388 -557
- package/util/layouts/MultiLayout.js +41 -109
- package/util/layouts/PrecomputedLayout.js +56 -114
- package/util/layouts/PrecomputedMultiLayout.js +22 -59
- package/util/layouts/SceneGraph.js +127 -197
- package/util/layouts/index.js +29 -66
- package/util/mst-reflection.js +55 -71
- package/util/offscreenCanvasPonyfill.js +66 -134
- package/util/offscreenCanvasUtils.d.ts +2 -7
- package/util/offscreenCanvasUtils.js +49 -146
- package/util/range.js +29 -40
- package/util/rxjs.js +20 -27
- package/util/simpleFeature.js +88 -152
- package/util/stats.js +91 -151
- package/util/tracks.js +130 -171
- package/util/types/index.d.ts +3 -3
- package/util/types/index.js +110 -179
- package/util/types/mst.d.ts +3 -3
- package/util/types/mst.js +91 -142
- package/util/types/util.js +1 -4
- package/util/when.js +54 -101
- package/BaseFeatureWidget/SequenceFeatureDetails.test.js +0 -122
- package/BaseFeatureWidget/index.test.js +0 -51
- package/TextSearch/BaseResults.test.js +0 -42
- package/configuration/configurationSchema.test.js +0 -266
- package/configuration/configurationSlot.test.js +0 -69
- package/configuration/util.test.js +0 -39
- package/data_adapters/BaseAdapter.test.js +0 -200
- package/declare.d.js +0 -1
- package/pluggableElementTypes/RpcMethodType.test.js +0 -118
- package/pluggableElementTypes/renderers/declare.d.js +0 -1
- package/pluggableElementTypes/renderers/util/serializableFilterChain.test.js +0 -20
- package/rpc/BaseRpcDriver.test.js +0 -540
- package/rpc/declaration.d.js +0 -1
- package/ui/FatalErrorDialog.test.js +0 -82
- package/ui/SanitizedHTML.test.js +0 -36
- package/ui/theme.test.js +0 -111
- package/util/Base1DViewModel.test.js +0 -130
- package/util/calculateDynamicBlocks.test.js +0 -74
- package/util/calculateStaticBlocks.test.js +0 -297
- package/util/declare.d.js +0 -1
- package/util/formatFastaStrings.test.js +0 -40
- package/util/index.test.js +0 -213
- package/util/jexlStrings.test.js +0 -48
- package/util/layouts/GranularRectLayout.test.js +0 -99
- package/util/range.test.js +0 -64
- package/util/simpleFeature.test.js +0 -34
- package/util/stats.test.js +0 -172
|
@@ -1,92 +1,64 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
this.name = name;
|
|
32
|
-
this.left = left;
|
|
33
|
-
this.top = top;
|
|
34
|
-
this.width = width;
|
|
35
|
-
this.height = height;
|
|
36
|
-
this.data = data;
|
|
37
|
-
(0, _defineProperty2.default)(this, "children", void 0);
|
|
38
|
-
(0, _defineProperty2.default)(this, "absoluteCache", void 0);
|
|
39
|
-
(0, _defineProperty2.default)(this, "parent", void 0);
|
|
40
|
-
|
|
41
|
-
if (_.inDevelopment && (typeof name !== 'string' || typeof left !== 'number' || Number.isNaN(left) || typeof top !== 'number' || Number.isNaN(top) || typeof width !== 'number' || Number.isNaN(width) || typeof height !== 'number' || Number.isNaN(height))) {
|
|
42
|
-
throw new TypeError('invalid SceneGraph arguments');
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const __1 = require("..");
|
|
4
|
+
class SceneGraph {
|
|
5
|
+
/**
|
|
6
|
+
* note: all coordinates are inter-base or inter-pixel coordinates
|
|
7
|
+
*/
|
|
8
|
+
constructor(name, left, top, width, height,
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
+
data) {
|
|
11
|
+
this.name = name;
|
|
12
|
+
this.left = left;
|
|
13
|
+
this.top = top;
|
|
14
|
+
this.width = width;
|
|
15
|
+
this.height = height;
|
|
16
|
+
this.data = data;
|
|
17
|
+
if (__1.inDevelopment &&
|
|
18
|
+
(typeof name !== 'string' ||
|
|
19
|
+
typeof left !== 'number' ||
|
|
20
|
+
Number.isNaN(left) ||
|
|
21
|
+
typeof top !== 'number' ||
|
|
22
|
+
Number.isNaN(top) ||
|
|
23
|
+
typeof width !== 'number' ||
|
|
24
|
+
Number.isNaN(width) ||
|
|
25
|
+
typeof height !== 'number' ||
|
|
26
|
+
Number.isNaN(height))) {
|
|
27
|
+
throw new TypeError('invalid SceneGraph arguments');
|
|
28
|
+
}
|
|
29
|
+
this.children = new Map();
|
|
30
|
+
this.absoluteCache = { dirty: true };
|
|
43
31
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
this.absoluteCache = {
|
|
47
|
-
dirty: true
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
(0, _createClass2.default)(SceneGraph, [{
|
|
52
|
-
key: "addChild",
|
|
53
|
-
value: function addChild(nameOrSceneGraph, left, top, width, height, // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
32
|
+
addChild(nameOrSceneGraph, left, top, width, height,
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
54
34
|
data) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if (childLeft !== undefined && childRight !== undefined && childTop !== undefined && childBottom !== undefined) {
|
|
80
|
-
this.expand(childLeft, childRight, childTop, childBottom);
|
|
81
|
-
this.children.set(child.name, child);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return child;
|
|
35
|
+
let child;
|
|
36
|
+
if (nameOrSceneGraph instanceof SceneGraph) {
|
|
37
|
+
child = nameOrSceneGraph;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
child = new SceneGraph(nameOrSceneGraph, left, top, width, height, data);
|
|
41
|
+
}
|
|
42
|
+
if (!(child instanceof SceneGraph)) {
|
|
43
|
+
throw new TypeError('argument to addChild must be an array or a SceneGraph');
|
|
44
|
+
}
|
|
45
|
+
if (this.children.has(child.name)) {
|
|
46
|
+
throw new Error(`child named "${child.name}" already exists`);
|
|
47
|
+
}
|
|
48
|
+
// update the bounds to match the child
|
|
49
|
+
child.parent = this;
|
|
50
|
+
const { left: childLeft, right: childRight, top: childTop, bottom: childBottom, } = child.absolute;
|
|
51
|
+
if (childLeft !== undefined &&
|
|
52
|
+
childRight !== undefined &&
|
|
53
|
+
childTop !== undefined &&
|
|
54
|
+
childBottom !== undefined) {
|
|
55
|
+
this.expand(childLeft, childRight, childTop, childBottom);
|
|
56
|
+
this.children.set(child.name, child);
|
|
57
|
+
}
|
|
58
|
+
return child;
|
|
85
59
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
value: function getSubRecord(name) {
|
|
89
|
-
return this.children.get(name);
|
|
60
|
+
getSubRecord(name) {
|
|
61
|
+
return this.children.get(name);
|
|
90
62
|
}
|
|
91
63
|
/**
|
|
92
64
|
* if the record does not already cover the given
|
|
@@ -97,123 +69,81 @@ var SceneGraph = /*#__PURE__*/function () {
|
|
|
97
69
|
* @param top -
|
|
98
70
|
* @param bottom -
|
|
99
71
|
*/
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
this.height += _diff;
|
|
124
|
-
this.top -= _diff;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if (bottom !== undefined && newBottom > bottom) {
|
|
128
|
-
this.height += newBottom - bottom;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
if (this.parent) {
|
|
132
|
-
this.parent.expand(newLeft, newRight, newTop, newBottom);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
this.absoluteCache.dirty = true;
|
|
72
|
+
expand(newLeft, newRight, newTop, newBottom) {
|
|
73
|
+
const { left, right, top, bottom } = this.absolute;
|
|
74
|
+
if (left !== undefined && newLeft < left) {
|
|
75
|
+
const diff = left - newLeft;
|
|
76
|
+
this.width += diff;
|
|
77
|
+
this.left -= diff;
|
|
78
|
+
}
|
|
79
|
+
if (right !== undefined && newRight > right) {
|
|
80
|
+
this.width += newRight - right;
|
|
81
|
+
}
|
|
82
|
+
if (top !== undefined && newTop < top) {
|
|
83
|
+
const diff = top - newTop;
|
|
84
|
+
this.height += diff;
|
|
85
|
+
this.top -= diff;
|
|
86
|
+
}
|
|
87
|
+
if (bottom !== undefined && newBottom > bottom) {
|
|
88
|
+
this.height += newBottom - bottom;
|
|
89
|
+
}
|
|
90
|
+
if (this.parent) {
|
|
91
|
+
this.parent.expand(newLeft, newRight, newTop, newBottom);
|
|
92
|
+
}
|
|
93
|
+
this.absoluteCache.dirty = true;
|
|
136
94
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
get: function get() {
|
|
140
|
-
return this.top + this.height;
|
|
95
|
+
get bottom() {
|
|
96
|
+
return this.top + this.height;
|
|
141
97
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
get: function get() {
|
|
145
|
-
return this.left + this.width;
|
|
98
|
+
get right() {
|
|
99
|
+
return this.left + this.width;
|
|
146
100
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
this.parent.walkParents(callback);
|
|
153
|
-
}
|
|
101
|
+
walkParents(callback) {
|
|
102
|
+
if (this.parent) {
|
|
103
|
+
callback(this.parent);
|
|
104
|
+
this.parent.walkParents(callback);
|
|
105
|
+
}
|
|
154
106
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
_step;
|
|
160
|
-
|
|
161
|
-
try {
|
|
162
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
163
|
-
var sub = _step.value;
|
|
164
|
-
callback(sub);
|
|
165
|
-
sub.walkChildren(callback);
|
|
107
|
+
walkChildren(callback) {
|
|
108
|
+
for (const sub of this.children.values()) {
|
|
109
|
+
callback(sub);
|
|
110
|
+
sub.walkChildren(callback);
|
|
166
111
|
}
|
|
167
|
-
} catch (err) {
|
|
168
|
-
_iterator.e(err);
|
|
169
|
-
} finally {
|
|
170
|
-
_iterator.f();
|
|
171
|
-
}
|
|
172
112
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
return this.absoluteCache;
|
|
113
|
+
get absolute() {
|
|
114
|
+
if (this.absoluteCache.dirty) {
|
|
115
|
+
let xOffset = 0;
|
|
116
|
+
let yOffset = 0;
|
|
117
|
+
this.walkParents((node) => {
|
|
118
|
+
xOffset += node.left;
|
|
119
|
+
yOffset += node.top;
|
|
120
|
+
});
|
|
121
|
+
this.absoluteCache = {
|
|
122
|
+
dirty: false,
|
|
123
|
+
left: this.left + xOffset,
|
|
124
|
+
right: this.right + xOffset,
|
|
125
|
+
top: this.top + yOffset,
|
|
126
|
+
bottom: this.bottom + yOffset,
|
|
127
|
+
width: this.width,
|
|
128
|
+
height: this.height,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
return this.absoluteCache;
|
|
195
132
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
if (left !== undefined && right !== undefined && top !== undefined && bottom !== undefined) {
|
|
212
|
-
this.expand(left, right, top, bottom);
|
|
213
|
-
}
|
|
133
|
+
move(x, y) {
|
|
134
|
+
this.left += x;
|
|
135
|
+
this.top += y;
|
|
136
|
+
this.absoluteCache.dirty = true;
|
|
137
|
+
this.walkChildren((c) => {
|
|
138
|
+
c.absoluteCache.dirty = true;
|
|
139
|
+
});
|
|
140
|
+
const { left, right, top, bottom } = this.absolute;
|
|
141
|
+
if (left !== undefined &&
|
|
142
|
+
right !== undefined &&
|
|
143
|
+
top !== undefined &&
|
|
144
|
+
bottom !== undefined) {
|
|
145
|
+
this.expand(left, right, top, bottom);
|
|
146
|
+
}
|
|
214
147
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
}();
|
|
218
|
-
|
|
219
|
-
exports.default = SceneGraph;
|
|
148
|
+
}
|
|
149
|
+
exports.default = SceneGraph;
|
package/util/layouts/index.js
CHANGED
|
@@ -1,68 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
});
|
|
8
|
-
var _exportNames = {
|
|
9
|
-
GranularRectLayout: true,
|
|
10
|
-
MultiLayout: true,
|
|
11
|
-
PrecomputedLayout: true,
|
|
12
|
-
PrecomputedMultiLayout: true,
|
|
13
|
-
SceneGraph: true
|
|
14
|
-
};
|
|
15
|
-
Object.defineProperty(exports, "GranularRectLayout", {
|
|
16
|
-
enumerable: true,
|
|
17
|
-
get: function get() {
|
|
18
|
-
return _GranularRectLayout.default;
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
Object.defineProperty(exports, "MultiLayout", {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function get() {
|
|
24
|
-
return _MultiLayout.default;
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
Object.defineProperty(exports, "PrecomputedLayout", {
|
|
28
|
-
enumerable: true,
|
|
29
|
-
get: function get() {
|
|
30
|
-
return _PrecomputedLayout.default;
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
Object.defineProperty(exports, "PrecomputedMultiLayout", {
|
|
34
|
-
enumerable: true,
|
|
35
|
-
get: function get() {
|
|
36
|
-
return _PrecomputedMultiLayout.default;
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
Object.defineProperty(exports, "SceneGraph", {
|
|
40
|
-
enumerable: true,
|
|
41
|
-
get: function get() {
|
|
42
|
-
return _SceneGraph.default;
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
var _BaseLayout = require("./BaseLayout");
|
|
47
|
-
|
|
48
|
-
Object.keys(_BaseLayout).forEach(function (key) {
|
|
49
|
-
if (key === "default" || key === "__esModule") return;
|
|
50
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
51
|
-
if (key in exports && exports[key] === _BaseLayout[key]) return;
|
|
52
|
-
Object.defineProperty(exports, key, {
|
|
53
|
-
enumerable: true,
|
|
54
|
-
get: function get() {
|
|
55
|
-
return _BaseLayout[key];
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
56
7
|
}
|
|
57
|
-
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
var
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.SceneGraph = exports.PrecomputedMultiLayout = exports.PrecomputedLayout = exports.MultiLayout = exports.GranularRectLayout = void 0;
|
|
21
|
+
__exportStar(require("./BaseLayout"), exports);
|
|
22
|
+
var GranularRectLayout_1 = require("./GranularRectLayout");
|
|
23
|
+
Object.defineProperty(exports, "GranularRectLayout", { enumerable: true, get: function () { return __importDefault(GranularRectLayout_1).default; } });
|
|
24
|
+
var MultiLayout_1 = require("./MultiLayout");
|
|
25
|
+
Object.defineProperty(exports, "MultiLayout", { enumerable: true, get: function () { return __importDefault(MultiLayout_1).default; } });
|
|
26
|
+
var PrecomputedLayout_1 = require("./PrecomputedLayout");
|
|
27
|
+
Object.defineProperty(exports, "PrecomputedLayout", { enumerable: true, get: function () { return __importDefault(PrecomputedLayout_1).default; } });
|
|
28
|
+
var PrecomputedMultiLayout_1 = require("./PrecomputedMultiLayout");
|
|
29
|
+
Object.defineProperty(exports, "PrecomputedMultiLayout", { enumerable: true, get: function () { return __importDefault(PrecomputedMultiLayout_1).default; } });
|
|
30
|
+
var SceneGraph_1 = require("./SceneGraph");
|
|
31
|
+
Object.defineProperty(exports, "SceneGraph", { enumerable: true, get: function () { return __importDefault(SceneGraph_1).default; } });
|
package/util/mst-reflection.js
CHANGED
|
@@ -1,19 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getDefaultValue = getDefaultValue;
|
|
7
|
-
exports.getEnumerationValues = getEnumerationValues;
|
|
8
|
-
exports.getPropertyType = getPropertyType;
|
|
9
|
-
exports.getSubType = getSubType;
|
|
10
|
-
exports.getUnionSubTypes = getUnionSubTypes;
|
|
11
|
-
exports.resolveLateType = resolveLateType;
|
|
12
|
-
|
|
13
|
-
var _mobxStateTree = require("mobx-state-tree");
|
|
14
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveLateType = exports.getEnumerationValues = exports.getDefaultValue = exports.getPropertyType = exports.getUnionSubTypes = exports.getSubType = void 0;
|
|
15
4
|
/* eslint-disable no-underscore-dangle */
|
|
16
|
-
|
|
5
|
+
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
17
6
|
/**
|
|
18
7
|
* get the inner type of an MST optional, array, or late type object
|
|
19
8
|
*
|
|
@@ -21,46 +10,46 @@ var _mobxStateTree = require("mobx-state-tree");
|
|
|
21
10
|
* @returns {IModelType}
|
|
22
11
|
*/
|
|
23
12
|
function getSubType(type) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
13
|
+
let t;
|
|
14
|
+
if ((0, mobx_state_tree_1.isOptionalType)(type)) {
|
|
15
|
+
t = type._subtype || type.type;
|
|
16
|
+
}
|
|
17
|
+
else if ((0, mobx_state_tree_1.isArrayType)(type) || (0, mobx_state_tree_1.isMapType)(type)) {
|
|
18
|
+
t = type._subtype || type._subType || type.subType;
|
|
19
|
+
}
|
|
20
|
+
else if (typeof type.getSubType === 'function') {
|
|
21
|
+
return type.getSubType();
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
throw new TypeError('unsupported mst type');
|
|
25
|
+
}
|
|
26
|
+
if (!t) {
|
|
27
|
+
// debugger
|
|
28
|
+
throw new Error('failed to get subtype');
|
|
29
|
+
}
|
|
30
|
+
return t;
|
|
42
31
|
}
|
|
32
|
+
exports.getSubType = getSubType;
|
|
43
33
|
/**
|
|
44
34
|
* get the array of
|
|
45
35
|
* @param {MST Union Type obj} unionType
|
|
46
36
|
* @returns {Array<IModelType>}
|
|
47
37
|
*/
|
|
48
|
-
|
|
49
|
-
|
|
50
38
|
function getUnionSubTypes(unionType) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
39
|
+
if (!(0, mobx_state_tree_1.isUnionType)(unionType)) {
|
|
40
|
+
throw new TypeError('not an MST union type');
|
|
41
|
+
}
|
|
42
|
+
const t = unionType._types ||
|
|
43
|
+
unionType.types ||
|
|
44
|
+
getSubType(unionType)._types ||
|
|
45
|
+
getSubType(unionType).types;
|
|
46
|
+
if (!t) {
|
|
47
|
+
// debugger
|
|
48
|
+
throw new Error('failed to extract subtypes from mst union');
|
|
49
|
+
}
|
|
50
|
+
return t;
|
|
63
51
|
}
|
|
52
|
+
exports.getUnionSubTypes = getUnionSubTypes;
|
|
64
53
|
/**
|
|
65
54
|
* get the type of one of the properties of the given MST model type
|
|
66
55
|
*
|
|
@@ -68,40 +57,35 @@ function getUnionSubTypes(unionType) {
|
|
|
68
57
|
* @param {string} propertyName
|
|
69
58
|
* @returns {IModelType}
|
|
70
59
|
*/
|
|
71
|
-
|
|
72
|
-
|
|
73
60
|
function getPropertyType(type, propertyName) {
|
|
74
|
-
|
|
75
|
-
|
|
61
|
+
const propertyType = type.properties[propertyName];
|
|
62
|
+
return propertyType;
|
|
76
63
|
}
|
|
64
|
+
exports.getPropertyType = getPropertyType;
|
|
77
65
|
/**
|
|
78
66
|
* get the base type from inside an MST optional type
|
|
79
67
|
* @param {*} type
|
|
80
68
|
*/
|
|
81
|
-
|
|
82
|
-
|
|
83
69
|
function getDefaultValue(type) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
return type._defaultValue || type.defaultValue;
|
|
70
|
+
if (!(0, mobx_state_tree_1.isOptionalType)(type)) {
|
|
71
|
+
throw new TypeError('type must be an optional type');
|
|
72
|
+
}
|
|
73
|
+
return type._defaultValue || type.defaultValue;
|
|
89
74
|
}
|
|
75
|
+
exports.getDefaultValue = getDefaultValue;
|
|
90
76
|
/** get the string values of an MST enumeration type */
|
|
91
|
-
|
|
92
|
-
|
|
93
77
|
function getEnumerationValues(type) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
return t.value;
|
|
98
|
-
});
|
|
78
|
+
const subtypes = getUnionSubTypes(type);
|
|
79
|
+
// the subtypes should all be literals with a value member
|
|
80
|
+
return subtypes.map(t => t.value);
|
|
99
81
|
}
|
|
100
|
-
|
|
82
|
+
exports.getEnumerationValues = getEnumerationValues;
|
|
101
83
|
function resolveLateType(maybeLate) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
84
|
+
if (!(0, mobx_state_tree_1.isUnionType)(maybeLate) &&
|
|
85
|
+
!(0, mobx_state_tree_1.isArrayType)(maybeLate) &&
|
|
86
|
+
(0, mobx_state_tree_1.isLateType)(maybeLate)) {
|
|
87
|
+
return maybeLate.getSubType();
|
|
88
|
+
}
|
|
89
|
+
return maybeLate;
|
|
90
|
+
}
|
|
91
|
+
exports.resolveLateType = resolveLateType;
|