@jbrowse/plugin-circular-view 3.7.0 → 4.0.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.
Files changed (73) hide show
  1. package/esm/CircularView/components/CircularView.d.ts +2 -2
  2. package/esm/CircularView/components/CircularView.js +21 -15
  3. package/esm/CircularView/components/Controls.d.ts +2 -2
  4. package/esm/CircularView/components/Controls.js +3 -3
  5. package/esm/CircularView/components/ExportSvgDialog.d.ts +1 -1
  6. package/esm/CircularView/components/ImportForm.d.ts +2 -2
  7. package/esm/CircularView/components/ImportForm.js +4 -4
  8. package/esm/CircularView/components/Ruler.d.ts +2 -2
  9. package/esm/CircularView/components/Ruler.js +7 -7
  10. package/esm/CircularView/index.js +2 -2
  11. package/esm/CircularView/model.d.ts +73 -34
  12. package/esm/CircularView/model.js +146 -54
  13. package/esm/CircularView/slices.js +9 -1
  14. package/esm/CircularView/svgcomponents/SVGCircularView.d.ts +1 -1
  15. package/esm/CircularView/svgcomponents/SVGCircularView.js +3 -4
  16. package/esm/LaunchCircularView/index.js +6 -12
  17. package/esm/index.d.ts +1 -2
  18. package/esm/index.js +4 -7
  19. package/package.json +26 -32
  20. package/dist/BaseChordDisplay/components/BaseChordDisplay.d.ts +0 -11
  21. package/dist/BaseChordDisplay/components/BaseChordDisplay.js +0 -21
  22. package/dist/BaseChordDisplay/components/DisplayError.d.ts +0 -9
  23. package/dist/BaseChordDisplay/components/DisplayError.js +0 -9
  24. package/dist/BaseChordDisplay/components/Loading.d.ts +0 -8
  25. package/dist/BaseChordDisplay/components/Loading.js +0 -62
  26. package/dist/BaseChordDisplay/configSchema.d.ts +0 -9
  27. package/dist/BaseChordDisplay/configSchema.js +0 -16
  28. package/dist/BaseChordDisplay/index.d.ts +0 -3
  29. package/dist/BaseChordDisplay/index.js +0 -12
  30. package/dist/BaseChordDisplay/model.d.ts +0 -109
  31. package/dist/BaseChordDisplay/model.js +0 -166
  32. package/dist/BaseChordDisplay/renderReaction.d.ts +0 -27
  33. package/dist/BaseChordDisplay/renderReaction.js +0 -50
  34. package/dist/CircularView/components/CircularView.d.ts +0 -5
  35. package/dist/CircularView/components/CircularView.js +0 -60
  36. package/dist/CircularView/components/Controls.d.ts +0 -5
  37. package/dist/CircularView/components/Controls.js +0 -57
  38. package/dist/CircularView/components/ExportSvgDialog.d.ts +0 -7
  39. package/dist/CircularView/components/ExportSvgDialog.js +0 -53
  40. package/dist/CircularView/components/ImportForm.d.ts +0 -5
  41. package/dist/CircularView/components/ImportForm.js +0 -35
  42. package/dist/CircularView/components/Ruler.d.ts +0 -7
  43. package/dist/CircularView/components/Ruler.js +0 -106
  44. package/dist/CircularView/index.d.ts +0 -2
  45. package/dist/CircularView/index.js +0 -50
  46. package/dist/CircularView/model.d.ts +0 -107
  47. package/dist/CircularView/model.js +0 -376
  48. package/dist/CircularView/slices.d.ts +0 -45
  49. package/dist/CircularView/slices.js +0 -57
  50. package/dist/CircularView/svgcomponents/SVGBackground.d.ts +0 -5
  51. package/dist/CircularView/svgcomponents/SVGBackground.js +0 -10
  52. package/dist/CircularView/svgcomponents/SVGCircularView.d.ts +0 -4
  53. package/dist/CircularView/svgcomponents/SVGCircularView.js +0 -31
  54. package/dist/CircularView/viewportVisibleRegion.d.ts +0 -6
  55. package/dist/CircularView/viewportVisibleRegion.js +0 -153
  56. package/dist/LaunchCircularView/index.d.ts +0 -2
  57. package/dist/LaunchCircularView/index.js +0 -22
  58. package/dist/index.d.ts +0 -9
  59. package/dist/index.js +0 -37
  60. package/esm/BaseChordDisplay/components/BaseChordDisplay.d.ts +0 -11
  61. package/esm/BaseChordDisplay/components/BaseChordDisplay.js +0 -16
  62. package/esm/BaseChordDisplay/components/DisplayError.d.ts +0 -9
  63. package/esm/BaseChordDisplay/components/DisplayError.js +0 -7
  64. package/esm/BaseChordDisplay/components/Loading.d.ts +0 -8
  65. package/esm/BaseChordDisplay/components/Loading.js +0 -60
  66. package/esm/BaseChordDisplay/configSchema.d.ts +0 -9
  67. package/esm/BaseChordDisplay/configSchema.js +0 -13
  68. package/esm/BaseChordDisplay/index.d.ts +0 -3
  69. package/esm/BaseChordDisplay/index.js +0 -3
  70. package/esm/BaseChordDisplay/model.d.ts +0 -109
  71. package/esm/BaseChordDisplay/model.js +0 -163
  72. package/esm/BaseChordDisplay/renderReaction.d.ts +0 -27
  73. package/esm/BaseChordDisplay/renderReaction.js +0 -46
