@jbrowse/core 2.3.4 → 2.4.1

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.
Files changed (116) hide show
  1. package/BaseFeatureWidget/BaseFeatureDetail.d.ts +18 -19
  2. package/BaseFeatureWidget/BaseFeatureDetail.js +76 -69
  3. package/BaseFeatureWidget/SequenceBox.js +9 -3
  4. package/BaseFeatureWidget/SequenceFeatureDetails.js +70 -52
  5. package/BaseFeatureWidget/SequencePanel.d.ts +3 -3
  6. package/BaseFeatureWidget/SequencePanel.js +8 -5
  7. package/BaseFeatureWidget/index.js +2 -2
  8. package/CorePlugin.js +2 -7
  9. package/PluginLoader.d.ts +1 -1
  10. package/PluginLoader.js +20 -24
  11. package/PluginManager.d.ts +1 -1
  12. package/PluginManager.js +2 -3
  13. package/ReExports/Attributes.d.ts +1 -2
  14. package/ReExports/Attributes.js +4 -3
  15. package/ReExports/BaseCard.d.ts +1 -2
  16. package/ReExports/BaseCard.js +4 -3
  17. package/ReExports/DataGrid.d.ts +1 -2
  18. package/ReExports/DataGrid.js +2 -2
  19. package/ReExports/FeatureDetails.d.ts +1 -2
  20. package/ReExports/FeatureDetails.js +4 -3
  21. package/ReExports/index.d.ts +1 -2
  22. package/ReExports/index.js +3 -2
  23. package/ReExports/modules.d.ts +1 -1
  24. package/ReExports/modules.js +2 -2
  25. package/assemblyManager/assembly.js +5 -5
  26. package/assemblyManager/assemblyConfigSchema.js +2 -2
  27. package/configuration/configurationSchema.js +1 -1
  28. package/configuration/util.js +1 -1
  29. package/data_adapters/BaseAdapter.js +1 -1
  30. package/data_adapters/CytobandAdapter/CytobandAdapter.d.ts +8 -0
  31. package/data_adapters/CytobandAdapter/CytobandAdapter.js +40 -0
  32. package/data_adapters/CytobandAdapter/configSchema.d.ts +2 -0
  33. package/data_adapters/CytobandAdapter/configSchema.js +17 -0
  34. package/data_adapters/CytobandAdapter/index.d.ts +3 -0
  35. package/data_adapters/CytobandAdapter/index.js +37 -0
  36. package/data_adapters/dataAdapterCache.d.ts +3 -2
  37. package/data_adapters/dataAdapterCache.js +2 -3
  38. package/package.json +5 -4
  39. package/pluggableElementTypes/PluggableElementBase.d.ts +1 -1
  40. package/pluggableElementTypes/PluggableElementBase.js +1 -2
  41. package/pluggableElementTypes/RpcMethodType.d.ts +5 -8
  42. package/pluggableElementTypes/RpcMethodType.js +23 -34
  43. package/pluggableElementTypes/index.d.ts +11 -1
  44. package/pluggableElementTypes/index.js +23 -23
  45. package/pluggableElementTypes/models/BaseConnectionModelFactory.js +2 -2
  46. package/pluggableElementTypes/models/BaseTrackModel.js +8 -13
  47. package/pluggableElementTypes/renderers/CircularChordRendererType.d.ts +13 -2
  48. package/pluggableElementTypes/renderers/CircularChordRendererType.js +10 -2
  49. package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.d.ts +8 -2
  50. package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.js +10 -4
  51. package/pluggableElementTypes/renderers/ServerSideRendererType.d.ts +1 -1
  52. package/pluggableElementTypes/renderers/ServerSideRendererType.js +2 -34
  53. package/pluggableElementTypes/renderers/index.d.ts +7 -9
  54. package/pluggableElementTypes/renderers/index.js +15 -15
  55. package/pluggableElementTypes/renderers/util/serializableFilterChain.js +1 -1
  56. package/rpc/BaseRpcDriver.js +7 -8
  57. package/rpc/WebWorkerRpcDriver.js +18 -12
  58. package/rpc/coreRpcMethods.d.ts +9 -11
  59. package/rpc/coreRpcMethods.js +17 -17
  60. package/rpc/methods/CoreGetFeatureDetails.js +1 -1
  61. package/rpc/methods/util.d.ts +2 -2
  62. package/rpc/methods/util.js +2 -2
  63. package/rpc/remoteAbortSignals.js +0 -1
  64. package/tsconfig.build.tsbuildinfo +1 -1
  65. package/ui/App.js +3 -18
  66. package/ui/AppLogo.js +1 -6
  67. package/ui/ColorPicker.js +1 -1
  68. package/ui/Dialog.js +1 -1
  69. package/ui/DrawerWidget.js +4 -4
  70. package/ui/EditableTypography.js +1 -1
  71. package/ui/FileSelector/FileSelector.d.ts +2 -2
  72. package/ui/FileSelector/FileSelector.js +24 -35
  73. package/ui/FileSelector/index.d.ts +1 -2
  74. package/ui/FileSelector/index.js +3 -2
  75. package/ui/LoadingEllipses.js +2 -2
  76. package/ui/Menu.js +45 -32
  77. package/ui/ResizeBar.js +10 -6
  78. package/ui/ResizeHandle.js +3 -6
  79. package/ui/SanitizedHTML.js +2 -0
  80. package/ui/ViewContainer.js +7 -44
  81. package/ui/ViewMenu.d.ts +9 -0
  82. package/ui/ViewMenu.js +69 -0
  83. package/ui/ViewPanel.d.ts +19 -0
  84. package/ui/ViewPanel.js +49 -0
  85. package/ui/theme.d.ts +10 -166
  86. package/ui/theme.js +260 -48
  87. package/util/Base1DUtils.js +16 -14
  88. package/util/Base1DViewModel.d.ts +1 -1
  89. package/util/Base1DViewModel.js +9 -8
  90. package/util/aborting.js +1 -1
  91. package/util/analytics.js +1 -1
  92. package/util/blockTypes.js +10 -10
  93. package/util/color/index.d.ts +1 -2
  94. package/util/color/index.js +4 -3
  95. package/util/idMaker.js +5 -8
  96. package/util/index.d.ts +9 -9
  97. package/util/index.js +35 -52
  98. package/util/io/RemoteFileWithRangeCache.js +2 -2
  99. package/util/io/index.d.ts +1 -2
  100. package/util/io/index.js +6 -6
  101. package/util/jexl.js +3 -1
  102. package/util/layouts/GranularRectLayout.js +10 -4
  103. package/util/layouts/MultiLayout.js +1 -1
  104. package/util/layouts/SceneGraph.js +3 -7
  105. package/util/map-obj.d.ts +3 -0
  106. package/util/map-obj.js +33 -0
  107. package/util/offscreenCanvasPonyfill.js +4 -3
  108. package/util/offscreenCanvasUtils.d.ts +18 -4
  109. package/util/offscreenCanvasUtils.js +49 -7
  110. package/util/tracks.d.ts +1 -1
  111. package/util/tracks.js +0 -1
  112. package/util/types/index.d.ts +1 -1
  113. package/util/types/index.js +3 -3
  114. package/util/types/mst.js +3 -3
  115. package/data_adapters/CytobandAdapter.d.ts +0 -8
  116. package/data_adapters/CytobandAdapter.js +0 -49
