ketcher-react 2.6.0-rc.3 → 2.6.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.
@@ -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 'redux-logger';
43
+ import { logger } from '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,6 +356,7 @@ 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));
359
360
  }
360
361
  }
361
362
  }
@@ -681,6 +682,7 @@ var storage = {
681
682
  try {
682
683
  item = JSON.parse(localStorage.getItem(key));
683
684
  } catch (ex) {
685
+ console.info('LocalStorage:', ex.name);
684
686
  }
685
687
  return item;
686
688
  },
@@ -690,6 +692,7 @@ var storage = {
690
692
  localStorage.setItem(key, JSON.stringify(data));
691
693
  isSet = true;
692
694
  } catch (ex) {
695
+ console.info('LocalStorage:', ex.name);
693
696
  isSet = false;
694
697
  }
695
698
  return isSet;
@@ -823,6 +826,7 @@ function constant(schema, prop) {
823
826
  return desc.constant || desc["enum"][0];
824
827
  }
825
828
  function mapOf(schema, prop) {
829
+ console.assert(schema.oneOf);
826
830
  return schema.oneOf.reduce(function (res, desc) {
827
831
  res[constant(desc, prop)] = desc;
828
832
  return res;
@@ -2478,7 +2482,7 @@ function load(struct, options) {
2478
2482
  if (parsedStruct.isBlank()) {
2479
2483
  dispatch({
2480
2484
  type: 'ACTION',
2481
- action: tools$1['select-lasso'].action
2485
+ action: tools$1['select-rectangle'].action
2482
2486
  });
2483
2487
  } else {
2484
2488
  dispatch(onAction({
@@ -2850,7 +2854,7 @@ var zoom = {
2850
2854
 
2851
2855
  var openHelpLink = function openHelpLink() {
2852
2856
  var _window$open;
2853
- return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.6.0-rc.2\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
2857
+ return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.6.0\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
2854
2858
  };
2855
2859
  var help = {
2856
2860
  help: {
@@ -2923,7 +2927,7 @@ var config = _objectSpread$Y(_objectSpread$Y(_objectSpread$Y(_objectSpread$Y(_ob
2923
2927
  if (!editor.struct().isBlank()) editor.struct(null);
2924
2928
  dispatch({
2925
2929
  type: 'ACTION',
2926
- action: tools$1['select-lasso'].action
2930
+ action: tools$1['select-rectangle'].action
2927
2931
  });
2928
2932
  }
2929
2933
  },
@@ -7620,7 +7624,9 @@ function execute(activeTool, _ref) {
7620
7624
  }
7621
7625
  } else if (typeof action === 'function') {
7622
7626
  action(editor, server, options);
7623
- } else ;
7627
+ } else {
7628
+ console.info('no action');
7629
+ }
7624
7630
  return activeTool;
7625
7631
  }
7626
7632
  function selected(actObj, activeTool, _ref2) {
@@ -7660,7 +7666,7 @@ function actionStateReducer () {
7660
7666
  var activeTool;
7661
7667
  switch (type) {
7662
7668
  case 'INIT':
7663
- action = config['select-lasso'].action;
7669
+ action = config['select-rectangle'].action;
7664
7670
  case 'ACTION':
7665
7671
  activeTool = execute(state && state.activeTool, _objectSpread$S(_objectSpread$S({}, params), {}, {
7666
7672
  action: action
@@ -7750,7 +7756,7 @@ var initial = {
7750
7756
  currentAtom: 0,
7751
7757
  opened: null,
7752
7758
  visibleTools: {
7753
- select: 'select-lasso'
7759
+ select: 'select-rectangle'
7754
7760
  }
7755
7761
  };
7756
7762
  var MAX_ATOMS = 7;
@@ -7918,6 +7924,7 @@ function createStore (options, server, setEditor) {
7918
7924
  templates: initTmplsState
7919
7925
  };
7920
7926
  var middleware = [thunk];
7927
+ middleware.push(logger);
7921
7928
  var rootReducer = getRootReducer(setEditor);
7922
7929
  return createStore$1(rootReducer, initState, applyMiddleware.apply(void 0, middleware));
7923
7930
  }
@@ -7976,7 +7983,7 @@ var groupDescriptors = groups.reduce(function (accum, group, index) {
7976
7983
  var rGroupOptions = makeItems(['rgroup-label', 'rgroup-fragment', 'rgroup-attpoints']);
7977
7984
  var shapeOptions = makeItems(['shape-ellipse', 'shape-rectangle', 'shape-line']);
7978
7985
  var transformOptions = makeItems(['transform-rotate', 'transform-flip-h', 'transform-flip-v']);
7979
- var selectOptions$2 = makeItems(['select-lasso', 'select-rectangle', 'select-fragment']);
7986
+ var selectOptions$2 = makeItems(['select-rectangle', 'select-lasso', 'select-fragment']);
7980
7987
  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']);
7981
7988
  var mappingOptions = makeItems(['reaction-map', 'reaction-unmap', 'reaction-automap']);
7982
7989
 
@@ -8791,10 +8798,12 @@ var AtomsList = forwardRef(function (props, ref) {
8791
8798
  children: atoms.map(function (label) {
8792
8799
  var element = Elements.get(label);
8793
8800
  var shortcut = atoms.indexOf(label) > -1 ? shortcutStr(atomCuts[label]) : null;
8801
+ var isSelected = isAtom && active && active.opts.label === label;
8794
8802
  return jsx(StyledAtom, {
8795
8803
  el: element,
8796
8804
  shortcut: shortcut,
8797
- selected: isAtom && active && active.opts.label === label,
8805
+ className: isSelected ? 'selected' : '',
8806
+ selected: isSelected,
8798
8807
  onClick: function onClick() {
8799
8808
  return onAction({
8800
8809
  tool: 'atom',
@@ -9502,6 +9511,7 @@ var TopToolbar = function TopToolbar(_ref) {
9502
9511
  isCollapsed: width < collapseLimit
9503
9512
  }), jsx(SystemControls, {
9504
9513
  onHistoryClick: function onHistoryClick() {
9514
+ console.log('History button clicked');
9505
9515
  },
9506
9516
  onSettingsOpen: onSettingsOpen,
9507
9517
  onFullscreen: onFullscreen,
@@ -12222,6 +12232,7 @@ function sgroupDialog(editor, id, defaultType) {
12222
12232
  var type = sg ? sg.type : defaultType;
12223
12233
  var eventName = type === 'DAT' ? 'sdataEdit' : 'sgroupEdit';
12224
12234
  if (!selection.atoms && !selection.bonds && !sg) {
12235
+ console.info('There is no selection or sgroup');
12225
12236
  return;
12226
12237
  }
12227
12238
  var attrs;
@@ -13052,6 +13063,7 @@ var EraserTool = function () {
13052
13063
  } else if (ci.map === 'texts') {
13053
13064
  this.editor.update(fromTextDeletion(restruct, ci.id));
13054
13065
  } else {
13066
+ console.error('EraserTool: unable to delete the object ' + ci.map + '[' + ci.id + ']');
13055
13067
  return;
13056
13068
  }
13057
13069
  this.editor.selection(null);
@@ -14790,8 +14802,8 @@ var Editor$3 = function () {
14790
14802
  value: function renderAndRecoordinateStruct(struct) {
14791
14803
  var action = fromNewCanvas(this.render.ctab, struct);
14792
14804
  this.update(action);
14793
- getStructCenter(this.render.ctab);
14794
- recoordinate(this);
14805
+ var structCenter = getStructCenter(this.render.ctab);
14806
+ recoordinate(this, structCenter);
14795
14807
  return this.render.ctab.molecule;
14796
14808
  }
14797
14809
  }, {
@@ -14840,8 +14852,8 @@ var Editor$3 = function () {
14840
14852
  }
14841
14853
  this.render.setZoom(value);
14842
14854
  var selection = this.selection();
14843
- getStructCenter(this.render.ctab, selection);
14844
- recoordinate(this);
14855
+ var structCenter = getStructCenter(this.render.ctab, selection);
14856
+ recoordinate(this, structCenter);
14845
14857
  this.render.update();
14846
14858
  return this.render.options.zoom;
14847
14859
  }
@@ -15079,6 +15091,7 @@ function domEventSetup(editor, clientArea) {
15079
15091
  }
15080
15092
  function recoordinate(editor, rp
15081
15093
  ) {
15094
+ console.assert(rp, 'Reference point not specified');
15082
15095
  editor.render.setScrollOffset(0, 0);
15083
15096
  }
15084
15097
  function getStructCenter(ReStruct, selection) {
@@ -16096,6 +16109,7 @@ function greekify(str) {
16096
16109
  });
16097
16110
  }
16098
16111
  function filterLib(lib, filter$1) {
16112
+ console.warn('Filter', filter$1);
16099
16113
  var re = new RegExp(escapeRegExp(greekify(filter$1)), 'i');
16100
16114
  return flow(filter(function (item) {
16101
16115
  return !filter$1 || re.test(greekify(item.struct.name)) || re.test(greekify(item.props.group));
@@ -16105,6 +16119,7 @@ function filterLib(lib, filter$1) {
16105
16119
  }, {}))(lib);
16106
16120
  }
16107
16121
  function filterFGLib(lib, filter$1) {
16122
+ console.warn('Filter', filter$1);
16108
16123
  var re = new RegExp(escapeRegExp(greekify(filter$1)), 'i');
16109
16124
  return flow(filter(function (item) {
16110
16125
  return !filter$1 || re.test(greekify(item.struct.name));
@@ -17153,6 +17168,7 @@ var mapDispatchToProps$b = function mapDispatchToProps(dispatch, ownProps) {
17153
17168
  result: JSON.parse(newOpts)
17154
17169
  }));
17155
17170
  } catch (ex) {
17171
+ console.info('Bad file');
17156
17172
  }
17157
17173
  },
17158
17174
  onReset: function onReset() {
@@ -17567,6 +17583,7 @@ function renderStruct(el, struct) {
17567
17583
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
17568
17584
  if (el) {
17569
17585
  if (struct) {
17586
+ console.info('render!', el.clientWidth, el.clientWidth);
17570
17587
  struct.initHalfBonds();
17571
17588
  struct.initNeighbors();
17572
17589
  struct.setImplicitHydrogen();
@@ -17930,7 +17947,7 @@ var MiewDialog = function MiewDialog(_ref) {
17930
17947
  }).then(function () {
17931
17948
  return miew.setOptions(miewOpts);
17932
17949
  })["catch"](function (ex) {
17933
- return (void 0);
17950
+ return console.error(ex.message);
17934
17951
  });
17935
17952
  }, [miewOpts, server, struct]);
17936
17953
  var exportCML = useCallback(function () {
@@ -18545,14 +18562,17 @@ var OpenOptions = function OpenOptions(_ref) {
18545
18562
 
18546
18563
  var TextEditor = function TextEditor(_ref) {
18547
18564
  var structStr = _ref.structStr,
18548
- inputHandler = _ref.inputHandler;
18565
+ inputHandler = _ref.inputHandler,
18566
+ _ref$autoFocus = _ref.autoFocus,
18567
+ autoFocus = _ref$autoFocus === void 0 ? false : _ref$autoFocus;
18549
18568
  return jsx(Fragment, {
18550
18569
  children: jsx("textarea", {
18551
18570
  className: classes$l.textareaEditor,
18552
18571
  value: structStr,
18553
18572
  onChange: function onChange(event) {
18554
18573
  return inputHandler(event.target.value);
18555
- }
18574
+ },
18575
+ autoFocus: autoFocus
18556
18576
  })
18557
18577
  });
18558
18578
  };
@@ -18704,7 +18724,8 @@ var Open = function Open(props) {
18704
18724
  errorHandler: errorHandler,
18705
18725
  isRecognizeDisabled: isRecognizeDisabled,
18706
18726
  structStr: structStr,
18707
- inputHandler: setStructStr
18727
+ inputHandler: setStructStr,
18728
+ autoFocus: true
18708
18729
  })
18709
18730
  });
18710
18731
  };
@@ -21746,8 +21767,8 @@ var KetcherBuilder = function () {
21746
21767
  initApp(element, staticResourcesUrl, {
21747
21768
  buttons: buttons || {},
21748
21769
  errorHandler: errorHandler || null,
21749
- version: "2.6.0-rc.3" ,
21750
- buildDate: "2022-10-27T17:46:38" ,
21770
+ version: "2.6.1" ,
21771
+ buildDate: "2022-11-12T14:27:59" ,
21751
21772
  buildNumber: ''
21752
21773
  }, structService, resolve);
21753
21774
  });