bpmn-js 17.4.0 → 17.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/bpmn-modeler.development.js +167 -154
  2. package/dist/bpmn-modeler.production.min.js +7 -7
  3. package/dist/bpmn-navigated-viewer.development.js +108 -85
  4. package/dist/bpmn-navigated-viewer.production.min.js +4 -4
  5. package/dist/bpmn-viewer.development.js +104 -85
  6. package/dist/bpmn-viewer.production.min.js +4 -4
  7. package/lib/BaseModeler.d.ts +5 -2
  8. package/lib/BaseModeler.js +5 -1
  9. package/lib/BaseViewer.d.ts +81 -9
  10. package/lib/BaseViewer.js +47 -3
  11. package/lib/Modeler.d.ts +4 -2
  12. package/lib/Modeler.js +4 -1
  13. package/lib/NavigatedViewer.d.ts +4 -1
  14. package/lib/NavigatedViewer.js +4 -0
  15. package/lib/Viewer.d.ts +5 -2
  16. package/lib/Viewer.js +5 -1
  17. package/lib/features/context-pad/ContextPadProvider.js +4 -5
  18. package/lib/features/label-editing/LabelEditingProvider.js +21 -1
  19. package/lib/features/modeling/BpmnUpdater.d.ts +1 -3
  20. package/lib/features/modeling/BpmnUpdater.js +4 -17
  21. package/lib/features/modeling/ElementFactory.d.ts +1 -3
  22. package/lib/features/modeling/ElementFactory.js +5 -10
  23. package/lib/features/modeling/behavior/UpdateFlowNodeRefsBehavior.d.ts +1 -3
  24. package/lib/features/modeling/behavior/UpdateFlowNodeRefsBehavior.js +4 -7
  25. package/lib/features/modeling/cmd/SetColorHandler.js +1 -1
  26. package/lib/features/modeling/cmd/SplitLaneHandler.d.ts +1 -3
  27. package/lib/features/modeling/cmd/SplitLaneHandler.js +4 -9
  28. package/lib/features/modeling/cmd/UpdatePropertiesHandler.d.ts +1 -3
  29. package/lib/features/modeling/cmd/UpdatePropertiesHandler.js +3 -8
  30. package/lib/features/ordering/BpmnOrderingProvider.d.ts +1 -3
  31. package/lib/features/ordering/BpmnOrderingProvider.js +4 -6
  32. package/lib/features/ordering/index.d.ts +0 -1
  33. package/lib/features/ordering/index.js +0 -5
  34. package/lib/import/BpmnImporter.d.ts +1 -3
  35. package/lib/import/BpmnImporter.js +17 -29
  36. package/lib/import/BpmnTreeWalker.d.ts +1 -3
  37. package/lib/import/BpmnTreeWalker.js +32 -47
  38. package/lib/import/Importer.js +2 -4
  39. package/package.json +2 -2
@@ -1,10 +1,13 @@
1
1
  /**
2
2
  * A base modeler for BPMN 2.0 diagrams.
3
3
  *
4
- * See {@link Modeler} for a fully-featured modeler.
4
+ * See {@link bpmn-js/lib/Modeler} for a fully-featured modeler.
5
+ *
6
+ *
7
+ * @extends BaseViewer<ServiceMap>
5
8
  *
6
9
  */
7
- export default class BaseModeler extends BaseViewer {}
10
+ export default class BaseModeler<ServiceMap = null> extends BaseViewer<ServiceMap> {}
8
11
 
9
12
  type BaseViewerOptions = import('./BaseViewer').BaseViewerOptions;
10
13
  type ModdleElementsById = import('./BaseViewer').ModdleElementsById;
