camunda-bpmn-js 4.0.0-0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/dist/assets/diagram-js.css +7 -19
  2. package/dist/assets/properties-panel.css +57 -23
  3. package/dist/base-modeler.development.js +65569 -62864
  4. package/dist/base-modeler.production.min.js +52 -53
  5. package/dist/base-navigated-viewer.development.js +1694 -1145
  6. package/dist/base-navigated-viewer.production.min.js +1 -1
  7. package/dist/base-viewer.development.js +1692 -1147
  8. package/dist/base-viewer.production.min.js +1 -1
  9. package/dist/camunda-cloud-modeler.development.js +52572 -39963
  10. package/dist/camunda-cloud-modeler.production.min.js +61 -61
  11. package/dist/camunda-cloud-navigated-viewer.development.js +1694 -1145
  12. package/dist/camunda-cloud-navigated-viewer.production.min.js +1 -1
  13. package/dist/camunda-cloud-viewer.development.js +1692 -1147
  14. package/dist/camunda-cloud-viewer.production.min.js +1 -1
  15. package/dist/camunda-platform-modeler.development.js +45585 -42832
  16. package/dist/camunda-platform-modeler.production.min.js +52 -53
  17. package/dist/camunda-platform-navigated-viewer.development.js +1694 -1145
  18. package/dist/camunda-platform-navigated-viewer.production.min.js +1 -1
  19. package/dist/camunda-platform-viewer.development.js +1692 -1147
  20. package/dist/camunda-platform-viewer.production.min.js +1 -1
  21. package/lib/camunda-cloud/Modeler.js +0 -3
  22. package/package.json +33 -33
  23. package/lib/camunda-cloud/features/rules/BpmnRules.d.ts +0 -32
  24. package/lib/camunda-cloud/features/rules/BpmnRules.js +0 -161
  25. package/lib/camunda-cloud/features/rules/index.d.ts +0 -6
  26. package/lib/camunda-cloud/features/rules/index.js +0 -6
@@ -11,7 +11,7 @@
11
11
  *
12
12
  * @template T
13
13
  *
14
- * @param {T[][]} arr
14
+ * @param {T[][] | T[] | null} [arr]
15
15
  *
16
16
  * @return {T[]}
17
17
  */
@@ -27,6 +27,10 @@
27
27
  return obj !== undefined;
28
28
  }
29
29
 
30
+ function isNil(obj) {
31
+ return obj == null;
32
+ }
33
+
30
34
  function isArray$2(obj) {
31
35
  return nativeToString$1.call(obj) === '[object Array]';
32
36
  }
@@ -475,6 +479,58 @@
475
479
  return Object.assign(target, ...others);
476
480
  }
477
481
 
482
+ /**
483
+ * Sets a nested property of a given object to the specified value.
484
+ *
485
+ * This mutates the object and returns it.
486
+ *
487
+ * @template T
488
+ *
489
+ * @param {T} target The target of the set operation.
490
+ * @param {(string|number)[]} path The path to the nested value.
491
+ * @param {any} value The value to set.
492
+ *
493
+ * @return {T}
494
+ */
495
+ function set$1(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();
2863
+ var rendererIds = new Ids();
2745
2864
 
2746
- var TASK_BORDER_RADIUS = 10;
2747
- var INNER_OUTER_DIST = 3;
2865
+ var ELEMENT_LABEL_DISTANCE = 10,
2866
+ INNER_OUTER_DIST = 3,
2867
+ PARTICIPANT_STROKE_WIDTH = 1.5,
2868
+ TASK_BORDER_RADIUS = 10;
2748
2869
 
2749
- var DEFAULT_FILL_OPACITY = .95,
2750
- HIGH_FILL_OPACITY = .35;
2751
-
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
3254
  }
3242
3255
 
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
- }
3259
-
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)
3540
- });
3541
- },
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)
3518
+ fill: getFillColor(event, defaultFillColor, attrs.fill),
3519
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3520
+ strokeWidth: 1
3547
3521
  });
3548
-
3549
- if (!options || options.renderIcon !== false) {
3550
- renderEventContent(element, parentGfx);
3551
- }
3552
-
3553
- return circle;
3554
3522
  },
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
  *
@@ -6304,10 +6762,6 @@
6304
6762
  return event.originalEvent || event.srcEvent;
