ketcher-react 3.5.0-rc.2 → 3.5.0-rc.4

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 (51) hide show
  1. package/dist/Editor.d.ts +1 -1
  2. package/dist/MicromoleculesEditor.d.ts +1 -0
  3. package/dist/cjs/Editor.d.ts +1 -1
  4. package/dist/cjs/MicromoleculesEditor.d.ts +1 -0
  5. package/dist/cjs/components/StructRender/types.d.ts +1 -2
  6. package/dist/cjs/contexts/appContext.d.ts +1 -2
  7. package/dist/cjs/index.js +618 -564
  8. package/dist/cjs/index.js.map +1 -1
  9. package/dist/cjs/{index.modern-ada6f3d0.js → index.modern-2314b276.js} +69 -43
  10. package/dist/cjs/index.modern-2314b276.js.map +1 -0
  11. package/dist/cjs/script/builders/ketcher/ButtonName.d.ts +1 -1
  12. package/dist/cjs/script/builders/ketcher/KetcherBuilder.d.ts +4 -7
  13. package/dist/cjs/script/editor/Editor.d.ts +2 -1
  14. package/dist/cjs/script/editor/tool/arrow/arrow.types.d.ts +1 -4
  15. package/dist/cjs/script/editor/tool/arrow/multitailArrowMoveTool.d.ts +1 -1
  16. package/dist/cjs/script/editor/tool/arrow/reactionArrowMoveTool.d.ts +1 -1
  17. package/dist/cjs/script/index.d.ts +5 -5
  18. package/dist/cjs/script/ui/App/initApp.d.ts +2 -4
  19. package/dist/cjs/script/ui/dialog/template/template-attach.d.ts +2 -0
  20. package/dist/cjs/script/ui/state/hotkeys.d.ts +1 -1
  21. package/dist/cjs/script/ui/views/components/ContextMenu/ContextMenuTrigger.utils.d.ts +2 -2
  22. package/dist/cjs/script/ui/views/components/ContextMenu/contextMenu.types.d.ts +8 -8
  23. package/dist/cjs/script/ui/views/modal/Modal.container.d.ts +2 -2
  24. package/dist/cjs/script/ui/views/modal/Modal.d.ts +2 -2
  25. package/dist/cjs/script/ui/views/modal/modal.types.d.ts +4 -1
  26. package/dist/cjs/script/ui/views/toolbars/toolbar.types.d.ts +1 -1
  27. package/dist/components/StructRender/types.d.ts +1 -2
  28. package/dist/contexts/appContext.d.ts +1 -2
  29. package/dist/index.js +620 -566
  30. package/dist/index.js.map +1 -1
  31. package/dist/{index.modern-87cd317d.js → index.modern-723c68e1.js} +68 -42
  32. package/dist/index.modern-723c68e1.js.map +1 -0
  33. package/dist/script/builders/ketcher/ButtonName.d.ts +1 -1
  34. package/dist/script/builders/ketcher/KetcherBuilder.d.ts +4 -7
  35. package/dist/script/editor/Editor.d.ts +2 -1
  36. package/dist/script/editor/tool/arrow/arrow.types.d.ts +1 -4
  37. package/dist/script/editor/tool/arrow/multitailArrowMoveTool.d.ts +1 -1
  38. package/dist/script/editor/tool/arrow/reactionArrowMoveTool.d.ts +1 -1
  39. package/dist/script/index.d.ts +5 -5
  40. package/dist/script/ui/App/initApp.d.ts +2 -4
  41. package/dist/script/ui/dialog/template/template-attach.d.ts +2 -0
  42. package/dist/script/ui/state/hotkeys.d.ts +1 -1
  43. package/dist/script/ui/views/components/ContextMenu/ContextMenuTrigger.utils.d.ts +2 -2
  44. package/dist/script/ui/views/components/ContextMenu/contextMenu.types.d.ts +8 -8
  45. package/dist/script/ui/views/modal/Modal.container.d.ts +2 -2
  46. package/dist/script/ui/views/modal/Modal.d.ts +2 -2
  47. package/dist/script/ui/views/modal/modal.types.d.ts +4 -1
  48. package/dist/script/ui/views/toolbars/toolbar.types.d.ts +1 -1
  49. package/package.json +1 -1
  50. package/dist/cjs/index.modern-ada6f3d0.js.map +0 -1
  51. package/dist/index.modern-87cd317d.js.map +0 -1
