ketcher-react 2.25.0-rc.4 → 2.26.0-rc.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.
Files changed (49) hide show
  1. package/dist/components/Buttons/IconButton/IconButton.d.ts +1 -2
  2. package/dist/components/Buttons/IconButton/IconButtonBase.d.ts +17 -0
  3. package/dist/components/Buttons/IconButton/IconButtonCustomIcon.d.ts +17 -0
  4. package/dist/components/Buttons/IconButton/index.d.ts +1 -0
  5. package/dist/components/Buttons/IconButton/styles.d.ts +4 -0
  6. package/dist/components/Buttons/IconButton/types.d.ts +11 -3
  7. package/dist/components/Icon/utils/iconNameToIcon.d.ts +7 -1
  8. package/dist/constants.d.ts +20 -0
  9. package/dist/index.css +1 -1
  10. package/dist/index.css.map +1 -1
  11. package/dist/index.js +2007 -1369
  12. package/dist/index.js.map +1 -1
  13. package/dist/index.modern.js +2006 -1370
  14. package/dist/index.modern.js.map +1 -1
  15. package/dist/script/builders/ketcher/CustomButtons.d.ts +5 -0
  16. package/dist/script/builders/ketcher/KetcherBuilder.d.ts +2 -1
  17. package/dist/script/editor/Editor.d.ts +1 -0
  18. package/dist/script/editor/tool/helper/dropAndMerge.d.ts +1 -1
  19. package/dist/script/editor/tool/select/index.d.ts +7 -0
  20. package/dist/script/editor/tool/{select.d.ts → select/select.d.ts} +7 -12
  21. package/dist/script/editor/tool/select/select.helpers.d.ts +17 -0
  22. package/dist/script/editor/tool/select/select.types.d.ts +1 -0
  23. package/dist/script/editor/tool/select/selectViewOnly.d.ts +14 -0
  24. package/dist/script/index.d.ts +3 -1
  25. package/dist/script/ui/action/action.types.d.ts +5 -4
  26. package/dist/script/ui/action/createCopyOfSelected.d.ts +14 -0
  27. package/dist/script/ui/action/fullscreen.d.ts +1 -0
  28. package/dist/script/ui/action/help.d.ts +1 -0
  29. package/dist/script/ui/action/highlightColors/HighlightColors.d.ts +6 -0
  30. package/dist/script/ui/action/highlightColors/style.d.ts +25 -0
  31. package/dist/script/ui/action/index.d.ts +19 -705
  32. package/dist/script/ui/action/server.d.ts +3 -0
  33. package/dist/script/ui/action/tools.d.ts +3 -0
  34. package/dist/script/ui/action/zoom.d.ts +4 -0
  35. package/dist/script/ui/state/options/index.d.ts +38 -2
  36. package/dist/script/ui/views/components/ContextMenu/contextMenu.types.d.ts +7 -2
  37. package/dist/script/ui/views/components/ContextMenu/hooks/useChangeBondDirection.d.ts +3 -0
  38. package/dist/script/ui/views/components/ContextMenu/hooks/useMonomerExpansionHandlers.d.ts +4 -0
  39. package/dist/script/ui/views/components/ContextMenu/menuItems/MacromoleculeMenuItems.d.ts +3 -0
  40. package/dist/script/ui/views/modal/components/meta/Settings/Settings.d.ts +1 -0
  41. package/dist/script/ui/views/modal/components/meta/Settings/fieldGroups.d.ts +1 -1
  42. package/dist/script/ui/views/toolbars/BottomToolbar/TemplatesList/TemplatesList.d.ts +2 -1
  43. package/dist/script/ui/views/toolbars/RightToolbar/AtomsList/AtomsList.d.ts +2 -1
  44. package/dist/script/ui/views/toolbars/ToolbarGroupItem/ToolbarGroupItem.d.ts +2 -4
  45. package/dist/script/ui/views/toolbars/TopToolbar/CustomButtons.d.ts +8 -0
  46. package/dist/script/ui/views/toolbars/TopToolbar/TopToolbar.container.d.ts +1 -1
  47. package/dist/script/ui/views/toolbars/TopToolbar/TopToolbar.d.ts +3 -1
  48. package/dist/script/ui/views/toolbars/TopToolbar/TopToolbarIconButton.d.ts +3 -0
  49. package/package.json +1 -1
