ketcher-react 2.12.0-rc.1 → 2.12.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.
@@ -49,6 +49,7 @@ import useResizeObserver from 'use-resize-observer/polyfilled';
49
49
  import { useInView } from 'react-intersection-observer';
50
50
  import _taggedTemplateLiteral from '@babel/runtime/helpers/taggedTemplateLiteral';
51
51
  import { IconButton as IconButton$1, Collapse, ClickAwayListener, Button, Popover, createTheme, ThemeProvider } from '@mui/material';
52
+ import { createSelector } from 'reselect';
52
53
  import * as KN from 'w3c-keyname';
53
54
  import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
54
55
  import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
@@ -68,7 +69,6 @@ import { css } from '@emotion/react';
68
69
  import Accordion$1 from '@mui/material/Accordion';
69
70
  import AccordionSummary from '@mui/material/AccordionSummary';
70
71
  import AccordionDetails from '@mui/material/AccordionDetails';
71
- import { createSelector } from 'reselect';
72
72
  import Tabs$1 from '@mui/material/Tabs';
73
73
  import Tab from '@mui/material/Tab';
74
74
  import 'draft-js/dist/Draft.css';
@@ -2920,7 +2920,7 @@ var templates$1 = ["Benzene\n Ketcher 5112215552D 1 1.00000 0.00000
2920
2920
  var templateLib = {
2921
2921
  'template-lib': {
2922
2922
  shortcut: 'Shift+t',
2923
- title: 'Custom Templates',
2923
+ title: 'Structure Library',
2924
2924
  action: {
2925
2925
  dialog: 'templates',
2926
2926
  prop: {
@@ -3009,7 +3009,7 @@ var zoom = {
3009
3009
 
3010
3010
  var openHelpLink = function openHelpLink() {
3011
3011
  var _window$open;
3012
- return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.12.0-rc.1\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
3012
+ return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.12.0-rc.2\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
3013
3013
  };
3014
3014
  var help = {
3015
3015
  help: {
@@ -6711,7 +6711,7 @@ var getIconName = function getIconName(name) {
6711
6711
 
6712
6712
  var color = {
6713
6713
  white: '#FFFFFF',
6714
- primaryWhite: 'EFF2F5',
6714
+ primaryWhite: '#EFF2F5',
6715
6715
  green: '#167782',
6716
6716
  lightGreen: '#188794',
6717
6717
  graphite: '#333333',
@@ -7281,14 +7281,14 @@ var BottomToolbar = function BottomToolbar(props) {
7281
7281
  return jsx("div", {
7282
7282
  className: clsx(classes$M.root, className),
7283
7283
  children: jsxs(Group$1, {
7284
- children: [jsx(ToolbarGroupItem, _objectSpread$16({
7285
- id: "template-lib"
7286
- }, rest)), jsx(TemplatesList, {
7284
+ children: [jsx(TemplatesList, {
7287
7285
  active: active,
7288
7286
  indigoVerification: indigoVerification,
7289
7287
  disableableButtons: disableableButtons,
7290
7288
  onAction: onAction
7291
- })]
7289
+ }), jsx(ToolbarGroupItem, _objectSpread$16({
7290
+ id: "template-lib"
7291
+ }, rest))]
7292
7292
  })
7293
7293
  });
7294
7294
  };
@@ -7938,7 +7938,9 @@ function setFunctionalGroupsTooltip(_ref) {
7938
7938
  if (closestCollapsibleStructures && event) {
7939
7939
  var _editor$struct;
7940
7940
  var sGroup = (_editor$struct = editor.struct()) === null || _editor$struct === void 0 ? void 0 : _editor$struct.sgroups.get(closestCollapsibleStructures.id);
7941
- if (sGroup && !sGroup.data.expanded && sGroup.hovering) {
7941
+ var isSGroupPresent = sGroup === null || sGroup === void 0 ? void 0 : sGroup.hovering;
7942
+ var isShowingTooltip = !(sGroup !== null && sGroup !== void 0 && sGroup.data.expanded) || SGroup$1.isDataSGroup(sGroup);
7943
+ if (isSGroupPresent && isShowingTooltip) {
7942
7944
  var groupName = sGroup.data.name;
7943
7945
  var groupStruct = makeStruct(editor, sGroup);
7944
7946
  groupStruct.name = groupName;
@@ -8308,13 +8310,14 @@ function createStore (options, server, setEditor) {
8308
8310
  return createStore$1(rootReducer, initState, applyMiddleware.apply(void 0, middleware));
8309
8311
  }
8310
8312
 
8313
+ var disableableButtons$3 = [];
8311
8314
  var mapStateToProps$k = function mapStateToProps(state) {
8312
8315
  return {
8313
8316
  active: state.actionState && state.actionState.activeTool,
8314
8317
  status: state.actionState || {},
8315
8318
  opened: state.toolbar.opened,
8316
8319
  indigoVerification: state.requestsStatuses.indigoVerification,
8317
- disableableButtons: []
8320
+ disableableButtons: disableableButtons$3
8318
8321
  };
8319
8322
  };
8320
8323
  var mapDispatchToProps$j = function mapDispatchToProps(dispatch) {
@@ -8683,12 +8686,12 @@ var LeftToolbar = function LeftToolbar(props) {
8683
8686
  options: [].concat(_toConsumableArray(bondCommon), _toConsumableArray(bondQuery), _toConsumableArray(bondSpecial), _toConsumableArray(bondStereo))
8684
8687
  }, {
8685
8688
  id: 'chain'
8689
+ }, {
8690
+ id: 'enhanced-stereo'
8686
8691
  }, {
8687
8692
  id: 'charge-plus'
8688
8693
  }, {
8689
8694
  id: 'charge-minus'
8690
- }, {
8691
- id: 'enhanced-stereo'
8692
8695
  }]
8693
8696
  }), jsx("div", {
8694
8697
  className: classes$K.listener,
@@ -8734,13 +8737,13 @@ var LeftToolbar = function LeftToolbar(props) {
8734
8737
  });
8735
8738
  };
8736
8739
 
8737
- var disableableButtons = [];
8740
+ var disableableButtons$2 = [];
8738
8741
  var mapStateToProps$j = function mapStateToProps(state) {
8739
8742
  return {
8740
8743
  status: state.actionState || {},
8741
8744
  opened: state.toolbar.opened,
8742
8745
  indigoVerification: state.requestsStatuses.indigoVerification,
8743
- disableableButtons: disableableButtons
8746
+ disableableButtons: disableableButtons$2
8744
8747
  };
8745
8748
  };
8746
8749
  var mapDispatchToProps$i = function mapDispatchToProps(dispatch) {
@@ -8876,42 +8879,47 @@ var RightToolbar = function RightToolbar(props) {
8876
8879
  ref: ref,
8877
8880
  children: [jsxs("div", {
8878
8881
  ref: scrollRef,
8879
- children: [jsxs(Group, {
8880
- className: clsx(classes$I.atomsList, classes$I.buttons, classes$I.groupItem),
8881
- children: [jsx(ToolbarGroupItem, _objectSpread$S({
8882
- id: "period-table"
8883
- }, rest)), jsx(AtomsList, {
8884
- ref: startRef,
8885
- atoms: basicAtoms.slice(0, 1),
8886
- active: active,
8887
- onAction: onAction
8888
- }), jsx(AtomsList, {
8889
- atoms: basicAtoms.slice(1, 5),
8890
- active: active,
8891
- onAction: onAction
8892
- }), jsx(HorizontalDivider, {}), jsx(AtomsList, {
8893
- atoms: basicAtoms.slice(5),
8894
- active: active,
8895
- onAction: onAction
8896
- }), jsx(AtomsList, {
8897
- atoms: freqAtoms,
8898
- active: active,
8899
- onAction: onAction
8900
- })]
8901
- }), jsx(Group, {
8902
- className: clsx(classes$I.buttons, classes$I.groupItem),
8903
- children: jsxs("div", {
8904
- ref: sizeRef,
8905
- children: [jsx("div", {
8906
- ref: endRef,
8907
- className: classes$I.button,
8908
- children: jsx(ToolbarGroupItem, _objectSpread$S({
8909
- id: "extended-table"
8910
- }, rest))
8882
+ className: classes$I.buttons,
8883
+ children: [jsx("div", {
8884
+ ref: startRef,
8885
+ children: jsxs(Group, {
8886
+ className: clsx(classes$I.atomsList, classes$I.buttons, classes$I.groupItem),
8887
+ children: [jsx(AtomsList, {
8888
+ atoms: basicAtoms.slice(0, 1),
8889
+ active: active,
8890
+ onAction: onAction
8891
+ }), jsx(AtomsList, {
8892
+ atoms: basicAtoms.slice(1, 5),
8893
+ active: active,
8894
+ onAction: onAction
8895
+ }), jsx(HorizontalDivider, {}), jsx(AtomsList, {
8896
+ atoms: basicAtoms.slice(5),
8897
+ active: active,
8898
+ onAction: onAction
8899
+ }), jsx(AtomsList, {
8900
+ atoms: freqAtoms,
8901
+ active: active,
8902
+ onAction: onAction
8911
8903
  }), jsx(ToolbarGroupItem, _objectSpread$S({
8912
- id: "any-atom"
8904
+ id: "period-table"
8913
8905
  }, rest))]
8914
8906
  })
8907
+ }), jsx("div", {
8908
+ ref: endRef,
8909
+ children: jsx(Group, {
8910
+ className: classes$I.groupItem,
8911
+ children: jsxs("div", {
8912
+ ref: sizeRef,
8913
+ children: [jsx(ToolbarGroupItem, _objectSpread$S({
8914
+ id: "any-atom"
8915
+ }, rest)), jsx("div", {
8916
+ className: classes$I.button,
8917
+ children: jsx(ToolbarGroupItem, _objectSpread$S({
8918
+ id: "extended-table"
8919
+ }, rest))
8920
+ })]
8921
+ })
8922
+ })
8915
8923
  })]
8916
8924
  }), height && (scrollRef === null || scrollRef === void 0 ? void 0 : (_scrollRef$current = scrollRef.current) === null || _scrollRef$current === void 0 ? void 0 : _scrollRef$current.scrollHeight) > height && jsx(ArrowScroll, {
8917
8925
  startInView: startInView,
@@ -8922,6 +8930,7 @@ var RightToolbar = function RightToolbar(props) {
8922
8930
  });
8923
8931
  };
8924
8932
 
8933
+ var disableableButtons$1 = [];
8925
8934
  var mapStateToProps$i = function mapStateToProps(state) {
8926
8935
  return {
8927
8936
  active: state.actionState && state.actionState.activeTool,
@@ -8929,7 +8938,7 @@ var mapStateToProps$i = function mapStateToProps(state) {
8929
8938
  freqAtoms: state.toolbar.freqAtoms,
8930
8939
  opened: state.toolbar.opened,
8931
8940
  indigoVerification: state.requestsStatuses.indigoVerification,
8932
- disableableButtons: []
8941
+ disableableButtons: disableableButtons$1
8933
8942
  };
8934
8943
  };
8935
8944
  var mapDispatchToProps$h = function mapDispatchToProps(dispatch) {
@@ -9421,7 +9430,7 @@ var ExternalFuncControls = function ExternalFuncControls(_ref) {
9421
9430
 
9422
9431
  var _templateObject$2;
9423
9432
  var collapseLimit = 650;
9424
- var ControlsPanel = styled('div')(_templateObject$2 || (_templateObject$2 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n align-items: center;\n gap: 0px;\n height: 36px;\n padding: 0px 22px;\n background-color: #ffffff;\n box-shadow: 0px 2px 5px rgba(103, 104, 132, 0.15);\n\n .group {\n display: flex;\n flex-direction: row;\n gap: 0px;\n }\n\n & * {\n box-sizing: border-box;\n }\n\n @media only screen and (min-width: 1024px) {\n height: 40px;\n gap: 0px;\n padding-bottom: 10px;\n .group {\n gap: 4px;\n }\n }\n\n @media only screen and (min-width: 1920px) {\n height: 64px;\n gap: 12px;\n }\n"])));
9433
+ var ControlsPanel = styled('div')(_templateObject$2 || (_templateObject$2 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n align-items: center;\n gap: 0px;\n height: 36px;\n padding: 0px 22px;\n background-color: #ffffff;\n box-shadow: 0px 2px 5px rgba(103, 104, 132, 0.15);\n\n .group {\n display: flex;\n flex-direction: row;\n gap: 0px;\n }\n\n & * {\n box-sizing: border-box;\n }\n\n @media only screen and (min-width: 1024px) {\n height: 40px;\n gap: 0px;\n padding-bottom: 0;\n .group {\n gap: 4px;\n }\n }\n\n @media only screen and (min-width: 1920px) {\n height: 64px;\n gap: 12px;\n }\n"])));
9425
9434
  var TopToolbar = function TopToolbar(_ref) {
9426
9435
  var className = _ref.className,
9427
9436
  disabledButtons = _ref.disabledButtons,
@@ -9524,41 +9533,48 @@ var TopToolbar = function TopToolbar(_ref) {
9524
9533
  });
9525
9534
  };
9526
9535
 
9527
- var shortcuts = Object.keys(config).reduce(function (acc, key) {
9528
- var _action$key;
9529
- if ((_action$key = config[key]) !== null && _action$key !== void 0 && _action$key.shortcut) {
9530
- var shortcut = config[key].shortcut;
9531
- var processedShortcut = shortcutStr(shortcut);
9532
- acc[key] = processedShortcut;
9533
- }
9534
- return acc;
9535
- }, {});
9536
- var mapStateToProps$h = function mapStateToProps(state) {
9537
- var _state$actionState, _state$actionState$zo;
9538
- var actionState = state.actionState || {};
9539
- var disabledButtons = Object.keys(actionState).reduce(function (acc, item) {
9536
+ var getActionState = function getActionState(state) {
9537
+ return state.actionState || {};
9538
+ };
9539
+ var disabledButtonsSelector = createSelector([getActionState], function (actionState) {
9540
+ return Object.keys(actionState).reduce(function (acc, item) {
9540
9541
  var _actionState$item;
9541
9542
  if ((_actionState$item = actionState[item]) !== null && _actionState$item !== void 0 && _actionState$item.disabled) {
9542
9543
  acc.push(item);
9543
9544
  }
9544
9545
  return acc;
9545
9546
  }, []);
9546
- var hiddenButtons = Object.keys(actionState).reduce(function (acc, item) {
9547
+ });
9548
+ var hiddenButtonsSelector = createSelector([getActionState], function (actionState) {
9549
+ return Object.keys(actionState).reduce(function (acc, item) {
9547
9550
  var _actionState$item2;
9548
9551
  if ((_actionState$item2 = actionState[item]) !== null && _actionState$item2 !== void 0 && _actionState$item2.hidden) {
9549
9552
  acc.push(item);
9550
9553
  }
9551
9554
  return acc;
9552
9555
  }, []);
9556
+ });
9557
+ var disableableButtons = ['layout', 'clean', 'arom', 'dearom', 'cip', 'enhanced-stereo'];
9558
+ var shortcuts = Object.keys(config).reduce(function (acc, key) {
9559
+ var _action$key;
9560
+ if ((_action$key = config[key]) !== null && _action$key !== void 0 && _action$key.shortcut) {
9561
+ var shortcut = config[key].shortcut;
9562
+ var processedShortcut = shortcutStr(shortcut);
9563
+ acc[key] = processedShortcut;
9564
+ }
9565
+ return acc;
9566
+ }, {});
9567
+ var mapStateToProps$h = function mapStateToProps(state) {
9568
+ var _state$actionState, _state$actionState$zo;
9553
9569
  return {
9554
9570
  currentZoom: Math.round(((_state$actionState = state.actionState) === null || _state$actionState === void 0 ? void 0 : (_state$actionState$zo = _state$actionState.zoom) === null || _state$actionState$zo === void 0 ? void 0 : _state$actionState$zo.selected) * 100),
9555
- disabledButtons: disabledButtons,
9556
- hiddenButtons: hiddenButtons,
9571
+ disabledButtons: disabledButtonsSelector(state),
9572
+ hiddenButtons: hiddenButtonsSelector(state),
9557
9573
  shortcuts: shortcuts,
9558
9574
  status: state.actionState || {},
9559
9575
  opened: state.toolbar.opened,
9560
9576
  indigoVerification: state.requestsStatuses.indigoVerification,
9561
- disableableButtons: ['layout', 'clean', 'arom', 'dearom', 'cip', 'enhanced-stereo']
9577
+ disableableButtons: disableableButtons
9562
9578
  };
9563
9579
  };
9564
9580
  var mapDispatchToProps$f = function mapDispatchToProps(dispatch) {
@@ -9828,16 +9844,16 @@ function isCloseToTheEdgeOfCanvas(selectedItems, editor, key) {
9828
9844
  var atom = restruct.atoms.get(atomId);
9829
9845
  var position = atom === null || atom === void 0 ? void 0 : atom.a.pp;
9830
9846
  if (position && theMostTopAtom) {
9831
- theMostTopAtom = position.y > theMostTopAtom.a.pp.y ? atom : theMostTopAtom;
9847
+ theMostTopAtom = position.y < theMostTopAtom.a.pp.y ? atom : theMostTopAtom;
9832
9848
  }
9833
9849
  if (position && theMostBottomAtom) {
9834
- theMostBottomAtom = position.y < theMostBottomAtom.a.pp.y ? atom : theMostBottomAtom;
9850
+ theMostBottomAtom = position.y > theMostBottomAtom.a.pp.y ? atom : theMostBottomAtom;
9835
9851
  }
9836
9852
  if (position && theMostRightAtom) {
9837
- theMostRightAtom = position.x > theMostRightAtom.a.pp.y ? atom : theMostRightAtom;
9853
+ theMostRightAtom = position.x > theMostRightAtom.a.pp.x ? atom : theMostRightAtom;
9838
9854
  }
9839
9855
  if (position && theMostLeftAtom) {
9840
- theMostLeftAtom = position.x < theMostLeftAtom.a.pp.y ? atom : theMostLeftAtom;
9856
+ theMostLeftAtom = position.x < theMostLeftAtom.a.pp.x ? atom : theMostLeftAtom;
9841
9857
  }
9842
9858
  });
9843
9859
  if (theMostTopAtom && theMostBottomAtom && theMostRightAtom && theMostLeftAtom) {
@@ -19148,13 +19164,12 @@ var RotateTool = function () {
19148
19164
  center = (_struct$atoms$get2 = struct.atoms.get(rotatePoint)) === null || _struct$atoms$get2 === void 0 ? void 0 : _struct$atoms$get2.pp;
19149
19165
  }
19150
19166
  if (!center && (visibleAtoms.length || texts !== null && texts !== void 0 && texts.length || rxnArrows !== null && rxnArrows !== void 0 && rxnArrows.length || rxnPluses !== null && rxnPluses !== void 0 && rxnPluses.length)) {
19151
- var selectionBoundingBox = editor.render.ctab.getVBoxObj({
19167
+ center = editor.render.ctab.getSelectionRotationCenter({
19152
19168
  atoms: visibleAtoms,
19153
19169
  texts: texts,
19154
19170
  rxnArrows: rxnArrows,
19155
19171
  rxnPluses: rxnPluses
19156
19172
  });
19157
- center = selectionBoundingBox === null || selectionBoundingBox === void 0 ? void 0 : selectionBoundingBox.centre();
19158
19173
  }
19159
19174
  return [center, visibleAtoms];
19160
19175
  }
@@ -21104,9 +21119,10 @@ function resetSelectionOnCanvasClick(editor, eventName, clientArea, event) {
21104
21119
  function updateLastCursorPosition(editor, event) {
21105
21120
  var events = ['mousemove', 'click', 'mousedown', 'mouseup', 'mouseover'];
21106
21121
  if (events.includes(event.type)) {
21122
+ var clientAreaBoundingBox = editor.render.clientArea.getBoundingClientRect();
21107
21123
  editor.lastCursorPosition = {
21108
- x: event.layerX,
21109
- y: event.layerY
21124
+ x: event.pageX - clientAreaBoundingBox.x,
21125
+ y: event.pageY - clientAreaBoundingBox.y
21110
21126
  };
21111
21127
  }
21112
21128
  }
@@ -24982,9 +24998,15 @@ var MiewDialog = function MiewDialog(_ref) {
24982
24998
  })
24983
24999
  });
24984
25000
  };
25001
+ var getOptionsSettings = function getOptionsSettings(state) {
25002
+ return state.options.settings;
25003
+ };
25004
+ var miewOptionsSelector = createSelector([getOptionsSettings], function (settings) {
25005
+ return createMiewOptions(pick(MIEW_OPTIONS, settings));
25006
+ });
24985
25007
  var mapStateToProps$a = function mapStateToProps(state) {
24986
25008
  return {
24987
- miewOpts: createMiewOptions(pick(MIEW_OPTIONS, state.options.settings)),
25009
+ miewOpts: miewOptionsSelector(state),
24988
25010
  server: state.options.app.server ? state.server : null,
24989
25011
  struct: state.editor.struct(),
24990
25012
  miewTheme: state.options.settings.miewTheme
@@ -26267,11 +26289,17 @@ var SaveDialog = function (_Component) {
26267
26289
  return SaveDialog;
26268
26290
  }(Component);
26269
26291
  _defineProperty$1(SaveDialog, "contextType", errorsContext);
26292
+ var getOptions = function getOptions(state) {
26293
+ return state.options;
26294
+ };
26295
+ var serverSettingsSelector = createSelector([getOptions], function (options) {
26296
+ return options.getServerSettings();
26297
+ });
26270
26298
  var mapStateToProps$3 = function mapStateToProps(state) {
26271
26299
  return {
26272
26300
  server: state.options.app.server ? state.server : null,
26273
26301
  struct: state.editor.struct(),
26274
- options: state.options.getServerSettings(),
26302
+ options: serverSettingsSelector(state),
26275
26303
  formState: state.modal.form,
26276
26304
  moleculeErrors: state.modal.form.moleculeErrors,
26277
26305
  checkState: state.options.check,
@@ -29266,8 +29294,8 @@ var KetcherBuilder = function () {
29266
29294
  initApp(element, staticResourcesUrl, {
29267
29295
  buttons: buttons || {},
29268
29296
  errorHandler: errorHandler || null,
29269
- version: "2.12.0-rc.1" ,
29270
- buildDate: "2023-06-28T12:14:56" ,
29297
+ version: "2.12.0-rc.2" ,
29298
+ buildDate: "2023-07-03T14:37:11" ,
29271
29299
  buildNumber: ''
29272
29300
  }, structService, resolve);
29273
29301
  });