bpmn-js 17.3.0 → 17.5.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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * bpmn-js - bpmn-viewer v17.3.0
2
+ * bpmn-js - bpmn-viewer v17.5.0
3
3
  *
4
4
  * Copyright (c) 2014-present, camunda Services GmbH
5
5
  *
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * Source Code: https://github.com/bpmn-io/bpmn-js
10
10
  *
11
- * Date: 2024-04-17
11
+ * Date: 2024-04-26
12
12
  */
13
13
  (function (global, factory) {
14
14
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -6398,7 +6398,6 @@
6398
6398
  * @typedef {import('diagram-js/lib/core/Canvas').default} Canvas
6399
6399
  * @typedef {import('diagram-js/lib/core/ElementRegistry').default} ElementRegistry
6400
6400
  * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
6401
- * @typedef {import('diagram-js/lib/i18n/translate/translate').default} Translate
6402
6401
  *
6403
6402
  * @typedef {import('../features/modeling/ElementFactory').default} ElementFactory
6404
6403
  * @typedef {import('../draw/TextRenderer').default} TextRenderer
@@ -6440,12 +6439,10 @@
6440
6439
  });
6441
6440
  }
6442
6441
 
6443
- function notYetDrawn(translate, semantic, refSemantic, property) {
6444
- return new Error(translate('element {element} referenced by {referenced}#{property} not yet drawn', {
6445
- element: elementToString(refSemantic),
6446
- referenced: elementToString(semantic),
6447
- property: property
6448
- }));
6442
+ function notYetDrawn(semantic, refSemantic, property) {
6443
+ return new Error(
6444
+ `element ${ elementToString(refSemantic) } referenced by ${ elementToString(semantic) }#${ property } not yet drawn`
6445
+ );
6449
6446
  }
6450
6447
 
6451
6448
 
@@ -6456,18 +6453,16 @@
6456
6453
  * @param {Canvas} canvas
6457
6454
  * @param {ElementFactory} elementFactory
6458
6455
  * @param {ElementRegistry} elementRegistry
6459
- * @param {Function} translate
6460
6456
  * @param {TextRenderer} textRenderer
6461
6457
  */
6462
6458
  function BpmnImporter(
6463
6459
  eventBus, canvas, elementFactory,
6464
- elementRegistry, translate, textRenderer) {
6460
+ elementRegistry, textRenderer) {
6465
6461
 
6466
6462
  this._eventBus = eventBus;
6467
6463
  this._canvas = canvas;
6468
6464
  this._elementFactory = elementFactory;
6469
6465
  this._elementRegistry = elementRegistry;
6470
- this._translate = translate;
6471
6466
  this._textRenderer = textRenderer;
6472
6467
  }
6473
6468
 
@@ -6476,7 +6471,6 @@
6476
6471
  'canvas',
6477
6472
  'elementFactory',
6478
6473
  'elementRegistry',
6479
- 'translate',
6480
6474
  'textRenderer'
6481
6475
  ];
6482
6476
 
@@ -6493,7 +6487,6 @@
6493
6487
  */
6494
6488
  BpmnImporter.prototype.add = function(semantic, di, parentElement) {
6495
6489
  var element,
6496
- translate = this._translate,
6497
6490
  hidden;
6498
6491
 
6499
6492
  var parentIndex;
@@ -6579,10 +6572,9 @@
6579
6572
 
6580
6573
  this._canvas.addConnection(element, parentElement, parentIndex);
6581
6574
  } else {
6582
- throw new Error(translate('unknown di {di} for element {semantic}', {
6583
- di: elementToString(di),
6584
- semantic: elementToString(semantic)
6585
- }));
6575
+ throw new Error(
6576
+ `unknown di ${ elementToString(di) } for element ${ elementToString(semantic) }`
6577
+ );
6586
6578
  }
6587
6579
 
6588
6580
  // (optional) LABEL
