camunda-bpmn-js 1.2.0 → 1.3.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/README.md +3 -5
  2. package/dist/assets/bpmn-font/css/bpmn-codes.css +6 -6
  3. package/dist/assets/bpmn-font/css/bpmn-embedded.css +18 -13
  4. package/dist/assets/bpmn-font/css/bpmn.css +14 -15
  5. package/dist/assets/bpmn-font/font/bpmn.eot +0 -0
  6. package/dist/assets/bpmn-font/font/bpmn.svg +12 -12
  7. package/dist/assets/bpmn-font/font/bpmn.ttf +0 -0
  8. package/dist/assets/bpmn-font/font/bpmn.woff +0 -0
  9. package/dist/assets/bpmn-font/font/bpmn.woff2 +0 -0
  10. package/dist/assets/diagram-js.css +6 -3
  11. package/dist/assets/properties-panel.css +4 -0
  12. package/dist/base-modeler.development.js +2587 -1172
  13. package/dist/base-modeler.production.min.js +39 -39
  14. package/dist/base-navigated-viewer.development.js +324 -219
  15. package/dist/base-navigated-viewer.production.min.js +2 -2
  16. package/dist/base-viewer.development.js +324 -219
  17. package/dist/base-viewer.production.min.js +2 -2
  18. package/dist/camunda-cloud-modeler.development.js +2613 -1185
  19. package/dist/camunda-cloud-modeler.production.min.js +39 -39
  20. package/dist/camunda-cloud-navigated-viewer.development.js +324 -219
  21. package/dist/camunda-cloud-navigated-viewer.production.min.js +2 -2
  22. package/dist/camunda-cloud-viewer.development.js +324 -219
  23. package/dist/camunda-cloud-viewer.production.min.js +2 -2
  24. package/dist/camunda-platform-modeler.development.js +2597 -1183
  25. package/dist/camunda-platform-modeler.production.min.js +39 -39
  26. package/dist/camunda-platform-navigated-viewer.development.js +324 -219
  27. package/dist/camunda-platform-navigated-viewer.production.min.js +2 -2
  28. package/dist/camunda-platform-viewer.development.js +324 -219
  29. package/dist/camunda-platform-viewer.production.min.js +2 -2
  30. package/lib/camunda-cloud/Modeler.js +12 -0
  31. package/package.json +20 -7
  32. package/dist/assets/bpmn-font/bpmn-codes.css +0 -108
  33. package/dist/assets/bpmn-font/bpmn-embedded.css +0 -161
  34. package/dist/assets/bpmn-font/bpmn.css +0 -164
  35. package/dist/assets/bpmn-font/bpmn.eot +0 -0
  36. package/dist/assets/bpmn-font/bpmn.svg +0 -224
  37. package/dist/assets/bpmn-font/bpmn.ttf +0 -0
  38. package/dist/assets/bpmn-font/bpmn.woff +0 -0
  39. package/dist/assets/bpmn-font/bpmn.woff2 +0 -0
@@ -1324,34 +1324,128 @@
1324
1324
  return transformList.consolidate();
1325
1325
  }
1326
1326
 
1327
+ /**
1328
+ * @param { [ string, ...any[] ][] } elements
1329
+ *
1330
+ * @return { string }
1331
+ */
1327
1332
  function componentsToPath(elements) {
1328
- return elements.join(',').replace(/,?([A-z]),?/g, '$1');
1333
+ return elements.flat().join(',').replace(/,?([A-z]),?/g, '$1');
1334
+ }
1335
+
1336
+ function move(point) {
1337
+ return [ 'M', point.x, point.y ];
1338
+ }
1339
+
1340
+ function lineTo(point) {
1341
+ return [ 'L', point.x, point.y ];
1329
1342
  }
1330
1343
 
