Skip to content

Commit 7f021a0

Browse files
authored
0.16.6. (#94)
* 0.16.6.
1 parent 1a67a7f commit 7f021a0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1422
-28
lines changed

.github/workflows/examples.yml

+2
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,13 @@ jobs:
3333
cp -R examples _deploy
3434
cp -R demos/angular-app/dist/angular-app _deploy/angular-app
3535
cp -R demos/react-app/build _deploy/react-app
36+
cp -R demos/svelte-app/build _deploy/svelte-app
3637
- name: Append Analytics
3738
run: |
3839
node scripts/append-ga.cjs _deploy/examples
3940
node scripts/append-ga.cjs _deploy/react-app
4041
node scripts/append-ga.cjs _deploy/angular-app
42+
node scripts/append-ga.cjs _deploy/svelte-app
4143
- name: Upload artifact
4244
uses: actions/upload-pages-artifact@v1
4345
with:

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ build/
33
node_modules/
44
coverage/
55
.vscode/
6-
lib/
76
dist/
87
yarn-*.log
98
designer/css/*.css

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.16.6
2+
3+
This version introduces a wrapper for Svelte framework! 🎉
4+
15
## 0.16.5
26

37
This version fixes the bug with scrolling in the toolbox [#92](https://github.com/nocode-js/sequential-workflow-designer/issues/92).

README.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Features:
1313
* use light/dark themes or customize easily,
1414
* compatible with modern browsers and mobile devices,
1515
* the definition is stored as JSON,
16-
* supports [React](./react/) and [Angular](./angular/designer/).
16+
* supports [Angular](./angular/designer/), [React](./react/) and [Svelte](./svelte/).
1717

1818
📝 Check the [documentation](https://nocode-js.com/docs/category/sequential-workflow-designer) for more details.
1919

@@ -33,8 +33,9 @@ Features:
3333
* [📜 Scrollable Page](https://nocode-js.github.io/sequential-workflow-designer/examples/scrollable-page.html)
3434
* [🌵 Multi-Conditional Switch](https://nocode-js.github.io/sequential-workflow-designer/examples/multi-conditional-switch.html)
3535
* [🌀 Auto-Select](https://nocode-js.github.io/sequential-workflow-designer/examples/auto-select.html)
36-
* [React Demo](https://nocode-js.github.io/sequential-workflow-designer/react-app/)
3736
* [Angular Demo](https://nocode-js.github.io/sequential-workflow-designer/angular-app/)
37+
* [React Demo](https://nocode-js.github.io/sequential-workflow-designer/react-app/)
38+
* [Svelte Demo](https://nocode-js.github.io/sequential-workflow-designer/svelte-app/)
3839

3940
Pro:
4041

@@ -95,10 +96,10 @@ Add the below code to your head section in HTML document.
9596
```html
9697
<head>
9798
...
98-
<link href="https://cdn.jsdelivr.net/npm/[email protected].5/css/designer.css" rel="stylesheet">
99-
<link href="https://cdn.jsdelivr.net/npm/[email protected].5/css/designer-light.css" rel="stylesheet">
100-
<link href="https://cdn.jsdelivr.net/npm/[email protected].5/css/designer-dark.css" rel="stylesheet">
101-
<script src="https://cdn.jsdelivr.net/npm/[email protected].5/dist/index.umd.js"></script>
99+
<link href="https://cdn.jsdelivr.net/npm/[email protected].6/css/designer.css" rel="stylesheet">
100+
<link href="https://cdn.jsdelivr.net/npm/[email protected].6/css/designer-light.css" rel="stylesheet">
101+
<link href="https://cdn.jsdelivr.net/npm/[email protected].6/css/designer-dark.css" rel="stylesheet">
102+
<script src="https://cdn.jsdelivr.net/npm/[email protected].6/dist/index.umd.js"></script>
102103
```
103104

104105
Call the designer by:

angular/designer/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "sequential-workflow-designer-angular",
33
"description": "Angular wrapper for Sequential Workflow Designer component.",
4-
"version": "0.16.5",
4+
"version": "0.16.6",
55
"author": {
66
"name": "NoCode JS",
77
"url": "https://nocode-js.com/"
@@ -15,7 +15,7 @@
1515
"peerDependencies": {
1616
"@angular/common": "12 - 16",
1717
"@angular/core": "12 - 16",
18-
"sequential-workflow-designer": "^0.16.5"
18+
"sequential-workflow-designer": "^0.16.6"
1919
},
2020
"dependencies": {
2121
"tslib": "^2.3.0"

demos/angular-app/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
"@angular/platform-browser-dynamic": "^15.2.9",
2727
"@angular/router": "^15.2.9",
2828
"rxjs": "~7.8.0",
29-
"sequential-workflow-designer": "^0.16.5",
30-
"sequential-workflow-designer-angular": "^0.16.5",
29+
"sequential-workflow-designer": "^0.16.6",
30+
"sequential-workflow-designer-angular": "^0.16.6",
3131
"tslib": "^2.3.0",
3232
"zone.js": "~0.13.0"
3333
},
@@ -42,7 +42,7 @@
4242
"karma-coverage": "~2.2.0",
4343
"karma-jasmine": "~5.1.0",
4444
"karma-jasmine-html-reporter": "~2.0.0",
45-
"prettier": "^2.8.4",
45+
"prettier": "^2.8.2",
4646
"typescript": "~4.9.5"
4747
}
4848
}

demos/react-app/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"dependencies": {
77
"react": "^18.2.0",
88
"react-dom": "^18.2.0",
9-
"sequential-workflow-designer": "^0.16.5",
10-
"sequential-workflow-designer-react": "^0.16.5"
9+
"sequential-workflow-designer": "^0.16.6",
10+
"sequential-workflow-designer-react": "^0.16.6"
1111
},
1212
"devDependencies": {
1313
"@types/jest": "^29.2.5",

demos/svelte-app/.gitignore

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.DS_Store
2+
node_modules
3+
/build
4+
/.svelte-kit
5+
/package
6+
.env
7+
.env.*
8+
!.env.example
9+
vite.config.js.timestamp-*
10+
vite.config.ts.timestamp-*

demos/svelte-app/README.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Demo of Sequential Workflow Designer for Svelte
2+
3+
This project contains a simple demo of using the `sequential-workflow-designer-svelte` package.
4+
5+
## 🚀 How to Run?
6+
7+
1. Clone this repository.
8+
2. Install dependencies: `yarn install`
9+
3. Run the project: `yarn start`

demos/svelte-app/package.json

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "sequential-workflow-designer-svelte-app-demo",
3+
"version": "0.0.0",
4+
"license": "MIT",
5+
"type": "module",
6+
"private": true,
7+
"scripts": {
8+
"start": "svelte-kit sync && vite dev",
9+
"build": "svelte-kit sync && vite build",
10+
"preview": "vite preview",
11+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
12+
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
13+
"test:single": "echo \"No tests yet\"",
14+
"prettier": "prettier --check ./src",
15+
"prettier:fix": "prettier --write ./src",
16+
"eslint": "eslint ./src --ext .ts"
17+
},
18+
"dependencies": {
19+
"sequential-workflow-designer": "^0.16.6",
20+
"sequential-workflow-designer-svelte": "^0.16.6"
21+
},
22+
"devDependencies": {
23+
"@sveltejs/adapter-static": "^2.0.3",
24+
"@sveltejs/kit": "^1.20.4",
25+
"svelte": "^4.0.5",
26+
"svelte-check": "^3.4.3",
27+
"tslib": "^2.4.1",
28+
"typescript": "^5.0.0",
29+
"vite": "^4.4.2",
30+
"prettier": "^2.8.2",
31+
"@typescript-eslint/eslint-plugin": "^5.47.0",
32+
"@typescript-eslint/parser": "^5.47.0",
33+
"eslint": "^8.30.0"
34+
}
35+
}

demos/svelte-app/src/app.d.ts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// See https://kit.svelte.dev/docs/types#app
2+
// for information about these interfaces
3+
declare global {
4+
namespace App {
5+
// interface Error {}
6+
// interface Locals {}
7+
// interface PageData {}
8+
// interface Platform {}
9+
}
10+
}
11+
12+
export {};

demos/svelte-app/src/app.html

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="icon" href="%sveltekit.assets%/favicon.ico" />
6+
<meta name="viewport" content="width=device-width" />
7+
<title>🍁 Sequential Workflow Designer for Svelte</title>
8+
%sveltekit.head%
9+
</head>
10+
<body data-sveltekit-preload-data="hover">
11+
<div style="display: contents">%sveltekit.body%</div>
12+
</body>
13+
</html>
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const prerender = true;
+122
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
<script lang="ts">
2+
import type { Definition, StepsConfiguration, ToolboxConfiguration, ValidatorConfiguration } from 'sequential-workflow-designer';
3+
import { SequentialWorkflowDesigner } from 'sequential-workflow-designer-svelte';
4+
import StepEditor from './step-editor.svelte';
5+
import RootEditor from './root-editor.svelte';
6+
import './style.css';
7+
8+
let definition = createDefinition();
9+
let isReadonly = false;
10+
let isToolboxCollapsed = false;
11+
let isEditorCollapsed = false;
12+
let selectedStepId: string | null = null;
13+
let isValid: boolean | null = null;
14+
const steps: StepsConfiguration = {};
15+
const validator: ValidatorConfiguration = {
16+
step: (step) => step.name.length > 0
17+
};
18+
const toolbox: ToolboxConfiguration = {
19+
groups: [
20+
{
21+
name: 'Steps',
22+
steps: [createStep()]
23+
}
24+
]
25+
};
26+
27+
function randId() {
28+
return Math.round((Math.random() * 1000000)).toString(16);
29+
}
30+
31+
function createStep() {
32+
return {
33+
id: randId(),
34+
type: 'step',
35+
name: 'test',
36+
componentType: 'task',
37+
properties: {
38+
comment: 'Some comment'
39+
}
40+
}
41+
}
42+
43+
function createDefinition(): Definition {
44+
return {
45+
properties: {
46+
velocity: 20
47+
},
48+
sequence: [
49+
createStep(),
50+
createStep()
51+
]
52+
};
53+
}
54+
55+
function onDefinitionChanged({ detail }: { detail: { definition: Definition, isValid: boolean } }) {
56+
definition = detail.definition;
57+
isValid = detail.isValid;
58+
}
59+
60+
function onSelectedStepIdChanged({ detail }: { detail: { stepId: string | null } }) {
61+
selectedStepId = detail.stepId;
62+
}
63+
64+
function toggleReadonly() {
65+
isReadonly = !isReadonly;
66+
}
67+
68+
function toggleSelection() {
69+
if (selectedStepId) {
70+
selectedStepId = null;
71+
} else if (definition.sequence.length > 0) {
72+
selectedStepId = definition.sequence[0].id;
73+
}
74+
}
75+
76+
function toggleEditor() {
77+
isEditorCollapsed = !isEditorCollapsed;
78+
}
79+
80+
function toggleToolbox() {
81+
isToolboxCollapsed = !isToolboxCollapsed;
82+
}
83+
84+
function resetDefinition() {
85+
definition = createDefinition();
86+
}
87+
</script>
88+
89+
<SequentialWorkflowDesigner
90+
definition={definition}
91+
on:definitionChanged={onDefinitionChanged}
92+
steps={steps}
93+
validator={validator}
94+
toolbox={toolbox}
95+
stepEditor={StepEditor}
96+
rootEditor={RootEditor}
97+
selectedStepId={selectedStepId}
98+
on:selectedStepIdChanged={onSelectedStepIdChanged}
99+
isToolboxCollapsed={isToolboxCollapsed}
100+
isEditorCollapsed={isEditorCollapsed}
101+
isReadonly={isReadonly} />
102+
103+
<div class="block">
104+
<button on:click={toggleReadonly}>Toggle readonly</button>
105+
106+
<button on:click={toggleSelection}>Toggle selection</button>
107+
108+
<button on:click={resetDefinition}>Reset definition</button>
109+
110+
<button on:click={toggleEditor}>Toggle editor</button>
111+
112+
<button on:click={toggleToolbox}>Toggle toolbox</button>
113+
</div>
114+
115+
<div class="block">
116+
Is valid: <strong>{isValid}</strong> &nbsp;
117+
Selected step: <strong>{selectedStepId}</strong>
118+
</div>
119+
120+
<div class="block">
121+
This demo uses Svelte and <a href="https://github.com/nocode-js/sequential-workflow-designer/tree/main/svelte">Sequential Workflow Designer for Svelte</a>.
122+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<script lang="ts">
2+
import type { GlobalEditorContext, Definition } from 'sequential-workflow-designer';
3+
4+
export let context: GlobalEditorContext;
5+
export let definition: Definition;
6+
7+
let velocity = definition.properties.velocity;
8+
9+
$: {
10+
console.log('Changed', { velocity });
11+
}
12+
13+
function onVelocityChanged(event: Event) {
14+
velocity = parseInt((event.target as HTMLInputElement).value);
15+
definition.properties.velocity = velocity;
16+
context.notifyPropertiesChanged();
17+
}
18+
</script>
19+
20+
<h2>Root Editor</h2>
21+
22+
<h3>Velocity</h3>
23+
24+
<input type="number" value={String(velocity)} on:input={onVelocityChanged} />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<script lang="ts">
2+
import type { StepEditorContext, Definition, Step } from 'sequential-workflow-designer';
3+
4+
export let context: StepEditorContext;
5+
export let definition: Definition;
6+
export let step: Step;
7+
8+
let name = step.name;
9+
let comment = step.properties.comment;
10+
11+
$: {
12+
console.log('Changed', { definition, name, comment });
13+
}
14+
15+
function onNameChanged(event: Event) {
16+
name = (event.target as HTMLInputElement).value;
17+
step.name = name;
18+
context.notifyNameChanged();
19+
}
20+
21+
function onCommentChanged(event: Event) {
22+
comment = (event.target as HTMLInputElement).value;
23+
step.properties.comment = comment;
24+
context.notifyPropertiesChanged();
25+
}
26+
</script>
27+
28+
<h2>Step Editor {step.type}</h2>
29+
30+
<h3>Name</h3>
31+
32+
<input value={name} on:input={onNameChanged} />
33+
34+
<h3>Comment</h3>
35+
36+
<input value={comment} on:input={onCommentChanged} />

0 commit comments

Comments
 (0)