@@ -6590,7 +6582,6 @@
6590
6582
  this.addLabel(semantic, di, element);
6591
6583
  }
6592
6584
 
6593
-
6594
6585
  this._eventBus.fire('bpmnElement.added', { element: element });
6595
6586
 
6596
6587
  return element;
@@ -6604,20 +6595,19 @@
6604
6595
  * @param {Shape} boundaryElement
6605
6596
  */
6606
6597
  BpmnImporter.prototype._attachBoundary = function(boundarySemantic, boundaryElement) {
6607
- var translate = this._translate;
6608
6598
  var hostSemantic = boundarySemantic.attachedToRef;
6609
6599
 
6610
6600
  if (!hostSemantic) {
6611
- throw new Error(translate('missing {semantic}#attachedToRef', {
6612
- semantic: elementToString(boundarySemantic)
6613
- }));
6601
+ throw new Error(
6602
+ `missing ${ elementToString(boundarySemantic) }#attachedToRef`
6603
+ );
6614
6604
  }
6615
6605
 
6616
6606
  var host = this._elementRegistry.get(hostSemantic.id),
6617
6607
  attachers = host && host.attachers;
6618
6608
 
6619
6609
  if (!host) {
6620
- throw notYetDrawn(translate, boundarySemantic, hostSemantic, 'attachedToRef');
6610
+ throw notYetDrawn(boundarySemantic, hostSemantic, 'attachedToRef');
6621
6611
  }
6622
6612
 
6623
6613
  // wire element.host <> host.attachers
@@ -6683,8 +6673,7 @@
6683
6673
 
6684
6674
  var element,
6685
6675
  refSemantic,
6686
- type = semantic.$type,
6687
- translate = this._translate;
6676
+ type = semantic.$type;
6688
6677
 
6689
6678
  refSemantic = semantic[side + 'Ref'];
6690
6679
 
@@ -6707,12 +6696,11 @@
6707
6696
  }
6708
6697
 
6709
6698
  if (refSemantic) {
6710
- throw notYetDrawn(translate, semantic, refSemantic, side + 'Ref');
6699
+ throw notYetDrawn(semantic, refSemantic, side + 'Ref');
6711
6700
  } else {
6712
- throw new Error(translate('{semantic}#{side} Ref not specified', {
6713
- semantic: elementToString(semantic),
6714
- side: side
6715
- }));
6701
+ throw new Error(
6702
+ `${ elementToString(semantic) }#${ side } Ref not specified`
6703
+ );
6716
6704
  }
6717
6705
  };
6718
6706
 
@@ -22072,8 +22060,6 @@
22072
22060
  }
22073
22061
 
22074
22062
  /**
22075
- * @typedef {import('diagram-js/lib/i18n/translate/translate').default} Translate
22076
- *
22077
22063
  * @typedef {import('../model/Types').ModdleElement} ModdleElement
22078
22064
  */
22079
22065
 
@@ -22106,9 +22092,8 @@
22106
22092
 
22107
22093
  /**
22108
22094
  * @param {Record<'element' | 'root' | 'error', Function>} handler
22109
- * @param {Translate} translate
22110
22095
  */
22111
- function BpmnTreeWalker(handler, translate) {
22096
+ function BpmnTreeWalker(handler) {
22112
22097
 
22113
22098
  // list of containers already walked
22114
22099
  var handledElements = {};
@@ -22142,7 +22127,7 @@
22142
22127
  // avoid multiple rendering of elements
22143
22128
  if (gfx) {
22144
22129
  throw new Error(
22145
- translate('already rendered {element}', { element: elementToString(element) })
22130
+ 'already rendered ${ elementToString(element) }'
22146
22131
  );
22147
22132
  }
22148
22133
 
@@ -22162,11 +22147,10 @@
22162
22147
  handled(element);
22163
22148
 
22164
22149
  return gfx;
22165
- } catch (e) {
22166
- logError(e.message, { element: element, error: e });
22150
+ } catch (error) {
22151
+ logError(error.message, { element, error });
22167
22152
 
22168
- console.error(translate('failed to import {element}', { element: elementToString(element) }));
22169
- console.error(e);
22153
+ console.error(`failed to import ${ elementToString(element) }`, error);
22170
22154
  }
22171
22155
  }