6305
6763
  }
6306
6764
 
6307
- function isMac() {
6308
- return (/mac/i).test(navigator.platform);
6309
- }
6310
-
6311
6765
  /**
6312
6766
  * @param {MouseEvent} event
6313
6767
  * @param {string} button
@@ -6340,26 +6794,6 @@
6340
6794
  return isButton(event, 1);
6341
6795
  }
6342
6796
 
6343
- /**
6344
- * @param {MouseEvent} event
6345
- *
6346
- * @return {boolean}
6347
- */
6348
- function hasPrimaryModifier(event) {
6349
- var originalEvent = getOriginal(event) || event;
6350
-
6351
- if (!isPrimaryButton(event)) {
6352
- return false;
6353
- }
6354
-
6355
- // Use cmd as primary modifier key for mac OS
6356
- if (isMac()) {
6357
- return originalEvent.metaKey;
6358
- } else {
6359
- return originalEvent.ctrlKey;
6360
- }
6361
- }
6362
-
6363
6797
  /**
6364
6798
  * @param {MouseEvent} event
6365
6799
  *
@@ -6960,6 +7394,8 @@
6960
7394
 
6961
7395
  var LOW_PRIORITY$2 = 500;
6962
7396
 
7397
+ var DEFAULT_PRIORITY$2 = 1000;
7398
+
6963
7399
  /**
6964
7400
  * @typedef {import('../../model/Types').Element} Element
6965
7401
  *
@@ -6978,25 +7414,30 @@
6978
7414
  */
