sequential-workflow-designer 0.37.3 → 0.37.4

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
@@ -107,10 +107,10 @@ Add the below code to your head section in HTML document.
107
107
  ```html
108
108
  <head>
109
109
  ...
110
- <link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.37.3/css/designer.css" rel="stylesheet" />
111
- <link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.37.3/css/designer-light.css" rel="stylesheet" />
112
- <link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.37.3/css/designer-dark.css" rel="stylesheet" />
113
- <script src="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.37.3/dist/index.umd.js"></script>
110
+ <link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.37.4/css/designer.css" rel="stylesheet" />
111
+ <link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.37.4/css/designer-light.css" rel="stylesheet" />
112
+ <link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.37.4/css/designer-dark.css" rel="stylesheet" />
113
+ <script src="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.37.4/dist/index.umd.js"></script>
114
114
  </head>
115
115
  ```
116
116
 
package/dist/index.umd.js CHANGED
@@ -133,11 +133,15 @@
133
133
  class SimpleEvent {
134
134
  constructor() {
135
135
  this.listeners = [];
136
- this.forward = (value) => {
137
- if (this.listeners.length > 0) {
138
- this.listeners.forEach(listener => listener(value));
136
+ this.emit = (value) => {
137
+ for (const listener of this.listeners) {
138
+ listener(value);
139
139
  }
140
140
  };
141
+ /**
142
+ * @deprecated Use `emit` method instead.
143
+ */
144
+ this.forward = this.emit;
141
145
  }
142
146
  subscribe(listener) {
143
147
  this.listeners.push(listener);
@@ -169,14 +173,14 @@
169
173
  const value = [undefined, undefined, undefined, undefined];
170
174
  const result = new SimpleEvent();
171
175
  let scheduled = false;
172
- function forward() {
176
+ function emit() {
173
177
  if (scheduled) {
174
178
  return;
175
179
  }
176
180
  scheduled = true;
177
181
  setTimeout(() => {
178
182
  try {
179
- result.forward(value);
183
+ result.emit(value);
180
184
  }
181
185
  finally {
182
186
  scheduled = false;
@@ -187,7 +191,7 @@
187
191
  function subscribe(event, index) {
188
192
  event.subscribe(v => {
189
193
  value[index] = v;
190
- forward();
194
+ emit();
191
195
  });
192
196
  }
193
197
  subscribe(a, 0);
@@ -204,7 +208,7 @@
204
208
  class ControlBarApi {
205
209
  static create(state, historyController, stateModifier) {
206
210
  const api = new ControlBarApi(state, historyController, stateModifier);
207
- race(0, state.onIsReadonlyChanged, state.onSelectedStepIdChanged, state.onIsDragDisabledChanged, api.isUndoRedoSupported() ? state.onDefinitionChanged : undefined).subscribe(api.onStateChanged.forward);
211
+ race(0, state.onIsReadonlyChanged, state.onSelectedStepIdChanged, state.onIsDragDisabledChanged, api.isUndoRedoSupported() ? state.onDefinitionChanged : undefined).subscribe(api.onStateChanged.emit);
208
212
  return api;
209
213
  }
210
214
  constructor(state, historyController, stateModifier) {
@@ -3283,16 +3287,16 @@
3283
3287
  setSelectedStepId(stepId) {
3284
3288
  if (this.selectedStepId !== stepId) {
3285
3289
  this.selectedStepId = stepId;
3286
- this.onSelectedStepIdChanged.forward(stepId);
3290
+ this.onSelectedStepIdChanged.emit(stepId);
3287
3291
  }
3288
3292
  }
3289
3293
  pushStepIdToFolderPath(stepId) {
3290
3294
  this.folderPath.push(stepId);
3291
- this.onFolderPathChanged.forward(this.folderPath);
3295
+ this.onFolderPathChanged.emit(this.folderPath);
3292
3296
  }
3293
3297
  setFolderPath(path) {
3294
3298
  this.folderPath = path;
3295
- this.onFolderPathChanged.forward(path);
3299
+ this.onFolderPathChanged.emit(path);
3296
3300
  }
3297
3301
  tryGetLastStepIdFromFolderPath() {
3298
3302
  return this.folderPath.length > 0 ? this.folderPath[this.folderPath.length - 1] : null;
@@ -3310,50 +3314,50 @@
3310
3314
  if (details) {
3311
3315
  Object.assign(event, details);
3312
3316
  }
3313
- this.onDefinitionChanged.forward(event);
3317
+ this.onDefinitionChanged.emit(event);
3314
3318
  }
3315
3319
  notifyStepUnselectionBlocked(stepId) {
3316
- this.onStepUnselectionBlocked.forward(stepId);
3320
+ this.onStepUnselectionBlocked.emit(stepId);
3317
3321
  }
3318
3322
  setViewport(viewport) {
3319
3323
  this.viewport = viewport;
3320
- this.onViewportChanged.forward(viewport);
3324
+ this.onViewportChanged.emit(viewport);
3321
3325
  }
3322
3326
  setIsReadonly(isReadonly) {
3323
3327
  if (this.isReadonly !== isReadonly) {
3324
3328
  this.isReadonly = isReadonly;
3325
- this.onIsReadonlyChanged.forward(isReadonly);
3329
+ this.onIsReadonlyChanged.emit(isReadonly);
3326
3330
  }
3327
3331
  }
3328
3332
  setIsDragging(isDragging) {
3329
3333
  if (this.isDragging !== isDragging) {
3330
3334
  this.isDragging = isDragging;
3331
- this.onIsDraggingChanged.forward(isDragging);
3335
+ this.onIsDraggingChanged.emit(isDragging);
3332
3336
  }
3333
3337
  }
3334
3338
  setIsDragDisabled(isDragDisabled) {
3335
3339
  if (this.isDragDisabled !== isDragDisabled) {
3336
3340
  this.isDragDisabled = isDragDisabled;
3337
- this.onIsDragDisabledChanged.forward(isDragDisabled);
3341
+ this.onIsDragDisabledChanged.emit(isDragDisabled);
3338
3342
  }
3339
3343
  }
3340
3344
  setIsToolboxCollapsed(isCollapsed) {
3341
3345
  if (this.isToolboxCollapsed !== isCollapsed) {
3342
3346
  this.isToolboxCollapsed = isCollapsed;
3343
- this.onIsToolboxCollapsedChanged.forward(isCollapsed);
3347
+ this.onIsToolboxCollapsedChanged.emit(isCollapsed);
3344
3348
  }
3345
3349
  }
3346
3350
  setIsEditorCollapsed(isCollapsed) {
3347
3351
  if (this.isEditorCollapsed !== isCollapsed) {
3348
3352
  this.isEditorCollapsed = isCollapsed;
3349
- this.onIsEditorCollapsedChanged.forward(isCollapsed);
3353
+ this.onIsEditorCollapsedChanged.emit(isCollapsed);
3350
3354
  }
3351
3355
  }
3352
3356
  setPreferences(changes, stepId) {
3353
3357
  for (const change of changes) {
3354
3358
  this.preferenceStorage.setItem(change.key, change.value);
3355
3359
  }
3356
- this.onPreferencesChanged.forward({ changes, stepId });
3360
+ this.onPreferencesChanged.emit({ changes, stepId });
3357
3361
  }
3358
3362
  getPreference(key) {
3359
3363
  return this.preferenceStorage.getItem(key);
@@ -4194,7 +4198,7 @@
4194
4198
  this.view.render(rootSequence.sequence, parentPlaceIndicator);
4195
4199
  this.trySelectStepComponent(this.state.selectedStepId);
4196
4200
  this.updateBadges();
4197
- this.onRootComponentUpdated.forward();
4201
+ this.onRootComponentUpdated.emit();
4198
4202
  };
4199
4203
  this.onClick = (position, target, buttonIndex, altKey) => {
4200
4204
  const isPrimaryButton = buttonIndex === 0;
@@ -5262,21 +5266,22 @@
5262
5266
  const designerApi = DesignerApi.create(designerContext);
5263
5267
  const view = DesignerView.create(placeholder, designerContext, designerApi);
5264
5268
  const designer = new Designer(view, designerContext.state, designerContext.definitionWalker, designerContext.historyController, designerApi);
5265
- view.workspace.onRootComponentUpdated.subscribe(designer.onRootComponentUpdated.forward);
5266
- view.workspace.onRootComponentUpdated.once().then(designer.onReady.forward);
5269
+ view.workspace.onRootComponentUpdated.subscribe(designer.onRootComponentUpdated.emit);
5270
+ view.workspace.onRootComponentUpdated.once().then(designer.onReady.emit);
5267
5271
  race(0, designerContext.state.onDefinitionChanged, designerContext.state.onSelectedStepIdChanged).subscribe(([definition, selectedStepId]) => {
5268
5272
  if (definition !== undefined) {
5269
- designer.onDefinitionChanged.forward(definition);
5273
+ designer.onDefinitionChanged.emit(definition);
5270
5274
  }
5271
5275
  if (selectedStepId !== undefined) {
5272
- designer.onSelectedStepIdChanged.forward(designerContext.state.selectedStepId);
5276
+ designer.onSelectedStepIdChanged.emit(designerContext.state.selectedStepId);
5273
5277
  }
5274
5278
  });
5275
- designerContext.state.onViewportChanged.subscribe(designer.onViewportChanged.forward);
5276
- designerContext.state.onIsToolboxCollapsedChanged.subscribe(designer.onIsToolboxCollapsedChanged.forward);
5277
- designerContext.state.onIsEditorCollapsedChanged.subscribe(designer.onIsEditorCollapsedChanged.forward);
5278
- designerContext.state.onStepUnselectionBlocked.subscribe(designer.onStepUnselectionBlocked.forward);
5279
- designerContext.state.onPreferencesChanged.subscribe(designer.onPreferencesChanged.forward);
5279
+ designerContext.state.onViewportChanged.subscribe(designer.onViewportChanged.emit);
5280
+ designerContext.state.onIsToolboxCollapsedChanged.subscribe(designer.onIsToolboxCollapsedChanged.emit);
5281
+ designerContext.state.onIsEditorCollapsedChanged.subscribe(designer.onIsEditorCollapsedChanged.emit);
5282
+ designerContext.state.onStepUnselectionBlocked.subscribe(designer.onStepUnselectionBlocked.emit);
5283
+ designerContext.state.onIsDraggingChanged.subscribe(designer.onIsDraggingChanged.emit);
5284
+ designerContext.state.onPreferencesChanged.subscribe(designer.onPreferencesChanged.emit);
5280
5285
  return designer;
5281
5286
  }
5282
5287
  constructor(view, state, walker, historyController, api) {
@@ -5317,6 +5322,10 @@
5317
5322
  * @description Fires when the root component and all its children are rerendered.
5318
5323
  */
5319
5324
  this.onRootComponentUpdated = new SimpleEvent();
5325
+ /**
5326
+ * @description Fires when the dragging state has changed. `true` if the step is being dragged, otherwise `false`.
5327
+ */
5328
+ this.onIsDraggingChanged = new SimpleEvent();
5320
5329
  /**
5321
5330
  * @description Fires when any of the designer preferences has changed.
5322
5331
  */
@@ -5426,6 +5435,12 @@
5426
5435
  isEditorCollapsed() {
5427
5436
  return this.state.isEditorCollapsed;
5428
5437
  }
5438
+ /**
5439
+ * @returns a flag that indicates whether the step is being dragged.
5440
+ */
5441
+ isDragging() {
5442
+ return this.state.isDragging;
5443
+ }
5429
5444
  /**
5430
5445
  * @description Sets a flag that indicates whether the editor is collapsed.
5431
5446
  */
package/lib/cjs/index.cjs CHANGED
@@ -131,11 +131,15 @@ class Uid {
131
131
  class SimpleEvent {
132
132
  constructor() {
133
133
  this.listeners = [];
134
- this.forward = (value) => {
135
- if (this.listeners.length > 0) {
136
- this.listeners.forEach(listener => listener(value));
134
+ this.emit = (value) => {
135
+ for (const listener of this.listeners) {
136
+ listener(value);
137
137
  }
138
138
  };
139
+ /**
140
+ * @deprecated Use `emit` method instead.
141
+ */
142
+ this.forward = this.emit;
139
143
  }
140
144
  subscribe(listener) {
141
145
  this.listeners.push(listener);
@@ -167,14 +171,14 @@ function race(timeout, a, b, c, d) {
167
171
  const value = [undefined, undefined, undefined, undefined];
168
172
  const result = new SimpleEvent();
169
173
  let scheduled = false;
170
- function forward() {
174
+ function emit() {
171
175
  if (scheduled) {
172
176
  return;
173
177
  }
174
178
  scheduled = true;
175
179
  setTimeout(() => {
176
180
  try {
177
- result.forward(value);
181
+ result.emit(value);
178
182
  }
179
183
  finally {
180
184
  scheduled = false;
@@ -185,7 +189,7 @@ function race(timeout, a, b, c, d) {
185
189
  function subscribe(event, index) {
186
190
  event.subscribe(v => {
187
191
  value[index] = v;
188
- forward();
192
+ emit();
189
193
  });
190
194
  }
191
195
  subscribe(a, 0);
@@ -202,7 +206,7 @@ function race(timeout, a, b, c, d) {
202
206
  class ControlBarApi {
203
207
  static create(state, historyController, stateModifier) {
204
208
  const api = new ControlBarApi(state, historyController, stateModifier);
205
- race(0, state.onIsReadonlyChanged, state.onSelectedStepIdChanged, state.onIsDragDisabledChanged, api.isUndoRedoSupported() ? state.onDefinitionChanged : undefined).subscribe(api.onStateChanged.forward);
209
+ race(0, state.onIsReadonlyChanged, state.onSelectedStepIdChanged, state.onIsDragDisabledChanged, api.isUndoRedoSupported() ? state.onDefinitionChanged : undefined).subscribe(api.onStateChanged.emit);
206
210
  return api;
207
211
  }
208
212
  constructor(state, historyController, stateModifier) {
@@ -3098,16 +3102,16 @@ class DesignerState {
3098
3102
  setSelectedStepId(stepId) {
3099
3103
  if (this.selectedStepId !== stepId) {
3100
3104
  this.selectedStepId = stepId;
3101
- this.onSelectedStepIdChanged.forward(stepId);
3105
+ this.onSelectedStepIdChanged.emit(stepId);
3102
3106
  }
3103
3107
  }
3104
3108
  pushStepIdToFolderPath(stepId) {
3105
3109
  this.folderPath.push(stepId);
3106
- this.onFolderPathChanged.forward(this.folderPath);
3110
+ this.onFolderPathChanged.emit(this.folderPath);
3107
3111
  }
3108
3112
  setFolderPath(path) {
3109
3113
  this.folderPath = path;
3110
- this.onFolderPathChanged.forward(path);
3114
+ this.onFolderPathChanged.emit(path);
3111
3115
  }
3112
3116
  tryGetLastStepIdFromFolderPath() {
3113
3117
  return this.folderPath.length > 0 ? this.folderPath[this.folderPath.length - 1] : null;
@@ -3125,50 +3129,50 @@ class DesignerState {
3125
3129
  if (details) {
3126
3130
  Object.assign(event, details);
3127
3131
  }
3128
- this.onDefinitionChanged.forward(event);
3132
+ this.onDefinitionChanged.emit(event);
3129
3133
  }
3130
3134
  notifyStepUnselectionBlocked(stepId) {
3131
- this.onStepUnselectionBlocked.forward(stepId);
3135
+ this.onStepUnselectionBlocked.emit(stepId);
3132
3136
  }
3133
3137
  setViewport(viewport) {
3134
3138
  this.viewport = viewport;
3135
- this.onViewportChanged.forward(viewport);
3139
+ this.onViewportChanged.emit(viewport);
3136
3140
  }
3137
3141
  setIsReadonly(isReadonly) {
3138
3142
  if (this.isReadonly !== isReadonly) {
3139
3143
  this.isReadonly = isReadonly;
3140
- this.onIsReadonlyChanged.forward(isReadonly);
3144
+ this.onIsReadonlyChanged.emit(isReadonly);
3141
3145
  }
3142
3146
  }
3143
3147
  setIsDragging(isDragging) {
3144
3148
  if (this.isDragging !== isDragging) {
3145
3149
  this.isDragging = isDragging;
3146
- this.onIsDraggingChanged.forward(isDragging);
3150
+ this.onIsDraggingChanged.emit(isDragging);
3147
3151
  }
3148
3152
  }
3149
3153
  setIsDragDisabled(isDragDisabled) {
3150
3154
  if (this.isDragDisabled !== isDragDisabled) {
3151
3155
  this.isDragDisabled = isDragDisabled;
3152
- this.onIsDragDisabledChanged.forward(isDragDisabled);
3156
+ this.onIsDragDisabledChanged.emit(isDragDisabled);
3153
3157
  }
3154
3158
  }
3155
3159
  setIsToolboxCollapsed(isCollapsed) {
3156
3160
  if (this.isToolboxCollapsed !== isCollapsed) {
3157
3161
  this.isToolboxCollapsed = isCollapsed;
3158
- this.onIsToolboxCollapsedChanged.forward(isCollapsed);
3162
+ this.onIsToolboxCollapsedChanged.emit(isCollapsed);
3159
3163
  }
3160
3164
  }
3161
3165
  setIsEditorCollapsed(isCollapsed) {
3162
3166
  if (this.isEditorCollapsed !== isCollapsed) {
3163
3167
  this.isEditorCollapsed = isCollapsed;
3164
- this.onIsEditorCollapsedChanged.forward(isCollapsed);
3168
+ this.onIsEditorCollapsedChanged.emit(isCollapsed);
3165
3169
  }
3166
3170
  }
3167
3171
  setPreferences(changes, stepId) {
3168
3172
  for (const change of changes) {
3169
3173
  this.preferenceStorage.setItem(change.key, change.value);
3170
3174
  }
3171
- this.onPreferencesChanged.forward({ changes, stepId });
3175
+ this.onPreferencesChanged.emit({ changes, stepId });
3172
3176
  }
3173
3177
  getPreference(key) {
3174
3178
  return this.preferenceStorage.getItem(key);
@@ -4009,7 +4013,7 @@ class Workspace {
4009
4013
  this.view.render(rootSequence.sequence, parentPlaceIndicator);
4010
4014
  this.trySelectStepComponent(this.state.selectedStepId);
4011
4015
  this.updateBadges();
4012
- this.onRootComponentUpdated.forward();
4016
+ this.onRootComponentUpdated.emit();
4013
4017
  };
4014
4018
  this.onClick = (position, target, buttonIndex, altKey) => {
4015
4019
  const isPrimaryButton = buttonIndex === 0;
@@ -5077,21 +5081,22 @@ class Designer {
5077
5081
  const designerApi = DesignerApi.create(designerContext);
5078
5082
  const view = DesignerView.create(placeholder, designerContext, designerApi);
5079
5083
  const designer = new Designer(view, designerContext.state, designerContext.definitionWalker, designerContext.historyController, designerApi);
5080
- view.workspace.onRootComponentUpdated.subscribe(designer.onRootComponentUpdated.forward);
5081
- view.workspace.onRootComponentUpdated.once().then(designer.onReady.forward);
5084
+ view.workspace.onRootComponentUpdated.subscribe(designer.onRootComponentUpdated.emit);
5085
+ view.workspace.onRootComponentUpdated.once().then(designer.onReady.emit);
5082
5086
  race(0, designerContext.state.onDefinitionChanged, designerContext.state.onSelectedStepIdChanged).subscribe(([definition, selectedStepId]) => {
5083
5087
  if (definition !== undefined) {
5084
- designer.onDefinitionChanged.forward(definition);
5088
+ designer.onDefinitionChanged.emit(definition);
5085
5089
  }
5086
5090
  if (selectedStepId !== undefined) {
5087
- designer.onSelectedStepIdChanged.forward(designerContext.state.selectedStepId);
5091
+ designer.onSelectedStepIdChanged.emit(designerContext.state.selectedStepId);
5088
5092
  }
5089
5093
  });
5090
- designerContext.state.onViewportChanged.subscribe(designer.onViewportChanged.forward);
5091
- designerContext.state.onIsToolboxCollapsedChanged.subscribe(designer.onIsToolboxCollapsedChanged.forward);
5092
- designerContext.state.onIsEditorCollapsedChanged.subscribe(designer.onIsEditorCollapsedChanged.forward);
5093
- designerContext.state.onStepUnselectionBlocked.subscribe(designer.onStepUnselectionBlocked.forward);
5094
- designerContext.state.onPreferencesChanged.subscribe(designer.onPreferencesChanged.forward);
5094
+ designerContext.state.onViewportChanged.subscribe(designer.onViewportChanged.emit);
5095
+ designerContext.state.onIsToolboxCollapsedChanged.subscribe(designer.onIsToolboxCollapsedChanged.emit);
5096
+ designerContext.state.onIsEditorCollapsedChanged.subscribe(designer.onIsEditorCollapsedChanged.emit);
5097
+ designerContext.state.onStepUnselectionBlocked.subscribe(designer.onStepUnselectionBlocked.emit);
5098
+ designerContext.state.onIsDraggingChanged.subscribe(designer.onIsDraggingChanged.emit);
5099
+ designerContext.state.onPreferencesChanged.subscribe(designer.onPreferencesChanged.emit);
5095
5100
  return designer;
5096
5101
  }
5097
5102
  constructor(view, state, walker, historyController, api) {
@@ -5132,6 +5137,10 @@ class Designer {
5132
5137
  * @description Fires when the root component and all its children are rerendered.
5133
5138
  */
5134
5139
  this.onRootComponentUpdated = new SimpleEvent();
5140
+ /**
5141
+ * @description Fires when the dragging state has changed. `true` if the step is being dragged, otherwise `false`.
5142
+ */
5143
+ this.onIsDraggingChanged = new SimpleEvent();
5135
5144
  /**
5136
5145
  * @description Fires when any of the designer preferences has changed.
5137
5146
  */
@@ -5241,6 +5250,12 @@ class Designer {
5241
5250
  isEditorCollapsed() {
5242
5251
  return this.state.isEditorCollapsed;
5243
5252
  }
5253
+ /**
5254
+ * @returns a flag that indicates whether the step is being dragged.
5255
+ */
5256
+ isDragging() {
5257
+ return this.state.isDragging;
5258
+ }
5244
5259
  /**
5245
5260
  * @description Sets a flag that indicates whether the editor is collapsed.
5246
5261
  */
package/lib/esm/index.js CHANGED
@@ -130,11 +130,15 @@ class Uid {
130
130
  class SimpleEvent {
131
131
  constructor() {
132
132
  this.listeners = [];
133
- this.forward = (value) => {
134
- if (this.listeners.length > 0) {
135
- this.listeners.forEach(listener => listener(value));
133
+ this.emit = (value) => {
134
+ for (const listener of this.listeners) {
135
+ listener(value);
136
136
  }
137
137
  };
138
+ /**
139
+ * @deprecated Use `emit` method instead.
140
+ */
141
+ this.forward = this.emit;
138
142
  }
139
143
  subscribe(listener) {
140
144
  this.listeners.push(listener);
@@ -166,14 +170,14 @@ function race(timeout, a, b, c, d) {
166
170
  const value = [undefined, undefined, undefined, undefined];
167
171
  const result = new SimpleEvent();
168
172
  let scheduled = false;
169
- function forward() {
173
+ function emit() {
170
174
  if (scheduled) {
171
175
  return;
172
176
  }
173
177
  scheduled = true;
174
178
  setTimeout(() => {
175
179
  try {
176
- result.forward(value);
180
+ result.emit(value);
177
181
  }
178
182
  finally {
179
183
  scheduled = false;
@@ -184,7 +188,7 @@ function race(timeout, a, b, c, d) {
184
188
  function subscribe(event, index) {
185
189
  event.subscribe(v => {
186
190
  value[index] = v;
187
- forward();
191
+ emit();
188
192
  });
189
193
  }
190
194
  subscribe(a, 0);
@@ -201,7 +205,7 @@ function race(timeout, a, b, c, d) {
201
205
  class ControlBarApi {
202
206
  static create(state, historyController, stateModifier) {
203
207
  const api = new ControlBarApi(state, historyController, stateModifier);
204
- race(0, state.onIsReadonlyChanged, state.onSelectedStepIdChanged, state.onIsDragDisabledChanged, api.isUndoRedoSupported() ? state.onDefinitionChanged : undefined).subscribe(api.onStateChanged.forward);
208
+ race(0, state.onIsReadonlyChanged, state.onSelectedStepIdChanged, state.onIsDragDisabledChanged, api.isUndoRedoSupported() ? state.onDefinitionChanged : undefined).subscribe(api.onStateChanged.emit);
205
209
  return api;
206
210
  }
207
211
  constructor(state, historyController, stateModifier) {
@@ -3097,16 +3101,16 @@ class DesignerState {
3097
3101
  setSelectedStepId(stepId) {
3098
3102
  if (this.selectedStepId !== stepId) {
3099
3103
  this.selectedStepId = stepId;
3100
- this.onSelectedStepIdChanged.forward(stepId);
3104
+ this.onSelectedStepIdChanged.emit(stepId);
3101
3105
  }
3102
3106
  }
3103
3107
  pushStepIdToFolderPath(stepId) {
3104
3108
  this.folderPath.push(stepId);
3105
- this.onFolderPathChanged.forward(this.folderPath);
3109
+ this.onFolderPathChanged.emit(this.folderPath);
3106
3110
  }
3107
3111
  setFolderPath(path) {
3108
3112
  this.folderPath = path;
3109
- this.onFolderPathChanged.forward(path);
3113
+ this.onFolderPathChanged.emit(path);
3110
3114
  }
3111
3115
  tryGetLastStepIdFromFolderPath() {
3112
3116
  return this.folderPath.length > 0 ? this.folderPath[this.folderPath.length - 1] : null;
@@ -3124,50 +3128,50 @@ class DesignerState {
3124
3128
  if (details) {
3125
3129
  Object.assign(event, details);
3126
3130
  }
3127
- this.onDefinitionChanged.forward(event);
3131
+ this.onDefinitionChanged.emit(event);
3128
3132
  }
3129
3133
  notifyStepUnselectionBlocked(stepId) {
3130
- this.onStepUnselectionBlocked.forward(stepId);
3134
+ this.onStepUnselectionBlocked.emit(stepId);
3131
3135
  }
3132
3136
  setViewport(viewport) {
3133
3137
  this.viewport = viewport;
3134
- this.onViewportChanged.forward(viewport);
3138
+ this.onViewportChanged.emit(viewport);
3135
3139
  }
3136
3140
  setIsReadonly(isReadonly) {
3137
3141
  if (this.isReadonly !== isReadonly) {
3138
3142
  this.isReadonly = isReadonly;
3139
- this.onIsReadonlyChanged.forward(isReadonly);
3143
+ this.onIsReadonlyChanged.emit(isReadonly);
3140
3144
  }
3141
3145
  }
3142
3146
  setIsDragging(isDragging) {
3143
3147
  if (this.isDragging !== isDragging) {
3144
3148
  this.isDragging = isDragging;
3145
- this.onIsDraggingChanged.forward(isDragging);
3149
+ this.onIsDraggingChanged.emit(isDragging);
3146
3150
  }
3147
3151
  }
3148
3152
  setIsDragDisabled(isDragDisabled) {
3149
3153
  if (this.isDragDisabled !== isDragDisabled) {
3150
3154
  this.isDragDisabled = isDragDisabled;
3151
- this.onIsDragDisabledChanged.forward(isDragDisabled);
3155
+ this.onIsDragDisabledChanged.emit(isDragDisabled);
3152
3156
  }
3153
3157
  }
3154
3158
  setIsToolboxCollapsed(isCollapsed) {
3155
3159
  if (this.isToolboxCollapsed !== isCollapsed) {
3156
3160
  this.isToolboxCollapsed = isCollapsed;
3157
- this.onIsToolboxCollapsedChanged.forward(isCollapsed);
3161
+ this.onIsToolboxCollapsedChanged.emit(isCollapsed);
3158
3162
  }
3159
3163
  }
3160
3164
  setIsEditorCollapsed(isCollapsed) {
3161
3165
  if (this.isEditorCollapsed !== isCollapsed) {
3162
3166
  this.isEditorCollapsed = isCollapsed;
3163
- this.onIsEditorCollapsedChanged.forward(isCollapsed);
3167
+ this.onIsEditorCollapsedChanged.emit(isCollapsed);
3164
3168
  }
3165
3169
  }
3166
3170
  setPreferences(changes, stepId) {
3167
3171
  for (const change of changes) {
3168
3172
  this.preferenceStorage.setItem(change.key, change.value);
3169
3173
  }
3170
- this.onPreferencesChanged.forward({ changes, stepId });
3174
+ this.onPreferencesChanged.emit({ changes, stepId });
3171
3175
  }
3172
3176
  getPreference(key) {
3173
3177
  return this.preferenceStorage.getItem(key);
@@ -4008,7 +4012,7 @@ class Workspace {
4008
4012
  this.view.render(rootSequence.sequence, parentPlaceIndicator);
4009
4013
  this.trySelectStepComponent(this.state.selectedStepId);
4010
4014
  this.updateBadges();
4011
- this.onRootComponentUpdated.forward();
4015
+ this.onRootComponentUpdated.emit();
4012
4016
  };
4013
4017
  this.onClick = (position, target, buttonIndex, altKey) => {
4014
4018
  const isPrimaryButton = buttonIndex === 0;
@@ -5076,21 +5080,22 @@ class Designer {
5076
5080
  const designerApi = DesignerApi.create(designerContext);
5077
5081
  const view = DesignerView.create(placeholder, designerContext, designerApi);
5078
5082
  const designer = new Designer(view, designerContext.state, designerContext.definitionWalker, designerContext.historyController, designerApi);
5079
- view.workspace.onRootComponentUpdated.subscribe(designer.onRootComponentUpdated.forward);
5080
- view.workspace.onRootComponentUpdated.once().then(designer.onReady.forward);
5083
+ view.workspace.onRootComponentUpdated.subscribe(designer.onRootComponentUpdated.emit);
5084
+ view.workspace.onRootComponentUpdated.once().then(designer.onReady.emit);
5081
5085
  race(0, designerContext.state.onDefinitionChanged, designerContext.state.onSelectedStepIdChanged).subscribe(([definition, selectedStepId]) => {
5082
5086
  if (definition !== undefined) {
5083
- designer.onDefinitionChanged.forward(definition);
5087
+ designer.onDefinitionChanged.emit(definition);
5084
5088
  }
5085
5089
  if (selectedStepId !== undefined) {
5086
- designer.onSelectedStepIdChanged.forward(designerContext.state.selectedStepId);
5090
+ designer.onSelectedStepIdChanged.emit(designerContext.state.selectedStepId);
5087
5091
  }
5088
5092
  });
5089
- designerContext.state.onViewportChanged.subscribe(designer.onViewportChanged.forward);
5090
- designerContext.state.onIsToolboxCollapsedChanged.subscribe(designer.onIsToolboxCollapsedChanged.forward);
5091
- designerContext.state.onIsEditorCollapsedChanged.subscribe(designer.onIsEditorCollapsedChanged.forward);
5092
- designerContext.state.onStepUnselectionBlocked.subscribe(designer.onStepUnselectionBlocked.forward);
5093
- designerContext.state.onPreferencesChanged.subscribe(designer.onPreferencesChanged.forward);
5093
+ designerContext.state.onViewportChanged.subscribe(designer.onViewportChanged.emit);
5094
+ designerContext.state.onIsToolboxCollapsedChanged.subscribe(designer.onIsToolboxCollapsedChanged.emit);
5095
+ designerContext.state.onIsEditorCollapsedChanged.subscribe(designer.onIsEditorCollapsedChanged.emit);
5096
+ designerContext.state.onStepUnselectionBlocked.subscribe(designer.onStepUnselectionBlocked.emit);
5097
+ designerContext.state.onIsDraggingChanged.subscribe(designer.onIsDraggingChanged.emit);
5098
+ designerContext.state.onPreferencesChanged.subscribe(designer.onPreferencesChanged.emit);
5094
5099
  return designer;
5095
5100
  }
5096
5101
  constructor(view, state, walker, historyController, api) {
@@ -5131,6 +5136,10 @@ class Designer {
5131
5136
  * @description Fires when the root component and all its children are rerendered.
5132
5137
  */
5133
5138
  this.onRootComponentUpdated = new SimpleEvent();
5139
+ /**
5140
+ * @description Fires when the dragging state has changed. `true` if the step is being dragged, otherwise `false`.
5141
+ */
5142
+ this.onIsDraggingChanged = new SimpleEvent();
5134
5143
  /**
5135
5144
  * @description Fires when any of the designer preferences has changed.
5136
5145
  */
@@ -5240,6 +5249,12 @@ class Designer {
5240
5249
  isEditorCollapsed() {
5241
5250
  return this.state.isEditorCollapsed;
5242
5251
  }
5252
+ /**
5253
+ * @returns a flag that indicates whether the step is being dragged.
5254
+ */
5255
+ isDragging() {
5256
+ return this.state.isDragging;
5257
+ }
5243
5258
  /**
5244
5259
  * @description Sets a flag that indicates whether the editor is collapsed.
5245
5260
  */
package/lib/index.d.ts CHANGED
@@ -61,6 +61,10 @@ declare class SimpleEvent<T> {
61
61
  private readonly listeners;
62
62
  subscribe(listener: SimpleEventListener<T>): void;
63
63
  unsubscribe(listener: SimpleEventListener<T>): void;
64
+ readonly emit: (value: T) => void;
65
+ /**
66
+ * @deprecated Use `emit` method instead.
67
+ */
64
68
  readonly forward: (value: T) => void;
65
69
  count(): number;
66
70
  once(): Promise<T>;
@@ -1391,6 +1395,10 @@ declare class Designer<TDefinition extends Definition = Definition> {
1391
1395
  * @description Fires when the root component and all its children are rerendered.
1392
1396
  */
1393
1397
  readonly onRootComponentUpdated: SimpleEvent<void>;
1398
+ /**
1399
+ * @description Fires when the dragging state has changed. `true` if the step is being dragged, otherwise `false`.
1400
+ */
1401
+ readonly onIsDraggingChanged: SimpleEvent<boolean>;
1394
1402
  /**
1395
1403
  * @description Fires when any of the designer preferences has changed.
1396
1404
  */
@@ -1464,6 +1472,10 @@ declare class Designer<TDefinition extends Definition = Definition> {
1464
1472
  * @returns a flag that indicates whether the editor is collapsed.
1465
1473
  */
1466
1474
  isEditorCollapsed(): boolean;
1475
+ /**
1476
+ * @returns a flag that indicates whether the step is being dragged.
1477
+ */
1478
+ isDragging(): boolean;
1467
1479
  /**
1468
1480
  * @description Sets a flag that indicates whether the editor is collapsed.
1469
1481
  */
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.37.3",
4
+ "version": "0.37.4",
5
5
  "type": "module",
6
6
  "main": "./lib/esm/index.js",
7
7
  "types": "./lib/index.d.ts",