camunda-bpmn-js 4.0.0-0 → 4.0.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 (26) hide show
  1. package/dist/assets/diagram-js.css +7 -19
  2. package/dist/assets/properties-panel.css +57 -23
  3. package/dist/base-modeler.development.js +65569 -62864
  4. package/dist/base-modeler.production.min.js +52 -53
  5. package/dist/base-navigated-viewer.development.js +1694 -1145
  6. package/dist/base-navigated-viewer.production.min.js +1 -1
  7. package/dist/base-viewer.development.js +1692 -1147
  8. package/dist/base-viewer.production.min.js +1 -1
  9. package/dist/camunda-cloud-modeler.development.js +52572 -39963
  10. package/dist/camunda-cloud-modeler.production.min.js +61 -61
  11. package/dist/camunda-cloud-navigated-viewer.development.js +1694 -1145
  12. package/dist/camunda-cloud-navigated-viewer.production.min.js +1 -1
  13. package/dist/camunda-cloud-viewer.development.js +1692 -1147
  14. package/dist/camunda-cloud-viewer.production.min.js +1 -1
  15. package/dist/camunda-platform-modeler.development.js +45585 -42832
  16. package/dist/camunda-platform-modeler.production.min.js +52 -53
  17. package/dist/camunda-platform-navigated-viewer.development.js +1694 -1145
  18. package/dist/camunda-platform-navigated-viewer.production.min.js +1 -1
  19. package/dist/camunda-platform-viewer.development.js +1692 -1147
  20. package/dist/camunda-platform-viewer.production.min.js +1 -1
  21. package/lib/camunda-cloud/Modeler.js +0 -3
  22. package/package.json +33 -33
  23. package/lib/camunda-cloud/features/rules/BpmnRules.d.ts +0 -32
  24. package/lib/camunda-cloud/features/rules/BpmnRules.js +0 -161
  25. package/lib/camunda-cloud/features/rules/index.d.ts +0 -6
  26. package/lib/camunda-cloud/features/rules/index.js +0 -6
@@ -11,7 +11,7 @@
11
11
  *
12
12
  * @template T
13
13
  *
14
- * @param {T[][]} arr
14
+ * @param {T[][] | T[] | null} [arr]
15
15
  *
16
16
  * @return {T[]}
17
17
  */
@@ -27,6 +27,10 @@
27
27
  return obj !== undefined;
28
28
  }
29
29
 
30
+ function isNil(obj) {
31
+ return obj == null;
32
+ }
33
+
30
34
  function isArray$2(obj) {
31
35
  return nativeToString$1.call(obj) === '[object Array]';
32
36
  }
@@ -475,6 +479,58 @@
475
479
  return Object.assign(target, ...others);
476
480
  }
477
481
 
482
+ /**
483
+ * Sets a nested property of a given object to the specified value.
484
+ *
485
+ * This mutates the object and returns it.
486
+ *
487
+ * @template T
488
+ *
489
+ * @param {T} target The target of the set operation.
490
+ * @param {(string|number)[]} path The path to the nested value.
491
+ * @param {any} value The value to set.
492
+ *
493
+ * @return {T}
494
+ */
495
+ function set$2(target, path, value) {
496
+
497
+ let currentTarget = target;
498
+
499
+ forEach$1(path, function(key, idx) {
500
+
501
+ if (typeof key !== 'number' && typeof key !== 'string') {
502
+ throw new Error('illegal key type: ' + typeof key + '. Key should be of type number or string.');
503
+ }
504
+
505
+ if (key === 'constructor') {
506
+ throw new Error('illegal key: constructor');
507
+ }
508
+
509
+ if (key === '__proto__') {
510
+ throw new Error('illegal key: __proto__');
511
+ }
512
+
513
+ let nextKey = path[idx + 1];
514
+ let nextTarget = currentTarget[key];
515
+
516
+ if (isDefined(nextKey) && isNil(nextTarget)) {
517
+ nextTarget = currentTarget[key] = isNaN(+nextKey) ? {} : [];
518
+ }
519
+
520
+ if (isUndefined$2(nextKey)) {
521
+ if (isUndefined$2(value)) {
522
+ delete currentTarget[key];
523
+ } else {
524
+ currentTarget[key] = value;
525
+ }
526
+ } else {
527
+ currentTarget = nextTarget;
528
+ }
529
+ });
530
+
531
+ return target;
532
+ }
533
+
478
534
  /**
479
535
  * Pick properties from the given target.
480
536
  *
@@ -713,6 +769,26 @@
713
769
  return true;
714
770
  }
715
771
 
772
+ /**
773
+ * @param {Element} element
774
+ *
775
+ * @return {boolean}
776
+ */
777
+ function isHorizontal(element) {
778
+
779
+ if (!is$1(element, 'bpmn:Participant') && !is$1(element, 'bpmn:Lane')) {
780
+ return undefined;
781
+ }
782
+
783
+ var isHorizontal = getDi(element).isHorizontal;
784
+
785
+ if (isHorizontal === undefined) {
786
+ return true;
787
+ }
788
+
789
+ return isHorizontal;
790
+ }
791
+
716
792
  /**
717
793
  * @param {Element} element
718
794
  *
@@ -1784,6 +1860,7 @@
1784
1860
  }
1785
1861
 
1786
1862
  var black = 'hsl(225, 10%, 15%)';
1863
+ var white = 'white';
1787
1864
 
1788
1865
  // element utils //////////////////////
1789
1866
 
@@ -1831,39 +1908,42 @@
1831
1908
  /**
1832
1909
  * @param {Element} element
1833
1910
  * @param {string} [defaultColor]
1911
+ * @param {string} [overrideColor]
1834
1912
  *
1835
1913
  * @return {string}
1836
1914
  */