@@ -3,23 +3,31 @@ import { readConfObject } from '@jbrowse/core/configuration';
3
3
  import { BaseViewModel } from '@jbrowse/core/pluggableElementTypes/models';
4
4
  import { TrackSelector as TrackSelectorIcon } from '@jbrowse/core/ui/Icons';
5
5
  import { clamp, getSession, isSessionModelWithWidgets, } from '@jbrowse/core/util';
6
+ import { hideTrackGeneric, showTrackGeneric, toggleTrackGeneric, } from '@jbrowse/core/util/tracks';
7
+ import { addDisposer, cast, types } from '@jbrowse/mobx-state-tree';
6
8
  import FolderOpenIcon from '@mui/icons-material/FolderOpen';
7
9
  import PhotoCameraIcon from '@mui/icons-material/PhotoCamera';
8
- import { saveAs } from 'file-saver';
9
- import { transaction } from 'mobx';
10
- import { cast, getRoot, resolveIdentifier, types } from 'mobx-state-tree';
11
- import { calculateStaticSlices, sliceIsVisible } from './slices';
12
- import { viewportVisibleSection } from './viewportVisibleRegion';
13
- const ExportSvgDialog = lazy(() => import('./components/ExportSvgDialog'));
10
+ import { autorun } from 'mobx';
11
+ import { calculateStaticSlices, sliceIsVisible } from "./slices.js";
12
+ import { viewportVisibleSection } from "./viewportVisibleRegion.js";
13
+ const ExportSvgDialog = lazy(() => import("./components/ExportSvgDialog.js"));
14
14
  function stateModelFactory(pluginManager) {
15
15
  const minHeight = 40;
16
16
  const minWidth = 100;
17
17
  const defaultHeight = 400;
18
+ const defaultOffsetRadians = -Math.PI / 2;
19
+ const defaultBpPerPx = 200;
20
+ const defaultMinimumRadiusPx = 25;
21
+ const defaultSpacingPx = 10;
22
+ const defaultPaddingPx = 80;
23
+ const defaultLockedPaddingPx = 100;
24
+ const defaultMinVisibleWidth = 6;
25
+ const defaultMinimumBlockWidth = 20;
18
26
  return types
19
27
  .compose('CircularView', BaseViewModel, types.model({
20
28
  type: types.literal('CircularView'),
21
- offsetRadians: -Math.PI / 2,
22
- bpPerPx: 200,
29
+ offsetRadians: defaultOffsetRadians,
30
+ bpPerPx: defaultBpPerPx,
23
31
  tracks: types.array(pluginManager.pluggableMstType('track', 'stateModel')),
24
32
  hideVerticalResizeHandle: false,
25
33
  hideTrackSelectorButton: false,
@@ -29,17 +37,18 @@ function stateModelFactory(pluginManager) {
29
37
  displayedRegions: types.optional(types.frozen(), []),
30
38
  scrollX: 0,
31
39
  scrollY: 0,
32
- minimumRadiusPx: 25,
33
- spacingPx: 10,
34
- paddingPx: 80,
35
- lockedPaddingPx: 100,
36
- minVisibleWidth: 6,
37
- minimumBlockWidth: 20,
40
+ minimumRadiusPx: defaultMinimumRadiusPx,
41
+ spacingPx: defaultSpacingPx,
42
+ paddingPx: defaultPaddingPx,
43
+ lockedPaddingPx: defaultLockedPaddingPx,
44
+ minVisibleWidth: defaultMinVisibleWidth,
45
+ minimumBlockWidth: defaultMinimumBlockWidth,
38
46
  trackSelectorType: 'hierarchical',
47
+ init: types.frozen(),
39
48
  }))
40
49
  .volatile(() => ({
41
50
  volatileWidth: undefined,
42
- error: undefined,
51
+ volatileError: undefined,
43
52
  }))
44
53
  .views(self => ({
45
54
  get width() {
@@ -119,7 +128,7 @@ function stateModelFactory(pluginManager) {
119
128
  const widthPx = widthBp / self.bpPerPx;
120
129
  if (widthPx < self.minVisibleWidth) {
121
130
  const lastVisible = visible.at(-1);
122
- if (lastVisible === null || lastVisible === void 0 ? void 0 : lastVisible.elided) {
131
+ if (lastVisible?.elided) {
123
132
  lastVisible.regions.push({ ...region });
124
133
  lastVisible.widthBp += widthBp;
125
134
  }
@@ -153,9 +162,59 @@ function stateModelFactory(pluginManager) {
153
162
  return assemblyNames;
154
163
  },
155
164
  get initialized() {
165
+ if (self.volatileWidth === undefined) {
166
+ return false;
167
+ }
168
+ const { assemblyManager } = getSession(self);
169
+ if (self.init) {
170
+ const asm = assemblyManager.get(self.init.assembly);
171
+ return !!(asm?.initialized && asm.regions);
172
+ }
173
+ return this.assemblyNames.every(a => assemblyManager.get(a)?.initialized);
174
+ },
175
+ get assemblyErrors() {
156
176
  const { assemblyManager } = getSession(self);
157
- return (self.volatileWidth !== undefined &&
158
- this.assemblyNames.every(a => { var _a; return (_a = assemblyManager.get(a)) === null || _a === void 0 ? void 0 : _a.initialized; }));
177
+ return this.assemblyNames
178
+ .map(a => assemblyManager.get(a)?.error)
179
+ .filter(f => !!f)
180
+ .join(', ');
181
+ },
182
+ get error() {
183
+ if (self.volatileError) {
184
+ return self.volatileError;
185
+ }
186
+ if (this.assemblyErrors) {
187
+ return this.assemblyErrors;
188
+ }
189
+ if (self.init) {
190
+ const { assemblyManager } = getSession(self);
191
+ const asm = assemblyManager.get(self.init.assembly);
192
+ if (asm?.error) {
193
+ return asm.error;
194
+ }
195
+ if (!asm) {
196
+ return `Assembly ${self.init.assembly} not found`;
197
+ }
198
+ }
199
+ return undefined;
200
+ },
201
+ get loadingMessage() {
202
+ return this.showLoading ? 'Loading' : undefined;
203
+ },
204
+ get hasSomethingToShow() {
205
+ return self.displayedRegions.length > 0 || !!self.init;
206
+ },
207
+ get showLoading() {
208
+ return !this.initialized && !this.error && this.hasSomethingToShow;
209
+ },
210
+ get showView() {
211
+ return (!!self.displayedRegions.length &&
212
+ !!this.figureWidth &&
213
+ !!this.figureHeight &&
214
+ this.initialized);
215
+ },
216
+ get showImportForm() {
217
+ return ((!this.hasSomethingToShow && !self.disableImportForm) || !!this.error);
159
218
  },
160
219
  }))
161
220
  .views(self => ({
@@ -237,33 +296,16 @@ function stateModelFactory(pluginManager) {
237
296
  throw new Error(`invalid track selector type ${self.trackSelectorType}`);
238
297
  },
239
298
  toggleTrack(trackId) {
240
- const hiddenCount = this.hideTrack(trackId);
241
- if (!hiddenCount) {
242
- this.showTrack(trackId);
243
- return true;
244
- }
245
- return false;
299
+ toggleTrackGeneric(self, trackId);
246
300
  },
247
301
  setError(error) {
248
- self.error = error;
302
+ self.volatileError = error;
303
+ },
304
+ setInit(init) {
305
+ self.init = init;
249
306
  },
250
307
  showTrack(trackId, initialSnapshot = {}) {
251
- const schema = pluginManager.pluggableConfigSchemaType('track');
252
- const conf = resolveIdentifier(schema, getRoot(self), trackId);
253
- const trackType = pluginManager.getTrackType(conf.type);
254
- if (!trackType) {
255
- throw new Error(`unknown track type ${conf.type}`);
256
- }
257
- const viewType = pluginManager.getViewType(self.type);
258
- const supportedDisplays = new Set(viewType.displayTypes.map(d => d.name));
259
- const displayConf = conf.displays.find((d) => supportedDisplays.has(d.type));
260
- const track = trackType.stateModel.create({
261
- ...initialSnapshot,
262
- type: conf.type,
263
- configuration: conf,
264
- displays: [{ type: displayConf.type, configuration: displayConf }],
265
- });
266
- self.tracks.push(track);
308
+ showTrackGeneric(self, trackId, initialSnapshot);
267
309
  },
268
310
  addTrackConf(configuration, initialSnapshot = {}) {
269
311
  const { type } = configuration;
@@ -284,15 +326,7 @@ function stateModelFactory(pluginManager) {
284
326
  }));
285
327
  },
286
328
  hideTrack(trackId) {
287
- const schema = pluginManager.pluggableConfigSchemaType('track');
288
- const conf = resolveIdentifier(schema, getRoot(self), trackId);
289
- const tracks = self.tracks.filter(t => t.configuration === conf);
290
- transaction(() => {
291
- for (const track of tracks) {
292
- self.tracks.remove(track);
293
- }
294
- });
295
- return tracks.length;
329
+ hideTrackGeneric(self, trackId);
296
330
  },
297
331
  toggleFitToWindowLock() {
298
332
  self.lockedFitToWindow = !self.lockedFitToWindow;
@@ -300,10 +334,34 @@ function stateModelFactory(pluginManager) {
300
334
  return self.lockedFitToWindow;
301
335
  },
302
336
  async exportSvg(opts = {}) {
303
- const { renderToSvg } = await import('./svgcomponents/SVGCircularView');
337
+ const { renderToSvg } = await import("./svgcomponents/SVGCircularView.js");
304
338
  const html = await renderToSvg(self, opts);
305
- const blob = new Blob([html], { type: 'image/svg+xml' });
306
- saveAs(blob, opts.filename || 'image.svg');
339
+ const { saveAs } = await import('file-saver-es');
340
+ saveAs(new Blob([html], { type: 'image/svg+xml' }), opts.filename || 'image.svg');
341
+ },
342
+ }))
343
+ .actions(self => ({
344
+ afterAttach() {
345
+ addDisposer(self, autorun(function circularViewInitAutorun() {
346
+ const { init, initialized } = self;
347
+ if (!initialized) {
348
+ return;
349
+ }
350
+ if (init) {
351
+ const session = getSession(self);
352
+ const { assemblyManager } = session;
353
+ const regions = assemblyManager.get(init.assembly)?.regions;
354
+ if (regions) {
355
+ self.setDisplayedRegions(regions);
356
+ }
357
+ if (init.tracks) {
358
+ for (const trackId of init.tracks) {
359
+ self.showTrack(trackId);
360
+ }
361
+ }
362
+ self.setInit(undefined);
363
+ }
364
+ }, { name: 'CircularViewInit' }));
307
365
  },
308
366
  }))
309
367
  .views(self => ({
@@ -333,6 +391,40 @@ function stateModelFactory(pluginManager) {
333
391
  },
334
392
  ];
335
393
  },
336
- }));
394
+ }))
395
+ .postProcessSnapshot(snap => {
396
+ if (!snap) {
397
+ return snap;
398
+ }
399
+ const { init, offsetRadians, bpPerPx, hideVerticalResizeHandle, hideTrackSelectorButton, lockedFitToWindow, disableImportForm, height, displayedRegions, scrollX, scrollY, minimumRadiusPx, spacingPx, paddingPx, lockedPaddingPx, minVisibleWidth, minimumBlockWidth, trackSelectorType, ...rest } = snap;
400
+ return {
401
+ ...rest,
402
+ ...(offsetRadians !== defaultOffsetRadians ? { offsetRadians } : {}),
403
+ ...(bpPerPx !== defaultBpPerPx ? { bpPerPx } : {}),
404
+ ...(hideVerticalResizeHandle ? { hideVerticalResizeHandle } : {}),
405
+ ...(hideTrackSelectorButton ? { hideTrackSelectorButton } : {}),
406
+ ...(!lockedFitToWindow ? { lockedFitToWindow } : {}),
407
+ ...(disableImportForm ? { disableImportForm } : {}),
408
+ ...(height !== defaultHeight ? { height } : {}),
409
+ ...(displayedRegions.length ? { displayedRegions } : {}),
410
+ ...(scrollX ? { scrollX } : {}),
411
+ ...(scrollY ? { scrollY } : {}),
412
+ ...(minimumRadiusPx !== defaultMinimumRadiusPx
413
+ ? { minimumRadiusPx }
414
+ : {}),
415
+ ...(spacingPx !== defaultSpacingPx ? { spacingPx } : {}),
416
+ ...(paddingPx !== defaultPaddingPx ? { paddingPx } : {}),
417
+ ...(lockedPaddingPx !== defaultLockedPaddingPx
418
+ ? { lockedPaddingPx }
419
+ : {}),
420
+ ...(minVisibleWidth !== defaultMinVisibleWidth
421
+ ? { minVisibleWidth }
422
+ : {}),
423
+ ...(minimumBlockWidth !== defaultMinimumBlockWidth
424
+ ? { minimumBlockWidth }
425
+ : {}),
426
+ ...(trackSelectorType !== 'hierarchical' ? { trackSelectorType } : {}),
427
+ };
428
+ });
337
429
  }
