sequential-workflow-designer 0.10.3

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 ADDED
@@ -0,0 +1,9 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 N4NO.com
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,205 @@
1
+ ![Sequential Workflow Designer](.github/cover.png)
2
+
3
+ # Sequential Workflow Designer
4
+
5
+ [![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fb4rtaz%2Fsequential-workflow-designer%2Fbadge%3Fref%3Dmain&style=flat-square)](https://actions-badge.atrox.dev/b4rtaz/sequential-workflow-designer/goto?ref=main) [![License: MIT](https://img.shields.io/github/license/mashape/apistatus.svg?style=flat-square)](/LICENSE) [![View this project on NPM](https://img.shields.io/npm/v/sequential-workflow-designer.svg?style=flat-square)](https://npmjs.org/package/sequential-workflow-designer)
6
+
7
+ Sequential workflow designer with 0 external dependencies for web. It's written in pure TypeScript and uses SVG for rendering. This designer is not associated with any workflow engine. It's full generic. You may create any kind application by this, from graphical programming languages to workflow builders.
8
+
9
+ Features:
10
+
11
+ * 0 external dependencies,
12
+ * full generic & configurable,
13
+ * light/dark themes,
14
+ * works on modern browsers,
15
+ * works on mobile,
16
+ * the definition is stored as JSON,
17
+ * has support for [React](./react/) and [Angular](./angular/designer/).
18
+
19
+ 📝 Check the [documentation](https://nocode-js.com/docs/category/sequential-workflow-designer) for more details.
20
+
21
+ 🤩 Don't miss [the pro version](https://github.com/nocode-js/sequential-workflow-designer-pro-demo).
22
+
23
+ ## 👀 Examples
24
+
25
+ * [⏩ Live Testing](https://nocode-js.github.io/sequential-workflow-designer/examples/live-testing.html)
26
+ * [❎ Fullscreen](https://nocode-js.github.io/sequential-workflow-designer/examples/fullscreen.html)
27
+ * [🌅 Image Filter](https://nocode-js.github.io/sequential-workflow-designer/examples/image-filter.html)
28
+ * [🔴 Particles](https://nocode-js.github.io/sequential-workflow-designer/examples/particles.html)
29
+ * [⛅ Light Dark](https://nocode-js.github.io/sequential-workflow-designer/examples/light-dark.html)
30
+ * [🤖 Code Generator](https://nocode-js.github.io/sequential-workflow-designer/examples/code-generator.html)
31
+ * [📐 Simple Flow](https://nocode-js.github.io/sequential-workflow-designer/examples/simple-flow.html)
32
+ * [🌻 Rendering Test](https://nocode-js.github.io/sequential-workflow-designer/examples/rendering-test.html)
33
+ * [🚄 Stress Test](https://nocode-js.github.io/sequential-workflow-designer/examples/stress-test.html)
34
+ * [🚪 Editing Restrictions](https://nocode-js.github.io/sequential-workflow-designer/examples/editing-restrictions.html)
35
+ * [📜 Scrollable Page](https://nocode-js.github.io/sequential-workflow-designer/examples/scrollable-page.html)
36
+
37
+ Pro:
38
+
39
+ * [🤩 Pro Components](https://nocode-js.github.io/sequential-workflow-designer-pro-demo/demos/webpack-pro-app/public/pro-components.html)
40
+ * [👈 Goto](https://nocode-js.github.io/sequential-workflow-designer-pro-demo/demos/webpack-pro-app/public/goto.html)
41
+ * [📁 Folders](https://nocode-js.github.io/sequential-workflow-designer-pro-demo/demos/webpack-pro-app/public/folders.html)
42
+ * [⭕ Wheel Mode](https://nocode-js.github.io/sequential-workflow-designer-pro-demo/demos/webpack-pro-app/public/wheel-mode.html)
43
+ * [🐭 Minimal Root Component](https://nocode-js.github.io/sequential-workflow-designer-pro-demo/demos/webpack-pro-app/public/minimal-root-component.html)
44
+ * [🦁 External UI Components](https://nocode-js.github.io/sequential-workflow-designer-pro-demo/demos/webpack-pro-app/public/external-ui-components.html)
45
+ * [👋 Custom Dragged Component](https://nocode-js.github.io/sequential-workflow-designer-pro-demo/demos/webpack-pro-app/public/custom-dragged-component.html)
46
+ * [🔰 Badges](https://nocode-js.github.io/sequential-workflow-designer-pro-demo/demos/webpack-pro-app/public/badges.html)
47
+ * [🎩 Custom Viewport](https://nocode-js.github.io/sequential-workflow-designer-pro-demo/demos/webpack-pro-app/public/custom-viewport.html)
48
+
49
+ ## 👩‍💻 Integrations
50
+
51
+ * [🚚 Sequential Workflow Machine](https://github.com/nocode-js/sequential-workflow-machine) - JavaScript workflow engine, powered by the xstate library.
52
+
53
+ ## 🚀 Installation
54
+
55
+ To use the designer you should add JS/TS files and CSS files to your project.
56
+
57
+ ### NPM
58
+
59
+ Install this package by [NPM](https://www.npmjs.com/) command:
60
+
61
+ `npm i sequential-workflow-designer`
62
+
63
+ To import the package:
64
+
65
+ ```ts
66
+ import { Designer } from 'sequential-workflow-designer';
67
+ ```
68
+
69
+ If you use [css-loader](https://webpack.js.org/loaders/css-loader/) or similar, you can add CSS files to your bundle:
70
+
71
+ ```ts
72
+ import 'sequential-workflow-designer/css/designer.css';
73
+ import 'sequential-workflow-designer/css/designer-light.css';
74
+ import 'sequential-workflow-designer/css/designer-dark.css';
75
+ ```
76
+
77
+ To create the designer write the below code:
78
+
79
+ ```ts
80
+ // ...
81
+ Designer.create(placeholder, definition, configuration);
82
+ ```
83
+
84
+ ### CDN
85
+
86
+ Add the below code to your head section in HTML document.
87
+
88
+ ```html
89
+ <head>
90
+ ...
91
+ <link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.10.3/css/designer.css" rel="stylesheet">
92
+ <link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.10.3/css/designer-light.css" rel="stylesheet">
93
+ <link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.10.3/css/designer-dark.css" rel="stylesheet">
94
+ <script src="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.10.3/dist/index.umd.js"></script>
95
+ ```
96
+
97
+ Call the designer by:
98
+
99
+ ```js
100
+ sequentialWorkflowDesigner.Designer.create(placeholder, definition, configuration);
101
+ ```
102
+
103
+ ## 🎬 Usage
104
+
105
+ Check [examples](/examples) directory.
106
+
107
+ ```ts
108
+ import { Designer } from 'sequential-workflow-designer';
109
+
110
+ const placeholder = document.getElementById('placeholder');
111
+
112
+ const definition = {
113
+ properties: {
114
+ 'myProperty': 'my-value',
115
+ // global properties...
116
+ },
117
+ sequence: [
118
+ // root steps...
119
+ ]
120
+ };
121
+
122
+ const configuration = {
123
+ theme: 'light', // optional, default: 'light'
124
+ isReadonly: false, // optional, default: false
125
+ undoStackSize: 10, // optional, default: 0 - disabled, 1+ - enabled
126
+
127
+ steps: {
128
+ // all properties in this section are optional
129
+
130
+ iconUrlProvider: (componentType, type) => {
131
+ return `icon-${componentType}-${type}.svg`;
132
+ },
133
+ validator: (step, sourceSequence) => {
134
+ return /^[a-z]+$/.test(step.name);
135
+ },
136
+ isDraggable: (step, parentSequence) => {
137
+ return step.name !== 'y';
138
+ },
139
+ isDeletable: (step, parentSequence) => {
140
+ return step.properties['isDeletable'];
141
+ },
142
+ canInsertStep: (step, targetSequence, targetIndex) => {
143
+ return targetSequence.length < 5;
144
+ },
145
+ canMoveStep: (sourceSequence, step, targetSequence, targetIndex) => {
146
+ return !step.properties['isLocked'];
147
+ },
148
+ canDeleteStep: (step, parentSequence) => {
149
+ return step.name !== 'x';
150
+ }
151
+ },
152
+
153
+ toolbox: {
154
+ groups: [
155
+ {
156
+ name: 'Files',
157
+ steps: [
158
+ // steps for the toolbox's group
159
+ ]
160
+ },
161
+ {
162
+ name: 'Notification',
163
+ steps: [
164
+ // steps for the toolbox's group
165
+ ]
166
+ }
167
+ ]
168
+ },
169
+
170
+ editors: {
171
+ globalEditorProvider: (definition, globalContext) => {
172
+ const editor = document.createElement('div');
173
+ // ...
174
+ return editor;
175
+ },
176
+ stepEditorProvider: (step, stepContext) => {
177
+ const editor = document.createElement('div');
178
+ // ...
179
+ return editor;
180
+ }
181
+ },
182
+
183
+ controlBar: true,
184
+ };
185
+
186
+ const designer = Designer.create(placeholder, definition, configuration);
187
+ designer.onDefinitionChanged.subscribe((newDefinition) => {
188
+ // ...
189
+ });
190
+ ```
191
+
192
+ You can hide default UI components by setting the corresponding configuration property to `false`.
193
+
194
+ ```ts
195
+ const configuration = {
196
+ toolbox: false,
197
+ editors: false,
198
+ controlBar: false,
199
+ // ...
200
+ }
201
+ ```
202
+
203
+ ## 💡 License
204
+
205
+ This project is released under the MIT license.
@@ -0,0 +1,148 @@
1
+
2
+ /********* dark *********/
3
+
4
+ .sqd-theme-dark.sqd-designer {
5
+ background: #1F1F1F;
6
+ }
7
+
8
+ /* dark > .sqd-toolbox */
9
+
10
+ .sqd-theme-dark .sqd-toolbox {
11
+ background: #3F3F3F;
12
+ }
13
+ .sqd-theme-dark .sqd-toolbox-header-title {
14
+ color: #FFF;
15
+
16
+ }
17
+ .sqd-theme-dark .sqd-toolbox-filter {
18
+ border: 0;
19
+ background: #242424;
20
+ color: #FFF;
21
+ }
22
+ .sqd-theme-dark .sqd-toolbox-group-title {
23
+ background: #242424;
24
+ color: #FFF;
25
+ }
26
+ .sqd-theme-dark .sqd-toolbox-item {
27
+ border: none;
28
+ background: #C6C6C6;
29
+ }
30
+ .sqd-theme-dark .sqd-toolbox-item:hover {
31
+ background: #D3D3D3;
32
+ }
33
+ .sqd-theme-dark .sqd-toolbox-item-icon.sqd-no-icon {
34
+ background: #C6C6C6;
35
+ }
36
+ .sqd-theme-dark .sqd-control-bar-button.sqd-delete .sqd-icon-path {
37
+ fill: #E01A24;
38
+ }
39
+
40
+ /* dark > .sqd-control-bar */
41
+
42
+ .sqd-theme-dark .sqd-control-bar {
43
+ background: #3F3F3F;
44
+ }
45
+ .sqd-theme-dark .sqd-control-bar-button {
46
+ background: #C6C6C6;
47
+ }
48
+ .sqd-theme-dark .sqd-control-bar-button:hover {
49
+ background: #D3D3D3;
50
+ }
51
+
52
+ /* dark > .sqd-workspace */
53
+
54
+ .sqd-theme-dark .sqd-grid-path {
55
+ stroke: #2A2A2A;
56
+ }
57
+ .sqd-theme-dark .sqd-join {
58
+ stroke: #707070;
59
+ }
60
+
61
+ /* dark > .sqd-smart-editor */
62
+
63
+ .sqd-theme-dark .sqd-smart-editor {
64
+ background: #3F3F3F;
65
+ }
66
+ .sqd-theme-dark .sqd-smart-editor-toggle {
67
+ background: #6F6F6F;
68
+ }
69
+
70
+ /* dark > .sqd-step-task */
71
+
72
+ .sqd-theme-dark .sqd-step-task-rect {
73
+ fill: #C6C6C6;
74
+ stroke: none;
75
+ filter: drop-shadow(0 1.5px 1.5px rgba(0, 0, 0, .15));
76
+ }
77
+ .sqd-theme-dark .sqd-step-task-rect.sqd-selected {
78
+ stroke: #FFF;
79
+ }
80
+ .sqd-theme-dark .sqd-step-task-text {
81
+ fill: #000;
82
+ }
83
+ .sqd-theme-dark .sqd-step-task-empty-icon {
84
+ fill: #C6C6C6;
85
+ }
86
+
87
+ /* dark > .sqd-input + .sqd-output */
88
+
89
+ .sqd-theme-dark .sqd-input {
90
+ fill: #C6C6C6;
91
+ stroke: #707070;
92
+ }
93
+
94
+ .sqd-theme-dark .sqd-output {
95
+ fill: #707070;
96
+ }
97
+
98
+ /* dark > .sqd-region */
99
+
100
+ .sqd-theme-dark .sqd-region {
101
+ stroke: #434343;
102
+ }
103
+ .sqd-theme-dark .sqd-region.sqd-selected {
104
+ stroke: #FFF;
105
+ }
106
+ .sqd-theme-dark .sqd-label-rect {
107
+ fill: #2411DB;
108
+ }
109
+ .sqd-theme-dark .sqd-label-rect.sqd-label-secondary {
110
+ fill: #0E0E0E;
111
+ }
112
+ .sqd-theme-dark .sqd-label-text {
113
+ fill: #FFF;
114
+ }
115
+
116
+ /* dark > .sqd-root-start-stop */
117
+
118
+ .sqd-theme-dark .sqd-root-start-stop-circle {
119
+ fill: #2C18DF;
120
+ }
121
+ .sqd-theme-dark .sqd-root-start-stop-icon {
122
+ fill: #FFF;
123
+ }
124
+
125
+ /* dark > .sqd-placeholder */
126
+
127
+ .sqd-theme-dark .sqd-placeholder .sqd-placeholder-rect {
128
+ fill: #0E0E0E;
129
+ stroke: #6A6A6A;
130
+ }
131
+ .sqd-theme-dark .sqd-placeholder-icon-path {
132
+ fill: #FFF;
133
+ }
134
+ .sqd-theme-dark .sqd-placeholder.sqd-hover .sqd-placeholder-rect {
135
+ fill: #ED4800;
136
+ }
137
+ .sqd-theme-dark .sqd-placeholder.sqd-hover .sqd-placeholder-icon-path {
138
+ fill: #FFF;
139
+ }
140
+
141
+ /* dark > .sqd-validation-error */
142
+
143
+ .sqd-theme-dark .sqd-validation-error {
144
+ fill: #FFA200;
145
+ }
146
+ .sqd-theme-dark .sqd-validation-error-icon-path {
147
+ fill: #000;
148
+ }
@@ -0,0 +1,148 @@
1
+
2
+ /********* light *********/
3
+
4
+ .sqd-theme-light.sqd-designer {
5
+ background: #F9F9F9;
6
+ }
7
+
8
+ /* light > .sqd-toolbox */
9
+
10
+ .sqd-theme-light .sqd-toolbox {
11
+ background: #FFF;
12
+ box-shadow: 0 0 8px rgba(0, 0, 0, .15), 0 2px 4px rgba(0, 0, 0, .15);
13
+ }
14
+ .sqd-theme-light .sqd-toolbox-filter {
15
+ border: 1px solid #C3C3C3;
16
+ }
17
+ .sqd-theme-light .sqd-toolbox-filter:focus {
18
+ border-color: #939393;
19
+ }
20
+ .sqd-theme-light .sqd-toolbox-group-title {
21
+ background: #E5E5E5;
22
+ }
23
+ .sqd-theme-light .sqd-toolbox-item {
24
+ border: 1px solid #C3C3C3;
25
+ box-shadow: 0 2px 2px rgba(0, 0, 0, .15);
26
+ }
27
+ .sqd-theme-light .sqd-toolbox-item:hover {
28
+ border: 1px solid #939393;
29
+ }
30
+ .sqd-theme-light .sqd-toolbox-item-icon.sqd-no-icon {
31
+ background: #C6C6C6;
32
+ }
33
+
34
+ /* light > .sqd-control-bar */
35
+
36
+ .sqd-theme-light .sqd-control-bar {
37
+ background: #FFF;
38
+ box-shadow: 0 0 8px rgba(0, 0, 0, .15), 0 2px 4px rgba(0, 0, 0, .15);
39
+ }
40
+ .sqd-theme-light .sqd-control-bar-button {
41
+ border: 1px solid #C3C3C3;
42
+ }
43
+ .sqd-theme-light .sqd-control-bar-button:hover {
44
+ border-color: #939393;
45
+ }
46
+ .sqd-theme-light .sqd-control-bar-button.sqd-delete .sqd-icon-path {
47
+ fill: #E01A24;
48
+ }
49
+
50
+ /* light > .sqd-workspace */
51
+
52
+ .sqd-theme-light .sqd-grid-path {
53
+ stroke: #E3E3E3;
54
+ }
55
+ .sqd-theme-light .sqd-join {
56
+ stroke: #000;
57
+ }
58
+
59
+ /* light > .sqd-smart-editor */
60
+
61
+ .sqd-theme-light .sqd-smart-editor {
62
+ background: #FFF;
63
+ box-shadow: 0 0 8px rgba(0, 0, 0, .15);
64
+ }
65
+ .sqd-theme-light .sqd-smart-editor-toggle {
66
+ background: #FFF;
67
+ box-shadow: 0 0 8px rgba(0, 0, 0, .15);
68
+ }
69
+
70
+ /* light > .sqd-step-task */
71
+
72
+ .sqd-theme-light .sqd-step-task-rect {
73
+ fill: #FFF;
74
+ stroke: #C3C3C3;
75
+ filter: drop-shadow(0 1.5px 1.5px rgba(0, 0, 0, .15));
76
+ }
77
+ .sqd-theme-light .sqd-step-task-rect.sqd-selected {
78
+ stroke: #ED4800;
79
+ }
80
+ .sqd-theme-light .sqd-step-task-text {
81
+ fill: #000;
82
+ }
83
+ .sqd-theme-light .sqd-step-task-empty-icon {
84
+ fill: #C6C6C6;
85
+ }
86
+
87
+ /* light > .sqd-input + .sqd-output */
88
+
89
+ .sqd-theme-light .sqd-input {
90
+ fill: #FFF;
91
+ stroke: #000;
92
+ }
93
+
94
+ .sqd-theme-light .sqd-output {
95
+ fill: #000;
96
+ }
97
+
98
+ /* light > .sqd-region */
99
+
100
+ .sqd-theme-light .sqd-region {
101
+ stroke: #CECECE;
102
+ }
103
+ .sqd-theme-light .sqd-region.sqd-selected {
104
+ stroke: #ED4800;
105
+ }
106
+ .sqd-theme-light .sqd-label-rect {
107
+ fill: #2411DB;
108
+ }
109
+ .sqd-theme-light .sqd-label-rect.sqd-label-secondary {
110
+ fill: #000;
111
+ }
112
+ .sqd-theme-light .sqd-label-text {
113
+ fill: #FFF;
114
+ }
115
+
116
+ /* light > .sqd-root-start-stop */
117
+
118
+ .sqd-theme-light .sqd-root-start-stop-circle {
119
+ fill: #2C18DF;
120
+ }
121
+ .sqd-theme-light .sqd-root-start-stop-icon {
122
+ fill: #FFF;
123
+ }
124
+
125
+ /* light > .sqd-placeholder */
126
+
127
+ .sqd-theme-light .sqd-placeholder .sqd-placeholder-rect {
128
+ fill: #D8D8D8;
129
+ stroke: #6A6A6A;
130
+ }
131
+ .sqd-theme-light .sqd-placeholder-icon-path {
132
+ fill: #2B2B2B;
133
+ }
134
+ .sqd-theme-light .sqd-placeholder.sqd-hover .sqd-placeholder-rect {
135
+ fill: #ED4800;
136
+ }
137
+ .sqd-theme-light .sqd-placeholder.sqd-hover .sqd-placeholder-icon-path {
138
+ fill: #FFF;
139
+ }
140
+
141
+ /* light > .sqd-validation-error */
142
+
143
+ .sqd-theme-light .sqd-validation-error {
144
+ fill: #FFA200;
145
+ }
146
+ .sqd-theme-light .sqd-validation-error-icon-path {
147
+ fill: #000;
148
+ }