@jbrowse/product-core 4.3.0 → 5.0.0-beta.10

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 (157) hide show
  1. package/esm/RootModel/BaseRootModel.d.ts +514 -323
  2. package/esm/RootModel/BaseRootModel.js +141 -14
  3. package/esm/RootModel/HierarchicalConfig.d.ts +30 -20
  4. package/esm/RootModel/HierarchicalConfig.js +36 -0
  5. package/esm/RootModel/InternetAccounts.d.ts +18 -1
  6. package/esm/RootModel/InternetAccounts.js +120 -22
  7. package/esm/RootModel/PreferencesConfig.d.ts +37 -0
  8. package/esm/RootModel/PreferencesConfig.js +75 -0
  9. package/esm/RootModel/createConfigModel.d.ts +257 -0
  10. package/esm/RootModel/createConfigModel.js +77 -0
  11. package/esm/RootModel/index.d.ts +10 -5
  12. package/esm/RootModel/index.js +10 -5
  13. package/esm/RootModel/menuItems.d.ts +24 -0
  14. package/esm/RootModel/menuItems.js +141 -0
  15. package/esm/Session/BaseSession.d.ts +285 -11
  16. package/esm/Session/BaseSession.js +383 -15
  17. package/esm/Session/Connections.d.ts +115 -8
  18. package/esm/Session/Connections.js +196 -74
  19. package/esm/Session/DrawerWidgets.d.ts +145 -13
  20. package/esm/Session/DrawerWidgets.js +219 -49
  21. package/esm/Session/MultipleViews.d.ts +1067 -1177
  22. package/esm/Session/MultipleViews.js +395 -64
  23. package/esm/Session/Preferences.d.ts +1389 -0
  24. package/esm/Session/Preferences.js +58 -0
  25. package/esm/Session/ReferenceManagement.d.ts +28 -3
  26. package/esm/Session/ReferenceManagement.js +56 -41
  27. package/esm/Session/SessionTracks.d.ts +1101 -1180
  28. package/esm/Session/SessionTracks.js +584 -34
  29. package/esm/Session/Themes.d.ts +136 -2
  30. package/esm/Session/Themes.js +267 -21
  31. package/esm/Session/TrackMenu.d.ts +88 -0
  32. package/esm/Session/TrackMenu.js +175 -0
  33. package/esm/Session/TrackMenuSessionMixin.d.ts +27 -0
  34. package/esm/Session/TrackMenuSessionMixin.js +42 -0
  35. package/esm/Session/Tracks.d.ts +945 -1159
  36. package/esm/Session/Tracks.js +229 -30
  37. package/esm/Session/assertSessionModel.d.ts +21 -0
  38. package/esm/Session/assertSessionModel.js +1 -0
  39. package/esm/Session/copyTrackSnapshot.d.ts +21 -0
  40. package/esm/Session/copyTrackSnapshot.js +20 -0
  41. package/esm/Session/developerMode.d.ts +7 -0
  42. package/esm/Session/developerMode.js +43 -0
  43. package/esm/Session/finalizeSession.d.ts +15 -0
  44. package/esm/Session/finalizeSession.js +28 -0
  45. package/esm/Session/hydratedForms.d.ts +16 -0
  46. package/esm/Session/hydratedForms.js +13 -0
  47. package/esm/Session/index.d.ts +27 -10
  48. package/esm/Session/index.js +16 -10
  49. package/esm/Session/pluginExtraTrackItems.d.ts +11 -0
  50. package/esm/Session/pluginExtraTrackItems.js +13 -0
  51. package/esm/Session/readdedTrackConf.d.ts +8 -0
  52. package/esm/Session/readdedTrackConf.js +24 -0
  53. package/esm/Session/shareableSnapshot.d.ts +23 -0
  54. package/esm/Session/shareableSnapshot.js +66 -0
  55. package/esm/Session/temporaryAssemblyTracks.d.ts +24 -0
  56. package/esm/Session/temporaryAssemblyTracks.js +37 -0
  57. package/esm/assertExtends.d.ts +55 -0
  58. package/esm/assertExtends.js +1 -0
  59. package/esm/controllerTracks.d.ts +76 -0
  60. package/esm/controllerTracks.js +125 -0
  61. package/esm/destroyViewState.d.ts +21 -0
  62. package/esm/destroyViewState.js +29 -0
  63. package/esm/embeddedController.d.ts +57 -0
  64. package/esm/embeddedController.js +100 -0
  65. package/esm/index.d.ts +32 -4
  66. package/esm/index.js +31 -4
  67. package/esm/loadPlugins.d.ts +38 -0
  68. package/esm/loadPlugins.js +45 -0
  69. package/esm/localFiles.d.ts +74 -0
  70. package/esm/localFiles.js +156 -0
  71. package/esm/observeSession.d.ts +55 -0
  72. package/esm/observeSession.js +90 -0
  73. package/esm/parallelChunkLoading.d.ts +30 -0
  74. package/esm/parallelChunkLoading.js +71 -0
  75. package/esm/pluginInput.d.ts +32 -0
  76. package/esm/pluginInput.js +19 -0
  77. package/esm/pruneUnbuildableNodes.d.ts +109 -0
  78. package/esm/pruneUnbuildableNodes.js +562 -0
  79. package/esm/resolveAssemblies.d.ts +68 -0
  80. package/esm/resolveAssemblies.js +77 -0
  81. package/esm/rpcWorker.d.ts +36 -4
  82. package/esm/rpcWorker.js +126 -20
  83. package/esm/sessionMigrations/index.d.ts +15 -0
  84. package/esm/sessionMigrations/index.js +178 -0
  85. package/esm/sessionUrl.d.ts +40 -0
  86. package/esm/sessionUrl.js +66 -0
  87. package/esm/sessionUtils.d.ts +74 -0
  88. package/esm/sessionUtils.js +599 -0
  89. package/esm/siblingCast.d.ts +14 -0
  90. package/esm/siblingCast.js +16 -0
  91. package/esm/snapshotUtils.d.ts +8 -0
  92. package/esm/snapshotUtils.js +12 -0
  93. package/esm/ui/AboutDialog.d.ts +8 -3
  94. package/esm/ui/AboutDialog.js +14 -5
  95. package/esm/ui/AboutDialogContents.d.ts +2 -6
  96. package/esm/ui/AboutDialogContents.js +13 -17
  97. package/esm/ui/AssemblyInfoPanel.d.ts +5 -0
  98. package/esm/ui/AssemblyInfoPanel.js +63 -0
  99. package/esm/ui/DescriptionPanel.d.ts +3 -0
  100. package/esm/ui/DescriptionPanel.js +25 -0
  101. package/esm/ui/Drawer.d.ts +21 -0
  102. package/esm/ui/Drawer.js +60 -0
  103. package/esm/ui/DrawerControls.d.ts +5 -0
  104. package/esm/ui/DrawerControls.js +28 -0
  105. package/esm/ui/DrawerHeader.d.ts +6 -0
  106. package/esm/ui/DrawerHeader.js +36 -0
  107. package/esm/ui/DrawerWidget.d.ts +5 -0
  108. package/esm/ui/DrawerWidget.js +12 -0
  109. package/esm/ui/DrawerWidgetSelector.d.ts +5 -0
  110. package/esm/ui/DrawerWidgetSelector.js +40 -0
  111. package/esm/ui/FileInfoPanel.d.ts +3 -6
  112. package/esm/ui/FileInfoPanel.js +36 -26
  113. package/esm/ui/GeneralPreferencesTab.d.ts +17 -0
  114. package/esm/ui/GeneralPreferencesTab.js +34 -0
  115. package/esm/ui/HeaderButtons.d.ts +2 -1
  116. package/esm/ui/HeaderButtons.js +15 -17
  117. package/esm/ui/ModalWidget.d.ts +13 -0
  118. package/esm/ui/ModalWidget.js +48 -0
  119. package/esm/ui/ModalWidgetAppBar.d.ts +8 -0
  120. package/esm/ui/ModalWidgetAppBar.js +9 -0
  121. package/esm/ui/PreferenceCheckbox.d.ts +6 -0
  122. package/esm/ui/PreferenceCheckbox.js +16 -0
  123. package/esm/ui/PreferencesDialog.d.ts +34 -0
  124. package/esm/ui/PreferencesDialog.js +55 -0
  125. package/esm/ui/PreferencesResetDialog.d.ts +8 -0
  126. package/esm/ui/PreferencesResetDialog.js +19 -0
  127. package/esm/ui/RefNameAliasesDialog.d.ts +9 -0
  128. package/esm/ui/RefNameAliasesDialog.js +65 -0
  129. package/esm/ui/RefNameInfoDialog.d.ts +3 -6
  130. package/esm/ui/RefNameInfoDialog.js +45 -63
  131. package/esm/ui/ViewPreferencesTab.d.ts +12 -0
  132. package/esm/ui/ViewPreferencesTab.js +15 -0
  133. package/esm/ui/WidgetBody.d.ts +18 -0
  134. package/esm/ui/WidgetBody.js +22 -0
  135. package/esm/ui/WidgetHeading.d.ts +7 -0
  136. package/esm/ui/WidgetHeading.js +7 -0
  137. package/esm/ui/aboutTestUtils.d.ts +140 -0
  138. package/esm/ui/aboutTestUtils.js +25 -0
  139. package/esm/ui/descriptionHtml.d.ts +25 -0
  140. package/esm/ui/descriptionHtml.js +64 -0
  141. package/esm/ui/drawerLayout.d.ts +18 -0
  142. package/esm/ui/drawerLayout.js +22 -0
  143. package/esm/ui/index.d.ts +15 -1
  144. package/esm/ui/index.js +13 -1
  145. package/esm/ui/preferencesReset.d.ts +18 -0
  146. package/esm/ui/preferencesReset.js +69 -0
  147. package/esm/ui/util.d.ts +22 -7
  148. package/esm/ui/util.js +19 -41
  149. package/esm/useEngineLifecycle.d.ts +19 -0
  150. package/esm/useEngineLifecycle.js +44 -0
  151. package/package.json +15 -18
  152. package/esm/RootModel/FormatAbout.d.ts +0 -12
  153. package/esm/RootModel/FormatAbout.js +0 -15
  154. package/esm/RootModel/FormatDetails.d.ts +0 -24
  155. package/esm/RootModel/FormatDetails.js +0 -27
  156. package/esm/Session/DialogQueue.d.ts +0 -17
  157. package/esm/Session/DialogQueue.js +0 -31
