Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.24.6. #167

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.24.6

Fixed a bug where the designer remained in an invalid state when rendered inside a placeholder with a width or height of 0px.

# 0.24.5

Fixed another bug with event handling when the designer is placed in a shadow DOM.
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ Add the below code to your head section in HTML document.
```html
<head>
...
<link href="https://cdn.jsdelivr.net/npm/[email protected].5/css/designer.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/[email protected].5/css/designer-light.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/[email protected].5/css/designer-dark.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/[email protected].5/dist/index.umd.js"></script>
<link href="https://cdn.jsdelivr.net/npm/[email protected].6/css/designer.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/[email protected].6/css/designer-light.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/[email protected].6/css/designer-dark.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/[email protected].6/dist/index.umd.js"></script>
```

Call the designer by:
Expand Down
4 changes: 2 additions & 2 deletions angular/designer/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "sequential-workflow-designer-angular",
"description": "Angular wrapper for Sequential Workflow Designer component.",
"version": "0.24.5",
"version": "0.24.6",
"author": {
"name": "NoCode JS",
"url": "https://nocode-js.com/"
Expand All @@ -15,7 +15,7 @@
"peerDependencies": {
"@angular/common": "12 - 18",
"@angular/core": "12 - 18",
"sequential-workflow-designer": "^0.24.5"
"sequential-workflow-designer": "^0.24.6"
},
"dependencies": {
"tslib": "^2.3.0"
Expand Down
4 changes: 2 additions & 2 deletions demos/angular-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"@angular/platform-browser-dynamic": "^17.3.9",
"@angular/router": "^17.3.9",
"rxjs": "~7.8.0",
"sequential-workflow-designer": "^0.24.5",
"sequential-workflow-designer-angular": "^0.24.5",
"sequential-workflow-designer": "^0.24.6",
"sequential-workflow-designer-angular": "^0.24.6",
"tslib": "^2.3.0",
"zone.js": "~0.14.6"
},
Expand Down
16 changes: 8 additions & 8 deletions demos/angular-app/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6744,17 +6744,17 @@ [email protected]:
range-parser "~1.2.1"
statuses "2.0.1"

sequential-workflow-designer-angular@^0.24.4:
version "0.24.4"
resolved "https://registry.yarnpkg.com/sequential-workflow-designer-angular/-/sequential-workflow-designer-angular-0.24.4.tgz#50842a31c9ac5c6d45733ba5ffd0704dda4cfe9a"
integrity sha512-kiIhcoOzpaRNGK4ii1rotZHu49/zosdTodD71mQRXIqDNbpqVHMS4CktWwEWdQ13LIsSQxEbfMnpZJJ5+eIW3w==
sequential-workflow-designer-angular@^0.24.6:
version "0.24.6"
resolved "https://registry.yarnpkg.com/sequential-workflow-designer-angular/-/sequential-workflow-designer-angular-0.24.6.tgz#342e7b3aa75b5bd021ddd3fa8b7271001f2b14ac"
integrity sha512-USyB8FXHEIZ6IXBzHe31jPovMtfqjHCsAhOeWQ6qAZCjVVRe1ymCIdAoixVK7TvKONursMqlcGoQ2O+iAdMABw==
dependencies:
tslib "^2.3.0"

sequential-workflow-designer@^0.24.4:
version "0.24.4"
resolved "https://registry.yarnpkg.com/sequential-workflow-designer/-/sequential-workflow-designer-0.24.4.tgz#68db6ec198ec7941a5e87994156f15ec91e83cc5"
integrity sha512-fIdZDT6nozMAuIXvJ6uOVVy4h9XA+DMTfIO63bM6+vi/5BmQlxyUJ+4uVFKOiHJ7Tx5MQI8eBchcWDtknBA8nQ==
sequential-workflow-designer@^0.24.6:
version "0.24.6"
resolved "https://registry.yarnpkg.com/sequential-workflow-designer/-/sequential-workflow-designer-0.24.6.tgz#0be6112837177db19c2e5e69e15e5a827243097d"
integrity sha512-zjv60NrWKYZY8ZiL+PAG3DZK3lJX/cjBkgQ/IYElsk2rwHl6+srOFWSRKx2cEfHHNueTovNQLFVsFIWRvAtVNg==
dependencies:
sequential-workflow-model "^0.2.0"

Expand Down
4 changes: 2 additions & 2 deletions demos/react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"sequential-workflow-designer": "^0.24.5",
"sequential-workflow-designer-react": "^0.24.5"
"sequential-workflow-designer": "^0.24.6",
"sequential-workflow-designer-react": "^0.24.6"
},
"devDependencies": {
"@types/jest": "^29.2.5",
Expand Down
4 changes: 2 additions & 2 deletions demos/svelte-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"eslint": "eslint ./src --ext .ts"
},
"dependencies": {
"sequential-workflow-designer": "^0.24.5",
"sequential-workflow-designer-svelte": "^0.24.5"
"sequential-workflow-designer": "^0.24.6",
"sequential-workflow-designer-svelte": "^0.24.6"
},
"devDependencies": {
"@sveltejs/adapter-static": "^2.0.3",
Expand Down
2 changes: 1 addition & 1 deletion designer/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "sequential-workflow-designer",
"description": "Customizable no-code component for building flow-based programming applications.",
"version": "0.24.5",
"version": "0.24.6",
"type": "module",
"main": "./lib/esm/index.js",
"types": "./lib/index.d.ts",
Expand Down
7 changes: 7 additions & 0 deletions designer/src/designer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,13 @@ export class Designer<TDefinition extends Definition = Definition> {
this.state.setViewport(viewport);
}

/**
* @description Resets the viewport.
*/
public resetViewport() {
this.api.viewport.resetViewport();
}

/**
* @description Unselects the selected step.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,54 @@ import { CenteredViewportCalculator } from './centered-viewport-calculator';

describe('CenteredViewportCalculator', () => {
describe('center()', () => {
const c100x100 = new Vector(100, 100);
const v100x100 = new Vector(100, 100);

it('root component fills 100% of canvas (margin = 0)', () => {
const vp = CenteredViewportCalculator.center(0, c100x100, new Vector(100, 100));
const vp = CenteredViewportCalculator.center(0, v100x100, new Vector(100, 100));

expect(vp.position.x).toBe(0);
expect(vp.position.y).toBe(0);
expect(vp.scale).toBe(1);
});

it('root component fills 100% of canvas (margin = 20)', () => {
const vp = CenteredViewportCalculator.center(20, c100x100, new Vector(100, 100));
const vp = CenteredViewportCalculator.center(20, v100x100, new Vector(100, 100));

expect(vp.position.x).toBe(20);
expect(vp.position.y).toBe(20);
expect(vp.scale).toBe(0.6);
});

it('root component is smaller than canvas (margin = 20)', () => {
const vp = CenteredViewportCalculator.center(20, c100x100, new Vector(10, 20));
const vp = CenteredViewportCalculator.center(20, v100x100, new Vector(10, 20));

expect(vp.position.x).toBe(45);
expect(vp.position.y).toBe(40);
expect(vp.scale).toBe(1);
});

it('root component is bigger than canvas (margin = 20)', () => {
const vp = CenteredViewportCalculator.center(20, c100x100, new Vector(200, 200));
const vp = CenteredViewportCalculator.center(20, v100x100, new Vector(200, 200));

expect(vp.position.x).toBe(20);
expect(vp.position.y).toBe(20);
expect(vp.scale).toBe(0.3);
});

it('returns scale=1 when canvas size is 0x(1+)', () => {
const vp = CenteredViewportCalculator.center(20, new Vector(0, 100), v100x100);

expect(vp.position.x).toBe(0);
expect(vp.position.y).toBe(0);
expect(vp.scale).toBe(1);
});

it('returns scale=1 when canvas size is (1+)x0', () => {
const vp = CenteredViewportCalculator.center(20, new Vector(100, 0), v100x100);

expect(vp.position.x).toBe(0);
expect(vp.position.y).toBe(0);
expect(vp.scale).toBe(1);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ import { Viewport } from '../../designer-extension';

export class CenteredViewportCalculator {
public static center(margin: number, canvasSize: Vector, rootComponentSize: Vector): Viewport {
if (canvasSize.x === 0 || canvasSize.y === 0) {
return {
position: new Vector(0, 0),
scale: 1
};
}

const canvasSafeWidth = Math.max(canvasSize.x - margin * 2, 0);
const canvasSafeHeight = Math.max(canvasSize.y - margin * 2, 0);

Expand Down
2 changes: 1 addition & 1 deletion examples/assets/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function embedStylesheet(url) {
document.write(`<link href="${url}" rel="stylesheet">`);
}

const baseUrl = isTestEnv() ? '../designer' : '//cdn.jsdelivr.net/npm/[email protected].5';
const baseUrl = isTestEnv() ? '../designer' : '//cdn.jsdelivr.net/npm/[email protected].6';

embedScript(`${baseUrl}/dist/index.umd.js`);
embedStylesheet(`${baseUrl}/css/designer.css`);
Expand Down
6 changes: 3 additions & 3 deletions react/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "sequential-workflow-designer-react",
"description": "React wrapper for Sequential Workflow Designer component.",
"version": "0.24.5",
"version": "0.24.6",
"type": "module",
"main": "./lib/esm/index.js",
"types": "./lib/index.d.ts",
Expand Down Expand Up @@ -47,7 +47,7 @@
"peerDependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"sequential-workflow-designer": "^0.24.5"
"sequential-workflow-designer": "^0.24.6"
},
"devDependencies": {
"@rollup/plugin-node-resolve": "^15.0.1",
Expand All @@ -63,7 +63,7 @@
"prettier": "^3.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"sequential-workflow-designer": "^0.24.5",
"sequential-workflow-designer": "^0.24.6",
"rollup": "^3.18.0",
"rollup-plugin-dts": "^5.2.0",
"rollup-plugin-typescript2": "^0.34.1",
Expand Down
6 changes: 3 additions & 3 deletions svelte/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "sequential-workflow-designer-svelte",
"description": "Svelte wrapper for Sequential Workflow Designer component.",
"version": "0.24.5",
"version": "0.24.6",
"license": "MIT",
"scripts": {
"prepare": "cp ../LICENSE LICENSE",
Expand All @@ -28,10 +28,10 @@
],
"peerDependencies": {
"svelte": "^4.0.0",
"sequential-workflow-designer": "^0.24.5"
"sequential-workflow-designer": "^0.24.6"
},
"devDependencies": {
"sequential-workflow-designer": "^0.24.5",
"sequential-workflow-designer": "^0.24.6",
"@sveltejs/adapter-static": "^2.0.3",
"@sveltejs/kit": "^1.20.4",
"@sveltejs/package": "^2.0.0",
Expand Down
Loading