ketcher-react 2.20.0 → 2.21.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/index.js +31 -122
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +26 -117
- package/dist/index.modern.js.map +1 -1
- package/dist/script/builders/ketcher/KetcherBuilder.d.ts +1 -1
- package/dist/script/index.d.ts +1 -1
- package/package.json +1 -1
- package/dist/script/ui/component/cliparea/clipboardUtils.d.ts +0 -7
package/dist/index.modern.js
CHANGED
|
@@ -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, 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, 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, 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, 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';
|
|
@@ -271,15 +271,6 @@ var debugObj = {
|
|
|
271
271
|
|
|
272
272
|
var classes$R = {"cliparea":"cliparea-module_cliparea__GdPrN"};
|
|
273
273
|
|
|
274
|
-
function isClipboardAPIAvailable() {
|
|
275
|
-
var _navigator, _navigator2;
|
|
276
|
-
return typeof ((_navigator = navigator) === null || _navigator === void 0 || (_navigator = _navigator.clipboard) === null || _navigator === void 0 ? void 0 : _navigator.writeText) === 'function' && typeof ((_navigator2 = navigator) === null || _navigator2 === void 0 || (_navigator2 = _navigator2.clipboard) === null || _navigator2 === void 0 ? void 0 : _navigator2.read) === 'function';
|
|
277
|
-
}
|
|
278
|
-
function notifyCopyCut() {
|
|
279
|
-
var event = new Event('copyOrCutComplete');
|
|
280
|
-
window.dispatchEvent(event);
|
|
281
|
-
}
|
|
282
|
-
|
|
283
274
|
function _createForOfIteratorHelper$f(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$g(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
284
275
|
function _unsupportedIterableToArray$g(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$g(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$g(o, minLen); }
|
|
285
276
|
function _arrayLikeToArray$g(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
@@ -3595,7 +3586,7 @@ var zoom = {
|
|
|
3595
3586
|
|
|
3596
3587
|
var openHelpLink = function openHelpLink() {
|
|
3597
3588
|
var _window$open;
|
|
3598
|
-
return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.
|
|
3589
|
+
return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.21.0-rc.2\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
|
|
3599
3590
|
};
|
|
3600
3591
|
var help = {
|
|
3601
3592
|
help: {
|
|
@@ -18978,92 +18969,6 @@ function initClipboard(dispatch) {
|
|
|
18978
18969
|
}
|
|
18979
18970
|
};
|
|
18980
18971
|
}
|
|
18981
|
-
function safelyGetMimeType(_x, _x2) {
|
|
18982
|
-
return _safelyGetMimeType.apply(this, arguments);
|
|
18983
|
-
}
|
|
18984
|
-
function _safelyGetMimeType() {
|
|
18985
|
-
_safelyGetMimeType = _asyncToGenerator( _regeneratorRuntime.mark(function _callee7(clipboardItem, mimeType) {
|
|
18986
|
-
var result;
|
|
18987
|
-
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
18988
|
-
while (1) switch (_context7.prev = _context7.next) {
|
|
18989
|
-
case 0:
|
|
18990
|
-
_context7.prev = 0;
|
|
18991
|
-
_context7.next = 3;
|
|
18992
|
-
return clipboardItem.getType(mimeType);
|
|
18993
|
-
case 3:
|
|
18994
|
-
result = _context7.sent;
|
|
18995
|
-
return _context7.abrupt("return", result);
|
|
18996
|
-
case 7:
|
|
18997
|
-
_context7.prev = 7;
|
|
18998
|
-
_context7.t0 = _context7["catch"](0);
|
|
18999
|
-
return _context7.abrupt("return", '');
|
|
19000
|
-
case 10:
|
|
19001
|
-
case "end":
|
|
19002
|
-
return _context7.stop();
|
|
19003
|
-
}
|
|
19004
|
-
}, _callee7, null, [[0, 7]]);
|
|
19005
|
-
}));
|
|
19006
|
-
return _safelyGetMimeType.apply(this, arguments);
|
|
19007
|
-
}
|
|
19008
|
-
function getStructStringFromClipboardData(_x3) {
|
|
19009
|
-
return _getStructStringFromClipboardData.apply(this, arguments);
|
|
19010
|
-
}
|
|
19011
|
-
function _getStructStringFromClipboardData() {
|
|
19012
|
-
_getStructStringFromClipboardData = _asyncToGenerator( _regeneratorRuntime.mark(function _callee8(data) {
|
|
19013
|
-
var clipboardItem, structStr;
|
|
19014
|
-
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
19015
|
-
while (1) switch (_context8.prev = _context8.next) {
|
|
19016
|
-
case 0:
|
|
19017
|
-
clipboardItem = data[0];
|
|
19018
|
-
if (!(clipboardItem instanceof ClipboardItem)) {
|
|
19019
|
-
_context8.next = 23;
|
|
19020
|
-
break;
|
|
19021
|
-
}
|
|
19022
|
-
_context8.next = 4;
|
|
19023
|
-
return safelyGetMimeType(clipboardItem, "web ".concat(ChemicalMimeType.KET));
|
|
19024
|
-
case 4:
|
|
19025
|
-
_context8.t2 = _context8.sent;
|
|
19026
|
-
if (_context8.t2) {
|
|
19027
|
-
_context8.next = 9;
|
|
19028
|
-
break;
|
|
19029
|
-
}
|
|
19030
|
-
_context8.next = 8;
|
|
19031
|
-
return safelyGetMimeType(clipboardItem, "web ".concat(ChemicalMimeType.Mol));
|
|
19032
|
-
case 8:
|
|
19033
|
-
_context8.t2 = _context8.sent;
|
|
19034
|
-
case 9:
|
|
19035
|
-
_context8.t1 = _context8.t2;
|
|
19036
|
-
if (_context8.t1) {
|
|
19037
|
-
_context8.next = 14;
|
|
19038
|
-
break;
|
|
19039
|
-
}
|
|
19040
|
-
_context8.next = 13;
|
|
19041
|
-
return safelyGetMimeType(clipboardItem, "web ".concat(ChemicalMimeType.Rxn));
|
|
19042
|
-
case 13:
|
|
19043
|
-
_context8.t1 = _context8.sent;
|
|
19044
|
-
case 14:
|
|
19045
|
-
_context8.t0 = _context8.t1;
|
|
19046
|
-
if (_context8.t0) {
|
|
19047
|
-
_context8.next = 19;
|
|
19048
|
-
break;
|
|
19049
|
-
}
|
|
19050
|
-
_context8.next = 18;
|
|
19051
|
-
return safelyGetMimeType(clipboardItem, 'text/plain');
|
|
19052
|
-
case 18:
|
|
19053
|
-
_context8.t0 = _context8.sent;
|
|
19054
|
-
case 19:
|
|
19055
|
-
structStr = _context8.t0;
|
|
19056
|
-
return _context8.abrupt("return", structStr === '' ? '' : structStr.text());
|
|
19057
|
-
case 23:
|
|
19058
|
-
return _context8.abrupt("return", data[ChemicalMimeType.KET] || data[ChemicalMimeType.Mol] || data[ChemicalMimeType.Rxn] || data['text/plain']);
|
|
19059
|
-
case 24:
|
|
19060
|
-
case "end":
|
|
19061
|
-
return _context8.stop();
|
|
19062
|
-
}
|
|
19063
|
-
}, _callee8);
|
|
19064
|
-
}));
|
|
19065
|
-
return _getStructStringFromClipboardData.apply(this, arguments);
|
|
19066
|
-
}
|
|
19067
18972
|
function isAbleToCopy(editor) {
|
|
19068
18973
|
var struct = editor.structSelected();
|
|
19069
18974
|
var errorHandler = editor.errorHandler;
|
|
@@ -19077,49 +18982,49 @@ function isAbleToCopy(editor) {
|
|
|
19077
18982
|
}
|
|
19078
18983
|
return true;
|
|
19079
18984
|
}
|
|
19080
|
-
function clipData(
|
|
18985
|
+
function clipData(_x) {
|
|
19081
18986
|
return _clipData.apply(this, arguments);
|
|
19082
18987
|
}
|
|
19083
18988
|
function _clipData() {
|
|
19084
|
-
_clipData = _asyncToGenerator( _regeneratorRuntime.mark(function
|
|
18989
|
+
_clipData = _asyncToGenerator( _regeneratorRuntime.mark(function _callee7(editor) {
|
|
19085
18990
|
var res, struct, errorHandler, serializer, ket, ketcherInstance, data, type;
|
|
19086
|
-
return _regeneratorRuntime.wrap(function
|
|
19087
|
-
while (1) switch (
|
|
18991
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
18992
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
19088
18993
|
case 0:
|
|
19089
18994
|
if (isAbleToCopy(editor)) {
|
|
19090
|
-
|
|
18995
|
+
_context7.next = 2;
|
|
19091
18996
|
break;
|
|
19092
18997
|
}
|
|
19093
|
-
return
|
|
18998
|
+
return _context7.abrupt("return", null);
|
|
19094
18999
|
case 2:
|
|
19095
19000
|
res = {};
|
|
19096
19001
|
struct = editor.structSelected();
|
|
19097
19002
|
errorHandler = editor.errorHandler;
|
|
19098
|
-
|
|
19003
|
+
_context7.prev = 5;
|
|
19099
19004
|
serializer = new KetSerializer();
|
|
19100
19005
|
ket = serializer.serialize(struct);
|
|
19101
19006
|
ketcherInstance = ketcherProvider.getKetcher();
|
|
19102
|
-
|
|
19007
|
+
_context7.next = 11;
|
|
19103
19008
|
return getStructure(SupportedFormat.molAuto, ketcherInstance.formatterFactory, struct);
|
|
19104
19009
|
case 11:
|
|
19105
|
-
data =
|
|
19010
|
+
data = _context7.sent;
|
|
19106
19011
|
res[ChemicalMimeType.KET] = ket;
|
|
19107
19012
|
type = struct.isReaction ? ChemicalMimeType.Mol : ChemicalMimeType.Rxn;
|
|
19108
19013
|
res['text/plain'] = data;
|
|
19109
19014
|
res[type] = data;
|
|
19110
|
-
return
|
|
19015
|
+
return _context7.abrupt("return", res);
|
|
19111
19016
|
case 19:
|
|
19112
|
-
|
|
19113
|
-
|
|
19114
|
-
KetcherLogger.error('hotkeys.ts::clipData',
|
|
19115
|
-
errorHandler && errorHandler(
|
|
19017
|
+
_context7.prev = 19;
|
|
19018
|
+
_context7.t0 = _context7["catch"](5);
|
|
19019
|
+
KetcherLogger.error('hotkeys.ts::clipData', _context7.t0);
|
|
19020
|
+
errorHandler && errorHandler(_context7.t0.message);
|
|
19116
19021
|
case 23:
|
|
19117
|
-
return
|
|
19022
|
+
return _context7.abrupt("return", null);
|
|
19118
19023
|
case 24:
|
|
19119
19024
|
case "end":
|
|
19120
|
-
return
|
|
19025
|
+
return _context7.stop();
|
|
19121
19026
|
}
|
|
19122
|
-
},
|
|
19027
|
+
}, _callee7, null, [[5, 19]]);
|
|
19123
19028
|
}));
|
|
19124
19029
|
return _clipData.apply(this, arguments);
|
|
19125
19030
|
}
|
|
@@ -32854,8 +32759,8 @@ var KetcherBuilder = function () {
|
|
|
32854
32759
|
initApp(element, appRoot, staticResourcesUrl, {
|
|
32855
32760
|
buttons: buttons || {},
|
|
32856
32761
|
errorHandler: errorHandler || null,
|
|
32857
|
-
version: "2.
|
|
32858
|
-
buildDate: "2024-
|
|
32762
|
+
version: "2.21.0-rc.2" ,
|
|
32763
|
+
buildDate: "2024-05-07T11:51:00" ,
|
|
32859
32764
|
buildNumber: ''
|
|
32860
32765
|
}, structService, resolve, togglerComponent);
|
|
32861
32766
|
});
|
|
@@ -32890,6 +32795,10 @@ var KetcherBuilder = function () {
|
|
|
32890
32795
|
}
|
|
32891
32796
|
var ketcher = new Ketcher(this.editor, this.structService, this.formatterFactory);
|
|
32892
32797
|
ketcher[this.serviceMode] = true;
|
|
32798
|
+
var userInput = document.location.search;
|
|
32799
|
+
if (userInput === '__proto__' || userInput === 'constructor' || userInput === 'prototype') {
|
|
32800
|
+
return;
|
|
32801
|
+
}
|
|
32893
32802
|
var params = new URLSearchParams(document.location.search);
|
|
32894
32803
|
var initialMol = params.get('moll');
|
|
32895
32804
|
if (initialMol) {
|
|
@@ -32954,7 +32863,7 @@ function Editor(props) {
|
|
|
32954
32863
|
element: rootElRef.current,
|
|
32955
32864
|
appRoot: appRoot
|
|
32956
32865
|
})).then(function (ketcher) {
|
|
32957
|
-
if (typeof onInit === 'function') {
|
|
32866
|
+
if (typeof onInit === 'function' && ketcher) {
|
|
32958
32867
|
onInit(ketcher);
|
|
32959
32868
|
window.dispatchEvent(ketcherInitEvent);
|
|
32960
32869
|
}
|