338
430
  export default stateModelFactory;
@@ -1,6 +1,14 @@
1
1
  import { assembleLocString, polarToCartesian } from '@jbrowse/core/util';
2
- import { thetaRangesOverlap } from './viewportVisibleRegion';
2
+ import { thetaRangesOverlap } from "./viewportVisibleRegion.js";
3
3
  export class Slice {
4
+ region;
5
+ offsetRadians;
6
+ radianWidth;
7
+ key;
8
+ startRadians;
9
+ endRadians;
10
+ bpPerRadian;
11
+ flipped;
4
12
  constructor(view, region, offsetRadians, radianWidth) {
5
13
  this.region = region;
6
14
  this.offsetRadians = offsetRadians;
@@ -1,4 +1,4 @@
1
- import type { CircularViewModel, ExportSvgOptions } from '../model';
1
+ import type { CircularViewModel, ExportSvgOptions } from '../model.ts';
2
2
  type CGV = CircularViewModel;
3
3
  export declare function renderToSvg(model: CGV, opts: ExportSvgOptions): Promise<string>;
4
4
  export {};
@@ -4,14 +4,13 @@ import { createJBrowseTheme } from '@jbrowse/core/ui';
4
4
  import { getSession, radToDeg, renderToStaticMarkup } from '@jbrowse/core/util';
5
5
  import { ThemeProvider } from '@mui/material';
6
6
  import { when } from 'mobx';
7
- import SVGBackground from './SVGBackground';
8
- import Ruler from '../components/Ruler';
7
+ import SVGBackground from "./SVGBackground.js";
8
+ import Ruler from "../components/Ruler.js";
9
9
  export async function renderToSvg(model, opts) {
10
- var _a;
11
10
  await when(() => model.initialized);
12
11
  const { themeName = 'default', Wrapper = ({ children }) => children } = opts;
13
12
  const session = getSession(model);
14
- const theme = (_a = session.allThemes) === null || _a === void 0 ? void 0 : _a.call(session)[themeName];
13
+ const theme = session.allThemes?.()[themeName];
15
14
  const { width, tracks, height } = model;
16
15
  const shift = 50;
17
16
  const displayResults = await Promise.all(tracks.map(async (track) => {
@@ -1,19 +1,13 @@
1
- import { when } from 'mobx';
2
1
  export default function LaunchCircularViewF(pluginManager) {
3
2
  pluginManager.addToExtensionPoint('LaunchView-CircularView', async ({ session, assembly, tracks = [], }) => {
4
- const { assemblyManager } = session;
5
- const view = session.addView('CircularView', {});
6
- await when(() => view.initialized);
7
3
  if (!assembly) {
8
4
  throw new Error('No assembly provided when launching circular genome view');
9
5
  }
10
- const asm = await assemblyManager.waitForAssembly(assembly);
11
- if (!asm) {
12
- throw new Error(`Assembly "${assembly}" not found when launching circular genome view`);
13
- }
14
- view.setDisplayedRegions(asm.regions || []);
15
- for (const track of tracks) {
16
- view.showTrack(track);
17
- }
6
+ session.addView('CircularView', {
7
+ init: {
8
+ assembly,
9
+ tracks,
10
+ },
11
+ });
18
12
  });
19
13
  }
package/esm/index.d.ts CHANGED
@@ -5,5 +5,4 @@ export default class CircularViewPlugin extends Plugin {
5
5
  install(pluginManager: PluginManager): void;
6
6
  configure(pluginManager: PluginManager): void;
7
7
  }
8
- export { BaseChordDisplayComponent, BaseChordDisplayModel, baseChordDisplayConfig, } from './BaseChordDisplay';
9
- export { type CircularViewModel, type CircularViewStateModel, } from './CircularView/model';
8
+ export { type CircularViewModel, type CircularViewStateModel, type ExportSvgOptions, } from './CircularView/model.ts';
package/esm/index.js CHANGED
@@ -1,13 +1,10 @@
1
1
  import Plugin from '@jbrowse/core/Plugin';
2
2
  import { isAbstractMenuManager } from '@jbrowse/core/util';
3
3
  import DataUsageIcon from '@mui/icons-material/DataUsage';
4
- import CircularViewF from './CircularView';
5
- import LaunchCircularViewF from './LaunchCircularView';
4
+ import CircularViewF from "./CircularView/index.js";
5
+ import LaunchCircularViewF from "./LaunchCircularView/index.js";
6
6
  export default class CircularViewPlugin extends Plugin {
7
- constructor() {
8
- super(...arguments);
9
- this.name = 'CircularViewPlugin';
10
- }
7
+ name = 'CircularViewPlugin';
11
8
  install(pluginManager) {
12
9
  CircularViewF(pluginManager);
13
10
  LaunchCircularViewF(pluginManager);
@@ -24,4 +21,4 @@ export default class CircularViewPlugin extends Plugin {
24
21
  }
25
22
  }
26
23
  }
27
- export { BaseChordDisplayComponent, BaseChordDisplayModel, baseChordDisplayConfig, } from './BaseChordDisplay';
24
+ export {} from "./CircularView/model.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-circular-view",
3
- "version": "3.7.0",
3
+ "version": "4.0.0",
4
4
  "description": "JBrowse 2 circular view",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -15,36 +15,19 @@
15
15
  "directory": "plugins/circular-view"
16
16
  },
17
17
  "author": "JBrowse Team",
18
- "distMain": "dist/index.js",
19
- "srcMain": "src/index.ts",
20
- "main": "dist/index.js",
18
+ "main": "esm/index.js",
21
19
  "files": [
22
- "dist",
23
20
  "esm"
24
21
  ],
25
- "scripts": {
26
- "build": "npm-run-all build:*",
27
- "test": "cd ../..; jest --passWithNoTests plugins/circular-view",
28
- "prepublishOnly": "yarn test",
29
- "prepack": "yarn build && yarn useDist",
30
- "postpack": "yarn useSrc",
31
- "useDist": "node ../../scripts/useDist.js",
32
- "useSrc": "node ../../scripts/useSrc.js",
33
- "prebuild": "npm run clean",
34
- "build:esm": "tsc --build tsconfig.build.esm.json",
35
- "build:commonjs": "tsc --build tsconfig.build.commonjs.json",
36
- "clean": "rimraf dist esm *.tsbuildinfo"
37
- },
38
22
  "dependencies": {
39
- "@jbrowse/core": "^3.7.0",
40
- "@mui/icons-material": "^7.0.0",
41
- "@mui/material": "^7.0.0",
42
- "@types/file-saver": "^2.0.0",
43
- "file-saver": "^2.0.0",
44
- "mobx": "^6.0.0",
45
- "mobx-react": "^9.0.0",
46
- "mobx-state-tree": "^5.0.0",
47
- "tss-react": "^4.0.0"
23
+ "@jbrowse/mobx-state-tree": "^5.5.0",
24
+ "@mui/icons-material": "^7.3.6",
25
+ "@mui/material": "^7.3.6",
26
+ "@types/file-saver-es": "^2.0.3",
27
+ "file-saver-es": "^2.0.5",
28
+ "mobx": "^6.15.0",
29
+ "mobx-react": "^9.2.1",
30
+ "@jbrowse/core": "^4.0.0"
48
31
  },
49
32
  "peerDependencies": {
50
33
  "react": ">=18.0.0",
@@ -53,8 +36,19 @@
53
36
  "publishConfig": {
54
37
  "access": "public"
55
38
  },
56
- "distModule": "esm/index.js",
57
- "srcModule": "src/index.ts",
58
- "module": "esm/index.js",
59
- "gitHead": "85bdd0d58286b7adbfd408146b15847676317635"
60
- }
39
+ "sideEffects": false,
40
+ "scripts": {
41
+ "build": "pnpm run /^build:/",
42
+ "test": "cd ../..; jest --passWithNoTests plugins/circular-view",
43
+ "prebuild": "pnpm clean",
44
+ "build:esm": "tsc -p tsconfig.build.esm.json",
45
+ "clean": "rimraf esm *.tsbuildinfo"
46
+ },
47
+ "types": "esm/index.d.ts",
48
+ "exports": {
49
+ ".": {
50
+ "types": "./esm/index.d.ts",
51
+ "import": "./esm/index.js"
52
+ }
53
+ }
54
+ }
@@ -1,11 +0,0 @@
1
- declare const BaseChordDisplay: ({ display, }: {
2
- display: {
3
- filled: boolean;
4
- error: unknown;
5
- reactElement: React.ReactElement;
6
- renderProps: {
7
- radius: number;
8
- };
9
- };
10
- }) => import("react/jsx-runtime").JSX.Element;
11
- export default BaseChordDisplay;
@@ -1,21 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const jsx_runtime_1 = require("react/jsx-runtime");
7
- const mobx_react_1 = require("mobx-react");
8
- const DisplayError_1 = __importDefault(require("./DisplayError"));
9
- const Loading_1 = __importDefault(require("./Loading"));
10
- const BaseChordDisplay = (0, mobx_react_1.observer)(function ({ display, }) {
11
- if (display.error) {
12
- return (0, jsx_runtime_1.jsx)(DisplayError_1.default, { model: display });
13
- }
14
- else if (!display.filled) {
15
- return (0, jsx_runtime_1.jsx)(Loading_1.default, { model: display });
16
- }
17
- else {
18
- return display.reactElement;
19
- }
20
- });
21
- exports.default = BaseChordDisplay;
@@ -1,9 +0,0 @@
1
- declare const DisplayError: ({ model, }: {
2
- model: {
3
- renderProps: {
4
- radius: number;
5
- };
6
- error: unknown;
7
- };
8
- }) => import("react/jsx-runtime").JSX.Element;
9
- export default DisplayError;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const jsx_runtime_1 = require("react/jsx-runtime");
4
- const mobx_react_1 = require("mobx-react");
5
- const DisplayError = (0, mobx_react_1.observer)(function ({ model, }) {
6
- const { renderProps: { radius }, error, } = model;
7
- return ((0, jsx_runtime_1.jsxs)("g", { children: [(0, jsx_runtime_1.jsx)("defs", { children: (0, jsx_runtime_1.jsx)("pattern", { id: "diagonalHatch", width: "10", height: "10", patternTransform: "rotate(45 0 0)", patternUnits: "userSpaceOnUse", children: (0, jsx_runtime_1.jsx)("line", { x1: "0", y1: "0", x2: "0", y2: "10", style: { stroke: 'rgba(255,0,0,0.5)', strokeWidth: 10 } }) }) }), (0, jsx_runtime_1.jsx)("circle", { cx: "0", cy: "0", r: radius, fill: "#ffb4b4" }), (0, jsx_runtime_1.jsx)("circle", { cx: "0", cy: "0", r: radius, fill: "url(#diagonalHatch)" }), (0, jsx_runtime_1.jsx)("text", { x: "0", y: "0", transform: "rotate(90 0 0)", dominantBaseline: "middle", textAnchor: "middle", children: String(error) })] }));
8
- });
9
- exports.default = DisplayError;
@@ -1,8 +0,0 @@
1
- declare const Loading: ({ model: { renderProps: { radius }, }, }: {
2
- model: {
3
- renderProps: {
4
- radius: number;
5
- };
6
- };
7
- }) => import("react/jsx-runtime").JSX.Element | null;
8
- export default Loading;
@@ -1,62 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const jsx_runtime_1 = require("react/jsx-runtime");
4
- const react_1 = require("react");
5
- const mobx_react_1 = require("mobx-react");
6
- const mui_1 = require("tss-react/mui");
7
- const useStyles = (0, mui_1.makeStyles)()(theme => {
8
- const offset = 2;
9
- const duration = 1.4;
10
- const { primary, secondary, tertiary, quaternary } = theme.palette;
11
- return {
12
- path: {
13
- strokeDasharray: 187,
14
- strokeDashoffset: 50,
15
- animation: `$dash ${duration}s ease-in-out infinite, $colors ${duration * 4}s ease-in-out infinite`,
16
- },
17
- '@keyframes colors': {
18
- '0%': {
19
- stroke: primary.light,
20
- },
21
- '25%': {
22
- stroke: secondary.light,
23
- },
24
- '50%': {
25
- stroke: tertiary.light,
26
- },
27
- '75%': {
28
- stroke: quaternary.light,
29
- },
30
- '100%': {
31
- stroke: primary.light,
32
- },
33
- },
34
- '@keyframes dash': {
35
- '0%': {
36
- strokeDashoffset: offset,
37
- },
38
- '50%': {
39
- strokeDashoffset: offset / 4,
40
- transform: 'rotate(135deg)',
41
- },
42
- '100%': {
43
- strokeDashoffset: offset,
44
- transform: 'rotate(720deg)',
45
- },
46
- },
47
- };
48
- });
49
- const Loading = (0, mobx_react_1.observer)(function ({ model: { renderProps: { radius }, }, }) {
50
- const { classes } = useStyles();
51
- const [shown, setShown] = (0, react_1.useState)(false);
52
- (0, react_1.useEffect)(() => {
53
- const timeout = setTimeout(() => {
54
- setShown(true);
55
- }, 400);
56
- return () => {
57
- clearTimeout(timeout);
58
- };
59
- });
60
- return !shown ? null : ((0, jsx_runtime_1.jsxs)("g", { children: [(0, jsx_runtime_1.jsx)("defs", { children: (0, jsx_runtime_1.jsx)("pattern", { id: "diagonalHatch", width: "10", height: "10", patternTransform: "rotate(45 0 0)", patternUnits: "userSpaceOnUse", children: (0, jsx_runtime_1.jsx)("line", { x1: "0", y1: "0", x2: "0", y2: "10", style: { stroke: 'rgba(255,255,255,0.5)', strokeWidth: 10 } }) }) }), (0, jsx_runtime_1.jsx)("circle", { cx: "0", cy: "0", r: radius, fill: "#f1f1f1" }), (0, jsx_runtime_1.jsx)("circle", { cx: "0", cy: "0", r: radius, fill: "url(#diagonalHatch)" }), (0, jsx_runtime_1.jsx)("text", { x: "0", y: "0", transform: "rotate(90 0 0)", dominantBaseline: "middle", textAnchor: "middle", children: "Loading\u2026" }), (0, jsx_runtime_1.jsx)("circle", { className: classes.path, fill: "none", strokeWidth: "4", strokeLinecap: "round", cx: "0", cy: "0", r: "60" })] }));
61
- });
62
- exports.default = Loading;
@@ -1,9 +0,0 @@
1
- declare const baseChordDisplayConfig: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
2
- onChordClick: {
3
- type: string;
4
- description: string;
5
- defaultValue: boolean;
6
- contextVariable: string[];
7
- };
8
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "displayId">>;
9
- export { baseChordDisplayConfig };
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.baseChordDisplayConfig = void 0;
4
- const configuration_1 = require("@jbrowse/core/configuration");
5
- function x() { }
6
- const baseChordDisplayConfig = (0, configuration_1.ConfigurationSchema)('BaseChordDisplay', {
7
- onChordClick: {
8
- type: 'boolean',
9
- description: 'callback that should be run when a chord in the track is clicked',
10
- defaultValue: false,
11
- contextVariable: ['feature', 'track', 'pluginManager'],
12
- },
13
- }, {
14
- explicitIdentifier: 'displayId',
15
- });
16
- exports.baseChordDisplayConfig = baseChordDisplayConfig;
@@ -1,3 +0,0 @@
1
- export { default as BaseChordDisplayComponent } from './components/BaseChordDisplay';
2
- export { BaseChordDisplayModel } from './model';
3
- export { baseChordDisplayConfig } from './configSchema';
@@ -1,12 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.baseChordDisplayConfig = exports.BaseChordDisplayModel = exports.BaseChordDisplayComponent = void 0;
7
- var BaseChordDisplay_1 = require("./components/BaseChordDisplay");
8
- Object.defineProperty(exports, "BaseChordDisplayComponent", { enumerable: true, get: function () { return __importDefault(BaseChordDisplay_1).default; } });
9
- var model_1 = require("./model");
10
- Object.defineProperty(exports, "BaseChordDisplayModel", { enumerable: true, get: function () { return model_1.BaseChordDisplayModel; } });
11
- var configSchema_1 = require("./configSchema");
12
- Object.defineProperty(exports, "baseChordDisplayConfig", { enumerable: true, get: function () { return configSchema_1.baseChordDisplayConfig; } });