sequential-workflow-designer 0.24.2 → 0.24.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/README.md CHANGED
@@ -103,10 +103,10 @@ Add the below code to your head section in HTML document.
103
103
  ```html
104
104
  <head>
105
105
  ...
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>
106
+ <link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.24.3/css/designer.css" rel="stylesheet">
107
+ <link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.24.3/css/designer-light.css" rel="stylesheet">
108
+ <link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.24.3/css/designer-dark.css" rel="stylesheet">
109
+ <script src="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.24.3/dist/index.umd.js"></script>
110
110
  ```
111
111
 
112
112
  Call the designer by:
package/dist/index.umd.js CHANGED
@@ -2726,7 +2726,7 @@
2726
2726
  }
2727
2727
 
2728
2728
  class DesignerContext {
2729
- static create(parent, startDefinition, configuration, services, documentBody) {
2729
+ static create(documentBody, parent, startDefinition, configuration, services) {
2730
2730
  var _a, _b, _c, _d, _e;
2731
2731
  const definition = ObjectCloner.deepClone(startDefinition);
2732
2732
  const layoutController = new LayoutController(parent);
@@ -2749,9 +2749,10 @@
2749
2749
  }
2750
2750
  const preferenceStorage = (_e = configuration.preferenceStorage) !== null && _e !== void 0 ? _e : new MemoryPreferenceStorage();
2751
2751
  const componentContext = ComponentContext.create(configuration, state, stepExtensionResolver, definitionWalker, preferenceStorage, placeholderController, i18n, services, documentBody);
2752
- return new DesignerContext(theme, state, configuration, services, componentContext, definitionWalker, i18n, stateModifier, layoutController, workspaceController, placeholderController, behaviorController, customActionController, historyController);
2752
+ return new DesignerContext(documentBody, theme, state, configuration, services, componentContext, definitionWalker, i18n, stateModifier, layoutController, workspaceController, placeholderController, behaviorController, customActionController, historyController);
2753
2753
  }
2754
- constructor(theme, state, configuration, services, componentContext, definitionWalker, i18n, stateModifier, layoutController, workspaceController, placeholderController, behaviorController, customActionController, historyController) {
2754
+ constructor(documentBody, theme, state, configuration, services, componentContext, definitionWalker, i18n, stateModifier, layoutController, workspaceController, placeholderController, behaviorController, customActionController, historyController) {
2755
+ this.documentBody = documentBody;
2755
2756
  this.theme = theme;
2756
2757
  this.state = state;
2757
2758
  this.configuration = configuration;
@@ -3062,7 +3063,7 @@
3062
3063
  }
3063
3064
 
3064
3065
  class ContextMenu {
3065
- static create(position, theme, items) {
3066
+ static create(documentBody, position, theme, items) {
3066
3067
  const menu = document.createElement('div');
3067
3068
  menu.style.left = `${position.x}px`;
3068
3069
  menu.style.top = `${position.y}px`;
@@ -3082,15 +3083,16 @@
3082
3083
  elements.push(element);
3083
3084
  menu.appendChild(element);
3084
3085
  }
3085
- const instance = new ContextMenu(menu, elements, items, Date.now());
3086
+ const instance = new ContextMenu(documentBody, menu, elements, items, Date.now());
3086
3087
  document.addEventListener('mousedown', instance.mouseDown, false);
3087
3088
  document.addEventListener('mouseup', instance.mouseUp, false);
3088
3089
  document.addEventListener('touchstart', instance.mouseDown, false);
3089
3090
  document.addEventListener('touchend', instance.mouseUp, false);
3090
- document.body.appendChild(menu);
3091
+ documentBody.appendChild(menu);
3091
3092
  return instance;
3092
3093
  }
3093
- constructor(menu, elements, items, startTime) {
3094
+ constructor(documentBody, menu, elements, items, startTime) {
3095
+ this.documentBody = documentBody;
3094
3096
  this.menu = menu;
3095
3097
  this.elements = elements;
3096
3098
  this.items = items;
@@ -3137,7 +3139,7 @@
3137
3139
  }
3138
3140
  tryDestroy() {
3139
3141
  if (this.isAttached) {
3140
- document.body.removeChild(this.menu);
3142
+ this.documentBody.removeChild(this.menu);
3141
3143
  document.removeEventListener('mousedown', this.mouseDown, false);
3142
3144
  document.removeEventListener('mouseup', this.mouseUp, false);
3143
3145
  document.removeEventListener('touchstart', this.mouseDown, false);
@@ -3148,7 +3150,8 @@
3148
3150
  }
3149
3151
 
3150
3152
  class ContextMenuController {
3151
- constructor(theme, configuration, itemsBuilder) {
3153
+ constructor(documentBody, theme, configuration, itemsBuilder) {
3154
+ this.documentBody = documentBody;
3152
3155
  this.theme = theme;
3153
3156
  this.configuration = configuration;
3154
3157
  this.itemsBuilder = itemsBuilder;
@@ -3162,7 +3165,7 @@
3162
3165
  this.current.tryDestroy();
3163
3166
  }
3164
3167
  const items = this.itemsBuilder.build(commandOrNull);
3165
- this.current = ContextMenu.create(position, this.theme, items);
3168
+ this.current = ContextMenu.create(this.documentBody, position, this.theme, items);
3166
3169
  }
3167
3170
  destroy() {
3168
3171
  if (this.current) {
@@ -3264,7 +3267,7 @@
3264
3267
  const contextMenuItemsBuilder = new ContextMenuItemsBuilder(api.viewport, api.i18n, designerContext.stateModifier, designerContext.state, ((_a = designerContext.services.contextMenu) === null || _a === void 0 ? void 0 : _a.createItemsProvider)
3265
3268
  ? designerContext.services.contextMenu.createItemsProvider(designerContext.customActionController)
3266
3269
  : undefined);
3267
- const contextMenuController = new ContextMenuController(designerContext.theme, designerContext.configuration, contextMenuItemsBuilder);
3270
+ const contextMenuController = new ContextMenuController(designerContext.documentBody, designerContext.theme, designerContext.configuration, contextMenuItemsBuilder);
3268
3271
  const workspace = new Workspace(view, designerContext.definitionWalker, designerContext.state, designerContext.behaviorController, wheelController, contextMenuController, clickBehaviorResolver, api.viewport, designerContext.services);
3269
3272
  setTimeout(() => {
3270
3273
  workspace.updateRootComponent();
@@ -4584,7 +4587,7 @@
4584
4587
  throw new Error('Placeholder is not attached to the DOM');
4585
4588
  }
4586
4589
  const services = ServicesResolver.resolve(configuration.extensions, config);
4587
- const designerContext = DesignerContext.create(placeholder, startDefinition, config, services, documentBody);
4590
+ const designerContext = DesignerContext.create(documentBody, placeholder, startDefinition, config, services);
4588
4591
  const designerApi = DesignerApi.create(designerContext);
4589
4592
  const view = DesignerView.create(placeholder, designerContext, designerApi);
4590
4593
  const designer = new Designer(view, designerContext.state, designerContext.stateModifier, designerContext.definitionWalker, designerContext.historyController, designerApi);
package/lib/cjs/index.cjs CHANGED
@@ -2541,7 +2541,7 @@ class MemoryPreferenceStorage {
2541
2541
  }
2542
2542
 
2543
2543
  class DesignerContext {
2544
- static create(parent, startDefinition, configuration, services, documentBody) {
2544
+ static create(documentBody, parent, startDefinition, configuration, services) {
2545
2545
  var _a, _b, _c, _d, _e;
2546
2546
  const definition = ObjectCloner.deepClone(startDefinition);
2547
2547
  const layoutController = new LayoutController(parent);
@@ -2564,9 +2564,10 @@ class DesignerContext {
2564
2564
  }
2565
2565
  const preferenceStorage = (_e = configuration.preferenceStorage) !== null && _e !== void 0 ? _e : new MemoryPreferenceStorage();
2566
2566
  const componentContext = ComponentContext.create(configuration, state, stepExtensionResolver, definitionWalker, preferenceStorage, placeholderController, i18n, services, documentBody);
2567
- return new DesignerContext(theme, state, configuration, services, componentContext, definitionWalker, i18n, stateModifier, layoutController, workspaceController, placeholderController, behaviorController, customActionController, historyController);
2567
+ return new DesignerContext(documentBody, theme, state, configuration, services, componentContext, definitionWalker, i18n, stateModifier, layoutController, workspaceController, placeholderController, behaviorController, customActionController, historyController);
2568
2568
  }
2569
- constructor(theme, state, configuration, services, componentContext, definitionWalker, i18n, stateModifier, layoutController, workspaceController, placeholderController, behaviorController, customActionController, historyController) {
2569
+ constructor(documentBody, theme, state, configuration, services, componentContext, definitionWalker, i18n, stateModifier, layoutController, workspaceController, placeholderController, behaviorController, customActionController, historyController) {
2570
+ this.documentBody = documentBody;
2570
2571
  this.theme = theme;
2571
2572
  this.state = state;
2572
2573
  this.configuration = configuration;
@@ -2877,7 +2878,7 @@ function findValidationBadgeIndex(extensions) {
2877
2878
  }
2878
2879
 
2879
2880
  class ContextMenu {
2880
- static create(position, theme, items) {
2881
+ static create(documentBody, position, theme, items) {
2881
2882
  const menu = document.createElement('div');
2882
2883
  menu.style.left = `${position.x}px`;
2883
2884
  menu.style.top = `${position.y}px`;
@@ -2897,15 +2898,16 @@ class ContextMenu {
2897
2898
  elements.push(element);
2898
2899
  menu.appendChild(element);
2899
2900
  }
2900
- const instance = new ContextMenu(menu, elements, items, Date.now());
2901
+ const instance = new ContextMenu(documentBody, menu, elements, items, Date.now());
2901
2902
  document.addEventListener('mousedown', instance.mouseDown, false);
2902
2903
  document.addEventListener('mouseup', instance.mouseUp, false);
2903
2904
  document.addEventListener('touchstart', instance.mouseDown, false);
2904
2905
  document.addEventListener('touchend', instance.mouseUp, false);
2905
- document.body.appendChild(menu);
2906
+ documentBody.appendChild(menu);
2906
2907
  return instance;
2907
2908
  }
2908
- constructor(menu, elements, items, startTime) {
2909
+ constructor(documentBody, menu, elements, items, startTime) {
2910
+ this.documentBody = documentBody;
2909
2911
  this.menu = menu;
2910
2912
  this.elements = elements;
2911
2913
  this.items = items;
@@ -2952,7 +2954,7 @@ class ContextMenu {
2952
2954
  }
2953
2955
  tryDestroy() {
2954
2956
  if (this.isAttached) {
2955
- document.body.removeChild(this.menu);
2957
+ this.documentBody.removeChild(this.menu);
2956
2958
  document.removeEventListener('mousedown', this.mouseDown, false);
2957
2959
  document.removeEventListener('mouseup', this.mouseUp, false);
2958
2960
  document.removeEventListener('touchstart', this.mouseDown, false);
@@ -2963,7 +2965,8 @@ class ContextMenu {
2963
2965
  }
2964
2966
 
2965
2967
  class ContextMenuController {
2966
- constructor(theme, configuration, itemsBuilder) {
2968
+ constructor(documentBody, theme, configuration, itemsBuilder) {
2969
+ this.documentBody = documentBody;
2967
2970
  this.theme = theme;
2968
2971
  this.configuration = configuration;
2969
2972
  this.itemsBuilder = itemsBuilder;
@@ -2977,7 +2980,7 @@ class ContextMenuController {
2977
2980
  this.current.tryDestroy();
2978
2981
  }
2979
2982
  const items = this.itemsBuilder.build(commandOrNull);
2980
- this.current = ContextMenu.create(position, this.theme, items);
2983
+ this.current = ContextMenu.create(this.documentBody, position, this.theme, items);
2981
2984
  }
2982
2985
  destroy() {
2983
2986
  if (this.current) {
@@ -3079,7 +3082,7 @@ class Workspace {
3079
3082
  const contextMenuItemsBuilder = new ContextMenuItemsBuilder(api.viewport, api.i18n, designerContext.stateModifier, designerContext.state, ((_a = designerContext.services.contextMenu) === null || _a === void 0 ? void 0 : _a.createItemsProvider)
3080
3083
  ? designerContext.services.contextMenu.createItemsProvider(designerContext.customActionController)
3081
3084
  : undefined);
3082
- const contextMenuController = new ContextMenuController(designerContext.theme, designerContext.configuration, contextMenuItemsBuilder);
3085
+ const contextMenuController = new ContextMenuController(designerContext.documentBody, designerContext.theme, designerContext.configuration, contextMenuItemsBuilder);
3083
3086
  const workspace = new Workspace(view, designerContext.definitionWalker, designerContext.state, designerContext.behaviorController, wheelController, contextMenuController, clickBehaviorResolver, api.viewport, designerContext.services);
3084
3087
  setTimeout(() => {
3085
3088
  workspace.updateRootComponent();
@@ -4399,7 +4402,7 @@ class Designer {
4399
4402
  throw new Error('Placeholder is not attached to the DOM');
4400
4403
  }
4401
4404
  const services = ServicesResolver.resolve(configuration.extensions, config);
4402
- const designerContext = DesignerContext.create(placeholder, startDefinition, config, services, documentBody);
4405
+ const designerContext = DesignerContext.create(documentBody, placeholder, startDefinition, config, services);
4403
4406
  const designerApi = DesignerApi.create(designerContext);
4404
4407
  const view = DesignerView.create(placeholder, designerContext, designerApi);
4405
4408
  const designer = new Designer(view, designerContext.state, designerContext.stateModifier, designerContext.definitionWalker, designerContext.historyController, designerApi);
package/lib/esm/index.js CHANGED
@@ -2540,7 +2540,7 @@ class MemoryPreferenceStorage {
2540
2540
  }
2541
2541
 
2542
2542
  class DesignerContext {
2543
- static create(parent, startDefinition, configuration, services, documentBody) {
2543
+ static create(documentBody, parent, startDefinition, configuration, services) {
2544
2544
  var _a, _b, _c, _d, _e;
2545
2545
  const definition = ObjectCloner.deepClone(startDefinition);
2546
2546
  const layoutController = new LayoutController(parent);
@@ -2563,9 +2563,10 @@ class DesignerContext {
2563
2563
  }
2564
2564
  const preferenceStorage = (_e = configuration.preferenceStorage) !== null && _e !== void 0 ? _e : new MemoryPreferenceStorage();
2565
2565
  const componentContext = ComponentContext.create(configuration, state, stepExtensionResolver, definitionWalker, preferenceStorage, placeholderController, i18n, services, documentBody);
2566
- return new DesignerContext(theme, state, configuration, services, componentContext, definitionWalker, i18n, stateModifier, layoutController, workspaceController, placeholderController, behaviorController, customActionController, historyController);
2566
+ return new DesignerContext(documentBody, theme, state, configuration, services, componentContext, definitionWalker, i18n, stateModifier, layoutController, workspaceController, placeholderController, behaviorController, customActionController, historyController);
2567
2567
  }
2568
- constructor(theme, state, configuration, services, componentContext, definitionWalker, i18n, stateModifier, layoutController, workspaceController, placeholderController, behaviorController, customActionController, historyController) {
2568
+ constructor(documentBody, theme, state, configuration, services, componentContext, definitionWalker, i18n, stateModifier, layoutController, workspaceController, placeholderController, behaviorController, customActionController, historyController) {
2569
+ this.documentBody = documentBody;
2569
2570
  this.theme = theme;
2570
2571
  this.state = state;
2571
2572
  this.configuration = configuration;
@@ -2876,7 +2877,7 @@ function findValidationBadgeIndex(extensions) {
2876
2877
  }
2877
2878
 
2878
2879
  class ContextMenu {
2879
- static create(position, theme, items) {
2880
+ static create(documentBody, position, theme, items) {
2880
2881
  const menu = document.createElement('div');
2881
2882
  menu.style.left = `${position.x}px`;
2882
2883
  menu.style.top = `${position.y}px`;
@@ -2896,15 +2897,16 @@ class ContextMenu {
2896
2897
  elements.push(element);
2897
2898
  menu.appendChild(element);
2898
2899
  }
2899
- const instance = new ContextMenu(menu, elements, items, Date.now());
2900
+ const instance = new ContextMenu(documentBody, menu, elements, items, Date.now());
2900
2901
  document.addEventListener('mousedown', instance.mouseDown, false);
2901
2902
  document.addEventListener('mouseup', instance.mouseUp, false);
2902
2903
  document.addEventListener('touchstart', instance.mouseDown, false);
2903
2904
  document.addEventListener('touchend', instance.mouseUp, false);
2904
- document.body.appendChild(menu);
2905
+ documentBody.appendChild(menu);
2905
2906
  return instance;
2906
2907
  }
2907
- constructor(menu, elements, items, startTime) {
2908
+ constructor(documentBody, menu, elements, items, startTime) {
2909
+ this.documentBody = documentBody;
2908
2910
  this.menu = menu;
2909
2911
  this.elements = elements;
2910
2912
  this.items = items;
@@ -2951,7 +2953,7 @@ class ContextMenu {
2951
2953
  }
2952
2954
  tryDestroy() {
2953
2955
  if (this.isAttached) {
2954
- document.body.removeChild(this.menu);
2956
+ this.documentBody.removeChild(this.menu);
2955
2957
  document.removeEventListener('mousedown', this.mouseDown, false);
2956
2958
  document.removeEventListener('mouseup', this.mouseUp, false);
2957
2959
  document.removeEventListener('touchstart', this.mouseDown, false);
@@ -2962,7 +2964,8 @@ class ContextMenu {
2962
2964
  }
2963
2965
 
2964
2966
  class ContextMenuController {
2965
- constructor(theme, configuration, itemsBuilder) {
2967
+ constructor(documentBody, theme, configuration, itemsBuilder) {
2968
+ this.documentBody = documentBody;
2966
2969
  this.theme = theme;
2967
2970
  this.configuration = configuration;
2968
2971
  this.itemsBuilder = itemsBuilder;
@@ -2976,7 +2979,7 @@ class ContextMenuController {
2976
2979
  this.current.tryDestroy();
2977
2980
  }
2978
2981
  const items = this.itemsBuilder.build(commandOrNull);
2979
- this.current = ContextMenu.create(position, this.theme, items);
2982
+ this.current = ContextMenu.create(this.documentBody, position, this.theme, items);
2980
2983
  }
2981
2984
  destroy() {
2982
2985
  if (this.current) {
@@ -3078,7 +3081,7 @@ class Workspace {
3078
3081
  const contextMenuItemsBuilder = new ContextMenuItemsBuilder(api.viewport, api.i18n, designerContext.stateModifier, designerContext.state, ((_a = designerContext.services.contextMenu) === null || _a === void 0 ? void 0 : _a.createItemsProvider)
3079
3082
  ? designerContext.services.contextMenu.createItemsProvider(designerContext.customActionController)
3080
3083
  : undefined);
3081
- const contextMenuController = new ContextMenuController(designerContext.theme, designerContext.configuration, contextMenuItemsBuilder);
3084
+ const contextMenuController = new ContextMenuController(designerContext.documentBody, designerContext.theme, designerContext.configuration, contextMenuItemsBuilder);
3082
3085
  const workspace = new Workspace(view, designerContext.definitionWalker, designerContext.state, designerContext.behaviorController, wheelController, contextMenuController, clickBehaviorResolver, api.viewport, designerContext.services);
3083
3086
  setTimeout(() => {
3084
3087
  workspace.updateRootComponent();
@@ -4398,7 +4401,7 @@ class Designer {
4398
4401
  throw new Error('Placeholder is not attached to the DOM');
4399
4402
  }
4400
4403
  const services = ServicesResolver.resolve(configuration.extensions, config);
4401
- const designerContext = DesignerContext.create(placeholder, startDefinition, config, services, documentBody);
4404
+ const designerContext = DesignerContext.create(documentBody, placeholder, startDefinition, config, services);
4402
4405
  const designerApi = DesignerApi.create(designerContext);
4403
4406
  const view = DesignerView.create(placeholder, designerContext, designerApi);
4404
4407
  const designer = new Designer(view, designerContext.state, designerContext.stateModifier, designerContext.definitionWalker, designerContext.historyController, designerApi);
package/lib/index.d.ts CHANGED
@@ -343,6 +343,7 @@ declare class WorkspaceControllerWrapper implements WorkspaceController {
343
343
  }
344
344
 
345
345
  declare class DesignerContext {
346
+ readonly documentBody: Node;
346
347
  readonly theme: string;
347
348
  readonly state: DesignerState;
348
349
  readonly configuration: DesignerConfiguration;
@@ -357,8 +358,8 @@ declare class DesignerContext {
357
358
  readonly behaviorController: BehaviorController;
358
359
  readonly customActionController: CustomActionController;
359
360
  readonly historyController: HistoryController | undefined;
360
- static create(parent: HTMLElement, startDefinition: Definition, configuration: DesignerConfiguration, services: Services, documentBody: Node): DesignerContext;
361
- constructor(theme: string, state: DesignerState, configuration: DesignerConfiguration, services: Services, componentContext: ComponentContext, definitionWalker: DefinitionWalker, i18n: I18n, stateModifier: StateModifier, layoutController: LayoutController, workspaceController: WorkspaceControllerWrapper, placeholderController: PlaceholderController, behaviorController: BehaviorController, customActionController: CustomActionController, historyController: HistoryController | undefined);
361
+ static create(documentBody: Node, parent: HTMLElement, startDefinition: Definition, configuration: DesignerConfiguration, services: Services): DesignerContext;
362
+ constructor(documentBody: Node, theme: string, state: DesignerState, configuration: DesignerConfiguration, services: Services, componentContext: ComponentContext, definitionWalker: DefinitionWalker, i18n: I18n, stateModifier: StateModifier, layoutController: LayoutController, workspaceController: WorkspaceControllerWrapper, placeholderController: PlaceholderController, behaviorController: BehaviorController, customActionController: CustomActionController, historyController: HistoryController | undefined);
362
363
  setWorkspaceController(controller: WorkspaceController): void;
363
364
  }
364
365
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sequential-workflow-designer",
3
3
  "description": "Customizable no-code component for building flow-based programming applications.",
4
- "version": "0.24.2",
4
+ "version": "0.24.3",
5
5
  "type": "module",
6
6
  "main": "./lib/esm/index.js",
7
7
  "types": "./lib/index.d.ts",