@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.
- package/AASliver.js +187 -0
- package/AddLaddersDialog.js +82 -0
- package/AdditionalCutsiteInfoDialog.js +599 -0
- package/AlignmentView/Mismatches.d.ts +3 -3
- package/AlignmentVisibilityTool.js +105 -0
- package/AnnotationContainerHolder.js +20 -0
- package/AnnotationPositioner.js +27 -0
- package/AutoAnnotate.js +501 -0
- package/AutoAnnotateBpMatchingDialog.js +208 -0
- package/Axis.js +151 -0
- package/AxisNumbers.js +35 -0
- package/Browser.js +106 -0
- package/Caret.js +63 -0
- package/Chromatogram.js +293 -0
- package/CircularDnaSequence.js +73 -0
- package/CircularView/Labels/index.d.ts +1 -1
- package/CircularView/index.d.ts +0 -1
- package/CircularZoomMinimap.js +16 -0
- package/ColorPicker.js +30 -0
- package/CommandHotkeyHandler.js +44 -0
- package/CreateAnnotationsPage.d.ts +4 -4
- package/CreateAnnotationsPage.js +98 -0
- package/Cutsite.js +18 -0
- package/CutsiteProperties.js +176 -0
- package/CutsiteSelectionLayers.js +47 -0
- package/Cutsites.js +271 -0
- package/DeletionLayer.js +28 -0
- package/DigestTool/Ladder.d.ts +1 -1
- package/DropHandler.css +21 -0
- package/DropHandler.js +64 -0
- package/EditCaretPosition.js +234 -0
- package/EditTrackNameDialog.js +30 -0
- package/Feature.js +83 -0
- package/FeatureProperties.js +6 -0
- package/FillWindow.js +47 -0
- package/GenbankView.js +74 -0
- package/GeneralProperties.js +117 -0
- package/GenericAnnotationProperties.js +406 -0
- package/GlobalDialog.js +73 -0
- package/GlobalDialogUtils.js +110 -0
- package/GoToDialog.js +25 -0
- package/HorizontalPanelDragHandle.js +35 -0
- package/Keyboard.js +85 -0
- package/Labels.js +327 -0
- package/Ladder.css +20 -0
- package/Ladder.js +303 -0
- package/MeltingTemp.js +85 -0
- package/Menlo.ttf +0 -0
- package/Minimap.js +515 -0
- package/Mismatches.js +134 -0
- package/Monaco.ttf +0 -0
- package/MultipleSeqsDetectedOnImportDialog.js +74 -0
- package/Orf.js +109 -0
- package/OrfProperties.js +117 -0
- package/Orfs.js +35 -0
- package/PCRTool.js +179 -0
- package/PairwiseAlignmentView.js +68 -0
- package/Part.js +34 -0
- package/PartProperties.js +9 -0
- package/PassThrough.js +3 -0
- package/PerformantSelectionLayer.js +32 -0
- package/PinchHelper.js +24 -0
- package/PointedAnnotation.js +347 -0
- package/PositionAnnotationOnCircle.js +26 -0
- package/Primer.js +41 -0
- package/PrimerProperties.js +19 -0
- package/Reflex/index.d.ts +0 -1
- package/ReflexContainer.js +802 -0
- package/ReflexElement.js +160 -0
- package/ReflexEvents.js +77 -0
- package/ReflexSplitter.js +205 -0
- package/RenameSequenceDialog.js +7 -0
- package/RotateCircularViewSlider.js +93 -0
- package/RowView/index.d.ts +0 -1
- package/SelectDialog.js +150 -0
- package/SequenceName.js +15 -0
- package/SimpleCircularOrLinearView.js +381 -0
- package/SimpleOligoPreview.js +39 -0
- package/SingleEnzymeCutsiteInfo.js +139 -0
- package/ToolBar/ToolbarItem.d.ts +1 -3
- package/ToolbarItem.js +192 -0
- package/Translation.js +198 -0
- package/TranslationProperties.js +149 -0
- package/UncontrolledSliderWithPlusMinusBtns.css +5 -0
- package/UncontrolledSliderWithPlusMinusBtns.js +134 -0
- package/VeTopRightContainer.js +12 -0
- package/ZoomCircularViewSlider.js +62 -0
- package/ZoomLinearView.js +47 -0
- package/addAlignment.js +6 -0
- package/addMetaToActionCreators.js +12 -0
- package/addWrappedAddons.js +20 -0
- package/alignmentTool.js +503 -0
- package/alignments.js +379 -0
- package/annotationLabelVisibility.js +2 -0
- package/annotationSearchSelector.js +24 -0
- package/annotationTypes.js +35 -0
- package/annotationVisibility.js +196 -0
- package/annotationsToSupport.js +104 -0
- package/arrayToObjWithIds.js +17 -0
- package/arrayUtils.js +19 -0
- package/array_move.js +10 -0
- package/calculateTickMarkPositionsForGivenRange.js +47 -0
- package/caretPosition.js +27 -0
- package/cdsFeaturesSelector.js +9 -0
- package/charWidth.js +22 -0
- package/circular.js +19 -0
- package/circularSelector.js +4 -0
- package/clickAndDragUtils.js +576 -0
- package/coerceInitialValue.js +7 -0
- package/combineReducersDontIgnoreKeys.js +12 -0
- package/commandUtils.js +20 -0
- package/constants.js +2 -0
- package/copyOptions.js +34 -0
- package/createFragmentLines.js +120 -0
- package/createMergedDefaultStateReducer.js +30 -0
- package/createMetaAction.js +12 -0
- package/createSequenceInputPopup.js +290 -0
- package/createSequenceInputPopupStyle.css +87 -0
- package/createSimpleDialog.js +89 -0
- package/createYourOwnEnzyme.js +39 -0
- package/cutsiteLabelColorSelector.js +6 -0
- package/cutsiteTool.js +88 -0
- package/cutsitesByRangeSelector.js +5 -0
- package/cutsitesSelector.js +61 -0
- package/darkmode.css +98 -0
- package/defaultConfig.js +150 -0
- package/deletionLayers.js +36 -0
- package/description.js +21 -0
- package/digestTool.js +34 -0
- package/dnaToColor.js +17 -0
- package/downloadTool.js +39 -0
- package/draggableClassnames.js +5 -0
- package/drawAnnotations.js +440 -0
- package/drawDirectedPiePiece.js +142 -0
- package/editTool.js +49 -0
- package/editorSelector.js +2 -0
- package/editorUtils.js +205 -0
- package/estimateRowHeight.js +184 -0
- package/featureLengthsToHide.js +27 -0
- package/featureTool.js +34 -0
- package/features.js +19 -0
- package/featuresSelector.js +8 -0
- package/filteredCutsitesSelector.js +136 -0
- package/filteredFeaturesSelector.js +32 -0
- package/filteredPartsSelector.js +57 -0
- package/filteredPrimersSelector.js +27 -0
- package/filteredRestrictionEnzymesSelector.js +1 -0
- package/find.png +0 -0
- package/findTool.js +79 -0
- package/findToolConstants.js +1 -0
- package/frameTranslations.js +52 -0
- package/fullscreen.png +0 -0
- package/getAdditionalEnzymesSelector.js +46 -0
- package/getAngleForPositionMidpoint.js +3 -0
- package/getAnnotationClassnames.js +12 -0
- package/getAnnotationNameAndStartStopString.js +61 -0
- package/getBpsPerRow.js +19 -0
- package/getCutsiteLabelHeights.js +56 -0
- package/getGapMap.js +12 -0
- package/getGaps.js +27 -0
- package/getInternalLabel.js +40 -0
- package/getOveHotkeyDefs.js +12 -0
- package/getPairwiseOverviewLinearViewOptions.js +38 -0
- package/getRangeAnglesSpecial.js +12 -0
- package/getStructuredBases.js +97 -0
- package/getTrackFromEvent.js +25 -0
- package/getVisibleStartEnd.js +7 -0
- package/getXStartAndWidthFromNonCircularRange.js +12 -0
- package/getXStartAndWidthOfRangeWrtRow.js +27 -0
- package/getXStartAndWidthOfRowAnnotation.js +19 -0
- package/getYOffset.js +15 -0
- package/hoveredAnnotation.js +24 -0
- package/{html2canvas.esm--JN4fLQL.js → html2canvas.esm-DiGWN1gP.js} +187 -229
- package/{html2canvas.esm-B7d7VJmQ.cjs → html2canvas.esm-J1esNpMJ.cjs} +187 -229
- package/importTool.js +27 -0
- package/index.cjs.js +48165 -47142
- package/index.es.js +47699 -46676
- package/index.js +71 -0
- package/inlineFindTool.js +38 -0
- package/isElementInViewport.js +29 -0
- package/isEnzymeFilterAndSelector.js +1 -0
- package/isTargetWithinEl.js +6 -0
- package/labelLineIntensity.js +25 -0
- package/labelSize.js +23 -0
- package/ladderDefaults.js +25 -0
- package/lastSavedId.js +20 -0
- package/lineageLines.js +11 -0
- package/linear.png +0 -0
- package/makeStore.js +34 -0
- package/massageTickSpacing.js +19 -0
- package/materiallyAvailable.js +19 -0
- package/middleware.js +112 -0
- package/minimumOrfSize.js +24 -0
- package/minimumOrfSizeSelector.js +2 -0
- package/modalActions.js +3 -0
- package/moveCaret.js +58 -0
- package/name.js +19 -0
- package/normalizeAngle.js +3 -0
- package/normalizeAngleRange.js +9 -0
- package/oligoTool.js +30 -0
- package/onlyUpdateForKeysDeep.js +31 -0
- package/orfFrameToColorMap.js +10 -0
- package/orfTool.js +136 -0
- package/orfsSelector.js +15 -0
- package/ove.css +12107 -0
- package/package.json +6 -5
- package/panelsShown.js +294 -0
- package/partLengthsToHide.js +23 -0
- package/partOverhangs.js +6 -0
- package/partTagSearch.js +69 -0
- package/partTool.js +45 -0
- package/parts.js +19 -0
- package/partsSelector.js +8 -0
- package/pie.png +0 -0
- package/polarToSpecialCartesian.js +7 -0
- package/positionCutsites.js +6 -0
- package/prepareRowData.js +64 -0
- package/primerBases.js +221 -0
- package/primerLengthsToHide.js +27 -0
- package/primers.js +19 -0
- package/primersSelector.js +8 -0
- package/print.png +0 -0
- package/printTool.js +31 -0
- package/propertiesTool.js +40 -0
- package/proteinUtils.js +3 -0
- package/pureNoFunc.js +18 -0
- package/readOnly.js +25 -0
- package/redoTool.js +30 -0
- package/reflex-styles.css +128 -0
- package/reflex-styles.css.map +9 -0
- package/relaxLabelAngles.js +157 -0
- package/relaxLabels_DEPRECATED.js +105 -0
- package/replacementLayers.js +36 -0
- package/restrictionEnzymes.js +52 -0
- package/restrictionEnzymesSelector.js +34 -0
- package/rowviewContants.js +3 -0
- package/ruler.css +89 -0
- package/save.png +0 -0
- package/saveTool.js +44 -0
- package/searchLayersSelector.js +71 -0
- package/selectedAnnotations.js +89 -0
- package/selectedAnnotationsSelector.js +1 -0
- package/selectedCutsitesSelector.js +21 -0
- package/selectedPartTags.js +21 -0
- package/selectionLayer.js +25 -0
- package/selectors/annotationSearchSelector.d.ts +1 -1
- package/sequence.js +12 -0
- package/sequenceDataHistory.js +43 -0
- package/sequenceDataSelector.js +2 -0
- package/sequenceLengthSelector.js +5 -0
- package/sequenceSelector.js +4 -0
- package/sharedActionCreators.js +0 -0
- package/shouldFlipText.js +4 -0
- package/shouldRerender.js +27 -0
- package/showFileDialog.js +25 -0
- package/showGCContent.js +23 -0
- package/show_cut_sites.png +0 -0
- package/show_features.png +0 -0
- package/show_orfs.png +0 -0
- package/show_primers.png +0 -0
- package/simpleDialog.css +13 -0
- package/specialCutsiteFilterOptions.js +22 -0
- package/src/Editor/DropHandler.js +2 -1
- package/src/Editor/index.js +0 -2
- package/src/RowItem/StackedAnnotations/getStructuredBases.js +20 -6
- package/src/ToolBar/cutsiteTool.js +1 -1
- package/src/helperComponents/PropertiesDialog/TranslationProperties.js +2 -1
- package/style.css +3 -12100
- package/tagsToBoldSelector.js +2 -0
- package/toggle_views.svg +1 -0
- package/toolBar.js +23 -0
- package/translationSearchMatchesSelector.js +14 -0
- package/translations.js +20 -0
- package/translationsRawSelector.js +8 -0
- package/translationsSelector.js +137 -0
- package/typeField.js +24 -0
- package/undoTool.js +30 -0
- package/updateEditor.d.ts +1 -3
- package/updateEditor.js +200 -0
- package/updateLabelsForInViewFeatures.js +55 -0
- package/updateLabelsForInViewFeaturesCircView.js +41 -0
- package/updateTrackHelper.js +58 -0
- package/uppercaseSequenceMapFont.js +25 -0
- package/upsertDeleteActionGenerator.js +31 -0
- package/useAAColorType.js +8 -0
- package/useAdditionalOrfStartCodons.js +24 -0
- package/useAnnotationLimits.js +42 -0
- package/useChromatogramPrefs.js +31 -0
- package/useFormValue.js +7 -0
- package/useLadders.js +6 -0
- package/useMeltingTemp.js +7 -0
- package/useTmType.js +10 -0
- package/userDefinedHandlersAndOpts.js +61 -0
- package/utils/getAnnotationNameAndStartStopString.d.ts +1 -5
- package/utils/selectionLayer.d.ts +2 -2
- package/utils.js +37 -0
- package/versionHistory.js +26 -0
- package/versionHistoryTool.js +21 -0
- package/viewSubmenu.js +479 -0
- package/visibilityTool.js +39 -0
- package/withEditorInteractions/getBpsPerRow.d.ts +1 -3
- package/withHover.js +113 -0
- package/withRestrictionEnzymes.js +15 -0
- 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
|
+
}
|
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);
|