camunda-bpmn-js 0.24.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/dist/assets/color-picker.css +10 -0
  2. package/dist/base-modeler.development.js +72 -10
  3. package/dist/base-modeler.production.min.js +3 -3
  4. package/dist/base-navigated-viewer.development.js +3 -0
  5. package/dist/base-navigated-viewer.production.min.js +1 -1
  6. package/dist/base-viewer.development.js +3 -0
  7. package/dist/base-viewer.production.min.js +1 -1
  8. package/dist/camunda-cloud-modeler.development.js +399 -104
  9. package/dist/camunda-cloud-modeler.production.min.js +4 -4
  10. package/dist/camunda-cloud-navigated-viewer.development.js +3 -0
  11. package/dist/camunda-cloud-navigated-viewer.production.min.js +1 -1
  12. package/dist/camunda-cloud-viewer.development.js +3 -0
  13. package/dist/camunda-cloud-viewer.production.min.js +1 -1
  14. package/dist/camunda-platform-modeler.development.js +462 -11
  15. package/dist/camunda-platform-modeler.production.min.js +5 -5
  16. package/dist/camunda-platform-navigated-viewer.development.js +3 -0
  17. package/dist/camunda-platform-navigated-viewer.production.min.js +1 -1
  18. package/dist/camunda-platform-viewer.development.js +3 -0
  19. package/dist/camunda-platform-viewer.production.min.js +1 -1
  20. package/lib/camunda-cloud/Modeler.js +5 -1
  21. package/lib/camunda-cloud/features/replace/ElementTemplatesReplaceProvider.js +3 -141
  22. package/lib/camunda-platform/Modeler.js +6 -1
  23. package/lib/shared/features/replace/UnlinkTemplateReplaceProvider.js +178 -0
  24. package/lib/shared/features/replace/index.js +8 -0
  25. package/lib/{camunda-cloud/features/replace → shared/features/replace/util}/ReplaceOptionsUtil.js +0 -0
  26. package/package.json +7 -5
@@ -22147,6 +22147,9 @@
22147
22147
 
22148
22148
  };
22149
22149
 
22150
+ Overlays.prototype.isShown = function() {
22151
+ return this._overlayRoot.style.display !== 'none';
22152
+ };
22150
22153
 
22151
22154
  Overlays.prototype.show = function() {
22152
22155
  setVisible$1(this._overlayRoot);
@@ -28053,7 +28056,9 @@
28053
28056
 
28054
28057
 
28055
28058
  /**
28056
- * Trigger context pad action.
28059
+ * Trigger context pad via DOM event.
28060
+ *
28061
+ * The entry to trigger is determined by the target element.
28057
28062
  *
28058
28063
  * @param {string} action
28059
28064
  * @param {Event} event
@@ -28061,10 +28066,7 @@
28061
28066
  */
28062
28067
  ContextPad.prototype.trigger = function(action, event, autoActivate) {
28063
28068
 
28064
- var target = this._current.target,
28065
- entries = this._current.entries,
28066
- entry,
28067
- handler,
28069
+ var entry,
28068
28070
  originalEvent,
28069
28071
  button = event.delegateTarget || event.target;
28070
28072
 
@@ -28072,19 +28074,45 @@
28072
28074
  return event.preventDefault();
28073
28075
  }
28074
28076
 
28075
- entry = entries[attr$1(button, 'data-action')];
28076
- handler = entry.action;
28077
-
28077
+ entry = attr$1(button, 'data-action');
28078
28078
  originalEvent = event.originalEvent || event;
28079
28079
 
28080
+ return this.triggerEntry(entry, action, originalEvent, autoActivate);
28081
+ };
28082
+
28083
+ /**
28084
+ * Trigger context pad entry entry.
28085
+ *
28086
+ * @param {string} entryId
28087
+ * @param {string} action
28088
+ * @param {Event} event
28089
+ * @param {boolean} [autoActivate=false]
28090
+ */
28091
+ ContextPad.prototype.triggerEntry = function(entryId, action, event, autoActivate) {
28092
+
28093
+ if (!this.isShown()) {
28094
+ return;
28095
+ }
28096
+
28097
+ var target = this._current.target,
28098
+ entries = this._current.entries;
28099
+
28100
+ var entry = entries[entryId];
28101
+
28102
+ if (!entry) {
28103
+ return;
28104
+ }
28105
+
28106
+ var handler = entry.action;
28107
+
28080
28108
  // simple action (via callback function)
28081
28109
  if (isFunction(handler)) {
28082
28110
  if (action === 'click') {
28083
- return handler(originalEvent, target, autoActivate);
28111
+ return handler(event, target, autoActivate);
28084
28112
  }
28085
28113
  } else {
28086
28114
  if (handler[action]) {
28087
- return handler[action](originalEvent, target, autoActivate);
28115
+ return handler[action](event, target, autoActivate);
28088
28116
  }
28089
28117
  }
28090
28118
 
@@ -28285,6 +28313,16 @@
28285
28313
  };
