camunda-bpmn-js 0.24.1 → 1.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 (29) hide show
  1. package/dist/assets/base-modeler.css +2 -1
  2. package/dist/assets/color-picker.css +10 -0
  3. package/dist/assets/diagram-js.css +1 -3
  4. package/dist/base-modeler.development.js +751 -243
  5. package/dist/base-modeler.production.min.js +22 -22
  6. package/dist/base-navigated-viewer.development.js +3 -0
  7. package/dist/base-navigated-viewer.production.min.js +1 -1
  8. package/dist/base-viewer.development.js +3 -0
  9. package/dist/base-viewer.production.min.js +1 -1
  10. package/dist/camunda-cloud-modeler.development.js +1570 -415
  11. package/dist/camunda-cloud-modeler.production.min.js +22 -22
  12. package/dist/camunda-cloud-navigated-viewer.development.js +3 -0
  13. package/dist/camunda-cloud-navigated-viewer.production.min.js +1 -1
  14. package/dist/camunda-cloud-viewer.development.js +3 -0
  15. package/dist/camunda-cloud-viewer.production.min.js +1 -1
  16. package/dist/camunda-platform-modeler.development.js +1180 -269
  17. package/dist/camunda-platform-modeler.production.min.js +26 -26
  18. package/dist/camunda-platform-navigated-viewer.development.js +3 -0
  19. package/dist/camunda-platform-navigated-viewer.production.min.js +1 -1
  20. package/dist/camunda-platform-viewer.development.js +3 -0
  21. package/dist/camunda-platform-viewer.production.min.js +1 -1
  22. package/lib/camunda-cloud/Modeler.js +5 -1
  23. package/lib/camunda-cloud/features/replace/ElementTemplatesReplaceProvider.js +3 -141
  24. package/lib/camunda-platform/Modeler.js +6 -1
  25. package/lib/shared/features/replace/UnlinkTemplateReplaceProvider.js +178 -0
  26. package/lib/shared/features/replace/index.js +8 -0
  27. package/lib/{camunda-cloud/features/replace → shared/features/replace/util}/ReplaceOptionsUtil.js +0 -0
  28. package/package.json +9 -7
  29. package/styles/base-modeler.css +2 -1
@@ -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
  *
@@ -28337,11 +28375,11 @@
28337
28375
 
28338
28376
  var n$3,l$3,u$3,t$5,o$5,f$3={},e$5=[],c$3=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function s$3(n,l){for(var u in l)n[u]=l[u];return n}function a$4(n){var l=n.parentNode;l&&l.removeChild(n);}function h$3(l,u,i){var t,o,r,f={};for(r in u)"key"==r?t=u[r]:"ref"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n$3.call(arguments,2):i),"function"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return v$3(l,f,t,o,null)}function v$3(n,i,t,o,r){var f={type:n,props:i,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++u$3:r};return null==r&&null!=l$3.vnode&&l$3.vnode(f),f}function p$4(n){return n.children}function d$3(n,l){this.props=n,this.context=l;}function _$3(n,l){if(null==l)return n.__?_$3(n.__,n.__.__k.indexOf(n)+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return "function"==typeof n.type?_$3(n):null}function k$4(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return k$4(n)}}function b$3(n){(!n.__d&&(n.__d=!0)&&t$5.push(n)&&!g$4.__r++||o$5!==l$3.debounceRendering)&&((o$5=l$3.debounceRendering)||setTimeout)(g$4);}function g$4(){for(var n;g$4.__r=t$5.length;)n=t$5.sort(function(n,l){return n.__v.__b-l.__v.__b}),t$5=[],n.some(function(n){var l,u,i,t,o,r;n.__d&&(o=(t=(l=n).__v).__e,(r=l.__P)&&(u=[],(i=s$3({},t)).__v=t.__v+1,j$4(r,t,i,l.__n,void 0!==r.ownerSVGElement,null!=t.__h?[o]:null,u,null==o?_$3(t):o,t.__h),z$3(u,t),t.__e!=o&&k$4(t)));});}function w$4(n,l,u,i,t,o,r,c,s,a){var h,y,d,k,b,g,w,x=i&&i.__k||e$5,C=x.length;for(u.__k=[],h=0;h<l.length;h++)if(null!=(k=u.__k[h]=null==(k=l[h])||"boolean"==typeof k?null:"string"==typeof k||"number"==typeof k||"bigint"==typeof k?v$3(null,k,null,null,k):Array.isArray(k)?v$3(p$4,{children:k},null,null,null):k.__b>0?v$3(k.type,k.props,k.key,k.ref?k.ref:null,k.__v):k)){if(k.__=u,k.__b=u.__b+1,null===(d=x[h])||d&&k.key==d.key&&k.type===d.type)x[h]=void 0;else for(y=0;y<C;y++){if((d=x[y])&&k.key==d.key&&k.type===d.type){x[y]=void 0;break}d=null;}j$4(n,k,d=d||f$3,t,o,r,c,s,a),b=k.__e,(y=k.ref)&&d.ref!=y&&(w||(w=[]),d.ref&&w.push(d.ref,null,k),w.push(y,k.__c||b,k)),null!=b?(null==g&&(g=b),"function"==typeof k.type&&k.__k===d.__k?k.__d=s=m$4(k,s,n):s=A$3(n,k,d,x,b,s),"function"==typeof u.type&&(u.__d=s)):s&&d.__e==s&&s.parentNode!=n&&(s=_$3(d));}for(u.__e=g,h=C;h--;)null!=x[h]&&N$2(x[h],x[h]);if(w)for(h=0;h<w.length;h++)M$2(w[h],w[++h],w[++h]);}function m$4(n,l,u){for(var i,t=n.__k,o=0;t&&o<t.length;o++)(i=t[o])&&(i.__=n,l="function"==typeof i.type?m$4(i,l,u):A$3(u,i,i,t,i.__e,l));return l}function A$3(n,l,u,i,t,o){var r,f,e;if(void 0!==l.__d)r=l.__d,l.__d=void 0;else if(null==u||t!=o||null==t.parentNode)n:if(null==o||o.parentNode!==n)n.appendChild(t),r=null;else {for(f=o,e=0;(f=f.nextSibling)&&e<i.length;e+=1)if(f==t)break n;n.insertBefore(t,o),r=o;}return void 0!==r?r:t.nextSibling}function C$3(n,l,u,i,t){var o;for(o in u)"children"===o||"key"===o||o in l||H$2(n,o,null,u[o],i);for(o in l)t&&"function"!=typeof l[o]||"children"===o||"key"===o||"value"===o||"checked"===o||u[o]===l[o]||H$2(n,o,l[o],u[o],i);}function $$2(n,l,u){"-"===l[0]?n.setProperty(l,u):n[l]=null==u?"":"number"!=typeof u||c$3.test(l)?u:u+"px";}function H$2(n,l,u,i,t){var o;n:if("style"===l)if("string"==typeof u)n.style.cssText=u;else {if("string"==typeof i&&(n.style.cssText=i=""),i)for(l in i)u&&l in u||$$2(n.style,l,"");if(u)for(l in u)i&&u[l]===i[l]||$$2(n.style,l,u[l]);}else if("o"===l[0]&&"n"===l[1])o=l!==(l=l.replace(/Capture$/,"")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?i||n.addEventListener(l,o?T$4:I$2,o):n.removeEventListener(l,o?T$4:I$2,o);else if("dangerouslySetInnerHTML"!==l){if(t)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("href"!==l&&"list"!==l&&"form"!==l&&"tabIndex"!==l&&"download"!==l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null==u||!1===u&&-1==l.indexOf("-")?n.removeAttribute(l):n.setAttribute(l,u));}}function I$2(n){this.l[n.type+!1](l$3.event?l$3.event(n):n);}function T$4(n){this.l[n.type+!0](l$3.event?l$3.event(n):n);}function j$4(n,u,i,t,o,r,f,e,c){var a,h,v,y,_,k,b,g,m,x,A,C,$,H,I,T=u.type;if(void 0!==u.constructor)return null;null!=i.__h&&(c=i.__h,e=u.__e=i.__e,u.__h=null,r=[e]),(a=l$3.__b)&&a(u);try{n:if("function"==typeof T){if(g=u.props,m=(a=T.contextType)&&t[a.__c],x=a?m?m.props.value:a.__:t,i.__c?b=(h=u.__c=i.__c).__=h.__E:("prototype"in T&&T.prototype.render?u.__c=h=new T(g,x):(u.__c=h=new d$3(g,x),h.constructor=T,h.render=O$2),m&&m.sub(h),h.props=g,h.state||(h.state={}),h.context=x,h.__n=t,v=h.__d=!0,h.__h=[],h._sb=[]),null==h.__s&&(h.__s=h.state),null!=T.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=s$3({},h.__s)),s$3(h.__s,T.getDerivedStateFromProps(g,h.__s))),y=h.props,_=h.state,v)null==T.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else {if(null==T.getDerivedStateFromProps&&g!==y&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(g,x),!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(g,h.__s,x)||u.__v===i.__v){for(h.props=g,h.state=h.__s,u.__v!==i.__v&&(h.__d=!1),h.__v=u,u.__e=i.__e,u.__k=i.__k,u.__k.forEach(function(n){n&&(n.__=u);}),A=0;A<h._sb.length;A++)h.__h.push(h._sb[A]);h._sb=[],h.__h.length&&f.push(h);break n}null!=h.componentWillUpdate&&h.componentWillUpdate(g,h.__s,x),null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(y,_,k);});}if(h.context=x,h.props=g,h.__v=u,h.__P=n,C=l$3.__r,$=0,"prototype"in T&&T.prototype.render){for(h.state=h.__s,h.__d=!1,C&&C(u),a=h.render(h.props,h.state,h.context),H=0;H<h._sb.length;H++)h.__h.push(h._sb[H]);h._sb=[];}else do{h.__d=!1,C&&C(u),a=h.render(h.props,h.state,h.context),h.state=h.__s;}while(h.__d&&++$<25);h.state=h.__s,null!=h.getChildContext&&(t=s$3(s$3({},t),h.getChildContext())),v||null==h.getSnapshotBeforeUpdate||(k=h.getSnapshotBeforeUpdate(y,_)),I=null!=a&&a.type===p$4&&null==a.key?a.props.children:a,w$4(n,Array.isArray(I)?I:[I],u,i,t,o,r,f,e,c),h.base=u.__e,u.__h=null,h.__h.length&&f.push(h),b&&(h.__E=h.__=null),h.__e=!1;}else null==r&&u.__v===i.__v?(u.__k=i.__k,u.__e=i.__e):u.__e=L$2(i.__e,u,i,t,o,r,f,c);(a=l$3.diffed)&&a(u);}catch(n){u.__v=null,(c||null!=r)&&(u.__e=e,u.__h=!!c,r[r.indexOf(e)]=null),l$3.__e(n,u,i);}}function z$3(n,u){l$3.__c&&l$3.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u);});}catch(n){l$3.__e(n,u.__v);}});}function L$2(l,u,i,t,o,r,e,c){var s,h,v,y=i.props,p=u.props,d=u.type,k=0;if("svg"===d&&(o=!0),null!=r)for(;k<r.length;k++)if((s=r[k])&&"setAttribute"in s==!!d&&(d?s.localName===d:3===s.nodeType)){l=s,r[k]=null;break}if(null==l){if(null===d)return document.createTextNode(p);l=o?document.createElementNS("http://www.w3.org/2000/svg",d):document.createElement(d,p.is&&p),r=null,c=!1;}if(null===d)y===p||c&&l.data===p||(l.data=p);else {if(r=r&&n$3.call(l.childNodes),h=(y=i.props||f$3).dangerouslySetInnerHTML,v=p.dangerouslySetInnerHTML,!c){if(null!=r)for(y={},k=0;k<l.attributes.length;k++)y[l.attributes[k].name]=l.attributes[k].value;(v||h)&&(v&&(h&&v.__html==h.__html||v.__html===l.innerHTML)||(l.innerHTML=v&&v.__html||""));}if(C$3(l,p,y,o,c),v)u.__k=[];else if(k=u.props.children,w$4(l,Array.isArray(k)?k:[k],u,i,t,o&&"foreignObject"!==d,r,e,r?r[0]:i.__k&&_$3(i,0),c),null!=r)for(k=r.length;k--;)null!=r[k]&&a$4(r[k]);c||("value"in p&&void 0!==(k=p.value)&&(k!==l.value||"progress"===d&&!k||"option"===d&&k!==y.value)&&H$2(l,"value",k,y.value,!1),"checked"in p&&void 0!==(k=p.checked)&&k!==l.checked&&H$2(l,"checked",k,y.checked,!1));}return l}function M$2(n,u,i){try{"function"==typeof n?n(u):n.current=u;}catch(n){l$3.__e(n,i);}}function N$2(n,u,i){var t,o;if(l$3.unmount&&l$3.unmount(n),(t=n.ref)&&(t.current&&t.current!==n.__e||M$2(t,null,u)),null!=(t=n.__c)){if(t.componentWillUnmount)try{t.componentWillUnmount();}catch(n){l$3.__e(n,u);}t.base=t.__P=null,n.__c=void 0;}if(t=n.__k)for(o=0;o<t.length;o++)t[o]&&N$2(t[o],u,i||"function"!=typeof n.type);i||null==n.__e||a$4(n.__e),n.__=n.__e=n.__d=void 0;}function O$2(n,l,u){return this.constructor(n,u)}function P$2(u,i,t){var o,r,e;l$3.__&&l$3.__(u,i),r=(o="function"==typeof t)?null:t&&t.__k||i.__k,e=[],j$4(i,u=(!o&&t||i).__k=h$3(p$4,null,[u]),r||f$3,f$3,void 0!==i.ownerSVGElement,!o&&t?[t]:r?null:i.firstChild?n$3.call(i.childNodes):null,e,!o&&t?t:r?r.__e:i.firstChild,o),z$3(e,u);}n$3=e$5.slice,l$3={__e:function(n,l,u,i){for(var t,o,r;l=l.__;)if((t=l.__c)&&!t.__)try{if((o=t.constructor)&&null!=o.getDerivedStateFromError&&(t.setState(o.getDerivedStateFromError(n)),r=t.__d),null!=t.componentDidCatch&&(t.componentDidCatch(n,i||{}),r=t.__d),r)return t.__E=t}catch(l){n=l;}throw n}},u$3=0,d$3.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=s$3({},this.state),"function"==typeof n&&(n=n(s$3({},u),this.props)),n&&s$3(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),b$3(this));},d$3.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),b$3(this));},d$3.prototype.render=p$4,t$5=[],g$4.__r=0;
28339
28377
 
