sequential-workflow-designer 0.17.0 → 0.18.0

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
@@ -96,10 +96,10 @@ Add the below code to your head section in HTML document.
96
96
  ```html
97
97
  <head>
98
98
  ...
99
- <link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.17.0/css/designer.css" rel="stylesheet">
100
- <link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.17.0/css/designer-light.css" rel="stylesheet">
101
- <link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.17.0/css/designer-dark.css" rel="stylesheet">
102
- <script src="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.17.0/dist/index.umd.js"></script>
99
+ <link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.18.0/css/designer.css" rel="stylesheet">
100
+ <link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.18.0/css/designer-light.css" rel="stylesheet">
101
+ <link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.18.0/css/designer-dark.css" rel="stylesheet">
102
+ <script src="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.18.0/dist/index.umd.js"></script>
103
103
  ```
104
104
 
105
105
  Call the designer by:
package/dist/index.umd.js CHANGED
@@ -205,6 +205,11 @@
205
205
  }
206
206
  }
207
207
 
208
+ function getAbsolutePosition(element) {
209
+ const rect = element.getBoundingClientRect();
210
+ return new Vector(rect.x + window.scrollX, rect.y + window.scrollY);
211
+ }
212
+
208
213
  class Uid {
209
214
  static next() {
210
215
  const bytes = new Uint8Array(16);
@@ -474,9 +479,8 @@
474
479
  const hasSameSize = this.draggedStepComponent.view.width === this.view.component.width &&
475
480
  this.draggedStepComponent.view.height === this.view.component.height;
476
481
  if (hasSameSize) {
477
- const scroll = new Vector(window.scrollX, window.scrollY);
478
482
  // Mouse cursor will be positioned on the same place as the source component.
479
- const pagePosition = this.draggedStepComponent.view.getClientPosition().add(scroll);
483
+ const pagePosition = this.draggedStepComponent.view.getClientPosition();
480
484
  offset = position.subtract(pagePosition);
481
485
  }
482
486
  }
@@ -1271,8 +1275,7 @@
1271
1275
  this.height = height;
1272
1276
  }
1273
1277
  getClientPosition() {
1274
- const rect = this.lines[0].getBoundingClientRect();
1275
- return new Vector(rect.x, rect.y);
1278
+ return getAbsolutePosition(this.lines[0]);
1276
1279
  }
1277
1280
  resolveClick(click) {
1278
1281
  const regionPosition = this.getClientPosition();
@@ -1669,8 +1672,7 @@
1669
1672
  return !!outputView;
1670
1673
  },
1671
1674
  getClientPosition() {
1672
- const r = rect.getBoundingClientRect();
1673
- return new Vector(r.x, r.y);
1675
+ return getAbsolutePosition(rect);
1674
1676
  },
1675
1677
  resolveClick(click) {
1676
1678
  return g.contains(click.element) ? true : null;
@@ -2657,8 +2659,7 @@
2657
2659
  });
2658
2660
  }
2659
2661
  getCanvasPosition() {
2660
- const rect = this.canvas.getBoundingClientRect();
2661
- return new Vector(rect.x + window.scrollX, rect.y + window.scrollY);
2662
+ return getAbsolutePosition(this.canvas);
2662
2663
  }
2663
2664
  getCanvasSize() {
2664
2665
  return new Vector(this.canvas.clientWidth, this.canvas.clientHeight);
@@ -4600,6 +4601,7 @@
4600
4601
  exports.createContainerStepComponentViewFactory = createContainerStepComponentViewFactory;
4601
4602
  exports.createSwitchStepComponentViewFactory = createSwitchStepComponentViewFactory;
4602
4603
  exports.createTaskStepComponentViewFactory = createTaskStepComponentViewFactory;
4604
+ exports.getAbsolutePosition = getAbsolutePosition;
4603
4605
  exports.race = race;
4604
4606
 
4605
4607
  }));
package/lib/cjs/index.cjs CHANGED
@@ -203,6 +203,11 @@ class Vector {
203
203
  }
204
204
  }
205
205
 
