camunda-bpmn-js 4.0.0-0 → 4.1.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 +44323 -41580
  4. package/dist/base-modeler.production.min.js +52 -53
  5. package/dist/base-navigated-viewer.development.js +1695 -1148
  6. package/dist/base-navigated-viewer.production.min.js +1 -1
  7. package/dist/base-viewer.development.js +1694 -1151
  8. package/dist/base-viewer.production.min.js +1 -1
  9. package/dist/camunda-cloud-modeler.development.js +53952 -41021
  10. package/dist/camunda-cloud-modeler.production.min.js +61 -61
  11. package/dist/camunda-cloud-navigated-viewer.development.js +1695 -1148
  12. package/dist/camunda-cloud-navigated-viewer.production.min.js +1 -1
  13. package/dist/camunda-cloud-viewer.development.js +1694 -1151
  14. package/dist/camunda-cloud-viewer.production.min.js +1 -1
  15. package/dist/camunda-platform-modeler.development.js +45914 -43112
  16. package/dist/camunda-platform-modeler.production.min.js +52 -53
  17. package/dist/camunda-platform-navigated-viewer.development.js +1695 -1148
  18. package/dist/camunda-platform-navigated-viewer.production.min.js +1 -1
  19. package/dist/camunda-platform-viewer.development.js +1694 -1151
  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
  *
@@ -1795,6 +1871,7 @@
1795
1871
  }
1796
1872
 
1797
1873
  var black = 'hsl(225, 10%, 15%)';
1874
+ var white = 'white';
1798
1875
 
1799
1876
  // element utils //////////////////////
1800
1877
 
@@ -1842,39 +1919,42 @@
1842
1919
  /**
1843
1920
  * @param {Element} element
1844
1921
  * @param {string} [defaultColor]
1922
+ * @param {string} [overrideColor]
1845
1923
  *
1846
1924
  * @return {string}
1847
1925
  */