@@ -0,0 +1,5 @@
1
+ export interface CustomButton {
2
+ id: string;
3
+ imageLink: string;
4
+ title: string;
5
+ }
@@ -18,6 +18,7 @@ import { Ketcher, ServiceMode, StructService, StructServiceProvider } from 'ketc
18
18
  import { ButtonsConfig } from './ButtonsConfig';
19
19
  import { initApp } from '../../ui';
20
20
  import { Root } from 'react-dom/client';
21
+ import { CustomButton } from './CustomButtons';
21
22
  declare class KetcherBuilder {
22
23
  private structService;
23
24
  private editor;
@@ -27,7 +28,7 @@ declare class KetcherBuilder {
27
28
  appendApiAsync(structServiceProvider: StructServiceProvider): Promise<void>;
28
29
  reinitializeApi(structServiceProvider: StructServiceProvider, setStructServiceToStore: (structService: StructService) => void): StructService;
29
30
  appendServiceMode(mode: ServiceMode): void;
30
- appendUiAsync(element: HTMLDivElement | null, appRoot: Root, staticResourcesUrl: string, errorHandler: (message: string) => void, buttons?: ButtonsConfig, togglerComponent?: JSX.Element): Promise<{
31
+ appendUiAsync(element: HTMLDivElement | null, appRoot: Root, staticResourcesUrl: string, errorHandler: (message: string) => void, buttons?: ButtonsConfig, togglerComponent?: JSX.Element, customButtons?: Array<CustomButton>): Promise<{
31
32
  setKetcher: (ketcher: Ketcher) => void;
32
33
  ketcherId: string;
33
34
  cleanup: ReturnType<typeof initApp> | null;
@@ -81,6 +81,7 @@ declare class Editor implements KetcherEditor {
81
81
  structToAddFragment(value: Struct): Struct;
82
82
  setOptions(opts: string): false | import("ketcher-core").RenderOptions;
83
83
  options(value?: any): import("ketcher-core").RenderOptions;
84
+ private updateToolAfterOptionsChange;
84
85
  zoom(value?: any, event?: WheelEvent): number;
85
86
  centerStruct(): void;
86
87
  zoomAccordingContent(struct: Struct): void;
@@ -1,3 +1,3 @@
1
1
  import { Action } from 'ketcher-core';
2
2
  import Editor from '../../Editor';
3
- export declare function dropAndMerge(editor: Editor, mergeItems: any, action?: Action): Action;
3
+ export declare function dropAndMerge(editor: Editor, mergeItems: any, action?: Action, copyAction?: Action): Action;
@@ -0,0 +1,7 @@
1
+ import { Tool } from '../Tool';
2
+ import { Editor } from '../../Editor';
3
+ import { SelectMode } from './select.types';
4
+ export * from './select.helpers';
5
+ export declare class SelectCommonTool implements Tool {
6
+ constructor(editor: Editor, mode: SelectMode);
7
+ }
@@ -13,35 +13,30 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  ***************************************************************************/
16
- import { Atom, Bond } from 'ketcher-core';
17
- import { Editor } from '../Editor';
18
- import { Tool } from './Tool';
19
- declare type SelectMode = 'lasso' | 'fragment' | 'rectangle';
16
+ import { Editor } from '../../Editor';
17
+ import { Tool } from '../Tool';
18
+ import { SelectMode } from './select.types';
20
19
  declare class SelectTool implements Tool {
21
20
  #private;
22
21
  private readonly editor;
23
22
  private dragCtx;
24
23
  private previousMouseMoveEvent?;
25
24
  isMouseDown: boolean;
25
+ isReadyForCopy: boolean;
26
+ isCopied: boolean;
26
27
  readonly isMoving = false;
27
28
  private multitailArrowMoveTool;
28
29
  private reactionArrowMoveTool;
29
30
  constructor(editor: Editor, mode: SelectMode);
30
31
  isSelectionRunning(): boolean;
31
- mousedown(event: PointerEvent): true | undefined;
32
- mousemove(event: PointerEvent): boolean;
32
+ mousedown(event: PointerEvent): boolean;
33
+ mousemove(event: PointerEvent): true | undefined;
33
34
  mouseup(event: PointerEvent): void;
34
35
  dblclick(event: any): true | undefined;
35
36
  mouseleave(): void;
36
- private selectElementsOnCanvas;
37
37
  private isDraggingStructureOnSaltOrSolvent;
38
38
  private isCloseToEdgeOfCanvas;
39
39
  private handleMoveCloseToEdgeOfCanvas;
40
40
  private moveViewBox;
41
41
  }
42
- export declare function selMerge(selection: any, add: any, reversible: boolean): any;
43
- export declare function getSelectedAtoms(selection: any, molecule: any): Atom[];
44
- export declare function getSelectedBonds(selection: any, molecule: any): Bond[];
45
- export declare function mapAtomIdsToAtoms(atomsIds: number[], molecule: any): Atom[];
46
- export declare function mapBondIdsToBonds(bondsIds: number[], molecule: any): Bond[];
47
42
  export default SelectTool;
@@ -0,0 +1,17 @@
1
+ import { Atom, Bond } from 'ketcher-core';
2
+ import Editor from '../../Editor';
3
+ import LassoHelper from '../helper/lasso';
4
+ export declare function selMerge(selection: any, add: any, reversible: boolean): any;
5
+ export declare function getSelectedAtoms(selection: any, molecule: any): Atom[];
6
+ export declare function getSelectedBonds(selection: any, molecule: any): Bond[];
7
+ export declare function mapAtomIdsToAtoms(atomsIds: number[], molecule: any): Atom[];
8
+ export declare function mapBondIdsToBonds(bondsIds: number[], molecule: any): Bond[];
9
+ export declare function getNewSelectedItems(editor: Editor, selectedSgroups: number[]): Record<"atoms" | "bonds", number[]>;
10
+ export declare function selectElementsOnCanvas(elements: {
11
+ atoms: number[];
12
+ bonds: number[];
13
+ }, editor: Editor, lassoHelper: LassoHelper, event: PointerEvent): void;
14
+ export declare function onSelectionStart(event: PointerEvent, editor: Editor, lassoHelper: LassoHelper): void;
15
+ export declare function onSelectionMove(event: PointerEvent, editor: Editor, lassoHelper: LassoHelper): boolean;
16
+ export declare function onSelectionEnd(event: PointerEvent, editor: Editor, lassoHelper: LassoHelper): void;
17
+ export declare function onSelectionLeave(editor: Editor, lassoHelper: LassoHelper): void;
@@ -0,0 +1 @@
1
+ export declare type SelectMode = 'lasso' | 'fragment' | 'rectangle';
@@ -0,0 +1,14 @@
1
+ import { Tool } from '../Tool';
2
+ import Editor from '../../Editor';
3
+ import { SelectMode } from './select.types';
4
+ export declare class SelectViewOnlyTool implements Tool {
5
+ private readonly editor;
6
+ private mode;
7
+ private readonly lassoHelper;
8
+ constructor(editor: Editor, mode: SelectMode);
9
+ isSelectionRunning(): boolean;
10
+ mousedown(event: PointerEvent): void;
11
+ mousemove(event: PointerEvent): void;
12
+ mouseup(event: PointerEvent): void;
13
+ mouseleave(): void;
14
+ }
@@ -17,16 +17,18 @@
17
17
  import { Root } from 'react-dom/client';
18
18
  import { ButtonsConfig, KetcherBuilder } from './builders';
19
19
  import { StructServiceProvider } from 'ketcher-core';
20
+ import { CustomButton } from './builders/ketcher/CustomButtons';
20
21
  interface Config {
21
22
  element: HTMLDivElement | null;
22
23
  appRoot: Root;
23
24
  staticResourcesUrl: string;
24
25
  structServiceProvider: StructServiceProvider;
25
26
  buttons?: ButtonsConfig;
27
+ customButtons?: Array<CustomButton>;
26
28
  errorHandler: (message: string) => void;
27
29
  togglerComponent?: JSX.Element;
28
30
  }
29
- declare function buildKetcherAsync({ element, appRoot, staticResourcesUrl, structServiceProvider, buttons, errorHandler, togglerComponent, }: Config): Promise<{
31
+ declare function buildKetcherAsync({ element, appRoot, staticResourcesUrl, structServiceProvider, buttons, errorHandler, togglerComponent, customButtons, }: Config): Promise<{
30
32
  ketcher: import("ketcher-core").Ketcher | undefined;
31
33
  ketcherId: string;
32
34
  cleanup: (() => void) | null;
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  ***************************************************************************/
16
16
  import { Dispatch } from 'redux';
17
- declare type ToolVariant = 'about' | 'analyse' | 'arom' | 'atom-props' | 'bond-any' | 'bond-hydrogen' | 'bond-aromatic' | 'bond-crossed' | 'bond-dative' | 'bond-double' | 'bond-doublearomatic' | 'bond-down' | 'bond-props' | 'bond-single' | 'bond-singlearomatic' | 'bond-singledouble' | 'bond-triple' | 'bond-up' | 'bond-updown' | 'chain' | 'charge-minus' | 'charge-plus' | 'check' | 'chiral-flag' | 'cip' | 'clean' | 'copy' | 'copy-image' | 'cut' | 'dearom' | 'dropdown' | 'enhanced-stereo' | 'erase' | 'fullscreen' | 'functional-groups' | 'generic-groups' | 'help' | 'layout' | 'logo' | 'miew' | 'clear' | 'open' | 'paste' | 'period-table' | 'reaction-arrow' | 'reaction-automap' | 'reaction-map' | 'reaction-plus' | 'reaction-unmap' | 'recognize' | 'redo' | 'rgroup-attpoints' | 'rgroup-fragment' | 'rgroup-label' | 'save' | 'select-fragment' | 'select-lasso' | 'select-rectangle' | 'settings' | 'sgroup' | 'template-0' | 'template-1' | 'template-2' | 'template-3' | 'template-4' | 'template-5' | 'template-6' | 'template-7' | 'template-lib' | 'text' | 'transform-flip-h' | 'transform-flip-v' | 'transform-rotate' | 'zoom-in' | 'zoom-out' | 'shape-circle' | 'shape-rectangle' | 'shape-polyline' | 'shape-line' | 'undo';
17
+ declare type ToolVariant = 'any-atom' | 'about' | 'analyse' | 'arom' | 'atom-props' | 'bond-any' | 'bond-hydrogen' | 'bond-aromatic' | 'bond-crossed' | 'bond-dative' | 'bond-double' | 'bond-doublearomatic' | 'bond-down' | 'bond-props' | 'bond-single' | 'bond-singlearomatic' | 'bond-singledouble' | 'bond-triple' | 'bond-up' | 'bond-updown' | 'copies' | 'copy-mol' | 'copy-ket' | 'chain' | 'charge-minus' | 'charge-plus' | 'check' | 'chiral-flag' | 'cip' | 'clean' | 'copy' | 'copy-image' | 'cut' | 'dearom' | 'dropdown' | 'deselect-all' | 'enhanced-stereo' | 'erase' | 'extended-table' | 'fullscreen' | 'functional-groups' | 'generic-groups' | 'help' | 'info-modal' | 'layout' | 'logo' | 'miew' | 'clear' | 'open' | 'paste' | 'period-table' | 'reaction-arrow' | 'reaction-automap' | 'reaction-map' | 'reaction-plus' | 'reaction-unmap' | 'recognize' | 'redo' | 'rgroup-attpoints' | 'rgroup-fragment' | 'rgroup-label' | 'save' | 'select-fragment' | 'select-lasso' | 'select-rectangle' | 'select-all' | 'select-descriptors' | 'settings' | 'sgroup' | 'template-0' | 'template-1' | 'template-2' | 'template-3' | 'template-4' | 'template-5' | 'template-6' | 'template-7' | 'template-lib' | 'text' | 'transform-flip-h' | 'transform-flip-v' | 'transform-rotate' | 'zoom-in' | 'zoom-out' | 'shape-circle' | 'shape-rectangle' | 'shape-polyline' | 'shape-line' | 'undo';
18
18
  declare type Editor = any;
19
19
  declare type Server = any;
20
20
  declare type Options = any;
@@ -27,11 +27,12 @@ declare type ActionObj = {
27
27
  };
28
28
  declare type ActionFn = (editor: Editor) => void;
29
29
  declare type UiActionAction = ActionObj | ActionFn;
30
- declare type GetActionState = (editor: Editor, server?: Server, options?: Options) => boolean;
30
+ export declare type GetActionState = (editor: Editor, server?: Server, options?: Options) => boolean;
31
31
  declare type IsActionState = boolean | GetActionState;
32
32
  interface UiAction {
33
33
  title?: string;
34
- shortcut?: string;
34
+ shortcut?: string | Array<string>;
35
+ enabledInViewOnly?: true;
35
36
  action: UiActionAction;
36
37
  selected?: IsActionState;
37
38
  disabled?: IsActionState;
@@ -39,6 +40,6 @@ interface UiAction {
39
40
  onAction?: (action: UiActionAction) => void;
40
41
  }
41
42
  declare type Tools = {
42
- [ket in keyof ToolVariant]?: UiAction;
43
+ [key in ToolVariant]: UiAction;
43
44
  };
44
45
  export type { Tools, UiAction, UiActionAction };
@@ -0,0 +1,14 @@
1
+ import { Editor, Vec2 } from 'ketcher-core';
2
+ export declare const createCopyOfSelected: (editor: Editor, point: Vec2) => {
3
+ action: import("ketcher-core").Action;
4
+ items: {
5
+ atoms: number[];
6
+ bonds: number[];
7
+ rxnArrows: number[];
8
+ rxnPluses: number[];
9
+ texts: number[];
10
+ images: number[];
11
+ simpleObjects: number[];
12
+ multitailArrows: number[];
13
+ };
14
+ };
@@ -16,6 +16,7 @@
16
16
  declare const _default: {
17
17
  fullscreen: {
18
18
  title: string;
19
+ enabledInViewOnly: boolean;
19
20
  action: () => void;
20
21
  hidden: (options: any) => boolean;
21
22
  };
@@ -1,5 +1,6 @@
1
1
  declare namespace _default {
2
2
  namespace help {
3
+ const enabledInViewOnly: boolean;
3
4
  const shortcut: string[];
4
5
  function action(): void | undefined;
5
6
  function hidden(options: any): boolean;
@@ -0,0 +1,6 @@
1
+ import { FC } from 'react';
2
+ interface HighlightMenuProps {
3
+ onHighlight: (color: string) => void;
4
+ }
5
+ declare const HighlightMenu: FC<HighlightMenuProps>;
6
+ export default HighlightMenu;
@@ -0,0 +1,25 @@
1
+ /// <reference types="react" />
2
+ export declare const standardColors: {
3
+ name: string;
4
+ value: string;
5
+ }[];
6
+ export declare const StyledSubmenu: import("@emotion/styled").StyledComponent<import("react-contexify").SubMenuProps & {
7
+ theme?: import("@emotion/react").Theme | undefined;
8
+ }, {}, {}>;
9
+ export declare const ColorContainer: import("@emotion/styled").StyledComponent<{
10
+ theme?: import("@emotion/react").Theme | undefined;
11
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
12
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
13
+ export declare const ColorSquare: import("@emotion/styled").StyledComponent<{
14
+ theme?: import("@emotion/react").Theme | undefined;
15
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
16
+ } & {
17
+ color: string;
18
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
19
+ export declare const ColorItem: import("@emotion/styled").StyledComponent<import("react-contexify").ItemProps & {
20
+ theme?: import("@emotion/react").Theme | undefined;
21
+ }, {}, {}>;
22
+ export declare const Divider: import("@emotion/styled").StyledComponent<{
23
+ theme?: import("@emotion/react").Theme | undefined;
24
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
25
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;