@jbrowse/plugin-circular-view 2.2.2 → 2.3.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 (66) hide show
  1. package/README.md +13 -4
  2. package/dist/BaseChordDisplay/components/BaseChordDisplay.d.ts +11 -3
  3. package/dist/BaseChordDisplay/components/BaseChordDisplay.js +4 -6
  4. package/dist/BaseChordDisplay/components/BaseChordDisplay.js.map +1 -1
  5. package/dist/BaseChordDisplay/components/DisplayError.js +1 -1
  6. package/dist/BaseChordDisplay/components/DisplayError.js.map +1 -1
  7. package/dist/BaseChordDisplay/components/Loading.js +1 -2
  8. package/dist/BaseChordDisplay/components/Loading.js.map +1 -1
  9. package/dist/BaseChordDisplay/models/BaseChordDisplayModel.d.ts +5 -4
  10. package/dist/BaseChordDisplay/models/BaseChordDisplayModel.js +198 -194
  11. package/dist/BaseChordDisplay/models/BaseChordDisplayModel.js.map +1 -1
  12. package/dist/BaseChordDisplay/models/renderReaction.d.ts +2 -0
  13. package/dist/BaseChordDisplay/models/renderReaction.js +12 -3
  14. package/dist/BaseChordDisplay/models/renderReaction.js.map +1 -1
  15. package/dist/CircularView/components/CircularView.js +2 -2
  16. package/dist/CircularView/components/CircularView.js.map +1 -1
  17. package/dist/CircularView/index.d.ts +3 -0
  18. package/dist/CircularView/index.js +40 -0
  19. package/dist/CircularView/index.js.map +1 -0
  20. package/dist/LaunchCircularView/index.d.ts +3 -0
  21. package/dist/LaunchCircularView/index.js +22 -0
  22. package/dist/LaunchCircularView/index.js.map +1 -0
  23. package/dist/index.d.ts +1 -1
  24. package/dist/index.js +7 -50
  25. package/dist/index.js.map +1 -1
  26. package/esm/BaseChordDisplay/components/BaseChordDisplay.d.ts +11 -3
  27. package/esm/BaseChordDisplay/components/BaseChordDisplay.js +4 -6
  28. package/esm/BaseChordDisplay/components/BaseChordDisplay.js.map +1 -1
  29. package/esm/BaseChordDisplay/components/DisplayError.js +1 -1
  30. package/esm/BaseChordDisplay/components/DisplayError.js.map +1 -1
  31. package/esm/BaseChordDisplay/components/Loading.js +1 -2
  32. package/esm/BaseChordDisplay/components/Loading.js.map +1 -1
  33. package/esm/BaseChordDisplay/models/BaseChordDisplayModel.d.ts +5 -4
  34. package/esm/BaseChordDisplay/models/BaseChordDisplayModel.js +199 -195
  35. package/esm/BaseChordDisplay/models/BaseChordDisplayModel.js.map +1 -1
  36. package/esm/BaseChordDisplay/models/renderReaction.d.ts +2 -0
  37. package/esm/BaseChordDisplay/models/renderReaction.js +9 -3
  38. package/esm/BaseChordDisplay/models/renderReaction.js.map +1 -1
  39. package/esm/CircularView/components/CircularView.js +2 -2
  40. package/esm/CircularView/components/CircularView.js.map +1 -1
  41. package/esm/CircularView/index.d.ts +3 -0
  42. package/esm/CircularView/index.js +12 -0
  43. package/esm/CircularView/index.js.map +1 -0
  44. package/esm/LaunchCircularView/index.d.ts +3 -0
  45. package/esm/LaunchCircularView/index.js +20 -0
  46. package/esm/LaunchCircularView/index.js.map +1 -0
  47. package/esm/index.d.ts +1 -1
  48. package/esm/index.js +6 -26
  49. package/esm/index.js.map +1 -1
  50. package/package.json +5 -4
  51. package/src/BaseChordDisplay/components/BaseChordDisplay.tsx +16 -6
  52. package/src/BaseChordDisplay/components/DisplayError.tsx +41 -43
  53. package/src/BaseChordDisplay/components/Loading.tsx +55 -58
  54. package/src/BaseChordDisplay/models/BaseChordDisplayModel.ts +241 -232
  55. package/src/BaseChordDisplay/models/renderReaction.ts +9 -3
  56. package/src/CircularView/components/CircularView.tsx +73 -75
  57. package/src/CircularView/index.ts +16 -0
  58. package/src/LaunchCircularView/index.ts +48 -0
  59. package/src/index.ts +10 -55
  60. package/dist/BaseChordDisplay/components/RpcRenderedSvgGroup.d.ts +0 -12
  61. package/dist/BaseChordDisplay/components/RpcRenderedSvgGroup.js +0 -73
  62. package/dist/BaseChordDisplay/components/RpcRenderedSvgGroup.js.map +0 -1
  63. package/esm/BaseChordDisplay/components/RpcRenderedSvgGroup.d.ts +0 -12
  64. package/esm/BaseChordDisplay/components/RpcRenderedSvgGroup.js +0 -48
  65. package/esm/BaseChordDisplay/components/RpcRenderedSvgGroup.js.map +0 -1
  66. package/src/BaseChordDisplay/components/RpcRenderedSvgGroup.tsx +0 -69
