camunda-bpmn-js 4.0.0-0 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/dist/assets/diagram-js.css +7 -19
  2. package/dist/assets/properties-panel.css +57 -23
  3. package/dist/base-modeler.development.js +44323 -41580
  4. package/dist/base-modeler.production.min.js +52 -53
  5. package/dist/base-navigated-viewer.development.js +1695 -1148
  6. package/dist/base-navigated-viewer.production.min.js +1 -1
  7. package/dist/base-viewer.development.js +1694 -1151
  8. package/dist/base-viewer.production.min.js +1 -1
  9. package/dist/camunda-cloud-modeler.development.js +53952 -41021
  10. package/dist/camunda-cloud-modeler.production.min.js +61 -61
  11. package/dist/camunda-cloud-navigated-viewer.development.js +1695 -1148
  12. package/dist/camunda-cloud-navigated-viewer.production.min.js +1 -1
  13. package/dist/camunda-cloud-viewer.development.js +1694 -1151
  14. package/dist/camunda-cloud-viewer.production.min.js +1 -1
  15. package/dist/camunda-platform-modeler.development.js +45914 -43112
  16. package/dist/camunda-platform-modeler.production.min.js +52 -53
  17. package/dist/camunda-platform-navigated-viewer.development.js +1695 -1148
  18. package/dist/camunda-platform-navigated-viewer.production.min.js +1 -1
  19. package/dist/camunda-platform-viewer.development.js +1694 -1151
  20. package/dist/camunda-platform-viewer.production.min.js +1 -1
  21. package/lib/camunda-cloud/Modeler.js +0 -3
  22. package/package.json +33 -33
  23. package/lib/camunda-cloud/features/rules/BpmnRules.d.ts +0 -32
  24. package/lib/camunda-cloud/features/rules/BpmnRules.js +0 -161
  25. package/lib/camunda-cloud/features/rules/index.d.ts +0 -6
  26. package/lib/camunda-cloud/features/rules/index.js +0 -6
@@ -11,7 +11,7 @@
11
11
  *
12
12
  * @template T
13
13
  *
14
- * @param {T[][]} arr
14
+ * @param {T[][] | T[] | null} [arr]
15
15
  *
16
16
  * @return {T[]}
17
17
  */
@@ -27,6 +27,10 @@
27
27
  return obj !== undefined;
28
28
  }
29
29
 
30
+ function isNil(obj) {
31
+ return obj == null;
32
+ }
33
+
30
34
  function isArray$2(obj) {
31
35
  return nativeToString$1.call(obj) === '[object Array]';
32
36
  }
@@ -475,6 +479,58 @@
475
479
  return Object.assign(target, ...others);
476
480
  }
477
481
 
482
+ /**
483
+ * Sets a nested property of a given object to the specified value.
484
+ *
485
+ * This mutates the object and returns it.
486
+ *
487
+ * @template T
488
+ *
489
+ * @param {T} target The target of the set operation.
490
+ * @param {(string|number)[]} path The path to the nested value.
491
+ * @param {any} value The value to set.
492
+ *
493
+ * @return {T}
494
+ */
495
+ function set$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
  *
@@ -1784,6 +1860,7 @@
1784
1860
  }
1785
1861
 
1786
1862
  var black = 'hsl(225, 10%, 15%)';
1863
+ var white = 'white';
1787
1864
 
1788
1865
  // element utils //////////////////////
1789
1866
 
@@ -1831,39 +1908,42 @@
1831
1908
  /**
1832
1909
  * @param {Element} element
1833
1910
  * @param {string} [defaultColor]
1911
+ * @param {string} [overrideColor]
1834
1912
  *
1835
1913
  * @return {string}
1836
1914
  */
