ketcher-react 3.12.0-dev.1 → 3.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.
Files changed (35) hide show
  1. package/dist/cjs/index.css +1 -1
  2. package/dist/cjs/index.css.map +1 -1
  3. package/dist/cjs/index.js +1226 -524
  4. package/dist/cjs/index.js.map +1 -1
  5. package/dist/cjs/{index.modern-b232add2.js → index.modern-0386b391.js} +4 -3
  6. package/dist/cjs/index.modern-0386b391.js.map +1 -0
  7. package/dist/cjs/script/editor/Editor.d.ts +19 -2
  8. package/dist/cjs/script/editor/tool/sgroup.d.ts +17 -0
  9. package/dist/cjs/script/editor/utils/customOnChangeHandler.test.d.ts +16 -0
  10. package/dist/cjs/script/ui/data/schema/sdata-schema.d.ts +1 -1
  11. package/dist/cjs/script/ui/state/functionalGroups/index.d.ts +1 -1
  12. package/dist/cjs/script/ui/state/notifications/index.d.ts +17 -0
  13. package/dist/cjs/script/ui/state/saltsAndSolvents/index.d.ts +1 -1
  14. package/dist/cjs/script/ui/views/components/ContextMenu/hooks/useMarkAs.d.ts +9 -0
  15. package/dist/cjs/script/ui/views/components/MonomerCreationWizard/MonomerCreationWizard.constants.d.ts +2 -0
  16. package/dist/cjs/script/ui/views/components/MonomerCreationWizard/MonomerCreationWizard.types.d.ts +6 -1
  17. package/dist/index.css +1 -1
  18. package/dist/index.css.map +1 -1
  19. package/dist/index.js +1228 -526
  20. package/dist/index.js.map +1 -1
  21. package/dist/{index.modern-06d576e1.js → index.modern-3f8330b9.js} +5 -4
  22. package/dist/index.modern-3f8330b9.js.map +1 -0
  23. package/dist/script/editor/Editor.d.ts +19 -2
  24. package/dist/script/editor/tool/sgroup.d.ts +17 -0
  25. package/dist/script/editor/utils/customOnChangeHandler.test.d.ts +16 -0
  26. package/dist/script/ui/data/schema/sdata-schema.d.ts +1 -1
  27. package/dist/script/ui/state/functionalGroups/index.d.ts +1 -1
  28. package/dist/script/ui/state/notifications/index.d.ts +17 -0
  29. package/dist/script/ui/state/saltsAndSolvents/index.d.ts +1 -1
  30. package/dist/script/ui/views/components/ContextMenu/hooks/useMarkAs.d.ts +9 -0
  31. package/dist/script/ui/views/components/MonomerCreationWizard/MonomerCreationWizard.constants.d.ts +2 -0
  32. package/dist/script/ui/views/components/MonomerCreationWizard/MonomerCreationWizard.types.d.ts +6 -1
  33. package/package.json +1 -1
  34. package/dist/cjs/index.modern-b232add2.js.map +0 -1
  35. package/dist/index.modern-06d576e1.js.map +0 -1
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  ***************************************************************************/
16
- import { Action, Atom, AtomLabel, AttachmentPointName, Editor as KetcherEditor, FloatingToolsParams, IKetMonomerTemplate, MonomerCreationState, MULTITAIL_ARROW_KEY, Render, Struct, KetMonomerClass } from 'ketcher-core';
16
+ import { Action, Atom, AtomLabel, AttachmentPointName, Editor as KetcherEditor, FloatingToolsParams, IKetMonomerTemplate, MonomerCreationState, MULTITAIL_ARROW_KEY, Render, Struct, Vec2, KetMonomerClass, RnaPresetComponentKey } from 'ketcher-core';
17
17
  import { PipelineSubscription, Subscription } from 'subscription';
18
18
  import { Highlighter } from './highlighter';
19
19
  import { ContextMenuInfo } from '../ui/views/components/ContextMenu/contextMenu.types';
@@ -96,6 +96,7 @@ declare class Editor implements KetcherEditor {
96
96
  get monomerCreationState(): MonomerCreationState;
97
97
  private set monomerCreationState(value);
98
98
  setMonomerCreationSelectedType(type: KetMonomerClass | 'rnaPreset' | undefined): void;
99
+ setRnaComponentAtoms(componentKey: RnaPresetComponentKey, atomIds: number[], bondIds: number[]): void;
99
100
  get isMonomerCreationWizardActive(): boolean;
100
101
  private terminalRGroupAtoms;
101
102
  private potentialLeavingAtomsForAutoAssignment;
@@ -116,7 +117,7 @@ declare class Editor implements KetcherEditor {
116
117
  assignConnectionPointAtom(atomId: number, attachmentPointName?: AttachmentPointName, assignedAttachmentPointsByMonomer?: Map<AttachmentPointName, [
117
118
  number,
118
119
  number
119
- ]>, monomerStructure?: Selection, forceAddNewLeavingGroupAtom?: boolean, leavingAtomLabel?: AtomLabel): void;
120
+ ]>, monomerStructure?: Selection, forceAddNewLeavingGroupAtom?: boolean, leavingAtomLabel?: AtomLabel, leavingAtomPosition?: Vec2): void;
120
121
  closeMonomerCreationWizard(restoreOriginalStruct?: boolean): void;