28286
28314
 
28287
28315
 
28316
+ /**
28317
+ * Check if pad is open and not hidden.
28318
+ *
28319
+ * @return {boolean}
28320
+ */
28321
+ ContextPad.prototype.isShown = function() {
28322
+ return this.isOpen() && this._overlays.isShown();
28323
+ };
28324
+
28325
+
28288
28326
  /**
28289
28327
  * Get contex pad position.
28290
28328
  *
@@ -39927,6 +39965,7 @@
39927
39965
  var directEditing = injector.get('directEditing', false);
39928
39966
  var searchPad = injector.get('searchPad', false);
39929
39967
  var modeling = injector.get('modeling', false);
39968
+ var contextPad = injector.get('contextPad', false);
39930
39969
 
39931
39970
  // (2) check components and register actions
39932
39971
 
@@ -40050,6 +40089,12 @@
40050
40089
  });
40051
40090
  }
40052
40091
 
40092
+ if (selection && contextPad) {
40093
+ this._registerAction('replaceElement', function(event) {
40094
+ contextPad.triggerEntry('replace', 'click', event);
40095
+ });
40096
+ }
40097
+
40053
40098
  };
40054
40099
 
40055
40100
  var EditorActionsModule = {
@@ -41168,6 +41213,23 @@
41168
41213
  }
41169
41214
  });
41170
41215
 
41216
+ // activate replace element
41217
+ // R
41218
+ addListener('replaceElement', function(context) {
41219
+
41220
+ var event = context.keyEvent;
41221
+
41222
+ if (keyboard.hasModifier(event)) {
41223
+ return;
41224
+ }
41225
+
41226
+ if (keyboard.isKey([ 'r', 'R' ], event)) {
41227
+ editorActions.trigger('replaceElement', event);
41228
+
41229
+ return true;
41230
+ }
41231
+ });
41232
+
41171
41233
  };
41172
41234
 
41173
41235
  var KeyboardModule = {
@@ -102076,6 +102138,124 @@
102076
102138
  bpmnRules: [ 'type', CustomRules ]
102077
102139
  };
102078
102140
 
102141
+ /**
102142
+ * A replace menu provider that allows to replace elements with
102143
+ * element templates.
102144
+ */
102145
+ function ElementTemplatesReplaceProvider(popupMenu, translate, elementTemplates) {
102146
+
102147
+ this._popupMenu = popupMenu;
102148
+ this._translate = translate;
102149
+ this._elementTemplates = elementTemplates;
102150
+
102151
+ this.register();
102152
+ }
102153
+
102154
+ ElementTemplatesReplaceProvider.$inject = [
102155
+ 'popupMenu',
102156
+ 'translate',
102157
+ 'elementTemplates'
102158
+ ];
102159
+
102160
+ /**
102161
+ * Register replace menu provider in the popup menu
102162
+ */
102163
+ ElementTemplatesReplaceProvider.prototype.register = function() {
102164
+ this._popupMenu.registerProvider('bpmn-replace', this);
102165
+ };
102166
+
102167
+ /**
102168
+ * Adds the element templates to the replace menu.
102169
+ * @param {djs.model.Base} element
102170
+ *
102171
+ * @returns {Object}
102172
+ */
102173
+ ElementTemplatesReplaceProvider.prototype.getPopupMenuEntries = function(element) {
102174
+
102175
+ return (entries) => {
102176
+
102177
+ // convert our entries into something sortable
102178
+ let entrySet = Object.entries(entries);
102179
+
102180
+ // add template entries
102181
+ entrySet = [ ...entrySet, ...this.getTemplateEntries(element) ];
102182
+
102183
+ // convert back to object
102184
+ return entrySet.reduce((entries, [ key, value ]) => {
102185
+ entries[key] = value;
102186
+
102187
+ return entries;
102188
+ }, {});
102189
+ };
102190
+ };
102191
+
102192
+ /**
102193
+ * Get all element templates that can be used to replace the given element.
102194
+ *
102195
+ * @param {djs.model.Base} element
102196
+ *
102197
+ * @return {Array<Object>} a list of element templates as menu entries
102198
+ */
102199
+ ElementTemplatesReplaceProvider.prototype.getTemplateEntries = function(element) {
102200
+
102201
+ const templates = this._getMatchingTemplates(element);
102202
+ return templates.map(template => {
102203
+
102204
+ const {
102205
+ icon = {},
102206
+ category,
102207
+ } = template;
102208
+
102209
+ const entryId = `replace.template-${template.id}`;
102210
+
102211
+ const defaultGroup = {
102212
+ id: 'templates',
102213
+ name: this._translate('Templates')
102214
+ };
102215
+
102216
+ return [ entryId, {
102217
+ label: template.name,
102218
+ description: template.description,
102219
+ documentationRef: template.documentationRef,
102220
+ imageUrl: icon.contents,
102221
+ group: category || defaultGroup,
102222
+ action: () => {
102223
+ this._elementTemplates.applyTemplate(element, template);
102224
+ }
102225
+ } ];
102226
+ });
102227
+ };
102228
+
102229
+ /**
102230
+ * Returns the templates that can the element can be replaced with.
102231
+ *
102232
+ * @param {djs.model.Base} element
102233
+ *
102234
+ * @return {Array<ElementTemplate>}
102235
+ */
102236
+ ElementTemplatesReplaceProvider.prototype._getMatchingTemplates = function(element) {
102237
+ return this._elementTemplates.getLatest().filter(template => {
102238
+ return isAny(element, template.appliesTo) && !isTemplateApplied(element, template);
102239
+ });
102240
+ };
102241
+
102242
+
102243
+ // helpers ////////////
102244
+ function isTemplateApplied(element, template) {
102245
+ const businessObject = getBusinessObject$1(element);
102246
+
102247
+ if (businessObject) {
102248
+ return businessObject.get('zeebe:modelerTemplate') === template.id;
102249
+ }
102250
+
102251
+ return false;
102252
+ }
102253
+
102254
+ var replaceModule = {
102255
+ __init__: [ 'elementTemplatesProvider' ],
102256
+ elementTemplatesProvider: [ 'type', ElementTemplatesReplaceProvider ]
102257
+ };
102258
+
102079
102259
  const ALL_OPTIONS = Object.values(replaceOptions);
