@process-analytics/bv-experimental-add-ons
Advanced tools
Comparing version 0.6.1 to 0.7.0
@@ -38,7 +38,17 @@ import { BpmnVisualization as BaseBpmnVisualization, type GlobalOptions as BaseGlobalOptions } from 'bpmn-visualization'; | ||
export type GlobalOptions = BaseGlobalOptions & PluginOptionExtension; | ||
/** | ||
* The identifiers of the plugins provided by `bv-experimental-add-ons`. | ||
* @since 0.7.0 | ||
*/ | ||
export type DefaultPlugins = 'css' | 'elements' | 'overlays' | 'style' | 'style-by-name'; | ||
/** | ||
* All possible identifiers that can be used to identify a plugin. | ||
* @since 0.7.0 | ||
*/ | ||
export type PluginIds = DefaultPlugins | (string & Record<never, never>); | ||
export declare class BpmnVisualization extends BaseBpmnVisualization { | ||
private readonly plugins; | ||
constructor(options: GlobalOptions); | ||
getPlugin<T extends Plugin>(id: string): T; | ||
getPlugin<T extends Plugin>(id: PluginIds): T; | ||
private registerPlugins; | ||
} |
@@ -0,1 +1,4 @@ | ||
export * from './css-classes'; | ||
export * from './elements'; | ||
export * from './overlays'; | ||
export * from './style'; |
@@ -16,2 +16,5 @@ /* | ||
*/ | ||
export * from './css-classes'; | ||
export * from './elements'; | ||
export * from './overlays'; | ||
export * from './style'; |
{ | ||
"name": "@process-analytics/bv-experimental-add-ons", | ||
"version": "0.6.1", | ||
"version": "0.7.0", | ||
"private": false, | ||
@@ -51,12 +51,12 @@ "type": "module", | ||
"@jest/globals": "~29.7.0", | ||
"@testing-library/jest-dom": "~6.2.0", | ||
"@testing-library/jest-dom": "~6.5.0", | ||
"cross-env": "~7.0.3", | ||
"eslint-plugin-jest": "~27.6.1", | ||
"eslint-plugin-jest-dom": "~5.1.0", | ||
"eslint-plugin-jest": "~28.8.2", | ||
"eslint-plugin-jest-dom": "~5.4.0", | ||
"jest": "~29.7.0", | ||
"jest-environment-jsdom": "~29.7.0", | ||
"npm-run-all": "~4.1.5", | ||
"rimraf": "~5.0.5", | ||
"ts-jest": "~29.1.1" | ||
"rimraf": "~6.0.1", | ||
"ts-jest": "~29.2.5" | ||
} | ||
} |
@@ -7,3 +7,2 @@ # bpmn-visualization add-ons | ||
## 📌 Usage | ||
<!-- ### 📌 Usage in applications and projects --> | ||
@@ -28,6 +27,12 @@ Install `bv-experimental-add-ons` and [bpmn-visualization](https://github.com/process-analytics/bpmn-visualization-js/): | ||
> [!IMPORTANT] | ||
> To be able to register and use the plugins, you need to import `BpmnVisualization` from the `addons` package, and not from `bpmn-visualization`. | ||
```diff | ||
- import {BpmnVisualization} from "bpmn-visualization"; | ||
+ import {BpmnVisualization} from "@process-analytics/bv-experimental-add-ons"; | ||
``` | ||
Example of use: | ||
```ts | ||
// use BpmnVisualization from addons not from bpmn-visualization | ||
import {BpmnVisualization} from "@process-analytics/bv-experimental-add-ons"; | ||
@@ -46,7 +51,13 @@ | ||
- `ElementsPlugin`: provides all `BpmnElementsRegistry` methods for retrieving `BpmnElement` and `BpmnSemantic` objects. | ||
- `OverlaysPlugin`: | ||
- let show/hide overlays created with `BpmnElementsRegistry.addOverlays`. | ||
- provides all `BpmnElementsRegistry` methods relating to overlays. | ||
- Plugins providing `BpmnElementsRegistry` methods divided into different categories. This is how `bpmn-visualization` will provide these functionalities | ||
in the future, in order to better separate responsibilities and improve tree-shaking : | ||
- `CssClassesPlugin`: all methods for manipulating the CSS classes of BPMN elements. | ||
- `ElementsPlugin`: all methods for retrieving `BpmnElement` and `BpmnSemantic` objects. | ||
- `OverlaysPlugin`: | ||
- provides all `BpmnElementsRegistry` methods relating to overlays. | ||
- ADDITION: let show/hide overlays created with `BpmnElementsRegistry.addOverlays`. | ||
- `StylePlugin`: all methods for manipulating the style of BPMN elements. | ||
- `StyleByNamePlugin`: provides all `BpmnElementsRegistry` methods for manipulating the style of BPMN elements, identifying the BPMN elements by name. | ||
#### Writing a custom plugin | ||
@@ -68,6 +79,6 @@ | ||
`bpmn-visualization`only provides APIs that take BPMN element ids as parameters. | ||
`bpmn-visualization` only provides APIs that take BPMN element ids as parameters. | ||
However, there are scenario where the ids in the BPMN source/model have been generated and are unknown by the application. | ||
Instead, the app knows the name of the elements. `BpmnElementsSearcher` provides a way to retrieve the ids of elements related to their names. | ||
Instead, the application knows the name of the elements. `BpmnElementsSearcher` provides a way to retrieve elements given their names. | ||
@@ -77,6 +88,18 @@ This is useful for example in "Process Discovery" scenario. The elements are identified by name only. Ids may be generated | ||
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). | ||
#### Retrieving `ids` | ||
Once you get the ids of elements related to their names, you can then call regular `bpmn-visualization` API by passing the resulting ids. | ||
Limitations | ||
- There is no guarantee that names are unique in the BPMN source. In case that there are several matches, `BpmnElementsSearcher` returns the first matching id. | ||
- If there are several matching names, `BpmnElementsSearcher` returns the first matching identifier. | ||
#### Retrieving the whole `BpmnSemantic` | ||
`BpmnElementsSearcher` also provides a method to retrieve the whole BpmnSemantic objects. | ||
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. | ||
### Available implementations for `Path Resolution` | ||
@@ -83,0 +106,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
50709
21
798
129