@process-analytics/bpmn-visualization-addons 0.8.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/LICENSE +201 -0
- package/README.md +142 -0
- package/lib/bpmn-elements.d.ts +59 -0
- package/lib/bpmn-elements.js +122 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +19 -0
- package/lib/paths.d.ts +54 -0
- package/lib/paths.js +91 -0
- package/lib/plugins/css-classes.d.ts +18 -0
- package/lib/plugins/css-classes.js +48 -0
- package/lib/plugins/elements.d.ts +11 -0
- package/lib/plugins/elements.js +41 -0
- package/lib/plugins/index.d.ts +4 -0
- package/lib/plugins/index.js +19 -0
- package/lib/plugins/overlays.d.ts +13 -0
- package/lib/plugins/overlays.js +66 -0
- package/lib/plugins/style.d.ts +62 -0
- package/lib/plugins/style.js +92 -0
- package/lib/plugins-support.d.ts +53 -0
- package/lib/plugins-support.js +52 -0
- package/package.json +64 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# bpmn-visualization-addons
|
|
2
|
+
|
|
3
|
+
`bpmn-visualization-addons` offers new functionalities to [bpmn-visualization](https://github.com/process-analytics/bpmn-visualization-js) in the form of addons.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## 📌 Usage
|
|
7
|
+
|
|
8
|
+
Install `bpmn-visualization-addons` and [bpmn-visualization](https://github.com/process-analytics/bpmn-visualization-js/):
|
|
9
|
+
```shell
|
|
10
|
+
npm install @process-analytics/bpmn-visualization-addons bpmn-visualization
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
> [!NOTE]
|
|
14
|
+
> Until version 0.7.1, the `bpmn-visualization-addons` package was available under the name `bv-experimental-add-ons`.
|
|
15
|
+
If your application was using the package under its former name, proceed as follows 👇:
|
|
16
|
+
```shell
|
|
17
|
+
# first uninstall the old package
|
|
18
|
+
npm uninstall @process-analytics/bv-experimental-add-ons
|
|
19
|
+
# then install the new package
|
|
20
|
+
npm install @process-analytics/bpmn-visualization-addons
|
|
21
|
+
```
|
|
22
|
+
Then, update the imports in your application code to use the new package name as follows 👇:
|
|
23
|
+
```diff
|
|
24
|
+
- import {BpmnVisualization} from "@process-analytics/bv-experimental-add-ons";
|
|
25
|
+
+ import {BpmnVisualization} from "@process-analytics/bpmn-visualization-addons";
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## 📜 TypeScript Support
|
|
29
|
+
|
|
30
|
+
The `@process-analytics/bpmn-visualization-addons` npm package includes type definitions, so the integration works out of the box in TypeScript projects and applications.
|
|
31
|
+
`bpmn-visualization-addons` requires **TypeScript 4.5** or greater.
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## 🎨 Features
|
|
35
|
+
|
|
36
|
+
### Plugins
|
|
37
|
+
|
|
38
|
+
The plugins infrastructure provides a way to register extension points.
|
|
39
|
+
|
|
40
|
+
> [!IMPORTANT]
|
|
41
|
+
> To be able to register and use the plugins, you need to import `BpmnVisualization` from `bpmn-visualization-addons`, and not from `bpmn-visualization`.
|
|
42
|
+
```diff
|
|
43
|
+
- import {BpmnVisualization} from "bpmn-visualization";
|
|
44
|
+
+ import {BpmnVisualization} from "@process-analytics/bpmn-visualization-addons";
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Example of use:
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
import {BpmnVisualization} from "@process-analytics/bpmn-visualization-addons";
|
|
51
|
+
|
|
52
|
+
const bpmnVisualization = new BpmnVisualization({
|
|
53
|
+
container: 'bpmn-container',
|
|
54
|
+
plugins: [MyPlugin]
|
|
55
|
+
});
|
|
56
|
+
// Retrieve the plugin by id. The id is defined in the plugin implementation
|
|
57
|
+
const myPlugin = bpmnVisualization.getPlugin<MyPlugin>('my-plugin');
|
|
58
|
+
myPlugin.aMethod();
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
#### Available plugins
|
|
62
|
+
|
|
63
|
+
- Plugins providing `BpmnElementsRegistry` methods divided into different categories. This is how `bpmn-visualization` will provide these functionalities
|
|
64
|
+
in the future, in order to better separate responsibilities and improve tree-shaking :
|
|
65
|
+
- `CssClassesPlugin`: all methods for manipulating the CSS classes of BPMN elements.
|
|
66
|
+
- `ElementsPlugin`: all methods for retrieving `BpmnElement` and `BpmnSemantic` objects.
|
|
67
|
+
- `OverlaysPlugin`:
|
|
68
|
+
- provides all `BpmnElementsRegistry` methods relating to overlays.
|
|
69
|
+
- ADDITION: let show/hide overlays created with `BpmnElementsRegistry.addOverlays`.
|
|
70
|
+
- `StylePlugin`: all methods for manipulating the style of BPMN elements.
|
|
71
|
+
- `StyleByNamePlugin`: provides all `BpmnElementsRegistry` methods for manipulating the style of BPMN elements, identifying the BPMN elements by name.
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
#### Writing a custom plugin
|
|
75
|
+
|
|
76
|
+
A plugin is defined as a class:
|
|
77
|
+
- It must implement the `Plugin` interface.
|
|
78
|
+
- Its constructor must satisfy the `PluginConstructor` type.
|
|
79
|
+
- It can implement the `configure` method to configure the plugin after construction.
|
|
80
|
+
- It can provide new methods to extend existing API or introduce new behavior .
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
### `BpmnElementsIdentifier`
|
|
84
|
+
|
|
85
|
+
Convenient tools to know the type/kind of BPMN elements.
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
### `BpmnElementsSearcher`
|
|
89
|
+
|
|
90
|
+
`bpmn-visualization` only provides APIs that take BPMN element ids as parameters.
|
|
91
|
+
However, there are scenario where the ids in the BPMN source/model have been generated and are unknown by the application.
|
|
92
|
+
|
|
93
|
+
Instead, the application knows the name of the elements. `BpmnElementsSearcher` provides a way to retrieve elements given their names.
|
|
94
|
+
|
|
95
|
+
This is useful for example in "Process Discovery" scenario. The elements are identified by name only. Ids may be generated
|
|
96
|
+
and not fully linked with the name of the elements.
|
|
97
|
+
|
|
98
|
+
IMPORTANT: There is no guarantee that names are unique in the BPMN source. In case that there are several matches, `BpmnElementsSearcher` may do filtering (see below).
|
|
99
|
+
|
|
100
|
+
#### Retrieving `ids`
|
|
101
|
+
|
|
102
|
+
Once you get the ids of elements related to their names, you can then call regular `bpmn-visualization` API by passing the resulting ids.
|
|
103
|
+
|
|
104
|
+
Limitations
|
|
105
|
+
- If there are several matching names, `BpmnElementsSearcher` returns the first matching identifier.
|
|
106
|
+
|
|
107
|
+
#### Retrieving the whole `BpmnSemantic`
|
|
108
|
+
|
|
109
|
+
`BpmnElementsSearcher` also provides a method to retrieve the whole BpmnSemantic objects.
|
|
110
|
+
|
|
111
|
+
In this case, it allows to provide ways to choose the elements if there are several matches for a given name. See `DeduplicateNamesOptions` for more details.
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
### Available implementations for `Path Resolution`
|
|
115
|
+
|
|
116
|
+
**WARNING**: this is front-end processing. It's more efficient for this type of processing to be carried out in the backend.
|
|
117
|
+
Use it to bypass the limitations of the tools and algorithms provided in the backend.
|
|
118
|
+
|
|
119
|
+
The `Path Resolution` infers a BPMN path from elements known to be completed or pending.
|
|
120
|
+
|
|
121
|
+
#### `PathResolver`
|
|
122
|
+
|
|
123
|
+
As it is generic and covers general use cases, its capabilities are limited.
|
|
124
|
+
|
|
125
|
+
It only infers edges/flows given a list of flowNode/shape ids.
|
|
126
|
+
|
|
127
|
+
#### `CasePathResolver`
|
|
128
|
+
|
|
129
|
+
Provides path resolution for a single process instance/case.
|
|
130
|
+
|
|
131
|
+
It is an enhanced implementation of `PathResolver` with resolution options and returns categorized `BpmnSemantic` objects.
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
### `ShapeUtil`
|
|
135
|
+
|
|
136
|
+
Add new methods to the `ShapeUtil` class provided by `bpmn-visualization`.
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
## 📃 License
|
|
140
|
+
|
|
141
|
+
`bpmn-visualization-addons` is released under the [Apache 2.0](LICENSE) license.
|
|
142
|
+
Copyright © 2023-present, Bonitasoft S.A.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { BpmnElementKind, BpmnSemantic, ElementsRegistry } from 'bpmn-visualization';
|
|
2
|
+
import { ShapeBpmnElementKind, ShapeUtil as BaseShapeUtil } from 'bpmn-visualization';
|
|
3
|
+
/**
|
|
4
|
+
* Options to deduplicate elements when several names match.
|
|
5
|
+
*/
|
|
6
|
+
export type DeduplicateNamesOptions = {
|
|
7
|
+
/** If not set, use all `BpmnElementKind` values. */
|
|
8
|
+
kinds?: BpmnElementKind[];
|
|
9
|
+
/** Apply custom function to filter duplicates. */
|
|
10
|
+
filter?: (bpmnSemantic: BpmnSemantic) => boolean;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Provides workarounds for {@link https://github.com/process-analytics/bpmn-visualization-js/issues/2453}.
|
|
14
|
+
*/
|
|
15
|
+
export declare class BpmnElementsSearcher {
|
|
16
|
+
private readonly elementsRegistry;
|
|
17
|
+
constructor(elementsRegistry: ElementsRegistry);
|
|
18
|
+
/**
|
|
19
|
+
* Find the ID of the first element that matches the provided name.
|
|
20
|
+
* @param name the name of the element to retrieve.
|
|
21
|
+
*/
|
|
22
|
+
getElementIdByName(name: string): string | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Find the element that matches the provided name.
|
|
25
|
+
*
|
|
26
|
+
* Use the `deduplicateOptions` parameter to modify the default behavior of deduplication processing.
|
|
27
|
+
*
|
|
28
|
+
* The deduplication process is done in this order:
|
|
29
|
+
* - look for elements matching the provided kinds. If not specified, use all `BpmnElementKind` values.
|
|
30
|
+
* - apply the deduplication filter if provided, otherwise take the first element corresponding to the name provided.
|
|
31
|
+
*
|
|
32
|
+
* @param name the name of the element to retrieve.
|
|
33
|
+
* @param deduplicateOptions if not defined, or if the object doesn't define any properties, duplicates are filtered out by selecting the first element corresponding to the name provided.
|
|
34
|
+
*/
|
|
35
|
+
getElementByName(name: string, deduplicateOptions?: DeduplicateNamesOptions): BpmnSemantic | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Returns all elements matching the names passed in parameter.
|
|
38
|
+
*
|
|
39
|
+
* The number of elements returned may differ from the number of names passed in parameter:
|
|
40
|
+
* - if there are no elements matching the names
|
|
41
|
+
* - if one of the names does not correspond to any elements
|
|
42
|
+
* - if a name corresponds to several elements (duplicates)
|
|
43
|
+
*
|
|
44
|
+
* @param names the names of the elements to retrieve.
|
|
45
|
+
*/
|
|
46
|
+
getElementsByNames(names: string[]): BpmnSemantic[];
|
|
47
|
+
}
|
|
48
|
+
export declare class BpmnElementsIdentifier {
|
|
49
|
+
private readonly elementsRegistry;
|
|
50
|
+
constructor(elementsRegistry: ElementsRegistry);
|
|
51
|
+
isActivity(elementId: string): boolean;
|
|
52
|
+
isBpmnArtifact(elementId: string): boolean;
|
|
53
|
+
isGateway(elementId: string): boolean;
|
|
54
|
+
isEvent(elementId: string): boolean;
|
|
55
|
+
private isInCategory;
|
|
56
|
+
}
|
|
57
|
+
export declare class ShapeUtil extends BaseShapeUtil {
|
|
58
|
+
static isBpmnArtifact(kind: ShapeBpmnElementKind | string): boolean;
|
|
59
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2023 Bonitasoft S.A.
|
|
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 { FlowKind, ShapeBpmnElementKind, ShapeUtil as BaseShapeUtil } from 'bpmn-visualization';
|
|
17
|
+
const allBpmnElementKinds = [...Object.values(ShapeBpmnElementKind), ...Object.values(FlowKind)];
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
19
|
+
const acceptAll = (_bpmnSemantic) => true;
|
|
20
|
+
/**
|
|
21
|
+
* Provides workarounds for {@link https://github.com/process-analytics/bpmn-visualization-js/issues/2453}.
|
|
22
|
+
*/
|
|
23
|
+
export class BpmnElementsSearcher {
|
|
24
|
+
constructor(elementsRegistry) {
|
|
25
|
+
Object.defineProperty(this, "elementsRegistry", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
configurable: true,
|
|
28
|
+
writable: true,
|
|
29
|
+
value: elementsRegistry
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Find the ID of the first element that matches the provided name.
|
|
34
|
+
* @param name the name of the element to retrieve.
|
|
35
|
+
*/
|
|
36
|
+
getElementIdByName(name) {
|
|
37
|
+
var _a;
|
|
38
|
+
return (_a = this.getElementByName(name)) === null || _a === void 0 ? void 0 : _a.id;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Find the element that matches the provided name.
|
|
42
|
+
*
|
|
43
|
+
* Use the `deduplicateOptions` parameter to modify the default behavior of deduplication processing.
|
|
44
|
+
*
|
|
45
|
+
* The deduplication process is done in this order:
|
|
46
|
+
* - look for elements matching the provided kinds. If not specified, use all `BpmnElementKind` values.
|
|
47
|
+
* - apply the deduplication filter if provided, otherwise take the first element corresponding to the name provided.
|
|
48
|
+
*
|
|
49
|
+
* @param name the name of the element to retrieve.
|
|
50
|
+
* @param deduplicateOptions if not defined, or if the object doesn't define any properties, duplicates are filtered out by selecting the first element corresponding to the name provided.
|
|
51
|
+
*/
|
|
52
|
+
getElementByName(name, deduplicateOptions) {
|
|
53
|
+
var _a;
|
|
54
|
+
// Not optimized, do a full lookup at each call
|
|
55
|
+
// Split query by kind to avoid returning a big chunk of data
|
|
56
|
+
for (const kind of (_a = deduplicateOptions === null || deduplicateOptions === void 0 ? void 0 : deduplicateOptions.kinds) !== null && _a !== void 0 ? _a : allBpmnElementKinds) {
|
|
57
|
+
const candidate = this.elementsRegistry
|
|
58
|
+
.getModelElementsByKinds(kind)
|
|
59
|
+
.filter(element => element.name === name)
|
|
60
|
+
.find(element => { var _a; return ((_a = deduplicateOptions === null || deduplicateOptions === void 0 ? void 0 : deduplicateOptions.filter) !== null && _a !== void 0 ? _a : acceptAll)(element); });
|
|
61
|
+
if (candidate) {
|
|
62
|
+
return candidate;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Returns all elements matching the names passed in parameter.
|
|
69
|
+
*
|
|
70
|
+
* The number of elements returned may differ from the number of names passed in parameter:
|
|
71
|
+
* - if there are no elements matching the names
|
|
72
|
+
* - if one of the names does not correspond to any elements
|
|
73
|
+
* - if a name corresponds to several elements (duplicates)
|
|
74
|
+
*
|
|
75
|
+
* @param names the names of the elements to retrieve.
|
|
76
|
+
*/
|
|
77
|
+
getElementsByNames(names) {
|
|
78
|
+
const elements = [];
|
|
79
|
+
for (const kind of allBpmnElementKinds) {
|
|
80
|
+
elements.push(...this.elementsRegistry
|
|
81
|
+
.getModelElementsByKinds(kind)
|
|
82
|
+
.filter(element => names.includes(element.name))
|
|
83
|
+
.flat());
|
|
84
|
+
}
|
|
85
|
+
return elements;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
export class BpmnElementsIdentifier {
|
|
89
|
+
constructor(elementsRegistry) {
|
|
90
|
+
Object.defineProperty(this, "elementsRegistry", {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
configurable: true,
|
|
93
|
+
writable: true,
|
|
94
|
+
value: elementsRegistry
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
isActivity(elementId) {
|
|
98
|
+
return this.isInCategory(BaseShapeUtil.isActivity, elementId);
|
|
99
|
+
}
|
|
100
|
+
isBpmnArtifact(elementId) {
|
|
101
|
+
return this.isInCategory(ShapeUtil.isBpmnArtifact, elementId);
|
|
102
|
+
}
|
|
103
|
+
isGateway(elementId) {
|
|
104
|
+
return this.isInCategory(BaseShapeUtil.isGateway, elementId);
|
|
105
|
+
}
|
|
106
|
+
isEvent(elementId) {
|
|
107
|
+
return this.isInCategory(BaseShapeUtil.isEvent, elementId);
|
|
108
|
+
}
|
|
109
|
+
isInCategory(categorizeFunction, elementId) {
|
|
110
|
+
const elements = this.elementsRegistry.getModelElementsByIds(elementId);
|
|
111
|
+
if (elements.length > 0) {
|
|
112
|
+
const kind = elements[0].kind;
|
|
113
|
+
return categorizeFunction(kind);
|
|
114
|
+
}
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
export class ShapeUtil extends BaseShapeUtil {
|
|
119
|
+
static isBpmnArtifact(kind) {
|
|
120
|
+
return kind === ShapeBpmnElementKind.GROUP || kind === ShapeBpmnElementKind.TEXT_ANNOTATION;
|
|
121
|
+
}
|
|
122
|
+
}
|
package/lib/index.d.ts
ADDED
package/lib/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2023 Bonitasoft S.A.
|
|
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
|
+
export * from './bpmn-elements.js';
|
|
17
|
+
export * from './paths.js';
|
|
18
|
+
export * from './plugins/index.js';
|
|
19
|
+
export * from './plugins-support.js';
|
package/lib/paths.d.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { EdgeBpmnSemantic, ElementsRegistry, ShapeBpmnSemantic } from 'bpmn-visualization';
|
|
2
|
+
/**
|
|
3
|
+
* A general implementation for Path resolution.
|
|
4
|
+
*
|
|
5
|
+
* As it is generic and covers general use cases, its capabilities are limited.
|
|
6
|
+
*
|
|
7
|
+
* For the path resolution of single case/instance of a process, prefer {@link CasePathResolver}.
|
|
8
|
+
*/
|
|
9
|
+
export declare class PathResolver {
|
|
10
|
+
private readonly elementsRegistry;
|
|
11
|
+
constructor(elementsRegistry: ElementsRegistry);
|
|
12
|
+
/**
|
|
13
|
+
* If the `shapeIds` parameter contains ids related to edges, these ids are ignored and not returned as part of the visited edges.
|
|
14
|
+
*
|
|
15
|
+
* @param shapeIds the ids used to compute the visited edges
|
|
16
|
+
*/
|
|
17
|
+
getVisitedEdges(shapeIds: string[]): string[];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Provides path resolution for a single process instance/case.
|
|
21
|
+
*
|
|
22
|
+
* It is an enhanced implementation of {@link PathResolver} with resolution options and returns categorized `BpmnSemantic` objects.
|
|
23
|
+
*/
|
|
24
|
+
export declare class CasePathResolver {
|
|
25
|
+
private readonly elementsRegistry;
|
|
26
|
+
constructor(elementsRegistry: ElementsRegistry);
|
|
27
|
+
compute(input: CasePathResolverInput): CasePathResolverOutput;
|
|
28
|
+
}
|
|
29
|
+
export type CasePathResolverInput = {
|
|
30
|
+
/**
|
|
31
|
+
* The IDs of elements (flowNodes/shapes and flows/edges) that are already completed. Non-existing ids will be silently ignored.
|
|
32
|
+
*
|
|
33
|
+
* `Completed` means that the element has been fully executed or definitively cancelled (for BPM engines that support this and allow cancelled elements to be continued).
|
|
34
|
+
* No further user action or automation will update the element.
|
|
35
|
+
*/
|
|
36
|
+
completedIds: string[];
|
|
37
|
+
};
|
|
38
|
+
export type CasePathResolverOutput = {
|
|
39
|
+
/**
|
|
40
|
+
* The `BpmnSemantic` objects retrieved from the model that relate to the ids passed in {@link CasePathResolverInput}.
|
|
41
|
+
*/
|
|
42
|
+
provided: {
|
|
43
|
+
completed: {
|
|
44
|
+
shapes: ShapeBpmnSemantic[];
|
|
45
|
+
edges: EdgeBpmnSemantic[];
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
computed: {
|
|
49
|
+
completed: {
|
|
50
|
+
shapes: ShapeBpmnSemantic[];
|
|
51
|
+
edges: EdgeBpmnSemantic[];
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
};
|
package/lib/paths.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2023 Bonitasoft S.A.
|
|
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
|
+
const inferEdgeIds = (shapes) => {
|
|
17
|
+
const incomingIds = [];
|
|
18
|
+
const outgoingIds = [];
|
|
19
|
+
for (const shape of shapes) {
|
|
20
|
+
incomingIds.push(...shape.incomingIds);
|
|
21
|
+
outgoingIds.push(...shape.outgoingIds);
|
|
22
|
+
}
|
|
23
|
+
return incomingIds.filter(incomingId => outgoingIds.includes(incomingId));
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* A general implementation for Path resolution.
|
|
27
|
+
*
|
|
28
|
+
* As it is generic and covers general use cases, its capabilities are limited.
|
|
29
|
+
*
|
|
30
|
+
* For the path resolution of single case/instance of a process, prefer {@link CasePathResolver}.
|
|
31
|
+
*/
|
|
32
|
+
export class PathResolver {
|
|
33
|
+
constructor(elementsRegistry) {
|
|
34
|
+
Object.defineProperty(this, "elementsRegistry", {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
configurable: true,
|
|
37
|
+
writable: true,
|
|
38
|
+
value: elementsRegistry
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* If the `shapeIds` parameter contains ids related to edges, these ids are ignored and not returned as part of the visited edges.
|
|
43
|
+
*
|
|
44
|
+
* @param shapeIds the ids used to compute the visited edges
|
|
45
|
+
*/
|
|
46
|
+
getVisitedEdges(shapeIds) {
|
|
47
|
+
const shapes = this.elementsRegistry.getModelElementsByIds(shapeIds).filter(element => element.isShape);
|
|
48
|
+
return inferEdgeIds(shapes);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Provides path resolution for a single process instance/case.
|
|
53
|
+
*
|
|
54
|
+
* It is an enhanced implementation of {@link PathResolver} with resolution options and returns categorized `BpmnSemantic` objects.
|
|
55
|
+
*/
|
|
56
|
+
export class CasePathResolver {
|
|
57
|
+
constructor(elementsRegistry) {
|
|
58
|
+
Object.defineProperty(this, "elementsRegistry", {
|
|
59
|
+
enumerable: true,
|
|
60
|
+
configurable: true,
|
|
61
|
+
writable: true,
|
|
62
|
+
value: elementsRegistry
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
compute(input) {
|
|
66
|
+
const completedElements = this.elementsRegistry.getModelElementsByIds(input.completedIds);
|
|
67
|
+
const completedShapes = completedElements.filter(element => element.isShape);
|
|
68
|
+
const completedEdges = completedElements.filter(element => !element.isShape);
|
|
69
|
+
const inputElementIds = new Set(completedElements.map(element => element.id));
|
|
70
|
+
// infer edges from shapes
|
|
71
|
+
const computedCompletedEdgeIds = inferEdgeIds(completedShapes).filter(id => !inputElementIds.has(id));
|
|
72
|
+
const computedCompletedEdges = this.elementsRegistry.getModelElementsByIds(computedCompletedEdgeIds);
|
|
73
|
+
// infer shapes from edges
|
|
74
|
+
const computedCompletedShapeIds = completedEdges.flatMap(edge => [edge.sourceRefId, edge.targetRefId]).filter(id => !inputElementIds.has(id));
|
|
75
|
+
const computedCompletedShapes = this.elementsRegistry.getModelElementsByIds(computedCompletedShapeIds);
|
|
76
|
+
return {
|
|
77
|
+
provided: {
|
|
78
|
+
completed: {
|
|
79
|
+
shapes: completedShapes,
|
|
80
|
+
edges: completedEdges,
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
computed: {
|
|
84
|
+
completed: {
|
|
85
|
+
shapes: computedCompletedShapes,
|
|
86
|
+
edges: computedCompletedEdges,
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { BpmnVisualization, Plugin } from '../plugins-support.js';
|
|
2
|
+
import type { CssClassesRegistry } from 'bpmn-visualization';
|
|
3
|
+
/**
|
|
4
|
+
* Provide CSS classes operations on BPMN elements.
|
|
5
|
+
*
|
|
6
|
+
* This plugin is a wrapper that delegates the actual CSS classes operations to {@link BpmnElementsRegistry}.
|
|
7
|
+
*
|
|
8
|
+
* @since 0.7.0
|
|
9
|
+
*/
|
|
10
|
+
export declare class CssClassesPlugin implements Plugin, CssClassesRegistry {
|
|
11
|
+
private readonly cssRegistry;
|
|
12
|
+
constructor(bpmnVisualization: BpmnVisualization);
|
|
13
|
+
getPluginId(): string;
|
|
14
|
+
addCssClasses(bpmnElementIds: string | string[], classNames: string | string[]): void;
|
|
15
|
+
removeCssClasses(bpmnElementIds: string | string[], classNames: string | string[]): void;
|
|
16
|
+
removeAllCssClasses(bpmnElementIds?: string | string[]): void;
|
|
17
|
+
toggleCssClasses(bpmnElementIds: string | string[], classNames: string | string[]): void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2024 Bonitasoft S.A.
|
|
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
|
+
/**
|
|
17
|
+
* Provide CSS classes operations on BPMN elements.
|
|
18
|
+
*
|
|
19
|
+
* This plugin is a wrapper that delegates the actual CSS classes operations to {@link BpmnElementsRegistry}.
|
|
20
|
+
*
|
|
21
|
+
* @since 0.7.0
|
|
22
|
+
*/
|
|
23
|
+
export class CssClassesPlugin {
|
|
24
|
+
constructor(bpmnVisualization) {
|
|
25
|
+
Object.defineProperty(this, "cssRegistry", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
configurable: true,
|
|
28
|
+
writable: true,
|
|
29
|
+
value: void 0
|
|
30
|
+
});
|
|
31
|
+
this.cssRegistry = bpmnVisualization.bpmnElementsRegistry;
|
|
32
|
+
}
|
|
33
|
+
getPluginId() {
|
|
34
|
+
return 'css';
|
|
35
|
+
}
|
|
36
|
+
addCssClasses(bpmnElementIds, classNames) {
|
|
37
|
+
this.cssRegistry.addCssClasses(bpmnElementIds, classNames);
|
|
38
|
+
}
|
|
39
|
+
removeCssClasses(bpmnElementIds, classNames) {
|
|
40
|
+
this.cssRegistry.removeCssClasses(bpmnElementIds, classNames);
|
|
41
|
+
}
|
|
42
|
+
removeAllCssClasses(bpmnElementIds) {
|
|
43
|
+
this.cssRegistry.removeAllCssClasses(bpmnElementIds);
|
|
44
|
+
}
|
|
45
|
+
toggleCssClasses(bpmnElementIds, classNames) {
|
|
46
|
+
this.cssRegistry.toggleCssClasses(bpmnElementIds, classNames);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { BpmnVisualization, Plugin } from '../plugins-support.js';
|
|
2
|
+
import type { BpmnElement, BpmnElementKind, BpmnSemantic, ElementsRegistry } from 'bpmn-visualization';
|
|
3
|
+
export declare class ElementsPlugin implements Plugin, ElementsRegistry {
|
|
4
|
+
private readonly elementsRegistry;
|
|
5
|
+
constructor(bpmnVisualization: BpmnVisualization);
|
|
6
|
+
getElementsByIds(bpmnElementIds: string | string[]): BpmnElement[];
|
|
7
|
+
getElementsByKinds(bpmnKinds: BpmnElementKind | BpmnElementKind[]): BpmnElement[];
|
|
8
|
+
getModelElementsByIds(bpmnElementIds: string | string[]): BpmnSemantic[];
|
|
9
|
+
getModelElementsByKinds(bpmnKinds: BpmnElementKind | BpmnElementKind[]): BpmnSemantic[];
|
|
10
|
+
getPluginId(): string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2023 Bonitasoft S.A.
|
|
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
|
+
export class ElementsPlugin {
|
|
17
|
+
constructor(bpmnVisualization) {
|
|
18
|
+
Object.defineProperty(this, "elementsRegistry", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
configurable: true,
|
|
21
|
+
writable: true,
|
|
22
|
+
value: void 0
|
|
23
|
+
});
|
|
24
|
+
this.elementsRegistry = bpmnVisualization.bpmnElementsRegistry;
|
|
25
|
+
}
|
|
26
|
+
getElementsByIds(bpmnElementIds) {
|
|
27
|
+
return this.elementsRegistry.getElementsByIds(bpmnElementIds);
|
|
28
|
+
}
|
|
29
|
+
getElementsByKinds(bpmnKinds) {
|
|
30
|
+
return this.elementsRegistry.getElementsByKinds(bpmnKinds);
|
|
31
|
+
}
|
|
32
|
+
getModelElementsByIds(bpmnElementIds) {
|
|
33
|
+
return this.elementsRegistry.getModelElementsByIds(bpmnElementIds);
|
|
34
|
+
}
|
|
35
|
+
getModelElementsByKinds(bpmnKinds) {
|
|
36
|
+
return this.elementsRegistry.getModelElementsByKinds(bpmnKinds);
|
|
37
|
+
}
|
|
38
|
+
getPluginId() {
|
|
39
|
+
return 'elements';
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2023 Bonitasoft S.A.
|
|
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
|
+
export * from './css-classes.js';
|
|
17
|
+
export * from './elements.js';
|
|
18
|
+
export * from './overlays.js';
|
|
19
|
+
export * from './style.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { BpmnVisualization, Plugin } from '../plugins-support.js';
|
|
2
|
+
import type { Overlay, OverlaysRegistry } from 'bpmn-visualization';
|
|
3
|
+
export declare class OverlaysPlugin implements Plugin, OverlaysRegistry {
|
|
4
|
+
private readonly overlayPane;
|
|
5
|
+
private readonly overlaysRegistry;
|
|
6
|
+
private previousStyleDisplay?;
|
|
7
|
+
private isVisible;
|
|
8
|
+
constructor(bpmnVisualization: BpmnVisualization);
|
|
9
|
+
setVisible(visible?: boolean): void;
|
|
10
|
+
addOverlays(bpmnElementId: string, overlays: Overlay | Overlay[]): void;
|
|
11
|
+
removeAllOverlays(bpmnElementId: string): void;
|
|
12
|
+
getPluginId(): string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2023 Bonitasoft S.A.
|
|
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
|
+
export class OverlaysPlugin {
|
|
17
|
+
constructor(bpmnVisualization) {
|
|
18
|
+
Object.defineProperty(this, "overlayPane", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
configurable: true,
|
|
21
|
+
writable: true,
|
|
22
|
+
value: void 0
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(this, "overlaysRegistry", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
configurable: true,
|
|
27
|
+
writable: true,
|
|
28
|
+
value: void 0
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(this, "previousStyleDisplay", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
configurable: true,
|
|
33
|
+
writable: true,
|
|
34
|
+
value: void 0
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(this, "isVisible", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
configurable: true,
|
|
39
|
+
writable: true,
|
|
40
|
+
value: true
|
|
41
|
+
});
|
|
42
|
+
const view = bpmnVisualization.graph.getView();
|
|
43
|
+
this.overlayPane = view.getOverlayPane();
|
|
44
|
+
this.overlaysRegistry = bpmnVisualization.bpmnElementsRegistry;
|
|
45
|
+
}
|
|
46
|
+
setVisible(visible = true) {
|
|
47
|
+
if (visible && !this.isVisible) {
|
|
48
|
+
this.overlayPane.style.display = this.previousStyleDisplay; // if there was no display before, unset the display
|
|
49
|
+
this.isVisible = true;
|
|
50
|
+
}
|
|
51
|
+
else if (!visible && this.isVisible) {
|
|
52
|
+
this.previousStyleDisplay = this.overlayPane.style.display;
|
|
53
|
+
this.overlayPane.style.display = 'none';
|
|
54
|
+
this.isVisible = false;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
addOverlays(bpmnElementId, overlays) {
|
|
58
|
+
this.overlaysRegistry.addOverlays(bpmnElementId, overlays);
|
|
59
|
+
}
|
|
60
|
+
removeAllOverlays(bpmnElementId) {
|
|
61
|
+
this.overlaysRegistry.removeAllOverlays(bpmnElementId);
|
|
62
|
+
}
|
|
63
|
+
getPluginId() {
|
|
64
|
+
return 'overlays';
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { BpmnVisualization, Plugin } from '../plugins-support.js';
|
|
2
|
+
import type { StyleRegistry, StyleUpdate } from 'bpmn-visualization';
|
|
3
|
+
/**
|
|
4
|
+
* Provide style operations on BPMN elements.
|
|
5
|
+
*
|
|
6
|
+
* This plugin is a wrapper that delegates the actual style operations to {@link BpmnElementsRegistry}.
|
|
7
|
+
*
|
|
8
|
+
* @since 0.7.0
|
|
9
|
+
*/
|
|
10
|
+
export declare class StylePlugin implements Plugin, StyleRegistry {
|
|
11
|
+
private readonly styleRegistry;
|
|
12
|
+
constructor(bpmnVisualization: BpmnVisualization);
|
|
13
|
+
getPluginId(): string;
|
|
14
|
+
updateStyle(bpmnElementIds: string | string[], styleUpdate: StyleUpdate): void;
|
|
15
|
+
resetStyle(bpmnElementIds?: string | string[]): void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @since 0.7.0
|
|
19
|
+
*/
|
|
20
|
+
export interface StyleRegistryByName extends StyleRegistry {
|
|
21
|
+
/**
|
|
22
|
+
* Update the style of the BPMN elements with the given names.
|
|
23
|
+
*
|
|
24
|
+
* See {@link StyleRegistry.updateStyle} for more details.
|
|
25
|
+
*
|
|
26
|
+
* @param bpmnElementNames The name of the BPMN element(s) whose style must be updated.
|
|
27
|
+
* @param styleUpdate The style properties to update.
|
|
28
|
+
*/
|
|
29
|
+
updateStyle(bpmnElementNames: string | string[], styleUpdate: StyleUpdate): void;
|
|
30
|
+
/**
|
|
31
|
+
* Reset the style of the BPMN elements with the given names.
|
|
32
|
+
*
|
|
33
|
+
* See {@link StyleRegistry.resetStyle} for more details.
|
|
34
|
+
*
|
|
35
|
+
* @param bpmnElementNames The name of the BPMN element(s) whose style must be reset. When passing a nullish parameter, the style of all BPMN elements will be reset. Passing an empty array has no effect.
|
|
36
|
+
*/
|
|
37
|
+
resetStyle(bpmnElementNames?: string | string[]): void;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Provide style operations on BPMN elements, identifying them by name.
|
|
41
|
+
*
|
|
42
|
+
* This plugin is a wrapper that delegates the actual style operations to a {@link StyleRegistry} instance.
|
|
43
|
+
* It uses the {@link BpmnElementsSearcher} to map names to ids.
|
|
44
|
+
*
|
|
45
|
+
* **WARNING**: This plugin does not currently allow you to configure deduplication or filtering of the elements corresponding to the names supplied as method parameters.
|
|
46
|
+
* If a name corresponds to multiple elements, all matching elements are used, as implemented in {@link BpmnElementsSearcher.getElementsByNames}.
|
|
47
|
+
* This is a known limitation of the current implementation.
|
|
48
|
+
*
|
|
49
|
+
* **IMPORTANT**: The mapping is currently not cached, nor pre-fetched after the BPMN source has been loaded.
|
|
50
|
+
* So the implementation is not very effective. Caching and pre-fetch features will be implemented in the future.
|
|
51
|
+
* See https://github.com/process-analytics/bpmn-visualization-addons/issues/4 for improvement.
|
|
52
|
+
*
|
|
53
|
+
* @since 0.7.0
|
|
54
|
+
*/
|
|
55
|
+
export declare class StyleByNamePlugin implements Plugin, StyleRegistryByName {
|
|
56
|
+
private readonly searcher;
|
|
57
|
+
private readonly styleRegistry;
|
|
58
|
+
constructor(bpmnVisualization: BpmnVisualization);
|
|
59
|
+
getPluginId(): string;
|
|
60
|
+
updateStyle(bpmnElementNames: string | string[], styleUpdate: StyleUpdate): void;
|
|
61
|
+
resetStyle(bpmnElementNames?: string | string[]): void;
|
|
62
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2024 Bonitasoft S.A.
|
|
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 { BpmnElementsSearcher } from '../bpmn-elements.js';
|
|
17
|
+
/**
|
|
18
|
+
* Provide style operations on BPMN elements.
|
|
19
|
+
*
|
|
20
|
+
* This plugin is a wrapper that delegates the actual style operations to {@link BpmnElementsRegistry}.
|
|
21
|
+
*
|
|
22
|
+
* @since 0.7.0
|
|
23
|
+
*/
|
|
24
|
+
export class StylePlugin {
|
|
25
|
+
constructor(bpmnVisualization) {
|
|
26
|
+
Object.defineProperty(this, "styleRegistry", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
configurable: true,
|
|
29
|
+
writable: true,
|
|
30
|
+
value: void 0
|
|
31
|
+
});
|
|
32
|
+
this.styleRegistry = bpmnVisualization.bpmnElementsRegistry;
|
|
33
|
+
}
|
|
34
|
+
getPluginId() {
|
|
35
|
+
return 'style';
|
|
36
|
+
}
|
|
37
|
+
updateStyle(bpmnElementIds, styleUpdate) {
|
|
38
|
+
this.styleRegistry.updateStyle(bpmnElementIds, styleUpdate);
|
|
39
|
+
}
|
|
40
|
+
resetStyle(bpmnElementIds) {
|
|
41
|
+
this.styleRegistry.resetStyle(bpmnElementIds);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Provide style operations on BPMN elements, identifying them by name.
|
|
46
|
+
*
|
|
47
|
+
* This plugin is a wrapper that delegates the actual style operations to a {@link StyleRegistry} instance.
|
|
48
|
+
* It uses the {@link BpmnElementsSearcher} to map names to ids.
|
|
49
|
+
*
|
|
50
|
+
* **WARNING**: This plugin does not currently allow you to configure deduplication or filtering of the elements corresponding to the names supplied as method parameters.
|
|
51
|
+
* If a name corresponds to multiple elements, all matching elements are used, as implemented in {@link BpmnElementsSearcher.getElementsByNames}.
|
|
52
|
+
* This is a known limitation of the current implementation.
|
|
53
|
+
*
|
|
54
|
+
* **IMPORTANT**: The mapping is currently not cached, nor pre-fetched after the BPMN source has been loaded.
|
|
55
|
+
* So the implementation is not very effective. Caching and pre-fetch features will be implemented in the future.
|
|
56
|
+
* See https://github.com/process-analytics/bpmn-visualization-addons/issues/4 for improvement.
|
|
57
|
+
*
|
|
58
|
+
* @since 0.7.0
|
|
59
|
+
*/
|
|
60
|
+
export class StyleByNamePlugin {
|
|
61
|
+
constructor(bpmnVisualization) {
|
|
62
|
+
Object.defineProperty(this, "searcher", {
|
|
63
|
+
enumerable: true,
|
|
64
|
+
configurable: true,
|
|
65
|
+
writable: true,
|
|
66
|
+
value: void 0
|
|
67
|
+
});
|
|
68
|
+
Object.defineProperty(this, "styleRegistry", {
|
|
69
|
+
enumerable: true,
|
|
70
|
+
configurable: true,
|
|
71
|
+
writable: true,
|
|
72
|
+
value: void 0
|
|
73
|
+
});
|
|
74
|
+
this.searcher = new BpmnElementsSearcher(bpmnVisualization.bpmnElementsRegistry);
|
|
75
|
+
this.styleRegistry = bpmnVisualization.bpmnElementsRegistry;
|
|
76
|
+
}
|
|
77
|
+
getPluginId() {
|
|
78
|
+
return 'style-by-name';
|
|
79
|
+
}
|
|
80
|
+
updateStyle(bpmnElementNames, styleUpdate) {
|
|
81
|
+
const bpmnElements = this.searcher.getElementsByNames(bpmnElementNames);
|
|
82
|
+
this.styleRegistry.updateStyle(bpmnElements.map(bpmnElement => bpmnElement.id), styleUpdate);
|
|
83
|
+
}
|
|
84
|
+
resetStyle(bpmnElementNames) {
|
|
85
|
+
if (!bpmnElementNames) {
|
|
86
|
+
this.styleRegistry.resetStyle();
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const bpmnElements = this.searcher.getElementsByNames(bpmnElementNames);
|
|
90
|
+
this.styleRegistry.resetStyle(bpmnElements.map(bpmnElement => bpmnElement.id));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { BpmnVisualization as BaseBpmnVisualization, type GlobalOptions as BaseGlobalOptions } from 'bpmn-visualization';
|
|
2
|
+
/**
|
|
3
|
+
* Enforce the Plugin constructor signature.
|
|
4
|
+
* Inspired from https://www.typescriptlang.org/docs/handbook/interfaces.html#difference-between-the-static-and-instance-sides-of-classes (deprecated page, but sill working).
|
|
5
|
+
*/
|
|
6
|
+
export type PluginConstructor = new (bpmnVisualization: BpmnVisualization, options: GlobalOptions) => Plugin;
|
|
7
|
+
/**
|
|
8
|
+
* Plugin lifecycle:
|
|
9
|
+
* - construct
|
|
10
|
+
* - configure
|
|
11
|
+
*/
|
|
12
|
+
export interface Plugin {
|
|
13
|
+
/** Returns the unique identifier of the plugin. It is not possible to use several plugins having the same identifier. */
|
|
14
|
+
getPluginId(): string;
|
|
15
|
+
/**
|
|
16
|
+
* Implement this method to configure the plugin after initialization.
|
|
17
|
+
* @param options The options passed to the BpmnVisualization instance, used to configure the plugin.
|
|
18
|
+
*/
|
|
19
|
+
configure?: (options: GlobalOptions) => void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Let pass plugins configuration to {@link BpmnVisualization}.
|
|
23
|
+
*
|
|
24
|
+
* Use this type if you already have a dedicated custom `GlobalOptions` type extending the bpmn-visualization `GlobalOptions` type.
|
|
25
|
+
* In this case, proceed as in the following example to add the plugins configuration to the custom `GlobalOptions`.
|
|
26
|
+
*
|
|
27
|
+
* ```ts
|
|
28
|
+
* // Assuming you have a `CustomGlobalOptions` type extending the bpmn-visualization `GlobalOptions` type
|
|
29
|
+
* type GlobalOptionsWithPluginsSupport = CustomGlobalOptions & PluginOptionExtension;
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* If you don't extend `GlobalOptions`, use {@link GlobalOptions} directly.
|
|
33
|
+
*/
|
|
34
|
+
export type PluginOptionExtension = {
|
|
35
|
+
plugins?: PluginConstructor[];
|
|
36
|
+
};
|
|
37
|
+
export type GlobalOptions = BaseGlobalOptions & PluginOptionExtension;
|
|
38
|
+
/**
|
|
39
|
+
* The identifiers of the plugins provided by `bpmn-visualization-addons`.
|
|
40
|
+
* @since 0.7.0
|
|
41
|
+
*/
|
|
42
|
+
export type DefaultPlugins = 'css' | 'elements' | 'overlays' | 'style' | 'style-by-name';
|
|
43
|
+
/**
|
|
44
|
+
* All possible identifiers that can be used to identify a plugin.
|
|
45
|
+
* @since 0.7.0
|
|
46
|
+
*/
|
|
47
|
+
export type PluginIds = DefaultPlugins | (string & Record<never, never>);
|
|
48
|
+
export declare class BpmnVisualization extends BaseBpmnVisualization {
|
|
49
|
+
private readonly plugins;
|
|
50
|
+
constructor(options: GlobalOptions);
|
|
51
|
+
getPlugin<T extends Plugin>(id: PluginIds): T;
|
|
52
|
+
private readonly registerPlugins;
|
|
53
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2023 Bonitasoft S.A.
|
|
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 { BpmnVisualization as BaseBpmnVisualization } from 'bpmn-visualization';
|
|
17
|
+
export class BpmnVisualization extends BaseBpmnVisualization {
|
|
18
|
+
constructor(options) {
|
|
19
|
+
super(options);
|
|
20
|
+
Object.defineProperty(this, "plugins", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
configurable: true,
|
|
23
|
+
writable: true,
|
|
24
|
+
value: new Map()
|
|
25
|
+
});
|
|
26
|
+
Object.defineProperty(this, "registerPlugins", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
configurable: true,
|
|
29
|
+
writable: true,
|
|
30
|
+
value: (options) => {
|
|
31
|
+
var _a, _b;
|
|
32
|
+
// construct
|
|
33
|
+
for (const constructor of (_a = options.plugins) !== null && _a !== void 0 ? _a : []) {
|
|
34
|
+
const plugin = new constructor(this, options);
|
|
35
|
+
const pluginId = plugin.getPluginId();
|
|
36
|
+
if (this.plugins.has(pluginId)) {
|
|
37
|
+
throw new Error(`Plugin loading fails. It is not possible to register multiple plugins with the same '${pluginId}' identifier.`);
|
|
38
|
+
}
|
|
39
|
+
this.plugins.set(pluginId, plugin);
|
|
40
|
+
}
|
|
41
|
+
// configure
|
|
42
|
+
for (const plugin of this.plugins.values()) {
|
|
43
|
+
(_b = plugin.configure) === null || _b === void 0 ? void 0 : _b.call(plugin, options);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
this.registerPlugins(options);
|
|
48
|
+
}
|
|
49
|
+
getPlugin(id) {
|
|
50
|
+
return this.plugins.get(id);
|
|
51
|
+
}
|
|
52
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@process-analytics/bpmn-visualization-addons",
|
|
3
|
+
"version": "0.8.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"description": "Experimental addons for bpmn-visualization",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"analytics",
|
|
10
|
+
"bpmn",
|
|
11
|
+
"browser",
|
|
12
|
+
"visualization",
|
|
13
|
+
"addons",
|
|
14
|
+
"add-ons",
|
|
15
|
+
"extensions",
|
|
16
|
+
"process",
|
|
17
|
+
"typescript"
|
|
18
|
+
],
|
|
19
|
+
"homepage": "https://github.com/process-analytics/bpmn-visualization-addons#readme",
|
|
20
|
+
"bugs": "https://github.com/process-analytics/bpmn-visualization-addons/issues",
|
|
21
|
+
"license": "Apache-2.0",
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/process-analytics/bpmn-visualization-addons.git"
|
|
25
|
+
},
|
|
26
|
+
"module": "./lib/index.js",
|
|
27
|
+
"types": "./lib/index.d.ts",
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"import": {
|
|
31
|
+
"types": "./lib/index.d.ts",
|
|
32
|
+
"default": "./lib/index.js"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"./package.json": "./package.json"
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"lib"
|
|
39
|
+
],
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "tsc",
|
|
42
|
+
"clean": "rimraf lib",
|
|
43
|
+
"dev": "tsc --watch --sourceMap",
|
|
44
|
+
"prepack": "run-s clean build",
|
|
45
|
+
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --runInBand",
|
|
46
|
+
"test-check": "tsc --noEmit --project tsconfig.test.json"
|
|
47
|
+
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"bpmn-visualization": ">=0.42.0"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@jest/globals": "~29.7.0",
|
|
53
|
+
"@swc/core": "~1.7.28",
|
|
54
|
+
"@swc/jest": "~0.2.36",
|
|
55
|
+
"@testing-library/jest-dom": "~6.5.0",
|
|
56
|
+
"cross-env": "~7.0.3",
|
|
57
|
+
"eslint-plugin-jest": "~28.8.3",
|
|
58
|
+
"eslint-plugin-jest-dom": "~5.4.0",
|
|
59
|
+
"jest": "~29.7.0",
|
|
60
|
+
"jest-environment-jsdom": "~29.7.0",
|
|
61
|
+
"npm-run-all": "~4.1.5",
|
|
62
|
+
"rimraf": "~6.0.1"
|
|
63
|
+
}
|
|
64
|
+
}
|