@@ -15,7 +15,11 @@ import BaseViewer from './BaseViewer';
15
15
  /**
16
16
  * A base modeler for BPMN 2.0 diagrams.
17
17
  *
18
- * See {@link Modeler} for a fully-featured modeler.
18
+ * See {@link bpmn-js/lib/Modeler} for a fully-featured modeler.
19
+ *
20
+ * @template [ServiceMap=null]
21
+ *
22
+ * @extends BaseViewer<ServiceMap>
19
23
  *
20
24
  * @param {BaseViewerOptions} [options] The options to configure the modeler.
21
25
  */
@@ -1,11 +1,14 @@
1
1
  /**
2
2
  * A base viewer for BPMN 2.0 diagrams.
3
3
  *
4
- * Have a look at {@link Viewer}, {@link NavigatedViewer} or {@link Modeler} for
4
+ * Have a look at {@link bpmn-js/lib/Viewer}, {@link bpmn-js/lib/NavigatedViewer} or {@link bpmn-js/lib/Modeler} for
5
5
  * bundles that include actual features.
6
6
  *
7
+ *
8
+ * @extends Diagram<ServiceMap>
9
+ *
7
10
  */
8
- export default class BaseViewer extends Diagram<null> {
11
+ export default class BaseViewer<ServiceMap = null> extends Diagram<ServiceMap> {
9
12
  /**
10
13
  * @param options The options to configure the viewer.
11
14
  */
@@ -145,21 +148,85 @@ export default class BaseViewer extends Diagram<null> {
145
148
  getModules(): ModuleDeclaration[];
146
149
 
147
150
  /**
148
- * Register an event listener.
151
+ * Register an event listener for events with the given name.
152
+ *
153
+ * The callback will be invoked with `event, ...additionalArguments`
154
+ * that have been passed to {@link EventBus#fire}.
155
+ *
156
+ * Returning false from a listener will prevent the events default action
157
+ * (if any is specified). To stop an event from being processed further in
158
+ * other listeners execute {@link Event#stopPropagation}.
159
+ *
160
+ * Returning anything but `undefined` from a listener will stop the listener propagation.
161
+ *
162
+ *
163
+ * @param events to subscribe to
164
+ * @param callback
165
+ * @param that callback context
166
+ */
167
+ on<EventName extends keyof EventMap<ServiceMap>>(
168
+ events: EventName,
169
+ callback: EventBusEventCallback<(EventMap<ServiceMap>)[EventName]>,
170
+ that?: any
171
+ ): void;
172
+
173
+ /**
174
+ * Register an event listener for events with the given name.
175
+ *
176
+ * The callback will be invoked with `event, ...additionalArguments`
177
+ * that have been passed to {@link EventBus#fire}.
178
+ *
179
+ * Returning false from a listener will prevent the events default action
180
+ * (if any is specified). To stop an event from being processed further in
181
+ * other listeners execute {@link Event#stopPropagation}.
182
+ *
183
+ * Returning anything but `undefined` from a listener will stop the listener propagation.
184
+ *
185
+ *
186
+ * @param events to subscribe to
187
+ * @param priority listen priority
188
+ * @param callback
189
+ * @param that callback context
190
+ */
191
+ on<EventName extends keyof EventMap<ServiceMap>>(
192
+ events: EventName,
193
+ priority: number,
194
+ callback: EventBusEventCallback<(EventMap<ServiceMap>)[EventName]>,
195
+ that?: any
196
+ ): void;
197
+
198
+ /**
149
199
  *
150
- * Remove an event listener via {@link BaseViewer#off}.
200
+ * Register an event listener for events with the given name.
201
+ *
202
+ * The callback will be invoked with `event, ...additionalArguments`
203
+ * that have been passed to {@link EventBus#fire}.
204
+ *
205
+ * Returning false from a listener will prevent the events default action
206
+ * (if any is specified). To stop an event from being processed further in
207
+ * other listeners execute {@link Event#stopPropagation}.
208
+ *
209
+ * Returning anything but `undefined` from a listener will stop the listener propagation.
151
210
  *
152
211
  *
153
212
  * @param events The event(s) to listen to.
154
213
  * @param callback The callback.
155
214
  * @param that Value of `this` the callback will be called with.
156
215
  */
157
- on<T>(events: string | string[], callback: EventBusEventCallback<T>, that?: any): any;
216
+ on<T>(events: string|string[], callback: EventBusEventCallback<T>, that?: any): void;
158
217
 
159
218
  /**
160
- * Register an event listener.
161
219
  *
162
- * Remove an event listener via {@link BaseViewer#off}.
220
+ * Register an event listener for events with the given name.
221
+ *
222
+ * The callback will be invoked with `event, ...additionalArguments`
223
+ * that have been passed to {@link EventBus#fire}.
224
+ *
225
+ * Returning false from a listener will prevent the events default action
226
+ * (if any is specified). To stop an event from being processed further in
227
+ * other listeners execute {@link Event#stopPropagation}.
228
+ *
229
+ * Returning anything but `undefined` from a listener will stop the listener propagation.
163
230
  *
164
231
  *
165
232
  * @param events The event(s) to listen to.
@@ -168,11 +235,11 @@ export default class BaseViewer extends Diagram<null> {
168
235
  * @param that Value of `this` the callback will be called with.
169
236
  */
170
237
  on<T>(
171
- events: string | string[],
238
+ events: string|string[],
172
239
  priority: number,
173
240
  callback: EventBusEventCallback<T>,
174
241
  that?: any
175
- ): any;
242
+ ): void;
176
243
 
177
244
  /**
178
245
  * Remove an event listener.
@@ -204,6 +271,7 @@ export default class BaseViewer extends Diagram<null> {
204
271
  detach(): void;
205
272
  }
206
273
 
274
+ type EventBus<T> = import('diagram-js/lib/core/EventBus').default<T>;
207
275
  type EventBusEventCallback<T> = import('diagram-js/lib/core/EventBus').EventBusEventCallback<T>;
208
276
  type ModuleDeclaration = import('didi').ModuleDeclaration;
209
277
  type Moddle = import('./model/Types').Moddle;
@@ -277,4 +345,8 @@ export type SaveSVGDoneEvent = {
277
345
  svg: string;
278
346
  };
279
347
 
348
+ export type EventMap<Type> = Type extends {
349
+ eventBus: import("diagram-js/lib/core/EventBus").default<infer X>;
350
+ } ? X : never;
351
+
280
352
  import Diagram from 'diagram-js';
package/lib/BaseViewer.js CHANGED
@@ -31,6 +31,12 @@ import {
31
31
  importBpmnDiagram
32
32
  } from './import/Importer';
33
33
 
34
+ /**
35
+ * @template T
36
+ *
37
+ * @typedef { import('diagram-js/lib/core/EventBus').default<T> } EventBus
38
+ */
39
+
34
40
  /**
35
41
  * @template T
36
42
  *
@@ -116,12 +122,22 @@ import {
116
122
  * } } SaveSVGDoneEvent
117
123
  */
118
124
 
125
+ /**
126
+ * @template Type
127
+ *
128
+ * @typedef { Type extends { eventBus: EventBus<infer X> } ? X : never } EventMap
129
+ */
130
+
119
131
  /**
120
132
  * A base viewer for BPMN 2.0 diagrams.
121
133
  *
122
- * Have a look at {@link Viewer}, {@link NavigatedViewer} or {@link Modeler} for
134
+ * Have a look at {@link bpmn-js/lib/Viewer}, {@link bpmn-js/lib/NavigatedViewer} or {@link bpmn-js/lib/Modeler} for
123
135
  * bundles that include actual features.
124
136
  *
137
+ * @template [ServiceMap=null]
138
+ *
139
+ * @extends Diagram<ServiceMap>
140
+ *
125
141
  * @param {BaseViewerOptions} [options] The options to configure the viewer.
126
142
  */
127
143
  export default function BaseViewer(options) {
@@ -542,9 +558,18 @@ BaseViewer.prototype.destroy = function() {
542
558
  };
543
559
 
544
560
  /**
545
- * Register an event listener.
561
+ * @overlord
546
562
  *
547
- * Remove an event listener via {@link BaseViewer#off}.
563
+ * Register an event listener for events with the given name.
564
+ *
565
+ * The callback will be invoked with `event, ...additionalArguments`
566
+ * that have been passed to {@link EventBus#fire}.
567
+ *
568
+ * Returning false from a listener will prevent the events default action
569
+ * (if any is specified). To stop an event from being processed further in
570
+ * other listeners execute {@link Event#stopPropagation}.
571
+ *
572
+ * Returning anything but `undefined` from a listener will stop the listener propagation.
548
573
  *
549
574
  * @template T
550
575
  *
@@ -553,6 +578,25 @@ BaseViewer.prototype.destroy = function() {
553
578
  * @param {EventBusEventCallback<T>} callback The callback.
554
579
  * @param {any} [that] Value of `this` the callback will be called with.
555
580
  */
581
+ /**
582
+ * Register an event listener for events with the given name.
583
+ *
584
+ * The callback will be invoked with `event, ...additionalArguments`
585
+ * that have been passed to {@link EventBus#fire}.
586
+ *
587
+ * Returning false from a listener will prevent the events default action
588
+ * (if any is specified). To stop an event from being processed further in
589
+ * other listeners execute {@link Event#stopPropagation}.
590
+ *
591
+ * Returning anything but `undefined` from a listener will stop the listener propagation.
592
+ *
593
+ * @template {keyof EventMap<ServiceMap>} EventName
594
+ *
595
+ * @param {EventName} events to subscribe to
596
+ * @param {number} [priority=1000] listen priority
597
+ * @param {EventBusEventCallback<(EventMap<ServiceMap>)[EventName]>} callback
598
+ * @param {any} [that] callback context
599
+ */
556
600
  BaseViewer.prototype.on = function(events, priority, callback, that) {
557
601
  return this.get('eventBus').on(events, priority, callback, that);
558
602
  };
package/lib/Modeler.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * A modeler for BPMN 2.0 diagrams.
3
3
  *
4
- *
5
4
  * ## Extending the Modeler
6
5
  *
7
6
  * In order to extend the viewer pass extension modules to bootstrap via the
@@ -62,8 +61,11 @@
62
61
  * var bpmnModeler = new Modeler({ additionalModules: [ overrideModule ]});
63
62
  * ```
64
63
  *
64
+ *
65
+ * @extends BaseModeler<ServiceMap>
66
+ *
65
67
  */
66
- export default class Modeler extends BaseModeler {
68
+ export default class Modeler<ServiceMap = null> extends BaseModeler<ServiceMap> {
67
69
  static Viewer: typeof Viewer;
68
70
  static NavigatedViewer: typeof NavigatedViewer;
69
71
 
package/lib/Modeler.js CHANGED
@@ -64,7 +64,6 @@ var initialDiagram =
64
64
  /**
65
65
  * A modeler for BPMN 2.0 diagrams.
66
66
  *
67
- *
68
67
  * ## Extending the Modeler
69
68
  *
70
69
  * In order to extend the viewer pass extension modules to bootstrap via the
@@ -125,6 +124,10 @@ var initialDiagram =
125
124
  * var bpmnModeler = new Modeler({ additionalModules: [ overrideModule ]});
126
125
  * ```
127
126
  *
127
+ * @template [ServiceMap=null]
128
+ *
129
+ * @extends BaseModeler<ServiceMap>
130
+ *
128
131
  * @param {BaseViewerOptions} [options] The options to configure the modeler.
129
132
  */
130
133
  export default function Modeler(options) {
@@ -1,8 +1,11 @@
1
1
  /**
2
2
  * A viewer with mouse and keyboard navigation features.
3
3
  *
4
+ *
5
+ * @extends Viewer<ServiceMap>
6
+ *
4
7
  */
5
- export default class NavigatedViewer extends Viewer {}
8
+ export default class NavigatedViewer<ServiceMap = null> extends Viewer<ServiceMap> {}
6
9
 
7
10
  type BaseViewerOptions = import('./BaseViewer').BaseViewerOptions;
8
11
  import Viewer from './Viewer';
@@ -13,6 +13,10 @@ import ZoomScrollModule from 'diagram-js/lib/navigation/zoomscroll';
13
13
  /**
14
14
  * A viewer with mouse and keyboard navigation features.
15
15
  *
16
+ * @template [ServiceMap=null]
17
+ *
18
+ * @extends Viewer<ServiceMap>
19
+ *
16
20
  * @param {BaseViewerOptions} [options]
17
21
  */
18
22
  export default function NavigatedViewer(options) {
package/lib/Viewer.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * A viewer for BPMN 2.0 diagrams.
3
3
  *
4
- * Have a look at {@link NavigatedViewer} or {@link Modeler} for bundles that include
4
+ * Have a look at {@link bpmn-js/lib/NavigatedViewer} or {@link bpmn-js/lib/Modeler} for bundles that include
5
5
  * additional features.
6
6
  *
7
7
  *
@@ -37,8 +37,11 @@
37
37
  * bpmnViewer.importXML(...);
38
38
  * ```
39
39
  *
40
+ *
41
+ * @extends BaseViewer<ServiceMap>
42
+ *
40
43
  */
41
- export default class Viewer extends BaseViewer {}
44
+ export default class Viewer<ServiceMap = null> extends BaseViewer<ServiceMap> {}
42
45
 
43
46
  type BaseViewerOptions = import('./BaseViewer').BaseViewerOptions;
44
47
  import BaseViewer from './BaseViewer';
package/lib/Viewer.js CHANGED
@@ -17,7 +17,7 @@ import BaseViewer from './BaseViewer';
17
17
  /**
18
18
  * A viewer for BPMN 2.0 diagrams.
19
19
  *
20
- * Have a look at {@link NavigatedViewer} or {@link Modeler} for bundles that include
20
+ * Have a look at {@link bpmn-js/lib/NavigatedViewer} or {@link bpmn-js/lib/Modeler} for bundles that include
21
21
  * additional features.
22
22
  *
23
23
  *
@@ -53,6 +53,10 @@ import BaseViewer from './BaseViewer';
53
53
  * bpmnViewer.importXML(...);
54
54
  * ```
55
55
  *
56
+ * @template [ServiceMap=null]
57
+ *
58
+ * @extends BaseViewer<ServiceMap>
59
+ *
56
60
  * @param {BaseViewerOptions} [options] The options to configure the viewer.
57
61
  */
58
62
  export default function Viewer(options) {
@@ -110,6 +110,10 @@ export default function ContextPadProvider(
110
110
  entries.replace.action.click(event, shape);
111
111
  }
112
112
  });
113
+
114
+ eventBus.on('contextPad.close', function() {
115
+ appendPreview.cleanUp();
116
+ });
113
117
  }
114
118
 
115
119
  ContextPadProvider.$inject = [
@@ -244,16 +248,12 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
244
248
  create.start(event, shape, {
245
249
  source: element
246
250
  });
247
-
248
- appendPreview.cleanUp();
249
251
  }
250
252
 
251
253
  var append = autoPlace ? function(_, element) {
252
254
  var shape = elementFactory.createShape(assign({ type: type }, options));
253
255
 
254
256
  autoPlace.append(element, shape);
255
-
256
- appendPreview.cleanUp();
257
257
  } : appendStart;
258
258
 
259
259
  var previewAppend = autoPlace ? function(_, element) {
@@ -487,7 +487,6 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
487
487
  'bpmn-icon-text-annotation',
488
488
  translate('Add text annotation')
489
489
  ),
490
-
491
490
  'connect': {
492
491
  group: 'connect',
493
492
  className: 'bpmn-icon-connection-multi',
@@ -202,6 +202,13 @@ LabelEditingProvider.prototype.activate = function(element) {
202
202
  assign(context, bounds);
203
203
 
204
204
  var options = {};
205
+ var style = context.style || {};
206
+
207
+ // Remove background and border
208
+ assign(style, {
209
+ backgroundColor: null,
210
+ border: null
211
+ });
205
212
 
206
213
  // tasks
207
214
  if (
@@ -223,6 +230,12 @@ LabelEditingProvider.prototype.activate = function(element) {
223
230
  assign(options, {
224
231
  autoResize: true
225
232
  });
233
+
234
+ // keep background and border for external labels
235
+ assign(style, {
236
+ backgroundColor: '#ffffff',
237
+ border: '1px solid #ccc'
238
+ });
226
239
  }
227
240
 
228
241
  // text annotations
@@ -231,10 +244,17 @@ LabelEditingProvider.prototype.activate = function(element) {
231
244
  resizable: true,
232
245
  autoResize: true
233
246
  });
247
+
248
+ // keep background and border for text annotations
249
+ assign(style, {
250
+ backgroundColor: '#ffffff',
251
+ border: '1px solid #ccc'
252
+ });
234
253
  }
235
254
 
236
255
  assign(context, {
237
- options: options
256
+ options: options,
257
+ style: style
238
258
  });
239
259
 
240
260
  return context;
@@ -8,9 +8,8 @@ export default class BpmnUpdater extends CommandInterceptor {
8
8
  * @param eventBus
9
9
  * @param bpmnFactory
10
10
  * @param connectionDocking
11
- * @param translate
12
11
  */
13
- constructor(eventBus: EventBus, bpmnFactory: BpmnFactory, connectionDocking: CroppingConnectionDocking, translate: Translate);
12
+ constructor(eventBus: EventBus, bpmnFactory: BpmnFactory, connectionDocking: CroppingConnectionDocking);
14
13
 
15
14
  /**
16
15
  * @param context
@@ -83,7 +82,6 @@ export default class BpmnUpdater extends CommandInterceptor {
83
82
  type EventBus = import('diagram-js/lib/core/EventBus').default;
84
83
  type BpmnFactory = import('./BpmnFactory').default;
85
84
  type CroppingConnectionDocking = import('diagram-js/lib/layout/CroppingConnectionDocking').default;
86
- export type Translate = typeof import("diagram-js/lib/i18n/translate/translate").default;
87
85
  type Connection = import('../../model/Types').Connection;
88
86
  type Element = import('../../model/Types').Element;
89
87
  type Shape = import('../../model/Types').Shape;
@@ -34,7 +34,6 @@ import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
34
34
  * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
35
35
  * @typedef {import('./BpmnFactory').default} BpmnFactory
36
36
  * @typedef {import('diagram-js/lib/layout/CroppingConnectionDocking').default} CroppingConnectionDocking
37
- * @typedef {import('diagram-js/lib/i18n/translate/translate').default} Translate
38
37
  *
39
38
  * @typedef {import('../../model/Types').Connection} Connection
40
39
  * @typedef {import('../../model/Types').Element} Element
@@ -50,24 +49,20 @@ import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
50
49
  * @param {EventBus} eventBus
51
50
  * @param {BpmnFactory} bpmnFactory
52
51
  * @param {CroppingConnectionDocking} connectionDocking
53
- * @param {Translate} translate
54
52
  */
55
53
  export default function BpmnUpdater(
56
54
  eventBus,
57
55
  bpmnFactory,
58
- connectionDocking,
59
- translate
56
+ connectionDocking
60
57
  ) {
61
58
 
62
59
  CommandInterceptor.call(this, eventBus);
63
60
 
64
61
  this._bpmnFactory = bpmnFactory;
65
- this._translate = translate;
66
62
 
67
63
  var self = this;
68
64
 
69
65
 
70
-
71
66
  // connection cropping //////////////////////
72
67
 
73
68
  // crop connection ends during create/update
@@ -322,8 +317,7 @@ inherits(BpmnUpdater, CommandInterceptor);
322
317
  BpmnUpdater.$inject = [
323
318
  'eventBus',
324
319
  'bpmnFactory',
325
- 'connectionDocking',
326
- 'translate'
320
+ 'connectionDocking'
327
321
  ];
328
322
 
329
323
 
@@ -562,8 +556,7 @@ BpmnUpdater.prototype.getLaneSet = function(container) {
562
556
  */
563
557
  BpmnUpdater.prototype.updateSemanticParent = function(businessObject, newParent, visualParent) {
564
558
 
565
- var containment,
566
- translate = this._translate;
559
+ var containment;
567
560
 
568
561
  if (businessObject.$parent === newParent) {
569
562
  return;
@@ -668,13 +661,7 @@ BpmnUpdater.prototype.updateSemanticParent = function(businessObject, newParent,
668
661
  }
669
662
 
670
663
  if (!containment) {
671
- throw new Error(translate(
672
- 'no parent for {element} in {parent}',
673
- {
674
- element: businessObject.id,
675
- parent: newParent.id
676
- }
677
- ));
664
+ throw new Error(`no parent for <${ businessObject.id }> in <${ newParent.id }>`);
678
665
  }
679
666
 
680
667
  var children;
@@ -11,9 +11,8 @@ export default class ElementFactory<T extends import("../../model/Types").Connec
11
11
  /**
12
12
  * @param bpmnFactory
13
13
  * @param moddle
14
- * @param translate
15
14
  */
16
- constructor(bpmnFactory: BpmnFactory, moddle: Moddle, translate: Translate);
15
+ constructor(bpmnFactory: BpmnFactory, moddle: Moddle);
17
16
 
18
17
  /**
19
18
  * Create a label.
@@ -105,7 +104,6 @@ export default class ElementFactory<T extends import("../../model/Types").Connec
105
104
  createParticipantShape(attrs?: boolean | (Partial<Shape> & Partial<BpmnAttributes>)): W;
106
105
  }
107
106
 
108
- export type Translate = typeof import("diagram-js/lib/i18n/translate/translate").default;
109
107
  type Dimensions = import('diagram-js/lib/util/Types').Dimensions;
110
108
  type BpmnFactory = import('./BpmnFactory').default;
111
109
  type BpmnAttributes = import('../../model/Types').BpmnAttributes;
@@ -34,8 +34,6 @@ import {
34
34
  } from '../../util/CompatibilityUtil';
35
35
 
36
36
  /**
37
- * @typedef {import('diagram-js/lib/i18n/translate/translate').default} Translate
38
- *
39
37
  * @typedef {import('diagram-js/lib/util/Types').Dimensions} Dimensions
40
38
  *
41
39
  * @typedef {import('./BpmnFactory').default} BpmnFactory
@@ -62,22 +60,19 @@ import {
62
60
  *
63
61
  * @param {BpmnFactory} bpmnFactory
64
62
  * @param {Moddle} moddle
65
- * @param {Translate} translate
66
63
  */
67
- export default function ElementFactory(bpmnFactory, moddle, translate) {
64
+ export default function ElementFactory(bpmnFactory, moddle) {
68
65
  BaseElementFactory.call(this);
69
66
 
70
67
  this._bpmnFactory = bpmnFactory;
71
68
  this._moddle = moddle;
72
- this._translate = translate;
73
69
  }
74
70
 
75
71
  inherits(ElementFactory, BaseElementFactory);
76
72
 
77
73
  ElementFactory.$inject = [
78
74
  'bpmnFactory',
79
- 'moddle',
80
- 'translate'
75
+ 'moddle'
81
76
  ];
82
77
 
83
78
  ElementFactory.prototype._baseCreate = BaseElementFactory.prototype.create;
@@ -155,17 +150,17 @@ ElementFactory.prototype.create = function(elementType, attrs) {
155
150
  * @return {T}
156
151
  */
157
152
  ElementFactory.prototype.createElement = function(elementType, attrs) {
158
- var size,
159
- translate = this._translate;
160
153
 
161
154
  attrs = assign({}, attrs || {});
162
155
 
156
+ var size;
157
+
163
158
  var businessObject = attrs.businessObject,
164
159
  di = attrs.di;
165
160
 
166
161
  if (!businessObject) {
167
162
  if (!attrs.type) {
168
- throw new Error(translate('no shape type specified'));
163
+ throw new Error('no shape type specified');
169
164
  }
170
165
 
171
166
  businessObject = this._bpmnFactory.create(attrs.type);
@@ -6,12 +6,10 @@ export default class UpdateFlowNodeRefsBehavior extends CommandInterceptor {
6
6
  /**
7
7
  * @param eventBus
8
8
  * @param modeling
9
- * @param translate
10
9
  */
11
- constructor(eventBus: EventBus, modeling: Modeling, translate: Translate);
10
+ constructor(eventBus: EventBus, modeling: Modeling);
12
11
  }
13
12
 
14
13
  type EventBus = import('diagram-js/lib/core/EventBus').default;
15
14
  type Modeling = import('../Modeling').default;
16
- export type Translate = typeof import("diagram-js/lib/i18n/translate/translate").default;
17
15
  import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
@@ -9,7 +9,6 @@ import {
9
9
  /**
10
10
  * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
11
11
  * @typedef {import('../Modeling').default} Modeling
12
- * @typedef {import('diagram-js/lib/i18n/translate/translate').default} Translate
13
12
  */
14
13
 
15
14
  var LOW_PRIORITY = 500,
@@ -21,9 +20,8 @@ var LOW_PRIORITY = 500,
21
20
  *
22
21
  * @param {EventBus} eventBus
23
22
  * @param {Modeling} modeling
24
- * @param {Translate} translate
25
23
  */
26
- export default function UpdateFlowNodeRefsBehavior(eventBus, modeling, translate) {
24
+ export default function UpdateFlowNodeRefsBehavior(eventBus, modeling) {
27
25
 
28
26
  CommandInterceptor.call(this, eventBus);
29
27
 
@@ -46,7 +44,7 @@ export default function UpdateFlowNodeRefsBehavior(eventBus, modeling, translate
46
44
 
47
45
  function getContext() {
48
46
  if (!context) {
49
- throw new Error(translate('out of bounds release'));
47
+ throw new Error('out of bounds release');
50
48
  }
51
49
 
52
50
  return context;
@@ -55,7 +53,7 @@ export default function UpdateFlowNodeRefsBehavior(eventBus, modeling, translate
55
53
  function releaseContext() {
56
54
 
57
55
  if (!context) {
58
- throw new Error(translate('out of bounds release'));
56
+ throw new Error('out of bounds release');
59
57
  }
60
58
 
61
59
  var triggerUpdate = context.leave();
@@ -127,8 +125,7 @@ export default function UpdateFlowNodeRefsBehavior(eventBus, modeling, translate
127
125
 
128
126
  UpdateFlowNodeRefsBehavior.$inject = [
129
127
  'eventBus',
130
- 'modeling' ,
131
- 'translate'
128
+ 'modeling'
132
129
  ];
133
130
 
134
131
  inherits(UpdateFlowNodeRefsBehavior, CommandInterceptor);
@@ -52,7 +52,7 @@ export default function SetColorHandler(commandStack) {
52
52
  }
53
53
  }
54
54
 
55
- throw new Error('invalid color value: ' + color);
55
+ throw new Error(`invalid color value: ${ color }`);
56
56
  };
57
57
  }
58
58