206
+ function getAbsolutePosition(element) {
207
+ const rect = element.getBoundingClientRect();
208
+ return new Vector(rect.x + window.scrollX, rect.y + window.scrollY);
209
+ }
210
+
206
211
  class Uid {
207
212
  static next() {
208
213
  const bytes = new Uint8Array(16);
@@ -472,9 +477,8 @@ class DragStepBehavior {
472
477
  const hasSameSize = this.draggedStepComponent.view.width === this.view.component.width &&
473
478
  this.draggedStepComponent.view.height === this.view.component.height;
474
479
  if (hasSameSize) {
475
- const scroll = new Vector(window.scrollX, window.scrollY);
476
480
  // Mouse cursor will be positioned on the same place as the source component.
477
- const pagePosition = this.draggedStepComponent.view.getClientPosition().add(scroll);
481
+ const pagePosition = this.draggedStepComponent.view.getClientPosition();
478
482
  offset = position.subtract(pagePosition);
479
483
  }
480
484
  }
@@ -1269,8 +1273,7 @@ class RegionView {
1269
1273
  this.height = height;
1270
1274
  }
1271
1275
  getClientPosition() {
1272
- const rect = this.lines[0].getBoundingClientRect();
1273
- return new Vector(rect.x, rect.y);
1276
+ return getAbsolutePosition(this.lines[0]);
1274
1277
  }
1275
1278
  resolveClick(click) {
1276
1279
  const regionPosition = this.getClientPosition();
@@ -1667,8 +1670,7 @@ const createTaskStepComponentViewFactory = (isInterrupted, cfg) => (parentElemen
1667
1670
  return !!outputView;
1668
1671
  },
1669
1672
  getClientPosition() {
1670
- const r = rect.getBoundingClientRect();
1671
- return new Vector(r.x, r.y);
1673
+ return getAbsolutePosition(rect);
1672
1674
  },
1673
1675
  resolveClick(click) {
1674
1676
  return g.contains(click.element) ? true : null;
@@ -2472,8 +2474,7 @@ class WorkspaceView {
2472
2474
  });
2473
2475
  }
2474
2476
  getCanvasPosition() {
2475
- const rect = this.canvas.getBoundingClientRect();
2476
- return new Vector(rect.x + window.scrollX, rect.y + window.scrollY);
2477
+ return getAbsolutePosition(this.canvas);
2477
2478
  }
2478
2479
  getCanvasSize() {
2479
2480
  return new Vector(this.canvas.clientWidth, this.canvas.clientHeight);
@@ -4414,6 +4415,7 @@ exports.WorkspaceApi = WorkspaceApi;
4414
4415
  exports.createContainerStepComponentViewFactory = createContainerStepComponentViewFactory;
4415
4416
  exports.createSwitchStepComponentViewFactory = createSwitchStepComponentViewFactory;
4416
4417
  exports.createTaskStepComponentViewFactory = createTaskStepComponentViewFactory;
4418
+ exports.getAbsolutePosition = getAbsolutePosition;
4417
4419
  exports.race = race;
4418
4420
  Object.keys(sequentialWorkflowModel).forEach(function (k) {
4419
4421
  if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
package/lib/esm/index.js CHANGED
@@ -202,6 +202,11 @@ class Vector {
202
202
  }
203
203
  }
204
204
 
205
+ function getAbsolutePosition(element) {
206
+ const rect = element.getBoundingClientRect();
207
+ return new Vector(rect.x + window.scrollX, rect.y + window.scrollY);
208
+ }
209
+
205
210
  class Uid {
206
211
  static next() {
207
212
  const bytes = new Uint8Array(16);
@@ -471,9 +476,8 @@ class DragStepBehavior {
471
476
  const hasSameSize = this.draggedStepComponent.view.width === this.view.component.width &&
472
477
  this.draggedStepComponent.view.height === this.view.component.height;
473
478
  if (hasSameSize) {
474
- const scroll = new Vector(window.scrollX, window.scrollY);
475
479
  // Mouse cursor will be positioned on the same place as the source component.
476
- const pagePosition = this.draggedStepComponent.view.getClientPosition().add(scroll);
480
+ const pagePosition = this.draggedStepComponent.view.getClientPosition();
477
481
  offset = position.subtract(pagePosition);
478
482
  }
479
483
  }
@@ -1268,8 +1272,7 @@ class RegionView {
1268
1272
  this.height = height;
1269
1273
  }
1270
1274
  getClientPosition() {
1271
- const rect = this.lines[0].getBoundingClientRect();
1272
- return new Vector(rect.x, rect.y);
1275
+ return getAbsolutePosition(this.lines[0]);
1273
1276
  }
1274
1277
  resolveClick(click) {
1275
1278
  const regionPosition = this.getClientPosition();
@@ -1666,8 +1669,7 @@ const createTaskStepComponentViewFactory = (isInterrupted, cfg) => (parentElemen
1666
1669
  return !!outputView;
1667
1670
  },
1668
1671
  getClientPosition() {
1669
- const r = rect.getBoundingClientRect();
1670
- return new Vector(r.x, r.y);
1672
+ return getAbsolutePosition(rect);
1671
1673
  },
1672
1674
  resolveClick(click) {
1673
1675
  return g.contains(click.element) ? true : null;
@@ -2471,8 +2473,7 @@ class WorkspaceView {
2471
2473
  });
2472
2474
  }
2473
2475
  getCanvasPosition() {
2474
- const rect = this.canvas.getBoundingClientRect();
2475
- return new Vector(rect.x + window.scrollX, rect.y + window.scrollY);
2476
+ return getAbsolutePosition(this.canvas);
2476
2477
  }
2477
2478
  getCanvasSize() {
2478
2479
  return new Vector(this.canvas.clientWidth, this.canvas.clientHeight);
@@ -4371,4 +4372,4 @@ class StepsDesignerExtension {
4371
4372
  class StepsExtension extends StepsDesignerExtension {
4372
4373
  }
4373
4374
 
4374
- export { Badges, CenteredViewportCalculator, ClassicWheelControllerExtension, ClickCommandType, ComponentContext, ControlBarApi, DefaultSequenceComponent, DefaultSequenceComponentView, DefaultViewportController, DefaultViewportControllerExtension, DefinitionChangeType, Designer, DesignerApi, DesignerContext, DesignerState, Dom, Editor, EditorApi, Icons, InputView, JoinView, KeyboardAction, LabelView, LineGridDesignerExtension, ObjectCloner, OutputView, PathBarApi, PlaceholderDirection, QuantifiedScaleViewportCalculator, RectPlaceholder, RectPlaceholderView, RegionView, ServicesResolver, SimpleEvent, StepComponent, StepExtensionResolver, StepsDesignerExtension, StepsExtension, ToolboxApi, Uid, ValidationErrorBadgeExtension, Vector, WorkspaceApi, createContainerStepComponentViewFactory, createSwitchStepComponentViewFactory, createTaskStepComponentViewFactory, race };
4375
+ export { Badges, CenteredViewportCalculator, ClassicWheelControllerExtension, ClickCommandType, ComponentContext, ControlBarApi, DefaultSequenceComponent, DefaultSequenceComponentView, DefaultViewportController, DefaultViewportControllerExtension, DefinitionChangeType, Designer, DesignerApi, DesignerContext, DesignerState, Dom, Editor, EditorApi, Icons, InputView, JoinView, KeyboardAction, LabelView, LineGridDesignerExtension, ObjectCloner, OutputView, PathBarApi, PlaceholderDirection, QuantifiedScaleViewportCalculator, RectPlaceholder, RectPlaceholderView, RegionView, ServicesResolver, SimpleEvent, StepComponent, StepExtensionResolver, StepsDesignerExtension, StepsExtension, ToolboxApi, Uid, ValidationErrorBadgeExtension, Vector, WorkspaceApi, createContainerStepComponentViewFactory, createSwitchStepComponentViewFactory, createTaskStepComponentViewFactory, getAbsolutePosition, race };
package/lib/index.d.ts CHANGED
@@ -309,6 +309,8 @@ declare class Dom {
309
309
  static toggleClass(element: Element, isEnabled: boolean, className: string): void;
310
310
  }
311
311
 
312
+ declare function getAbsolutePosition(element: Element): Vector;
313
+
312
314
  declare class Uid {
313
315
  static next(): string;
314
316
  }
@@ -1191,4 +1193,4 @@ declare class StepsExtension extends StepsDesignerExtension {
1191
1193
  interface StepsExtensionConfiguration extends StepsDesignerExtensionConfiguration {
1192
1194
  }
1193
1195
 
1194
- export { Attributes, Badge, BadgeExtension, BadgeView, Badges, BadgesResult, BaseClickCommand, CenteredViewportCalculator, ClassicWheelControllerExtension, ClickCommand, ClickCommandType, ClickDetails, Component, ComponentContext, ComponentView, ContainerStep, ContainerStepComponentViewConfiguration, ContainerStepExtensionConfiguration, ControlBarApi, CustomAction, CustomActionHandler, CustomActionHandlerContext, Daemon, DaemonExtension, DefaultSequenceComponent, DefaultSequenceComponentView, DefaultViewportController, DefaultViewportControllerExtension, DefinitionChangeType, DefinitionChangedEvent, Designer, DesignerApi, DesignerConfiguration, DesignerContext, DesignerExtension, DesignerState, Dom, DraggedComponent, DraggedComponentExtension, Editor, EditorApi, EditorsConfiguration, Grid, GridExtension, Icons, InputView, JoinView, KeyboardAction, KeyboardConfiguration, LabelView, LineGridConfiguration, LineGridDesignerExtension, ObjectCloner, OpenFolderClickCommand, OutputView, PathBarApi, Placeholder, PlaceholderController, PlaceholderControllerExtension, PlaceholderDirection, PlaceholderExtension, PlaceholderView, QuantifiedScaleViewportCalculator, RectPlaceholder, RectPlaceholderConfiguration, RectPlaceholderView, RegionView, RerenderStepClickCommand, RootComponentExtension, RootEditorContext, RootEditorProvider, RootValidator, SelectStepClickCommand, SequenceComponent, SequenceComponentExtension, SequenceContext, SequencePlaceIndicator, Services, ServicesResolver, SimpleEvent, SimpleEventListener, StepComponent, StepComponentView, StepComponentViewContext, StepComponentViewFactory, StepComponentViewWrapperExtension, StepContext, StepDefinition, StepDescriptionProvider, StepEditorContext, StepEditorProvider, StepExtension, StepExtensionResolver, StepIconUrlProvider, StepLabelProvider, StepValidator, StepsConfiguration, StepsDesignerExtension, StepsDesignerExtensionConfiguration, StepsExtension, StepsExtensionConfiguration, SwitchStep, SwitchStepComponentViewConfiguration, SwitchStepExtensionConfiguration, TaskStep, TaskStepComponentViewConfiguration, TaskStepExtensionConfiguration, ToolboxApi, ToolboxConfiguration, ToolboxGroupConfiguration, TriggerCustomActionClickCommand, UiComponent, UiComponentExtension, Uid, UidGenerator, UndoStack, UndoStackItem, ValidationErrorBadgeExtension, ValidationErrorBadgeExtensionConfiguration, ValidationErrorBadgeViewConfiguration, ValidatorConfiguration, Vector, Viewport, ViewportController, ViewportControllerExtension, WheelController, WheelControllerExtension, WorkspaceApi, createContainerStepComponentViewFactory, createSwitchStepComponentViewFactory, createTaskStepComponentViewFactory, race };
1196
+ export { Attributes, Badge, BadgeExtension, BadgeView, Badges, BadgesResult, BaseClickCommand, CenteredViewportCalculator, ClassicWheelControllerExtension, ClickCommand, ClickCommandType, ClickDetails, Component, ComponentContext, ComponentView, ContainerStep, ContainerStepComponentViewConfiguration, ContainerStepExtensionConfiguration, ControlBarApi, CustomAction, CustomActionHandler, CustomActionHandlerContext, Daemon, DaemonExtension, DefaultSequenceComponent, DefaultSequenceComponentView, DefaultViewportController, DefaultViewportControllerExtension, DefinitionChangeType, DefinitionChangedEvent, Designer, DesignerApi, DesignerConfiguration, DesignerContext, DesignerExtension, DesignerState, Dom, DraggedComponent, DraggedComponentExtension, Editor, EditorApi, EditorsConfiguration, Grid, GridExtension, Icons, InputView, JoinView, KeyboardAction, KeyboardConfiguration, LabelView, LineGridConfiguration, LineGridDesignerExtension, ObjectCloner, OpenFolderClickCommand, OutputView, PathBarApi, Placeholder, PlaceholderController, PlaceholderControllerExtension, PlaceholderDirection, PlaceholderExtension, PlaceholderView, QuantifiedScaleViewportCalculator, RectPlaceholder, RectPlaceholderConfiguration, RectPlaceholderView, RegionView, RerenderStepClickCommand, RootComponentExtension, RootEditorContext, RootEditorProvider, RootValidator, SelectStepClickCommand, SequenceComponent, SequenceComponentExtension, SequenceContext, SequencePlaceIndicator, Services, ServicesResolver, SimpleEvent, SimpleEventListener, StepComponent, StepComponentView, StepComponentViewContext, StepComponentViewFactory, StepComponentViewWrapperExtension, StepContext, StepDefinition, StepDescriptionProvider, StepEditorContext, StepEditorProvider, StepExtension, StepExtensionResolver, StepIconUrlProvider, StepLabelProvider, StepValidator, StepsConfiguration, StepsDesignerExtension, StepsDesignerExtensionConfiguration, StepsExtension, StepsExtensionConfiguration, SwitchStep, SwitchStepComponentViewConfiguration, SwitchStepExtensionConfiguration, TaskStep, TaskStepComponentViewConfiguration, TaskStepExtensionConfiguration, ToolboxApi, ToolboxConfiguration, ToolboxGroupConfiguration, TriggerCustomActionClickCommand, UiComponent, UiComponentExtension, Uid, UidGenerator, UndoStack, UndoStackItem, ValidationErrorBadgeExtension, ValidationErrorBadgeExtensionConfiguration, ValidationErrorBadgeViewConfiguration, ValidatorConfiguration, Vector, Viewport, ViewportController, ViewportControllerExtension, WheelController, WheelControllerExtension, WorkspaceApi, createContainerStepComponentViewFactory, createSwitchStepComponentViewFactory, createTaskStepComponentViewFactory, getAbsolutePosition, race };
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.17.0",
4
+ "version": "0.18.0",
5
5
  "type": "module",
6
6
  "main": "./lib/esm/index.js",
7
7
  "types": "./lib/index.d.ts",