102080
102260
 
102081
102261
  function getReplaceOptionGroups() {
@@ -102084,23 +102264,18 @@
102084
102264
 
102085
102265
  /**
102086
102266
  * A replace menu provider that allows to replace elements with
102087
- * element templates.
102267
+ * templates applied with the correspondent plain element.
102088
102268
  */
102089
- function ElementTemplatesReplaceProvider(config, popupMenu, translate, elementTemplates) {
102269
+ function UnlinkTemplateReplaceProvider(popupMenu, translate, elementTemplates) {
102090
102270
 
102091
102271
  this._popupMenu = popupMenu;
102092
102272
  this._translate = translate;
102093
102273
  this._elementTemplates = elementTemplates;
102094
102274
 
102095
- const enabled = config && config.enabled;
102096
-
102097
- if (enabled) {
102098
- this.register();
102099
- }
102275
+ this.register();
102100
102276
  }
102101
102277
 
102102
- ElementTemplatesReplaceProvider.$inject = [
102103
- 'config.elementTemplatesReplaceProvider',
102278
+ UnlinkTemplateReplaceProvider.$inject = [
102104
102279
  'popupMenu',
102105
102280
  'translate',
102106
102281
  'elementTemplates'
@@ -102109,7 +102284,7 @@
102109
102284
  /**
102110
102285
  * Register replace menu provider in the popup menu
102111
102286
  */
102112
- ElementTemplatesReplaceProvider.prototype.register = function() {
102287
+ UnlinkTemplateReplaceProvider.prototype.register = function() {
102113
102288
  this._popupMenu.registerProvider('bpmn-replace', this);
102114
102289
  };
102115
102290
 
@@ -102119,7 +102294,7 @@
102119
102294
  *
102120
102295
  * @returns {Object}
102121
102296
  */
102122
- ElementTemplatesReplaceProvider.prototype.getPopupMenuEntries = function(element) {
102297
+ UnlinkTemplateReplaceProvider.prototype.getPopupMenuEntries = function(element) {
102123
102298
 
102124
102299
  return (entries) => {
102125
102300
 
@@ -102129,12 +102304,9 @@
102129
102304
  if (this._elementTemplates.get(element)) {
102130
102305
 
102131
102306
  // add unlink template option
102132
- this._addPlainElementEntry(element, entrySet);
102307
+ this.addPlainElementEntry(element, entrySet, this._translate, this._elementTemplates);
102133
102308
  }
102134
102309
 
102135
- // add template entries
102136
- entrySet = [ ...entrySet, ...this.getTemplateEntries(element) ];
102137
-
102138
102310
  // convert back to object
102139
102311
  return entrySet.reduce((entries, [ key, value ]) => {
102140
102312
  entries[key] = value;
@@ -102144,15 +102316,16 @@
102144
102316
  };
102145
102317
  };
102146
102318
 
102319
+
102147
102320
  /**
102148
102321
  * Adds the option to replace with plain element (unlink template).
102149
102322
  *
102150
102323
  * @param {djs.model.Base} element
102151
102324
  * @param {Array<Object>} entries
102152
102325
  */
102153
- ElementTemplatesReplaceProvider.prototype._addPlainElementEntry = function(element, entries) {
102326
+ UnlinkTemplateReplaceProvider.prototype.addPlainElementEntry = function(element, entries, translate, elementTemplates) {
102154
102327
 
102155
- const replaceOption = this._getPlainEntry(element, entries);
102328
+ const replaceOption = this.getPlainEntry(element, entries, translate, elementTemplates);
102156
102329
 
102157
102330
  if (!replaceOption) {
102158
102331
  return;
@@ -102175,7 +102348,7 @@
102175
102348
  *
102176
102349
  * @returns {Array<Object, number>}
102177
102350
  */
102178
- ElementTemplatesReplaceProvider.prototype._getPlainEntry = function(element, entries) {
102351
+ UnlinkTemplateReplaceProvider.prototype.getPlainEntry = function(element, entries, translate, elementTemplates) {
102179
102352
 
102180
102353
  const {
102181
102354
  options,
@@ -102190,9 +102363,9 @@
102190
102363
  const entry = {
102191
102364
  id: 'replace-unlink-element-template',
102192
102365
  action: () => {
102193
- this._elementTemplates.applyTemplate(element, null);
102366
+ elementTemplates.applyTemplate(element, null);
102194
102367
  },
102195
- label: this._translate(option.label),
102368
+ label: translate(option.label),
102196
102369
  className: option.className
102197
102370
  };
102198
102371
 
@@ -102223,66 +102396,34 @@
102223
102396
  ];
102224
102397
  };
102225
102398
 
102399
+
102226
102400
  /**
102227
- * Get all element templates that can be used to replace the given element.
102228
- *
102229
- * @param {djs.model.Base} element
102401
+ * @param {ModdleElement} element
102230
102402
  *
102231
- * @return {Array<Object>} a list of element templates as menu entries
102403
+ * @return { { options: Array<any>, option: any, optionIndex: number } | null }
102232
102404
  */
102233
- ElementTemplatesReplaceProvider.prototype.getTemplateEntries = function(element) {
102234
-
102235
- const templates = this._getMatchingTemplates(element);
102236
- return templates.map(template => {
102237
-
102238
- const {
102239
- icon = {},
102240
- category,
102241
- } = template;
102242
-
102243
- const entryId = `replace.template-${template.id}`;
102244
-
102245
- const defaultGroup = {
102246
- id: 'templates',
102247
- name: this._translate('Templates')
102248
- };
102405
+ function findReplaceOptions(element) {
102249
102406
 
102250
- return [ entryId, {
102251
- name: template.name,
102252
- description: template.description,
102253
- documentationRef: template.documentationRef,
102254
- imageUrl: icon.contents,
102255
- group: category || defaultGroup,
102256
- action: () => {
102257
- this._elementTemplates.applyTemplate(element, template);
102258
- }
102259
- } ];
102260
- });
102261
- };
102407
+ const isSameType = (element, option) => option.target && !isDifferentType(element)(option);
102262
102408
 
102263
- /**
102264
- * Returns the templates that can the element can be replaced with.
102265
- *
102266
- * @param {djs.model.Base} element
102267
- *
102268
- * @return {Array<ElementTemplate>}
102269
- */
102270
- ElementTemplatesReplaceProvider.prototype._getMatchingTemplates = function(element) {
102271
- return this._elementTemplates.getLatest().filter(template => {
102272
- return isAny(element, template.appliesTo) && !isTemplateApplied(element, template);
102273
- });
102274
- };
102409
+ return getReplaceOptionGroups().reduce((result, options) => {
102275
102410
 
102411
+ if (result) {
102412
+ return result;
102413
+ }
102276
102414
 
102277
- // helpers ////////////
102278
- function isTemplateApplied(element, template) {
102279
- const businessObject = getBusinessObject$1(element);
102415
+ const optionIndex = options.findIndex(option => isSameType(element, option));
102280
102416
 
102281
- if (businessObject) {
102282
- return businessObject.get('zeebe:modelerTemplate') === template.id;
102283
- }
102417
+ if (optionIndex === -1) {
102418
+ return;
102419
+ }
102284
102420
 
102285
- return false;
102421
+ return {
102422
+ options,
102423
+ option: options[optionIndex],
102424
+ optionIndex
102425
+ };
102426
+ }, null);
102286
102427
  }
102287
102428
 
102288
102429
  function getOptionIndex(options, index, entries) {
@@ -102297,38 +102438,190 @@
102297
102438
  );
102298
102439
  }
102299
102440
 
102300
- /**
102301
- * @param {ModdleElement} element
102302
- *
102303
- * @return { { options: Array<any>, option: any, optionIndex: number } | null }
102304
- */
102305
- function findReplaceOptions(element) {
102441
+ var sharedReplaceModule = {
102442
+ __init__: [
102443
+ 'unlinkTemplateReplaceProvider'
102444
+ ],
102445
+ unlinkTemplateReplaceProvider: [ 'type', UnlinkTemplateReplaceProvider ]
102446
+ };
102306
102447
 
102307
- const isSameType = (element, option) => option.target && !isDifferentType(element)(option);
102448
+ const colorImageSvg = '<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22"><path d="m12.5 5.5.3-.4 3.6-3.6c.5-.5 1.3-.5 1.7 0l1 1c.5.4.5 1.2 0 1.7l-3.6 3.6-.4.2v.2c0 1.4.6 2 1 2.7v.6l-1.7 1.6c-.2.2-.4.2-.6 0L7.3 6.6a.4.4 0 0 1 0-.6l.3-.3.5-.5.8-.8c.2-.2.4-.1.6 0 .9.5 1.5 1.1 3 1.1zm-9.9 6 4.2-4.2 6.3 6.3-4.2 4.2c-.3.3-.9.3-1.2 0l-.8-.8-.9-.8-2.3-2.9" /></svg>';
102449
+
102450
+ const colorImageUrl = 'data:image/svg+xml;utf8,' + encodeURIComponent(colorImageSvg);
102451
+
102452
+
102453
+ function ColorContextPadProvider(contextPad, popupMenu, canvas, translate) {
102454
+
102455
+ this._contextPad = contextPad;
102456
+ this._popupMenu = popupMenu;
102457
+ this._canvas = canvas;
102458
+ this._translate = translate;
102459
+
102460
+ contextPad.registerProvider(this);
102461
+ }
102462
+
102463
+
102464
+ ColorContextPadProvider.$inject = [
102465
+ 'contextPad',
102466
+ 'popupMenu',
102467
+ 'canvas',
102468
+ 'translate'
102469
+ ];
102470
+
102471
+
102472
+ ColorContextPadProvider.prototype.getContextPadEntries = function(element) {
102473
+ return this._createPopupAction([ element ]);
102474
+ };
102475
+
102476
+
102477
+ ColorContextPadProvider.prototype.getMultiElementContextPadEntries = function(elements) {
102478
+
102479
+ return this._createPopupAction(elements);
102480
+ };
102481
+
102482
+ ColorContextPadProvider.prototype._createPopupAction = function(elements) {
102483
+
102484
+ const canvas = this._canvas;
102485
+ const translate = this._translate;
102486
+ const contextPad = this._contextPad;
102487
+ const popupMenu = this._popupMenu;
102488
+
102489
+ return {
102490
+ 'set-color': {
102491
+ group: 'edit',
102492
+ className: 'bpmn-icon-color',
102493
+ title: translate('Set Color'),
102494
+ imageUrl: colorImageUrl,
102495
+ action: {
102496
+ click: (event, element) => {
102497
+
102498
+ // get start popup draw start position
102499
+ var position = {
102500
+ ...getStartPosition(canvas, contextPad, elements),
102501
+ cursor: {
102502
+ x: event.x,
102503
+ y: event.y
102504
+ }
102505
+ };
102506
+
102507
+ // open new color-picker popup
102508
+ popupMenu.open(elements, 'color-picker', position);
102509
+ }
102510
+ }
102511
+ }
102512
+ };
102513
+
102514
+ };
102515
+
102516
+
102517
+ // helpers //////////////////////
102518
+
102519
+ function getStartPosition(canvas, contextPad, elements) {
102520
+
102521
+ var Y_OFFSET = 5;
102522
+
102523
+ var diagramContainer = canvas.getContainer(),
102524
+ pad = contextPad.getPad(elements).html;
102525
+
102526
+ var diagramRect = diagramContainer.getBoundingClientRect(),
102527
+ padRect = pad.getBoundingClientRect();
102528
+
102529
+ var top = padRect.top - diagramRect.top;
102530
+ var left = padRect.left - diagramRect.left;
102531
+
102532
+ var pos = {
102533
+ x: left,
102534
+ y: top + padRect.height + Y_OFFSET
102535
+ };
102536
+
102537
+ return pos;
102538
+ }
102308
102539
 
102309
- return getReplaceOptionGroups().reduce((result, options) => {
102540
+ const COLORS = [ {
102541
+ label: 'Default',
102542
+ fill: undefined,
102543
+ stroke: undefined
102544
+ }, {
102545
+ label: 'Blue',
102546
+ fill: '#BBDEFB',
102547
+ stroke: '#0D4372'
102548
+ }, {
102549
+ label: 'Orange',
102550
+ fill: '#FFE0B2',
102551
+ stroke: '#6B3C00'
102552
+ }, {
102553
+ label: 'Green',
102554
+ fill: '#C8E6C9',
102555
+ stroke: '#205022'
102556
+ }, {
102557
+ label: 'Red',
102558
+ fill: '#FFCDD2',
102559
+ stroke: '#831311'
102560
+ }, {
102561
+ label: 'Purple',
102562
+ fill: '#E1BEE7',
102563
+ stroke: '#5B176D'
102564
+ } ];
102310
102565
 
102311
- if (result) {
102312
- return result;
102313
- }
102314
102566
 
102315
- const optionIndex = options.findIndex(option => isSameType(element, option));
102567
+ function ColorPopupProvider(config, popupMenu, modeling, translate) {
102568
+ this._popupMenu = popupMenu;
102569
+ this._modeling = modeling;
102570
+ this._translate = translate;
102316
102571
 
102317
- if (optionIndex === -1) {
102318
- return;
102319
- }
102572
+ this._colors = config && config.colors || COLORS;
102573
+
102574
+ this._popupMenu.registerProvider('color-picker', this);
102575
+ }
102576
+
102577
+
102578
+ ColorPopupProvider.$inject = [
102579
+ 'config.colorPicker',
102580
+ 'popupMenu',
102581
+ 'modeling',
102582
+ 'translate'
102583
+ ];
102584
+
102585
+
102586
+ ColorPopupProvider.prototype.getEntries = function(elements) {
102587
+ var self = this;
102588
+
102589
+ var colorIcon = domify$1(`
102590
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" height="100%">
102591
+ <rect rx="2" x="1" y="1" width="22" height="22" fill="var(--fill-color)" stroke="var(--stroke-color)"></rect>
102592
+ </svg>
102593
+ `);
102594
+
102595
+ var entries = this._colors.map(function(color) {
102596
+
102597
+ colorIcon.style.setProperty('--fill-color', color.fill || 'white');
102598
+ colorIcon.style.setProperty('--stroke-color', color.stroke || 'rgb(34, 36, 42)');
102320
102599
 
102321
102600
  return {
102322
- options,
102323
- option: options[optionIndex],
102324
- optionIndex
102601
+ title: self._translate(color.label),
102602
+ id: color.label.toLowerCase() + '-color',
102603
+ imageUrl: `data:image/svg+xml;utf8,${ encodeURIComponent(colorIcon.outerHTML) }`,
102604
+ action: createAction(self._modeling, elements, color)
102325
102605
  };
102326
- }, null);
102606
+ });
102607
+
102608
+ return entries;
102609
+ };
102610
+
102611
+
102612
+ function createAction(modeling, element, color) {
102613
+ return function() {
102614
+ modeling.setColor(element, color);
102615
+ };
102327
102616
  }
102328
102617
 
102329
- var replaceModule = {
102330
- __init__: [ 'elementTemplatesProvider' ],
102331
- elementTemplatesProvider: [ 'type', ElementTemplatesReplaceProvider ]
102618
+ var colorPickerModule = {
102619
+ __init__: [
102620
+ 'colorContextPadProvider',
102621
+ 'colorPopupProvider'
102622
+ ],
102623
+ colorContextPadProvider: [ 'type', ColorContextPadProvider ],
102624
+ colorPopupProvider: [ 'type', ColorPopupProvider ]
102332
102625
  };
102333
102626
 
102334
102627
  function getModelerTemplateIcon(element) {
@@ -102872,7 +103165,9 @@
102872
103165
  rulesModule,
102873
103166
  zeebePropertiesProviderModule,
102874
103167
  index$1,
102875
- replaceModule
103168
+ replaceModule,
103169
+ sharedReplaceModule,
103170
+ colorPickerModule
102876
103171
  ];
102877
103172
 
102878
103173
  Modeler.prototype._modules = [].concat(