@@ -1,9 +1,8 @@
1
1
  import React from 'react'
2
2
  import { observer } from 'mobx-react'
3
+ import { IconButton } from '@mui/material'
3
4
  import { ResizeHandle, ErrorMessage } from '@jbrowse/core/ui'
4
5
  import { assembleLocString } from '@jbrowse/core/util'
5
- import { CircularViewModel } from '../models/CircularView'
6
- import { IconButton } from '@mui/material'
7
6
  import { makeStyles } from 'tss-react/mui'
8
7
  import { grey } from '@mui/material/colors'
9
8
 
@@ -19,6 +18,7 @@ import { TrackSelector as TrackSelectorIcon } from '@jbrowse/core/ui/Icons'
19
18
  // locals
20
19
  import Ruler from './Ruler'
21
20
  import ImportForm from './ImportForm'
21
+ import { CircularViewModel } from '../models/CircularView'
22
22
 
23
23
  const dragHandleHeight = 3
24
24
 
@@ -85,87 +85,85 @@ const Slices = observer(({ model }: { model: CircularViewModel }) => {
85
85
  )
86
86
  })
87
87
 
88
- const Controls = observer(
89
- ({
90
- model,
91
- showingFigure,
92
- }: {
93
- model: CircularViewModel
94
- showingFigure: boolean
95
- }) => {
96
- const { classes } = useStyles()
97
- return (
98
- <div className={classes.controls}>
99
- <IconButton
100
- onClick={model.zoomOutButton}
101
- className={classes.iconButton}
102
- title={model.lockedFitToWindow ? 'unlock to zoom out' : 'zoom out'}
103
- disabled={
104
- !showingFigure || model.atMaxBpPerPx || model.lockedFitToWindow
105
- }
106
- color="secondary"
107
- >
108
- <ZoomOutIcon />
109
- </IconButton>
88
+ const Controls = observer(function ({
89
+ model,
90
+ showingFigure,
91
+ }: {
92
+ model: CircularViewModel
93
+ showingFigure: boolean
94
+ }) {
95
+ const { classes } = useStyles()
96
+ return (
97
+ <div className={classes.controls}>
98
+ <IconButton
99
+ onClick={model.zoomOutButton}
100
+ className={classes.iconButton}
101
+ title={model.lockedFitToWindow ? 'unlock to zoom out' : 'zoom out'}
102
+ disabled={
103
+ !showingFigure || model.atMaxBpPerPx || model.lockedFitToWindow
104
+ }
105
+ color="secondary"
106
+ >
107
+ <ZoomOutIcon />
108
+ </IconButton>
110
109
 
111
- <IconButton
112
- onClick={model.zoomInButton}
113
- className={classes.iconButton}
114
- title="zoom in"
115
- disabled={!showingFigure || model.atMinBpPerPx}
116
- color="secondary"
117
- >
118
- <ZoomInIcon />
119
- </IconButton>
110
+ <IconButton
111
+ onClick={model.zoomInButton}
112
+ className={classes.iconButton}
113
+ title="zoom in"
114
+ disabled={!showingFigure || model.atMinBpPerPx}
115
+ color="secondary"
116
+ >
117
+ <ZoomInIcon />
118
+ </IconButton>
120
119
 
121
- <IconButton
122
- onClick={model.rotateCounterClockwiseButton}
123
- className={classes.iconButton}
124
- title="rotate counter-clockwise"
125
- disabled={!showingFigure}
126
- color="secondary"
127
- >
128
- <RotateLeftIcon />
129
- </IconButton>
120
+ <IconButton
121
+ onClick={model.rotateCounterClockwiseButton}
122
+ className={classes.iconButton}
123
+ title="rotate counter-clockwise"
124
+ disabled={!showingFigure}
125
+ color="secondary"
126
+ >
127
+ <RotateLeftIcon />
128
+ </IconButton>
130
129
 
131
- <IconButton
132
- onClick={model.rotateClockwiseButton}
133
- className={classes.iconButton}
134
- title="rotate clockwise"
135
- disabled={!showingFigure}
136
- color="secondary"
137
- >
138
- <RotateRightIcon />
139
- </IconButton>
130
+ <IconButton
131
+ onClick={model.rotateClockwiseButton}
132
+ className={classes.iconButton}
133
+ title="rotate clockwise"
134
+ disabled={!showingFigure}
135
+ color="secondary"
136
+ >
137
+ <RotateRightIcon />
138
+ </IconButton>
140
139
 
140
+ <IconButton
141
+ onClick={model.toggleFitToWindowLock}
142
+ className={classes.iconButton}
143
+ title={
144
+ model.lockedFitToWindow
145
+ ? 'locked model to window size'
146
+ : 'unlocked model to zoom further'
147
+ }
148
+ disabled={model.tooSmallToLock}
149
+ color="secondary"
150
+ >
151
+ {model.lockedFitToWindow ? <LockIcon /> : <LockOpenIcon />}
152
+ </IconButton>
153
+
154
+ {model.hideTrackSelectorButton ? null : (
141
155
  <IconButton
142
- onClick={model.toggleFitToWindowLock}
143
- className={classes.iconButton}
144
- title={
145
- model.lockedFitToWindow
146
- ? 'locked model to window size'
147
- : 'unlocked model to zoom further'
148
- }
149
- disabled={model.tooSmallToLock}
156
+ onClick={model.activateTrackSelector}
157
+ title="Open track selector"
158
+ data-testid="circular_track_select"
150
159
  color="secondary"
151
160
  >
152
- {model.lockedFitToWindow ? <LockIcon /> : <LockOpenIcon />}
161
+ <TrackSelectorIcon />
153
162
  </IconButton>
154
-
155
- {model.hideTrackSelectorButton ? null : (
156
- <IconButton
157
- onClick={model.activateTrackSelector}
158
- title="Open track selector"
159
- data-testid="circular_track_select"
160
- color="secondary"
161
- >
162
- <TrackSelectorIcon />
163
- </IconButton>
164
- )}
165
- </div>
166
- )
167
- },
168
- )
163
+ )}
164
+ </div>
165
+ )
166
+ })
169
167
 