22172
22156
 
@@ -22182,9 +22166,7 @@
22182
22166
  if (bpmnElement) {
22183
22167
  if (diMap[bpmnElement.id]) {
22184
22168
  logError(
22185
- translate('multiple DI elements defined for {element}', {
22186
- element: elementToString(bpmnElement)
22187
- }),
22169
+ `multiple DI elements defined for ${ elementToString(bpmnElement) }`,
22188
22170
  { element: bpmnElement }
22189
22171
  );
22190
22172
  } else {
@@ -22194,9 +22176,7 @@
22194
22176
  }
22195
22177
  } else {
22196
22178
  logError(
22197
- translate('no bpmnElement referenced in {element}', {
22198
- element: elementToString(di)
22199
- }),
22179
+ `no bpmnElement referenced in ${ elementToString(di) }`,
22200
22180
  { element: di }
22201
22181
  );
22202
22182
  }
@@ -22234,7 +22214,7 @@
22234
22214
  var diagrams = definitions.diagrams;
22235
22215
 
22236
22216
  if (diagram && diagrams.indexOf(diagram) === -1) {
22237
- throw new Error(translate('diagram not part of bpmn:Definitions'));
22217
+ throw new Error('diagram not part of <bpmn:Definitions />');
22238
22218
  }
22239
22219
 
22240
22220
  if (!diagram && diagrams && diagrams.length) {
@@ -22243,7 +22223,7 @@
22243
22223
 
22244
22224
  // no diagram -> nothing to import
22245
22225
  if (!diagram) {
22246
- throw new Error(translate('no diagram to display'));
22226
+ throw new Error('no diagram to display');
22247
22227
  }
22248
22228
 
22249
22229
  // load DI from selected diagram only
@@ -22254,10 +22234,9 @@
22254
22234
  var plane = diagram.plane;
22255
22235
 
22256
22236
  if (!plane) {
22257
- throw new Error(translate(
22258
- 'no plane for {element}',
22259
- { element: elementToString(diagram) }
22260
- ));
22237
+ throw new Error(
22238
+ `no plane for ${ elementToString(diagram) }`
22239
+ );
22261
22240
  }
22262
22241
 
22263
22242
  var rootElement = plane.bpmnElement;
@@ -22268,14 +22247,11 @@
22268
22247
  rootElement = findDisplayCandidate(definitions);
22269
22248
 
22270
22249
  if (!rootElement) {
22271
- throw new Error(translate('no process or collaboration to display'));
22250
+ throw new Error('no process or collaboration to display');
22272
22251
  } else {
22273
22252
 
22274
22253
  logError(
22275
- translate('correcting missing bpmnElement on {plane} to {rootElement}', {
22276
- plane: elementToString(plane),
22277
- rootElement: elementToString(rootElement)
22278
- })
22254
+ `correcting missing bpmnElement on ${ elementToString(plane) } to ${ elementToString(rootElement) }`
22279
22255
  );
22280
22256
 
22281
22257
  // correct DI on the fly
@@ -22296,10 +22272,7 @@
22296
22272
  handleUnhandledProcesses(definitions.rootElements, ctx);
22297
22273
  } else {
22298
22274
  throw new Error(
22299
- translate('unsupported bpmnElement for {plane}: {rootElement}', {
22300
- plane: elementToString(plane),
22301
- rootElement: elementToString(rootElement)
22302
- })
22275
+ `unsupported bpmnElement for ${ elementToString(plane) }: ${ elementToString(rootElement) }`
22303
22276
  );
22304
22277
  }
22305
22278
 
@@ -22461,28 +22434,28 @@
22461
22434
  }
