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-navigated-viewer v17.3.0
2
+ * bpmn-js - bpmn-navigated-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
 
@@ -22097,8 +22085,6 @@
22097
22085
  }
22098
22086
 
22099
22087
  /**
22100
- * @typedef {import('diagram-js/lib/i18n/translate/translate').default} Translate
22101
- *
22102
22088
  * @typedef {import('../model/Types').ModdleElement} ModdleElement
22103
22089
  */
22104
22090
 
@@ -22131,9 +22117,8 @@
22131
22117
 
22132
22118
  /**
22133
22119
  * @param {Record<'element' | 'root' | 'error', Function>} handler
22134
- * @param {Translate} translate
22135
22120
  */
22136
- function BpmnTreeWalker(handler, translate) {
22121
+ function BpmnTreeWalker(handler) {
22137
22122
 
22138
22123
  // list of containers already walked
22139
22124
  var handledElements = {};
@@ -22167,7 +22152,7 @@
22167
22152
  // avoid multiple rendering of elements
22168
22153
  if (gfx) {
22169
22154
  throw new Error(
22170
- translate('already rendered {element}', { element: elementToString(element) })
22155
+ 'already rendered ${ elementToString(element) }'
22171
22156
  );
22172
22157
  }
22173
22158
 
@@ -22187,11 +22172,10 @@
22187
22172
  handled(element);
22188
22173
 
22189
22174
  return gfx;
22190
- } catch (e) {
22191
- logError(e.message, { element: element, error: e });
22175
+ } catch (error) {
22176
+ logError(error.message, { element, error });
22192
22177
 
22193
- console.error(translate('failed to import {element}', { element: elementToString(element) }));
22194
- console.error(e);
22178
+ console.error(`failed to import ${ elementToString(element) }`, error);
22195
22179
  }
22196
22180
  }
22197
22181
 
@@ -22207,9 +22191,7 @@
22207
22191
  if (bpmnElement) {
22208
22192
  if (diMap[bpmnElement.id]) {
22209
22193
  logError(
22210
- translate('multiple DI elements defined for {element}', {
22211
- element: elementToString(bpmnElement)
22212
- }),
22194
+ `multiple DI elements defined for ${ elementToString(bpmnElement) }`,
22213
22195
  { element: bpmnElement }
22214
22196
  );
22215
22197
  } else {
@@ -22219,9 +22201,7 @@
22219
22201
  }
22220
22202
  } else {
22221
22203
  logError(
22222
- translate('no bpmnElement referenced in {element}', {
22223
- element: elementToString(di)
22224
- }),
22204
+ `no bpmnElement referenced in ${ elementToString(di) }`,
22225
22205
  { element: di }
22226
22206
  );
22227
22207
  }
@@ -22259,7 +22239,7 @@
22259
22239
  var diagrams = definitions.diagrams;
22260
22240
 
22261
22241
  if (diagram && diagrams.indexOf(diagram) === -1) {
22262
- throw new Error(translate('diagram not part of bpmn:Definitions'));
22242
+ throw new Error('diagram not part of <bpmn:Definitions />');
22263
22243
  }
22264
22244
 
22265
22245
  if (!diagram && diagrams && diagrams.length) {
@@ -22268,7 +22248,7 @@
22268
22248
 
22269
22249
  // no diagram -> nothing to import
22270
22250
  if (!diagram) {
22271
- throw new Error(translate('no diagram to display'));
22251
+ throw new Error('no diagram to display');
22272
22252
  }
22273
22253
 
22274
22254
  // load DI from selected diagram only
@@ -22279,10 +22259,9 @@
22279
22259
  var plane = diagram.plane;
22280
22260
 
22281
22261
  if (!plane) {
22282
- throw new Error(translate(
22283
- 'no plane for {element}',
22284
- { element: elementToString(diagram) }
22285
- ));
22262
+ throw new Error(
22263
+ `no plane for ${ elementToString(diagram) }`
22264
+ );
22286
22265
  }
22287
22266
 
22288
22267
  var rootElement = plane.bpmnElement;
@@ -22293,14 +22272,11 @@
22293
22272
  rootElement = findDisplayCandidate(definitions);
22294
22273
 
22295
22274
  if (!rootElement) {
22296
- throw new Error(translate('no process or collaboration to display'));
22275
+ throw new Error('no process or collaboration to display');
22297
22276
  } else {
22298
22277
 
22299
22278
  logError(
22300
- translate('correcting missing bpmnElement on {plane} to {rootElement}', {
22301
- plane: elementToString(plane),
22302
- rootElement: elementToString(rootElement)
22303
- })
22279
+ `correcting missing bpmnElement on ${ elementToString(plane) } to ${ elementToString(rootElement) }`
22304
22280
  );
22305
22281
 
22306
22282
  // correct DI on the fly
@@ -22321,10 +22297,7 @@
22321
22297
  handleUnhandledProcesses(definitions.rootElements, ctx);
22322
22298
  } else {
22323
22299
  throw new Error(
22324
- translate('unsupported bpmnElement for {plane}: {rootElement}', {
22325
- plane: elementToString(plane),
22326
- rootElement: elementToString(rootElement)
22327
- })
22300
+ `unsupported bpmnElement for ${ elementToString(plane) }: ${ elementToString(rootElement) }`
22328
22301
  );
22329
22302
  }
22330
22303
 
@@ -22486,28 +22459,28 @@
22486
22459
  }
