ketcher-react 3.8.0-rc.1 → 3.8.0-rc.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 CHANGED
@@ -3850,7 +3850,7 @@ var zoom = {
3850
3850
 
3851
3851
  var openHelpLink = function openHelpLink() {
3852
3852
  var _window$open;
3853
- return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v3.8.0-rc.1\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
3853
+ return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v3.8.0-rc.2\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
3854
3854
  };
3855
3855
  var help = {
3856
3856
  help: {
@@ -25466,7 +25466,6 @@ var Editor$3 = function () {
25466
25466
  _this2.selectedToOriginalAtomsIdMap.set(i, atomId);
25467
25467
  });
25468
25468
  var assignedAttachmentPoints = new Map();
25469
- var potentialAttachmentPoints = new Map();
25470
25469
  this.terminalRGroupAtoms.forEach(function (atomId, i) {
25471
25470
  var _selectedStruct$halfB;
25472
25471
  var selectedStructLeavingAtomId = originalToSelectedAtomsIdMap.get(atomId);
@@ -25481,32 +25480,41 @@ var Editor$3 = function () {
25481
25480
  assert_1(selectedStructAttachmentAtomId !== undefined);
25482
25481
  assignedAttachmentPoints.set(attachmentPointName, [selectedStructAttachmentAtomId, selectedStructLeavingAtomId]);
25483
25482
  });
25484
- this.potentialLeavingAtoms.forEach(function (atomId) {
25485
- var _selectedStruct$atoms, _selectedStruct$atoms2, _currentStruct$halfBo;
25483
+ this.potentialLeavingAtoms.forEach(function (atomId, i) {
25484
+ var _selectedStruct$atoms, _selectedStruct$atoms2;
25486
25485
  var leavingAtom = currentStruct.atoms.get(atomId);
25487
25486
  assert_1(leavingAtom);
25487
+ var attachmentAtomId = -1;
25488
+ leavingAtom.neighbors.forEach(function (halfBondId) {
25489
+ var _selection$atoms3;
25490
+ var halfBond = currentStruct.halfBonds.get(halfBondId);
25491
+ assert_1(halfBond !== undefined);
25492
+ if ((_selection$atoms3 = selection.atoms) !== null && _selection$atoms3 !== void 0 && _selection$atoms3.includes(halfBond.end)) {
25493
+ attachmentAtomId = halfBond.end;
25494
+ }
25495
+ });
25496
+ if (attachmentAtomId === -1) {
25497
+ return;
25498
+ }
25488
25499
  var selectedStructLeavingAtom = leavingAtom.clone();
25489
25500
  selectedStructLeavingAtom.fragment = (_selectedStruct$atoms = (_selectedStruct$atoms2 = selectedStruct.atoms.get(0)) === null || _selectedStruct$atoms2 === void 0 ? void 0 : _selectedStruct$atoms2.fragment) !== null && _selectedStruct$atoms !== void 0 ? _selectedStruct$atoms : 0;
25490
25501
  var selectedStructLeavingAtomId = selectedStruct.atoms.add(selectedStructLeavingAtom);
25491
25502
  _this2.selectedToOriginalAtomsIdMap.set(selectedStructLeavingAtomId, atomId);
25492
- var neighborHalfBondId = leavingAtom === null || leavingAtom === void 0 ? void 0 : leavingAtom.neighbors[0];
25493
- assert_1(neighborHalfBondId !== undefined);
25494
- var attachmentAtomId = (_currentStruct$halfBo = currentStruct.halfBonds.get(neighborHalfBondId)) === null || _currentStruct$halfBo === void 0 ? void 0 : _currentStruct$halfBo.end;
25495
- assert_1(attachmentAtomId !== undefined);
25496
25503
  var selectedStructAttachmentAtomId = originalToSelectedAtomsIdMap.get(attachmentAtomId);
25497
25504
  assert_1(selectedStructAttachmentAtomId !== undefined);
25505
+ _this2.selectedToOriginalAtomsIdMap.set(selectedStructAttachmentAtomId, attachmentAtomId);
25498
25506
  var newBond = new ketcherCore.Bond({
25499
25507
  type: ketcherCore.Bond.PATTERN.TYPE.SINGLE,
25500
25508
  begin: selectedStructAttachmentAtomId,
25501
25509
  end: selectedStructLeavingAtomId
25502
25510
  });
25503
25511
  selectedStruct.bonds.add(newBond);
25504
- potentialAttachmentPoints.set(selectedStructAttachmentAtomId, selectedStructLeavingAtomId);
25505
- _this2.selectedToOriginalAtomsIdMap.set(selectedStructAttachmentAtomId, attachmentAtomId);
25512
+ var attachmentPointName = ketcherCore.getAttachmentPointLabel(_this2.terminalRGroupAtoms.length + i + 1);
25513
+ assignedAttachmentPoints.set(attachmentPointName, [selectedStructAttachmentAtomId, selectedStructLeavingAtomId]);
25506
25514
  });
25507
25515
  this.monomerCreationState = {
25508
25516
  assignedAttachmentPoints: assignedAttachmentPoints,
25509
- potentialAttachmentPoints: potentialAttachmentPoints
25517
+ potentialAttachmentPoints: new Map()
25510
25518
  };
25511
25519
  this.originalStruct = currentStruct;
25512
25520
  this.struct(selectedStruct);
@@ -25543,8 +25551,6 @@ var Editor$3 = function () {
25543
25551
  leavingAtomId = _atomPairForLeavingGr2[1];
25544
25552
  var leavingAtom = this.render.ctab.molecule.atoms.get(leavingAtomId);
25545
25553
  assert_1(leavingAtom);
25546
- leavingAtom.label = 'H';
25547
- this.render.ctab.molecule.calcImplicitHydrogen(leavingAtomId);
25548
25554
  var attachmentPointName = ketcherCore.getNextFreeAttachmentPoint(Array.from(this.monomerCreationState.assignedAttachmentPoints.keys()));
25549
25555
  this.monomerCreationState.assignedAttachmentPoints.set(attachmentPointName, atomPairForLeavingGroup);
25550
25556
  this.monomerCreationState.potentialAttachmentPoints["delete"](attachmentAtomId);
@@ -25564,8 +25570,8 @@ var Editor$3 = function () {
25564
25570
  }, {
25565
25571
  key: "saveNewMonomer",
25566
25572
  value: function saveNewMonomer(data) {
25567
- var _this$originalSelecti,
25568
- _this3 = this;
25573
+ var _this3 = this,
25574
+ _this$originalSelecti;
25569
25575
  if (!this.monomerCreationState) {
25570
25576
  throw new Error('Monomer creation wizard is not active, cannot save new monomer');
25571
25577
  }
@@ -25618,6 +25624,20 @@ var Editor$3 = function () {
25618
25624
  Monomer = _monomerFactory2[0];
25619
25625
  var monomerPosition = new ketcherCore.Vec2((this.selectionBBox.min.x + this.selectionBBox.max.x) / 2, (this.selectionBBox.min.y + this.selectionBBox.max.y) / 2);
25620
25626
  var monomer = new Monomer(monomerItem, monomerPosition);
25627
+ var finalAttachmentPoints = this.monomerCreationState.assignedAttachmentPoints;
25628
+ finalAttachmentPoints.forEach(function (atomPair) {
25629
+ var _atomPair2 = _slicedToArray__default["default"](atomPair, 2),
25630
+ leavingAtomId = _atomPair2[1];
25631
+ var leavingAtom = _this3.struct().atoms.get(leavingAtomId);
25632
+ assert_1(leavingAtom);
25633
+ var originalLeavingAtomId = _this3.selectedToOriginalAtomsIdMap.get(leavingAtomId);
25634
+ assert_1(originalLeavingAtomId);
25635
+ var originalLeavingAtom = _this3.originalStruct.atoms.get(originalLeavingAtomId);
25636
+ assert_1(originalLeavingAtom);
25637
+ originalLeavingAtom.rglabel = null;
25638
+ originalLeavingAtom.label = leavingAtom.label;
25639
+ _this3.originalStruct.calcImplicitHydrogen(originalLeavingAtomId);
25640
+ });
25621
25641
  this.closeMonomerCreationWizard();
25622
25642
  (_this$originalSelecti = this.originalSelection.atoms) === null || _this$originalSelecti === void 0 || _this$originalSelecti.forEach(function (atomId) {
25623
25643
  var atom = _this3.render.ctab.molecule.atoms.get(atomId);
@@ -26504,20 +26524,22 @@ var useMakeLeavingGroupAtomMenuItem = function useMakeLeavingGroupAtomMenuItem(_
26504
26524
  };
26505
26525
  return isAtomAssignedAttachmentPoint ? jsxRuntime.jsxs(jsxRuntime.Fragment, {
26506
26526
  children: [jsxRuntime.jsxs(reactContexify.Item, {
26527
+ "data-testid": "edit-connection-point",
26528
+ onClick: handleEditClick,
26507
26529
  children: [jsxRuntime.jsx(Icon, {
26508
26530
  name: "editMenu",
26509
- className: styles$m.icon,
26510
- onClick: handleEditClick
26531
+ className: styles$m.icon
26511
26532
  }), "Edit connection point"]
26512
26533
  }), jsxRuntime.jsxs(reactContexify.Item, {
26534
+ "data-testid": "remove-assignment",
26535
+ onClick: handleRemoveClick,
26513
26536
  children: [jsxRuntime.jsx(Icon, {
26514
26537
  name: "deleteMenu",
26515
- className: styles$m.icon,
26516
- onClick: handleRemoveClick
26538
+ className: styles$m.icon
26517
26539
  }), "Remove assignment"]
26518
26540
  })]
26519
26541
  }) : jsxRuntime.jsxs(reactContexify.Item, _objectSpread$S(_objectSpread$S({}, props), {}, {
26520
- "data-testid": "Assign as a leaving group",
26542
+ "data-testid": "assign-as-a-leaving-group",
26521
26543
  onClick: handleMakeLeavingGroupAtomClick,
26522
26544
  disabled: attachmentPointsLimitReached,
26523
26545
  children: [jsxRuntime.jsx(Icon, {
@@ -28618,19 +28640,19 @@ var attachmentPointNameOptions = Array.from({
28618
28640
  };
28619
28641
  });
28620
28642
  var attachmentPointAtomOptions = [{
28621
- value: 'H',
28643
+ value: ketcherCore.AtomLabel.H,
28622
28644
  label: 'H'
28623
28645
  }, {
28624
- value: 'O',
28646
+ value: ketcherCore.AtomLabel.O,
28625
28647
  label: 'OH'
28626
28648
  }, {
28627
- value: 'N',
28649
+ value: ketcherCore.AtomLabel.N,
28628
28650
  label: 'NH2'
28629
28651
  }, {
28630
- value: 'Cl',
28652
+ value: ketcherCore.AtomLabel.Cl,
28631
28653
  label: 'Cl'
28632
28654
  }, {
28633
- value: 'F',
28655
+ value: ketcherCore.AtomLabel.F,
28634
28656
  label: 'F'
28635
28657
  }];
28636
28658
  var AttachmentPointEditPopup = function AttachmentPointEditPopup(_ref) {
@@ -37152,8 +37174,8 @@ var KetcherBuilder = function () {
37152
37174
  cleanup = initApp(prevKetcherId, ketcherId, element, appRoot, staticResourcesUrl, {
37153
37175
  buttons: buttons || {},
37154
37176
  errorHandler: errorHandler || null,
37155
- version: "3.8.0-rc.1" ,
37156
- buildDate: "2025-09-03T08:19:34" ,
37177
+ version: "3.8.0-rc.2" ,
37178
+ buildDate: "2025-09-05T18:59:48" ,
37157
37179
  buildNumber: '',
37158
37180
  customButtons: customButtons || []
37159
37181
  }, structService, resolve, togglerComponent);
@@ -37448,7 +37470,7 @@ var ModeControl = function ModeControl(_ref3) {
37448
37470
  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; }
37449
37471
  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; }
37450
37472
  var MacromoleculesEditorComponent = React.lazy(function () {
37451
- return Promise.resolve().then(function () { return require('./index.modern-e42372a4.js'); });
37473
+ return Promise.resolve().then(function () { return require('./index.modern-30f7e490.js'); });
37452
37474
  });
37453
37475
  var Editor = function Editor(props) {
37454
37476
  var _useState = React.useState(false),