package/CorePlugin.js CHANGED
@@ -30,9 +30,8 @@ const react_1 = require("react");
30
30
  const BaseFeatureWidget_1 = require("./BaseFeatureWidget");
31
31
  const Plugin_1 = __importDefault(require("./Plugin"));
32
32
  const coreRpcMethods = __importStar(require("./rpc/coreRpcMethods"));
33
- const AdapterType_1 = __importDefault(require("./pluggableElementTypes/AdapterType"));
34
33
  const WidgetType_1 = __importDefault(require("./pluggableElementTypes/WidgetType"));
35
- const CytobandAdapter_1 = require("./data_adapters/CytobandAdapter");
34
+ const CytobandAdapter_1 = __importDefault(require("./data_adapters/CytobandAdapter"));
36
35
  // the core plugin, which registers types that ALL JBrowse applications are
37
36
  // expected to need.
38
37
  class CorePlugin extends Plugin_1.default {
@@ -45,11 +44,7 @@ class CorePlugin extends Plugin_1.default {
45
44
  Object.values(coreRpcMethods).forEach(RpcMethod => {
46
45
  pluginManager.addRpcMethod(() => new RpcMethod(pluginManager));
47
46
  });
48
- pluginManager.addAdapterType(() => new AdapterType_1.default({
49
- name: 'CytobandAdapter',
50
- configSchema: CytobandAdapter_1.configSchema,
51
- AdapterClass: CytobandAdapter_1.DataAdapter,
52
- }));
47
+ (0, CytobandAdapter_1.default)(pluginManager);
53
48
  pluginManager.addWidgetType(() => {
54
49
  return new WidgetType_1.default({
55
50
  name: 'BaseFeatureWidget',
package/PluginLoader.d.ts CHANGED
@@ -48,7 +48,7 @@ export default class PluginLoader {
48
48
  fetchESM?: (url: string) => Promise<LoadedPlugin>;
49
49
  fetchCJS?: (url: string) => Promise<LoadedPlugin>;
50
50
  });
51
- loadScript(scriptUrl: string): Promise<void>;
51
+ loadScript(scriptUrl: string): Promise<any>;
52
52
  loadCJSPlugin(def: CJSPluginDefinition, baseUri?: string): Promise<LoadedPlugin>;
53
53
  loadESMPlugin(def: ESMPluginDefinition, baseUri?: string): Promise<LoadedPlugin>;
54
54
  loadUMDPlugin(def: UMDPluginDefinition | LegacyUMDPluginDefinition, baseUri?: string): Promise<{
package/PluginLoader.js CHANGED
@@ -5,6 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.isCJSPluginDefinition = exports.isESMPluginDefinition = exports.isUMDPluginDefinition = void 0;
7
7
  const load_script2_1 = __importDefault(require("load-script2"));
8
+ // locals
9
+ const Plugin_1 = __importDefault(require("./Plugin"));
8
10
  const ReExports_1 = __importDefault(require("./ReExports"));
9
11
  const util_1 = require("./util");
10
12
  function isUMDPluginDefinition(def) {
@@ -23,18 +25,8 @@ function isCJSPluginDefinition(def) {
23
25
  return def.cjsUrl !== undefined;
24
26
  }
25
27
  exports.isCJSPluginDefinition = isCJSPluginDefinition;
26
- function getGlobalObject() {
27
- // Based on window-or-global
28
- // https://github.com/purposeindustries/window-or-global/blob/322abc71de0010c9e5d9d0729df40959e1ef8775/lib/index.js
29
- return (
30
- // eslint-disable-next-line no-restricted-globals
31
- (typeof self === 'object' && self.self === self && self) ||
32
- (typeof global === 'object' && global.global === global && global) ||
33
- // @ts-ignore
34
- this);
35
- }
36
- function isInWebWorker(globalObject) {
37
- return Boolean('WorkerGlobalScope' in globalObject);
28
+ function isInWebWorker() {
29
+ return Boolean('WorkerGlobalScope' in globalThis);
38
30
  }
39
31
  class PluginLoader {
40
32
  constructor(defs = [], args) {
@@ -44,14 +36,13 @@ class PluginLoader {
44
36
  this.definitions = JSON.parse(JSON.stringify(defs));
45
37
  }
46
38
  async loadScript(scriptUrl) {
47
- const globalObject = getGlobalObject();
48
- if (!isInWebWorker(globalObject)) {
39
+ if (!isInWebWorker()) {
49
40
  return (0, load_script2_1.default)(scriptUrl);
50
41
  }
51
- // @ts-ignore
52
- if (globalObject === null || globalObject === void 0 ? void 0 : globalObject.importScripts) {
53
- // @ts-ignore
54
- await globalObject.importScripts(scriptUrl);
42
+ // @ts-expect-error
43
+ if (globalThis === null || globalThis === void 0 ? void 0 : globalThis.importScripts) {
44
+ // @ts-expect-error
45
+ await globalThis.importScripts(scriptUrl);
55
46
  return;
56
47
  }
57
48
  throw new Error('cannot figure out how to load external JS scripts in this environment');
@@ -91,14 +82,19 @@ class PluginLoader {
91
82
  if (parsedUrl.protocol !== 'http:' && parsedUrl.protocol !== 'https:') {
92
83
  throw new Error(`cannot load plugins using protocol "${parsedUrl.protocol}"`);
93
84
  }
94
- await this.loadScript(parsedUrl.href);
95
85
  const moduleName = def.name;
96
86
  const umdName = `JBrowsePlugin${moduleName}`;
97
- const globalObject = getGlobalObject();
98
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
99
- const plugin = globalObject[umdName];
87
+ if (typeof jest === 'undefined') {
88
+ await this.loadScript(parsedUrl.href);
89
+ }
90
+ else {
91
+ // @ts-expect-error
92
+ globalThis[umdName] = { default: Plugin_1.default };
93
+ }
94
+ // @ts-expect-error
95
+ const plugin = globalThis[umdName];
100
96
  if (!plugin) {
101
- throw new Error(`Failed to load UMD bundle for ${moduleName}, ${globalObject.constructor.name}.${umdName} is undefined`);
97
+ throw new Error(`Failed to load UMD bundle for ${moduleName}, ${umdName} is undefined`);
102
98
  }
103
99
  return plugin;
104
100
  }
@@ -122,7 +118,7 @@ class PluginLoader {
122
118
  return plugin.default;
123
119
  }
124
120
  installGlobalReExports(target) {
125
- // @ts-ignore
121
+ // @ts-expect-error
126
122
  target.JBrowseExports = Object.fromEntries(Object.entries(ReExports_1.default).map(([moduleName, module]) => {
127
123
  return [moduleName, module];
128
124
  }));
@@ -195,7 +195,7 @@ export default class PluginManager {
195
195
  showAllRegions(): void;
196
196
  zoomOut(): void;
197
197
  zoomIn(): void;
198
- zoomTo(newBpPerPx: number, offset?: number): number;
198
+ zoomTo(bpPerPx: number, offset?: number): number;
199
199
  scrollTo(offsetPx: number): number;
200
200
  centerAt(coord: number, refName: string | undefined, regionNumber: number): void;
201
201
  scroll(distance: number): number;
package/PluginManager.js CHANGED
@@ -149,7 +149,6 @@ class PluginManager {
149
149
  }
150
150
  this.pluginMetadata[plugin.name] = metadata;
151
151
  if ('definition' in load) {
152
- // @ts-ignore
153
152
  this.runtimePluginDefinitions.push(load.definition);
154
153
  }
155
154
  plugin.install(this);
@@ -253,7 +252,7 @@ class PluginManager {
253
252
  pluggableMstType(groupName, fieldName, fallback = mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.null)) {
254
253
  const pluggableTypes = this.getElementTypeRecord(groupName)
255
254
  .all()
256
- // @ts-ignore
255
+ // @ts-expect-error
257
256
  .map(t => t[fieldName])
258
257
  .filter(t => (0, mobx_state_tree_1.isType)(t) && (0, mobx_state_tree_1.isModelType)(t));
259
258
  // try to smooth over the case when no types are registered, mostly
@@ -268,7 +267,7 @@ class PluginManager {
268
267
  pluggableConfigSchemaType(typeGroup, fieldName = 'configSchema') {
269
268
  const pluggableTypes = this.getElementTypeRecord(typeGroup)
270
269
  .all()
271
- // @ts-ignore
270
+ // @ts-expect-error
272
271
  .map(t => t[fieldName])
273
272
  .filter(t => (0, configuration_1.isBareConfigurationSchemaType)(t));
274
273
  if (pluggableTypes.length === 0) {
@@ -1,2 +1 @@
1
- import { Attributes } from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail';
2
- export default Attributes;
1
+ export { Attributes as default } from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail';
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
2
  // convert named export to default for lazy react
4
- const BaseFeatureDetail_1 = require("@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail");
5
- exports.default = BaseFeatureDetail_1.Attributes;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.default = void 0;
5
+ var BaseFeatureDetail_1 = require("@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail");
6
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return BaseFeatureDetail_1.Attributes; } });
@@ -1,2 +1 @@
1
- import { BaseCard } from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail';
2
- export default BaseCard;
1
+ export { BaseCard as default } from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail';
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
2
  // convert named export to default for lazy react
4
- const BaseFeatureDetail_1 = require("@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail");
5
- exports.default = BaseFeatureDetail_1.BaseCard;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.default = void 0;
5
+ var BaseFeatureDetail_1 = require("@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail");
6
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return BaseFeatureDetail_1.BaseCard; } });
@@ -1,2 +1 @@
1
- import { DataGrid } from '@mui/x-data-grid';
2
- export { DataGrid as default };
1
+ export { DataGrid as default } from '@mui/x-data-grid';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
+ // convert named export to default for lazy react
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  exports.default = void 0;
4
- // convert named export to default for lazy react
5
- const x_data_grid_1 = require("@mui/x-data-grid");
5
+ var x_data_grid_1 = require("@mui/x-data-grid");
6
6
  Object.defineProperty(exports, "default", { enumerable: true, get: function () { return x_data_grid_1.DataGrid; } });
@@ -1,2 +1 @@
1
- import { FeatureDetails } from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail';
2
- export default FeatureDetails;
1
+ export { FeatureDetails as default } from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail';
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
2
  // convert named export to default for lazy react
4
- const BaseFeatureDetail_1 = require("@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail");
5
- exports.default = BaseFeatureDetail_1.FeatureDetails;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.default = void 0;
5
+ var BaseFeatureDetail_1 = require("@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail");
6
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return BaseFeatureDetail_1.FeatureDetails; } });
@@ -1,2 +1 @@
1
- import modules from './modules';
2
- export default modules;
1
+ export { default } from './modules';
@@ -3,5 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const modules_1 = __importDefault(require("./modules"));
7
- exports.default = modules_1.default;
6
+ exports.default = void 0;
7
+ var modules_1 = require("./modules");
8
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(modules_1).default; } });
@@ -112,7 +112,7 @@ declare const libs: {
112
112
  showAllRegions(): void;
113
113
  zoomOut(): void;
114
114
  zoomIn(): void;
115
- zoomTo(newBpPerPx: number, offset?: number): number;
115
+ zoomTo(bpPerPx: number, offset?: number): number;
116
116
  scrollTo(offsetPx: number): number;
117
117
  centerAt(coord: number, refName: string | undefined, regionNumber: number): void;
118
118
  scroll(distance: number): number;
@@ -445,11 +445,11 @@ const libs = {
445
445
  },
446
446
  '@jbrowse/core/data_adapters/BaseAdapter': BaseAdapterExports,
447
447
  };
448
- const libsList = Array.from(Object.keys(libs));
448
+ const libsList = Object.keys(libs);
449
449
  // make sure that all the items in the ReExports/list array (used by build
450
450
  // systems and such) are included here, and vice versa
451
451
  const inLibsOnly = libsList.filter(mod => !list_1.default.includes(mod));
452
- if (inLibsOnly.length) {
452
+ if (inLibsOnly.length > 0) {
453
453
  throw new Error(`The following modules are in the re-exports list, but not the modules libs: ${inLibsOnly.join(', ')}`);
454
454
  }
455
455
  const inReExportsOnly = list_1.default.filter(mod => !libsList.includes(mod));
@@ -74,7 +74,7 @@ async function loadRefNameMap(assembly, adapterConfig, options, signal) {
74
74
  }
75
75
  // Valid refName pattern from https://samtools.github.io/hts-specs/SAMv1.pdf
76
76
  function checkRefName(refName) {
77
- if (!refName.match(refNameRegex)) {
77
+ if (!refNameRegex.test(refName)) {
78
78
  throw new Error(`Encountered invalid refName: "${refName}"`);
79
79
  }
80
80
  }
@@ -104,7 +104,7 @@ function assemblyFactory(assemblyConfigType, pm) {
104
104
  }))
105
105
  .views(self => ({
106
106
  get initialized() {
107
- // @ts-ignore
107
+ // @ts-expect-error
108
108
  self.load();
109
109
  return !!self.refNameAliases;
110
110
  },
@@ -112,7 +112,7 @@ function assemblyFactory(assemblyConfigType, pm) {
112
112
  return (0, configuration_1.getConf)(self, 'name');
113
113
  },
114
114
  get regions() {
115
- // @ts-ignore
115
+ // @ts-expect-error
116
116
  self.load();
117
117
  return self.volatileRegions;
118
118
  },
@@ -172,7 +172,7 @@ function assemblyFactory(assemblyConfigType, pm) {
172
172
  if (!self.refNames) {
173
173
  return undefined;
174
174
  }
175
- const idx = self.refNames.findIndex(r => r === refName);
175
+ const idx = self.refNames.indexOf(refName);
176
176
  if (idx === -1) {
177
177
  return undefined;
178
178
  }
@@ -301,7 +301,7 @@ async function getCytobands(config, pm) {
301
301
  const type = pm.getAdapterType(config.type);
302
302
  const CLASS = await type.getAdapterClass();
303
303
  const adapter = new CLASS(config, undefined, pm);
304
- // @ts-ignore
304
+ // @ts-expect-error
305
305
  return adapter.getData();
306
306
  }
307
307
  async function getAssemblyRegions(config, pm, signal) {
@@ -42,7 +42,7 @@ function assemblyConfigSchema(pluginManager) {
42
42
  }, {
43
43
  preProcessSnapshot: snap => {
44
44
  // allow refNameAliases to be unspecified
45
- // @ts-ignore
45
+ // @ts-expect-error
46
46
  if (!snap.adapter) {
47
47
  return { adapter: { type: 'RefNameAliasAdapter' } };
48
48
  }
@@ -59,7 +59,7 @@ function assemblyConfigSchema(pluginManager) {
59
59
  }, {
60
60
  preProcessSnapshot: snap => {
61
61
  // allow cytoBand to be unspecified
62
- // @ts-ignore
62
+ // @ts-expect-error
63
63
  if (!snap.adapter) {
64
64
  return { adapter: { type: 'CytobandAdapter' } };
65
65
  }
@@ -32,7 +32,7 @@ function preprocessConfigurationSchemaArguments(modelName, inputSchemaDefinition
32
32
  ...schemaDefinition,
33
33
  };
34
34
  options = {
35
- ...(inputOptions.baseConfiguration.jbrowseSchemaOptions || {}),
35
+ ...inputOptions.baseConfiguration.jbrowseSchemaOptions,
36
36
  ...inputOptions,
37
37
  };
38
38
  delete options.baseConfiguration;
@@ -100,7 +100,7 @@ exports.getConf = getConf;
100
100
  function getTypeNamesFromExplicitlyTypedUnion(maybeUnionType) {
101
101
  if ((0, mobx_state_tree_1.isType)(maybeUnionType)) {
102
102
  maybeUnionType = (0, mst_reflection_1.resolveLateType)(maybeUnionType);
103
- // @ts-ignore
103
+ // @ts-expect-error
104
104
  if ((0, mobx_state_tree_1.isUnionType)(maybeUnionType)) {
105
105
  const typeNames = [];
106
106
  (0, mst_reflection_1.getUnionSubTypes)(maybeUnionType).forEach(type => {
@@ -169,7 +169,7 @@ class BaseFeatureDataAdapter extends BaseAdapter {
169
169
  }
170
170
  else {
171
171
  console.warn("Stats estimation reached timeout, or didn't get enough features");
172
- return { featureDensity: Infinity };
172
+ return { featureDensity: Number.POSITIVE_INFINITY };
173
173
  }
174
174
  };
175
175
  return statsFromInterval(1000, 0);
@@ -0,0 +1,8 @@
1
+ /// <reference types="node" />
2
+ import { SimpleFeature } from '../../util';
3
+ import { BaseAdapter } from '../BaseAdapter';
4
+ export declare function isGzip(buf: Buffer): boolean;
5
+ export default class CytobandAdapter extends BaseAdapter {
6
+ getData(): Promise<SimpleFeature[]>;
7
+ freeResources(): void;
8
+ }
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isGzip = void 0;
4
+ const bgzf_filehandle_1 = require("@gmod/bgzf-filehandle");
5
+ // locals
6
+ const util_1 = require("../../util");
7
+ const io_1 = require("../../util/io");
8
+ const BaseAdapter_1 = require("../BaseAdapter");
9
+ function isGzip(buf) {
10
+ return buf[0] === 31 && buf[1] === 139 && buf[2] === 8;
11
+ }
12
+ exports.isGzip = isGzip;
13
+ class CytobandAdapter extends BaseAdapter_1.BaseAdapter {
14
+ async getData() {
15
+ const pm = this.pluginManager;
16
+ const loc = this.getConf('cytobandLocation');
17
+ if (loc.uri === '' || loc.uri === '/path/to/cytoband.txt.gz') {
18
+ return [];
19
+ }
20
+ const buffer = await (0, io_1.openLocation)(loc, pm).readFile();
21
+ const buf = isGzip(buffer) ? await (0, bgzf_filehandle_1.unzip)(buffer) : buffer;
22
+ const text = new TextDecoder('utf8', { fatal: true }).decode(buf);
23
+ return text
24
+ .split(/\n|\r\n|\r/)
25
+ .filter(f => !!f.trim())
26
+ .map((line, i) => {
27
+ const [refName, start, end, name, type] = line.split('\t');
28
+ return new util_1.SimpleFeature({
29
+ uniqueId: `${i}`,
30
+ refName,
31
+ start: +start,
32
+ end: +end,
33
+ name,
34
+ type,
35
+ });
36
+ });
37
+ }
38
+ freeResources( /* { region } */) { }
39
+ }
40
+ exports.default = CytobandAdapter;
@@ -0,0 +1,2 @@
1
+ declare const configSchema: import("../../configuration").AnyConfigurationSchemaType;
2
+ export default configSchema;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const configuration_1 = require("../../configuration");
4
+ /**
5
+ * #config CytobandAdapter
6
+ */
7
+ function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
8
+ const configSchema = (0, configuration_1.ConfigurationSchema)('CytobandAdapter', {
9
+ /**
10
+ * #slot
11
+ */
12
+ cytobandLocation: {
13
+ type: 'fileLocation',
14
+ defaultValue: { uri: '/path/to/cytoband.txt.gz' },
15
+ },
16
+ }, { explicitlyTyped: true });
17
+ exports.default = configSchema;
@@ -0,0 +1,3 @@
1
+ import PluginManager from '../../PluginManager';
2
+ declare const _default: (pluginManager: PluginManager) => void;
3
+ export default _default;
@@ -0,0 +1,37 @@
1
+ "use strict";
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]; } };
7
+ }
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ const pluggableElementTypes_1 = require("../../pluggableElementTypes");
30
+ const configSchema_1 = __importDefault(require("./configSchema"));
31
+ exports.default = (pluginManager) => {
32
+ pluginManager.addAdapterType(() => new pluggableElementTypes_1.AdapterType({
33
+ name: 'CytobandAdapter',
34
+ configSchema: configSchema_1.default,
35
+ getAdapterClass: () => Promise.resolve().then(() => __importStar(require('./CytobandAdapter'))).then(f => f.default),
36
+ }));
37
+ };
@@ -1,7 +1,8 @@
1
1
  import { SnapshotIn } from 'mobx-state-tree';
2
2
  import PluginManager from '../PluginManager';
3
- import { AnyConfigurationSchemaType } from '../configuration/configurationSchema';
3
+ import { AnyConfigurationSchemaType } from '../configuration';
4
4
  import { AnyDataAdapter } from './BaseAdapter';
5
+ type ConfigSnap = SnapshotIn<AnyConfigurationSchemaType>;
5
6
  interface AdapterCacheEntry {
6
7
  dataAdapter: AnyDataAdapter;
7
8
  sessionIds: Set<string>;
@@ -21,7 +22,7 @@ export declare function getAdapter(pluginManager: PluginManager, sessionId: stri
21
22
  * allows them to get any sub-adapters that they need
22
23
  * internally, staying with the same worker session ID
23
24
  */
24
- export type getSubAdapterType = (adapterConfigSnapshot: SnapshotIn<AnyConfigurationSchemaType>) => ReturnType<typeof getAdapter>;
25
+ export type getSubAdapterType = (adapterConfigSnap: ConfigSnap) => ReturnType<typeof getAdapter>;
25
26
  export declare function freeAdapterResources(specification: Record<string, any>): number;
26
27
  export declare function clearAdapterCache(): void;
27
28
  export {};
@@ -39,7 +39,6 @@ async function getAdapter(pluginManager, sessionId, adapterConfigSnapshot) {
39
39
  // (such as sequence adapters or wrapped subadapters) that it needs
40
40
  //
41
41
  const { AdapterClass, getAdapterClass } = dataAdapterType;
42
- // @ts-ignore
43
42
  const CLASS = AdapterClass || (await getAdapterClass());
44
43
  if (!CLASS) {
45
44
  throw new Error('Failed to get adapter');
@@ -81,11 +80,11 @@ function freeAdapterResources(specification) {
81
80
  else {
82
81
  const regions = specification.regions ||
83
82
  (specification.region ? [specification.region] : []);
84
- regions.forEach((region) => {
83
+ for (const region of regions) {
85
84
  if (region.refName !== undefined) {
86
85
  cacheEntry.dataAdapter.freeResources(region);
87
86
  }
88
- });
87
+ }
89
88
  }
90
89
  });
91
90
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/core",
3
- "version": "2.3.4",
3
+ "version": "2.4.1",
4
4
  "description": "JBrowse 2 core libraries used by plugins",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -29,6 +29,7 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@babel/runtime": "^7.17.9",
32
+ "@gmod/bgzf-filehandle": "^1.4.3",
32
33
  "@mui/icons-material": "^5.0.1",
33
34
  "@types/clone": "^2.0.0",
34
35
  "abortable-promise-cache": "^1.5.0",
@@ -40,7 +41,7 @@
40
41
  "copy-to-clipboard": "^3.3.1",
41
42
  "deepmerge": "^4.2.2",
42
43
  "detect-node": "^2.1.0",
43
- "dompurify": "^2.3.4",
44
+ "dompurify": "^3.0.0",
44
45
  "escape-html": "^1.0.3",
45
46
  "fast-deep-equal": "^3.1.3",
46
47
  "generic-filehandle": "^3.0.0",
@@ -50,7 +51,7 @@
50
51
  "json-stable-stringify": "^1.0.1",
51
52
  "librpc-web-mod": "^1.1.5",
52
53
  "load-script2": "^2.0.5",
53
- "material-ui-popup-state": "^3.0.0",
54
+ "material-ui-popup-state": "^5.0.0",
54
55
  "rbush": "^3.0.1",
55
56
  "react-error-boundary": "^3.0.0",
56
57
  "react-use-measure": "^2.1.1",
@@ -74,5 +75,5 @@
74
75
  "access": "public",
75
76
  "directory": "dist"
76
77
  },
77
- "gitHead": "98ae48be91ee2371e1b2768a907b4997995e9915"
78
+ "gitHead": "747c50c4edc0184827efa4f8dfc576ca9a72caeb"
78
79
  }
@@ -2,7 +2,7 @@ export default abstract class PluggableElementBase {
2
2
  name: string;
3
3
  maybeDisplayName?: string;
4
4
  constructor(args: {
5
- name: string;
5
+ name?: string;
6
6
  displayName?: string;
7
7
  });
8
8
  get displayName(): string;
@@ -2,8 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  class PluggableElementBase {
4
4
  constructor(args) {
5
- this.name = '';
6
- this.name = args.name;
5
+ this.name = args.name || 'UNKNOWN';
7
6
  this.maybeDisplayName = args.displayName;
8
7
  }
9
8
  get displayName() {
@@ -5,20 +5,17 @@ import { RemoteAbortSignal } from '../rpc/remoteAbortSignals';
5
5
  export type RpcMethodConstructor = new (pm: PluginManager) => RpcMethodType;
6
6
  export default abstract class RpcMethodType extends PluggableElementBase {
7
7
  pluginManager: PluginManager;
8
- name: string;
9
8
  constructor(pluginManager: PluginManager);
10
9
  serializeArguments(args: {}, _rpcDriverClassName: string): Promise<{}>;
11
10
  serializeNewAuthArguments(loc: UriLocation): Promise<UriLocation>;
12
- deserializeArguments<SERIALIZED extends {
11
+ deserializeArguments<T extends {
13
12
  signal?: RemoteAbortSignal;
14
13
  blobMap?: Record<string, File>;
15
- }>(serializedArgs: SERIALIZED, _rpcDriverClassName: string): Promise<(SERIALIZED & {
16
- signal: AbortSignal;
17
- }) | (SERIALIZED & {
18
- signal: undefined;
19
- })>;
14
+ }>(serializedArgs: T, _rpcDriverClassName: string): Promise<T & {
15
+ signal: AbortSignal | undefined;
16
+ }>;
20
17
  abstract execute(serializedArgs: unknown, rpcDriverClassName: string): Promise<unknown>;
21
18
  serializeReturn(originalReturn: unknown, _args: unknown, _rpcDriverClassName: string): Promise<unknown>;
22
- deserializeReturn(serializedReturn: unknown, _args: unknown, _rpcDriverClassName: string): Promise<unknown>;
19
+ deserializeReturn(serializedReturn: unknown, _args: unknown, _rpcDriver: string): Promise<unknown>;
23
20
  private augmentLocationObjects;
24
21
  }