ketcher-react 2.6.0 → 2.6.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.
@@ -40,7 +40,7 @@ import ReactDOM from 'react-dom';
40
40
  import { connect, useDispatch, useSelector, Provider } from 'react-redux';
41
41
  import { combineReducers, createStore as createStore$1, applyMiddleware } from 'redux';
42
42
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
43
- import { logger } from 'redux-logger';
43
+ import 'redux-logger';
44
44
  import thunk from 'redux-thunk';
45
45
  import { throttle as throttle$1, inRange, isEqual as isEqual$1, range as range$1 } from 'lodash';
46
46
  import useResizeObserver from 'use-resize-observer/polyfilled';
@@ -356,7 +356,6 @@ function _copy(cb, data) {
356
356
  cb.setData(fmt, data[fmt]);
357
357
  });
358
358
  } catch (ex) {
359
- console.info("Could not write exact type ".concat(curFmt));
360
359
  }
361
360
  }
362
361
  }
@@ -682,7 +681,6 @@ var storage = {
682
681
  try {
683
682
  item = JSON.parse(localStorage.getItem(key));
684
683
  } catch (ex) {
685
- console.info('LocalStorage:', ex.name);
686
684
  }
687
685
  return item;
688
686
  },
@@ -692,7 +690,6 @@ var storage = {
692
690
  localStorage.setItem(key, JSON.stringify(data));
693
691
  isSet = true;
694
692
  } catch (ex) {
695
- console.info('LocalStorage:', ex.name);
696
693
  isSet = false;
697
694
  }
698
695
  return isSet;
@@ -826,7 +823,6 @@ function constant(schema, prop) {
826
823
  return desc.constant || desc["enum"][0];
827
824
  }