@@ -0,0 +1,66 @@
1
+ import { ENCODED_PREFIX, JSON_PREFIX, fromUrlSafeB64, toUrlSafeB64, } from '@jbrowse/core/util';
2
+ import { getShareableSessionSnapshot } from './Session/shareableSnapshot.js';
3
+ /**
4
+ * Serialize a live session into a compact, URL-safe string for a query param or
5
+ * hash fragment. Deflated then base64url-encoded, so it survives a URL intact
6
+ * and stays far smaller than raw JSON.
7
+ *
8
+ * Not a plain `getSnapshot`: a workspace arrangement turned on by the sender's
9
+ * preference is not in the snapshot, so a raw one renders as a classic stack
10
+ * for whoever opens the link. `getShareableSessionSnapshot` stamps it first.
11
+ *
12
+ * The session travels but the config does not — the receiving app supplies its
13
+ * own assembly/tracks. Put the result somewhere the server never sees (the hash
14
+ * fragment) if it may be long: a query string can exceed the request-line limit
15
+ * and get a 414, which is why jbrowse-web moved its own there.
16
+ *
17
+ * Carries `ENCODED_PREFIX`, the same `?session=encoded-…` value jbrowse-web's
18
+ * SessionLoader decodes, so a link built by an embedded product opens in
19
+ * jbrowse.org/jb2 and vice versa. The format is `encodeSessionParam`'s `long`
20
+ * mode; sessionUrl.test.ts asserts the two stay byte-identical.
21
+ */
22
+ export async function encodeSessionToUrl(session) {
23
+ const snap = getShareableSessionSnapshot(session);
24
+ return `${ENCODED_PREFIX}${await toUrlSafeB64(JSON.stringify(snap))}`;
25
+ }
26
+ function isSessionSnapshot(value) {
27
+ return (typeof value === 'object' &&
28
+ value !== null &&
29
+ !Array.isArray(value) &&
30
+ 'name' in value &&
31
+ typeof value.name === 'string');
32
+ }
33
+ // A clipped `json-` link still parses up to the cut, so without this the
34
+ // recipient reads JSON.parse's "Unterminated string in JSON at position 813"
35
+ function parseJsonParam(json) {
36
+ try {
37
+ return JSON.parse(json)?.session;
38
+ }
39
+ catch (e) {
40
+ throw new Error("This link's session JSON is incomplete, which is how a link cut short in transit arrives. A short link survives being sent where a long one may not.", { cause: e });
41
+ }
42
+ }
43
+ async function parseEncodedParam(value) {
44
+ return JSON.parse(await fromUrlSafeB64(value.startsWith(ENCODED_PREFIX)
45
+ ? value.slice(ENCODED_PREFIX.length)
46
+ : value));
47
+ }
48
+ /**
49
+ * Inverse of {@link encodeSessionToUrl}, and of the `json-` form jbrowse-web's
50
+ * share dialog writes. Accepts an `encoded-` value with or without its prefix,
51
+ * so a raw `?session=` value from either app passes straight through.
52
+ *
53
+ * Throws on anything that isn't a decodable session — a truncated link, or a
54
+ * `share-`/`spec-` param an embedded product doesn't handle — so a host can
55
+ * fall back to its own declarative launch state instead of opening a
56
+ * half-built session.
57
+ */
58
+ export async function decodeSessionFromUrl(value) {
59
+ const parsed = value.startsWith(JSON_PREFIX)
60
+ ? parseJsonParam(value.slice(JSON_PREFIX.length))
61
+ : await parseEncodedParam(value);
62
+ if (!isSessionSnapshot(parsed)) {
63
+ throw new Error('not a session snapshot: no "name"');
64
+ }
65
+ return parsed;
66
+ }
@@ -0,0 +1,74 @@
1
+ import type { HydratedForms } from './Session/hydratedForms.ts';
2
+ import type { PluginDefinition } from '@jbrowse/core/pluginDefinitions';
3
+ import type { IAnyStateTreeNode, IAnyType } from '@jbrowse/mobx-state-tree';
4
+ export interface DroppedSessionNode {
5
+ type?: string;
6
+ configuration?: string;
7
+ }
8
+ export declare function filterSessionInPlace(node: IAnyStateTreeNode, type: IAnyType, dropped?: DroppedSessionNode[]): DroppedSessionNode[];
9
+ export interface NonPortableLocation {
10
+ locationType: string;
11
+ name: string;
12
+ trackId?: string;
13
+ trackName?: string;
14
+ }
15
+ export interface WebPortabilityReport {
16
+ nonPortable: NonPortableLocation[];
17
+ portable: boolean;
18
+ }
19
+ export declare function analyzeWebPortability(snapshot: unknown): WebPortabilityReport;
20
+ export interface TrackSnapshot {
21
+ trackId: string;
22
+ [key: string]: unknown;
23
+ }
24
+ export interface WebExportInput {
25
+ assemblies?: AssemblySnapshot[];
26
+ tracks?: TrackSnapshot[];
27
+ plugins?: PluginDefinition[];
28
+ connections?: unknown[];
29
+ configuration?: {
30
+ sourceConfigUrl?: string;
31
+ webExportUrl?: string;
32
+ };
33
+ defaultSession?: Record<string, unknown>;
34
+ }
35
+ export interface AssemblySnapshot {
36
+ name: string;
37
+ [key: string]: unknown;
38
+ }
39
+ export interface HostedBaseConfig {
40
+ assemblies?: AssemblySnapshot[];
41
+ tracks?: TrackSnapshot[];
42
+ internetAccounts?: {
43
+ internetAccountId?: string;
44
+ }[];
45
+ plugins?: PluginDefinition[];
46
+ connections?: unknown[];
47
+ configuration?: {
48
+ shareURL?: string;
49
+ };
50
+ [key: string]: unknown;
51
+ }
52
+ export interface HostedBase {
53
+ config: HostedBaseConfig;
54
+ forms: HydratedForms;
55
+ }
56
+ export interface WebExportPlan {
57
+ strategy: 'hostedConfigBase' | 'selfContained';
58
+ configUrl?: string;
59
+ webBaseUrl: string;
60
+ session: Record<string, unknown>;
61
+ droppedTracks: string[];
62
+ blockingFiles: string[];
63
+ selfContainedReason?: SelfContainedReason;
64
+ droppedTextIndexes: string[];
65
+ revertedAssemblies: string[];
66
+ unavailableAccounts: string[];
67
+ }
68
+ export type SelfContainedReason = 'noSourceConfig' | 'baseUnreachable' | 'assembliesNotInBase';
69
+ export declare function planWebExport(snapshot: WebExportInput, base?: HostedBase): WebExportPlan;
70
+ export declare const DEFAULT_WEB_BASE_URL = "https://jbrowse.org/code/jb2/latest/";
71
+ export declare function buildWebExportUrl(plan: Pick<WebExportPlan, 'webBaseUrl' | 'configUrl'>, sessionParam: string, options?: {
72
+ password?: string;
73
+ exportedFrom?: string;
74
+ }): string;