ketcher-react 3.9.0-rc.2 → 3.10.0-build.2
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/dist/cjs/index.js +81 -211
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/{index.modern-bddb9120.js → index.modern-d047d786.js} +4 -4
- package/dist/cjs/index.modern-d047d786.js.map +1 -0
- package/dist/cjs/script/editor/Editor.d.ts +0 -2
- package/dist/cjs/script/ui/action/tools.d.ts +2 -2
- package/dist/cjs/script/ui/views/components/MonomerCreationWizard/MonomerCreationWizard.types.d.ts +1 -1
- package/dist/index.js +80 -211
- package/dist/index.js.map +1 -1
- package/dist/{index.modern-87b29a80.js → index.modern-68c23873.js} +4 -4
- package/dist/index.modern-68c23873.js.map +1 -0
- package/dist/script/editor/Editor.d.ts +0 -2
- package/dist/script/ui/action/tools.d.ts +2 -2
- package/dist/script/ui/views/components/MonomerCreationWizard/MonomerCreationWizard.types.d.ts +1 -1
- package/package.json +2 -1
- package/dist/cjs/index.modern-bddb9120.js.map +0 -1
- package/dist/index.modern-87b29a80.js.map +0 -1
package/dist/cjs/index.js
CHANGED
|
@@ -44,6 +44,7 @@ var _ = require('lodash');
|
|
|
44
44
|
var _taggedTemplateLiteral = require('@babel/runtime/helpers/taggedTemplateLiteral');
|
|
45
45
|
var styled = require('@emotion/styled');
|
|
46
46
|
var react = require('@emotion/react');
|
|
47
|
+
var KN = require('w3c-keyname');
|
|
47
48
|
var require$$0$3 = require('util');
|
|
48
49
|
var ReactDOM = require('react-dom');
|
|
49
50
|
var reactRedux = require('react-redux');
|
|
@@ -121,6 +122,7 @@ var _toConsumableArray__default = /*#__PURE__*/_interopDefaultLegacy(_toConsumab
|
|
|
121
122
|
var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
|
|
122
123
|
var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_taggedTemplateLiteral);
|
|
123
124
|
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
125
|
+
var KN__namespace = /*#__PURE__*/_interopNamespace(KN);
|
|
124
126
|
var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0$3);
|
|
125
127
|
var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
|
126
128
|
var CFB__namespace = /*#__PURE__*/_interopNamespace(CFB);
|
|
@@ -2852,7 +2854,7 @@ var toolActions = (_toolActions = {
|
|
|
2852
2854
|
}
|
|
2853
2855
|
},
|
|
2854
2856
|
'charge-plus': {
|
|
2855
|
-
shortcut:
|
|
2857
|
+
shortcut: '+',
|
|
2856
2858
|
title: 'Charge Plus',
|
|
2857
2859
|
action: {
|
|
2858
2860
|
tool: 'charge',
|
|
@@ -2863,7 +2865,7 @@ var toolActions = (_toolActions = {
|
|
|
2863
2865
|
}
|
|
2864
2866
|
},
|
|
2865
2867
|
'charge-minus': {
|
|
2866
|
-
shortcut:
|
|
2868
|
+
shortcut: '-',
|
|
2867
2869
|
title: 'Charge Minus',
|
|
2868
2870
|
action: {
|
|
2869
2871
|
tool: 'charge',
|
|
@@ -3900,7 +3902,7 @@ var zoom = {
|
|
|
3900
3902
|
}
|
|
3901
3903
|
},
|
|
3902
3904
|
'zoom-out': {
|
|
3903
|
-
shortcut: ['
|
|
3905
|
+
shortcut: ['Ctrl+_', 'Ctrl+-'],
|
|
3904
3906
|
title: 'Zoom Out',
|
|
3905
3907
|
enabledInViewOnly: true,
|
|
3906
3908
|
disabled: function disabled(editor) {
|
|
@@ -3922,7 +3924,7 @@ var zoom = {
|
|
|
3922
3924
|
}
|
|
3923
3925
|
},
|
|
3924
3926
|
'zoom-in': {
|
|
3925
|
-
shortcut: ['
|
|
3927
|
+
shortcut: ['Ctrl+=', 'Ctrl++'],
|
|
3926
3928
|
title: 'Zoom In',
|
|
3927
3929
|
enabledInViewOnly: true,
|
|
3928
3930
|
disabled: function disabled(editor) {
|
|
@@ -3953,7 +3955,7 @@ var zoom = {
|
|
|
3953
3955
|
|
|
3954
3956
|
var openHelpLink = function openHelpLink() {
|
|
3955
3957
|
var _window$open;
|
|
3956
|
-
return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("
|
|
3958
|
+
return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("master", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
|
|
3957
3959
|
};
|
|
3958
3960
|
var help = {
|
|
3959
3961
|
help: {
|
|
@@ -8914,7 +8916,7 @@ var Dialog = function Dialog(props) {
|
|
|
8914
8916
|
}
|
|
8915
8917
|
};
|
|
8916
8918
|
var keyDown = function keyDown(event) {
|
|
8917
|
-
var key = event
|
|
8919
|
+
var key = KN__namespace.keyName(event);
|
|
8918
8920
|
var active = document.activeElement;
|
|
8919
8921
|
var activeTextarea = active && active.tagName === 'TEXTAREA';
|
|
8920
8922
|
if (key === 'Escape' || key === 'Enter' && !activeTextarea) {
|
|
@@ -20414,8 +20416,8 @@ function keyHandle(dispatch, getState, hotKeys, event) {
|
|
|
20414
20416
|
var hoveredItem = getHoveredItem(render.ctab);
|
|
20415
20417
|
if (key && key.length === 1 && !hoveredItem) {
|
|
20416
20418
|
var currentlyPressedKeys = selectAbbreviationLookupValue(state);
|
|
20417
|
-
var isShortcutKey = shortcutKeys.includes(key.toLowerCase());
|
|
20418
|
-
var isTheSameKey = key
|
|
20419
|
+
var isShortcutKey = shortcutKeys.includes(key === null || key === void 0 ? void 0 : key.toLowerCase());
|
|
20420
|
+
var isTheSameKey = key === currentlyPressedKeys;
|
|
20419
20421
|
var isAbbreviationLookupShown = (!isTheSameKey || !isShortcutKey) && currentlyPressedKeys;
|
|
20420
20422
|
if (isAbbreviationLookupShown) {
|
|
20421
20423
|
dispatch(showAbbreviationLookup(event.key));
|
|
@@ -20433,7 +20435,7 @@ function keyHandle(dispatch, getState, hotKeys, event) {
|
|
|
20433
20435
|
dispatch(initAbbreviationLookup(event.key));
|
|
20434
20436
|
}
|
|
20435
20437
|
}
|
|
20436
|
-
if (key === '
|
|
20438
|
+
if (key && key.length === 1 && key.match('/')) {
|
|
20437
20439
|
var hotkeyDialogTypes = {
|
|
20438
20440
|
atoms: configWithNonViewOnlyActionsDisabled['atom-props'].action,
|
|
20439
20441
|
bonds: configWithNonViewOnlyActionsDisabled['bond-props'].action
|
|
@@ -25639,35 +25641,11 @@ var Editor$3 = function () {
|
|
|
25639
25641
|
}
|
|
25640
25642
|
return false;
|
|
25641
25643
|
}
|
|
25642
|
-
}, {
|
|
25643
|
-
key: "isMinimalViableStructure",
|
|
25644
|
-
value: function isMinimalViableStructure() {
|
|
25645
|
-
var _this = this;
|
|
25646
|
-
var nonLeavingAtoms = this.struct().atoms.filter(function (atomId) {
|
|
25647
|
-
assert_1(_this.monomerCreationState);
|
|
25648
|
-
return Array.from(_this.monomerCreationState.assignedAttachmentPoints.values()).every(function (atomPair) {
|
|
25649
|
-
return atomPair[1] !== atomId;
|
|
25650
|
-
});
|
|
25651
|
-
});
|
|
25652
|
-
if (nonLeavingAtoms.size < 2) {
|
|
25653
|
-
return false;
|
|
25654
|
-
}
|
|
25655
|
-
var nonLeavingAtomBonds = this.struct().bonds.filter(function (_, bond) {
|
|
25656
|
-
return nonLeavingAtoms.has(bond.begin) && nonLeavingAtoms.has(bond.end);
|
|
25657
|
-
});
|
|
25658
|
-
if (nonLeavingAtomBonds.size < 1) {
|
|
25659
|
-
return false;
|
|
25660
|
-
}
|
|
25661
|
-
var simpleSingleBonds = nonLeavingAtomBonds.filter(function (_, bond) {
|
|
25662
|
-
return bond.type === ketcherCore.Bond.PATTERN.TYPE.SINGLE && bond.stereo === ketcherCore.Bond.PATTERN.STEREO.NONE;
|
|
25663
|
-
});
|
|
25664
|
-
return simpleSingleBonds.size >= 1;
|
|
25665
|
-
}
|
|
25666
25644
|
}, {
|
|
25667
25645
|
key: "openMonomerCreationWizard",
|
|
25668
25646
|
value: function openMonomerCreationWizard() {
|
|
25669
25647
|
var _selection$atoms2,
|
|
25670
|
-
|
|
25648
|
+
_this = this;
|
|
25671
25649
|
var currentStruct = this.render.ctab.molecule;
|
|
25672
25650
|
var selection = this.selection();
|
|
25673
25651
|
assert_1(selection);
|
|
@@ -25679,7 +25657,7 @@ var Editor$3 = function () {
|
|
|
25679
25657
|
return a - b;
|
|
25680
25658
|
}).forEach(function (atomId, i) {
|
|
25681
25659
|
originalToSelectedAtomsIdMap.set(atomId, i);
|
|
25682
|
-
|
|
25660
|
+
_this.selectedToOriginalAtomsIdMap.set(i, atomId);
|
|
25683
25661
|
});
|
|
25684
25662
|
var assignedAttachmentPoints = new Map();
|
|
25685
25663
|
var sideTerminalSGroupAtoms = this.terminalRGroupAtoms.filter(function (_ref) {
|
|
@@ -25748,10 +25726,10 @@ var Editor$3 = function () {
|
|
|
25748
25726
|
pp: leavingAtom.pp
|
|
25749
25727
|
});
|
|
25750
25728
|
var selectedStructLeavingAtomId = selectedStruct.atoms.add(selectedStructLeavingAtom);
|
|
25751
|
-
|
|
25729
|
+
_this.selectedToOriginalAtomsIdMap.set(selectedStructLeavingAtomId, atomId);
|
|
25752
25730
|
var selectedStructAttachmentAtomId = originalToSelectedAtomsIdMap.get(attachmentAtomId);
|
|
25753
25731
|
assert_1(selectedStructAttachmentAtomId !== undefined);
|
|
25754
|
-
|
|
25732
|
+
_this.selectedToOriginalAtomsIdMap.set(selectedStructAttachmentAtomId, attachmentAtomId);
|
|
25755
25733
|
var newBond = new ketcherCore.Bond({
|
|
25756
25734
|
type: ketcherCore.Bond.PATTERN.TYPE.SINGLE,
|
|
25757
25735
|
begin: selectedStructAttachmentAtomId,
|
|
@@ -25845,7 +25823,7 @@ var Editor$3 = function () {
|
|
|
25845
25823
|
}, {
|
|
25846
25824
|
key: "assignConnectionPointAtom",
|
|
25847
25825
|
value: function assignConnectionPointAtom(atomId) {
|
|
25848
|
-
var
|
|
25826
|
+
var _this2 = this;
|
|
25849
25827
|
assert_1(this.monomerCreationState);
|
|
25850
25828
|
var potentialLeavingAtoms = this.monomerCreationState.potentialAttachmentPoints.get(atomId);
|
|
25851
25829
|
var leavingAtomId;
|
|
@@ -25854,7 +25832,7 @@ var Editor$3 = function () {
|
|
|
25854
25832
|
return a - b;
|
|
25855
25833
|
}).reduce(function (acc, currentAtomId) {
|
|
25856
25834
|
var _Elements$get;
|
|
25857
|
-
var atom =
|
|
25835
|
+
var atom = _this2.struct().atoms.get(currentAtomId);
|
|
25858
25836
|
assert_1(atom);
|
|
25859
25837
|
var atomicNumber = (_Elements$get = ketcherCore.Elements.get(atom.label)) === null || _Elements$get === void 0 ? void 0 : _Elements$get.number;
|
|
25860
25838
|
if (atomicNumber !== undefined) {
|
|
@@ -25910,16 +25888,14 @@ var Editor$3 = function () {
|
|
|
25910
25888
|
assert_1(_.isNumber(originalLeavingAtomId));
|
|
25911
25889
|
var originalLeavingAtom = this.originalStruct.atoms.get(originalLeavingAtomId);
|
|
25912
25890
|
assert_1(originalLeavingAtom);
|
|
25913
|
-
|
|
25914
|
-
|
|
25915
|
-
|
|
25916
|
-
this.originalStruct.calcImplicitHydrogen(originalLeavingAtomId);
|
|
25917
|
-
}
|
|
25891
|
+
originalLeavingAtom.rglabel = null;
|
|
25892
|
+
originalLeavingAtom.label = leavingAtom.label;
|
|
25893
|
+
this.originalStruct.calcImplicitHydrogen(originalLeavingAtomId);
|
|
25918
25894
|
}
|
|
25919
25895
|
}, {
|
|
25920
25896
|
key: "saveNewMonomer",
|
|
25921
25897
|
value: function saveNewMonomer(data) {
|
|
25922
|
-
var
|
|
25898
|
+
var _this3 = this,
|
|
25923
25899
|
_this$originalSelecti;
|
|
25924
25900
|
if (!this.monomerCreationState) {
|
|
25925
25901
|
throw new Error('Monomer creation wizard is not active, cannot save new monomer');
|
|
@@ -25976,25 +25952,25 @@ var Editor$3 = function () {
|
|
|
25976
25952
|
this.monomerCreationState.assignedAttachmentPoints.forEach(function (_ref11) {
|
|
25977
25953
|
var _ref12 = _slicedToArray__default["default"](_ref11, 2),
|
|
25978
25954
|
leavingAtomId = _ref12[1];
|
|
25979
|
-
return
|
|
25955
|
+
return _this3.cleanupAttachmentPoint(leavingAtomId);
|
|
25980
25956
|
});
|
|
25981
25957
|
this.monomerCreationState.potentialAttachmentPoints.forEach(function (leavingAtomIds) {
|
|
25982
25958
|
return Array.from(leavingAtomIds.values()).forEach(function (leavingAtomId) {
|
|
25983
|
-
return
|
|
25959
|
+
return _this3.cleanupAttachmentPoint(leavingAtomId);
|
|
25984
25960
|
});
|
|
25985
25961
|
});
|
|
25986
25962
|
this.closeMonomerCreationWizard();
|
|
25987
25963
|
(_this$originalSelecti = this.originalSelection.atoms) === null || _this$originalSelecti === void 0 || _this$originalSelecti.forEach(function (atomId) {
|
|
25988
|
-
var atom =
|
|
25964
|
+
var atom = _this3.render.ctab.molecule.atoms.get(atomId);
|
|
25989
25965
|
if (atom) {
|
|
25990
25966
|
atom.fragment = -1;
|
|
25991
25967
|
}
|
|
25992
25968
|
});
|
|
25993
25969
|
var sGroupAttachmentPoints = ketcherCore.MacromoleculesConverter.convertMonomerAttachmentPointsToSGroupAttachmentPoints(monomer, this.selectedToOriginalAtomsIdMap);
|
|
25994
25970
|
sGroupAttachmentPoints.forEach(function (ap) {
|
|
25995
|
-
|
|
25996
|
-
var
|
|
25997
|
-
if ((bond.begin === ap.atomId || bond.end === ap.atomId) && (!((
|
|
25971
|
+
_this3.render.ctab.molecule.bonds.forEach(function (bond) {
|
|
25972
|
+
var _this3$originalSelect, _this3$originalSelect2;
|
|
25973
|
+
if ((bond.begin === ap.atomId || bond.end === ap.atomId) && (!((_this3$originalSelect = _this3.originalSelection.atoms) !== null && _this3$originalSelect !== void 0 && _this3$originalSelect.includes(bond.begin)) || !((_this3$originalSelect2 = _this3.originalSelection.atoms) !== null && _this3$originalSelect2 !== void 0 && _this3$originalSelect2.includes(bond.end)))) {
|
|
25998
25974
|
bond.beginSuperatomAttachmentPointNumber = ap.attachmentPointNumber;
|
|
25999
25975
|
}
|
|
26000
25976
|
});
|
|
@@ -26063,7 +26039,6 @@ var Editor$3 = function () {
|
|
|
26063
26039
|
}, {
|
|
26064
26040
|
key: "removeAttachmentPoint",
|
|
26065
26041
|
value: function removeAttachmentPoint(name) {
|
|
26066
|
-
var _this5 = this;
|
|
26067
26042
|
assert_1(this.monomerCreationState);
|
|
26068
26043
|
var atomPair = this.monomerCreationState.assignedAttachmentPoints.get(name);
|
|
26069
26044
|
assert_1(atomPair);
|
|
@@ -26080,18 +26055,8 @@ var Editor$3 = function () {
|
|
|
26080
26055
|
var action = ketcherCore.fromOneBondDeletion(this.render.ctab, preservedBondId).mergeWith(ketcherCore.fromOneAtomDeletion(this.render.ctab, preservedLeavingAtomId));
|
|
26081
26056
|
this.update(action, true);
|
|
26082
26057
|
}
|
|
26083
|
-
this.preservedConnectionPointData["delete"](attachmentAtomId);
|
|
26084
|
-
} else {
|
|
26085
|
-
var leavingAtoms = this.findPotentialLeavingAtoms(attachmentAtomId);
|
|
26086
|
-
var leavingAtomIdsSet = new Set();
|
|
26087
|
-
leavingAtoms.forEach(function (atom) {
|
|
26088
|
-
var atomId = _this5.struct().atoms.keyOf(atom);
|
|
26089
|
-
if (atomId !== null) {
|
|
26090
|
-
leavingAtomIdsSet.add(atomId);
|
|
26091
|
-
}
|
|
26092
|
-
});
|
|
26093
|
-
this.monomerCreationState.potentialAttachmentPoints.set(attachmentAtomId, leavingAtomIdsSet);
|
|
26094
26058
|
}
|
|
26059
|
+
this.preservedConnectionPointData["delete"](attachmentAtomId);
|
|
26095
26060
|
this.monomerCreationState.assignedAttachmentPoints["delete"](name);
|
|
26096
26061
|
this.monomerCreationState = Object.assign({}, this.monomerCreationState);
|
|
26097
26062
|
this.render.update(true);
|
|
@@ -26140,7 +26105,7 @@ var Editor$3 = function () {
|
|
|
26140
26105
|
}, {
|
|
26141
26106
|
key: "findPotentialLeavingAtoms",
|
|
26142
26107
|
value: function findPotentialLeavingAtoms(attachmentAtomId) {
|
|
26143
|
-
var
|
|
26108
|
+
var _this4 = this;
|
|
26144
26109
|
var bondsToOutside = this.struct().bonds.filter(function (_, bond) {
|
|
26145
26110
|
return attachmentAtomId === bond.begin && attachmentAtomId !== bond.end || attachmentAtomId === bond.end && attachmentAtomId !== bond.begin;
|
|
26146
26111
|
});
|
|
@@ -26150,7 +26115,7 @@ var Editor$3 = function () {
|
|
|
26150
26115
|
return;
|
|
26151
26116
|
}
|
|
26152
26117
|
var atomIdToUse = attachmentAtomId === bond.begin ? bond.end : bond.begin;
|
|
26153
|
-
var atom =
|
|
26118
|
+
var atom = _this4.struct().atoms.get(atomIdToUse);
|
|
26154
26119
|
assert_1(atom);
|
|
26155
26120
|
if (atom.neighbors.length === 1) {
|
|
26156
26121
|
potentialLeavingAtoms.push(atom);
|
|
@@ -26161,15 +26126,15 @@ var Editor$3 = function () {
|
|
|
26161
26126
|
}, {
|
|
26162
26127
|
key: "subscribeToChangeEventInMonomerCreationWizard",
|
|
26163
26128
|
value: function subscribeToChangeEventInMonomerCreationWizard() {
|
|
26164
|
-
var
|
|
26129
|
+
var _this5 = this;
|
|
26165
26130
|
if (this.changeEventSubscriber) {
|
|
26166
26131
|
return;
|
|
26167
26132
|
}
|
|
26168
26133
|
var handleChangeEvent = function handleChangeEvent(data) {
|
|
26169
|
-
if (!
|
|
26134
|
+
if (!_this5.isMonomerCreationWizardActive || data.length === 0) {
|
|
26170
26135
|
return;
|
|
26171
26136
|
}
|
|
26172
|
-
|
|
26137
|
+
_this5.collectChangesForMonomerCreationStateInvalidation(data);
|
|
26173
26138
|
};
|
|
26174
26139
|
this.changeEventSubscriber = this.subscribe('change', handleChangeEvent);
|
|
26175
26140
|
}
|
|
@@ -26212,7 +26177,7 @@ var Editor$3 = function () {
|
|
|
26212
26177
|
}, {
|
|
26213
26178
|
key: "invalidateMonomerCreationWizardState",
|
|
26214
26179
|
value: function invalidateMonomerCreationWizardState(changesMap) {
|
|
26215
|
-
var
|
|
26180
|
+
var _this6 = this;
|
|
26216
26181
|
if (!this.monomerCreationState) {
|
|
26217
26182
|
return;
|
|
26218
26183
|
}
|
|
@@ -26226,7 +26191,7 @@ var Editor$3 = function () {
|
|
|
26226
26191
|
switch (operation) {
|
|
26227
26192
|
case ketcherCore.OperationType.ATOM_DELETE:
|
|
26228
26193
|
{
|
|
26229
|
-
var attachmentPointsToInvalidate = Array.from(
|
|
26194
|
+
var attachmentPointsToInvalidate = Array.from(_this6.monomerCreationState.assignedAttachmentPoints.entries()).filter(function (_ref13) {
|
|
26230
26195
|
var _ref14 = _slicedToArray__default["default"](_ref13, 2),
|
|
26231
26196
|
atomPair = _ref14[1];
|
|
26232
26197
|
return ids.has(atomPair[0]) || ids.has(atomPair[1]);
|
|
@@ -26242,39 +26207,18 @@ var Editor$3 = function () {
|
|
|
26242
26207
|
attachmentAtomId = _atomPair4[0],
|
|
26243
26208
|
leavingAtomId = _atomPair4[1];
|
|
26244
26209
|
if (ids.has(attachmentAtomId)) {
|
|
26245
|
-
var
|
|
26246
|
-
(
|
|
26210
|
+
var _this6$monomerCreatio;
|
|
26211
|
+
(_this6$monomerCreatio = _this6.monomerCreationState) === null || _this6$monomerCreatio === void 0 || _this6$monomerCreatio.assignedAttachmentPoints["delete"](attachmentPointName);
|
|
26247
26212
|
} else if (ids.has(leavingAtomId)) {
|
|
26248
|
-
var potentialLeavingAtoms =
|
|
26213
|
+
var potentialLeavingAtoms = _this6.findPotentialLeavingAtoms(attachmentAtomId);
|
|
26249
26214
|
if (potentialLeavingAtoms.length === 0) {
|
|
26250
|
-
var
|
|
26251
|
-
(
|
|
26215
|
+
var _this6$monomerCreatio2;
|
|
26216
|
+
(_this6$monomerCreatio2 = _this6.monomerCreationState) === null || _this6$monomerCreatio2 === void 0 || _this6$monomerCreatio2.assignedAttachmentPoints["delete"](attachmentPointName);
|
|
26252
26217
|
} else {
|
|
26253
|
-
var
|
|
26254
|
-
var newLeavingAtomId =
|
|
26218
|
+
var _this6$monomerCreatio3;
|
|
26219
|
+
var newLeavingAtomId = _this6.struct().atoms.keyOf(potentialLeavingAtoms[0]);
|
|
26255
26220
|
assert_1(newLeavingAtomId !== null);
|
|
26256
|
-
(
|
|
26257
|
-
}
|
|
26258
|
-
}
|
|
26259
|
-
});
|
|
26260
|
-
var potentialAttachmentPointsToInvalidate = Array.from(_this8.monomerCreationState.potentialAttachmentPoints.entries());
|
|
26261
|
-
potentialAttachmentPointsToInvalidate.forEach(function (_ref17) {
|
|
26262
|
-
var _ref18 = _slicedToArray__default["default"](_ref17, 2),
|
|
26263
|
-
attachmentAtomId = _ref18[0],
|
|
26264
|
-
leavingAtomIds = _ref18[1];
|
|
26265
|
-
if (ids.has(attachmentAtomId)) {
|
|
26266
|
-
var _this8$monomerCreatio4;
|
|
26267
|
-
(_this8$monomerCreatio4 = _this8.monomerCreationState) === null || _this8$monomerCreatio4 === void 0 || _this8$monomerCreatio4.potentialAttachmentPoints["delete"](attachmentAtomId);
|
|
26268
|
-
} else {
|
|
26269
|
-
var updatedLeavingAtomIds = new Set(Array.from(leavingAtomIds).filter(function (id) {
|
|
26270
|
-
return !ids.has(id);
|
|
26271
|
-
}));
|
|
26272
|
-
if (updatedLeavingAtomIds.size === 0) {
|
|
26273
|
-
var _this8$monomerCreatio5;
|
|
26274
|
-
(_this8$monomerCreatio5 = _this8.monomerCreationState) === null || _this8$monomerCreatio5 === void 0 || _this8$monomerCreatio5.potentialAttachmentPoints["delete"](attachmentAtomId);
|
|
26275
|
-
} else {
|
|
26276
|
-
var _this8$monomerCreatio6;
|
|
26277
|
-
(_this8$monomerCreatio6 = _this8.monomerCreationState) === null || _this8$monomerCreatio6 === void 0 || _this8$monomerCreatio6.potentialAttachmentPoints.set(attachmentAtomId, updatedLeavingAtomIds);
|
|
26221
|
+
(_this6$monomerCreatio3 = _this6.monomerCreationState) === null || _this6$monomerCreatio3 === void 0 || _this6$monomerCreatio3.assignedAttachmentPoints.set(attachmentPointName, [attachmentAtomId, newLeavingAtomId]);
|
|
26278
26222
|
}
|
|
26279
26223
|
}
|
|
26280
26224
|
});
|
|
@@ -26287,40 +26231,24 @@ var Editor$3 = function () {
|
|
|
26287
26231
|
try {
|
|
26288
26232
|
var _loop2 = function _loop2() {
|
|
26289
26233
|
var id = _step3.value;
|
|
26290
|
-
var bond =
|
|
26234
|
+
var bond = _this6.struct().bonds.get(id);
|
|
26291
26235
|
assert_1(bond);
|
|
26292
|
-
var attachmentPointWithBond = Array.from(
|
|
26293
|
-
var
|
|
26294
|
-
atomPair =
|
|
26236
|
+
var attachmentPointWithBond = Array.from(_this6.monomerCreationState.assignedAttachmentPoints.entries()).find(function (_ref17) {
|
|
26237
|
+
var _ref18 = _slicedToArray__default["default"](_ref17, 2),
|
|
26238
|
+
atomPair = _ref18[1];
|
|
26295
26239
|
return bond.begin === atomPair[0] && bond.end === atomPair[1] || bond.begin === atomPair[1] && bond.end === atomPair[0];
|
|
26296
26240
|
});
|
|
26297
|
-
if (attachmentPointWithBond) {
|
|
26298
|
-
|
|
26299
|
-
_this8.monomerCreationState.problematicAttachmentPoints.add(attachmentPointWithBond[0]);
|
|
26300
|
-
} else {
|
|
26301
|
-
_this8.monomerCreationState.problematicAttachmentPoints["delete"](attachmentPointWithBond[0]);
|
|
26302
|
-
}
|
|
26241
|
+
if (!attachmentPointWithBond) {
|
|
26242
|
+
return 1;
|
|
26303
26243
|
}
|
|
26304
26244
|
if (bond.type !== ketcherCore.Bond.PATTERN.TYPE.SINGLE || bond.stereo !== ketcherCore.Bond.PATTERN.STEREO.NONE) {
|
|
26305
|
-
|
|
26306
|
-
|
|
26307
|
-
|
|
26308
|
-
var bondToAttachmentAtom = bond.end === attachmentAtomId && leavingAtomIds.has(bond.begin);
|
|
26309
|
-
if (bondFromAttachmentAtom || bondToAttachmentAtom) {
|
|
26310
|
-
updatedLeavingAtomIds["delete"](bondFromAttachmentAtom ? bond.end : bond.begin);
|
|
26311
|
-
}
|
|
26312
|
-
if (updatedLeavingAtomIds.size === 0) {
|
|
26313
|
-
var _this8$monomerCreatio7;
|
|
26314
|
-
(_this8$monomerCreatio7 = _this8.monomerCreationState) === null || _this8$monomerCreatio7 === void 0 || _this8$monomerCreatio7.potentialAttachmentPoints["delete"](attachmentAtomId);
|
|
26315
|
-
} else {
|
|
26316
|
-
var _this8$monomerCreatio8;
|
|
26317
|
-
(_this8$monomerCreatio8 = _this8.monomerCreationState) === null || _this8$monomerCreatio8 === void 0 || _this8$monomerCreatio8.potentialAttachmentPoints.set(attachmentAtomId, updatedLeavingAtomIds);
|
|
26318
|
-
}
|
|
26319
|
-
});
|
|
26245
|
+
_this6.monomerCreationState.problematicAttachmentPoints.add(attachmentPointWithBond[0]);
|
|
26246
|
+
} else {
|
|
26247
|
+
_this6.monomerCreationState.problematicAttachmentPoints["delete"](attachmentPointWithBond[0]);
|
|
26320
26248
|
}
|
|
26321
26249
|
};
|
|
26322
26250
|
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
26323
|
-
_loop2();
|
|
26251
|
+
if (_loop2()) continue;
|
|
26324
26252
|
}
|
|
26325
26253
|
} catch (err) {
|
|
26326
26254
|
_iterator3.e(err);
|
|
@@ -26336,44 +26264,23 @@ var Editor$3 = function () {
|
|
|
26336
26264
|
try {
|
|
26337
26265
|
var _loop3 = function _loop3() {
|
|
26338
26266
|
var id = _step4.value;
|
|
26339
|
-
var bond =
|
|
26267
|
+
var bond = _this6.struct().bonds.get(id);
|
|
26340
26268
|
assert_1(bond);
|
|
26341
|
-
var attachmentPointWithBondToLeavingAtom = Array.from(
|
|
26342
|
-
var
|
|
26343
|
-
|
|
26344
|
-
leavingAtomId =
|
|
26269
|
+
var attachmentPointWithBondToLeavingAtom = Array.from(_this6.monomerCreationState.assignedAttachmentPoints.entries()).find(function (_ref19) {
|
|
26270
|
+
var _ref20 = _slicedToArray__default["default"](_ref19, 2),
|
|
26271
|
+
_ref20$ = _slicedToArray__default["default"](_ref20[1], 2),
|
|
26272
|
+
leavingAtomId = _ref20$[1];
|
|
26345
26273
|
return bond.begin === leavingAtomId || bond.end === leavingAtomId;
|
|
26346
26274
|
});
|
|
26347
|
-
if (attachmentPointWithBondToLeavingAtom) {
|
|
26348
|
-
|
|
26349
|
-
attachmentPointName = _attachmentPointWithB[0];
|
|
26350
|
-
_this8.monomerCreationState.assignedAttachmentPoints["delete"](attachmentPointName);
|
|
26351
|
-
}
|
|
26352
|
-
if (bond.type === ketcherCore.Bond.PATTERN.TYPE.SINGLE && bond.stereo === ketcherCore.Bond.PATTERN.STEREO.NONE) {
|
|
26353
|
-
if (_this8.monomerCreationState.potentialAttachmentPoints.has(bond.begin)) {
|
|
26354
|
-
var leavingAtomIds = _this8.monomerCreationState.potentialAttachmentPoints.get(bond.begin);
|
|
26355
|
-
assert_1(leavingAtomIds);
|
|
26356
|
-
var endAtom = _this8.struct().atoms.get(bond.end);
|
|
26357
|
-
if (endAtom && endAtom.neighbors.length === 1) {
|
|
26358
|
-
var updatedLeavingAtomIds = new Set(leavingAtomIds);
|
|
26359
|
-
updatedLeavingAtomIds.add(bond.end);
|
|
26360
|
-
_this8.monomerCreationState.potentialAttachmentPoints.set(bond.begin, updatedLeavingAtomIds);
|
|
26361
|
-
}
|
|
26362
|
-
}
|
|
26363
|
-
if (_this8.monomerCreationState.potentialAttachmentPoints.has(bond.end)) {
|
|
26364
|
-
var _leavingAtomIds = _this8.monomerCreationState.potentialAttachmentPoints.get(bond.end);
|
|
26365
|
-
assert_1(_leavingAtomIds);
|
|
26366
|
-
var beginAtom = _this8.struct().atoms.get(bond.begin);
|
|
26367
|
-
if (beginAtom && beginAtom.neighbors.length === 1) {
|
|
26368
|
-
var _updatedLeavingAtomIds = new Set(_leavingAtomIds);
|
|
26369
|
-
_updatedLeavingAtomIds.add(bond.begin);
|
|
26370
|
-
_this8.monomerCreationState.potentialAttachmentPoints.set(bond.end, _updatedLeavingAtomIds);
|
|
26371
|
-
}
|
|
26372
|
-
}
|
|
26275
|
+
if (!attachmentPointWithBondToLeavingAtom) {
|
|
26276
|
+
return 1;
|
|
26373
26277
|
}
|
|
26278
|
+
var _attachmentPointWithB = _slicedToArray__default["default"](attachmentPointWithBondToLeavingAtom, 1),
|
|
26279
|
+
attachmentPointName = _attachmentPointWithB[0];
|
|
26280
|
+
_this6.monomerCreationState.assignedAttachmentPoints["delete"](attachmentPointName);
|
|
26374
26281
|
};
|
|
26375
26282
|
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
26376
|
-
_loop3();
|
|
26283
|
+
if (_loop3()) continue;
|
|
26377
26284
|
}
|
|
26378
26285
|
} catch (err) {
|
|
26379
26286
|
_iterator4.e(err);
|
|
@@ -26748,17 +26655,6 @@ var Editor$3 = function () {
|
|
|
26748
26655
|
}
|
|
26749
26656
|
return visited.size === atomIds.length;
|
|
26750
26657
|
}
|
|
26751
|
-
}, {
|
|
26752
|
-
key: "isStructureImpure",
|
|
26753
|
-
value: function isStructureImpure(struct) {
|
|
26754
|
-
var atoms = struct.atoms,
|
|
26755
|
-
sgroups = struct.sgroups,
|
|
26756
|
-
rgroups = struct.rgroups,
|
|
26757
|
-
functionalGroups = struct.functionalGroups;
|
|
26758
|
-
return sgroups.size > 0 || rgroups.size > 0 || functionalGroups.size > 0 || Array.from(atoms.values()).some(function (atom) {
|
|
26759
|
-
return ketcherCore.genericsList.includes(atom.label);
|
|
26760
|
-
});
|
|
26761
|
-
}
|
|
26762
26658
|
}]);
|
|
26763
26659
|
return Editor;
|
|
26764
26660
|
}();
|
|
@@ -26834,10 +26730,10 @@ function domEventSetup(editor, clientArea) {
|
|
|
26834
26730
|
eventName: 'mouseover',
|
|
26835
26731
|
toolEventHandler: 'mouseover'
|
|
26836
26732
|
}];
|
|
26837
|
-
trackedDomEvents.forEach(function (
|
|
26838
|
-
var target =
|
|
26839
|
-
eventName =
|
|
26840
|
-
toolEventHandler =
|
|
26733
|
+
trackedDomEvents.forEach(function (_ref21) {
|
|
26734
|
+
var target = _ref21.target,
|
|
26735
|
+
eventName = _ref21.eventName,
|
|
26736
|
+
toolEventHandler = _ref21.toolEventHandler;
|
|
26841
26737
|
editor.event[eventName] = new subscription.DOMSubscription();
|
|
26842
26738
|
var subs = editor.event[eventName];
|
|
26843
26739
|
target.addEventListener(eventName, function () {
|
|
@@ -29543,11 +29439,9 @@ var useAttachmentPointSelectsData = function useAttachmentPointSelectsData(edito
|
|
|
29543
29439
|
leavingAtomId = _atomPair[1];
|
|
29544
29440
|
var attachmentAtom = editor.struct().atoms.get(attachmentAtomId);
|
|
29545
29441
|
assert_1(attachmentAtom);
|
|
29546
|
-
var
|
|
29442
|
+
var attachmentPointNameOptionsLength = Math.max.apply(Math, _toConsumableArray__default["default"](Array.from(assignedAttachmentPoints.keys()).map(function (name) {
|
|
29547
29443
|
return ketcherCore.getAttachmentPointNumberFromLabel(name);
|
|
29548
|
-
});
|
|
29549
|
-
var maxUsedNumber = Math.max.apply(Math, _toConsumableArray__default["default"](usedNumbers));
|
|
29550
|
-
var attachmentPointNameOptionsLength = maxUsedNumber <= 3 ? 3 : Math.min(maxUsedNumber, 8);
|
|
29444
|
+
})));
|
|
29551
29445
|
var nameOptions = Array.from({
|
|
29552
29446
|
length: attachmentPointNameOptionsLength
|
|
29553
29447
|
}).map(function (_, i) {
|
|
@@ -29707,9 +29601,7 @@ var NotificationMessages = {
|
|
|
29707
29601
|
noAttachmentPoints: 'The monomer must have at least one attachment point.',
|
|
29708
29602
|
incorrectAttachmentPointsOrder: 'Attachment point numbers must be in order, but R1 and R2 may be skipped.',
|
|
29709
29603
|
creationSuccessful: 'The monomer was successfully added to the library.',
|
|
29710
|
-
incontinuousStructure: 'All monomers must have a continuous structure.'
|
|
29711
|
-
notMinimalViableStructure: 'Minimal monomer structure is two atoms connected via a single bond.',
|
|
29712
|
-
impureStructure: 'Monomer structure cannot contain S-groups, R-groups, special atoms, or any other query properties.'
|
|
29604
|
+
incontinuousStructure: 'All monomers must have a continuous structure.'
|
|
29713
29605
|
};
|
|
29714
29606
|
var NotificationTypes = {
|
|
29715
29607
|
defaultAttachmentPoints: 'info',
|
|
@@ -29720,9 +29612,7 @@ var NotificationTypes = {
|
|
|
29720
29612
|
noAttachmentPoints: 'error',
|
|
29721
29613
|
incorrectAttachmentPointsOrder: 'error',
|
|
29722
29614
|
creationSuccessful: 'info',
|
|
29723
|
-
incontinuousStructure: 'error'
|
|
29724
|
-
notMinimalViableStructure: 'error',
|
|
29725
|
-
impureStructure: 'error'
|
|
29615
|
+
incontinuousStructure: 'error'
|
|
29726
29616
|
};
|
|
29727
29617
|
var MonomerCreationExternalNotificationAction = 'MonomerCreationExternalNotification';
|
|
29728
29618
|
|
|
@@ -29977,21 +29867,6 @@ var validateAttachmentPoints = function validateAttachmentPoints(attachmentPoint
|
|
|
29977
29867
|
};
|
|
29978
29868
|
var validateStructure = function validateStructure(editor) {
|
|
29979
29869
|
var notifications = new Map();
|
|
29980
|
-
var isStructureImpure = Editor$3.isStructureImpure(editor.struct());
|
|
29981
|
-
if (isStructureImpure) {
|
|
29982
|
-
notifications.set('impureStructure', {
|
|
29983
|
-
type: 'error',
|
|
29984
|
-
message: NotificationMessages.impureStructure
|
|
29985
|
-
});
|
|
29986
|
-
}
|
|
29987
|
-
var isMinimalViableStructure = editor.isMinimalViableStructure();
|
|
29988
|
-
if (!isMinimalViableStructure) {
|
|
29989
|
-
notifications.set('notMinimalViableStructure', {
|
|
29990
|
-
type: 'error',
|
|
29991
|
-
message: NotificationMessages.notMinimalViableStructure
|
|
29992
|
-
});
|
|
29993
|
-
return notifications;
|
|
29994
|
-
}
|
|
29995
29870
|
var isStructureContinuous = Editor$3.isStructureContinuous(editor.struct());
|
|
29996
29871
|
if (!isStructureContinuous) {
|
|
29997
29872
|
notifications.set('incontinuousStructure', {
|
|
@@ -31830,7 +31705,7 @@ var OpenButton = function (_Component) {
|
|
|
31830
31705
|
|
|
31831
31706
|
var fileSaver = function fileSaver(server) {
|
|
31832
31707
|
return new Promise(function (resolve, reject) {
|
|
31833
|
-
if (
|
|
31708
|
+
if (globalThis.Blob && fileSaver$1.saveAs) {
|
|
31834
31709
|
resolve(function (data, fn, type) {
|
|
31835
31710
|
var blob = new Blob([data], {
|
|
31836
31711
|
type: type
|
|
@@ -36829,11 +36704,6 @@ var TemplateDialog = function TemplateDialog(props) {
|
|
|
36829
36704
|
onTabChange(initialTab);
|
|
36830
36705
|
}
|
|
36831
36706
|
}, [initialTab, onTabChange]);
|
|
36832
|
-
React.useEffect(function () {
|
|
36833
|
-
if (isMonomerCreationWizardActive && tab === TemplateTabs.FunctionalGroupLibrary) {
|
|
36834
|
-
onTabChange(TemplateTabs.TemplateLibrary);
|
|
36835
|
-
}
|
|
36836
|
-
}, [isMonomerCreationWizardActive, tab, onTabChange]);
|
|
36837
36707
|
var handleAccordionChange = function handleAccordionChange(accordion) {
|
|
36838
36708
|
return function (_, isExpanded) {
|
|
36839
36709
|
setExpandedAccordions(isExpanded ? [].concat(_toConsumableArray__default["default"](expandedAccordions), [accordion]) : _toConsumableArray__default["default"](expandedAccordions).filter(function (expandedAccordion) {
|
|
@@ -38041,12 +37911,12 @@ var AbbreviationLookup = function AbbreviationLookup(_ref) {
|
|
|
38041
37911
|
});
|
|
38042
37912
|
},
|
|
38043
37913
|
renderOption: function renderOption(props, option) {
|
|
38044
|
-
return
|
|
37914
|
+
return jsxRuntime.jsx("li", _objectSpread$2(_objectSpread$2({}, props), {}, {
|
|
38045
37915
|
title: option.label,
|
|
38046
|
-
|
|
38047
|
-
|
|
38048
|
-
|
|
38049
|
-
|
|
37916
|
+
children: jsxRuntime.jsx("div", {
|
|
37917
|
+
className: classes.optionItemContent,
|
|
37918
|
+
children: highlightOptionLabel(option, loweredLookupValue)
|
|
37919
|
+
})
|
|
38050
37920
|
}));
|
|
38051
37921
|
},
|
|
38052
37922
|
"data-testid": ABBREVIATION_LOOKUP_TEST_ID
|
|
@@ -38324,8 +38194,8 @@ var KetcherBuilder = function () {
|
|
|
38324
38194
|
cleanup = initApp(prevKetcherId, ketcherId, element, appRoot, staticResourcesUrl, {
|
|
38325
38195
|
buttons: buttons || {},
|
|
38326
38196
|
errorHandler: errorHandler || null,
|
|
38327
|
-
version: "3.
|
|
38328
|
-
buildDate: "2025-10-
|
|
38197
|
+
version: "3.10.0-build.2" ,
|
|
38198
|
+
buildDate: "2025-10-17T10:35:38" ,
|
|
38329
38199
|
buildNumber: '',
|
|
38330
38200
|
customButtons: customButtons || []
|
|
38331
38201
|
}, structService, resolve, togglerComponent);
|
|
@@ -38620,7 +38490,7 @@ var ModeControl = function ModeControl(_ref3) {
|
|
|
38620
38490
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
38621
38491
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty__default["default"](e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
38622
38492
|
var MacromoleculesEditorComponent = React.lazy(function () {
|
|
38623
|
-
return Promise.resolve().then(function () { return require('./index.modern-
|
|
38493
|
+
return Promise.resolve().then(function () { return require('./index.modern-d047d786.js'); });
|
|
38624
38494
|
});
|
|
38625
38495
|
var Editor = function Editor(props) {
|
|
38626
38496
|
var _useState = React.useState(false),
|