sequential-workflow-designer 0.24.4 → 0.24.6

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/cjs/index.cjs CHANGED
@@ -403,17 +403,19 @@ class PathBarApi {
403
403
 
404
404
  class DragStepView {
405
405
  static create(step, theme, componentContext) {
406
+ var _a;
407
+ const body = (_a = componentContext.shadowRoot) !== null && _a !== void 0 ? _a : document.body;
406
408
  const layer = Dom.element('div', {
407
409
  class: `sqd-drag sqd-theme-${theme}`
408
410
  });
409
- componentContext.documentBody.appendChild(layer);
411
+ body.appendChild(layer);
410
412
  const component = componentContext.services.draggedComponent.create(layer, step, componentContext);
411
- return new DragStepView(component, layer, componentContext.documentBody);
413
+ return new DragStepView(component, layer, body);
412
414
  }
413
- constructor(component, layer, documentBody) {
415
+ constructor(component, layer, body) {
414
416
  this.component = component;
415
417
  this.layer = layer;
416
- this.documentBody = documentBody;
418
+ this.body = body;
417
419
  }
418
420
  setPosition(position) {
419
421
  this.layer.style.top = position.y + 'px';
@@ -421,7 +423,7 @@ class DragStepView {
421
423
  }
422
424
  remove() {
423
425
  this.component.destroy();
424
- this.documentBody.removeChild(this.layer);
426
+ this.body.removeChild(this.layer);
425
427
  }
426
428
  }
427
429
 
@@ -726,11 +728,10 @@ class DesignerApi {
726
728
  const viewportController = context.services.viewportController.create(workspace);
727
729
  const viewport = new ViewportApi(context.workspaceController, viewportController);
728
730
  const toolboxDataProvider = new ToolboxDataProvider(context.componentContext.iconProvider, context.i18n, context.configuration.toolbox);
729
- return new DesignerApi(context.documentOrShadowRoot, context.documentBody, 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);
731
+ 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);
730
732
  }
731
- constructor(documentOrShadowRoot, documentBody, controlBar, toolbox, editor, workspace, viewport, pathBar, definitionWalker, i18n) {
732
- this.documentOrShadowRoot = documentOrShadowRoot;
733
- this.documentBody = documentBody;
733
+ constructor(shadowRoot, controlBar, toolbox, editor, workspace, viewport, pathBar, definitionWalker, i18n) {
734
+ this.shadowRoot = shadowRoot;
734
735
  this.controlBar = controlBar;
735
736
  this.toolbox = toolbox;
736
737
  this.editor = editor;
@@ -969,15 +970,14 @@ class StepComponentFactory {
969
970
  }
970
971
 
971
972
  class ComponentContext {
972
- static create(documentOrShadowRoot, documentBody, configuration, state, stepExtensionResolver, definitionWalker, preferenceStorage, placeholderController, i18n, services) {
973
+ static create(configuration, state, stepExtensionResolver, definitionWalker, preferenceStorage, placeholderController, i18n, services) {
973
974
  const validator = new DefinitionValidator(configuration.validator, state);
974
975
  const iconProvider = new IconProvider(configuration.steps);
975
976
  const stepComponentFactory = new StepComponentFactory(stepExtensionResolver);
976
- return new ComponentContext(documentOrShadowRoot, documentBody, validator, iconProvider, placeholderController, stepComponentFactory, definitionWalker, services, preferenceStorage, i18n);
977
+ return new ComponentContext(configuration.shadowRoot, validator, iconProvider, placeholderController, stepComponentFactory, definitionWalker, services, preferenceStorage, i18n);
977
978
  }
978
- constructor(documentOrShadowRoot, documentBody, validator, iconProvider, placeholderController, stepComponentFactory, definitionWalker, services, preferenceStorage, i18n) {
979
- this.documentOrShadowRoot = documentOrShadowRoot;
980
- this.documentBody = documentBody;
979
+ constructor(shadowRoot, validator, iconProvider, placeholderController, stepComponentFactory, definitionWalker, services, preferenceStorage, i18n) {
980
+ this.shadowRoot = shadowRoot;
981
981
  this.validator = validator;
982
982
  this.iconProvider = iconProvider;
983
983
  this.placeholderController = placeholderController;
@@ -1704,6 +1704,12 @@ const createTaskStepComponentViewFactory = (isInterrupted, cfg) => (parentElemen
1704
1704
 
1705
1705
  class CenteredViewportCalculator {
1706
1706
  static center(margin, canvasSize, rootComponentSize) {
1707
+ if (canvasSize.x === 0 || canvasSize.y === 0) {
1708
+ return {
1709
+ position: new Vector(0, 0),
1710
+ scale: 1
1711
+ };
1712
+ }
1707
1713
  const canvasSafeWidth = Math.max(canvasSize.x - margin * 2, 0);
1708
1714
  const canvasSafeHeight = Math.max(canvasSize.y - margin * 2, 0);
1709
1715
  const scale = Math.min(Math.min(canvasSafeWidth / rootComponentSize.x, canvasSafeHeight / rootComponentSize.y), 1);
@@ -2052,32 +2058,41 @@ const nonPassiveOptions = {
2052
2058
  passive: false
2053
2059
  };
2054
2060
  class BehaviorController {
2055
- constructor(documentOrShadowRoot) {
2056
- this.documentOrShadowRoot = documentOrShadowRoot;
2061
+ static create(shadowRoot) {
2062
+ return new BehaviorController(shadowRoot !== null && shadowRoot !== void 0 ? shadowRoot : document, shadowRoot);
2063
+ }
2064
+ constructor(dom, shadowRoot) {
2065
+ this.dom = dom;
2066
+ this.shadowRoot = shadowRoot;
2057
2067
  this.onMouseMove = (e) => {
2058
2068
  e.preventDefault();
2069
+ e.stopPropagation();
2059
2070
  this.move(readMousePosition(e));
2060
2071
  };
2061
2072
  this.onTouchMove = (e) => {
2062
2073
  e.preventDefault();
2074
+ e.stopPropagation();
2063
2075
  this.move(readTouchPosition(e));
2064
2076
  };
2065
2077
  this.onMouseUp = (e) => {
2066
2078
  e.preventDefault();
2079
+ e.stopPropagation();
2067
2080
  this.stop(false, e.target);
2068
2081
  };
2069
2082
  this.onTouchEnd = (e) => {
2070
2083
  var _a;
2071
2084
  e.preventDefault();
2085
+ e.stopPropagation();
2072
2086
  if (!this.state) {
2073
2087
  throw new Error(notInitializedError);
2074
2088
  }
2075
2089
  const position = (_a = this.state.lastPosition) !== null && _a !== void 0 ? _a : this.state.startPosition;
2076
- const element = this.documentOrShadowRoot.elementFromPoint(position.x, position.y);
2090
+ const element = this.dom.elementFromPoint(position.x, position.y);
2077
2091
  this.stop(false, element);
2078
2092
  };
2079
2093
  this.onTouchStart = (e) => {
2080
2094
  e.preventDefault();
2095
+ e.stopPropagation();
2081
2096
  if (e.touches.length !== 1) {
2082
2097
  this.stop(true, null);
2083
2098
  }
@@ -2093,11 +2108,24 @@ class BehaviorController {
2093
2108
  behavior
2094
2109
  };
2095
2110
  behavior.onStart(this.state.startPosition);
2096
- window.addEventListener('mousemove', this.onMouseMove, false);
2097
- window.addEventListener('touchmove', this.onTouchMove, nonPassiveOptions);
2098
- window.addEventListener('mouseup', this.onMouseUp, false);
2099
- window.addEventListener('touchend', this.onTouchEnd, nonPassiveOptions);
2100
- window.addEventListener('touchstart', this.onTouchStart, nonPassiveOptions);
2111
+ if (this.shadowRoot) {
2112
+ this.bind(this.shadowRoot);
2113
+ }
2114
+ this.bind(window);
2115
+ }
2116
+ bind(target) {
2117
+ target.addEventListener('mousemove', this.onMouseMove, false);
2118
+ target.addEventListener('touchmove', this.onTouchMove, nonPassiveOptions);
2119
+ target.addEventListener('mouseup', this.onMouseUp, false);
2120
+ target.addEventListener('touchend', this.onTouchEnd, nonPassiveOptions);
2121
+ target.addEventListener('touchstart', this.onTouchStart, nonPassiveOptions);
2122
+ }
2123
+ unbind(target) {
2124
+ target.removeEventListener('mousemove', this.onMouseMove, false);
2125
+ target.removeEventListener('touchmove', this.onTouchMove, nonPassiveOptions);
2126
+ target.removeEventListener('mouseup', this.onMouseUp, false);
2127
+ target.removeEventListener('touchend', this.onTouchEnd, nonPassiveOptions);
2128
+ target.removeEventListener('touchstart', this.onTouchStart, nonPassiveOptions);
2101
2129
  }
2102
2130
  move(position) {
2103
2131
  if (!this.state) {
@@ -2117,11 +2145,10 @@ class BehaviorController {
2117
2145
  if (!this.state) {
2118
2146
  throw new Error(notInitializedError);
2119
2147
  }
2120
- window.removeEventListener('mousemove', this.onMouseMove, false);
2121
- window.removeEventListener('touchmove', this.onTouchMove, nonPassiveOptions);
2122
- window.removeEventListener('mouseup', this.onMouseUp, false);
2123
- window.removeEventListener('touchend', this.onTouchEnd, nonPassiveOptions);
2124
- window.removeEventListener('touchstart', this.onTouchStart, nonPassiveOptions);
2148
+ if (this.shadowRoot) {
2149
+ this.unbind(this.shadowRoot);
2150
+ }
2151
+ this.unbind(window);
2125
2152
  this.state.behavior.onEnd(interrupt, element);
2126
2153
  this.state = undefined;
2127
2154
  }
@@ -2484,11 +2511,11 @@ function areItemsEqual(item, changeType, stepId) {
2484
2511
  }
2485
2512
 
2486
2513
  class LayoutController {
2487
- constructor(parent) {
2488
- this.parent = parent;
2514
+ constructor(placeholder) {
2515
+ this.placeholder = placeholder;
2489
2516
  }
2490
2517
  isMobile() {
2491
- return this.parent.clientWidth < 400; // TODO
2518
+ return this.placeholder.clientWidth < 400; // TODO
2492
2519
  }
2493
2520
  }
2494
2521
 
@@ -2545,18 +2572,18 @@ class MemoryPreferenceStorage {
2545
2572
  }
2546
2573
 
2547
2574
  class DesignerContext {
2548
- static create(documentOrShadowRoot, documentBody, parent, startDefinition, configuration, services) {
2575
+ static create(placeholder, startDefinition, configuration, services) {
2549
2576
  var _a, _b, _c, _d, _e;
2550
2577
  const definition = ObjectCloner.deepClone(startDefinition);
2551
- const layoutController = new LayoutController(parent);
2552
- const isReadonly = !!configuration.isReadonly;
2578
+ const layoutController = new LayoutController(placeholder);
2579
+ const isReadonly = Boolean(configuration.isReadonly);
2553
2580
  const isToolboxCollapsed = configuration.toolbox ? (_a = configuration.toolbox.isCollapsed) !== null && _a !== void 0 ? _a : layoutController.isMobile() : false;
2554
2581
  const isEditorCollapsed = configuration.editors ? (_b = configuration.editors.isCollapsed) !== null && _b !== void 0 ? _b : layoutController.isMobile() : false;
2555
2582
  const theme = configuration.theme || 'light';
2556
2583
  const state = new DesignerState(definition, isReadonly, isToolboxCollapsed, isEditorCollapsed);
2557
2584
  const workspaceController = new WorkspaceControllerWrapper();
2558
2585
  const placeholderController = services.placeholderController.create();
2559
- const behaviorController = new BehaviorController(documentOrShadowRoot);
2586
+ const behaviorController = BehaviorController.create(configuration.shadowRoot);
2560
2587
  const stepExtensionResolver = StepExtensionResolver.create(services);
2561
2588
  const definitionWalker = (_c = configuration.definitionWalker) !== null && _c !== void 0 ? _c : new sequentialWorkflowModel.DefinitionWalker();
2562
2589
  const i18n = (_d = configuration.i18n) !== null && _d !== void 0 ? _d : ((_, defaultValue) => defaultValue);
@@ -2567,12 +2594,10 @@ class DesignerContext {
2567
2594
  historyController = HistoryController.create(configuration.undoStack, state, stateModifier, configuration);
2568
2595
  }
2569
2596
  const preferenceStorage = (_e = configuration.preferenceStorage) !== null && _e !== void 0 ? _e : new MemoryPreferenceStorage();
2570
- const componentContext = ComponentContext.create(documentOrShadowRoot, documentBody, configuration, state, stepExtensionResolver, definitionWalker, preferenceStorage, placeholderController, i18n, services);
2571
- return new DesignerContext(documentOrShadowRoot, documentBody, theme, state, configuration, services, componentContext, definitionWalker, i18n, stateModifier, layoutController, workspaceController, placeholderController, behaviorController, customActionController, historyController);
2597
+ const componentContext = ComponentContext.create(configuration, state, stepExtensionResolver, definitionWalker, preferenceStorage, placeholderController, i18n, services);
2598
+ return new DesignerContext(theme, state, configuration, services, componentContext, definitionWalker, i18n, stateModifier, layoutController, workspaceController, placeholderController, behaviorController, customActionController, historyController);
2572
2599
  }
2573
- constructor(documentOrShadowRoot, documentBody, theme, state, configuration, services, componentContext, definitionWalker, i18n, stateModifier, layoutController, workspaceController, placeholderController, behaviorController, customActionController, historyController) {
2574
- this.documentOrShadowRoot = documentOrShadowRoot;
2575
- this.documentBody = documentBody;
2600
+ constructor(theme, state, configuration, services, componentContext, definitionWalker, i18n, stateModifier, layoutController, workspaceController, placeholderController, behaviorController, customActionController, historyController) {
2576
2601
  this.theme = theme;
2577
2602
  this.state = state;
2578
2603
  this.configuration = configuration;
@@ -2618,8 +2643,8 @@ function __awaiter(thisArg, _arguments, P, generator) {
2618
2643
  });
2619
2644
  }
2620
2645
 
2621
- function isElementAttached(element, documentBody) {
2622
- return !(documentBody.compareDocumentPosition(element) & Node.DOCUMENT_POSITION_DISCONNECTED);
2646
+ function isElementAttached(dom, element) {
2647
+ return !(dom.compareDocumentPosition(element) & Node.DOCUMENT_POSITION_DISCONNECTED);
2623
2648
  }
2624
2649
 
2625
2650
  let lastGridPatternId = 0;
@@ -2653,12 +2678,12 @@ class WorkspaceView {
2653
2678
  canvas.appendChild(foreground);
2654
2679
  workspace.appendChild(canvas);
2655
2680
  parent.appendChild(workspace);
2656
- const view = new WorkspaceView(componentContext.documentOrShadowRoot, workspace, canvas, pattern, gridPattern, foreground, componentContext);
2681
+ const view = new WorkspaceView(componentContext.shadowRoot, workspace, canvas, pattern, gridPattern, foreground, componentContext);
2657
2682
  window.addEventListener('resize', view.onResizeHandler, false);
2658
2683
  return view;
2659
2684
  }
2660
- constructor(documentOrShadowRoot, workspace, canvas, pattern, gridPattern, foreground, context) {
2661
- this.documentOrShadowRoot = documentOrShadowRoot;
2685
+ constructor(shadowRoot, workspace, canvas, pattern, gridPattern, foreground, context) {
2686
+ this.shadowRoot = shadowRoot;
2662
2687
  this.workspace = workspace;
2663
2688
  this.canvas = canvas;
2664
2689
  this.pattern = pattern;
@@ -2699,9 +2724,11 @@ class WorkspaceView {
2699
2724
  handler(readMousePosition(e), e.target, e.button, e.altKey);
2700
2725
  }, false);
2701
2726
  this.canvas.addEventListener('touchstart', e => {
2727
+ var _a;
2702
2728
  e.preventDefault();
2703
2729
  const clientPosition = readTouchClientPosition(e);
2704
- const element = this.documentOrShadowRoot.elementFromPoint(clientPosition.x, clientPosition.y);
2730
+ const dom = (_a = this.shadowRoot) !== null && _a !== void 0 ? _a : document;
2731
+ const element = dom.elementFromPoint(clientPosition.x, clientPosition.y);
2705
2732
  if (element) {
2706
2733
  const position = readTouchPosition(e);
2707
2734
  handler(position, element, 0, false);
@@ -2884,7 +2911,7 @@ function findValidationBadgeIndex(extensions) {
2884
2911
  }
2885
2912
 
2886
2913
  class ContextMenu {
2887
- static create(documentBody, position, theme, items) {
2914
+ static create(shadowRoot, position, theme, items) {
2888
2915
  const menu = document.createElement('div');
2889
2916
  menu.style.left = `${position.x}px`;
2890
2917
  menu.style.top = `${position.y}px`;
@@ -2904,16 +2931,19 @@ class ContextMenu {
2904
2931
  elements.push(element);
2905
2932
  menu.appendChild(element);
2906
2933
  }
2907
- const instance = new ContextMenu(documentBody, menu, elements, items, Date.now());
2908
- documentBody.addEventListener('mousedown', instance.mouseDown, false);
2909
- documentBody.addEventListener('mouseup', instance.mouseUp, false);
2910
- documentBody.addEventListener('touchstart', instance.mouseDown, false);
2911
- documentBody.addEventListener('touchend', instance.mouseUp, false);
2912
- documentBody.appendChild(menu);
2934
+ const body = shadowRoot !== null && shadowRoot !== void 0 ? shadowRoot : document.body;
2935
+ const dom = shadowRoot !== null && shadowRoot !== void 0 ? shadowRoot : document;
2936
+ const instance = new ContextMenu(body, dom, menu, elements, items, Date.now());
2937
+ dom.addEventListener('mousedown', instance.mouseDown, false);
2938
+ dom.addEventListener('mouseup', instance.mouseUp, false);
2939
+ dom.addEventListener('touchstart', instance.mouseDown, false);
2940
+ dom.addEventListener('touchend', instance.mouseUp, false);
2941
+ body.appendChild(menu);
2913
2942
  return instance;
2914
2943
  }
2915
- constructor(documentBody, menu, elements, items, startTime) {
2916
- this.documentBody = documentBody;
2944
+ constructor(body, dom, menu, elements, items, startTime) {
2945
+ this.body = body;
2946
+ this.dom = dom;
2917
2947
  this.menu = menu;
2918
2948
  this.elements = elements;
2919
2949
  this.items = items;
@@ -2960,19 +2990,18 @@ class ContextMenu {
2960
2990
  }
2961
2991
  tryDestroy() {
2962
2992
  if (this.isAttached) {
2963
- this.documentBody.removeChild(this.menu);
2964
- this.documentBody.removeEventListener('mousedown', this.mouseDown, false);
2965
- this.documentBody.removeEventListener('mouseup', this.mouseUp, false);
2966
- this.documentBody.removeEventListener('touchstart', this.mouseDown, false);
2967
- this.documentBody.removeEventListener('touchend', this.mouseUp, false);
2993
+ this.body.removeChild(this.menu);
2994
+ this.dom.removeEventListener('mousedown', this.mouseDown, false);
2995
+ this.dom.removeEventListener('mouseup', this.mouseUp, false);
2996
+ this.dom.removeEventListener('touchstart', this.mouseDown, false);
2997
+ this.dom.removeEventListener('touchend', this.mouseUp, false);
2968
2998
  this.isAttached = false;
2969
2999
  }
2970
3000
  }
2971
3001
  }
2972
3002
 
2973
3003
  class ContextMenuController {
2974
- constructor(documentBody, theme, configuration, itemsBuilder) {
2975
- this.documentBody = documentBody;
3004
+ constructor(theme, configuration, itemsBuilder) {
2976
3005
  this.theme = theme;
2977
3006
  this.configuration = configuration;
2978
3007
  this.itemsBuilder = itemsBuilder;
@@ -2986,7 +3015,7 @@ class ContextMenuController {
2986
3015
  this.current.tryDestroy();
2987
3016
  }
2988
3017
  const items = this.itemsBuilder.build(commandOrNull);
2989
- this.current = ContextMenu.create(this.documentBody, position, this.theme, items);
3018
+ this.current = ContextMenu.create(this.configuration.shadowRoot, position, this.theme, items);
2990
3019
  }
2991
3020
  destroy() {
2992
3021
  if (this.current) {
@@ -3088,7 +3117,7 @@ class Workspace {
3088
3117
  const contextMenuItemsBuilder = new ContextMenuItemsBuilder(api.viewport, api.i18n, designerContext.stateModifier, designerContext.state, ((_a = designerContext.services.contextMenu) === null || _a === void 0 ? void 0 : _a.createItemsProvider)
3089
3118
  ? designerContext.services.contextMenu.createItemsProvider(designerContext.customActionController)
3090
3119
  : undefined);
3091
- const contextMenuController = new ContextMenuController(designerContext.documentBody, designerContext.theme, designerContext.configuration, contextMenuItemsBuilder);
3120
+ const contextMenuController = new ContextMenuController(designerContext.theme, designerContext.configuration, contextMenuItemsBuilder);
3092
3121
  const workspace = new Workspace(view, designerContext.definitionWalker, designerContext.state, designerContext.behaviorController, wheelController, contextMenuController, clickBehaviorResolver, api.viewport, designerContext.services);
3093
3122
  setTimeout(() => {
3094
3123
  workspace.updateRootComponent();
@@ -3519,12 +3548,13 @@ class ControlBarExtension {
3519
3548
  const ignoreTagNames = ['INPUT', 'TEXTAREA', 'SELECT'];
3520
3549
  class KeyboardDaemon {
3521
3550
  static create(api, configuration) {
3522
- const controller = new KeyboardDaemon(api.documentOrShadowRoot, api.controlBar, configuration);
3523
- api.documentOrShadowRoot.addEventListener('keyup', controller.onKeyUp, false);
3551
+ const dom = api.shadowRoot || document;
3552
+ const controller = new KeyboardDaemon(dom, api.controlBar, configuration);
3553
+ dom.addEventListener('keyup', controller.onKeyUp, false);
3524
3554
  return controller;
3525
3555
  }
3526
- constructor(documentOrShadowRoot, controlBarApi, configuration) {
3527
- this.documentOrShadowRoot = documentOrShadowRoot;
3556
+ constructor(dom, controlBarApi, configuration) {
3557
+ this.dom = dom;
3528
3558
  this.controlBarApi = controlBarApi;
3529
3559
  this.configuration = configuration;
3530
3560
  this.onKeyUp = (e) => {
@@ -3548,7 +3578,7 @@ class KeyboardDaemon {
3548
3578
  };
3549
3579
  }
3550
3580
  destroy() {
3551
- this.documentOrShadowRoot.removeEventListener('keyup', this.onKeyUp, false);
3581
+ this.dom.removeEventListener('keyup', this.onKeyUp, false);
3552
3582
  }
3553
3583
  }
3554
3584
  function detectAction(e) {
@@ -4396,7 +4426,7 @@ class Designer {
4396
4426
  * @returns An instance of the designer.
4397
4427
  */
4398
4428
  static create(placeholder, startDefinition, configuration) {
4399
- var _a, _b;
4429
+ var _a;
4400
4430
  if (!placeholder) {
4401
4431
  throw new Error('Placeholder is not defined');
4402
4432
  }
@@ -4405,13 +4435,11 @@ class Designer {
4405
4435
  }
4406
4436
  const config = configuration;
4407
4437
  validateConfiguration(config);
4408
- const documentOrShadowRoot = (_a = configuration.documentOrShadowRoot) !== null && _a !== void 0 ? _a : document;
4409
- const documentBody = (_b = configuration.documentBody) !== null && _b !== void 0 ? _b : document.body;
4410
- if (!isElementAttached(placeholder, documentBody)) {
4438
+ if (!isElementAttached((_a = config.shadowRoot) !== null && _a !== void 0 ? _a : document, placeholder)) {
4411
4439
  throw new Error('Placeholder is not attached to the DOM');
4412
4440
  }
4413
4441
  const services = ServicesResolver.resolve(configuration.extensions, config);
4414
- const designerContext = DesignerContext.create(documentOrShadowRoot, documentBody, placeholder, startDefinition, config, services);
4442
+ const designerContext = DesignerContext.create(placeholder, startDefinition, config, services);
4415
4443
  const designerApi = DesignerApi.create(designerContext);
4416
4444
  const view = DesignerView.create(placeholder, designerContext, designerApi);
4417
4445
  const designer = new Designer(view, designerContext.state, designerContext.stateModifier, designerContext.definitionWalker, designerContext.historyController, designerApi);
@@ -4510,6 +4538,12 @@ class Designer {
4510
4538
  setViewport(viewport) {
4511
4539
  this.state.setViewport(viewport);
4512
4540
  }
4541
+ /**
4542
+ * @description Resets the viewport.
4543
+ */
4544
+ resetViewport() {
4545
+ this.api.viewport.resetViewport();
4546
+ }
4513
4547
  /**
4514
4548
  * @description Unselects the selected step.
4515
4549
  */