121
122
  saveNewMonomer(data: any): {
122
123
  monomer: import("ketcher-core").Chem | import("ketcher-core").Sugar | import("ketcher-core").Peptide | import("ketcher-core").RNABase | import("ketcher-core").Phosphate;
@@ -132,10 +133,26 @@ declare class Editor implements KetcherEditor {
132
133
  setProblematicAttachmentPoints(problematicPoints: Set<AttachmentPointName>): void;
133
134
  highlightAttachmentPoint(name: AttachmentPointName | null): void;
134
135
  findPotentialLeavingAtoms(attachmentAtomId: number): Atom[];
136
+ private getRnaComponentForAtom;
137
+ private canAssignRnaComponent;
138
+ /**
139
+ * Auto-assigns atoms to RNA preset components when new bonds are added.
140
+ * If one atom belongs to a component and the other doesn't belong to any,
141
+ * the unassigned atom (and the bond) is added to the same component.
142
+ */
143
+ private autoAssignAtomToRnaComponent;
144
+ private updateRnaComponentStructureState;
145
+ /**
146
+ * Adds an atom and bond to an RNA preset component and fires an event
147
+ * so the wizard can update its state.
148
+ */
149
+ private addAtomsAndBondsToRnaComponent;
150
+ private removeAtomsAndBondsFromRnaComponents;
135
151
  private subscribeToChangeEventInMonomerCreationWizard;
136
152
  private unsubscribeFromChangeEventInMonomerCreationWizard;
137
153
  private collectChangesForMonomerCreationStateInvalidation;
138
154
  private invalidateMonomerCreationWizardState;
155
+ setRnaMonomerCreationMode(isActive: boolean): void;
139
156
  selection(ci?: any): Selection | null;
140
157
  hover(ci: {
141
158
  id: number;
@@ -24,6 +24,23 @@ declare class SGroupTool implements Tool {
24
24
  mousedown(event: any): void;
25
25
  mousemove(event: any): void;
26
26
  mouseleave(event: any): void;
27
+ private isContractedFunctionalGroupClicked;
28
+ private processSelectedAtoms;
29
+ private getActualSgroupId;
30
+ private isAtomInContractedGroup;
31
+ private addContractedGroupToSelection;
32
+ private processSelectedBonds;
33
+ private expandFunctionalGroupSelection;
34
+ private expandAtomsToFunctionalGroups;
35
+ private expandBondsToFunctionalGroups;
36
+ private collectFunctionalGroupIds;
37
+ private collectFunctionalGroupIdsFromAtoms;
38
+ private collectFunctionalGroupIdsFromBonds;
39
+ private shouldRemoveSingleFunctionalGroup;
40
+ private determineSelection;
41
+ private handleLassoSelection;
42
+ private handleClickSelection;
43
+ private shouldOpenDialog;
27
44
  mouseup(event: any): void;
28
45
  cancel(): void;
29
46
  static sgroupDialog(editor: Editor, id: number | null): Promise<void>;
@@ -0,0 +1,16 @@
1
+ /****************************************************************************
2
+ * Copyright 2021 EPAM Systems
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ ***************************************************************************/
16
+ export {};
@@ -7,7 +7,7 @@
7
7
  * @param fieldName? { string }
8
8
  * @returns { string }
9
9
  */
10
- export function getSdataDefault(schema: {} | undefined, context: any, fieldName: any): string;
10
+ export function getSdataDefault(schema?: {}, context?: undefined, fieldName?: undefined): string;
11
11
  export namespace sdataCustomSchema {
12
12
  const key: string;
13
13
  const title: string;
@@ -20,7 +20,7 @@ interface FGState {
20
20
  functionalGroupInfo: any;
21
21
  mode: string;
22
22
  }
23
- declare const functionalGroupsReducer: (state: FGState | undefined, { type, payload }: AnyAction) => any;
23
+ declare const functionalGroupsReducer: (state: FGState | undefined, action: AnyAction) => any;
24
24
  export declare const initFGroups: (lib: SdfItem[]) => {
25
25
  type: string;
26
26
  payload: {
@@ -0,0 +1,17 @@
1
+ export declare const initNotificationsState: {
2
+ snackbarNotificationText: string;
3
+ };
4
+ export declare function showSnackbarNotification(text: string): {
5
+ type: string;
6
+ data: string;
7
+ };
8
+ export declare function hideSnackbarNotification(): {
9
+ type: string;
10
+ };
11
+ export declare function selectSnackbarNotificationText(state: any): any;
12
+ declare function notificationsReducer(state: {
13
+ snackbarNotificationText: string;
14
+ } | undefined, action: any): {
15
+ snackbarNotificationText: any;
16
+ };
17
+ export default notificationsReducer;
@@ -19,7 +19,7 @@ interface SaltsAndSolventsState {
19
19
  lib: [];
20
20
  mode: string;
21
21
  }
22
- declare const saltsAndSolventsReducer: (state: SaltsAndSolventsState | undefined, { type, payload }: AnyAction) => any;
22
+ declare const saltsAndSolventsReducer: (state: SaltsAndSolventsState | undefined, action: AnyAction) => any;
23
23
  export declare const initSaltsAndSolvents: (lib: SdfItem[]) => {
24
24
  type: string;
25
25
  payload: {
@@ -0,0 +1,9 @@
1
+ import { SelectionContextMenuProps, ItemEventParams } from '../contextMenu.types';
2
+ import { RnaPresetComponentType } from '../../MonomerCreationWizard/MonomerCreationWizard.constants';
3
+ declare type Params = ItemEventParams<SelectionContextMenuProps>;
4
+ declare const useMarkAs: () => {
5
+ handler: (componentType: RnaPresetComponentType) => (_params: Params) => void;
6
+ isVisible: () => boolean | undefined;
7
+ isDisabled: () => boolean;
8
+ };
9
+ export default useMarkAs;
@@ -4,3 +4,5 @@ export declare const MAX_MODIFICATION_TYPES = 5;
4
4
  export declare const NotificationMessages: WizardNotificationMessageMap;
5
5
  export declare const NotificationTypes: WizardNotificationTypeMap;
6
6
  export declare const MonomerCreationExternalNotificationAction = "MonomerCreationExternalNotification";
7
+ export declare const MonomerCreationMarkAsComponentAction = "MonomerCreationMarkAsComponent";
8
+ export declare type RnaPresetComponentType = 'base' | 'sugar' | 'phosphate';
@@ -19,7 +19,7 @@ export declare type WizardValues = {
19
19
  [key in StringWizardFormFieldId]: string;
20
20
  };
21
21
  export declare type WizardNotificationType = 'info' | 'error' | 'warning';
22
- export declare type WizardNotificationId = 'defaultAttachmentPoints' | 'emptyMandatoryFields' | 'invalidSymbol' | 'symbolExists' | 'editingIsNotAllowed' | 'noAttachmentPoints' | 'incorrectAttachmentPointsOrder' | 'creationSuccessful' | 'incontinuousStructure' | 'notUniqueModificationTypes' | 'modificationTypeExists' | 'notMinimalViableStructure' | 'impureStructure' | 'notUniqueHELMAlias' | 'invalidHELMAlias' | 'invalidRnaPresetStructure' | 'notUniquePresetCode' | 'invalidPresetCode';
22
+ export declare type WizardNotificationId = 'defaultAttachmentPoints' | 'emptyMandatoryFields' | 'invalidSymbol' | 'symbolExists' | 'editingIsNotAllowed' | 'noAttachmentPoints' | 'incorrectAttachmentPointsOrder' | 'creationSuccessful' | 'creationRNASuccessful' | 'incontinuousStructure' | 'notUniqueModificationTypes' | 'modificationTypeExists' | 'notMinimalViableStructure' | 'impureStructure' | 'notUniqueHELMAlias' | 'invalidHELMAlias' | 'invalidRnaPresetStructure' | 'notUniquePresetCode' | 'invalidPresetCode';
23
23
  export declare type WizardNotificationTypeMap = Record<WizardNotificationId, WizardNotificationType>;
24
24
  export declare type WizardNotificationMessageMap = Record<WizardNotificationId, string>;
25
25
  export declare type WizardNotification = {
@@ -84,6 +84,11 @@ export declare type RnaPresetWizardAction = (WizardAction & {
84
84
  type: 'SetRnaPresetComponentStructure';
85
85
  rnaComponentKey: RnaPresetWizardStateFieldId;
86
86
  editor: Editor;
87
+ } | {
88
+ type: 'UpdateRnaPresetComponentStructure';
89
+ rnaComponentKey: RnaPresetWizardComponentStateFieldId;
90
+ atomIds: number[];
91
+ bondIds: number[];
87
92
  } | {
88
93
  type: 'ResetErrors';
89
94
  } | {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ketcher-react",
3
- "version": "3.12.0-dev.1",
3
+ "version": "3.12.0-rc.2",
4
4
  "description": "Web-based molecule sketcher",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "http://lifescience.opensource.epam.com/ketcher",