170
168
  const CircularView = observer(({ model }: { model: CircularViewModel }) => {
171
169
  const { classes } = useStyles()
@@ -0,0 +1,16 @@
1
+ import { lazy } from 'react'
2
+ import PluginManager from '@jbrowse/core/PluginManager'
3
+ import ViewType from '@jbrowse/core/pluggableElementTypes/ViewType'
4
+ import stateModelFactory from './models/CircularView'
5
+
6
+ export default (pluginManager: PluginManager) => {
7
+ pluginManager.addViewType(
8
+ () =>
9
+ new ViewType({
10
+ ReactComponent: lazy(() => import('./components/CircularView')),
11
+ stateModel: stateModelFactory(pluginManager),
12
+ name: 'CircularView',
13
+ displayName: 'Circular view',
14
+ }),
15
+ )
16
+ }
@@ -0,0 +1,48 @@
1
+ import { when } from 'mobx'
2
+ import { AbstractSessionModel } from '@jbrowse/core/util'
3
+ import PluginManager from '@jbrowse/core/PluginManager'
4
+
5
+ // locals
6
+ import { CircularViewModel } from '../CircularView/models/CircularView'
7
+
8
+ type CGV = CircularViewModel
9
+
10
+ export default (pluginManager: PluginManager) => {
11
+ pluginManager.addToExtensionPoint(
12
+ 'LaunchView-CircularView',
13
+ // @ts-ignore
14
+ async ({
15
+ session,
16
+ assembly,
17
+ loc,
18
+ tracks = [],
19
+ }: {
20
+ session: AbstractSessionModel
21
+ assembly?: string
22
+ loc: string
23
+ tracks?: string[]
24
+ }) => {
25
+ const { assemblyManager } = session
26
+ const view = session.addView('CircularView', {}) as CGV
27
+
28
+ await when(() => view.initialized)
29
+
30
+ if (!assembly) {
31
+ throw new Error(
32
+ 'No assembly provided when launching circular genome view',
33
+ )
34
+ }
35
+
36
+ const asm = await assemblyManager.waitForAssembly(assembly)
37
+ if (!asm) {
38
+ throw new Error(
39
+ `Assembly "${assembly}" not found when launching circular genome view`,
40
+ )
41
+ }
42
+
43
+ view.setDisplayedRegions(asm.regions || [])
44
+
45
+ tracks.forEach(track => view.showTrack(track))
46
+ },
47
+ )
48
+ }
package/src/index.ts CHANGED
@@ -1,69 +1,24 @@
1
- import { lazy } from 'react'
2
- import { when } from 'mobx'
3
1
  import { AbstractSessionModel, isAbstractMenuManager } from '@jbrowse/core/util'
4
2
  import PluginManager from '@jbrowse/core/PluginManager'
5
3
  import Plugin from '@jbrowse/core/Plugin'
6
- import ViewType from '@jbrowse/core/pluggableElementTypes/ViewType'
7
- import DataUsageIcon from '@mui/icons-material/DataUsage'
8
- import stateModelFactory, {
4
+
5
+ // locals
6
+ import {
9
7
  CircularViewModel,
10
8
  CircularViewStateModel,
11
9
  } from './CircularView/models/CircularView'
10
+ import CircularViewF from './CircularView'
11
+ import LaunchCircularViewF from './LaunchCircularView'
12
12
 
13
- type CGV = CircularViewModel
13
+ // icons
14
+ import DataUsageIcon from '@mui/icons-material/DataUsage'
14
15
 
15
16
  export default class CircularViewPlugin extends Plugin {
16
17
  name = 'CircularViewPlugin'
17
18
 
18
19
  install(pluginManager: PluginManager) {
19
- pluginManager.addViewType(
20
- () =>
21
- new ViewType({
22
- ReactComponent: lazy(
23
- () => import('./CircularView/components/CircularView'),
24
- ),
25
- stateModel: stateModelFactory(pluginManager),
26
- name: 'CircularView',
27
- }),
28
- )
29
-
30
- pluginManager.addToExtensionPoint(
31
- 'LaunchView-CircularView',
32
- // @ts-ignore
33
- async ({
34
- session,
35
- assembly,
36
- loc,
37
- tracks = [],
38
- }: {
39
- session: AbstractSessionModel
40
- assembly?: string
41
- loc: string
42
- tracks?: string[]
43
- }) => {
44
- const { assemblyManager } = session
45
- const view = session.addView('CircularView', {}) as CGV
46
-
47
- await when(() => view.initialized)
48
-
49
- if (!assembly) {
50
- throw new Error(
51
- 'No assembly provided when launching circular genome view',
52
- )
53
- }
54
-
55
- const asm = await assemblyManager.waitForAssembly(assembly)
56
- if (!asm) {
57
- throw new Error(
58
- `Assembly "${assembly}" not found when launching circular genome view`,
59
- )
60
- }
61
-
62
- view.setDisplayedRegions(asm.regions || [])
63
-
64
- tracks.forEach(track => view.showTrack(track))
65
- },
66
- )
20
+ CircularViewF(pluginManager)
21
+ LaunchCircularViewF(pluginManager)
67
22
  }
68
23
 
69
24
  configure(pluginManager: PluginManager) {
@@ -80,8 +35,8 @@ export default class CircularViewPlugin extends Plugin {
80
35
  }
81
36
 
82
37
  export {
83
- BaseChordDisplayModel,
84
38
  baseChordDisplayConfig,
39
+ BaseChordDisplayModel,
85
40
  BaseChordDisplayComponent,
86
41
  } from './BaseChordDisplay'
87
42
 
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- declare function RpcRenderedSvgGroup({ model, }: {
3
- model: {
4
- data: any;
5
- html: string;
6
- filled: boolean;
7
- renderingComponent: React.FC<any>;
8
- renderProps: Function;
9
- };
10
- }): JSX.Element;
11
- declare const _default: typeof RpcRenderedSvgGroup;
12
- export default _default;
@@ -1,73 +0,0 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
26
- const react_1 = __importStar(require("react"));
27
- const mobx_state_tree_1 = require("mobx-state-tree");
28
- const mobx_react_1 = require("mobx-react");
29
- const react_dom_1 = require("react-dom");
30
- const util_1 = require("@jbrowse/core/util");
31
- function RpcRenderedSvgGroup({ model, }) {
32
- const { data, html, filled, renderingComponent } = model;
33
- const ssrContainerNode = (0, react_1.useRef)(null);
34
- (0, react_1.useEffect)(() => {
35
- const domNode = ssrContainerNode.current;
36
- function doHydrate() {
37
- if (domNode && filled) {
38
- if (domNode.innerHTML) {
39
- domNode.style.display = 'none';
40
- (0, react_dom_1.unmountComponentAtNode)(domNode);
41
- }
42
- // setting outline:none fixes react "focusable" element issue. see
43
- // https://github.com/GMOD/jbrowse-components/issues/2160
44
- domNode.style.outline = 'none';
45
- domNode.innerHTML = html;
46
- // use requestIdleCallback to defer main-thread rendering
47
- // and hydration for when we have some free time. helps
48
- // keep the framerate up.
49
- (0, util_1.rIC)(() => {
50
- if (!(0, mobx_state_tree_1.isAlive)(model)) {
51
- return;
52
- }
53
- const mainThreadRendering = react_1.default.createElement(renderingComponent, { ...data, ...model.renderProps() }, null);
54
- (0, util_1.rIC)(() => {
55
- if (!(0, mobx_state_tree_1.isAlive)(model)) {
56
- return;
57
- }
58
- (0, react_dom_1.hydrate)(mainThreadRendering, domNode);
59
- });
60
- });
61
- }
62
- }
63
- doHydrate();
64
- return () => {
65
- if (domNode) {
66
- (0, react_dom_1.unmountComponentAtNode)(domNode);
67
- }
68
- };
69
- });
70
- return react_1.default.createElement("g", { ref: ssrContainerNode });
71
- }
72
- exports.default = (0, mobx_react_1.observer)(RpcRenderedSvgGroup);
73
- //# sourceMappingURL=RpcRenderedSvgGroup.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RpcRenderedSvgGroup.js","sourceRoot":"","sources":["../../../src/BaseChordDisplay/components/RpcRenderedSvgGroup.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAgD;AAChD,qDAAyC;AACzC,2CAAqC;AACrC,yCAA2D;AAC3D,6CAAwC;AAExC,SAAS,mBAAmB,CAAC,EAC3B,KAAK,GAWN;IACC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,kBAAkB,EAAE,GAAG,KAAK,CAAA;IAExD,MAAM,gBAAgB,GAAG,IAAA,cAAM,EAAc,IAAI,CAAC,CAAA;IAElD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,MAAM,OAAO,GAAG,gBAAgB,CAAC,OAAO,CAAA;QACxC,SAAS,SAAS;YAChB,IAAI,OAAO,IAAI,MAAM,EAAE;gBACrB,IAAI,OAAO,CAAC,SAAS,EAAE;oBACrB,OAAO,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAA;oBAC9B,IAAA,kCAAsB,EAAC,OAAO,CAAC,CAAA;iBAChC;gBAED,kEAAkE;gBAClE,yDAAyD;gBACzD,OAAO,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAA;gBAC9B,OAAO,CAAC,SAAS,GAAG,IAAI,CAAA;gBACxB,yDAAyD;gBACzD,uDAAuD;gBACvD,yBAAyB;gBACzB,IAAA,UAAG,EAAC,GAAG,EAAE;oBACP,IAAI,CAAC,IAAA,yBAAO,EAAC,KAAK,CAAC,EAAE;wBACnB,OAAM;qBACP;oBACD,MAAM,mBAAmB,GAAG,eAAK,CAAC,aAAa,CAC7C,kBAAkB,EAClB,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC,WAAW,EAAE,EAAE,EACnC,IAAI,CACL,CAAA;oBACD,IAAA,UAAG,EAAC,GAAG,EAAE;wBACP,IAAI,CAAC,IAAA,yBAAO,EAAC,KAAK,CAAC,EAAE;4BACnB,OAAM;yBACP;wBACD,IAAA,mBAAO,EAAC,mBAAmB,EAAE,OAAO,CAAC,CAAA;oBACvC,CAAC,CAAC,CAAA;gBACJ,CAAC,CAAC,CAAA;aACH;QACH,CAAC;QACD,SAAS,EAAE,CAAA;QACX,OAAO,GAAG,EAAE;YACV,IAAI,OAAO,EAAE;gBACX,IAAA,kCAAsB,EAAC,OAAO,CAAC,CAAA;aAChC;QACH,CAAC,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,qCAAG,GAAG,EAAE,gBAAgB,GAAI,CAAA;AACrC,CAAC;AAED,kBAAe,IAAA,qBAAQ,EAAC,mBAAmB,CAAC,CAAA"}
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- declare function RpcRenderedSvgGroup({ model, }: {
3
- model: {
4
- data: any;
5
- html: string;
6
- filled: boolean;
7
- renderingComponent: React.FC<any>;
8
- renderProps: Function;
9
- };
10
- }): JSX.Element;
11
- declare const _default: typeof RpcRenderedSvgGroup;
12
- export default _default;
@@ -1,48 +0,0 @@
1
- import React, { useEffect, useRef } from 'react';
2
- import { isAlive } from 'mobx-state-tree';
3
- import { observer } from 'mobx-react';
4
- import { hydrate, unmountComponentAtNode } from 'react-dom';
5
- import { rIC } from '@jbrowse/core/util';
6
- function RpcRenderedSvgGroup({ model, }) {
7
- const { data, html, filled, renderingComponent } = model;
8
- const ssrContainerNode = useRef(null);
9
- useEffect(() => {
10
- const domNode = ssrContainerNode.current;
11
- function doHydrate() {
12
- if (domNode && filled) {
13
- if (domNode.innerHTML) {
14
- domNode.style.display = 'none';
15
- unmountComponentAtNode(domNode);
16
- }
17
- // setting outline:none fixes react "focusable" element issue. see
18
- // https://github.com/GMOD/jbrowse-components/issues/2160
19
- domNode.style.outline = 'none';
20
- domNode.innerHTML = html;
21
- // use requestIdleCallback to defer main-thread rendering
22
- // and hydration for when we have some free time. helps
23
- // keep the framerate up.
24
- rIC(() => {
25
- if (!isAlive(model)) {
26
- return;
27
- }
28
- const mainThreadRendering = React.createElement(renderingComponent, { ...data, ...model.renderProps() }, null);
29
- rIC(() => {
30
- if (!isAlive(model)) {
31
- return;
32
- }
33
- hydrate(mainThreadRendering, domNode);
34
- });
35
- });
36
- }
37
- }
38
- doHydrate();
39
- return () => {
40
- if (domNode) {
41
- unmountComponentAtNode(domNode);
42
- }
43
- };
44
- });
45
- return React.createElement("g", { ref: ssrContainerNode });
46
- }
47
- export default observer(RpcRenderedSvgGroup);
48
- //# sourceMappingURL=RpcRenderedSvgGroup.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RpcRenderedSvgGroup.js","sourceRoot":"","sources":["../../../src/BaseChordDisplay/components/RpcRenderedSvgGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAA;AAC3D,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAA;AAExC,SAAS,mBAAmB,CAAC,EAC3B,KAAK,GAWN;IACC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,kBAAkB,EAAE,GAAG,KAAK,CAAA;IAExD,MAAM,gBAAgB,GAAG,MAAM,CAAc,IAAI,CAAC,CAAA;IAElD,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,OAAO,GAAG,gBAAgB,CAAC,OAAO,CAAA;QACxC,SAAS,SAAS;YAChB,IAAI,OAAO,IAAI,MAAM,EAAE;gBACrB,IAAI,OAAO,CAAC,SAAS,EAAE;oBACrB,OAAO,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAA;oBAC9B,sBAAsB,CAAC,OAAO,CAAC,CAAA;iBAChC;gBAED,kEAAkE;gBAClE,yDAAyD;gBACzD,OAAO,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAA;gBAC9B,OAAO,CAAC,SAAS,GAAG,IAAI,CAAA;gBACxB,yDAAyD;gBACzD,uDAAuD;gBACvD,yBAAyB;gBACzB,GAAG,CAAC,GAAG,EAAE;oBACP,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;wBACnB,OAAM;qBACP;oBACD,MAAM,mBAAmB,GAAG,KAAK,CAAC,aAAa,CAC7C,kBAAkB,EAClB,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC,WAAW,EAAE,EAAE,EACnC,IAAI,CACL,CAAA;oBACD,GAAG,CAAC,GAAG,EAAE;wBACP,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;4BACnB,OAAM;yBACP;wBACD,OAAO,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAA;oBACvC,CAAC,CAAC,CAAA;gBACJ,CAAC,CAAC,CAAA;aACH;QACH,CAAC;QACD,SAAS,EAAE,CAAA;QACX,OAAO,GAAG,EAAE;YACV,IAAI,OAAO,EAAE;gBACX,sBAAsB,CAAC,OAAO,CAAC,CAAA;aAChC;QACH,CAAC,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,2BAAG,GAAG,EAAE,gBAAgB,GAAI,CAAA;AACrC,CAAC;AAED,eAAe,QAAQ,CAAC,mBAAmB,CAAC,CAAA"}
@@ -1,69 +0,0 @@
1
- import React, { useEffect, useRef } from 'react'
2
- import { isAlive } from 'mobx-state-tree'
3
- import { observer } from 'mobx-react'
4
- import { hydrate, unmountComponentAtNode } from 'react-dom'
5
- import { rIC } from '@jbrowse/core/util'
6
-
7
- function RpcRenderedSvgGroup({
8
- model,
9
- }: {
10
- model: {
11
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
- data: any
13
- html: string
14
- filled: boolean
15
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
- renderingComponent: React.FC<any>
17
- renderProps: Function
18
- }
19
- }) {
20
- const { data, html, filled, renderingComponent } = model
21
-
22
- const ssrContainerNode = useRef<SVGGElement>(null)
23
-
24
- useEffect(() => {
25
- const domNode = ssrContainerNode.current
26
- function doHydrate() {
27
- if (domNode && filled) {
28
- if (domNode.innerHTML) {
29
- domNode.style.display = 'none'
30
- unmountComponentAtNode(domNode)
31
- }
32
-
33
- // setting outline:none fixes react "focusable" element issue. see
34
- // https://github.com/GMOD/jbrowse-components/issues/2160
35
- domNode.style.outline = 'none'
36
- domNode.innerHTML = html
37
- // use requestIdleCallback to defer main-thread rendering
38
- // and hydration for when we have some free time. helps
39
- // keep the framerate up.
40
- rIC(() => {
41
- if (!isAlive(model)) {
42
- return
43
- }
44
- const mainThreadRendering = React.createElement(
45
- renderingComponent,
46
- { ...data, ...model.renderProps() },
47
- null,
48
- )
49
- rIC(() => {
50
- if (!isAlive(model)) {
51
- return
52
- }
53
- hydrate(mainThreadRendering, domNode)
54
- })
55
- })
56
- }
57
- }
58
- doHydrate()
59
- return () => {
60
- if (domNode) {
61
- unmountComponentAtNode(domNode)
62
- }
63
- }
64
- })
65
-
66
- return <g ref={ssrContainerNode} />
67
- }
68
-
69
- export default observer(RpcRenderedSvgGroup)