ketcher-react 2.22.0-rc.5 → 2.23.0-rc.1-dev.1

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.
@@ -24,7 +24,7 @@ import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
24
24
  import _regeneratorRuntime from '@babel/runtime/regenerator';
25
25
  import _classCallCheck$2 from '@babel/runtime/helpers/classCallCheck';
26
26
  import _createClass$2 from '@babel/runtime/helpers/createClass';
27
- import { KetSerializer, MolSerializer, KetcherLogger, Ketcher, defaultBondThickness, FormatterFactory, isClipboardAPIAvailable, notifyCopyCut, notifyRequestCompleted, isControlKey, StereLabelStyleType, StereoColoringType, ShowHydrogenLabels, ShowHydrogenLabelNames, SettingsManager, SdfSerializer, KETCHER_SAVED_OPTIONS_KEY, Bond as Bond$2, Elements, AtomList, getAtomType, StereoLabel, isAttachmentBond, Atom as Atom$2, findStereoAtoms, RxnArrowMode, SimpleObjectMode, SGroup as SGroup$1, Pile, getStereoAtomsMap, identifyStructFormat, SupportedFormat, ChemicalMimeType, RenderStruct, Struct, shortcutStr, MonomerMicromolecule, FunctionalGroupsProvider, SaltsAndSolventsProvider, KetcherAsyncEvents, ElementColor, generateMenuShortcuts, Vec2, Scale, fromMultipleMove, FunctionalGroup, fromSgroupDeletion, fromFragmentDeletion, mergeMapOfItemsToSet, vectorUtils, fromBondAddition, Action, fromAtomAddition, fromAtomsAttrs, checkOverlapping, fromSeveralSgroupAddition, expandSGroupWithMultipleAttachmentPoint, SgContexts, fromSgroupAction, fromItemsFuse, ReBond, setExpandSGroup, fromBondsAttrs, OperationType, ReStruct, fromSimpleObjectResizing, fromArrowResizing, getItemsToFuse, getHoverToFuse, fromTextDeletion, fromTextUpdating, CoordinateTransformation, fromTemplateOnCanvas, fromTemplateOnBondAction, fromTemplateOnAtom, BondAttr, AtomAttr, formatProperties, ketcherProvider, runAsyncAction, getStructStringFromClipboardData, getStructure, initHotKeys, keyNorm, Fragment as Fragment$1, fromRGroupAttachmentPointUpdate, fromOneBondDeletion, bondChangingAction, fromChain, fromStereoFlagUpdate, fromOneAtomDeletion, fromArrowDeletion, fromPlusDeletion, fromSimpleObjectDeletion, fromRGroupAttachmentPointDeletion, notifyItemsToMergeInitializationComplete, fromPaste, RGroup as RGroup$2, fromRGroupFragment, fromUpdateIfThen, fromRGroupAttrs, fromArrowAddition, fromPlusAddition, fromRotate, fromFlip, fromSimpleObjectAddition, fromTextCreation, fromHighlightCreate, fromHighlightClear, provideEditorSettings, fromNewCanvas, Render, fromDescriptorsAlign, fromSgroupAddition, SGroupAttachmentPoint, fromSgroupAttachmentPointAddition, atomGetAttr, genericsList, getAtomCustomQuery, getFormatMimeTypeByFileName, getPropertiesByFormat, StereoFlag, getPropertiesByImgFormat, b64toBlob, Generics, TextCommand, DefaultStructServiceOptions } from 'ketcher-core';
27
+ import { KetSerializer, MolSerializer, KetcherLogger, Ketcher, defaultBondThickness, FormatterFactory, isClipboardAPIAvailable, notifyCopyCut, notifyRequestCompleted, isControlKey, StereLabelStyleType, StereoColoringType, ShowHydrogenLabels, ShowHydrogenLabelNames, SettingsManager, SdfSerializer, KETCHER_SAVED_OPTIONS_KEY, Bond as Bond$2, Elements, AtomList, getAtomType, StereoLabel, isAttachmentBond, Atom as Atom$2, findStereoAtoms, RxnArrowMode, SimpleObjectMode, SGroup as SGroup$1, Pile, getStereoAtomsMap, identifyStructFormat, SupportedFormat, ChemicalMimeType, RenderStruct, Struct, shortcutStr, MonomerMicromolecule, FunctionalGroupsProvider, SaltsAndSolventsProvider, KetcherAsyncEvents, ElementColor, generateMenuShortcuts, Vec2, Scale, fromMultipleMove, FunctionalGroup, fromSgroupDeletion, fromFragmentDeletion, mergeMapOfItemsToSet, vectorUtils, fromBondAddition, Action, fromAtomAddition, fromAtomsAttrs, checkOverlapping, fromSeveralSgroupAddition, expandSGroupWithMultipleAttachmentPoint, SgContexts, fromSgroupAction, fromItemsFuse, ReBond, setExpandSGroup, fromBondsAttrs, OperationType, ReStruct, fromSimpleObjectResizing, fromArrowResizing, getItemsToFuse, getHoverToFuse, fromTextDeletion, fromTextUpdating, CoordinateTransformation, fromTemplateOnCanvas, fromTemplateOnBondAction, fromTemplateOnAtom, BondAttr, AtomAttr, formatProperties, ketcherProvider, runAsyncAction, getStructStringFromClipboardData, getStructure, initHotKeys, keyNorm, Fragment as Fragment$1, fromRGroupAttachmentPointUpdate, fromOneBondDeletion, bondChangingAction, fromChain, fromStereoFlagUpdate, fromOneAtomDeletion, fromArrowDeletion, fromPlusDeletion, fromSimpleObjectDeletion, fromRGroupAttachmentPointDeletion, notifyItemsToMergeInitializationComplete, fromPaste, RGroup as RGroup$2, fromRGroupFragment, fromUpdateIfThen, fromRGroupAttrs, fromArrowAddition, fromPlusAddition, fromRotate, fromFlip, fromSimpleObjectAddition, fromTextCreation, fromHighlightCreate, fromHighlightClear, provideEditorSettings, fromNewCanvas, Render, fromDescriptorsAlign, fromSgroupAttachmentPointAddition, SGroupAttachmentPoint, fromSgroupAddition, atomGetAttr, genericsList, getAtomCustomQuery, getFormatMimeTypeByFileName, getPropertiesByFormat, StereoFlag, getPropertiesByImgFormat, b64toBlob, Generics, TextCommand, DefaultStructServiceOptions } from 'ketcher-core';
28
28
  import * as React from 'react';