@@ -13,5 +13,5 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  ***************************************************************************/
16
- import { MULTITAIL_ARROW_TOOL_NAME } from 'domain/constants';
16
+ import { MULTITAIL_ARROW_TOOL_NAME } from 'ketcher-core';
17
17
  export declare type ButtonName = 'layout' | 'clean' | 'arom' | 'dearom' | 'cip' | 'check' | 'analyse' | 'recognize' | 'miew' | 'settings' | 'help' | 'about' | 'fullscreen' | 'sgroup' | 'reaction-plus' | 'arrows' | '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' | typeof MULTITAIL_ARROW_TOOL_NAME | 'reaction-mapping-tools' | 'reaction-automap' | 'reaction-map' | 'reaction-unmap' | 'rgroup' | 'rgroup-label' | 'rgroup-fragment' | 'rgroup-attpoints' | 'shape' | 'shape-ellipse' | 'shape-rectangle' | 'shape-line' | 'text' | 'enhanced-stereo';
@@ -21,19 +21,16 @@ import { Root } from 'react-dom/client';
21
21
  import { CustomButton } from './CustomButtons';
22
22
  declare class KetcherBuilder {
23
23
  private structService;
24
- private editor;
25
24
  private serviceMode;
26
25
  private formatterFactory;
27
26
  constructor();
28
- appendApiAsync(structServiceProvider: StructServiceProvider): Promise<void>;
29
- reinitializeApi(structServiceProvider: StructServiceProvider, setStructServiceToStore: (structService: StructService) => void): StructService;
27
+ appendApiAsync(structServiceProvider: StructServiceProvider): StructService;
28
+ reinitializeApi(ketcherId: string, structServiceProvider: StructServiceProvider, setStructServiceToStore: (structService: StructService) => void): StructService;
30
29
  appendServiceMode(mode: ServiceMode): void;
31
- appendUiAsync(element: HTMLDivElement | null, appRoot: Root, staticResourcesUrl: string, errorHandler: (message: string) => void, buttons?: ButtonsConfig, togglerComponent?: JSX.Element, customButtons?: Array<CustomButton>): Promise<{
32
- setKetcher: (ketcher: Ketcher) => void;
33
- ketcherId: string;
30
+ appendUiAsync(prevKetcherId: string, ketcherId: string, element: HTMLDivElement | null, appRoot: Root, staticResourcesUrl: string, errorHandler: (message: string) => void, buttons?: ButtonsConfig, togglerComponent?: JSX.Element, customButtons?: Array<CustomButton>): Promise<{
34
31
  cleanup: ReturnType<typeof initApp> | null;
35
32
  setServer: (structService: StructService) => void;
36
33
  }>;
37
- build(): Ketcher | undefined;
34
+ build(): Ketcher;
38
35
  }
39
36
  export { KetcherBuilder };
@@ -32,6 +32,7 @@ export interface Selection {
32
32
  }
33
33
  declare class Editor implements KetcherEditor {
34
34
  #private;
35
+ ketcherId: string;
35
36
  render: Render;
36
37
  _selection: Selection | null;
37
38
  _tool: Tool | null;
@@ -73,7 +74,7 @@ declare class Editor implements KetcherEditor {
73
74
  serverSettings: {};
74
75
  lastEvent: any;
75
76
  macromoleculeConvertionError: string | null | undefined;
76
- constructor(clientArea: any, options: any, serverSettings: any);
77
+ constructor(ketcherId: any, clientArea: any, options: any, serverSettings: any, prevEditor?: any);
77
78
  isDitrty(): boolean;
78
79
  setOrigin(): void;
79
80
  tool(name?: any, opts?: any): Tool | null;
@@ -1,9 +1,6 @@
1
1
  import { Tool } from '../Tool';
2
- import { Vec2 } from 'domain/entities';
3
- import { Action } from 'application/editor';
2
+ import { Vec2, MultitailArrowReferencePosition, Action, MULTITAIL_ARROW_KEY } from 'ketcher-core';
4
3
  import { ClosestItemWithMap } from '../../shared/closest.types';
5
- import { MultitailArrowReferencePosition } from 'application/render';
6
- import { MULTITAIL_ARROW_KEY } from 'domain/constants';
7
4
  export declare type ArrowAddTool = Required<Pick<Tool, 'mousemove' | 'mouseup' | 'mousedown'>>;
8
5
  export declare type ReactionArrowClosestItem = ClosestItemWithMap<Vec2, 'rxnArrows'>;
9
6
  export declare type MultitailArrowClosestItem = ClosestItemWithMap<MultitailArrowReferencePosition, typeof MULTITAIL_ARROW_KEY>;
@@ -8,5 +8,5 @@ export declare class MultitailArrowMoveTool extends ArrowTool implements ArrowMo
8
8
  closestItem: MultitailArrowClosestItem;
9
9
  };
10
10
  mousemove(event: PointerEvent, dragContext: CommonArrowDragContext<MultitailArrowClosestItem>): Action;
11
- mouseup(event: PointerEvent, dragContext: CommonArrowDragContext<MultitailArrowClosestItem>): any;
11
+ mouseup(event: PointerEvent, dragContext: CommonArrowDragContext<MultitailArrowClosestItem>): Action | null;
12
12
  }
@@ -8,5 +8,5 @@ export declare class ReactionArrowMoveTool extends ArrowTool implements ArrowMov
8
8
  closestItem: ReactionArrowClosestItem;
9
9
  };
