lecom-modeler 0.3.0 → 0.5.0

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/lib/index.d.cts CHANGED
@@ -1,10 +1,7 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
1
  import { Node } from '@xyflow/react';
2
+ import * as react from 'react';
3
3
  import { Ref } from 'react';
4
-
5
- declare const useSelectionUtils: () => {
6
- deselectAll: () => Promise<unknown>;
7
- };
4
+ import * as react_jsx_runtime from 'react/jsx-runtime';
8
5
 
9
6
  declare enum GatewayVariant {
10
7
  EXCLUSIVE = "EXCLUSIVE",
@@ -90,14 +87,33 @@ interface SelectionUtils {
90
87
  isReady: () => boolean;
91
88
  getElement?: (elementId: string) => unknown;
92
89
  }
90
+
91
+ interface ModelerProviderProps extends React.PropsWithChildren {
92
+ locale?: string;
93
+ defaultMode?: EditorMode;
94
+ }
93
95
  interface ModelerProps {
96
+ selectorRef?: Ref<SelectionUtils>;
97
+ instanceId?: string;
94
98
  mode?: EditorMode;
95
- locale?: string;
96
99
  onConfigureElement?: (element: Element) => void;
97
100
  onSubprocessValidationClick?: (subprocess: SubProcessElement) => void;
98
- selectorRef?: Ref<SelectionUtils>;
99
101
  }
100
102
 
101
- declare const Modeler: (props: ModelerProps) => react_jsx_runtime.JSX.Element;
103
+ declare const useSelectionUtils: () => {
104
+ deselectAll: () => Promise<unknown>;
105
+ };
106
+
107
+ declare const Modeler: ({ selectorRef, instanceId: initialInstanceId, mode: initialMode, onConfigureElement, onSubprocessValidationClick, }: ModelerProps) => react_jsx_runtime.JSX.Element;
108
+
109
+ type ModelerContext = {
110
+ defaultMode?: EditorMode;
111
+ locale?: string;
112
+ importDiagram: (diagram: string, instanceId?: string) => Promise<void>;
113
+ exportDiagram: (instanceId?: string) => string;
114
+ };
115
+ declare const ModelerContext: react.Context<ModelerContext | null>;
116
+ declare const useModeler: () => ModelerContext;
117
+ declare const ModelerProvider: ({ locale: initialLocale, defaultMode, children, }: ModelerProviderProps) => react_jsx_runtime.JSX.Element;
102
118
 
103
- export { ActivityVariant, ComplexVariant, EditorMode, type Element, ElementType, ExclusiveVariant, GatewayVariant, Modeler, type ModelerProps, type RoutingElement, RoutingVariant, type SelectionUtils, useSelectionUtils };
119
+ export { ActivityVariant, ComplexVariant, EditorMode, type Element, ElementType, ExclusiveVariant, GatewayVariant, Modeler, type ModelerProps, ModelerProvider, type RoutingElement, RoutingVariant, type SelectionUtils, useModeler, useSelectionUtils };
package/lib/index.d.ts CHANGED
@@ -1,10 +1,7 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
1
  import { Node } from '@xyflow/react';
2
+ import * as react from 'react';
3
3
  import { Ref } from 'react';
4
-
5
- declare const useSelectionUtils: () => {
6
- deselectAll: () => Promise<unknown>;
7
- };
4
+ import * as react_jsx_runtime from 'react/jsx-runtime';
8
5
 
9
6
  declare enum GatewayVariant {
10
7
  EXCLUSIVE = "EXCLUSIVE",
@@ -90,14 +87,33 @@ interface SelectionUtils {
90
87
  isReady: () => boolean;
91
88
  getElement?: (elementId: string) => unknown;
92
89
  }
90
+
91
+ interface ModelerProviderProps extends React.PropsWithChildren {
92
+ locale?: string;
93
+ defaultMode?: EditorMode;
94
+ }
93
95
  interface ModelerProps {
96
+ selectorRef?: Ref<SelectionUtils>;
97
+ instanceId?: string;
94
98
  mode?: EditorMode;
95
- locale?: string;
96
99
  onConfigureElement?: (element: Element) => void;
97
100
  onSubprocessValidationClick?: (subprocess: SubProcessElement) => void;
98
- selectorRef?: Ref<SelectionUtils>;
99
101
  }
100
102
 
101
- declare const Modeler: (props: ModelerProps) => react_jsx_runtime.JSX.Element;
103
+ declare const useSelectionUtils: () => {
104
+ deselectAll: () => Promise<unknown>;
105
+ };
106
+
107
+ declare const Modeler: ({ selectorRef, instanceId: initialInstanceId, mode: initialMode, onConfigureElement, onSubprocessValidationClick, }: ModelerProps) => react_jsx_runtime.JSX.Element;
108
+
109
+ type ModelerContext = {
110
+ defaultMode?: EditorMode;
111
+ locale?: string;
112
+ importDiagram: (diagram: string, instanceId?: string) => Promise<void>;
113
+ exportDiagram: (instanceId?: string) => string;
114
+ };
115
+ declare const ModelerContext: react.Context<ModelerContext | null>;
116
+ declare const useModeler: () => ModelerContext;
117
+ declare const ModelerProvider: ({ locale: initialLocale, defaultMode, children, }: ModelerProviderProps) => react_jsx_runtime.JSX.Element;
102
118
 
103
- export { ActivityVariant, ComplexVariant, EditorMode, type Element, ElementType, ExclusiveVariant, GatewayVariant, Modeler, type ModelerProps, type RoutingElement, RoutingVariant, type SelectionUtils, useSelectionUtils };
119
+ export { ActivityVariant, ComplexVariant, EditorMode, type Element, ElementType, ExclusiveVariant, GatewayVariant, Modeler, type ModelerProps, ModelerProvider, type RoutingElement, RoutingVariant, type SelectionUtils, useModeler, useSelectionUtils };