28340
- var t$4,r$3,u$2,i$4,o$4=0,f$2=[],c$2=[],e$4=l$3.__b,a$3=l$3.__r,v$2=l$3.diffed,l$2=l$3.__c,m$3=l$3.unmount;function d$2(t,u){l$3.__h&&l$3.__h(r$3,t,o$4||u),o$4=0;var i=r$3.__H||(r$3.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({__V:c$2}),i.__[t]}function p$3(n){return o$4=1,y$2(B$1,n)}function y$2(n,u,i){var o=d$2(t$4++,2);if(o.t=n,!o.__c&&(o.__=[i?i(u):B$1(void 0,u),function(n){var t=o.__N?o.__N[0]:o.__[0],r=o.t(t,n);t!==r&&(o.__N=[r,o.__[1]],o.__c.setState({}));}],o.__c=r$3,!r$3.u)){r$3.u=!0;var f=r$3.shouldComponentUpdate;r$3.shouldComponentUpdate=function(n,t,r){if(!o.__c.__H)return !0;var u=o.__c.__H.__.filter(function(n){return n.__c});if(u.every(function(n){return !n.__N}))return !f||f.call(this,n,t,r);var i=!1;return u.forEach(function(n){if(n.__N){var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(i=!0);}}),!(!i&&o.__c.props===n)&&(!f||f.call(this,n,t,r))};}return o.__N||o.__}function h$2(u,i){var o=d$2(t$4++,3);!l$3.__s&&z$2(o.__H,i)&&(o.__=u,o.i=i,r$3.__H.__h.push(o));}function s$2(u,i){var o=d$2(t$4++,4);!l$3.__s&&z$2(o.__H,i)&&(o.__=u,o.i=i,r$3.__h.push(o));}function _$2(n){return o$4=5,F$2(function(){return {current:n}},[])}function F$2(n,r){var u=d$2(t$4++,7);return z$2(u.__H,r)?(u.__V=n(),u.i=r,u.__h=n,u.__V):u.__}function T$3(n,t){return o$4=8,F$2(function(){return n},t)}function b$2(){for(var t;t=f$2.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(k$3),t.__H.__h.forEach(w$3),t.__H.__h=[];}catch(r){t.__H.__h=[],l$3.__e(r,t.__v);}}l$3.__b=function(n){r$3=null,e$4&&e$4(n);},l$3.__r=function(n){a$3&&a$3(n),t$4=0;var i=(r$3=n.__c).__H;i&&(u$2===r$3?(i.__h=[],r$3.__h=[],i.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=c$2,n.__N=n.i=void 0;})):(i.__h.forEach(k$3),i.__h.forEach(w$3),i.__h=[])),u$2=r$3;},l$3.diffed=function(t){v$2&&v$2(t);var o=t.__c;o&&o.__H&&(o.__H.__h.length&&(1!==f$2.push(o)&&i$4===l$3.requestAnimationFrame||((i$4=l$3.requestAnimationFrame)||j$3)(b$2)),o.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==c$2&&(n.__=n.__V),n.i=void 0,n.__V=c$2;})),u$2=r$3=null;},l$3.__c=function(t,r){r.some(function(t){try{t.__h.forEach(k$3),t.__h=t.__h.filter(function(n){return !n.__||w$3(n)});}catch(u){r.some(function(n){n.__h&&(n.__h=[]);}),r=[],l$3.__e(u,t.__v);}}),l$2&&l$2(t,r);},l$3.unmount=function(t){m$3&&m$3(t);var r,u=t.__c;u&&u.__H&&(u.__H.__.forEach(function(n){try{k$3(n);}catch(n){r=n;}}),u.__H=void 0,r&&l$3.__e(r,u.__v));};var g$3="function"==typeof requestAnimationFrame;function j$3(n){var t,r=function(){clearTimeout(u),g$3&&cancelAnimationFrame(t),setTimeout(n);},u=setTimeout(r,100);g$3&&(t=requestAnimationFrame(r));}function k$3(n){var t=r$3,u=n.__c;"function"==typeof u&&(n.__c=void 0,u()),r$3=t;}function w$3(n){var t=r$3;n.__c=n.__(),r$3=t;}function z$2(n,t){return !n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function B$1(n,t){return "function"==typeof t?t(n):t}
28378
+ var n$2=function(t,s,r,e){var u;s[0]=0;for(var h=1;h<s.length;h++){var p=s[h++],a=s[h]?(s[0]|=p?1:2,r[s[h++]]):s[++h];3===p?e[0]=a:4===p?e[1]=Object.assign(e[1]||{},a):5===p?(e[1]=e[1]||{})[s[++h]]=a:6===p?e[1][s[++h]]+=a+"":p?(u=t.apply(a,n$2(t,a,r,["",null])),e.push(u),a[0]?s[0]|=2:(s[h-2]=0,s[h]=u)):e.push(a);}return e},t$4=new Map;function e$4(s){var r=t$4.get(this);return r||(r=new Map,t$4.set(this,r)),(r=n$2(this,r.get(s)||(r.set(s,r=function(n){for(var t,s,r=1,e="",u="",h=[0],p=function(n){1===r&&(n||(e=e.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?h.push(0,n,e):3===r&&(n||e)?(h.push(3,n,e),r=2):2===r&&"..."===e&&n?h.push(4,n,0):2===r&&e&&!n?h.push(5,0,!0,e):r>=5&&((e||!n&&5===r)&&(h.push(r,0,e,s),r=6),n&&(h.push(r,n,0,s),r=6)),e="";},a=0;a<n.length;a++){a&&(1===r&&p(),p(a));for(var l=0;l<n[a].length;l++)t=n[a][l],1===r?"<"===t?(p(),h=[h],r=3):e+=t:4===r?"--"===e&&">"===t?(r=1,e=""):e=t+e[0]:u?t===u?u="":e+=t:'"'===t||"'"===t?u=t:">"===t?(p(),r=1):r&&("="===t?(r=5,s=e,e=""):"/"===t&&(r<5||">"===n[a][l+1])?(p(),3===r&&(h=h[0]),r=h,(h=h[0]).push(2,0,r),r=0):" "===t||"\t"===t||"\n"===t||"\r"===t?(p(),r=2):e+=t),3===r&&"!--"===e&&(r=4,h=h[0]);}return p(),h}(s)),r),arguments,[])).length>1?r:r[0]}
28341
28379
 
28342
- var n$2=function(t,s,r,e){var u;s[0]=0;for(var h=1;h<s.length;h++){var p=s[h++],a=s[h]?(s[0]|=p?1:2,r[s[h++]]):s[++h];3===p?e[0]=a:4===p?e[1]=Object.assign(e[1]||{},a):5===p?(e[1]=e[1]||{})[s[++h]]=a:6===p?e[1][s[++h]]+=a+"":p?(u=t.apply(a,n$2(t,a,r,["",null])),e.push(u),a[0]?s[0]|=2:(s[h-2]=0,s[h]=u)):e.push(a);}return e},t$3=new Map;function e$3(s){var r=t$3.get(this);return r||(r=new Map,t$3.set(this,r)),(r=n$2(this,r.get(s)||(r.set(s,r=function(n){for(var t,s,r=1,e="",u="",h=[0],p=function(n){1===r&&(n||(e=e.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?h.push(0,n,e):3===r&&(n||e)?(h.push(3,n,e),r=2):2===r&&"..."===e&&n?h.push(4,n,0):2===r&&e&&!n?h.push(5,0,!0,e):r>=5&&((e||!n&&5===r)&&(h.push(r,0,e,s),r=6),n&&(h.push(r,n,0,s),r=6)),e="";},a=0;a<n.length;a++){a&&(1===r&&p(),p(a));for(var l=0;l<n[a].length;l++)t=n[a][l],1===r?"<"===t?(p(),h=[h],r=3):e+=t:4===r?"--"===e&&">"===t?(r=1,e=""):e=t+e[0]:u?t===u?u="":e+=t:'"'===t||"'"===t?u=t:">"===t?(p(),r=1):r&&("="===t?(r=5,s=e,e=""):"/"===t&&(r<5||">"===n[a][l+1])?(p(),3===r&&(h=h[0]),r=h,(h=h[0]).push(2,0,r),r=0):" "===t||"\t"===t||"\n"===t||"\r"===t?(p(),r=2):e+=t),3===r&&"!--"===e&&(r=4,h=h[0]);}return p(),h}(s)),r),arguments,[])).length>1?r:r[0]}
28380
+ var m$3=e$4.bind(h$3);
28343
28381
 
28344
- var m$2=e$3.bind(h$3);
28382
+ var t$3,r$3,u$2,i$4,o$4=0,f$2=[],c$2=[],e$3=l$3.__b,a$3=l$3.__r,v$2=l$3.diffed,l$2=l$3.__c,m$2=l$3.unmount;function d$2(t,u){l$3.__h&&l$3.__h(r$3,t,o$4||u),o$4=0;var i=r$3.__H||(r$3.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({__V:c$2}),i.__[t]}function p$3(n){return o$4=1,y$2(B$1,n)}function y$2(n,u,i){var o=d$2(t$3++,2);if(o.t=n,!o.__c&&(o.__=[i?i(u):B$1(void 0,u),function(n){var t=o.__N?o.__N[0]:o.__[0],r=o.t(t,n);t!==r&&(o.__N=[r,o.__[1]],o.__c.setState({}));}],o.__c=r$3,!r$3.u)){r$3.u=!0;var f=r$3.shouldComponentUpdate;r$3.shouldComponentUpdate=function(n,t,r){if(!o.__c.__H)return !0;var u=o.__c.__H.__.filter(function(n){return n.__c});if(u.every(function(n){return !n.__N}))return !f||f.call(this,n,t,r);var i=!1;return u.forEach(function(n){if(n.__N){var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(i=!0);}}),!(!i&&o.__c.props===n)&&(!f||f.call(this,n,t,r))};}return o.__N||o.__}function h$2(u,i){var o=d$2(t$3++,3);!l$3.__s&&z$2(o.__H,i)&&(o.__=u,o.i=i,r$3.__H.__h.push(o));}function s$2(u,i){var o=d$2(t$3++,4);!l$3.__s&&z$2(o.__H,i)&&(o.__=u,o.i=i,r$3.__h.push(o));}function _$2(n){return o$4=5,F$2(function(){return {current:n}},[])}function F$2(n,r){var u=d$2(t$3++,7);return z$2(u.__H,r)?(u.__V=n(),u.i=r,u.__h=n,u.__V):u.__}function T$3(n,t){return o$4=8,F$2(function(){return n},t)}function b$2(){for(var t;t=f$2.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(k$3),t.__H.__h.forEach(w$3),t.__H.__h=[];}catch(r){t.__H.__h=[],l$3.__e(r,t.__v);}}l$3.__b=function(n){r$3=null,e$3&&e$3(n);},l$3.__r=function(n){a$3&&a$3(n),t$3=0;var i=(r$3=n.__c).__H;i&&(u$2===r$3?(i.__h=[],r$3.__h=[],i.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=c$2,n.__N=n.i=void 0;})):(i.__h.forEach(k$3),i.__h.forEach(w$3),i.__h=[])),u$2=r$3;},l$3.diffed=function(t){v$2&&v$2(t);var o=t.__c;o&&o.__H&&(o.__H.__h.length&&(1!==f$2.push(o)&&i$4===l$3.requestAnimationFrame||((i$4=l$3.requestAnimationFrame)||j$3)(b$2)),o.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==c$2&&(n.__=n.__V),n.i=void 0,n.__V=c$2;})),u$2=r$3=null;},l$3.__c=function(t,r){r.some(function(t){try{t.__h.forEach(k$3),t.__h=t.__h.filter(function(n){return !n.__||w$3(n)});}catch(u){r.some(function(n){n.__h&&(n.__h=[]);}),r=[],l$3.__e(u,t.__v);}}),l$2&&l$2(t,r);},l$3.unmount=function(t){m$2&&m$2(t);var r,u=t.__c;u&&u.__H&&(u.__H.__.forEach(function(n){try{k$3(n);}catch(n){r=n;}}),u.__H=void 0,r&&l$3.__e(r,u.__v));};var g$3="function"==typeof requestAnimationFrame;function j$3(n){var t,r=function(){clearTimeout(u),g$3&&cancelAnimationFrame(t),setTimeout(n);},u=setTimeout(r,100);g$3&&(t=requestAnimationFrame(r));}function k$3(n){var t=r$3,u=n.__c;"function"==typeof u&&(n.__c=void 0,u()),r$3=t;}function w$3(n){var t=r$3;n.__c=n.__(),r$3=t;}function z$2(n,t){return !n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function B$1(n,t){return "function"==typeof t?t(n):t}
28345
28383
 
28346
28384
  function r$2(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r$2(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r$2(e))&&(n&&(n+=" "),n+=t);return n}
28347
28385
 
@@ -28364,7 +28402,7 @@
28364
28402
  onClick
28365
28403
  } = props;
28366
28404
 
28367
- return m$2`
28405
+ return m$3`
28368
28406
  <li
28369
28407
  class=${ clsx('entry', { selected }) }
28370
28408
  data-id=${ entry.id }
@@ -28377,17 +28415,17 @@
28377
28415
  <span
28378
28416
  class=${ clsx('djs-popup-entry-name', entry.className) }
28379
28417
  >
28380
- ${ entry.imageUrl ? m$2`
28418
+ ${ entry.imageUrl ? m$3`
28381
28419
  <img class="djs-popup-entry-icon" src=${ entry.imageUrl } />
28382
28420
  ` : null }
28383
28421
 
28384
- ${ entry.label ? m$2`
28422
+ ${ entry.label ? m$3`
28385
28423
  <span class="djs-popup-label">
28386
28424
  ${ entry.label }
28387
28425
  </span>
28388
28426
  ` : null }
28389
28427
  </span>
28390
- ${ entry.description && m$2`
28428
+ ${ entry.description && m$3`
28391
28429
  <span
28392
28430
  class="djs-popup-entry-description"
28393
28431
  title=${ entry.description }
@@ -28396,7 +28434,7 @@
28396
28434
  </span>
28397
28435
  ` }
28398
28436
  </div>
28399
- ${ entry.documentationRef && m$2`
28437
+ ${ entry.documentationRef && m$3`
28400
28438
  <div class="djs-popup-entry-docs">
28401
28439
  <a
28402
28440
  href="${ entry.documentationRef }"
@@ -28451,16 +28489,16 @@
28451
28489
  }
28452
28490
  }, [ selectedEntry ]);
28453
28491
 
28454
- return m$2`
28492
+ return m$3`
28455
28493
  <div class="djs-popup-results" ref=${ resultsRef }>
28456
- ${ groups.map(group => m$2`
28457
- ${ group.name && m$2`
28494
+ ${ groups.map(group => m$3`
28495
+ ${ group.name && m$3`
28458
28496
  <div key=${ group.id } class="entry-header" title=${ group.name }>
28459
28497
  ${ group.name }
28460
28498
  </div>
28461
28499
  ` }
28462
28500
  <ul class="djs-popup-group" data-group=${ group.id }>
28463
- ${ group.entries.map(entry => m$2`
28501
+ ${ group.entries.map(entry => m$3`
28464
28502
  <${PopupMenuItem}
28465
28503
  key=${ entry.id }
28466
28504
  entry=${ entry }
@@ -28679,7 +28717,7 @@
28679
28717
 
28680
28718
  const displayHeader = F$2(() => title || headerEntries.length > 0, [ title, headerEntries ]);
28681
28719
 
28682
- return m$2`
28720
+ return m$3`
28683
28721
  <${PopupMenuWrapper}
28684
28722
  onClose=${ onClose }
28685
28723
  onKeyup=${ handleKey }
@@ -28689,10 +28727,10 @@
28689
28727
  width=${ width }
28690
28728
  scale=${ scale }
28691
28729
  >
28692
- ${ displayHeader && m$2`
28730
+ ${ displayHeader && m$3`
28693
28731
  <div class="djs-popup-header">
28694
28732
  <h3 class="djs-popup-title" title=${ title }>${ title }</h3>
28695
- ${ headerEntries.map(entry => m$2`
28733
+ ${ headerEntries.map(entry => m$3`
28696
28734
  <span
28697
28735
  class=${ getHeaderClasses(entry, entry === selectedEntry) }
28698
28736
  onClick=${ event => onSelect(event, entry) }
@@ -28701,21 +28739,21 @@
28701
28739
  onMouseEnter=${ () => setSelectedEntry(entry) }
28702
28740
  onMouseLeave=${ () => setSelectedEntry(null) }
28703
28741
  >
28704
- ${ entry.imageUrl ? m$2`
28742
+ ${ entry.imageUrl ? m$3`
28705
28743
  <img class="djs-popup-entry-icon" src=${ entry.imageUrl } />
28706
28744
  ` : null }
28707
28745
 
28708
- ${ entry.label ? m$2`
28746
+ ${ entry.label ? m$3`
28709
28747
  <span class="djs-popup-label">${ entry.label }</span>
28710
28748
  ` : null }
28711
28749
  </span>
28712
28750
  `) }
28713
28751
  </div>
28714
28752
  ` }
28715
- ${ originalEntries.length > 0 && m$2`
28753
+ ${ originalEntries.length > 0 && m$3`
28716
28754
  <div class="djs-popup-body">
28717
28755
 
28718
- ${ searchable && m$2`
28756
+ ${ searchable && m$3`
28719
28757
  <div class="djs-popup-search">
28720
28758
  <svg class="djs-popup-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
28721
28759
  <path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>
@@ -28734,7 +28772,7 @@
28734
28772
  onClick=${ onSelect }
28735
28773
  />
28736
28774
  </div>
28737
- ${ entries.length === 0 && m$2`
28775
+ ${ entries.length === 0 && m$3`
28738
28776
  <div class="djs-popup-no-results">No matching entries found.</div>
28739
28777
  ` }
28740
28778
  ` }
@@ -28787,7 +28825,7 @@
28787
28825
  popupRef.current && popupRef.current.focus();
28788
28826
  }, []);
28789
28827
 
28790
- return m$2`
28828
+ return m$3`
28791
28829
  <div
28792
28830
  class="djs-popup-backdrop"
28793
28831
  onClick=${ checkClose }
@@ -28918,7 +28956,7 @@
28918
28956
  const onSelect = (event, entry) => this.trigger(event, entry);
28919
28957
 
28920
28958
  P$2(
28921
- m$2`
28959
+ m$3`
28922
28960
  <${PopupMenuComponent}
28923
28961
  onClose=${ onClose }
28924
28962
  onSelect=${ onSelect }
@@ -29042,13 +29080,10 @@
29042
29080
 
29043
29081
  PopupMenu.prototype._createContainer = function(config) {
29044
29082
 
29045
- let parent = config && config.parent || 'body';
29046
-
29047
- if (typeof parent === 'string') {
29048
- parent = document.querySelector(parent);
29049
- }
29083
+ var canvas = this._canvas,
29084
+ parent = canvas.getContainer();
29050
29085
 
29051
- const container = domify$1(`<div class="djs-popup-parent djs-parent" data-popup=${config.provider}></div>`);
29086
+ const container = domify$1(`<div class="djs-popup-parent djs-scrollable" data-popup=${config.provider}></div>`);
29052
29087
 
29053
29088
  parent.appendChild(container);
29054
29089
 
@@ -37810,6 +37845,25 @@
37810
37845
  }
37811
37846
  ];
37812
37847
 
37848
+ var replaceOptions = /*#__PURE__*/Object.freeze({
37849
+ __proto__: null,
37850
+ START_EVENT: START_EVENT,
37851
+ START_EVENT_SUB_PROCESS: START_EVENT_SUB_PROCESS,
37852
+ INTERMEDIATE_EVENT: INTERMEDIATE_EVENT,
37853
+ END_EVENT: END_EVENT,
37854
+ GATEWAY: GATEWAY,
37855
+ SUBPROCESS_EXPANDED: SUBPROCESS_EXPANDED,
37856
+ TRANSACTION: TRANSACTION,
37857
+ EVENT_SUB_PROCESS: EVENT_SUB_PROCESS,
37858
+ TASK: TASK,
37859
+ DATA_OBJECT_REFERENCE: DATA_OBJECT_REFERENCE,
37860
+ DATA_STORE_REFERENCE: DATA_STORE_REFERENCE,
37861
+ BOUNDARY_EVENT: BOUNDARY_EVENT,
37862
+ EVENT_SUB_PROCESS_START_EVENT: EVENT_SUB_PROCESS_START_EVENT,
37863
+ SEQUENCE_FLOW: SEQUENCE_FLOW,
37864
+ PARTICIPANT: PARTICIPANT
37865
+ });
37866
+
37813
37867
  /**
37814
37868
  * This module is an element agnostic replace menu provider for the popup menu.
37815
37869
  */
@@ -39908,6 +39962,7 @@
39908
39962
  var directEditing = injector.get('directEditing', false);
39909
39963
  var searchPad = injector.get('searchPad', false);
39910
39964
  var modeling = injector.get('modeling', false);
39965
+ var contextPad = injector.get('contextPad', false);
39911
39966
 
39912
39967
  // (2) check components and register actions
39913
39968
 
@@ -40031,6 +40086,12 @@
40031
40086
  });
40032
40087
  }
40033
40088
 
40089
+ if (selection && contextPad) {
40090
+ this._registerAction('replaceElement', function(event) {
40091
+ contextPad.triggerEntry('replace', 'click', event);
40092
+ });
40093
+ }
40094
+
40034
40095
  };
40035
40096
 
40036
40097
  var EditorActionsModule = {
@@ -41149,6 +41210,23 @@
41149
41210
  }
41150
41211
  });
41151
41212
 
41213
+ // activate replace element
41214
+ // R
41215
+ addListener('replaceElement', function(context) {
41216
+
41217
+ var event = context.keyEvent;
41218
+
41219
+ if (keyboard.hasModifier(event)) {
41220
+ return;
41221
+ }
41222
+
41223
+ if (keyboard.isKey([ 'r', 'R' ], event)) {
41224
+ editorActions.trigger('replaceElement', event);
41225
+
41226
+ return true;
41227
+ }
41228
+ });
41229
+
41152
41230
  };
41153
41231
 
41154
41232
  var KeyboardModule = {
@@ -64434,10 +64512,11 @@
64434
64512
  /**
64435
64513
  Create a selection range.
64436
64514
  */
64437
- static range(anchor, head, goalColumn) {
64438
- let goal = (goalColumn !== null && goalColumn !== void 0 ? goalColumn : 33554431 /* RangeFlag.NoGoalColumn */) << 5 /* RangeFlag.GoalColumnOffset */;
64439
- return head < anchor ? SelectionRange.create(head, anchor, 16 /* RangeFlag.Inverted */ | goal | 8 /* RangeFlag.AssocAfter */)
64440
- : SelectionRange.create(anchor, head, goal | (head > anchor ? 4 /* RangeFlag.AssocBefore */ : 0));
64515
+ static range(anchor, head, goalColumn, bidiLevel) {
64516
+ let flags = ((goalColumn !== null && goalColumn !== void 0 ? goalColumn : 33554431 /* RangeFlag.NoGoalColumn */) << 5 /* RangeFlag.GoalColumnOffset */) |
64517
+ (bidiLevel == null ? 3 : Math.min(2, bidiLevel));
64518
+ return head < anchor ? SelectionRange.create(head, anchor, 16 /* RangeFlag.Inverted */ | 8 /* RangeFlag.AssocAfter */ | flags)
64519
+ : SelectionRange.create(anchor, head, (head > anchor ? 4 /* RangeFlag.AssocBefore */ : 0) | flags);
64441
64520
  }
64442
64521
  /**
64443
64522
  @internal
@@ -67267,6 +67346,26 @@
67267
67346
  }
67268
67347
  }
67269
67348
  }
67349
+ function scrollableParent(dom) {
67350
+ let doc = dom.ownerDocument;
67351
+ for (let cur = dom.parentNode; cur;) {
67352
+ if (cur == doc.body) {
67353
+ break;
67354
+ }
67355
+ else if (cur.nodeType == 1) {
67356
+ if (cur.scrollHeight > cur.clientHeight || cur.scrollWidth > cur.clientWidth)
67357
+ return cur;
67358
+ cur = cur.assignedSlot || cur.parentNode;
67359
+ }
67360
+ else if (cur.nodeType == 11) {
67361
+ cur = cur.host;
67362
+ }
67363
+ else {
67364
+ break;
67365
+ }
67366
+ }
67367
+ return null;
67368
+ }
67270
67369
  class DOMSelectionState {
67271
67370
  constructor() {
67272
67371
  this.anchorNode = null;
@@ -68403,7 +68502,9 @@
68403
68502
  super(-200000000 /* Side.Line */, -200000000 /* Side.Line */, null, spec);
68404
68503
  }
68405
68504
  eq(other) {
68406
- return other instanceof LineDecoration && attrsEq(this.spec.attributes, other.spec.attributes);
68505
+ return other instanceof LineDecoration &&
68506
+ this.spec.class == other.spec.class &&
68507
+ attrsEq(this.spec.attributes, other.spec.attributes);
68407
68508
  }
68408
68509
  range(from, to = from) {
68409
68510
  if (to != from)
@@ -68678,6 +68779,7 @@
68678
68779
  this.curLine = null;
68679
68780
  this.breakAtStart = 0;
68680
68781
  this.pendingBuffer = 0 /* Buf.No */;
68782
+ this.bufferMarks = [];
68681
68783
  // Set to false directly after a widget that covers the position after it
68682
68784
  this.atCursorPos = true;
68683
68785
  this.openStart = -1;
@@ -68700,20 +68802,20 @@
68700
68802
  }
68701
68803
  return this.curLine;
68702
68804
  }
68703
- flushBuffer(active) {
68805
+ flushBuffer(active = this.bufferMarks) {
68704
68806
  if (this.pendingBuffer) {
68705
68807
  this.curLine.append(wrapMarks(new WidgetBufferView(-1), active), active.length);
68706
68808
  this.pendingBuffer = 0 /* Buf.No */;
68707
68809
  }
68708
68810
  }
68709
68811
  addBlockWidget(view) {
68710
- this.flushBuffer([]);
68812
+ this.flushBuffer();
68711
68813
  this.curLine = null;
68712
68814
  this.content.push(view);
68713
68815
  }
68714
68816
  finish(openEnd) {
68715
- if (!openEnd)
68716
- this.flushBuffer([]);
68817
+ if (this.pendingBuffer && openEnd <= this.bufferMarks.length)
68818
+ this.flushBuffer();
68717
68819
  else
68718
68820
  this.pendingBuffer = 0 /* Buf.No */;
68719
68821
  if (!this.posCovered())
@@ -68733,8 +68835,9 @@
68733
68835
  this.content[this.content.length - 1].breakAfter = 1;
68734
68836
  else
68735
68837
  this.breakAtStart = 1;
68736
- this.flushBuffer([]);
68838
+ this.flushBuffer();
68737
68839
  this.curLine = null;
68840
+ this.atCursorPos = true;
68738
68841
  length--;
68739
68842
  continue;
68740
68843
  }
@@ -68776,7 +68879,7 @@
68776
68879
  else {
68777
68880
  let view = WidgetView.create(deco.widget || new NullWidget("span"), len, len ? 0 : deco.startSide);
68778
68881
  let cursorBefore = this.atCursorPos && !view.isEditable && openStart <= active.length && (from < to || deco.startSide > 0);
68779
- let cursorAfter = !view.isEditable && (from < to || deco.startSide <= 0);
68882
+ let cursorAfter = !view.isEditable && (from < to || openStart > active.length || deco.startSide <= 0);
68780
68883
  let line = this.getLine();
68781
68884
  if (this.pendingBuffer == 2 /* Buf.IfCursor */ && !cursorBefore)
68782
68885
  this.pendingBuffer = 0 /* Buf.No */;
@@ -68787,7 +68890,9 @@
68787
68890
  }
68788
68891
  line.append(wrapMarks(view, active), openStart);
68789
68892
  this.atCursorPos = cursorAfter;
68790
- this.pendingBuffer = !cursorAfter ? 0 /* Buf.No */ : from < to ? 1 /* Buf.Yes */ : 2 /* Buf.IfCursor */;
68893
+ this.pendingBuffer = !cursorAfter ? 0 /* Buf.No */ : from < to || openStart > active.length ? 1 /* Buf.Yes */ : 2 /* Buf.IfCursor */;
68894
+ if (this.pendingBuffer)
68895
+ this.bufferMarks = active.slice();
68791
68896
  }
68792
68897
  }
68793
68898
  else if (this.doc.lineAt(this.pos).from == this.pos) { // Line decoration
@@ -70461,22 +70566,30 @@
70461
70566
  this.compositionFirstChange = null;
70462
70567
  this.compositionEndedAt = 0;
70463
70568
  this.mouseSelection = null;
70569
+ let handleEvent = (handler, event) => {
70570
+ if (this.ignoreDuringComposition(event))
70571
+ return;
70572
+ if (event.type == "keydown" && this.keydown(view, event))
70573
+ return;
70574
+ if (this.mustFlushObserver(event))
70575
+ view.observer.forceFlush();
70576
+ if (this.runCustomHandlers(event.type, view, event))
70577
+ event.preventDefault();
70578
+ else
70579
+ handler(view, event);
70580
+ };
70464
70581
  for (let type in handlers) {
70465
70582
  let handler = handlers[type];
70466
- view.contentDOM.addEventListener(type, (event) => {
70467
- if (!eventBelongsToEditor(view, event) || this.ignoreDuringComposition(event))
70468
- return;
70469
- if (type == "keydown" && this.keydown(view, event))
70470
- return;
70471
- if (this.mustFlushObserver(event))
70472
- view.observer.forceFlush();
70473
- if (this.runCustomHandlers(type, view, event))
70474
- event.preventDefault();
70475
- else
70476
- handler(view, event);
70583
+ view.contentDOM.addEventListener(type, event => {
70584
+ if (eventBelongsToEditor(view, event))
70585
+ handleEvent(handler, event);
70477
70586
  }, handlerOptions[type]);
70478
70587
  this.registeredEvents.push(type);
70479
70588
  }
70589
+ view.scrollDOM.addEventListener("mousedown", (event) => {
70590
+ if (event.target == view.scrollDOM)
70591
+ handleEvent(handlers.mousedown, event);
70592
+ });
70480
70593
  if (browser.chrome && browser.chrome_version == 102) { // FIXME remove at some point
70481
70594
  // On Chrome 102, viewport updates somehow stop wheel-based
70482
70595
  // scrolling. Turning off pointer events during the scroll seems
@@ -70633,12 +70746,18 @@
70633
70746
  const EmacsyPendingKeys = "dthko";
70634
70747
  // Key codes for modifier keys
70635
70748
  const modifierCodes = [16, 17, 18, 20, 91, 92, 224, 225];
70749
+ function dragScrollSpeed(dist) {
70750
+ return dist * 0.7 + 8;
70751
+ }
70636
70752
  class MouseSelection {
70637
70753
  constructor(view, startEvent, style, mustSelect) {
70638
70754
  this.view = view;
70639
70755
  this.style = style;
70640
70756
  this.mustSelect = mustSelect;
70757
+ this.scrollSpeed = { x: 0, y: 0 };
70758
+ this.scrolling = -1;
70641
70759
  this.lastEvent = startEvent;
70760
+ this.scrollParent = scrollableParent(view.contentDOM);
70642
70761
  let doc = view.contentDOM.ownerDocument;
70643
70762
  doc.addEventListener("mousemove", this.move = this.move.bind(this));
70644
70763
  doc.addEventListener("mouseup", this.up = this.up.bind(this));
@@ -70654,11 +70773,24 @@
70654
70773
  }
70655
70774
  }
70656
70775
  move(event) {
70776
+ var _a;
70657
70777
  if (event.buttons == 0)
70658
70778
  return this.destroy();
70659
70779
  if (this.dragging !== false)
70660
70780
  return;
70661
70781
  this.select(this.lastEvent = event);
70782
+ let sx = 0, sy = 0;
70783
+ let rect = ((_a = this.scrollParent) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect())
70784
+ || { left: 0, top: 0, right: this.view.win.innerWidth, bottom: this.view.win.innerHeight };
70785
+ if (event.clientX <= rect.left)
70786
+ sx = -dragScrollSpeed(rect.left - event.clientX);
70787
+ else if (event.clientX >= rect.right)
70788
+ sx = dragScrollSpeed(event.clientX - rect.right);
70789
+ if (event.clientY <= rect.top)
70790
+ sy = -dragScrollSpeed(rect.top - event.clientY);
70791
+ else if (event.clientY >= rect.bottom)
70792
+ sy = dragScrollSpeed(event.clientY - rect.bottom);
70793
+ this.setScrollSpeed(sx, sy);
70662
70794
  }
70663
70795
  up(event) {
70664
70796
  if (this.dragging == null)
@@ -70668,19 +70800,41 @@
70668
70800
  this.destroy();
70669
70801
  }
70670
70802
  destroy() {
70803
+ this.setScrollSpeed(0, 0);
70671
70804
  let doc = this.view.contentDOM.ownerDocument;
70672
70805
  doc.removeEventListener("mousemove", this.move);
70673
70806
  doc.removeEventListener("mouseup", this.up);
70674
70807
  this.view.inputState.mouseSelection = null;
70675
70808
  }
70809
+ setScrollSpeed(sx, sy) {
70810
+ this.scrollSpeed = { x: sx, y: sy };
70811
+ if (sx || sy) {
70812
+ if (this.scrolling < 0)
70813
+ this.scrolling = setInterval(() => this.scroll(), 50);
70814
+ }
70815
+ else if (this.scrolling > -1) {
70816
+ clearInterval(this.scrolling);
70817
+ this.scrolling = -1;
70818
+ }
70819
+ }
70820
+ scroll() {
70821
+ if (this.scrollParent) {
70822
+ this.scrollParent.scrollLeft += this.scrollSpeed.x;
70823
+ this.scrollParent.scrollTop += this.scrollSpeed.y;
70824
+ }
70825
+ else {
70826
+ this.view.win.scrollBy(this.scrollSpeed.x, this.scrollSpeed.y);
70827
+ }
70828
+ if (this.dragging === false)
70829
+ this.select(this.lastEvent);
70830
+ }
70676
70831
  select(event) {
70677
70832
  let selection = this.style.get(event, this.extend, this.multiple);
70678
70833
  if (this.mustSelect || !selection.eq(this.view.state.selection) ||
70679
70834
  selection.main.assoc != this.view.state.selection.main.assoc)
70680
70835
  this.view.dispatch({
70681
70836
  selection,
70682
- userEvent: "select.pointer",
70683
- scrollIntoView: true
70837
+ userEvent: "select.pointer"
70684
70838
  });
70685
70839
  this.mustSelect = false;
70686
70840
  }
@@ -70871,23 +71025,15 @@
70871
71025
  function basicMouseSelection(view, event) {
70872
71026
  let start = queryPos(view, event), type = getClickType(event);
70873
71027
  let startSel = view.state.selection;
70874
- let last = start, lastEvent = event;
70875
71028
  return {
70876
71029
  update(update) {
70877
71030
  if (update.docChanged) {
70878
71031
  start.pos = update.changes.mapPos(start.pos);
70879
71032
  startSel = startSel.map(update.changes);
70880
- lastEvent = null;
70881
71033
  }
70882
71034
  },
70883
71035
  get(event, extend, multiple) {
70884
- let cur;
70885
- if (lastEvent && event.clientX == lastEvent.clientX && event.clientY == lastEvent.clientY)
70886
- cur = last;
70887
- else {
70888
- cur = last = queryPos(view, event);
70889
- lastEvent = event;
70890
- }
71036
+ let cur = queryPos(view, event);
70891
71037
  let range = rangeForClick(view, cur.pos, cur.bias, type);
70892
71038
  if (start.pos != cur.pos && !extend) {
70893
71039
  let startRange = rangeForClick(view, start.pos, start.bias, type);
@@ -72333,7 +72479,7 @@
72333
72479
  });
72334
72480
  }
72335
72481
  const baseTheme$1$1 = /*@__PURE__*/buildTheme("." + baseThemeID, {
72336
- "&.cm-editor": {
72482
+ "&": {
72337
72483
  position: "relative !important",
72338
72484
  boxSizing: "border-box",
72339
72485
  "&.cm-focused": {
@@ -72364,7 +72510,6 @@
72364
72510
  margin: 0,
72365
72511
  flexGrow: 2,
72366
72512
  flexShrink: 0,
72367
- minHeight: "100%",
72368
72513
  display: "block",
72369
72514
  whiteSpace: "pre",
72370
72515
  wordWrap: "normal",
@@ -72386,14 +72531,13 @@
72386
72531
  "&dark .cm-content": { caretColor: "white" },
72387
72532
  ".cm-line": {
72388
72533
  display: "block",
72389
- padding: "0 2px 0 4px"
72390
- },
72391
- ".cm-selectionLayer": {
72392
- zIndex: -1,
72393
- contain: "size style"
72534
+ padding: "0 2px 0 6px"
72394
72535
  },
72395
- ".cm-selectionBackground": {
72396
- position: "absolute",
72536
+ ".cm-layer": {
72537
+ contain: "size style",
72538
+ "& > *": {
72539
+ position: "absolute"
72540
+ }
72397
72541
  },
72398
72542
  "&light .cm-selectionBackground": {
72399
72543
  background: "#d9d9d9"
@@ -72408,8 +72552,6 @@
72408
72552
  background: "#233"
72409
72553
  },
72410
72554
  ".cm-cursorLayer": {
72411
- zIndex: 100,
72412
- contain: "size style",
72413
72555
  pointerEvents: "none"
72414
72556
  },
72415
72557
  "&.cm-focused .cm-cursorLayer": {
@@ -72421,7 +72563,6 @@
72421
72563
  "@keyframes cm-blink": { "0%": {}, "50%": { opacity: 0 }, "100%": {} },
72422
72564
  "@keyframes cm-blink2": { "0%": {}, "50%": { opacity: 0 }, "100%": {} },
72423
72565
  ".cm-cursor, .cm-dropCursor": {
72424
- position: "absolute",
72425
72566
  borderLeft: "1.2px solid black",
72426
72567
  marginLeft: "-0.6px",
72427
72568
  pointerEvents: "none",
@@ -72515,6 +72656,21 @@
72515
72656
  display: "inline-block",
72516
72657
  verticalAlign: "top",
72517
72658
  },
72659
+ ".cm-highlightSpace:before": {
72660
+ content: "attr(data-display)",
72661
+ position: "absolute",
72662
+ pointerEvents: "none",
72663
+ color: "#888"
72664
+ },
72665
+ ".cm-highlightTab": {
72666
+ backgroundImage: `url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,
72667
+ backgroundSize: "auto 100%",
72668
+ backgroundPosition: "right 90%",
72669
+ backgroundRepeat: "no-repeat"
72670
+ },
72671
+ ".cm-trailingSpace": {
72672
+ backgroundColor: "#ff332255"
72673
+ },
72518
72674
  ".cm-button": {
72519
72675
  verticalAlign: "middle",
72520
72676
  color: "inherit",
@@ -72607,7 +72763,7 @@
72607
72763
  insert: Text.of(domChange.text.slice(diff.from, diff.toB).split(LineBreakPlaceholder)) };
72608
72764
  }
72609
72765
  }
72610
- else if (newSel && (!view.hasFocus || !view.state.facet(editable) || newSel.main.eq(sel))) {
72766
+ else if (newSel && (!view.hasFocus && view.state.facet(editable) || newSel.main.eq(sel))) {
72611
72767
  newSel = null;
72612
72768
  }
72613
72769
  if (!change && !newSel)
@@ -72817,7 +72973,8 @@
72817
72973
  this.lastChange = 0;
72818
72974
  this.scrollTargets = [];
72819
72975
  this.intersection = null;
72820
- this.resize = null;
72976
+ this.resizeScroll = null;
72977
+ this.resizeContent = null;
72821
72978
  this.intersecting = false;
72822
72979
  this.gapIntersection = null;
72823
72980
  this.gaps = [];
@@ -72855,12 +73012,14 @@
72855
73012
  this.onPrint = this.onPrint.bind(this);
72856
73013
  this.onScroll = this.onScroll.bind(this);
72857
73014
  if (typeof ResizeObserver == "function") {
72858
- this.resize = new ResizeObserver(() => {
73015
+ this.resizeScroll = new ResizeObserver(() => {
72859
73016
  var _a;
72860
73017
  if (((_a = this.view.docView) === null || _a === void 0 ? void 0 : _a.lastUpdate) < Date.now() - 75)
72861
73018
  this.onResize();
72862
73019
  });
72863
- this.resize.observe(view.scrollDOM);
73020
+ this.resizeScroll.observe(view.scrollDOM);
73021
+ this.resizeContent = new ResizeObserver(() => this.view.requestMeasure());
73022
+ this.resizeContent.observe(view.contentDOM);
72864
73023
  }
72865
73024
  this.addWindowListeners(this.win = view.win);
72866
73025
  this.start();
@@ -73179,11 +73338,12 @@
73179
73338
  win.document.removeEventListener("selectionchange", this.onSelectionChange);
73180
73339
  }
73181
73340
  destroy() {
73182
- var _a, _b, _c;
73341
+ var _a, _b, _c, _d;
73183
73342
  this.stop();
73184
73343
  (_a = this.intersection) === null || _a === void 0 ? void 0 : _a.disconnect();
73185
73344
  (_b = this.gapIntersection) === null || _b === void 0 ? void 0 : _b.disconnect();
73186
- (_c = this.resize) === null || _c === void 0 ? void 0 : _c.disconnect();
73345
+ (_c = this.resizeScroll) === null || _c === void 0 ? void 0 : _c.disconnect();
73346
+ (_d = this.resizeContent) === null || _d === void 0 ? void 0 : _d.disconnect();
73187
73347
  for (let dom of this.scrollTargets)
73188
73348
  dom.removeEventListener("scroll", this.onScroll);
73189
73349
  this.removeWindowListeners(this.win);
@@ -73282,7 +73442,7 @@
73282
73442
  this.scrollDOM.className = "cm-scroller";
73283
73443
  this.scrollDOM.appendChild(this.contentDOM);
73284
73444
  this.announceDOM = document.createElement("div");
73285
- this.announceDOM.style.cssText = "position: absolute; top: -10000px";
73445
+ this.announceDOM.style.cssText = "position: fixed; top: -10000px";
73286
73446
  this.announceDOM.setAttribute("aria-live", "polite");
73287
73447
  this.dom = document.createElement("div");
73288
73448
  this.dom.appendChild(this.announceDOM);
@@ -73667,6 +73827,8 @@
73667
73827
  if (this.measureScheduled < 0)
73668
73828
  this.measureScheduled = this.win.requestAnimationFrame(() => this.measure());
73669
73829
  if (request) {
73830
+ if (this.measureRequests.indexOf(request) > -1)
73831
+ return;
73670
73832
  if (request.key != null)
73671
73833
  for (let i = 0; i < this.measureRequests.length; i++) {
73672
73834
  if (this.measureRequests[i].key === request.key) {
@@ -74342,6 +74504,8 @@
74342
74504
  if (runFor(scopeObj[prefix + modifiers(name, event, !isChar)]))
74343
74505
  return true;
74344
74506
  if (isChar && (event.altKey || event.metaKey || event.ctrlKey) &&
74507
+ // Ctrl-Alt may be used for AltGr on Windows
74508
+ !(browser.windows && event.ctrlKey && event.altKey) &&
74345
74509
  (baseName = base[event.keyCode]) && baseName != name) {
74346
74510
  if (runFor(scopeObj[prefix + modifiers(baseName, event, true)]))
74347
74511
  return true;
@@ -74579,6 +74743,17 @@
74579
74743
  : pos.bottom + (size.bottom - size.top) + offset.y > space.bottom) &&
74580
74744
  above == (space.bottom - pos.bottom > pos.top - space.top))
74581
74745
  above = !above;
74746
+ let spaceVert = (above ? pos.top - space.top : space.bottom - pos.bottom) - arrowHeight;
74747
+ if (spaceVert < height && tView.resize !== false) {
74748
+ if (spaceVert < this.view.defaultLineHeight) {
74749
+ dom.style.top = Outside;
74750
+ continue;
74751
+ }
74752
+ dom.style.height = (height = spaceVert) + "px";
74753
+ }
74754
+ else if (dom.style.height) {
74755
+ dom.style.height = "";
74756
+ }
74582
74757
  let top = above ? pos.top - height - arrowHeight - offset.y : pos.bottom + arrowHeight + offset.y;
74583
74758
  let right = left + width;
74584
74759
  if (tView.overlap !== true)
@@ -74622,7 +74797,8 @@
74622
74797
  });
74623
74798
  const baseTheme$4 = /*@__PURE__*/EditorView.baseTheme({
74624
74799
  ".cm-tooltip": {
74625
- zIndex: 100
74800
+ zIndex: 100,
74801
+ boxSizing: "border-box"
74626
74802
  },
74627
74803
  "&light .cm-tooltip": {
74628
74804
  border: "1px solid #bbb",
@@ -75187,8 +75363,8 @@
75187
75363
  /// Define a node type.
75188
75364
  static define(spec) {
75189
75365
  let props = spec.props && spec.props.length ? Object.create(null) : noProps;
75190
- let flags = (spec.top ? 1 /* Top */ : 0) | (spec.skipped ? 2 /* Skipped */ : 0) |
75191
- (spec.error ? 4 /* Error */ : 0) | (spec.name == null ? 8 /* Anonymous */ : 0);
75366
+ let flags = (spec.top ? 1 /* NodeFlag.Top */ : 0) | (spec.skipped ? 2 /* NodeFlag.Skipped */ : 0) |
75367
+ (spec.error ? 4 /* NodeFlag.Error */ : 0) | (spec.name == null ? 8 /* NodeFlag.Anonymous */ : 0);
75192
75368
  let type = new NodeType(spec.name || "", props, spec.id, flags);
75193
75369
  if (spec.props)
75194
75370
  for (let src of spec.props) {
@@ -75206,14 +75382,14 @@
75206
75382
  /// the prop isn't present on this node.
75207
75383
  prop(prop) { return this.props[prop.id]; }
75208
75384
  /// True when this is the top node of a grammar.
75209
- get isTop() { return (this.flags & 1 /* Top */) > 0; }
75385
+ get isTop() { return (this.flags & 1 /* NodeFlag.Top */) > 0; }
75210
75386
  /// True when this node is produced by a skip rule.
75211
- get isSkipped() { return (this.flags & 2 /* Skipped */) > 0; }
75387
+ get isSkipped() { return (this.flags & 2 /* NodeFlag.Skipped */) > 0; }
75212
75388
  /// Indicates whether this is an error node.
75213
- get isError() { return (this.flags & 4 /* Error */) > 0; }
75389
+ get isError() { return (this.flags & 4 /* NodeFlag.Error */) > 0; }
75214
75390
  /// When true, this node type doesn't correspond to a user-declared
75215
75391
  /// named node, for example because it is used to cache repetition.
75216
- get isAnonymous() { return (this.flags & 8 /* Anonymous */) > 0; }
75392
+ get isAnonymous() { return (this.flags & 8 /* NodeFlag.Anonymous */) > 0; }
75217
75393
  /// Returns true when this node's name or one of its
75218
75394
  /// [groups](#common.NodeProp^group) matches the given string.
75219
75395
  is(name) {
@@ -75246,7 +75422,7 @@
75246
75422
  }
75247
75423
  }
75248
75424
  /// An empty dummy node type to use when no actual type is available.
75249
- NodeType.none = new NodeType("", Object.create(null), 0, 8 /* Anonymous */);
75425
+ NodeType.none = new NodeType("", Object.create(null), 0, 8 /* NodeFlag.Anonymous */);
75250
75426
  /// A node set holds a collection of node types. It is used to
75251
75427
  /// compactly represent trees by storing their type ids, rather than a
75252
75428
  /// full pointer to the type object, in a numeric array. Each parser
@@ -75455,7 +75631,7 @@
75455
75631
  /// which may have children grouped into subtrees with type
75456
75632
  /// [`NodeType.none`](#common.NodeType^none).
75457
75633
  balance(config = {}) {
75458
- return this.children.length <= 8 /* BranchFactor */ ? this :
75634
+ return this.children.length <= 8 /* Balance.BranchFactor */ ? this :
75459
75635
  balanceRange(NodeType.none, this.children, this.positions, 0, this.children.length, 0, this.length, (children, positions, length) => new Tree(this.type, children, positions, length, this.propValues), config.makeTree || ((children, positions, length) => new Tree(NodeType.none, children, positions, length)));
75460
75636
  }
75461
75637
  /// Build a tree from a postfix-ordered buffer of node information,
@@ -75534,26 +75710,27 @@
75534
75710
  return pick;
75535
75711
  }
75536
75712
  /// @internal
75537
- slice(startI, endI, from, to) {
75713
+ slice(startI, endI, from) {
75538
75714
  let b = this.buffer;
75539
- let copy = new Uint16Array(endI - startI);
75715
+ let copy = new Uint16Array(endI - startI), len = 0;
75540
75716
  for (let i = startI, j = 0; i < endI;) {
75541
75717
  copy[j++] = b[i++];
75542
75718
  copy[j++] = b[i++] - from;
75543
- copy[j++] = b[i++] - from;
75719
+ let to = copy[j++] = b[i++] - from;
75544
75720
  copy[j++] = b[i++] - startI;
75721
+ len = Math.max(len, to);
75545
75722
  }
75546
- return new TreeBuffer(copy, to - from, this.set);
75723
+ return new TreeBuffer(copy, len, this.set);
75547
75724
  }
75548
75725
  }
75549
75726
  function checkSide(side, pos, from, to) {
75550
75727
  switch (side) {
75551
- case -2 /* Before */: return from < pos;
75552
- case -1 /* AtOrBefore */: return to >= pos && from < pos;
75553
- case 0 /* Around */: return from < pos && to > pos;
75554
- case 1 /* AtOrAfter */: return from <= pos && to > pos;
75555
- case 2 /* After */: return to > pos;
75556
- case 4 /* DontCare */: return true;
75728
+ case -2 /* Side.Before */: return from < pos;
75729
+ case -1 /* Side.AtOrBefore */: return to >= pos && from < pos;
75730
+ case 0 /* Side.Around */: return from < pos && to > pos;
75731
+ case 1 /* Side.AtOrAfter */: return from <= pos && to > pos;
75732
+ case 2 /* Side.After */: return to > pos;
75733
+ case 4 /* Side.DontCare */: return true;
75557
75734
  }
75558
75735
  }
75559
75736
  function enterUnfinishedNodesBefore(node, pos) {
@@ -75643,10 +75820,10 @@
75643
75820
  return null;
75644
75821
  }
75645
75822
  }
75646
- get firstChild() { return this.nextChild(0, 1, 0, 4 /* DontCare */); }
75647
- get lastChild() { return this.nextChild(this._tree.children.length - 1, -1, 0, 4 /* DontCare */); }
75648
- childAfter(pos) { return this.nextChild(0, 1, pos, 2 /* After */); }
75649
- childBefore(pos) { return this.nextChild(this._tree.children.length - 1, -1, pos, -2 /* Before */); }
75823
+ get firstChild() { return this.nextChild(0, 1, 0, 4 /* Side.DontCare */); }
75824
+ get lastChild() { return this.nextChild(this._tree.children.length - 1, -1, 0, 4 /* Side.DontCare */); }
75825
+ childAfter(pos) { return this.nextChild(0, 1, pos, 2 /* Side.After */); }
75826
+ childBefore(pos) { return this.nextChild(this._tree.children.length - 1, -1, pos, -2 /* Side.Before */); }
75650
75827
  enter(pos, side, mode = 0) {
75651
75828
  let mounted;
75652
75829
  if (!(mode & IterMode.IgnoreOverlays) && (mounted = this._tree.prop(NodeProp.mounted)) && mounted.overlay) {
@@ -75669,10 +75846,10 @@
75669
75846
  return this._parent ? this._parent.nextSignificantParent() : null;
75670
75847
  }
75671
75848
  get nextSibling() {
75672
- return this._parent && this.index >= 0 ? this._parent.nextChild(this.index + 1, 1, 0, 4 /* DontCare */) : null;
75849
+ return this._parent && this.index >= 0 ? this._parent.nextChild(this.index + 1, 1, 0, 4 /* Side.DontCare */) : null;
75673
75850
  }
75674
75851
  get prevSibling() {
75675
- return this._parent && this.index >= 0 ? this._parent.nextChild(this.index - 1, -1, 0, 4 /* DontCare */) : null;
75852
+ return this._parent && this.index >= 0 ? this._parent.nextChild(this.index - 1, -1, 0, 4 /* Side.DontCare */) : null;
75676
75853
  }
75677
75854
  cursor(mode = 0) { return new TreeCursor(this, mode); }
75678
75855
  get tree() { return this._tree; }
@@ -75734,24 +75911,24 @@
75734
75911
  }
75735
75912
  }
75736
75913
  class BufferNode {
75914
+ get name() { return this.type.name; }
75915
+ get from() { return this.context.start + this.context.buffer.buffer[this.index + 1]; }
75916
+ get to() { return this.context.start + this.context.buffer.buffer[this.index + 2]; }
75737
75917
  constructor(context, _parent, index) {
75738
75918
  this.context = context;
75739
75919
  this._parent = _parent;
75740
75920
  this.index = index;
75741
75921
  this.type = context.buffer.set.types[context.buffer.buffer[index]];
75742
75922
  }
75743
- get name() { return this.type.name; }
75744
- get from() { return this.context.start + this.context.buffer.buffer[this.index + 1]; }
75745
- get to() { return this.context.start + this.context.buffer.buffer[this.index + 2]; }
75746
75923
  child(dir, pos, side) {
75747
75924
  let { buffer } = this.context;
75748
75925
  let index = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.context.start, side);
75749
75926
  return index < 0 ? null : new BufferNode(this.context, this, index);
75750
75927
  }
75751
- get firstChild() { return this.child(1, 0, 4 /* DontCare */); }
75752
- get lastChild() { return this.child(-1, 0, 4 /* DontCare */); }
75753
- childAfter(pos) { return this.child(1, pos, 2 /* After */); }
75754
- childBefore(pos) { return this.child(-1, pos, -2 /* Before */); }
75928
+ get firstChild() { return this.child(1, 0, 4 /* Side.DontCare */); }
75929
+ get lastChild() { return this.child(-1, 0, 4 /* Side.DontCare */); }
75930
+ childAfter(pos) { return this.child(1, pos, 2 /* Side.After */); }
75931
+ childBefore(pos) { return this.child(-1, pos, -2 /* Side.Before */); }
75755
75932
  enter(pos, side, mode = 0) {
75756
75933
  if (mode & IterMode.ExcludeBuffers)
75757
75934
  return null;
@@ -75763,7 +75940,7 @@
75763
75940
  return this._parent || this.context.parent.nextSignificantParent();
75764
75941
  }
75765
75942
  externalSibling(dir) {
75766
- return this._parent ? null : this.context.parent.nextChild(this.context.index + dir, dir, 0, 4 /* DontCare */);
75943
+ return this._parent ? null : this.context.parent.nextChild(this.context.index + dir, dir, 0, 4 /* Side.DontCare */);
75767
75944
  }
75768
75945
  get nextSibling() {
75769
75946
  let { buffer } = this.context;
@@ -75777,7 +75954,7 @@
75777
75954
  let parentStart = this._parent ? this._parent.index + 4 : 0;
75778
75955
  if (this.index == parentStart)
75779
75956
  return this.externalSibling(-1);
75780
- return new BufferNode(this.context, this._parent, buffer.findChild(parentStart, this.index, -1, 0, 4 /* DontCare */));
75957
+ return new BufferNode(this.context, this._parent, buffer.findChild(parentStart, this.index, -1, 0, 4 /* Side.DontCare */));
75781
75958
  }
75782
75959
  cursor(mode = 0) { return new TreeCursor(this, mode); }
75783
75960
  get tree() { return null; }
@@ -75786,8 +75963,8 @@
75786
75963
  let { buffer } = this.context;
75787
75964
  let startI = this.index + 4, endI = buffer.buffer[this.index + 3];
75788
75965
  if (endI > startI) {
75789
- let from = buffer.buffer[this.index + 1], to = buffer.buffer[this.index + 2];
75790
- children.push(buffer.slice(startI, endI, from, to));
75966
+ let from = buffer.buffer[this.index + 1];
75967
+ children.push(buffer.slice(startI, endI, from));
75791
75968
  positions.push(0);
75792
75969
  }
75793
75970
  return new Tree(this.type, children, positions, this.to - this.from);
@@ -75814,6 +75991,8 @@
75814
75991
  /// A tree cursor object focuses on a given node in a syntax tree, and
75815
75992
  /// allows you to move to adjacent nodes.
75816
75993
  class TreeCursor {
75994
+ /// Shorthand for `.type.name`.
75995
+ get name() { return this.type.name; }
75817
75996
  /// @internal
75818
75997
  constructor(node,
75819
75998
  /// @internal
@@ -75837,8 +76016,6 @@
75837
76016
  this.yieldBuf(node.index);
75838
76017
  }
75839
76018
  }
75840
- /// Shorthand for `.type.name`.
75841
- get name() { return this.type.name; }
75842
76019
  yieldNode(node) {
75843
76020
  if (!node)
75844
76021
  return false;
@@ -75883,13 +76060,13 @@
75883
76060
  }
75884
76061
  /// Move the cursor to this node's first child. When this returns
75885
76062
  /// false, the node has no child, and the cursor has not been moved.
75886
- firstChild() { return this.enterChild(1, 0, 4 /* DontCare */); }
76063
+ firstChild() { return this.enterChild(1, 0, 4 /* Side.DontCare */); }
75887
76064
  /// Move the cursor to this node's last child.
75888
- lastChild() { return this.enterChild(-1, 0, 4 /* DontCare */); }
76065
+ lastChild() { return this.enterChild(-1, 0, 4 /* Side.DontCare */); }
75889
76066
  /// Move the cursor to the first child that ends after `pos`.
75890
- childAfter(pos) { return this.enterChild(1, pos, 2 /* After */); }
76067
+ childAfter(pos) { return this.enterChild(1, pos, 2 /* Side.After */); }
75891
76068
  /// Move to the last child that starts before `pos`.
75892
- childBefore(pos) { return this.enterChild(-1, pos, -2 /* Before */); }
76069
+ childBefore(pos) { return this.enterChild(-1, pos, -2 /* Side.Before */); }
75893
76070
  /// Move the cursor to the child around `pos`. If side is -1 the
75894
76071
  /// child may end at that position, when 1 it may start there. This
75895
76072
  /// will also enter [overlaid](#common.MountedTree.overlay)
@@ -75915,19 +76092,19 @@
75915
76092
  if (!this.buffer)
75916
76093
  return !this._tree._parent ? false
75917
76094
  : this.yield(this._tree.index < 0 ? null
75918
- : this._tree._parent.nextChild(this._tree.index + dir, dir, 0, 4 /* DontCare */, this.mode));
76095
+ : this._tree._parent.nextChild(this._tree.index + dir, dir, 0, 4 /* Side.DontCare */, this.mode));
75919
76096
  let { buffer } = this.buffer, d = this.stack.length - 1;
75920
76097
  if (dir < 0) {
75921
76098
  let parentStart = d < 0 ? 0 : this.stack[d] + 4;
75922
76099
  if (this.index != parentStart)
75923
- return this.yieldBuf(buffer.findChild(parentStart, this.index, -1, 0, 4 /* DontCare */));
76100
+ return this.yieldBuf(buffer.findChild(parentStart, this.index, -1, 0, 4 /* Side.DontCare */));
75924
76101
  }
75925
76102
  else {
75926
76103
  let after = buffer.buffer[this.index + 3];
75927
76104
  if (after < (d < 0 ? buffer.buffer.length : buffer.buffer[this.stack[d] + 3]))
75928
76105
  return this.yieldBuf(after);
75929
76106
  }
75930
- return d < 0 ? this.yield(this.buffer.parent.nextChild(this.buffer.index + dir, dir, 0, 4 /* DontCare */, this.mode)) : false;
76107
+ return d < 0 ? this.yield(this.buffer.parent.nextChild(this.buffer.index + dir, dir, 0, 4 /* Side.DontCare */, this.mode)) : false;
75931
76108
  }
75932
76109
  /// Move to this node's next sibling, if any.
75933
76110
  nextSibling() { return this.sibling(1); }
@@ -75964,7 +76141,7 @@
75964
76141
  return true;
75965
76142
  }
75966
76143
  move(dir, enter) {
75967
- if (enter && this.enterChild(dir, 0, 4 /* DontCare */))
76144
+ if (enter && this.enterChild(dir, 0, 4 /* Side.DontCare */))
75968
76145
  return true;
75969
76146
  for (;;) {
75970
76147
  if (this.sibling(dir))
@@ -75974,7 +76151,7 @@
75974
76151
  }
75975
76152
  }
75976
76153
  /// Move to the next node in a
75977
- /// [pre-order](https://en.wikipedia.org/wiki/Tree_traversal#Pre-order_(NLR))
76154
+ /// [pre-order](https://en.wikipedia.org/wiki/Tree_traversal#Pre-order,_NLR)
75978
76155
  /// traversal, going from a node to its first child or, if the
75979
76156
  /// current node is empty or `enter` is false, its next sibling or
75980
76157
  /// the next sibling of the first parent node that has one.
@@ -76090,17 +76267,17 @@
76090
76267
  let lookAheadAtStart = lookAhead;
76091
76268
  while (size < 0) {
76092
76269
  cursor.next();
76093
- if (size == -1 /* Reuse */) {
76270
+ if (size == -1 /* SpecialRecord.Reuse */) {
76094
76271
  let node = reused[id];
76095
76272
  children.push(node);
76096
76273
  positions.push(start - parentStart);
76097
76274
  return;
76098
76275
  }
76099
- else if (size == -3 /* ContextChange */) { // Context change
76276
+ else if (size == -3 /* SpecialRecord.ContextChange */) { // Context change
76100
76277
  contextHash = id;
76101
76278
  return;
76102
76279
  }
76103
- else if (size == -4 /* LookAhead */) {
76280
+ else if (size == -4 /* SpecialRecord.LookAhead */) {
76104
76281
  lookAhead = id;
76105
76282
  return;
76106
76283
  }
@@ -76217,7 +76394,7 @@
76217
76394
  fork.next();
76218
76395
  while (fork.pos > startPos) {
76219
76396
  if (fork.size < 0) {
76220
- if (fork.size == -3 /* ContextChange */)
76397
+ if (fork.size == -3 /* SpecialRecord.ContextChange */)
76221
76398
  localSkipped += 4;
76222
76399
  else
76223
76400
  break scan;
@@ -76253,10 +76430,10 @@
76253
76430
  buffer[--index] = start - bufferStart;
76254
76431
  buffer[--index] = id;
76255
76432
  }
76256
- else if (size == -3 /* ContextChange */) {
76433
+ else if (size == -3 /* SpecialRecord.ContextChange */) {
76257
76434
  contextHash = id;
76258
76435
  }
76259
- else if (size == -4 /* LookAhead */) {
76436
+ else if (size == -4 /* SpecialRecord.LookAhead */) {
76260
76437
  lookAhead = id;
76261
76438
  }
76262
76439
  return index;
@@ -76303,7 +76480,7 @@
76303
76480
  let total = 0;
76304
76481
  for (let i = from; i < to; i++)
76305
76482
  total += nodeSize(balanceType, children[i]);
76306
- let maxChild = Math.ceil((total * 1.5) / 8 /* BranchFactor */);
76483
+ let maxChild = Math.ceil((total * 1.5) / 8 /* Balance.BranchFactor */);
76307
76484
  let localChildren = [], localPositions = [];
76308
76485
  function divide(children, positions, from, to, offset) {
76309
76486
  for (let i = from; i < to;) {
@@ -76364,16 +76541,16 @@
76364
76541
  this.to = to;
76365
76542
  this.tree = tree;
76366
76543
  this.offset = offset;
76367
- this.open = (openStart ? 1 /* Start */ : 0) | (openEnd ? 2 /* End */ : 0);
76544
+ this.open = (openStart ? 1 /* Open.Start */ : 0) | (openEnd ? 2 /* Open.End */ : 0);
76368
76545
  }
76369
76546
  /// Whether the start of the fragment represents the start of a
76370
76547
  /// parse, or the end of a change. (In the second case, it may not
76371
76548
  /// be safe to reuse some nodes at the start, depending on the
76372
76549
  /// parsing algorithm.)
76373
- get openStart() { return (this.open & 1 /* Start */) > 0; }
76550
+ get openStart() { return (this.open & 1 /* Open.Start */) > 0; }
76374
76551
  /// Whether the end of the fragment represents the end of a
76375
76552
  /// full-document parse, or the start of a change.
76376
- get openEnd() { return (this.open & 2 /* End */) > 0; }
76553
+ get openEnd() { return (this.open & 2 /* Open.End */) > 0; }
76377
76554
  /// Create a set of fragments from a freshly parsed tree, or update
76378
76555
  /// an existing set of fragments by replacing the ones that overlap
76379
76556
  /// with a tree with content from the new tree. When `partial` is
@@ -76617,10 +76794,10 @@
76617
76794
  tags = [tags];
76618
76795
  for (let part of prop.split(" "))
76619
76796
  if (part) {
76620
- let pieces = [], mode = 2 /* Normal */, rest = part;
76797
+ let pieces = [], mode = 2 /* Mode.Normal */, rest = part;
76621
76798
  for (let pos = 0;;) {
76622
76799
  if (rest == "..." && pos > 0 && pos + 3 == part.length) {
76623
- mode = 1 /* Inherit */;
76800
+ mode = 1 /* Mode.Inherit */;
76624
76801
  break;
76625
76802
  }
76626
76803
  let m = /^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(rest);
@@ -76632,7 +76809,7 @@
76632
76809
  break;
76633
76810
  let next = part[pos++];
76634
76811
  if (pos == part.length && next == "!") {
76635
- mode = 0 /* Opaque */;
76812
+ mode = 0 /* Mode.Opaque */;
76636
76813
  break;
76637
76814
  }
76638
76815
  if (next != "/")
@@ -76656,8 +76833,8 @@
76656
76833
  this.context = context;
76657
76834
  this.next = next;
76658
76835
  }
76659
- get opaque() { return this.mode == 0 /* Opaque */; }
76660
- get inherit() { return this.mode == 1 /* Inherit */; }
76836
+ get opaque() { return this.mode == 0 /* Mode.Opaque */; }
76837
+ get inherit() { return this.mode == 1 /* Mode.Inherit */; }
76661
76838
  sort(other) {
76662
76839
  if (!other || other.depth < this.depth) {
76663
76840
  this.next = other;
@@ -76668,7 +76845,7 @@
76668
76845
  }
76669
76846
  get depth() { return this.context ? this.context.length : 0; }
76670
76847
  }
76671
- Rule.empty = new Rule([], 2 /* Normal */, null);
76848
+ Rule.empty = new Rule([], 2 /* Mode.Normal */, null);
76672
76849
  /// Define a [highlighter](#highlight.Highlighter) from an array of
76673
76850
  /// tag/class pairs. Classes associated with more specific tags will
76674
76851
  /// take precedence.
@@ -76755,7 +76932,7 @@
76755
76932
  if (cls)
76756
76933
  cls += " ";
76757
76934
  cls += tagCls;
76758
- if (rule.mode == 1 /* Inherit */)
76935
+ if (rule.mode == 1 /* Mode.Inherit */)
76759
76936
  inheritedClass += (inheritedClass ? " " : "") + tagCls;
76760
76937
  }
76761
76938
  this.startSpan(cursor.from, cls);
@@ -76773,7 +76950,7 @@
76773
76950
  if (rangeFrom < rangeTo && hasChild) {
76774
76951
  while (cursor.from < rangeTo) {
76775
76952
  this.highlightRange(cursor, rangeFrom, rangeTo, inheritedClass, highlighters);
76776
- this.startSpan(Math.min(to, cursor.to), cls);
76953
+ this.startSpan(Math.min(rangeTo, cursor.to), cls);
76777
76954
  if (cursor.to >= nextPos || !cursor.nextSibling())
76778
76955
  break;
76779
76956
  }
@@ -78714,6 +78891,7 @@
78714
78891
  closeOnBlur: true,
78715
78892
  maxRenderedOptions: 100,
78716
78893
  defaultKeymap: true,
78894
+ tooltipClass: () => "",
78717
78895
  optionClass: () => "",
78718
78896
  aboveCursor: false,
78719
78897
  icons: true,
@@ -78724,6 +78902,7 @@
78724
78902
  defaultKeymap: (a, b) => a && b,
78725
78903
  closeOnBlur: (a, b) => a && b,
78726
78904
  icons: (a, b) => a && b,
78905
+ tooltipClass: (a, b) => c => joinClass(a(c), b(c)),
78727
78906
  optionClass: (a, b) => c => joinClass(a(c), b(c)),
78728
78907
  addToOptions: (a, b) => a.concat(b)
78729
78908
  });
@@ -78802,14 +78981,17 @@
78802
78981
  key: this
78803
78982
  };
78804
78983
  this.space = null;
78984
+ this.currentClass = "";
78805
78985
  let cState = view.state.field(stateField);
78806
78986
  let { options, selected } = cState.open;
78807
78987
  let config = view.state.facet(completionConfig);
78808
78988
  this.optionContent = optionContent(config);
78809
78989
  this.optionClass = config.optionClass;
78990
+ this.tooltipClass = config.tooltipClass;
78810
78991
  this.range = rangeAroundSelected(options.length, selected, config.maxRenderedOptions);
78811
78992
  this.dom = document.createElement("div");
78812
78993
  this.dom.className = "cm-tooltip-autocomplete";
78994
+ this.updateTooltipClass(view.state);
78813
78995
  this.dom.addEventListener("mousedown", (e) => {
78814
78996
  for (let dom = e.target, match; dom && dom != this.dom; dom = dom.parentNode) {
78815
78997
  if (dom.nodeName == "LI" && (match = /-(\d+)$/.exec(dom.id)) && +match[1] < options.length) {
@@ -78830,12 +79012,25 @@
78830
79012
  var _a, _b, _c;
78831
79013
  let cState = update.state.field(this.stateField);
78832
79014
  let prevState = update.startState.field(this.stateField);
79015
+ this.updateTooltipClass(update.state);
78833
79016
  if (cState != prevState) {
78834
79017
  this.updateSel();
78835
79018
  if (((_a = cState.open) === null || _a === void 0 ? void 0 : _a.disabled) != ((_b = prevState.open) === null || _b === void 0 ? void 0 : _b.disabled))
78836
79019
  this.dom.classList.toggle("cm-tooltip-autocomplete-disabled", !!((_c = cState.open) === null || _c === void 0 ? void 0 : _c.disabled));
78837
79020
  }
78838
79021
  }
79022
+ updateTooltipClass(state) {
79023
+ let cls = this.tooltipClass(state);
79024
+ if (cls != this.currentClass) {
79025
+ for (let c of this.currentClass.split(" "))
79026
+ if (c)
79027
+ this.dom.classList.remove(c);
79028
+ for (let c of cls.split(" "))
79029
+ if (c)
79030
+ this.dom.classList.add(c);
79031
+ this.currentClass = cls;
79032
+ }
79033
+ }
78839
79034
  positioned(space) {
78840
79035
  this.space = space;
78841
79036
  if (this.info)
@@ -79096,13 +79291,13 @@
79096
79291
  if (active.length == this.active.length && active.every((a, i) => a == this.active[i]))
79097
79292
  active = this.active;
79098
79293
  let open = this.open;
79294
+ if (open && tr.docChanged)
79295
+ open = open.map(tr.changes);
79099
79296
  if (tr.selection || active.some(a => a.hasResult() && tr.changes.touchesRange(a.from, a.to)) ||
79100
79297
  !sameResults(active, this.active))
79101
- open = CompletionDialog.build(active, state, this.id, this.open, conf);
79298
+ open = CompletionDialog.build(active, state, this.id, open, conf);
79102
79299
  else if (open && open.disabled && !active.some(a => a.state == 1 /* State.Pending */))
79103
79300
  open = null;
79104
- else if (open && tr.docChanged)
79105
- open = open.map(tr.changes);
79106
79301
  if (!open && active.every(a => a.state != 1 /* State.Pending */) && active.some(a => a.hasResult()))
79107
79302
  active = active.map(a => a.hasResult() ? new ActiveSource(a.source, 0 /* State.Inactive */) : a);
79108
79303
  for (let effect of tr.effects)
@@ -79457,6 +79652,7 @@
79457
79652
  maxWidth: "min(700px, 95vw)",
79458
79653
  minWidth: "250px",
79459
79654
  maxHeight: "10em",
79655
+ height: "100%",
79460
79656
  listStyle: "none",
79461
79657
  margin: 0,
79462
79658
  padding: 0,
@@ -80411,7 +80607,7 @@
80411
80607
  function extendSel(view, how) {
80412
80608
  let selection = updateSel(view.state.selection, range => {
80413
80609
  let head = how(range);
80414
- return EditorSelection.range(range.anchor, head.head, head.goalColumn);
80610
+ return EditorSelection.range(range.anchor, head.head, head.goalColumn, head.bidiLevel || undefined);
80415
80611
  });
80416
80612
  if (selection.eq(view.state.selection))
80417
80613
  return false;
@@ -84384,6 +84580,88 @@
84384
84580
  }
84385
84581
  });
84386
84582
 
84583
+ /**
84584
+ * Create an array of syntax errors in the given tree.
84585
+ *
84586
+ * @param {Tree} syntaxTree
84587
+ * @returns {LintMessage[]} array of syntax errors
84588
+ */
84589
+ function lintSyntax(syntaxTree) {
84590
+
84591
+ const lintMessages = [];
84592
+
84593
+ syntaxTree.iterate({
84594
+ enter: node => {
84595
+ if (node.type.isError) {
84596
+
84597
+ const error = node.toString();
84598
+
84599
+ /* The error has the pattern [⚠ || ⚠(NodeType)]. The regex extracts the node type from inside the brackets */
84600
+ const match = /\((.*?)\)/.exec(error);
84601
+ const nodeType = match && match[1];
84602
+
84603
+ let message;
84604
+
84605
+ if (nodeType) {
84606
+ message = 'unexpected ' + nodeType;
84607
+ } else {
84608
+ message = 'expression expected';
84609
+ }
84610
+
84611
+ lintMessages.push(
84612
+ {
84613
+ from: node.from,
84614
+ to: node.to,
84615
+ severity: 'error',
84616
+ message: message,
84617
+ type: 'syntaxError'
84618
+ }
84619
+ );
84620
+ }
84621
+ }
84622
+ });
84623
+
84624
+ return lintMessages;
84625
+ }
84626
+
84627
+ /**
84628
+ * Generates lint messages for the given syntax tree.
84629
+ *
84630
+ * @param {Tree} syntaxTree
84631
+ * @returns {LintMessage[]} array of all lint messages
84632
+ */
84633
+ function lintAll(syntaxTree) {
84634
+
84635
+ const lintMessages = [
84636
+ ... lintSyntax(syntaxTree)
84637
+ ];
84638
+
84639
+ return lintMessages;
84640
+ }
84641
+
84642
+ /**
84643
+ * CodeMirror extension that provides linting for FEEL expressions.
84644
+ *
84645
+ * @param {EditorView} editorView
84646
+ * @returns {Source} CodeMirror linting source
84647
+ */
84648
+ const cmFeelLinter = () => editorView => {
84649
+
84650
+ // don't lint if the Editor is empty
84651
+ if (editorView.state.doc.length === 0) {
84652
+ return [];
84653
+ }
84654
+
84655
+ const tree = syntaxTree(editorView.state);
84656
+
84657
+ const messages = lintAll(tree);
84658
+
84659
+ return messages.map(message => ({
84660
+ ...message,
84661
+ source: 'syntaxError'
84662
+ }));
84663
+ };
84664
+
84387
84665
  // helpers ///////////////////////////////
84388
84666
 
84389
84667
  function isNodeEmpty(node) {
@@ -84747,9 +85025,10 @@
84747
85025
  label: tag.name,
84748
85026
  type: 'function',
84749
85027
  info: () => {
84750
- const html = domify$1(tag.description);
85028
+ const html = domify$1(`<div class="description">${tag.description}<div>`);
84751
85029
  return html;
84752
- }
85030
+ },
85031
+ boost: -1
84753
85032
  }
84754
85033
  ));
84755
85034
 
@@ -84788,6 +85067,109 @@
84788
85067
  */
84789
85068
  const variablesFacet = Facet.define();
84790
85069
 
85070
+ var pathExpression = context => {
85071
+ const variables = context.state.facet(variablesFacet)[0];
85072
+ const nodeBefore = syntaxTree(context.state).resolve(context.pos, -1);
85073
+
85074
+ if (!isPathExpression(nodeBefore)) {
85075
+ return;
85076
+ }
85077
+
85078
+ const expression = findPathExpression(nodeBefore);
85079
+
85080
+ // if the cursor is directly after the `.`, variable starts at the cursor position
85081
+ const from = nodeBefore === expression ? context.pos : nodeBefore.from;
85082
+
85083
+ const path = getPath(expression, context);
85084
+
85085
+ let options = variables;
85086
+ for (var i = 0; i < path.length - 1; i++) {
85087
+ var childVar = options.find(val => val.name === path[i].name);
85088
+
85089
+ if (!childVar) {
85090
+ return null;
85091
+ }
85092
+
85093
+ // only suggest if variable type matches
85094
+ if (
85095
+ childVar.isList !== 'optional' &&
85096
+ !!childVar.isList !== path[i].isList
85097
+ ) {
85098
+ return;
85099
+ }
85100
+
85101
+ options = childVar.entries;
85102
+ }
85103
+
85104
+ if (!options) return;
85105
+
85106
+ options = options.map(v => ({
85107
+ label: v.name,
85108
+ type: 'variable',
85109
+ info: v.info,
85110
+ detail: v.detail
85111
+ }));
85112
+
85113
+ const result = {
85114
+ from: from,
85115
+ options: options
85116
+ };
85117
+
85118
+ return result;
85119
+ };
85120
+
85121
+
85122
+ function findPathExpression(node) {
85123
+ while (node) {
85124
+ if (node.name === 'PathExpression') {
85125
+ return node;
85126
+ }
85127
+ node = node.parent;
85128
+ }
85129
+ }
85130
+
85131
+ // parses the path expression into a list of variable names with type information
85132
+ // e.g. foo[0].bar => [ { name: 'foo', isList: true }, { name: 'bar', isList: false } ]
85133
+ function getPath(node, context) {
85134
+ let path = [];
85135
+
85136
+ for (let child = node.firstChild; child; child = child.nextSibling) {
85137
+ if (child.name === 'PathExpression') {
85138
+ path.push(...getPath(child, context));
85139
+ } else if (child.name === 'FilterExpression') {
85140
+ path.push(...getFilter(child, context));
85141
+ }
85142
+ else {
85143
+ path.push({
85144
+ name: getNodeContent(child, context),
85145
+ isList: false
85146
+ });
85147
+ }
85148
+ }
85149
+ return path;
85150
+ }
85151
+
85152
+ function getFilter(node, context) {
85153
+ const list = node.firstChild;
85154
+
85155
+ if (list.name === 'PathExpression') {
85156
+ const path = getPath(list, context);
85157
+ const last = path[path.length - 1];
85158
+ last.isList = true;
85159
+
85160
+ return path;
85161
+ }
85162
+
85163
+ return [ {
85164
+ name: getNodeContent(list, context),
85165
+ isList: true
85166
+ } ];
85167
+ }
85168
+
85169
+ function getNodeContent(node, context) {
85170
+ return context.state.sliceDoc(node.from, node.to);
85171
+ }
85172
+
84791
85173
  /**
84792
85174
  * @type {import('@codemirror/autocomplete').CompletionSource}
84793
85175
  */
@@ -84839,7 +85221,8 @@
84839
85221
  override: [
84840
85222
  variables,
84841
85223
  builtins,
84842
- completeFromList(snippets)
85224
+ completeFromList(snippets.map(s => ({ ...s, boost: -1 }))),
85225
+ pathExpression
84843
85226
  ]
84844
85227
  })
84845
85228
  ];
@@ -84849,53 +85232,7 @@
84849
85232
  return new LanguageSupport(feelLanguage, [ ]);
84850
85233
  }
84851
85234
 
84852
- const FeelLinter = function(editorView) {
84853
- const messages = [];
84854
-
84855
- // don't lint if the Editor is empty
84856
- if (editorView.state.doc.length === 0) {
84857
- return messages;
84858
- }
84859
-
84860
- const tree = syntaxTree(editorView.state);
84861
-
84862
- tree.iterate({
84863
- enter: node => {
84864
- if (node.type.isError) {
84865
-
84866
- const error = node.toString();
84867
-
84868
- /* The error has the pattern [⚠ || ⚠(NodeType)]. The regex extracts the node type from inside the brackets */
84869
- const match = /\((.*?)\)/.exec(error);
84870
- const nodeType = match && match[1];
84871
-
84872
- let message;
84873
-
84874
- if (nodeType) {
84875
- message = 'unexpected ' + nodeType;
84876
- } else {
84877
- message = 'expression expected';
84878
- }
84879
-
84880
- messages.push(
84881
- {
84882
- from: node.from,
84883
- to: node.to,
84884
- severity: 'error',
84885
- message: message,
84886
- source: 'syntaxError'
84887
- }
84888
- );
84889
- }
84890
- }
84891
- });
84892
-
84893
- return messages;
84894
- };
84895
-
84896
- var syntaxLinter = linter$1(FeelLinter);
84897
-
84898
- var linter = [ syntaxLinter ];
85235
+ var linter = [ linter$1(cmFeelLinter()) ];
84899
85236
 
84900
85237
  const baseTheme = EditorView.theme({
84901
85238
  '& .cm-content': {
@@ -84963,9 +85300,11 @@
84963
85300
 
84964
85301
  /**
84965
85302
  * @typedef {object} Variable
84966
- * @property {string} name
84967
- * @property {string} [info]
84968
- * @property {string} [detail]
85303
+ * @property {string} name name or key of the variable
85304
+ * @property {string} [info] short information about the variable, e.g. type
85305
+ * @property {string} [detail] longer description of the variable content
85306
+ * @property {boolean} [isList] whether the variable is a list
85307
+ * @property {array<Variable>} [schema] array of child variables if the variable is a context or list
84969
85308
  */
84970
85309
 
84971
85310
  const autocompletionConf = new Compartment();
@@ -86703,7 +87042,7 @@
86703
87042
  label,
86704
87043
  onChange,
86705
87044
  options = [],
86706
- value,
87045
+ value = '',
86707
87046
  disabled,
86708
87047
  onFocus,
86709
87048
  onBlur
@@ -87798,28 +88137,41 @@
87798
88137
 
87799
88138
  // api /////////////////////////
87800
88139
 
88140
+ /**
88141
+ * Extractors add ProcessVariables to the `options.processVariables` parameter.
88142
+ * @callback extractor
88143
+ * @param {Object} options
88144
+ * @param {Array<ModdleElement>} options.elements
88145
+ * @param {ModdleElement} options.containerElement
88146
+ * @param {Array<ProcessVariable>} options.processVariables
88147
+ */
88148
+
87801
88149
  /**
87802
88150
  * Retrieves all process variables for a given container element.
87803
88151
  * @param {ModdleElement} containerElement
88152
+ * @param {Array<extractor>} [additionalExtractors]
87804
88153
  *
87805
- * @returns {Array<ProcessVariable>}
88154
+ * @returns {Promise<Array<ProcessVariable>>}
87806
88155
  */
87807
- function getProcessVariables$1(containerElement) {
88156
+ function getProcessVariables$1(containerElement, additionalExtractors = []) {
87808
88157
  var processVariables = [];
87809
88158
 
87810
88159
  // (1) extract all flow elements inside the container
87811
88160
  var elements = selfAndAllFlowElements$1([ containerElement ], false);
87812
88161
 
88162
+ const allPromises = [];
88163
+
87813
88164
  // (2) extract all variables from the extractors
87814
- minDash$1.forEach(extractors$1, function(extractor) {
87815
- extractor({
88165
+ minDash$1.forEach([ ...extractors$1, ...additionalExtractors ], function(extractor) {
88166
+ allPromises.push(extractor({
87816
88167
  elements: elements,
87817
88168
  containerElement: containerElement,
87818
88169
  processVariables: processVariables
87819
- });
88170
+ }));
87820
88171
  });
87821
88172
 
87822
- return processVariables;
88173
+ return Promise.all(allPromises)
88174
+ .then(() => processVariables);
87823
88175
  }
87824
88176
 
87825
88177
  /**
@@ -87831,12 +88183,13 @@
87831
88183
  *
87832
88184
  * @param {string} scope
87833
88185
  * @param {ModdleElement} rootElement element from where to extract all variables
88186
+ * @param {Array<extractor>} [additionalExtractors]
87834
88187
  *
87835
- * @returns {Array<ProcessVariable>}
88188
+ * @returns {Promise<Array<ProcessVariable>>}
87836
88189
  */
87837
- function getVariablesForScope$1(scope, rootElement) {
88190
+ async function getVariablesForScope$1(scope, rootElement, additionalExtractors = []) {
87838
88191
 
87839
- var allVariables = getProcessVariables$1(rootElement);
88192
+ var allVariables = await getProcessVariables$1(rootElement, additionalExtractors);
87840
88193
 
87841
88194
  var scopeElement = getElement$1(scope, rootElement);
87842
88195
 
@@ -87858,8 +88211,8 @@
87858
88211
  }
87859
88212
 
87860
88213
 
87861
- function getVariablesForElement(element) {
87862
- return getVariablesForScope$1(getScope$2(element), getRootElement$1(element));
88214
+ function getVariablesForElement(element, additionalExtractors = []) {
88215
+ return getVariablesForScope$1(getScope$2(element), getRootElement$1(element), additionalExtractors);
87863
88216
  }
87864
88217
 
87865
88218
  function getScope$2(element) {
@@ -88564,30 +88917,46 @@
88564
88917
  * @property {ModdleElement} scope
88565
88918
  */
88566
88919
 
88920
+
88921
+ /**
88922
+ * Extractors add ProcessVariables to the `options.processVariables` parameter.
88923
+ * @callback extractor
88924
+ * @param {Object} options
88925
+ * @param {Array<ModdleElement>} options.elements
88926
+ * @param {ModdleElement} options.containerElement
88927
+ * @param {Array<ProcessVariable>} options.processVariables
88928
+ */
88929
+
88567
88930
  // api /////////////////////////
88568
88931
 
88569
88932
  /**
88570
88933
  * Retrieves all process variables for a given container element.
88571
88934
  * @param {ModdleElement} containerElement
88935
+ * @param {Array<extractor>} additionalExtractors
88572
88936
  *
88573
- * @returns {Array<ProcessVariable>}
88937
+ * @returns {Promise<Array<ProcessVariable>>}
88574
88938
  */
88575
- function getProcessVariables(containerElement) {
88939
+ function getProcessVariables(containerElement, additionalExtractors = []) {
88940
+ const allPromises = [];
88941
+
88576
88942
  var processVariables = [];
88577
88943
 
88578
88944
  // (1) extract all flow elements inside the container
88579
88945
  var elements = selfAndAllFlowElements([ containerElement ], false);
88580
88946
 
88581
88947
  // (2) extract all variables from the extractors
88582
- minDash.forEach(extractors, function(extractor) {
88583
- extractor({
88584
- elements: elements,
88585
- containerElement: containerElement,
88586
- processVariables: processVariables
88587
- });
88948
+ minDash.forEach([ ...extractors, ...additionalExtractors ], function(extractor) {
88949
+ allPromises.push(
88950
+ extractor({
88951
+ elements: elements,
88952
+ containerElement: containerElement,
88953
+ processVariables: processVariables
88954
+ })
88955
+ );
88588
88956
  });
88589
88957
 
88590
- return processVariables;
88958
+ return Promise.all(allPromises)
88959
+ .then(() => processVariables);
88591
88960
  }
88592
88961
 
88593
88962
  /**
@@ -88599,12 +88968,13 @@
88599
88968
  *
88600
88969
  * @param {string} scope
88601
88970
  * @param {ModdleElement} rootElement element from where to extract all variables
88971
+ * @param {Array<extractor>} additionalExtractors
88602
88972
  *
88603
- * @returns {Array<ProcessVariable>}
88973
+ * @returns {Promise<Array<ProcessVariable>>}
88604
88974
  */
88605
- function getVariablesForScope(scope, rootElement) {
88975
+ async function getVariablesForScope(scope, rootElement, additionalExtractors = []) {
88606
88976
 
88607
- var allVariables = getProcessVariables(rootElement);
88977
+ var allVariables = await getProcessVariables(rootElement, additionalExtractors);
88608
88978
 
88609
88979
  var scopeElement = getElement(scope, rootElement);
88610
88980
 
@@ -91618,7 +91988,7 @@
91618
91988
  /**
91619
91989
  * @returns {Array<Entry>} entries
91620
91990
  */
91621
- function ErrorProps$1(props) {
91991
+ function ErrorProps$2(props) {
91622
91992
  const {
91623
91993
  element
91624
91994
  } = props;
@@ -91638,7 +92008,7 @@
91638
92008
  isEdited: isEdited$1
91639
92009
  }, {
91640
92010
  id: 'errorCode',
91641
- component: ErrorCode$1,
92011
+ component: ErrorCode$2,
91642
92012
  isEdited: isEdited$1
91643
92013
  }];
91644
92014
  }
@@ -91754,7 +92124,7 @@
91754
92124
  debounce
91755
92125
  });
91756
92126
  }
91757
- function ErrorCode$1(props) {
92127
+ function ErrorCode$2(props) {
91758
92128
  const {
91759
92129
  element
91760
92130
  } = props;
@@ -93228,7 +93598,7 @@
93228
93598
  id: 'error',
93229
93599
  label: translate('Error'),
93230
93600
  component: Group,
93231
- entries: [...ErrorProps$1({
93601
+ entries: [...ErrorProps$2({
93232
93602
  element
93233
93603
  })]
93234
93604
  };
@@ -99583,7 +99953,8 @@
99583
99953
  }
99584
99954
  return {
99585
99955
  items,
99586
- add
99956
+ add,
99957
+ shouldSort: false
99587
99958
  };
99588
99959
  }
99589
99960
  function removeFactory$2(props) {
@@ -100391,7 +100762,8 @@
100391
100762
  bpmnFactory,
100392
100763
  commandStack,
100393
100764
  element
100394
- })
100765
+ }),
100766
+ shouldSort: false
100395
100767
  };
100396
100768
  }
100397
100769
  function removeFactory({
@@ -100955,24 +101327,23 @@
100955
101327
  return businessObject.get('processRef') || businessObject;
100956
101328
  }
100957
101329
 
100958
- function ProcessVariablesProps(props) {
101330
+ function ProcessVariablesEntry(props) {
100959
101331
  const {
100960
101332
  element
100961
101333
  } = props;
100962
- if (!canHaveProcessVariables(element)) {
100963
- return null;
100964
- }
100965
- const businessObject = getBusinessObject$1(element);
100966
- const rootElement = getRootElement(businessObject);
100967
- const scope = getScope(element);
100968
-
100969
- // (1) fetch available process variables for given scope
100970
- const variables = getVariablesForScope_1(scope, rootElement);
101334
+ const [variables, setVariables] = l$1([]);
101335
+ y(async () => {
101336
+ const businessObject = getBusinessObject$1(element);
101337
+ const rootElement = getRootElement(businessObject);
101338
+ const scope = getScope(element);
101339
+ const rawVariables = await getVariablesForScope_1(scope, rootElement);
101340
+ const withName = populateElementNames(sortByName(rawVariables));
101341
+ setVariables(withName);
101342
+ }, [element]);
100971
101343
  if (!variables.length) {
100972
101344
  return null;
100973
101345
  }
100974
- const withNames = populateElementNames(sortByName(variables));
100975
- const byScope = groupByScope(withNames);
101346
+ const byScope = groupByScope(variables);
100976
101347
  const multiScope = isMultiScope(byScope);
100977
101348
  let variableItems = [];
100978
101349
 
@@ -100984,7 +101355,7 @@
100984
101355
  variableItems = flatten$1(reversed);
100985
101356
  } else {
100986
101357
  // (2b) single scope
100987
- variableItems = withNames;
101358
+ variableItems = variables;
100988
101359
  }
100989
101360
  const items = variableItems.map((variable, index) => {
100990
101361
  const id = element.id + '-variable-' + index;
@@ -100998,8 +101369,21 @@
100998
101369
  })]
100999
101370
  };
101000
101371
  });
101372
+ return o$1(ListGroup, {
101373
+ ...props,
101374
+ items: items,
101375
+ shouldSort: false
101376
+ });
101377
+ }
101378
+ function ProcessVariablesProps(props) {
101379
+ const {
101380
+ element
101381
+ } = props;
101382
+ if (!canHaveProcessVariables(element)) {
101383
+ return null;
101384
+ }
101001
101385
  return {
101002
- items,
101386
+ component: ProcessVariablesEntry,
101003
101387
  shouldSort: false
101004
101388
  };
101005
101389
  }
@@ -102136,19 +102520,19 @@
102136
102520
  }
102137
102521
  function ProcessVariablesGroup(element, injector) {
102138
102522
  const translate = injector.get('translate');
102523
+ const variableProps = ProcessVariablesProps({
102524
+ element,
102525
+ injector
102526
+ });
102527
+ if (!variableProps) {
102528
+ return null;
102529
+ }
102139
102530
  const group = {
102140
102531
  label: translate('Process variables'),
102141
102532
  id: 'CamundaPlatform__ProcessVariables',
102142
- component: ListGroup,
102143
- ...ProcessVariablesProps({
102144
- element,
102145
- injector
102146
- })
102533
+ ...variableProps
102147
102534
  };
102148
- if (group.items) {
102149
- return group;
102150
- }
102151
- return null;
102535
+ return group;
102152
102536
  }
102153
102537
  function FormDataGroup(element, injector) {
102154
102538
  const translate = injector.get('translate');
@@ -103168,7 +103552,7 @@
103168
103552
  // different conditions but same bindings
103169
103553
  return oldProperties.filter(property => !findPropertyWithBinding(newTemplate, property));
103170
103554
  }
103171
- function normalizeReplacer(key, value) {
103555
+ function normalizeReplacer$1(key, value) {
103172
103556
  if (isObject(value)) {
103173
103557
  const keys = Object.keys(value).sort();
103174
103558
  return keys.reduce((obj, key) => {
@@ -103179,7 +103563,7 @@
103179
103563
  return value;
103180
103564
  }
103181
103565
  function equals(a, b) {
103182
- return JSON.stringify(a, normalizeReplacer) === JSON.stringify(b, normalizeReplacer);
103566
+ return JSON.stringify(a, normalizeReplacer$1) === JSON.stringify(b, normalizeReplacer$1);
103183
103567
  }
103184
103568
 
103185
103569
  /**
@@ -104744,6 +105128,163 @@
104744
105128
  });
104745
105129
  }
104746
105130
 
105131
+ /**
105132
+ * Restores the original order of the template properties
105133
+ * on the moddle element.
105134
+ */
105135
+ class UpdateTemplatePropertiesOrder extends CommandInterceptor {
105136
+ constructor(eventBus, elementTemplates, commandStack, bpmnFactory) {
105137
+ super(eventBus);
105138
+ this._eventBus = eventBus;
105139
+ this._elementTemplates = elementTemplates;
105140
+ this._commandStack = commandStack;
105141
+ this._bpmnFactory = bpmnFactory;
105142
+ this.postExecute(['element.updateProperties', 'element.updateModdleProperties'], this._updatePropertiesOrder, true, this);
105143
+ }
105144
+ _updatePropertiesOrder(context) {
105145
+ const {
105146
+ element
105147
+ } = context;
105148
+ const template = this._elementTemplates.get(element);
105149
+ const businessObject = element.businessObject;
105150
+ const commands = [];
105151
+ if (!template) {
105152
+ return;
105153
+ }
105154
+ const templateProperties = template.properties;
105155
+
105156
+ // zeebe:Property
105157
+ const zeebeProperties = findExtension$1(businessObject, 'zeebe:Properties');
105158
+ if (zeebeProperties) {
105159
+ this._updateZeebePropertiesOrder(zeebeProperties, templateProperties, commands, context);
105160
+ }
105161
+
105162
+ // zeebe:IoMapping
105163
+ const ioMapping = findExtension$1(businessObject, 'zeebe:IoMapping');
105164
+ if (ioMapping) {
105165
+ // zeebe:Input
105166
+ this._updateInputOrder(ioMapping, templateProperties, commands, context);
105167
+
105168
+ // zeebe:Output
105169
+ this._updateOutputOrder(ioMapping, templateProperties, commands, context);
105170
+ }
105171
+
105172
+ // zeebe:TaskHeaders
105173
+ const taskHeaders = findExtension$1(businessObject, 'zeebe:TaskHeaders');
105174
+ if (taskHeaders) {
105175
+ this._updateTaskHeadersOrder(taskHeaders, templateProperties, commands, context);
105176
+ }
105177
+ if (commands.length) {
105178
+ const commandsToExecute = commands.filter(command => command !== null);
105179
+ commandsToExecute.length && this._commandStack.execute('properties-panel.multi-command-executor', commandsToExecute);
105180
+ return;
105181
+ }
105182
+ }
105183
+ _updateZeebePropertiesOrder(zeebeProperties, templateProperties, commands, context) {
105184
+ const findIndex = (properties, propertyToFind) => properties.findIndex(prop => prop.binding.type == 'zeebe:property' && prop.binding.name === propertyToFind.get('name'));
105185
+ const properties = zeebeProperties.get('properties');
105186
+ if (properties.length < 1) return;
105187
+ let newPropertiesOrder = [...properties];
105188
+ sortProperties(newPropertiesOrder, findIndex, templateProperties);
105189
+ if (!arrayEquals(newPropertiesOrder, properties)) {
105190
+ commands.push({
105191
+ cmd: 'element.updateModdleProperties',
105192
+ context: {
105193
+ ...context,
105194
+ moddleElement: zeebeProperties,
105195
+ properties: {
105196
+ properties: newPropertiesOrder
105197
+ }
105198
+ }
105199
+ });
105200
+ }
105201
+ }
105202
+ _updateInputOrder(ioMapping, templateProperties, commands, context) {
105203
+ const findIndex = (properties, propertyToFind) => properties.findIndex(prop => prop.binding.type == 'zeebe:input' && prop.binding.name === propertyToFind.get('target'));
105204
+ const inputParameters = ioMapping.get('inputParameters');
105205
+ if (inputParameters.length < 1) return;
105206
+ let newInputOrder = [...inputParameters];
105207
+ sortProperties(newInputOrder, findIndex, templateProperties);
105208
+ if (!arrayEquals(newInputOrder, inputParameters)) {
105209
+ commands.push({
105210
+ cmd: 'element.updateModdleProperties',
105211
+ context: {
105212
+ ...context,
105213
+ moddleElement: ioMapping,
105214
+ properties: {
105215
+ inputParameters: newInputOrder
105216
+ }
105217
+ }
105218
+ });
105219
+ }
105220
+ }
105221
+ _updateOutputOrder(ioMapping, templateProperties, commands, context) {
105222
+ const findIndex = (properties, propertyToFind) => properties.findIndex(prop => prop.binding.type == 'zeebe:output' && prop.binding.source === propertyToFind.get('source'));
105223
+ const outputParameters = ioMapping.get('outputParameters');
105224
+ if (outputParameters.length < 1) return;
105225
+ let newOutputOrder = [...outputParameters];
105226
+ sortProperties(newOutputOrder, findIndex, templateProperties);
105227
+ if (!arrayEquals(newOutputOrder, outputParameters)) {
105228
+ commands.push({
105229
+ cmd: 'element.updateModdleProperties',
105230
+ context: {
105231
+ ...context,
105232
+ moddleElement: ioMapping,
105233
+ properties: {
105234
+ outputParameters: newOutputOrder
105235
+ }
105236
+ }
105237
+ });
105238
+ }
105239
+ }
105240
+ _updateTaskHeadersOrder(taskHeaders, templateProperties, commands, context) {
105241
+ const findIndex = (properties, propertyToFind) => properties.findIndex(prop => prop.binding.type == 'zeebe:taskHeader' && prop.binding.key === propertyToFind.get('key'));
105242
+ const headers = taskHeaders.get('zeebe:values');
105243
+ if (headers.length < 1) return;
105244
+ let newHeadersOrder = [...headers];
105245
+ sortProperties(newHeadersOrder, findIndex, templateProperties);
105246
+ if (!arrayEquals(newHeadersOrder, headers)) {
105247
+ commands.push({
105248
+ cmd: 'element.updateModdleProperties',
105249
+ context: {
105250
+ ...context,
105251
+ moddleElement: taskHeaders,
105252
+ properties: {
105253
+ values: newHeadersOrder
105254
+ }
105255
+ }
105256
+ });
105257
+ }
105258
+ }
105259
+ }
105260
+ UpdateTemplatePropertiesOrder.$inject = ['eventBus', 'elementTemplates', 'commandStack', 'bpmnFactory'];
105261
+
105262
+ // helpers
105263
+
105264
+ function normalizeReplacer(key, value) {
105265
+ if (isObject(value)) {
105266
+ const keys = Object.keys(value).sort();
105267
+ return keys.reduce((obj, key) => {
105268
+ obj[key] = value[key];
105269
+ return obj;
105270
+ }, {});
105271
+ }
105272
+ return value;
105273
+ }
105274
+ function objectEquals(a, b) {
105275
+ return JSON.stringify(a, normalizeReplacer) === JSON.stringify(b, normalizeReplacer);
105276
+ }
105277
+ function arrayEquals(a, b) {
105278
+ return a.every((element, idx) => objectEquals(element, b[idx]));
105279
+ }
105280
+ function sortProperties(array, findIndex, templateProperties) {
105281
+ return array.sort((a, b) => {
105282
+ const aIndex = findIndex(templateProperties, a);
105283
+ const bIndex = findIndex(templateProperties, b);
105284
+ return aIndex - bIndex;
105285
+ });
105286
+ }
105287
+
104747
105288
  /**
104748
105289
  * This Behavior checks if the new element's type is in
104749
105290
  * the list of elements the template applies to and unlinks
@@ -109902,6 +110443,374 @@
109902
110443
  camunda: camundaModdle
109903
110444
  };
109904
110445
 
110446
+ const ALL_OPTIONS = Object.values(replaceOptions);
110447
+
110448
+ function getReplaceOptionGroups() {
110449
+ return ALL_OPTIONS;
110450
+ }
110451
+
110452
+ /**
110453
+ * A replace menu provider that allows to replace elements with
110454
+ * templates applied with the correspondent plain element.
110455
+ */
110456
+ function UnlinkTemplateReplaceProvider(popupMenu, translate, elementTemplates) {
110457
+
110458
+ this._popupMenu = popupMenu;
110459
+ this._translate = translate;
110460
+ this._elementTemplates = elementTemplates;
110461
+
110462
+ this.register();
110463
+ }
110464
+
110465
+ UnlinkTemplateReplaceProvider.$inject = [
110466
+ 'popupMenu',
110467
+ 'translate',
110468
+ 'elementTemplates'
110469
+ ];
110470
+
110471
+ /**
110472
+ * Register replace menu provider in the popup menu
110473
+ */
110474
+ UnlinkTemplateReplaceProvider.prototype.register = function() {
110475
+ this._popupMenu.registerProvider('bpmn-replace', this);
110476
+ };
110477
+
110478
+ /**
110479
+ * Adds the element templates to the replace menu.
110480
+ * @param {djs.model.Base} element
110481
+ *
110482
+ * @returns {Object}
110483
+ */
110484
+ UnlinkTemplateReplaceProvider.prototype.getPopupMenuEntries = function(element) {
110485
+
110486
+ return (entries) => {
110487
+
110488
+ // convert our entries into something sortable
110489
+ let entrySet = Object.entries(entries);
110490
+
110491
+ if (this._elementTemplates.get(element)) {
110492
+
110493
+ // add unlink template option
110494
+ this.addPlainElementEntry(element, entrySet, this._translate, this._elementTemplates);
110495
+ }
110496
+
110497
+ // convert back to object
110498
+ return entrySet.reduce((entries, [ key, value ]) => {
110499
+ entries[key] = value;
110500
+
110501
+ return entries;
110502
+ }, {});
110503
+ };
110504
+ };
110505
+
110506
+
110507
+ /**
110508
+ * Adds the option to replace with plain element (unlink template).
110509
+ *
110510
+ * @param {djs.model.Base} element
110511
+ * @param {Array<Object>} entries
110512
+ */
110513
+ UnlinkTemplateReplaceProvider.prototype.addPlainElementEntry = function(element, entries, translate, elementTemplates) {
110514
+
110515
+ const replaceOption = this.getPlainEntry(element, entries, translate, elementTemplates);
110516
+
110517
+ if (!replaceOption) {
110518
+ return;
110519
+ }
110520
+
110521
+ const [
110522
+ insertIndex,
110523
+ entry
110524
+ ] = replaceOption;
110525
+
110526
+ // insert unlink entry
110527
+ entries.splice(insertIndex, 0, [ entry.id, entry ]);
110528
+ };
110529
+
110530
+ /**
110531
+ * Returns the option to replace with plain element and the index where it should be inserted.
110532
+ *
110533
+ * @param {djs.model.Base} element
110534
+ * @param {Array<Object>} entries
110535
+ *
110536
+ * @returns {Array<Object, number>}
110537
+ */
110538
+ UnlinkTemplateReplaceProvider.prototype.getPlainEntry = function(element, entries, translate, elementTemplates) {
110539
+
110540
+ const {
110541
+ options,
110542
+ option,
110543
+ optionIndex
110544
+ } = findReplaceOptions(element) || { };
110545
+
110546
+ if (!options) {
110547
+ return null;
110548
+ }
110549
+
110550
+ const entry = {
110551
+ id: 'replace-unlink-element-template',
110552
+ action: () => {
110553
+ elementTemplates.applyTemplate(element, null);
110554
+ },
110555
+ label: translate(option.label),
110556
+ className: option.className
110557
+ };
110558
+
110559
+ // insert after previous option, if it exists
110560
+ const previousIndex = getOptionIndex(options, optionIndex - 1, entries);
110561
+
110562
+ if (previousIndex) {
110563
+ return [
110564
+ previousIndex + 1,
110565
+ entry
110566
+ ];
110567
+ }
110568
+
110569
+ // insert before next option, if it exists
110570
+ const nextIndex = getOptionIndex(options, optionIndex + 1, entries);
110571
+
110572
+ if (nextIndex) {
110573
+ return [
110574
+ nextIndex,
110575
+ entry
110576
+ ];
110577
+ }
110578
+
110579
+ // fallback to insert at start
110580
+ return [
110581
+ 0,
110582
+ entry
110583
+ ];
110584
+ };
110585
+
110586
+
110587
+ /**
110588
+ * @param {ModdleElement} element
110589
+ *
110590
+ * @return { { options: Array<any>, option: any, optionIndex: number } | null }
110591
+ */
110592
+ function findReplaceOptions(element) {
110593
+
110594
+ const isSameType = (element, option) => option.target && !isDifferentType(element)(option);
110595
+
110596
+ return getReplaceOptionGroups().reduce((result, options) => {
110597
+
110598
+ if (result) {
110599
+ return result;
110600
+ }
110601
+
110602
+ const optionIndex = options.findIndex(option => isSameType(element, option));
110603
+
110604
+ if (optionIndex === -1) {
110605
+ return;
110606
+ }
110607
+
110608
+ return {
110609
+ options,
110610
+ option: options[optionIndex],
110611
+ optionIndex
110612
+ };
110613
+ }, null);
110614
+ }
110615
+
110616
+ function getOptionIndex(options, index, entries) {
110617
+ const option = options[index];
110618
+
110619
+ if (!option) {
110620
+ return false;
110621
+ }
110622
+
110623
+ return entries.findIndex(
110624
+ ([ key ]) => key === option.actionName
110625
+ );
110626
+ }
110627
+
110628
+ var sharedReplaceModule = {
110629
+ __init__: [
110630
+ 'unlinkTemplateReplaceProvider'
110631
+ ],
110632
+ unlinkTemplateReplaceProvider: [ 'type', UnlinkTemplateReplaceProvider ]
110633
+ };
110634
+
110635
+ 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>';
110636
+
110637
+ const colorImageUrl = 'data:image/svg+xml;utf8,' + encodeURIComponent(colorImageSvg);
110638
+
110639
+
110640
+ function ColorContextPadProvider(contextPad, popupMenu, canvas, translate) {
110641
+
110642
+ this._contextPad = contextPad;
110643
+ this._popupMenu = popupMenu;
110644
+ this._canvas = canvas;
110645
+ this._translate = translate;
110646
+
110647
+ contextPad.registerProvider(this);
110648
+ }
110649
+
110650
+
110651
+ ColorContextPadProvider.$inject = [
110652
+ 'contextPad',
110653
+ 'popupMenu',
110654
+ 'canvas',
110655
+ 'translate'
110656
+ ];
110657
+
110658
+
110659
+ ColorContextPadProvider.prototype.getContextPadEntries = function(element) {
110660
+ return this._createPopupAction([ element ]);
110661
+ };
110662
+
110663
+
110664
+ ColorContextPadProvider.prototype.getMultiElementContextPadEntries = function(elements) {
110665
+
110666
+ return this._createPopupAction(elements);
110667
+ };
110668
+
110669
+ ColorContextPadProvider.prototype._createPopupAction = function(elements) {
110670
+
110671
+ const canvas = this._canvas;
110672
+ const translate = this._translate;
110673
+ const contextPad = this._contextPad;
110674
+ const popupMenu = this._popupMenu;
110675
+
110676
+ return {
110677
+ 'set-color': {
110678
+ group: 'edit',
110679
+ className: 'bpmn-icon-color',
110680
+ title: translate('Set Color'),
110681
+ imageUrl: colorImageUrl,
110682
+ action: {
110683
+ click: (event, element) => {
110684
+
110685
+ // get start popup draw start position
110686
+ var position = {
110687
+ ...getStartPosition(canvas, contextPad, elements),
110688
+ cursor: {
110689
+ x: event.x,
110690
+ y: event.y
110691
+ }
110692
+ };
110693
+
110694
+ // open new color-picker popup
110695
+ popupMenu.open(elements, 'color-picker', position);
110696
+ }
110697
+ }
110698
+ }
110699
+ };
110700
+
110701
+ };
110702
+
110703
+
110704
+ // helpers //////////////////////
110705
+
110706
+ function getStartPosition(canvas, contextPad, elements) {
110707
+
110708
+ var Y_OFFSET = 5;
110709
+
110710
+ var diagramContainer = canvas.getContainer(),
110711
+ pad = contextPad.getPad(elements).html;
110712
+
110713
+ var diagramRect = diagramContainer.getBoundingClientRect(),
110714
+ padRect = pad.getBoundingClientRect();
110715
+
110716
+ var top = padRect.top - diagramRect.top;
110717
+ var left = padRect.left - diagramRect.left;
110718
+
110719
+ var pos = {
110720
+ x: left,
110721
+ y: top + padRect.height + Y_OFFSET
110722
+ };
110723
+
110724
+ return pos;
110725
+ }
110726
+
110727
+ const COLORS = [ {
110728
+ label: 'Default',
110729
+ fill: undefined,
110730
+ stroke: undefined
110731
+ }, {
110732
+ label: 'Blue',
110733
+ fill: '#BBDEFB',
110734
+ stroke: '#0D4372'
110735
+ }, {
110736
+ label: 'Orange',
110737
+ fill: '#FFE0B2',
110738
+ stroke: '#6B3C00'
110739
+ }, {
110740
+ label: 'Green',
110741
+ fill: '#C8E6C9',
110742
+ stroke: '#205022'
110743
+ }, {
110744
+ label: 'Red',
110745
+ fill: '#FFCDD2',
110746
+ stroke: '#831311'
110747
+ }, {
110748
+ label: 'Purple',
110749
+ fill: '#E1BEE7',
110750
+ stroke: '#5B176D'
110751
+ } ];
110752
+
110753
+
110754
+ function ColorPopupProvider(config, popupMenu, modeling, translate) {
110755
+ this._popupMenu = popupMenu;
110756
+ this._modeling = modeling;
110757
+ this._translate = translate;
110758
+
110759
+ this._colors = config && config.colors || COLORS;
110760
+
110761
+ this._popupMenu.registerProvider('color-picker', this);
110762
+ }
110763
+
110764
+
110765
+ ColorPopupProvider.$inject = [
110766
+ 'config.colorPicker',
110767
+ 'popupMenu',
110768
+ 'modeling',
110769
+ 'translate'
110770
+ ];
110771
+
110772
+
110773
+ ColorPopupProvider.prototype.getEntries = function(elements) {
110774
+ var self = this;
110775
+
110776
+ var colorIcon = domify$1(`
110777
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" height="100%">
110778
+ <rect rx="2" x="1" y="1" width="22" height="22" fill="var(--fill-color)" stroke="var(--stroke-color)"></rect>
110779
+ </svg>
110780
+ `);
110781
+
110782
+ var entries = this._colors.map(function(color) {
110783
+
110784
+ colorIcon.style.setProperty('--fill-color', color.fill || 'white');
110785
+ colorIcon.style.setProperty('--stroke-color', color.stroke || 'rgb(34, 36, 42)');
110786
+
110787
+ return {
110788
+ title: self._translate(color.label),
110789
+ id: color.label.toLowerCase() + '-color',
110790
+ imageUrl: `data:image/svg+xml;utf8,${ encodeURIComponent(colorIcon.outerHTML) }`,
110791
+ action: createAction(self._modeling, elements, color)
110792
+ };
110793
+ });
110794
+
110795
+ return entries;
110796
+ };
110797
+
110798
+
110799
+ function createAction(modeling, element, color) {
110800
+ return function() {
110801
+ modeling.setColor(element, color);
110802
+ };
110803
+ }
110804
+
110805
+ var colorPickerModule = {
110806
+ __init__: [
110807
+ 'colorContextPadProvider',
110808
+ 'colorPopupProvider'
110809
+ ],
110810
+ colorContextPadProvider: [ 'type', ColorContextPadProvider ],
110811
+ colorPopupProvider: [ 'type', ColorPopupProvider ]
110812
+ };
110813
+
109905
110814
  /**
109906
110815
  *
109907
110816
  * @param {Object} options
@@ -109924,7 +110833,9 @@
109924
110833
  Modeler.prototype._camundaPlatformModules = [
109925
110834
  behaviorsModule,
109926
110835
  camundaPlatformPropertiesProviderModule,
109927
- index
110836
+ index,
110837
+ sharedReplaceModule,
110838
+ colorPickerModule
109928
110839
  ];
109929
110840
 
109930
110841
  Modeler.prototype._modules = [].concat(