Skip to content

Commit 1001a02

Browse files
authored
0.24.2. (#163)
1 parent c3b402b commit 1001a02

19 files changed

+60
-46
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 0.24.2
2+
3+
This version reverts the changes introduced in version 0.24.1. To modify the DOM attachment check, you should now pass the `documentBody` property in the configuration, which should reference the document's body element.
4+
15
# 0.24.1
26

37
This version allows to disable the DOM attachment check.

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ Add the below code to your head section in HTML document.
103103
```html
104104
<head>
105105
...
106-
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.24.1/css/designer.css" rel="stylesheet">
107-
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.24.1/css/designer-light.css" rel="stylesheet">
108-
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.24.1/css/designer-dark.css" rel="stylesheet">
109-
<script src="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.24.1/dist/index.umd.js"></script>
106+
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.24.2/css/designer.css" rel="stylesheet">
107+
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.24.2/css/designer-light.css" rel="stylesheet">
108+
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.24.2/css/designer-dark.css" rel="stylesheet">
109+
<script src="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.24.2/dist/index.umd.js"></script>
110110
```
111111

112112
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.24.1",
4+
"version": "0.24.2",
55
"author": {
66
"name": "NoCode JS",
77
"url": "https://nocode-js.com/"
@@ -15,7 +15,7 @@
1515
"peerDependencies": {
1616
"@angular/common": "12 - 18",
1717
"@angular/core": "12 - 18",
18-
"sequential-workflow-designer": "^0.24.1"
18+
"sequential-workflow-designer": "^0.24.2"
1919
},
2020
"dependencies": {
2121
"tslib": "^2.3.0"

demos/angular-app/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
"@angular/platform-browser-dynamic": "^17.3.9",
2727
"@angular/router": "^17.3.9",
2828
"rxjs": "~7.8.0",
29-
"sequential-workflow-designer": "^0.24.1",
30-
"sequential-workflow-designer-angular": "^0.24.1",
29+
"sequential-workflow-designer": "^0.24.2",
30+
"sequential-workflow-designer-angular": "^0.24.2",
3131
"tslib": "^2.3.0",
3232
"zone.js": "~0.14.6"
3333
},

demos/angular-app/yarn.lock

+8-8
Original file line numberDiff line numberDiff line change
@@ -6744,17 +6744,17 @@ send@0.18.0:
67446744
range-parser "~1.2.1"
67456745
statuses "2.0.1"
67466746

6747-
sequential-workflow-designer-angular@^0.24.1:
6748-
version "0.24.1"
6749-
resolved "https://registry.yarnpkg.com/sequential-workflow-designer-angular/-/sequential-workflow-designer-angular-0.24.1.tgz#09b6b943057a338ca31393fef41f4fba684938b0"
6750-
integrity sha512-B72m3jCcl/ZTHjXPuF/BAP37dgfvw91JzD0LeKZUDcEsvDOfH1lVCjvZD1JWlplQhLsYHTZohmg698lgRjdY9A==
6747+
sequential-workflow-designer-angular@^0.24.2:
6748+
version "0.24.2"
6749+
resolved "https://registry.yarnpkg.com/sequential-workflow-designer-angular/-/sequential-workflow-designer-angular-0.24.2.tgz#def1c1ed8bf58942653be1dd4a5e8d5eb8e77cb5"
6750+
integrity sha512-o3oi6ogatAm53Drn44IoupcQHxgi2e3/8tf22J2AyOrFrIvzGbxVyZMKF2t99zYBDjmJkQ7p2jp58kwk0e363Q==
67516751
dependencies:
67526752
tslib "^2.3.0"
67536753

6754-
sequential-workflow-designer@^0.24.1:
6755-
version "0.24.1"
6756-
resolved "https://registry.yarnpkg.com/sequential-workflow-designer/-/sequential-workflow-designer-0.24.1.tgz#d5e60c518589a655fda308068e3bae47341f958b"
6757-
integrity sha512-BNeIN0RWwObaSnlAGm2IpqPb/NpvtLyy2Ft2arRuQ2PO8a4RkU6Wu0G7mx1i6NLNoN2xJOf+4PsTDFeOk/k2ww==
6754+
sequential-workflow-designer@^0.24.2:
6755+
version "0.24.2"
6756+
resolved "https://registry.yarnpkg.com/sequential-workflow-designer/-/sequential-workflow-designer-0.24.2.tgz#628b3d1e317c0a40b9b4c7c3b1b2703e17b3b741"
6757+
integrity sha512-dfnf23keTXvXlAq0XBNbOi2pyrJXKB4j41IPIV0UpFEbKZ54QkxPq4UYubA/TWGjSgIOG+jnrZuNrEzs61UVRw==
67586758
dependencies:
67596759
sequential-workflow-model "^0.2.0"
67606760

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.24.1",
10-
"sequential-workflow-designer-react": "^0.24.1"
9+
"sequential-workflow-designer": "^0.24.2",
10+
"sequential-workflow-designer-react": "^0.24.2"
1111
},
1212
"devDependencies": {
1313
"@types/jest": "^29.2.5",

demos/svelte-app/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
"eslint": "eslint ./src --ext .ts"
1717
},
1818
"dependencies": {
19-
"sequential-workflow-designer": "^0.24.1",
20-
"sequential-workflow-designer-svelte": "^0.24.1"
19+
"sequential-workflow-designer": "^0.24.2",
20+
"sequential-workflow-designer-svelte": "^0.24.2"
2121
},
2222
"devDependencies": {
2323
"@sveltejs/adapter-static": "^2.0.3",

designer/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "sequential-workflow-designer",
33
"description": "Customizable no-code component for building flow-based programming applications.",
4-
"version": "0.24.1",
4+
"version": "0.24.2",
55
"type": "module",
66
"main": "./lib/esm/index.js",
77
"types": "./lib/index.d.ts",

designer/src/behaviors/drag-step-behavior-view.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,17 @@ export class DragStepView {
99
const layer = Dom.element('div', {
1010
class: `sqd-drag sqd-theme-${theme}`
1111
});
12-
document.body.appendChild(layer);
12+
componentContext.documentBody.appendChild(layer);
1313

1414
const component = componentContext.services.draggedComponent.create(layer, step, componentContext);
1515

16-
return new DragStepView(component, layer);
16+
return new DragStepView(component, layer, componentContext.documentBody);
1717
}
1818

1919
private constructor(
2020
public readonly component: DraggedComponent,
21-
private readonly layer: HTMLElement
21+
private readonly layer: HTMLElement,
22+
private readonly documentBody: Node
2223
) {}
2324

2425
public setPosition(position: Vector) {
@@ -28,6 +29,6 @@ export class DragStepView {
2829

2930
public remove() {
3031
this.component.destroy();
31-
document.body.removeChild(this.layer);
32+
this.documentBody.removeChild(this.layer);
3233
}
3334
}

designer/src/component-context.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ export class ComponentContext {
1717
preferenceStorage: PreferenceStorage,
1818
placeholderController: PlaceholderController,
1919
i18n: I18n,
20-
services: Services
20+
services: Services,
21+
documentBody: Node
2122
): ComponentContext {
2223
const validator = new DefinitionValidator(configuration.validator, state);
2324
const iconProvider = new IconProvider(configuration.steps);
@@ -30,7 +31,8 @@ export class ComponentContext {
3031
definitionWalker,
3132
services,
3233
preferenceStorage,
33-
i18n
34+
i18n,
35+
documentBody
3436
);
3537
}
3638

@@ -42,6 +44,7 @@ export class ComponentContext {
4244
public readonly definitionWalker: DefinitionWalker,
4345
public readonly services: Services,
4446
public readonly preferenceStorage: PreferenceStorage,
45-
public readonly i18n: I18n
47+
public readonly i18n: I18n,
48+
public readonly documentBody: Node
4649
) {}
4750
}
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
import { isElementAttached } from './is-element-attached';
22

33
describe('isElementAttached', () => {
4+
const documentBody = document.body;
5+
46
it('returns true if attached', () => {
57
const element = document.createElement('h2');
68

79
document.body.appendChild(element);
810

9-
expect(isElementAttached(element)).toBe(true);
11+
expect(isElementAttached(element, documentBody)).toBe(true);
1012

1113
document.body.removeChild(element);
1214
});
1315

1416
it('returns false if not attached', () => {
1517
const element = document.createElement('h2');
1618

17-
expect(isElementAttached(element)).toBe(false);
19+
expect(isElementAttached(element, documentBody)).toBe(false);
1820
});
1921
});
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export function isElementAttached(element: HTMLElement): boolean {
2-
return !(document.compareDocumentPosition(element) & Node.DOCUMENT_POSITION_DISCONNECTED);
1+
export function isElementAttached(element: HTMLElement, documentBody: Node): boolean {
2+
return !(documentBody.compareDocumentPosition(element) & Node.DOCUMENT_POSITION_DISCONNECTED);
33
}

designer/src/designer-configuration.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ export interface DesignerConfiguration<TDefinition extends Definition = Definiti
8989
i18n?: I18n;
9090

9191
/**
92-
* @description By default, the designer checks if the placeholder is attached to the DOM. This flag may disable this check.
92+
* @description The body of the document. By default, the designer will use the `document.body`.
9393
*/
94-
disableDomAttachmentCheck?: boolean;
94+
documentBody?: Node;
9595
}
9696

9797
export type UidGenerator = () => string;

designer/src/designer-context.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ export class DesignerContext {
1919
parent: HTMLElement,
2020
startDefinition: Definition,
2121
configuration: DesignerConfiguration,
22-
services: Services
22+
services: Services,
23+
documentBody: Node
2324
): DesignerContext {
2425
const definition = ObjectCloner.deepClone(startDefinition);
2526

@@ -54,7 +55,8 @@ export class DesignerContext {
5455
preferenceStorage,
5556
placeholderController,
5657
i18n,
57-
services
58+
services,
59+
documentBody
5860
);
5961

6062
return new DesignerContext(

designer/src/designer.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,13 @@ export class Designer<TDefinition extends Definition = Definition> {
3636
const config = configuration as DesignerConfiguration;
3737
validateConfiguration(config);
3838

39-
if (!config.disableDomAttachmentCheck && !isElementAttached(placeholder)) {
39+
const documentBody = configuration.documentBody ?? document.body;
40+
if (!isElementAttached(placeholder, documentBody)) {
4041
throw new Error('Placeholder is not attached to the DOM');
4142
}
4243

4344
const services = ServicesResolver.resolve(configuration.extensions, config);
44-
const designerContext = DesignerContext.create(placeholder, startDefinition, config, services);
45+
const designerContext = DesignerContext.create(placeholder, startDefinition, config, services, documentBody);
4546
const designerApi = DesignerApi.create(designerContext);
4647

4748
const view = DesignerView.create(placeholder, designerContext, designerApi);

designer/src/test-tools/stubs.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ export function createDesignerContextStub(): DesignerContext {
4848
const parent = document.createElement('div');
4949
const configuration = createDesignerConfigurationStub();
5050
const services = ServicesResolver.resolve([], configuration);
51-
return DesignerContext.create(parent, createDefinitionStub(), createDesignerConfigurationStub(), services);
51+
const documentBody = document.body;
52+
return DesignerContext.create(parent, createDefinitionStub(), createDesignerConfigurationStub(), services, documentBody);
5253
}
5354

5455
export function createComponentContextStub(): ComponentContext {

examples/assets/lib.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function embedStylesheet(url) {
1313
document.write(`<link href="${url}" rel="stylesheet">`);
1414
}
1515

16-
const baseUrl = isTestEnv() ? '../designer' : '//cdn.jsdelivr.net/npm/sequential-workflow-designer@0.24.1';
16+
const baseUrl = isTestEnv() ? '../designer' : '//cdn.jsdelivr.net/npm/sequential-workflow-designer@0.24.2';
1717

1818
embedScript(`${baseUrl}/dist/index.umd.js`);
1919
embedStylesheet(`${baseUrl}/css/designer.css`);

react/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "sequential-workflow-designer-react",
33
"description": "React wrapper for Sequential Workflow Designer component.",
4-
"version": "0.24.1",
4+
"version": "0.24.2",
55
"type": "module",
66
"main": "./lib/esm/index.js",
77
"types": "./lib/index.d.ts",
@@ -47,7 +47,7 @@
4747
"peerDependencies": {
4848
"react": "^18.2.0",
4949
"react-dom": "^18.2.0",
50-
"sequential-workflow-designer": "^0.24.1"
50+
"sequential-workflow-designer": "^0.24.2"
5151
},
5252
"devDependencies": {
5353
"@rollup/plugin-node-resolve": "^15.0.1",
@@ -63,7 +63,7 @@
6363
"prettier": "^3.2.5",
6464
"react": "^18.2.0",
6565
"react-dom": "^18.2.0",
66-
"sequential-workflow-designer": "^0.24.1",
66+
"sequential-workflow-designer": "^0.24.2",
6767
"rollup": "^3.18.0",
6868
"rollup-plugin-dts": "^5.2.0",
6969
"rollup-plugin-typescript2": "^0.34.1",

svelte/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "sequential-workflow-designer-svelte",
33
"description": "Svelte wrapper for Sequential Workflow Designer component.",
4-
"version": "0.24.1",
4+
"version": "0.24.2",
55
"license": "MIT",
66
"scripts": {
77
"prepare": "cp ../LICENSE LICENSE",
@@ -28,10 +28,10 @@
2828
],
2929
"peerDependencies": {
3030
"svelte": "^4.0.0",
31-
"sequential-workflow-designer": "^0.24.1"
31+
"sequential-workflow-designer": "^0.24.2"
3232
},
3333
"devDependencies": {
34-
"sequential-workflow-designer": "^0.24.1",
34+
"sequential-workflow-designer": "^0.24.2",
3535
"@sveltejs/adapter-static": "^2.0.3",
3636
"@sveltejs/kit": "^1.20.4",
3737
"@sveltejs/package": "^2.0.0",

0 commit comments

Comments
 (0)