ketcher-react 2.11.0-rc.4 → 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.
Files changed (109) hide show
  1. package/dist/components/Buttons/IconButton/IconButton.d.ts +19 -0
  2. package/dist/{icons → components/Buttons/IconButton}/index.d.ts +1 -1
  3. package/dist/components/Buttons/IconButton/styles.d.ts +24 -0
  4. package/dist/{script/ui/views/toolbars/TopToolbar/IconButton.d.ts → components/Buttons/IconButton/types.d.ts} +10 -6
  5. package/dist/components/Buttons/index.d.ts +16 -0
  6. package/dist/components/Icon/Icon.d.ts +19 -0
  7. package/dist/components/Icon/index.d.ts +19 -0
  8. package/dist/{script/ui/views/toolbars/LeftToolbar/Transform/Transform.d.ts → components/Icon/types.d.ts} +9 -8
  9. package/dist/components/Icon/utils/getIconByName.d.ts +17 -0
  10. package/dist/components/Icon/utils/getIconName.d.ts +17 -0
  11. package/dist/components/Icon/utils/iconNameToIcon.d.ts +209 -0
  12. package/dist/components/index.d.ts +17 -0
  13. package/dist/components/styles/consts.d.ts +46 -0
  14. package/dist/components/styles/index.d.ts +16 -0
  15. package/dist/constants.d.ts +2 -0
  16. package/dist/index.css +1 -1
  17. package/dist/index.css.map +1 -1
  18. package/dist/index.d.ts +1 -0
  19. package/dist/index.js +11755 -7063
  20. package/dist/index.js.map +1 -1
  21. package/dist/index.modern.js +11827 -7142
  22. package/dist/index.modern.js.map +1 -1
  23. package/dist/script/editor/Editor.d.ts +15 -6
  24. package/dist/script/editor/shared/closest.d.ts +3 -3
  25. package/dist/script/editor/shared/utils.d.ts +0 -36
  26. package/dist/script/editor/tool/Tool.d.ts +21 -0
  27. package/dist/script/editor/tool/apoint.d.ts +3 -3
  28. package/dist/script/editor/tool/atom.d.ts +5 -5
  29. package/dist/script/editor/tool/attach.d.ts +4 -4
  30. package/dist/script/editor/tool/bond.d.ts +6 -8
  31. package/dist/script/editor/tool/chain.d.ts +4 -4
  32. package/dist/script/editor/tool/charge.d.ts +4 -4
  33. package/dist/script/editor/tool/enhanced-stereo.d.ts +4 -3
  34. package/dist/script/editor/tool/eraser.d.ts +5 -6
  35. package/dist/script/editor/tool/hand.d.ts +5 -6
  36. package/dist/script/editor/tool/helper/deleteFunctionalGroups.d.ts +2 -0
  37. package/dist/script/editor/tool/helper/filterNotInCollapsedSGroup.d.ts +13 -0
  38. package/dist/script/editor/tool/index.d.ts +17 -47
  39. package/dist/script/editor/tool/paste.d.ts +8 -11
  40. package/dist/script/editor/tool/reactionarrow.d.ts +12 -8
  41. package/dist/script/editor/tool/reactionmap.d.ts +5 -6
  42. package/dist/script/editor/tool/reactionplus.d.ts +4 -4
  43. package/dist/script/editor/tool/reactionunmap.d.ts +3 -3
  44. package/dist/script/editor/tool/rgroupatom.d.ts +3 -3
  45. package/dist/script/editor/tool/rgroupfragment.d.ts +3 -3
  46. package/dist/script/editor/tool/rotate-controller.d.ts +9 -2
  47. package/dist/script/editor/tool/rotate-controller.utils.d.ts +3 -0
  48. package/dist/script/editor/tool/rotate.d.ts +7 -6
  49. package/dist/script/editor/tool/select.d.ts +11 -10
  50. package/dist/script/editor/tool/sgroup.d.ts +4 -4
  51. package/dist/script/editor/tool/simpleobject.d.ts +7 -5
  52. package/dist/script/editor/tool/template.d.ts +19 -21
  53. package/dist/script/editor/tool/text.d.ts +4 -3
  54. package/dist/script/ui/action/index.d.ts +0 -4
  55. package/dist/script/ui/action/tools.d.ts +0 -4
  56. package/dist/script/ui/component/cliparea/cliparea.d.ts +1 -0
  57. package/dist/script/ui/component/view/saveButton.types.d.ts +2 -0
  58. package/dist/script/ui/component/view/saveButton.utils.d.ts +2 -0
  59. package/dist/script/ui/dialog/AbbreviationLookup/AbbreviationLookup.constants.d.ts +4 -0
  60. package/dist/script/ui/dialog/AbbreviationLookup/AbbreviationLookup.container.d.ts +17 -0
  61. package/dist/script/ui/dialog/AbbreviationLookup/AbbreviationLookup.container.test.d.ts +1 -0
  62. package/dist/script/ui/dialog/AbbreviationLookup/AbbreviationLookup.d.ts +22 -0
  63. package/dist/script/ui/dialog/AbbreviationLookup/AbbreviationLookup.test.d.ts +1 -0
  64. package/dist/script/ui/dialog/AbbreviationLookup/AbbreviationLookup.test.utils.d.ts +8 -0
  65. package/dist/script/ui/dialog/AbbreviationLookup/AbbreviationLookup.types.d.ts +37 -0
  66. package/dist/script/ui/dialog/AbbreviationLookup/AbbreviationLookup.utils.d.ts +23 -0
  67. package/dist/script/ui/dialog/AbbreviationLookup/AbbreviationLookup.utils.test.d.ts +16 -0
  68. package/dist/script/ui/dialog/AbbreviationLookup/hooks/useOptions.d.ts +17 -0
  69. package/dist/script/ui/dialog/AbbreviationLookup/hooks/useOptions.test.d.ts +1 -0
  70. package/dist/script/ui/dialog/AbbreviationLookup/index.d.ts +17 -0
  71. package/dist/script/ui/state/abbreviationLookup/abbreviationLookup.types.d.ts +19 -0
  72. package/dist/script/ui/state/abbreviationLookup/index.d.ts +30 -0
  73. package/dist/script/ui/state/abbreviationLookup/index.test.d.ts +1 -0
  74. package/dist/script/ui/{views/toolbars/LeftToolbar/Transform → state/abbreviationLookup/selectors}/index.d.ts +1 -1
  75. package/dist/script/ui/state/abbreviationLookup/selectors/selectors.d.ts +17 -0
  76. package/dist/script/ui/state/common/common.types.d.ts +21 -0
  77. package/dist/script/ui/state/common/index.d.ts +26 -0
  78. package/dist/script/ui/state/common/index.test.d.ts +1 -0
  79. package/dist/script/ui/state/common/selectors/index.d.ts +16 -0
  80. package/dist/script/ui/state/common/selectors/selectors.d.ts +19 -0
  81. package/dist/script/ui/state/constants.d.ts +21 -6
  82. package/dist/script/ui/state/editor/index.d.ts +1 -0
  83. package/dist/script/ui/state/floatingTools/index.d.ts +16 -0
  84. package/dist/script/ui/state/floatingTools/selectors/index.d.ts +5 -0
  85. package/dist/script/ui/state/mouse.d.ts +16 -0
  86. package/dist/script/ui/state/moveSelectedItems.d.ts +5 -0
  87. package/dist/script/ui/state/templates/index.d.ts +38 -23
  88. package/dist/script/ui/state/templates/selectors/index.d.ts +16 -0
  89. package/dist/script/ui/utils/index.d.ts +0 -1
  90. package/dist/script/ui/views/components/ContextMenu/ContextMenuTrigger.utils.d.ts +7 -0
  91. package/dist/script/ui/views/components/StructEditor/StructEditor.d.ts +1 -0
  92. package/dist/script/ui/views/modal/components/Text/TextButton/TextButton.d.ts +2 -1
  93. package/dist/script/ui/views/modal/components/document/Open/components/FileDrop.d.ts +2 -1
  94. package/dist/script/ui/views/modal/components/document/Save/Save.d.ts +1 -1
  95. package/dist/script/ui/views/toolbars/FloatingTools/FloatingTools.container.d.ts +4 -0
  96. package/dist/script/ui/views/toolbars/FloatingTools/FloatingTools.d.ts +20 -0
  97. package/dist/script/ui/views/toolbars/FloatingTools/index.d.ts +1 -0
  98. package/dist/script/ui/views/toolbars/LeftToolbar/leftToolbarOptions.d.ts +1 -2
  99. package/dist/script/ui/views/toolbars/ToolbarGroupItem/ActionButton/ActionButton.d.ts +2 -1
  100. package/dist/script/ui/views/toolbars/ToolbarGroupItem/ToolbarGroupItem.d.ts +1 -1
  101. package/dist/script/ui/views/toolbars/TopToolbar/Divider.d.ts +1 -0
  102. package/dist/script/ui/views/toolbars/TopToolbar/FileControls.d.ts +0 -15
  103. package/dist/script/ui/views/toolbars/TopToolbar/TopToolbarIconButton.d.ts +18 -0
  104. package/dist/script/ui/views/toolbars/index.d.ts +1 -0
  105. package/dist/script/ui/views/toolbars/toolbar.types.d.ts +4 -3
  106. package/package.json +6 -3
  107. package/dist/script/editor/tool/helper/getMergeItems.d.ts +0 -2
  108. package/dist/script/ui/component/view/icon.d.ts +0 -5
  109. package/dist/script/ui/utils/renderStruct.d.ts +0 -9
