@jbrowse/core 5.0.0-beta.1 → 5.0.0-beta.2

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 (115) hide show
  1. package/README.md +42 -3
  2. package/esm/BaseFeatureWidget/SequenceFeatureDetails/test_data/NCDN.d.ts +2 -2
  3. package/esm/PluginLoader.d.ts +1 -0
  4. package/esm/PluginLoader.js +52 -8
  5. package/esm/PluginManager.d.ts +70 -17
  6. package/esm/PluginManager.js +151 -20
  7. package/esm/ReExports/modules.js +3 -53
  8. package/esm/ReExports/publicUtil.d.ts +1 -1
  9. package/esm/ReExports/publicUtil.js +1 -1
  10. package/esm/ReExports/sharedModules.d.ts +96 -0
  11. package/esm/ReExports/sharedModules.js +59 -0
  12. package/esm/ReExports/uiStub.d.ts +1 -0
  13. package/esm/ReExports/uiStub.js +13 -0
  14. package/esm/ReExports/workerModules.d.ts +2 -0
  15. package/esm/ReExports/workerModules.js +10 -0
  16. package/esm/configuration/configurationSchema.d.ts +5 -38
  17. package/esm/configuration/configurationSchema.js +53 -40
  18. package/esm/configuration/promotableDefaults.js +12 -6
  19. package/esm/configuration/promotableResolve.d.ts +1 -1
  20. package/esm/configuration/promotableResolve.js +1 -1
  21. package/esm/data_adapters/BaseAdapter/BaseFeatureDataAdapter.d.ts +12 -0
  22. package/esm/data_adapters/BaseAdapter/BaseFeatureDataAdapter.js +39 -0
  23. package/esm/data_adapters/BaseAdapter/featureDensity.d.ts +29 -0
  24. package/esm/data_adapters/BaseAdapter/featureDensity.js +17 -0
  25. package/esm/data_adapters/BaseAdapter/index.d.ts +1 -0
  26. package/esm/data_adapters/BaseAdapter/index.js +1 -0
  27. package/esm/data_adapters/BaseAdapter/stats.d.ts +33 -1
  28. package/esm/data_adapters/BaseAdapter/stats.js +52 -13
  29. package/esm/data_adapters/BaseAdapter/types.d.ts +1 -0
  30. package/esm/pluggableElementTypes/DisplayType.d.ts +9 -10
  31. package/esm/pluggableElementTypes/DisplayType.js +43 -8
  32. package/esm/pluggableElementTypes/ViewType.d.ts +25 -2
  33. package/esm/pluggableElementTypes/ViewType.js +75 -2
  34. package/esm/pluggableElementTypes/extendElementType.js +8 -3
  35. package/esm/pluggableElementTypes/models/BaseDisplayModel.d.ts +41 -0
  36. package/esm/pluggableElementTypes/models/BaseDisplayModel.js +74 -1
  37. package/esm/pluggableElementTypes/models/BaseTrackModel.d.ts +21 -0
  38. package/esm/pluggableElementTypes/models/BaseTrackModel.js +37 -2
  39. package/esm/pluggableElementTypes/models/BaseViewModel.d.ts +49 -0
  40. package/esm/pluggableElementTypes/models/BaseViewModel.js +39 -0
  41. package/esm/pluggableElementTypes/models/assertDisplayContract.d.ts +10 -7
  42. package/esm/pluggableElementTypes/models/assertDisplayContract.js +23 -30
  43. package/esm/rpc/RpcRegistry.d.ts +10 -0
  44. package/esm/rpc/byteBudget.d.ts +9 -0
  45. package/esm/rpc/coreRpcMethods.d.ts +1 -0
  46. package/esm/rpc/coreRpcMethods.js +1 -0
  47. package/esm/rpc/methods/CoreGetFeatureDensity.d.ts +11 -0
  48. package/esm/rpc/methods/CoreGetFeatureDensity.js +22 -0
  49. package/esm/svg/svgReady.d.ts +1 -0
  50. package/esm/ui/CascadingMenu.js +30 -8
  51. package/esm/ui/LoadingOverlay.d.ts +14 -0
  52. package/esm/ui/LoadingOverlay.js +1 -1
  53. package/esm/ui/MenuTypes.d.ts +11 -2
  54. package/esm/ui/MenuTypes.js +3 -0
  55. package/esm/ui/PaletteContext.d.ts +11 -4
  56. package/esm/ui/PaletteContext.js +34 -5
  57. package/esm/ui/PinAdornment.js +12 -6
  58. package/esm/ui/index.d.ts +1 -1
  59. package/esm/ui/index.js +1 -1
  60. package/esm/ui/launchViewMenu.js +7 -1
  61. package/esm/ui/legendMenuItem.d.ts +5 -5
  62. package/esm/ui/legendMenuItem.js +5 -5
  63. package/esm/ui/makeSizeMenu.js +1 -1
  64. package/esm/ui/menuItems.d.ts +1 -1
  65. package/esm/ui/menuItems.js +1 -1
  66. package/esm/ui/promotableMenuItems.js +8 -6
  67. package/esm/ui/promotablePinCoverage.js +2 -1
  68. package/esm/ui/toggleMenuItems.d.ts +1 -3
  69. package/esm/util/addAndShowTrack.d.ts +1 -1
  70. package/esm/util/addAndShowTrack.js +5 -1
  71. package/esm/util/addTrackFromWidget.js +2 -2
  72. package/esm/util/cacheBudgets.d.ts +22 -19
  73. package/esm/util/cacheBudgets.js +22 -19
  74. package/esm/util/createStopTokenRotation.d.ts +1 -0
  75. package/esm/util/createStopTokenRotation.js +7 -27
  76. package/esm/util/fetchContext.d.ts +2 -2
  77. package/esm/util/fetchContext.js +2 -2
  78. package/esm/util/fetchPhases.d.ts +9 -9
  79. package/esm/util/hooks.d.ts +8 -0
  80. package/esm/util/hooks.js +27 -0
  81. package/esm/util/index.d.ts +2 -3
  82. package/esm/util/index.js +2 -3
  83. package/esm/util/installFetch.d.ts +49 -23
  84. package/esm/util/installFetch.js +49 -21
  85. package/esm/util/installInitAutorun.d.ts +8 -8
  86. package/esm/util/installInitAutorun.js +15 -15
  87. package/esm/util/lazyAfterAttach.d.ts +13 -0
  88. package/esm/util/lazyAfterAttach.js +31 -0
  89. package/esm/util/legendCandidates.d.ts +50 -0
  90. package/esm/util/legendCandidates.js +87 -0
  91. package/esm/util/mstUtils.d.ts +12 -1
  92. package/esm/util/mstUtils.js +20 -2
  93. package/esm/util/pluginStore.d.ts +1 -0
  94. package/esm/util/pluginStore.js +8 -1
  95. package/esm/util/range.d.ts +13 -9
  96. package/esm/util/range.js +17 -8
  97. package/esm/util/rxjs.d.ts +16 -0
  98. package/esm/util/rxjs.js +49 -0
  99. package/esm/util/tabix.d.ts +10 -4
  100. package/esm/util/tabix.js +11 -5
  101. package/esm/util/tracks.d.ts +48 -0
  102. package/esm/util/tracks.js +192 -66
  103. package/esm/util/types/index.d.ts +48 -5
  104. package/esm/util/types/index.js +3 -0
  105. package/esm/util/unknownSnapshotKeys.d.ts +36 -0
  106. package/esm/util/unknownSnapshotKeys.js +69 -0
  107. package/esm/util/viewStatus.d.ts +23 -0
  108. package/esm/util/viewStatus.js +17 -0
  109. package/esm/util/whenViewSettled.d.ts +17 -4
  110. package/esm/util/whenViewSettled.js +19 -6
  111. package/esm/util/withLaunchInput.d.ts +123 -0
  112. package/esm/util/withLaunchInput.js +228 -0
  113. package/package.json +12 -9
  114. package/esm/util/applyInitSettings.d.ts +0 -79
  115. package/esm/util/applyInitSettings.js +0 -91