6979
7415
  function Outline(eventBus, styles) {
6980
7416
 
6981
- this.offset = 6;
7417
+ this._eventBus = eventBus;
7418
+
7419
+ this.offset = 5;
6982
7420
 
6983
7421
  var OUTLINE_STYLE = styles.cls('djs-outline', [ 'no-fill' ]);
6984
7422
 
6985
7423
  var self = this;
6986
7424
 
6987
- function createOutline(gfx, bounds) {
7425
+ /**
7426
+ * @param {SVGElement} gfx
7427
+ *
7428
+ * @return {SVGElement} outline
7429
+ */
7430
+ function createOutline(gfx) {
6988
7431
  var outline = create$1('rect');
6989
7432
 
6990
7433
  attr$1(outline, assign$1({
6991
- x: 10,
6992
- y: 10,
7434
+ x: 0,
7435
+ y: 0,
6993
7436
  rx: 4,
6994
7437
  width: 100,
6995
7438
  height: 100
6996
7439
  }, OUTLINE_STYLE));
6997
7440
 
6998
- append(gfx, outline);
6999
-
7000
7441
  return outline;
7001
7442
  }
7002
7443
 
@@ -7009,7 +7450,8 @@
7009
7450
  var outline = query('.djs-outline', gfx);
7010
7451
 
7011
7452
  if (!outline) {
7012
- outline = createOutline(gfx);
7453
+ outline = self.getOutline(element) || createOutline();
7454
+ append(gfx, outline);
7013
7455
  }
7014
7456
 
7015
7457
  self.updateShapeOutline(outline, element);
@@ -7022,7 +7464,8 @@
7022
7464
  var outline = query('.djs-outline', gfx);
7023
7465
 
7024
7466
  if (!outline) {
7025
- outline = createOutline(gfx);
7467
+ outline = createOutline();
7468
+ append(gfx, outline);
7026
7469
  }
7027
7470
 
7028
7471
  self.updateConnectionOutline(outline, element);
@@ -7039,25 +7482,34 @@
7039
7482
  */
7040
7483
  Outline.prototype.updateShapeOutline = function(outline, element) {
7041
7484
 
7042
- attr$1(outline, {
7043
- x: -this.offset,
7044
- y: -this.offset,
7045
- width: element.width + this.offset * 2,
7046
- height: element.height + this.offset * 2
7047
- });
7485
+ var updated = false;
7486
+ var providers = this._getProviders();
7048
7487
 
7049
- };
7488
+ if (providers.length) {
7489
+ forEach$1(providers, function(provider) {
7490
+ updated = updated || provider.updateOutline(element, outline);
7491
+ });
7492
+ }
7050
7493
 
7494
+ if (!updated) {
7495
+ attr$1(outline, {
7496
+ x: -this.offset,
7497
+ y: -this.offset,
7498
+ width: element.width + this.offset * 2,
7499
+ height: element.height + this.offset * 2
7500
+ });
7501
+ }
7502
+ };
7051
7503
 
7052
7504
  /**
7053
7505
  * Updates the outline of a connection respecting the bounding box of
7054
7506
  * the connection and an outline offset.
7507
+ * Register an outline provider with the given priority.
7055
7508
  *
7056
7509
  * @param {SVGElement} outline
7057
7510
  * @param {Element} connection
7058
7511
  */
7059
7512
  Outline.prototype.updateConnectionOutline = function(outline, connection) {
7060
-
7061
7513
  var bbox = getBBox(connection);
7062
7514
 
7063
7515
  attr$1(outline, {
@@ -7066,9 +7518,61 @@
7066
7518
  width: bbox.width + this.offset * 2,
7067
7519
  height: bbox.height + this.offset * 2
7068
7520
  });
7521
+ };
7522
+
7523
+ /**
7524
+ * Register an outline provider with the given priority.
7525
+ *
7526
+ * @param {number} priority
7527
+ * @param {OutlineProvider} provider
7528
+ */
7529
+ Outline.prototype.registerProvider = function(priority, provider) {
7530
+ if (!provider) {
7531
+ provider = priority;
7532
+ priority = DEFAULT_PRIORITY$2;
7533
+ }
7534
+
7535
+ this._eventBus.on('outline.getProviders', priority, function(event) {
7536
+ event.providers.push(provider);
7537
+ });
7538
+ };
7539
+
7540
+ /**
7541
+ * Returns the registered outline providers.
7542
+ *
7543
+ * @returns {OutlineProvider[]}
7544
+ */
7545
+ Outline.prototype._getProviders = function() {
7546
+ var event = this._eventBus.createEvent({
7547
+ type: 'outline.getProviders',
7548
+ providers: []
7549
+ });
7550
+
7551
+ this._eventBus.fire(event);
7069
7552
 
7553
+ return event.providers;
7070
7554
  };
7071
7555
 
7556
+ /**
7557
+ * Returns the outline for an element.
7558
+ *
7559
+ * @param {Element} element
7560
+ **/
7561
+ Outline.prototype.getOutline = function(element) {
7562
+ var outline;
7563
+ var providers = this._getProviders();
7564
+
7565
+ forEach$1(providers, function(provider) {
7566
+
7567
+ if (!isFunction(provider.getOutline)) {
7568
+ return;
7569
+ }
7570
+
7571
+ outline = outline || provider.getOutline(element);
7572
+ });
7573
+
7574
+ return outline;
7575
+ };
7072
7576
 
7073
7577
  Outline.$inject = [ 'eventBus', 'styles', 'elementRegistry' ];
7074
7578
 
@@ -7410,8 +7914,8 @@
7410
7914
  var isSelected = selection.isSelected(element),
7411
7915
  isMultiSelect = selection.get().length > 1;
7412
7916
 
7413
- // Add to selection if CTRL or SHIFT pressed
7414
- var add = hasPrimaryModifier(event) || hasSecondaryModifier(event);
7917
+ // Add to selection if SHIFT pressed
7918
+ var add = hasSecondaryModifier(event);
7415
7919
 
7416
7920
  if (isSelected && isMultiSelect) {
7417
7921
  if (add) {
@@ -9387,7 +9891,7 @@
9387
9891
  }
9388
9892
 
9389
9893
  /**
9390
- * @typedef {import('./index').InjectAnnotated } InjectAnnotated
9894
+ * @typedef {import('./index.js').InjectAnnotated } InjectAnnotated
9391
9895
  */
9392
9896
 
9393
9897
  /**
@@ -9457,9 +9961,9 @@
9457
9961
  }
9458
9962
 
9459
9963
  /**
9460
- * @typedef { import('./index').ModuleDeclaration } ModuleDeclaration
9461
- * @typedef { import('./index').ModuleDefinition } ModuleDefinition
9462
- * @typedef { import('./index').InjectorContext } InjectorContext
9964
+ * @typedef { import('./index.js').ModuleDeclaration } ModuleDeclaration
9965
+ * @typedef { import('./index.js').ModuleDefinition } ModuleDefinition
9966
+ * @typedef { import('./index.js').InjectorContext } InjectorContext
9463
9967
  */
9464
9968
 
9465
9969
  /**
@@ -9562,11 +10066,20 @@
9562
10066
  };
9563
10067
  }
9564
10068
 
9565
- function instantiate(Type) {
10069
+ /**
10070
+ * Instantiate the given type, injecting dependencies.
10071
+ *
10072
+ * @template T
10073
+ *
10074
+ * @param { Function | [...string[], Function ]} type
10075
+ *
10076
+ * @return T
10077
+ */
10078
+ function instantiate(type) {
9566
10079
  const {
9567
10080
  fn,
9568
10081
  dependencies
9569
- } = fnDef(Type);
10082
+ } = fnDef(type);
9570
10083
 
9571
10084
  // instantiate var args constructor
9572
10085
  const Constructor = Function.prototype.bind.apply(fn, [ null ].concat(dependencies));
@@ -9574,6 +10087,17 @@
9574
10087
  return new Constructor();
9575
10088
  }
9576
10089
 
10090
+ /**
10091
+ * Invoke the given function, injecting dependencies. Return the result.
10092
+ *
10093
+ * @template T
10094
+ *
10095
+ * @param { Function | [...string[], Function ]} func
10096
+ * @param { Object } [context]
10097
+ * @param { Object } [locals]
10098
+ *
10099
+ * @return {T} invocation result
10100
+ */
9577
10101
  function invoke(func, context, locals) {
9578
10102
  const {
9579
10103
  fn,
@@ -11842,32 +12366,17 @@
11842
12366
  }
11843
12367
  };
11844
12368
 
11845
- var objectRefs = {exports: {}};
11846
-
11847
- var collection = {};
11848
-
11849
- /**
11850
- * An empty collection stub. Use {@link RefsCollection.extend} to extend a
11851
- * collection with ref semantics.
11852
- *
11853
- * @class RefsCollection
11854
- */
11855
-
11856
12369
  /**
11857
12370
  * Extends a collection with {@link Refs} aware methods
11858
12371
  *
11859
- * @memberof RefsCollection
11860
- * @static
11861
- *
11862
- * @param {Array<Object>} collection
11863
- * @param {Refs} refs instance
11864
- * @param {Object} property represented by the collection
11865
- * @param {Object} target object the collection is attached to
12372
+ * @param {Array<Object>} collection
12373
+ * @param {Refs} refs instance
12374
+ * @param {Object} property represented by the collection
12375
+ * @param {Object} target object the collection is attached to
11866
12376
  *
11867
12377
  * @return {RefsCollection<Object>} the extended array
11868
12378
  */
11869
12379
  function extend(collection, refs, property, target) {
11870
-
11871
12380
  var inverseProperty = property.inverse;
11872
12381
 
11873
12382
  /**
@@ -11878,7 +12387,7 @@
11878
12387
  * @param {Object} element the element to remove
11879
12388
  */
11880
12389
  Object.defineProperty(collection, 'remove', {
11881
- value: function(element) {
12390
+ value: function (element) {
11882
12391
  var idx = this.indexOf(element);
11883
12392
  if (idx !== -1) {
11884
12393
  this.splice(idx, 1);
@@ -11886,7 +12395,6 @@
11886
12395
  // unset inverse
11887
12396
  refs.unset(element, inverseProperty, target);
11888
12397
  }
11889
-
11890
12398
  return element;
11891
12399
  }
11892
12400
  });
@@ -11899,7 +12407,7 @@
11899
12407
  * @param {Object} element the element to check for
11900
12408
  */
11901
12409
  Object.defineProperty(collection, 'contains', {
11902
- value: function(element) {
12410
+ value: function (element) {
11903
12411
  return this.indexOf(element) !== -1;
11904
12412
  }
11905
12413
  });
@@ -11914,12 +12422,9 @@
11914
12422
  * (possibly moving other elements around)
11915
12423
  */
11916
12424
  Object.defineProperty(collection, 'add', {
11917
- value: function(element, idx) {
11918
-
12425
+ value: function (element, idx) {
11919
12426
  var currentIdx = this.indexOf(element);
11920
-
11921
12427
  if (typeof idx === 'undefined') {
11922
-
11923
12428
  if (currentIdx !== -1) {
11924
12429
  // element already in collection (!)
11925
12430
  return;
@@ -11931,14 +12436,12 @@
11931
12436
 
11932
12437
  // handle already in collection
11933
12438
  if (currentIdx !== -1) {
11934
-
11935
12439
  // remove element from currentIdx
11936
12440
  this.splice(currentIdx, 1);
11937
12441
  }
11938
12442
 
11939
12443
  // add element at idx
11940
12444
  this.splice(idx, 0, element);
11941
-
11942
12445
  if (currentIdx === -1) {
11943
12446
  // set inverse, unless element was
11944
12447
  // in collection already
@@ -11952,69 +12455,53 @@
11952
12455
  Object.defineProperty(collection, '__refs_collection', {
11953
12456
  value: true
11954
12457
  });
11955
-
11956
12458
  return collection;
11957
12459
  }
11958
12460
 
11959
-
12461
+ /**
12462
+ * Checks if a given collection is extended
12463
+ *
12464
+ * @param {Array<Object>} collection
12465
+ *
12466
+ * @return {boolean}
12467
+ */
11960
12468
  function isExtended(collection) {
11961
12469
  return collection.__refs_collection === true;
11962
12470
  }
11963
12471
 
11964
- collection.extend = extend;
11965
-
11966
- collection.isExtended = isExtended;
11967
-
11968
- var Collection = collection;
11969
-
11970
12472
  function hasOwnProperty$1(e, property) {
11971
12473
  return Object.prototype.hasOwnProperty.call(e, property.name || property);
11972
12474
  }
11973
-
11974
12475
  function defineCollectionProperty(ref, property, target) {
11975
-
11976
- var collection = Collection.extend(target[property.name] || [], ref, property, target);
11977
-
12476
+ var collection = extend(target[property.name] || [], ref, property, target);
11978
12477
  Object.defineProperty(target, property.name, {
11979
12478
  enumerable: property.enumerable,
11980
12479
  value: collection
11981
12480
  });
11982
-
11983
12481
  if (collection.length) {
11984
-
11985
- collection.forEach(function(o) {
12482
+ collection.forEach(function (o) {
11986
12483
  ref.set(o, property.inverse, target);
11987
12484
  });
11988
12485
  }
11989
12486
  }
11990
-
11991
-
11992
12487
  function defineProperty$1(ref, property, target) {
11993
-
11994
12488
  var inverseProperty = property.inverse;
11995
-
11996
12489
  var _value = target[property.name];
11997
-
11998
12490
  Object.defineProperty(target, property.name, {
11999
12491
  configurable: property.configurable,
12000
12492
  enumerable: property.enumerable,
12001
-
12002
- get: function() {
12493
+ get: function () {
12003
12494
  return _value;
12004
12495
  },
12005
-
12006
- set: function(value) {
12007
-
12496
+ set: function (value) {
12008
12497
  // return if we already performed all changes
12009
12498
  if (value === _value) {
12010
12499
  return;
12011
12500
  }
12012
-
12013
12501
  var old = _value;
12014
12502
 
12015
12503
  // temporary set null
12016
12504
  _value = null;
12017
-
12018
12505
  if (old) {
12019
12506
  ref.unset(old, inverseProperty, target);
12020
12507
  }
@@ -12026,7 +12513,6 @@
12026
12513
  ref.set(_value, inverseProperty, target);
12027
12514
  }
12028
12515
  });
12029
-
12030
12516
  }
12031
12517
 
12032
12518
  /**
@@ -12072,16 +12558,14 @@
12072
12558
  *
12073
12559
  * wheels[0].car // undefined
12074
12560
  */
12075
- function Refs$1(a, b) {
12076
-
12077
- if (!(this instanceof Refs$1)) {
12078
- return new Refs$1(a, b);
12561
+ function Refs(a, b) {
12562
+ if (!(this instanceof Refs)) {
12563
+ return new Refs(a, b);
12079
12564
  }
12080
12565
 
12081
12566
  // link
12082
12567
  a.inverse = b;
12083
12568
  b.inverse = a;
12084
-
12085
12569
  this.props = {};
12086
12570
  this.props[a.name] = a;
12087
12571
  this.props[b.name] = b;
@@ -12096,43 +12580,34 @@
12096
12580
  * @param {Object} target
12097
12581
  * @param {String} property
12098
12582
  */
12099
- Refs$1.prototype.bind = function(target, property) {
12583
+ Refs.prototype.bind = function (target, property) {
12100
12584
  if (typeof property === 'string') {
12101
12585
  if (!this.props[property]) {
12102
12586
  throw new Error('no property <' + property + '> in ref');
12103
12587
  }
12104
12588
  property = this.props[property];
12105
12589
  }
12106
-
12107
12590
  if (property.collection) {
12108
12591
  defineCollectionProperty(this, property, target);
12109
12592
  } else {
12110
12593
  defineProperty$1(this, property, target);
12111
12594
  }
12112
12595
  };
12113
-
12114
- Refs$1.prototype.ensureRefsCollection = function(target, property) {
12115
-
12596
+ Refs.prototype.ensureRefsCollection = function (target, property) {
12116
12597
  var collection = target[property.name];
12117
-
12118
- if (!Collection.isExtended(collection)) {
12598
+ if (!isExtended(collection)) {
12119
12599
  defineCollectionProperty(this, property, target);
12120
12600
  }
12121
-
12122
12601
  return collection;
12123
12602
  };
12124
-
12125
- Refs$1.prototype.ensureBound = function(target, property) {
12603
+ Refs.prototype.ensureBound = function (target, property) {
12126
12604
  if (!hasOwnProperty$1(target, property)) {
12127
12605
  this.bind(target, property);
12128
12606
  }
12129
12607
  };
12130
-
12131
- Refs$1.prototype.unset = function(target, property, value) {
12132
-
12608
+ Refs.prototype.unset = function (target, property, value) {
12133
12609
  if (target) {
12134
12610
  this.ensureBound(target, property);
12135
-
12136
12611
  if (property.collection) {
12137
12612
  this.ensureRefsCollection(target, property).remove(value);
12138
12613
  } else {
@@ -12140,12 +12615,9 @@
12140
12615
  }
12141
12616
  }
12142
12617
  };
12143
-
12144
- Refs$1.prototype.set = function(target, property, value) {
12145
-
12618
+ Refs.prototype.set = function (target, property, value) {
12146
12619
  if (target) {
12147
12620
  this.ensureBound(target, property);
12148
-
12149
12621
  if (property.collection) {
12150
12622
  this.ensureRefsCollection(target, property).add(value);
12151
12623
  } else {
@@ -12154,15 +12626,6 @@
12154
12626
  }
12155
12627
  };
12156
12628
 
12157
- var refs = Refs$1;
12158
-
12159
- objectRefs.exports = refs;
12160
-
12161
- objectRefs.exports.Collection = collection;
12162
-
12163
- var objectRefsExports = objectRefs.exports;
12164
- var Refs = /*@__PURE__*/getDefaultExportFromCjs(objectRefsExports);
12165
-
12166
12629
  var parentRefs = new Refs({ name: 'children', enumerable: true, collection: true }, { name: 'parent' }),
12167
12630
  labelRefs = new Refs({ name: 'labels', enumerable: true, collection: true }, { name: 'labelTarget' }),
12168
12631
  attacherRefs = new Refs({ name: 'attachers', collection: true }, { name: 'host' }),
@@ -13367,13 +13830,14 @@
13367
13830
  *
13368
13831
  * @param {SVGElement} visual The graphical element.
13369
13832
  * @param {ShapeLike} element The shape.
13833
+ * @param {Object} attrs Optional attributes.
13370
13834
  *
13371
13835
  * @return {SVGElement}
13372
13836
  */
13373
- GraphicsFactory.prototype.drawShape = function(visual, element) {
13837
+ GraphicsFactory.prototype.drawShape = function(visual, element, attrs = {}) {
13374
13838
  var eventBus = this._eventBus;
13375
13839
 
13376
- return eventBus.fire('render.shape', { gfx: visual, element: element });
13840
+ return eventBus.fire('render.shape', { gfx: visual, element, attrs });
13377
13841
  };
13378
13842
 
13379
13843
  /**
@@ -13394,13 +13858,14 @@
13394
13858
  *
13395
13859
  * @param {SVGElement} visual The graphical element.
13396
13860
  * @param {ConnectionLike} element The connection.
13861
+ * @param {Object} attrs Optional attributes.
13397
13862
  *
13398
13863
  * @return {SVGElement}
13399
13864
  */
13400
- GraphicsFactory.prototype.drawConnection = function(visual, element) {
13865
+ GraphicsFactory.prototype.drawConnection = function(visual, element, attrs = {}) {
13401
13866
  var eventBus = this._eventBus;
13402
13867
 
13403
- return eventBus.fire('render.connection', { gfx: visual, element: element });
13868
+ return eventBus.fire('render.connection', { gfx: visual, element, attrs });
13404
13869
  };
13405
13870
 
13406
13871
  /**
@@ -13977,6 +14442,17 @@
13977
14442
  this.idProperty = p;
13978
14443
  };
13979
14444
 
14445
+ DescriptorBuilder.prototype.assertNotTrait = function(typeDescriptor) {
14446
+
14447
+ const _extends = typeDescriptor.extends || [];
14448
+
14449
+ if (_extends.length) {
14450
+ throw new Error(
14451
+ `cannot create <${ typeDescriptor.name }> extending <${ typeDescriptor.extends }>`
14452
+ );
14453
+ }
14454
+ };
14455
+
13980
14456
  DescriptorBuilder.prototype.assertNotDefined = function(p, name) {
13981
14457
  var propertyName = p.name,
13982
14458
  definedProperty = this.propertiesByName[propertyName];
@@ -13995,6 +14471,10 @@
13995
14471
 
13996
14472
  DescriptorBuilder.prototype.addTrait = function(t, inherited) {
13997
14473
 
14474
+ if (inherited) {
14475
+ this.assertNotTrait(t);
14476
+ }
14477
+
13998
14478
  var typesByName = this.allTypesByName,
13999
14479
  types = this.allTypes;
14000
14480
 
@@ -14128,7 +14608,9 @@
14128
14608
  });
14129
14609
 
14130
14610
  forEach$1(type.extends, bind$2(function(extendsName) {
14131
- var extended = this.typeMap[extendsName];
14611
+ var extendsNameNs = parseName(extendsName, ns.prefix);
14612
+
14613
+ var extended = this.typeMap[extendsNameNs.name];
14132
14614
 
14133
14615
  extended.traits = extended.traits || [];
14134
14616
  extended.traits.push(name);
@@ -14157,24 +14639,33 @@
14157
14639
 
14158
14640
  var self = this;
14159
14641
 
14642
+ /**
14643
+ * Traverse the selected super type or trait
14644
+ *
14645
+ * @param {String} cls
14646
+ * @param {Boolean} [trait=false]
14647
+ */
14648
+ function traverse(cls, trait) {
14649
+ var parentNs = parseName(cls, isBuiltIn(cls) ? '' : nsName.prefix);
14650
+ self.mapTypes(parentNs, iterator, trait);
14651
+ }
14652
+
14160
14653
  /**
14161
14654
  * Traverse the selected trait.
14162
14655
  *
14163
14656
  * @param {String} cls
14164
14657
  */
14165
14658
  function traverseTrait(cls) {
14166
- return traverseSuper(cls, true);
14659
+ return traverse(cls, true);
14167
14660
  }
14168
14661
 
14169
14662
  /**
14170
- * Traverse the selected super type or trait
14663
+ * Traverse the selected super type
14171
14664
  *
14172
14665
  * @param {String} cls
14173
- * @param {Boolean} [trait=false]
14174
14666
  */
14175
- function traverseSuper(cls, trait) {
14176
- var parentNs = parseName(cls, isBuiltIn(cls) ? '' : nsName.prefix);
14177
- self.mapTypes(parentNs, iterator, trait);
14667
+ function traverseSuper(cls) {
14668
+ return traverse(cls, false);
14178
14669
  }
14179
14670
 
14180
14671
  if (!type) {
@@ -14257,7 +14748,7 @@
14257
14748
  throw new TypeError('property name must be a non-empty string');
14258
14749
  }
14259
14750
 
14260
- var property = this.model.getPropertyDescriptor(target, name);
14751
+ var property = this.getProperty(target, name);
14261
14752
 
14262
14753
  var propertyName = property && property.name;
14263
14754
 
@@ -14268,7 +14759,7 @@
14268
14759
  if (property) {
14269
14760
  delete target[propertyName];
14270
14761
  } else {
14271
- delete target.$attrs[name];
14762
+ delete target.$attrs[stripGlobal(name)];
14272
14763
  }
14273
14764
  } else {
14274
14765
 
@@ -14281,7 +14772,7 @@
14281
14772
  defineProperty(target, property, value);
14282
14773
  }
14283
14774
  } else {
14284
- target.$attrs[name] = value;
14775
+ target.$attrs[stripGlobal(name)] = value;
14285
14776
  }
14286
14777
  }
14287
14778
  };
@@ -14296,10 +14787,10 @@
14296
14787
  */
14297
14788
  Properties.prototype.get = function(target, name) {
14298
14789
 
14299
- var property = this.model.getPropertyDescriptor(target, name);
14790
+ var property = this.getProperty(target, name);
14300
14791
 
14301
14792
  if (!property) {
14302
- return target.$attrs[name];
14793
+ return target.$attrs[stripGlobal(name)];
14303
14794
  }
14304
14795
 
14305
14796
  var propertyName = property.name;
@@ -14353,6 +14844,44 @@
14353
14844
  this.define(target, '$model', { value: model });
14354
14845
  };
14355
14846
 
14847
+ /**
14848
+ * Return property with the given name on the element.
14849
+ *
14850
+ * @param {any} target
14851
+ * @param {string} name
14852
+ *
14853
+ * @return {object | null} property
14854
+ */
14855
+ Properties.prototype.getProperty = function(target, name) {
14856
+
14857
+ var model = this.model;
14858
+
14859
+ var property = model.getPropertyDescriptor(target, name);
14860
+
14861
+ if (property) {
14862
+ return property;
14863
+ }
14864
+
14865
+ if (name.includes(':')) {
14866
+ return null;
14867
+ }
14868
+
14869
+ const strict = model.config.strict;
14870
+
14871
+ if (typeof strict !== 'undefined') {
14872
+ const error = new TypeError(`unknown property <${ name }> on <${ target.$type }>`);
14873
+
14874
+ if (strict) {
14875
+ throw error;
14876
+ } else {
14877
+
14878
+ // eslint-disable-next-line no-undef
14879
+ typeof console !== 'undefined' && console.warn(error);
14880
+ }
14881
+ }
14882
+
14883
+ return null;
14884
+ };
14356
14885
 
14357
14886
  function isUndefined(val) {
14358
14887
  return typeof val === 'undefined';
@@ -14367,6 +14896,10 @@
14367
14896
  });
14368
14897
  }
14369
14898
 
14899
+ function stripGlobal(name) {
14900
+ return name.replace(/^:/, '');
14901
+ }
14902
+
14370
14903
  // Moddle implementation /////////////////////////////////////////////////
14371
14904
 
14372
14905
  /**
@@ -14389,8 +14922,10 @@
14389
14922
  * var moddle = new Moddle([pkg]);
14390
14923
  *
14391
14924
  * @param {Array<Package>} packages the packages to contain
14925
+ *
14926
+ * @param { { strict?: boolean } } [config] moddle configuration
14392
14927
  */
14393
- function Moddle(packages) {
14928
+ function Moddle(packages, config = {}) {
14394
14929
 
14395
14930
  this.properties = new Properties(this);
14396
14931
 
@@ -14398,6 +14933,8 @@
14398
14933
  this.registry = new Registry(packages, this.properties);
14399
14934
 
14400
14935
  this.typeCache = {};
14936
+
14937
+ this.config = config;
14401
14938
  }
14402
14939
 
14403
14940
 
@@ -14491,6 +15028,12 @@
14491
15028
  $type: name,
14492
15029
  $instanceOf: function(type) {
14493
15030
  return type === this.$type;
15031
+ },
15032
+ get: function(key) {
15033
+ return this[key];
15034
+ },
15035
+ set: function(key, value) {
15036
+ set$1(this, [ key ], value);
14494
15037
  }
14495
15038
  };
14496
15039
 
@@ -14506,6 +15049,8 @@
14506
15049
 
14507
15050
  this.properties.defineDescriptor(element, descriptor);
14508
15051
  this.properties.defineModel(element, this);
15052
+ this.properties.define(element, 'get', { enumerable: false, writable: true });
15053
+ this.properties.define(element, 'set', { enumerable: false, writable: true });
14509
15054
  this.properties.define(element, '$parent', { enumerable: false, writable: true });
14510
15055
  this.properties.define(element, '$instanceOf', { enumerable: false, writable: true });
14511
15056