29
29
  import React__default, { createRef, Component, useRef, useEffect, useLayoutEffect, useState, useMemo, createElement, forwardRef, useCallback, Fragment as Fragment$2, PureComponent, lazy, Suspense } from 'react';
30
30
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
@@ -3595,7 +3595,7 @@ var zoom = {
3595
3595
 
3596
3596
  var openHelpLink = function openHelpLink() {
3597
3597
  var _window$open;
3598
- return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.22.0-rc.5\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
3598
+ return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.23.0-rc.1-dev.1\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
3599
3599
  };
3600
3600
  var help = {
3601
3601
  help: {
@@ -23599,6 +23599,12 @@ var Editor$3 = function () {
23599
23599
  value: function clearMacromoleculeConvertionError() {
23600
23600
  this.macromoleculeConvertionError = null;
23601
23601
  }
23602
+ }, {
23603
+ key: "focusCliparea",
23604
+ value: function focusCliparea() {
23605
+ var cliparea = document.querySelector('.cliparea');
23606
+ cliparea === null || cliparea === void 0 || cliparea.focus();
23607
+ }
23602
23608
  }]);
23603
23609
  return Editor;
23604
23610
  }();
@@ -23894,7 +23900,8 @@ var useDelete$1 = function useDelete() {
23894
23900
  action = fromFragmentDeletion(molecule, itemsToDelete);
23895
23901
  editor.update(action);
23896
23902
  editor.selection(null);
23897
- case 7:
23903
+ editor.focusCliparea();
23904
+ case 8:
23898
23905
  case "end":
23899
23906
  return _context.stop();
23900
23907
  }