828
825
  function mapOf(schema, prop) {
829
- console.assert(schema.oneOf);
830
826
  return schema.oneOf.reduce(function (res, desc) {
831
827
  res[constant(desc, prop)] = desc;
832
828
  return res;
@@ -2482,7 +2478,7 @@ function load(struct, options) {
2482
2478
  if (parsedStruct.isBlank()) {
2483
2479
  dispatch({
2484
2480
  type: 'ACTION',
2485
- action: tools$1['select-lasso'].action
2481
+ action: tools$1['select-rectangle'].action
2486
2482
  });
2487
2483
  } else {
2488
2484
  dispatch(onAction({
@@ -2854,7 +2850,7 @@ var zoom = {
2854
2850
 
2855
2851
  var openHelpLink = function openHelpLink() {
2856
2852
  var _window$open;
2857
- return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.5.2\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
2853
+ return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.6.2\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
2858
2854
  };
2859
2855
  var help = {
2860
2856
  help: {
@@ -2927,7 +2923,7 @@ var config = _objectSpread$Y(_objectSpread$Y(_objectSpread$Y(_objectSpread$Y(_ob
2927
2923
  if (!editor.struct().isBlank()) editor.struct(null);
2928
2924
  dispatch({
2929
2925
  type: 'ACTION',
2930
- action: tools$1['select-lasso'].action
2926
+ action: tools$1['select-rectangle'].action
2931
2927
  });
2932
2928
  }
2933
2929
  },
@@ -7624,9 +7620,7 @@ function execute(activeTool, _ref) {
7624
7620
  }
7625
7621
  } else if (typeof action === 'function') {
7626
7622
  action(editor, server, options);
7627
- } else {
7628
- console.info('no action');
7629
- }
7623
+ } else ;
7630
7624
  return activeTool;
7631
7625
  }
7632
7626
  function selected(actObj, activeTool, _ref2) {
@@ -7666,7 +7660,7 @@ function actionStateReducer () {
7666
7660
  var activeTool;
7667
7661
  switch (type) {
7668
7662
  case 'INIT':
7669
- action = config['select-lasso'].action;
7663
+ action = config['select-rectangle'].action;
7670
7664
  case 'ACTION':
7671
7665
  activeTool = execute(state && state.activeTool, _objectSpread$S(_objectSpread$S({}, params), {}, {
7672
7666
  action: action
@@ -7756,7 +7750,7 @@ var initial = {
7756
7750
  currentAtom: 0,
7757
7751
  opened: null,
7758
7752
  visibleTools: {
7759
- select: 'select-lasso'
7753
+ select: 'select-rectangle'
7760
7754
  }
7761
7755
  };
7762
7756
  var MAX_ATOMS = 7;
@@ -7924,7 +7918,6 @@ function createStore (options, server, setEditor) {
7924
7918
  templates: initTmplsState
7925
7919
  };
7926
7920
  var middleware = [thunk];
7927
- middleware.push(logger);
7928
7921
  var rootReducer = getRootReducer(setEditor);
7929
7922
  return createStore$1(rootReducer, initState, applyMiddleware.apply(void 0, middleware));
7930
7923
  }
@@ -7983,7 +7976,7 @@ var groupDescriptors = groups.reduce(function (accum, group, index) {
7983
7976
  var rGroupOptions = makeItems(['rgroup-label', 'rgroup-fragment', 'rgroup-attpoints']);
7984
7977
  var shapeOptions = makeItems(['shape-ellipse', 'shape-rectangle', 'shape-line']);
7985
7978
  var transformOptions = makeItems(['transform-rotate', 'transform-flip-h', 'transform-flip-v']);
7986
- var selectOptions$2 = makeItems(['select-lasso', 'select-rectangle', 'select-fragment']);
7979
+ var selectOptions$2 = makeItems(['select-rectangle', 'select-lasso', 'select-fragment']);
7987
7980
  var arrowsOptions = makeItems(['reaction-arrow-open-angle', 'reaction-arrow-filled-triangle', 'reaction-arrow-filled-bow', 'reaction-arrow-dashed-open-angle', 'reaction-arrow-failed', 'reaction-arrow-both-ends-filled-triangle', 'reaction-arrow-equilibrium-filled-half-bow', 'reaction-arrow-equilibrium-filled-triangle', 'reaction-arrow-equilibrium-open-angle', 'reaction-arrow-unbalanced-equilibrium-filled-half-bow', 'reaction-arrow-unbalanced-equilibrium-open-half-angle', 'reaction-arrow-unbalanced-equilibrium-large-filled-half-bow', 'reaction-arrow-unbalanced-equilibrium-filled-half-triangle', 'reaction-arrow-elliptical-arc-arrow-filled-bow', 'reaction-arrow-elliptical-arc-arrow-filled-triangle', 'reaction-arrow-elliptical-arc-arrow-open-angle', 'reaction-arrow-elliptical-arc-arrow-open-half-angle']);
7988
7981
  var mappingOptions = makeItems(['reaction-map', 'reaction-unmap', 'reaction-automap']);
7989
7982
 
@@ -8798,10 +8791,12 @@ var AtomsList = forwardRef(function (props, ref) {
8798
8791
  children: atoms.map(function (label) {
8799
8792
  var element = Elements.get(label);
8800
8793
  var shortcut = atoms.indexOf(label) > -1 ? shortcutStr(atomCuts[label]) : null;
8794
+ var isSelected = isAtom && active && active.opts.label === label;
8801
8795
  return jsx(StyledAtom, {
8802
8796
  el: element,
8803
8797
  shortcut: shortcut,
8804
- selected: isAtom && active && active.opts.label === label,
8798
+ className: isSelected ? 'selected' : '',
8799
+ selected: isSelected,
8805
8800
  onClick: function onClick() {
8806
8801
  return onAction({
8807
8802
  tool: 'atom',
@@ -9509,7 +9504,6 @@ var TopToolbar = function TopToolbar(_ref) {
9509
9504
  isCollapsed: width < collapseLimit
9510
9505
  }), jsx(SystemControls, {
9511
9506
  onHistoryClick: function onHistoryClick() {
9512
- console.log('History button clicked');
9513
9507
  },
9514
9508
  onSettingsOpen: onSettingsOpen,
9515
9509
  onFullscreen: onFullscreen,
@@ -12230,7 +12224,6 @@ function sgroupDialog(editor, id, defaultType) {
12230
12224
  var type = sg ? sg.type : defaultType;
12231
12225
  var eventName = type === 'DAT' ? 'sdataEdit' : 'sgroupEdit';
12232
12226
  if (!selection.atoms && !selection.bonds && !sg) {
12233
- console.info('There is no selection or sgroup');
12234
12227
  return;
12235
12228
  }
12236
12229
  var attrs;
@@ -13061,7 +13054,6 @@ var EraserTool = function () {
13061
13054
  } else if (ci.map === 'texts') {
13062
13055
  this.editor.update(fromTextDeletion(restruct, ci.id));
13063
13056
  } else {
13064
- console.error('EraserTool: unable to delete the object ' + ci.map + '[' + ci.id + ']');
13065
13057
  return;
13066
13058
  }
13067
13059
  this.editor.selection(null);
@@ -14800,8 +14792,8 @@ var Editor$3 = function () {
14800
14792
  value: function renderAndRecoordinateStruct(struct) {
14801
14793
  var action = fromNewCanvas(this.render.ctab, struct);
14802
14794
  this.update(action);
14803
- var structCenter = getStructCenter(this.render.ctab);
14804
- recoordinate(this, structCenter);
14795
+ getStructCenter(this.render.ctab);
14796
+ recoordinate(this);
14805
14797
  return this.render.ctab.molecule;
14806
14798
  }
14807
14799
  }, {
@@ -14850,8 +14842,8 @@ var Editor$3 = function () {
14850
14842
  }
14851
14843
  this.render.setZoom(value);
14852
14844
  var selection = this.selection();
14853
- var structCenter = getStructCenter(this.render.ctab, selection);
14854
- recoordinate(this, structCenter);
14845
+ getStructCenter(this.render.ctab, selection);
14846
+ recoordinate(this);
14855
14847
  this.render.update();
14856
14848
  return this.render.options.zoom;
14857
14849
  }
@@ -15089,7 +15081,6 @@ function domEventSetup(editor, clientArea) {
15089
15081
  }
15090
15082
  function recoordinate(editor, rp
15091
15083
  ) {
15092
- console.assert(rp, 'Reference point not specified');
15093
15084
  editor.render.setScrollOffset(0, 0);
15094
15085
  }
15095
15086
  function getStructCenter(ReStruct, selection) {
@@ -16107,7 +16098,6 @@ function greekify(str) {
16107
16098
  });
16108
16099
  }
16109
16100
  function filterLib(lib, filter$1) {
16110
- console.warn('Filter', filter$1);
16111
16101
  var re = new RegExp(escapeRegExp(greekify(filter$1)), 'i');
16112
16102
  return flow(filter(function (item) {
16113
16103
  return !filter$1 || re.test(greekify(item.struct.name)) || re.test(greekify(item.props.group));
@@ -16117,7 +16107,6 @@ function filterLib(lib, filter$1) {
16117
16107
  }, {}))(lib);
16118
16108
  }
16119
16109
  function filterFGLib(lib, filter$1) {
16120
- console.warn('Filter', filter$1);
16121
16110
  var re = new RegExp(escapeRegExp(greekify(filter$1)), 'i');
16122
16111
  return flow(filter(function (item) {
16123
16112
  return !filter$1 || re.test(greekify(item.struct.name));
@@ -17166,7 +17155,6 @@ var mapDispatchToProps$b = function mapDispatchToProps(dispatch, ownProps) {
17166
17155
  result: JSON.parse(newOpts)
17167
17156
  }));
17168
17157
  } catch (ex) {
17169
- console.info('Bad file');
17170
17158
  }
17171
17159
  },
17172
17160
  onReset: function onReset() {
@@ -17581,7 +17569,6 @@ function renderStruct(el, struct) {
17581
17569
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
17582
17570
  if (el) {
17583
17571
  if (struct) {
17584
- console.info('render!', el.clientWidth, el.clientWidth);
17585
17572
  struct.initHalfBonds();
17586
17573
  struct.initNeighbors();
17587
17574
  struct.setImplicitHydrogen();
@@ -17945,7 +17932,7 @@ var MiewDialog = function MiewDialog(_ref) {
17945
17932
  }).then(function () {
17946
17933
  return miew.setOptions(miewOpts);
17947
17934
  })["catch"](function (ex) {
17948
- return console.error(ex.message);
17935
+ return (void 0);
17949
17936
  });
17950
17937
  }, [miewOpts, server, struct]);
17951
17938
  var exportCML = useCallback(function () {
@@ -18560,14 +18547,17 @@ var OpenOptions = function OpenOptions(_ref) {
18560
18547
 
18561
18548
  var TextEditor = function TextEditor(_ref) {
18562
18549
  var structStr = _ref.structStr,
18563
- inputHandler = _ref.inputHandler;
18550
+ inputHandler = _ref.inputHandler,
18551
+ _ref$autoFocus = _ref.autoFocus,
18552
+ autoFocus = _ref$autoFocus === void 0 ? false : _ref$autoFocus;
18564
18553
  return jsx(Fragment, {
18565
18554
  children: jsx("textarea", {
18566
18555
  className: classes$l.textareaEditor,
18567
18556
  value: structStr,
18568
18557
  onChange: function onChange(event) {
18569
18558
  return inputHandler(event.target.value);
18570
- }
18559
+ },
18560
+ autoFocus: autoFocus
18571
18561
  })
18572
18562
  });
18573
18563
  };
@@ -18719,7 +18709,8 @@ var Open = function Open(props) {
18719
18709
  errorHandler: errorHandler,
18720
18710
  isRecognizeDisabled: isRecognizeDisabled,
18721
18711
  structStr: structStr,
18722
- inputHandler: setStructStr
18712
+ inputHandler: setStructStr,
18713
+ autoFocus: true
18723
18714
  })
18724
18715
  });
18725
18716
  };
@@ -21761,8 +21752,8 @@ var KetcherBuilder = function () {
21761
21752
  initApp(element, staticResourcesUrl, {
21762
21753
  buttons: buttons || {},
21763
21754
  errorHandler: errorHandler || null,
21764
- version: "2.5.2" ,
21765
- buildDate: "2022-10-31T09:16:26" ,
21755
+ version: "2.6.2" ,
21756
+ buildDate: "2022-11-18T12:28:46" ,
21766
21757
  buildNumber: ''
21767
21758
  }, structService, resolve);
21768
21759
  });