sequential-workflow-designer 0.25.0 → 0.26.1

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/lib/esm/index.js CHANGED
@@ -199,27 +199,17 @@ function race(timeout, a, b, c, d) {
199
199
  }
200
200
 
201
201
  class ControlBarApi {
202
- static create(state, historyController, stateModifier, viewportApi) {
203
- const api = new ControlBarApi(state, historyController, stateModifier, viewportApi);
202
+ static create(state, historyController, stateModifier) {
203
+ const api = new ControlBarApi(state, historyController, stateModifier);
204
204
  race(0, state.onIsReadonlyChanged, state.onSelectedStepIdChanged, state.onIsDragDisabledChanged, api.isUndoRedoSupported() ? state.onDefinitionChanged : undefined).subscribe(api.onStateChanged.forward);
205
205
  return api;
206
206
  }
207
- constructor(state, historyController, stateModifier, viewportApi) {
207
+ constructor(state, historyController, stateModifier) {
208
208
  this.state = state;
209
209
  this.historyController = historyController;
210
210
  this.stateModifier = stateModifier;
211
- this.viewportApi = viewportApi;
212
211
  this.onStateChanged = new SimpleEvent();
213
212
  }
214
- resetViewport() {
215
- this.viewportApi.resetViewport();
216
- }
217
- zoomIn() {
218
- this.viewportApi.zoom(true);
219
- }
220
- zoomOut() {
221
- this.viewportApi.zoom(false);
222
- }
223
213
  isDragDisabled() {
224
214
  return this.state.isDragDisabled;
225
215
  }
@@ -690,21 +680,20 @@ function animate(interval, handler) {
690
680
  }
691
681
 
692
682
  class ViewportAnimator {
693
- constructor(api) {
694
- this.api = api;
683
+ constructor(state) {
684
+ this.state = state;
695
685
  }
696
686
  execute(target) {
697
687
  if (this.animation && this.animation.isAlive) {
698
688
  this.animation.stop();
699
689
  }
700
- const viewport = this.api.getViewport();
701
- const startPosition = viewport.position;
702
- const startScale = viewport.scale;
690
+ const startPosition = this.state.viewport.position;
691
+ const startScale = this.state.viewport.scale;
703
692
  const deltaPosition = startPosition.subtract(target.position);
704
693
  const deltaScale = startScale - target.scale;
705
694
  this.animation = animate(150, progress => {
706
695
  const newScale = startScale - deltaScale * progress;
707
- this.api.setViewport({
696
+ this.state.setViewport({
708
697
  position: startPosition.subtract(deltaPosition.multiplyByScalar(progress)),
709
698
  scale: newScale
710
699
  });
@@ -737,23 +726,23 @@ class ZoomByWheelCalculator {
737
726
  }
738
727
 
739
728
  class ViewportApi {
740
- constructor(workspaceController, viewportController, api) {
729
+ constructor(state, workspaceController, viewportController) {
730
+ this.state = state;
741
731
  this.workspaceController = workspaceController;
742
732
  this.viewportController = viewportController;
743
- this.api = api;
744
- this.animator = new ViewportAnimator(this.api);
733
+ this.animator = new ViewportAnimator(this.state);
745
734
  }
746
735
  limitScale(scale) {
747
736
  return this.viewportController.limitScale(scale);
748
737
  }
749
738
  resetViewport() {
750
739
  const defaultViewport = this.viewportController.getDefault();
751
- this.api.setViewport(defaultViewport);
740
+ this.state.setViewport(defaultViewport);
752
741
  }
753
742
  zoom(direction) {
754
743
  const viewport = this.viewportController.getZoomed(direction);
755
744
  if (viewport) {
756
- this.api.setViewport(viewport);
745
+ this.state.setViewport(viewport);
757
746
  }
758
747
  }
759
748
  moveViewportToStep(stepId) {
@@ -766,11 +755,10 @@ class ViewportApi {
766
755
  this.animator.execute(viewport);
767
756
  }
768
757
  handleWheelEvent(e) {
769
- const viewport = this.api.getViewport();
770
- const canvasPosition = this.api.getCanvasPosition();
771
- const newViewport = ZoomByWheelCalculator.calculate(this.viewportController, viewport, canvasPosition, e);
758
+ const canvasPosition = this.workspaceController.getCanvasPosition();
759
+ const newViewport = ZoomByWheelCalculator.calculate(this.viewportController, this.state.viewport, canvasPosition, e);
772
760
  if (newViewport) {
773
- this.api.setViewport(newViewport);
761
+ this.state.setViewport(newViewport);
774
762
  }
775
763
  }
776
764
  }
@@ -780,6 +768,12 @@ class WorkspaceApi {
780
768
  this.state = state;
781
769
  this.workspaceController = workspaceController;
782
770
  }
771
+ getViewport() {
772
+ return this.state.viewport;
773
+ }
774
+ setViewport(viewport) {
775
+ this.state.setViewport(viewport);
776
+ }
783
777
  getCanvasPosition() {
784
778
  return this.workspaceController.getCanvasPosition();
785
779
  }
@@ -789,12 +783,6 @@ class WorkspaceApi {
789
783
  getRootComponentSize() {
790
784
  return this.workspaceController.getRootComponentSize();
791
785
  }
792
- getViewport() {
793
- return this.state.viewport;
794
- }
795
- setViewport(viewport) {
796
- this.state.setViewport(viewport);
797
- }
798
786
  updateRootComponent() {
799
787
  this.workspaceController.updateRootComponent();
800
788
  }
@@ -810,9 +798,8 @@ class DesignerApi {
810
798
  static create(context) {
811
799
  const workspace = new WorkspaceApi(context.state, context.workspaceController);
812
800
  const viewportController = context.services.viewportController.create(workspace);
813
- const viewport = new ViewportApi(context.workspaceController, viewportController, workspace);
814
801
  const toolboxDataProvider = new ToolboxDataProvider(context.componentContext.iconProvider, context.i18n, context.configuration.toolbox);
815
- return new DesignerApi(context.configuration.shadowRoot, ControlBarApi.create(context.state, context.historyController, context.stateModifier, viewport), new ToolboxApi(context.state, context, context.behaviorController, toolboxDataProvider, context.configuration.uidGenerator), new EditorApi(context.state, context.definitionWalker, context.stateModifier), workspace, viewport, new PathBarApi(context.state, context.definitionWalker), context.definitionWalker, context.i18n);
802
+ return new DesignerApi(context.configuration.shadowRoot, ControlBarApi.create(context.state, context.historyController, context.stateModifier), new ToolboxApi(context.state, context, context.behaviorController, toolboxDataProvider, context.configuration.uidGenerator), new EditorApi(context.state, context.definitionWalker, context.stateModifier), workspace, new ViewportApi(context.state, context.workspaceController, viewportController), new PathBarApi(context.state, context.definitionWalker), context.definitionWalker, context.i18n);
816
803
  }
817
804
  constructor(shadowRoot, controlBar, toolbox, editor, workspace, viewport, pathBar, definitionWalker, i18n) {
818
805
  this.shadowRoot = shadowRoot;
@@ -827,36 +814,15 @@ class DesignerApi {
827
814
  }
828
815
  }
829
816
 
830
- class DefinitionValidator {
831
- constructor(configuration, state) {
832
- this.configuration = configuration;
833
- this.state = state;
834
- }
835
- validateStep(step, parentSequence) {
836
- var _a;
837
- if ((_a = this.configuration) === null || _a === void 0 ? void 0 : _a.step) {
838
- return this.configuration.step(step, parentSequence, this.state.definition);
839
- }
840
- return true;
841
- }
842
- validateRoot() {
843
- var _a;
844
- if ((_a = this.configuration) === null || _a === void 0 ? void 0 : _a.root) {
845
- return this.configuration.root(this.state.definition);
846
- }
847
- return true;
848
- }
849
- }
850
-
851
- class IconProvider {
852
- constructor(configuration) {
853
- this.configuration = configuration;
817
+ const TYPE = 'selectStep';
818
+ class SelectStepBehaviorEndToken {
819
+ static is(token) {
820
+ return Boolean(token) && token.type === TYPE;
854
821
  }
855
- getIconUrl(step) {
856
- if (this.configuration.iconUrlProvider) {
857
- return this.configuration.iconUrlProvider(step.componentType, step.type);
858
- }
859
- return null;
822
+ constructor(stepId, time) {
823
+ this.stepId = stepId;
824
+ this.time = time;
825
+ this.type = TYPE;
860
826
  }
861
827
  }
862
828
 
@@ -921,349 +887,104 @@ function createG(parentElement) {
921
887
  return g;
922
888
  }
923
889
 
924
- var ClickCommandType;
925
- (function (ClickCommandType) {
926
- ClickCommandType[ClickCommandType["selectStep"] = 1] = "selectStep";
927
- ClickCommandType[ClickCommandType["rerenderStep"] = 2] = "rerenderStep";
928
- ClickCommandType[ClickCommandType["openFolder"] = 3] = "openFolder";
929
- ClickCommandType[ClickCommandType["triggerCustomAction"] = 4] = "triggerCustomAction";
930
- })(ClickCommandType || (ClickCommandType = {}));
931
- var PlaceholderDirection;
932
- (function (PlaceholderDirection) {
933
- PlaceholderDirection[PlaceholderDirection["none"] = 0] = "none";
934
- PlaceholderDirection[PlaceholderDirection["in"] = 1] = "in";
935
- PlaceholderDirection[PlaceholderDirection["out"] = 2] = "out";
936
- })(PlaceholderDirection || (PlaceholderDirection = {}));
937
-
938
- class StepComponent {
939
- static create(view, stepContext, componentContext) {
940
- const badges = Badges.createForStep(stepContext, view, componentContext);
941
- return new StepComponent(view, stepContext.step, stepContext.parentSequence, view.hasOutput, badges);
890
+ class ValidationErrorBadgeView {
891
+ static create(parent, cfg) {
892
+ const g = Dom.svg('g');
893
+ const halfOfSize = cfg.size / 2;
894
+ const circle = Dom.svg('path', {
895
+ class: 'sqd-validation-error',
896
+ d: `M 0 ${-halfOfSize} l ${halfOfSize} ${cfg.size} l ${-cfg.size} 0 Z`
897
+ });
898
+ Dom.translate(circle, halfOfSize, halfOfSize);
899
+ g.appendChild(circle);
900
+ const icon = Icons.appendPath(g, 'sqd-validation-error-icon-path', Icons.alert, cfg.iconSize);
901
+ const offsetX = (cfg.size - cfg.iconSize) / 2;
902
+ const offsetY = offsetX * 1.5;
903
+ Dom.translate(icon, offsetX, offsetY);
904
+ parent.appendChild(g);
905
+ return new ValidationErrorBadgeView(parent, g, cfg.size, cfg.size);
942
906
  }
943
- constructor(view, step, parentSequence, hasOutput, badges) {
944
- this.view = view;
945
- this.step = step;
946
- this.parentSequence = parentSequence;
947
- this.hasOutput = hasOutput;
948
- this.badges = badges;
907
+ constructor(parent, g, width, height) {
908
+ this.parent = parent;
909
+ this.g = g;
910
+ this.width = width;
911
+ this.height = height;
949
912
  }
950
- findById(stepId) {
951
- if (this.step.id === stepId) {
952
- return this;
953
- }
954
- if (this.view.sequenceComponents) {
955
- for (const component of this.view.sequenceComponents) {
956
- const result = component.findById(stepId);
957
- if (result) {
958
- return result;
959
- }
960
- }
961
- }
962
- return null;
913
+ destroy() {
914
+ this.parent.removeChild(this.g);
963
915
  }
964
- resolveClick(click) {
965
- if (this.view.sequenceComponents) {
966
- for (const component of this.view.sequenceComponents) {
967
- const result = component.resolveClick(click);
968
- if (result) {
969
- return result;
970
- }
916
+ }
917
+
918
+ class ValidatorFactory {
919
+ static createForStep(stepContext, view, componentContext) {
920
+ return () => {
921
+ if (!componentContext.validator.validateStep(stepContext.step, stepContext.parentSequence)) {
922
+ return false;
971
923
  }
972
- }
973
- const badgeResult = this.badges.resolveClick(click);
974
- if (badgeResult) {
975
- return badgeResult;
976
- }
977
- const viewResult = this.view.resolveClick(click);
978
- if (viewResult) {
979
- return viewResult === true
980
- ? {
981
- type: ClickCommandType.selectStep,
982
- component: this
924
+ if (view.haveCollapsedChildren) {
925
+ let allChildrenValid = true;
926
+ componentContext.definitionWalker.forEachChildren(stepContext.step, (step, _, parentSequence) => {
927
+ if (!componentContext.validator.validateStep(step, parentSequence)) {
928
+ allChildrenValid = false;
929
+ return false;
930
+ }
931
+ });
932
+ if (!allChildrenValid) {
933
+ return false;
983
934
  }
984
- : viewResult;
985
- }
986
- return null;
987
- }
988
- resolvePlaceholders(skipComponent, result) {
989
- if (skipComponent !== this) {
990
- if (this.view.sequenceComponents) {
991
- this.view.sequenceComponents.forEach(component => component.resolvePlaceholders(skipComponent, result));
992
935
  }
993
- if (this.view.placeholders) {
994
- this.view.placeholders.forEach(ph => result.placeholders.push(ph));
995
- }
996
- result.components.push(this);
997
- }
936
+ return true;
937
+ };
998
938
  }
999
- setIsDragging(isDragging) {
1000
- this.view.setIsDragging(isDragging);
939
+ static createForRoot(componentContext) {
940
+ return () => {
941
+ return componentContext.validator.validateRoot();
942
+ };
1001
943
  }
1002
- setIsSelected(isSelected) {
1003
- this.view.setIsSelected(isSelected);
944
+ }
945
+
946
+ class ValidationErrorBadge {
947
+ static createForStep(parentElement, view, stepContext, componentContext, configuration) {
948
+ const validator = ValidatorFactory.createForStep(stepContext, view, componentContext);
949
+ return new ValidationErrorBadge(parentElement, validator, configuration);
1004
950
  }
1005
- setIsDisabled(isDisabled) {
1006
- this.view.setIsDisabled(isDisabled);
951
+ static createForRoot(parentElement, componentContext, configuration) {
952
+ const validator = ValidatorFactory.createForRoot(componentContext);
953
+ return new ValidationErrorBadge(parentElement, validator, configuration);
1007
954
  }
1008
- updateBadges(result) {
1009
- if (this.view.sequenceComponents) {
1010
- this.view.sequenceComponents.forEach(component => component.updateBadges(result));
955
+ constructor(parentElement, validator, configuration) {
956
+ this.parentElement = parentElement;
957
+ this.validator = validator;
958
+ this.configuration = configuration;
959
+ this.view = null;
960
+ }
961
+ update(result) {
962
+ const isValid = this.validator();
963
+ if (isValid) {
964
+ if (this.view) {
965
+ this.view.destroy();
966
+ this.view = null;
967
+ }
1011
968
  }
1012
- this.badges.update(result);
969
+ else if (!this.view) {
970
+ this.view = ValidationErrorBadgeView.create(this.parentElement, this.configuration);
971
+ }
972
+ return isValid && result;
1013
973
  }
1014
- }
1015
-
1016
- class StepComponentViewContextFactory {
1017
- static create(stepContext, componentContext) {
1018
- const preferenceKeyPrefix = stepContext.step.id + ':';
1019
- return {
1020
- i18n: componentContext.i18n,
1021
- getStepIconUrl: () => componentContext.iconProvider.getIconUrl(stepContext.step),
1022
- getStepName: () => componentContext.i18n(`step.${stepContext.step.type}.name`, stepContext.step.name),
1023
- createSequenceComponent: (parentElement, sequence) => {
1024
- const sequenceContext = {
1025
- sequence,
1026
- depth: stepContext.depth + 1,
1027
- isInputConnected: true,
1028
- isOutputConnected: stepContext.isOutputConnected,
1029
- isPreview: stepContext.isPreview
1030
- };
1031
- return componentContext.services.sequenceComponent.create(parentElement, sequenceContext, componentContext);
1032
- },
1033
- createRegionComponentView(parentElement, componentClassName, contentFactory) {
1034
- return componentContext.services.regionComponentView.create(parentElement, componentClassName, stepContext, this, contentFactory);
1035
- },
1036
- createPlaceholderForArea: componentContext.services.placeholder.createForArea.bind(componentContext.services.placeholder),
1037
- getPreference: (key) => componentContext.preferenceStorage.getItem(preferenceKeyPrefix + key),
1038
- setPreference: (key, value) => componentContext.preferenceStorage.setItem(preferenceKeyPrefix + key, value)
1039
- };
974
+ resolveClick() {
975
+ return null;
1040
976
  }
1041
977
  }
1042
978
 
1043
- class StepComponentFactory {
1044
- constructor(stepExtensionResolver) {
1045
- this.stepExtensionResolver = stepExtensionResolver;
979
+ const defaultConfiguration$7 = {
980
+ view: {
981
+ size: 22,
982
+ iconSize: 12
1046
983
  }
1047
- create(parentElement, stepContext, componentContext) {
1048
- const viewContext = StepComponentViewContextFactory.create(stepContext, componentContext);
1049
- const extension = this.stepExtensionResolver.resolve(stepContext.step.componentType);
1050
- const view = extension.createComponentView(parentElement, stepContext, viewContext);
1051
- const wrappedView = componentContext.services.stepComponentViewWrapper.wrap(view, stepContext);
1052
- return StepComponent.create(wrappedView, stepContext, componentContext);
1053
- }
1054
- }
1055
-
1056
- class ComponentContext {
1057
- static create(configuration, state, stepExtensionResolver, definitionWalker, preferenceStorage, placeholderController, i18n, services) {
1058
- const validator = new DefinitionValidator(configuration.validator, state);
1059
- const iconProvider = new IconProvider(configuration.steps);
1060
- const stepComponentFactory = new StepComponentFactory(stepExtensionResolver);
1061
- return new ComponentContext(configuration.shadowRoot, validator, iconProvider, placeholderController, stepComponentFactory, definitionWalker, services, preferenceStorage, i18n);
1062
- }
1063
- constructor(shadowRoot, validator, iconProvider, placeholderController, stepComponentFactory, definitionWalker, services, preferenceStorage, i18n) {
1064
- this.shadowRoot = shadowRoot;
1065
- this.validator = validator;
1066
- this.iconProvider = iconProvider;
1067
- this.placeholderController = placeholderController;
1068
- this.stepComponentFactory = stepComponentFactory;
1069
- this.definitionWalker = definitionWalker;
1070
- this.services = services;
1071
- this.preferenceStorage = preferenceStorage;
1072
- this.i18n = i18n;
1073
- }
1074
- }
1075
-
1076
- class CustomActionController {
1077
- constructor(configuration, state, stateModifier) {
1078
- this.configuration = configuration;
1079
- this.state = state;
1080
- this.stateModifier = stateModifier;
1081
- }
1082
- trigger(action, step, sequence) {
1083
- const handler = this.configuration.customActionHandler;
1084
- if (!handler) {
1085
- console.warn(`Custom action handler is not defined (action type: ${action.type})`);
1086
- return;
1087
- }
1088
- const context = this.createCustomActionHandlerContext();
1089
- handler(action, step, sequence, context);
1090
- }
1091
- createCustomActionHandlerContext() {
1092
- return {
1093
- notifyStepNameChanged: (stepId) => this.notifyStepChanged(DefinitionChangeType.stepNameChanged, stepId, false),
1094
- notifyStepPropertiesChanged: (stepId) => this.notifyStepChanged(DefinitionChangeType.stepPropertyChanged, stepId, false),
1095
- notifyStepInserted: (stepId) => this.notifyStepChanged(DefinitionChangeType.stepInserted, stepId, true),
1096
- notifyStepMoved: (stepId) => this.notifyStepChanged(DefinitionChangeType.stepMoved, stepId, true),
1097
- notifyStepDeleted: (stepId) => this.notifyStepChanged(DefinitionChangeType.stepDeleted, stepId, true)
1098
- };
1099
- }
1100
- notifyStepChanged(changeType, stepId, updateDependencies) {
1101
- if (!stepId) {
1102
- throw new Error('Step id is empty');
1103
- }
1104
- this.state.notifyDefinitionChanged(changeType, stepId);
1105
- if (updateDependencies) {
1106
- this.stateModifier.updateDependencies();
1107
- }
1108
- }
1109
- }
1110
-
1111
- class EditorView {
1112
- static create(parent) {
1113
- return new EditorView(parent);
1114
- }
1115
- constructor(parent) {
1116
- this.parent = parent;
1117
- this.currentContainer = null;
1118
- }
1119
- setContent(content, className) {
1120
- const container = Dom.element('div', {
1121
- class: className
1122
- });
1123
- container.appendChild(content);
1124
- if (this.currentContainer) {
1125
- this.parent.removeChild(this.currentContainer);
1126
- }
1127
- this.parent.appendChild(container);
1128
- this.currentContainer = container;
1129
- }
1130
- destroy() {
1131
- if (this.currentContainer) {
1132
- this.parent.removeChild(this.currentContainer);
1133
- }
1134
- }
1135
- }
1136
-
1137
- class Editor {
1138
- static create(parent, api, stepEditorClassName, stepEditorProvider, rootEditorClassName, rootEditorProvider, customSelectedStepIdProvider) {
1139
- const view = EditorView.create(parent);
1140
- function render(step) {
1141
- const definition = api.getDefinition();
1142
- let content;
1143
- let className;
1144
- if (step) {
1145
- const stepContext = api.createStepEditorContext(step.id);
1146
- content = stepEditorProvider(step, stepContext, definition, api.isReadonly());
1147
- className = stepEditorClassName;
1148
- }
1149
- else {
1150
- const rootContext = api.createRootEditorContext();
1151
- content = rootEditorProvider(definition, rootContext, api.isReadonly());
1152
- className = rootEditorClassName;
1153
- }
1154
- view.setContent(content, className);
1155
- }
1156
- const renderer = api.runRenderer(step => render(step), customSelectedStepIdProvider);
1157
- return new Editor(view, renderer);
1158
- }
1159
- constructor(view, renderer) {
1160
- this.view = view;
1161
- this.renderer = renderer;
1162
- }
1163
- destroy() {
1164
- this.view.destroy();
1165
- this.renderer.destroy();
1166
- }
1167
- }
1168
-
1169
- class ValidationErrorBadgeView {
1170
- static create(parent, cfg) {
1171
- const g = Dom.svg('g');
1172
- const halfOfSize = cfg.size / 2;
1173
- const circle = Dom.svg('path', {
1174
- class: 'sqd-validation-error',
1175
- d: `M 0 ${-halfOfSize} l ${halfOfSize} ${cfg.size} l ${-cfg.size} 0 Z`
1176
- });
1177
- Dom.translate(circle, halfOfSize, halfOfSize);
1178
- g.appendChild(circle);
1179
- const icon = Icons.appendPath(g, 'sqd-validation-error-icon-path', Icons.alert, cfg.iconSize);
1180
- const offsetX = (cfg.size - cfg.iconSize) / 2;
1181
- const offsetY = offsetX * 1.5;
1182
- Dom.translate(icon, offsetX, offsetY);
1183
- parent.appendChild(g);
1184
- return new ValidationErrorBadgeView(parent, g, cfg.size, cfg.size);
1185
- }
1186
- constructor(parent, g, width, height) {
1187
- this.parent = parent;
1188
- this.g = g;
1189
- this.width = width;
1190
- this.height = height;
1191
- }
1192
- destroy() {
1193
- this.parent.removeChild(this.g);
1194
- }
1195
- }
1196
-
1197
- class ValidatorFactory {
1198
- static createForStep(stepContext, view, componentContext) {
1199
- return () => {
1200
- if (!componentContext.validator.validateStep(stepContext.step, stepContext.parentSequence)) {
1201
- return false;
1202
- }
1203
- if (view.haveCollapsedChildren) {
1204
- let allChildrenValid = true;
1205
- componentContext.definitionWalker.forEachChildren(stepContext.step, (step, _, parentSequence) => {
1206
- if (!componentContext.validator.validateStep(step, parentSequence)) {
1207
- allChildrenValid = false;
1208
- return false;
1209
- }
1210
- });
1211
- if (!allChildrenValid) {
1212
- return false;
1213
- }
1214
- }
1215
- return true;
1216
- };
1217
- }
1218
- static createForRoot(componentContext) {
1219
- return () => {
1220
- return componentContext.validator.validateRoot();
1221
- };
1222
- }
1223
- }
1224
-
1225
- class ValidationErrorBadge {
1226
- static createForStep(parentElement, view, stepContext, componentContext, configuration) {
1227
- const validator = ValidatorFactory.createForStep(stepContext, view, componentContext);
1228
- return new ValidationErrorBadge(parentElement, validator, configuration);
1229
- }
1230
- static createForRoot(parentElement, componentContext, configuration) {
1231
- const validator = ValidatorFactory.createForRoot(componentContext);
1232
- return new ValidationErrorBadge(parentElement, validator, configuration);
1233
- }
1234
- constructor(parentElement, validator, configuration) {
1235
- this.parentElement = parentElement;
1236
- this.validator = validator;
1237
- this.configuration = configuration;
1238
- this.view = null;
1239
- }
1240
- update(result) {
1241
- const isValid = this.validator();
1242
- if (isValid) {
1243
- if (this.view) {
1244
- this.view.destroy();
1245
- this.view = null;
1246
- }
1247
- }
1248
- else if (!this.view) {
1249
- this.view = ValidationErrorBadgeView.create(this.parentElement, this.configuration);
1250
- }
1251
- return isValid && result;
1252
- }
1253
- resolveClick() {
1254
- return null;
1255
- }
1256
- }
1257
-
1258
- const defaultConfiguration$7 = {
1259
- view: {
1260
- size: 22,
1261
- iconSize: 12
1262
- }
1263
- };
1264
- class ValidationErrorBadgeExtension {
1265
- static create(configuration) {
1266
- return new ValidationErrorBadgeExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$7);
984
+ };
985
+ class ValidationErrorBadgeExtension {
986
+ static create(configuration) {
987
+ return new ValidationErrorBadgeExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$7);
1267
988
  }
1268
989
  constructor(configuration) {
1269
990
  this.configuration = configuration;
@@ -1333,54 +1054,58 @@ class InputView {
1333
1054
  }
1334
1055
  }
1335
1056
 
1057
+ const EPS = 0.5; // Epsilon, a tiny offset to avoid rendering issues
1336
1058
  class JoinView {
1337
1059
  static createStraightJoin(parent, start, height) {
1060
+ const dy = Math.sign(height);
1338
1061
  const join = Dom.svg('line', {
1339
1062
  class: 'sqd-join',
1340
1063
  x1: start.x,
1341
- y1: start.y,
1064
+ y1: start.y - EPS * dy,
1342
1065
  x2: start.x,
1343
- y2: start.y + height
1066
+ y2: start.y + height + EPS * dy
1344
1067
  });
1345
1068
  parent.insertBefore(join, parent.firstChild);
1346
1069
  }
1347
1070
  static createJoins(parent, start, targets) {
1348
1071
  const firstTarget = targets[0];
1349
1072
  const h = Math.abs(firstTarget.y - start.y) / 2; // half height
1350
- const y = Math.sign(firstTarget.y - start.y); // y direction
1073
+ const dy = Math.sign(firstTarget.y - start.y); // direction y
1351
1074
  switch (targets.length) {
1352
1075
  case 1:
1353
1076
  if (start.x === targets[0].x) {
1354
- JoinView.createStraightJoin(parent, start, firstTarget.y * y);
1077
+ JoinView.createStraightJoin(parent, start, firstTarget.y * dy);
1355
1078
  }
1356
1079
  else {
1357
- appendCurvedJoins(parent, start, targets, h, y);
1080
+ appendCurvedJoins(parent, start, targets, h, dy);
1358
1081
  }
1359
1082
  break;
1360
1083
  case 2:
1361
- appendCurvedJoins(parent, start, targets, h, y);
1084
+ appendCurvedJoins(parent, start, targets, h, dy);
1362
1085
  break;
1363
1086
  default:
1364
1087
  {
1365
1088
  const f = targets[0]; // first
1366
1089
  const l = targets[targets.length - 1]; // last
1367
- appendJoin(parent, `M ${f.x} ${f.y} q ${h * 0.3} ${h * -y * 0.8} ${h} ${h * -y} ` +
1368
- `l ${l.x - f.x - h * 2} 0 q ${h * 0.8} ${-h * -y * 0.3} ${h} ${-h * -y}`);
1090
+ const eps = EPS * dy;
1091
+ appendJoin(parent, `M ${f.x} ${f.y + eps} l 0 ${-eps} q ${h * 0.3} ${h * -dy * 0.8} ${h} ${h * -dy} ` +
1092
+ `l ${l.x - f.x - h * 2} 0 q ${h * 0.8} ${-h * -dy * 0.3} ${h} ${-h * -dy} l 0 ${eps}`);
1369
1093
  for (let i = 1; i < targets.length - 1; i++) {
1370
- JoinView.createStraightJoin(parent, targets[i], h * -y);
1094
+ JoinView.createStraightJoin(parent, targets[i], h * -dy);
1371
1095
  }
1372
- JoinView.createStraightJoin(parent, start, h * y);
1096
+ JoinView.createStraightJoin(parent, start, h * dy);
1373
1097
  }
1374
1098
  break;
1375
1099
  }
1376
1100
  }
1377
1101
  }
1378
- function appendCurvedJoins(parent, start, targets, h, y) {
1102
+ function appendCurvedJoins(parent, start, targets, h, dy) {
1103
+ const eps = EPS * dy;
1379
1104
  for (const target of targets) {
1380
- const l = Math.abs(target.x - start.x) - h * 2; // line size
1381
- const x = Math.sign(target.x - start.x); // x direction
1382
- appendJoin(parent, `M ${start.x} ${start.y} q ${x * h * 0.3} ${y * h * 0.8} ${x * h} ${y * h} ` +
1383
- `l ${x * l} 0 q ${x * h * 0.7} ${y * h * 0.2} ${x * h} ${y * h}`);
1105
+ const l = Math.abs(target.x - start.x) - h * 2; // straight line length
1106
+ const dx = Math.sign(target.x - start.x); // direction x
1107
+ appendJoin(parent, `M ${start.x} ${start.y - eps} l 0 ${eps} q ${dx * h * 0.3} ${dy * h * 0.8} ${dx * h} ${dy * h} ` +
1108
+ `l ${dx * l} 0 q ${dx * h * 0.7} ${dy * h * 0.2} ${dx * h} ${dy * h} l 0 ${eps}`);
1384
1109
  }
1385
1110
  }
1386
1111
  function appendJoin(parent, d) {
@@ -1563,6 +1288,20 @@ class DefaultSequenceComponent {
1563
1288
  }
1564
1289
  }
1565
1290
 
1291
+ var ClickCommandType;
1292
+ (function (ClickCommandType) {
1293
+ ClickCommandType[ClickCommandType["selectStep"] = 1] = "selectStep";
1294
+ ClickCommandType[ClickCommandType["rerenderStep"] = 2] = "rerenderStep";
1295
+ ClickCommandType[ClickCommandType["openFolder"] = 3] = "openFolder";
1296
+ ClickCommandType[ClickCommandType["triggerCustomAction"] = 4] = "triggerCustomAction";
1297
+ })(ClickCommandType || (ClickCommandType = {}));
1298
+ var PlaceholderDirection;
1299
+ (function (PlaceholderDirection) {
1300
+ PlaceholderDirection[PlaceholderDirection["none"] = 0] = "none";
1301
+ PlaceholderDirection[PlaceholderDirection["in"] = 1] = "in";
1302
+ PlaceholderDirection[PlaceholderDirection["out"] = 2] = "out";
1303
+ })(PlaceholderDirection || (PlaceholderDirection = {}));
1304
+
1566
1305
  class StartStopRootComponentView {
1567
1306
  static create(parent, sequence, parentPlaceIndicator, context, cfg) {
1568
1307
  const g = Dom.svg('g', {
@@ -2041,28 +1780,106 @@ class DefaultViewportControllerExtension {
2041
1780
  }
2042
1781
  }
2043
1782
 
2044
- class StepExtensionResolver {
2045
- static create(services) {
2046
- const dict = {};
2047
- for (let i = services.steps.length - 1; i >= 0; i--) {
2048
- const extension = services.steps[i];
2049
- dict[extension.componentType] = extension;
2050
- }
2051
- return new StepExtensionResolver(dict);
1783
+ class StepComponent {
1784
+ static create(view, stepContext, componentContext) {
1785
+ const badges = Badges.createForStep(stepContext, view, componentContext);
1786
+ return new StepComponent(view, stepContext.step, stepContext.parentSequence, view.hasOutput, badges);
2052
1787
  }
2053
- constructor(dict) {
2054
- this.dict = dict;
1788
+ constructor(view, step, parentSequence, hasOutput, badges) {
1789
+ this.view = view;
1790
+ this.step = step;
1791
+ this.parentSequence = parentSequence;
1792
+ this.hasOutput = hasOutput;
1793
+ this.badges = badges;
2055
1794
  }
2056
- resolve(componentType) {
2057
- const extension = this.dict[componentType];
2058
- if (!extension) {
2059
- throw new Error(`Not supported component type: ${componentType}`);
1795
+ findById(stepId) {
1796
+ if (this.step.id === stepId) {
1797
+ return this;
2060
1798
  }
2061
- return extension;
2062
- }
2063
- }
2064
-
2065
- class RectPlaceholderView {
1799
+ if (this.view.sequenceComponents) {
1800
+ for (const component of this.view.sequenceComponents) {
1801
+ const result = component.findById(stepId);
1802
+ if (result) {
1803
+ return result;
1804
+ }
1805
+ }
1806
+ }
1807
+ return null;
1808
+ }
1809
+ resolveClick(click) {
1810
+ if (this.view.sequenceComponents) {
1811
+ for (const component of this.view.sequenceComponents) {
1812
+ const result = component.resolveClick(click);
1813
+ if (result) {
1814
+ return result;
1815
+ }
1816
+ }
1817
+ }
1818
+ const badgeResult = this.badges.resolveClick(click);
1819
+ if (badgeResult) {
1820
+ return badgeResult;
1821
+ }
1822
+ const viewResult = this.view.resolveClick(click);
1823
+ if (viewResult) {
1824
+ return viewResult === true
1825
+ ? {
1826
+ type: ClickCommandType.selectStep,
1827
+ component: this
1828
+ }
1829
+ : viewResult;
1830
+ }
1831
+ return null;
1832
+ }
1833
+ resolvePlaceholders(skipComponent, result) {
1834
+ if (skipComponent !== this) {
1835
+ if (this.view.sequenceComponents) {
1836
+ this.view.sequenceComponents.forEach(component => component.resolvePlaceholders(skipComponent, result));
1837
+ }
1838
+ if (this.view.placeholders) {
1839
+ this.view.placeholders.forEach(ph => result.placeholders.push(ph));
1840
+ }
1841
+ result.components.push(this);
1842
+ }
1843
+ }
1844
+ setIsDragging(isDragging) {
1845
+ this.view.setIsDragging(isDragging);
1846
+ }
1847
+ setIsSelected(isSelected) {
1848
+ this.view.setIsSelected(isSelected);
1849
+ }
1850
+ setIsDisabled(isDisabled) {
1851
+ this.view.setIsDisabled(isDisabled);
1852
+ }
1853
+ updateBadges(result) {
1854
+ if (this.view.sequenceComponents) {
1855
+ this.view.sequenceComponents.forEach(component => component.updateBadges(result));
1856
+ }
1857
+ this.badges.update(result);
1858
+ }
1859
+ }
1860
+
1861
+ class StepExtensionResolver {
1862
+ static create(services) {
1863
+ const dict = {};
1864
+ for (let i = services.steps.length - 1; i >= 0; i--) {
1865
+ const extension = services.steps[i];
1866
+ dict[extension.componentType] = extension;
1867
+ }
1868
+ return new StepExtensionResolver(dict);
1869
+ }
1870
+ constructor(dict) {
1871
+ this.dict = dict;
1872
+ }
1873
+ resolve(componentType) {
1874
+ const extension = this.dict[componentType];
1875
+ if (!extension) {
1876
+ throw new Error(`Not supported component type: ${componentType}`);
1877
+ }
1878
+ return extension;
1879
+ }
1880
+ }
1881
+
1882
+ class RectPlaceholderView {
2066
1883
  static create(parent, width, height, radius, iconSize, direction) {
2067
1884
  const g = Dom.svg('g', {
2068
1885
  visibility: 'hidden',
@@ -2121,63 +1938,414 @@ class RectPlaceholder {
2121
1938
  resolveClick() {
2122
1939
  return null;
2123
1940
  }
2124
- }
2125
-
2126
- class DefaultRegionView {
2127
- static create(parent, widths, height) {
2128
- const totalWidth = widths.reduce((result, width) => result + width, 0);
2129
- const lines = [
2130
- drawLine(parent, 0, 0, totalWidth, 0),
2131
- drawLine(parent, 0, 0, 0, height),
2132
- drawLine(parent, 0, height, totalWidth, height),
2133
- drawLine(parent, totalWidth, 0, totalWidth, height)
2134
- ];
2135
- let offsetX = widths[0];
2136
- for (let i = 1; i < widths.length; i++) {
2137
- lines.push(drawLine(parent, offsetX, 0, offsetX, height));
2138
- offsetX += widths[i];
1941
+ }
1942
+
1943
+ class DefaultRegionView {
1944
+ static create(parent, widths, height) {
1945
+ const totalWidth = widths.reduce((result, width) => result + width, 0);
1946
+ const lines = [
1947
+ drawLine(parent, 0, 0, totalWidth, 0),
1948
+ drawLine(parent, 0, 0, 0, height),
1949
+ drawLine(parent, 0, height, totalWidth, height),
1950
+ drawLine(parent, totalWidth, 0, totalWidth, height)
1951
+ ];
1952
+ let offsetX = widths[0];
1953
+ for (let i = 1; i < widths.length; i++) {
1954
+ lines.push(drawLine(parent, offsetX, 0, offsetX, height));
1955
+ offsetX += widths[i];
1956
+ }
1957
+ return new DefaultRegionView(lines, totalWidth, height);
1958
+ }
1959
+ constructor(lines, width, height) {
1960
+ this.lines = lines;
1961
+ this.width = width;
1962
+ this.height = height;
1963
+ }
1964
+ getClientPosition() {
1965
+ return getAbsolutePosition(this.lines[0]);
1966
+ }
1967
+ resolveClick(click) {
1968
+ const regionPosition = this.getClientPosition();
1969
+ const d = click.position.subtract(regionPosition);
1970
+ if (d.x >= 0 && d.y >= 0 && d.x < this.width * click.scale && d.y < this.height * click.scale) {
1971
+ return true;
1972
+ }
1973
+ return null;
1974
+ }
1975
+ setIsSelected(isSelected) {
1976
+ this.lines.forEach(region => {
1977
+ Dom.toggleClass(region, isSelected, 'sqd-selected');
1978
+ });
1979
+ }
1980
+ }
1981
+ function drawLine(parent, x1, y1, x2, y2) {
1982
+ const line = Dom.svg('line', {
1983
+ class: 'sqd-region',
1984
+ x1,
1985
+ y1,
1986
+ x2,
1987
+ y2
1988
+ });
1989
+ parent.insertBefore(line, parent.firstChild);
1990
+ return line;
1991
+ }
1992
+
1993
+ class DefaultRegionComponentViewExtension {
1994
+ create(parentElement, componentClassName, stepContext, _, contentFactory) {
1995
+ const g = ComponentDom.stepG(componentClassName, stepContext.step.type, stepContext.step.id);
1996
+ parentElement.appendChild(g);
1997
+ return contentFactory(g, DefaultRegionView.create);
1998
+ }
1999
+ }
2000
+
2001
+ class DefaultViewportControllerDesignerExtension {
2002
+ static create(configuration) {
2003
+ return new DefaultViewportControllerDesignerExtension(DefaultViewportControllerExtension.create(configuration));
2004
+ }
2005
+ constructor(viewportController) {
2006
+ this.viewportController = viewportController;
2007
+ }
2008
+ }
2009
+
2010
+ class LineGrid {
2011
+ static create(size) {
2012
+ const path = Dom.svg('path', {
2013
+ class: 'sqd-line-grid-path',
2014
+ fill: 'none'
2015
+ });
2016
+ return new LineGrid(size, path);
2017
+ }
2018
+ constructor(size, element) {
2019
+ this.size = size;
2020
+ this.element = element;
2021
+ }
2022
+ setScale(_, scaledSize) {
2023
+ Dom.attrs(this.element, {
2024
+ d: `M ${scaledSize.x} 0 L 0 0 0 ${scaledSize.y}`
2025
+ });
2026
+ }
2027
+ }
2028
+
2029
+ const defaultConfiguration$4 = {
2030
+ gridSizeX: 48,
2031
+ gridSizeY: 48
2032
+ };
2033
+ class LineGridExtension {
2034
+ static create(configuration) {
2035
+ return new LineGridExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$4);
2036
+ }
2037
+ constructor(configuration) {
2038
+ this.configuration = configuration;
2039
+ }
2040
+ create() {
2041
+ const size = new Vector(this.configuration.gridSizeX, this.configuration.gridSizeY);
2042
+ return LineGrid.create(size);
2043
+ }
2044
+ }
2045
+
2046
+ class LineGridDesignerExtension {
2047
+ static create(configuration) {
2048
+ const grid = LineGridExtension.create(configuration);
2049
+ return new LineGridDesignerExtension(grid);
2050
+ }
2051
+ constructor(grid) {
2052
+ this.grid = grid;
2053
+ }
2054
+ }
2055
+
2056
+ class StartStopRootComponentDesignerExtension {
2057
+ static create(configuration) {
2058
+ return new StartStopRootComponentDesignerExtension(StartStopRootComponentExtension.create(configuration));
2059
+ }
2060
+ constructor(rootComponent) {
2061
+ this.rootComponent = rootComponent;
2062
+ }
2063
+ }
2064
+
2065
+ const defaultConfiguration$3 = {
2066
+ view: {
2067
+ paddingTop: 20,
2068
+ paddingX: 20,
2069
+ inputSize: 18,
2070
+ inputIconSize: 14,
2071
+ label: {
2072
+ height: 22,
2073
+ paddingX: 10,
2074
+ minWidth: 50,
2075
+ radius: 10
2076
+ }
2077
+ }
2078
+ };
2079
+ class ContainerStepExtension {
2080
+ static create(configuration) {
2081
+ return new ContainerStepExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$3);
2082
+ }
2083
+ constructor(configuration) {
2084
+ this.configuration = configuration;
2085
+ this.componentType = 'container';
2086
+ this.createComponentView = createContainerStepComponentViewFactory(this.configuration.view);
2087
+ }
2088
+ }
2089
+
2090
+ const defaultConfiguration$2 = {
2091
+ view: {
2092
+ minContainerWidth: 40,
2093
+ paddingX: 20,
2094
+ paddingTop: 20,
2095
+ connectionHeight: 16,
2096
+ inputSize: 18,
2097
+ inputIconSize: 14,
2098
+ branchNameLabel: {
2099
+ height: 22,
2100
+ paddingX: 10,
2101
+ minWidth: 50,
2102
+ radius: 10
2103
+ },
2104
+ nameLabel: {
2105
+ height: 22,
2106
+ paddingX: 10,
2107
+ minWidth: 50,
2108
+ radius: 10
2109
+ }
2110
+ }
2111
+ };
2112
+ class SwitchStepExtension {
2113
+ static create(configuration) {
2114
+ return new SwitchStepExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$2);
2115
+ }
2116
+ constructor(configuration) {
2117
+ this.configuration = configuration;
2118
+ this.componentType = 'switch';
2119
+ this.createComponentView = createSwitchStepComponentViewFactory(this.configuration.view);
2120
+ }
2121
+ }
2122
+
2123
+ const defaultConfiguration$1 = {
2124
+ view: {
2125
+ paddingLeft: 12,
2126
+ paddingRight: 12,
2127
+ paddingY: 10,
2128
+ textMarginLeft: 12,
2129
+ minTextWidth: 70,
2130
+ iconSize: 22,
2131
+ radius: 5,
2132
+ inputSize: 14,
2133
+ outputSize: 10
2134
+ }
2135
+ };
2136
+ class TaskStepExtension {
2137
+ static create(configuration) {
2138
+ return new TaskStepExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$1);
2139
+ }
2140
+ constructor(configuration) {
2141
+ this.configuration = configuration;
2142
+ this.componentType = 'task';
2143
+ this.createComponentView = createTaskStepComponentViewFactory(false, this.configuration.view);
2144
+ }
2145
+ }
2146
+
2147
+ class StepsDesignerExtension {
2148
+ static create(configuration) {
2149
+ const steps = [];
2150
+ if (configuration.container) {
2151
+ steps.push(ContainerStepExtension.create(configuration.container));
2152
+ }
2153
+ if (configuration.switch) {
2154
+ steps.push(SwitchStepExtension.create(configuration.switch));
2155
+ }
2156
+ if (configuration.task) {
2157
+ steps.push(TaskStepExtension.create(configuration.task));
2158
+ }
2159
+ return new StepsDesignerExtension(steps);
2160
+ }
2161
+ constructor(steps) {
2162
+ this.steps = steps;
2163
+ }
2164
+ }
2165
+
2166
+ class DefinitionValidator {
2167
+ constructor(configuration, state) {
2168
+ this.configuration = configuration;
2169
+ this.state = state;
2170
+ }
2171
+ validateStep(step, parentSequence) {
2172
+ var _a;
2173
+ if ((_a = this.configuration) === null || _a === void 0 ? void 0 : _a.step) {
2174
+ return this.configuration.step(step, parentSequence, this.state.definition);
2175
+ }
2176
+ return true;
2177
+ }
2178
+ validateRoot() {
2179
+ var _a;
2180
+ if ((_a = this.configuration) === null || _a === void 0 ? void 0 : _a.root) {
2181
+ return this.configuration.root(this.state.definition);
2182
+ }
2183
+ return true;
2184
+ }
2185
+ }
2186
+
2187
+ class IconProvider {
2188
+ constructor(configuration) {
2189
+ this.configuration = configuration;
2190
+ }
2191
+ getIconUrl(step) {
2192
+ if (this.configuration.iconUrlProvider) {
2193
+ return this.configuration.iconUrlProvider(step.componentType, step.type);
2194
+ }
2195
+ return null;
2196
+ }
2197
+ }
2198
+
2199
+ class StepComponentViewContextFactory {
2200
+ static create(stepContext, componentContext) {
2201
+ const preferenceKeyPrefix = stepContext.step.id + ':';
2202
+ return {
2203
+ i18n: componentContext.i18n,
2204
+ getStepIconUrl: () => componentContext.iconProvider.getIconUrl(stepContext.step),
2205
+ getStepName: () => componentContext.i18n(`step.${stepContext.step.type}.name`, stepContext.step.name),
2206
+ createSequenceComponent: (parentElement, sequence) => {
2207
+ const sequenceContext = {
2208
+ sequence,
2209
+ depth: stepContext.depth + 1,
2210
+ isInputConnected: true,
2211
+ isOutputConnected: stepContext.isOutputConnected,
2212
+ isPreview: stepContext.isPreview
2213
+ };
2214
+ return componentContext.services.sequenceComponent.create(parentElement, sequenceContext, componentContext);
2215
+ },
2216
+ createRegionComponentView(parentElement, componentClassName, contentFactory) {
2217
+ return componentContext.services.regionComponentView.create(parentElement, componentClassName, stepContext, this, contentFactory);
2218
+ },
2219
+ createPlaceholderForArea: componentContext.services.placeholder.createForArea.bind(componentContext.services.placeholder),
2220
+ getPreference: (key) => componentContext.preferenceStorage.getItem(preferenceKeyPrefix + key),
2221
+ setPreference: (key, value) => componentContext.preferenceStorage.setItem(preferenceKeyPrefix + key, value)
2222
+ };
2223
+ }
2224
+ }
2225
+
2226
+ class StepComponentFactory {
2227
+ constructor(stepExtensionResolver) {
2228
+ this.stepExtensionResolver = stepExtensionResolver;
2229
+ }
2230
+ create(parentElement, stepContext, componentContext) {
2231
+ const viewContext = StepComponentViewContextFactory.create(stepContext, componentContext);
2232
+ const extension = this.stepExtensionResolver.resolve(stepContext.step.componentType);
2233
+ const view = extension.createComponentView(parentElement, stepContext, viewContext);
2234
+ const wrappedView = componentContext.services.stepComponentViewWrapper.wrap(view, stepContext);
2235
+ return StepComponent.create(wrappedView, stepContext, componentContext);
2236
+ }
2237
+ }
2238
+
2239
+ class ComponentContext {
2240
+ static create(configuration, state, stepExtensionResolver, definitionWalker, preferenceStorage, placeholderController, i18n, services) {
2241
+ const validator = new DefinitionValidator(configuration.validator, state);
2242
+ const iconProvider = new IconProvider(configuration.steps);
2243
+ const stepComponentFactory = new StepComponentFactory(stepExtensionResolver);
2244
+ return new ComponentContext(configuration.shadowRoot, validator, iconProvider, placeholderController, stepComponentFactory, definitionWalker, services, preferenceStorage, i18n);
2245
+ }
2246
+ constructor(shadowRoot, validator, iconProvider, placeholderController, stepComponentFactory, definitionWalker, services, preferenceStorage, i18n) {
2247
+ this.shadowRoot = shadowRoot;
2248
+ this.validator = validator;
2249
+ this.iconProvider = iconProvider;
2250
+ this.placeholderController = placeholderController;
2251
+ this.stepComponentFactory = stepComponentFactory;
2252
+ this.definitionWalker = definitionWalker;
2253
+ this.services = services;
2254
+ this.preferenceStorage = preferenceStorage;
2255
+ this.i18n = i18n;
2256
+ }
2257
+ }
2258
+
2259
+ class CustomActionController {
2260
+ constructor(configuration, state, stateModifier) {
2261
+ this.configuration = configuration;
2262
+ this.state = state;
2263
+ this.stateModifier = stateModifier;
2264
+ }
2265
+ trigger(action, step, sequence) {
2266
+ const handler = this.configuration.customActionHandler;
2267
+ if (!handler) {
2268
+ console.warn(`Custom action handler is not defined (action type: ${action.type})`);
2269
+ return;
2270
+ }
2271
+ const context = this.createCustomActionHandlerContext();
2272
+ handler(action, step, sequence, context);
2273
+ }
2274
+ createCustomActionHandlerContext() {
2275
+ return {
2276
+ notifyStepNameChanged: (stepId) => this.notifyStepChanged(DefinitionChangeType.stepNameChanged, stepId, false),
2277
+ notifyStepPropertiesChanged: (stepId) => this.notifyStepChanged(DefinitionChangeType.stepPropertyChanged, stepId, false),
2278
+ notifyStepInserted: (stepId) => this.notifyStepChanged(DefinitionChangeType.stepInserted, stepId, true),
2279
+ notifyStepMoved: (stepId) => this.notifyStepChanged(DefinitionChangeType.stepMoved, stepId, true),
2280
+ notifyStepDeleted: (stepId) => this.notifyStepChanged(DefinitionChangeType.stepDeleted, stepId, true)
2281
+ };
2282
+ }
2283
+ notifyStepChanged(changeType, stepId, updateDependencies) {
2284
+ if (!stepId) {
2285
+ throw new Error('Step id is empty');
2286
+ }
2287
+ this.state.notifyDefinitionChanged(changeType, stepId);
2288
+ if (updateDependencies) {
2289
+ this.stateModifier.updateDependencies();
2139
2290
  }
2140
- return new DefaultRegionView(lines, totalWidth, height);
2141
2291
  }
2142
- constructor(lines, width, height) {
2143
- this.lines = lines;
2144
- this.width = width;
2145
- this.height = height;
2292
+ }
2293
+
2294
+ class EditorView {
2295
+ static create(parent) {
2296
+ return new EditorView(parent);
2146
2297
  }
2147
- getClientPosition() {
2148
- return getAbsolutePosition(this.lines[0]);
2298
+ constructor(parent) {
2299
+ this.parent = parent;
2300
+ this.currentContainer = null;
2149
2301
  }
2150
- resolveClick(click) {
2151
- const regionPosition = this.getClientPosition();
2152
- const d = click.position.subtract(regionPosition);
2153
- if (d.x >= 0 && d.y >= 0 && d.x < this.width * click.scale && d.y < this.height * click.scale) {
2154
- return true;
2302
+ setContent(content, className) {
2303
+ const container = Dom.element('div', {
2304
+ class: className
2305
+ });
2306
+ container.appendChild(content);
2307
+ if (this.currentContainer) {
2308
+ this.parent.removeChild(this.currentContainer);
2155
2309
  }
2156
- return null;
2310
+ this.parent.appendChild(container);
2311
+ this.currentContainer = container;
2157
2312
  }
2158
- setIsSelected(isSelected) {
2159
- this.lines.forEach(region => {
2160
- Dom.toggleClass(region, isSelected, 'sqd-selected');
2161
- });
2313
+ destroy() {
2314
+ if (this.currentContainer) {
2315
+ this.parent.removeChild(this.currentContainer);
2316
+ }
2162
2317
  }
2163
- }
2164
- function drawLine(parent, x1, y1, x2, y2) {
2165
- const line = Dom.svg('line', {
2166
- class: 'sqd-region',
2167
- x1,
2168
- y1,
2169
- x2,
2170
- y2
2171
- });
2172
- parent.insertBefore(line, parent.firstChild);
2173
- return line;
2174
2318
  }
2175
2319
 
2176
- class DefaultRegionComponentViewExtension {
2177
- create(parentElement, componentClassName, stepContext, _, contentFactory) {
2178
- const g = ComponentDom.stepG(componentClassName, stepContext.step.type, stepContext.step.id);
2179
- parentElement.appendChild(g);
2180
- return contentFactory(g, DefaultRegionView.create);
2320
+ class Editor {
2321
+ static create(parent, api, stepEditorClassName, stepEditorProvider, rootEditorClassName, rootEditorProvider, customSelectedStepIdProvider) {
2322
+ const view = EditorView.create(parent);
2323
+ function render(step) {
2324
+ const definition = api.getDefinition();
2325
+ let content;
2326
+ let className;
2327
+ if (step) {
2328
+ const stepContext = api.createStepEditorContext(step.id);
2329
+ content = stepEditorProvider(step, stepContext, definition, api.isReadonly());
2330
+ className = stepEditorClassName;
2331
+ }
2332
+ else {
2333
+ const rootContext = api.createRootEditorContext();
2334
+ content = rootEditorProvider(definition, rootContext, api.isReadonly());
2335
+ className = rootEditorClassName;
2336
+ }
2337
+ view.setContent(content, className);
2338
+ }
2339
+ const renderer = api.runRenderer(step => render(step), customSelectedStepIdProvider);
2340
+ return new Editor(view, renderer);
2341
+ }
2342
+ constructor(view, renderer) {
2343
+ this.view = view;
2344
+ this.renderer = renderer;
2345
+ }
2346
+ destroy() {
2347
+ this.view.destroy();
2348
+ this.renderer.destroy();
2181
2349
  }
2182
2350
  }
2183
2351
 
@@ -2226,6 +2394,8 @@ class BehaviorController {
2226
2394
  constructor(dom, shadowRoot) {
2227
2395
  this.dom = dom;
2228
2396
  this.shadowRoot = shadowRoot;
2397
+ this.previousEndToken = null;
2398
+ this.state = null;
2229
2399
  this.onMouseMove = (e) => {
2230
2400
  e.preventDefault();
2231
2401
  e.stopPropagation();
@@ -2297,7 +2467,7 @@ class BehaviorController {
2297
2467
  const delta = this.state.startPosition.subtract(position);
2298
2468
  const newBehavior = this.state.behavior.onMove(delta);
2299
2469
  if (newBehavior) {
2300
- this.state.behavior.onEnd(true, null);
2470
+ this.state.behavior.onEnd(true, null, null);
2301
2471
  this.state.behavior = newBehavior;
2302
2472
  this.state.startPosition = position;
2303
2473
  this.state.behavior.onStart(this.state.startPosition);
@@ -2311,8 +2481,9 @@ class BehaviorController {
2311
2481
  this.unbind(this.shadowRoot);
2312
2482
  }
2313
2483
  this.unbind(window);
2314
- this.state.behavior.onEnd(interrupt, element);
2315
- this.state = undefined;
2484
+ const endToken = this.state.behavior.onEnd(interrupt, element, this.previousEndToken);
2485
+ this.state = null;
2486
+ this.previousEndToken = endToken || null;
2316
2487
  }
2317
2488
  }
2318
2489
 
@@ -2988,9 +3159,11 @@ class SelectStepBehavior {
2988
3159
  }
2989
3160
  }
2990
3161
  onEnd(interrupt) {
2991
- if (!interrupt) {
2992
- this.stateModifier.trySelectStep(this.pressedStepComponent.step, this.pressedStepComponent.parentSequence);
3162
+ if (interrupt) {
3163
+ return;
2993
3164
  }
3165
+ this.stateModifier.trySelectStep(this.pressedStepComponent.step, this.pressedStepComponent.parentSequence);
3166
+ return new SelectStepBehaviorEndToken(this.pressedStepComponent.step.id, Date.now());
2994
3167
  }
2995
3168
  }
2996
3169
 
@@ -3303,10 +3476,7 @@ class PinchToZoomController {
3303
3476
  const zoomRealPoint = zoomPoint
3304
3477
  .divideByScalar(this.state.lastViewport.scale)
3305
3478
  .subtract(this.state.lastViewport.position.divideByScalar(this.state.lastViewport.scale));
3306
- const position = zoomRealPoint
3307
- .multiplyByScalar(-scale)
3308
- .add(zoomPoint)
3309
- .add(deltaCenterPoint.divideByScalar(this.state.lastViewport.scale));
3479
+ const position = zoomRealPoint.multiplyByScalar(-scale).add(zoomPoint).add(deltaCenterPoint);
3310
3480
  const newViewport = {
3311
3481
  position,
3312
3482
  scale
@@ -3359,13 +3529,14 @@ class Workspace {
3359
3529
  var _a;
3360
3530
  const view = WorkspaceView.create(parent, designerContext.componentContext);
3361
3531
  const clickBehaviorResolver = new ClickBehaviorResolver(designerContext);
3532
+ const clickBehaviorWrapper = designerContext.services.clickBehaviorWrapperExtension.create(designerContext.customActionController);
3362
3533
  const wheelController = designerContext.services.wheelController.create(api.viewport, api.workspace);
3363
3534
  const pinchToZoomController = PinchToZoomController.create(api.workspace, api.viewport, api.shadowRoot);
3364
3535
  const contextMenuItemsBuilder = new ContextMenuItemsBuilder(api.viewport, api.i18n, designerContext.stateModifier, designerContext.state, ((_a = designerContext.services.contextMenu) === null || _a === void 0 ? void 0 : _a.createItemsProvider)
3365
3536
  ? designerContext.services.contextMenu.createItemsProvider(designerContext.customActionController)
3366
3537
  : undefined);
3367
3538
  const contextMenuController = new ContextMenuController(designerContext.theme, designerContext.configuration, contextMenuItemsBuilder);
3368
- const workspace = new Workspace(view, designerContext.definitionWalker, designerContext.state, designerContext.behaviorController, wheelController, pinchToZoomController, contextMenuController, clickBehaviorResolver, api.viewport, designerContext.services);
3539
+ const workspace = new Workspace(view, designerContext.definitionWalker, designerContext.state, designerContext.behaviorController, wheelController, pinchToZoomController, contextMenuController, clickBehaviorResolver, clickBehaviorWrapper, api.viewport, designerContext.services);
3369
3540
  setTimeout(() => {
3370
3541
  workspace.updateRootComponent();
3371
3542
  api.viewport.resetViewport();
@@ -3381,7 +3552,7 @@ class Workspace {
3381
3552
  view.bindContextMenu(workspace.onContextMenu);
3382
3553
  return workspace;
3383
3554
  }
3384
- constructor(view, definitionWalker, state, behaviorController, wheelController, pinchToZoomController, contextMenuController, clickBehaviorResolver, viewportApi, services) {
3555
+ constructor(view, definitionWalker, state, behaviorController, wheelController, pinchToZoomController, contextMenuController, clickBehaviorResolver, clickBehaviorWrapper, viewportApi, services) {
3385
3556
  this.view = view;
3386
3557
  this.definitionWalker = definitionWalker;
3387
3558
  this.state = state;
@@ -3390,6 +3561,7 @@ class Workspace {
3390
3561
  this.pinchToZoomController = pinchToZoomController;
3391
3562
  this.contextMenuController = contextMenuController;
3392
3563
  this.clickBehaviorResolver = clickBehaviorResolver;
3564
+ this.clickBehaviorWrapper = clickBehaviorWrapper;
3393
3565
  this.viewportApi = viewportApi;
3394
3566
  this.services = services;
3395
3567
  this.onRendered = new SimpleEvent();
@@ -3403,7 +3575,8 @@ class Workspace {
3403
3575
  const forceMove = isMiddleButton || altKey;
3404
3576
  const commandOrNull = this.resolveClick(target, position);
3405
3577
  const behavior = this.clickBehaviorResolver.resolve(commandOrNull, target, forceMove);
3406
- this.behaviorController.start(position, behavior);
3578
+ const wrappedBehavior = this.clickBehaviorWrapper.wrap(behavior, commandOrNull);
3579
+ this.behaviorController.start(position, wrappedBehavior);
3407
3580
  }
3408
3581
  };
3409
3582
  this.onPinchToZoom = (distance, centerPoint) => {
@@ -3721,7 +3894,7 @@ class ControlBar {
3721
3894
  static create(parent, api) {
3722
3895
  const isUndoRedoSupported = api.controlBar.isUndoRedoSupported();
3723
3896
  const view = ControlBarView.create(parent, isUndoRedoSupported, api.i18n);
3724
- const bar = new ControlBar(view, api.controlBar, isUndoRedoSupported);
3897
+ const bar = new ControlBar(view, api.controlBar, api.viewport, isUndoRedoSupported);
3725
3898
  view.bindResetButtonClick(() => bar.onResetButtonClicked());
3726
3899
  view.bindZoomInButtonClick(() => bar.onZoomInButtonClicked());
3727
3900
  view.bindZoomOutButtonClick(() => bar.onZoomOutButtonClicked());
@@ -3735,9 +3908,10 @@ class ControlBar {
3735
3908
  bar.refreshButtons();
3736
3909
  return bar;
3737
3910
  }
3738
- constructor(view, controlBarApi, isUndoRedoSupported) {
3911
+ constructor(view, controlBarApi, viewportApi, isUndoRedoSupported) {
3739
3912
  this.view = view;
3740
3913
  this.controlBarApi = controlBarApi;
3914
+ this.viewportApi = viewportApi;
3741
3915
  this.isUndoRedoSupported = isUndoRedoSupported;
3742
3916
  }
3743
3917
  updateLayout() {
@@ -3747,13 +3921,13 @@ class ControlBar {
3747
3921
  //
3748
3922
  }
3749
3923
  onResetButtonClicked() {
3750
- this.controlBarApi.resetViewport();
3924
+ this.viewportApi.resetViewport();
3751
3925
  }
3752
3926
  onZoomInButtonClicked() {
3753
- this.controlBarApi.zoomIn();
3927
+ this.viewportApi.zoom(true);
3754
3928
  }
3755
3929
  onZoomOutButtonClicked() {
3756
- this.controlBarApi.zoomOut();
3930
+ this.viewportApi.zoom(false);
3757
3931
  }
3758
3932
  onMoveButtonClicked() {
3759
3933
  this.controlBarApi.toggleIsDragDisabled();
@@ -4271,31 +4445,6 @@ class ToolboxExtension {
4271
4445
  }
4272
4446
  }
4273
4447
 
4274
- const defaultConfiguration$4 = {
4275
- view: {
4276
- paddingTop: 20,
4277
- paddingX: 20,
4278
- inputSize: 18,
4279
- inputIconSize: 14,
4280
- label: {
4281
- height: 22,
4282
- paddingX: 10,
4283
- minWidth: 50,
4284
- radius: 10
4285
- }
4286
- }
4287
- };
4288
- class ContainerStepExtension {
4289
- static create(configuration) {
4290
- return new ContainerStepExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$4);
4291
- }
4292
- constructor(configuration) {
4293
- this.configuration = configuration;
4294
- this.componentType = 'container';
4295
- this.createComponentView = createContainerStepComponentViewFactory(this.configuration.view);
4296
- }
4297
- }
4298
-
4299
4448
  class DefaultPlaceholderControllerExtension {
4300
4449
  create() {
4301
4450
  return {
@@ -4304,7 +4453,7 @@ class DefaultPlaceholderControllerExtension {
4304
4453
  }
4305
4454
  }
4306
4455
 
4307
- const defaultConfiguration$3 = {
4456
+ const defaultConfiguration = {
4308
4457
  gapWidth: 88,
4309
4458
  gapHeight: 24,
4310
4459
  radius: 6,
@@ -4312,7 +4461,7 @@ const defaultConfiguration$3 = {
4312
4461
  };
4313
4462
  class RectPlaceholderExtension {
4314
4463
  static create(configuration) {
4315
- return new RectPlaceholderExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$3);
4464
+ return new RectPlaceholderExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration);
4316
4465
  }
4317
4466
  constructor(configuration) {
4318
4467
  this.configuration = configuration;
@@ -4326,63 +4475,6 @@ class RectPlaceholderExtension {
4326
4475
  }
4327
4476
  }
4328
4477
 
4329
- const defaultConfiguration$2 = {
4330
- view: {
4331
- minContainerWidth: 40,
4332
- paddingX: 20,
4333
- paddingTop: 20,
4334
- connectionHeight: 16,
4335
- inputSize: 18,
4336
- inputIconSize: 14,
4337
- branchNameLabel: {
4338
- height: 22,
4339
- paddingX: 10,
4340
- minWidth: 50,
4341
- radius: 10
4342
- },
4343
- nameLabel: {
4344
- height: 22,
4345
- paddingX: 10,
4346
- minWidth: 50,
4347
- radius: 10
4348
- }
4349
- }
4350
- };
4351
- class SwitchStepExtension {
4352
- static create(configuration) {
4353
- return new SwitchStepExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$2);
4354
- }
4355
- constructor(configuration) {
4356
- this.configuration = configuration;
4357
- this.componentType = 'switch';
4358
- this.createComponentView = createSwitchStepComponentViewFactory(this.configuration.view);
4359
- }
4360
- }
4361
-
4362
- const defaultConfiguration$1 = {
4363
- view: {
4364
- paddingLeft: 12,
4365
- paddingRight: 12,
4366
- paddingY: 10,
4367
- textMarginLeft: 12,
4368
- minTextWidth: 70,
4369
- iconSize: 22,
4370
- radius: 5,
4371
- inputSize: 14,
4372
- outputSize: 10
4373
- }
4374
- };
4375
- class TaskStepExtension {
4376
- static create(configuration) {
4377
- return new TaskStepExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$1);
4378
- }
4379
- constructor(configuration) {
4380
- this.configuration = configuration;
4381
- this.componentType = 'task';
4382
- this.createComponentView = createTaskStepComponentViewFactory(false, this.configuration.view);
4383
- }
4384
- }
4385
-
4386
4478
  class DefaultSequenceComponentExtension {
4387
4479
  constructor() {
4388
4480
  this.create = DefaultSequenceComponent.create;
@@ -4395,39 +4487,15 @@ class DefaultStepComponentViewWrapperExtension {
4395
4487
  }
4396
4488
  }
4397
4489
 
4398
- class LineGrid {
4399
- static create(size) {
4400
- const path = Dom.svg('path', {
4401
- class: 'sqd-line-grid-path',
4402
- fill: 'none'
4403
- });
4404
- return new LineGrid(size, path);
4405
- }
4406
- constructor(size, element) {
4407
- this.size = size;
4408
- this.element = element;
4409
- }
4410
- setScale(_, scaledSize) {
4411
- Dom.attrs(this.element, {
4412
- d: `M ${scaledSize.x} 0 L 0 0 0 ${scaledSize.y}`
4413
- });
4490
+ class DefaultClickBehaviorWrapper {
4491
+ constructor() {
4492
+ this.wrap = (behavior) => behavior;
4414
4493
  }
4415
4494
  }
4416
4495
 
4417
- const defaultConfiguration = {
4418
- gridSizeX: 48,
4419
- gridSizeY: 48
4420
- };
4421
- class LineGridExtension {
4422
- static create(configuration) {
4423
- return new LineGridExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration);
4424
- }
4425
- constructor(configuration) {
4426
- this.configuration = configuration;
4427
- }
4496
+ class DefaultClickBehaviorWrapperExtension {
4428
4497
  create() {
4429
- const size = new Vector(this.configuration.gridSizeX, this.configuration.gridSizeY);
4430
- return LineGrid.create(size);
4498
+ return new DefaultClickBehaviorWrapper();
4431
4499
  }
4432
4500
  }
4433
4501
 
@@ -4447,6 +4515,9 @@ function merge(services, extensions) {
4447
4515
  if (ext.stepComponentViewWrapper) {
4448
4516
  services.stepComponentViewWrapper = ext.stepComponentViewWrapper;
4449
4517
  }
4518
+ if (ext.clickBehaviorWrapperExtension) {
4519
+ services.clickBehaviorWrapperExtension = ext.clickBehaviorWrapperExtension;
4520
+ }
4450
4521
  if (ext.badges) {
4451
4522
  services.badges = (services.badges || []).concat(ext.badges);
4452
4523
  }
@@ -4498,6 +4569,9 @@ function setDefaults(services, configuration) {
4498
4569
  if (!services.stepComponentViewWrapper) {
4499
4570
  services.stepComponentViewWrapper = new DefaultStepComponentViewWrapperExtension();
4500
4571
  }
4572
+ if (!services.clickBehaviorWrapperExtension) {
4573
+ services.clickBehaviorWrapperExtension = new DefaultClickBehaviorWrapperExtension();
4574
+ }
4501
4575
  if (!services.badges) {
4502
4576
  services.badges = [];
4503
4577
  }
@@ -4794,33 +4868,4 @@ class Designer {
4794
4868
  }
4795
4869
  }
4796
4870
 
4797
- class LineGridDesignerExtension {
4798
- static create(configuration) {
4799
- const grid = LineGridExtension.create(configuration);
4800
- return new LineGridDesignerExtension(grid);
4801
- }
4802
- constructor(grid) {
4803
- this.grid = grid;
4804
- }
4805
- }
4806
-
4807
- class StepsDesignerExtension {
4808
- static create(configuration) {
4809
- const steps = [];
4810
- if (configuration.container) {
4811
- steps.push(ContainerStepExtension.create(configuration.container));
4812
- }
4813
- if (configuration.switch) {
4814
- steps.push(SwitchStepExtension.create(configuration.switch));
4815
- }
4816
- if (configuration.task) {
4817
- steps.push(TaskStepExtension.create(configuration.task));
4818
- }
4819
- return new StepsDesignerExtension(steps);
4820
- }
4821
- constructor(steps) {
4822
- this.steps = steps;
4823
- }
4824
- }
4825
-
4826
- export { Badges, CenteredViewportCalculator, ClassicWheelControllerExtension, ClickCommandType, ComponentContext, ComponentDom, ControlBarApi, CustomActionController, DefaultRegionComponentViewExtension, DefaultRegionView, DefaultSequenceComponent, DefaultSequenceComponentView, DefaultViewportController, DefaultViewportControllerExtension, DefinitionChangeType, Designer, DesignerApi, DesignerContext, DesignerState, Dom, Editor, EditorApi, Icons, InputView, JoinView, KeyboardAction, LabelView, LineGridDesignerExtension, ObjectCloner, OutputView, PathBarApi, PlaceholderDirection, RectPlaceholder, RectPlaceholderView, ServicesResolver, SimpleEvent, StartStopRootComponentExtension, StepComponent, StepExtensionResolver, StepsDesignerExtension, ToolboxApi, Uid, ValidationErrorBadgeExtension, Vector, ViewportApi, WorkspaceApi, createContainerStepComponentViewFactory, createSwitchStepComponentViewFactory, createTaskStepComponentViewFactory, getAbsolutePosition, race };
4871
+ export { Badges, CenteredViewportCalculator, ClassicWheelControllerExtension, ClickCommandType, ComponentContext, ComponentDom, ControlBarApi, CustomActionController, DefaultRegionComponentViewExtension, DefaultRegionView, DefaultSequenceComponent, DefaultSequenceComponentView, DefaultViewportController, DefaultViewportControllerDesignerExtension, DefaultViewportControllerExtension, DefinitionChangeType, Designer, DesignerApi, DesignerContext, DesignerState, Dom, Editor, EditorApi, Icons, InputView, JoinView, KeyboardAction, LabelView, LineGridDesignerExtension, ObjectCloner, OutputView, PathBarApi, PlaceholderDirection, RectPlaceholder, RectPlaceholderView, SelectStepBehaviorEndToken, ServicesResolver, SimpleEvent, StartStopRootComponentDesignerExtension, StartStopRootComponentExtension, StepComponent, StepExtensionResolver, StepsDesignerExtension, TYPE, ToolboxApi, Uid, ValidationErrorBadgeExtension, Vector, ViewportApi, WorkspaceApi, createContainerStepComponentViewFactory, createSwitchStepComponentViewFactory, createTaskStepComponentViewFactory, getAbsolutePosition, race };