10
10
  mousemove(event: PointerEvent, dragContext: CommonArrowDragContext<ReactionArrowClosestItem>): import("ketcher-core").Action;
11
- mouseup(_event: PointerEvent, dragContext: CommonArrowDragContext<ReactionArrowClosestItem>): any;
11
+ mouseup(_event: PointerEvent, dragContext: CommonArrowDragContext<ReactionArrowClosestItem>): import("ketcher-core").Action | null;
12
12
  }
@@ -27,14 +27,14 @@ interface Config {
27
27
  customButtons?: Array<CustomButton>;
28
28
  errorHandler: (message: string) => void;
29
29
  togglerComponent?: JSX.Element;
30
- }
31
- declare function buildKetcherAsync({ element, appRoot, staticResourcesUrl, structServiceProvider, buttons, errorHandler, togglerComponent, customButtons, }: Config): Promise<{
32
- ketcher: import("ketcher-core").Ketcher | undefined;
33
30
  ketcherId: string;
31
+ }
32
+ export type { Config, ButtonsConfig };
33
+ export * from './providers';
34
+ declare function buildKetcherAsync({ element, appRoot, staticResourcesUrl, structServiceProvider, buttons, errorHandler, togglerComponent, customButtons, ketcherId: prevKetcherId, }: Config): Promise<{
35
+ ketcher: import("ketcher-core").Ketcher;
34
36
  cleanup: (() => void) | null;
35
37
  builder: KetcherBuilder;
36
38
  setServer: (structService: import("ketcher-core").StructService) => void;
37
39
  }>;
38
- export type { Config, ButtonsConfig };
39
- export * from './providers';
40
40
  export default buildKetcherAsync;
@@ -14,12 +14,10 @@
14
14
  * limitations under the License.
15
15
  ***************************************************************************/
16
16
  /// <reference types="react" />
17
- import { Ketcher, StructService } from 'ketcher-core';
17
+ import { StructService } from 'ketcher-core';
18
18
  import { Root } from 'react-dom/client';