1331
- function toSVGPoints(points) {
1332
- var result = '';
1344
+ function curveTo(p1, p2, p3) {
1345
+ return [ 'C', p1.x, p1.y, p2.x, p2.y, p3.x, p3.y ];
1346
+ }
1347
+
1348
+ function drawPath(waypoints, cornerRadius) {
1349
+ const pointCount = waypoints.length;
1350
+
1351
+ const path = [ move(waypoints[0]) ];
1352
+
1353
+ for (let i = 1; i < pointCount; i++) {
1333
1354
 
1334
- for (var i = 0, p; (p = points[i]); i++) {
1335
- result += p.x + ',' + p.y + ' ';
1355
+ const pointBefore = waypoints[i - 1];
1356
+ const point = waypoints[i];
1357
+ const pointAfter = waypoints[i + 1];
1358
+
1359
+ if (!pointAfter || !cornerRadius) {
1360
+ path.push(lineTo(point));
1361
+
1362
+ continue;
1363
+ }
1364
+
1365
+ const effectiveRadius = Math.min(
1366
+ cornerRadius,
1367
+ vectorLength(point.x - pointBefore.x, point.y - pointBefore.y),
1368
+ vectorLength(pointAfter.x - point.x, pointAfter.y - point.y)
1369
+ );
1370
+
1371
+ if (!effectiveRadius) {
1372
+ path.push(lineTo(point));
1373
+
1374
+ continue;
1375
+ }
1376
+
1377
+ const beforePoint = getPointAtLength(point, pointBefore, effectiveRadius);
1378
+ const beforePoint2 = getPointAtLength(point, pointBefore, effectiveRadius * .5);
1379
+
1380
+ const afterPoint = getPointAtLength(point, pointAfter, effectiveRadius);
1381
+ const afterPoint2 = getPointAtLength(point, pointAfter, effectiveRadius * .5);
1382
+
1383
+ path.push(lineTo(beforePoint));
1384
+ path.push(curveTo(beforePoint2, afterPoint2, afterPoint));
1336
1385
  }
1337
1386
 
1338
- return result;
1387
+ return path;
1339
1388
  }
1340
1389
 
1341
- function createLine(points, attrs) {
1390
+ function getPointAtLength(start, end, length) {
1342
1391
 
1343
- var line = create$1('polyline');
1344
- attr$1(line, { points: toSVGPoints(points) });
1392
+ const deltaX = end.x - start.x;
1393
+ const deltaY = end.y - start.y;
1345
1394
 
1346
- if (attrs) {
1347
- attr$1(line, attrs);
1395
+ const totalLength = vectorLength(deltaX, deltaY);
1396
+
1397
+ const percent = length / totalLength;
1398
+
1399
+ return {
1400
+ x: start.x + deltaX * percent,
1401
+ y: start.y + deltaY * percent
1402
+ };
1403
+ }
1404
+
1405
+ function vectorLength(x, y) {
1406
+ return Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
1407
+ }
1408
+
1409
+ /**
1410
+ * @param { { x: number, y: number }[] } points
1411
+ * @param { any } [attrs]
1412
+ * @param { number } [radius]
1413
+ *
1414
+ * @return {SVGElement}
1415
+ */
1416
+ function createLine(points, attrs, radius) {
1417
+
1418
+ if (isNumber(attrs)) {
1419
+ radius = attrs;
1420
+ attrs = null;
1348
1421
  }
1349
1422
 
1350
- return line;
1423
+ if (!attrs) {
1424
+ attrs = {};
1425
+ }
1426
+
1427
+ const line = create$1('path', attrs);
1428
+
1429
+ if (isNumber(radius)) {
1430
+ line.dataset.cornerRadius = String(radius);
1431
+ }
1432
+
1433
+ return updateLine(line, points);
1351
1434
  }
1352
1435
 
1436
+ /**
1437
+ * @param { SVGElement } gfx
1438
+ * @param { { x: number, y: number }[]} points
1439
+ *
1440
+ * @return {SVGElement}
1441
+ */
1353
1442
  function updateLine(gfx, points) {
1354
- attr$1(gfx, { points: toSVGPoints(points) });
1443
+
1444
+ const cornerRadius = parseInt(gfx.dataset.cornerRadius, 10) || 0;
1445
+
1446
+ attr$1(gfx, {
1447
+ d: componentsToPath(drawPath(points, cornerRadius))
1448
+ });
1355
1449
 
1356
1450
  return gfx;
1357
1451
  }
@@ -1824,9 +1918,13 @@
1824
1918
 
1825
1919
  var componentEvent = {};
1826
1920
 
1827
- var bind$1 = window.addEventListener ? 'addEventListener' : 'attachEvent',
1828
- unbind$1 = window.removeEventListener ? 'removeEventListener' : 'detachEvent',
1829
- prefix$6 = bind$1 !== 'addEventListener' ? 'on' : '';
1921
+ var bind$1, unbind$1, prefix$6;
1922
+
1923
+ function detect () {
1924
+ bind$1 = window.addEventListener ? 'addEventListener' : 'attachEvent';
1925
+ unbind$1 = window.removeEventListener ? 'removeEventListener' : 'detachEvent';
1926
+ prefix$6 = bind$1 !== 'addEventListener' ? 'on' : '';
1927
+ }
1830
1928
 
1831
1929
  /**
1832
1930
  * Bind `el` event `type` to `fn`.
@@ -1840,6 +1938,7 @@
1840
1938
  */
1841
1939
 
1842
1940
  var bind_1 = componentEvent.bind = function(el, type, fn, capture){
1941
+ if (!bind$1) detect();
1843
1942
  el[bind$1](prefix$6 + type, fn, capture || false);
1844
1943
  return fn;
1845
1944
  };
@@ -1856,6 +1955,7 @@
1856
1955
  */
1857
1956
 
1858
1957
  var unbind_1 = componentEvent.unbind = function(el, type, fn, capture){
1958
+ if (!unbind$1) detect();
1859
1959
  el[unbind$1](prefix$6 + type, fn, capture || false);
1860
1960
  return fn;
1861
1961
  };
@@ -2287,33 +2387,33 @@
2287
2387
 
2288
2388
  var markers = {};
2289
2389
 
2290
- var computeStyle = styles.computeStyle;
2291
-
2292
- function addMarker(id, options) {
2293
- var attrs = assign$1({
2294
- fill: black,
2295
- strokeWidth: 1,
2390
+ function shapeStyle(attrs) {
2391
+ return styles.computeStyle(attrs, {
2296
2392
  strokeLinecap: 'round',
2297
- strokeDasharray: 'none'
2298
- }, options.attrs);
2299
-
2300
- var ref = options.ref || { x: 0, y: 0 };
2301
-
2302
- var scale = options.scale || 1;
2303
-
2304
- // fix for safari / chrome / firefox bug not correctly
2305
- // resetting stroke dash array
2306
- if (attrs.strokeDasharray === 'none') {
2307
- attrs.strokeDasharray = [ 10000, 1 ];
2308
- }
2309
-
2310
- var marker = create$1('marker');
2393
+ strokeLinejoin: 'round',
2394
+ stroke: black,
2395
+ strokeWidth: 2,
2396
+ fill: 'white'
2397
+ });
2398
+ }
2311
2399
 
2312
- attr$1(options.element, attrs);
2400
+ function lineStyle(attrs) {
2401
+ return styles.computeStyle(attrs, [ 'no-fill' ], {
2402
+ strokeLinecap: 'round',
2403
+ strokeLinejoin: 'round',
2404
+ stroke: black,
2405
+ strokeWidth: 2
2406
+ });
2407
+ }
2313
2408
 
2314
- append(marker, options.element);
2409
+ function addMarker(id, options) {
2410
+ var {
2411
+ ref = { x: 0, y: 0 },
2412
+ scale = 1,
2413
+ element
2414
+ } = options;
2315
2415
 
2316
- attr$1(marker, {
2416
+ var marker = create$1('marker', {
2317
2417
  id: id,
2318
2418
  viewBox: '0 0 20 20',
2319
2419
  refX: ref.x,
@@ -2323,6 +2423,8 @@
2323
2423
  orient: 'auto'
2324
2424
  });
2325
2425
 
2426
+ append(marker, element);
2427
+
2326
2428
  var defs = query('defs', canvas._svg);
2327
2429
 
2328
2430
  if (!defs) {
@@ -2355,105 +2457,116 @@
2355
2457
  function createMarker(id, type, fill, stroke) {
2356
2458
 
2357
2459
  if (type === 'sequenceflow-end') {
2358
- var sequenceflowEnd = create$1('path');
2359
- attr$1(sequenceflowEnd, { d: 'M 1 5 L 11 10 L 1 15 Z' });
2460
+ var sequenceflowEnd = create$1('path', {
2461
+ d: 'M 1 5 L 11 10 L 1 15 Z',
2462
+ ...shapeStyle({
2463
+ fill: stroke,
2464
+ stroke: stroke,
2465
+ strokeWidth: 1
2466
+ })
2467
+ });
2360
2468
 
2361
2469
  addMarker(id, {
2362
2470
  element: sequenceflowEnd,
2363
2471
  ref: { x: 11, y: 10 },
2364
- scale: 0.5,
2365
- attrs: {
2366
- fill: stroke,
2367
- stroke: stroke
2368
- }
2472
+ scale: 0.5
2369
2473
  });
2370
2474
  }
2371
2475
 
2372
2476
  if (type === 'messageflow-start') {
2373
- var messageflowStart = create$1('circle');
2374
- attr$1(messageflowStart, { cx: 6, cy: 6, r: 3.5 });
2477
+ var messageflowStart = create$1('circle', {
2478
+ cx: 6,
2479
+ cy: 6,
2480
+ r: 3.5,
2481
+ ...shapeStyle({
2482
+ fill: fill,
2483
+ stroke: stroke,
2484
+ strokeWidth: 1
2485
+ })
2486
+ });
2375
2487
 
2376
2488
  addMarker(id, {
2377
2489
  element: messageflowStart,
2378
- attrs: {
2379
- fill: fill,
2380
- stroke: stroke
2381
- },
2382
2490
  ref: { x: 6, y: 6 }
2383
2491
  });
2384
2492
  }
2385
2493
 
2386
2494
  if (type === 'messageflow-end') {
2387
- var messageflowEnd = create$1('path');
2388
- attr$1(messageflowEnd, { d: 'm 1 5 l 0 -3 l 7 3 l -7 3 z' });
2495
+ var messageflowEnd = create$1('path', {
2496
+ d: 'm 1 5 l 0 -3 l 7 3 l -7 3 z',
2497
+ ...shapeStyle({
2498
+ fill: fill,
2499
+ stroke: stroke,
2500
+ strokeWidth: 1
2501
+ })
2502
+ });
2389
2503
 
2390
2504
  addMarker(id, {
2391
2505
  element: messageflowEnd,
2392
- attrs: {
2393
- fill: fill,
2394
- stroke: stroke,
2395
- strokeLinecap: 'butt'
2396
- },
2397
2506
  ref: { x: 8.5, y: 5 }
2398
2507
  });
2399
2508
  }
2400
2509
 
2401
2510
  if (type === 'association-start') {
2402
- var associationStart = create$1('path');
2403
- attr$1(associationStart, { d: 'M 11 5 L 1 10 L 11 15' });
2404
-
2405
- addMarker(id, {
2406
- element: associationStart,
2407
- attrs: {
2511
+ var associationStart = create$1('path', {
2512
+ d: 'M 11 5 L 1 10 L 11 15',
2513
+ ...lineStyle({
2408
2514
  fill: 'none',
2409
2515
  stroke: stroke,
2410
2516
  strokeWidth: 1.5
2411
- },
2517
+ })
2518
+ });
2519
+
2520
+ addMarker(id, {
2521
+ element: associationStart,
2412
2522
  ref: { x: 1, y: 10 },
2413
2523
  scale: 0.5
2414
2524
  });
2415
2525
  }
2416
2526
 
2417
2527
  if (type === 'association-end') {
2418
- var associationEnd = create$1('path');
2419
- attr$1(associationEnd, { d: 'M 1 5 L 11 10 L 1 15' });
2420
-
2421
- addMarker(id, {
2422
- element: associationEnd,
2423
- attrs: {
2528
+ var associationEnd = create$1('path', {
2529
+ d: 'M 1 5 L 11 10 L 1 15',
2530
+ ...lineStyle({
2424
2531
  fill: 'none',
2425
2532
  stroke: stroke,
2426
2533
  strokeWidth: 1.5
2427
- },
2428
- ref: { x: 12, y: 10 },
2534
+ })
2535
+ });
2536
+
2537
+ addMarker(id, {
2538
+ element: associationEnd,
2539
+ ref: { x: 11, y: 10 },
2429
2540
  scale: 0.5
2430
2541
  });
2431
2542
  }
2432
2543
 
2433
2544
  if (type === 'conditional-flow-marker') {
2434
- var conditionalflowMarker = create$1('path');
2435
- attr$1(conditionalflowMarker, { d: 'M 0 10 L 8 6 L 16 10 L 8 14 Z' });
2436
-
2437
- addMarker(id, {
2438
- element: conditionalflowMarker,
2439
- attrs: {
2545
+ var conditionalFlowMarker = create$1('path', {
2546
+ d: 'M 0 10 L 8 6 L 16 10 L 8 14 Z',
2547
+ ...shapeStyle({
2440
2548
  fill: fill,
2441
2549
  stroke: stroke
2442
- },
2550
+ })
2551
+ });
2552
+
2553
+ addMarker(id, {
2554
+ element: conditionalFlowMarker,
2443
2555
  ref: { x: -1, y: 10 },
2444
2556
  scale: 0.5
2445
2557
  });
2446
2558
  }
2447
2559
 
2448
2560
  if (type === 'conditional-default-flow-marker') {
2449
- var conditionaldefaultflowMarker = create$1('path');
2450
- attr$1(conditionaldefaultflowMarker, { d: 'M 6 4 L 10 16' });
2561
+ var defaultFlowMarker = create$1('path', {
2562
+ d: 'M 6 4 L 10 16',
2563
+ ...shapeStyle({
2564
+ stroke: stroke
2565
+ })
2566
+ });
2451
2567
 
2452
2568
  addMarker(id, {
2453
- element: conditionaldefaultflowMarker,
2454
- attrs: {
2455
- stroke: stroke
2456
- },
2569
+ element: defaultFlowMarker,
2457
2570
  ref: { x: 0, y: 10 },
2458
2571
  scale: 0.5
2459
2572
  });
@@ -2469,11 +2582,7 @@
2469
2582
 
2470
2583
  offset = offset || 0;
2471
2584
 
2472
- attrs = computeStyle(attrs, {
2473
- stroke: black,
2474
- strokeWidth: 2,
2475
- fill: 'white'
2476
- });
2585
+ attrs = shapeStyle(attrs);
2477
2586
 
2478
2587
  if (attrs.fill === 'none') {
2479
2588
  delete attrs.fillOpacity;
@@ -2482,13 +2591,12 @@
2482
2591
  var cx = width / 2,
2483
2592
  cy = height / 2;
2484
2593
 
2485
- var circle = create$1('circle');
2486
- attr$1(circle, {
2594
+ var circle = create$1('circle', {
2487
2595
  cx: cx,
2488
2596
  cy: cy,
2489
- r: Math.round((width + height) / 4 - offset)
2597
+ r: Math.round((width + height) / 4 - offset),
2598
+ ...attrs
2490
2599
  });
2491
- attr$1(circle, attrs);
2492
2600
 
2493
2601
  append(parentGfx, circle);
2494
2602
 
@@ -2504,22 +2612,17 @@
2504
2612
 
2505
2613
  offset = offset || 0;
2506
2614
 
2507
- attrs = computeStyle(attrs, {
2508
- stroke: black,
2509
- strokeWidth: 2,
2510
- fill: 'white'
2511
- });
2615
+ attrs = shapeStyle(attrs);
2512
2616
 
2513
- var rect = create$1('rect');
2514
- attr$1(rect, {
2617
+ var rect = create$1('rect', {
2515
2618
  x: offset,
2516
2619
  y: offset,
2517
2620
  width: width - offset * 2,
2518
2621
  height: height - offset * 2,
2519
2622
  rx: r,
2520
- ry: r
2623
+ ry: r,
2624
+ ...attrs
2521
2625
  });
2522
- attr$1(rect, attrs);
2523
2626
 
2524
2627
  append(parentGfx, rect);
2525
2628
 
@@ -2531,53 +2634,66 @@
2531
2634
  var x_2 = width / 2;
2532
2635
  var y_2 = height / 2;
2533
2636
 
2534
- var points = [ { x: x_2, y: 0 }, { x: width, y: y_2 }, { x: x_2, y: height }, { x: 0, y: y_2 } ];
2637
+ var points = [
2638
+ { x: x_2, y: 0 },
2639
+ { x: width, y: y_2 },
2640
+ { x: x_2, y: height },
2641
+ { x: 0, y: y_2 }
2642
+ ];
2535
2643
 
2536
2644
  var pointsString = points.map(function(point) {
2537
2645
  return point.x + ',' + point.y;
2538
2646
  }).join(' ');
2539
2647
 
2540
- attrs = computeStyle(attrs, {
2541
- stroke: black,
2542
- strokeWidth: 2,
2543
- fill: 'white'
2544
- });
2648
+ attrs = shapeStyle(attrs);
2545
2649
 
2546
- var polygon = create$1('polygon');
2547
- attr$1(polygon, {
2650
+ var polygon = create$1('polygon', {
2651
+ ...attrs,
2548
2652
  points: pointsString
2549
2653
  });
2550
- attr$1(polygon, attrs);
2551
2654
 
2552
2655
  append(parentGfx, polygon);
2553
2656
 
2554
2657
  return polygon;
2555
2658
  }
2556
2659
 
2557
- function drawLine(parentGfx, waypoints, attrs) {
2558
- attrs = computeStyle(attrs, [ 'no-fill' ], {
2559
- stroke: black,
2560
- strokeWidth: 2,
2561
- fill: 'none'
2562
- });
2660
+ /**
2661
+ * @param {SVGElement} parentGfx
2662
+ * @param {Point[]} waypoints
2663
+ * @param {any} attrs
2664
+ * @param {number} [radius]
2665
+ *
2666
+ * @return {SVGElement}
2667
+ */
2668
+ function drawLine(parentGfx, waypoints, attrs, radius) {
2669
+ attrs = lineStyle(attrs);
2563
2670
 
2564
- var line = createLine(waypoints, attrs);
2671
+ var line = createLine(waypoints, attrs, radius);
2565
2672
 
2566
2673
  append(parentGfx, line);
2567
2674
 
2568
2675
  return line;
2569
2676
  }
2570
2677
 
2678
+ /**
2679
+ * @param {SVGElement} parentGfx
2680
+ * @param {Point[]} waypoints
2681
+ * @param {any} attrs
2682
+ *
2683
+ * @return {SVGElement}
2684
+ */
2685
+ function drawConnectionSegments(parentGfx, waypoints, attrs) {
2686
+ return drawLine(parentGfx, waypoints, attrs, 5);
2687
+ }
2688
+
2571
2689
  function drawPath(parentGfx, d, attrs) {
2572
2690
 
2573
- attrs = computeStyle(attrs, [ 'no-fill' ], {
2574
- strokeWidth: 2,
2575
- stroke: black
2576
- });
2691
+ attrs = lineStyle(attrs);
2577
2692
 
2578
- var path = create$1('path');
2579
- attr$1(path, { d: d });
2580
- attr$1(path, attrs);
2693
+ var path = create$1('path', {
2694
+ ...attrs,
2695
+ d
2696
+ });
2581
2697
 
2582
2698
  append(parentGfx, path);
2583
2699
 
@@ -2678,7 +2794,7 @@
2678
2794
  return renderLabel(parentGfx, semantic.name, {
2679
2795
  box: element,
2680
2796
  align: align,
2681
- padding: 5,
2797
+ padding: 7,
2682
2798
  style: {
2683
2799
  fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
2684
2800
  }
@@ -2724,16 +2840,6 @@
2724
2840
  transform(textBox, 0, -top, 270);
2725
2841
  }
2726
2842
 
2727
- function createPathFromConnection(connection) {
2728
- var waypoints = connection.waypoints;
2729
-
2730
- var pathData = 'm ' + waypoints[0].x + ',' + waypoints[0].y;
2731
- for (var i = 1; i < waypoints.length; i++) {
2732
- pathData += 'L' + waypoints[i].x + ',' + waypoints[i].y + ' ';
2733
- }
2734
- return pathData;
2735
- }
2736
-
2737
2843
  var handlers = this.handlers = {
2738
2844
  'bpmn:Event': function(parentGfx, element, attrs) {
2739
2845
 
@@ -2754,7 +2860,6 @@
2754
2860
  if (!semantic.isInterrupting) {
2755
2861
  attrs = {
2756
2862
  strokeDasharray: '6',
2757
- strokeLinecap: 'round',
2758
2863
  fill: getFillColor(element, defaultFillColor),
2759
2864
  stroke: getStrokeColor(element, defaultStrokeColor)
2760
2865
  };
@@ -2809,7 +2914,6 @@
2809
2914
 
2810
2915
  drawPath(parentGfx, pathData, {
2811
2916
  strokeWidth: 2,
2812
- strokeLinecap: 'square',
2813
2917
  stroke: getStrokeColor(element, defaultStrokeColor)
2814
2918
  });
2815
2919
 
@@ -2831,7 +2935,6 @@
2831
2935
 
2832
2936
  drawPath(parentGfx, linePathData, {
2833
2937
  strokeWidth: 1,
2834
- strokeLinecap: 'square',
2835
2938
  transform: 'rotate(' + (i * 30) + ',' + height + ',' + width + ')',
2836
2939
  stroke: getStrokeColor(element, defaultStrokeColor)
2837
2940
  });
@@ -3039,14 +3142,14 @@
3039
3142
  },
3040
3143
  'bpmn:IntermediateEvent': function(parentGfx, element) {
3041
3144
  var outer = renderer('bpmn:Event')(parentGfx, element, {
3042
- strokeWidth: 1,
3145
+ strokeWidth: 1.5,
3043
3146
  fill: getFillColor(element, defaultFillColor),
3044
3147
  stroke: getStrokeColor(element, defaultStrokeColor)
3045
3148
  });
3046
3149
 
3047
3150
  /* inner */
3048
3151
  drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {
3049
- strokeWidth: 1,
3152
+ strokeWidth: 1.5,
3050
3153
  fill: getFillColor(element, 'none'),
3051
3154
  stroke: getStrokeColor(element, defaultStrokeColor)
3052
3155
  });
@@ -3299,10 +3402,11 @@
3299
3402
  return task;
3300
3403
  },
3301
3404
  'bpmn:SubProcess': function(parentGfx, element, attrs) {
3302
- attrs = assign$1({
3405
+ attrs = {
3303
3406
  fill: getFillColor(element, defaultFillColor),
3304
- stroke: getStrokeColor(element, defaultStrokeColor)
3305
- }, attrs);
3407
+ stroke: getStrokeColor(element, defaultStrokeColor),
3408
+ ...attrs
3409
+ };
3306
3410
 
3307
3411
  var rect = renderer('bpmn:Activity')(parentGfx, element, attrs);
3308
3412
 
@@ -3310,7 +3414,8 @@
3310
3414
 
3311
3415
  if (isEventSubProcess(element)) {
3312
3416
  attr$1(rect, {
3313
- strokeDasharray: '1,2'
3417
+ strokeDasharray: '0, 5.5',
3418
+ strokeWidth: 2.5
3314
3419
  });
3315
3420
  }
3316
3421
 
@@ -3328,13 +3433,14 @@
3328
3433
  return renderer('bpmn:SubProcess')(parentGfx, element);
3329
3434
  },
3330
3435
  'bpmn:Transaction': function(parentGfx, element) {
3331
- var outer = renderer('bpmn:SubProcess')(parentGfx, element);
3436
+ var outer = renderer('bpmn:SubProcess')(parentGfx, element, { strokeWidth: 1.5 });
3332
3437
 
3333
3438
  var innerAttrs = styles.style([ 'no-fill', 'no-events' ], {
3334
- stroke: getStrokeColor(element, defaultStrokeColor)
3439
+ stroke: getStrokeColor(element, defaultStrokeColor),
3440
+ strokeWidth: 1.5
3335
3441
  });
3336
3442
 
3337
- /* inner path */ drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS - 2, INNER_OUTER_DIST, innerAttrs);
3443
+ /* inner path */ drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS - 3, INNER_OUTER_DIST, innerAttrs);
3338
3444
 
3339
3445
  return outer;
3340
3446
  },
@@ -3345,10 +3451,13 @@
3345
3451
  },
3346
3452
  'bpmn:Participant': function(parentGfx, element) {
3347
3453
 
3454
+ var strokeWidth = 1.5;
3455
+
3348
3456
  var attrs = {
3349
3457
  fillOpacity: DEFAULT_FILL_OPACITY,
3350
3458
  fill: getFillColor(element, defaultFillColor),
3351
- stroke: getStrokeColor(element, defaultStrokeColor)
3459
+ stroke: getStrokeColor(element, defaultStrokeColor),
3460
+ strokeWidth
3352
3461
  };
3353
3462
 
3354
3463
  var lane = renderer('bpmn:Lane')(parentGfx, element, attrs);
@@ -3360,13 +3469,14 @@
3360
3469
  { x: 30, y: 0 },
3361
3470
  { x: 30, y: element.height }
3362
3471
  ], {
3363
- stroke: getStrokeColor(element, defaultStrokeColor)
3472
+ stroke: getStrokeColor(element, defaultStrokeColor),
3473
+ strokeWidth
3364
3474
  });
3365
3475
  var text = getSemantic(element).name;
3366
3476
  renderLaneLabel(parentGfx, text, element);
3367
3477
  } else {
3368
3478
 
3369
- // Collapsed pool draw text inline
3479
+ // collapsed pool draw text inline
3370
3480
  var text2 = getSemantic(element).name;
3371
3481
  renderLabel(parentGfx, text2, {
3372
3482
  box: element, align: 'center-middle',
@@ -3385,11 +3495,13 @@
3385
3495
  return lane;
3386
3496
  },
3387
3497
  'bpmn:Lane': function(parentGfx, element, attrs) {
3388
- var rect = drawRect(parentGfx, element.width, element.height, 0, assign$1({
3498
+ var rect = drawRect(parentGfx, element.width, element.height, 0, {
3389
3499
  fill: getFillColor(element, defaultFillColor),
3390
3500
  fillOpacity: HIGH_FILL_OPACITY,
3391
- stroke: getStrokeColor(element, defaultStrokeColor)
3392
- }, attrs));
3501
+ stroke: getStrokeColor(element, defaultStrokeColor),
3502
+ strokeWidth: 1.5,
3503
+ ...attrs
3504
+ });
3393
3505
 
3394
3506
  var semantic = getSemantic(element);
3395
3507
 
@@ -3508,13 +3620,11 @@
3508
3620
  }
3509
3621
  });
3510
3622
 
3511
- var attrs = {
3623
+ /* event path */ drawPath(parentGfx, pathData, {
3512
3624
  strokeWidth: 2,
3513
3625
  fill: getFillColor(element, 'none'),
3514
3626
  stroke: getStrokeColor(element, defaultStrokeColor)
3515
- };
3516
-
3517
- /* event path */ drawPath(parentGfx, pathData, attrs);
3627
+ });
3518
3628
  }
3519
3629
 
3520
3630
  if (type === 'Parallel') {
@@ -3530,16 +3640,14 @@
3530
3640
  }
3531
3641
  });
3532
3642
 
3533
- var parallelPath = drawPath(parentGfx, pathData);
3534
- attr$1(parallelPath, {
3643
+ drawPath(parentGfx, pathData, {
3535
3644
  strokeWidth: 1,
3536
3645
  fill: 'none'
3537
3646
  });
3538
3647
  } else if (type === 'Exclusive') {
3539
3648
 
3540
3649
  if (!instantiate) {
3541
- var innerCircle = drawCircle(parentGfx, element.width, element.height, element.height * 0.26);
3542
- attr$1(innerCircle, {
3650
+ drawCircle(parentGfx, element.width, element.height, element.height * 0.26, {
3543
3651
  strokeWidth: 1,
3544
3652
  fill: 'none',
3545
3653
  stroke: getStrokeColor(element, defaultStrokeColor)
@@ -3553,27 +3661,20 @@
3553
3661
  return diamond;
3554
3662
  },
3555
3663
  'bpmn:Gateway': function(parentGfx, element) {
3556
- var attrs = {
3664
+ return drawDiamond(parentGfx, element.width, element.height, {
3557
3665
  fill: getFillColor(element, defaultFillColor),
3558
3666
  fillOpacity: DEFAULT_FILL_OPACITY,
3559
3667
  stroke: getStrokeColor(element, defaultStrokeColor)
3560
- };
3561
-
3562
- return drawDiamond(parentGfx, element.width, element.height, attrs);
3668
+ });
3563
3669
  },
3564
3670
  'bpmn:SequenceFlow': function(parentGfx, element) {
3565
- var pathData = createPathFromConnection(element);
3566
-
3567
3671
  var fill = getFillColor(element, defaultFillColor),
3568
3672
  stroke = getStrokeColor(element, defaultStrokeColor);
3569
3673
 
3570
- var attrs = {
3571
- strokeLinejoin: 'round',
3674
+ var path = drawConnectionSegments(parentGfx, element.waypoints, {
3572
3675
  markerEnd: marker('sequenceflow-end', fill, stroke),
3573
3676
  stroke: getStrokeColor(element, defaultStrokeColor)
3574
- };
3575
-
3576
- var path = drawPath(parentGfx, pathData, attrs);
3677
+ });
3577
3678
 
3578
3679
  var sequenceFlow = getSemantic(element);
3579
3680
 
@@ -3607,12 +3708,11 @@
3607
3708
  var fill = getFillColor(element, defaultFillColor),
3608
3709
  stroke = getStrokeColor(element, defaultStrokeColor);
3609
3710
 
3610
- attrs = assign$1({
3611
- strokeDasharray: '0.5, 5',
3612
- strokeLinecap: 'round',
3613
- strokeLinejoin: 'round',
3614
- stroke: getStrokeColor(element, defaultStrokeColor)
3615
- }, attrs || {});
3711
+ attrs = {
3712
+ strokeDasharray: '0, 5',
3713
+ stroke: getStrokeColor(element, defaultStrokeColor),
3714
+ ...attrs
3715
+ };
3616
3716
 
3617
3717
  if (semantic.associationDirection === 'One' ||
3618
3718
  semantic.associationDirection === 'Both') {
@@ -3623,7 +3723,7 @@
3623
3723
  attrs.markerStart = marker('association-start', fill, stroke);
3624
3724
  }
3625
3725
 
3626
- return drawLine(parentGfx, element.waypoints, attrs);
3726
+ return drawConnectionSegments(parentGfx, element.waypoints, attrs);
3627
3727
  },
3628
3728
  'bpmn:DataInputAssociation': function(parentGfx, element) {
3629
3729
  var fill = getFillColor(element, defaultFillColor),
@@ -3649,19 +3749,13 @@
3649
3749
  var fill = getFillColor(element, defaultFillColor),
3650
3750
  stroke = getStrokeColor(element, defaultStrokeColor);
3651
3751
 
3652
- var pathData = createPathFromConnection(element);
3653
-
3654
- var attrs = {
3752
+ var path = drawConnectionSegments(parentGfx, element.waypoints, {
3655
3753
  markerEnd: marker('messageflow-end', fill, stroke),
3656
3754
  markerStart: marker('messageflow-start', fill, stroke),
3657
- strokeDasharray: '10, 12',
3658
- strokeLinecap: 'round',
3659
- strokeLinejoin: 'round',
3660
- strokeWidth: '1.5px',
3755
+ strokeDasharray: '10, 11',
3756
+ strokeWidth: 1.5,
3661
3757
  stroke: getStrokeColor(element, defaultStrokeColor)
3662
- };
3663
-
3664
- var path = drawPath(parentGfx, pathData, attrs);
3758
+ });
3665
3759
 
3666
3760
  if (semantic.messageRef) {
3667
3761
  var midPoint = path.getPointAtLength(path.getTotalLength() / 2);
@@ -3784,25 +3878,26 @@
3784
3878
  cancel = semantic.cancelActivity;
3785
3879
 
3786
3880
  var attrs = {
3787
- strokeWidth: 1,
3881
+ strokeWidth: 1.5,
3788
3882
  fill: getFillColor(element, defaultFillColor),
3789
3883
  stroke: getStrokeColor(element, defaultStrokeColor)
3790
3884
  };
3791
3885
 
3792
3886
  if (!cancel) {
3793
3887
  attrs.strokeDasharray = '6';
3794
- attrs.strokeLinecap = 'round';
3795
3888
  }
3796
3889
 
3797
3890
  // apply fillOpacity
3798
- var outerAttrs = assign$1({}, attrs, {
3891
+ var outerAttrs = {
3892
+ ...attrs,
3799
3893
  fillOpacity: 1
3800
- });
3894
+ };
3801
3895
 
3802
3896
  // apply no-fill
3803
- var innerAttrs = assign$1({}, attrs, {
3897
+ var innerAttrs = {
3898
+ ...attrs,
3804
3899
  fill: 'none'
3805
- });
3900
+ };
3806
3901
 
3807
3902
  var outer = renderer('bpmn:Event')(parentGfx, element, outerAttrs);
3808
3903
 
@@ -3813,27 +3908,22 @@
3813
3908
  return outer;
3814
3909
  },
3815
3910
  'bpmn:Group': function(parentGfx, element) {
3816
-
3817
- var group = drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, {
3911
+ return drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, {
3818
3912
  stroke: getStrokeColor(element, defaultStrokeColor),
3819
- strokeWidth: 1,
3820
- strokeDasharray: '8,3,1,3',
3913
+ strokeWidth: 1.5,
3914
+ strokeDasharray: '10,6,0,6',
3821
3915
  fill: 'none',
3822
3916
  pointerEvents: 'none'
3823
3917
  });
3824
-
3825
- return group;
3826
3918
  },
3827
3919
  'label': function(parentGfx, element) {
3828
3920
  return renderExternalLabel(parentGfx, element);
3829
3921
  },
3830
3922
  'bpmn:TextAnnotation': function(parentGfx, element) {
3831
- var style = {
3923
+ var textElement = drawRect(parentGfx, element.width, element.height, 0, 0, {
3832
3924
  'fill': 'none',
3833
3925
  'stroke': 'none'
3834
- };
3835
-
3836
- var textElement = drawRect(parentGfx, element.width, element.height, 0, 0, style);
3926
+ });
3837
3927
 
3838
3928
  var textPathData = pathMap.getScaledPath('TEXT_ANNOTATION', {
3839
3929
  xScaleFactor: 1,
@@ -3854,7 +3944,7 @@
3854
3944
  renderLabel(parentGfx, text, {
3855
3945
  box: element,
3856
3946
  align: 'left-top',
3857
- padding: 5,
3947
+ padding: 7,
3858
3948
  style: {
3859
3949
  fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
3860
3950
  }
@@ -3972,10 +4062,9 @@
3972
4062
  });
3973
4063
 
3974
4064
  drawMarker('loop', parentGfx, markerPath, {
3975
- strokeWidth: 1,
4065
+ strokeWidth: 1.5,
3976
4066
  fill: getFillColor(element, defaultFillColor),
3977
4067
  stroke: getStrokeColor(element, defaultStrokeColor),
3978
- strokeLinecap: 'round',
3979
4068
  strokeMiterlimit: 0.5
3980
4069
  });
3981
4070
  },
@@ -6382,7 +6471,7 @@
6382
6471
  attr$1(outline, assign$1({
6383
6472
  x: 10,
6384
6473
  y: 10,
6385
- rx: 3,
6474
+ rx: 4,
6386
6475
  width: 100,
6387
6476
  height: 100
6388
6477
  }, OUTLINE_STYLE));
@@ -20769,6 +20858,11 @@
20769
20858
  * @see http://bpmn.io/license for more information.
20770
20859
  */
20771
20860
 
20861
+
20862
+ /**
20863
+ * @typedef { import('didi').ModuleDeclaration } Module
20864
+ */
20865
+
20772
20866
  /**
20773
20867
  * A base viewer for BPMN 2.0 diagrams.
20774
20868
  *
@@ -20780,8 +20874,8 @@
20780
20874
  * @param {string|number} [options.width] the width of the viewer
20781
20875
  * @param {string|number} [options.height] the height of the viewer
20782
20876
  * @param {Object} [options.moddleExtensions] extension packages to provide
20783
- * @param {Array<didi.Module>} [options.modules] a list of modules to override the default modules
20784
- * @param {Array<didi.Module>} [options.additionalModules] a list of modules to use with the default modules
20877
+ * @param {Module[]} [options.modules] a list of modules to override the default modules
20878
+ * @param {Module[]} [options.additionalModules] a list of modules to use with the default modules
20785
20879
  */
20786
20880
  function BaseViewer(options) {
20787
20881
 
@@ -21210,7 +21304,14 @@
21210
21304
  this._definitions = definitions;
21211
21305
  };
21212
21306
 
21213
- BaseViewer.prototype.getModules = function() {
21307
+ /**
21308
+ * Return modules to instantiate with.
21309
+ *
21310
+ * @param {any} options the instance got created with
21311
+ *
21312
+ * @return {Module[]}
21313
+ */
21314
+ BaseViewer.prototype.getModules = function(options) {
21214
21315
  return this._modules;
21215
21316
  };
21216
21317
 
@@ -21316,7 +21417,7 @@
21316
21417
 
21317
21418
  BaseViewer.prototype._init = function(container, moddle, options) {
21318
21419
 
21319
- const baseModules = options.modules || this.getModules(),
21420
+ const baseModules = options.modules || this.getModules(options),
21320
21421
  additionalModules = options.additionalModules || [],
21321
21422
  staticModules = [
21322
21423
  {
@@ -21471,6 +21572,10 @@
21471
21572
 
21472
21573
  /* </project-logo> */
21473
21574
 
21575
+ /**
21576
+ * @typedef { import('didi').ModuleDeclaration } Module
21577
+ */
21578
+
21474
21579
  /**
21475
21580
  * A viewer for BPMN 2.0 diagrams.
21476
21581
  *
@@ -21515,8 +21620,8 @@
21515
21620
  * @param {string|number} [options.width] the width of the viewer
21516
21621
  * @param {string|number} [options.height] the height of the viewer
21517
21622
  * @param {Object} [options.moddleExtensions] extension packages to provide
21518
- * @param {Array<didi.Module>} [options.modules] a list of modules to override the default modules
21519
- * @param {Array<didi.Module>} [options.additionalModules] a list of modules to use with the default modules
21623
+ * @param {Module[]} [options.modules] a list of modules to override the default modules
21624
+ * @param {Module[]} [options.additionalModules] a list of modules to use with the default modules
21520
21625
  */
21521
21626
  function Viewer(options) {
21522
21627
  BaseViewer.call(this, options);