22487
22460
 
22488
22461
  function handleFlowElements(flowElements, context) {
22489
- forEach$1(flowElements, function(e) {
22490
- if (is(e, 'bpmn:SequenceFlow')) {
22462
+ forEach$1(flowElements, function(flowElement) {
22463
+ if (is(flowElement, 'bpmn:SequenceFlow')) {
22491
22464
  deferred.push(function() {
22492
- handleSequenceFlow(e, context);
22465
+ handleSequenceFlow(flowElement, context);
22493
22466
  });
22494
- } else if (is(e, 'bpmn:BoundaryEvent')) {
22467
+ } else if (is(flowElement, 'bpmn:BoundaryEvent')) {
22495
22468
  deferred.unshift(function() {
22496
- handleFlowNode(e, context);
22469
+ handleFlowNode(flowElement, context);
22497
22470
  });
22498
- } else if (is(e, 'bpmn:FlowNode')) {
22499
- handleFlowNode(e, context);
22500
- } else if (is(e, 'bpmn:DataObject')) ; else if (is(e, 'bpmn:DataStoreReference')) {
22501
- handleDataElement(e, context);
22502
- } else if (is(e, 'bpmn:DataObjectReference')) {
22503
- handleDataElement(e, context);
22471
+ } else if (is(flowElement, 'bpmn:FlowNode')) {
22472
+ handleFlowNode(flowElement, context);
22473
+ } else if (is(flowElement, 'bpmn:DataObject')) ; else if (is(flowElement, 'bpmn:DataStoreReference')) {
22474
+ handleDataElement(flowElement, context);
22475
+ } else if (is(flowElement, 'bpmn:DataObjectReference')) {
22476
+ handleDataElement(flowElement, context);
22504
22477
  } else {
22505
22478
  logError(
22506
- translate('unrecognized flowElement {element} in context {context}', {
22507
- element: elementToString(e),
22508
- context: (context ? elementToString(context.businessObject) : 'null')
22509
- }),
22510
- { element: e, context: context }
22479
+ `unrecognized flowElement ${ elementToString(flowElement) } in context ${ elementToString(context && context.businessObject) }`,
22480
+ {
22481
+ element: flowElement,
22482
+ context
22483
+ }
22511
22484
  );
22512
22485
  }
22513
22486
  });
@@ -22574,7 +22547,6 @@
22574
22547
 
22575
22548
  var importer,
22576
22549
  eventBus,
22577
- translate,
22578
22550
  canvas;
22579
22551
 
22580
22552
  var error,
@@ -22604,7 +22576,7 @@
22604
22576
  }
22605
22577
  };
22606
22578
 
22607
- var walker = new BpmnTreeWalker(visitor, translate);
22579
+ var walker = new BpmnTreeWalker(visitor);
22608
22580
 
22609
22581
 
22610
22582
  bpmnDiagram = bpmnDiagram || (definitions.diagrams && definitions.diagrams[0]);
@@ -22612,7 +22584,7 @@
22612
22584
  var diagramsToImport = getDiagramsToImport(definitions, bpmnDiagram);
22613
22585
 
22614
22586
  if (!diagramsToImport) {
22615
- throw new Error(translate('no diagram to display'));
22587
+ throw new Error('no diagram to display');
22616
22588
  }
22617
22589
 
22618
22590
  // traverse BPMN 2.0 document model,
@@ -22635,7 +22607,6 @@
22635
22607
  try {
22636
22608
  importer = diagram.get('bpmnImporter');
22637
22609
  eventBus = diagram.get('eventBus');
22638
- translate = diagram.get('translate');
22639
22610
  canvas = diagram.get('canvas');
22640
22611
 
22641
22612
  eventBus.fire('import.render.start', { definitions: definitions });