1837
- function getFillColor(element, defaultColor) {
1915
+ function getFillColor(element, defaultColor, overrideColor) {
1838
1916
  var di = getDi(element);
1839
1917
 
1840
- return di.get('color:background-color') || di.get('bioc:fill') || defaultColor || 'white';
1918
+ return overrideColor || di.get('color:background-color') || di.get('bioc:fill') || defaultColor || white;
1841
1919
  }
1842
1920
 
1843
1921
  /**
1844
1922
  * @param {Element} element
1845
1923
  * @param {string} [defaultColor]
1924
+ * @param {string} [overrideColor]
1846
1925
  *
1847
1926
  * @return {string}
1848
1927
  */
1849
- function getStrokeColor(element, defaultColor) {
1928
+ function getStrokeColor(element, defaultColor, overrideColor) {
1850
1929
  var di = getDi(element);
1851
1930
 
1852
- return di.get('color:border-color') || di.get('bioc:stroke') || defaultColor || black;
1931
+ return overrideColor || di.get('color:border-color') || di.get('bioc:stroke') || defaultColor || black;
1853
1932
  }
1854
1933
 
1855
1934
  /**
1856
1935
  * @param {Element} element
1857
1936
  * @param {string} [defaultColor]
1858
1937
  * @param {string} [defaultStrokeColor]
1938
+ * @param {string} [overrideColor]
1859
1939
  *
1860
1940
  * @return {string}
1861
1941
  */
1862
- function getLabelColor(element, defaultColor, defaultStrokeColor) {
1942
+ function getLabelColor(element, defaultColor, defaultStrokeColor, overrideColor) {
1863
1943
  var di = getDi(element),
1864
1944
  label = di.get('label');
1865
1945
 
1866
- return label && label.get('color:color') || defaultColor ||
1946
+ return overrideColor || (label && label.get('color:color')) || defaultColor ||
1867
1947
  getStrokeColor(element, defaultStrokeColor);
1868
1948
  }
1869
1949
 
@@ -1967,6 +2047,45 @@
1967
2047
  return componentsToPath(rectPath);
1968
2048
  }
1969
2049
 
2050
+ /**
2051
+ * Get width and height from element or overrides.
2052
+ *
2053
+ * @param {Dimensions|Rect|ShapeLike} bounds
2054
+ * @param {Object} overrides
2055
+ *
2056
+ * @returns {Dimensions}
2057
+ */
2058
+ function getBounds(bounds, overrides = {}) {
2059
+ return {
2060
+ width: getWidth(bounds, overrides),
2061
+ height: getHeight(bounds, overrides)
2062
+ };
2063
+ }
2064
+
2065
+ /**
2066
+ * Get width from element or overrides.
2067
+ *
2068
+ * @param {Dimensions|Rect|ShapeLike} bounds
2069
+ * @param {Object} overrides
2070
+ *
2071
+ * @returns {number}
2072
+ */
2073
+ function getWidth(bounds, overrides = {}) {
2074
+ return has$1(overrides, 'width') ? overrides.width : bounds.width;
2075
+ }
2076
+
2077
+ /**
2078
+ * Get height from element or overrides.
2079
+ *
2080
+ * @param {Dimensions|Rect|ShapeLike} bounds
2081
+ * @param {Object} overrides
2082
+ *
2083
+ * @returns {number}
2084
+ */
2085
+ function getHeight(bounds, overrides = {}) {
2086
+ return has$1(overrides, 'height') ? overrides.height : bounds.height;
2087
+ }
2088
+
1970
2089
  function _mergeNamespaces$1(n, m) {
1971
2090
  m.forEach(function (e) {
1972
2091
  e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
@@ -2730,15 +2849,16 @@
2730
2849
  }
2731
2850
  };
2732
2851
 
2733
- var RENDERER_IDS = new Ids();
2734
-
2735
- var TASK_BORDER_RADIUS = 10;
2736
- var INNER_OUTER_DIST = 3;
2852
+ var rendererIds = new Ids();
2737
2853
 
2738
- var DEFAULT_FILL_OPACITY = .95,
2739
- HIGH_FILL_OPACITY = .35;
2854
+ var ELEMENT_LABEL_DISTANCE = 10,
2855
+ INNER_OUTER_DIST = 3,
2856
+ PARTICIPANT_STROKE_WIDTH = 1.5,
2857
+ TASK_BORDER_RADIUS = 10;
2740
2858
 
2741
- var ELEMENT_LABEL_DISTANCE = 10;
2859
+ var DEFAULT_OPACITY = 0.95,
2860
+ FULL_OPACITY = 1,
2861
+ LOW_OPACITY = 0.25;
2742
2862
 
2743
2863
  /**
2744
2864
  * @typedef { Partial<{
@@ -2746,6 +2866,13 @@
2746
2866
  * defaultStrokeColor: string,
2747
2867
  * defaultLabelColor: string
2748
2868
  * }> } BpmnRendererConfig
2869
+ *
2870
+ * @typedef { Partial<{
2871
+ * fill: string,
2872
+ * stroke: string,
2873
+ * width: string,
2874
+ * height: string
2875
+ * }> } Attrs
2749
2876
  */
2750
2877
 
2751
2878
  /**
@@ -2773,7 +2900,7 @@
2773
2900
  defaultStrokeColor = config && config.defaultStrokeColor,
2774
2901
  defaultLabelColor = config && config.defaultLabelColor;
2775
2902
 
2776
- var rendererId = RENDERER_IDS.next();
2903
+ var rendererId = rendererIds.next();
2777
2904
 
2778
2905
  var markers = {};
2779
2906
 
@@ -2869,7 +2996,7 @@
2869
2996
  cy: 6,
2870
2997
  r: 3.5,
2871
2998
  ...shapeStyle({
2872
- fill: fill,
2999
+ fill,
2873
3000
  stroke: stroke,
2874
3001
  strokeWidth: 1,
2875
3002
 
@@ -2889,7 +3016,7 @@
2889
3016
  var messageflowEnd = create$1('path', {
2890
3017
  d: 'm 1 5 l 0 -3 l 7 3 l -7 3 z',
2891
3018
  ...shapeStyle({
2892
- fill: fill,
3019
+ fill,
2893
3020
  stroke: stroke,
2894
3021
  strokeWidth: 1,
2895
3022
 
@@ -2910,7 +3037,7 @@
2910
3037
  d: 'M 11 5 L 1 10 L 11 15',
2911
3038
  ...lineStyle({
2912
3039
  fill: 'none',
2913
- stroke: stroke,
3040
+ stroke,
2914
3041
  strokeWidth: 1.5,
2915
3042
 
2916
3043
  // fix for safari / chrome / firefox bug not correctly
@@ -2931,7 +3058,7 @@
2931
3058
  d: 'M 1 5 L 11 10 L 1 15',
2932
3059
  ...lineStyle({
2933
3060
  fill: 'none',
2934
- stroke: stroke,
3061
+ stroke,
2935
3062
  strokeWidth: 1.5,
2936
3063
 
2937
3064
  // fix for safari / chrome / firefox bug not correctly
@@ -2951,7 +3078,7 @@
2951
3078
  var conditionalFlowMarker = create$1('path', {
2952
3079
  d: 'M 0 10 L 8 6 L 16 10 L 8 14 Z',
2953
3080
  ...shapeStyle({
2954
- fill: fill,
3081
+ fill,
2955
3082
  stroke: stroke
2956
3083
  })
2957
3084
  });
@@ -2979,7 +3106,7 @@
2979
3106
  }
2980
3107
  }
2981
3108
 
2982
- function drawCircle(parentGfx, width, height, offset, attrs) {
3109
+ function drawCircle(parentGfx, width, height, offset, attrs = {}) {
2983
3110
 
2984
3111
  if (isObject(offset)) {
2985
3112
  attrs = offset;
@@ -2990,10 +3117,6 @@
2990
3117
 
2991
3118
  attrs = shapeStyle(attrs);
2992
3119
 
2993
- if (attrs.fill === 'none') {
2994
- delete attrs.fillOpacity;
2995
- }
2996
-
2997
3120
  var cx = width / 2,
2998
3121
  cy = height / 2;
2999
3122
 
@@ -3093,7 +3216,6 @@
3093
3216
  }
3094
3217
 
3095
3218
  function drawPath(parentGfx, d, attrs) {
3096
-
3097
3219
  attrs = lineStyle(attrs);
3098
3220
 
3099
3221
  var path = create$1('path', {
@@ -3115,171 +3237,13 @@
3115
3237
  }
3116
3238
 
3117
3239
  function as(type) {
3118
- return function(parentGfx, element, options) {
3119
- return renderer(type)(parentGfx, element, options);
3120
- };
3121
- }
3122
-
3123
- function renderEventContent(element, parentGfx) {
3124
-
3125
- var event = getBusinessObject(element);
3126
- var isThrowing = isThrowEvent(event);
3127
-
3128
- if (event.eventDefinitions && event.eventDefinitions.length > 1) {
3129
- if (event.parallelMultiple) {
3130
- return renderer('bpmn:ParallelMultipleEventDefinition')(parentGfx, element, isThrowing);
3131
- }
3132
- else {
3133
- return renderer('bpmn:MultipleEventDefinition')(parentGfx, element, isThrowing);
3134
- }
3135
- }
3136
-
3137
- if (isTypedEvent(event, 'bpmn:MessageEventDefinition')) {
3138
- return renderer('bpmn:MessageEventDefinition')(parentGfx, element, isThrowing);
3139
- }
3140
-
3141
- if (isTypedEvent(event, 'bpmn:TimerEventDefinition')) {
3142
- return renderer('bpmn:TimerEventDefinition')(parentGfx, element, isThrowing);
3143
- }
3144
-
3145
- if (isTypedEvent(event, 'bpmn:ConditionalEventDefinition')) {
3146
- return renderer('bpmn:ConditionalEventDefinition')(parentGfx, element);
3147
- }
3148
-
3149
- if (isTypedEvent(event, 'bpmn:SignalEventDefinition')) {
3150
- return renderer('bpmn:SignalEventDefinition')(parentGfx, element, isThrowing);
3151
- }
3152
-
3153
- if (isTypedEvent(event, 'bpmn:EscalationEventDefinition')) {
3154
- return renderer('bpmn:EscalationEventDefinition')(parentGfx, element, isThrowing);
3155
- }
3156
-
3157
- if (isTypedEvent(event, 'bpmn:LinkEventDefinition')) {
3158
- return renderer('bpmn:LinkEventDefinition')(parentGfx, element, isThrowing);
3159
- }
3160
-
3161
- if (isTypedEvent(event, 'bpmn:ErrorEventDefinition')) {
3162
- return renderer('bpmn:ErrorEventDefinition')(parentGfx, element, isThrowing);
3163
- }
3164
-
3165
- if (isTypedEvent(event, 'bpmn:CancelEventDefinition')) {
3166
- return renderer('bpmn:CancelEventDefinition')(parentGfx, element, isThrowing);
3167
- }
3168
-
3169
- if (isTypedEvent(event, 'bpmn:CompensateEventDefinition')) {
3170
- return renderer('bpmn:CompensateEventDefinition')(parentGfx, element, isThrowing);
3171
- }
3172
-
3173
- if (isTypedEvent(event, 'bpmn:TerminateEventDefinition')) {
3174
- return renderer('bpmn:TerminateEventDefinition')(parentGfx, element, isThrowing);
3175
- }
3176
-
3177
- return null;
3178
- }
3179
-
3180
- function renderLabel(parentGfx, label, options) {
3181
-
3182
- options = assign$1({
3183
- size: {
3184
- width: 100
3185
- }
3186
- }, options);
3187
-
3188
- var text = textRenderer.createText(label || '', options);
3189
-
3190
- classes$1(text).add('djs-label');
3191
-
3192
- append(parentGfx, text);
3193
-
3194
- return text;
3195
- }
3196
-
3197
- function renderEmbeddedLabel(parentGfx, element, align) {
3198
- var semantic = getBusinessObject(element);
3199
-
3200
- return renderLabel(parentGfx, semantic.name, {
3201
- box: element,
3202
- align: align,
3203
- padding: 7,
3204
- style: {
3205
- fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
3206
- }
3207
- });
3208
- }
3209
-
3210
- function renderExternalLabel(parentGfx, element) {
3211
-
3212
- var box = {
3213
- width: 90,
3214
- height: 30,
3215
- x: element.width / 2 + element.x,
3216
- y: element.height / 2 + element.y
3240
+ return function(parentGfx, element, attrs) {
3241
+ return renderer(type)(parentGfx, element, attrs);
3217
3242
  };
3218
-
3219
- return renderLabel(parentGfx, getLabel(element), {
3220
- box: box,
3221
- fitBox: true,
3222
- style: assign$1(
3223
- {},
3224
- textRenderer.getExternalStyle(),
3225
- {
3226
- fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
3227
- }
3228
- )
3229
- });
3230
- }
3231
-
3232
- function renderLaneLabel(parentGfx, text, element) {
3233
- var textBox = renderLabel(parentGfx, text, {
3234
- box: {
3235
- height: 30,
3236
- width: element.height
3237
- },
3238
- align: 'center-middle',
3239
- style: {
3240
- fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
3241
- }
3242
- });
3243
-
3244
- var top = -1 * element.height;
3245
-
3246
- transform(textBox, 0, -top, 270);
3247
3243
  }
3248
3244
 
3249
- var handlers = this.handlers = {
3250
- 'bpmn:Event': function(parentGfx, element, attrs) {
3251
-
3252
- if (!('fillOpacity' in attrs)) {
3253
- attrs.fillOpacity = DEFAULT_FILL_OPACITY;
3254
- }
3255
-
3256
- return drawCircle(parentGfx, element.width, element.height, attrs);
3257
- },
3258
- 'bpmn:StartEvent': function(parentGfx, element, options) {
3259
- var attrs = {
3260
- fill: getFillColor(element, defaultFillColor),
3261
- stroke: getStrokeColor(element, defaultStrokeColor)
3262
- };
3263
-
3264
- var semantic = getBusinessObject(element);
3265
-
3266
- if (!semantic.isInterrupting) {
3267
- attrs = {
3268
- strokeDasharray: '6',
3269
- fill: getFillColor(element, defaultFillColor),
3270
- stroke: getStrokeColor(element, defaultStrokeColor)
3271
- };
3272
- }
3273
-
3274
- var circle = renderer('bpmn:Event')(parentGfx, element, attrs);
3275
-
3276
- if (!options || options.renderIcon !== false) {
3277
- renderEventContent(element, parentGfx);
3278
- }
3279
-
3280
- return circle;
3281
- },
3282
- 'bpmn:MessageEventDefinition': function(parentGfx, element, isThrowing) {
3245
+ var eventIconRenderers = {
3246
+ 'bpmn:MessageEventDefinition': function(parentGfx, element, attrs = {}, isThrowing) {
3283
3247
  var pathData = pathMap.getScaledPath('EVENT_MESSAGE', {
3284
3248
  xScaleFactor: 0.9,
3285
3249
  yScaleFactor: 0.9,
@@ -3291,22 +3255,27 @@
3291
3255
  }
3292
3256
  });
3293
3257
 
3294
- var fill = isThrowing ? getStrokeColor(element, defaultStrokeColor) : getFillColor(element, defaultFillColor);
3295
- var stroke = isThrowing ? getFillColor(element, defaultFillColor) : getStrokeColor(element, defaultStrokeColor);
3258
+ var fill = isThrowing
3259
+ ? getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3260
+ : getFillColor(element, defaultFillColor, attrs.fill);
3261
+
3262
+ var stroke = isThrowing
3263
+ ? getFillColor(element, defaultFillColor, attrs.fill)
3264
+ : getStrokeColor(element, defaultStrokeColor, attrs.stroke);
3296
3265
 
3297
3266
  var messagePath = drawPath(parentGfx, pathData, {
3298
- strokeWidth: 1,
3299
- fill: fill,
3300
- stroke: stroke
3267
+ fill,
3268
+ stroke,
3269
+ strokeWidth: 1
3301
3270
  });
3302
3271
 
3303
3272
  return messagePath;
3304
3273
  },
3305
- 'bpmn:TimerEventDefinition': function(parentGfx, element) {
3274
+ 'bpmn:TimerEventDefinition': function(parentGfx, element, attrs = {}) {
3306
3275
  var circle = drawCircle(parentGfx, element.width, element.height, 0.2 * element.height, {
3307
- strokeWidth: 2,
3308
- fill: getFillColor(element, defaultFillColor),
3309
- stroke: getStrokeColor(element, defaultStrokeColor)
3276
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3277
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3278
+ strokeWidth: 2
3310
3279
  });
3311
3280
 
3312
3281
  var pathData = pathMap.getScaledPath('EVENT_TIMER_WH', {
@@ -3321,12 +3290,11 @@
3321
3290
  });
3322
3291
 
3323
3292
  drawPath(parentGfx, pathData, {
3324
- strokeWidth: 2,
3325
- stroke: getStrokeColor(element, defaultStrokeColor)
3293
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3294
+ strokeWidth: 2
3326
3295
  });
3327
3296
 
3328
- for (var i = 0;i < 12; i++) {
3329
-
3297
+ for (var i = 0; i < 12; i++) {
3330
3298
  var linePathData = pathMap.getScaledPath('EVENT_TIMER_LINE', {
3331
3299
  xScaleFactor: 0.75,
3332
3300
  yScaleFactor: 0.75,
@@ -3338,19 +3306,19 @@
3338
3306
  }
3339
3307
  });
3340
3308
 
3341
- var width = element.width / 2;
3342
- var height = element.height / 2;
3309
+ var width = element.width / 2,
3310
+ height = element.height / 2;
3343
3311
 
3344
3312
  drawPath(parentGfx, linePathData, {
3345
3313
  strokeWidth: 1,
3346
- transform: 'rotate(' + (i * 30) + ',' + height + ',' + width + ')',
3347
- stroke: getStrokeColor(element, defaultStrokeColor)
3314
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3315
+ transform: 'rotate(' + (i * 30) + ',' + height + ',' + width + ')'
3348
3316
  });
3349
3317
  }
3350
3318
 
3351
3319
  return circle;
3352
3320
  },
3353
- 'bpmn:EscalationEventDefinition': function(parentGfx, event, isThrowing) {
3321
+ 'bpmn:EscalationEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3354
3322
  var pathData = pathMap.getScaledPath('EVENT_ESCALATION', {
3355
3323
  xScaleFactor: 1,
3356
3324
  yScaleFactor: 1,
@@ -3362,15 +3330,17 @@
3362
3330
  }
3363
3331
  });
3364
3332
 
3365
- var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
3333
+ var fill = isThrowing
3334
+ ? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3335
+ : getFillColor(event, defaultFillColor, attrs.fill);
3366
3336
 
3367
3337
  return drawPath(parentGfx, pathData, {
3368
- strokeWidth: 1,
3369
- fill: fill,
3370
- stroke: getStrokeColor(event, defaultStrokeColor)
3338
+ fill,
3339
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3340
+ strokeWidth: 1
3371
3341
  });
3372
3342
  },
3373
- 'bpmn:ConditionalEventDefinition': function(parentGfx, event) {
3343
+ 'bpmn:ConditionalEventDefinition': function(parentGfx, event, attrs = {}) {
3374
3344
  var pathData = pathMap.getScaledPath('EVENT_CONDITIONAL', {
3375
3345
  xScaleFactor: 1,
3376
3346
  yScaleFactor: 1,
@@ -3383,11 +3353,12 @@
3383
3353
  });
3384
3354
 
3385
3355
  return drawPath(parentGfx, pathData, {
3386
- strokeWidth: 1,
3387
- stroke: getStrokeColor(event, defaultStrokeColor)
3356
+ fill: getFillColor(event, defaultFillColor, attrs.fill),
3357
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3358
+ strokeWidth: 1
3388
3359
  });
3389
3360
  },
3390
- 'bpmn:LinkEventDefinition': function(parentGfx, event, isThrowing) {
3361
+ 'bpmn:LinkEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3391
3362
  var pathData = pathMap.getScaledPath('EVENT_LINK', {
3392
3363
  xScaleFactor: 1,
3393
3364
  yScaleFactor: 1,
@@ -3399,15 +3370,17 @@
3399
3370
  }
3400
3371
  });
3401
3372
 
3402
- var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
3373
+ var fill = isThrowing
3374
+ ? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3375
+ : getFillColor(event, defaultFillColor, attrs.fill);
3403
3376
 
3404
3377
  return drawPath(parentGfx, pathData, {
3405
- strokeWidth: 1,
3406
- fill: fill,
3407
- stroke: getStrokeColor(event, defaultStrokeColor)
3378
+ fill,
3379
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3380
+ strokeWidth: 1
3408
3381
  });
3409
3382
  },
3410
- 'bpmn:ErrorEventDefinition': function(parentGfx, event, isThrowing) {
3383
+ 'bpmn:ErrorEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3411
3384
  var pathData = pathMap.getScaledPath('EVENT_ERROR', {
3412
3385
  xScaleFactor: 1.1,
3413
3386
  yScaleFactor: 1.1,
@@ -3419,15 +3392,17 @@
3419
3392
  }
3420
3393
  });
3421
3394
 
3422
- var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
3395
+ var fill = isThrowing
3396
+ ? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3397
+ : getFillColor(event, defaultFillColor, attrs.fill);
3423
3398
 
3424
3399
  return drawPath(parentGfx, pathData, {
3425
- strokeWidth: 1,
3426
- fill: fill,
3427
- stroke: getStrokeColor(event, defaultStrokeColor)
3400
+ fill,
3401
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3402
+ strokeWidth: 1
3428
3403
  });
3429
3404
  },
3430
- 'bpmn:CancelEventDefinition': function(parentGfx, event, isThrowing) {
3405
+ 'bpmn:CancelEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3431
3406
  var pathData = pathMap.getScaledPath('EVENT_CANCEL_45', {
3432
3407
  xScaleFactor: 1.0,
3433
3408
  yScaleFactor: 1.0,
@@ -3439,19 +3414,19 @@
3439
3414
  }
3440
3415
  });
3441
3416
 
3442
- var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
3417
+ var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor, attrs.stroke) : 'none';
3443
3418
 
3444
3419
  var path = drawPath(parentGfx, pathData, {
3445
- strokeWidth: 1,
3446
- fill: fill,
3447
- stroke: getStrokeColor(event, defaultStrokeColor)
3420
+ fill,
3421
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3422
+ strokeWidth: 1
3448
3423
  });
3449
3424
 
3450
3425
  rotate(path, 45);
3451
3426
 
3452
3427
  return path;
3453
3428
  },
3454
- 'bpmn:CompensateEventDefinition': function(parentGfx, event, isThrowing) {
3429
+ 'bpmn:CompensateEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3455
3430
  var pathData = pathMap.getScaledPath('EVENT_COMPENSATION', {
3456
3431
  xScaleFactor: 1,
3457
3432
  yScaleFactor: 1,
@@ -3463,15 +3438,17 @@
3463
3438
  }
3464
3439
  });
3465
3440
 
3466
- var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
3441
+ var fill = isThrowing
3442
+ ? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3443
+ : getFillColor(event, defaultFillColor, attrs.fill);
3467
3444
 
3468
3445
  return drawPath(parentGfx, pathData, {
3469
- strokeWidth: 1,
3470
- fill: fill,
3471
- stroke: getStrokeColor(event, defaultStrokeColor)
3446
+ fill,
3447
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3448
+ strokeWidth: 1
3472
3449
  });
3473
3450
  },
3474
- 'bpmn:SignalEventDefinition': function(parentGfx, event, isThrowing) {
3451
+ 'bpmn:SignalEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3475
3452
  var pathData = pathMap.getScaledPath('EVENT_SIGNAL', {
3476
3453
  xScaleFactor: 0.9,
3477
3454
  yScaleFactor: 0.9,
@@ -3483,15 +3460,17 @@
3483
3460
  }
3484
3461
  });
3485
3462
 
3486
- var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
3463
+ var fill = isThrowing
3464
+ ? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3465
+ : getFillColor(event, defaultFillColor, attrs.fill);
3487
3466
 
3488
3467
  return drawPath(parentGfx, pathData, {
3489
3468
  strokeWidth: 1,
3490
- fill: fill,
3491
- stroke: getStrokeColor(event, defaultStrokeColor)
3469
+ fill,
3470
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3492
3471
  });
3493
3472
  },
3494
- 'bpmn:MultipleEventDefinition': function(parentGfx, event, isThrowing) {
3473
+ 'bpmn:MultipleEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3495
3474
  var pathData = pathMap.getScaledPath('EVENT_MULTIPLE', {
3496
3475
  xScaleFactor: 1.1,
3497
3476
  yScaleFactor: 1.1,
@@ -3503,14 +3482,16 @@
3503
3482
  }
3504
3483
  });
3505
3484
 
3506
- var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
3485
+ var fill = isThrowing
3486
+ ? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3487
+ : getFillColor(event, defaultFillColor, attrs.fill);
3507
3488
 
3508
3489
  return drawPath(parentGfx, pathData, {
3509
- strokeWidth: 1,
3510
- fill: fill
3490
+ fill,
3491
+ strokeWidth: 1
3511
3492
  });
3512
3493
  },
3513
- 'bpmn:ParallelMultipleEventDefinition': function(parentGfx, event) {
3494
+ 'bpmn:ParallelMultipleEventDefinition': function(parentGfx, event, attrs = {}) {
3514
3495
  var pathData = pathMap.getScaledPath('EVENT_PARALLEL_MULTIPLE', {
3515
3496
  xScaleFactor: 1.2,
3516
3497
  yScaleFactor: 1.2,
@@ -3523,501 +3504,791 @@
3523
3504
  });
3524
3505
 
3525
3506
  return drawPath(parentGfx, pathData, {
3526
- strokeWidth: 1,
3527
- fill: getStrokeColor(event, defaultStrokeColor),
3528
- stroke: getStrokeColor(event, defaultStrokeColor)
3507
+ fill: getFillColor(event, defaultFillColor, attrs.fill),
3508
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3509
+ strokeWidth: 1
3529
3510
  });
3530
3511
  },
3531
- 'bpmn:EndEvent': function(parentGfx, element, options) {
3532
- var circle = renderer('bpmn:Event')(parentGfx, element, {
3533
- strokeWidth: 4,
3534
- fill: getFillColor(element, defaultFillColor),
3535
- stroke: getStrokeColor(element, defaultStrokeColor)
3536
- });
3537
-
3538
- if (!options || options.renderIcon !== false) {
3539
- renderEventContent(element, parentGfx);
3540
- }
3541
-
3542
- return circle;
3543
- },
3544
- 'bpmn:TerminateEventDefinition': function(parentGfx, element) {
3512
+ 'bpmn:TerminateEventDefinition': function(parentGfx, element, attrs = {}) {
3545
3513
  var circle = drawCircle(parentGfx, element.width, element.height, 8, {
3546
- strokeWidth: 4,
3547
- fill: getStrokeColor(element, defaultStrokeColor),
3548
- stroke: getStrokeColor(element, defaultStrokeColor)
3514
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3515
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3516
+ strokeWidth: 4
3549
3517
  });
3550
3518
 
3551
3519
  return circle;
3552
- },
3553
- 'bpmn:IntermediateEvent': function(parentGfx, element, options) {
3554
- var outer = renderer('bpmn:Event')(parentGfx, element, {
3555
- strokeWidth: 1.5,
3556
- fill: getFillColor(element, defaultFillColor),
3557
- stroke: getStrokeColor(element, defaultStrokeColor)
3558
- });
3520
+ }
3521
+ };
3559
3522
 
3560
- /* inner */
3561
- drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {
3562
- strokeWidth: 1.5,
3563
- fill: getFillColor(element, 'none'),
3564
- stroke: getStrokeColor(element, defaultStrokeColor)
3565
- });
3523
+ function renderEventIcon(element, parentGfx, attrs = {}) {
3524
+ var semantic = getBusinessObject(element),
3525
+ isThrowing = isThrowEvent(semantic);
3566
3526
 
3567
- if (!options || options.renderIcon !== false) {
3568
- renderEventContent(element, parentGfx);
3527
+ if (semantic.get('eventDefinitions') && semantic.get('eventDefinitions').length > 1) {
3528
+ if (semantic.get('parallelMultiple')) {
3529
+ return eventIconRenderers[ 'bpmn:ParallelMultipleEventDefinition' ](parentGfx, element, attrs, isThrowing);
3530
+ }
3531
+ else {
3532
+ return eventIconRenderers[ 'bpmn:MultipleEventDefinition' ](parentGfx, element, attrs, isThrowing);
3569
3533
  }
3534
+ }
3570
3535
 
3571
- return outer;
3572
- },
3573
- 'bpmn:IntermediateCatchEvent': as('bpmn:IntermediateEvent'),
3574
- 'bpmn:IntermediateThrowEvent': as('bpmn:IntermediateEvent'),
3536
+ if (isTypedEvent(semantic, 'bpmn:MessageEventDefinition')) {
3537
+ return eventIconRenderers[ 'bpmn:MessageEventDefinition' ](parentGfx, element, attrs, isThrowing);
3538
+ }
3575
3539
 
3576
- 'bpmn:Activity': function(parentGfx, element, attrs) {
3540
+ if (isTypedEvent(semantic, 'bpmn:TimerEventDefinition')) {
3541
+ return eventIconRenderers[ 'bpmn:TimerEventDefinition' ](parentGfx, element, attrs, isThrowing);
3542
+ }
3577
3543
 
3578
- attrs = attrs || {};
3544
+ if (isTypedEvent(semantic, 'bpmn:ConditionalEventDefinition')) {
3545
+ return eventIconRenderers[ 'bpmn:ConditionalEventDefinition' ](parentGfx, element, attrs, isThrowing);
3546
+ }
3579
3547
 
3580
- if (!('fillOpacity' in attrs)) {
3581
- attrs.fillOpacity = DEFAULT_FILL_OPACITY;
3582
- }
3548
+ if (isTypedEvent(semantic, 'bpmn:SignalEventDefinition')) {
3549
+ return eventIconRenderers[ 'bpmn:SignalEventDefinition' ](parentGfx, element, attrs, isThrowing);
3550
+ }
3583
3551
 
3584
- return drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, attrs);
3585
- },
3552
+ if (isTypedEvent(semantic, 'bpmn:EscalationEventDefinition')) {
3553
+ return eventIconRenderers[ 'bpmn:EscalationEventDefinition' ](parentGfx, element, attrs, isThrowing);
3554
+ }
3586
3555
 
3587
- 'bpmn:Task': function(parentGfx, element) {
3588
- var attrs = {
3589
- fill: getFillColor(element, defaultFillColor),
3590
- stroke: getStrokeColor(element, defaultStrokeColor)
3591
- };
3556
+ if (isTypedEvent(semantic, 'bpmn:LinkEventDefinition')) {
3557
+ return eventIconRenderers[ 'bpmn:LinkEventDefinition' ](parentGfx, element, attrs, isThrowing);
3558
+ }
3592
3559
 
3593
- var rect = renderer('bpmn:Activity')(parentGfx, element, attrs);
3560
+ if (isTypedEvent(semantic, 'bpmn:ErrorEventDefinition')) {
3561
+ return eventIconRenderers[ 'bpmn:ErrorEventDefinition' ](parentGfx, element, attrs, isThrowing);
3562
+ }
3594
3563
 
3595
- renderEmbeddedLabel(parentGfx, element, 'center-middle');
3596
- attachTaskMarkers(parentGfx, element);
3564
+ if (isTypedEvent(semantic, 'bpmn:CancelEventDefinition')) {
3565
+ return eventIconRenderers[ 'bpmn:CancelEventDefinition' ](parentGfx, element, attrs, isThrowing);
3566
+ }
3597
3567
 
3598
- return rect;
3599
- },
3600
- 'bpmn:ServiceTask': function(parentGfx, element) {
3601
- var task = renderer('bpmn:Task')(parentGfx, element);
3568
+ if (isTypedEvent(semantic, 'bpmn:CompensateEventDefinition')) {
3569
+ return eventIconRenderers[ 'bpmn:CompensateEventDefinition' ](parentGfx, element, attrs, isThrowing);
3570
+ }
3602
3571
 
3603
- var pathDataBG = pathMap.getScaledPath('TASK_TYPE_SERVICE', {
3604
- abspos: {
3605
- x: 12,
3606
- y: 18
3572
+ if (isTypedEvent(semantic, 'bpmn:TerminateEventDefinition')) {
3573
+ return eventIconRenderers[ 'bpmn:TerminateEventDefinition' ](parentGfx, element, attrs, isThrowing);
3574
+ }
3575
+
3576
+ return null;
3577
+ }
3578
+
3579
+ var taskMarkerRenderers = {
3580
+ 'ParticipantMultiplicityMarker': function(parentGfx, element, attrs = {}) {
3581
+ var width = getWidth(element, attrs),
3582
+ height = getHeight(element, attrs);
3583
+
3584
+ var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', {
3585
+ xScaleFactor: 1,
3586
+ yScaleFactor: 1,
3587
+ containerWidth: width,
3588
+ containerHeight: height,
3589
+ position: {
3590
+ mx: ((width / 2 - 6) / width),
3591
+ my: (height - 15) / height
3607
3592
  }
3608
3593
  });
3609
3594
 
3610
- /* service bg */ drawPath(parentGfx, pathDataBG, {
3595
+ drawMarker('participant-multiplicity', parentGfx, markerPath, {
3596
+ strokeWidth: 2,
3597
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3598
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3599
+ });
3600
+ },
3601
+ 'SubProcessMarker': function(parentGfx, element, attrs = {}) {
3602
+ var markerRect = drawRect(parentGfx, 14, 14, 0, {
3611
3603
  strokeWidth: 1,
3612
- fill: getFillColor(element, defaultFillColor),
3613
- stroke: getStrokeColor(element, defaultStrokeColor)
3604
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3605
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3614
3606
  });
3615
3607
 
3616
- var fillPathData = pathMap.getScaledPath('TASK_TYPE_SERVICE_FILL', {
3617
- abspos: {
3618
- x: 17.2,
3619
- y: 18
3608
+ translate$1(markerRect, element.width / 2 - 7.5, element.height - 20);
3609
+
3610
+ var markerPath = pathMap.getScaledPath('MARKER_SUB_PROCESS', {
3611
+ xScaleFactor: 1.5,
3612
+ yScaleFactor: 1.5,
3613
+ containerWidth: element.width,
3614
+ containerHeight: element.height,
3615
+ position: {
3616
+ mx: (element.width / 2 - 7.5) / element.width,
3617
+ my: (element.height - 20) / element.height
3620
3618
  }
3621
3619
  });
3622
3620
 
3623
- /* service fill */ drawPath(parentGfx, fillPathData, {
3624
- strokeWidth: 0,
3625
- fill: getFillColor(element, defaultFillColor)
3621
+ drawMarker('sub-process', parentGfx, markerPath, {
3622
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3623
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3626
3624
  });
3625
+ },
3626
+ 'ParallelMarker': function(parentGfx, element, attrs) {
3627
+ var width = getWidth(element, attrs),
3628
+ height = getHeight(element, attrs);
3627
3629
 
3628
- var pathData = pathMap.getScaledPath('TASK_TYPE_SERVICE', {
3629
- abspos: {
3630
- x: 17,
3631
- y: 22
3630
+ var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', {
3631
+ xScaleFactor: 1,
3632
+ yScaleFactor: 1,
3633
+ containerWidth: width,
3634
+ containerHeight: height,
3635
+ position: {
3636
+ mx: ((width / 2 + attrs.parallel) / width),
3637
+ my: (height - 20) / height
3632
3638
  }
3633
3639
  });
3634
3640
 
3635
- /* service */ drawPath(parentGfx, pathData, {
3636
- strokeWidth: 1,
3637
- fill: getFillColor(element, defaultFillColor),
3638
- stroke: getStrokeColor(element, defaultStrokeColor)
3641
+ drawMarker('parallel', parentGfx, markerPath, {
3642
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3643
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3639
3644
  });
3640
-
3641
- return task;
3642
3645
  },
3643
- 'bpmn:UserTask': function(parentGfx, element) {
3644
- var task = renderer('bpmn:Task')(parentGfx, element);
3645
-
3646
- var x = 15;
3647
- var y = 12;
3648
-
3649
- var pathData = pathMap.getScaledPath('TASK_TYPE_USER_1', {
3650
- abspos: {
3651
- x: x,
3652
- y: y
3646
+ 'SequentialMarker': function(parentGfx, element, attrs) {
3647
+ var markerPath = pathMap.getScaledPath('MARKER_SEQUENTIAL', {
3648
+ xScaleFactor: 1,
3649
+ yScaleFactor: 1,
3650
+ containerWidth: element.width,
3651
+ containerHeight: element.height,
3652
+ position: {
3653
+ mx: ((element.width / 2 + attrs.seq) / element.width),
3654
+ my: (element.height - 19) / element.height
3653
3655
  }
3654
3656
  });
3655
3657
 
3656
- /* user path */ drawPath(parentGfx, pathData, {
3657
- strokeWidth: 0.5,
3658
- fill: getFillColor(element, defaultFillColor),
3659
- stroke: getStrokeColor(element, defaultStrokeColor)
3658
+ drawMarker('sequential', parentGfx, markerPath, {
3659
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3660
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3660
3661
  });
3661
-
3662
- var pathData2 = pathMap.getScaledPath('TASK_TYPE_USER_2', {
3663
- abspos: {
3664
- x: x,
3665
- y: y
3662
+ },
3663
+ 'CompensationMarker': function(parentGfx, element, attrs) {
3664
+ var markerMath = pathMap.getScaledPath('MARKER_COMPENSATION', {
3665
+ xScaleFactor: 1,
3666
+ yScaleFactor: 1,
3667
+ containerWidth: element.width,
3668
+ containerHeight: element.height,
3669
+ position: {
3670
+ mx: ((element.width / 2 + attrs.compensation) / element.width),
3671
+ my: (element.height - 13) / element.height
3666
3672
  }
3667
3673
  });
3668
3674
 
3669
- /* user2 path */ drawPath(parentGfx, pathData2, {
3670
- strokeWidth: 0.5,
3671
- fill: getFillColor(element, defaultFillColor),
3672
- stroke: getStrokeColor(element, defaultStrokeColor)
3675
+ drawMarker('compensation', parentGfx, markerMath, {
3676
+ strokeWidth: 1,
3677
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3678
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3673
3679
  });
3680
+ },
3681
+ 'LoopMarker': function(parentGfx, element, attrs) {
3682
+ var width = getWidth(element, attrs),
3683
+ height = getHeight(element, attrs);
3674
3684
 
3675
- var pathData3 = pathMap.getScaledPath('TASK_TYPE_USER_3', {
3676
- abspos: {
3677
- x: x,
3678
- y: y
3685
+ var markerPath = pathMap.getScaledPath('MARKER_LOOP', {
3686
+ xScaleFactor: 1,
3687
+ yScaleFactor: 1,
3688
+ containerWidth: width,
3689
+ containerHeight: height,
3690
+ position: {
3691
+ mx: ((width / 2 + attrs.loop) / width),
3692
+ my: (height - 7) / height
3679
3693
  }
3680
3694
  });
3681
3695
 
3682
- /* user3 path */ drawPath(parentGfx, pathData3, {
3683
- strokeWidth: 0.5,
3684
- fill: getStrokeColor(element, defaultStrokeColor),
3685
- stroke: getStrokeColor(element, defaultStrokeColor)
3696
+ drawMarker('loop', parentGfx, markerPath, {
3697
+ strokeWidth: 1.5,
3698
+ fill: 'none',
3699
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3700
+ strokeMiterlimit: 0.5
3686
3701
  });
3687
-
3688
- return task;
3689
3702
  },
3690
- 'bpmn:ManualTask': function(parentGfx, element) {
3691
- var task = renderer('bpmn:Task')(parentGfx, element);
3703
+ 'AdhocMarker': function(parentGfx, element, attrs) {
3704
+ var width = getWidth(element, attrs),
3705
+ height = getHeight(element, attrs);
3692
3706
 
3693
- var pathData = pathMap.getScaledPath('TASK_TYPE_MANUAL', {
3694
- abspos: {
3695
- x: 17,
3696
- y: 15
3707
+ var markerPath = pathMap.getScaledPath('MARKER_ADHOC', {
3708
+ xScaleFactor: 1,
3709
+ yScaleFactor: 1,
3710
+ containerWidth: width,
3711
+ containerHeight: height,
3712
+ position: {
3713
+ mx: ((width / 2 + attrs.adhoc) / width),
3714
+ my: (height - 15) / height
3697
3715
  }
3698
3716
  });
3699
3717
 
3700
- /* manual path */ drawPath(parentGfx, pathData, {
3701
- strokeWidth: 0.5, // 0.25,
3702
- fill: getFillColor(element, defaultFillColor),
3703
- stroke: getStrokeColor(element, defaultStrokeColor)
3718
+ drawMarker('adhoc', parentGfx, markerPath, {
3719
+ strokeWidth: 1,
3720
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3721
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3704
3722
  });
3723
+ }
3724
+ };
3705
3725
 
3706
- return task;
3707
- },
3708
- 'bpmn:SendTask': function(parentGfx, element) {
3709
- var task = renderer('bpmn:Task')(parentGfx, element);
3726
+ function renderTaskMarker(type, parentGfx, element, attrs) {
3727
+ taskMarkerRenderers[ type ](parentGfx, element, attrs);
3728
+ }
3710
3729
 
3711
- var pathData = pathMap.getScaledPath('TASK_TYPE_SEND', {
3730
+ function renderTaskMarkers(parentGfx, element, taskMarkers, attrs = {}) {
3731
+ attrs = {
3732
+ fill: attrs.fill,
3733
+ stroke: attrs.stroke,
3734
+ width: getWidth(element, attrs),
3735
+ height: getHeight(element, attrs)
3736
+ };
3737
+
3738
+ var semantic = getBusinessObject(element);
3739
+
3740
+ var subprocess = taskMarkers && taskMarkers.includes('SubProcessMarker');
3741
+
3742
+ if (subprocess) {
3743
+ attrs = {
3744
+ ...attrs,
3745
+ seq: -21,
3746
+ parallel: -22,
3747
+ compensation: -42,
3748
+ loop: -18,
3749
+ adhoc: 10
3750
+ };
3751
+ } else {
3752
+ attrs = {
3753
+ ...attrs,
3754
+ seq: -5,
3755
+ parallel: -6,
3756
+ compensation: -27,
3757
+ loop: 0,
3758
+ adhoc: 10
3759
+ };
3760
+ }
3761
+
3762
+ forEach$1(taskMarkers, function(marker) {
3763
+ renderTaskMarker(marker, parentGfx, element, attrs);
3764
+ });
3765
+
3766
+ if (semantic.get('isForCompensation')) {
3767
+ renderTaskMarker('CompensationMarker', parentGfx, element, attrs);
3768
+ }
3769
+
3770
+ if (is$1(semantic, 'bpmn:AdHocSubProcess')) {
3771
+ renderTaskMarker('AdhocMarker', parentGfx, element, attrs);
3772
+ }
3773
+
3774
+ var loopCharacteristics = semantic.get('loopCharacteristics'),
3775
+ isSequential = loopCharacteristics && loopCharacteristics.get('isSequential');
3776
+
3777
+ if (loopCharacteristics) {
3778
+
3779
+ if (isSequential === undefined) {
3780
+ renderTaskMarker('LoopMarker', parentGfx, element, attrs);
3781
+ }
3782
+
3783
+ if (isSequential === false) {
3784
+ renderTaskMarker('ParallelMarker', parentGfx, element, attrs);
3785
+ }
3786
+
3787
+ if (isSequential === true) {
3788
+ renderTaskMarker('SequentialMarker', parentGfx, element, attrs);
3789
+ }
3790
+ }
3791
+ }
3792
+
3793
+ function renderLabel(parentGfx, label, attrs = {}) {
3794
+ attrs = assign$1({
3795
+ size: {
3796
+ width: 100
3797
+ }
3798
+ }, attrs);
3799
+
3800
+ var text = textRenderer.createText(label || '', attrs);
3801
+
3802
+ classes$1(text).add('djs-label');
3803
+
3804
+ append(parentGfx, text);
3805
+
3806
+ return text;
3807
+ }
3808
+
3809
+ function renderEmbeddedLabel(parentGfx, element, align, attrs = {}) {
3810
+ var semantic = getBusinessObject(element);
3811
+
3812
+ var box = getBounds({
3813
+ x: element.x,
3814
+ y: element.y,
3815
+ width: element.width,
3816
+ height: element.height
3817
+ }, attrs);
3818
+
3819
+ return renderLabel(parentGfx, semantic.name, {
3820
+ align,
3821
+ box,
3822
+ padding: 7,
3823
+ style: {
3824
+ fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
3825
+ }
3826
+ });
3827
+ }
3828
+
3829
+ function renderExternalLabel(parentGfx, element, attrs = {}) {
3830
+ var box = {
3831
+ width: 90,
3832
+ height: 30,
3833
+ x: element.width / 2 + element.x,
3834
+ y: element.height / 2 + element.y
3835
+ };
3836
+
3837
+ return renderLabel(parentGfx, getLabel(element), {
3838
+ box: box,
3839
+ fitBox: true,
3840
+ style: assign$1(
3841
+ {},
3842
+ textRenderer.getExternalStyle(),
3843
+ {
3844
+ fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
3845
+ }
3846
+ )
3847
+ });
3848
+ }
3849
+
3850
+ function renderLaneLabel(parentGfx, text, element, attrs = {}) {
3851
+ var isHorizontalLane = isHorizontal(element);
3852
+
3853
+ var textBox = renderLabel(parentGfx, text, {
3854
+ box: {
3855
+ height: 30,
3856
+ width: isHorizontalLane ? getHeight(element, attrs) : getWidth(element, attrs),
3857
+ },
3858
+ align: 'center-middle',
3859
+ style: {
3860
+ fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
3861
+ }
3862
+ });
3863
+
3864
+ if (isHorizontalLane) {
3865
+ var top = -1 * getHeight(element, attrs);
3866
+ transform(textBox, 0, -top, 270);
3867
+ }
3868
+ }
3869
+
3870
+ function renderActivity(parentGfx, element, attrs = {}) {
3871
+ var {
3872
+ width,
3873
+ height
3874
+ } = getBounds(element, attrs);
3875
+
3876
+ return drawRect(parentGfx, width, height, TASK_BORDER_RADIUS, {
3877
+ ...attrs,
3878
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3879
+ fillOpacity: DEFAULT_OPACITY,
3880
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3881
+ });
3882
+ }
3883
+
3884
+ function renderAssociation(parentGfx, element, attrs = {}) {
3885
+ var semantic = getBusinessObject(element);
3886
+
3887
+ var fill = getFillColor(element, defaultFillColor, attrs.fill),
3888
+ stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
3889
+
3890
+ if (semantic.get('associationDirection') === 'One' ||
3891
+ semantic.get('associationDirection') === 'Both') {
3892
+ attrs.markerEnd = marker('association-end', fill, stroke);
3893
+ }
3894
+
3895
+ if (semantic.get('associationDirection') === 'Both') {
3896
+ attrs.markerStart = marker('association-start', fill, stroke);
3897
+ }
3898
+
3899
+ attrs = pickAttrs(attrs, [
3900
+ 'markerStart',
3901
+ 'markerEnd'
3902
+ ]);
3903
+
3904
+ return drawConnectionSegments(parentGfx, element.waypoints, {
3905
+ ...attrs,
3906
+ stroke,
3907
+ strokeDasharray: '0, 5'
3908
+ });
3909
+ }
3910
+
3911
+ function renderDataObject(parentGfx, element, attrs = {}) {
3912
+ var fill = getFillColor(element, defaultFillColor, attrs.fill),
3913
+ stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
3914
+
3915
+ var pathData = pathMap.getScaledPath('DATA_OBJECT_PATH', {
3916
+ xScaleFactor: 1,
3917
+ yScaleFactor: 1,
3918
+ containerWidth: element.width,
3919
+ containerHeight: element.height,
3920
+ position: {
3921
+ mx: 0.474,
3922
+ my: 0.296
3923
+ }
3924
+ });
3925
+
3926
+ var dataObject = drawPath(parentGfx, pathData, {
3927
+ fill,
3928
+ fillOpacity: DEFAULT_OPACITY,
3929
+ stroke
3930
+ });
3931
+
3932
+ var semantic = getBusinessObject(element);
3933
+
3934
+ if (isCollection(semantic)) {
3935
+ var collectionPathData = pathMap.getScaledPath('DATA_OBJECT_COLLECTION_PATH', {
3712
3936
  xScaleFactor: 1,
3713
3937
  yScaleFactor: 1,
3714
- containerWidth: 21,
3715
- containerHeight: 14,
3938
+ containerWidth: element.width,
3939
+ containerHeight: element.height,
3716
3940
  position: {
3717
- mx: 0.285,
3718
- my: 0.357
3941
+ mx: 0.33,
3942
+ my: (element.height - 18) / element.height
3719
3943
  }
3720
3944
  });
3721
3945
 
3722
- /* send path */ drawPath(parentGfx, pathData, {
3723
- strokeWidth: 1,
3724
- fill: getStrokeColor(element, defaultStrokeColor),
3725
- stroke: getFillColor(element, defaultFillColor)
3946
+ drawPath(parentGfx, collectionPathData, {
3947
+ strokeWidth: 2,
3948
+ fill,
3949
+ stroke
3726
3950
  });
3951
+ }
3727
3952
 
3728
- return task;
3729
- },
3730
- 'bpmn:ReceiveTask' : function(parentGfx, element) {
3731
- var semantic = getBusinessObject(element);
3953
+ return dataObject;
3954
+ }
3732
3955
 
3733
- var task = renderer('bpmn:Task')(parentGfx, element);
3734
- var pathData;
3956
+ function renderEvent(parentGfx, element, attrs = {}) {
3957
+ return drawCircle(parentGfx, element.width, element.height, {
3958
+ fillOpacity: DEFAULT_OPACITY,
3959
+ ...attrs,
3960
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3961
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3962
+ });
3963
+ }
3735
3964
 
3736
- if (semantic.instantiate) {
3737
- drawCircle(parentGfx, 28, 28, 20 * 0.22, { strokeWidth: 1 });
3965
+ function renderGateway(parentGfx, element, attrs = {}) {
3966
+ return drawDiamond(parentGfx, element.width, element.height, {
3967
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3968
+ fillOpacity: DEFAULT_OPACITY,
3969
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3970
+ });
3971
+ }
3738
3972
 
3739
- pathData = pathMap.getScaledPath('TASK_TYPE_INSTANTIATING_SEND', {
3740
- abspos: {
3741
- x: 7.77,
3742
- y: 9.52
3743
- }
3744
- });
3745
- } else {
3973
+ function renderLane(parentGfx, element, attrs = {}) {
3974
+ var lane = drawRect(parentGfx, getWidth(element, attrs), getHeight(element, attrs), 0, {
3975
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3976
+ fillOpacity: attrs.fillOpacity || DEFAULT_OPACITY,
3977
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3978
+ strokeWidth: 1.5
3979
+ });
3746
3980
 
3747
- pathData = pathMap.getScaledPath('TASK_TYPE_SEND', {
3748
- xScaleFactor: 0.9,
3749
- yScaleFactor: 0.9,
3750
- containerWidth: 21,
3751
- containerHeight: 14,
3752
- position: {
3753
- mx: 0.3,
3754
- my: 0.4
3755
- }
3756
- });
3757
- }
3981
+ var semantic = getBusinessObject(element);
3758
3982
 
3759
- /* receive path */ drawPath(parentGfx, pathData, {
3760
- strokeWidth: 1,
3761
- fill: getFillColor(element, defaultFillColor),
3762
- stroke: getStrokeColor(element, defaultStrokeColor)
3983
+ if (is$1(semantic, 'bpmn:Lane')) {
3984
+ var text = semantic.get('name');
3985
+
3986
+ renderLaneLabel(parentGfx, text, element, attrs);
3987
+ }
3988
+
3989
+ return lane;
3990
+ }
3991
+
3992
+ function renderSubProcess(parentGfx, element, attrs = {}) {
3993
+ var activity = renderActivity(parentGfx, element, attrs);
3994
+
3995
+ if (isEventSubProcess(element)) {
3996
+ attr$1(activity, {
3997
+ strokeDasharray: '0, 5.5',
3998
+ strokeWidth: 2.5
3763
3999
  });
4000
+ }
3764
4001
 
3765
- return task;
4002
+ var expanded = isExpanded(element);
4003
+
4004
+ renderEmbeddedLabel(parentGfx, element, expanded ? 'center-top' : 'center-middle', attrs);
4005
+
4006
+ if (expanded) {
4007
+ renderTaskMarkers(parentGfx, element, undefined, attrs);
4008
+ } else {
4009
+ renderTaskMarkers(parentGfx, element, [ 'SubProcessMarker' ], attrs);
4010
+ }
4011
+
4012
+ return activity;
4013
+ }
4014
+
4015
+ function renderTask(parentGfx, element, attrs = {}) {
4016
+ var activity = renderActivity(parentGfx, element, attrs);
4017
+
4018
+ renderEmbeddedLabel(parentGfx, element, 'center-middle', attrs);
4019
+
4020
+ renderTaskMarkers(parentGfx, element, undefined, attrs);
4021
+
4022
+ return activity;
4023
+ }
4024
+
4025
+ var handlers = this.handlers = {
4026
+ 'bpmn:AdHocSubProcess': function(parentGfx, element, attrs = {}) {
4027
+ if (isExpanded(element)) {
4028
+ attrs = pickAttrs(attrs, [
4029
+ 'fill',
4030
+ 'stroke',
4031
+ 'width',
4032
+ 'height'
4033
+ ]);
4034
+ } else {
4035
+ attrs = pickAttrs(attrs, [
4036
+ 'fill',
4037
+ 'stroke'
4038
+ ]);
4039
+ }
4040
+
4041
+ return renderSubProcess(parentGfx, element, attrs);
3766
4042
  },
3767
- 'bpmn:ScriptTask': function(parentGfx, element) {
3768
- var task = renderer('bpmn:Task')(parentGfx, element);
4043
+ 'bpmn:Association': function(parentGfx, element, attrs = {}) {
4044
+ attrs = pickAttrs(attrs, [
4045
+ 'fill',
4046
+ 'stroke'
4047
+ ]);
3769
4048
 
3770
- var pathData = pathMap.getScaledPath('TASK_TYPE_SCRIPT', {
3771
- abspos: {
3772
- x: 15,
3773
- y: 20
3774
- }
3775
- });
4049
+ return renderAssociation(parentGfx, element, attrs);
4050
+ },
4051
+ 'bpmn:BoundaryEvent': function(parentGfx, element, attrs = {}) {
4052
+ var { renderIcon = true } = attrs;
3776
4053
 
3777
- /* script path */ drawPath(parentGfx, pathData, {
3778
- strokeWidth: 1,
3779
- stroke: getStrokeColor(element, defaultStrokeColor)
4054
+ attrs = pickAttrs(attrs, [
4055
+ 'fill',
4056
+ 'stroke'
4057
+ ]);
4058
+
4059
+ var semantic = getBusinessObject(element),
4060
+ cancelActivity = semantic.get('cancelActivity');
4061
+
4062
+ attrs = {
4063
+ strokeWidth: 1.5,
4064
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4065
+ fillOpacity: FULL_OPACITY,
4066
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
4067
+ };
4068
+
4069
+ if (!cancelActivity) {
4070
+ attrs.strokeDasharray = '6';
4071
+ }
4072
+
4073
+ var event = renderEvent(parentGfx, element, attrs);
4074
+
4075
+ drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {
4076
+ ...attrs,
4077
+ fill: 'none'
3780
4078
  });
3781
4079
 
3782
- return task;
4080
+ if (renderIcon) {
4081
+ renderEventIcon(element, parentGfx, attrs);
4082
+ }
4083
+
4084
+ return event;
3783
4085
  },
3784
- 'bpmn:BusinessRuleTask': function(parentGfx, element) {
3785
- var task = renderer('bpmn:Task')(parentGfx, element);
4086
+ 'bpmn:BusinessRuleTask': function(parentGfx, element, attrs = {}) {
4087
+ attrs = pickAttrs(attrs, [
4088
+ 'fill',
4089
+ 'stroke'
4090
+ ]);
3786
4091
 
3787
- var headerPathData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_HEADER', {
4092
+ var task = renderTask(parentGfx, element, attrs);
4093
+
4094
+ var headerData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_MAIN', {
3788
4095
  abspos: {
3789
4096
  x: 8,
3790
4097
  y: 8
3791
4098
  }
3792
4099
  });
3793
4100
 
3794
- var businessHeaderPath = drawPath(parentGfx, headerPathData);
3795
- attr$1(businessHeaderPath, {
3796
- strokeWidth: 1,
3797
- fill: getFillColor(element, '#aaaaaa'),
3798
- stroke: getStrokeColor(element, defaultStrokeColor)
4101
+ var businessPath = drawPath(parentGfx, headerData);
4102
+
4103
+ attr$1(businessPath, {
4104
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4105
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4106
+ strokeWidth: 1
3799
4107
  });
3800
4108
 
3801
- var headerData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_MAIN', {
4109
+ var headerPathData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_HEADER', {
3802
4110
  abspos: {
3803
4111
  x: 8,
3804
4112
  y: 8
3805
4113
  }
3806
4114
  });
3807
4115
 
3808
- var businessPath = drawPath(parentGfx, headerData);
3809
- attr$1(businessPath, {
3810
- strokeWidth: 1,
3811
- stroke: getStrokeColor(element, defaultStrokeColor)
4116
+ var businessHeaderPath = drawPath(parentGfx, headerPathData);
4117
+
4118
+ attr$1(businessHeaderPath, {
4119
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4120
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4121
+ strokeWidth: 1
3812
4122
  });
3813
4123
 
3814
4124
  return task;
3815
4125
  },
3816
- 'bpmn:SubProcess': function(parentGfx, element, attrs) {
3817
- attrs = {
3818
- fill: getFillColor(element, defaultFillColor),
3819
- stroke: getStrokeColor(element, defaultStrokeColor),
4126
+ 'bpmn:CallActivity': function(parentGfx, element, attrs = {}) {
4127
+ attrs = pickAttrs(attrs, [
4128
+ 'fill',
4129
+ 'stroke'
4130
+ ]);
4131
+
4132
+ return renderSubProcess(parentGfx, element, {
4133
+ strokeWidth: 5,
3820
4134
  ...attrs
3821
- };
4135
+ });
4136
+ },
4137
+ 'bpmn:ComplexGateway': function(parentGfx, element, attrs = {}) {
4138
+ attrs = pickAttrs(attrs, [
4139
+ 'fill',
4140
+ 'stroke'
4141
+ ]);
3822
4142
 
3823
- var rect = renderer('bpmn:Activity')(parentGfx, element, attrs);
4143
+ var gateway = renderGateway(parentGfx, element, attrs);
3824
4144
 
3825
- var expanded = isExpanded(element);
4145
+ var pathData = pathMap.getScaledPath('GATEWAY_COMPLEX', {
4146
+ xScaleFactor: 0.5,
4147
+ yScaleFactor:0.5,
4148
+ containerWidth: element.width,
4149
+ containerHeight: element.height,
4150
+ position: {
4151
+ mx: 0.46,
4152
+ my: 0.26
4153
+ }
4154
+ });
3826
4155
 
3827
- if (isEventSubProcess(element)) {
3828
- attr$1(rect, {
3829
- strokeDasharray: '0, 5.5',
3830
- strokeWidth: 2.5
3831
- });
3832
- }
4156
+ drawPath(parentGfx, pathData, {
4157
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4158
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4159
+ strokeWidth: 1
4160
+ });
3833
4161
 
3834
- renderEmbeddedLabel(parentGfx, element, expanded ? 'center-top' : 'center-middle');
4162
+ return gateway;
4163
+ },
4164
+ 'bpmn:DataInput': function(parentGfx, element, attrs = {}) {
4165
+ attrs = pickAttrs(attrs, [
4166
+ 'fill',
4167
+ 'stroke'
4168
+ ]);
3835
4169
 
3836
- if (expanded) {
3837
- attachTaskMarkers(parentGfx, element);
3838
- } else {
3839
- attachTaskMarkers(parentGfx, element, [ 'SubProcessMarker' ]);
3840
- }
4170
+ var arrowPathData = pathMap.getRawPath('DATA_ARROW');
3841
4171
 
3842
- return rect;
3843
- },
3844
- 'bpmn:AdHocSubProcess': function(parentGfx, element) {
3845
- return renderer('bpmn:SubProcess')(parentGfx, element);
3846
- },
3847
- 'bpmn:Transaction': function(parentGfx, element) {
3848
- var outer = renderer('bpmn:SubProcess')(parentGfx, element, { strokeWidth: 1.5 });
4172
+ var dataObject = renderDataObject(parentGfx, element, attrs);
3849
4173
 
3850
- var innerAttrs = styles.style([ 'no-fill', 'no-events' ], {
3851
- stroke: getStrokeColor(element, defaultStrokeColor),
3852
- strokeWidth: 1.5
4174
+ drawPath(parentGfx, arrowPathData, {
4175
+ fill: 'none',
4176
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4177
+ strokeWidth: 1
3853
4178
  });
3854
4179
 
3855
- /* inner path */ drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS - 3, INNER_OUTER_DIST, innerAttrs);
3856
-
3857
- return outer;
4180
+ return dataObject;
3858
4181
  },
3859
- 'bpmn:CallActivity': function(parentGfx, element) {
3860
- return renderer('bpmn:SubProcess')(parentGfx, element, {
3861
- strokeWidth: 5
4182
+ 'bpmn:DataInputAssociation': function(parentGfx, element, attrs = {}) {
4183
+ attrs = pickAttrs(attrs, [
4184
+ 'fill',
4185
+ 'stroke'
4186
+ ]);
4187
+
4188
+ return renderAssociation(parentGfx, element, {
4189
+ ...attrs,
4190
+ markerEnd: marker('association-end', getFillColor(element, defaultFillColor, attrs.fill), getStrokeColor(element, defaultStrokeColor, attrs.stroke))
3862
4191
  });
3863
4192
  },
3864
- 'bpmn:Participant': function(parentGfx, element) {
3865
-
3866
- var strokeWidth = 1.5;
3867
-
3868
- var attrs = {
3869
- fillOpacity: DEFAULT_FILL_OPACITY,
3870
- fill: getFillColor(element, defaultFillColor),
3871
- stroke: getStrokeColor(element, defaultStrokeColor),
3872
- strokeWidth
3873
- };
3874
-
3875
- var lane = renderer('bpmn:Lane')(parentGfx, element, attrs);
3876
-
3877
- var expandedPool = isExpanded(element);
3878
-
3879
- if (expandedPool) {
3880
- drawLine(parentGfx, [
3881
- { x: 30, y: 0 },
3882
- { x: 30, y: element.height }
3883
- ], {
3884
- stroke: getStrokeColor(element, defaultStrokeColor),
3885
- strokeWidth
3886
- });
3887
- var text = getBusinessObject(element).name;
3888
- renderLaneLabel(parentGfx, text, element);
3889
- } else {
3890
-
3891
- // collapsed pool draw text inline
3892
- var text2 = getBusinessObject(element).name;
3893
- renderLabel(parentGfx, text2, {
3894
- box: element, align: 'center-middle',
3895
- style: {
3896
- fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
3897
- }
3898
- });
3899
- }
3900
-
3901
- var participantMultiplicity = !!(getBusinessObject(element).participantMultiplicity);
3902
-
3903
- if (participantMultiplicity) {
3904
- renderer('ParticipantMultiplicityMarker')(parentGfx, element);
3905
- }
4193
+ 'bpmn:DataObject': function(parentGfx, element, attrs = {}) {
4194
+ attrs = pickAttrs(attrs, [
4195
+ 'fill',
4196
+ 'stroke'
4197
+ ]);
3906
4198
 
3907
- return lane;
4199
+ return renderDataObject(parentGfx, element, attrs);
3908
4200
  },
3909
- 'bpmn:Lane': function(parentGfx, element, attrs) {
3910
- var rect = drawRect(parentGfx, element.width, element.height, 0, {
3911
- fill: getFillColor(element, defaultFillColor),
3912
- fillOpacity: HIGH_FILL_OPACITY,
3913
- stroke: getStrokeColor(element, defaultStrokeColor),
3914
- strokeWidth: 1.5,
3915
- ...attrs
3916
- });
3917
-
3918
- var semantic = getBusinessObject(element);
4201
+ 'bpmn:DataObjectReference': as('bpmn:DataObject'),
4202
+ 'bpmn:DataOutput': function(parentGfx, element, attrs = {}) {
4203
+ attrs = pickAttrs(attrs, [
4204
+ 'fill',
4205
+ 'stroke'
4206
+ ]);
3919
4207
 
3920
- if (semantic.$type === 'bpmn:Lane') {
3921
- var text = semantic.name;
3922
- renderLaneLabel(parentGfx, text, element);
3923
- }
4208
+ var arrowPathData = pathMap.getRawPath('DATA_ARROW');
3924
4209
 
3925
- return rect;
3926
- },
3927
- 'bpmn:InclusiveGateway': function(parentGfx, element) {
3928
- var diamond = renderer('bpmn:Gateway')(parentGfx, element);
4210
+ var dataObject = renderDataObject(parentGfx, element, attrs);
3929
4211
 
3930
- /* circle path */
3931
- drawCircle(parentGfx, element.width, element.height, element.height * 0.24, {
3932
- strokeWidth: 2.5,
3933
- fill: getFillColor(element, defaultFillColor),
3934
- stroke: getStrokeColor(element, defaultStrokeColor)
4212
+ drawPath(parentGfx, arrowPathData, {
4213
+ strokeWidth: 1,
4214
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4215
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3935
4216
  });
3936
4217
 
3937
- return diamond;
4218
+ return dataObject;
3938
4219
  },
3939
- 'bpmn:ExclusiveGateway': function(parentGfx, element) {
3940
- var diamond = renderer('bpmn:Gateway')(parentGfx, element);
4220
+ 'bpmn:DataOutputAssociation': function(parentGfx, element, attrs = {}) {
4221
+ attrs = pickAttrs(attrs, [
4222
+ 'fill',
4223
+ 'stroke'
4224
+ ]);
3941
4225
 
3942
- var pathData = pathMap.getScaledPath('GATEWAY_EXCLUSIVE', {
3943
- xScaleFactor: 0.4,
3944
- yScaleFactor: 0.4,
3945
- containerWidth: element.width,
3946
- containerHeight: element.height,
3947
- position: {
3948
- mx: 0.32,
3949
- my: 0.3
3950
- }
4226
+ return renderAssociation(parentGfx, element, {
4227
+ ...attrs,
4228
+ markerEnd: marker('association-end', getFillColor(element, defaultFillColor, attrs.fill), getStrokeColor(element, defaultStrokeColor, attrs.stroke))
3951
4229
  });
3952
-
3953
- if ((getDi(element).isMarkerVisible)) {
3954
- drawPath(parentGfx, pathData, {
3955
- strokeWidth: 1,
3956
- fill: getStrokeColor(element, defaultStrokeColor),
3957
- stroke: getStrokeColor(element, defaultStrokeColor)
3958
- });
3959
- }
3960
-
3961
- return diamond;
3962
4230
  },
3963
- 'bpmn:ComplexGateway': function(parentGfx, element) {
3964
- var diamond = renderer('bpmn:Gateway')(parentGfx, element);
4231
+ 'bpmn:DataStoreReference': function(parentGfx, element, attrs = {}) {
4232
+ attrs = pickAttrs(attrs, [
4233
+ 'fill',
4234
+ 'stroke'
4235
+ ]);
3965
4236
 
3966
- var pathData = pathMap.getScaledPath('GATEWAY_COMPLEX', {
3967
- xScaleFactor: 0.5,
3968
- yScaleFactor:0.5,
4237
+ var dataStorePath = pathMap.getScaledPath('DATA_STORE', {
4238
+ xScaleFactor: 1,
4239
+ yScaleFactor: 1,
3969
4240
  containerWidth: element.width,
3970
4241
  containerHeight: element.height,
3971
4242
  position: {
3972
- mx: 0.46,
3973
- my: 0.26
4243
+ mx: 0,
4244
+ my: 0.133
3974
4245
  }
3975
4246
  });
3976
4247
 
3977
- /* complex path */ drawPath(parentGfx, pathData, {
3978
- strokeWidth: 1,
3979
- fill: getStrokeColor(element, defaultStrokeColor),
3980
- stroke: getStrokeColor(element, defaultStrokeColor)
4248
+ return drawPath(parentGfx, dataStorePath, {
4249
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4250
+ fillOpacity: DEFAULT_OPACITY,
4251
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4252
+ strokeWidth: 2
3981
4253
  });
3982
-
3983
- return diamond;
3984
4254
  },
3985
- 'bpmn:ParallelGateway': function(parentGfx, element) {
3986
- var diamond = renderer('bpmn:Gateway')(parentGfx, element);
4255
+ 'bpmn:EndEvent': function(parentGfx, element, attrs = {}) {
4256
+ var { renderIcon = true } = attrs;
3987
4257
 
3988
- var pathData = pathMap.getScaledPath('GATEWAY_PARALLEL', {
3989
- xScaleFactor: 0.6,
3990
- yScaleFactor:0.6,
3991
- containerWidth: element.width,
3992
- containerHeight: element.height,
3993
- position: {
3994
- mx: 0.46,
3995
- my: 0.2
3996
- }
3997
- });
4258
+ attrs = pickAttrs(attrs, [
4259
+ 'fill',
4260
+ 'stroke'
4261
+ ]);
3998
4262
 
3999
- /* parallel path */ drawPath(parentGfx, pathData, {
4000
- strokeWidth: 1,
4001
- fill: getStrokeColor(element, defaultStrokeColor),
4002
- stroke: getStrokeColor(element, defaultStrokeColor)
4263
+ var event = renderEvent(parentGfx, element, {
4264
+ ...attrs,
4265
+ strokeWidth: 4
4003
4266
  });
4004
4267
 
4005
- return diamond;
4268
+ if (renderIcon) {
4269
+ renderEventIcon(element, parentGfx, attrs);
4270
+ }
4271
+
4272
+ return event;
4006
4273
  },
4007
- 'bpmn:EventBasedGateway': function(parentGfx, element) {
4274
+ 'bpmn:EventBasedGateway': function(parentGfx, element, attrs = {}) {
4275
+ attrs = pickAttrs(attrs, [
4276
+ 'fill',
4277
+ 'stroke'
4278
+ ]);
4008
4279
 
4009
4280
  var semantic = getBusinessObject(element);
4010
4281
 
4011
- var diamond = renderer('bpmn:Gateway')(parentGfx, element);
4282
+ var diamond = renderGateway(parentGfx, element, attrs);
4012
4283
 
4013
- /* outer circle path */ drawCircle(parentGfx, element.width, element.height, element.height * 0.20, {
4014
- strokeWidth: 1,
4015
- fill: 'none',
4016
- stroke: getStrokeColor(element, defaultStrokeColor)
4284
+ drawCircle(parentGfx, element.width, element.height, element.height * 0.20, {
4285
+ fill: getFillColor(element, 'none', attrs.fill),
4286
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4287
+ strokeWidth: 1
4017
4288
  });
4018
4289
 
4019
- var type = semantic.eventGatewayType;
4020
- var instantiate = !!semantic.instantiate;
4290
+ var type = semantic.get('eventGatewayType'),
4291
+ instantiate = !!semantic.get('instantiate');
4021
4292
 
4022
4293
  function drawEvent() {
4023
4294
 
@@ -4032,18 +4303,17 @@
4032
4303
  }
4033
4304
  });
4034
4305
 
4035
- /* event path */ drawPath(parentGfx, pathData, {
4036
- strokeWidth: 2,
4037
- fill: getFillColor(element, 'none'),
4038
- stroke: getStrokeColor(element, defaultStrokeColor)
4306
+ drawPath(parentGfx, pathData, {
4307
+ fill: 'none',
4308
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4309
+ strokeWidth: 2
4039
4310
  });
4040
4311
  }
4041
4312
 
4042
4313
  if (type === 'Parallel') {
4043
-
4044
4314
  var pathData = pathMap.getScaledPath('GATEWAY_PARALLEL', {
4045
4315
  xScaleFactor: 0.4,
4046
- yScaleFactor:0.4,
4316
+ yScaleFactor: 0.4,
4047
4317
  containerWidth: element.width,
4048
4318
  containerHeight: element.height,
4049
4319
  position: {
@@ -4053,16 +4323,16 @@
4053
4323
  });
4054
4324
 
4055
4325
  drawPath(parentGfx, pathData, {
4056
- strokeWidth: 1,
4057
- fill: 'none'
4326
+ fill: 'none',
4327
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4328
+ strokeWidth: 1
4058
4329
  });
4059
4330
  } else if (type === 'Exclusive') {
4060
-
4061
4331
  if (!instantiate) {
4062
4332
  drawCircle(parentGfx, element.width, element.height, element.height * 0.26, {
4063
- strokeWidth: 1,
4064
4333
  fill: 'none',
4065
- stroke: getStrokeColor(element, defaultStrokeColor)
4334
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4335
+ strokeWidth: 1
4066
4336
  });
4067
4337
  }
4068
4338
 
@@ -4072,104 +4342,163 @@
4072
4342
 
4073
4343
  return diamond;
4074
4344
  },
4075
- 'bpmn:Gateway': function(parentGfx, element) {
4076
- return drawDiamond(parentGfx, element.width, element.height, {
4077
- fill: getFillColor(element, defaultFillColor),
4078
- fillOpacity: DEFAULT_FILL_OPACITY,
4079
- stroke: getStrokeColor(element, defaultStrokeColor)
4080
- });
4081
- },
4082
- 'bpmn:SequenceFlow': function(parentGfx, element) {
4083
- var fill = getFillColor(element, defaultFillColor),
4084
- stroke = getStrokeColor(element, defaultStrokeColor);
4345
+ 'bpmn:ExclusiveGateway': function(parentGfx, element, attrs = {}) {
4346
+ attrs = pickAttrs(attrs, [
4347
+ 'fill',
4348
+ 'stroke'
4349
+ ]);
4085
4350
 
4086
- var path = drawConnectionSegments(parentGfx, element.waypoints, {
4087
- markerEnd: marker('sequenceflow-end', fill, stroke),
4088
- stroke: getStrokeColor(element, defaultStrokeColor)
4089
- });
4351
+ var gateway = renderGateway(parentGfx, element, attrs);
4090
4352
 
4091
- var sequenceFlow = getBusinessObject(element);
4353
+ var pathData = pathMap.getScaledPath('GATEWAY_EXCLUSIVE', {
4354
+ xScaleFactor: 0.4,
4355
+ yScaleFactor: 0.4,
4356
+ containerWidth: element.width,
4357
+ containerHeight: element.height,
4358
+ position: {
4359
+ mx: 0.32,
4360
+ my: 0.3
4361
+ }
4362
+ });
4092
4363
 
4093
- var source;
4364
+ var di = getDi(element);
4094
4365
 
4095
- if (element.source) {
4096
- source = element.source.businessObject;
4366
+ if (di.get('isMarkerVisible')) {
4367
+ drawPath(parentGfx, pathData, {
4368
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4369
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4370
+ strokeWidth: 1
4371
+ });
4372
+ }
4097
4373
 
4098
- // conditional flow marker
4099
- if (sequenceFlow.conditionExpression && source.$instanceOf('bpmn:Activity')) {
4100
- attr$1(path, {
4101
- markerStart: marker('conditional-flow-marker', fill, stroke)
4102
- });
4103
- }
4374
+ return gateway;
4375
+ },
4376
+ 'bpmn:Gateway': function(parentGfx, element, attrs = {}) {
4377
+ attrs = pickAttrs(attrs, [
4378
+ 'fill',
4379
+ 'stroke'
4380
+ ]);
4104
4381
 
4105
- // default marker
4106
- if (source.default && (source.$instanceOf('bpmn:Gateway') || source.$instanceOf('bpmn:Activity')) &&
4107
- source.default === sequenceFlow) {
4108
- attr$1(path, {
4109
- markerStart: marker('conditional-default-flow-marker', fill, stroke)
4110
- });
4111
- }
4112
- }
4382
+ return renderGateway(parentGfx, element, attrs);
4383
+ },
4384
+ 'bpmn:Group': function(parentGfx, element, attrs = {}) {
4385
+ attrs = pickAttrs(attrs, [
4386
+ 'fill',
4387
+ 'stroke',
4388
+ 'width',
4389
+ 'height'
4390
+ ]);
4113
4391
 
4114
- return path;
4392
+ return drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, {
4393
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4394
+ strokeWidth: 1.5,
4395
+ strokeDasharray: '10, 6, 0, 6',
4396
+ fill: 'none',
4397
+ pointerEvents: 'none',
4398
+ width: getWidth(element, attrs),
4399
+ height: getHeight(element, attrs)
4400
+ });
4115
4401
  },
4116
- 'bpmn:Association': function(parentGfx, element, attrs) {
4402
+ 'bpmn:InclusiveGateway': function(parentGfx, element, attrs = {}) {
4403
+ attrs = pickAttrs(attrs, [
4404
+ 'fill',
4405
+ 'stroke'
4406
+ ]);
4117
4407
 
4118
- var semantic = getBusinessObject(element);
4408
+ var gateway = renderGateway(parentGfx, element, attrs);
4119
4409
 
4120
- var fill = getFillColor(element, defaultFillColor),
4121
- stroke = getStrokeColor(element, defaultStrokeColor);
4410
+ drawCircle(parentGfx, element.width, element.height, element.height * 0.24, {
4411
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4412
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4413
+ strokeWidth: 2.5
4414
+ });
4122
4415
 
4123
- attrs = {
4124
- strokeDasharray: '0, 5',
4125
- stroke: getStrokeColor(element, defaultStrokeColor),
4126
- ...attrs
4127
- };
4416
+ return gateway;
4417
+ },
4418
+ 'bpmn:IntermediateEvent': function(parentGfx, element, attrs = {}) {
4419
+ var { renderIcon = true } = attrs;
4128
4420
 
4129
- if (semantic.associationDirection === 'One' ||
4130
- semantic.associationDirection === 'Both') {
4131
- attrs.markerEnd = marker('association-end', fill, stroke);
4132
- }
4421
+ attrs = pickAttrs(attrs, [
4422
+ 'fill',
4423
+ 'stroke'
4424
+ ]);
4425
+
4426
+ var outer = renderEvent(parentGfx, element, {
4427
+ ...attrs,
4428
+ strokeWidth: 1.5
4429
+ });
4430
+
4431
+ drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {
4432
+ fill: 'none',
4433
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4434
+ strokeWidth: 1.5
4435
+ });
4133
4436
 
4134
- if (semantic.associationDirection === 'Both') {
4135
- attrs.markerStart = marker('association-start', fill, stroke);
4437
+ if (renderIcon) {
4438
+ renderEventIcon(element, parentGfx, attrs);
4136
4439
  }
4137
4440
 
4138
- return drawConnectionSegments(parentGfx, element.waypoints, attrs);
4441
+ return outer;
4139
4442
  },
4140
- 'bpmn:DataInputAssociation': function(parentGfx, element) {
4141
- var fill = getFillColor(element, defaultFillColor),
4142
- stroke = getStrokeColor(element, defaultStrokeColor);
4143
-
4144
- return renderer('bpmn:Association')(parentGfx, element, {
4145
- markerEnd: marker('association-end', fill, stroke)
4443
+ 'bpmn:IntermediateCatchEvent': as('bpmn:IntermediateEvent'),
4444
+ 'bpmn:IntermediateThrowEvent': as('bpmn:IntermediateEvent'),
4445
+ 'bpmn:Lane': function(parentGfx, element, attrs = {}) {
4446
+ attrs = pickAttrs(attrs, [
4447
+ 'fill',
4448
+ 'stroke',
4449
+ 'width',
4450
+ 'height'
4451
+ ]);
4452
+
4453
+ return renderLane(parentGfx, element, {
4454
+ ...attrs,
4455
+ fillOpacity: LOW_OPACITY
4146
4456
  });
4147
4457
  },
4148
- 'bpmn:DataOutputAssociation': function(parentGfx, element) {
4149
- var fill = getFillColor(element, defaultFillColor),
4150
- stroke = getStrokeColor(element, defaultStrokeColor);
4458
+ 'bpmn:ManualTask': function(parentGfx, element, attrs = {}) {
4459
+ attrs = pickAttrs(attrs, [
4460
+ 'fill',
4461
+ 'stroke'
4462
+ ]);
4463
+
4464
+ var task = renderTask(parentGfx, element, attrs);
4465
+
4466
+ var pathData = pathMap.getScaledPath('TASK_TYPE_MANUAL', {
4467
+ abspos: {
4468
+ x: 17,
4469
+ y: 15
4470
+ }
4471
+ });
4151
4472
 
4152
- return renderer('bpmn:Association')(parentGfx, element, {
4153
- markerEnd: marker('association-end', fill, stroke)
4473
+ drawPath(parentGfx, pathData, {
4474
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4475
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4476
+ strokeWidth: 0.5
4154
4477
  });
4478
+
4479
+ return task;
4155
4480
  },
4156
- 'bpmn:MessageFlow': function(parentGfx, element) {
4481
+ 'bpmn:MessageFlow': function(parentGfx, element, attrs = {}) {
4482
+ attrs = pickAttrs(attrs, [
4483
+ 'fill',
4484
+ 'stroke'
4485
+ ]);
4157
4486
 
4158
4487
  var semantic = getBusinessObject(element),
4159
4488
  di = getDi(element);
4160
4489
 
4161
- var fill = getFillColor(element, defaultFillColor),
4162
- stroke = getStrokeColor(element, defaultStrokeColor);
4490
+ var fill = getFillColor(element, defaultFillColor, attrs.fill),
4491
+ stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
4163
4492
 
4164
4493
  var path = drawConnectionSegments(parentGfx, element.waypoints, {
4165
4494
  markerEnd: marker('messageflow-end', fill, stroke),
4166
4495
  markerStart: marker('messageflow-start', fill, stroke),
4496
+ stroke,
4167
4497
  strokeDasharray: '10, 11',
4168
- strokeWidth: 1.5,
4169
- stroke: getStrokeColor(element, defaultStrokeColor)
4498
+ strokeWidth: 1.5
4170
4499
  });
4171
4500
 
4172
- if (semantic.messageRef) {
4501
+ if (semantic.get('messageRef')) {
4173
4502
  var midPoint = path.getPointAtLength(path.getTotalLength() / 2);
4174
4503
 
4175
4504
  var markerPathData = pathMap.getScaledPath('MESSAGE_FLOW_MARKER', {
@@ -4179,404 +4508,518 @@
4179
4508
  }
4180
4509
  });
4181
4510
 
4182
- var messageAttrs = { strokeWidth: 1 };
4511
+ var messageAttrs = {
4512
+ strokeWidth: 1
4513
+ };
4514
+
4515
+ if (di.get('messageVisibleKind') === 'initiating') {
4516
+ messageAttrs.fill = fill;
4517
+ messageAttrs.stroke = stroke;
4518
+ } else {
4519
+ messageAttrs.fill = stroke;
4520
+ messageAttrs.stroke = fill;
4521
+ }
4522
+
4523
+ var message = drawPath(parentGfx, markerPathData, messageAttrs);
4524
+
4525
+ var messageRef = semantic.get('messageRef'),
4526
+ name = messageRef.get('name');
4527
+
4528
+ var label = renderLabel(parentGfx, name, {
4529
+ align: 'center-top',
4530
+ fitBox: true,
4531
+ style: {
4532
+ fill: stroke
4533
+ }
4534
+ });
4535
+
4536
+ var messageBounds = message.getBBox(),
4537
+ labelBounds = label.getBBox();
4538
+
4539
+ var translateX = midPoint.x - labelBounds.width / 2,
4540
+ translateY = midPoint.y + messageBounds.height / 2 + ELEMENT_LABEL_DISTANCE;
4541
+
4542
+ transform(label, translateX, translateY, 0);
4543
+ }
4544
+
4545
+ return path;
4546
+ },
4547
+ 'bpmn:ParallelGateway': function(parentGfx, element, attrs = {}) {
4548
+ attrs = pickAttrs(attrs, [
4549
+ 'fill',
4550
+ 'stroke'
4551
+ ]);
4552
+
4553
+ var diamond = renderGateway(parentGfx, element, attrs);
4554
+
4555
+ var pathData = pathMap.getScaledPath('GATEWAY_PARALLEL', {
4556
+ xScaleFactor: 0.6,
4557
+ yScaleFactor: 0.6,
4558
+ containerWidth: element.width,
4559
+ containerHeight: element.height,
4560
+ position: {
4561
+ mx: 0.46,
4562
+ my: 0.2
4563
+ }
4564
+ });
4565
+
4566
+ drawPath(parentGfx, pathData, {
4567
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4568
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4569
+ strokeWidth: 1
4570
+ });
4571
+
4572
+ return diamond;
4573
+ },
4574
+ 'bpmn:Participant': function(parentGfx, element, attrs = {}) {
4575
+ attrs = pickAttrs(attrs, [
4576
+ 'fill',
4577
+ 'stroke',
4578
+ 'width',
4579
+ 'height'
4580
+ ]);
4581
+
4582
+ var participant = renderLane(parentGfx, element, attrs);
4583
+
4584
+ var expandedParticipant = isExpanded(element);
4585
+ var horizontalParticipant = isHorizontal(element);
4586
+
4587
+ var semantic = getBusinessObject(element),
4588
+ name = semantic.get('name');
4589
+
4590
+ if (expandedParticipant) {
4591
+ var waypoints = horizontalParticipant ? [
4592
+ {
4593
+ x: 30,
4594
+ y: 0
4595
+ },
4596
+ {
4597
+ x: 30,
4598
+ y: getHeight(element, attrs)
4599
+ }
4600
+ ] : [
4601
+ {
4602
+ x: 0,
4603
+ y: 30
4604
+ },
4605
+ {
4606
+ x: getWidth(element, attrs),
4607
+ y: 30
4608
+ }
4609
+ ];
4610
+
4611
+ drawLine(parentGfx, waypoints, {
4612
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4613
+ strokeWidth: PARTICIPANT_STROKE_WIDTH
4614
+ });
4615
+
4616
+ renderLaneLabel(parentGfx, name, element, attrs);
4617
+ } else {
4618
+ var bounds = getBounds(element, attrs);
4183
4619
 
4184
- if (di.messageVisibleKind === 'initiating') {
4185
- messageAttrs.fill = 'white';
4186
- messageAttrs.stroke = black;
4187
- } else {
4188
- messageAttrs.fill = '#888';
4189
- messageAttrs.stroke = 'white';
4620
+ if (!horizontalParticipant) {
4621
+ bounds.height = getWidth(element, attrs);
4622
+ bounds.width = getHeight(element, attrs);
4190
4623
  }
4191
4624
 
4192
- var message = drawPath(parentGfx, markerPathData, messageAttrs);
4193
-
4194
- var labelText = semantic.messageRef.name;
4195
- var label = renderLabel(parentGfx, labelText, {
4196
- align: 'center-top',
4197
- fitBox: true,
4625
+ var textBox = renderLabel(parentGfx, name, {
4626
+ box: bounds,
4627
+ align: 'center-middle',
4198
4628
  style: {
4199
- fill: getStrokeColor(element, defaultLabelColor)
4629
+ fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
4200
4630
  }
4201
4631
  });
4202
4632
 
4203
- var messageBounds = message.getBBox(),
4204
- labelBounds = label.getBBox();
4205
-
4206
- var translateX = midPoint.x - labelBounds.width / 2,
4207
- translateY = midPoint.y + messageBounds.height / 2 + ELEMENT_LABEL_DISTANCE;
4208
-
4209
- transform(label, translateX, translateY, 0);
4633
+ if (!horizontalParticipant) {
4634
+ var top = -1 * getHeight(element, attrs);
4635
+ transform(textBox, 0, -top, 270);
4636
+ }
4637
+ }
4210
4638
 
4639
+ if (semantic.get('participantMultiplicity')) {
4640
+ renderTaskMarker('ParticipantMultiplicityMarker', parentGfx, element, attrs);
4211
4641
  }
4212
4642
 
4213
- return path;
4643
+ return participant;
4214
4644
  },
4215
- 'bpmn:DataObject': function(parentGfx, element) {
4216
- var pathData = pathMap.getScaledPath('DATA_OBJECT_PATH', {
4217
- xScaleFactor: 1,
4218
- yScaleFactor: 1,
4219
- containerWidth: element.width,
4220
- containerHeight: element.height,
4221
- position: {
4222
- mx: 0.474,
4223
- my: 0.296
4224
- }
4225
- });
4226
-
4227
- var elementObject = drawPath(parentGfx, pathData, {
4228
- fill: getFillColor(element, defaultFillColor),
4229
- fillOpacity: DEFAULT_FILL_OPACITY,
4230
- stroke: getStrokeColor(element, defaultStrokeColor)
4231
- });
4645
+ 'bpmn:ReceiveTask' : function(parentGfx, element, attrs = {}) {
4646
+ attrs = pickAttrs(attrs, [
4647
+ 'fill',
4648
+ 'stroke'
4649
+ ]);
4232
4650
 
4233
4651
  var semantic = getBusinessObject(element);
4234
4652
 
4235
- if (isCollection(semantic)) {
4236
- renderDataItemCollection(parentGfx, element);
4237
- }
4653
+ var task = renderTask(parentGfx, element, attrs);
4238
4654
 
4239
- return elementObject;
4240
- },
4241
- 'bpmn:DataObjectReference': as('bpmn:DataObject'),
4242
- 'bpmn:DataInput': function(parentGfx, element) {
4655
+ var pathData;
4243
4656
 
4244
- var arrowPathData = pathMap.getRawPath('DATA_ARROW');
4657
+ if (semantic.get('instantiate')) {
4658
+ drawCircle(parentGfx, 28, 28, 20 * 0.22, {
4659
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4660
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4661
+ strokeWidth: 1
4662
+ });
4245
4663
 
4246
- // page
4247
- var elementObject = renderer('bpmn:DataObject')(parentGfx, element);
4664
+ pathData = pathMap.getScaledPath('TASK_TYPE_INSTANTIATING_SEND', {
4665
+ abspos: {
4666
+ x: 7.77,
4667
+ y: 9.52
4668
+ }
4669
+ });
4670
+ } else {
4671
+ pathData = pathMap.getScaledPath('TASK_TYPE_SEND', {
4672
+ xScaleFactor: 0.9,
4673
+ yScaleFactor: 0.9,
4674
+ containerWidth: 21,
4675
+ containerHeight: 14,
4676
+ position: {
4677
+ mx: 0.3,
4678
+ my: 0.4
4679
+ }
4680
+ });
4681
+ }
4248
4682
 
4249
- /* input arrow path */ drawPath(parentGfx, arrowPathData, { strokeWidth: 1 });
4683
+ drawPath(parentGfx, pathData, {
4684
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4685
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4686
+ strokeWidth: 1
4687
+ });
4250
4688
 
4251
- return elementObject;
4689
+ return task;
4252
4690
  },
4253
- 'bpmn:DataOutput': function(parentGfx, element) {
4254
- var arrowPathData = pathMap.getRawPath('DATA_ARROW');
4691
+ 'bpmn:ScriptTask': function(parentGfx, element, attrs = {}) {
4692
+ attrs = pickAttrs(attrs, [
4693
+ 'fill',
4694
+ 'stroke'
4695
+ ]);
4255
4696
 
4256
- // page
4257
- var elementObject = renderer('bpmn:DataObject')(parentGfx, element);
4697
+ var task = renderTask(parentGfx, element, attrs);
4258
4698
 
4259
- /* output arrow path */ drawPath(parentGfx, arrowPathData, {
4260
- strokeWidth: 1,
4261
- fill: black
4699
+ var pathData = pathMap.getScaledPath('TASK_TYPE_SCRIPT', {
4700
+ abspos: {
4701
+ x: 15,
4702
+ y: 20
4703
+ }
4262
4704
  });
4263
4705
 
4264
- return elementObject;
4706
+ drawPath(parentGfx, pathData, {
4707
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4708
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4709
+ strokeWidth: 1
4710
+ });
4711
+
4712
+ return task;
4265
4713
  },
4266
- 'bpmn:DataStoreReference': function(parentGfx, element) {
4267
- var DATA_STORE_PATH = pathMap.getScaledPath('DATA_STORE', {
4714
+ 'bpmn:SendTask': function(parentGfx, element, attrs = {}) {
4715
+ attrs = pickAttrs(attrs, [
4716
+ 'fill',
4717
+ 'stroke'
4718
+ ]);
4719
+
4720
+ var task = renderTask(parentGfx, element, attrs);
4721
+
4722
+ var pathData = pathMap.getScaledPath('TASK_TYPE_SEND', {
4268
4723
  xScaleFactor: 1,
4269
4724
  yScaleFactor: 1,
4270
- containerWidth: element.width,
4271
- containerHeight: element.height,
4725
+ containerWidth: 21,
4726
+ containerHeight: 14,
4272
4727
  position: {
4273
- mx: 0,
4274
- my: 0.133
4728
+ mx: 0.285,
4729
+ my: 0.357
4275
4730
  }
4276
4731
  });
4277
4732
 
4278
- var elementStore = drawPath(parentGfx, DATA_STORE_PATH, {
4279
- strokeWidth: 2,
4280
- fill: getFillColor(element, defaultFillColor),
4281
- fillOpacity: DEFAULT_FILL_OPACITY,
4282
- stroke: getStrokeColor(element, defaultStrokeColor)
4733
+ drawPath(parentGfx, pathData, {
4734
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4735
+ stroke: getFillColor(element, defaultFillColor, attrs.fill),
4736
+ strokeWidth: 1
4283
4737
  });
4284
4738
 
4285
- return elementStore;
4739
+ return task;
4286
4740
  },
4287
- 'bpmn:BoundaryEvent': function(parentGfx, element, options) {
4288
-
4289
- var semantic = getBusinessObject(element),
4290
- cancel = semantic.cancelActivity;
4741
+ 'bpmn:SequenceFlow': function(parentGfx, element, attrs = {}) {
4742
+ attrs = pickAttrs(attrs, [
4743
+ 'fill',
4744
+ 'stroke'
4745
+ ]);
4291
4746
 
4292
- var attrs = {
4293
- strokeWidth: 1.5,
4294
- fill: getFillColor(element, defaultFillColor),
4295
- stroke: getStrokeColor(element, defaultStrokeColor)
4296
- };
4747
+ var fill = getFillColor(element, defaultFillColor, attrs.fill),
4748
+ stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
4297
4749
 
4298
- if (!cancel) {
4299
- attrs.strokeDasharray = '6';
4300
- }
4750
+ var connection = drawConnectionSegments(parentGfx, element.waypoints, {
4751
+ markerEnd: marker('sequenceflow-end', fill, stroke),
4752
+ stroke
4753
+ });
4301
4754
 
4302
- // apply fillOpacity
4303
- var outerAttrs = {
4304
- ...attrs,
4305
- fillOpacity: 1
4306
- };
4755
+ var semantic = getBusinessObject(element);
4307
4756
 
4308
- // apply no-fill
4309
- var innerAttrs = {
4310
- ...attrs,
4311
- fill: 'none'
4312
- };
4757
+ var { source } = element;
4313
4758
 
4314
- var outer = renderer('bpmn:Event')(parentGfx, element, outerAttrs);
4759
+ if (source) {
4760
+ var sourceSemantic = getBusinessObject(source);
4315
4761
 
4316
- /* inner path */ drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, innerAttrs);
4762
+ // conditional flow marker
4763
+ if (semantic.get('conditionExpression') && is$1(sourceSemantic, 'bpmn:Activity')) {
4764
+ attr$1(connection, {
4765
+ markerStart: marker('conditional-flow-marker', fill, stroke)
4766
+ });
4767
+ }
4317
4768
 
4318
- if (!options || options.renderIcon !== false) {
4319
- renderEventContent(element, parentGfx);
4769
+ // default marker
4770
+ if (sourceSemantic.get('default') && (is$1(sourceSemantic, 'bpmn:Gateway') || is$1(sourceSemantic, 'bpmn:Activity')) &&
4771
+ sourceSemantic.get('default') === semantic) {
4772
+ attr$1(connection, {
4773
+ markerStart: marker('conditional-default-flow-marker', fill, stroke)
4774
+ });
4775
+ }
4320
4776
  }
4321
4777
 
4322
- return outer;
4323
- },
4324
- 'bpmn:Group': function(parentGfx, element) {
4325
- return drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, {
4326
- stroke: getStrokeColor(element, defaultStrokeColor),
4327
- strokeWidth: 1.5,
4328
- strokeDasharray: '10,6,0,6',
4329
- fill: 'none',
4330
- pointerEvents: 'none'
4331
- });
4778
+ return connection;
4332
4779
  },
4333
- 'label': function(parentGfx, element) {
4334
- return renderExternalLabel(parentGfx, element);
4335
- },
4336
- 'bpmn:TextAnnotation': function(parentGfx, element) {
4337
- var textElement = drawRect(parentGfx, element.width, element.height, 0, 0, {
4338
- 'fill': 'none',
4339
- 'stroke': 'none'
4780
+ 'bpmn:ServiceTask': function(parentGfx, element, attrs = {}) {
4781
+ attrs = pickAttrs(attrs, [
4782
+ 'fill',
4783
+ 'stroke'
4784
+ ]);
4785
+
4786
+ var task = renderTask(parentGfx, element, attrs);
4787
+
4788
+ drawCircle(parentGfx, 10, 10, {
4789
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4790
+ stroke: 'none',
4791
+ transform: 'translate(6, 6)'
4340
4792
  });
4341
4793
 
4342
- var textPathData = pathMap.getScaledPath('TEXT_ANNOTATION', {
4343
- xScaleFactor: 1,
4344
- yScaleFactor: 1,
4345
- containerWidth: element.width,
4346
- containerHeight: element.height,
4347
- position: {
4348
- mx: 0.0,
4349
- my: 0.0
4794
+ var pathDataService1 = pathMap.getScaledPath('TASK_TYPE_SERVICE', {
4795
+ abspos: {
4796
+ x: 12,
4797
+ y: 18
4350
4798
  }
4351
4799
  });
4352
4800
 
4353
- drawPath(parentGfx, textPathData, {
4354
- stroke: getStrokeColor(element, defaultStrokeColor)
4801
+ drawPath(parentGfx, pathDataService1, {
4802
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4803
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4804
+ strokeWidth: 1
4355
4805
  });
4356
4806
 
4357
- var text = getBusinessObject(element).text || '';
4358
- renderLabel(parentGfx, text, {
4359
- box: element,
4360
- align: 'left-top',
4361
- padding: 7,
4362
- style: {
4363
- fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
4364
- }
4807
+ drawCircle(parentGfx, 10, 10, {
4808
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4809
+ stroke: 'none',
4810
+ transform: 'translate(11, 10)'
4365
4811
  });
4366
4812
 
4367
- return textElement;
4368
- },
4369
- 'ParticipantMultiplicityMarker': function(parentGfx, element) {
4370
- var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', {
4371
- xScaleFactor: 1,
4372
- yScaleFactor: 1,
4373
- containerWidth: element.width,
4374
- containerHeight: element.height,
4375
- position: {
4376
- mx: ((element.width / 2) / element.width),
4377
- my: (element.height - 15) / element.height
4813
+ var pathDataService2 = pathMap.getScaledPath('TASK_TYPE_SERVICE', {
4814
+ abspos: {
4815
+ x: 17,
4816
+ y: 22
4378
4817
  }
4379
4818
  });
4380
4819
 
4381
- drawMarker('participant-multiplicity', parentGfx, markerPath, {
4382
- strokeWidth: 2,
4383
- fill: getFillColor(element, defaultFillColor),
4384
- stroke: getStrokeColor(element, defaultStrokeColor)
4820
+ drawPath(parentGfx, pathDataService2, {
4821
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4822
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4823
+ strokeWidth: 1
4385
4824
  });
4825
+
4826
+ return task;
4386
4827
  },
4387
- 'SubProcessMarker': function(parentGfx, element) {
4388
- var markerRect = drawRect(parentGfx, 14, 14, 0, {
4389
- strokeWidth: 1,
4390
- fill: getFillColor(element, defaultFillColor),
4391
- stroke: getStrokeColor(element, defaultStrokeColor)
4392
- });
4828
+ 'bpmn:StartEvent': function(parentGfx, element, attrs = {}) {
4829
+ var { renderIcon = true } = attrs;
4393
4830
 
4394
- // Process marker is placed in the middle of the box
4395
- // therefore fixed values can be used here
4396
- translate$1(markerRect, element.width / 2 - 7.5, element.height - 20);
4831
+ attrs = pickAttrs(attrs, [
4832
+ 'fill',
4833
+ 'stroke'
4834
+ ]);
4397
4835
 
4398
- var markerPath = pathMap.getScaledPath('MARKER_SUB_PROCESS', {
4399
- xScaleFactor: 1.5,
4400
- yScaleFactor: 1.5,
4401
- containerWidth: element.width,
4402
- containerHeight: element.height,
4403
- position: {
4404
- mx: (element.width / 2 - 7.5) / element.width,
4405
- my: (element.height - 20) / element.height
4406
- }
4407
- });
4836
+ var semantic = getBusinessObject(element);
4408
4837
 
4409
- drawMarker('sub-process', parentGfx, markerPath, {
4410
- fill: getFillColor(element, defaultFillColor),
4411
- stroke: getStrokeColor(element, defaultStrokeColor)
4412
- });
4413
- },
4414
- 'ParallelMarker': function(parentGfx, element, position) {
4415
- var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', {
4416
- xScaleFactor: 1,
4417
- yScaleFactor: 1,
4418
- containerWidth: element.width,
4419
- containerHeight: element.height,
4420
- position: {
4421
- mx: ((element.width / 2 + position.parallel) / element.width),
4422
- my: (element.height - 20) / element.height
4423
- }
4424
- });
4838
+ if (!semantic.get('isInterrupting')) {
4839
+ attrs = {
4840
+ ...attrs,
4841
+ strokeDasharray: '6'
4842
+ };
4843
+ }
4425
4844
 
4426
- drawMarker('parallel', parentGfx, markerPath, {
4427
- fill: getFillColor(element, defaultFillColor),
4428
- stroke: getStrokeColor(element, defaultStrokeColor)
4429
- });
4845
+ var event = renderEvent(parentGfx, element, attrs);
4846
+
4847
+ if (renderIcon) {
4848
+ renderEventIcon(element, parentGfx, attrs);
4849
+ }
4850
+
4851
+ return event;
4430
4852
  },
4431
- 'SequentialMarker': function(parentGfx, element, position) {
4432
- var markerPath = pathMap.getScaledPath('MARKER_SEQUENTIAL', {
4433
- xScaleFactor: 1,
4434
- yScaleFactor: 1,
4435
- containerWidth: element.width,
4436
- containerHeight: element.height,
4437
- position: {
4438
- mx: ((element.width / 2 + position.seq) / element.width),
4439
- my: (element.height - 19) / element.height
4440
- }
4441
- });
4853
+ 'bpmn:SubProcess': function(parentGfx, element, attrs = {}) {
4854
+ if (isExpanded(element)) {
4855
+ attrs = pickAttrs(attrs, [
4856
+ 'fill',
4857
+ 'stroke',
4858
+ 'width',
4859
+ 'height'
4860
+ ]);
4861
+ } else {
4862
+ attrs = pickAttrs(attrs, [
4863
+ 'fill',
4864
+ 'stroke'
4865
+ ]);
4866
+ }
4442
4867
 
4443
- drawMarker('sequential', parentGfx, markerPath, {
4444
- fill: getFillColor(element, defaultFillColor),
4445
- stroke: getStrokeColor(element, defaultStrokeColor)
4446
- });
4868
+ return renderSubProcess(parentGfx, element, attrs);
4447
4869
  },
4448
- 'CompensationMarker': function(parentGfx, element, position) {
4449
- var markerMath = pathMap.getScaledPath('MARKER_COMPENSATION', {
4450
- xScaleFactor: 1,
4451
- yScaleFactor: 1,
4452
- containerWidth: element.width,
4453
- containerHeight: element.height,
4454
- position: {
4455
- mx: ((element.width / 2 + position.compensation) / element.width),
4456
- my: (element.height - 13) / element.height
4457
- }
4458
- });
4870
+ 'bpmn:Task': function(parentGfx, element, attrs = {}) {
4871
+ attrs = pickAttrs(attrs, [
4872
+ 'fill',
4873
+ 'stroke'
4874
+ ]);
4459
4875
 
4460
- drawMarker('compensation', parentGfx, markerMath, {
4461
- strokeWidth: 1,
4462
- fill: getFillColor(element, defaultFillColor),
4463
- stroke: getStrokeColor(element, defaultStrokeColor)
4464
- });
4876
+ return renderTask(parentGfx, element, attrs);
4465
4877
  },
4466
- 'LoopMarker': function(parentGfx, element, position) {
4467
- var markerPath = pathMap.getScaledPath('MARKER_LOOP', {
4468
- xScaleFactor: 1,
4469
- yScaleFactor: 1,
4470
- containerWidth: element.width,
4471
- containerHeight: element.height,
4472
- position: {
4473
- mx: ((element.width / 2 + position.loop) / element.width),
4474
- my: (element.height - 7) / element.height
4475
- }
4878
+ 'bpmn:TextAnnotation': function(parentGfx, element, attrs = {}) {
4879
+ attrs = pickAttrs(attrs, [
4880
+ 'fill',
4881
+ 'stroke',
4882
+ 'width',
4883
+ 'height'
4884
+ ]);
4885
+
4886
+ var {
4887
+ width,
4888
+ height
4889
+ } = getBounds(element, attrs);
4890
+
4891
+ var textElement = drawRect(parentGfx, width, height, 0, 0, {
4892
+ fill: 'none',
4893
+ stroke: 'none'
4476
4894
  });
4477
4895
 
4478
- drawMarker('loop', parentGfx, markerPath, {
4479
- strokeWidth: 1.5,
4480
- fill: getFillColor(element, defaultFillColor),
4481
- stroke: getStrokeColor(element, defaultStrokeColor),
4482
- strokeMiterlimit: 0.5
4483
- });
4484
- },
4485
- 'AdhocMarker': function(parentGfx, element, position) {
4486
- var markerPath = pathMap.getScaledPath('MARKER_ADHOC', {
4896
+ var textPathData = pathMap.getScaledPath('TEXT_ANNOTATION', {
4487
4897
  xScaleFactor: 1,
4488
4898
  yScaleFactor: 1,
4489
- containerWidth: element.width,
4490
- containerHeight: element.height,
4899
+ containerWidth: width,
4900
+ containerHeight: height,
4491
4901
  position: {
4492
- mx: ((element.width / 2 + position.adhoc) / element.width),
4493
- my: (element.height - 15) / element.height
4902
+ mx: 0.0,
4903
+ my: 0.0
4494
4904
  }
4495
4905
  });
4496
4906
 
4497
- drawMarker('adhoc', parentGfx, markerPath, {
4498
- strokeWidth: 1,
4499
- fill: getStrokeColor(element, defaultStrokeColor),
4500
- stroke: getStrokeColor(element, defaultStrokeColor)
4907
+ drawPath(parentGfx, textPathData, {
4908
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
4501
4909
  });
4502
- }
4503
- };
4504
4910
 
4505
- function attachTaskMarkers(parentGfx, element, taskMarkers) {
4506
- var obj = getBusinessObject(element);
4911
+ var semantic = getBusinessObject(element),
4912
+ text = semantic.get('text') || '';
4507
4913
 
4508
- var subprocess = taskMarkers && taskMarkers.indexOf('SubProcessMarker') !== -1;
4509
- var position;
4914
+ renderLabel(parentGfx, text, {
4915
+ align: 'left-top',
4916
+ box: getBounds(element, attrs),
4917
+ padding: 7,
4918
+ style: {
4919
+ fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
4920
+ }
4921
+ });
4510
4922
 
4511
- if (subprocess) {
4512
- position = {
4513
- seq: -21,
4514
- parallel: -22,
4515
- compensation: -42,
4516
- loop: -18,
4517
- adhoc: 10
4518
- };
4519
- } else {
4520
- position = {
4521
- seq: -3,
4522
- parallel: -6,
4523
- compensation: -27,
4524
- loop: 0,
4525
- adhoc: 10
4526
- };
4527
- }
4923
+ return textElement;
4924
+ },
4925
+ 'bpmn:Transaction': function(parentGfx, element, attrs = {}) {
4926
+ if (isExpanded(element)) {
4927
+ attrs = pickAttrs(attrs, [
4928
+ 'fill',
4929
+ 'stroke',
4930
+ 'width',
4931
+ 'height'
4932
+ ]);
4933
+ } else {
4934
+ attrs = pickAttrs(attrs, [
4935
+ 'fill',
4936
+ 'stroke'
4937
+ ]);
4938
+ }
4939
+
4940
+ var outer = renderSubProcess(parentGfx, element, {
4941
+ strokeWidth: 1.5,
4942
+ ...attrs
4943
+ });
4528
4944
 
4529
- forEach$1(taskMarkers, function(marker) {
4530
- renderer(marker)(parentGfx, element, position);
4531
- });
4945
+ var innerAttrs = styles.style([ 'no-fill', 'no-events' ], {
4946
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4947
+ strokeWidth: 1.5
4948
+ });
4532
4949
 
4533
- if (obj.isForCompensation) {
4534
- renderer('CompensationMarker')(parentGfx, element, position);
4535
- }
4950
+ var expanded = isExpanded(element);
4536
4951
 
4537
- if (obj.$type === 'bpmn:AdHocSubProcess') {
4538
- renderer('AdhocMarker')(parentGfx, element, position);
4539
- }
4952
+ if (!expanded) {
4953
+ attrs = {};
4954
+ }
4540
4955
 
4541
- var loopCharacteristics = obj.loopCharacteristics,
4542
- isSequential = loopCharacteristics && loopCharacteristics.isSequential;
4956
+ drawRect(
4957
+ parentGfx,
4958
+ getWidth(element, attrs),
4959
+ getHeight(element, attrs),
4960
+ TASK_BORDER_RADIUS - INNER_OUTER_DIST,
4961
+ INNER_OUTER_DIST,
4962
+ innerAttrs
4963
+ );
4543
4964
 
4544
- if (loopCharacteristics) {
4965
+ return outer;
4966
+ },
4967
+ 'bpmn:UserTask': function(parentGfx, element, attrs = {}) {
4968
+ attrs = pickAttrs(attrs, [
4969
+ 'fill',
4970
+ 'stroke'
4971
+ ]);
4545
4972
 
4546
- if (isSequential === undefined) {
4547
- renderer('LoopMarker')(parentGfx, element, position);
4548
- }
4973
+ var task = renderTask(parentGfx, element, attrs);
4549
4974
 
4550
- if (isSequential === false) {
4551
- renderer('ParallelMarker')(parentGfx, element, position);
4552
- }
4975
+ var x = 15;
4976
+ var y = 12;
4553
4977
 
4554
- if (isSequential === true) {
4555
- renderer('SequentialMarker')(parentGfx, element, position);
4556
- }
4557
- }
4558
- }
4978
+ var pathDataUser1 = pathMap.getScaledPath('TASK_TYPE_USER_1', {
4979
+ abspos: {
4980
+ x: x,
4981
+ y: y
4982
+ }
4983
+ });
4559
4984
 
4560
- function renderDataItemCollection(parentGfx, element) {
4985
+ drawPath(parentGfx, pathDataUser1, {
4986
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4987
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4988
+ strokeWidth: 0.5
4989
+ });
4990
+
4991
+ var pathDataUser2 = pathMap.getScaledPath('TASK_TYPE_USER_2', {
4992
+ abspos: {
4993
+ x: x,
4994
+ y: y
4995
+ }
4996
+ });
4561
4997
 
4562
- var yPosition = (element.height - 18) / element.height;
4998
+ drawPath(parentGfx, pathDataUser2, {
4999
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
5000
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
5001
+ strokeWidth: 0.5
5002
+ });
4563
5003
 
4564
- var pathData = pathMap.getScaledPath('DATA_OBJECT_COLLECTION_PATH', {
4565
- xScaleFactor: 1,
4566
- yScaleFactor: 1,
4567
- containerWidth: element.width,
4568
- containerHeight: element.height,
4569
- position: {
4570
- mx: 0.33,
4571
- my: yPosition
4572
- }
4573
- });
5004
+ var pathDataUser3 = pathMap.getScaledPath('TASK_TYPE_USER_3', {
5005
+ abspos: {
5006
+ x: x,
5007
+ y: y
5008
+ }
5009
+ });
4574
5010
 
4575
- /* collection path */ drawPath(parentGfx, pathData, {
4576
- strokeWidth: 2
4577
- });
4578
- }
5011
+ drawPath(parentGfx, pathDataUser3, {
5012
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
5013
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
5014
+ strokeWidth: 0.5
5015
+ });
4579
5016
 
5017
+ return task;
5018
+ },
5019
+ 'label': function(parentGfx, element, attrs = {}) {
5020
+ return renderExternalLabel(parentGfx, element, attrs);
5021
+ }
5022
+ };
4580
5023
 
4581
5024
  // extension API, use at your own risk
4582
5025
  this._drawPath = drawPath;
@@ -4611,15 +5054,16 @@
4611
5054
  *
4612
5055
  * @param {SVGElement} parentGfx
4613
5056
  * @param {Element} element
5057
+ * @param {Attrs} [attrs]
4614
5058
  *
4615
5059
  * @return {SVGElement} mainGfx
4616
5060
  */
4617
- BpmnRenderer.prototype.drawShape = function(parentGfx, element) {
4618
- var type = element.type;
4619
- var h = this._renderer(type);
5061
+ BpmnRenderer.prototype.drawShape = function(parentGfx, element, attrs = {}) {
5062
+ var { type } = element;
4620
5063
 
4621
- /* jshint -W040 */
4622
- return h(parentGfx, element);
5064
+ var handler = this._renderer(type);
5065
+
5066
+ return handler(parentGfx, element, attrs);
4623
5067
  };
4624
5068
 
4625
5069
  /**
@@ -4627,15 +5071,16 @@
4627
5071
  *
4628
5072
  * @param {SVGElement} parentGfx
4629
5073
  * @param {Element} element
5074
+ * @param {Attrs} [attrs]
4630
5075
  *
4631
5076
  * @return {SVGElement} mainGfx
4632
5077
  */
4633
- BpmnRenderer.prototype.drawConnection = function(parentGfx, element) {
4634
- var type = element.type;
4635
- var h = this._renderer(type);
5078
+ BpmnRenderer.prototype.drawConnection = function(parentGfx, element, attrs = {}) {
5079
+ var { type } = element;
5080
+
5081
+ var handler = this._renderer(type);
4636
5082
 
4637
- /* jshint -W040 */
4638
- return h(parentGfx, element);
5083
+ return handler(parentGfx, element, attrs);
4639
5084
  };
4640
5085
 
4641
5086
  /**
@@ -4646,7 +5091,6 @@
4646
5091
  * @return {string} path
4647
5092
  */
4648
5093
  BpmnRenderer.prototype.getShapePath = function(element) {
4649
-
4650
5094
  if (is$1(element, 'bpmn:Event')) {
4651
5095
  return getCirclePath(element);
4652
5096
  }
@@ -4662,6 +5106,24 @@
4662
5106
  return getRectPath(element);
4663
5107
  };
4664
5108
 
5109
+ /**
5110
+ * Pick attributes if they exist.
5111
+ *
5112
+ * @param {Object} attrs
5113
+ * @param {string[]} keys
5114
+ *
5115
+ * @returns {Object}
5116
+ */
5117
+ function pickAttrs(attrs, keys = []) {
5118
+ return keys.reduce((pickedAttrs, key) => {
5119
+ if (attrs[ key ]) {
5120
+ pickedAttrs[ key ] = attrs[ key ];
5121
+ }
5122
+
5123
+ return pickedAttrs;
5124
+ }, {});
5125
+ }
5126
+
4665
5127
  /**
4666
5128
  * @typedef {import('../util/Types').Dimensions} Dimensions
4667
5129
  *
@@ -5758,10 +6220,6 @@
5758
6220
  translate: [ 'value', translate ]
5759
6221
  };
5760
6222
 
5761
- function getDefaultExportFromCjs (x) {
5762
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
5763
- }
5764
-
5765
6223
  /**
5766
6224
  * @param {Point} point
5767
6225
  *
@@ -6350,26 +6808,6 @@
6350
6808
  return isButton(event, 1);
6351
6809
  }
6352
6810
 
6353
- /**
6354
- * @param {MouseEvent} event
6355
- *
6356
- * @return {boolean}
6357
- */
6358
- function hasPrimaryModifier(event) {
6359
- var originalEvent = getOriginal(event) || event;
6360
-
6361
- if (!isPrimaryButton(event)) {
6362
- return false;
6363
- }
6364
-
6365
- // Use cmd as primary modifier key for mac OS
6366
- if (isMac()) {
6367
- return originalEvent.metaKey;
6368
- } else {
6369
- return originalEvent.ctrlKey;
6370
- }
6371
- }
6372
-
6373
6811
  /**
6374
6812
  * @param {MouseEvent} event
6375
6813
  *
@@ -6970,6 +7408,8 @@
6970
7408
 
6971
7409
  var LOW_PRIORITY$3 = 500;
6972
7410
 
7411
+ var DEFAULT_PRIORITY$3 = 1000;
7412
+
6973
7413
  /**
6974
7414
  * @typedef {import('../../model/Types').Element} Element
6975
7415
  *
@@ -6988,25 +7428,30 @@
6988
7428
  */
6989
7429
  function Outline(eventBus, styles) {
6990
7430
 
6991
- this.offset = 6;
7431
+ this._eventBus = eventBus;
7432
+
7433
+ this.offset = 5;
6992
7434
 
6993
7435
  var OUTLINE_STYLE = styles.cls('djs-outline', [ 'no-fill' ]);
6994
7436
 
6995
7437
  var self = this;
6996
7438
 
6997
- function createOutline(gfx, bounds) {
7439
+ /**
7440
+ * @param {SVGElement} gfx
7441
+ *
7442
+ * @return {SVGElement} outline
7443
+ */
7444
+ function createOutline(gfx) {
6998
7445
  var outline = create$1('rect');
6999
7446
 
7000
7447
  attr$1(outline, assign$1({
7001
- x: 10,
7002
- y: 10,
7448
+ x: 0,
7449
+ y: 0,
7003
7450
  rx: 4,
7004
7451
  width: 100,
7005
7452
  height: 100
7006
7453
  }, OUTLINE_STYLE));
7007
7454
 
7008
- append(gfx, outline);
7009
-
7010
7455
  return outline;
7011
7456
  }
7012
7457
 
@@ -7019,7 +7464,8 @@
7019
7464
  var outline = query('.djs-outline', gfx);
7020
7465
 
7021
7466
  if (!outline) {
7022
- outline = createOutline(gfx);
7467
+ outline = self.getOutline(element) || createOutline();
7468
+ append(gfx, outline);
7023
7469
  }
7024
7470
 
7025
7471
  self.updateShapeOutline(outline, element);
@@ -7032,7 +7478,8 @@
7032
7478
  var outline = query('.djs-outline', gfx);
7033
7479
 
7034
7480
  if (!outline) {
7035
- outline = createOutline(gfx);
7481
+ outline = createOutline();
7482
+ append(gfx, outline);
7036
7483
  }
7037
7484
 
7038
7485
  self.updateConnectionOutline(outline, element);
@@ -7049,25 +7496,34 @@
7049
7496
  */
7050
7497
  Outline.prototype.updateShapeOutline = function(outline, element) {
7051
7498
 
7052
- attr$1(outline, {
7053
- x: -this.offset,
7054
- y: -this.offset,
7055
- width: element.width + this.offset * 2,
7056
- height: element.height + this.offset * 2
7057
- });
7499
+ var updated = false;
7500
+ var providers = this._getProviders();
7058
7501
 
7059
- };
7502
+ if (providers.length) {
7503
+ forEach$1(providers, function(provider) {
7504
+ updated = updated || provider.updateOutline(element, outline);
7505
+ });
7506
+ }
7060
7507
 
7508
+ if (!updated) {
7509
+ attr$1(outline, {
7510
+ x: -this.offset,
7511
+ y: -this.offset,
7512
+ width: element.width + this.offset * 2,
7513
+ height: element.height + this.offset * 2
7514
+ });
7515
+ }
7516
+ };
7061
7517
 
7062
7518
  /**
7063
7519
  * Updates the outline of a connection respecting the bounding box of
7064
7520
  * the connection and an outline offset.
7521
+ * Register an outline provider with the given priority.
7065
7522
  *
7066
7523
  * @param {SVGElement} outline
7067
7524
  * @param {Element} connection
7068
7525
  */
7069
7526
  Outline.prototype.updateConnectionOutline = function(outline, connection) {
7070
-
7071
7527
  var bbox = getBBox(connection);
7072
7528
 
7073
7529
  attr$1(outline, {
@@ -7076,9 +7532,61 @@
7076
7532
  width: bbox.width + this.offset * 2,
7077
7533
  height: bbox.height + this.offset * 2
7078
7534
  });
7535
+ };
7536
+
7537
+ /**
7538
+ * Register an outline provider with the given priority.
7539
+ *
7540
+ * @param {number} priority
7541
+ * @param {OutlineProvider} provider
7542
+ */
7543
+ Outline.prototype.registerProvider = function(priority, provider) {
7544
+ if (!provider) {
7545
+ provider = priority;
7546
+ priority = DEFAULT_PRIORITY$3;
7547
+ }
7548
+
7549
+ this._eventBus.on('outline.getProviders', priority, function(event) {
7550
+ event.providers.push(provider);
7551
+ });
7552
+ };
7553
+
7554
+ /**
7555
+ * Returns the registered outline providers.
7556
+ *
7557
+ * @returns {OutlineProvider[]}
7558
+ */
7559
+ Outline.prototype._getProviders = function() {
7560
+ var event = this._eventBus.createEvent({
7561
+ type: 'outline.getProviders',
7562
+ providers: []
7563
+ });
7564
+
7565
+ this._eventBus.fire(event);
7079
7566
 
7567
+ return event.providers;
7080
7568
  };
7081
7569
 
7570
+ /**
7571
+ * Returns the outline for an element.
7572
+ *
7573
+ * @param {Element} element
7574
+ **/
7575
+ Outline.prototype.getOutline = function(element) {
7576
+ var outline;
7577
+ var providers = this._getProviders();
7578
+
7579
+ forEach$1(providers, function(provider) {
7580
+
7581
+ if (!isFunction(provider.getOutline)) {
7582
+ return;
7583
+ }
7584
+
7585
+ outline = outline || provider.getOutline(element);
7586
+ });
7587
+
7588
+ return outline;
7589
+ };
7082
7590
 
7083
7591
  Outline.$inject = [ 'eventBus', 'styles', 'elementRegistry' ];
7084
7592
 
@@ -7420,8 +7928,8 @@
7420
7928
  var isSelected = selection.isSelected(element),
7421
7929
  isMultiSelect = selection.get().length > 1;
7422
7930
 
7423
- // Add to selection if CTRL or SHIFT pressed
7424
- var add = hasPrimaryModifier(event) || hasSecondaryModifier(event);
7931
+ // Add to selection if SHIFT pressed
7932
+ var add = hasSecondaryModifier(event);
7425
7933
 
7426
7934
  if (isSelected && isMultiSelect) {
7427
7935
  if (add) {
@@ -9397,7 +9905,7 @@
9397
9905
  }
9398
9906
 
9399
9907
  /**
9400
- * @typedef {import('./index').InjectAnnotated } InjectAnnotated
9908
+ * @typedef {import('./index.js').InjectAnnotated } InjectAnnotated
9401
9909
  */
9402
9910
 
9403
9911
  /**
@@ -9467,9 +9975,9 @@
9467
9975
  }
9468
9976
 
9469
9977
  /**
9470
- * @typedef { import('./index').ModuleDeclaration } ModuleDeclaration
9471
- * @typedef { import('./index').ModuleDefinition } ModuleDefinition
9472
- * @typedef { import('./index').InjectorContext } InjectorContext
9978
+ * @typedef { import('./index.js').ModuleDeclaration } ModuleDeclaration
9979
+ * @typedef { import('./index.js').ModuleDefinition } ModuleDefinition
9980
+ * @typedef { import('./index.js').InjectorContext } InjectorContext
9473
9981
  */
9474
9982
 
9475
9983
  /**
@@ -9572,11 +10080,20 @@
9572
10080
  };
9573
10081
  }
9574
10082
 
9575
- function instantiate(Type) {
10083
+ /**
10084
+ * Instantiate the given type, injecting dependencies.
10085
+ *
10086
+ * @template T
10087
+ *
10088
+ * @param { Function | [...string[], Function ]} type
10089
+ *
10090
+ * @return T
10091
+ */
10092
+ function instantiate(type) {
9576
10093
  const {
9577
10094
  fn,
9578
10095
  dependencies
9579
- } = fnDef(Type);
10096
+ } = fnDef(type);
9580
10097
 
9581
10098
  // instantiate var args constructor
9582
10099
  const Constructor = Function.prototype.bind.apply(fn, [ null ].concat(dependencies));
@@ -9584,6 +10101,17 @@
9584
10101
  return new Constructor();
9585
10102
  }
9586
10103
 
10104
+ /**
10105
+ * Invoke the given function, injecting dependencies. Return the result.
10106
+ *
10107
+ * @template T
10108
+ *
10109
+ * @param { Function | [...string[], Function ]} func
10110
+ * @param { Object } [context]
10111
+ * @param { Object } [locals]
10112
+ *
10113
+ * @return {T} invocation result
10114
+ */
9587
10115
  function invoke(func, context, locals) {
9588
10116
  const {
9589
10117
  fn,
@@ -11852,32 +12380,17 @@
11852
12380
  }
11853
12381
  };
11854
12382
 
11855
- var objectRefs = {exports: {}};
11856
-
11857
- var collection = {};
11858
-
11859
- /**
11860
- * An empty collection stub. Use {@link RefsCollection.extend} to extend a
11861
- * collection with ref semantics.
11862
- *
11863
- * @class RefsCollection
11864
- */
11865
-
11866
12383
  /**
11867
12384
  * Extends a collection with {@link Refs} aware methods
11868
12385
  *
11869
- * @memberof RefsCollection
11870
- * @static
11871
- *
11872
- * @param {Array<Object>} collection
11873
- * @param {Refs} refs instance
11874
- * @param {Object} property represented by the collection
11875
- * @param {Object} target object the collection is attached to
12386
+ * @param {Array<Object>} collection
12387
+ * @param {Refs} refs instance
12388
+ * @param {Object} property represented by the collection
12389
+ * @param {Object} target object the collection is attached to
11876
12390
  *
11877
12391
  * @return {RefsCollection<Object>} the extended array
11878
12392
  */
11879
12393
  function extend(collection, refs, property, target) {
11880
-
11881
12394
  var inverseProperty = property.inverse;
11882
12395
 
11883
12396
  /**
@@ -11888,7 +12401,7 @@
11888
12401
  * @param {Object} element the element to remove
11889
12402
  */
11890
12403
  Object.defineProperty(collection, 'remove', {
11891
- value: function(element) {
12404
+ value: function (element) {
11892
12405
  var idx = this.indexOf(element);
11893
12406
  if (idx !== -1) {
11894
12407
  this.splice(idx, 1);
@@ -11896,7 +12409,6 @@
11896
12409
  // unset inverse
11897
12410
  refs.unset(element, inverseProperty, target);
11898
12411
  }
11899
-
11900
12412
  return element;
11901
12413
  }
11902
12414
  });
@@ -11909,7 +12421,7 @@
11909
12421
  * @param {Object} element the element to check for
11910
12422
  */
11911
12423
  Object.defineProperty(collection, 'contains', {
11912
- value: function(element) {
12424
+ value: function (element) {
11913
12425
  return this.indexOf(element) !== -1;
11914
12426
  }
11915
12427
  });
@@ -11924,12 +12436,9 @@
11924
12436
  * (possibly moving other elements around)
11925
12437
  */
11926
12438
  Object.defineProperty(collection, 'add', {
11927
- value: function(element, idx) {
11928
-
12439
+ value: function (element, idx) {
11929
12440
  var currentIdx = this.indexOf(element);
11930
-
11931
12441
  if (typeof idx === 'undefined') {
11932
-
11933
12442
  if (currentIdx !== -1) {
11934
12443
  // element already in collection (!)
11935
12444
  return;
@@ -11941,14 +12450,12 @@
11941
12450
 
11942
12451
  // handle already in collection
11943
12452
  if (currentIdx !== -1) {
11944
-
11945
12453
  // remove element from currentIdx
11946
12454
  this.splice(currentIdx, 1);
11947
12455
  }
11948
12456
 
11949
12457
  // add element at idx
11950
12458
  this.splice(idx, 0, element);
11951
-
11952
12459
  if (currentIdx === -1) {
11953
12460
  // set inverse, unless element was
11954
12461
  // in collection already
@@ -11962,69 +12469,53 @@
11962
12469
  Object.defineProperty(collection, '__refs_collection', {
11963
12470
  value: true
11964
12471
  });
11965
-
11966
12472
  return collection;
11967
12473
  }
11968
12474
 
11969
-
12475
+ /**
12476
+ * Checks if a given collection is extended
12477
+ *
12478
+ * @param {Array<Object>} collection
12479
+ *
12480
+ * @return {boolean}
12481
+ */
11970
12482
  function isExtended(collection) {
11971
12483
  return collection.__refs_collection === true;
11972
12484
  }
11973
12485
 
11974
- collection.extend = extend;
11975
-
11976
- collection.isExtended = isExtended;
11977
-
11978
- var Collection = collection;
11979
-
11980
12486
  function hasOwnProperty$1(e, property) {
11981
12487
  return Object.prototype.hasOwnProperty.call(e, property.name || property);
11982
12488
  }
11983
-
11984
12489
  function defineCollectionProperty(ref, property, target) {
11985
-
11986
- var collection = Collection.extend(target[property.name] || [], ref, property, target);
11987
-
12490
+ var collection = extend(target[property.name] || [], ref, property, target);
11988
12491
  Object.defineProperty(target, property.name, {
11989
12492
  enumerable: property.enumerable,
11990
12493
  value: collection
11991
12494
  });
11992
-
11993
12495
  if (collection.length) {
11994
-
11995
- collection.forEach(function(o) {
12496
+ collection.forEach(function (o) {
11996
12497
  ref.set(o, property.inverse, target);
11997
12498
  });
11998
12499
  }
11999
12500
  }
12000
-
12001
-
12002
12501
  function defineProperty$1(ref, property, target) {
12003
-
12004
12502
  var inverseProperty = property.inverse;
12005
-
12006
12503
  var _value = target[property.name];
12007
-
12008
12504
  Object.defineProperty(target, property.name, {
12009
12505
  configurable: property.configurable,
12010
12506
  enumerable: property.enumerable,
12011
-
12012
- get: function() {
12507
+ get: function () {
12013
12508
  return _value;
12014
12509
  },
12015
-
12016
- set: function(value) {
12017
-
12510
+ set: function (value) {
12018
12511
  // return if we already performed all changes
12019
12512
  if (value === _value) {
12020
12513
  return;
12021
12514
  }
12022
-
12023
12515
  var old = _value;
12024
12516
 
12025
12517
  // temporary set null
12026
12518
  _value = null;
12027
-
12028
12519
  if (old) {
12029
12520
  ref.unset(old, inverseProperty, target);
12030
12521
  }
@@ -12036,7 +12527,6 @@
12036
12527
  ref.set(_value, inverseProperty, target);
12037
12528
  }
12038
12529
  });
12039
-
12040
12530
  }
12041
12531
 
12042
12532
  /**
@@ -12082,16 +12572,14 @@
12082
12572
  *
12083
12573
  * wheels[0].car // undefined
12084
12574
  */
12085
- function Refs$1(a, b) {
12086
-
12087
- if (!(this instanceof Refs$1)) {
12088
- return new Refs$1(a, b);
12575
+ function Refs(a, b) {
12576
+ if (!(this instanceof Refs)) {
12577
+ return new Refs(a, b);
12089
12578
  }
12090
12579
 
12091
12580
  // link
12092
12581
  a.inverse = b;
12093
12582
  b.inverse = a;
12094
-
12095
12583
  this.props = {};
12096
12584
  this.props[a.name] = a;
12097
12585
  this.props[b.name] = b;
@@ -12106,43 +12594,34 @@
12106
12594
  * @param {Object} target
12107
12595
  * @param {String} property
12108
12596
  */
12109
- Refs$1.prototype.bind = function(target, property) {
12597
+ Refs.prototype.bind = function (target, property) {
12110
12598
  if (typeof property === 'string') {
12111
12599
  if (!this.props[property]) {
12112
12600
  throw new Error('no property <' + property + '> in ref');
12113
12601
  }
12114
12602
  property = this.props[property];
12115
12603
  }
12116
-
12117
12604
  if (property.collection) {
12118
12605
  defineCollectionProperty(this, property, target);
12119
12606
  } else {
12120
12607
  defineProperty$1(this, property, target);
12121
12608
  }
12122
12609
  };
12123
-
12124
- Refs$1.prototype.ensureRefsCollection = function(target, property) {
12125
-
12610
+ Refs.prototype.ensureRefsCollection = function (target, property) {
12126
12611
  var collection = target[property.name];
12127
-
12128
- if (!Collection.isExtended(collection)) {
12612
+ if (!isExtended(collection)) {
12129
12613
  defineCollectionProperty(this, property, target);
12130
12614
  }
12131
-
12132
12615
  return collection;
12133
12616
  };
12134
-
12135
- Refs$1.prototype.ensureBound = function(target, property) {
12617
+ Refs.prototype.ensureBound = function (target, property) {
12136
12618
  if (!hasOwnProperty$1(target, property)) {
12137
12619
  this.bind(target, property);
12138
12620
  }
12139
12621
  };
12140
-
12141
- Refs$1.prototype.unset = function(target, property, value) {
12142
-
12622
+ Refs.prototype.unset = function (target, property, value) {
12143
12623
  if (target) {
12144
12624
  this.ensureBound(target, property);
12145
-
12146
12625
  if (property.collection) {
12147
12626
  this.ensureRefsCollection(target, property).remove(value);
12148
12627
  } else {
@@ -12150,12 +12629,9 @@
12150
12629
  }
12151
12630
  }
12152
12631
  };
12153
-
12154
- Refs$1.prototype.set = function(target, property, value) {
12155
-
12632
+ Refs.prototype.set = function (target, property, value) {
12156
12633
  if (target) {
12157
12634
  this.ensureBound(target, property);
12158
-
12159
12635
  if (property.collection) {
12160
12636
  this.ensureRefsCollection(target, property).add(value);
12161
12637
  } else {
@@ -12164,15 +12640,6 @@
12164
12640
  }
12165
12641
  };
12166
12642
 
12167
- var refs = Refs$1;
12168
-
12169
- objectRefs.exports = refs;
12170
-
12171
- objectRefs.exports.Collection = collection;
12172
-
12173
- var objectRefsExports = objectRefs.exports;
12174
- var Refs = /*@__PURE__*/getDefaultExportFromCjs(objectRefsExports);
12175
-
12176
12643
  var parentRefs = new Refs({ name: 'children', enumerable: true, collection: true }, { name: 'parent' }),
12177
12644
  labelRefs = new Refs({ name: 'labels', enumerable: true, collection: true }, { name: 'labelTarget' }),
12178
12645
  attacherRefs = new Refs({ name: 'attachers', collection: true }, { name: 'host' }),
@@ -13377,13 +13844,14 @@
13377
13844
  *
13378
13845
  * @param {SVGElement} visual The graphical element.
13379
13846
  * @param {ShapeLike} element The shape.
13847
+ * @param {Object} attrs Optional attributes.
13380
13848
  *
13381
13849
  * @return {SVGElement}
13382
13850
  */
13383
- GraphicsFactory.prototype.drawShape = function(visual, element) {
13851
+ GraphicsFactory.prototype.drawShape = function(visual, element, attrs = {}) {
13384
13852
  var eventBus = this._eventBus;
13385
13853
 
13386
- return eventBus.fire('render.shape', { gfx: visual, element: element });
13854
+ return eventBus.fire('render.shape', { gfx: visual, element, attrs });
13387
13855
  };
13388
13856
 
13389
13857
  /**
@@ -13404,13 +13872,14 @@
13404
13872
  *
13405
13873
  * @param {SVGElement} visual The graphical element.
13406
13874
  * @param {ConnectionLike} element The connection.
13875
+ * @param {Object} attrs Optional attributes.
13407
13876
  *
13408
13877
  * @return {SVGElement}
13409
13878
  */
13410
- GraphicsFactory.prototype.drawConnection = function(visual, element) {
13879
+ GraphicsFactory.prototype.drawConnection = function(visual, element, attrs = {}) {
13411
13880
  var eventBus = this._eventBus;
13412
13881
 
13413
- return eventBus.fire('render.connection', { gfx: visual, element: element });
13882
+ return eventBus.fire('render.connection', { gfx: visual, element, attrs });
13414
13883
  };
13415
13884
 
13416
13885
  /**
@@ -13987,6 +14456,17 @@
13987
14456
  this.idProperty = p;
13988
14457
  };
13989
14458
 
14459
+ DescriptorBuilder.prototype.assertNotTrait = function(typeDescriptor) {
14460
+
14461
+ const _extends = typeDescriptor.extends || [];
14462
+
14463
+ if (_extends.length) {
14464
+ throw new Error(
14465
+ `cannot create <${ typeDescriptor.name }> extending <${ typeDescriptor.extends }>`
14466
+ );
14467
+ }
14468
+ };
14469
+
13990
14470
  DescriptorBuilder.prototype.assertNotDefined = function(p, name) {
13991
14471
  var propertyName = p.name,
13992
14472
  definedProperty = this.propertiesByName[propertyName];
@@ -14005,6 +14485,10 @@
14005
14485
 
14006
14486
  DescriptorBuilder.prototype.addTrait = function(t, inherited) {
14007
14487
 
14488
+ if (inherited) {
14489
+ this.assertNotTrait(t);
14490
+ }
14491
+
14008
14492
  var typesByName = this.allTypesByName,
14009
14493
  types = this.allTypes;
14010
14494
 
@@ -14138,7 +14622,9 @@
14138
14622
  });
14139
14623
 
14140
14624
  forEach$1(type.extends, bind$2(function(extendsName) {
14141
- var extended = this.typeMap[extendsName];
14625
+ var extendsNameNs = parseName(extendsName, ns.prefix);
14626
+
14627
+ var extended = this.typeMap[extendsNameNs.name];
14142
14628
 
14143
14629
  extended.traits = extended.traits || [];
14144
14630
  extended.traits.push(name);
@@ -14167,24 +14653,33 @@
14167
14653
 
14168
14654
  var self = this;
14169
14655
 
14656
+ /**
14657
+ * Traverse the selected super type or trait
14658
+ *
14659
+ * @param {String} cls
14660
+ * @param {Boolean} [trait=false]
14661
+ */
14662
+ function traverse(cls, trait) {
14663
+ var parentNs = parseName(cls, isBuiltIn(cls) ? '' : nsName.prefix);
14664
+ self.mapTypes(parentNs, iterator, trait);
14665
+ }
14666
+
14170
14667
  /**
14171
14668
  * Traverse the selected trait.
14172
14669
  *
14173
14670
  * @param {String} cls
14174
14671
  */
14175
14672
  function traverseTrait(cls) {
14176
- return traverseSuper(cls, true);
14673
+ return traverse(cls, true);
14177
14674
  }
14178
14675
 
14179
14676
  /**
14180
- * Traverse the selected super type or trait
14677
+ * Traverse the selected super type
14181
14678
  *
14182
14679
  * @param {String} cls
14183
- * @param {Boolean} [trait=false]
14184
14680
  */
14185
- function traverseSuper(cls, trait) {
14186
- var parentNs = parseName(cls, isBuiltIn(cls) ? '' : nsName.prefix);
14187
- self.mapTypes(parentNs, iterator, trait);
14681
+ function traverseSuper(cls) {
14682
+ return traverse(cls, false);
14188
14683
  }
14189
14684
 
14190
14685
  if (!type) {
@@ -14267,7 +14762,7 @@
14267
14762
  throw new TypeError('property name must be a non-empty string');
14268
14763
  }
14269
14764
 
14270
- var property = this.model.getPropertyDescriptor(target, name);
14765
+ var property = this.getProperty(target, name);
14271
14766
 
14272
14767
  var propertyName = property && property.name;
14273
14768
 
@@ -14278,7 +14773,7 @@
14278
14773
  if (property) {
14279
14774
  delete target[propertyName];
14280
14775
  } else {
14281
- delete target.$attrs[name];
14776
+ delete target.$attrs[stripGlobal(name)];
14282
14777
  }
14283
14778
  } else {
14284
14779
 
@@ -14291,7 +14786,7 @@
14291
14786
  defineProperty(target, property, value);
14292
14787
  }
14293
14788
  } else {
14294
- target.$attrs[name] = value;
14789
+ target.$attrs[stripGlobal(name)] = value;
14295
14790
  }
14296
14791
  }
14297
14792
  };
@@ -14306,10 +14801,10 @@
14306
14801
  */
14307
14802
  Properties.prototype.get = function(target, name) {
14308
14803
 
14309
- var property = this.model.getPropertyDescriptor(target, name);
14804
+ var property = this.getProperty(target, name);
14310
14805
 
14311
14806
  if (!property) {
14312
- return target.$attrs[name];
14807
+ return target.$attrs[stripGlobal(name)];
14313
14808
  }
14314
14809
 
14315
14810
  var propertyName = property.name;
@@ -14363,6 +14858,44 @@
14363
14858
  this.define(target, '$model', { value: model });
14364
14859
  };
14365
14860
 
14861
+ /**
14862
+ * Return property with the given name on the element.
14863
+ *
14864
+ * @param {any} target
14865
+ * @param {string} name
14866
+ *
14867
+ * @return {object | null} property
14868
+ */
14869
+ Properties.prototype.getProperty = function(target, name) {
14870
+
14871
+ var model = this.model;
14872
+
14873
+ var property = model.getPropertyDescriptor(target, name);
14874
+
14875
+ if (property) {
14876
+ return property;
14877
+ }
14878
+
14879
+ if (name.includes(':')) {
14880
+ return null;
14881
+ }
14882
+
14883
+ const strict = model.config.strict;
14884
+
14885
+ if (typeof strict !== 'undefined') {
14886
+ const error = new TypeError(`unknown property <${ name }> on <${ target.$type }>`);
14887
+
14888
+ if (strict) {
14889
+ throw error;
14890
+ } else {
14891
+
14892
+ // eslint-disable-next-line no-undef
14893
+ typeof console !== 'undefined' && console.warn(error);
14894
+ }
14895
+ }
14896
+
14897
+ return null;
14898
+ };
14366
14899
 
14367
14900
  function isUndefined(val) {
14368
14901
  return typeof val === 'undefined';
@@ -14377,6 +14910,10 @@
14377
14910
  });
14378
14911
  }
14379
14912
 
14913
+ function stripGlobal(name) {
14914
+ return name.replace(/^:/, '');
14915
+ }
14916
+
14380
14917
  // Moddle implementation /////////////////////////////////////////////////
14381
14918
 
14382
14919
  /**
@@ -14399,8 +14936,10 @@
14399
14936
  * var moddle = new Moddle([pkg]);
14400
14937
  *
14401
14938
  * @param {Array<Package>} packages the packages to contain
14939
+ *
14940
+ * @param { { strict?: boolean } } [config] moddle configuration
14402
14941
  */
14403
- function Moddle(packages) {
14942
+ function Moddle(packages, config = {}) {
14404
14943
 
14405
14944
  this.properties = new Properties(this);
14406
14945
 
@@ -14408,6 +14947,8 @@
14408
14947
  this.registry = new Registry(packages, this.properties);
14409
14948
 
14410
14949
  this.typeCache = {};
14950
+
14951
+ this.config = config;
14411
14952
  }
14412
14953
 
14413
14954
 
@@ -14501,6 +15042,12 @@
14501
15042
  $type: name,
14502
15043
  $instanceOf: function(type) {
14503
15044
  return type === this.$type;
15045
+ },
15046
+ get: function(key) {
15047
+ return this[key];
15048
+ },
15049
+ set: function(key, value) {
15050
+ set$2(this, [ key ], value);
14504
15051
  }
14505
15052
  };
14506
15053
 
@@ -14516,6 +15063,8 @@
14516
15063
 
14517
15064
  this.properties.defineDescriptor(element, descriptor);
14518
15065
  this.properties.defineModel(element, this);
15066
+ this.properties.define(element, 'get', { enumerable: false, writable: true });
15067
+ this.properties.define(element, 'set', { enumerable: false, writable: true });
14519
15068
  this.properties.define(element, '$parent', { enumerable: false, writable: true });
14520
15069
  this.properties.define(element, '$instanceOf', { enumerable: false, writable: true });
14521
15070
 
@@ -23759,7 +24308,7 @@
23759
24308
  // pinch to zoom is mapped to wheel + ctrlKey = true
23760
24309
  // in modern browsers (!)
23761
24310
 
23762
- var isZoom = event.ctrlKey;
24311
+ var isZoom = event.ctrlKey || (isMac() && event.metaKey);
23763
24312
 
23764
24313
  var isHorizontalScroll = event.shiftKey;
23765
24314