19
- declare function initApp(element: HTMLDivElement | null, appRoot: Root, staticResourcesUrl: string, options: any, server: StructService, resolve: (args: {
19
+ declare function initApp(prevKetcherId: string, ketcherId: string, element: HTMLDivElement | null, appRoot: Root, staticResourcesUrl: string, options: any, server: StructService, resolve: (args: {
20
20
  editor: any;
21
- setKetcher: (ketcher: Ketcher) => void;
22
- ketcherId: string;
23
21
  setServer: (server: StructService) => void;
24
22
  }) => void, togglerComponent?: JSX.Element): () => void;
25
23
  export { initApp };
@@ -27,6 +27,8 @@ declare class Attach extends Component<any, any, any> {
27
27
  bondid: any;
28
28
  };
29
29
  } | null;
30
+ oldKetcherEditor: import("ketcher-core").Editor;
31
+ componentWillUnmount(): void;
30
32
  checkIsValidName(name: any): boolean;
31
33
  render(): import("react/jsx-runtime").JSX.Element;
32
34
  }
@@ -15,7 +15,7 @@
15
15
  ***************************************************************************/
16
16
  export declare function initKeydownListener(element: any): (dispatch: any, getState: any) => void;
17
17
  export declare function removeKeydownListener(element: any): () => void;
18
- export declare function initClipboard(dispatch: any): {
18
+ export declare function initClipboard(dispatch: any, getState: any): {
19
19
  formats: any[];
20
20
  focused(): boolean;
21
21
  onLegacyCut(): {} | null;
@@ -3,5 +3,5 @@ import Editor, { ClosestItemWithMap } from 'src/script/editor';
3
3
  import { ContextMenuProps, GetIsItemInSelectionArgs } from './contextMenu.types';
4
4
  import { Selection } from '../../../../editor/Editor';
5
5
  export declare const getIsItemInSelection: ({ item, selection, selectedSGroupsIds, selectedFunctionalGroups, }: GetIsItemInSelectionArgs) => boolean;
6
- export declare function getMenuPropsForClosestItem(editor: Editor, closestItem: ClosestItemWithMap): ContextMenuProps | null;
7
- export declare function getMenuPropsForSelection(selection: Selection | null, selectedFunctionalGroups: Map<number, FunctionalGroup>): ContextMenuProps | null;
6
+ export declare function getMenuPropsForClosestItem(editor: Editor, closestItem: ClosestItemWithMap, ketcherId: string): ContextMenuProps | null;
7
+ export declare function getMenuPropsForSelection(selection: Selection | null, selectedFunctionalGroups: Map<number, FunctionalGroup>, ketcherId: string): ContextMenuProps | null;
@@ -12,37 +12,37 @@ export declare enum CONTEXT_MENU_ID {
12
12
  }
13
13
  export declare type ItemData = unknown;
14
14
  interface BaseContextMenuProps {
15
- id: CONTEXT_MENU_ID;
15
+ id: string;
16
16
  }
17
17
  interface WithExtraItems {
18
18
  extraItemsSelected?: boolean;
19
19
  }
20
20
  export interface BondsContextMenuProps extends BaseContextMenuProps, WithExtraItems {
21
- id: CONTEXT_MENU_ID.FOR_BONDS;
21
+ id: string;
22
22
  bondIds: Array<number>;
23
23
  }
24
24
  export interface AtomContextMenuProps extends BaseContextMenuProps, WithExtraItems {
25
- id: CONTEXT_MENU_ID.FOR_ATOMS;
25
+ id: string;
26
26
  atomIds: Array<number>;
27
27
  }
28
28
  export interface RGroupAttachmentPointContextMenuProps extends BaseContextMenuProps, WithExtraItems {
29
- id: CONTEXT_MENU_ID.FOR_R_GROUP_ATTACHMENT_POINT;
29
+ id: string;
30
30
  rgroupAttachmentPoints: Array<number>;
31
31
  atomIds?: AtomContextMenuProps['atomIds'];
32
32
  }
33
33
  export interface SelectionContextMenuProps extends BaseContextMenuProps, Partial<Pick<BondsContextMenuProps, 'bondIds'>>, Partial<Pick<AtomContextMenuProps, 'atomIds'>>, Partial<Pick<RGroupAttachmentPointContextMenuProps, 'rgroupAttachmentPoints'>> {
34
- id: CONTEXT_MENU_ID.FOR_SELECTION;
34
+ id: string;
35
35
  }
36
36
  export interface FunctionalGroupsContextMenuProps extends BaseContextMenuProps {
37
- id: CONTEXT_MENU_ID.FOR_FUNCTIONAL_GROUPS;
37
+ id: string;
38
38
  functionalGroups: FunctionalGroup[];
39
39
  }
40
40
  export interface MacromoleculeContextMenuProps extends BaseContextMenuProps {
41
- id: CONTEXT_MENU_ID.FOR_MACROMOLECULE;
41
+ id: string;
42
42
  functionalGroups: FunctionalGroup[];
43
43
  }
44
44
  export interface MultitailArrowContextMenuProps {
45
- id: CONTEXT_MENU_ID.FOR_MULTITAIL_ARROW;
45
+ id: string;
46
46
  itemId: number;
47
47
  tailId: number | null;
48
48
  }
@@ -14,6 +14,6 @@
14
14
  * limitations under the License.
15
15
  ***************************************************************************/
16
16
  import { Modal, ModalProps } from './Modal';
17
- import { BaseCallProps } from './modal.types';
18
- declare const ModalContainer: import("react-redux").ConnectedComponent<typeof Modal, import("react-redux").Omit<ModalProps & BaseCallProps, "modal" | "onCancel" | "onOk">>;
17
+ import { BaseCallProps, ModalContainerProps } from './modal.types';
18
+ declare const ModalContainer: import("react-redux").ConnectedComponent<typeof Modal, import("react-redux").Omit<ModalProps & BaseCallProps & ModalContainerProps, "modal" | "onCancel" | "onOk"> & ModalContainerProps>;
19
19
  export default ModalContainer;
@@ -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 { BaseCallProps } from './modal.types';
16
+ import { BaseCallProps, ModalContainerProps } from './modal.types';
17
17
  interface ModalProps extends BaseCallProps {
18
18
  modal: {
19
19
  name: string;
@@ -21,7 +21,7 @@ interface ModalProps extends BaseCallProps {
21
21
  prop: any;
22
22
  };
23
23
  }
24
- declare type Props = ModalProps & BaseCallProps;
24
+ declare type Props = ModalProps & BaseCallProps & ModalContainerProps;
25
25
  declare function Modal(props: Props): import("react/jsx-runtime").JSX.Element | null;
26
26
  export type { ModalProps };
27
27
  export { Modal };
@@ -25,4 +25,7 @@ interface BaseCallProps {
25
25
  onCancel: () => void;
26
26
  onOk: (result: any) => void;
27
27
  }
28
- export type { BaseProps, BaseCallProps };
28
+ interface ModalContainerProps {
29
+ ketcherId: string;
30
+ }
31
+ export type { BaseProps, BaseCallProps, ModalContainerProps };
@@ -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 { IMAGE_KEY, MULTITAIL_ARROW_TOOL_NAME } from 'domain/constants';
16
+ import { IMAGE_KEY, MULTITAIL_ARROW_TOOL_NAME } from 'ketcher-core';
17
17
  declare type TopGroup = 'document' | 'edit' | 'zoom' | 'process' | 'meta';
18
18
  declare type LeftGroup = 'hand' | 'select' | 'bond' | 'charge' | 'transform' | 'sgroup' | 'rgroup' | 'shape' | 'text';
19
19
  declare type BottomGroup = 'template-common' | 'template-lib';
@@ -13,8 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  ***************************************************************************/
16
- import { RenderOptions } from 'application/render/render.types';
17
- import { Struct } from 'ketcher-core';
16
+ import { Struct, RenderOptions } from 'ketcher-core';
18
17
  interface CasheOptions {
19
18
  cachePrefix?: string;
20
19
  needCache?: boolean;
@@ -13,11 +13,10 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  ***************************************************************************/
16
- import { Ketcher } from 'ketcher-core';
17
16
  import React from 'react';
18
17
  export interface IAppContext {
19
- getKetcherInstance: () => Ketcher;
20
18
  ketcherId: string;
19
+ prevKetcherId: string;
21
20
  }
22
21
  declare const appContext: React.Context<IAppContext>;
23
22
  export default appContext;