@opens/service-workflow-ui 0.0.0-stage → 1.0.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/README.md CHANGED
@@ -1,3 +1,123 @@
1
- # Temporary Holding Version
1
+ # @opens/service-workflow-ui
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ ## Service workflow editor
4
+
5
+ Import the package stylesheet once in the consuming application, then bind the service flow with
6
+ `v-model`. Existing rules are always displayed; `allowed-node-types` controls which types can be
7
+ created by the editor.
8
+
9
+ ```ts
10
+ import { createPinia } from 'pinia';
11
+ import ServiceWorkflowUi, {
12
+ AppServiceWorkflowAddForm,
13
+ AppServiceWorkflowEditor,
14
+ } from '@opens/service-workflow-ui';
15
+ import '@opens/service-workflow-ui/dist/yunique_ui.css';
16
+
17
+ app.use(createPinia());
18
+ app.use(ServiceWorkflowUi);
19
+ ```
20
+
21
+ ```vue
22
+ <app-service-workflow-editor
23
+ workflow-id="main-flow"
24
+ v-model="flow"
25
+ :allowed-node-types="['screen', 'identification', 'service']"
26
+ @change="handleChange"
27
+ @node="handleNode"
28
+ @invalid-change="handleInvalidChange"
29
+ @invalid-model="handleInvalidModel"
30
+ ></app-service-workflow-editor>
31
+
32
+ <app-service-workflow-add-form workflow-id="main-flow"></app-service-workflow-add-form>
33
+ ```
34
+
35
+ `workflow-id` connects one editor to one external add form through Pinia. The consumer owns the
36
+ Pinia instance; the library never installs or replaces it. The add form can be positioned anywhere
37
+ in the application and appears when the editor toolbar or a child placeholder requests creation.
38
+
39
+ A non-empty flow must contain exactly one rule with `isRoot: true`. Disconnected rules, multiple
40
+ parents, and cycles are supported. Invalid models remain visible in read-only mode.
41
+
42
+ Node-type descriptors may define a maximum number of outgoing children. Every rule with remaining
43
+ capacity displays one rolling purple add placeholder, regardless of how many slots remain.
44
+ `maxChildren: 0` disables child creation for that type.
45
+
46
+ ```ts
47
+ const allowedNodeTypes = [
48
+ { type: 'screen', maxChildren: 2 },
49
+ { type: 'identification', maxChildren: 1 },
50
+ { type: 'service', maxChildren: 0 },
51
+ ];
52
+ ```
53
+
54
+ The editor rejects add, connect, or cross-source reconnect operations that exceed a finite limit
55
+ through `invalid-change`. Existing over-capacity payloads remain visible and editable so their
56
+ connections can be removed or corrected.
57
+
58
+ This template should help get you started developing with Vue 3 in Vite.
59
+
60
+ ## Recommended IDE Setup
61
+
62
+ [VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
63
+
64
+ ## Type Support for `.vue` Imports in TS
65
+
66
+ TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types.
67
+
68
+ If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps:
69
+
70
+ 1. Disable the built-in TypeScript Extension
71
+ 1) Run `Extensions: Show Built-in Extensions` from VSCode's command palette
72
+ 2) Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)`
73
+ 2. Reload the VSCode window by running `Developer: Reload Window` from the command palette.
74
+
75
+ ## Customize configuration
76
+
77
+ See [Vite Configuration Reference](https://vitejs.dev/config/).
78
+
79
+ ## Project Setup
80
+
81
+ ```sh
82
+ npm install
83
+ ```
84
+
85
+ ### Compile and Hot-Reload for Development
86
+
87
+ ```sh
88
+ npm run dev
89
+ ```
90
+
91
+ ### Type-Check, Compile and Minify for Production
92
+
93
+ ```sh
94
+ npm run build
95
+ ```
96
+
97
+ ### Run Unit Tests with [Vitest](https://vitest.dev/)
98
+
99
+ ```sh
100
+ npm run test:unit
101
+ ```
102
+
103
+ ### Run End-to-End Tests with [Cypress](https://www.cypress.io/)
104
+
105
+ ```sh
106
+ npm run test:e2e:dev
107
+ ```
108
+
109
+ This runs the end-to-end tests against the Vite development server.
110
+ It is much faster than the production build.
111
+
112
+ But it's still recommended to test the production build with `test:e2e` before deploying (e.g. in CI environments):
113
+
114
+ ```sh
115
+ npm run build
116
+ npm run test:e2e
117
+ ```
118
+
119
+ ---
120
+
121
+ ### Novas versões
122
+
123
+ Para fechar novas versões deve-se atualizar o parâmetro `version` no package.json com o valor da nova versão. Após isso, o pipeline já irá fazer o build e atualizar no npm.
Binary file
package/dist/main.d.ts ADDED
@@ -0,0 +1,101 @@
1
+ import { App } from 'vue';
2
+ import { ComponentOptionsMixin } from 'vue';
3
+ import { ComponentProvideOptions } from 'vue';
4
+ import { ComputedRef } from 'vue';
5
+ import { DefineComponent } from 'vue';
6
+ import { PublicProps } from 'vue';
7
+
8
+ declare type __VLS_Props = {
9
+ workflowId: string;
10
+ };
11
+
12
+ declare type __VLS_Props_2 = {
13
+ workflowId: string;
14
+ modelValue: any;
15
+ allowedNodeTypes?: any[];
16
+ };
17
+
18
+ export declare const AppServiceWorkflowAddForm: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
19
+
20
+ export declare const AppServiceWorkflowEditor: DefineComponent<__VLS_Props_2, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
21
+ "update:modelValue": (flow: any) => any;
22
+ change: (flow: any, mutation: WorkflowMutation) => any;
23
+ node: (rule: any) => any;
24
+ "invalid-change": (invalid: InvalidChange) => any;
25
+ "invalid-model": (invalid: InvalidModel) => any;
26
+ }, string, PublicProps, Readonly<__VLS_Props_2> & Readonly<{
27
+ "onUpdate:modelValue"?: ((flow: any) => any) | undefined;
28
+ onChange?: ((flow: any, mutation: WorkflowMutation) => any) | undefined;
29
+ onNode?: ((rule: any) => any) | undefined;
30
+ "onInvalid-change"?: ((invalid: InvalidChange) => any) | undefined;
31
+ "onInvalid-model"?: ((invalid: InvalidModel) => any) | undefined;
32
+ }>, {
33
+ allowedNodeTypes: any[];
34
+ }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
35
+
36
+ declare const _default: {
37
+ install(app: App): void;
38
+ };
39
+ export default _default;
40
+
41
+ export declare interface InvalidChange {
42
+ mutation: Record<string, any>;
43
+ reason: string;
44
+ }
45
+
46
+ export declare interface InvalidModel {
47
+ reasons: string[];
48
+ }
49
+
50
+ export declare interface NormalizedNodeType {
51
+ type: string;
52
+ label: string;
53
+ color: string;
54
+ icon: string;
55
+ defaultName: string;
56
+ maxChildren?: number;
57
+ }
58
+
59
+ export declare interface ServiceWorkflowEditorChannel {
60
+ request: ComputedRef<WorkflowAddRequest | undefined>;
61
+ nodeTypes: ComputedRef<NormalizedNodeType[]>;
62
+ requestAdd: (parentRule?: any) => boolean;
63
+ cancelAdd: () => void;
64
+ confirmAdd: (nodeType: NormalizedNodeType) => boolean;
65
+ }
66
+
67
+ export declare const useServiceWorkflowEditorChannel: (workflowId: string) => ServiceWorkflowEditorChannel;
68
+
69
+ export declare interface WorkflowAddRequest {
70
+ workflowId: string;
71
+ parentId?: string;
72
+ parentName?: string;
73
+ }
74
+
75
+ export declare type WorkflowMutation = {
76
+ type: 'add-node';
77
+ nodeId: string;
78
+ parentId?: string;
79
+ } | {
80
+ type: 'delete-node';
81
+ nodeId: string;
82
+ } | {
83
+ type: 'connect';
84
+ edgeId: string;
85
+ source: string;
86
+ target: string;
87
+ } | {
88
+ type: 'disconnect';
89
+ edgeId: string;
90
+ source: string;
91
+ target: string;
92
+ } | {
93
+ type: 'reconnect';
94
+ edgeId: string;
95
+ source: string;
96
+ target: string;
97
+ previousSource: string;
98
+ previousTarget: string;
99
+ };
100
+
101
+ export { }