1837
- function getFillColor(element, defaultColor) {
1915
+ function getFillColor(element, defaultColor, overrideColor) {
1838
1916
  var di = getDi(element);
1839
1917
 
1840
- return di.get('color:background-color') || di.get('bioc:fill') || defaultColor || 'white';
1918
+ return overrideColor || di.get('color:background-color') || di.get('bioc:fill') || defaultColor || white;
1841
1919
  }
1842
1920
 
1843
1921
  /**
1844
1922
  * @param {Element} element
1845
1923
  * @param {string} [defaultColor]
1924
+ * @param {string} [overrideColor]
1846
1925
  *
1847
1926
  * @return {string}
1848
1927
  */
1849
- function getStrokeColor(element, defaultColor) {
1928
+ function getStrokeColor(element, defaultColor, overrideColor) {
1850
1929
  var di = getDi(element);
1851
1930
 
1852
- return di.get('color:border-color') || di.get('bioc:stroke') || defaultColor || black;
1931
+ return overrideColor || di.get('color:border-color') || di.get('bioc:stroke') || defaultColor || black;
1853
1932
  }
1854
1933
 
1855
1934
  /**
1856
1935
  * @param {Element} element
1857
1936
  * @param {string} [defaultColor]
1858
1937
  * @param {string} [defaultStrokeColor]
1938
+ * @param {string} [overrideColor]
1859
1939
  *
1860
1940
  * @return {string}
1861
1941
  */
1862
- function getLabelColor(element, defaultColor, defaultStrokeColor) {
1942
+ function getLabelColor(element, defaultColor, defaultStrokeColor, overrideColor) {
1863
1943
  var di = getDi(element),
1864
1944
  label = di.get('label');
1865
1945
 
1866
- return label && label.get('color:color') || defaultColor ||
1946
+ return overrideColor || (label && label.get('color:color')) || defaultColor ||
1867
1947
  getStrokeColor(element, defaultStrokeColor);
1868
1948
  }
1869
1949
 
@@ -1967,6 +2047,45 @@
1967
2047
  return componentsToPath(rectPath);
1968
2048
  }
1969
2049
 
2050
+ /**
2051
+ * Get width and height from element or overrides.
2052
+ *
2053
+ * @param {Dimensions|Rect|ShapeLike} bounds
2054
+ * @param {Object} overrides
2055
+ *
2056
+ * @returns {Dimensions}
2057
+ */
2058
+ function getBounds(bounds, overrides = {}) {
2059
+ return {
2060
+ width: getWidth(bounds, overrides),
2061
+ height: getHeight(bounds, overrides)
2062
+ };
2063
+ }
2064
+
2065
+ /**
2066
+ * Get width from element or overrides.
2067
+ *
2068
+ * @param {Dimensions|Rect|ShapeLike} bounds
2069
+ * @param {Object} overrides
2070
+ *
2071
+ * @returns {number}
2072
+ */
2073
+ function getWidth(bounds, overrides = {}) {
2074
+ return has$1(overrides, 'width') ? overrides.width : bounds.width;
2075
+ }
2076
+
2077
+ /**
2078
+ * Get height from element or overrides.
2079
+ *
2080
+ * @param {Dimensions|Rect|ShapeLike} bounds
2081
+ * @param {Object} overrides
2082
+ *
2083
+ * @returns {number}
2084
+ */
2085
+ function getHeight(bounds, overrides = {}) {
2086
+ return has$1(overrides, 'height') ? overrides.height : bounds.height;
2087
+ }
2088
+
1970
2089
  function _mergeNamespaces$1(n, m) {
1971
2090
  m.forEach(function (e) {
1972
2091
  e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
@@ -2730,15 +2849,16 @@
2730
2849
  }
2731
2850
  };
2732
2851
 
2733
- var RENDERER_IDS = new Ids();
2852
+ var rendererIds = new Ids();
2734
2853
 
2735
- var TASK_BORDER_RADIUS = 10;
2736
- var INNER_OUTER_DIST = 3;
2854
+ var ELEMENT_LABEL_DISTANCE = 10,
2855
+ INNER_OUTER_DIST = 3,
2856
+ PARTICIPANT_STROKE_WIDTH = 1.5,
2857
+ TASK_BORDER_RADIUS = 10;
2737
2858
 
2738
- var DEFAULT_FILL_OPACITY = .95,
2739
- HIGH_FILL_OPACITY = .35;
2740
-
2741
- var ELEMENT_LABEL_DISTANCE = 10;
2859
+ var DEFAULT_OPACITY = 0.95,
2860
+ FULL_OPACITY = 1,
2861
+ LOW_OPACITY = 0.25;
2742
2862
 
2743
2863
  /**
2744
2864
  * @typedef { Partial<{
@@ -2746,6 +2866,13 @@
2746
2866
  * defaultStrokeColor: string,
2747
2867
  * defaultLabelColor: string
2748
2868
  * }> } BpmnRendererConfig
2869
+ *
2870
+ * @typedef { Partial<{
2871
+ * fill: string,
2872
+ * stroke: string,
2873
+ * width: string,
2874
+ * height: string
2875
+ * }> } Attrs
2749
2876
  */
2750
2877
 
2751
2878
  /**
@@ -2773,7 +2900,7 @@
2773
2900
  defaultStrokeColor = config && config.defaultStrokeColor,
2774
2901
  defaultLabelColor = config && config.defaultLabelColor;
2775
2902
 
2776
- var rendererId = RENDERER_IDS.next();
2903
+ var rendererId = rendererIds.next();
2777
2904
 
2778
2905
  var markers = {};
2779
2906
 
@@ -2869,7 +2996,7 @@
2869
2996
  cy: 6,
2870
2997
  r: 3.5,
2871
2998
  ...shapeStyle({
2872
- fill: fill,
2999
+ fill,
2873
3000
  stroke: stroke,
2874
3001
  strokeWidth: 1,
2875
3002
 
@@ -2889,7 +3016,7 @@
2889
3016
  var messageflowEnd = create$1('path', {
2890
3017
  d: 'm 1 5 l 0 -3 l 7 3 l -7 3 z',
2891
3018
  ...shapeStyle({
2892
- fill: fill,
3019
+ fill,
2893
3020
  stroke: stroke,
2894
3021
  strokeWidth: 1,
2895
3022
 
@@ -2910,7 +3037,7 @@
2910
3037
  d: 'M 11 5 L 1 10 L 11 15',
2911
3038
  ...lineStyle({
2912
3039
  fill: 'none',
2913
- stroke: stroke,
3040
+ stroke,
2914
3041
  strokeWidth: 1.5,
2915
3042
 
2916
3043
  // fix for safari / chrome / firefox bug not correctly
@@ -2931,7 +3058,7 @@
2931
3058
  d: 'M 1 5 L 11 10 L 1 15',
2932
3059
  ...lineStyle({
2933
3060
  fill: 'none',
2934
- stroke: stroke,
3061
+ stroke,
2935
3062
  strokeWidth: 1.5,
2936
3063
 
2937
3064
  // fix for safari / chrome / firefox bug not correctly
@@ -2951,7 +3078,7 @@
2951
3078
  var conditionalFlowMarker = create$1('path', {
2952
3079
  d: 'M 0 10 L 8 6 L 16 10 L 8 14 Z',
2953
3080
  ...shapeStyle({
2954
- fill: fill,
3081
+ fill,
2955
3082
  stroke: stroke
2956
3083
  })
2957
3084
  });
@@ -2979,7 +3106,7 @@
2979
3106
  }
2980
3107
  }
2981
3108
 
2982
- function drawCircle(parentGfx, width, height, offset, attrs) {
3109
+ function drawCircle(parentGfx, width, height, offset, attrs = {}) {
2983
3110
 
2984
3111
  if (isObject(offset)) {
2985
3112
  attrs = offset;
@@ -2990,10 +3117,6 @@
2990
3117
 
2991
3118
  attrs = shapeStyle(attrs);
2992
3119
 
2993
- if (attrs.fill === 'none') {
2994
- delete attrs.fillOpacity;
2995
- }
2996
-
2997
3120
  var cx = width / 2,
2998
3121
  cy = height / 2;
2999
3122
 
@@ -3093,7 +3216,6 @@
3093
3216
  }
3094
3217
 
3095
3218
  function drawPath(parentGfx, d, attrs) {
3096
-
3097
3219
  attrs = lineStyle(attrs);
3098
3220
 
3099
3221
  var path = create$1('path', {
@@ -3115,171 +3237,13 @@
3115
3237
  }
3116
3238
 
3117
3239
  function as(type) {
3118
- return function(parentGfx, element, options) {
3119
- return renderer(type)(parentGfx, element, options);
3120
- };
3121
- }
3122
-
3123
- function renderEventContent(element, parentGfx) {
3124
-
3125
- var event = getBusinessObject(element);
3126
- var isThrowing = isThrowEvent(event);
3127
-
3128
- if (event.eventDefinitions && event.eventDefinitions.length > 1) {
3129
- if (event.parallelMultiple) {
3130
- return renderer('bpmn:ParallelMultipleEventDefinition')(parentGfx, element, isThrowing);
3131
- }
3132
- else {
3133
- return renderer('bpmn:MultipleEventDefinition')(parentGfx, element, isThrowing);
3134
- }
3135
- }
3136
-
3137
- if (isTypedEvent(event, 'bpmn:MessageEventDefinition')) {
3138
- return renderer('bpmn:MessageEventDefinition')(parentGfx, element, isThrowing);
3139
- }
3140
-
3141
- if (isTypedEvent(event, 'bpmn:TimerEventDefinition')) {
3142
- return renderer('bpmn:TimerEventDefinition')(parentGfx, element, isThrowing);
3143
- }
3144
-
3145
- if (isTypedEvent(event, 'bpmn:ConditionalEventDefinition')) {
3146
- return renderer('bpmn:ConditionalEventDefinition')(parentGfx, element);
3147
- }
3148
-
3149
- if (isTypedEvent(event, 'bpmn:SignalEventDefinition')) {
3150
- return renderer('bpmn:SignalEventDefinition')(parentGfx, element, isThrowing);
3151
- }
3152
-
3153
- if (isTypedEvent(event, 'bpmn:EscalationEventDefinition')) {
3154
- return renderer('bpmn:EscalationEventDefinition')(parentGfx, element, isThrowing);
3155
- }
3156
-
3157
- if (isTypedEvent(event, 'bpmn:LinkEventDefinition')) {
3158
- return renderer('bpmn:LinkEventDefinition')(parentGfx, element, isThrowing);
3159
- }
3160
-
3161
- if (isTypedEvent(event, 'bpmn:ErrorEventDefinition')) {
3162
- return renderer('bpmn:ErrorEventDefinition')(parentGfx, element, isThrowing);
3163
- }
3164
-
3165
- if (isTypedEvent(event, 'bpmn:CancelEventDefinition')) {
3166
- return renderer('bpmn:CancelEventDefinition')(parentGfx, element, isThrowing);
3167
- }
3168
-
3169
- if (isTypedEvent(event, 'bpmn:CompensateEventDefinition')) {
3170
- return renderer('bpmn:CompensateEventDefinition')(parentGfx, element, isThrowing);
3171
- }
3172
-
3173
- if (isTypedEvent(event, 'bpmn:TerminateEventDefinition')) {
3174
- return renderer('bpmn:TerminateEventDefinition')(parentGfx, element, isThrowing);
3175
- }
3176
-
3177
- return null;
3178
- }
3179
-
3180
- function renderLabel(parentGfx, label, options) {
3181
-
3182
- options = assign$1({
3183
- size: {
3184
- width: 100
3185
- }
3186
- }, options);
3187
-
3188
- var text = textRenderer.createText(label || '', options);
3189
-
3190
- classes$1(text).add('djs-label');
3191
-
3192
- append(parentGfx, text);
3193
-
3194
- return text;
3195
- }
3196
-
3197
- function renderEmbeddedLabel(parentGfx, element, align) {
3198
- var semantic = getBusinessObject(element);
3199
-
3200
- return renderLabel(parentGfx, semantic.name, {
3201
- box: element,
3202
- align: align,
3203
- padding: 7,
3204
- style: {
3205
- fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
3206
- }
3207
- });
3208
- }
3209
-
3210
- function renderExternalLabel(parentGfx, element) {
3211
-
3212
- var box = {
3213
- width: 90,
3214
- height: 30,
3215
- x: element.width / 2 + element.x,
3216
- y: element.height / 2 + element.y
3240
+ return function(parentGfx, element, attrs) {
3241
+ return renderer(type)(parentGfx, element, attrs);
3217
3242
  };
3218
-
3219
- return renderLabel(parentGfx, getLabel(element), {
3220
- box: box,
3221
- fitBox: true,
3222
- style: assign$1(
3223
- {},
3224
- textRenderer.getExternalStyle(),
3225
- {
3226
- fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
3227
- }
3228
- )
3229
- });
3230
3243
  }
3231
3244
 
3232
- function renderLaneLabel(parentGfx, text, element) {
3233
- var textBox = renderLabel(parentGfx, text, {
3234
- box: {
3235
- height: 30,
3236
- width: element.height
3237
- },
3238
- align: 'center-middle',
3239
- style: {
3240
- fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
3241
- }
3242
- });
3243
-
3244
- var top = -1 * element.height;
3245
-
3246
- transform(textBox, 0, -top, 270);
3247
- }
3248
-
3249
- var handlers = this.handlers = {
3250
- 'bpmn:Event': function(parentGfx, element, attrs) {
3251
-
3252
- if (!('fillOpacity' in attrs)) {
3253
- attrs.fillOpacity = DEFAULT_FILL_OPACITY;
3254
- }
3255
-
3256
- return drawCircle(parentGfx, element.width, element.height, attrs);
3257
- },
3258
- 'bpmn:StartEvent': function(parentGfx, element, options) {
3259
- var attrs = {
3260
- fill: getFillColor(element, defaultFillColor),
3261
- stroke: getStrokeColor(element, defaultStrokeColor)
3262
- };
3263
-
3264
- var semantic = getBusinessObject(element);
3265
-
3266
- if (!semantic.isInterrupting) {
3267
- attrs = {
3268
- strokeDasharray: '6',
3269
- fill: getFillColor(element, defaultFillColor),
3270
- stroke: getStrokeColor(element, defaultStrokeColor)
3271
- };
3272
- }
3273
-
3274
- var circle = renderer('bpmn:Event')(parentGfx, element, attrs);
3275
-
3276
- if (!options || options.renderIcon !== false) {
3277
- renderEventContent(element, parentGfx);
3278
- }
3279
-
3280
- return circle;
3281
- },
3282
- 'bpmn:MessageEventDefinition': function(parentGfx, element, isThrowing) {
3245
+ var eventIconRenderers = {
3246
+ 'bpmn:MessageEventDefinition': function(parentGfx, element, attrs = {}, isThrowing) {
3283
3247
  var pathData = pathMap.getScaledPath('EVENT_MESSAGE', {
3284
3248
  xScaleFactor: 0.9,
3285
3249
  yScaleFactor: 0.9,
@@ -3291,22 +3255,27 @@
3291
3255
  }
3292
3256
  });
3293
3257
 
3294
- var fill = isThrowing ? getStrokeColor(element, defaultStrokeColor) : getFillColor(element, defaultFillColor);
3295
- var stroke = isThrowing ? getFillColor(element, defaultFillColor) : getStrokeColor(element, defaultStrokeColor);
3258
+ var fill = isThrowing
3259
+ ? getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3260
+ : getFillColor(element, defaultFillColor, attrs.fill);
3261
+
3262
+ var stroke = isThrowing
3263
+ ? getFillColor(element, defaultFillColor, attrs.fill)
3264
+ : getStrokeColor(element, defaultStrokeColor, attrs.stroke);
3296
3265
 
3297
3266
  var messagePath = drawPath(parentGfx, pathData, {
3298
- strokeWidth: 1,
3299
- fill: fill,
3300
- stroke: stroke
3267
+ fill,
3268
+ stroke,
3269
+ strokeWidth: 1
3301
3270
  });
3302
3271
 
3303
3272
  return messagePath;
3304
3273
  },
3305
- 'bpmn:TimerEventDefinition': function(parentGfx, element) {
3274
+ 'bpmn:TimerEventDefinition': function(parentGfx, element, attrs = {}) {
3306
3275
  var circle = drawCircle(parentGfx, element.width, element.height, 0.2 * element.height, {
3307
- strokeWidth: 2,
3308
- fill: getFillColor(element, defaultFillColor),
3309
- stroke: getStrokeColor(element, defaultStrokeColor)
3276
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3277
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3278
+ strokeWidth: 2
3310
3279
  });
3311
3280
 
3312
3281
  var pathData = pathMap.getScaledPath('EVENT_TIMER_WH', {
@@ -3321,12 +3290,11 @@
3321
3290
  });
3322
3291
 
3323
3292
  drawPath(parentGfx, pathData, {
3324
- strokeWidth: 2,
3325
- stroke: getStrokeColor(element, defaultStrokeColor)
3293
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3294
+ strokeWidth: 2
3326
3295
  });
3327
3296
 
3328
- for (var i = 0;i < 12; i++) {
3329
-
3297
+ for (var i = 0; i < 12; i++) {
3330
3298
  var linePathData = pathMap.getScaledPath('EVENT_TIMER_LINE', {
3331
3299
  xScaleFactor: 0.75,
3332
3300
  yScaleFactor: 0.75,
@@ -3338,19 +3306,19 @@
3338
3306
  }
3339
3307
  });
3340
3308
 
3341
- var width = element.width / 2;
3342
- var height = element.height / 2;
3309
+ var width = element.width / 2,
3310
+ height = element.height / 2;
3343
3311
 
3344
3312
  drawPath(parentGfx, linePathData, {
3345
3313
  strokeWidth: 1,
3346
- transform: 'rotate(' + (i * 30) + ',' + height + ',' + width + ')',
3347
- stroke: getStrokeColor(element, defaultStrokeColor)
3314
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3315
+ transform: 'rotate(' + (i * 30) + ',' + height + ',' + width + ')'
3348
3316
  });
3349
3317
  }
3350
3318
 
3351
3319
  return circle;
3352
3320
  },
3353
- 'bpmn:EscalationEventDefinition': function(parentGfx, event, isThrowing) {
3321
+ 'bpmn:EscalationEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3354
3322
  var pathData = pathMap.getScaledPath('EVENT_ESCALATION', {
3355
3323
  xScaleFactor: 1,
3356
3324
  yScaleFactor: 1,
@@ -3362,15 +3330,17 @@
3362
3330
  }
3363
3331
  });
3364
3332
 
3365
- var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
3333
+ var fill = isThrowing
3334
+ ? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3335
+ : getFillColor(event, defaultFillColor, attrs.fill);
3366
3336
 
3367
3337
  return drawPath(parentGfx, pathData, {
3368
- strokeWidth: 1,
3369
- fill: fill,
3370
- stroke: getStrokeColor(event, defaultStrokeColor)
3338
+ fill,
3339
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3340
+ strokeWidth: 1
3371
3341
  });
3372
3342
  },
3373
- 'bpmn:ConditionalEventDefinition': function(parentGfx, event) {
3343
+ 'bpmn:ConditionalEventDefinition': function(parentGfx, event, attrs = {}) {
3374
3344
  var pathData = pathMap.getScaledPath('EVENT_CONDITIONAL', {
3375
3345
  xScaleFactor: 1,
3376
3346
  yScaleFactor: 1,
@@ -3383,11 +3353,12 @@
3383
3353
  });
3384
3354
 
3385
3355
  return drawPath(parentGfx, pathData, {
3386
- strokeWidth: 1,
3387
- stroke: getStrokeColor(event, defaultStrokeColor)
3356
+ fill: getFillColor(event, defaultFillColor, attrs.fill),
3357
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3358
+ strokeWidth: 1
3388
3359
  });
3389
3360
  },
3390
- 'bpmn:LinkEventDefinition': function(parentGfx, event, isThrowing) {
3361
+ 'bpmn:LinkEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3391
3362
  var pathData = pathMap.getScaledPath('EVENT_LINK', {
3392
3363
  xScaleFactor: 1,
3393
3364
  yScaleFactor: 1,
@@ -3399,15 +3370,17 @@
3399
3370
  }
3400
3371
  });
3401
3372
 
3402
- var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
3373
+ var fill = isThrowing
3374
+ ? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3375
+ : getFillColor(event, defaultFillColor, attrs.fill);
3403
3376
 
3404
3377
  return drawPath(parentGfx, pathData, {
3405
- strokeWidth: 1,
3406
- fill: fill,
3407
- stroke: getStrokeColor(event, defaultStrokeColor)
3378
+ fill,
3379
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3380
+ strokeWidth: 1
3408
3381
  });
3409
3382
  },
3410
- 'bpmn:ErrorEventDefinition': function(parentGfx, event, isThrowing) {
3383
+ 'bpmn:ErrorEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3411
3384
  var pathData = pathMap.getScaledPath('EVENT_ERROR', {
3412
3385
  xScaleFactor: 1.1,
3413
3386
  yScaleFactor: 1.1,
@@ -3419,15 +3392,17 @@
3419
3392
  }
3420
3393
  });
3421
3394
 
3422
- var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
3395
+ var fill = isThrowing
3396
+ ? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3397
+ : getFillColor(event, defaultFillColor, attrs.fill);
3423
3398
 
3424
3399
  return drawPath(parentGfx, pathData, {
3425
- strokeWidth: 1,
3426
- fill: fill,
3427
- stroke: getStrokeColor(event, defaultStrokeColor)
3400
+ fill,
3401
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3402
+ strokeWidth: 1
3428
3403
  });
3429
3404
  },
3430
- 'bpmn:CancelEventDefinition': function(parentGfx, event, isThrowing) {
3405
+ 'bpmn:CancelEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3431
3406
  var pathData = pathMap.getScaledPath('EVENT_CANCEL_45', {
3432
3407
  xScaleFactor: 1.0,
3433
3408
  yScaleFactor: 1.0,
@@ -3439,19 +3414,19 @@
3439
3414
  }
3440
3415
  });
3441
3416
 
3442
- var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
3417
+ var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor, attrs.stroke) : 'none';
3443
3418
 
3444
3419
  var path = drawPath(parentGfx, pathData, {
3445
- strokeWidth: 1,
3446
- fill: fill,
3447
- stroke: getStrokeColor(event, defaultStrokeColor)
3420
+ fill,
3421
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3422
+ strokeWidth: 1
3448
3423
  });
3449
3424
 
3450
3425
  rotate(path, 45);
3451
3426
 
3452
3427
  return path;
3453
3428
  },
3454
- 'bpmn:CompensateEventDefinition': function(parentGfx, event, isThrowing) {
3429
+ 'bpmn:CompensateEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3455
3430
  var pathData = pathMap.getScaledPath('EVENT_COMPENSATION', {
3456
3431
  xScaleFactor: 1,
3457
3432
  yScaleFactor: 1,
@@ -3463,15 +3438,17 @@
3463
3438
  }
3464
3439
  });
3465
3440
 
3466
- var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
3441
+ var fill = isThrowing
3442
+ ? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3443
+ : getFillColor(event, defaultFillColor, attrs.fill);
3467
3444
 
3468
3445
  return drawPath(parentGfx, pathData, {
3469
- strokeWidth: 1,
3470
- fill: fill,
3471
- stroke: getStrokeColor(event, defaultStrokeColor)
3446
+ fill,
3447
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3448
+ strokeWidth: 1
3472
3449
  });
3473
3450
  },
3474
- 'bpmn:SignalEventDefinition': function(parentGfx, event, isThrowing) {
3451
+ 'bpmn:SignalEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3475
3452
  var pathData = pathMap.getScaledPath('EVENT_SIGNAL', {
3476
3453
  xScaleFactor: 0.9,
3477
3454
  yScaleFactor: 0.9,
@@ -3483,15 +3460,17 @@
3483
3460
  }
3484
3461
  });
3485
3462
 
3486
- var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
3463
+ var fill = isThrowing
3464
+ ? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3465
+ : getFillColor(event, defaultFillColor, attrs.fill);
3487
3466
 
3488
3467
  return drawPath(parentGfx, pathData, {
3489
3468
  strokeWidth: 1,
3490
- fill: fill,
3491
- stroke: getStrokeColor(event, defaultStrokeColor)
3469
+ fill,
3470
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3492
3471
  });
3493
3472
  },
3494
- 'bpmn:MultipleEventDefinition': function(parentGfx, event, isThrowing) {
3473
+ 'bpmn:MultipleEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3495
3474
  var pathData = pathMap.getScaledPath('EVENT_MULTIPLE', {
3496
3475
  xScaleFactor: 1.1,
3497
3476
  yScaleFactor: 1.1,
@@ -3503,14 +3482,16 @@
3503
3482
  }
3504
3483
  });
3505
3484
 
3506
- var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
3485
+ var fill = isThrowing
3486
+ ? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3487
+ : getFillColor(event, defaultFillColor, attrs.fill);
3507
3488
 
3508
3489
  return drawPath(parentGfx, pathData, {
3509
- strokeWidth: 1,
3510
- fill: fill
3490
+ fill,
3491
+ strokeWidth: 1
3511
3492
  });
3512
3493
  },
3513
- 'bpmn:ParallelMultipleEventDefinition': function(parentGfx, event) {
3494
+ 'bpmn:ParallelMultipleEventDefinition': function(parentGfx, event, attrs = {}) {
3514
3495
  var pathData = pathMap.getScaledPath('EVENT_PARALLEL_MULTIPLE', {
3515
3496
  xScaleFactor: 1.2,
3516
3497
  yScaleFactor: 1.2,
@@ -3523,501 +3504,791 @@
3523
3504
  });
3524
3505
 
3525
3506
  return drawPath(parentGfx, pathData, {
3526
- strokeWidth: 1,
3527
- fill: getStrokeColor(event, defaultStrokeColor),
3528
- stroke: getStrokeColor(event, defaultStrokeColor)
3529
- });
3530
- },
3531
- 'bpmn:EndEvent': function(parentGfx, element, options) {
3532
- var circle = renderer('bpmn:Event')(parentGfx, element, {
3533
- strokeWidth: 4,
3534
- fill: getFillColor(element, defaultFillColor),
3535
- stroke: getStrokeColor(element, defaultStrokeColor)
3507
+ fill: getFillColor(event, defaultFillColor, attrs.fill),
3508
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3509
+ strokeWidth: 1
3536
3510
  });
3537
-
3538
- if (!options || options.renderIcon !== false) {
3539
- renderEventContent(element, parentGfx);
3540
- }
3541
-
3542
- return circle;
3543
3511
  },
3544
- 'bpmn:TerminateEventDefinition': function(parentGfx, element) {
3512
+ 'bpmn:TerminateEventDefinition': function(parentGfx, element, attrs = {}) {
3545
3513
  var circle = drawCircle(parentGfx, element.width, element.height, 8, {
3546
- strokeWidth: 4,
3547
- fill: getStrokeColor(element, defaultStrokeColor),
3548
- stroke: getStrokeColor(element, defaultStrokeColor)
3514
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3515
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3516
+ strokeWidth: 4
3549
3517
  });
3550
3518
 
3551
3519
  return circle;
3552
- },
3553
- 'bpmn:IntermediateEvent': function(parentGfx, element, options) {
3554
- var outer = renderer('bpmn:Event')(parentGfx, element, {
3555
- strokeWidth: 1.5,
3556
- fill: getFillColor(element, defaultFillColor),
3557
- stroke: getStrokeColor(element, defaultStrokeColor)
3558
- });
3520
+ }
3521
+ };
3559
3522
 
3560
- /* inner */
3561
- drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {
3562
- strokeWidth: 1.5,
3563
- fill: getFillColor(element, 'none'),
3564
- stroke: getStrokeColor(element, defaultStrokeColor)
3565
- });
3523
+ function renderEventIcon(element, parentGfx, attrs = {}) {
3524
+ var semantic = getBusinessObject(element),
3525
+ isThrowing = isThrowEvent(semantic);
3566
3526
 
3567
- if (!options || options.renderIcon !== false) {
3568
- renderEventContent(element, parentGfx);
3527
+ if (semantic.get('eventDefinitions') && semantic.get('eventDefinitions').length > 1) {
3528
+ if (semantic.get('parallelMultiple')) {
3529
+ return eventIconRenderers[ 'bpmn:ParallelMultipleEventDefinition' ](parentGfx, element, attrs, isThrowing);
3530
+ }
3531
+ else {
3532
+ return eventIconRenderers[ 'bpmn:MultipleEventDefinition' ](parentGfx, element, attrs, isThrowing);
3569
3533
  }
3534
+ }
3570
3535
 
3571
- return outer;
3572
- },
3573
- 'bpmn:IntermediateCatchEvent': as('bpmn:IntermediateEvent'),
3574
- 'bpmn:IntermediateThrowEvent': as('bpmn:IntermediateEvent'),
3536
+ if (isTypedEvent(semantic, 'bpmn:MessageEventDefinition')) {
3537
+ return eventIconRenderers[ 'bpmn:MessageEventDefinition' ](parentGfx, element, attrs, isThrowing);
3538
+ }
3575
3539
 
3576
- 'bpmn:Activity': function(parentGfx, element, attrs) {
3540
+ if (isTypedEvent(semantic, 'bpmn:TimerEventDefinition')) {
3541
+ return eventIconRenderers[ 'bpmn:TimerEventDefinition' ](parentGfx, element, attrs, isThrowing);
3542
+ }
3577
3543
 
3578
- attrs = attrs || {};
3544
+ if (isTypedEvent(semantic, 'bpmn:ConditionalEventDefinition')) {
3545
+ return eventIconRenderers[ 'bpmn:ConditionalEventDefinition' ](parentGfx, element, attrs, isThrowing);
3546
+ }
3579
3547
 
3580
- if (!('fillOpacity' in attrs)) {
3581
- attrs.fillOpacity = DEFAULT_FILL_OPACITY;
3582
- }
3548
+ if (isTypedEvent(semantic, 'bpmn:SignalEventDefinition')) {
3549
+ return eventIconRenderers[ 'bpmn:SignalEventDefinition' ](parentGfx, element, attrs, isThrowing);
3550
+ }
3583
3551
 
3584
- return drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, attrs);
3585
- },
3552
+ if (isTypedEvent(semantic, 'bpmn:EscalationEventDefinition')) {
3553
+ return eventIconRenderers[ 'bpmn:EscalationEventDefinition' ](parentGfx, element, attrs, isThrowing);
3554
+ }
3586
3555
 
3587
- 'bpmn:Task': function(parentGfx, element) {
3588
- var attrs = {
3589
- fill: getFillColor(element, defaultFillColor),
3590
- stroke: getStrokeColor(element, defaultStrokeColor)
3591
- };
3556
+ if (isTypedEvent(semantic, 'bpmn:LinkEventDefinition')) {
3557
+ return eventIconRenderers[ 'bpmn:LinkEventDefinition' ](parentGfx, element, attrs, isThrowing);
3558
+ }
3592
3559
 
3593
- var rect = renderer('bpmn:Activity')(parentGfx, element, attrs);
3560
+ if (isTypedEvent(semantic, 'bpmn:ErrorEventDefinition')) {
3561
+ return eventIconRenderers[ 'bpmn:ErrorEventDefinition' ](parentGfx, element, attrs, isThrowing);
3562
+ }
3594
3563
 
3595
- renderEmbeddedLabel(parentGfx, element, 'center-middle');
3596
- attachTaskMarkers(parentGfx, element);
3564
+ if (isTypedEvent(semantic, 'bpmn:CancelEventDefinition')) {
3565
+ return eventIconRenderers[ 'bpmn:CancelEventDefinition' ](parentGfx, element, attrs, isThrowing);
3566
+ }
3597
3567
 
3598
- return rect;
3599
- },
3600
- 'bpmn:ServiceTask': function(parentGfx, element) {
3601
- var task = renderer('bpmn:Task')(parentGfx, element);
3568
+ if (isTypedEvent(semantic, 'bpmn:CompensateEventDefinition')) {
3569
+ return eventIconRenderers[ 'bpmn:CompensateEventDefinition' ](parentGfx, element, attrs, isThrowing);
3570
+ }
3602
3571
 
3603
- var pathDataBG = pathMap.getScaledPath('TASK_TYPE_SERVICE', {
3604
- abspos: {
3605
- x: 12,
3606
- y: 18
3572
+ if (isTypedEvent(semantic, 'bpmn:TerminateEventDefinition')) {
3573
+ return eventIconRenderers[ 'bpmn:TerminateEventDefinition' ](parentGfx, element, attrs, isThrowing);
3574
+ }
3575
+
3576
+ return null;
3577
+ }
3578
+
3579
+ var taskMarkerRenderers = {
3580
+ 'ParticipantMultiplicityMarker': function(parentGfx, element, attrs = {}) {
3581
+ var width = getWidth(element, attrs),
3582
+ height = getHeight(element, attrs);
3583
+
3584
+ var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', {
3585
+ xScaleFactor: 1,
3586
+ yScaleFactor: 1,
3587
+ containerWidth: width,
3588
+ containerHeight: height,
3589
+ position: {
3590
+ mx: ((width / 2 - 6) / width),
3591
+ my: (height - 15) / height
3607
3592
  }
3608
3593
  });
3609
3594
 
3610
- /* service bg */ drawPath(parentGfx, pathDataBG, {
3595
+ drawMarker('participant-multiplicity', parentGfx, markerPath, {
3596
+ strokeWidth: 2,
3597
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3598
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3599
+ });
3600
+ },
3601
+ 'SubProcessMarker': function(parentGfx, element, attrs = {}) {
3602
+ var markerRect = drawRect(parentGfx, 14, 14, 0, {
3611
3603
  strokeWidth: 1,
3612
- fill: getFillColor(element, defaultFillColor),
3613
- stroke: getStrokeColor(element, defaultStrokeColor)
3604
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3605
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3614
3606
  });
3615
3607
 
3616
- var fillPathData = pathMap.getScaledPath('TASK_TYPE_SERVICE_FILL', {
3617
- abspos: {
3618
- x: 17.2,
3619
- y: 18
3608
+ translate$1(markerRect, element.width / 2 - 7.5, element.height - 20);
3609
+
3610
+ var markerPath = pathMap.getScaledPath('MARKER_SUB_PROCESS', {
3611
+ xScaleFactor: 1.5,
3612
+ yScaleFactor: 1.5,
3613
+ containerWidth: element.width,
3614
+ containerHeight: element.height,
3615
+ position: {
3616
+ mx: (element.width / 2 - 7.5) / element.width,
3617
+ my: (element.height - 20) / element.height
3620
3618
  }
3621
3619
  });
3622
3620
 
3623
- /* service fill */ drawPath(parentGfx, fillPathData, {
3624
- strokeWidth: 0,
3625
- fill: getFillColor(element, defaultFillColor)
3621
+ drawMarker('sub-process', parentGfx, markerPath, {
3622
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3623
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3626
3624
  });
3625
+ },
3626
+ 'ParallelMarker': function(parentGfx, element, attrs) {
3627
+ var width = getWidth(element, attrs),
3628
+ height = getHeight(element, attrs);
3627
3629
 
3628
- var pathData = pathMap.getScaledPath('TASK_TYPE_SERVICE', {
3629
- abspos: {
3630
- x: 17,
3631
- y: 22
3630
+ var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', {
3631
+ xScaleFactor: 1,
3632
+ yScaleFactor: 1,
3633
+ containerWidth: width,
3634
+ containerHeight: height,
3635
+ position: {
3636
+ mx: ((width / 2 + attrs.parallel) / width),
3637
+ my: (height - 20) / height
3632
3638
  }
3633
3639
  });
3634
3640
 
3635
- /* service */ drawPath(parentGfx, pathData, {
3636
- strokeWidth: 1,
3637
- fill: getFillColor(element, defaultFillColor),
3638
- stroke: getStrokeColor(element, defaultStrokeColor)
3641
+ drawMarker('parallel', parentGfx, markerPath, {
3642
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3643
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3639
3644
  });
3640
-
3641
- return task;
3642
3645
  },
3643
- 'bpmn:UserTask': function(parentGfx, element) {
3644
- var task = renderer('bpmn:Task')(parentGfx, element);
3645
-
3646
- var x = 15;
3647
- var y = 12;
3648
-
3649
- var pathData = pathMap.getScaledPath('TASK_TYPE_USER_1', {
3650
- abspos: {
3651
- x: x,
3652
- y: y
3646
+ 'SequentialMarker': function(parentGfx, element, attrs) {
3647
+ var markerPath = pathMap.getScaledPath('MARKER_SEQUENTIAL', {
3648
+ xScaleFactor: 1,
3649
+ yScaleFactor: 1,
3650
+ containerWidth: element.width,
3651
+ containerHeight: element.height,
3652
+ position: {
3653
+ mx: ((element.width / 2 + attrs.seq) / element.width),
3654
+ my: (element.height - 19) / element.height
3653
3655
  }
3654
3656
  });
3655
3657
 
3656
- /* user path */ drawPath(parentGfx, pathData, {
3657
- strokeWidth: 0.5,
3658
- fill: getFillColor(element, defaultFillColor),
3659
- stroke: getStrokeColor(element, defaultStrokeColor)
3658
+ drawMarker('sequential', parentGfx, markerPath, {
3659
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3660
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3660
3661
  });
3661
-
3662
- var pathData2 = pathMap.getScaledPath('TASK_TYPE_USER_2', {
3663
- abspos: {
3664
- x: x,
3665
- y: y
3662
+ },
3663
+ 'CompensationMarker': function(parentGfx, element, attrs) {
3664
+ var markerMath = pathMap.getScaledPath('MARKER_COMPENSATION', {
3665
+ xScaleFactor: 1,
3666
+ yScaleFactor: 1,
3667
+ containerWidth: element.width,
3668
+ containerHeight: element.height,
3669
+ position: {
3670
+ mx: ((element.width / 2 + attrs.compensation) / element.width),
3671
+ my: (element.height - 13) / element.height
3666
3672
  }
3667
3673
  });
3668
3674
 
3669
- /* user2 path */ drawPath(parentGfx, pathData2, {
3670
- strokeWidth: 0.5,
3671
- fill: getFillColor(element, defaultFillColor),
3672
- stroke: getStrokeColor(element, defaultStrokeColor)
3675
+ drawMarker('compensation', parentGfx, markerMath, {
3676
+ strokeWidth: 1,
3677
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3678
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3673
3679
  });
3680
+ },
3681
+ 'LoopMarker': function(parentGfx, element, attrs) {
3682
+ var width = getWidth(element, attrs),
3683
+ height = getHeight(element, attrs);
3674
3684
 
3675
- var pathData3 = pathMap.getScaledPath('TASK_TYPE_USER_3', {
3676
- abspos: {
3677
- x: x,
3678
- y: y
3685
+ var markerPath = pathMap.getScaledPath('MARKER_LOOP', {
3686
+ xScaleFactor: 1,
3687
+ yScaleFactor: 1,
3688
+ containerWidth: width,
3689
+ containerHeight: height,
3690
+ position: {
3691
+ mx: ((width / 2 + attrs.loop) / width),
3692
+ my: (height - 7) / height
3679
3693
  }
3680
3694
  });
3681
3695
 
3682
- /* user3 path */ drawPath(parentGfx, pathData3, {
3683
- strokeWidth: 0.5,
3684
- fill: getStrokeColor(element, defaultStrokeColor),
3685
- stroke: getStrokeColor(element, defaultStrokeColor)
3696
+ drawMarker('loop', parentGfx, markerPath, {
3697
+ strokeWidth: 1.5,
3698
+ fill: 'none',
3699
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3700
+ strokeMiterlimit: 0.5
3686
3701
  });
3687
-
3688
- return task;
3689
3702
  },
3690
- 'bpmn:ManualTask': function(parentGfx, element) {
3691
- var task = renderer('bpmn:Task')(parentGfx, element);
3703
+ 'AdhocMarker': function(parentGfx, element, attrs) {
3704
+ var width = getWidth(element, attrs),
3705
+ height = getHeight(element, attrs);
3692
3706
 
3693
- var pathData = pathMap.getScaledPath('TASK_TYPE_MANUAL', {
3694
- abspos: {
3695
- x: 17,
3696
- y: 15
3707
+ var markerPath = pathMap.getScaledPath('MARKER_ADHOC', {
3708
+ xScaleFactor: 1,
3709
+ yScaleFactor: 1,
3710
+ containerWidth: width,
3711
+ containerHeight: height,
3712
+ position: {
3713
+ mx: ((width / 2 + attrs.adhoc) / width),
3714
+ my: (height - 15) / height
3697
3715
  }
3698
3716
  });
3699
3717
 
3700
- /* manual path */ drawPath(parentGfx, pathData, {
3701
- strokeWidth: 0.5, // 0.25,
3702
- fill: getFillColor(element, defaultFillColor),
3703
- stroke: getStrokeColor(element, defaultStrokeColor)
3718
+ drawMarker('adhoc', parentGfx, markerPath, {
3719
+ strokeWidth: 1,
3720
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3721
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3704
3722
  });
3723
+ }
3724
+ };
3705
3725
 
3706
- return task;
3707
- },
3708
- 'bpmn:SendTask': function(parentGfx, element) {
3709
- var task = renderer('bpmn:Task')(parentGfx, element);
3726
+ function renderTaskMarker(type, parentGfx, element, attrs) {
3727
+ taskMarkerRenderers[ type ](parentGfx, element, attrs);
3728
+ }
3710
3729
 
3711
- var pathData = pathMap.getScaledPath('TASK_TYPE_SEND', {
3730
+ function renderTaskMarkers(parentGfx, element, taskMarkers, attrs = {}) {
3731
+ attrs = {
3732
+ fill: attrs.fill,
3733
+ stroke: attrs.stroke,
3734
+ width: getWidth(element, attrs),
3735
+ height: getHeight(element, attrs)
3736
+ };
3737
+
3738
+ var semantic = getBusinessObject(element);
3739
+
3740
+ var subprocess = taskMarkers && taskMarkers.includes('SubProcessMarker');
3741
+
3742
+ if (subprocess) {
3743
+ attrs = {
3744
+ ...attrs,
3745
+ seq: -21,
3746
+ parallel: -22,
3747
+ compensation: -42,
3748
+ loop: -18,
3749
+ adhoc: 10
3750
+ };
3751
+ } else {
3752
+ attrs = {
3753
+ ...attrs,
3754
+ seq: -5,
3755
+ parallel: -6,
3756
+ compensation: -27,
3757
+ loop: 0,
3758
+ adhoc: 10
3759
+ };
3760
+ }
3761
+
3762
+ forEach$1(taskMarkers, function(marker) {
3763
+ renderTaskMarker(marker, parentGfx, element, attrs);
3764
+ });
3765
+
3766
+ if (semantic.get('isForCompensation')) {
3767
+ renderTaskMarker('CompensationMarker', parentGfx, element, attrs);
3768
+ }
3769
+
3770
+ if (is$1(semantic, 'bpmn:AdHocSubProcess')) {
3771
+ renderTaskMarker('AdhocMarker', parentGfx, element, attrs);
3772
+ }
3773
+
3774
+ var loopCharacteristics = semantic.get('loopCharacteristics'),
3775
+ isSequential = loopCharacteristics && loopCharacteristics.get('isSequential');
3776
+
3777
+ if (loopCharacteristics) {
3778
+
3779
+ if (isSequential === undefined) {
3780
+ renderTaskMarker('LoopMarker', parentGfx, element, attrs);
3781
+ }
3782
+
3783
+ if (isSequential === false) {
3784
+ renderTaskMarker('ParallelMarker', parentGfx, element, attrs);
3785
+ }
3786
+
3787
+ if (isSequential === true) {
3788
+ renderTaskMarker('SequentialMarker', parentGfx, element, attrs);
3789
+ }
3790
+ }
3791
+ }
3792
+
3793
+ function renderLabel(parentGfx, label, attrs = {}) {
3794
+ attrs = assign$1({
3795
+ size: {
3796
+ width: 100
3797
+ }
3798
+ }, attrs);
3799
+
3800
+ var text = textRenderer.createText(label || '', attrs);
3801
+
3802
+ classes$1(text).add('djs-label');
3803
+
3804
+ append(parentGfx, text);
3805
+
3806
+ return text;
3807
+ }
3808
+
3809
+ function renderEmbeddedLabel(parentGfx, element, align, attrs = {}) {
3810
+ var semantic = getBusinessObject(element);
3811
+
3812
+ var box = getBounds({
3813
+ x: element.x,
3814
+ y: element.y,
3815
+ width: element.width,
3816
+ height: element.height
3817
+ }, attrs);
3818
+
3819
+ return renderLabel(parentGfx, semantic.name, {
3820
+ align,
3821
+ box,
3822
+ padding: 7,
3823
+ style: {
3824
+ fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
3825
+ }
3826
+ });
3827
+ }
3828
+
3829
+ function renderExternalLabel(parentGfx, element, attrs = {}) {
3830
+ var box = {
3831
+ width: 90,
3832
+ height: 30,
3833
+ x: element.width / 2 + element.x,
3834
+ y: element.height / 2 + element.y
3835
+ };
3836
+
3837
+ return renderLabel(parentGfx, getLabel(element), {
3838
+ box: box,
3839
+ fitBox: true,
3840
+ style: assign$1(
3841
+ {},
3842
+ textRenderer.getExternalStyle(),
3843
+ {
3844
+ fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
3845
+ }
3846
+ )
3847
+ });
3848
+ }
3849
+
3850
+ function renderLaneLabel(parentGfx, text, element, attrs = {}) {
3851
+ var isHorizontalLane = isHorizontal(element);
3852
+
3853
+ var textBox = renderLabel(parentGfx, text, {
3854
+ box: {
3855
+ height: 30,
3856
+ width: isHorizontalLane ? getHeight(element, attrs) : getWidth(element, attrs),
3857
+ },
3858
+ align: 'center-middle',
3859
+ style: {
3860
+ fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
3861
+ }
3862
+ });
3863
+
3864
+ if (isHorizontalLane) {
3865
+ var top = -1 * getHeight(element, attrs);
3866
+ transform(textBox, 0, -top, 270);
3867
+ }
3868
+ }
3869
+
3870
+ function renderActivity(parentGfx, element, attrs = {}) {
3871
+ var {
3872
+ width,
3873
+ height
3874
+ } = getBounds(element, attrs);
3875
+
3876
+ return drawRect(parentGfx, width, height, TASK_BORDER_RADIUS, {
3877
+ ...attrs,
3878
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3879
+ fillOpacity: DEFAULT_OPACITY,
3880
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3881
+ });
3882
+ }
3883
+
3884
+ function renderAssociation(parentGfx, element, attrs = {}) {
3885
+ var semantic = getBusinessObject(element);
3886
+
3887
+ var fill = getFillColor(element, defaultFillColor, attrs.fill),
3888
+ stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
3889
+
3890
+ if (semantic.get('associationDirection') === 'One' ||
3891
+ semantic.get('associationDirection') === 'Both') {
3892
+ attrs.markerEnd = marker('association-end', fill, stroke);
3893
+ }
3894
+
3895
+ if (semantic.get('associationDirection') === 'Both') {
3896
+ attrs.markerStart = marker('association-start', fill, stroke);
3897
+ }
3898
+
3899
+ attrs = pickAttrs(attrs, [
3900
+ 'markerStart',
3901
+ 'markerEnd'
3902
+ ]);
3903
+
3904
+ return drawConnectionSegments(parentGfx, element.waypoints, {
3905
+ ...attrs,
3906
+ stroke,
3907
+ strokeDasharray: '0, 5'
3908
+ });
3909
+ }
3910
+
3911
+ function renderDataObject(parentGfx, element, attrs = {}) {
3912
+ var fill = getFillColor(element, defaultFillColor, attrs.fill),
3913
+ stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
3914
+
3915
+ var pathData = pathMap.getScaledPath('DATA_OBJECT_PATH', {
3916
+ xScaleFactor: 1,
3917
+ yScaleFactor: 1,
3918
+ containerWidth: element.width,
3919
+ containerHeight: element.height,
3920
+ position: {
3921
+ mx: 0.474,
3922
+ my: 0.296
3923
+ }
3924
+ });
3925
+
3926
+ var dataObject = drawPath(parentGfx, pathData, {
3927
+ fill,
3928
+ fillOpacity: DEFAULT_OPACITY,
3929
+ stroke
3930
+ });
3931
+
3932
+ var semantic = getBusinessObject(element);
3933
+
3934
+ if (isCollection(semantic)) {
3935
+ var collectionPathData = pathMap.getScaledPath('DATA_OBJECT_COLLECTION_PATH', {
3712
3936
  xScaleFactor: 1,
3713
3937
  yScaleFactor: 1,
3714
- containerWidth: 21,
3715
- containerHeight: 14,
3938
+ containerWidth: element.width,
3939
+ containerHeight: element.height,
3716
3940
  position: {
3717
- mx: 0.285,
3718
- my: 0.357
3941
+ mx: 0.33,
3942
+ my: (element.height - 18) / element.height
3719
3943
  }
3720
3944
  });
3721
3945
 
3722
- /* send path */ drawPath(parentGfx, pathData, {
3723
- strokeWidth: 1,
3724
- fill: getStrokeColor(element, defaultStrokeColor),
3725
- stroke: getFillColor(element, defaultFillColor)
3946
+ drawPath(parentGfx, collectionPathData, {
3947
+ strokeWidth: 2,
3948
+ fill,
3949
+ stroke
3726
3950
  });
3951
+ }
3727
3952
 
3728
- return task;
3729
- },
3730
- 'bpmn:ReceiveTask' : function(parentGfx, element) {
3731
- var semantic = getBusinessObject(element);
3953
+ return dataObject;
3954
+ }
3732
3955
 
3733
- var task = renderer('bpmn:Task')(parentGfx, element);
3734
- var pathData;
3956
+ function renderEvent(parentGfx, element, attrs = {}) {
3957
+ return drawCircle(parentGfx, element.width, element.height, {
3958
+ fillOpacity: DEFAULT_OPACITY,
3959
+ ...attrs,
3960
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3961
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3962
+ });
3963
+ }
3735
3964
 
3736
- if (semantic.instantiate) {
3737
- drawCircle(parentGfx, 28, 28, 20 * 0.22, { strokeWidth: 1 });
3965
+ function renderGateway(parentGfx, element, attrs = {}) {
3966
+ return drawDiamond(parentGfx, element.width, element.height, {
3967
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3968
+ fillOpacity: DEFAULT_OPACITY,
3969
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3970
+ });
3971
+ }
3738
3972
 
3739
- pathData = pathMap.getScaledPath('TASK_TYPE_INSTANTIATING_SEND', {
3740
- abspos: {
3741
- x: 7.77,
3742
- y: 9.52
3743
- }
3744
- });
3745
- } else {
3973
+ function renderLane(parentGfx, element, attrs = {}) {
3974
+ var lane = drawRect(parentGfx, getWidth(element, attrs), getHeight(element, attrs), 0, {
3975
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3976
+ fillOpacity: attrs.fillOpacity || DEFAULT_OPACITY,
3977
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3978
+ strokeWidth: 1.5
3979
+ });
3746
3980
 
3747
- pathData = pathMap.getScaledPath('TASK_TYPE_SEND', {
3748
- xScaleFactor: 0.9,
3749
- yScaleFactor: 0.9,
3750
- containerWidth: 21,
3751
- containerHeight: 14,
3752
- position: {
3753
- mx: 0.3,
3754
- my: 0.4
3755
- }
3756
- });
3757
- }
3981
+ var semantic = getBusinessObject(element);
3758
3982
 
3759
- /* receive path */ drawPath(parentGfx, pathData, {
3760
- strokeWidth: 1,
3761
- fill: getFillColor(element, defaultFillColor),
3762
- stroke: getStrokeColor(element, defaultStrokeColor)
3983
+ if (is$1(semantic, 'bpmn:Lane')) {
3984
+ var text = semantic.get('name');
3985
+
3986
+ renderLaneLabel(parentGfx, text, element, attrs);
3987
+ }
3988
+
3989
+ return lane;
3990
+ }
3991
+
3992
+ function renderSubProcess(parentGfx, element, attrs = {}) {
3993
+ var activity = renderActivity(parentGfx, element, attrs);
3994
+
3995
+ if (isEventSubProcess(element)) {
3996
+ attr$1(activity, {
3997
+ strokeDasharray: '0, 5.5',
3998
+ strokeWidth: 2.5
3763
3999
  });
4000
+ }
3764
4001
 
3765
- return task;
4002
+ var expanded = isExpanded(element);
4003
+
4004
+ renderEmbeddedLabel(parentGfx, element, expanded ? 'center-top' : 'center-middle', attrs);
4005
+
4006
+ if (expanded) {
4007
+ renderTaskMarkers(parentGfx, element, undefined, attrs);
4008
+ } else {
4009
+ renderTaskMarkers(parentGfx, element, [ 'SubProcessMarker' ], attrs);
4010
+ }
4011
+
4012
+ return activity;
4013
+ }
4014
+
4015
+ function renderTask(parentGfx, element, attrs = {}) {
4016
+ var activity = renderActivity(parentGfx, element, attrs);
4017
+
4018
+ renderEmbeddedLabel(parentGfx, element, 'center-middle', attrs);
4019
+
4020
+ renderTaskMarkers(parentGfx, element, undefined, attrs);
4021
+
4022
+ return activity;
4023
+ }
4024
+
4025
+ var handlers = this.handlers = {
4026
+ 'bpmn:AdHocSubProcess': function(parentGfx, element, attrs = {}) {
4027
+ if (isExpanded(element)) {
4028
+ attrs = pickAttrs(attrs, [
4029
+ 'fill',
4030
+ 'stroke',
4031
+ 'width',
4032
+ 'height'
4033
+ ]);
4034
+ } else {
4035
+ attrs = pickAttrs(attrs, [
4036
+ 'fill',
4037
+ 'stroke'
4038
+ ]);
4039
+ }
4040
+
4041
+ return renderSubProcess(parentGfx, element, attrs);
3766
4042
  },
3767
- 'bpmn:ScriptTask': function(parentGfx, element) {
3768
- var task = renderer('bpmn:Task')(parentGfx, element);
4043
+ 'bpmn:Association': function(parentGfx, element, attrs = {}) {
4044
+ attrs = pickAttrs(attrs, [
4045
+ 'fill',
4046
+ 'stroke'
4047
+ ]);
3769
4048
 
3770
- var pathData = pathMap.getScaledPath('TASK_TYPE_SCRIPT', {
3771
- abspos: {
3772
- x: 15,
3773
- y: 20
3774
- }
3775
- });
4049
+ return renderAssociation(parentGfx, element, attrs);
4050
+ },
4051
+ 'bpmn:BoundaryEvent': function(parentGfx, element, attrs = {}) {
4052
+ var { renderIcon = true } = attrs;
3776
4053
 
3777
- /* script path */ drawPath(parentGfx, pathData, {
3778
- strokeWidth: 1,
3779
- stroke: getStrokeColor(element, defaultStrokeColor)
4054
+ attrs = pickAttrs(attrs, [
4055
+ 'fill',
4056
+ 'stroke'
4057
+ ]);
4058
+
4059
+ var semantic = getBusinessObject(element),
4060
+ cancelActivity = semantic.get('cancelActivity');
4061
+
4062
+ attrs = {
4063
+ strokeWidth: 1.5,
4064
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4065
+ fillOpacity: FULL_OPACITY,
4066
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
4067
+ };
4068
+
4069
+ if (!cancelActivity) {
4070
+ attrs.strokeDasharray = '6';
4071
+ }
4072
+
4073
+ var event = renderEvent(parentGfx, element, attrs);
4074
+
4075
+ drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {
4076
+ ...attrs,
4077
+ fill: 'none'
3780
4078
  });
3781
4079
 
3782
- return task;
4080
+ if (renderIcon) {
4081
+ renderEventIcon(element, parentGfx, attrs);
4082
+ }
4083
+
4084
+ return event;
3783
4085
  },
3784
- 'bpmn:BusinessRuleTask': function(parentGfx, element) {
3785
- var task = renderer('bpmn:Task')(parentGfx, element);
4086
+ 'bpmn:BusinessRuleTask': function(parentGfx, element, attrs = {}) {
4087
+ attrs = pickAttrs(attrs, [
4088
+ 'fill',
4089
+ 'stroke'
4090
+ ]);
3786
4091
 
3787
- var headerPathData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_HEADER', {
4092
+ var task = renderTask(parentGfx, element, attrs);
4093
+
4094
+ var headerData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_MAIN', {
3788
4095
  abspos: {
3789
4096
  x: 8,
3790
4097
  y: 8
3791
4098
  }
3792
4099
  });
3793
4100
 
3794
- var businessHeaderPath = drawPath(parentGfx, headerPathData);
3795
- attr$1(businessHeaderPath, {
3796
- strokeWidth: 1,
3797
- fill: getFillColor(element, '#aaaaaa'),
3798
- stroke: getStrokeColor(element, defaultStrokeColor)
4101
+ var businessPath = drawPath(parentGfx, headerData);
4102
+
4103
+ attr$1(businessPath, {
4104
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4105
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4106
+ strokeWidth: 1
3799
4107
  });
3800
4108
 
3801
- var headerData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_MAIN', {
4109
+ var headerPathData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_HEADER', {
3802
4110
  abspos: {
3803
4111
  x: 8,
3804
4112
  y: 8
3805
4113
  }
3806
4114
  });
3807
4115
 
3808
- var businessPath = drawPath(parentGfx, headerData);
3809
- attr$1(businessPath, {
3810
- strokeWidth: 1,
3811
- stroke: getStrokeColor(element, defaultStrokeColor)
4116
+ var businessHeaderPath = drawPath(parentGfx, headerPathData);
4117
+
4118
+ attr$1(businessHeaderPath, {
4119
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4120
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4121
+ strokeWidth: 1
3812
4122
  });
3813
4123
 
3814
4124
  return task;
3815
4125
  },
3816
- 'bpmn:SubProcess': function(parentGfx, element, attrs) {
3817
- attrs = {
3818
- fill: getFillColor(element, defaultFillColor),
3819
- stroke: getStrokeColor(element, defaultStrokeColor),
4126
+ 'bpmn:CallActivity': function(parentGfx, element, attrs = {}) {
4127
+ attrs = pickAttrs(attrs, [
4128
+ 'fill',
4129
+ 'stroke'
4130
+ ]);
4131
+
4132
+ return renderSubProcess(parentGfx, element, {
4133
+ strokeWidth: 5,
3820
4134
  ...attrs
3821
- };
4135
+ });
4136
+ },
4137
+ 'bpmn:ComplexGateway': function(parentGfx, element, attrs = {}) {
4138
+ attrs = pickAttrs(attrs, [
4139
+ 'fill',
4140
+ 'stroke'
4141
+ ]);
3822
4142
 
3823
- var rect = renderer('bpmn:Activity')(parentGfx, element, attrs);
4143
+ var gateway = renderGateway(parentGfx, element, attrs);
3824
4144
 
3825
- var expanded = isExpanded(element);
4145
+ var pathData = pathMap.getScaledPath('GATEWAY_COMPLEX', {
4146
+ xScaleFactor: 0.5,
4147
+ yScaleFactor:0.5,
4148
+ containerWidth: element.width,
4149
+ containerHeight: element.height,
4150
+ position: {
4151
+ mx: 0.46,
4152
+ my: 0.26
4153
+ }
4154
+ });
3826
4155
 
3827
- if (isEventSubProcess(element)) {
3828
- attr$1(rect, {
3829
- strokeDasharray: '0, 5.5',
3830
- strokeWidth: 2.5
3831
- });
3832
- }
4156
+ drawPath(parentGfx, pathData, {
4157
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4158
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4159
+ strokeWidth: 1
4160
+ });
3833
4161
 
3834
- renderEmbeddedLabel(parentGfx, element, expanded ? 'center-top' : 'center-middle');
4162
+ return gateway;
4163
+ },
4164
+ 'bpmn:DataInput': function(parentGfx, element, attrs = {}) {
4165
+ attrs = pickAttrs(attrs, [
4166
+ 'fill',
4167
+ 'stroke'
4168
+ ]);
3835
4169
 
3836
- if (expanded) {
3837
- attachTaskMarkers(parentGfx, element);
3838
- } else {
3839
- attachTaskMarkers(parentGfx, element, [ 'SubProcessMarker' ]);
3840
- }
4170
+ var arrowPathData = pathMap.getRawPath('DATA_ARROW');
3841
4171
 
3842
- return rect;
3843
- },
3844
- 'bpmn:AdHocSubProcess': function(parentGfx, element) {
3845
- return renderer('bpmn:SubProcess')(parentGfx, element);
3846
- },
3847
- 'bpmn:Transaction': function(parentGfx, element) {
3848
- var outer = renderer('bpmn:SubProcess')(parentGfx, element, { strokeWidth: 1.5 });
4172
+ var dataObject = renderDataObject(parentGfx, element, attrs);
3849
4173
 
3850
- var innerAttrs = styles.style([ 'no-fill', 'no-events' ], {
3851
- stroke: getStrokeColor(element, defaultStrokeColor),
3852
- strokeWidth: 1.5
4174
+ drawPath(parentGfx, arrowPathData, {
4175
+ fill: 'none',
4176
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4177
+ strokeWidth: 1
3853
4178
  });
3854
4179
 
3855
- /* inner path */ drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS - 3, INNER_OUTER_DIST, innerAttrs);
3856
-
3857
- return outer;
4180
+ return dataObject;
3858
4181
  },
3859
- 'bpmn:CallActivity': function(parentGfx, element) {
3860
- return renderer('bpmn:SubProcess')(parentGfx, element, {
3861
- strokeWidth: 5
4182
+ 'bpmn:DataInputAssociation': function(parentGfx, element, attrs = {}) {
4183
+ attrs = pickAttrs(attrs, [
4184
+ 'fill',
4185
+ 'stroke'
4186
+ ]);
4187
+
4188
+ return renderAssociation(parentGfx, element, {
4189
+ ...attrs,
4190
+ markerEnd: marker('association-end', getFillColor(element, defaultFillColor, attrs.fill), getStrokeColor(element, defaultStrokeColor, attrs.stroke))
3862
4191
  });
3863
4192
  },
3864
- 'bpmn:Participant': function(parentGfx, element) {
3865
-
3866
- var strokeWidth = 1.5;
3867
-
3868
- var attrs = {
3869
- fillOpacity: DEFAULT_FILL_OPACITY,
3870
- fill: getFillColor(element, defaultFillColor),
3871
- stroke: getStrokeColor(element, defaultStrokeColor),
3872
- strokeWidth
3873
- };
3874
-
3875
- var lane = renderer('bpmn:Lane')(parentGfx, element, attrs);
3876
-
3877
- var expandedPool = isExpanded(element);
3878
-
3879
- if (expandedPool) {
3880
- drawLine(parentGfx, [
3881
- { x: 30, y: 0 },
3882
- { x: 30, y: element.height }
3883
- ], {
3884
- stroke: getStrokeColor(element, defaultStrokeColor),
3885
- strokeWidth
3886
- });
3887
- var text = getBusinessObject(element).name;
3888
- renderLaneLabel(parentGfx, text, element);
3889
- } else {
3890
-
3891
- // collapsed pool draw text inline
3892
- var text2 = getBusinessObject(element).name;
3893
- renderLabel(parentGfx, text2, {
3894
- box: element, align: 'center-middle',
3895
- style: {
3896
- fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
3897
- }
3898
- });
3899
- }
3900
-
3901
- var participantMultiplicity = !!(getBusinessObject(element).participantMultiplicity);
4193
+ 'bpmn:DataObject': function(parentGfx, element, attrs = {}) {
4194
+ attrs = pickAttrs(attrs, [
4195
+ 'fill',
4196
+ 'stroke'
4197
+ ]);
3902
4198
 
3903
- if (participantMultiplicity) {
3904
- renderer('ParticipantMultiplicityMarker')(parentGfx, element);
3905
- }
3906
-
3907
- return lane;
4199
+ return renderDataObject(parentGfx, element, attrs);
3908
4200
  },
3909
- 'bpmn:Lane': function(parentGfx, element, attrs) {
3910
- var rect = drawRect(parentGfx, element.width, element.height, 0, {
3911
- fill: getFillColor(element, defaultFillColor),
3912
- fillOpacity: HIGH_FILL_OPACITY,
3913
- stroke: getStrokeColor(element, defaultStrokeColor),
3914
- strokeWidth: 1.5,
3915
- ...attrs
3916
- });
3917
-
3918
- var semantic = getBusinessObject(element);
4201
+ 'bpmn:DataObjectReference': as('bpmn:DataObject'),
4202
+ 'bpmn:DataOutput': function(parentGfx, element, attrs = {}) {
4203
+ attrs = pickAttrs(attrs, [
4204
+ 'fill',
4205
+ 'stroke'
4206
+ ]);
3919
4207
 
3920
- if (semantic.$type === 'bpmn:Lane') {
3921
- var text = semantic.name;
3922
- renderLaneLabel(parentGfx, text, element);
3923
- }
4208
+ var arrowPathData = pathMap.getRawPath('DATA_ARROW');
3924
4209
 
3925
- return rect;
3926
- },
3927
- 'bpmn:InclusiveGateway': function(parentGfx, element) {
3928
- var diamond = renderer('bpmn:Gateway')(parentGfx, element);
4210
+ var dataObject = renderDataObject(parentGfx, element, attrs);
3929
4211
 
3930
- /* circle path */
3931
- drawCircle(parentGfx, element.width, element.height, element.height * 0.24, {
3932
- strokeWidth: 2.5,
3933
- fill: getFillColor(element, defaultFillColor),
3934
- stroke: getStrokeColor(element, defaultStrokeColor)
4212
+ drawPath(parentGfx, arrowPathData, {
4213
+ strokeWidth: 1,
4214
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4215
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3935
4216
  });
3936
4217
 
3937
- return diamond;
4218
+ return dataObject;
3938
4219
  },
3939
- 'bpmn:ExclusiveGateway': function(parentGfx, element) {
3940
- var diamond = renderer('bpmn:Gateway')(parentGfx, element);
4220
+ 'bpmn:DataOutputAssociation': function(parentGfx, element, attrs = {}) {
4221
+ attrs = pickAttrs(attrs, [
4222
+ 'fill',
4223
+ 'stroke'
4224
+ ]);
3941
4225
 
3942
- var pathData = pathMap.getScaledPath('GATEWAY_EXCLUSIVE', {
3943
- xScaleFactor: 0.4,
3944
- yScaleFactor: 0.4,
3945
- containerWidth: element.width,
3946
- containerHeight: element.height,
3947
- position: {
3948
- mx: 0.32,
3949
- my: 0.3
3950
- }
4226
+ return renderAssociation(parentGfx, element, {
4227
+ ...attrs,
4228
+ markerEnd: marker('association-end', getFillColor(element, defaultFillColor, attrs.fill), getStrokeColor(element, defaultStrokeColor, attrs.stroke))
3951
4229
  });
3952
-
3953
- if ((getDi(element).isMarkerVisible)) {
3954
- drawPath(parentGfx, pathData, {
3955
- strokeWidth: 1,
3956
- fill: getStrokeColor(element, defaultStrokeColor),
3957
- stroke: getStrokeColor(element, defaultStrokeColor)
3958
- });
3959
- }
3960
-
3961
- return diamond;
3962
4230
  },
3963
- 'bpmn:ComplexGateway': function(parentGfx, element) {
3964
- var diamond = renderer('bpmn:Gateway')(parentGfx, element);
4231
+ 'bpmn:DataStoreReference': function(parentGfx, element, attrs = {}) {
4232
+ attrs = pickAttrs(attrs, [
4233
+ 'fill',
4234
+ 'stroke'
4235
+ ]);
3965
4236
 
3966
- var pathData = pathMap.getScaledPath('GATEWAY_COMPLEX', {
3967
- xScaleFactor: 0.5,
3968
- yScaleFactor:0.5,
4237
+ var dataStorePath = pathMap.getScaledPath('DATA_STORE', {
4238
+ xScaleFactor: 1,
4239
+ yScaleFactor: 1,
3969
4240
  containerWidth: element.width,
3970
4241
  containerHeight: element.height,
3971
4242
  position: {
3972
- mx: 0.46,
3973
- my: 0.26
4243
+ mx: 0,
4244
+ my: 0.133
3974
4245
  }
3975
4246
  });
3976
4247
 
3977
- /* complex path */ drawPath(parentGfx, pathData, {
3978
- strokeWidth: 1,
3979
- fill: getStrokeColor(element, defaultStrokeColor),
3980
- stroke: getStrokeColor(element, defaultStrokeColor)
4248
+ return drawPath(parentGfx, dataStorePath, {
4249
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4250
+ fillOpacity: DEFAULT_OPACITY,
4251
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4252
+ strokeWidth: 2
3981
4253
  });
3982
-
3983
- return diamond;
3984
4254
  },
3985
- 'bpmn:ParallelGateway': function(parentGfx, element) {
3986
- var diamond = renderer('bpmn:Gateway')(parentGfx, element);
4255
+ 'bpmn:EndEvent': function(parentGfx, element, attrs = {}) {
4256
+ var { renderIcon = true } = attrs;
3987
4257
 
3988
- var pathData = pathMap.getScaledPath('GATEWAY_PARALLEL', {
3989
- xScaleFactor: 0.6,
3990
- yScaleFactor:0.6,
3991
- containerWidth: element.width,
3992
- containerHeight: element.height,
3993
- position: {
3994
- mx: 0.46,
3995
- my: 0.2
3996
- }
3997
- });
4258
+ attrs = pickAttrs(attrs, [
4259
+ 'fill',
4260
+ 'stroke'
4261
+ ]);
3998
4262
 
3999
- /* parallel path */ drawPath(parentGfx, pathData, {
4000
- strokeWidth: 1,
4001
- fill: getStrokeColor(element, defaultStrokeColor),
4002
- stroke: getStrokeColor(element, defaultStrokeColor)
4263
+ var event = renderEvent(parentGfx, element, {
4264
+ ...attrs,
4265
+ strokeWidth: 4
4003
4266
  });
4004
4267
 
4005
- return diamond;
4268
+ if (renderIcon) {
4269
+ renderEventIcon(element, parentGfx, attrs);
4270
+ }
4271
+
4272
+ return event;
4006
4273
  },
4007
- 'bpmn:EventBasedGateway': function(parentGfx, element) {
4274
+ 'bpmn:EventBasedGateway': function(parentGfx, element, attrs = {}) {
4275
+ attrs = pickAttrs(attrs, [
4276
+ 'fill',
4277
+ 'stroke'
4278
+ ]);
4008
4279
 
4009
4280
  var semantic = getBusinessObject(element);
4010
4281
 
4011
- var diamond = renderer('bpmn:Gateway')(parentGfx, element);
4282
+ var diamond = renderGateway(parentGfx, element, attrs);
4012
4283
 
4013
- /* outer circle path */ drawCircle(parentGfx, element.width, element.height, element.height * 0.20, {
4014
- strokeWidth: 1,
4015
- fill: 'none',
4016
- stroke: getStrokeColor(element, defaultStrokeColor)
4284
+ drawCircle(parentGfx, element.width, element.height, element.height * 0.20, {
4285
+ fill: getFillColor(element, 'none', attrs.fill),
4286
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4287
+ strokeWidth: 1
4017
4288
  });
4018
4289
 
4019
- var type = semantic.eventGatewayType;
4020
- var instantiate = !!semantic.instantiate;
4290
+ var type = semantic.get('eventGatewayType'),
4291
+ instantiate = !!semantic.get('instantiate');
4021
4292
 
4022
4293
  function drawEvent() {
4023
4294
 
@@ -4032,18 +4303,17 @@
4032
4303
  }
4033
4304
  });
4034
4305
 
4035
- /* event path */ drawPath(parentGfx, pathData, {
4036
- strokeWidth: 2,
4037
- fill: getFillColor(element, 'none'),
4038
- stroke: getStrokeColor(element, defaultStrokeColor)
4306
+ drawPath(parentGfx, pathData, {
4307
+ fill: 'none',
4308
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4309
+ strokeWidth: 2
4039
4310
  });
4040
4311
  }
4041
4312
 
4042
4313
  if (type === 'Parallel') {
4043
-
4044
4314
  var pathData = pathMap.getScaledPath('GATEWAY_PARALLEL', {
4045
4315
  xScaleFactor: 0.4,
4046
- yScaleFactor:0.4,
4316
+ yScaleFactor: 0.4,
4047
4317
  containerWidth: element.width,
4048
4318
  containerHeight: element.height,
4049
4319
  position: {
@@ -4053,16 +4323,16 @@
4053
4323
  });
4054
4324
 
4055
4325
  drawPath(parentGfx, pathData, {
4056
- strokeWidth: 1,
4057
- fill: 'none'
4326
+ fill: 'none',
4327
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4328
+ strokeWidth: 1
4058
4329
  });
4059
4330
  } else if (type === 'Exclusive') {
4060
-
4061
4331
  if (!instantiate) {
4062
4332
  drawCircle(parentGfx, element.width, element.height, element.height * 0.26, {
4063
- strokeWidth: 1,
4064
4333
  fill: 'none',
4065
- stroke: getStrokeColor(element, defaultStrokeColor)
4334
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4335
+ strokeWidth: 1
4066
4336
  });
4067
4337
  }
4068
4338
 
@@ -4072,104 +4342,163 @@
4072
4342
 
4073
4343
  return diamond;
4074
4344
  },
4075
- 'bpmn:Gateway': function(parentGfx, element) {
4076
- return drawDiamond(parentGfx, element.width, element.height, {
4077
- fill: getFillColor(element, defaultFillColor),
4078
- fillOpacity: DEFAULT_FILL_OPACITY,
4079
- stroke: getStrokeColor(element, defaultStrokeColor)
4080
- });
4081
- },
4082
- 'bpmn:SequenceFlow': function(parentGfx, element) {
4083
- var fill = getFillColor(element, defaultFillColor),
4084
- stroke = getStrokeColor(element, defaultStrokeColor);
4345
+ 'bpmn:ExclusiveGateway': function(parentGfx, element, attrs = {}) {
4346
+ attrs = pickAttrs(attrs, [
4347
+ 'fill',
4348
+ 'stroke'
4349
+ ]);
4085
4350
 
4086
- var path = drawConnectionSegments(parentGfx, element.waypoints, {
4087
- markerEnd: marker('sequenceflow-end', fill, stroke),
4088
- stroke: getStrokeColor(element, defaultStrokeColor)
4089
- });
4351
+ var gateway = renderGateway(parentGfx, element, attrs);
4090
4352
 
4091
- var sequenceFlow = getBusinessObject(element);
4353
+ var pathData = pathMap.getScaledPath('GATEWAY_EXCLUSIVE', {
4354
+ xScaleFactor: 0.4,
4355
+ yScaleFactor: 0.4,
4356
+ containerWidth: element.width,
4357
+ containerHeight: element.height,
4358
+ position: {
4359
+ mx: 0.32,
4360
+ my: 0.3
4361
+ }
4362
+ });
4092
4363
 
4093
- var source;
4364
+ var di = getDi(element);
4094
4365
 
4095
- if (element.source) {
4096
- source = element.source.businessObject;
4366
+ if (di.get('isMarkerVisible')) {
4367
+ drawPath(parentGfx, pathData, {
4368
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4369
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4370
+ strokeWidth: 1
4371
+ });
4372
+ }
4097
4373
 
4098
- // conditional flow marker
4099
- if (sequenceFlow.conditionExpression && source.$instanceOf('bpmn:Activity')) {
4100
- attr$1(path, {
4101
- markerStart: marker('conditional-flow-marker', fill, stroke)
4102
- });
4103
- }
4374
+ return gateway;
4375
+ },
4376
+ 'bpmn:Gateway': function(parentGfx, element, attrs = {}) {
4377
+ attrs = pickAttrs(attrs, [
4378
+ 'fill',
4379
+ 'stroke'
4380
+ ]);
4104
4381
 
4105
- // default marker
4106
- if (source.default && (source.$instanceOf('bpmn:Gateway') || source.$instanceOf('bpmn:Activity')) &&
4107
- source.default === sequenceFlow) {
4108
- attr$1(path, {
4109
- markerStart: marker('conditional-default-flow-marker', fill, stroke)
4110
- });
4111
- }
4112
- }
4382
+ return renderGateway(parentGfx, element, attrs);
4383
+ },
4384
+ 'bpmn:Group': function(parentGfx, element, attrs = {}) {
4385
+ attrs = pickAttrs(attrs, [
4386
+ 'fill',
4387
+ 'stroke',
4388
+ 'width',
4389
+ 'height'
4390
+ ]);
4113
4391
 
4114
- return path;
4392
+ return drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, {
4393
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4394
+ strokeWidth: 1.5,
4395
+ strokeDasharray: '10, 6, 0, 6',
4396
+ fill: 'none',
4397
+ pointerEvents: 'none',
4398
+ width: getWidth(element, attrs),
4399
+ height: getHeight(element, attrs)
4400
+ });
4115
4401
  },
4116
- 'bpmn:Association': function(parentGfx, element, attrs) {
4402
+ 'bpmn:InclusiveGateway': function(parentGfx, element, attrs = {}) {
4403
+ attrs = pickAttrs(attrs, [
4404
+ 'fill',
4405
+ 'stroke'
4406
+ ]);
4117
4407
 
4118
- var semantic = getBusinessObject(element);
4408
+ var gateway = renderGateway(parentGfx, element, attrs);
4409
+
4410
+ drawCircle(parentGfx, element.width, element.height, element.height * 0.24, {
4411
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4412
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4413
+ strokeWidth: 2.5
4414
+ });
4119
4415
 
4120
- var fill = getFillColor(element, defaultFillColor),
4121
- stroke = getStrokeColor(element, defaultStrokeColor);
4416
+ return gateway;
4417
+ },
4418
+ 'bpmn:IntermediateEvent': function(parentGfx, element, attrs = {}) {
4419
+ var { renderIcon = true } = attrs;
4122
4420
 
4123
- attrs = {
4124
- strokeDasharray: '0, 5',
4125
- stroke: getStrokeColor(element, defaultStrokeColor),
4126
- ...attrs
4127
- };
4421
+ attrs = pickAttrs(attrs, [
4422
+ 'fill',
4423
+ 'stroke'
4424
+ ]);
4128
4425
 
4129
- if (semantic.associationDirection === 'One' ||
4130
- semantic.associationDirection === 'Both') {
4131
- attrs.markerEnd = marker('association-end', fill, stroke);
4132
- }
4426
+ var outer = renderEvent(parentGfx, element, {
4427
+ ...attrs,
4428
+ strokeWidth: 1.5
4429
+ });
4430
+
4431
+ drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {
4432
+ fill: 'none',
4433
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4434
+ strokeWidth: 1.5
4435
+ });
4133
4436
 
4134
- if (semantic.associationDirection === 'Both') {
4135
- attrs.markerStart = marker('association-start', fill, stroke);
4437
+ if (renderIcon) {
4438
+ renderEventIcon(element, parentGfx, attrs);
4136
4439
  }
4137
4440
 
4138
- return drawConnectionSegments(parentGfx, element.waypoints, attrs);
4441
+ return outer;
4139
4442
  },
4140
- 'bpmn:DataInputAssociation': function(parentGfx, element) {
4141
- var fill = getFillColor(element, defaultFillColor),
4142
- stroke = getStrokeColor(element, defaultStrokeColor);
4143
-
4144
- return renderer('bpmn:Association')(parentGfx, element, {
4145
- markerEnd: marker('association-end', fill, stroke)
4443
+ 'bpmn:IntermediateCatchEvent': as('bpmn:IntermediateEvent'),
4444
+ 'bpmn:IntermediateThrowEvent': as('bpmn:IntermediateEvent'),
4445
+ 'bpmn:Lane': function(parentGfx, element, attrs = {}) {
4446
+ attrs = pickAttrs(attrs, [
4447
+ 'fill',
4448
+ 'stroke',
4449
+ 'width',
4450
+ 'height'
4451
+ ]);
4452
+
4453
+ return renderLane(parentGfx, element, {
4454
+ ...attrs,
4455
+ fillOpacity: LOW_OPACITY
4146
4456
  });
4147
4457
  },
4148
- 'bpmn:DataOutputAssociation': function(parentGfx, element) {
4149
- var fill = getFillColor(element, defaultFillColor),
4150
- stroke = getStrokeColor(element, defaultStrokeColor);
4458
+ 'bpmn:ManualTask': function(parentGfx, element, attrs = {}) {
4459
+ attrs = pickAttrs(attrs, [
4460
+ 'fill',
4461
+ 'stroke'
4462
+ ]);
4463
+
4464
+ var task = renderTask(parentGfx, element, attrs);
4465
+
4466
+ var pathData = pathMap.getScaledPath('TASK_TYPE_MANUAL', {
4467
+ abspos: {
4468
+ x: 17,
4469
+ y: 15
4470
+ }
4471
+ });
4151
4472
 
4152
- return renderer('bpmn:Association')(parentGfx, element, {
4153
- markerEnd: marker('association-end', fill, stroke)
4473
+ drawPath(parentGfx, pathData, {
4474
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4475
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4476
+ strokeWidth: 0.5
4154
4477
  });
4478
+
4479
+ return task;
4155
4480
  },
4156
- 'bpmn:MessageFlow': function(parentGfx, element) {
4481
+ 'bpmn:MessageFlow': function(parentGfx, element, attrs = {}) {
4482
+ attrs = pickAttrs(attrs, [
4483
+ 'fill',
4484
+ 'stroke'
4485
+ ]);
4157
4486
 
4158
4487
  var semantic = getBusinessObject(element),
4159
4488
  di = getDi(element);
4160
4489
 
4161
- var fill = getFillColor(element, defaultFillColor),
4162
- stroke = getStrokeColor(element, defaultStrokeColor);
4490
+ var fill = getFillColor(element, defaultFillColor, attrs.fill),
4491
+ stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
4163
4492
 
4164
4493
  var path = drawConnectionSegments(parentGfx, element.waypoints, {
4165
4494
  markerEnd: marker('messageflow-end', fill, stroke),
4166
4495
  markerStart: marker('messageflow-start', fill, stroke),
4496
+ stroke,
4167
4497
  strokeDasharray: '10, 11',
4168
- strokeWidth: 1.5,
4169
- stroke: getStrokeColor(element, defaultStrokeColor)
4498
+ strokeWidth: 1.5
4170
4499
  });
4171
4500
 
4172
- if (semantic.messageRef) {
4501
+ if (semantic.get('messageRef')) {
4173
4502
  var midPoint = path.getPointAtLength(path.getTotalLength() / 2);
4174
4503
 
4175
4504
  var markerPathData = pathMap.getScaledPath('MESSAGE_FLOW_MARKER', {
@@ -4179,404 +4508,518 @@
4179
4508
  }
4180
4509
  });
4181
4510
 
4182
- var messageAttrs = { strokeWidth: 1 };
4511
+ var messageAttrs = {
4512
+ strokeWidth: 1
4513
+ };
4514
+
4515
+ if (di.get('messageVisibleKind') === 'initiating') {
4516
+ messageAttrs.fill = fill;
4517
+ messageAttrs.stroke = stroke;
4518
+ } else {
4519
+ messageAttrs.fill = stroke;
4520
+ messageAttrs.stroke = fill;
4521
+ }
4522
+
4523
+ var message = drawPath(parentGfx, markerPathData, messageAttrs);
4524
+
4525
+ var messageRef = semantic.get('messageRef'),
4526
+ name = messageRef.get('name');
4527
+
4528
+ var label = renderLabel(parentGfx, name, {
4529
+ align: 'center-top',
4530
+ fitBox: true,
4531
+ style: {
4532
+ fill: stroke
4533
+ }
4534
+ });
4535
+
4536
+ var messageBounds = message.getBBox(),
4537
+ labelBounds = label.getBBox();
4538
+
4539
+ var translateX = midPoint.x - labelBounds.width / 2,
4540
+ translateY = midPoint.y + messageBounds.height / 2 + ELEMENT_LABEL_DISTANCE;
4541
+
4542
+ transform(label, translateX, translateY, 0);
4543
+ }
4544
+
4545
+ return path;
4546
+ },
4547
+ 'bpmn:ParallelGateway': function(parentGfx, element, attrs = {}) {
4548
+ attrs = pickAttrs(attrs, [
4549
+ 'fill',
4550
+ 'stroke'
4551
+ ]);
4552
+
4553
+ var diamond = renderGateway(parentGfx, element, attrs);
4554
+
4555
+ var pathData = pathMap.getScaledPath('GATEWAY_PARALLEL', {
4556
+ xScaleFactor: 0.6,
4557
+ yScaleFactor: 0.6,
4558
+ containerWidth: element.width,
4559
+ containerHeight: element.height,
4560
+ position: {
4561
+ mx: 0.46,
4562
+ my: 0.2
4563
+ }
4564
+ });
4565
+
4566
+ drawPath(parentGfx, pathData, {
4567
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4568
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4569
+ strokeWidth: 1
4570
+ });
4571
+
4572
+ return diamond;
4573
+ },
4574
+ 'bpmn:Participant': function(parentGfx, element, attrs = {}) {
4575
+ attrs = pickAttrs(attrs, [
4576
+ 'fill',
4577
+ 'stroke',
4578
+ 'width',
4579
+ 'height'
4580
+ ]);
4581
+
4582
+ var participant = renderLane(parentGfx, element, attrs);
4583
+
4584
+ var expandedParticipant = isExpanded(element);
4585
+ var horizontalParticipant = isHorizontal(element);
4586
+
4587
+ var semantic = getBusinessObject(element),
4588
+ name = semantic.get('name');
4589
+
4590
+ if (expandedParticipant) {
4591
+ var waypoints = horizontalParticipant ? [
4592
+ {
4593
+ x: 30,
4594
+ y: 0
4595
+ },
4596
+ {
4597
+ x: 30,
4598
+ y: getHeight(element, attrs)
4599
+ }
4600
+ ] : [
4601
+ {
4602
+ x: 0,
4603
+ y: 30
4604
+ },
4605
+ {
4606
+ x: getWidth(element, attrs),
4607
+ y: 30
4608
+ }
4609
+ ];
4610
+
4611
+ drawLine(parentGfx, waypoints, {
4612
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4613
+ strokeWidth: PARTICIPANT_STROKE_WIDTH
4614
+ });
4615
+
4616
+ renderLaneLabel(parentGfx, name, element, attrs);
4617
+ } else {
4618
+ var bounds = getBounds(element, attrs);
4183
4619
 
4184
- if (di.messageVisibleKind === 'initiating') {
4185
- messageAttrs.fill = 'white';
4186
- messageAttrs.stroke = black;
4187
- } else {
4188
- messageAttrs.fill = '#888';
4189
- messageAttrs.stroke = 'white';
4620
+ if (!horizontalParticipant) {
4621
+ bounds.height = getWidth(element, attrs);
4622
+ bounds.width = getHeight(element, attrs);
4190
4623
  }
4191
4624
 
4192
- var message = drawPath(parentGfx, markerPathData, messageAttrs);
4193
-
4194
- var labelText = semantic.messageRef.name;
4195
- var label = renderLabel(parentGfx, labelText, {
4196
- align: 'center-top',
4197
- fitBox: true,
4625
+ var textBox = renderLabel(parentGfx, name, {
4626
+ box: bounds,
4627
+ align: 'center-middle',
4198
4628
  style: {
4199
- fill: getStrokeColor(element, defaultLabelColor)
4629
+ fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
4200
4630
  }
4201
4631
  });
4202
4632
 
4203
- var messageBounds = message.getBBox(),
4204
- labelBounds = label.getBBox();
4205
-
4206
- var translateX = midPoint.x - labelBounds.width / 2,
4207
- translateY = midPoint.y + messageBounds.height / 2 + ELEMENT_LABEL_DISTANCE;
4208
-
4209
- transform(label, translateX, translateY, 0);
4633
+ if (!horizontalParticipant) {
4634
+ var top = -1 * getHeight(element, attrs);
4635
+ transform(textBox, 0, -top, 270);
4636
+ }
4637
+ }
4210
4638
 
4639
+ if (semantic.get('participantMultiplicity')) {
4640
+ renderTaskMarker('ParticipantMultiplicityMarker', parentGfx, element, attrs);
4211
4641
  }
4212
4642
 
4213
- return path;
4643
+ return participant;
4214
4644
  },
4215
- 'bpmn:DataObject': function(parentGfx, element) {
4216
- var pathData = pathMap.getScaledPath('DATA_OBJECT_PATH', {
4217
- xScaleFactor: 1,
4218
- yScaleFactor: 1,
4219
- containerWidth: element.width,
4220
- containerHeight: element.height,
4221
- position: {
4222
- mx: 0.474,
4223
- my: 0.296
4224
- }
4225
- });
4226
-
4227
- var elementObject = drawPath(parentGfx, pathData, {
4228
- fill: getFillColor(element, defaultFillColor),
4229
- fillOpacity: DEFAULT_FILL_OPACITY,
4230
- stroke: getStrokeColor(element, defaultStrokeColor)
4231
- });
4645
+ 'bpmn:ReceiveTask' : function(parentGfx, element, attrs = {}) {
4646
+ attrs = pickAttrs(attrs, [
4647
+ 'fill',
4648
+ 'stroke'
4649
+ ]);
4232
4650
 
4233
4651
  var semantic = getBusinessObject(element);
4234
4652
 
4235
- if (isCollection(semantic)) {
4236
- renderDataItemCollection(parentGfx, element);
4237
- }
4653
+ var task = renderTask(parentGfx, element, attrs);
4238
4654
 
4239
- return elementObject;
4240
- },
4241
- 'bpmn:DataObjectReference': as('bpmn:DataObject'),
4242
- 'bpmn:DataInput': function(parentGfx, element) {
4655
+ var pathData;
4243
4656
 
4244
- var arrowPathData = pathMap.getRawPath('DATA_ARROW');
4657
+ if (semantic.get('instantiate')) {
4658
+ drawCircle(parentGfx, 28, 28, 20 * 0.22, {
4659
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4660
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4661
+ strokeWidth: 1
4662
+ });
4245
4663
 
4246
- // page
4247
- var elementObject = renderer('bpmn:DataObject')(parentGfx, element);
4664
+ pathData = pathMap.getScaledPath('TASK_TYPE_INSTANTIATING_SEND', {
4665
+ abspos: {
4666
+ x: 7.77,
4667
+ y: 9.52
4668
+ }
4669
+ });
4670
+ } else {
4671
+ pathData = pathMap.getScaledPath('TASK_TYPE_SEND', {
4672
+ xScaleFactor: 0.9,
4673
+ yScaleFactor: 0.9,
4674
+ containerWidth: 21,
4675
+ containerHeight: 14,
4676
+ position: {
4677
+ mx: 0.3,
4678
+ my: 0.4
4679
+ }
4680
+ });
4681
+ }
4248
4682
 
4249
- /* input arrow path */ drawPath(parentGfx, arrowPathData, { strokeWidth: 1 });
4683
+ drawPath(parentGfx, pathData, {
4684
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4685
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4686
+ strokeWidth: 1
4687
+ });
4250
4688
 
4251
- return elementObject;
4689
+ return task;
4252
4690
  },
4253
- 'bpmn:DataOutput': function(parentGfx, element) {
4254
- var arrowPathData = pathMap.getRawPath('DATA_ARROW');
4691
+ 'bpmn:ScriptTask': function(parentGfx, element, attrs = {}) {
4692
+ attrs = pickAttrs(attrs, [
4693
+ 'fill',
4694
+ 'stroke'
4695
+ ]);
4255
4696
 
4256
- // page
4257
- var elementObject = renderer('bpmn:DataObject')(parentGfx, element);
4697
+ var task = renderTask(parentGfx, element, attrs);
4258
4698
 
4259
- /* output arrow path */ drawPath(parentGfx, arrowPathData, {
4260
- strokeWidth: 1,
4261
- fill: black
4699
+ var pathData = pathMap.getScaledPath('TASK_TYPE_SCRIPT', {
4700
+ abspos: {
4701
+ x: 15,
4702
+ y: 20
4703
+ }
4704
+ });
4705
+
4706
+ drawPath(parentGfx, pathData, {
4707
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4708
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4709
+ strokeWidth: 1
4262
4710
  });
4263
4711
 
4264
- return elementObject;
4712
+ return task;
4265
4713
  },
4266
- 'bpmn:DataStoreReference': function(parentGfx, element) {
4267
- var DATA_STORE_PATH = pathMap.getScaledPath('DATA_STORE', {
4714
+ 'bpmn:SendTask': function(parentGfx, element, attrs = {}) {
4715
+ attrs = pickAttrs(attrs, [
4716
+ 'fill',
4717
+ 'stroke'
4718
+ ]);
4719
+
4720
+ var task = renderTask(parentGfx, element, attrs);
4721
+
4722
+ var pathData = pathMap.getScaledPath('TASK_TYPE_SEND', {
4268
4723
  xScaleFactor: 1,
4269
4724
  yScaleFactor: 1,
4270
- containerWidth: element.width,
4271
- containerHeight: element.height,
4725
+ containerWidth: 21,
4726
+ containerHeight: 14,
4272
4727
  position: {
4273
- mx: 0,
4274
- my: 0.133
4728
+ mx: 0.285,
4729
+ my: 0.357
4275
4730
  }
4276
4731
  });
4277
4732
 
4278
- var elementStore = drawPath(parentGfx, DATA_STORE_PATH, {
4279
- strokeWidth: 2,
4280
- fill: getFillColor(element, defaultFillColor),
4281
- fillOpacity: DEFAULT_FILL_OPACITY,
4282
- stroke: getStrokeColor(element, defaultStrokeColor)
4733
+ drawPath(parentGfx, pathData, {
4734
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4735
+ stroke: getFillColor(element, defaultFillColor, attrs.fill),
4736
+ strokeWidth: 1
4283
4737
  });
4284
4738
 
4285
- return elementStore;
4739
+ return task;
4286
4740
  },
4287
- 'bpmn:BoundaryEvent': function(parentGfx, element, options) {
4741
+ 'bpmn:SequenceFlow': function(parentGfx, element, attrs = {}) {
4742
+ attrs = pickAttrs(attrs, [
4743
+ 'fill',
4744
+ 'stroke'
4745
+ ]);
4288
4746
 
4289
- var semantic = getBusinessObject(element),
4290
- cancel = semantic.cancelActivity;
4291
-
4292
- var attrs = {
4293
- strokeWidth: 1.5,
4294
- fill: getFillColor(element, defaultFillColor),
4295
- stroke: getStrokeColor(element, defaultStrokeColor)
4296
- };
4747
+ var fill = getFillColor(element, defaultFillColor, attrs.fill),
4748
+ stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
4297
4749
 
4298
- if (!cancel) {
4299
- attrs.strokeDasharray = '6';
4300
- }
4750
+ var connection = drawConnectionSegments(parentGfx, element.waypoints, {
4751
+ markerEnd: marker('sequenceflow-end', fill, stroke),
4752
+ stroke
4753
+ });
4301
4754
 
4302
- // apply fillOpacity
4303
- var outerAttrs = {
4304
- ...attrs,
4305
- fillOpacity: 1
4306
- };
4755
+ var semantic = getBusinessObject(element);
4307
4756
 
4308
- // apply no-fill
4309
- var innerAttrs = {
4310
- ...attrs,
4311
- fill: 'none'
4312
- };
4757
+ var { source } = element;
4313
4758
 
4314
- var outer = renderer('bpmn:Event')(parentGfx, element, outerAttrs);
4759
+ if (source) {
4760
+ var sourceSemantic = getBusinessObject(source);
4315
4761
 
4316
- /* inner path */ drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, innerAttrs);
4762
+ // conditional flow marker
4763
+ if (semantic.get('conditionExpression') && is$1(sourceSemantic, 'bpmn:Activity')) {
4764
+ attr$1(connection, {
4765
+ markerStart: marker('conditional-flow-marker', fill, stroke)
4766
+ });
4767
+ }
4317
4768
 
4318
- if (!options || options.renderIcon !== false) {
4319
- renderEventContent(element, parentGfx);
4769
+ // default marker
4770
+ if (sourceSemantic.get('default') && (is$1(sourceSemantic, 'bpmn:Gateway') || is$1(sourceSemantic, 'bpmn:Activity')) &&
4771
+ sourceSemantic.get('default') === semantic) {
4772
+ attr$1(connection, {
4773
+ markerStart: marker('conditional-default-flow-marker', fill, stroke)
4774
+ });
4775
+ }
4320
4776
  }
4321
4777
 
4322
- return outer;
4323
- },
4324
- 'bpmn:Group': function(parentGfx, element) {
4325
- return drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, {
4326
- stroke: getStrokeColor(element, defaultStrokeColor),
4327
- strokeWidth: 1.5,
4328
- strokeDasharray: '10,6,0,6',
4329
- fill: 'none',
4330
- pointerEvents: 'none'
4331
- });
4778
+ return connection;
4332
4779
  },
4333
- 'label': function(parentGfx, element) {
4334
- return renderExternalLabel(parentGfx, element);
4335
- },
4336
- 'bpmn:TextAnnotation': function(parentGfx, element) {
4337
- var textElement = drawRect(parentGfx, element.width, element.height, 0, 0, {
4338
- 'fill': 'none',
4339
- 'stroke': 'none'
4780
+ 'bpmn:ServiceTask': function(parentGfx, element, attrs = {}) {
4781
+ attrs = pickAttrs(attrs, [
4782
+ 'fill',
4783
+ 'stroke'
4784
+ ]);
4785
+
4786
+ var task = renderTask(parentGfx, element, attrs);
4787
+
4788
+ drawCircle(parentGfx, 10, 10, {
4789
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4790
+ stroke: 'none',
4791
+ transform: 'translate(6, 6)'
4340
4792
  });
4341
4793
 
4342
- var textPathData = pathMap.getScaledPath('TEXT_ANNOTATION', {
4343
- xScaleFactor: 1,
4344
- yScaleFactor: 1,
4345
- containerWidth: element.width,
4346
- containerHeight: element.height,
4347
- position: {
4348
- mx: 0.0,
4349
- my: 0.0
4794
+ var pathDataService1 = pathMap.getScaledPath('TASK_TYPE_SERVICE', {
4795
+ abspos: {
4796
+ x: 12,
4797
+ y: 18
4350
4798
  }
4351
4799
  });
4352
4800
 
4353
- drawPath(parentGfx, textPathData, {
4354
- stroke: getStrokeColor(element, defaultStrokeColor)
4801
+ drawPath(parentGfx, pathDataService1, {
4802
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4803
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4804
+ strokeWidth: 1
4355
4805
  });
4356
4806
 
4357
- var text = getBusinessObject(element).text || '';
4358
- renderLabel(parentGfx, text, {
4359
- box: element,
4360
- align: 'left-top',
4361
- padding: 7,
4362
- style: {
4363
- fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
4364
- }
4807
+ drawCircle(parentGfx, 10, 10, {
4808
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4809
+ stroke: 'none',
4810
+ transform: 'translate(11, 10)'
4365
4811
  });
4366
4812
 
4367
- return textElement;
4368
- },
4369
- 'ParticipantMultiplicityMarker': function(parentGfx, element) {
4370
- var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', {
4371
- xScaleFactor: 1,
4372
- yScaleFactor: 1,
4373
- containerWidth: element.width,
4374
- containerHeight: element.height,
4375
- position: {
4376
- mx: ((element.width / 2) / element.width),
4377
- my: (element.height - 15) / element.height
4813
+ var pathDataService2 = pathMap.getScaledPath('TASK_TYPE_SERVICE', {
4814
+ abspos: {
4815
+ x: 17,
4816
+ y: 22
4378
4817
  }
4379
4818
  });
4380
4819
 
4381
- drawMarker('participant-multiplicity', parentGfx, markerPath, {
4382
- strokeWidth: 2,
4383
- fill: getFillColor(element, defaultFillColor),
4384
- stroke: getStrokeColor(element, defaultStrokeColor)
4820
+ drawPath(parentGfx, pathDataService2, {
4821
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4822
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4823
+ strokeWidth: 1
4385
4824
  });
4825
+
4826
+ return task;
4386
4827
  },
4387
- 'SubProcessMarker': function(parentGfx, element) {
4388
- var markerRect = drawRect(parentGfx, 14, 14, 0, {
4389
- strokeWidth: 1,
4390
- fill: getFillColor(element, defaultFillColor),
4391
- stroke: getStrokeColor(element, defaultStrokeColor)
4392
- });
4828
+ 'bpmn:StartEvent': function(parentGfx, element, attrs = {}) {
4829
+ var { renderIcon = true } = attrs;
4393
4830
 
4394
- // Process marker is placed in the middle of the box
4395
- // therefore fixed values can be used here
4396
- translate$1(markerRect, element.width / 2 - 7.5, element.height - 20);
4831
+ attrs = pickAttrs(attrs, [
4832
+ 'fill',
4833
+ 'stroke'
4834
+ ]);
4397
4835
 
4398
- var markerPath = pathMap.getScaledPath('MARKER_SUB_PROCESS', {
4399
- xScaleFactor: 1.5,
4400
- yScaleFactor: 1.5,
4401
- containerWidth: element.width,
4402
- containerHeight: element.height,
4403
- position: {
4404
- mx: (element.width / 2 - 7.5) / element.width,
4405
- my: (element.height - 20) / element.height
4406
- }
4407
- });
4836
+ var semantic = getBusinessObject(element);
4408
4837
 
4409
- drawMarker('sub-process', parentGfx, markerPath, {
4410
- fill: getFillColor(element, defaultFillColor),
4411
- stroke: getStrokeColor(element, defaultStrokeColor)
4412
- });
4838
+ if (!semantic.get('isInterrupting')) {
4839
+ attrs = {
4840
+ ...attrs,
4841
+ strokeDasharray: '6'
4842
+ };
4843
+ }
4844
+
4845
+ var event = renderEvent(parentGfx, element, attrs);
4846
+
4847
+ if (renderIcon) {
4848
+ renderEventIcon(element, parentGfx, attrs);
4849
+ }
4850
+
4851
+ return event;
4413
4852
  },
4414
- 'ParallelMarker': function(parentGfx, element, position) {
4415
- var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', {
4416
- xScaleFactor: 1,
4417
- yScaleFactor: 1,
4418
- containerWidth: element.width,
4419
- containerHeight: element.height,
4420
- position: {
4421
- mx: ((element.width / 2 + position.parallel) / element.width),
4422
- my: (element.height - 20) / element.height
4423
- }
4424
- });
4853
+ 'bpmn:SubProcess': function(parentGfx, element, attrs = {}) {
4854
+ if (isExpanded(element)) {
4855
+ attrs = pickAttrs(attrs, [
4856
+ 'fill',
4857
+ 'stroke',
4858
+ 'width',
4859
+ 'height'
4860
+ ]);
4861
+ } else {
4862
+ attrs = pickAttrs(attrs, [
4863
+ 'fill',
4864
+ 'stroke'
4865
+ ]);
4866
+ }
4425
4867
 
4426
- drawMarker('parallel', parentGfx, markerPath, {
4427
- fill: getFillColor(element, defaultFillColor),
4428
- stroke: getStrokeColor(element, defaultStrokeColor)
4429
- });
4868
+ return renderSubProcess(parentGfx, element, attrs);
4430
4869
  },
4431
- 'SequentialMarker': function(parentGfx, element, position) {
4432
- var markerPath = pathMap.getScaledPath('MARKER_SEQUENTIAL', {
4433
- xScaleFactor: 1,
4434
- yScaleFactor: 1,
4435
- containerWidth: element.width,
4436
- containerHeight: element.height,
4437
- position: {
4438
- mx: ((element.width / 2 + position.seq) / element.width),
4439
- my: (element.height - 19) / element.height
4440
- }
4441
- });
4870
+ 'bpmn:Task': function(parentGfx, element, attrs = {}) {
4871
+ attrs = pickAttrs(attrs, [
4872
+ 'fill',
4873
+ 'stroke'
4874
+ ]);
4442
4875
 
4443
- drawMarker('sequential', parentGfx, markerPath, {
4444
- fill: getFillColor(element, defaultFillColor),
4445
- stroke: getStrokeColor(element, defaultStrokeColor)
4446
- });
4876
+ return renderTask(parentGfx, element, attrs);
4447
4877
  },
4448
- 'CompensationMarker': function(parentGfx, element, position) {
4449
- var markerMath = pathMap.getScaledPath('MARKER_COMPENSATION', {
4450
- xScaleFactor: 1,
4451
- yScaleFactor: 1,
4452
- containerWidth: element.width,
4453
- containerHeight: element.height,
4454
- position: {
4455
- mx: ((element.width / 2 + position.compensation) / element.width),
4456
- my: (element.height - 13) / element.height
4457
- }
4878
+ 'bpmn:TextAnnotation': function(parentGfx, element, attrs = {}) {
4879
+ attrs = pickAttrs(attrs, [
4880
+ 'fill',
4881
+ 'stroke',
4882
+ 'width',
4883
+ 'height'
4884
+ ]);
4885
+
4886
+ var {
4887
+ width,
4888
+ height
4889
+ } = getBounds(element, attrs);
4890
+
4891
+ var textElement = drawRect(parentGfx, width, height, 0, 0, {
4892
+ fill: 'none',
4893
+ stroke: 'none'
4458
4894
  });
4459
4895
 
4460
- drawMarker('compensation', parentGfx, markerMath, {
4461
- strokeWidth: 1,
4462
- fill: getFillColor(element, defaultFillColor),
4463
- stroke: getStrokeColor(element, defaultStrokeColor)
4464
- });
4465
- },
4466
- 'LoopMarker': function(parentGfx, element, position) {
4467
- var markerPath = pathMap.getScaledPath('MARKER_LOOP', {
4896
+ var textPathData = pathMap.getScaledPath('TEXT_ANNOTATION', {
4468
4897
  xScaleFactor: 1,
4469
4898
  yScaleFactor: 1,
4470
- containerWidth: element.width,
4471
- containerHeight: element.height,
4899
+ containerWidth: width,
4900
+ containerHeight: height,
4472
4901
  position: {
4473
- mx: ((element.width / 2 + position.loop) / element.width),
4474
- my: (element.height - 7) / element.height
4902
+ mx: 0.0,
4903
+ my: 0.0
4475
4904
  }
4476
4905
  });
4477
4906
 
4478
- drawMarker('loop', parentGfx, markerPath, {
4479
- strokeWidth: 1.5,
4480
- fill: getFillColor(element, defaultFillColor),
4481
- stroke: getStrokeColor(element, defaultStrokeColor),
4482
- strokeMiterlimit: 0.5
4483
- });
4484
- },
4485
- 'AdhocMarker': function(parentGfx, element, position) {
4486
- var markerPath = pathMap.getScaledPath('MARKER_ADHOC', {
4487
- xScaleFactor: 1,
4488
- yScaleFactor: 1,
4489
- containerWidth: element.width,
4490
- containerHeight: element.height,
4491
- position: {
4492
- mx: ((element.width / 2 + position.adhoc) / element.width),
4493
- my: (element.height - 15) / element.height
4494
- }
4907
+ drawPath(parentGfx, textPathData, {
4908
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
4495
4909
  });
4496
4910
 
4497
- drawMarker('adhoc', parentGfx, markerPath, {
4498
- strokeWidth: 1,
4499
- fill: getStrokeColor(element, defaultStrokeColor),
4500
- stroke: getStrokeColor(element, defaultStrokeColor)
4911
+ var semantic = getBusinessObject(element),
4912
+ text = semantic.get('text') || '';
4913
+
4914
+ renderLabel(parentGfx, text, {
4915
+ align: 'left-top',
4916
+ box: getBounds(element, attrs),
4917
+ padding: 7,
4918
+ style: {
4919
+ fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
4920
+ }
4501
4921
  });
4502
- }
4503
- };
4504
4922
 
4505
- function attachTaskMarkers(parentGfx, element, taskMarkers) {
4506
- var obj = getBusinessObject(element);
4923
+ return textElement;
4924
+ },
4925
+ 'bpmn:Transaction': function(parentGfx, element, attrs = {}) {
4926
+ if (isExpanded(element)) {
4927
+ attrs = pickAttrs(attrs, [
4928
+ 'fill',
4929
+ 'stroke',
4930
+ 'width',
4931
+ 'height'
4932
+ ]);
4933
+ } else {
4934
+ attrs = pickAttrs(attrs, [
4935
+ 'fill',
4936
+ 'stroke'
4937
+ ]);
4938
+ }
4507
4939
 
4508
- var subprocess = taskMarkers && taskMarkers.indexOf('SubProcessMarker') !== -1;
4509
- var position;
4940
+ var outer = renderSubProcess(parentGfx, element, {
4941
+ strokeWidth: 1.5,
4942
+ ...attrs
4943
+ });
4510
4944
 
4511
- if (subprocess) {
4512
- position = {
4513
- seq: -21,
4514
- parallel: -22,
4515
- compensation: -42,
4516
- loop: -18,
4517
- adhoc: 10
4518
- };
4519
- } else {
4520
- position = {
4521
- seq: -3,
4522
- parallel: -6,
4523
- compensation: -27,
4524
- loop: 0,
4525
- adhoc: 10
4526
- };
4527
- }
4945
+ var innerAttrs = styles.style([ 'no-fill', 'no-events' ], {
4946
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4947
+ strokeWidth: 1.5
4948
+ });
4528
4949
 
4529
- forEach$1(taskMarkers, function(marker) {
4530
- renderer(marker)(parentGfx, element, position);
4531
- });
4950
+ var expanded = isExpanded(element);
4532
4951
 
4533
- if (obj.isForCompensation) {
4534
- renderer('CompensationMarker')(parentGfx, element, position);
4535
- }
4952
+ if (!expanded) {
4953
+ attrs = {};
4954
+ }
4536
4955
 
4537
- if (obj.$type === 'bpmn:AdHocSubProcess') {
4538
- renderer('AdhocMarker')(parentGfx, element, position);
4539
- }
4956
+ drawRect(
4957
+ parentGfx,
4958
+ getWidth(element, attrs),
4959
+ getHeight(element, attrs),
4960
+ TASK_BORDER_RADIUS - INNER_OUTER_DIST,
4961
+ INNER_OUTER_DIST,
4962
+ innerAttrs
4963
+ );
4540
4964
 
4541
- var loopCharacteristics = obj.loopCharacteristics,
4542
- isSequential = loopCharacteristics && loopCharacteristics.isSequential;
4965
+ return outer;
4966
+ },
4967
+ 'bpmn:UserTask': function(parentGfx, element, attrs = {}) {
4968
+ attrs = pickAttrs(attrs, [
4969
+ 'fill',
4970
+ 'stroke'
4971
+ ]);
4543
4972
 
4544
- if (loopCharacteristics) {
4973
+ var task = renderTask(parentGfx, element, attrs);
4545
4974
 
4546
- if (isSequential === undefined) {
4547
- renderer('LoopMarker')(parentGfx, element, position);
4548
- }
4975
+ var x = 15;
4976
+ var y = 12;
4549
4977
 
4550
- if (isSequential === false) {
4551
- renderer('ParallelMarker')(parentGfx, element, position);
4552
- }
4978
+ var pathDataUser1 = pathMap.getScaledPath('TASK_TYPE_USER_1', {
4979
+ abspos: {
4980
+ x: x,
4981
+ y: y
4982
+ }
4983
+ });
4553
4984
 
4554
- if (isSequential === true) {
4555
- renderer('SequentialMarker')(parentGfx, element, position);
4556
- }
4557
- }
4558
- }
4985
+ drawPath(parentGfx, pathDataUser1, {
4986
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4987
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4988
+ strokeWidth: 0.5
4989
+ });
4559
4990
 
4560
- function renderDataItemCollection(parentGfx, element) {
4991
+ var pathDataUser2 = pathMap.getScaledPath('TASK_TYPE_USER_2', {
4992
+ abspos: {
4993
+ x: x,
4994
+ y: y
4995
+ }
4996
+ });
4561
4997
 
4562
- var yPosition = (element.height - 18) / element.height;
4998
+ drawPath(parentGfx, pathDataUser2, {
4999
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
5000
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
5001
+ strokeWidth: 0.5
5002
+ });
4563
5003
 
4564
- var pathData = pathMap.getScaledPath('DATA_OBJECT_COLLECTION_PATH', {
4565
- xScaleFactor: 1,
4566
- yScaleFactor: 1,
4567
- containerWidth: element.width,
4568
- containerHeight: element.height,
4569
- position: {
4570
- mx: 0.33,
4571
- my: yPosition
4572
- }
4573
- });
5004
+ var pathDataUser3 = pathMap.getScaledPath('TASK_TYPE_USER_3', {
5005
+ abspos: {
5006
+ x: x,
5007
+ y: y
5008
+ }
5009
+ });
4574
5010
 
4575
- /* collection path */ drawPath(parentGfx, pathData, {
4576
- strokeWidth: 2
4577
- });
4578
- }
5011
+ drawPath(parentGfx, pathDataUser3, {
5012
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
5013
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
5014
+ strokeWidth: 0.5
5015
+ });
4579
5016
 
5017
+ return task;
5018
+ },
5019
+ 'label': function(parentGfx, element, attrs = {}) {
5020
+ return renderExternalLabel(parentGfx, element, attrs);
5021
+ }
5022
+ };
4580
5023
 
4581
5024
  // extension API, use at your own risk
4582
5025
  this._drawPath = drawPath;
@@ -4611,15 +5054,16 @@
4611
5054
  *
4612
5055
  * @param {SVGElement} parentGfx
4613
5056
  * @param {Element} element
5057
+ * @param {Attrs} [attrs]
4614
5058
  *
4615
5059
  * @return {SVGElement} mainGfx
4616
5060
  */
4617
- BpmnRenderer.prototype.drawShape = function(parentGfx, element) {
4618
- var type = element.type;
4619
- var h = this._renderer(type);
5061
+ BpmnRenderer.prototype.drawShape = function(parentGfx, element, attrs = {}) {
5062
+ var { type } = element;
4620
5063
 
4621
- /* jshint -W040 */
4622
- return h(parentGfx, element);
5064
+ var handler = this._renderer(type);
5065
+
5066
+ return handler(parentGfx, element, attrs);
4623
5067
  };
4624
5068
 
4625
5069
  /**
@@ -4627,15 +5071,16 @@
4627
5071
  *
4628
5072
  * @param {SVGElement} parentGfx
4629
5073
  * @param {Element} element
5074
+ * @param {Attrs} [attrs]
4630
5075
  *
4631
5076
  * @return {SVGElement} mainGfx
4632
5077
  */
4633
- BpmnRenderer.prototype.drawConnection = function(parentGfx, element) {
4634
- var type = element.type;
4635
- var h = this._renderer(type);
5078
+ BpmnRenderer.prototype.drawConnection = function(parentGfx, element, attrs = {}) {
5079
+ var { type } = element;
5080
+
5081
+ var handler = this._renderer(type);
4636
5082
 
4637
- /* jshint -W040 */
4638
- return h(parentGfx, element);
5083
+ return handler(parentGfx, element, attrs);
4639
5084
  };
4640
5085
 
4641
5086
  /**
@@ -4646,7 +5091,6 @@
4646
5091
  * @return {string} path
4647
5092
  */
4648
5093
  BpmnRenderer.prototype.getShapePath = function(element) {
4649
-
4650
5094
  if (is$1(element, 'bpmn:Event')) {
4651
5095
  return getCirclePath(element);
4652
5096
  }
@@ -4662,6 +5106,24 @@
4662
5106
  return getRectPath(element);
4663
5107
  };
4664
5108
 
5109
+ /**
5110
+ * Pick attributes if they exist.
5111
+ *
5112
+ * @param {Object} attrs
5113
+ * @param {string[]} keys
5114
+ *
5115
+ * @returns {Object}
5116
+ */
5117
+ function pickAttrs(attrs, keys = []) {
5118
+ return keys.reduce((pickedAttrs, key) => {
5119
+ if (attrs[ key ]) {
5120
+ pickedAttrs[ key ] = attrs[ key ];
5121
+ }
5122
+
5123
+ return pickedAttrs;
5124
+ }, {});
5125
+ }
5126
+
4665
5127
  /**
4666
5128
  * @typedef {import('../util/Types').Dimensions} Dimensions
4667
5129
  *
@@ -5758,10 +6220,6 @@
5758
6220
  translate: [ 'value', translate ]
5759
6221
  };
5760
6222
 
5761
- function getDefaultExportFromCjs (x) {
5762
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
5763
- }
5764
-
5765
6223
  /**
5766
6224
  * @param {Point} point
5767
6225
  *
@@ -6293,10 +6751,6 @@
6293
6751
  return event.originalEvent || event.srcEvent;
6294
6752
  }
6295
6753
 
6296
- function isMac() {
6297
- return (/mac/i).test(navigator.platform);
6298
- }
6299
-
6300
6754
  /**
6301
6755
  * @param {MouseEvent} event
6302
6756
  * @param {string} button
@@ -6329,26 +6783,6 @@
6329
6783
  return isButton(event, 1);
6330
6784
  }
6331
6785
 
6332
- /**
6333
- * @param {MouseEvent} event
6334
- *
6335
- * @return {boolean}
6336
- */
6337
- function hasPrimaryModifier(event) {
6338
- var originalEvent = getOriginal(event) || event;
6339
-
6340
- if (!isPrimaryButton(event)) {
6341
- return false;
6342
- }
6343
-
6344
- // Use cmd as primary modifier key for mac OS
6345
- if (isMac()) {
6346
- return originalEvent.metaKey;
6347
- } else {
6348
- return originalEvent.ctrlKey;
6349
- }
6350
- }
6351
-
6352
6786
  /**
6353
6787
  * @param {MouseEvent} event
6354
6788
  *
@@ -6949,6 +7383,8 @@
6949
7383
 
6950
7384
  var LOW_PRIORITY$2 = 500;
6951
7385
 
7386
+ var DEFAULT_PRIORITY$2 = 1000;
7387
+
6952
7388
  /**
6953
7389
  * @typedef {import('../../model/Types').Element} Element
6954
7390
  *
@@ -6967,25 +7403,30 @@
6967
7403
  */
6968
7404
  function Outline(eventBus, styles) {
6969
7405
 
6970
- this.offset = 6;
7406
+ this._eventBus = eventBus;
7407
+
7408
+ this.offset = 5;
6971
7409
 
6972
7410
  var OUTLINE_STYLE = styles.cls('djs-outline', [ 'no-fill' ]);
6973
7411
 
6974
7412
  var self = this;
6975
7413
 
6976
- function createOutline(gfx, bounds) {
7414
+ /**
7415
+ * @param {SVGElement} gfx
7416
+ *
7417
+ * @return {SVGElement} outline
7418
+ */
7419
+ function createOutline(gfx) {
6977
7420
  var outline = create$1('rect');
6978
7421
 
6979
7422
  attr$1(outline, assign$1({
6980
- x: 10,
6981
- y: 10,
7423
+ x: 0,
7424
+ y: 0,
6982
7425
  rx: 4,
6983
7426
  width: 100,
6984
7427
  height: 100
6985
7428
  }, OUTLINE_STYLE));
6986
7429
 
6987
- append(gfx, outline);
6988
-
6989
7430
  return outline;
6990
7431
  }
6991
7432
 
@@ -6998,7 +7439,8 @@
6998
7439
  var outline = query('.djs-outline', gfx);
6999
7440
 
7000
7441
  if (!outline) {
7001
- outline = createOutline(gfx);
7442
+ outline = self.getOutline(element) || createOutline();
7443
+ append(gfx, outline);
7002
7444
  }
7003
7445
 
7004
7446
  self.updateShapeOutline(outline, element);
@@ -7011,7 +7453,8 @@
7011
7453
  var outline = query('.djs-outline', gfx);
7012
7454
 
7013
7455
  if (!outline) {
7014
- outline = createOutline(gfx);
7456
+ outline = createOutline();
7457
+ append(gfx, outline);
7015
7458
  }
7016
7459
 
7017
7460
  self.updateConnectionOutline(outline, element);
@@ -7028,25 +7471,34 @@
7028
7471
  */
7029
7472
  Outline.prototype.updateShapeOutline = function(outline, element) {
7030
7473
 
7031
- attr$1(outline, {
7032
- x: -this.offset,
7033
- y: -this.offset,
7034
- width: element.width + this.offset * 2,
7035
- height: element.height + this.offset * 2
7036
- });
7474
+ var updated = false;
7475
+ var providers = this._getProviders();
7037
7476
 
7038
- };
7477
+ if (providers.length) {
7478
+ forEach$1(providers, function(provider) {
7479
+ updated = updated || provider.updateOutline(element, outline);
7480
+ });
7481
+ }
7039
7482
 
7483
+ if (!updated) {
7484
+ attr$1(outline, {
7485
+ x: -this.offset,
7486
+ y: -this.offset,
7487
+ width: element.width + this.offset * 2,
7488
+ height: element.height + this.offset * 2
7489
+ });
7490
+ }
7491
+ };
7040
7492
 
7041
7493
  /**
7042
7494
  * Updates the outline of a connection respecting the bounding box of
7043
7495
  * the connection and an outline offset.
7496
+ * Register an outline provider with the given priority.
7044
7497
  *
7045
7498
  * @param {SVGElement} outline
7046
7499
  * @param {Element} connection
7047
7500
  */
7048
7501
  Outline.prototype.updateConnectionOutline = function(outline, connection) {
7049
-
7050
7502
  var bbox = getBBox(connection);
7051
7503
 
7052
7504
  attr$1(outline, {
@@ -7055,9 +7507,61 @@
7055
7507
  width: bbox.width + this.offset * 2,
7056
7508
  height: bbox.height + this.offset * 2
7057
7509
  });
7510
+ };
7511
+
7512
+ /**
7513
+ * Register an outline provider with the given priority.
7514
+ *
7515
+ * @param {number} priority
7516
+ * @param {OutlineProvider} provider
7517
+ */
7518
+ Outline.prototype.registerProvider = function(priority, provider) {
7519
+ if (!provider) {
7520
+ provider = priority;
7521
+ priority = DEFAULT_PRIORITY$2;
7522
+ }
7523
+
7524
+ this._eventBus.on('outline.getProviders', priority, function(event) {
7525
+ event.providers.push(provider);
7526
+ });
7527
+ };
7528
+
7529
+ /**
7530
+ * Returns the registered outline providers.
7531
+ *
7532
+ * @returns {OutlineProvider[]}
7533
+ */
7534
+ Outline.prototype._getProviders = function() {
7535
+ var event = this._eventBus.createEvent({
7536
+ type: 'outline.getProviders',
7537
+ providers: []
7538
+ });
7539
+
7540
+ this._eventBus.fire(event);
7058
7541
 
7542
+ return event.providers;
7059
7543
  };
7060
7544
 
7545
+ /**
7546
+ * Returns the outline for an element.
7547
+ *
7548
+ * @param {Element} element
7549
+ **/
7550
+ Outline.prototype.getOutline = function(element) {
7551
+ var outline;
7552
+ var providers = this._getProviders();
7553
+
7554
+ forEach$1(providers, function(provider) {
7555
+
7556
+ if (!isFunction(provider.getOutline)) {
7557
+ return;
7558
+ }
7559
+
7560
+ outline = outline || provider.getOutline(element);
7561
+ });
7562
+
7563
+ return outline;
7564
+ };
7061
7565
 
7062
7566
  Outline.$inject = [ 'eventBus', 'styles', 'elementRegistry' ];
7063
7567
 
@@ -7399,8 +7903,8 @@
7399
7903
  var isSelected = selection.isSelected(element),
7400
7904
  isMultiSelect = selection.get().length > 1;
7401
7905
 
7402
- // Add to selection if CTRL or SHIFT pressed
7403
- var add = hasPrimaryModifier(event) || hasSecondaryModifier(event);
7906
+ // Add to selection if SHIFT pressed
7907
+ var add = hasSecondaryModifier(event);
7404
7908
 
7405
7909
  if (isSelected && isMultiSelect) {
7406
7910
  if (add) {
@@ -7692,8 +8196,7 @@
7692
8196
  } else {
7693
8197
  return [];
7694
8198
  }
7695
- } else
7696
- if (search.type) {
8199
+ } else if (search.type) {
7697
8200
  return filter(this._overlays, matchPattern({ type: search.type }));
7698
8201
  } else {
7699
8202
 
@@ -9376,7 +9879,7 @@
9376
9879
  }
9377
9880
 
9378
9881
  /**
9379
- * @typedef {import('./index').InjectAnnotated } InjectAnnotated
9882
+ * @typedef {import('./index.js').InjectAnnotated } InjectAnnotated
9380
9883
  */
9381
9884
 
9382
9885
  /**
@@ -9446,9 +9949,9 @@
9446
9949
  }
9447
9950
 
9448
9951
  /**
9449
- * @typedef { import('./index').ModuleDeclaration } ModuleDeclaration
9450
- * @typedef { import('./index').ModuleDefinition } ModuleDefinition
9451
- * @typedef { import('./index').InjectorContext } InjectorContext
9952
+ * @typedef { import('./index.js').ModuleDeclaration } ModuleDeclaration
9953
+ * @typedef { import('./index.js').ModuleDefinition } ModuleDefinition
9954
+ * @typedef { import('./index.js').InjectorContext } InjectorContext
9452
9955
  */
9453
9956
 
9454
9957
  /**
@@ -9551,11 +10054,20 @@
9551
10054
  };
9552
10055
  }
9553
10056
 
9554
- function instantiate(Type) {
10057
+ /**
10058
+ * Instantiate the given type, injecting dependencies.
10059
+ *
10060
+ * @template T
10061
+ *
10062
+ * @param { Function | [...string[], Function ]} type
10063
+ *
10064
+ * @return T
10065
+ */
10066
+ function instantiate(type) {
9555
10067
  const {
9556
10068
  fn,
9557
10069
  dependencies
9558
- } = fnDef(Type);
10070
+ } = fnDef(type);
9559
10071
 
9560
10072
  // instantiate var args constructor
9561
10073
  const Constructor = Function.prototype.bind.apply(fn, [ null ].concat(dependencies));
@@ -9563,6 +10075,17 @@
9563
10075
  return new Constructor();
9564
10076
  }
9565
10077
 
10078
+ /**
10079
+ * Invoke the given function, injecting dependencies. Return the result.
10080
+ *
10081
+ * @template T
10082
+ *
10083
+ * @param { Function | [...string[], Function ]} func
10084
+ * @param { Object } [context]
10085
+ * @param { Object } [locals]
10086
+ *
10087
+ * @return {T} invocation result
10088
+ */
9566
10089
  function invoke(func, context, locals) {
9567
10090
  const {
9568
10091
  fn,
@@ -11831,32 +12354,17 @@
11831
12354
  }
11832
12355
  };
11833
12356
 
11834
- var objectRefs = {exports: {}};
11835
-
11836
- var collection = {};
11837
-
11838
- /**
11839
- * An empty collection stub. Use {@link RefsCollection.extend} to extend a
11840
- * collection with ref semantics.
11841
- *
11842
- * @class RefsCollection
11843
- */
11844
-
11845
12357
  /**
11846
12358
  * Extends a collection with {@link Refs} aware methods
11847
12359
  *
11848
- * @memberof RefsCollection
11849
- * @static
11850
- *
11851
- * @param {Array<Object>} collection
11852
- * @param {Refs} refs instance
11853
- * @param {Object} property represented by the collection
11854
- * @param {Object} target object the collection is attached to
12360
+ * @param {Array<Object>} collection
12361
+ * @param {Refs} refs instance
12362
+ * @param {Object} property represented by the collection
12363
+ * @param {Object} target object the collection is attached to
11855
12364
  *
11856
12365
  * @return {RefsCollection<Object>} the extended array
11857
12366
  */
11858
12367
  function extend(collection, refs, property, target) {
11859
-
11860
12368
  var inverseProperty = property.inverse;
11861
12369
 
11862
12370
  /**
@@ -11867,7 +12375,7 @@
11867
12375
  * @param {Object} element the element to remove
11868
12376
  */
11869
12377
  Object.defineProperty(collection, 'remove', {
11870
- value: function(element) {
12378
+ value: function (element) {
11871
12379
  var idx = this.indexOf(element);
11872
12380
  if (idx !== -1) {
11873
12381
  this.splice(idx, 1);
@@ -11875,7 +12383,6 @@
11875
12383
  // unset inverse
11876
12384
  refs.unset(element, inverseProperty, target);
11877
12385
  }
11878
-
11879
12386
  return element;
11880
12387
  }
11881
12388
  });
@@ -11888,7 +12395,7 @@
11888
12395
  * @param {Object} element the element to check for
11889
12396
  */
11890
12397
  Object.defineProperty(collection, 'contains', {
11891
- value: function(element) {
12398
+ value: function (element) {
11892
12399
  return this.indexOf(element) !== -1;
11893
12400
  }
11894
12401
  });
@@ -11903,12 +12410,9 @@
11903
12410
  * (possibly moving other elements around)
11904
12411
  */
11905
12412
  Object.defineProperty(collection, 'add', {
11906
- value: function(element, idx) {
11907
-
12413
+ value: function (element, idx) {
11908
12414
  var currentIdx = this.indexOf(element);
11909
-
11910
12415
  if (typeof idx === 'undefined') {
11911
-
11912
12416
  if (currentIdx !== -1) {
11913
12417
  // element already in collection (!)
11914
12418
  return;
@@ -11920,14 +12424,12 @@
11920
12424
 
11921
12425
  // handle already in collection
11922
12426
  if (currentIdx !== -1) {
11923
-
11924
12427
  // remove element from currentIdx
11925
12428
  this.splice(currentIdx, 1);
11926
12429
  }
11927
12430
 
11928
12431
  // add element at idx
11929
12432
  this.splice(idx, 0, element);
11930
-
11931
12433
  if (currentIdx === -1) {
11932
12434
  // set inverse, unless element was
11933
12435
  // in collection already
@@ -11941,69 +12443,53 @@
11941
12443
  Object.defineProperty(collection, '__refs_collection', {
11942
12444
  value: true
11943
12445
  });
11944
-
11945
12446
  return collection;
11946
12447
  }
11947
12448
 
11948
-
12449
+ /**
12450
+ * Checks if a given collection is extended
12451
+ *
12452
+ * @param {Array<Object>} collection
12453
+ *
12454
+ * @return {boolean}
12455
+ */
11949
12456
  function isExtended(collection) {
11950
12457
  return collection.__refs_collection === true;
11951
12458
  }
11952
12459
 
11953
- collection.extend = extend;
11954
-
11955
- collection.isExtended = isExtended;
11956
-
11957
- var Collection = collection;
11958
-
11959
12460
  function hasOwnProperty$1(e, property) {
11960
12461
  return Object.prototype.hasOwnProperty.call(e, property.name || property);
11961
12462
  }
11962
-
11963
12463
  function defineCollectionProperty(ref, property, target) {
11964
-
11965
- var collection = Collection.extend(target[property.name] || [], ref, property, target);
11966
-
12464
+ var collection = extend(target[property.name] || [], ref, property, target);
11967
12465
  Object.defineProperty(target, property.name, {
11968
12466
  enumerable: property.enumerable,
11969
12467
  value: collection
11970
12468
  });
11971
-
11972
12469
  if (collection.length) {
11973
-
11974
- collection.forEach(function(o) {
12470
+ collection.forEach(function (o) {
11975
12471
  ref.set(o, property.inverse, target);
11976
12472
  });
11977
12473
  }
11978
12474
  }
11979
-
11980
-
11981
12475
  function defineProperty$1(ref, property, target) {
11982
-
11983
12476
  var inverseProperty = property.inverse;
11984
-
11985
12477
  var _value = target[property.name];
11986
-
11987
12478
  Object.defineProperty(target, property.name, {
11988
12479
  configurable: property.configurable,
11989
12480
  enumerable: property.enumerable,
11990
-
11991
- get: function() {
12481
+ get: function () {
11992
12482
  return _value;
11993
12483
  },
11994
-
11995
- set: function(value) {
11996
-
12484
+ set: function (value) {
11997
12485
  // return if we already performed all changes
11998
12486
  if (value === _value) {
11999
12487
  return;
12000
12488
  }
12001
-
12002
12489
  var old = _value;
12003
12490
 
12004
12491
  // temporary set null
12005
12492
  _value = null;
12006
-
12007
12493
  if (old) {
12008
12494
  ref.unset(old, inverseProperty, target);
12009
12495
  }
@@ -12015,7 +12501,6 @@
12015
12501
  ref.set(_value, inverseProperty, target);
12016
12502
  }
12017
12503
  });
12018
-
12019
12504
  }
12020
12505
 
12021
12506
  /**
@@ -12061,16 +12546,14 @@
12061
12546
  *
12062
12547
  * wheels[0].car // undefined
12063
12548
  */
12064
- function Refs$1(a, b) {
12065
-
12066
- if (!(this instanceof Refs$1)) {
12067
- return new Refs$1(a, b);
12549
+ function Refs(a, b) {
12550
+ if (!(this instanceof Refs)) {
12551
+ return new Refs(a, b);
12068
12552
  }
12069
12553
 
12070
12554
  // link
12071
12555
  a.inverse = b;
12072
12556
  b.inverse = a;
12073
-
12074
12557
  this.props = {};
12075
12558
  this.props[a.name] = a;
12076
12559
  this.props[b.name] = b;
@@ -12085,43 +12568,34 @@
12085
12568
  * @param {Object} target
12086
12569
  * @param {String} property
12087
12570
  */
12088
- Refs$1.prototype.bind = function(target, property) {
12571
+ Refs.prototype.bind = function (target, property) {
12089
12572
  if (typeof property === 'string') {
12090
12573
  if (!this.props[property]) {
12091
12574
  throw new Error('no property <' + property + '> in ref');
12092
12575
  }
12093
12576
  property = this.props[property];
12094
12577
  }
12095
-
12096
12578
  if (property.collection) {
12097
12579
  defineCollectionProperty(this, property, target);
12098
12580
  } else {
12099
12581
  defineProperty$1(this, property, target);
12100
12582
  }
12101
12583
  };
12102
-
12103
- Refs$1.prototype.ensureRefsCollection = function(target, property) {
12104
-
12584
+ Refs.prototype.ensureRefsCollection = function (target, property) {
12105
12585
  var collection = target[property.name];
12106
-
12107
- if (!Collection.isExtended(collection)) {
12586
+ if (!isExtended(collection)) {
12108
12587
  defineCollectionProperty(this, property, target);
12109
12588
  }
12110
-
12111
12589
  return collection;
12112
12590
  };
12113
-
12114
- Refs$1.prototype.ensureBound = function(target, property) {
12591
+ Refs.prototype.ensureBound = function (target, property) {
12115
12592
  if (!hasOwnProperty$1(target, property)) {
12116
12593
  this.bind(target, property);
12117
12594
  }
12118
12595
  };
12119
-
12120
- Refs$1.prototype.unset = function(target, property, value) {
12121
-
12596
+ Refs.prototype.unset = function (target, property, value) {
12122
12597
  if (target) {
12123
12598
  this.ensureBound(target, property);
12124
-
12125
12599
  if (property.collection) {
12126
12600
  this.ensureRefsCollection(target, property).remove(value);
12127
12601
  } else {
@@ -12129,12 +12603,9 @@
12129
12603
  }
12130
12604
  }
12131
12605
  };
12132
-
12133
- Refs$1.prototype.set = function(target, property, value) {
12134
-
12606
+ Refs.prototype.set = function (target, property, value) {
12135
12607
  if (target) {
12136
12608
  this.ensureBound(target, property);
12137
-
12138
12609
  if (property.collection) {
12139
12610
  this.ensureRefsCollection(target, property).add(value);
12140
12611
  } else {
@@ -12143,15 +12614,6 @@
12143
12614
  }
12144
12615
  };
12145
12616
 
12146
- var refs = Refs$1;
12147
-
12148
- objectRefs.exports = refs;
12149
-
12150
- objectRefs.exports.Collection = collection;
12151
-
12152
- var objectRefsExports = objectRefs.exports;
12153
- var Refs = /*@__PURE__*/getDefaultExportFromCjs(objectRefsExports);
12154
-
12155
12617
  var parentRefs = new Refs({ name: 'children', enumerable: true, collection: true }, { name: 'parent' }),
12156
12618
  labelRefs = new Refs({ name: 'labels', enumerable: true, collection: true }, { name: 'labelTarget' }),
12157
12619
  attacherRefs = new Refs({ name: 'attachers', collection: true }, { name: 'host' }),
@@ -13356,13 +13818,14 @@
13356
13818
  *
13357
13819
  * @param {SVGElement} visual The graphical element.
13358
13820
  * @param {ShapeLike} element The shape.
13821
+ * @param {Object} attrs Optional attributes.
13359
13822
  *
13360
13823
  * @return {SVGElement}
13361
13824
  */
13362
- GraphicsFactory.prototype.drawShape = function(visual, element) {
13825
+ GraphicsFactory.prototype.drawShape = function(visual, element, attrs = {}) {
13363
13826
  var eventBus = this._eventBus;
13364
13827
 
13365
- return eventBus.fire('render.shape', { gfx: visual, element: element });
13828
+ return eventBus.fire('render.shape', { gfx: visual, element, attrs });
13366
13829
  };
13367
13830
 
13368
13831
  /**
@@ -13383,13 +13846,14 @@
13383
13846
  *
13384
13847
  * @param {SVGElement} visual The graphical element.
13385
13848
  * @param {ConnectionLike} element The connection.
13849
+ * @param {Object} attrs Optional attributes.
13386
13850
  *
13387
13851
  * @return {SVGElement}
13388
13852
  */
13389
- GraphicsFactory.prototype.drawConnection = function(visual, element) {
13853
+ GraphicsFactory.prototype.drawConnection = function(visual, element, attrs = {}) {
13390
13854
  var eventBus = this._eventBus;
13391
13855
 
13392
- return eventBus.fire('render.connection', { gfx: visual, element: element });
13856
+ return eventBus.fire('render.connection', { gfx: visual, element, attrs });
13393
13857
  };
13394
13858
 
13395
13859
  /**
@@ -13427,8 +13891,7 @@
13427
13891
 
13428
13892
  // update positioning
13429
13893
  translate$1(gfx, element.x, element.y);
13430
- } else
13431
- if (type === 'connection') {
13894
+ } else if (type === 'connection') {
13432
13895
  this.drawConnection(visual, element);
13433
13896
  } else {
13434
13897
  throw new Error('unknown type: ' + type);
@@ -13966,6 +14429,17 @@
13966
14429
  this.idProperty = p;
13967
14430
  };
13968
14431
 
14432
+ DescriptorBuilder.prototype.assertNotTrait = function(typeDescriptor) {
14433
+
14434
+ const _extends = typeDescriptor.extends || [];
14435
+
14436
+ if (_extends.length) {
14437
+ throw new Error(
14438
+ `cannot create <${ typeDescriptor.name }> extending <${ typeDescriptor.extends }>`
14439
+ );
14440
+ }
14441
+ };
14442
+
13969
14443
  DescriptorBuilder.prototype.assertNotDefined = function(p, name) {
13970
14444
  var propertyName = p.name,
13971
14445
  definedProperty = this.propertiesByName[propertyName];
@@ -13984,6 +14458,10 @@
13984
14458
 
13985
14459
  DescriptorBuilder.prototype.addTrait = function(t, inherited) {
13986
14460
 
14461
+ if (inherited) {
14462
+ this.assertNotTrait(t);
14463
+ }
14464
+
13987
14465
  var typesByName = this.allTypesByName,
13988
14466
  types = this.allTypes;
13989
14467
 
@@ -14117,7 +14595,9 @@
14117
14595
  });
14118
14596
 
14119
14597
  forEach$1(type.extends, bind$2(function(extendsName) {
14120
- var extended = this.typeMap[extendsName];
14598
+ var extendsNameNs = parseName(extendsName, ns.prefix);
14599
+
14600
+ var extended = this.typeMap[extendsNameNs.name];
14121
14601
 
14122
14602
  extended.traits = extended.traits || [];
14123
14603
  extended.traits.push(name);
@@ -14146,24 +14626,33 @@
14146
14626
 
14147
14627
  var self = this;
14148
14628
 
14629
+ /**
14630
+ * Traverse the selected super type or trait
14631
+ *
14632
+ * @param {String} cls
14633
+ * @param {Boolean} [trait=false]
14634
+ */
14635
+ function traverse(cls, trait) {
14636
+ var parentNs = parseName(cls, isBuiltIn(cls) ? '' : nsName.prefix);
14637
+ self.mapTypes(parentNs, iterator, trait);
14638
+ }
14639
+
14149
14640
  /**
14150
14641
  * Traverse the selected trait.
14151
14642
  *
14152
14643
  * @param {String} cls
14153
14644
  */
14154
14645
  function traverseTrait(cls) {
14155
- return traverseSuper(cls, true);
14646
+ return traverse(cls, true);
14156
14647
  }
14157
14648
 
14158
14649
  /**
14159
- * Traverse the selected super type or trait
14650
+ * Traverse the selected super type
14160
14651
  *
14161
14652
  * @param {String} cls
14162
- * @param {Boolean} [trait=false]
14163
14653
  */
14164
- function traverseSuper(cls, trait) {
14165
- var parentNs = parseName(cls, isBuiltIn(cls) ? '' : nsName.prefix);
14166
- self.mapTypes(parentNs, iterator, trait);
14654
+ function traverseSuper(cls) {
14655
+ return traverse(cls, false);
14167
14656
  }
14168
14657
 
14169
14658
  if (!type) {
@@ -14246,7 +14735,7 @@
14246
14735
  throw new TypeError('property name must be a non-empty string');
14247
14736
  }
14248
14737
 
14249
- var property = this.model.getPropertyDescriptor(target, name);
14738
+ var property = this.getProperty(target, name);
14250
14739
 
14251
14740
  var propertyName = property && property.name;
14252
14741
 
@@ -14257,7 +14746,7 @@
14257
14746
  if (property) {
14258
14747
  delete target[propertyName];
14259
14748
  } else {
14260
- delete target.$attrs[name];
14749
+ delete target.$attrs[stripGlobal(name)];
14261
14750
  }
14262
14751
  } else {
14263
14752
 
@@ -14270,7 +14759,7 @@
14270
14759
  defineProperty(target, property, value);
14271
14760
  }
14272
14761
  } else {
14273
- target.$attrs[name] = value;
14762
+ target.$attrs[stripGlobal(name)] = value;
14274
14763
  }
14275
14764
  }
14276
14765
  };
@@ -14285,10 +14774,10 @@
14285
14774
  */
14286
14775
  Properties.prototype.get = function(target, name) {
14287
14776
 
14288
- var property = this.model.getPropertyDescriptor(target, name);
14777
+ var property = this.getProperty(target, name);
14289
14778
 
14290
14779
  if (!property) {
14291
- return target.$attrs[name];
14780
+ return target.$attrs[stripGlobal(name)];
14292
14781
  }
14293
14782
 
14294
14783
  var propertyName = property.name;
@@ -14342,6 +14831,44 @@
14342
14831
  this.define(target, '$model', { value: model });
14343
14832
  };
14344
14833
 
14834
+ /**
14835
+ * Return property with the given name on the element.
14836
+ *
14837
+ * @param {any} target
14838
+ * @param {string} name
14839
+ *
14840
+ * @return {object | null} property
14841
+ */
14842
+ Properties.prototype.getProperty = function(target, name) {
14843
+
14844
+ var model = this.model;
14845
+
14846
+ var property = model.getPropertyDescriptor(target, name);
14847
+
14848
+ if (property) {
14849
+ return property;
14850
+ }
14851
+
14852
+ if (name.includes(':')) {
14853
+ return null;
14854
+ }
14855
+
14856
+ const strict = model.config.strict;
14857
+
14858
+ if (typeof strict !== 'undefined') {
14859
+ const error = new TypeError(`unknown property <${ name }> on <${ target.$type }>`);
14860
+
14861
+ if (strict) {
14862
+ throw error;
14863
+ } else {
14864
+
14865
+ // eslint-disable-next-line no-undef
14866
+ typeof console !== 'undefined' && console.warn(error);
14867
+ }
14868
+ }
14869
+
14870
+ return null;
14871
+ };
14345
14872
 
14346
14873
  function isUndefined(val) {
14347
14874
  return typeof val === 'undefined';
@@ -14356,6 +14883,10 @@
14356
14883
  });
14357
14884
  }
14358
14885
 
14886
+ function stripGlobal(name) {
14887
+ return name.replace(/^:/, '');
14888
+ }
14889
+
14359
14890
  // Moddle implementation /////////////////////////////////////////////////
14360
14891
 
14361
14892
  /**
@@ -14378,8 +14909,10 @@
14378
14909
  * var moddle = new Moddle([pkg]);
14379
14910
  *
14380
14911
  * @param {Array<Package>} packages the packages to contain
14912
+ *
14913
+ * @param { { strict?: boolean } } [config] moddle configuration
14381
14914
  */
14382
- function Moddle(packages) {
14915
+ function Moddle(packages, config = {}) {
14383
14916
 
14384
14917
  this.properties = new Properties(this);
14385
14918
 
@@ -14387,6 +14920,8 @@
14387
14920
  this.registry = new Registry(packages, this.properties);
14388
14921
 
14389
14922
  this.typeCache = {};
14923
+
14924
+ this.config = config;
14390
14925
  }
14391
14926
 
14392
14927
 
@@ -14480,6 +15015,12 @@
14480
15015
  $type: name,
14481
15016
  $instanceOf: function(type) {
14482
15017
  return type === this.$type;
15018
+ },
15019
+ get: function(key) {
15020
+ return this[key];
15021
+ },
15022
+ set: function(key, value) {
15023
+ set$1(this, [ key ], value);
14483
15024
  }
14484
15025
  };
14485
15026
 
@@ -14495,6 +15036,8 @@
14495
15036
 
14496
15037
  this.properties.defineDescriptor(element, descriptor);
14497
15038
  this.properties.defineModel(element, this);
15039
+ this.properties.define(element, 'get', { enumerable: false, writable: true });
15040
+ this.properties.define(element, 'set', { enumerable: false, writable: true });
14498
15041
  this.properties.define(element, '$parent', { enumerable: false, writable: true });
14499
15042
  this.properties.define(element, '$instanceOf', { enumerable: false, writable: true });
14500
15043