@@ -19,6 +19,14 @@ import { Highlighter } from './highlighter';
19
19
  import { contextMenuInfo } from '../ui/views/components/ContextMenu/contextMenu.types';
20
20
  import { HoverIcon } from './HoverIcon';
21
21
  import RotateController from './tool/rotate-controller';
22
+ import { Tool } from './tool/Tool';
23
+ export declare type FloatingToolsParams = {
24
+ visible?: boolean;
25
+ rotateHandlePosition?: {
26
+ x: number;
27
+ y: number;
28
+ };
29
+ };
22
30
  export interface Selection {
23
31
  atoms?: Array<number>;
24
32
  bonds?: Array<number>;
@@ -31,7 +39,7 @@ declare class Editor implements KetcherEditor {
31
39
  #private;
32
40
  render: Render;
33
41
  _selection: Selection | null;
34
- _tool: any;
42
+ _tool: Tool | null;
35
43
  historyStack: any;
36
44
  historyPtr: any;
37
45
  errorHandler: ((message: string) => void) | null;
@@ -62,19 +70,20 @@ declare class Editor implements KetcherEditor {
62
70
  showInfo: PipelineSubscription;
63
71
  apiSettings: PipelineSubscription;
64
72
  cursor: Subscription;
73
+ updateFloatingTools: Subscription<FloatingToolsParams>;
65
74
  };
66
75
  lastEvent: any;
67
76
  constructor(clientArea: any, options: any);
68
77
  isDitrty(): boolean;
69
78
  setOrigin(): void;
70
- tool(name?: any, opts?: any): any;
79
+ tool(name?: any, opts?: any): Tool | null;
71
80
  clear(): void;
72
81
  renderAndRecoordinateStruct(struct: Struct): Struct;
73
82
  struct(value?: Struct): Struct;
74
83
  structToAddFragment(value: Struct): Struct;
75
- setOptions(opts: string): any;
76
- options(value?: any): any;
77
- zoom(value?: any): any;
84
+ setOptions(opts: string): false | import("ketcher-core/dist/application/render/render.types").RenderOptions;
85
+ options(value?: any): import("ketcher-core/dist/application/render/render.types").RenderOptions;
86
+ zoom(value?: any): number;
78
87
  selection(ci?: any): Selection | null;
79
88
  hover(ci: any, newTool?: any, event?: PointerEvent): void;
80
89
  update(action: Action | true, ignoreHistory?: boolean, options?: {
@@ -90,7 +99,7 @@ declare class Editor implements KetcherEditor {
90
99
  handler: any;
91
100
  };
92
101
  unsubscribe(eventName: any, subscriber: any): void;
93
- findItem(event: any, maps: any, skip?: any): any;
102
+ findItem(event: any, maps: Array<string> | null, skip?: any): any;
94
103
  findMerge(srcItems: any, maps: any): {
95
104
  atoms: Map<number, number>;
96
105
  bonds: Map<number, number>;
@@ -8,19 +8,19 @@ declare function findClosestAtom(restruct: any, pos: any, skip: any, minDist: an
8
8
  id: never;
9
9
  dist: any;
10
10
  } | null;
11
- declare function findClosestItem(restruct: any, pos: any, maps: any, skip: any, scale: any): any;
11
+ declare function findClosestItem(restruct: any, pos: any, maps: any, skip: any, options: any): any;
12
12
  /**
13
13
  * @param restruct { ReStruct }
14
14
  * @param selected { object }
15
15
  * @param maps { Array<string> }
16
- * @param scale { number }
16
+ * @param options { RenderOption }
17
17
  * @return {{
18
18
  * atoms: Map<number, number>?
19
19
  * bonds: Map<number, number>?
20
20
  * atomToFunctionalGroup: Map<number, number>?
21
21
  * }}
22
22
  */
23
- declare function findCloseMerge(restruct: ReStruct, selected: object, maps: string[] | undefined, scale: number): {
23
+ declare function findCloseMerge(restruct: ReStruct, selected: object, maps: string[] | undefined, options: RenderOption): {
24
24
  atoms: Map<number, number>;
25
25
  bonds: Map<number, number>;
26
26
  atomToFunctionalGroup: Map<number, number> | null;
@@ -3,46 +3,10 @@ declare namespace _default {
3
3
  export { fracAngle };
4
4
  export { calcNewAtomPos };
5
5
  export { degrees };
6
- export { mergeBondsParams };
7
- export { getOnlyNonGroupItems };
8
- export { getNonGroupItemsAndAttachmentPoints };
9
6
  }
10
7
  export default _default;
11
8
  declare function calcAngle(pos0: any, pos1: any): number;
12
9
  import { fracAngle } from "ketcher-core/dist/application/editor";
13
10
  declare function calcNewAtomPos(pos0: any, pos1: any, ctrlKey: any): Vec2;
14
11
  declare function degrees(angle: any): number;
15
- declare function mergeBondsParams(struct1: any, bond1: any, struct2: any, bond2: any): {
16
- merged: boolean;
17
- angle: number;
18
- scale: number;
19
- cross: boolean;
20
- };
21
- /**
22
- * Get all items IDs that do not belong to sgroups
23
- * @param items {{ atoms?: number[]; bonds?: number[] } | null}
24
- * @param struct {Struct}
25
- * @returns {{ atoms: number[], bonds: number[] }}
26
- */
27
- declare function getOnlyNonGroupItems(items: {
28
- atoms?: number[] | undefined;
29
- bonds?: number[] | undefined;
30
- } | null, struct: Struct): {
31
- atoms: number[];
32
- bonds: number[];
33
- };
34
- /**
35
- * Get all items IDs that do not belong to sgroups (except their attachment points)
36
- * @param items {{ atoms?: number[]; bonds?: number[] } | null}
37
- * @param struct {Struct}
38
- * @returns {{ atoms: number[], bonds: number[] }}
39
- */
40
- declare function getNonGroupItemsAndAttachmentPoints(items: {
41
- atoms?: number[] | undefined;
42
- bonds?: number[] | undefined;
43
- } | null, struct: Struct): {
44
- atoms: number[];
45
- bonds: number[];
46
- };
47
12
  import { Vec2 } from "ketcher-core/dist/domain/entities/vec2";
48
- import { Struct } from "ketcher-core/dist/domain/entities/struct";
@@ -0,0 +1,21 @@
1
+ import Editor from '../Editor';
2
+ interface ToolEventHandler {
3
+ click?(event: Event): void;
4
+ dblclick?(event: Event): void;
5
+ mousedown?(event: Event): void;
6
+ mousemove?(event: Event): void;
7
+ mouseup?(event: Event): void;
8
+ mouseleave?(event: Event): void;
9
+ mouseLeaveClientArea?(event: Event): void;
10
+ mouseover?(event: Event): void;
11
+ }
12
+ export interface Tool extends ToolEventHandler {
13
+ cancel?(): void;
14
+ isSelectionRunning?(): boolean;
15
+ isNotActiveTool?: boolean;
16
+ }
17
+ export declare type ToolConstructorInterface = {
18
+ new (editor: Editor, ...args: any[]): Tool;
19
+ };
20
+ export declare type ToolEventHandlerName = keyof ToolEventHandler;
21
+ export {};
@@ -13,9 +13,9 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  ***************************************************************************/
16
- import Editor from '../Editor';
17
- declare class APointTool {
18
- editor: Editor;
16
+ import { Tool } from './Tool';
17
+ declare class APointTool implements Tool {
18
+ private readonly editor;
19
19
  constructor(editor: any);
20
20
  mousemove(event: any): void;
21
21
  click(event: any): true | undefined;
@@ -13,12 +13,12 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  ***************************************************************************/
16
- import Editor from '../Editor';
17
- declare class AtomTool {
16
+ import { Tool } from './Tool';
17
+ declare class AtomTool implements Tool {
18
18
  #private;
19
- editor: Editor;
20
- atomProps: any;
21
- dragCtx: any;
19
+ private readonly editor;
20
+ private readonly atomProps;
21
+ private dragCtx;
22
22
  isNotActiveTool: boolean | undefined;
23
23
  constructor(editor: any, atomProps: any);
24
24
  mousedown(event: any): void;
@@ -13,10 +13,10 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  ***************************************************************************/
16
- import Editor from '../Editor';
17
- declare class AttachTool {
18
- attach: any;
19
- editor: Editor;
16
+ import { Tool } from './Tool';
17
+ declare class AttachTool implements Tool {
18
+ private readonly attach;
19
+ private readonly editor;
20
20
  constructor(editor: any, attachPoints: any);
21
21
  mousemove(event: any): boolean;
22
22
  click(event: any): true | undefined;
@@ -14,14 +14,12 @@
14
14
  * limitations under the License.
15
15
  ***************************************************************************/
16
16
  import { Bond, Struct } from 'ketcher-core';
17
- import Editor from '../Editor';
18
- declare class BondTool {
19
- editor: Editor;
20
- atomProps: {
21
- label: string;
22
- };
23
- bondProps: any;
24
- dragCtx: any;
17
+ import { Tool } from './Tool';
18
+ declare class BondTool implements Tool {
19
+ private readonly editor;
20
+ private readonly atomProps;
21
+ private readonly bondProps;
22
+ private dragCtx;
25
23
  isNotActiveTool: boolean | undefined;
26
24
  constructor(editor: any, bondProps: any);
27
25
  mousedown(event: any): true | undefined;
@@ -13,10 +13,10 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  ***************************************************************************/
16
- import Editor from '../Editor';
17
- declare class ChainTool {
18
- editor: Editor;
19
- dragCtx: any;
16
+ import { Tool } from './Tool';
17
+ declare class ChainTool implements Tool {
18
+ private readonly editor;
19
+ private dragCtx;
20
20
  constructor(editor: any);
21
21
  mousedown(event: any): true | undefined;
22
22
  mousemove(event: any): boolean;
@@ -13,10 +13,10 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  ***************************************************************************/
16
- import Editor from '../Editor';
17
- declare class ChargeTool {
18
- editor: Editor;
19
- charge: any;
16
+ import { Tool } from './Tool';
17
+ declare class ChargeTool implements Tool {
18
+ private readonly editor;
19
+ private readonly charge;
20
20
  constructor(editor: any, charge: any);
21
21
  mousemove(event: any): boolean;
22
22
  click(event: any): true | undefined;
@@ -14,9 +14,10 @@
14
14
  * limitations under the License.
15
15
  ***************************************************************************/
16
16
  import Editor from '../Editor';
17
- declare class EnhancedStereoTool {
18
- editor: Editor;
19
- stereoAtoms: Array<number>;
17
+ import { Tool } from './Tool';
18
+ declare class EnhancedStereoTool implements Tool {
19
+ private readonly editor;
20
+ private readonly stereoAtoms;
20
21
  isNotActiveTool: true;
21
22
  constructor(editor: any);
22
23
  static changeAtomsStereoAction(editor: Editor, stereoAtoms: Array<number>): any;
@@ -13,12 +13,11 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  ***************************************************************************/
16
- import LassoHelper from './helper/lasso';
17
- import Editor from '../Editor';
18
- declare class EraserTool {
19
- editor: Editor;
20
- maps: Array<string>;
21
- lassoHelper: LassoHelper;
16
+ import { Tool } from './Tool';
17
+ declare class EraserTool implements Tool {
18
+ private readonly editor;
19
+ private readonly maps;
20
+ private readonly lassoHelper;
22
21
  isNotActiveTool: boolean | undefined;
23
22
  constructor(editor: any, mode: any);
24
23
  mousedown(event: any): void;
@@ -13,12 +13,11 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  ***************************************************************************/
16
- import Editor from '../Editor';
17
- import { Vec2 } from 'ketcher-core';
18
- declare class HandTool {
19
- editor: Editor;
20
- begPos: Vec2 | null;
21
- endPos: Vec2 | null;
16
+ import { Tool } from './Tool';
17
+ declare class HandTool implements Tool {
18
+ private readonly editor;
19
+ private begPos;
20
+ private endPos;
22
21
  constructor(editor: any);
23
22
  mousedown(event: any): void;
24
23
  mousemove(event: any): void;
@@ -0,0 +1,2 @@
1
+ import { ReStruct, Action } from 'ketcher-core';
2
+ export declare function deleteFunctionalGroups(sGroupsId: number[], struct: ReStruct, action: Action): number[];
@@ -0,0 +1,13 @@
1
+ import { Struct } from 'ketcher-core';
2
+ /**
3
+ * return only such elements ids that not part of collapsed group
4
+ * Addition: if an atom in the contracted SGroup,
5
+ * but is an AttachmentPoint -> will be returned as well.
6
+ */
7
+ export declare function filterNotInContractedSGroup(itemsToFilter: {
8
+ atoms?: number[];
9
+ bonds?: number[];
10
+ }, struct: Struct): {
11
+ atoms: number[];
12
+ bonds: number[];
13
+ };
@@ -1,47 +1,17 @@
1
- export default tools;
2
- declare namespace tools {
3
- export { HandTool as hand };
4
- export { RGroupAtomTool as rgroupatom };
5
- export { SelectTool as select };
6
- export { SGroupTool as sgroup };
7
- export { EraserTool as eraser };
8
- export { AtomTool as atom };
9
- export { BondTool as bond };
10
- export { ChainTool as chain };
11
- export { TemplateTool as template };
12
- export { ChargeTool as charge };
13
- export { RGroupFragmentTool as rgroupfragment };
14
- export { APointTool as apoint };
15
- export { AttachTool as attach };
16
- export { ReactionArrowTool as reactionarrow };
17
- export { ReactionPlusTool as reactionplus };
18
- export { ReactionMapTool as reactionmap };
19
- export { ReactionUnmapTool as reactionunmap };
20
- export { PasteTool as paste };
21
- export { RotateTool as rotate };
22
- export { EnhancedStereoTool as enhancedStereo };
23
- export { SimpleObjectTool as simpleobject };
24
- export { TextTool as text };
25
- }
26
- import HandTool from "./hand";
27
- import RGroupAtomTool from "./rgroupatom";
28
- import SelectTool from "./select";
29
- import SGroupTool from "./sgroup";
30
- import EraserTool from "./eraser";
31
- import AtomTool from "./atom";
32
- import BondTool from "./bond";
33
- import ChainTool from "./chain";
34
- import TemplateTool from "./template";
35
- import ChargeTool from "./charge";
36
- import RGroupFragmentTool from "./rgroupfragment";
37
- import APointTool from "./apoint";
38
- import AttachTool from "./attach";
39
- import ReactionArrowTool from "./reactionarrow";
40
- import ReactionPlusTool from "./reactionplus";
41
- import ReactionMapTool from "./reactionmap";
42
- import ReactionUnmapTool from "./reactionunmap";
43
- import PasteTool from "./paste";
44
- import RotateTool from "./rotate";
45
- import EnhancedStereoTool from "./enhanced-stereo";
46
- import SimpleObjectTool from "./simpleobject";
47
- import TextTool from "./text";
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
+ import { ToolConstructorInterface } from './Tool';
17
+ export declare const toolsMap: Record<string, ToolConstructorInterface>;
@@ -13,17 +13,14 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  ***************************************************************************/
16
- import { Struct } from 'ketcher-core';
17
- import Editor from '../Editor';
18
- declare class PasteTool {
19
- editor: Editor;
20
- struct: Struct;
21
- action: any;
22
- templateAction: any;
23
- dragCtx: any;
24
- findItems: string[];
25
- mergeItems: any;
26
- isSingleContractedGroup: boolean;
16
+ import { Tool } from './Tool';
17
+ declare class PasteTool implements Tool {
18
+ private readonly editor;
19
+ private readonly struct;
20
+ private action;
21
+ private dragCtx;
22
+ private mergeItems;
23
+ private readonly isSingleContractedGroup;
27
24
  constructor(editor: any, struct: any);
28
25
  mousedown(event: any): void;
29
26
  mousemove(event: any): void;
@@ -13,15 +13,19 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  ***************************************************************************/
16
- import Editor from '../Editor';
17
- declare class ReactionArrowTool {
18
- mode: any;
19
- editor: Editor;
20
- dragCtx: any;
16
+ import { Tool } from './Tool';
17
+ declare class ReactionArrowTool implements Tool {
18
+ private readonly mode;
19
+ private readonly editor;
20
+ private dragCtx;
21
21
  constructor(editor: any, mode: any);
22
+ private get render();
23
+ private get reStruct();
22
24
  mousedown(event: any): void;
23
- mousemove(event: any): void;
24
- mouseup(): boolean;
25
- click(event: any): void;
25
+ mousemove(event: PointerEvent): void;
26
+ mouseup(event: any): boolean;
27
+ private addNewArrowWithDragging;
28
+ private addNewArrowWithClicking;
29
+ private updateResizingState;
26
30
  }
27
31
  export default ReactionArrowTool;
@@ -13,12 +13,11 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  ***************************************************************************/
16
- import Editor from '../Editor';
17
- declare class ReactionMapTool {
18
- editor: Editor;
19
- rcs: any;
20
- dragCtx: any;
21
- line: any;
16
+ import { Tool } from './Tool';
17
+ declare class ReactionMapTool implements Tool {
18
+ private readonly editor;
19
+ private dragCtx;
20
+ private line;
22
21
  constructor(editor: any);
23
22
  mousedown(event: any): void;
24
23
  mousemove(event: any): void;
@@ -13,10 +13,10 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  ***************************************************************************/
16
- import Editor from '../Editor';
17
- declare class ReactionPlusTool {
18
- editor: Editor;
19
- dragCtx: any;
16
+ import { Tool } from './Tool';
17
+ declare class ReactionPlusTool implements Tool {
18
+ private readonly editor;
19
+ private dragCtx;
20
20
  constructor(editor: any);
21
21
  mousedown(event: any): void;
22
22
  mousemove(event: any): void;
@@ -13,9 +13,9 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  ***************************************************************************/
16
- import Editor from '../Editor';
17
- declare class ReactionUnmapTool {
18
- editor: Editor;
16
+ import { Tool } from './Tool';
17
+ declare class ReactionUnmapTool implements Tool {
18
+ private readonly editor;
19
19
  constructor(editor: any);
20
20
  mousemove(event: any): void;
21
21
  mouseup(event: any): void;
@@ -13,9 +13,9 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  ***************************************************************************/
16
- import Editor from '../Editor';
17
- declare class RGroupAtomTool {
18
- editor: Editor;
16
+ import { Tool } from './Tool';
17
+ declare class RGroupAtomTool implements Tool {
18
+ private readonly editor;
19
19
  constructor(editor: any);
20
20
  mousemove(event: any): void;
21
21
  click(event: any): true | undefined;
@@ -13,9 +13,9 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  ***************************************************************************/
16
- import Editor from '../Editor';
17
- declare class RGroupFragmentTool {
18
- editor: Editor;
16
+ import { Tool } from './Tool';
17
+ declare class RGroupFragmentTool implements Tool {
18
+ private readonly editor;
19
19
  constructor(editor: any);
20
20
  mousemove(event: any): void;
21
21
  click(event: any): true | undefined;
@@ -1,12 +1,14 @@
1
+ /// <reference types="lodash" />
1
2
  import Editor from '../Editor';
3
+ import { getDifference } from './rotate-controller.utils';
2
4
  declare class RotateController {
5
+ isRotating: boolean;
3
6
  private editor;
4
7
  private rotateTool;
5
8
  private originalCenter;
6
9
  private normalizedCenterInitialHandleVec;
7
10
  private handleCenter;
8
11
  private initialRadius;
9
- private isRotating;
10
12
  private isMovingCenter;
11
13
  private handle?;
12
14
  private boundingRect?;
@@ -21,6 +23,10 @@ declare class RotateController {
21
23
  private get center();
22
24
  rerender(): void;
23
25
  clean(): void;
26
+ /**
27
+ * Revert rotation by pressing "Escape" key
28
+ */
29
+ revert(): void;
24
30
  private isPartOfFragmentSelected;
25
31
  private show;
26
32
  private drawCross;
@@ -41,6 +47,7 @@ declare class RotateController {
41
47
  private dragCrossMove;
42
48
  private dragCrossEnd;
43
49
  private dragCrossEndOUtOfBounding;
50
+ updateFloatingToolsPosition: import("lodash").DebouncedFunc<() => void>;
44
51
  }
45
52
  export default RotateController;
46
- export declare const getDifference: (currentDegree: number, structRotateDegree: number) => number;
53
+ export { getDifference };
@@ -0,0 +1,3 @@
1
+ import { Vec2 } from 'ketcher-core';
2
+ export declare const rotatePoint: (centerPoint: Vec2, startPoint: Vec2, angle: number) => Vec2;
3
+ export declare const getDifference: (currentDegree: number, structRotateDegree: number) => number;
@@ -13,14 +13,15 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  ***************************************************************************/
16
- import { Vec2 } from 'ketcher-core';
16
+ import { FlipDirection, Vec2 } from 'ketcher-core';
17
17
  import Editor from '../Editor';
18
- declare class RotateTool {
19
- editor: Editor;
18
+ import { Tool } from './Tool';
19
+ declare class RotateTool implements Tool {
20
+ private readonly editor;
20
21
  dragCtx: any;
21
- isNotActiveTool: boolean | undefined;
22
- constructor(editor: any, dir: any, isNotActiveTool?: boolean);
23
- mousedown(event: any, handleCenter?: Vec2, center?: Vec2): boolean;
22
+ isNotActiveTool: boolean;
23
+ constructor(editor: Editor, flipDirection?: FlipDirection);
24
+ mousedownHandle(handleCenter: Vec2, center: Vec2): void;
24
25
  /**
25
26
  * @returns `[center, visibleAtoms]`,
26
27
  * `visibleAtoms` = selected atoms
@@ -13,24 +13,25 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  ***************************************************************************/
16
- import { ReSGroup, Atom, Bond } from 'ketcher-core';
16
+ import { Atom, Bond } from 'ketcher-core';
17
17
  import { Editor } from '../Editor';
18
- declare class SelectTool {
18
+ import { Tool } from './Tool';
19
+ declare type SelectMode = 'lasso' | 'fragment' | 'rectangle';
20
+ declare class SelectTool implements Tool {
19
21
  #private;
20
- editor: Editor;
21
- dragCtx: any;
22
- constructor(editor: any, mode: any);
22
+ private readonly editor;
23
+ private dragCtx;
24
+ isMousedDown: boolean;
25
+ constructor(editor: Editor, mode: SelectMode);
23
26
  isSelectionRunning(): boolean;
24
27
  mousedown(event: any): boolean;
25
28
  mousemove(event: any): boolean;
26
29
  mouseup(event: any): void;
27
30
  dblclick(event: any): true | undefined;
28
31
  mouseleave(): void;
29
- selectElementsOnCanvas(elements: {
30
- atoms: number[];
31
- bonds: number[];
32
- }, editor: Editor, event: any): void;
33
- isDraggingStructureOnSaltOrSolvent(dragCtx: any, sgroups: Map<number, ReSGroup>): any;
32
+ private selectElementsOnCanvas;
33
+ private isDraggingStructureOnSaltOrSolvent;
34
+ private updateArrowResizingState;
34
35
  }
35
36
  export declare function selMerge(selection: any, add: any, reversible: boolean): any;
36
37
  export declare function getSelectedAtoms(selection: any, molecule: any): Atom[];
@@ -13,10 +13,10 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  ***************************************************************************/
16
- import Editor from '../Editor';
17
- declare class SGroupTool {
18
- editor: Editor;
19
- lassoHelper: any;
16
+ import { Tool } from './Tool';
17
+ declare class SGroupTool implements Tool {
18
+ private readonly editor;
19
+ private readonly lassoHelper;
20
20
  isNotActiveTool: boolean | undefined;
21
21
  constructor(editor: any);
22
22
  checkSelection(): void;