lecom-modeler 0.6.1 → 0.7.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.
package/lib/index.d.cts CHANGED
@@ -1,114 +1,122 @@
1
- import { Node } from '@xyflow/react';
2
1
  import * as react from 'react';
3
2
  import { Ref } from 'react';
4
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
4
 
5
+ declare enum EditorMode {
6
+ EDIT = "edit",
7
+ READONLY = "readonly"
8
+ }
9
+ interface ModelerSelector {
10
+ clearSelection?: () => Promise<boolean>;
11
+ selectElement?: (elementId: string) => boolean;
12
+ }
13
+
14
+ declare enum NodeType {
15
+ START_EVENT = "START_EVENT",
16
+ END_EVENT = "END_EVENT",
17
+ TASK = "TASK",
18
+ LANE = "LANE",
19
+ GATEWAY = "GATEWAY",
20
+ ANNOTATION = "ANNOTATION",
21
+ UNSUPPORTED = "UNSUPPORTED"
22
+ }
23
+ declare enum NodeVariant {
24
+ SCRIPT = "SCRIPT",
25
+ SUBPROCESS = "SUBPROCESS"
26
+ }
27
+ declare enum NodeAttribute {
28
+ LOOP = "LOOP"
29
+ }
6
30
  declare enum GatewayVariant {
7
31
  EXCLUSIVE = "EXCLUSIVE",
8
32
  PARALLEL = "PARALLEL",
9
33
  COMPLEX = "COMPLEX"
10
34
  }
11
35
 
12
- declare enum EditorMode {
13
- EDIT = "edit",
14
- READONLY = "readonly"
15
- }
16
36
  declare enum ElementType {
17
37
  ACTIVITY = "activity",
18
38
  ROUTING = "routing",
19
39
  GATEWAY = "gateway",
20
40
  SUB_PROCESS = "sub_process"
21
41
  }
