@teselagen/ove 0.7.27 → 0.7.28

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 (304) hide show
  1. package/AASliver.js +187 -0
  2. package/AddLaddersDialog.js +82 -0
  3. package/AdditionalCutsiteInfoDialog.js +599 -0
  4. package/AlignmentView/Mismatches.d.ts +3 -3
  5. package/AlignmentVisibilityTool.js +105 -0
  6. package/AnnotationContainerHolder.js +20 -0
  7. package/AnnotationPositioner.js +27 -0
  8. package/AutoAnnotate.js +501 -0
  9. package/AutoAnnotateBpMatchingDialog.js +208 -0
  10. package/Axis.js +151 -0
  11. package/AxisNumbers.js +35 -0
  12. package/Browser.js +106 -0
  13. package/Caret.js +63 -0
  14. package/Chromatogram.js +293 -0
  15. package/CircularDnaSequence.js +73 -0
  16. package/CircularView/Labels/index.d.ts +1 -1
  17. package/CircularView/index.d.ts +0 -1
  18. package/CircularZoomMinimap.js +16 -0
  19. package/ColorPicker.js +30 -0
  20. package/CommandHotkeyHandler.js +44 -0
  21. package/CreateAnnotationsPage.d.ts +4 -4
  22. package/CreateAnnotationsPage.js +98 -0
  23. package/Cutsite.js +18 -0
  24. package/CutsiteProperties.js +176 -0
  25. package/CutsiteSelectionLayers.js +47 -0
  26. package/Cutsites.js +271 -0
  27. package/DeletionLayer.js +28 -0
  28. package/DigestTool/Ladder.d.ts +1 -1
  29. package/DropHandler.css +21 -0
  30. package/DropHandler.js +64 -0
  31. package/EditCaretPosition.js +234 -0
  32. package/EditTrackNameDialog.js +30 -0
  33. package/Feature.js +83 -0
  34. package/FeatureProperties.js +6 -0
  35. package/FillWindow.js +47 -0
  36. package/GenbankView.js +74 -0
  37. package/GeneralProperties.js +117 -0
  38. package/GenericAnnotationProperties.js +406 -0
  39. package/GlobalDialog.js +73 -0
  40. package/GlobalDialogUtils.js +110 -0
  41. package/GoToDialog.js +25 -0
  42. package/HorizontalPanelDragHandle.js +35 -0
  43. package/Keyboard.js +85 -0
  44. package/Labels.js +327 -0
  45. package/Ladder.css +20 -0
  46. package/Ladder.js +303 -0
  47. package/MeltingTemp.js +85 -0
  48. package/Menlo.ttf +0 -0
  49. package/Minimap.js +515 -0
  50. package/Mismatches.js +134 -0
  51. package/Monaco.ttf +0 -0
  52. package/MultipleSeqsDetectedOnImportDialog.js +74 -0
  53. package/Orf.js +109 -0
  54. package/OrfProperties.js +117 -0
  55. package/Orfs.js +35 -0
  56. package/PCRTool.js +179 -0
  57. package/PairwiseAlignmentView.js +68 -0
  58. package/Part.js +34 -0
  59. package/PartProperties.js +9 -0
  60. package/PassThrough.js +3 -0
  61. package/PerformantSelectionLayer.js +32 -0
  62. package/PinchHelper.js +24 -0
  63. package/PointedAnnotation.js +347 -0
  64. package/PositionAnnotationOnCircle.js +26 -0
  65. package/Primer.js +41 -0
  66. package/PrimerProperties.js +19 -0
  67. package/Reflex/index.d.ts +0 -1
  68. package/ReflexContainer.js +802 -0
  69. package/ReflexElement.js +160 -0
  70. package/ReflexEvents.js +77 -0
  71. package/ReflexSplitter.js +205 -0
  72. package/RenameSequenceDialog.js +7 -0
  73. package/RotateCircularViewSlider.js +93 -0
  74. package/RowView/index.d.ts +0 -1
  75. package/SelectDialog.js +150 -0
  76. package/SequenceName.js +15 -0
  77. package/SimpleCircularOrLinearView.js +381 -0
  78. package/SimpleOligoPreview.js +39 -0
  79. package/SingleEnzymeCutsiteInfo.js +139 -0
  80. package/ToolBar/ToolbarItem.d.ts +1 -3
  81. package/ToolbarItem.js +192 -0
  82. package/Translation.js +198 -0
  83. package/TranslationProperties.js +149 -0
  84. package/UncontrolledSliderWithPlusMinusBtns.css +5 -0
  85. package/UncontrolledSliderWithPlusMinusBtns.js +134 -0
  86. package/VeTopRightContainer.js +12 -0
  87. package/ZoomCircularViewSlider.js +62 -0
  88. package/ZoomLinearView.js +47 -0
  89. package/addAlignment.js +6 -0
  90. package/addMetaToActionCreators.js +12 -0
  91. package/addWrappedAddons.js +20 -0
  92. package/alignmentTool.js +503 -0
  93. package/alignments.js +379 -0
  94. package/annotationLabelVisibility.js +2 -0
  95. package/annotationSearchSelector.js +24 -0
  96. package/annotationTypes.js +35 -0
  97. package/annotationVisibility.js +196 -0
  98. package/annotationsToSupport.js +104 -0
  99. package/arrayToObjWithIds.js +17 -0
  100. package/arrayUtils.js +19 -0
  101. package/array_move.js +10 -0
  102. package/calculateTickMarkPositionsForGivenRange.js +47 -0
  103. package/caretPosition.js +27 -0
  104. package/cdsFeaturesSelector.js +9 -0
  105. package/charWidth.js +22 -0
  106. package/circular.js +19 -0
  107. package/circularSelector.js +4 -0
  108. package/clickAndDragUtils.js +576 -0
  109. package/coerceInitialValue.js +7 -0
  110. package/combineReducersDontIgnoreKeys.js +12 -0
  111. package/commandUtils.js +20 -0
  112. package/constants.js +2 -0
  113. package/copyOptions.js +34 -0
  114. package/createFragmentLines.js +120 -0
  115. package/createMergedDefaultStateReducer.js +30 -0
  116. package/createMetaAction.js +12 -0
  117. package/createSequenceInputPopup.js +290 -0
  118. package/createSequenceInputPopupStyle.css +87 -0
  119. package/createSimpleDialog.js +89 -0
  120. package/createYourOwnEnzyme.js +39 -0
  121. package/cutsiteLabelColorSelector.js +6 -0
  122. package/cutsiteTool.js +88 -0
  123. package/cutsitesByRangeSelector.js +5 -0
  124. package/cutsitesSelector.js +61 -0
  125. package/darkmode.css +98 -0
  126. package/defaultConfig.js +150 -0
  127. package/deletionLayers.js +36 -0
  128. package/description.js +21 -0
  129. package/digestTool.js +34 -0
  130. package/dnaToColor.js +17 -0
  131. package/downloadTool.js +39 -0
  132. package/draggableClassnames.js +5 -0
  133. package/drawAnnotations.js +440 -0
  134. package/drawDirectedPiePiece.js +142 -0
  135. package/editTool.js +49 -0
  136. package/editorSelector.js +2 -0
  137. package/editorUtils.js +205 -0
  138. package/estimateRowHeight.js +184 -0
  139. package/featureLengthsToHide.js +27 -0
  140. package/featureTool.js +34 -0
  141. package/features.js +19 -0
  142. package/featuresSelector.js +8 -0
  143. package/filteredCutsitesSelector.js +136 -0
  144. package/filteredFeaturesSelector.js +32 -0
  145. package/filteredPartsSelector.js +57 -0
  146. package/filteredPrimersSelector.js +27 -0
  147. package/filteredRestrictionEnzymesSelector.js +1 -0
  148. package/find.png +0 -0
  149. package/findTool.js +79 -0
  150. package/findToolConstants.js +1 -0
  151. package/frameTranslations.js +52 -0
  152. package/fullscreen.png +0 -0
  153. package/getAdditionalEnzymesSelector.js +46 -0
  154. package/getAngleForPositionMidpoint.js +3 -0
  155. package/getAnnotationClassnames.js +12 -0
  156. package/getAnnotationNameAndStartStopString.js +61 -0
  157. package/getBpsPerRow.js +19 -0
  158. package/getCutsiteLabelHeights.js +56 -0
  159. package/getGapMap.js +12 -0
  160. package/getGaps.js +27 -0
  161. package/getInternalLabel.js +40 -0
  162. package/getOveHotkeyDefs.js +12 -0
  163. package/getPairwiseOverviewLinearViewOptions.js +38 -0
  164. package/getRangeAnglesSpecial.js +12 -0
  165. package/getStructuredBases.js +97 -0
  166. package/getTrackFromEvent.js +25 -0
  167. package/getVisibleStartEnd.js +7 -0
  168. package/getXStartAndWidthFromNonCircularRange.js +12 -0
  169. package/getXStartAndWidthOfRangeWrtRow.js +27 -0
  170. package/getXStartAndWidthOfRowAnnotation.js +19 -0
  171. package/getYOffset.js +15 -0
  172. package/hoveredAnnotation.js +24 -0
  173. package/{html2canvas.esm--JN4fLQL.js → html2canvas.esm-DiGWN1gP.js} +187 -229
  174. package/{html2canvas.esm-B7d7VJmQ.cjs → html2canvas.esm-J1esNpMJ.cjs} +187 -229
  175. package/importTool.js +27 -0
  176. package/index.cjs.js +48165 -47142
  177. package/index.es.js +47699 -46676
  178. package/index.js +71 -0
  179. package/inlineFindTool.js +38 -0
  180. package/isElementInViewport.js +29 -0
  181. package/isEnzymeFilterAndSelector.js +1 -0
  182. package/isTargetWithinEl.js +6 -0
  183. package/labelLineIntensity.js +25 -0
  184. package/labelSize.js +23 -0
  185. package/ladderDefaults.js +25 -0
  186. package/lastSavedId.js +20 -0
  187. package/lineageLines.js +11 -0
  188. package/linear.png +0 -0
  189. package/makeStore.js +34 -0
  190. package/massageTickSpacing.js +19 -0
  191. package/materiallyAvailable.js +19 -0
  192. package/middleware.js +112 -0
  193. package/minimumOrfSize.js +24 -0
  194. package/minimumOrfSizeSelector.js +2 -0
  195. package/modalActions.js +3 -0
  196. package/moveCaret.js +58 -0
  197. package/name.js +19 -0
  198. package/normalizeAngle.js +3 -0
  199. package/normalizeAngleRange.js +9 -0
  200. package/oligoTool.js +30 -0
  201. package/onlyUpdateForKeysDeep.js +31 -0
  202. package/orfFrameToColorMap.js +10 -0
  203. package/orfTool.js +136 -0
  204. package/orfsSelector.js +15 -0
  205. package/ove.css +12107 -0
  206. package/package.json +6 -5
  207. package/panelsShown.js +294 -0
  208. package/partLengthsToHide.js +23 -0
  209. package/partOverhangs.js +6 -0
  210. package/partTagSearch.js +69 -0
  211. package/partTool.js +45 -0
  212. package/parts.js +19 -0
  213. package/partsSelector.js +8 -0
  214. package/pie.png +0 -0
  215. package/polarToSpecialCartesian.js +7 -0
  216. package/positionCutsites.js +6 -0
  217. package/prepareRowData.js +64 -0
  218. package/primerBases.js +221 -0
  219. package/primerLengthsToHide.js +27 -0
  220. package/primers.js +19 -0
  221. package/primersSelector.js +8 -0
  222. package/print.png +0 -0
  223. package/printTool.js +31 -0
  224. package/propertiesTool.js +40 -0
  225. package/proteinUtils.js +3 -0
  226. package/pureNoFunc.js +18 -0
  227. package/readOnly.js +25 -0
  228. package/redoTool.js +30 -0
  229. package/reflex-styles.css +128 -0
  230. package/reflex-styles.css.map +9 -0
  231. package/relaxLabelAngles.js +157 -0
  232. package/relaxLabels_DEPRECATED.js +105 -0
  233. package/replacementLayers.js +36 -0
  234. package/restrictionEnzymes.js +52 -0
  235. package/restrictionEnzymesSelector.js +34 -0
  236. package/rowviewContants.js +3 -0
  237. package/ruler.css +89 -0
  238. package/save.png +0 -0
  239. package/saveTool.js +44 -0
  240. package/searchLayersSelector.js +71 -0
  241. package/selectedAnnotations.js +89 -0
  242. package/selectedAnnotationsSelector.js +1 -0
  243. package/selectedCutsitesSelector.js +21 -0
  244. package/selectedPartTags.js +21 -0
  245. package/selectionLayer.js +25 -0
  246. package/selectors/annotationSearchSelector.d.ts +1 -1
  247. package/sequence.js +12 -0
  248. package/sequenceDataHistory.js +43 -0
  249. package/sequenceDataSelector.js +2 -0
  250. package/sequenceLengthSelector.js +5 -0
  251. package/sequenceSelector.js +4 -0
  252. package/sharedActionCreators.js +0 -0
  253. package/shouldFlipText.js +4 -0
  254. package/shouldRerender.js +27 -0
  255. package/showFileDialog.js +25 -0
  256. package/showGCContent.js +23 -0
  257. package/show_cut_sites.png +0 -0
  258. package/show_features.png +0 -0
  259. package/show_orfs.png +0 -0
  260. package/show_primers.png +0 -0
  261. package/simpleDialog.css +13 -0
  262. package/specialCutsiteFilterOptions.js +22 -0
  263. package/src/Editor/DropHandler.js +2 -1
  264. package/src/Editor/index.js +0 -2
  265. package/src/RowItem/StackedAnnotations/getStructuredBases.js +20 -6
  266. package/src/ToolBar/cutsiteTool.js +1 -1
  267. package/src/helperComponents/PropertiesDialog/TranslationProperties.js +2 -1
  268. package/style.css +3 -12100
  269. package/tagsToBoldSelector.js +2 -0
  270. package/toggle_views.svg +1 -0
  271. package/toolBar.js +23 -0
  272. package/translationSearchMatchesSelector.js +14 -0
  273. package/translations.js +20 -0
  274. package/translationsRawSelector.js +8 -0
  275. package/translationsSelector.js +137 -0
  276. package/typeField.js +24 -0
  277. package/undoTool.js +30 -0
  278. package/updateEditor.d.ts +1 -3
  279. package/updateEditor.js +200 -0
  280. package/updateLabelsForInViewFeatures.js +55 -0
  281. package/updateLabelsForInViewFeaturesCircView.js +41 -0
  282. package/updateTrackHelper.js +58 -0
  283. package/uppercaseSequenceMapFont.js +25 -0
  284. package/upsertDeleteActionGenerator.js +31 -0
  285. package/useAAColorType.js +8 -0
  286. package/useAdditionalOrfStartCodons.js +24 -0
  287. package/useAnnotationLimits.js +42 -0
  288. package/useChromatogramPrefs.js +31 -0
  289. package/useFormValue.js +7 -0
  290. package/useLadders.js +6 -0
  291. package/useMeltingTemp.js +7 -0
  292. package/useTmType.js +10 -0
  293. package/userDefinedHandlersAndOpts.js +61 -0
  294. package/utils/getAnnotationNameAndStartStopString.d.ts +1 -5
  295. package/utils/selectionLayer.d.ts +2 -2
  296. package/utils.js +37 -0
  297. package/versionHistory.js +26 -0
  298. package/versionHistoryTool.js +21 -0
  299. package/viewSubmenu.js +479 -0
  300. package/visibilityTool.js +39 -0
  301. package/withEditorInteractions/getBpsPerRow.d.ts +1 -3
  302. package/withHover.js +113 -0
  303. package/withRestrictionEnzymes.js +15 -0
  304. package/index.umd.js +0 -188322
