Skip to content

Commit

Permalink
0.24.3. (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
b4rtaz authored Sep 15, 2024
1 parent 1001a02 commit ad3b4b0
Show file tree
Hide file tree
Showing 17 changed files with 46 additions and 37 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.24.3

Fixed the placement of the context menu in the `documentBody` element if specified in the configuration.

# 0.24.2

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.
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].2/css/designer.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/[email protected].2/css/designer-light.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/[email protected].2/css/designer-dark.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/[email protected].2/dist/index.umd.js"></script>
<link href="https://cdn.jsdelivr.net/npm/[email protected].3/css/designer.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/[email protected].3/css/designer-light.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/[email protected].3/css/designer-dark.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/[email protected].3/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.2",
"version": "0.24.3",
"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.2"
"sequential-workflow-designer": "^0.24.3"
},
"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.2",
"sequential-workflow-designer-angular": "^0.24.2",
"sequential-workflow-designer": "^0.24.3",
"sequential-workflow-designer-angular": "^0.24.3",
"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.2:
version "0.24.2"
resolved "https://registry.yarnpkg.com/sequential-workflow-designer-angular/-/sequential-workflow-designer-angular-0.24.2.tgz#def1c1ed8bf58942653be1dd4a5e8d5eb8e77cb5"
integrity sha512-o3oi6ogatAm53Drn44IoupcQHxgi2e3/8tf22J2AyOrFrIvzGbxVyZMKF2t99zYBDjmJkQ7p2jp58kwk0e363Q==
sequential-workflow-designer-angular@^0.24.3:
version "0.24.3"
resolved "https://registry.yarnpkg.com/sequential-workflow-designer-angular/-/sequential-workflow-designer-angular-0.24.3.tgz#9f130a321189a95a6ae735793bb906bce958d7fb"
integrity sha512-YRfm+cSrWAqHKvNRvuVOJxRtcmEKyX9alUGn+e6q8mW9czVKVZ5t+1jMZFPmkIYrUa/XwbzrR3zXgDXNO5l2oQ==
dependencies:
tslib "^2.3.0"

sequential-workflow-designer@^0.24.2:
version "0.24.2"
resolved "https://registry.yarnpkg.com/sequential-workflow-designer/-/sequential-workflow-designer-0.24.2.tgz#628b3d1e317c0a40b9b4c7c3b1b2703e17b3b741"
integrity sha512-dfnf23keTXvXlAq0XBNbOi2pyrJXKB4j41IPIV0UpFEbKZ54QkxPq4UYubA/TWGjSgIOG+jnrZuNrEzs61UVRw==
sequential-workflow-designer@^0.24.3:
version "0.24.3"
resolved "https://registry.yarnpkg.com/sequential-workflow-designer/-/sequential-workflow-designer-0.24.3.tgz#0e72b89003eb69f3172396ac29a729924e5ffbae"
integrity sha512-Y11VuUpa+Uo9tNFWoBdKg9w53Q0UhWfKeFCrHfuWrEDogCcY5hp52SiRsdCBW8qOHEBIG58KvMwfr9vxBtmjJQ==
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.2",
"sequential-workflow-designer-react": "^0.24.2"
"sequential-workflow-designer": "^0.24.3",
"sequential-workflow-designer-react": "^0.24.3"
},
"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.2",
"sequential-workflow-designer-svelte": "^0.24.2"
"sequential-workflow-designer": "^0.24.3",
"sequential-workflow-designer-svelte": "^0.24.3"
},
"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.2",
"version": "0.24.3",
"type": "module",
"main": "./lib/esm/index.js",
"types": "./lib/index.d.ts",
Expand Down
6 changes: 4 additions & 2 deletions designer/src/designer-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ import { PlaceholderController } from './designer-extension';