22
- declare enum ActivityVariant {
42
+ declare enum ElementPosition {
23
43
  START = "start",
24
44
  END = "end",
25
45
  BETWEEN = "between"
26
46
  }
47
+ interface NodeElement {
48
+ type: NodeType;
49
+ variant?: NodeVariant | GatewayVariant;
50
+ attribute?: NodeAttribute;
51
+ }
52
+ interface BaseElement {
53
+ id: string;
54
+ position?: ElementPosition;
55
+ label?: string;
56
+ sources?: Element[][];
57
+ targets?: Element[][];
58
+ edgeTargets?: Element[];
59
+ node?: NodeElement;
60
+ depth?: number;
61
+ directIncomers?: Element[];
62
+ directOutgoers?: Element[];
63
+ }
64
+ interface ActivityElement extends BaseElement {
65
+ type: ElementType.ACTIVITY;
66
+ }
67
+ interface SubProcessElement extends BaseElement {
68
+ type: ElementType.SUB_PROCESS;
69
+ }
70
+ declare enum GatewayElementVariant {
71
+ SCRIPT = "script",
72
+ LOOP = "loop",
73
+ SCRIPT_LOOP = "script_loop"
74
+ }
75
+ interface GatewayElement extends BaseElement {
76
+ type: ElementType.GATEWAY;
77
+ variant?: GatewayElementVariant;
78
+ }
27
79
  declare enum RoutingVariant {
28
80
  SIMPLE = "simple",
29
81
  LOOP = "loop",
30
82
  SCRIPT = "script",
83
+ SCRIPT_LOOP = "script_loop",
31
84
  COMPLEX = "complex",
32
85
  EXCLUSIVE = "exclusive",
33
86
  PARALLEL = "parallel",
34
87
  FINAL = "final",
35
88
  TO_SUB_PROCESS = "to_sub_process"
36
89
  }
37
- declare enum ComplexVariant {
38
- SCRIPT = "script",
39
- LOOP = "loop",
40
- SCRIPT_LOOP = "script_loop"
41
- }
42
- declare enum ExclusiveVariant {
43
- SCRIPT = "script",
44
- LOOP = "loop",
45
- SCRIPT_LOOP = "script_loop"
46
- }
47
- interface ActivityElement {
48
- id: string;
49
- type: ElementType.ACTIVITY;
50
- variant?: ActivityVariant;
51
- label?: string;
52
- origin?: Element;
53
- targets?: Element[];
54
- edgeTargets?: Element[];
55
- }
56
- interface SubProcessElement {
57
- id: string;
58
- type: ElementType.SUB_PROCESS;
59
- variant?: ActivityVariant;
60
- label?: string;
61
- origin?: Element;
62
- targets?: Element[];
63
- edgeTargets?: Element[];
64
- }
65
- interface RoutingElement {
66
- id: string;
90
+ interface RoutingElement extends BaseElement {
67
91
  type: ElementType.ROUTING;
68
92
  variant?: RoutingVariant;
69
- subVariant?: ComplexVariant | ExclusiveVariant;
70
- label?: string;
71
- origin?: Element;
72
- target?: Node;
73
- }
74
- interface GatewayElement {
75
- id: string;
76
- type: ElementType.GATEWAY;
77
- variant?: GatewayVariant;
78
- label?: string;
79
- subVariant?: ComplexVariant | ExclusiveVariant;
80
- origin?: Element;
81
- targets?: Element[];
82
- }
83
- type Element = ActivityElement | RoutingElement | GatewayElement | SubProcessElement;
84
- interface SelectionUtils {
85
- deselectAll?: () => Promise<unknown>;
86
- selectElement?: (elementId: string) => boolean;
87
- isReady: () => boolean;
88
- getElement?: (elementId: string) => unknown;
93
+ gatewayVariant?: GatewayElementVariant;
94
+ source?: Element;
95
+ target?: Element;
89
96
  }
97
+ type Element = ActivityElement | SubProcessElement | GatewayElement | RoutingElement;
90
98
 
91
99
  interface ModelerProviderProps extends React.PropsWithChildren {
92
100
  locale?: string;
93
101
  defaultMode?: EditorMode;
94
102
  }
95
103
  interface ModelerProps {
96
- selectorRef?: Ref<SelectionUtils>;
104
+ selectorRef?: Ref<ModelerSelector>;
97
105
  instanceId?: string;
98
106
  mode?: EditorMode;
99
107
  onConfigureElement?: (element: Element) => void;
100
108
  onSubprocessValidationClick?: (subprocess: SubProcessElement) => void;
101
109
  }
102
110
 
103
- declare const useSelectionUtils: () => {
104
- deselectAll: () => Promise<unknown>;
105
- };
106
-
107
111
  declare const Modeler: ({ selectorRef, instanceId: initialInstanceId, mode: initialMode, onConfigureElement, onSubprocessValidationClick, }: ModelerProps) => react_jsx_runtime.JSX.Element;
108
112
 
109
113
  type ModelerContext = {
110
114
  defaultMode?: EditorMode;
111
115
  locale?: string;
116
+ selectElements: (elementIds: string[], instanceId?: string) => boolean;
117
+ clearSelection: (instanceId?: string) => Promise<boolean>;
118
+ configureElement: (elementId: string, instanceId?: string) => Element | undefined;
119
+ getConfigureElement: (elementId: string, instanceId?: string) => Element | undefined;
112
120
  importDiagram: (diagram: string, instanceId?: string) => Promise<void>;
113
121
  exportDiagram: (instanceId?: string) => string;
114
122
  };
@@ -116,4 +124,4 @@ declare const ModelerContext: react.Context<ModelerContext | null>;
116
124
  declare const useModeler: () => ModelerContext;
117
125
  declare const ModelerProvider: ({ locale: initialLocale, defaultMode, children, }: ModelerProviderProps) => react_jsx_runtime.JSX.Element;
118
126
 
119
- export { ActivityVariant, ComplexVariant, EditorMode, type Element, ElementType, ExclusiveVariant, GatewayVariant, Modeler, type ModelerProps, ModelerProvider, type RoutingElement, RoutingVariant, type SelectionUtils, useModeler, useSelectionUtils };
127
+ export { type ActivityElement, EditorMode, type Element, ElementPosition, ElementType, type GatewayElement, GatewayElementVariant, GatewayVariant, Modeler, type ModelerProps, ModelerProvider, type ModelerSelector, NodeAttribute, NodeType, NodeVariant, type RoutingElement, RoutingVariant, type SubProcessElement, useModeler };
package/lib/index.d.ts CHANGED
@@ -1,114 +1,122 @@
1
- import { Node } from '@xyflow/react';
2
1
  import * as react from 'react';
3
2
  import { Ref } from 'react';
4
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
4
 
5
+ declare enum EditorMode {
6
+ EDIT = "edit",
7
+ READONLY = "readonly"
8
+ }
9
+ interface ModelerSelector {
10
+ clearSelection?: () => Promise<boolean>;
11
+ selectElement?: (elementId: string) => boolean;
12
+ }
13
+
14
+ declare enum NodeType {
15
+ START_EVENT = "START_EVENT",
16
+ END_EVENT = "END_EVENT",
17
+ TASK = "TASK",
18
+ LANE = "LANE",
19
+ GATEWAY = "GATEWAY",
20
+ ANNOTATION = "ANNOTATION",
21
+ UNSUPPORTED = "UNSUPPORTED"
22
+ }
23
+ declare enum NodeVariant {
24
+ SCRIPT = "SCRIPT",
25
+ SUBPROCESS = "SUBPROCESS"
26
+ }
27
+ declare enum NodeAttribute {
28
+ LOOP = "LOOP"
29
+ }
6
30
  declare enum GatewayVariant {
7
31
  EXCLUSIVE = "EXCLUSIVE",
8
32
  PARALLEL = "PARALLEL",
9
33
  COMPLEX = "COMPLEX"
10
34
  }
11
35
 
12
- declare enum EditorMode {
13
- EDIT = "edit",
14
- READONLY = "readonly"
15
- }
16
36
  declare enum ElementType {
17
37
  ACTIVITY = "activity",
18
38
  ROUTING = "routing",
19
39
  GATEWAY = "gateway",
20
40
  SUB_PROCESS = "sub_process"
21
41
  }
22
- declare enum ActivityVariant {
42
+ declare enum ElementPosition {
23
43
  START = "start",
24
44
  END = "end",
25
45
  BETWEEN = "between"
26
46
  }
47
+ interface NodeElement {
48
+ type: NodeType;
49
+ variant?: NodeVariant | GatewayVariant;
50
+ attribute?: NodeAttribute;
51
+ }
52
+ interface BaseElement {
53
+ id: string;
54
+ position?: ElementPosition;
55
+ label?: string;
56
+ sources?: Element[][];
57
+ targets?: Element[][];
58
+ edgeTargets?: Element[];
59
+ node?: NodeElement;
60
+ depth?: number;
61
+ directIncomers?: Element[];
62
+ directOutgoers?: Element[];
63
+ }
64
+ interface ActivityElement extends BaseElement {
65
+ type: ElementType.ACTIVITY;
66
+ }
67
+ interface SubProcessElement extends BaseElement {
68
+ type: ElementType.SUB_PROCESS;
69
+ }
70
+ declare enum GatewayElementVariant {
71
+ SCRIPT = "script",
72
+ LOOP = "loop",
73
+ SCRIPT_LOOP = "script_loop"
74
+ }
75
+ interface GatewayElement extends BaseElement {
76
+ type: ElementType.GATEWAY;
77
+ variant?: GatewayElementVariant;
78
+ }
27
79
  declare enum RoutingVariant {
28
80
  SIMPLE = "simple",
29
81
  LOOP = "loop",
30
82
  SCRIPT = "script",
83
+ SCRIPT_LOOP = "script_loop",
31
84
  COMPLEX = "complex",
32
85
  EXCLUSIVE = "exclusive",
33
86
  PARALLEL = "parallel",
34
87
  FINAL = "final",
35
88
  TO_SUB_PROCESS = "to_sub_process"
36
89
  }
37
- declare enum ComplexVariant {
38
- SCRIPT = "script",
39
- LOOP = "loop",
40
- SCRIPT_LOOP = "script_loop"
41
- }
42
- declare enum ExclusiveVariant {
43
- SCRIPT = "script",
44
- LOOP = "loop",
45
- SCRIPT_LOOP = "script_loop"
46
- }
47
- interface ActivityElement {
48
- id: string;
49
- type: ElementType.ACTIVITY;
50
- variant?: ActivityVariant;
51
- label?: string;
52
- origin?: Element;
53
- targets?: Element[];
54
- edgeTargets?: Element[];
55
- }
56
- interface SubProcessElement {
57
- id: string;
58
- type: ElementType.SUB_PROCESS;
59
- variant?: ActivityVariant;
60
- label?: string;
61
- origin?: Element;
62
- targets?: Element[];
63
- edgeTargets?: Element[];
64
- }
65
- interface RoutingElement {
66
- id: string;
90
+ interface RoutingElement extends BaseElement {
67
91
  type: ElementType.ROUTING;
68
92
  variant?: RoutingVariant;
69
- subVariant?: ComplexVariant | ExclusiveVariant;
70
- label?: string;
71
- origin?: Element;
72
- target?: Node;
73
- }
74
- interface GatewayElement {
75
- id: string;
76
- type: ElementType.GATEWAY;
77
- variant?: GatewayVariant;
78
- label?: string;
79
- subVariant?: ComplexVariant | ExclusiveVariant;
80
- origin?: Element;
81
- targets?: Element[];
82
- }
83
- type Element = ActivityElement | RoutingElement | GatewayElement | SubProcessElement;
84
- interface SelectionUtils {
85
- deselectAll?: () => Promise<unknown>;
86
- selectElement?: (elementId: string) => boolean;
87
- isReady: () => boolean;
88
- getElement?: (elementId: string) => unknown;
93
+ gatewayVariant?: GatewayElementVariant;
94
+ source?: Element;
95
+ target?: Element;
89
96
  }
97
+ type Element = ActivityElement | SubProcessElement | GatewayElement | RoutingElement;
90
98
 
91
99
  interface ModelerProviderProps extends React.PropsWithChildren {
92
100
  locale?: string;
93
101
  defaultMode?: EditorMode;
94
102
  }
95
103
  interface ModelerProps {
96
- selectorRef?: Ref<SelectionUtils>;
104
+ selectorRef?: Ref<ModelerSelector>;
97
105
  instanceId?: string;
98
106
  mode?: EditorMode;
99
107
  onConfigureElement?: (element: Element) => void;
100
108
  onSubprocessValidationClick?: (subprocess: SubProcessElement) => void;
101
109
  }
102
110
 
103
- declare const useSelectionUtils: () => {
104
- deselectAll: () => Promise<unknown>;
105
- };
106
-
107
111
  declare const Modeler: ({ selectorRef, instanceId: initialInstanceId, mode: initialMode, onConfigureElement, onSubprocessValidationClick, }: ModelerProps) => react_jsx_runtime.JSX.Element;
108
112
 
109
113
  type ModelerContext = {
110
114
  defaultMode?: EditorMode;
111
115
  locale?: string;
116
+ selectElements: (elementIds: string[], instanceId?: string) => boolean;
117
+ clearSelection: (instanceId?: string) => Promise<boolean>;
118
+ configureElement: (elementId: string, instanceId?: string) => Element | undefined;
119
+ getConfigureElement: (elementId: string, instanceId?: string) => Element | undefined;
112
120
  importDiagram: (diagram: string, instanceId?: string) => Promise<void>;
113
121
  exportDiagram: (instanceId?: string) => string;
114
122
  };
@@ -116,4 +124,4 @@ declare const ModelerContext: react.Context<ModelerContext | null>;
116
124
  declare const useModeler: () => ModelerContext;
117
125
  declare const ModelerProvider: ({ locale: initialLocale, defaultMode, children, }: ModelerProviderProps) => react_jsx_runtime.JSX.Element;
118
126
 
119
- export { ActivityVariant, ComplexVariant, EditorMode, type Element, ElementType, ExclusiveVariant, GatewayVariant, Modeler, type ModelerProps, ModelerProvider, type RoutingElement, RoutingVariant, type SelectionUtils, useModeler, useSelectionUtils };
127
+ export { type ActivityElement, EditorMode, type Element, ElementPosition, ElementType, type GatewayElement, GatewayElementVariant, GatewayVariant, Modeler, type ModelerProps, ModelerProvider, type ModelerSelector, NodeAttribute, NodeType, NodeVariant, type RoutingElement, RoutingVariant, type SubProcessElement, useModeler };