@@ -0,0 +1,234 @@
1
+ /* eslint-disable no-var */
2
+ const EditCaretPositioning = {};
3
+
4
+ export default EditCaretPositioning;
5
+
6
+ if (window.getSelection && document.createRange) {
7
+ //saves caret position(s)
8
+ EditCaretPositioning.saveSelection = function (containerEl) {
9
+ var range = window.getSelection().getRangeAt(0);
10
+ var preSelectionRange = range.cloneRange();
11
+ preSelectionRange.selectNodeContents(containerEl);
12
+ preSelectionRange.setEnd(range.startContainer, range.startOffset);
13
+ var start = preSelectionRange.toString().length;
14
+
15
+ return {
16
+ start: start,
17
+ end: start + range.toString().length
18
+ };
19
+ };
20
+ //restores caret position(s)
21
+ EditCaretPositioning.restoreSelection = function (containerEl, savedSel) {
22
+ var charIndex = 0,
23
+ range = document.createRange();
24
+ range.setStart(containerEl, 0);
25
+ range.collapse(true);
26
+ var nodeStack = [containerEl],
27
+ node,
28
+ foundStart = false,
29
+ stop = false;
30
+
31
+ while (!stop && (node = nodeStack.pop())) {
32
+ if (node.nodeType === 3) {
33
+ var nextCharIndex = charIndex + node.length;
34
+ if (
35
+ !foundStart &&
36
+ savedSel.start >= charIndex &&
37
+ savedSel.start <= nextCharIndex
38
+ ) {
39
+ range.setStart(node, savedSel.start - charIndex);
40
+ foundStart = true;
41
+ }
42
+ if (
43
+ foundStart &&
44
+ savedSel.end >= charIndex &&
45
+ savedSel.end <= nextCharIndex
46
+ ) {
47
+ range.setEnd(node, savedSel.end - charIndex);
48
+ stop = true;
49
+ }
50
+ charIndex = nextCharIndex;
51
+ } else {
52
+ var i = node.childNodes.length;
53
+ while (i--) {
54
+ nodeStack.push(node.childNodes[i]);
55
+ }
56
+ }
57
+ }
58
+
59
+ var sel = window.getSelection();
60
+ sel.removeAllRanges();
61
+ sel.addRange(range);
62
+ };
63
+ } else if (document.selection && document.body.createTextRange) {
64
+ //saves caret position(s)
65
+ EditCaretPositioning.saveSelection = function (containerEl) {
66
+ var selectedTextRange = document.selection.createRange();
67
+ var preSelectionTextRange = document.body.createTextRange();
68
+ preSelectionTextRange.moveToElementText(containerEl);
69
+ preSelectionTextRange.setEndPoint("EndToStart", selectedTextRange);
70
+ var start = preSelectionTextRange.text.length;
71
+
72
+ return {
73
+ start: start,
74
+ end: start + selectedTextRange.text.length
75
+ };
76
+ };
77
+ //restores caret position(s)
78
+ EditCaretPositioning.restoreSelection = function (containerEl, savedSel) {
79
+ var textRange = document.body.createTextRange();
80
+ textRange.moveToElementText(containerEl);
81
+ textRange.collapse(true);
82
+ textRange.moveEnd("character", savedSel.end);
83
+ textRange.moveStart("character", savedSel.start);
84
+ textRange.select();
85
+ };
86
+ }
87
+
88
+ // getCaretPosition: return [start, end] as offsets to elem.textContent that
89
+ // correspond to the selected portion of text
90
+ // (if start == end, caret is at given position and no text is selected)
91
+
92
+ // export function getCaretPosition(elem) {
93
+ // const sel = window.getSelection();
94
+ // let cum_length = [0, 0];
95
+
96
+ // if (sel.anchorNode == elem) cum_length = [sel.anchorOffset, sel.extentOffset];
97
+ // else {
98
+ // const nodes_to_find = [sel.anchorNode, sel.extentNode];
99
+ // if (!elem.contains(sel.anchorNode) || !elem.contains(sel.extentNode))
100
+ // return undefined;
101
+ // else {
102
+ // const found = [0, 0];
103
+ // let i;
104
+ // node_walk(elem, function (node) {
105
+ // for (i = 0; i < 2; i++) {
106
+ // if (node == nodes_to_find[i]) {
107
+ // found[i] = true;
108
+ // if (found[i == 0 ? 1 : 0]) return false; // all done
109
+ // }
110
+ // }
111
+
112
+ // if (node.textContent && !node.firstChild) {
113
+ // for (i = 0; i < 2; i++) {
114
+ // if (!found[i]) cum_length[i] += node.textContent.length;
115
+ // }
116
+ // }
117
+ // });
118
+ // cum_length[0] += sel.anchorOffset;
119
+ // cum_length[1] += sel.extentOffset;
120
+ // }
121
+ // }
122
+ // if (cum_length[0] <= cum_length[1]) return cum_length;
123
+ // return [cum_length[1], cum_length[0]];
124
+ // }
125
+
126
+ // no operation
127
+ const noop = () => null;
128
+
129
+ /**
130
+ * @function
131
+ * @description
132
+ * @param {DOMElement} container The container in which the cursor position must be saved
133
+ * @return {Function} A function used to restore caret position
134
+ */
135
+ export function selectionSaveCaretPosition(container) {
136
+ const selection = window.getSelection();
137
+
138
+ if (!selection || selection.rangeCount === 0) {
139
+ return noop;
140
+ }
141
+
142
+ const range = selection.getRangeAt(0);
143
+ const clone = range.cloneRange();
144
+
145
+ // find the range start index
146
+ clone.selectNodeContents(container);
147
+ clone.setStart(container, 0);
148
+ clone.setEnd(range.startContainer, range.startOffset);
149
+ const startIndex = clone.toString().length;
150
+
151
+ // find the range end index
152
+ clone.selectNodeContents(container);
153
+ clone.setStart(container, 0);
154
+ clone.setEnd(range.endContainer, range.endOffset);
155
+ const endIndex = clone.toString().length;
156
+
157
+ return function restoreCaretPosition() {
158
+ const start = getTextNodeAtPosition(container, startIndex);
159
+ const end = getTextNodeAtPosition(container, endIndex);
160
+ const newRange = new Range();
161
+
162
+ newRange.setStart(start.node, start.position);
163
+ newRange.setEnd(end.node, end.position);
164
+
165
+ selection.removeAllRanges();
166
+ selection.addRange(newRange);
167
+ container.focus();
168
+ };
169
+ }
170
+
171
+ /**
172
+ * @function
173
+ * @description This function is used to determine the text node and it's index within
174
+ * a "root" DOM element.
175
+ *
176
+ * @param {DOMElement} rootEl The root
177
+ * @param {Integer} index The index within the root element of which you want to find the text node
178
+ * @return {Object} An object that contains the text node, and the index within that text node
179
+ */
180
+ function getTextNodeAtPosition(rootEl, index) {
181
+ const treeWalker = document.createTreeWalker(
182
+ rootEl,
183
+ NodeFilter.SHOW_TEXT,
184
+ function next(elem) {
185
+ if (index > elem.textContent.length) {
186
+ index -= elem.textContent.length;
187
+ return NodeFilter.FILTER_REJECT;
188
+ }
189
+ return NodeFilter.FILTER_ACCEPT;
190
+ }
191
+ );
192
+ const node = treeWalker.nextNode();
193
+
194
+ return {
195
+ node: node ? node : rootEl,
196
+ position: node ? index : 0
197
+ };
198
+ }
199
+
200
+ // node_walk: walk the element tree, stop when func(node) returns false
201
+ // function node_walk(node, func) {
202
+ // let result = func(node);
203
+ // for (
204
+ // node = node.firstChild;
205
+ // result !== false && node;
206
+ // node = node.nextSibling
207
+ // )
208
+ // result = node_walk(node, func);
209
+ // return result;
210
+ // }
211
+
212
+ // const charpos = getCaretPosition(inputRef.current);
213
+
214
+ // let isChangeCloserToEnd;
215
+ // if (charpos && charpos[0]) {
216
+ // if (charpos[0] > newVal.length - charpos[0]) {
217
+ // isChangeCloserToEnd = true;
218
+ // }
219
+ // }
220
+ // if (forward && !isChangeCloserToEnd) {
221
+ // if (end || end === 0) {
222
+ // change(
223
+ // "start",
224
+ // normalizePositionByRangeLength(end - textLength + 1, seqLen)
225
+ // );
226
+ // }
227
+ // } else {
228
+ // if (start || start === 0) {
229
+ // change(
230
+ // "end",
231
+ // normalizePositionByRangeLength(start + textLength - 1, seqLen)
232
+ // );
233
+ // }
234
+ // }
@@ -0,0 +1,30 @@
1
+ import React from "react";
2
+ import { DialogFooter, InputField, wrapDialog } from "@teselagen/ui";
3
+ import { compose } from "recompose";
4
+ import { reduxForm } from "redux-form";
5
+
6
+ export const EditTrackNameDialog = compose(
7
+ wrapDialog({
8
+ title: "Edit Track Name"
9
+ }),
10
+ reduxForm({ form: "EditTrackNameDialog" })
11
+ )(function ({ handleSubmit, updateName, hideModal }) {
12
+ return (
13
+ <div>
14
+ <div className="bp3-dialog-body">
15
+ <InputField
16
+ autoFocus
17
+ label="New Name"
18
+ isRequired
19
+ name="name"
20
+ ></InputField>
21
+ </div>
22
+ <DialogFooter
23
+ onClick={handleSubmit(async ({ name }) => {
24
+ await updateName({ newName: name });
25
+ hideModal();
26
+ })}
27
+ ></DialogFooter>
28
+ </div>
29
+ );
30
+ });
package/Feature.js ADDED
@@ -0,0 +1,83 @@
1
+ import { startsWith } from "lodash-es";
2
+ import React from "react";
3
+
4
+ import drawDirectedPiePiece from "./drawDirectedPiePiece";
5
+ import { getInternalLabel } from "./getInternalLabel";
6
+ import shouldFlipText from "./shouldFlipText";
7
+
8
+ export default function Feature(props) {
9
+ const {
10
+ color = "orange",
11
+ radius,
12
+ containsLocations,
13
+ arrowheadLength = 0.5,
14
+ annotationHeight,
15
+ className,
16
+ ellipsizedName,
17
+ annotationType,
18
+ arrowheadType,
19
+ overlapsSelf,
20
+ rotationRadians,
21
+ centerAngle,
22
+ totalAngle,
23
+ locationNumber
24
+ } = props;
25
+ const isPart = annotationType === "part";
26
+ let colorToUse = color;
27
+ if (isPart) {
28
+ colorToUse = startsWith(color, "override_")
29
+ ? color.replace("override_", "")
30
+ : "#ac68cc";
31
+ }
32
+ const labelNeedsFlip = shouldFlipText(centerAngle + rotationRadians);
33
+ if (containsLocations) {
34
+ const path = drawDirectedPiePiece({
35
+ radius: radius,
36
+ labelNeedsFlip,
37
+ annotationHeight: annotationHeight / 8,
38
+ totalAngle,
39
+ arrowheadLength: 80 / radius,
40
+ tailThickness: 1 //feature specific
41
+ });
42
+ return (
43
+ <path
44
+ className={className}
45
+ strokeWidth=".5"
46
+ stroke="black"
47
+ fill={colorToUse}
48
+ d={path.print()}
49
+ />
50
+ );
51
+ }
52
+ const [path, textPath] = drawDirectedPiePiece({
53
+ returnTextPath: true,
54
+ overlapsSelf,
55
+ arrowheadType,
56
+ hasLabel: ellipsizedName,
57
+ labelNeedsFlip,
58
+ radius,
59
+ annotationHeight,
60
+ totalAngle,
61
+ arrowheadLength,
62
+ tailThickness: 1 //feature specific
63
+ });
64
+
65
+ return (
66
+ <>
67
+ <path
68
+ className={className}
69
+ strokeWidth=".5"
70
+ stroke={isPart ? colorToUse : "black"}
71
+ fill={isPart ? undefined : colorToUse}
72
+ d={path.print()}
73
+ />
74
+ {getInternalLabel({
75
+ ...props,
76
+ colorToUse,
77
+ textPath,
78
+ isPart,
79
+ locationNumber
80
+ })}
81
+ </>
82
+ );
83
+ }
@@ -0,0 +1,6 @@
1
+ import { featuresSubmenu } from "../../MenuBar/viewSubmenu";
2
+ import genericAnnotationProperties from "./GenericAnnotationProperties";
3
+ export default genericAnnotationProperties({
4
+ visSubmenu: featuresSubmenu,
5
+ annotationType: "feature"
6
+ });
package/FillWindow.js ADDED
@@ -0,0 +1,47 @@
1
+ import React from "react";
2
+ import { debounce } from "lodash-es";
3
+
4
+ export default class FillWindow extends React.Component {
5
+ updateDimensions = debounce(() => {
6
+ if (this.props.disabled) return;
7
+ this.setState({ randomRerenderTrigger: Math.random() });
8
+ }, 100);
9
+
10
+ componentDidMount() {
11
+ window.addEventListener("resize", this.updateDimensions);
12
+ }
13
+ componentWillUnmount() {
14
+ window.removeEventListener("resize", this.updateDimensions);
15
+ }
16
+ render() {
17
+ const w = window,
18
+ d = document,
19
+ e = d.documentElement,
20
+ g = d.getElementsByTagName("body")[0],
21
+ width = w.innerWidth || e.clientWidth || g.clientWidth,
22
+ height = w.innerHeight || e.clientHeight || g.clientHeight;
23
+ const windowDimensions = {
24
+ width,
25
+ height
26
+ };
27
+ const { children, disabled, style, ...rest } = this.props;
28
+ if (disabled) return children(windowDimensions);
29
+ return (
30
+ <div
31
+ {...rest}
32
+ style={{
33
+ zIndex: 10,
34
+ width,
35
+ height,
36
+ position: "fixed",
37
+ top: 0,
38
+ left: 0,
39
+ background: "white",
40
+ ...style
41
+ }}
42
+ >
43
+ {children(windowDimensions)}
44
+ </div>
45
+ );
46
+ }
47
+ }
package/GenbankView.js ADDED
@@ -0,0 +1,74 @@
1
+ import React from "react";
2
+ // import { Button } from "@blueprintjs/core";
3
+ import {
4
+ jsonToGenbank,
5
+ jsonToFasta,
6
+ cleanUpTeselagenJsonForExport
7
+ } from "@teselagen/bio-parsers";
8
+ import { HTMLSelect } from "@blueprintjs/core";
9
+ import { connectToEditor } from "../../withEditorProps";
10
+ import { compose } from "recompose";
11
+
12
+ class GenbankView extends React.Component {
13
+ state = {
14
+ fileTypeToView: "genbank"
15
+ };
16
+ select = () => this._input?.select();
17
+ render() {
18
+ const { sequenceData = {} } = this.props;
19
+ let filestring;
20
+ switch (this.state.fileTypeToView) {
21
+ case "fasta":
22
+ filestring = jsonToFasta(sequenceData);
23
+ break;
24
+ case "teselagen":
25
+ filestring = JSON.stringify(
26
+ cleanUpTeselagenJsonForExport(sequenceData),
27
+ null,
28
+ 4
29
+ );
30
+ break;
31
+ default:
32
+ filestring = jsonToGenbank(sequenceData);
33
+ }
34
+
35
+ return (
36
+ <>
37
+ <HTMLSelect
38
+ className="genbankFileView-type"
39
+ fill={false}
40
+ options={[
41
+ { label: "Genbank", value: "genbank" },
42
+ { label: "Fasta", value: "fasta" },
43
+ { label: "Teselagen JSON", value: "teselagen" }
44
+ ]}
45
+ onChange={e => {
46
+ this.setState({ fileTypeToView: e.target.value });
47
+ }}
48
+ />
49
+ <textarea
50
+ data-test="ve-genbank-text"
51
+ readOnly
52
+ onClick={this.select}
53
+ style={{
54
+ whiteSpace: "pre",
55
+ overflowWrap: "normal",
56
+ overflowX: "scroll",
57
+ fontSize: 11,
58
+ fontFamily: "monospace",
59
+ height: 350
60
+ }}
61
+ value={filestring}
62
+ />
63
+ </>
64
+ );
65
+ }
66
+ }
67
+
68
+ export default compose(
69
+ connectToEditor(({ sequenceData = {} }) => {
70
+ return {
71
+ sequenceData
72
+ };
73
+ })
74
+ )(GenbankView);
@@ -0,0 +1,117 @@
1
+ import React from "react";
2
+ import { InputField, TextareaField } from "@teselagen/ui";
3
+ import { reduxForm } from "redux-form";
4
+ import withEditorProps from "../../withEditorProps";
5
+ import { compose } from "recompose";
6
+ import {
7
+ EditAvailabilityItem,
8
+ EditCircularityItem,
9
+ EditReadOnlyItem
10
+ } from "../../StatusBar";
11
+
12
+ class GeneralProperties extends React.Component {
13
+ updateSeqDesc = val => {
14
+ return this.props.sequenceDescriptionUpdate(val);
15
+ };
16
+ render() {
17
+ const {
18
+ readOnly,
19
+ showReadOnly = true,
20
+ isProtein,
21
+ disableSetReadOnly,
22
+ sequenceData,
23
+ onSave,
24
+ showAvailability,
25
+ beforeReadOnlyChange,
26
+ editorName,
27
+ disableBpEditing,
28
+ sequenceNameUpdate
29
+ } = this.props;
30
+ const {
31
+ description,
32
+ name,
33
+ isOligo,
34
+ isRna,
35
+ sequence = "",
36
+ proteinSequence = ""
37
+ } = sequenceData || {};
38
+ return (
39
+ <React.Fragment>
40
+ <div className="ve-flex-row">
41
+ <div className="ve-column-left bp3-label">Name</div>{" "}
42
+ <div className="ve-column-right">
43
+ <InputField
44
+ disabled={readOnly}
45
+ onFieldSubmit={val => {
46
+ sequenceNameUpdate(val);
47
+ }}
48
+ name="name"
49
+ enableReinitialize
50
+ defaultValue={name}
51
+ />{" "}
52
+ </div>
53
+ </div>
54
+
55
+ {!isProtein && !isOligo && !isRna && (
56
+ <div className="ve-flex-row circularLinearSelect">
57
+ <div className="ve-column-left bp3-label">Circular/Linear</div>{" "}
58
+ <div className="ve-column-right">
59
+ {" "}
60
+ <EditCircularityItem editorName={editorName} showCircularity />
61
+ </div>
62
+ </div>
63
+ )}
64
+
65
+ {showAvailability && (
66
+ <div className="ve-flex-row">
67
+ <div className="ve-column-left bp3-label">
68
+ Material Availability
69
+ </div>{" "}
70
+ <div className="ve-column-right">
71
+ {" "}
72
+ <EditAvailabilityItem editorName={editorName} showAvailability />
73
+ </div>
74
+ </div>
75
+ )}
76
+ <div className="ve-flex-row">
77
+ <div className="ve-column-left bp3-label">Length</div>{" "}
78
+ <div className="ve-column-right">
79
+ {" "}
80
+ {isProtein ? proteinSequence.length : sequence.length}
81
+ </div>
82
+ </div>
83
+ {showReadOnly && (
84
+ <div className="ve-flex-row">
85
+ <div className="ve-column-left bp3-label">Is Editable</div>{" "}
86
+ <div className="ve-column-right">
87
+ {" "}
88
+ <EditReadOnlyItem
89
+ beforeReadOnlyChange={beforeReadOnlyChange}
90
+ editorName={editorName}
91
+ onSave={onSave}
92
+ disableBpEditing={disableBpEditing}
93
+ disableSetReadOnly={disableSetReadOnly}
94
+ showReadOnly={showReadOnly}
95
+ />
96
+ </div>
97
+ </div>
98
+ )}
99
+ <div>Description</div>
100
+ <TextareaField
101
+ clickToEdit
102
+ name="description"
103
+ onFieldSubmit={this.updateSeqDesc}
104
+ defaultValue={description}
105
+ disabled={readOnly}
106
+ />
107
+ </React.Fragment>
108
+ );
109
+ }
110
+ }
111
+
112
+ export default compose(
113
+ withEditorProps,
114
+ reduxForm({
115
+ form: "GeneralProperties"
116
+ })
117
+ )(GeneralProperties);