@@ -1,91 +0,0 @@
1
- import { applyPatch, getPropertyMembers } from '@jbrowse/mobx-state-tree';
2
- // Keys that are a view's identity or its plumbing rather than a setting. A
3
- // launch spec never gets to write these: `type` picks the view, `id` is passed
4
- // top-level so MST's optional identifier honors it, and `init` inside `init` is
5
- // the nesting mistake loadSessionSpec already reports.
6
- export const RESERVED_KEYS = ['id', 'type', 'init'];
7
- const RESERVED = new Set(RESERVED_KEYS);
8
- /**
9
- * Apply the plain-settings half of an `init` blob: every key naming a declared
10
- * MST property of `self` is written straight to it, and the caller handles only
11
- * the keys it names in `commands`.
12
- *
13
- * THE POINT IS THAT THERE IS NO PER-SETTING CODE. A view used to need a
14
- * hand-written `if (init.x !== undefined) self.setX(init.x)` arm per property,
15
- * so a new toggle worked from its menu the moment it was declared and was
16
- * dropped in silence from every authored surface — a session spec, a share
17
- * link, a config `defaultSession` — until someone remembered the second edit.
18
- * Nobody did: `drawLocationMarkers` shipped unauthorable, and DotplotView's
19
- * `alpha`/`drawCigar`/`lineWidth`/`lockAspectRatio` never had an arm at all.
20
- * Reading the property list off the model at runtime means declaring the
21
- * property IS declaring it authorable, including properties a composed mixin
22
- * brings in (colorBy, showColorLegend), and there is nothing left to keep in
23
- * sync.
24
- *
25
- * `commands` is what a launcher genuinely has to interpret: keys with no
26
- * property behind them (`loc`, `autoDiagonalize`), keys whose name collides
27
- * with a property meaning something else (a spec's `views` is a list of
28
- * assemblies to open; the model's `views` is the built rows), and keys with an
29
- * ordering constraint (`levelHeights` must land after the auto-scale pass).
30
- * Listing one is a decision to write code for it; everything else needs none.
31
- *
32
- * WRITTEN AS A PATCH, not through `setX`. Applying init is state restoration,
33
- * and the authority on that is MST: `applyPatch` validates each value against
34
- * the property's own type and touches nothing else, where `applySnapshot`
35
- * would rebuild the view's children. That it skips the setters is correct
36
- * rather than a shortcut — a session reload restores the same state from a
37
- * snapshot and calls no setters either, so a property needing a setter's side
38
- * effect to be correct is already broken on reload, and the effect belongs in a
39
- * reaction on the property.
40
- *
41
- * A value the property's type rejects is dropped and reported rather than
42
- * thrown: init blobs come from URLs, and one bad number should not cost the
43
- * reader the whole view.
44
- */
45
- export function applyInitSettings(self,
46
- // `object` rather than a keyed record: an init blob's static type is the
47
- // view's own `ViewInit`, which has named members and no index signature — by
48
- // design, so a typo is a compile error there — and that is not assignable to
49
- // `Record<string, unknown>`. This reads it by enumeration anyway.
50
- init, { commands = [] } = {}) {
51
- const report = { applied: [], unknown: [], invalid: [] };
52
- if (!init) {
53
- return report;
54
- }
55
- const skip = new Set(commands);
56
- const { properties } = getPropertyMembers(self);
57
- const patch = [];
58
- for (const [key, value] of Object.entries(init)) {
59
- if (skip.has(key) || RESERVED.has(key) || value === undefined) {
60
- continue;
61
- }
62
- const propType = properties[key];
63
- if (!propType) {
64
- report.unknown.push(key);
65
- }
66
- else if (!propType.is(value)) {
67
- report.invalid.push(key);
68
- }
69
- else {
70
- patch.push({ op: 'replace', path: `/${key}`, value });
71
- report.applied.push(key);
72
- }
73
- }
74
- if (patch.length) {
75
- applyPatch(self, patch);
76
- }
77
- return report;
78
- }
79
- /**
80
- * Say what `applyInitSettings` refused, naming the surface. Split from the
81
- * apply so a caller under test can assert the report without a console, and so
82
- * the two messages read the same wherever they come from.
83
- */
84
- export function warnInitSettings(surface, report) {
85
- if (report.unknown.length) {
86
- console.warn(`${surface} ignored unknown key(s): ${report.unknown.join(', ')}`);
87
- }
88
- if (report.invalid.length) {
89
- console.warn(`${surface} ignored key(s) with an invalid value: ${report.invalid.join(', ')}`);
90
- }
91
- }