1848
- function getFillColor(element, defaultColor) {
1926
+ function getFillColor(element, defaultColor, overrideColor) {
1849
1927
  var di = getDi(element);
1850
1928
 
1851
- return di.get('color:background-color') || di.get('bioc:fill') || defaultColor || 'white';
1929
+ return overrideColor || di.get('color:background-color') || di.get('bioc:fill') || defaultColor || white;
1852
1930
  }
1853
1931
 
1854
1932
  /**
1855
1933
  * @param {Element} element
1856
1934
  * @param {string} [defaultColor]
1935
+ * @param {string} [overrideColor]
1857
1936
  *
1858
1937
  * @return {string}
1859
1938
  */
1860
- function getStrokeColor(element, defaultColor) {
1939
+ function getStrokeColor(element, defaultColor, overrideColor) {
1861
1940
  var di = getDi(element);
1862
1941
 
1863
- return di.get('color:border-color') || di.get('bioc:stroke') || defaultColor || black;
1942
+ return overrideColor || di.get('color:border-color') || di.get('bioc:stroke') || defaultColor || black;
1864
1943
  }
1865
1944
 
1866
1945
  /**
1867
1946
  * @param {Element} element
1868
1947
  * @param {string} [defaultColor]
1869
1948
  * @param {string} [defaultStrokeColor]
1949
+ * @param {string} [overrideColor]
1870
1950
  *
1871
1951
  * @return {string}
1872
1952
  */
1873
- function getLabelColor(element, defaultColor, defaultStrokeColor) {
1953
+ function getLabelColor(element, defaultColor, defaultStrokeColor, overrideColor) {
1874
1954
  var di = getDi(element),
1875
1955
  label = di.get('label');
1876
1956
 
1877
- return label && label.get('color:color') || defaultColor ||
1957
+ return overrideColor || (label && label.get('color:color')) || defaultColor ||
1878
1958
  getStrokeColor(element, defaultStrokeColor);
1879
1959
  }
1880
1960
 
@@ -1978,6 +2058,45 @@
1978
2058
  return componentsToPath(rectPath);
1979
2059
  }
1980
2060
 
2061
+ /**
2062
+ * Get width and height from element or overrides.
2063
+ *
2064
+ * @param {Dimensions|Rect|ShapeLike} bounds
2065
+ * @param {Object} overrides
2066
+ *
2067
+ * @returns {Dimensions}
2068
+ */
2069
+ function getBounds(bounds, overrides = {}) {
2070
+ return {
2071
+ width: getWidth(bounds, overrides),
2072
+ height: getHeight(bounds, overrides)
2073
+ };
2074
+ }
2075
+
2076
+ /**
2077
+ * Get width from element or overrides.
2078
+ *
2079
+ * @param {Dimensions|Rect|ShapeLike} bounds
2080
+ * @param {Object} overrides
2081
+ *
2082
+ * @returns {number}
2083
+ */
2084
+ function getWidth(bounds, overrides = {}) {
2085
+ return has$1(overrides, 'width') ? overrides.width : bounds.width;
2086
+ }
2087
+
2088
+ /**
2089
+ * Get height from element or overrides.
2090
+ *
2091
+ * @param {Dimensions|Rect|ShapeLike} bounds
2092
+ * @param {Object} overrides
2093
+ *
2094
+ * @returns {number}
2095
+ */
2096
+ function getHeight(bounds, overrides = {}) {
2097
+ return has$1(overrides, 'height') ? overrides.height : bounds.height;
2098
+ }
2099
+
1981
2100
  function _mergeNamespaces$1(n, m) {
1982
2101
  m.forEach(function (e) {
1983
2102
  e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
@@ -2741,15 +2860,16 @@
2741
2860
  }
2742
2861
  };
2743
2862
 
2744
- var RENDERER_IDS = new Ids();
2745
-
2746
- var TASK_BORDER_RADIUS = 10;
2747
- var INNER_OUTER_DIST = 3;
2863
+ var rendererIds = new Ids();
2748
2864
 
2749
- var DEFAULT_FILL_OPACITY = .95,
2750
- HIGH_FILL_OPACITY = .35;
2865
+ var ELEMENT_LABEL_DISTANCE = 10,
2866
+ INNER_OUTER_DIST = 3,
2867
+ PARTICIPANT_STROKE_WIDTH = 1.5,
2868
+ TASK_BORDER_RADIUS = 10;
2751
2869
 
2752
- var ELEMENT_LABEL_DISTANCE = 10;
2870
+ var DEFAULT_OPACITY = 0.95,
2871
+ FULL_OPACITY = 1,
2872
+ LOW_OPACITY = 0.25;
2753
2873
 
2754
2874
  /**
2755
2875
  * @typedef { Partial<{
@@ -2757,6 +2877,13 @@
2757
2877
  * defaultStrokeColor: string,
2758
2878
  * defaultLabelColor: string
2759
2879
  * }> } BpmnRendererConfig
2880
+ *
2881
+ * @typedef { Partial<{
2882
+ * fill: string,
2883
+ * stroke: string,
2884
+ * width: string,
2885
+ * height: string
2886
+ * }> } Attrs
2760
2887
  */
2761
2888
 
2762
2889
  /**
@@ -2784,7 +2911,7 @@
2784
2911
  defaultStrokeColor = config && config.defaultStrokeColor,
2785
2912
  defaultLabelColor = config && config.defaultLabelColor;
2786
2913
 
2787
- var rendererId = RENDERER_IDS.next();
2914
+ var rendererId = rendererIds.next();
2788
2915
 
2789
2916
  var markers = {};
2790
2917
 
@@ -2880,7 +3007,7 @@
2880
3007
  cy: 6,
2881
3008
  r: 3.5,
2882
3009
  ...shapeStyle({
2883
- fill: fill,
3010
+ fill,
2884
3011
  stroke: stroke,
2885
3012
  strokeWidth: 1,
2886
3013
 
@@ -2900,7 +3027,7 @@
2900
3027
  var messageflowEnd = create$1('path', {
2901
3028
  d: 'm 1 5 l 0 -3 l 7 3 l -7 3 z',
2902
3029
  ...shapeStyle({
2903
- fill: fill,
3030
+ fill,
2904
3031
  stroke: stroke,
2905
3032
  strokeWidth: 1,
2906
3033
 
@@ -2921,7 +3048,7 @@
2921
3048
  d: 'M 11 5 L 1 10 L 11 15',
2922
3049
  ...lineStyle({
2923
3050
  fill: 'none',
2924
- stroke: stroke,
3051
+ stroke,
2925
3052
  strokeWidth: 1.5,
2926
3053
 
2927
3054
  // fix for safari / chrome / firefox bug not correctly
@@ -2942,7 +3069,7 @@
2942
3069
  d: 'M 1 5 L 11 10 L 1 15',
2943
3070
  ...lineStyle({
2944
3071
  fill: 'none',
2945
- stroke: stroke,
3072
+ stroke,
2946
3073
  strokeWidth: 1.5,
2947
3074
 
2948
3075
  // fix for safari / chrome / firefox bug not correctly
@@ -2962,7 +3089,7 @@
2962
3089
  var conditionalFlowMarker = create$1('path', {
2963
3090
  d: 'M 0 10 L 8 6 L 16 10 L 8 14 Z',
2964
3091
  ...shapeStyle({
2965
- fill: fill,
3092
+ fill,
2966
3093
  stroke: stroke
2967
3094
  })
2968
3095
  });
@@ -2990,7 +3117,7 @@
2990
3117
  }
2991
3118
  }
2992
3119
 
2993
- function drawCircle(parentGfx, width, height, offset, attrs) {
3120
+ function drawCircle(parentGfx, width, height, offset, attrs = {}) {
2994
3121
 
2995
3122
  if (isObject(offset)) {
2996
3123
  attrs = offset;
@@ -3001,10 +3128,6 @@
3001
3128
 
3002
3129
  attrs = shapeStyle(attrs);
3003
3130
 
3004
- if (attrs.fill === 'none') {
3005
- delete attrs.fillOpacity;
3006
- }
3007
-
3008
3131
  var cx = width / 2,
3009
3132
  cy = height / 2;
3010
3133
 
@@ -3104,7 +3227,6 @@
3104
3227
  }
3105
3228
 
3106
3229
  function drawPath(parentGfx, d, attrs) {
3107
-
3108
3230
  attrs = lineStyle(attrs);
3109
3231
 
3110
3232
  var path = create$1('path', {
@@ -3126,171 +3248,13 @@
3126
3248
  }
3127
3249
 
3128
3250
  function as(type) {
3129
- return function(parentGfx, element, options) {
3130
- return renderer(type)(parentGfx, element, options);
3131
- };
3132
- }
3133
-
3134
- function renderEventContent(element, parentGfx) {
3135
-
3136
- var event = getBusinessObject(element);
3137
- var isThrowing = isThrowEvent(event);
3138
-
3139
- if (event.eventDefinitions && event.eventDefinitions.length > 1) {
3140
- if (event.parallelMultiple) {
3141
- return renderer('bpmn:ParallelMultipleEventDefinition')(parentGfx, element, isThrowing);
3142
- }
3143
- else {
3144
- return renderer('bpmn:MultipleEventDefinition')(parentGfx, element, isThrowing);
3145
- }
3146
- }
3147
-
3148
- if (isTypedEvent(event, 'bpmn:MessageEventDefinition')) {
3149
- return renderer('bpmn:MessageEventDefinition')(parentGfx, element, isThrowing);
3150
- }
3151
-
3152
- if (isTypedEvent(event, 'bpmn:TimerEventDefinition')) {
3153
- return renderer('bpmn:TimerEventDefinition')(parentGfx, element, isThrowing);
3154
- }
3155
-
3156
- if (isTypedEvent(event, 'bpmn:ConditionalEventDefinition')) {
3157
- return renderer('bpmn:ConditionalEventDefinition')(parentGfx, element);
3158
- }
3159
-
3160
- if (isTypedEvent(event, 'bpmn:SignalEventDefinition')) {
3161
- return renderer('bpmn:SignalEventDefinition')(parentGfx, element, isThrowing);
3162
- }
3163
-
3164
- if (isTypedEvent(event, 'bpmn:EscalationEventDefinition')) {
3165
- return renderer('bpmn:EscalationEventDefinition')(parentGfx, element, isThrowing);
3166
- }
3167
-
3168
- if (isTypedEvent(event, 'bpmn:LinkEventDefinition')) {
3169
- return renderer('bpmn:LinkEventDefinition')(parentGfx, element, isThrowing);
3170
- }
3171
-
3172
- if (isTypedEvent(event, 'bpmn:ErrorEventDefinition')) {
3173
- return renderer('bpmn:ErrorEventDefinition')(parentGfx, element, isThrowing);
3174
- }
3175
-
3176
- if (isTypedEvent(event, 'bpmn:CancelEventDefinition')) {
3177
- return renderer('bpmn:CancelEventDefinition')(parentGfx, element, isThrowing);
3178
- }
3179
-
3180
- if (isTypedEvent(event, 'bpmn:CompensateEventDefinition')) {
3181
- return renderer('bpmn:CompensateEventDefinition')(parentGfx, element, isThrowing);
3182
- }
3183
-
3184
- if (isTypedEvent(event, 'bpmn:TerminateEventDefinition')) {
3185
- return renderer('bpmn:TerminateEventDefinition')(parentGfx, element, isThrowing);
3186
- }
3187
-
3188
- return null;
3189
- }
3190
-
3191
- function renderLabel(parentGfx, label, options) {
3192
-
3193
- options = assign$1({
3194
- size: {
3195
- width: 100
3196
- }
3197
- }, options);
3198
-
3199
- var text = textRenderer.createText(label || '', options);
3200
-
3201
- classes$1(text).add('djs-label');
3202
-
3203
- append(parentGfx, text);
3204
-
3205
- return text;
3206
- }
3207
-
3208
- function renderEmbeddedLabel(parentGfx, element, align) {
3209
- var semantic = getBusinessObject(element);
3210
-
3211
- return renderLabel(parentGfx, semantic.name, {
3212
- box: element,
3213
- align: align,
3214
- padding: 7,
3215
- style: {
3216
- fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
3217
- }
3218
- });
3219
- }
3220
-
3221
- function renderExternalLabel(parentGfx, element) {
3222
-
3223
- var box = {
3224
- width: 90,
3225
- height: 30,
3226
- x: element.width / 2 + element.x,
3227
- y: element.height / 2 + element.y
3251
+ return function(parentGfx, element, attrs) {
3252
+ return renderer(type)(parentGfx, element, attrs);
3228
3253
  };
3229
-
3230
- return renderLabel(parentGfx, getLabel(element), {
3231
- box: box,
3232
- fitBox: true,
3233
- style: assign$1(
3234
- {},
3235
- textRenderer.getExternalStyle(),
3236
- {
3237
- fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
3238
- }
3239
- )
3240
- });
3241
- }
3242
-
3243
- function renderLaneLabel(parentGfx, text, element) {
3244
- var textBox = renderLabel(parentGfx, text, {
3245
- box: {
3246
- height: 30,
3247
- width: element.height
3248
- },
3249
- align: 'center-middle',
3250
- style: {
3251
- fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
3252
- }
3253
- });
3254
-
3255
- var top = -1 * element.height;
3256
-
3257
- transform(textBox, 0, -top, 270);
3258
3254
  }
3259
3255
 
3260
- var handlers = this.handlers = {
3261
- 'bpmn:Event': function(parentGfx, element, attrs) {
3262
-
3263
- if (!('fillOpacity' in attrs)) {
3264
- attrs.fillOpacity = DEFAULT_FILL_OPACITY;
3265
- }
3266
-
3267
- return drawCircle(parentGfx, element.width, element.height, attrs);
3268
- },
3269
- 'bpmn:StartEvent': function(parentGfx, element, options) {
3270
- var attrs = {
3271
- fill: getFillColor(element, defaultFillColor),
3272
- stroke: getStrokeColor(element, defaultStrokeColor)
3273
- };
3274
-
3275
- var semantic = getBusinessObject(element);
3276
-
3277
- if (!semantic.isInterrupting) {
3278
- attrs = {
3279
- strokeDasharray: '6',
3280
- fill: getFillColor(element, defaultFillColor),
3281
- stroke: getStrokeColor(element, defaultStrokeColor)
3282
- };
3283
- }
3284
-
3285
- var circle = renderer('bpmn:Event')(parentGfx, element, attrs);
3286
-
3287
- if (!options || options.renderIcon !== false) {
3288
- renderEventContent(element, parentGfx);
3289
- }
3290
-
3291
- return circle;
3292
- },
3293
- 'bpmn:MessageEventDefinition': function(parentGfx, element, isThrowing) {
3256
+ var eventIconRenderers = {
3257
+ 'bpmn:MessageEventDefinition': function(parentGfx, element, attrs = {}, isThrowing) {
3294
3258
  var pathData = pathMap.getScaledPath('EVENT_MESSAGE', {
3295
3259
  xScaleFactor: 0.9,
3296
3260
  yScaleFactor: 0.9,
@@ -3302,22 +3266,27 @@
3302
3266
  }
3303
3267
  });
3304
3268
 
3305
- var fill = isThrowing ? getStrokeColor(element, defaultStrokeColor) : getFillColor(element, defaultFillColor);
3306
- var stroke = isThrowing ? getFillColor(element, defaultFillColor) : getStrokeColor(element, defaultStrokeColor);
3269
+ var fill = isThrowing
3270
+ ? getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3271
+ : getFillColor(element, defaultFillColor, attrs.fill);
3272
+
3273
+ var stroke = isThrowing
3274
+ ? getFillColor(element, defaultFillColor, attrs.fill)
3275
+ : getStrokeColor(element, defaultStrokeColor, attrs.stroke);
3307
3276
 
3308
3277
  var messagePath = drawPath(parentGfx, pathData, {
3309
- strokeWidth: 1,
3310
- fill: fill,
3311
- stroke: stroke
3278
+ fill,
3279
+ stroke,
3280
+ strokeWidth: 1
3312
3281
  });
3313
3282
 
3314
3283
  return messagePath;
3315
3284
  },
3316
- 'bpmn:TimerEventDefinition': function(parentGfx, element) {
3285
+ 'bpmn:TimerEventDefinition': function(parentGfx, element, attrs = {}) {
3317
3286
  var circle = drawCircle(parentGfx, element.width, element.height, 0.2 * element.height, {
3318
- strokeWidth: 2,
3319
- fill: getFillColor(element, defaultFillColor),
3320
- stroke: getStrokeColor(element, defaultStrokeColor)
3287
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3288
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3289
+ strokeWidth: 2
3321
3290
  });
3322
3291
 
3323
3292
  var pathData = pathMap.getScaledPath('EVENT_TIMER_WH', {
@@ -3332,12 +3301,11 @@
3332
3301
  });
3333
3302
 
3334
3303
  drawPath(parentGfx, pathData, {
3335
- strokeWidth: 2,
3336
- stroke: getStrokeColor(element, defaultStrokeColor)
3304
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3305
+ strokeWidth: 2
3337
3306
  });
3338
3307
 
3339
- for (var i = 0;i < 12; i++) {
3340
-
3308
+ for (var i = 0; i < 12; i++) {
3341
3309
  var linePathData = pathMap.getScaledPath('EVENT_TIMER_LINE', {
3342
3310
  xScaleFactor: 0.75,
3343
3311
  yScaleFactor: 0.75,
@@ -3349,19 +3317,19 @@
3349
3317
  }
3350
3318
  });
3351
3319
 
3352
- var width = element.width / 2;
3353
- var height = element.height / 2;
3320
+ var width = element.width / 2,
3321
+ height = element.height / 2;
3354
3322
 
3355
3323
  drawPath(parentGfx, linePathData, {
3356
3324
  strokeWidth: 1,
3357
- transform: 'rotate(' + (i * 30) + ',' + height + ',' + width + ')',
3358
- stroke: getStrokeColor(element, defaultStrokeColor)
3325
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3326
+ transform: 'rotate(' + (i * 30) + ',' + height + ',' + width + ')'
3359
3327
  });
3360
3328
  }
3361
3329
 
3362
3330
  return circle;
3363
3331
  },
3364
- 'bpmn:EscalationEventDefinition': function(parentGfx, event, isThrowing) {
3332
+ 'bpmn:EscalationEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3365
3333
  var pathData = pathMap.getScaledPath('EVENT_ESCALATION', {
3366
3334
  xScaleFactor: 1,
3367
3335
  yScaleFactor: 1,
@@ -3373,15 +3341,17 @@
3373
3341
  }
3374
3342
  });
3375
3343
 
3376
- var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
3344
+ var fill = isThrowing
3345
+ ? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3346
+ : getFillColor(event, defaultFillColor, attrs.fill);
3377
3347
 
3378
3348
  return drawPath(parentGfx, pathData, {
3379
- strokeWidth: 1,
3380
- fill: fill,
3381
- stroke: getStrokeColor(event, defaultStrokeColor)
3349
+ fill,
3350
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3351
+ strokeWidth: 1
3382
3352
  });
3383
3353
  },
3384
- 'bpmn:ConditionalEventDefinition': function(parentGfx, event) {
3354
+ 'bpmn:ConditionalEventDefinition': function(parentGfx, event, attrs = {}) {
3385
3355
  var pathData = pathMap.getScaledPath('EVENT_CONDITIONAL', {
3386
3356
  xScaleFactor: 1,
3387
3357
  yScaleFactor: 1,
@@ -3394,11 +3364,12 @@
3394
3364
  });
3395
3365
 
3396
3366
  return drawPath(parentGfx, pathData, {
3397
- strokeWidth: 1,
3398
- stroke: getStrokeColor(event, defaultStrokeColor)
3367
+ fill: getFillColor(event, defaultFillColor, attrs.fill),
3368
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3369
+ strokeWidth: 1
3399
3370
  });
3400
3371
  },
3401
- 'bpmn:LinkEventDefinition': function(parentGfx, event, isThrowing) {
3372
+ 'bpmn:LinkEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3402
3373
  var pathData = pathMap.getScaledPath('EVENT_LINK', {
3403
3374
  xScaleFactor: 1,
3404
3375
  yScaleFactor: 1,
@@ -3410,15 +3381,17 @@
3410
3381
  }
3411
3382
  });
3412
3383
 
3413
- var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
3384
+ var fill = isThrowing
3385
+ ? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3386
+ : getFillColor(event, defaultFillColor, attrs.fill);
3414
3387
 
3415
3388
  return drawPath(parentGfx, pathData, {
3416
- strokeWidth: 1,
3417
- fill: fill,
3418
- stroke: getStrokeColor(event, defaultStrokeColor)
3389
+ fill,
3390
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3391
+ strokeWidth: 1
3419
3392
  });
3420
3393
  },
3421
- 'bpmn:ErrorEventDefinition': function(parentGfx, event, isThrowing) {
3394
+ 'bpmn:ErrorEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3422
3395
  var pathData = pathMap.getScaledPath('EVENT_ERROR', {
3423
3396
  xScaleFactor: 1.1,
3424
3397
  yScaleFactor: 1.1,
@@ -3430,15 +3403,17 @@
3430
3403
  }
3431
3404
  });
3432
3405
 
3433
- var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
3406
+ var fill = isThrowing
3407
+ ? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3408
+ : getFillColor(event, defaultFillColor, attrs.fill);
3434
3409
 
3435
3410
  return drawPath(parentGfx, pathData, {
3436
- strokeWidth: 1,
3437
- fill: fill,
3438
- stroke: getStrokeColor(event, defaultStrokeColor)
3411
+ fill,
3412
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3413
+ strokeWidth: 1
3439
3414
  });
3440
3415
  },
3441
- 'bpmn:CancelEventDefinition': function(parentGfx, event, isThrowing) {
3416
+ 'bpmn:CancelEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3442
3417
  var pathData = pathMap.getScaledPath('EVENT_CANCEL_45', {
3443
3418
  xScaleFactor: 1.0,
3444
3419
  yScaleFactor: 1.0,
@@ -3450,19 +3425,19 @@
3450
3425
  }
3451
3426
  });
3452
3427
 
3453
- var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
3428
+ var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor, attrs.stroke) : 'none';
3454
3429
 
3455
3430
  var path = drawPath(parentGfx, pathData, {
3456
- strokeWidth: 1,
3457
- fill: fill,
3458
- stroke: getStrokeColor(event, defaultStrokeColor)
3431
+ fill,
3432
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3433
+ strokeWidth: 1
3459
3434
  });
3460
3435
 
3461
3436
  rotate(path, 45);
3462
3437
 
3463
3438
  return path;
3464
3439
  },
3465
- 'bpmn:CompensateEventDefinition': function(parentGfx, event, isThrowing) {
3440
+ 'bpmn:CompensateEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3466
3441
  var pathData = pathMap.getScaledPath('EVENT_COMPENSATION', {
3467
3442
  xScaleFactor: 1,
3468
3443
  yScaleFactor: 1,
@@ -3474,15 +3449,17 @@
3474
3449
  }
3475
3450
  });
3476
3451
 
3477
- var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
3452
+ var fill = isThrowing
3453
+ ? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3454
+ : getFillColor(event, defaultFillColor, attrs.fill);
3478
3455
 
3479
3456
  return drawPath(parentGfx, pathData, {
3480
- strokeWidth: 1,
3481
- fill: fill,
3482
- stroke: getStrokeColor(event, defaultStrokeColor)
3457
+ fill,
3458
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3459
+ strokeWidth: 1
3483
3460
  });
3484
3461
  },
3485
- 'bpmn:SignalEventDefinition': function(parentGfx, event, isThrowing) {
3462
+ 'bpmn:SignalEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3486
3463
  var pathData = pathMap.getScaledPath('EVENT_SIGNAL', {
3487
3464
  xScaleFactor: 0.9,
3488
3465
  yScaleFactor: 0.9,
@@ -3494,15 +3471,17 @@
3494
3471
  }
3495
3472
  });
3496
3473
 
3497
- var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
3474
+ var fill = isThrowing
3475
+ ? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3476
+ : getFillColor(event, defaultFillColor, attrs.fill);
3498
3477
 
3499
3478
  return drawPath(parentGfx, pathData, {
3500
3479
  strokeWidth: 1,
3501
- fill: fill,
3502
- stroke: getStrokeColor(event, defaultStrokeColor)
3480
+ fill,
3481
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3503
3482
  });
3504
3483
  },
3505
- 'bpmn:MultipleEventDefinition': function(parentGfx, event, isThrowing) {
3484
+ 'bpmn:MultipleEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3506
3485
  var pathData = pathMap.getScaledPath('EVENT_MULTIPLE', {
3507
3486
  xScaleFactor: 1.1,
3508
3487
  yScaleFactor: 1.1,
@@ -3514,14 +3493,16 @@
3514
3493
  }
3515
3494
  });
3516
3495
 
3517
- var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
3496
+ var fill = isThrowing
3497
+ ? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3498
+ : getFillColor(event, defaultFillColor, attrs.fill);
3518
3499
 
3519
3500
  return drawPath(parentGfx, pathData, {
3520
- strokeWidth: 1,
3521
- fill: fill
3501
+ fill,
3502
+ strokeWidth: 1
3522
3503
  });
3523
3504
  },
3524
- 'bpmn:ParallelMultipleEventDefinition': function(parentGfx, event) {
3505
+ 'bpmn:ParallelMultipleEventDefinition': function(parentGfx, event, attrs = {}) {
3525
3506
  var pathData = pathMap.getScaledPath('EVENT_PARALLEL_MULTIPLE', {
3526
3507
  xScaleFactor: 1.2,
3527
3508
  yScaleFactor: 1.2,
@@ -3534,501 +3515,791 @@
3534
3515
  });
3535
3516
 
3536
3517
  return drawPath(parentGfx, pathData, {
3537
- strokeWidth: 1,
3538
- fill: getStrokeColor(event, defaultStrokeColor),
3539
- stroke: getStrokeColor(event, defaultStrokeColor)
3518
+ fill: getFillColor(event, defaultFillColor, attrs.fill),
3519
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3520
+ strokeWidth: 1
3540
3521
  });
3541
3522
  },
3542
- 'bpmn:EndEvent': function(parentGfx, element, options) {
3543
- var circle = renderer('bpmn:Event')(parentGfx, element, {
3544
- strokeWidth: 4,
3545
- fill: getFillColor(element, defaultFillColor),
3546
- stroke: getStrokeColor(element, defaultStrokeColor)
3547
- });
3548
-
3549
- if (!options || options.renderIcon !== false) {
3550
- renderEventContent(element, parentGfx);
3551
- }
3552
-
3553
- return circle;
3554
- },
3555
- 'bpmn:TerminateEventDefinition': function(parentGfx, element) {
3523
+ 'bpmn:TerminateEventDefinition': function(parentGfx, element, attrs = {}) {
3556
3524
  var circle = drawCircle(parentGfx, element.width, element.height, 8, {
3557
- strokeWidth: 4,
3558
- fill: getStrokeColor(element, defaultStrokeColor),
3559
- stroke: getStrokeColor(element, defaultStrokeColor)
3525
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3526
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3527
+ strokeWidth: 4
3560
3528
  });
3561
3529
 
3562
3530
  return circle;
3563
- },
3564
- 'bpmn:IntermediateEvent': function(parentGfx, element, options) {
3565
- var outer = renderer('bpmn:Event')(parentGfx, element, {
3566
- strokeWidth: 1.5,
3567
- fill: getFillColor(element, defaultFillColor),
3568
- stroke: getStrokeColor(element, defaultStrokeColor)
3569
- });
3531
+ }
3532
+ };
3570
3533
 
3571
- /* inner */
3572
- drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {
3573
- strokeWidth: 1.5,
3574
- fill: getFillColor(element, 'none'),
3575
- stroke: getStrokeColor(element, defaultStrokeColor)
3576
- });
3534
+ function renderEventIcon(element, parentGfx, attrs = {}) {
3535
+ var semantic = getBusinessObject(element),
3536
+ isThrowing = isThrowEvent(semantic);
3577
3537
 
3578
- if (!options || options.renderIcon !== false) {
3579
- renderEventContent(element, parentGfx);
3538
+ if (semantic.get('eventDefinitions') && semantic.get('eventDefinitions').length > 1) {
3539
+ if (semantic.get('parallelMultiple')) {
3540
+ return eventIconRenderers[ 'bpmn:ParallelMultipleEventDefinition' ](parentGfx, element, attrs, isThrowing);
3541
+ }
3542
+ else {
3543
+ return eventIconRenderers[ 'bpmn:MultipleEventDefinition' ](parentGfx, element, attrs, isThrowing);
3580
3544
  }
3545
+ }
3581
3546
 
3582
- return outer;
3583
- },
3584
- 'bpmn:IntermediateCatchEvent': as('bpmn:IntermediateEvent'),
3585
- 'bpmn:IntermediateThrowEvent': as('bpmn:IntermediateEvent'),
3547
+ if (isTypedEvent(semantic, 'bpmn:MessageEventDefinition')) {
3548
+ return eventIconRenderers[ 'bpmn:MessageEventDefinition' ](parentGfx, element, attrs, isThrowing);
3549
+ }
3586
3550
 
3587
- 'bpmn:Activity': function(parentGfx, element, attrs) {
3551
+ if (isTypedEvent(semantic, 'bpmn:TimerEventDefinition')) {
3552
+ return eventIconRenderers[ 'bpmn:TimerEventDefinition' ](parentGfx, element, attrs, isThrowing);
3553
+ }
3588
3554
 
3589
- attrs = attrs || {};
3555
+ if (isTypedEvent(semantic, 'bpmn:ConditionalEventDefinition')) {
3556
+ return eventIconRenderers[ 'bpmn:ConditionalEventDefinition' ](parentGfx, element, attrs, isThrowing);
3557
+ }
3590
3558
 
3591
- if (!('fillOpacity' in attrs)) {
3592
- attrs.fillOpacity = DEFAULT_FILL_OPACITY;
3593
- }
3559
+ if (isTypedEvent(semantic, 'bpmn:SignalEventDefinition')) {
3560
+ return eventIconRenderers[ 'bpmn:SignalEventDefinition' ](parentGfx, element, attrs, isThrowing);
3561
+ }
3594
3562
 
3595
- return drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, attrs);
3596
- },
3563
+ if (isTypedEvent(semantic, 'bpmn:EscalationEventDefinition')) {
3564
+ return eventIconRenderers[ 'bpmn:EscalationEventDefinition' ](parentGfx, element, attrs, isThrowing);
3565
+ }
3597
3566
 
3598
- 'bpmn:Task': function(parentGfx, element) {
3599
- var attrs = {
3600
- fill: getFillColor(element, defaultFillColor),
3601
- stroke: getStrokeColor(element, defaultStrokeColor)
3602
- };
3567
+ if (isTypedEvent(semantic, 'bpmn:LinkEventDefinition')) {
3568
+ return eventIconRenderers[ 'bpmn:LinkEventDefinition' ](parentGfx, element, attrs, isThrowing);
3569
+ }
3603
3570
 
3604
- var rect = renderer('bpmn:Activity')(parentGfx, element, attrs);
3571
+ if (isTypedEvent(semantic, 'bpmn:ErrorEventDefinition')) {
3572
+ return eventIconRenderers[ 'bpmn:ErrorEventDefinition' ](parentGfx, element, attrs, isThrowing);
3573
+ }
3605
3574
 
3606
- renderEmbeddedLabel(parentGfx, element, 'center-middle');
3607
- attachTaskMarkers(parentGfx, element);
3575
+ if (isTypedEvent(semantic, 'bpmn:CancelEventDefinition')) {
3576
+ return eventIconRenderers[ 'bpmn:CancelEventDefinition' ](parentGfx, element, attrs, isThrowing);
3577
+ }
3608
3578
 
3609
- return rect;
3610
- },
3611
- 'bpmn:ServiceTask': function(parentGfx, element) {
3612
- var task = renderer('bpmn:Task')(parentGfx, element);
3579
+ if (isTypedEvent(semantic, 'bpmn:CompensateEventDefinition')) {
3580
+ return eventIconRenderers[ 'bpmn:CompensateEventDefinition' ](parentGfx, element, attrs, isThrowing);
3581
+ }
3613
3582
 
3614
- var pathDataBG = pathMap.getScaledPath('TASK_TYPE_SERVICE', {
3615
- abspos: {
3616
- x: 12,
3617
- y: 18
3583
+ if (isTypedEvent(semantic, 'bpmn:TerminateEventDefinition')) {
3584
+ return eventIconRenderers[ 'bpmn:TerminateEventDefinition' ](parentGfx, element, attrs, isThrowing);
3585
+ }
3586
+
3587
+ return null;
3588
+ }
3589
+
3590
+ var taskMarkerRenderers = {
3591
+ 'ParticipantMultiplicityMarker': function(parentGfx, element, attrs = {}) {
3592
+ var width = getWidth(element, attrs),
3593
+ height = getHeight(element, attrs);
3594
+
3595
+ var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', {
3596
+ xScaleFactor: 1,
3597
+ yScaleFactor: 1,
3598
+ containerWidth: width,
3599
+ containerHeight: height,
3600
+ position: {
3601
+ mx: ((width / 2 - 6) / width),
3602
+ my: (height - 15) / height
3618
3603
  }
3619
3604
  });
3620
3605
 
3621
- /* service bg */ drawPath(parentGfx, pathDataBG, {
3606
+ drawMarker('participant-multiplicity', parentGfx, markerPath, {
3607
+ strokeWidth: 2,
3608
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3609
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3610
+ });
3611
+ },
3612
+ 'SubProcessMarker': function(parentGfx, element, attrs = {}) {
3613
+ var markerRect = drawRect(parentGfx, 14, 14, 0, {
3622
3614
  strokeWidth: 1,
3623
- fill: getFillColor(element, defaultFillColor),
3624
- stroke: getStrokeColor(element, defaultStrokeColor)
3615
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3616
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3625
3617
  });
3626
3618
 
3627
- var fillPathData = pathMap.getScaledPath('TASK_TYPE_SERVICE_FILL', {
3628
- abspos: {
3629
- x: 17.2,
3630
- y: 18
3619
+ translate$1(markerRect, element.width / 2 - 7.5, element.height - 20);
3620
+
3621
+ var markerPath = pathMap.getScaledPath('MARKER_SUB_PROCESS', {
3622
+ xScaleFactor: 1.5,
3623
+ yScaleFactor: 1.5,
3624
+ containerWidth: element.width,
3625
+ containerHeight: element.height,
3626
+ position: {
3627
+ mx: (element.width / 2 - 7.5) / element.width,
3628
+ my: (element.height - 20) / element.height
3631
3629
  }
3632
3630
  });
3633
3631
 
3634
- /* service fill */ drawPath(parentGfx, fillPathData, {
3635
- strokeWidth: 0,
3636
- fill: getFillColor(element, defaultFillColor)
3632
+ drawMarker('sub-process', parentGfx, markerPath, {
3633
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3634
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3637
3635
  });
3636
+ },
3637
+ 'ParallelMarker': function(parentGfx, element, attrs) {
3638
+ var width = getWidth(element, attrs),
3639
+ height = getHeight(element, attrs);
3638
3640
 
3639
- var pathData = pathMap.getScaledPath('TASK_TYPE_SERVICE', {
3640
- abspos: {
3641
- x: 17,
3642
- y: 22
3641
+ var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', {
3642
+ xScaleFactor: 1,
3643
+ yScaleFactor: 1,
3644
+ containerWidth: width,
3645
+ containerHeight: height,
3646
+ position: {
3647
+ mx: ((width / 2 + attrs.parallel) / width),
3648
+ my: (height - 20) / height
3643
3649
  }
3644
3650
  });
3645
3651
 
3646
- /* service */ drawPath(parentGfx, pathData, {
3647
- strokeWidth: 1,
3648
- fill: getFillColor(element, defaultFillColor),
3649
- stroke: getStrokeColor(element, defaultStrokeColor)
3652
+ drawMarker('parallel', parentGfx, markerPath, {
3653
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3654
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3650
3655
  });
3651
-
3652
- return task;
3653
3656
  },
3654
- 'bpmn:UserTask': function(parentGfx, element) {
3655
- var task = renderer('bpmn:Task')(parentGfx, element);
3656
-
3657
- var x = 15;
3658
- var y = 12;
3659
-
3660
- var pathData = pathMap.getScaledPath('TASK_TYPE_USER_1', {
3661
- abspos: {
3662
- x: x,
3663
- y: y
3657
+ 'SequentialMarker': function(parentGfx, element, attrs) {
3658
+ var markerPath = pathMap.getScaledPath('MARKER_SEQUENTIAL', {
3659
+ xScaleFactor: 1,
3660
+ yScaleFactor: 1,
3661
+ containerWidth: element.width,
3662
+ containerHeight: element.height,
3663
+ position: {
3664
+ mx: ((element.width / 2 + attrs.seq) / element.width),
3665
+ my: (element.height - 19) / element.height
3664
3666
  }
3665
3667
  });
3666
3668
 
3667
- /* user path */ drawPath(parentGfx, pathData, {
3668
- strokeWidth: 0.5,
3669
- fill: getFillColor(element, defaultFillColor),
3670
- stroke: getStrokeColor(element, defaultStrokeColor)
3669
+ drawMarker('sequential', parentGfx, markerPath, {
3670
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3671
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3671
3672
  });
3672
-
3673
- var pathData2 = pathMap.getScaledPath('TASK_TYPE_USER_2', {
3674
- abspos: {
3675
- x: x,
3676
- y: y
3673
+ },
3674
+ 'CompensationMarker': function(parentGfx, element, attrs) {
3675
+ var markerMath = pathMap.getScaledPath('MARKER_COMPENSATION', {
3676
+ xScaleFactor: 1,
3677
+ yScaleFactor: 1,
3678
+ containerWidth: element.width,
3679
+ containerHeight: element.height,
3680
+ position: {
3681
+ mx: ((element.width / 2 + attrs.compensation) / element.width),
3682
+ my: (element.height - 13) / element.height
3677
3683
  }
3678
3684
  });
3679
3685
 
3680
- /* user2 path */ drawPath(parentGfx, pathData2, {
3681
- strokeWidth: 0.5,
3682
- fill: getFillColor(element, defaultFillColor),
3683
- stroke: getStrokeColor(element, defaultStrokeColor)
3686
+ drawMarker('compensation', parentGfx, markerMath, {
3687
+ strokeWidth: 1,
3688
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3689
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3684
3690
  });
3691
+ },
3692
+ 'LoopMarker': function(parentGfx, element, attrs) {
3693
+ var width = getWidth(element, attrs),
3694
+ height = getHeight(element, attrs);
3685
3695
 
3686
- var pathData3 = pathMap.getScaledPath('TASK_TYPE_USER_3', {
3687
- abspos: {
3688
- x: x,
3689
- y: y
3696
+ var markerPath = pathMap.getScaledPath('MARKER_LOOP', {
3697
+ xScaleFactor: 1,
3698
+ yScaleFactor: 1,
3699
+ containerWidth: width,
3700
+ containerHeight: height,
3701
+ position: {
3702
+ mx: ((width / 2 + attrs.loop) / width),
3703
+ my: (height - 7) / height
3690
3704
  }
3691
3705
  });
3692
3706
 
3693
- /* user3 path */ drawPath(parentGfx, pathData3, {
3694
- strokeWidth: 0.5,
3695
- fill: getStrokeColor(element, defaultStrokeColor),
3696
- stroke: getStrokeColor(element, defaultStrokeColor)
3707
+ drawMarker('loop', parentGfx, markerPath, {
3708
+ strokeWidth: 1.5,
3709
+ fill: 'none',
3710
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3711
+ strokeMiterlimit: 0.5
3697
3712
  });
3698
-
3699
- return task;
3700
3713
  },
3701
- 'bpmn:ManualTask': function(parentGfx, element) {
3702
- var task = renderer('bpmn:Task')(parentGfx, element);
3714
+ 'AdhocMarker': function(parentGfx, element, attrs) {
3715
+ var width = getWidth(element, attrs),
3716
+ height = getHeight(element, attrs);
3703
3717
 
3704
- var pathData = pathMap.getScaledPath('TASK_TYPE_MANUAL', {
3705
- abspos: {
3706
- x: 17,
3707
- y: 15
3718
+ var markerPath = pathMap.getScaledPath('MARKER_ADHOC', {
3719
+ xScaleFactor: 1,
3720
+ yScaleFactor: 1,
3721
+ containerWidth: width,
3722
+ containerHeight: height,
3723
+ position: {
3724
+ mx: ((width / 2 + attrs.adhoc) / width),
3725
+ my: (height - 15) / height
3708
3726
  }
3709
3727
  });
3710
3728
 
3711
- /* manual path */ drawPath(parentGfx, pathData, {
3712
- strokeWidth: 0.5, // 0.25,
3713
- fill: getFillColor(element, defaultFillColor),
3714
- stroke: getStrokeColor(element, defaultStrokeColor)
3729
+ drawMarker('adhoc', parentGfx, markerPath, {
3730
+ strokeWidth: 1,
3731
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3732
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3715
3733
  });
3734
+ }
3735
+ };
3716
3736
 
3717
- return task;
3718
- },
3719
- 'bpmn:SendTask': function(parentGfx, element) {
3720
- var task = renderer('bpmn:Task')(parentGfx, element);
3737
+ function renderTaskMarker(type, parentGfx, element, attrs) {
3738
+ taskMarkerRenderers[ type ](parentGfx, element, attrs);
3739
+ }
3721
3740
 
3722
- var pathData = pathMap.getScaledPath('TASK_TYPE_SEND', {
3741
+ function renderTaskMarkers(parentGfx, element, taskMarkers, attrs = {}) {
3742
+ attrs = {
3743
+ fill: attrs.fill,
3744
+ stroke: attrs.stroke,
3745
+ width: getWidth(element, attrs),
3746
+ height: getHeight(element, attrs)
3747
+ };
3748
+
3749
+ var semantic = getBusinessObject(element);
3750
+
3751
+ var subprocess = taskMarkers && taskMarkers.includes('SubProcessMarker');
3752
+
3753
+ if (subprocess) {
3754
+ attrs = {
3755
+ ...attrs,
3756
+ seq: -21,
3757
+ parallel: -22,
3758
+ compensation: -42,
3759
+ loop: -18,
3760
+ adhoc: 10
3761
+ };
3762
+ } else {
3763
+ attrs = {
3764
+ ...attrs,
3765
+ seq: -5,
3766
+ parallel: -6,
3767
+ compensation: -27,
3768
+ loop: 0,
3769
+ adhoc: 10
3770
+ };
3771
+ }
3772
+
3773
+ forEach$1(taskMarkers, function(marker) {
3774
+ renderTaskMarker(marker, parentGfx, element, attrs);
3775
+ });
3776
+
3777
+ if (semantic.get('isForCompensation')) {
3778
+ renderTaskMarker('CompensationMarker', parentGfx, element, attrs);
3779
+ }
3780
+
3781
+ if (is$1(semantic, 'bpmn:AdHocSubProcess')) {
3782
+ renderTaskMarker('AdhocMarker', parentGfx, element, attrs);
3783
+ }
3784
+
3785
+ var loopCharacteristics = semantic.get('loopCharacteristics'),
3786
+ isSequential = loopCharacteristics && loopCharacteristics.get('isSequential');
3787
+
3788
+ if (loopCharacteristics) {
3789
+
3790
+ if (isSequential === undefined) {
3791
+ renderTaskMarker('LoopMarker', parentGfx, element, attrs);
3792
+ }
3793
+
3794
+ if (isSequential === false) {
3795
+ renderTaskMarker('ParallelMarker', parentGfx, element, attrs);
3796
+ }
3797
+
3798
+ if (isSequential === true) {
3799
+ renderTaskMarker('SequentialMarker', parentGfx, element, attrs);
3800
+ }
3801
+ }
3802
+ }
3803
+
3804
+ function renderLabel(parentGfx, label, attrs = {}) {
3805
+ attrs = assign$1({
3806
+ size: {
3807
+ width: 100
3808
+ }
3809
+ }, attrs);
3810
+
3811
+ var text = textRenderer.createText(label || '', attrs);
3812
+
3813
+ classes$1(text).add('djs-label');
3814
+
3815
+ append(parentGfx, text);
3816
+
3817
+ return text;
3818
+ }
3819
+
3820
+ function renderEmbeddedLabel(parentGfx, element, align, attrs = {}) {
3821
+ var semantic = getBusinessObject(element);
3822
+
3823
+ var box = getBounds({
3824
+ x: element.x,
3825
+ y: element.y,
3826
+ width: element.width,
3827
+ height: element.height
3828
+ }, attrs);
3829
+
3830
+ return renderLabel(parentGfx, semantic.name, {
3831
+ align,
3832
+ box,
3833
+ padding: 7,
3834
+ style: {
3835
+ fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
3836
+ }
3837
+ });
3838
+ }
3839
+
3840
+ function renderExternalLabel(parentGfx, element, attrs = {}) {
3841
+ var box = {
3842
+ width: 90,
3843
+ height: 30,
3844
+ x: element.width / 2 + element.x,
3845
+ y: element.height / 2 + element.y
3846
+ };
3847
+
3848
+ return renderLabel(parentGfx, getLabel(element), {
3849
+ box: box,
3850
+ fitBox: true,
3851
+ style: assign$1(
3852
+ {},
3853
+ textRenderer.getExternalStyle(),
3854
+ {
3855
+ fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
3856
+ }
3857
+ )
3858
+ });
3859
+ }
3860
+
3861
+ function renderLaneLabel(parentGfx, text, element, attrs = {}) {
3862
+ var isHorizontalLane = isHorizontal(element);
3863
+
3864
+ var textBox = renderLabel(parentGfx, text, {
3865
+ box: {
3866
+ height: 30,
3867
+ width: isHorizontalLane ? getHeight(element, attrs) : getWidth(element, attrs),
3868
+ },
3869
+ align: 'center-middle',
3870
+ style: {
3871
+ fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
3872
+ }
3873
+ });
3874
+
3875
+ if (isHorizontalLane) {
3876
+ var top = -1 * getHeight(element, attrs);
3877
+ transform(textBox, 0, -top, 270);
3878
+ }
3879
+ }
3880
+
3881
+ function renderActivity(parentGfx, element, attrs = {}) {
3882
+ var {
3883
+ width,
3884
+ height
3885
+ } = getBounds(element, attrs);
3886
+
3887
+ return drawRect(parentGfx, width, height, TASK_BORDER_RADIUS, {
3888
+ ...attrs,
3889
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3890
+ fillOpacity: DEFAULT_OPACITY,
3891
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3892
+ });
3893
+ }
3894
+
3895
+ function renderAssociation(parentGfx, element, attrs = {}) {
3896
+ var semantic = getBusinessObject(element);
3897
+
3898
+ var fill = getFillColor(element, defaultFillColor, attrs.fill),
3899
+ stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
3900
+
3901
+ if (semantic.get('associationDirection') === 'One' ||
3902
+ semantic.get('associationDirection') === 'Both') {
3903
+ attrs.markerEnd = marker('association-end', fill, stroke);
3904
+ }
3905
+
3906
+ if (semantic.get('associationDirection') === 'Both') {
3907
+ attrs.markerStart = marker('association-start', fill, stroke);
3908
+ }
3909
+
3910
+ attrs = pickAttrs(attrs, [
3911
+ 'markerStart',
3912
+ 'markerEnd'
3913
+ ]);
3914
+
3915
+ return drawConnectionSegments(parentGfx, element.waypoints, {
3916
+ ...attrs,
3917
+ stroke,
3918
+ strokeDasharray: '0, 5'
3919
+ });
3920
+ }
3921
+
3922
+ function renderDataObject(parentGfx, element, attrs = {}) {
3923
+ var fill = getFillColor(element, defaultFillColor, attrs.fill),
3924
+ stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
3925
+
3926
+ var pathData = pathMap.getScaledPath('DATA_OBJECT_PATH', {
3927
+ xScaleFactor: 1,
3928
+ yScaleFactor: 1,
3929
+ containerWidth: element.width,
3930
+ containerHeight: element.height,
3931
+ position: {
3932
+ mx: 0.474,
3933
+ my: 0.296
3934
+ }
3935
+ });
3936
+
3937
+ var dataObject = drawPath(parentGfx, pathData, {
3938
+ fill,
3939
+ fillOpacity: DEFAULT_OPACITY,
3940
+ stroke
3941
+ });
3942
+
3943
+ var semantic = getBusinessObject(element);
3944
+
3945
+ if (isCollection(semantic)) {
3946
+ var collectionPathData = pathMap.getScaledPath('DATA_OBJECT_COLLECTION_PATH', {
3723
3947
  xScaleFactor: 1,
3724
3948
  yScaleFactor: 1,
3725
- containerWidth: 21,
3726
- containerHeight: 14,
3949
+ containerWidth: element.width,
3950
+ containerHeight: element.height,
3727
3951
  position: {
3728
- mx: 0.285,
3729
- my: 0.357
3952
+ mx: 0.33,
3953
+ my: (element.height - 18) / element.height
3730
3954
  }
3731
3955
  });
3732
3956
 
3733
- /* send path */ drawPath(parentGfx, pathData, {
3734
- strokeWidth: 1,
3735
- fill: getStrokeColor(element, defaultStrokeColor),
3736
- stroke: getFillColor(element, defaultFillColor)
3957
+ drawPath(parentGfx, collectionPathData, {
3958
+ strokeWidth: 2,
3959
+ fill,
3960
+ stroke
3737
3961
  });
3962
+ }
3738
3963
 
3739
- return task;
3740
- },
3741
- 'bpmn:ReceiveTask' : function(parentGfx, element) {
3742
- var semantic = getBusinessObject(element);
3964
+ return dataObject;
3965
+ }
3743
3966
 
3744
- var task = renderer('bpmn:Task')(parentGfx, element);
3745
- var pathData;
3967
+ function renderEvent(parentGfx, element, attrs = {}) {
3968
+ return drawCircle(parentGfx, element.width, element.height, {
3969
+ fillOpacity: DEFAULT_OPACITY,
3970
+ ...attrs,
3971
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3972
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3973
+ });
3974
+ }
3746
3975
 
3747
- if (semantic.instantiate) {
3748
- drawCircle(parentGfx, 28, 28, 20 * 0.22, { strokeWidth: 1 });
3976
+ function renderGateway(parentGfx, element, attrs = {}) {
3977
+ return drawDiamond(parentGfx, element.width, element.height, {
3978
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3979
+ fillOpacity: DEFAULT_OPACITY,
3980
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3981
+ });
3982
+ }
3749
3983
 
3750
- pathData = pathMap.getScaledPath('TASK_TYPE_INSTANTIATING_SEND', {
3751
- abspos: {
3752
- x: 7.77,
3753
- y: 9.52
3754
- }
3755
- });
3756
- } else {
3984
+ function renderLane(parentGfx, element, attrs = {}) {
3985
+ var lane = drawRect(parentGfx, getWidth(element, attrs), getHeight(element, attrs), 0, {
3986
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3987
+ fillOpacity: attrs.fillOpacity || DEFAULT_OPACITY,
3988
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3989
+ strokeWidth: 1.5
3990
+ });
3757
3991
 
3758
- pathData = pathMap.getScaledPath('TASK_TYPE_SEND', {
3759
- xScaleFactor: 0.9,
3760
- yScaleFactor: 0.9,
3761
- containerWidth: 21,
3762
- containerHeight: 14,
3763
- position: {
3764
- mx: 0.3,
3765
- my: 0.4
3766
- }
3767
- });
3768
- }
3992
+ var semantic = getBusinessObject(element);
3769
3993
 
3770
- /* receive path */ drawPath(parentGfx, pathData, {
3771
- strokeWidth: 1,
3772
- fill: getFillColor(element, defaultFillColor),
3773
- stroke: getStrokeColor(element, defaultStrokeColor)
3994
+ if (is$1(semantic, 'bpmn:Lane')) {
3995
+ var text = semantic.get('name');
3996
+
3997
+ renderLaneLabel(parentGfx, text, element, attrs);
3998
+ }
3999
+
4000
+ return lane;
4001
+ }
4002
+
4003
+ function renderSubProcess(parentGfx, element, attrs = {}) {
4004
+ var activity = renderActivity(parentGfx, element, attrs);
4005
+
4006
+ if (isEventSubProcess(element)) {
4007
+ attr$1(activity, {
4008
+ strokeDasharray: '0, 5.5',
4009
+ strokeWidth: 2.5
3774
4010
  });
4011
+ }
3775
4012
 
3776
- return task;
4013
+ var expanded = isExpanded(element);
4014
+
4015
+ renderEmbeddedLabel(parentGfx, element, expanded ? 'center-top' : 'center-middle', attrs);
4016
+
4017
+ if (expanded) {
4018
+ renderTaskMarkers(parentGfx, element, undefined, attrs);
4019
+ } else {
4020
+ renderTaskMarkers(parentGfx, element, [ 'SubProcessMarker' ], attrs);
4021
+ }
4022
+
4023
+ return activity;
4024
+ }
4025
+
4026
+ function renderTask(parentGfx, element, attrs = {}) {
4027
+ var activity = renderActivity(parentGfx, element, attrs);
4028
+
4029
+ renderEmbeddedLabel(parentGfx, element, 'center-middle', attrs);
4030
+
4031
+ renderTaskMarkers(parentGfx, element, undefined, attrs);
4032
+
4033
+ return activity;
4034
+ }
4035
+
4036
+ var handlers = this.handlers = {
4037
+ 'bpmn:AdHocSubProcess': function(parentGfx, element, attrs = {}) {
4038
+ if (isExpanded(element)) {
4039
+ attrs = pickAttrs(attrs, [
4040
+ 'fill',
4041
+ 'stroke',
4042
+ 'width',
4043
+ 'height'
4044
+ ]);
4045
+ } else {
4046
+ attrs = pickAttrs(attrs, [
4047
+ 'fill',
4048
+ 'stroke'
4049
+ ]);
4050
+ }
4051
+
4052
+ return renderSubProcess(parentGfx, element, attrs);
3777
4053
  },
3778
- 'bpmn:ScriptTask': function(parentGfx, element) {
3779
- var task = renderer('bpmn:Task')(parentGfx, element);
4054
+ 'bpmn:Association': function(parentGfx, element, attrs = {}) {
4055
+ attrs = pickAttrs(attrs, [
4056
+ 'fill',
4057
+ 'stroke'
4058
+ ]);
3780
4059
 
3781
- var pathData = pathMap.getScaledPath('TASK_TYPE_SCRIPT', {
3782
- abspos: {
3783
- x: 15,
3784
- y: 20
3785
- }
3786
- });
4060
+ return renderAssociation(parentGfx, element, attrs);
4061
+ },
4062
+ 'bpmn:BoundaryEvent': function(parentGfx, element, attrs = {}) {
4063
+ var { renderIcon = true } = attrs;
3787
4064
 
3788
- /* script path */ drawPath(parentGfx, pathData, {
3789
- strokeWidth: 1,
3790
- stroke: getStrokeColor(element, defaultStrokeColor)
4065
+ attrs = pickAttrs(attrs, [
4066
+ 'fill',
4067
+ 'stroke'
4068
+ ]);
4069
+
4070
+ var semantic = getBusinessObject(element),
4071
+ cancelActivity = semantic.get('cancelActivity');
4072
+
4073
+ attrs = {
4074
+ strokeWidth: 1.5,
4075
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4076
+ fillOpacity: FULL_OPACITY,
4077
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
4078
+ };
4079
+
4080
+ if (!cancelActivity) {
4081
+ attrs.strokeDasharray = '6';
4082
+ }
4083
+
4084
+ var event = renderEvent(parentGfx, element, attrs);
4085
+
4086
+ drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {
4087
+ ...attrs,
4088
+ fill: 'none'
3791
4089
  });
3792
4090
 
3793
- return task;
4091
+ if (renderIcon) {
4092
+ renderEventIcon(element, parentGfx, attrs);
4093
+ }
4094
+
4095
+ return event;
3794
4096
  },
3795
- 'bpmn:BusinessRuleTask': function(parentGfx, element) {
3796
- var task = renderer('bpmn:Task')(parentGfx, element);
4097
+ 'bpmn:BusinessRuleTask': function(parentGfx, element, attrs = {}) {
4098
+ attrs = pickAttrs(attrs, [
4099
+ 'fill',
4100
+ 'stroke'
4101
+ ]);
3797
4102
 
3798
- var headerPathData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_HEADER', {
4103
+ var task = renderTask(parentGfx, element, attrs);
4104
+
4105
+ var headerData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_MAIN', {
3799
4106
  abspos: {
3800
4107
  x: 8,
3801
4108
  y: 8
3802
4109
  }
3803
4110
  });
3804
4111
 
3805
- var businessHeaderPath = drawPath(parentGfx, headerPathData);
3806
- attr$1(businessHeaderPath, {
3807
- strokeWidth: 1,
3808
- fill: getFillColor(element, '#aaaaaa'),
3809
- stroke: getStrokeColor(element, defaultStrokeColor)
4112
+ var businessPath = drawPath(parentGfx, headerData);
4113
+
4114
+ attr$1(businessPath, {
4115
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4116
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4117
+ strokeWidth: 1
3810
4118
  });
3811
4119
 
3812
- var headerData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_MAIN', {
4120
+ var headerPathData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_HEADER', {
3813
4121
  abspos: {
3814
4122
  x: 8,
3815
4123
  y: 8
3816
4124
  }
3817
4125
  });
3818
4126
 
3819
- var businessPath = drawPath(parentGfx, headerData);
3820
- attr$1(businessPath, {
3821
- strokeWidth: 1,
3822
- stroke: getStrokeColor(element, defaultStrokeColor)
4127
+ var businessHeaderPath = drawPath(parentGfx, headerPathData);
4128
+
4129
+ attr$1(businessHeaderPath, {
4130
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4131
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4132
+ strokeWidth: 1
3823
4133
  });
3824
4134
 
3825
4135
  return task;
3826
4136
  },
3827
- 'bpmn:SubProcess': function(parentGfx, element, attrs) {
3828
- attrs = {
3829
- fill: getFillColor(element, defaultFillColor),
3830
- stroke: getStrokeColor(element, defaultStrokeColor),
4137
+ 'bpmn:CallActivity': function(parentGfx, element, attrs = {}) {
4138
+ attrs = pickAttrs(attrs, [
4139
+ 'fill',
4140
+ 'stroke'
4141
+ ]);
4142
+
4143
+ return renderSubProcess(parentGfx, element, {
4144
+ strokeWidth: 5,
3831
4145
  ...attrs
3832
- };
4146
+ });
4147
+ },
4148
+ 'bpmn:ComplexGateway': function(parentGfx, element, attrs = {}) {
4149
+ attrs = pickAttrs(attrs, [
4150
+ 'fill',
4151
+ 'stroke'
4152
+ ]);
3833
4153
 
3834
- var rect = renderer('bpmn:Activity')(parentGfx, element, attrs);
4154
+ var gateway = renderGateway(parentGfx, element, attrs);
3835
4155
 
3836
- var expanded = isExpanded(element);
4156
+ var pathData = pathMap.getScaledPath('GATEWAY_COMPLEX', {
4157
+ xScaleFactor: 0.5,
4158
+ yScaleFactor:0.5,
4159
+ containerWidth: element.width,
4160
+ containerHeight: element.height,
4161
+ position: {
4162
+ mx: 0.46,
4163
+ my: 0.26
4164
+ }
4165
+ });
3837
4166
 
3838
- if (isEventSubProcess(element)) {
3839
- attr$1(rect, {
3840
- strokeDasharray: '0, 5.5',
3841
- strokeWidth: 2.5
3842
- });
3843
- }
4167
+ drawPath(parentGfx, pathData, {
4168
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4169
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4170
+ strokeWidth: 1
4171
+ });
3844
4172
 
3845
- renderEmbeddedLabel(parentGfx, element, expanded ? 'center-top' : 'center-middle');
4173
+ return gateway;
4174
+ },
4175
+ 'bpmn:DataInput': function(parentGfx, element, attrs = {}) {
4176
+ attrs = pickAttrs(attrs, [
4177
+ 'fill',
4178
+ 'stroke'
4179
+ ]);
3846
4180
 
3847
- if (expanded) {
3848
- attachTaskMarkers(parentGfx, element);
3849
- } else {
3850
- attachTaskMarkers(parentGfx, element, [ 'SubProcessMarker' ]);
3851
- }
4181
+ var arrowPathData = pathMap.getRawPath('DATA_ARROW');
3852
4182
 
3853
- return rect;
3854
- },
3855
- 'bpmn:AdHocSubProcess': function(parentGfx, element) {
3856
- return renderer('bpmn:SubProcess')(parentGfx, element);
3857
- },
3858
- 'bpmn:Transaction': function(parentGfx, element) {
3859
- var outer = renderer('bpmn:SubProcess')(parentGfx, element, { strokeWidth: 1.5 });
4183
+ var dataObject = renderDataObject(parentGfx, element, attrs);
3860
4184
 
3861
- var innerAttrs = styles.style([ 'no-fill', 'no-events' ], {
3862
- stroke: getStrokeColor(element, defaultStrokeColor),
3863
- strokeWidth: 1.5
4185
+ drawPath(parentGfx, arrowPathData, {
4186
+ fill: 'none',
4187
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4188
+ strokeWidth: 1
3864
4189
  });
3865
4190
 
3866
- /* inner path */ drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS - 3, INNER_OUTER_DIST, innerAttrs);
3867
-
3868
- return outer;
4191
+ return dataObject;
3869
4192
  },
3870
- 'bpmn:CallActivity': function(parentGfx, element) {
3871
- return renderer('bpmn:SubProcess')(parentGfx, element, {
3872
- strokeWidth: 5
4193
+ 'bpmn:DataInputAssociation': function(parentGfx, element, attrs = {}) {
4194
+ attrs = pickAttrs(attrs, [
4195
+ 'fill',
4196
+ 'stroke'
4197
+ ]);
4198
+
4199
+ return renderAssociation(parentGfx, element, {
4200
+ ...attrs,
4201
+ markerEnd: marker('association-end', getFillColor(element, defaultFillColor, attrs.fill), getStrokeColor(element, defaultStrokeColor, attrs.stroke))
3873
4202
  });
3874
4203
  },
3875
- 'bpmn:Participant': function(parentGfx, element) {
3876
-
3877
- var strokeWidth = 1.5;
3878
-
3879
- var attrs = {
3880
- fillOpacity: DEFAULT_FILL_OPACITY,
3881
- fill: getFillColor(element, defaultFillColor),
3882
- stroke: getStrokeColor(element, defaultStrokeColor),
3883
- strokeWidth
3884
- };
3885
-
3886
- var lane = renderer('bpmn:Lane')(parentGfx, element, attrs);
3887
-
3888
- var expandedPool = isExpanded(element);
3889
-
3890
- if (expandedPool) {
3891
- drawLine(parentGfx, [
3892
- { x: 30, y: 0 },
3893
- { x: 30, y: element.height }
3894
- ], {
3895
- stroke: getStrokeColor(element, defaultStrokeColor),
3896
- strokeWidth
3897
- });
3898
- var text = getBusinessObject(element).name;
3899
- renderLaneLabel(parentGfx, text, element);
3900
- } else {
3901
-
3902
- // collapsed pool draw text inline
3903
- var text2 = getBusinessObject(element).name;
3904
- renderLabel(parentGfx, text2, {
3905
- box: element, align: 'center-middle',
3906
- style: {
3907
- fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
3908
- }
3909
- });
3910
- }
3911
-
3912
- var participantMultiplicity = !!(getBusinessObject(element).participantMultiplicity);
3913
-
3914
- if (participantMultiplicity) {
3915
- renderer('ParticipantMultiplicityMarker')(parentGfx, element);
3916
- }
4204
+ 'bpmn:DataObject': function(parentGfx, element, attrs = {}) {
4205
+ attrs = pickAttrs(attrs, [
4206
+ 'fill',
4207
+ 'stroke'
4208
+ ]);
3917
4209
 
3918
- return lane;
4210
+ return renderDataObject(parentGfx, element, attrs);
3919
4211
  },
3920
- 'bpmn:Lane': function(parentGfx, element, attrs) {
3921
- var rect = drawRect(parentGfx, element.width, element.height, 0, {
3922
- fill: getFillColor(element, defaultFillColor),
3923
- fillOpacity: HIGH_FILL_OPACITY,
3924
- stroke: getStrokeColor(element, defaultStrokeColor),
3925
- strokeWidth: 1.5,
3926
- ...attrs
3927
- });
3928
-
3929
- var semantic = getBusinessObject(element);
4212
+ 'bpmn:DataObjectReference': as('bpmn:DataObject'),
4213
+ 'bpmn:DataOutput': function(parentGfx, element, attrs = {}) {
4214
+ attrs = pickAttrs(attrs, [
4215
+ 'fill',
4216
+ 'stroke'
4217
+ ]);
3930
4218
 
3931
- if (semantic.$type === 'bpmn:Lane') {
3932
- var text = semantic.name;
3933
- renderLaneLabel(parentGfx, text, element);
3934
- }
4219
+ var arrowPathData = pathMap.getRawPath('DATA_ARROW');
3935
4220
 
3936
- return rect;
3937
- },
3938
- 'bpmn:InclusiveGateway': function(parentGfx, element) {
3939
- var diamond = renderer('bpmn:Gateway')(parentGfx, element);
4221
+ var dataObject = renderDataObject(parentGfx, element, attrs);
3940
4222
 
3941
- /* circle path */
3942
- drawCircle(parentGfx, element.width, element.height, element.height * 0.24, {
3943
- strokeWidth: 2.5,
3944
- fill: getFillColor(element, defaultFillColor),
3945
- stroke: getStrokeColor(element, defaultStrokeColor)
4223
+ drawPath(parentGfx, arrowPathData, {
4224
+ strokeWidth: 1,
4225
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4226
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3946
4227
  });
3947
4228
 
3948
- return diamond;
4229
+ return dataObject;
3949
4230
  },
3950
- 'bpmn:ExclusiveGateway': function(parentGfx, element) {
3951
- var diamond = renderer('bpmn:Gateway')(parentGfx, element);
4231
+ 'bpmn:DataOutputAssociation': function(parentGfx, element, attrs = {}) {
4232
+ attrs = pickAttrs(attrs, [
4233
+ 'fill',
4234
+ 'stroke'
4235
+ ]);
3952
4236
 
3953
- var pathData = pathMap.getScaledPath('GATEWAY_EXCLUSIVE', {
3954
- xScaleFactor: 0.4,
3955
- yScaleFactor: 0.4,
3956
- containerWidth: element.width,
3957
- containerHeight: element.height,
3958
- position: {
3959
- mx: 0.32,
3960
- my: 0.3
3961
- }
4237
+ return renderAssociation(parentGfx, element, {
4238
+ ...attrs,
4239
+ markerEnd: marker('association-end', getFillColor(element, defaultFillColor, attrs.fill), getStrokeColor(element, defaultStrokeColor, attrs.stroke))
3962
4240
  });
3963
-
3964
- if ((getDi(element).isMarkerVisible)) {
3965
- drawPath(parentGfx, pathData, {
3966
- strokeWidth: 1,
3967
- fill: getStrokeColor(element, defaultStrokeColor),
3968
- stroke: getStrokeColor(element, defaultStrokeColor)
3969
- });
3970
- }
3971
-
3972
- return diamond;
3973
4241
  },
3974
- 'bpmn:ComplexGateway': function(parentGfx, element) {
3975
- var diamond = renderer('bpmn:Gateway')(parentGfx, element);
4242
+ 'bpmn:DataStoreReference': function(parentGfx, element, attrs = {}) {
4243
+ attrs = pickAttrs(attrs, [
4244
+ 'fill',
4245
+ 'stroke'
4246
+ ]);
3976
4247
 
3977
- var pathData = pathMap.getScaledPath('GATEWAY_COMPLEX', {
3978
- xScaleFactor: 0.5,
3979
- yScaleFactor:0.5,
4248
+ var dataStorePath = pathMap.getScaledPath('DATA_STORE', {
4249
+ xScaleFactor: 1,
4250
+ yScaleFactor: 1,
3980
4251
  containerWidth: element.width,
3981
4252
  containerHeight: element.height,
3982
4253
  position: {
3983
- mx: 0.46,
3984
- my: 0.26
4254
+ mx: 0,
4255
+ my: 0.133
3985
4256
  }
3986
4257
  });
3987
4258
 
3988
- /* complex path */ drawPath(parentGfx, pathData, {
3989
- strokeWidth: 1,
3990
- fill: getStrokeColor(element, defaultStrokeColor),
3991
- stroke: getStrokeColor(element, defaultStrokeColor)
4259
+ return drawPath(parentGfx, dataStorePath, {
4260
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4261
+ fillOpacity: DEFAULT_OPACITY,
4262
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4263
+ strokeWidth: 2
3992
4264
  });
3993
-
3994
- return diamond;
3995
4265
  },
3996
- 'bpmn:ParallelGateway': function(parentGfx, element) {
3997
- var diamond = renderer('bpmn:Gateway')(parentGfx, element);
4266
+ 'bpmn:EndEvent': function(parentGfx, element, attrs = {}) {
4267
+ var { renderIcon = true } = attrs;
3998
4268
 
3999
- var pathData = pathMap.getScaledPath('GATEWAY_PARALLEL', {
4000
- xScaleFactor: 0.6,
4001
- yScaleFactor:0.6,
4002
- containerWidth: element.width,
4003
- containerHeight: element.height,
4004
- position: {
4005
- mx: 0.46,
4006
- my: 0.2
4007
- }
4008
- });
4269
+ attrs = pickAttrs(attrs, [
4270
+ 'fill',
4271
+ 'stroke'
4272
+ ]);
4009
4273
 
4010
- /* parallel path */ drawPath(parentGfx, pathData, {
4011
- strokeWidth: 1,
4012
- fill: getStrokeColor(element, defaultStrokeColor),
4013
- stroke: getStrokeColor(element, defaultStrokeColor)
4274
+ var event = renderEvent(parentGfx, element, {
4275
+ ...attrs,
4276
+ strokeWidth: 4
4014
4277
  });
4015
4278
 
4016
- return diamond;
4279
+ if (renderIcon) {
4280
+ renderEventIcon(element, parentGfx, attrs);
4281
+ }
4282
+
4283
+ return event;
4017
4284
  },
4018
- 'bpmn:EventBasedGateway': function(parentGfx, element) {
4285
+ 'bpmn:EventBasedGateway': function(parentGfx, element, attrs = {}) {
4286
+ attrs = pickAttrs(attrs, [
4287
+ 'fill',
4288
+ 'stroke'
4289
+ ]);
4019
4290
 
4020
4291
  var semantic = getBusinessObject(element);
4021
4292
 
4022
- var diamond = renderer('bpmn:Gateway')(parentGfx, element);
4293
+ var diamond = renderGateway(parentGfx, element, attrs);
4023
4294
 
4024
- /* outer circle path */ drawCircle(parentGfx, element.width, element.height, element.height * 0.20, {
4025
- strokeWidth: 1,
4026
- fill: 'none',
4027
- stroke: getStrokeColor(element, defaultStrokeColor)
4295
+ drawCircle(parentGfx, element.width, element.height, element.height * 0.20, {
4296
+ fill: getFillColor(element, 'none', attrs.fill),
4297
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4298
+ strokeWidth: 1
4028
4299
  });
4029
4300
 
4030
- var type = semantic.eventGatewayType;
4031
- var instantiate = !!semantic.instantiate;
4301
+ var type = semantic.get('eventGatewayType'),
4302
+ instantiate = !!semantic.get('instantiate');
4032
4303
 
4033
4304
  function drawEvent() {
4034
4305
 
@@ -4043,18 +4314,17 @@
4043
4314
  }
4044
4315
  });
4045
4316
 
4046
- /* event path */ drawPath(parentGfx, pathData, {
4047
- strokeWidth: 2,
4048
- fill: getFillColor(element, 'none'),
4049
- stroke: getStrokeColor(element, defaultStrokeColor)
4317
+ drawPath(parentGfx, pathData, {
4318
+ fill: 'none',
4319
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4320
+ strokeWidth: 2
4050
4321
  });
4051
4322
  }
4052
4323
 
4053
4324
  if (type === 'Parallel') {
4054
-
4055
4325
  var pathData = pathMap.getScaledPath('GATEWAY_PARALLEL', {
4056
4326
  xScaleFactor: 0.4,
4057
- yScaleFactor:0.4,
4327
+ yScaleFactor: 0.4,
4058
4328
  containerWidth: element.width,
4059
4329
  containerHeight: element.height,
4060
4330
  position: {
@@ -4064,16 +4334,16 @@
4064
4334
  });
4065
4335
 
4066
4336
  drawPath(parentGfx, pathData, {
4067
- strokeWidth: 1,
4068
- fill: 'none'
4337
+ fill: 'none',
4338
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4339
+ strokeWidth: 1
4069
4340
  });
4070
4341
  } else if (type === 'Exclusive') {
4071
-
4072
4342
  if (!instantiate) {
4073
4343
  drawCircle(parentGfx, element.width, element.height, element.height * 0.26, {
4074
- strokeWidth: 1,
4075
4344
  fill: 'none',
4076
- stroke: getStrokeColor(element, defaultStrokeColor)
4345
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4346
+ strokeWidth: 1
4077
4347
  });
4078
4348
  }
4079
4349
 
@@ -4083,104 +4353,163 @@
4083
4353
 
4084
4354
  return diamond;
4085
4355
  },
4086
- 'bpmn:Gateway': function(parentGfx, element) {
4087
- return drawDiamond(parentGfx, element.width, element.height, {
4088
- fill: getFillColor(element, defaultFillColor),
4089
- fillOpacity: DEFAULT_FILL_OPACITY,
4090
- stroke: getStrokeColor(element, defaultStrokeColor)
4091
- });
4092
- },
4093
- 'bpmn:SequenceFlow': function(parentGfx, element) {
4094
- var fill = getFillColor(element, defaultFillColor),
4095
- stroke = getStrokeColor(element, defaultStrokeColor);
4356
+ 'bpmn:ExclusiveGateway': function(parentGfx, element, attrs = {}) {
4357
+ attrs = pickAttrs(attrs, [
4358
+ 'fill',
4359
+ 'stroke'
4360
+ ]);
4096
4361
 
4097
- var path = drawConnectionSegments(parentGfx, element.waypoints, {
4098
- markerEnd: marker('sequenceflow-end', fill, stroke),
4099
- stroke: getStrokeColor(element, defaultStrokeColor)
4100
- });
4362
+ var gateway = renderGateway(parentGfx, element, attrs);
4101
4363
 
4102
- var sequenceFlow = getBusinessObject(element);
4364
+ var pathData = pathMap.getScaledPath('GATEWAY_EXCLUSIVE', {
4365
+ xScaleFactor: 0.4,
4366
+ yScaleFactor: 0.4,
4367
+ containerWidth: element.width,
4368
+ containerHeight: element.height,
4369
+ position: {
4370
+ mx: 0.32,
4371
+ my: 0.3
4372
+ }
4373
+ });
4103
4374
 
4104
- var source;
4375
+ var di = getDi(element);
4105
4376
 
4106
- if (element.source) {
4107
- source = element.source.businessObject;
4377
+ if (di.get('isMarkerVisible')) {
4378
+ drawPath(parentGfx, pathData, {
4379
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4380
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4381
+ strokeWidth: 1
4382
+ });
4383
+ }
4108
4384
 
4109
- // conditional flow marker
4110
- if (sequenceFlow.conditionExpression && source.$instanceOf('bpmn:Activity')) {
4111
- attr$1(path, {
4112
- markerStart: marker('conditional-flow-marker', fill, stroke)
4113
- });
4114
- }
4385
+ return gateway;
4386
+ },
4387
+ 'bpmn:Gateway': function(parentGfx, element, attrs = {}) {
4388
+ attrs = pickAttrs(attrs, [
4389
+ 'fill',
4390
+ 'stroke'
4391
+ ]);
4115
4392
 
4116
- // default marker
4117
- if (source.default && (source.$instanceOf('bpmn:Gateway') || source.$instanceOf('bpmn:Activity')) &&
4118
- source.default === sequenceFlow) {
4119
- attr$1(path, {
4120
- markerStart: marker('conditional-default-flow-marker', fill, stroke)
4121
- });
4122
- }
4123
- }
4393
+ return renderGateway(parentGfx, element, attrs);
4394
+ },
4395
+ 'bpmn:Group': function(parentGfx, element, attrs = {}) {
4396
+ attrs = pickAttrs(attrs, [
4397
+ 'fill',
4398
+ 'stroke',
4399
+ 'width',
4400
+ 'height'
4401
+ ]);
4124
4402
 
4125
- return path;
4403
+ return drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, {
4404
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4405
+ strokeWidth: 1.5,
4406
+ strokeDasharray: '10, 6, 0, 6',
4407
+ fill: 'none',
4408
+ pointerEvents: 'none',
4409
+ width: getWidth(element, attrs),
4410
+ height: getHeight(element, attrs)
4411
+ });
4126
4412
  },
4127
- 'bpmn:Association': function(parentGfx, element, attrs) {
4413
+ 'bpmn:InclusiveGateway': function(parentGfx, element, attrs = {}) {
4414
+ attrs = pickAttrs(attrs, [
4415
+ 'fill',
4416
+ 'stroke'
4417
+ ]);
4128
4418
 
4129
- var semantic = getBusinessObject(element);
4419
+ var gateway = renderGateway(parentGfx, element, attrs);
4130
4420
 
4131
- var fill = getFillColor(element, defaultFillColor),
4132
- stroke = getStrokeColor(element, defaultStrokeColor);
4421
+ drawCircle(parentGfx, element.width, element.height, element.height * 0.24, {
4422
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4423
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4424
+ strokeWidth: 2.5
4425
+ });
4133
4426
 
4134
- attrs = {
4135
- strokeDasharray: '0, 5',
4136
- stroke: getStrokeColor(element, defaultStrokeColor),
4137
- ...attrs
4138
- };
4427
+ return gateway;
4428
+ },
4429
+ 'bpmn:IntermediateEvent': function(parentGfx, element, attrs = {}) {
4430
+ var { renderIcon = true } = attrs;
4139
4431
 
4140
- if (semantic.associationDirection === 'One' ||
4141
- semantic.associationDirection === 'Both') {
4142
- attrs.markerEnd = marker('association-end', fill, stroke);
4143
- }
4432
+ attrs = pickAttrs(attrs, [
4433
+ 'fill',
4434
+ 'stroke'
4435
+ ]);
4436
+
4437
+ var outer = renderEvent(parentGfx, element, {
4438
+ ...attrs,
4439
+ strokeWidth: 1.5
4440
+ });
4441
+
4442
+ drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {
4443
+ fill: 'none',
4444
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4445
+ strokeWidth: 1.5
4446
+ });
4144
4447
 
4145
- if (semantic.associationDirection === 'Both') {
4146
- attrs.markerStart = marker('association-start', fill, stroke);
4448
+ if (renderIcon) {
4449
+ renderEventIcon(element, parentGfx, attrs);
4147
4450
  }
4148
4451
 
4149
- return drawConnectionSegments(parentGfx, element.waypoints, attrs);
4452
+ return outer;
4150
4453
  },
4151
- 'bpmn:DataInputAssociation': function(parentGfx, element) {
4152
- var fill = getFillColor(element, defaultFillColor),
4153
- stroke = getStrokeColor(element, defaultStrokeColor);
4154
-
4155
- return renderer('bpmn:Association')(parentGfx, element, {
4156
- markerEnd: marker('association-end', fill, stroke)
4454
+ 'bpmn:IntermediateCatchEvent': as('bpmn:IntermediateEvent'),
4455
+ 'bpmn:IntermediateThrowEvent': as('bpmn:IntermediateEvent'),
4456
+ 'bpmn:Lane': function(parentGfx, element, attrs = {}) {
4457
+ attrs = pickAttrs(attrs, [
4458
+ 'fill',
4459
+ 'stroke',
4460
+ 'width',
4461
+ 'height'
4462
+ ]);
4463
+
4464
+ return renderLane(parentGfx, element, {
4465
+ ...attrs,
4466
+ fillOpacity: LOW_OPACITY
4157
4467
  });
4158
4468
  },
4159
- 'bpmn:DataOutputAssociation': function(parentGfx, element) {
4160
- var fill = getFillColor(element, defaultFillColor),
4161
- stroke = getStrokeColor(element, defaultStrokeColor);
4469
+ 'bpmn:ManualTask': function(parentGfx, element, attrs = {}) {
4470
+ attrs = pickAttrs(attrs, [
4471
+ 'fill',
4472
+ 'stroke'
4473
+ ]);
4474
+
4475
+ var task = renderTask(parentGfx, element, attrs);
4476
+
4477
+ var pathData = pathMap.getScaledPath('TASK_TYPE_MANUAL', {
4478
+ abspos: {
4479
+ x: 17,
4480
+ y: 15
4481
+ }
4482
+ });
4162
4483
 
4163
- return renderer('bpmn:Association')(parentGfx, element, {
4164
- markerEnd: marker('association-end', fill, stroke)
4484
+ drawPath(parentGfx, pathData, {
4485
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4486
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4487
+ strokeWidth: 0.5
4165
4488
  });
4489
+
4490
+ return task;
4166
4491
  },
4167
- 'bpmn:MessageFlow': function(parentGfx, element) {
4492
+ 'bpmn:MessageFlow': function(parentGfx, element, attrs = {}) {
4493
+ attrs = pickAttrs(attrs, [
4494
+ 'fill',
4495
+ 'stroke'
4496
+ ]);
4168
4497
 
4169
4498
  var semantic = getBusinessObject(element),
4170
4499
  di = getDi(element);
4171
4500
 
4172
- var fill = getFillColor(element, defaultFillColor),
4173
- stroke = getStrokeColor(element, defaultStrokeColor);
4501
+ var fill = getFillColor(element, defaultFillColor, attrs.fill),
4502
+ stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
4174
4503
 
4175
4504
  var path = drawConnectionSegments(parentGfx, element.waypoints, {
4176
4505
  markerEnd: marker('messageflow-end', fill, stroke),
4177
4506
  markerStart: marker('messageflow-start', fill, stroke),
4507
+ stroke,
4178
4508
  strokeDasharray: '10, 11',
4179
- strokeWidth: 1.5,
4180
- stroke: getStrokeColor(element, defaultStrokeColor)
4509
+ strokeWidth: 1.5
4181
4510
  });
4182
4511
 
4183
- if (semantic.messageRef) {
4512
+ if (semantic.get('messageRef')) {
4184
4513
  var midPoint = path.getPointAtLength(path.getTotalLength() / 2);
4185
4514
 
4186
4515
  var markerPathData = pathMap.getScaledPath('MESSAGE_FLOW_MARKER', {
@@ -4190,404 +4519,518 @@
4190
4519
  }
4191
4520
  });
4192
4521
 
4193
- var messageAttrs = { strokeWidth: 1 };
4522
+ var messageAttrs = {
4523
+ strokeWidth: 1
4524
+ };
4525
+
4526
+ if (di.get('messageVisibleKind') === 'initiating') {
4527
+ messageAttrs.fill = fill;
4528
+ messageAttrs.stroke = stroke;
4529
+ } else {
4530
+ messageAttrs.fill = stroke;
4531
+ messageAttrs.stroke = fill;
4532
+ }
4533
+
4534
+ var message = drawPath(parentGfx, markerPathData, messageAttrs);
4535
+
4536
+ var messageRef = semantic.get('messageRef'),
4537
+ name = messageRef.get('name');
4538
+
4539
+ var label = renderLabel(parentGfx, name, {
4540
+ align: 'center-top',
4541
+ fitBox: true,
4542
+ style: {
4543
+ fill: stroke
4544
+ }
4545
+ });
4546
+
4547
+ var messageBounds = message.getBBox(),
4548
+ labelBounds = label.getBBox();
4549
+
4550
+ var translateX = midPoint.x - labelBounds.width / 2,
4551
+ translateY = midPoint.y + messageBounds.height / 2 + ELEMENT_LABEL_DISTANCE;
4552
+
4553
+ transform(label, translateX, translateY, 0);
4554
+ }
4555
+
4556
+ return path;
4557
+ },
4558
+ 'bpmn:ParallelGateway': function(parentGfx, element, attrs = {}) {
4559
+ attrs = pickAttrs(attrs, [
4560
+ 'fill',
4561
+ 'stroke'
4562
+ ]);
4563
+
4564
+ var diamond = renderGateway(parentGfx, element, attrs);
4565
+
4566
+ var pathData = pathMap.getScaledPath('GATEWAY_PARALLEL', {
4567
+ xScaleFactor: 0.6,
4568
+ yScaleFactor: 0.6,
4569
+ containerWidth: element.width,
4570
+ containerHeight: element.height,
4571
+ position: {
4572
+ mx: 0.46,
4573
+ my: 0.2
4574
+ }
4575
+ });
4576
+
4577
+ drawPath(parentGfx, pathData, {
4578
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4579
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4580
+ strokeWidth: 1
4581
+ });
4582
+
4583
+ return diamond;
4584
+ },
4585
+ 'bpmn:Participant': function(parentGfx, element, attrs = {}) {
4586
+ attrs = pickAttrs(attrs, [
4587
+ 'fill',
4588
+ 'stroke',
4589
+ 'width',
4590
+ 'height'
4591
+ ]);
4592
+
4593
+ var participant = renderLane(parentGfx, element, attrs);
4594
+
4595
+ var expandedParticipant = isExpanded(element);
4596
+ var horizontalParticipant = isHorizontal(element);
4597
+
4598
+ var semantic = getBusinessObject(element),
4599
+ name = semantic.get('name');
4600
+
4601
+ if (expandedParticipant) {
4602
+ var waypoints = horizontalParticipant ? [
4603
+ {
4604
+ x: 30,
4605
+ y: 0
4606
+ },
4607
+ {
4608
+ x: 30,
4609
+ y: getHeight(element, attrs)
4610
+ }
4611
+ ] : [
4612
+ {
4613
+ x: 0,
4614
+ y: 30
4615
+ },
4616
+ {
4617
+ x: getWidth(element, attrs),
4618
+ y: 30
4619
+ }
4620
+ ];
4621
+
4622
+ drawLine(parentGfx, waypoints, {
4623
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4624
+ strokeWidth: PARTICIPANT_STROKE_WIDTH
4625
+ });
4626
+
4627
+ renderLaneLabel(parentGfx, name, element, attrs);
4628
+ } else {
4629
+ var bounds = getBounds(element, attrs);
4194
4630
 
4195
- if (di.messageVisibleKind === 'initiating') {
4196
- messageAttrs.fill = 'white';
4197
- messageAttrs.stroke = black;
4198
- } else {
4199
- messageAttrs.fill = '#888';
4200
- messageAttrs.stroke = 'white';
4631
+ if (!horizontalParticipant) {
4632
+ bounds.height = getWidth(element, attrs);
4633
+ bounds.width = getHeight(element, attrs);
4201
4634
  }
4202
4635
 
4203
- var message = drawPath(parentGfx, markerPathData, messageAttrs);
4204
-
4205
- var labelText = semantic.messageRef.name;
4206
- var label = renderLabel(parentGfx, labelText, {
4207
- align: 'center-top',
4208
- fitBox: true,
4636
+ var textBox = renderLabel(parentGfx, name, {
4637
+ box: bounds,
4638
+ align: 'center-middle',
4209
4639
  style: {
4210
- fill: getStrokeColor(element, defaultLabelColor)
4640
+ fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
4211
4641
  }
4212
4642
  });
4213
4643
 
4214
- var messageBounds = message.getBBox(),
4215
- labelBounds = label.getBBox();
4216
-
4217
- var translateX = midPoint.x - labelBounds.width / 2,
4218
- translateY = midPoint.y + messageBounds.height / 2 + ELEMENT_LABEL_DISTANCE;
4219
-
4220
- transform(label, translateX, translateY, 0);
4644
+ if (!horizontalParticipant) {
4645
+ var top = -1 * getHeight(element, attrs);
4646
+ transform(textBox, 0, -top, 270);
4647
+ }
4648
+ }
4221
4649
 
4650
+ if (semantic.get('participantMultiplicity')) {
4651
+ renderTaskMarker('ParticipantMultiplicityMarker', parentGfx, element, attrs);
4222
4652
  }
4223
4653
 
4224
- return path;
4654
+ return participant;
4225
4655
  },
4226
- 'bpmn:DataObject': function(parentGfx, element) {
4227
- var pathData = pathMap.getScaledPath('DATA_OBJECT_PATH', {
4228
- xScaleFactor: 1,
4229
- yScaleFactor: 1,
4230
- containerWidth: element.width,
4231
- containerHeight: element.height,
4232
- position: {
4233
- mx: 0.474,
4234
- my: 0.296
4235
- }
4236
- });
4237
-
4238
- var elementObject = drawPath(parentGfx, pathData, {
4239
- fill: getFillColor(element, defaultFillColor),
4240
- fillOpacity: DEFAULT_FILL_OPACITY,
4241
- stroke: getStrokeColor(element, defaultStrokeColor)
4242
- });
4656
+ 'bpmn:ReceiveTask' : function(parentGfx, element, attrs = {}) {
4657
+ attrs = pickAttrs(attrs, [
4658
+ 'fill',
4659
+ 'stroke'
4660
+ ]);
4243
4661
 
4244
4662
  var semantic = getBusinessObject(element);
4245
4663
 
4246
- if (isCollection(semantic)) {
4247
- renderDataItemCollection(parentGfx, element);
4248
- }
4664
+ var task = renderTask(parentGfx, element, attrs);
4249
4665
 
4250
- return elementObject;
4251
- },
4252
- 'bpmn:DataObjectReference': as('bpmn:DataObject'),
4253
- 'bpmn:DataInput': function(parentGfx, element) {
4666
+ var pathData;
4254
4667
 
4255
- var arrowPathData = pathMap.getRawPath('DATA_ARROW');
4668
+ if (semantic.get('instantiate')) {
4669
+ drawCircle(parentGfx, 28, 28, 20 * 0.22, {
4670
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4671
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4672
+ strokeWidth: 1
4673
+ });
4256
4674
 
4257
- // page
4258
- var elementObject = renderer('bpmn:DataObject')(parentGfx, element);
4675
+ pathData = pathMap.getScaledPath('TASK_TYPE_INSTANTIATING_SEND', {
4676
+ abspos: {
4677
+ x: 7.77,
4678
+ y: 9.52
4679
+ }
4680
+ });
4681
+ } else {
4682
+ pathData = pathMap.getScaledPath('TASK_TYPE_SEND', {
4683
+ xScaleFactor: 0.9,
4684
+ yScaleFactor: 0.9,
4685
+ containerWidth: 21,
4686
+ containerHeight: 14,
4687
+ position: {
4688
+ mx: 0.3,
4689
+ my: 0.4
4690
+ }
4691
+ });
4692
+ }
4259
4693
 
4260
- /* input arrow path */ drawPath(parentGfx, arrowPathData, { strokeWidth: 1 });
4694
+ drawPath(parentGfx, pathData, {
4695
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4696
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4697
+ strokeWidth: 1
4698
+ });
4261
4699
 
4262
- return elementObject;
4700
+ return task;
4263
4701
  },
4264
- 'bpmn:DataOutput': function(parentGfx, element) {
4265
- var arrowPathData = pathMap.getRawPath('DATA_ARROW');
4702
+ 'bpmn:ScriptTask': function(parentGfx, element, attrs = {}) {
4703
+ attrs = pickAttrs(attrs, [
4704
+ 'fill',
4705
+ 'stroke'
4706
+ ]);
4266
4707
 
4267
- // page
4268
- var elementObject = renderer('bpmn:DataObject')(parentGfx, element);
4708
+ var task = renderTask(parentGfx, element, attrs);
4269
4709
 
4270
- /* output arrow path */ drawPath(parentGfx, arrowPathData, {
4271
- strokeWidth: 1,
4272
- fill: black
4710
+ var pathData = pathMap.getScaledPath('TASK_TYPE_SCRIPT', {
4711
+ abspos: {
4712
+ x: 15,
4713
+ y: 20
4714
+ }
4273
4715
  });
4274
4716
 
4275
- return elementObject;
4717
+ drawPath(parentGfx, pathData, {
4718
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4719
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4720
+ strokeWidth: 1
4721
+ });
4722
+
4723
+ return task;
4276
4724
  },
4277
- 'bpmn:DataStoreReference': function(parentGfx, element) {
4278
- var DATA_STORE_PATH = pathMap.getScaledPath('DATA_STORE', {
4725
+ 'bpmn:SendTask': function(parentGfx, element, attrs = {}) {
4726
+ attrs = pickAttrs(attrs, [
4727
+ 'fill',
4728
+ 'stroke'
4729
+ ]);
4730
+
4731
+ var task = renderTask(parentGfx, element, attrs);
4732
+
4733
+ var pathData = pathMap.getScaledPath('TASK_TYPE_SEND', {
4279
4734
  xScaleFactor: 1,
4280
4735
  yScaleFactor: 1,
4281
- containerWidth: element.width,
4282
- containerHeight: element.height,
4736
+ containerWidth: 21,
4737
+ containerHeight: 14,
4283
4738
  position: {
4284
- mx: 0,
4285
- my: 0.133
4739
+ mx: 0.285,
4740
+ my: 0.357
4286
4741
  }
4287
4742
  });
4288
4743
 
4289
- var elementStore = drawPath(parentGfx, DATA_STORE_PATH, {
4290
- strokeWidth: 2,
4291
- fill: getFillColor(element, defaultFillColor),
4292
- fillOpacity: DEFAULT_FILL_OPACITY,
4293
- stroke: getStrokeColor(element, defaultStrokeColor)
4744
+ drawPath(parentGfx, pathData, {
4745
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4746
+ stroke: getFillColor(element, defaultFillColor, attrs.fill),
4747
+ strokeWidth: 1
4294
4748
  });
4295
4749
 
4296
- return elementStore;
4750
+ return task;
4297
4751
  },
4298
- 'bpmn:BoundaryEvent': function(parentGfx, element, options) {
4299
-
4300
- var semantic = getBusinessObject(element),
4301
- cancel = semantic.cancelActivity;
4752
+ 'bpmn:SequenceFlow': function(parentGfx, element, attrs = {}) {
4753
+ attrs = pickAttrs(attrs, [
4754
+ 'fill',
4755
+ 'stroke'
4756
+ ]);
4302
4757
 
4303
- var attrs = {
4304
- strokeWidth: 1.5,
4305
- fill: getFillColor(element, defaultFillColor),
4306
- stroke: getStrokeColor(element, defaultStrokeColor)
4307
- };
4758
+ var fill = getFillColor(element, defaultFillColor, attrs.fill),
4759
+ stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
4308
4760
 
4309
- if (!cancel) {
4310
- attrs.strokeDasharray = '6';
4311
- }
4761
+ var connection = drawConnectionSegments(parentGfx, element.waypoints, {
4762
+ markerEnd: marker('sequenceflow-end', fill, stroke),
4763
+ stroke
4764
+ });
4312
4765
 
4313
- // apply fillOpacity
4314
- var outerAttrs = {
4315
- ...attrs,
4316
- fillOpacity: 1
4317
- };
4766
+ var semantic = getBusinessObject(element);
4318
4767
 
4319
- // apply no-fill
4320
- var innerAttrs = {
4321
- ...attrs,
4322
- fill: 'none'
4323
- };
4768
+ var { source } = element;
4324
4769
 
4325
- var outer = renderer('bpmn:Event')(parentGfx, element, outerAttrs);
4770
+ if (source) {
4771
+ var sourceSemantic = getBusinessObject(source);
4326
4772
 
4327
- /* inner path */ drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, innerAttrs);
4773
+ // conditional flow marker
4774
+ if (semantic.get('conditionExpression') && is$1(sourceSemantic, 'bpmn:Activity')) {
4775
+ attr$1(connection, {
4776
+ markerStart: marker('conditional-flow-marker', fill, stroke)
4777
+ });
4778
+ }
4328
4779
 
4329
- if (!options || options.renderIcon !== false) {
4330
- renderEventContent(element, parentGfx);
4780
+ // default marker
4781
+ if (sourceSemantic.get('default') && (is$1(sourceSemantic, 'bpmn:Gateway') || is$1(sourceSemantic, 'bpmn:Activity')) &&
4782
+ sourceSemantic.get('default') === semantic) {
4783
+ attr$1(connection, {
4784
+ markerStart: marker('conditional-default-flow-marker', fill, stroke)
4785
+ });
4786
+ }
4331
4787
  }
4332
4788
 
4333
- return outer;
4334
- },
4335
- 'bpmn:Group': function(parentGfx, element) {
4336
- return drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, {
4337
- stroke: getStrokeColor(element, defaultStrokeColor),
4338
- strokeWidth: 1.5,
4339
- strokeDasharray: '10,6,0,6',
4340
- fill: 'none',
4341
- pointerEvents: 'none'
4342
- });
4789
+ return connection;
4343
4790
  },
4344
- 'label': function(parentGfx, element) {
4345
- return renderExternalLabel(parentGfx, element);
4346
- },
4347
- 'bpmn:TextAnnotation': function(parentGfx, element) {
4348
- var textElement = drawRect(parentGfx, element.width, element.height, 0, 0, {
4349
- 'fill': 'none',
4350
- 'stroke': 'none'
4791
+ 'bpmn:ServiceTask': function(parentGfx, element, attrs = {}) {
4792
+ attrs = pickAttrs(attrs, [
4793
+ 'fill',
4794
+ 'stroke'
4795
+ ]);
4796
+
4797
+ var task = renderTask(parentGfx, element, attrs);
4798
+
4799
+ drawCircle(parentGfx, 10, 10, {
4800
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4801
+ stroke: 'none',
4802
+ transform: 'translate(6, 6)'
4351
4803
  });
4352
4804
 
4353
- var textPathData = pathMap.getScaledPath('TEXT_ANNOTATION', {
4354
- xScaleFactor: 1,
4355
- yScaleFactor: 1,
4356
- containerWidth: element.width,
4357
- containerHeight: element.height,
4358
- position: {
4359
- mx: 0.0,
4360
- my: 0.0
4805
+ var pathDataService1 = pathMap.getScaledPath('TASK_TYPE_SERVICE', {
4806
+ abspos: {
4807
+ x: 12,
4808
+ y: 18
4361
4809
  }
4362
4810
  });
4363
4811
 
4364
- drawPath(parentGfx, textPathData, {
4365
- stroke: getStrokeColor(element, defaultStrokeColor)
4812
+ drawPath(parentGfx, pathDataService1, {
4813
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4814
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4815
+ strokeWidth: 1
4366
4816
  });
4367
4817
 
4368
- var text = getBusinessObject(element).text || '';
4369
- renderLabel(parentGfx, text, {
4370
- box: element,
4371
- align: 'left-top',
4372
- padding: 7,
4373
- style: {
4374
- fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
4375
- }
4818
+ drawCircle(parentGfx, 10, 10, {
4819
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4820
+ stroke: 'none',
4821
+ transform: 'translate(11, 10)'
4376
4822
  });
4377
4823
 
4378
- return textElement;
4379
- },
4380
- 'ParticipantMultiplicityMarker': function(parentGfx, element) {
4381
- var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', {
4382
- xScaleFactor: 1,
4383
- yScaleFactor: 1,
4384
- containerWidth: element.width,
4385
- containerHeight: element.height,
4386
- position: {
4387
- mx: ((element.width / 2) / element.width),
4388
- my: (element.height - 15) / element.height
4824
+ var pathDataService2 = pathMap.getScaledPath('TASK_TYPE_SERVICE', {
4825
+ abspos: {
4826
+ x: 17,
4827
+ y: 22
4389
4828
  }
4390
4829
  });
4391
4830
 
4392
- drawMarker('participant-multiplicity', parentGfx, markerPath, {
4393
- strokeWidth: 2,
4394
- fill: getFillColor(element, defaultFillColor),
4395
- stroke: getStrokeColor(element, defaultStrokeColor)
4831
+ drawPath(parentGfx, pathDataService2, {
4832
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4833
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4834
+ strokeWidth: 1
4396
4835
  });
4836
+
4837
+ return task;
4397
4838
  },
4398
- 'SubProcessMarker': function(parentGfx, element) {
4399
- var markerRect = drawRect(parentGfx, 14, 14, 0, {
4400
- strokeWidth: 1,
4401
- fill: getFillColor(element, defaultFillColor),
4402
- stroke: getStrokeColor(element, defaultStrokeColor)
4403
- });
4839
+ 'bpmn:StartEvent': function(parentGfx, element, attrs = {}) {
4840
+ var { renderIcon = true } = attrs;
4404
4841
 
4405
- // Process marker is placed in the middle of the box
4406
- // therefore fixed values can be used here
4407
- translate$1(markerRect, element.width / 2 - 7.5, element.height - 20);
4842
+ attrs = pickAttrs(attrs, [
4843
+ 'fill',
4844
+ 'stroke'
4845
+ ]);
4408
4846
 
4409
- var markerPath = pathMap.getScaledPath('MARKER_SUB_PROCESS', {
4410
- xScaleFactor: 1.5,
4411
- yScaleFactor: 1.5,
4412
- containerWidth: element.width,
4413
- containerHeight: element.height,
4414
- position: {
4415
- mx: (element.width / 2 - 7.5) / element.width,
4416
- my: (element.height - 20) / element.height
4417
- }
4418
- });
4847
+ var semantic = getBusinessObject(element);
4419
4848
 
4420
- drawMarker('sub-process', parentGfx, markerPath, {
4421
- fill: getFillColor(element, defaultFillColor),
4422
- stroke: getStrokeColor(element, defaultStrokeColor)
4423
- });
4849
+ if (!semantic.get('isInterrupting')) {
4850
+ attrs = {
4851
+ ...attrs,
4852
+ strokeDasharray: '6'
4853
+ };
4854
+ }
4855
+
4856
+ var event = renderEvent(parentGfx, element, attrs);
4857
+
4858
+ if (renderIcon) {
4859
+ renderEventIcon(element, parentGfx, attrs);
4860
+ }
4861
+
4862
+ return event;
4424
4863
  },
4425
- 'ParallelMarker': function(parentGfx, element, position) {
4426
- var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', {
4427
- xScaleFactor: 1,
4428
- yScaleFactor: 1,
4429
- containerWidth: element.width,
4430
- containerHeight: element.height,
4431
- position: {
4432
- mx: ((element.width / 2 + position.parallel) / element.width),
4433
- my: (element.height - 20) / element.height
4434
- }
4435
- });
4864
+ 'bpmn:SubProcess': function(parentGfx, element, attrs = {}) {
4865
+ if (isExpanded(element)) {
4866
+ attrs = pickAttrs(attrs, [
4867
+ 'fill',
4868
+ 'stroke',
4869
+ 'width',
4870
+ 'height'
4871
+ ]);
4872
+ } else {
4873
+ attrs = pickAttrs(attrs, [
4874
+ 'fill',
4875
+ 'stroke'
4876
+ ]);
4877
+ }
4436
4878
 
4437
- drawMarker('parallel', parentGfx, markerPath, {
4438
- fill: getFillColor(element, defaultFillColor),
4439
- stroke: getStrokeColor(element, defaultStrokeColor)
4440
- });
4879
+ return renderSubProcess(parentGfx, element, attrs);
4441
4880
  },
4442
- 'SequentialMarker': function(parentGfx, element, position) {
4443
- var markerPath = pathMap.getScaledPath('MARKER_SEQUENTIAL', {
4444
- xScaleFactor: 1,
4445
- yScaleFactor: 1,
4446
- containerWidth: element.width,
4447
- containerHeight: element.height,
4448
- position: {
4449
- mx: ((element.width / 2 + position.seq) / element.width),
4450
- my: (element.height - 19) / element.height
4451
- }
4452
- });
4881
+ 'bpmn:Task': function(parentGfx, element, attrs = {}) {
4882
+ attrs = pickAttrs(attrs, [
4883
+ 'fill',
4884
+ 'stroke'
4885
+ ]);
4453
4886
 
4454
- drawMarker('sequential', parentGfx, markerPath, {
4455
- fill: getFillColor(element, defaultFillColor),
4456
- stroke: getStrokeColor(element, defaultStrokeColor)
4457
- });
4887
+ return renderTask(parentGfx, element, attrs);
4458
4888
  },
4459
- 'CompensationMarker': function(parentGfx, element, position) {
4460
- var markerMath = pathMap.getScaledPath('MARKER_COMPENSATION', {
4461
- xScaleFactor: 1,
4462
- yScaleFactor: 1,
4463
- containerWidth: element.width,
4464
- containerHeight: element.height,
4465
- position: {
4466
- mx: ((element.width / 2 + position.compensation) / element.width),
4467
- my: (element.height - 13) / element.height
4468
- }
4889
+ 'bpmn:TextAnnotation': function(parentGfx, element, attrs = {}) {
4890
+ attrs = pickAttrs(attrs, [
4891
+ 'fill',
4892
+ 'stroke',
4893
+ 'width',
4894
+ 'height'
4895
+ ]);
4896
+
4897
+ var {
4898
+ width,
4899
+ height
4900
+ } = getBounds(element, attrs);
4901
+
4902
+ var textElement = drawRect(parentGfx, width, height, 0, 0, {
4903
+ fill: 'none',
4904
+ stroke: 'none'
4469
4905
  });
4470
4906
 
4471
- drawMarker('compensation', parentGfx, markerMath, {
4472
- strokeWidth: 1,
4473
- fill: getFillColor(element, defaultFillColor),
4474
- stroke: getStrokeColor(element, defaultStrokeColor)
4475
- });
4476
- },
4477
- 'LoopMarker': function(parentGfx, element, position) {
4478
- var markerPath = pathMap.getScaledPath('MARKER_LOOP', {
4907
+ var textPathData = pathMap.getScaledPath('TEXT_ANNOTATION', {
4479
4908
  xScaleFactor: 1,
4480
4909
  yScaleFactor: 1,
4481
- containerWidth: element.width,
4482
- containerHeight: element.height,
4910
+ containerWidth: width,
4911
+ containerHeight: height,
4483
4912
  position: {
4484
- mx: ((element.width / 2 + position.loop) / element.width),
4485
- my: (element.height - 7) / element.height
4913
+ mx: 0.0,
4914
+ my: 0.0
4486
4915
  }
4487
4916
  });
4488
4917
 
4489
- drawMarker('loop', parentGfx, markerPath, {
4490
- strokeWidth: 1.5,
4491
- fill: getFillColor(element, defaultFillColor),
4492
- stroke: getStrokeColor(element, defaultStrokeColor),
4493
- strokeMiterlimit: 0.5
4494
- });
4495
- },
4496
- 'AdhocMarker': function(parentGfx, element, position) {
4497
- var markerPath = pathMap.getScaledPath('MARKER_ADHOC', {
4498
- xScaleFactor: 1,
4499
- yScaleFactor: 1,
4500
- containerWidth: element.width,
4501
- containerHeight: element.height,
4502
- position: {
4503
- mx: ((element.width / 2 + position.adhoc) / element.width),
4504
- my: (element.height - 15) / element.height
4505
- }
4918
+ drawPath(parentGfx, textPathData, {
4919
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
4506
4920
  });
4507
4921
 
4508
- drawMarker('adhoc', parentGfx, markerPath, {
4509
- strokeWidth: 1,
4510
- fill: getStrokeColor(element, defaultStrokeColor),
4511
- stroke: getStrokeColor(element, defaultStrokeColor)
4922
+ var semantic = getBusinessObject(element),
4923
+ text = semantic.get('text') || '';
4924
+
4925
+ renderLabel(parentGfx, text, {
4926
+ align: 'left-top',
4927
+ box: getBounds(element, attrs),
4928
+ padding: 7,
4929
+ style: {
4930
+ fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
4931
+ }
4512
4932
  });
4513
- }
4514
- };
4515
4933
 
4516
- function attachTaskMarkers(parentGfx, element, taskMarkers) {
4517
- var obj = getBusinessObject(element);
4934
+ return textElement;
4935
+ },
4936
+ 'bpmn:Transaction': function(parentGfx, element, attrs = {}) {
4937
+ if (isExpanded(element)) {
4938
+ attrs = pickAttrs(attrs, [
4939
+ 'fill',
4940
+ 'stroke',
4941
+ 'width',
4942
+ 'height'
4943
+ ]);
4944
+ } else {
4945
+ attrs = pickAttrs(attrs, [
4946
+ 'fill',
4947
+ 'stroke'
4948
+ ]);
4949
+ }
4518
4950
 
4519
- var subprocess = taskMarkers && taskMarkers.indexOf('SubProcessMarker') !== -1;
4520
- var position;
4951
+ var outer = renderSubProcess(parentGfx, element, {
4952
+ strokeWidth: 1.5,
4953
+ ...attrs
4954
+ });
4521
4955
 
4522
- if (subprocess) {
4523
- position = {
4524
- seq: -21,
4525
- parallel: -22,
4526
- compensation: -42,
4527
- loop: -18,
4528
- adhoc: 10
4529
- };
4530
- } else {
4531
- position = {
4532
- seq: -3,
4533
- parallel: -6,
4534
- compensation: -27,
4535
- loop: 0,
4536
- adhoc: 10
4537
- };
4538
- }
4956
+ var innerAttrs = styles.style([ 'no-fill', 'no-events' ], {
4957
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4958
+ strokeWidth: 1.5
4959
+ });
4539
4960
 
4540
- forEach$1(taskMarkers, function(marker) {
4541
- renderer(marker)(parentGfx, element, position);
4542
- });
4961
+ var expanded = isExpanded(element);
4543
4962
 
4544
- if (obj.isForCompensation) {
4545
- renderer('CompensationMarker')(parentGfx, element, position);
4546
- }
4963
+ if (!expanded) {
4964
+ attrs = {};
4965
+ }
4547
4966
 
4548
- if (obj.$type === 'bpmn:AdHocSubProcess') {
4549
- renderer('AdhocMarker')(parentGfx, element, position);
4550
- }
4967
+ drawRect(
4968
+ parentGfx,
4969
+ getWidth(element, attrs),
4970
+ getHeight(element, attrs),
4971
+ TASK_BORDER_RADIUS - INNER_OUTER_DIST,
4972
+ INNER_OUTER_DIST,
4973
+ innerAttrs
4974
+ );
4551
4975
 
4552
- var loopCharacteristics = obj.loopCharacteristics,
4553
- isSequential = loopCharacteristics && loopCharacteristics.isSequential;
4976
+ return outer;
4977
+ },
4978
+ 'bpmn:UserTask': function(parentGfx, element, attrs = {}) {
4979
+ attrs = pickAttrs(attrs, [
4980
+ 'fill',
4981
+ 'stroke'
4982
+ ]);
4554
4983
 
4555
- if (loopCharacteristics) {
4984
+ var task = renderTask(parentGfx, element, attrs);
4556
4985
 
4557
- if (isSequential === undefined) {
4558
- renderer('LoopMarker')(parentGfx, element, position);
4559
- }
4986
+ var x = 15;
4987
+ var y = 12;
4560
4988
 
4561
- if (isSequential === false) {
4562
- renderer('ParallelMarker')(parentGfx, element, position);
4563
- }
4989
+ var pathDataUser1 = pathMap.getScaledPath('TASK_TYPE_USER_1', {
4990
+ abspos: {
4991
+ x: x,
4992
+ y: y
4993
+ }
4994
+ });
4564
4995
 
4565
- if (isSequential === true) {
4566
- renderer('SequentialMarker')(parentGfx, element, position);
4567
- }
4568
- }
4569
- }
4996
+ drawPath(parentGfx, pathDataUser1, {
4997
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4998
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4999
+ strokeWidth: 0.5
5000
+ });
4570
5001
 
4571
- function renderDataItemCollection(parentGfx, element) {
5002
+ var pathDataUser2 = pathMap.getScaledPath('TASK_TYPE_USER_2', {
5003
+ abspos: {
5004
+ x: x,
5005
+ y: y
5006
+ }
5007
+ });
4572
5008
 
4573
- var yPosition = (element.height - 18) / element.height;
5009
+ drawPath(parentGfx, pathDataUser2, {
5010
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
5011
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
5012
+ strokeWidth: 0.5
5013
+ });
4574
5014
 
4575
- var pathData = pathMap.getScaledPath('DATA_OBJECT_COLLECTION_PATH', {
4576
- xScaleFactor: 1,
4577
- yScaleFactor: 1,
4578
- containerWidth: element.width,
4579
- containerHeight: element.height,
4580
- position: {
4581
- mx: 0.33,
4582
- my: yPosition
4583
- }
4584
- });
5015
+ var pathDataUser3 = pathMap.getScaledPath('TASK_TYPE_USER_3', {
5016
+ abspos: {
5017
+ x: x,
5018
+ y: y
5019
+ }
5020
+ });
4585
5021
 
4586
- /* collection path */ drawPath(parentGfx, pathData, {
4587
- strokeWidth: 2
4588
- });
4589
- }
5022
+ drawPath(parentGfx, pathDataUser3, {
5023
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
5024
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
5025
+ strokeWidth: 0.5
5026
+ });
4590
5027
 
5028
+ return task;
5029
+ },
5030
+ 'label': function(parentGfx, element, attrs = {}) {
5031
+ return renderExternalLabel(parentGfx, element, attrs);
5032
+ }
5033
+ };
4591
5034
 
4592
5035
  // extension API, use at your own risk
4593
5036
  this._drawPath = drawPath;
@@ -4622,15 +5065,16 @@
4622
5065
  *
4623
5066
  * @param {SVGElement} parentGfx
4624
5067
  * @param {Element} element
5068
+ * @param {Attrs} [attrs]
4625
5069
  *
4626
5070
  * @return {SVGElement} mainGfx
4627
5071
  */
4628
- BpmnRenderer.prototype.drawShape = function(parentGfx, element) {
4629
- var type = element.type;
4630
- var h = this._renderer(type);
5072
+ BpmnRenderer.prototype.drawShape = function(parentGfx, element, attrs = {}) {
5073
+ var { type } = element;
4631
5074
 
4632
- /* jshint -W040 */
4633
- return h(parentGfx, element);
5075
+ var handler = this._renderer(type);
5076
+
5077
+ return handler(parentGfx, element, attrs);
4634
5078
  };
4635
5079
 
4636
5080
  /**
@@ -4638,15 +5082,16 @@
4638
5082
  *
4639
5083
  * @param {SVGElement} parentGfx
4640
5084
  * @param {Element} element
5085
+ * @param {Attrs} [attrs]
4641
5086
  *
4642
5087
  * @return {SVGElement} mainGfx
4643
5088
  */
4644
- BpmnRenderer.prototype.drawConnection = function(parentGfx, element) {
4645
- var type = element.type;
4646
- var h = this._renderer(type);
5089
+ BpmnRenderer.prototype.drawConnection = function(parentGfx, element, attrs = {}) {
5090
+ var { type } = element;
5091
+
5092
+ var handler = this._renderer(type);
4647
5093
 
4648
- /* jshint -W040 */
4649
- return h(parentGfx, element);
5094
+ return handler(parentGfx, element, attrs);
4650
5095
  };
4651
5096
 
4652
5097
  /**
@@ -4657,7 +5102,6 @@
4657
5102
  * @return {string} path
4658
5103
  */
4659
5104
  BpmnRenderer.prototype.getShapePath = function(element) {
4660
-
4661
5105
  if (is$1(element, 'bpmn:Event')) {
4662
5106
  return getCirclePath(element);
4663
5107
  }
@@ -4673,6 +5117,24 @@
4673
5117
  return getRectPath(element);
4674
5118
  };
4675
5119
 
5120
+ /**
5121
+ * Pick attributes if they exist.
5122
+ *
5123
+ * @param {Object} attrs
5124
+ * @param {string[]} keys
5125
+ *
5126
+ * @returns {Object}
5127
+ */
5128
+ function pickAttrs(attrs, keys = []) {
5129
+ return keys.reduce((pickedAttrs, key) => {
5130
+ if (attrs[ key ]) {
5131
+ pickedAttrs[ key ] = attrs[ key ];
5132
+ }
5133
+
5134
+ return pickedAttrs;
5135
+ }, {});
5136
+ }
5137
+
4676
5138
  /**
4677
5139
  * @typedef {import('../util/Types').Dimensions} Dimensions
4678
5140
  *
@@ -5769,10 +6231,6 @@
5769
6231
  translate: [ 'value', translate ]
5770
6232
  };
5771
6233
 
5772
- function getDefaultExportFromCjs (x) {
5773
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
5774
- }
5775
-
5776
6234
  /**
5777
6235
  * @param {Point} point
5778
6236
  *
@@ -6361,26 +6819,6 @@
6361
6819
  return isButton(event, 1);
6362
6820
  }
6363
6821
 
6364
- /**
6365
- * @param {MouseEvent} event
6366
- *
6367
- * @return {boolean}
6368
- */
6369
- function hasPrimaryModifier(event) {
6370
- var originalEvent = getOriginal(event) || event;
6371
-
6372
- if (!isPrimaryButton(event)) {
6373
- return false;
6374
- }
6375
-
6376
- // Use cmd as primary modifier key for mac OS
6377
- if (isMac()) {
6378
- return originalEvent.metaKey;
6379
- } else {
6380
- return originalEvent.ctrlKey;
6381
- }
6382
- }
6383
-
6384
6822
  /**
6385
6823
  * @param {MouseEvent} event
6386
6824
  *
@@ -6981,6 +7419,8 @@
6981
7419
 
6982
7420
  var LOW_PRIORITY$3 = 500;
6983
7421
 
7422
+ var DEFAULT_PRIORITY$3 = 1000;
7423
+
6984
7424
  /**
6985
7425
  * @typedef {import('../../model/Types').Element} Element
6986
7426
  *
@@ -6999,25 +7439,30 @@
6999
7439
  */
7000
7440
  function Outline(eventBus, styles) {
7001
7441
 
7002
- this.offset = 6;
7442
+ this._eventBus = eventBus;
7443
+
7444
+ this.offset = 5;
7003
7445
 
7004
7446
  var OUTLINE_STYLE = styles.cls('djs-outline', [ 'no-fill' ]);
7005
7447
 
7006
7448
  var self = this;
7007
7449
 
7008
- function createOutline(gfx, bounds) {
7450
+ /**
7451
+ * @param {SVGElement} gfx
7452
+ *
7453
+ * @return {SVGElement} outline
7454
+ */
7455
+ function createOutline(gfx) {
7009
7456
  var outline = create$1('rect');
7010
7457
 
7011
7458
  attr$1(outline, assign$1({
7012
- x: 10,
7013
- y: 10,
7459
+ x: 0,
7460
+ y: 0,
7014
7461
  rx: 4,
7015
7462
  width: 100,
7016
7463
  height: 100
7017
7464
  }, OUTLINE_STYLE));
7018
7465
 
7019
- append(gfx, outline);
7020
-
7021
7466
  return outline;
7022
7467
  }
7023
7468
 
@@ -7030,7 +7475,8 @@
7030
7475
  var outline = query('.djs-outline', gfx);
7031
7476
 
7032
7477
  if (!outline) {
7033
- outline = createOutline(gfx);
7478
+ outline = self.getOutline(element) || createOutline();
7479
+ append(gfx, outline);
7034
7480
  }
7035
7481
 
7036
7482
  self.updateShapeOutline(outline, element);
@@ -7043,7 +7489,8 @@
7043
7489
  var outline = query('.djs-outline', gfx);
7044
7490
 
7045
7491
  if (!outline) {
7046
- outline = createOutline(gfx);
7492
+ outline = createOutline();
7493
+ append(gfx, outline);
7047
7494
  }
7048
7495
 
7049
7496
  self.updateConnectionOutline(outline, element);
@@ -7060,25 +7507,34 @@
7060
7507
  */
7061
7508
  Outline.prototype.updateShapeOutline = function(outline, element) {
7062
7509
 
7063
- attr$1(outline, {
7064
- x: -this.offset,
7065
- y: -this.offset,
7066
- width: element.width + this.offset * 2,
7067
- height: element.height + this.offset * 2
7068
- });
7510
+ var updated = false;
7511
+ var providers = this._getProviders();
7069
7512
 
7070
- };
7513
+ if (providers.length) {
7514
+ forEach$1(providers, function(provider) {
7515
+ updated = updated || provider.updateOutline(element, outline);
7516
+ });
7517
+ }
7071
7518
 
7519
+ if (!updated) {
7520
+ attr$1(outline, {
7521
+ x: -this.offset,
7522
+ y: -this.offset,
7523
+ width: element.width + this.offset * 2,
7524
+ height: element.height + this.offset * 2
7525
+ });
7526
+ }
7527
+ };
7072
7528
 
7073
7529
  /**
7074
7530
  * Updates the outline of a connection respecting the bounding box of
7075
7531
  * the connection and an outline offset.
7532
+ * Register an outline provider with the given priority.
7076
7533
  *
7077
7534
  * @param {SVGElement} outline
7078
7535
  * @param {Element} connection
7079
7536
  */
7080
7537
  Outline.prototype.updateConnectionOutline = function(outline, connection) {
7081
-
7082
7538
  var bbox = getBBox(connection);
7083
7539
 
7084
7540
  attr$1(outline, {
@@ -7087,9 +7543,61 @@
7087
7543
  width: bbox.width + this.offset * 2,
7088
7544
  height: bbox.height + this.offset * 2
7089
7545
  });
7546
+ };
7547
+
7548
+ /**
7549
+ * Register an outline provider with the given priority.
7550
+ *
7551
+ * @param {number} priority
7552
+ * @param {OutlineProvider} provider
7553
+ */
7554
+ Outline.prototype.registerProvider = function(priority, provider) {
7555
+ if (!provider) {
7556
+ provider = priority;
7557
+ priority = DEFAULT_PRIORITY$3;
7558
+ }
7559
+
7560
+ this._eventBus.on('outline.getProviders', priority, function(event) {
7561
+ event.providers.push(provider);
7562
+ });
7563
+ };
7564
+
7565
+ /**
7566
+ * Returns the registered outline providers.
7567
+ *
7568
+ * @returns {OutlineProvider[]}
7569
+ */
7570
+ Outline.prototype._getProviders = function() {
7571
+ var event = this._eventBus.createEvent({
7572
+ type: 'outline.getProviders',
7573
+ providers: []
7574
+ });
7575
+
7576
+ this._eventBus.fire(event);
7090
7577
 
7578
+ return event.providers;
7091
7579
  };
7092
7580
 
7581
+ /**
7582
+ * Returns the outline for an element.
7583
+ *
7584
+ * @param {Element} element
7585
+ **/
7586
+ Outline.prototype.getOutline = function(element) {
7587
+ var outline;
7588
+ var providers = this._getProviders();
7589
+
7590
+ forEach$1(providers, function(provider) {
7591
+
7592
+ if (!isFunction(provider.getOutline)) {
7593
+ return;
7594
+ }
7595
+
7596
+ outline = outline || provider.getOutline(element);
7597
+ });
7598
+
7599
+ return outline;
7600
+ };
7093
7601
 
7094
7602
  Outline.$inject = [ 'eventBus', 'styles', 'elementRegistry' ];
7095
7603
 
@@ -7431,8 +7939,8 @@
7431
7939
  var isSelected = selection.isSelected(element),
7432
7940
  isMultiSelect = selection.get().length > 1;
7433
7941
 
7434
- // Add to selection if CTRL or SHIFT pressed
7435
- var add = hasPrimaryModifier(event) || hasSecondaryModifier(event);
7942
+ // Add to selection if SHIFT pressed
7943
+ var add = hasSecondaryModifier(event);
7436
7944
 
7437
7945
  if (isSelected && isMultiSelect) {
7438
7946
  if (add) {
@@ -7724,8 +8232,7 @@
7724
8232
  } else {
7725
8233
  return [];
7726
8234
  }
7727
- } else
7728
- if (search.type) {
8235
+ } else if (search.type) {
7729
8236
  return filter(this._overlays, matchPattern({ type: search.type }));
7730
8237
  } else {
7731
8238
 
@@ -9408,7 +9915,7 @@
9408
9915
  }
9409
9916
 
9410
9917
  /**
9411
- * @typedef {import('./index').InjectAnnotated } InjectAnnotated
9918
+ * @typedef {import('./index.js').InjectAnnotated } InjectAnnotated
9412
9919
  */
9413
9920
 
9414
9921
  /**
@@ -9478,9 +9985,9 @@
9478
9985
  }
9479
9986
 
9480
9987
  /**
9481
- * @typedef { import('./index').ModuleDeclaration } ModuleDeclaration
9482
- * @typedef { import('./index').ModuleDefinition } ModuleDefinition
9483
- * @typedef { import('./index').InjectorContext } InjectorContext
9988
+ * @typedef { import('./index.js').ModuleDeclaration } ModuleDeclaration
9989
+ * @typedef { import('./index.js').ModuleDefinition } ModuleDefinition
9990
+ * @typedef { import('./index.js').InjectorContext } InjectorContext
9484
9991
  */
9485
9992
 
9486
9993
  /**
@@ -9583,11 +10090,20 @@
9583
10090
  };
9584
10091
  }
9585
10092
 
9586
- function instantiate(Type) {
10093
+ /**
10094
+ * Instantiate the given type, injecting dependencies.
10095
+ *
10096
+ * @template T
10097
+ *
10098
+ * @param { Function | [...string[], Function ]} type
10099
+ *
10100
+ * @return T
10101
+ */
10102
+ function instantiate(type) {
9587
10103
  const {
9588
10104
  fn,
9589
10105
  dependencies
9590
- } = fnDef(Type);
10106
+ } = fnDef(type);
9591
10107
 
9592
10108
  // instantiate var args constructor
9593
10109
  const Constructor = Function.prototype.bind.apply(fn, [ null ].concat(dependencies));
@@ -9595,6 +10111,17 @@
9595
10111
  return new Constructor();
9596
10112
  }
9597
10113
 
10114
+ /**
10115
+ * Invoke the given function, injecting dependencies. Return the result.
10116
+ *
10117
+ * @template T
10118
+ *
10119
+ * @param { Function | [...string[], Function ]} func
10120
+ * @param { Object } [context]
10121
+ * @param { Object } [locals]
10122
+ *
10123
+ * @return {T} invocation result
10124
+ */
9598
10125
  function invoke(func, context, locals) {
9599
10126
  const {
9600
10127
  fn,
@@ -11863,32 +12390,17 @@
11863
12390
  }
11864
12391
  };
11865
12392
 
11866
- var objectRefs = {exports: {}};
11867
-
11868
- var collection = {};
11869
-
11870
- /**
11871
- * An empty collection stub. Use {@link RefsCollection.extend} to extend a
11872
- * collection with ref semantics.
11873
- *
11874
- * @class RefsCollection
11875
- */
11876
-
11877
12393
  /**
11878
12394
  * Extends a collection with {@link Refs} aware methods
11879
12395
  *
11880
- * @memberof RefsCollection
11881
- * @static
11882
- *
11883
- * @param {Array<Object>} collection
11884
- * @param {Refs} refs instance
11885
- * @param {Object} property represented by the collection
11886
- * @param {Object} target object the collection is attached to
12396
+ * @param {Array<Object>} collection
12397
+ * @param {Refs} refs instance
12398
+ * @param {Object} property represented by the collection
12399
+ * @param {Object} target object the collection is attached to
11887
12400
  *
11888
12401
  * @return {RefsCollection<Object>} the extended array
11889
12402
  */
11890
12403
  function extend(collection, refs, property, target) {
11891
-
11892
12404
  var inverseProperty = property.inverse;
11893
12405
 
11894
12406
  /**
@@ -11899,7 +12411,7 @@
11899
12411
  * @param {Object} element the element to remove
11900
12412
  */
11901
12413
  Object.defineProperty(collection, 'remove', {
11902
- value: function(element) {
12414
+ value: function (element) {
11903
12415
  var idx = this.indexOf(element);
11904
12416
  if (idx !== -1) {
11905
12417
  this.splice(idx, 1);
@@ -11907,7 +12419,6 @@
11907
12419
  // unset inverse
11908
12420
  refs.unset(element, inverseProperty, target);
11909
12421
  }
11910
-
11911
12422
  return element;
11912
12423
  }
11913
12424
  });
@@ -11920,7 +12431,7 @@
11920
12431
  * @param {Object} element the element to check for
11921
12432
  */
11922
12433
  Object.defineProperty(collection, 'contains', {
11923
- value: function(element) {
12434
+ value: function (element) {
11924
12435
  return this.indexOf(element) !== -1;
11925
12436
  }
11926
12437
  });
@@ -11935,12 +12446,9 @@
11935
12446
  * (possibly moving other elements around)
11936
12447
  */
11937
12448
  Object.defineProperty(collection, 'add', {
11938
- value: function(element, idx) {
11939
-
12449
+ value: function (element, idx) {
11940
12450
  var currentIdx = this.indexOf(element);
11941
-
11942
12451
  if (typeof idx === 'undefined') {
11943
-
11944
12452
  if (currentIdx !== -1) {
11945
12453
  // element already in collection (!)
11946
12454
  return;
@@ -11952,14 +12460,12 @@
11952
12460
 
11953
12461
  // handle already in collection
11954
12462
  if (currentIdx !== -1) {
11955
-
11956
12463
  // remove element from currentIdx
11957
12464
  this.splice(currentIdx, 1);
11958
12465
  }
11959
12466
 
11960
12467
  // add element at idx
11961
12468
  this.splice(idx, 0, element);
11962
-
11963
12469
  if (currentIdx === -1) {
11964
12470
  // set inverse, unless element was
11965
12471
  // in collection already
@@ -11973,69 +12479,53 @@
11973
12479
  Object.defineProperty(collection, '__refs_collection', {
11974
12480
  value: true
11975
12481
  });
11976
-
11977
12482
  return collection;
11978
12483
  }
11979
12484
 
11980
-
12485
+ /**
12486
+ * Checks if a given collection is extended
12487
+ *
12488
+ * @param {Array<Object>} collection
12489
+ *
12490
+ * @return {boolean}
12491
+ */
11981
12492
  function isExtended(collection) {
11982
12493
  return collection.__refs_collection === true;
11983
12494
  }
11984
12495
 
11985
- collection.extend = extend;
11986
-
11987
- collection.isExtended = isExtended;
11988
-
11989
- var Collection = collection;
11990
-
11991
12496
  function hasOwnProperty$1(e, property) {
11992
12497
  return Object.prototype.hasOwnProperty.call(e, property.name || property);
11993
12498
  }
11994
-
11995
12499
  function defineCollectionProperty(ref, property, target) {
11996
-
11997
- var collection = Collection.extend(target[property.name] || [], ref, property, target);
11998
-
12500
+ var collection = extend(target[property.name] || [], ref, property, target);
11999
12501
  Object.defineProperty(target, property.name, {
12000
12502
  enumerable: property.enumerable,
12001
12503
  value: collection
12002
12504
  });
12003
-
12004
12505
  if (collection.length) {
12005
-
12006
- collection.forEach(function(o) {
12506
+ collection.forEach(function (o) {
12007
12507
  ref.set(o, property.inverse, target);
12008
12508
  });
12009
12509
  }
12010
12510
  }
12011
-
12012
-
12013
12511
  function defineProperty$1(ref, property, target) {
12014
-
12015
12512
  var inverseProperty = property.inverse;
12016
-
12017
12513
  var _value = target[property.name];
12018
-
12019
12514
  Object.defineProperty(target, property.name, {
12020
12515
  configurable: property.configurable,
12021
12516
  enumerable: property.enumerable,
12022
-
12023
- get: function() {
12517
+ get: function () {
12024
12518
  return _value;
12025
12519
  },
12026
-
12027
- set: function(value) {
12028
-
12520
+ set: function (value) {
12029
12521
  // return if we already performed all changes
12030
12522
  if (value === _value) {
12031
12523
  return;
12032
12524
  }
12033
-
12034
12525
  var old = _value;
12035
12526
 
12036
12527
  // temporary set null
12037
12528
  _value = null;
12038
-
12039
12529
  if (old) {
12040
12530
  ref.unset(old, inverseProperty, target);
12041
12531
  }
@@ -12047,7 +12537,6 @@
12047
12537
  ref.set(_value, inverseProperty, target);
12048
12538
  }
12049
12539
  });
12050
-
12051
12540
  }
12052
12541
 
12053
12542
  /**
@@ -12093,16 +12582,14 @@
12093
12582
  *
12094
12583
  * wheels[0].car // undefined
12095
12584
  */
12096
- function Refs$1(a, b) {
12097
-
12098
- if (!(this instanceof Refs$1)) {
12099
- return new Refs$1(a, b);
12585
+ function Refs(a, b) {
12586
+ if (!(this instanceof Refs)) {
12587
+ return new Refs(a, b);
12100
12588
  }
12101
12589
 
12102
12590
  // link
12103
12591
  a.inverse = b;
12104
12592
  b.inverse = a;
12105
-
12106
12593
  this.props = {};
12107
12594
  this.props[a.name] = a;
12108
12595
  this.props[b.name] = b;
@@ -12117,43 +12604,34 @@
12117
12604
  * @param {Object} target
12118
12605
  * @param {String} property
12119
12606
  */
12120
- Refs$1.prototype.bind = function(target, property) {
12607
+ Refs.prototype.bind = function (target, property) {
12121
12608
  if (typeof property === 'string') {
12122
12609
  if (!this.props[property]) {
12123
12610
  throw new Error('no property <' + property + '> in ref');
12124
12611
  }
12125
12612
  property = this.props[property];
12126
12613
  }
12127
-
12128
12614
  if (property.collection) {
12129
12615
  defineCollectionProperty(this, property, target);
12130
12616
  } else {
12131
12617
  defineProperty$1(this, property, target);
12132
12618
  }
12133
12619
  };
12134
-
12135
- Refs$1.prototype.ensureRefsCollection = function(target, property) {
12136
-
12620
+ Refs.prototype.ensureRefsCollection = function (target, property) {
12137
12621
  var collection = target[property.name];
12138
-
12139
- if (!Collection.isExtended(collection)) {
12622
+ if (!isExtended(collection)) {
12140
12623
  defineCollectionProperty(this, property, target);
12141
12624
  }
12142
-
12143
12625
  return collection;
12144
12626
  };
12145
-
12146
- Refs$1.prototype.ensureBound = function(target, property) {
12627
+ Refs.prototype.ensureBound = function (target, property) {
12147
12628
  if (!hasOwnProperty$1(target, property)) {
12148
12629
  this.bind(target, property);
12149
12630
  }
12150
12631
  };
12151
-
12152
- Refs$1.prototype.unset = function(target, property, value) {
12153
-
12632
+ Refs.prototype.unset = function (target, property, value) {
12154
12633
  if (target) {
12155
12634
  this.ensureBound(target, property);
12156
-
12157
12635
  if (property.collection) {
12158
12636
  this.ensureRefsCollection(target, property).remove(value);
12159
12637
  } else {
@@ -12161,12 +12639,9 @@
12161
12639
  }
12162
12640
  }
12163
12641
  };
12164
-
12165
- Refs$1.prototype.set = function(target, property, value) {
12166
-
12642
+ Refs.prototype.set = function (target, property, value) {
12167
12643
  if (target) {
12168
12644
  this.ensureBound(target, property);
12169
-
12170
12645
  if (property.collection) {
12171
12646
  this.ensureRefsCollection(target, property).add(value);
12172
12647
  } else {
@@ -12175,15 +12650,6 @@
12175
12650
  }
12176
12651
  };
12177
12652
 
12178
- var refs = Refs$1;
12179
-
12180
- objectRefs.exports = refs;
12181
-
12182
- objectRefs.exports.Collection = collection;
12183
-
12184
- var objectRefsExports = objectRefs.exports;
12185
- var Refs = /*@__PURE__*/getDefaultExportFromCjs(objectRefsExports);
12186
-
12187
12653
  var parentRefs = new Refs({ name: 'children', enumerable: true, collection: true }, { name: 'parent' }),
12188
12654
  labelRefs = new Refs({ name: 'labels', enumerable: true, collection: true }, { name: 'labelTarget' }),
12189
12655
  attacherRefs = new Refs({ name: 'attachers', collection: true }, { name: 'host' }),
@@ -13388,13 +13854,14 @@
13388
13854
  *
13389
13855
  * @param {SVGElement} visual The graphical element.
13390
13856
  * @param {ShapeLike} element The shape.
13857
+ * @param {Object} attrs Optional attributes.
13391
13858
  *
13392
13859
  * @return {SVGElement}
13393
13860
  */
13394
- GraphicsFactory.prototype.drawShape = function(visual, element) {
13861
+ GraphicsFactory.prototype.drawShape = function(visual, element, attrs = {}) {
13395
13862
  var eventBus = this._eventBus;
13396
13863
 
13397
- return eventBus.fire('render.shape', { gfx: visual, element: element });
13864
+ return eventBus.fire('render.shape', { gfx: visual, element, attrs });
13398
13865
  };
13399
13866
 
13400
13867
  /**
@@ -13415,13 +13882,14 @@
13415
13882
  *
13416
13883
  * @param {SVGElement} visual The graphical element.
13417
13884
  * @param {ConnectionLike} element The connection.
13885
+ * @param {Object} attrs Optional attributes.
13418
13886
  *
13419
13887
  * @return {SVGElement}
13420
13888
  */
13421
- GraphicsFactory.prototype.drawConnection = function(visual, element) {
13889
+ GraphicsFactory.prototype.drawConnection = function(visual, element, attrs = {}) {
13422
13890
  var eventBus = this._eventBus;
13423
13891
 
13424
- return eventBus.fire('render.connection', { gfx: visual, element: element });
13892
+ return eventBus.fire('render.connection', { gfx: visual, element, attrs });
13425
13893
  };
13426
13894
 
13427
13895
  /**
@@ -13459,8 +13927,7 @@
13459
13927
 
13460
13928
  // update positioning
13461
13929
  translate$1(gfx, element.x, element.y);
13462
- } else
13463
- if (type === 'connection') {
13930
+ } else if (type === 'connection') {
13464
13931
  this.drawConnection(visual, element);
13465
13932
  } else {
13466
13933
  throw new Error('unknown type: ' + type);
@@ -13998,6 +14465,17 @@
13998
14465
  this.idProperty = p;
13999
14466
  };
14000
14467
 
14468
+ DescriptorBuilder.prototype.assertNotTrait = function(typeDescriptor) {
14469
+
14470
+ const _extends = typeDescriptor.extends || [];
14471
+
14472
+ if (_extends.length) {
14473
+ throw new Error(
14474
+ `cannot create <${ typeDescriptor.name }> extending <${ typeDescriptor.extends }>`
14475
+ );
14476
+ }
14477
+ };
14478
+
14001
14479
  DescriptorBuilder.prototype.assertNotDefined = function(p, name) {
14002
14480
  var propertyName = p.name,
14003
14481
  definedProperty = this.propertiesByName[propertyName];
@@ -14016,6 +14494,10 @@
14016
14494
 
14017
14495
  DescriptorBuilder.prototype.addTrait = function(t, inherited) {
14018
14496
 
14497
+ if (inherited) {
14498
+ this.assertNotTrait(t);
14499
+ }
14500
+
14019
14501
  var typesByName = this.allTypesByName,
14020
14502
  types = this.allTypes;
14021
14503
 
@@ -14149,7 +14631,9 @@
14149
14631
  });
14150
14632
 
14151
14633
  forEach$1(type.extends, bind$2(function(extendsName) {
14152
- var extended = this.typeMap[extendsName];
14634
+ var extendsNameNs = parseName(extendsName, ns.prefix);
14635
+
14636
+ var extended = this.typeMap[extendsNameNs.name];
14153
14637
 
14154
14638
  extended.traits = extended.traits || [];
14155
14639
  extended.traits.push(name);
@@ -14178,24 +14662,33 @@
14178
14662
 
14179
14663
  var self = this;
14180
14664
 
14665
+ /**
14666
+ * Traverse the selected super type or trait
14667
+ *
14668
+ * @param {String} cls
14669
+ * @param {Boolean} [trait=false]
14670
+ */
14671
+ function traverse(cls, trait) {
14672
+ var parentNs = parseName(cls, isBuiltIn(cls) ? '' : nsName.prefix);
14673
+ self.mapTypes(parentNs, iterator, trait);
14674
+ }
14675
+
14181
14676
  /**
14182
14677
  * Traverse the selected trait.
14183
14678
  *
14184
14679
  * @param {String} cls
14185
14680
  */
14186
14681
  function traverseTrait(cls) {
14187
- return traverseSuper(cls, true);
14682
+ return traverse(cls, true);
14188
14683
  }
14189
14684
 
14190
14685
  /**
14191
- * Traverse the selected super type or trait
14686
+ * Traverse the selected super type
14192
14687
  *
14193
14688
  * @param {String} cls
14194
- * @param {Boolean} [trait=false]
14195
14689
  */
14196
- function traverseSuper(cls, trait) {
14197
- var parentNs = parseName(cls, isBuiltIn(cls) ? '' : nsName.prefix);
14198
- self.mapTypes(parentNs, iterator, trait);
14690
+ function traverseSuper(cls) {
14691
+ return traverse(cls, false);
14199
14692
  }
14200
14693
 
14201
14694
  if (!type) {
@@ -14278,7 +14771,7 @@
14278
14771
  throw new TypeError('property name must be a non-empty string');
14279
14772
  }
14280
14773
 
14281
- var property = this.model.getPropertyDescriptor(target, name);
14774
+ var property = this.getProperty(target, name);
14282
14775
 
14283
14776
  var propertyName = property && property.name;
14284
14777
 
@@ -14289,7 +14782,7 @@
14289
14782
  if (property) {
14290
14783
  delete target[propertyName];
14291
14784
  } else {
14292
- delete target.$attrs[name];
14785
+ delete target.$attrs[stripGlobal(name)];
14293
14786
  }
14294
14787
  } else {
14295
14788
 
@@ -14302,7 +14795,7 @@
14302
14795
  defineProperty(target, property, value);
14303
14796
  }
14304
14797
  } else {
14305
- target.$attrs[name] = value;
14798
+ target.$attrs[stripGlobal(name)] = value;
14306
14799
  }
14307
14800
  }
14308
14801
  };
@@ -14317,10 +14810,10 @@
14317
14810
  */
14318
14811
  Properties.prototype.get = function(target, name) {
14319
14812
 
14320
- var property = this.model.getPropertyDescriptor(target, name);
14813
+ var property = this.getProperty(target, name);
14321
14814
 
14322
14815
  if (!property) {
14323
- return target.$attrs[name];
14816
+ return target.$attrs[stripGlobal(name)];
14324
14817
  }
14325
14818
 
14326
14819
  var propertyName = property.name;
@@ -14374,6 +14867,44 @@
14374
14867
  this.define(target, '$model', { value: model });
14375
14868
  };
14376
14869
 
14870
+ /**
14871
+ * Return property with the given name on the element.
14872
+ *
14873
+ * @param {any} target
14874
+ * @param {string} name
14875
+ *
14876
+ * @return {object | null} property
14877
+ */
14878
+ Properties.prototype.getProperty = function(target, name) {
14879
+
14880
+ var model = this.model;
14881
+
14882
+ var property = model.getPropertyDescriptor(target, name);
14883
+
14884
+ if (property) {
14885
+ return property;
14886
+ }
14887
+
14888
+ if (name.includes(':')) {
14889
+ return null;
14890
+ }
14891
+
14892
+ const strict = model.config.strict;
14893
+
14894
+ if (typeof strict !== 'undefined') {
14895
+ const error = new TypeError(`unknown property <${ name }> on <${ target.$type }>`);
14896
+
14897
+ if (strict) {
14898
+ throw error;
14899
+ } else {
14900
+
14901
+ // eslint-disable-next-line no-undef
14902
+ typeof console !== 'undefined' && console.warn(error);
14903
+ }
14904
+ }
14905
+
14906
+ return null;
14907
+ };
14377
14908
 
14378
14909
  function isUndefined(val) {
14379
14910
  return typeof val === 'undefined';
@@ -14388,6 +14919,10 @@
14388
14919
  });
14389
14920
  }
14390
14921
 
14922
+ function stripGlobal(name) {
14923
+ return name.replace(/^:/, '');
14924
+ }
14925
+
14391
14926
  // Moddle implementation /////////////////////////////////////////////////
14392
14927
 
14393
14928
  /**
@@ -14410,8 +14945,10 @@
14410
14945
  * var moddle = new Moddle([pkg]);
14411
14946
  *
14412
14947
  * @param {Array<Package>} packages the packages to contain
14948
+ *
14949
+ * @param { { strict?: boolean } } [config] moddle configuration
14413
14950
  */
14414
- function Moddle(packages) {
14951
+ function Moddle(packages, config = {}) {
14415
14952
 
14416
14953
  this.properties = new Properties(this);
14417
14954
 
@@ -14419,6 +14956,8 @@
14419
14956
  this.registry = new Registry(packages, this.properties);
14420
14957
 
14421
14958
  this.typeCache = {};
14959
+
14960
+ this.config = config;
14422
14961
  }
14423
14962
 
14424
14963
 
@@ -14512,6 +15051,12 @@
14512
15051
  $type: name,
14513
15052
  $instanceOf: function(type) {
14514
15053
  return type === this.$type;
15054
+ },
15055
+ get: function(key) {
15056
+ return this[key];
15057
+ },
15058
+ set: function(key, value) {
15059
+ set$2(this, [ key ], value);
14515
15060
  }
14516
15061
  };
14517
15062
 
@@ -14527,6 +15072,8 @@
14527
15072
 
14528
15073
  this.properties.defineDescriptor(element, descriptor);
14529
15074
  this.properties.defineModel(element, this);
15075
+ this.properties.define(element, 'get', { enumerable: false, writable: true });
15076
+ this.properties.define(element, 'set', { enumerable: false, writable: true });
14530
15077
  this.properties.define(element, '$parent', { enumerable: false, writable: true });
14531
15078
  this.properties.define(element, '$instanceOf', { enumerable: false, writable: true });
14532
15079
 
@@ -23770,7 +24317,7 @@
23770
24317
  // pinch to zoom is mapped to wheel + ctrlKey = true
23771
24318
  // in modern browsers (!)
23772
24319
 
23773
- var isZoom = event.ctrlKey;
24320
+ var isZoom = event.ctrlKey || (isMac() && event.metaKey);
23774
24321
 
23775
24322
  var isHorizontalScroll = event.shiftKey;
23776
24323