22462
22435
 
22463
22436
  function handleFlowElements(flowElements, context) {
22464
- forEach$1(flowElements, function(e) {
22465
- if (is(e, 'bpmn:SequenceFlow')) {
22437
+ forEach$1(flowElements, function(flowElement) {
22438
+ if (is(flowElement, 'bpmn:SequenceFlow')) {
22466
22439
  deferred.push(function() {
22467
- handleSequenceFlow(e, context);
22440
+ handleSequenceFlow(flowElement, context);
22468
22441
  });
22469
- } else if (is(e, 'bpmn:BoundaryEvent')) {
22442
+ } else if (is(flowElement, 'bpmn:BoundaryEvent')) {
22470
22443
  deferred.unshift(function() {
22471
- handleFlowNode(e, context);
22444
+ handleFlowNode(flowElement, context);
22472
22445
  });
22473
- } else if (is(e, 'bpmn:FlowNode')) {
22474
- handleFlowNode(e, context);
22475
- } else if (is(e, 'bpmn:DataObject')) ; else if (is(e, 'bpmn:DataStoreReference')) {
22476
- handleDataElement(e, context);
22477
- } else if (is(e, 'bpmn:DataObjectReference')) {
22478
- handleDataElement(e, context);
22446
+ } else if (is(flowElement, 'bpmn:FlowNode')) {
22447
+ handleFlowNode(flowElement, context);
22448
+ } else if (is(flowElement, 'bpmn:DataObject')) ; else if (is(flowElement, 'bpmn:DataStoreReference')) {
22449
+ handleDataElement(flowElement, context);
22450
+ } else if (is(flowElement, 'bpmn:DataObjectReference')) {
22451
+ handleDataElement(flowElement, context);
22479
22452
  } else {
22480
22453
  logError(
22481
- translate('unrecognized flowElement {element} in context {context}', {
22482
- element: elementToString(e),
22483
- context: (context ? elementToString(context.businessObject) : 'null')
22484
- }),
22485
- { element: e, context: context }
22454
+ `unrecognized flowElement ${ elementToString(flowElement) } in context ${ elementToString(context && context.businessObject) }`,
22455
+ {
22456
+ element: flowElement,
22457
+ context
22458
+ }
22486
22459
  );
22487
22460
  }
22488
22461
  });
@@ -22549,7 +22522,6 @@
22549
22522
 
22550
22523
  var importer,
22551
22524
  eventBus,
22552
- translate,
22553
22525
  canvas;
22554
22526
 
22555
22527
  var error,
@@ -22579,7 +22551,7 @@
22579
22551
  }
22580
22552
  };
22581
22553
 
22582
- var walker = new BpmnTreeWalker(visitor, translate);
22554
+ var walker = new BpmnTreeWalker(visitor);
22583
22555
 
22584
22556
 
22585
22557
  bpmnDiagram = bpmnDiagram || (definitions.diagrams && definitions.diagrams[0]);
@@ -22587,7 +22559,7 @@
22587
22559
  var diagramsToImport = getDiagramsToImport(definitions, bpmnDiagram);
22588
22560
 
22589
22561
  if (!diagramsToImport) {
22590
- throw new Error(translate('no diagram to display'));
22562
+ throw new Error('no diagram to display');
22591
22563
  }
22592
22564
 
22593
22565
  // traverse BPMN 2.0 document model,
@@ -22610,7 +22582,6 @@
22610
22582
  try {
22611
22583
  importer = diagram.get('bpmnImporter');
22612
22584
  eventBus = diagram.get('eventBus');
22613
- translate = diagram.get('translate');
22614
22585
  canvas = diagram.get('canvas');
22615
22586
 
22616
22587
  eventBus.fire('import.render.start', { definitions: definitions });