export class DesignerContext {
public static create(
documentBody: Node,
parent: HTMLElement,
startDefinition: Definition,
configuration: DesignerConfiguration,
services: Services,
documentBody: Node
services: Services
): DesignerContext {
const definition = ObjectCloner.deepClone(startDefinition);

Expand Down Expand Up @@ -60,6 +60,7 @@ export class DesignerContext {
);

return new DesignerContext(
documentBody,
theme,
state,
configuration,
Expand All @@ -78,6 +79,7 @@ export class DesignerContext {
}

public constructor(
public readonly documentBody: Node,
public readonly theme: string,
public readonly state: DesignerState,
public readonly configuration: DesignerConfiguration,
Expand Down
2 changes: 1 addition & 1 deletion designer/src/designer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class Designer<TDefinition extends Definition = Definition> {
}

const services = ServicesResolver.resolve(configuration.extensions, config);
const designerContext = DesignerContext.create(placeholder, startDefinition, config, services, documentBody);
const designerContext = DesignerContext.create(documentBody, placeholder, startDefinition, config, services);
const designerApi = DesignerApi.create(designerContext);

const view = DesignerView.create(placeholder, designerContext, designerApi);
Expand Down
2 changes: 1 addition & 1 deletion designer/src/test-tools/stubs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function createDesignerContextStub(): DesignerContext {
const configuration = createDesignerConfigurationStub();
const services = ServicesResolver.resolve([], configuration);
const documentBody = document.body;
return DesignerContext.create(parent, createDefinitionStub(), createDesignerConfigurationStub(), services, documentBody);
return DesignerContext.create(documentBody, parent, createDefinitionStub(), createDesignerConfigurationStub(), services);
}

export function createComponentContextStub(): ComponentContext {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export class ContextMenuController {
private current?: ContextMenu;

public constructor(
private readonly documentBody: Node,
private readonly theme: string,
private readonly configuration: DesignerConfiguration,
private readonly itemsBuilder: ContextMenuItemsBuilder
Expand All @@ -24,7 +25,7 @@ export class ContextMenuController {
}

const items = this.itemsBuilder.build(commandOrNull);
this.current = ContextMenu.create(position, this.theme, items);
this.current = ContextMenu.create(this.documentBody, position, this.theme, items);
}

public destroy() {
Expand Down
9 changes: 5 additions & 4 deletions designer/src/workspace/context-menu/context-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Vector } from '../../core';
import { ContextMenuItem } from '../../designer-extension';

export class ContextMenu {
public static create(position: Vector, theme: string, items: ContextMenuItem[]) {
public static create(documentBody: Node, position: Vector, theme: string, items: ContextMenuItem[]) {
const menu = document.createElement('div');
menu.style.left = `${position.x}px`;
menu.style.top = `${position.y}px`;
Expand All @@ -25,18 +25,19 @@ export class ContextMenu {
menu.appendChild(element);
}

const instance = new ContextMenu(menu, elements, items, Date.now());
const instance = new ContextMenu(documentBody, menu, elements, items, Date.now());
document.addEventListener('mousedown', instance.mouseDown, false);
document.addEventListener('mouseup', instance.mouseUp, false);
document.addEventListener('touchstart', instance.mouseDown, false);
document.addEventListener('touchend', instance.mouseUp, false);
document.body.appendChild(menu);
documentBody.appendChild(menu);
return instance;
}

private isAttached = true;

private constructor(
private readonly documentBody: Node,
private readonly menu: HTMLElement,
private readonly elements: HTMLElement[],
private readonly items: ContextMenuItem[],
Expand Down Expand Up @@ -85,7 +86,7 @@ export class ContextMenu {

public tryDestroy() {
if (this.isAttached) {
document.body.removeChild(this.menu);
this.documentBody.removeChild(this.menu);
document.removeEventListener('mousedown', this.mouseDown, false);
document.removeEventListener('mouseup', this.mouseUp, false);
document.removeEventListener('touchstart', this.mouseDown, false);
Expand Down
1 change: 1 addition & 0 deletions designer/src/workspace/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export class Workspace implements WorkspaceController {
: undefined
);
const contextMenuController = new ContextMenuController(
designerContext.documentBody,
designerContext.theme,
designerContext.configuration,
contextMenuItemsBuilder
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].2';
const baseUrl = isTestEnv() ? '../designer' : '//cdn.jsdelivr.net/npm/[email protected].3';

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.2",
"version": "0.24.3",
"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.2"
"sequential-workflow-designer": "^0.24.3"
},
"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.2",
"sequential-workflow-designer": "^0.24.3",
"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.2",
"version": "0.24.3",
"license": "MIT",
"scripts": {
"prepare": "cp ../LICENSE LICENSE",
Expand All @@ -28,10 +28,10 @@
],
"peerDependencies": {
"svelte": "^4.0.0",
"sequential-workflow-designer": "^0.24.2"
"sequential-workflow-designer": "^0.24.3"
},
"devDependencies": {
"sequential-workflow-designer": "^0.24.2",
"sequential-workflow-designer": "^0.24.3",
"@sveltejs/adapter-static": "^2.0.3",
"@sveltejs/kit": "^1.20.4",
"@sveltejs/package": "^2.0.0",
Expand Down

0 comments on commit ad3b4b0

Please sign in to comment.