@@ -23946,7 +23953,7 @@ var useAddAttachmentPoint = function useAddAttachmentPoint() {
23946
23953
  var handler = useCallback( function () {
23947
23954
  var _ref2 = _asyncToGenerator( _regeneratorRuntime.mark(function _callee(_ref) {
23948
23955
  var _props$atomIds;
23949
- var props, editor, restruct, struct, atomId, sgroup, bondAdditionResult, action, addedLeavingGroupAtomId, moleculeAtoms, sgroupAttachmentPoints, lastAttachmentPoint;
23956
+ var props, editor, restruct, struct, atomId, sgroup, bondAdditionResult, action, addedLeavingGroupAtomId, moleculeAtoms, sgroupAttachmentPoints, allPointsNumbers, lastMinimalPointNumber, hasFirstNumber, i, prevNumber, currentNumber;
23950
23957
  return _regeneratorRuntime.wrap(function _callee$(_context) {
23951
23958
  while (1) switch (_context.prev = _context.next) {
23952
23959
  case 0:
@@ -23969,19 +23976,56 @@ var useAddAttachmentPoint = function useAddAttachmentPoint() {
23969
23976
  });
23970
23977
  action = bondAdditionResult[0];
23971
23978
  addedLeavingGroupAtomId = bondAdditionResult[2];
23972
- if (!sgroup) {
23973
- moleculeAtoms = struct.findConnectedComponent(atomId);
23974
- action.mergeWith(fromSgroupAddition(restruct, SGroup$1.TYPES.SUP, moleculeAtoms, {
23975
- expanded: true
23976
- }, restruct.molecule.sgroups.newId(), [new SGroupAttachmentPoint(atomId, addedLeavingGroupAtomId, undefined, 1)]));
23977
- } else {
23978
- sgroupAttachmentPoints = (sgroup === null || sgroup === void 0 ? void 0 : sgroup.getAttachmentPoints()) || [];
23979
- lastAttachmentPoint = sgroupAttachmentPoints[sgroupAttachmentPoints.length - 1];
23980
- action.mergeWith(fromSgroupAttachmentPointAddition(restruct, sgroup.id, new SGroupAttachmentPoint(atomId, addedLeavingGroupAtomId, undefined, (lastAttachmentPoint.attachmentPointNumber || 0) + 1)));
23979
+ if (sgroup) {
23980
+ _context.next = 16;
23981
+ break;
23982
+ }
23983
+ moleculeAtoms = struct.findConnectedComponent(atomId);
23984
+ action.mergeWith(fromSgroupAddition(restruct, SGroup$1.TYPES.SUP, moleculeAtoms, {
23985
+ expanded: true
23986
+ }, restruct.molecule.sgroups.newId(), [new SGroupAttachmentPoint(atomId, addedLeavingGroupAtomId, undefined, 1)]));
23987
+ _context.next = 35;
23988
+ break;
23989
+ case 16:
23990
+ sgroupAttachmentPoints = (sgroup === null || sgroup === void 0 ? void 0 : sgroup.getAttachmentPoints()) || [];
23991
+ allPointsNumbers = sgroupAttachmentPoints.map(function (point) {
23992
+ return point.attachmentPointNumber || 0;
23993
+ }).sort();
23994
+ lastMinimalPointNumber = allPointsNumbers[allPointsNumbers.length - 1];
23995
+ hasFirstNumber = allPointsNumbers.includes(1);
23996
+ if (hasFirstNumber) {
23997
+ _context.next = 24;
23998
+ break;
23981
23999
  }
24000
+ lastMinimalPointNumber = 0;
24001
+ _context.next = 34;
24002
+ break;
24003
+ case 24:
24004
+ i = 1;
24005
+ case 25:
24006
+ if (!(i < allPointsNumbers.length)) {
24007
+ _context.next = 34;
24008
+ break;
24009
+ }
24010
+ prevNumber = allPointsNumbers[i - 1];
24011
+ currentNumber = allPointsNumbers[i];
24012
+ if (!(currentNumber > prevNumber + 1)) {
24013
+ _context.next = 31;
24014
+ break;
24015
+ }
24016
+ lastMinimalPointNumber = prevNumber;
24017
+ return _context.abrupt("break", 34);
24018
+ case 31:
24019
+ i++;
24020
+ _context.next = 25;
24021
+ break;
24022
+ case 34:
24023
+ action.mergeWith(fromSgroupAttachmentPointAddition(restruct, sgroup.id, new SGroupAttachmentPoint(atomId, addedLeavingGroupAtomId, undefined, lastMinimalPointNumber + 1)));
24024
+ case 35:
23982
24025
  editor.update(action);
23983
24026
  editor.selection(null);
23984
- case 14:
24027
+ editor.focusCliparea();
24028
+ case 38:
23985
24029
  case "end":
23986
24030
  return _context.stop();
23987
24031
  }
@@ -24027,7 +24071,8 @@ var useRemoveAttachmentPoint = function useRemoveAttachmentPoint() {
24027
24071
  action = fromOneAtomDeletion(restruct, attachmentPointToDelete.leaveAtomId);
24028
24072
  editor.update(action);
24029
24073
  editor.selection(null);
24030
- case 15:
24074
+ editor.focusCliparea();
24075
+ case 16:
24031
24076
  case "end":
24032
24077
  return _context.stop();
24033
24078
  }
@@ -24168,6 +24213,12 @@ var AtomMenuItems = function AtomMenuItems(props) {
24168
24213
  return bond.endSuperatomAttachmentPointNumber === attachmentPoint.attachmentPointNumber || bond.beginSuperatomAttachmentPointNumber === attachmentPoint.attachmentPointNumber;
24169
24214
  }));
24170
24215
  });
24216
+ if (isAtomSuperatomLeavingGroup && onlyOneAtomSelected) {
24217
+ return jsx(Item, _objectSpread$M(_objectSpread$M({}, props), {}, {
24218
+ onClick: handleDelete,
24219
+ children: "Delete"
24220
+ }));
24221
+ }
24171
24222
  return jsxs(Fragment, {
24172
24223
  children: [jsx(Item, _objectSpread$M(_objectSpread$M({}, props), {}, {
24173
24224
  onClick: handleEdit,
@@ -32937,8 +32988,8 @@ var KetcherBuilder = function () {
32937
32988
  initApp(element, appRoot, staticResourcesUrl, {
32938
32989
  buttons: buttons || {},
32939
32990
  errorHandler: errorHandler || null,
32940
- version: "2.22.0-rc.5" ,
32941
- buildDate: "2024-06-13T16:31:07" ,
32991
+ version: "2.23.0-rc.1-dev.1" ,
32992
+ buildDate: "2024-06-16T11:41:22" ,
32942
32993
  buildNumber: ''
32943
32994
  }, structService, resolve, togglerComponent);
32944
32995
  });