camunda-bpmn-js 4.10.0 → 4.11.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.
@@ -65138,7 +65138,7 @@
65138
65138
  * @return {SearchResult[]}
65139
65139
  */
65140
65140
  BpmnSearchProvider.prototype.find = function(pattern) {
65141
- var rootElement = this._canvas.getRootElement();
65141
+ var rootElements = this._canvas.getRootElements();
65142
65142
 
65143
65143
  var elements = this._elementRegistry.filter(function(element) {
65144
65144
  if (element.labelTarget) {
@@ -65149,7 +65149,7 @@
65149
65149
 
65150
65150
  // do not include root element
65151
65151
  elements = filter$1(elements, function(element) {
65152
- return element !== rootElement;
65152
+ return !rootElements.includes(element);
65153
65153
  });
65154
65154
 
65155
65155
  elements = map$3(elements, function(element) {
@@ -69206,6 +69206,8 @@
69206
69206
  var _a;
69207
69207
  let depth = action >> 19 /* Action.ReduceDepthShift */, type = action & 65535 /* Action.ValueMask */;
69208
69208
  let { parser } = this.p;
69209
+ if (this.reducePos < this.pos - 25 /* Lookahead.Margin */)
69210
+ this.setLookAhead(this.pos);
69209
69211
  let dPrec = parser.dynamicPrecedence(type);
69210
69212
  if (dPrec)
69211
69213
  this.score += dPrec;
@@ -70085,8 +70087,8 @@
70085
70087
  if (!(side < 0 ? cursor.childBefore(pos) : cursor.childAfter(pos)))
70086
70088
  for (;;) {
70087
70089
  if ((side < 0 ? cursor.to < pos : cursor.from > pos) && !cursor.type.isError)
70088
- return side < 0 ? Math.max(0, Math.min(cursor.to - 1, pos - 25 /* Safety.Margin */))
70089
- : Math.min(tree.length, Math.max(cursor.from + 1, pos + 25 /* Safety.Margin */));
70090
+ return side < 0 ? Math.max(0, Math.min(cursor.to - 1, pos - 25 /* Lookahead.Margin */))
70091
+ : Math.min(tree.length, Math.max(cursor.from + 1, pos + 25 /* Lookahead.Margin */));
70090
70092
  if (side < 0 ? cursor.prevSibling() : cursor.nextSibling())
70091
70093
  break;
70092
70094
  if (!cursor.parent())
@@ -70204,7 +70206,7 @@
70204
70206
  token.mask = mask;
70205
70207
  token.context = context;
70206
70208
  }
70207
- if (token.lookAhead > token.end + 25 /* Safety.Margin */)
70209
+ if (token.lookAhead > token.end + 25 /* Lookahead.Margin */)
70208
70210
  lookAhead = Math.max(token.lookAhead, lookAhead);
70209
70211
  if (token.value != 0 /* Term.Err */) {
70210
70212
  let startIndex = actionIndex;
@@ -79520,8 +79522,13 @@
79520
79522
  /* global console,process */
79521
79523
 
79522
79524
 
79525
+ // @ts-expect-error env access
79523
79526
  const LOG_PARSE = typeof process != 'undefined' && process.env && /\bfparse(:dbg)?\b/.test(process.env.LOG);
79527
+
79528
+ // @ts-expect-error env access
79524
79529
  const LOG_PARSE_DEBUG = typeof process != 'undefined' && process.env && /\bfparse:dbg\b/.test(process.env.LOG);
79530
+
79531
+ // @ts-expect-error env access
79525
79532
  const LOG_VARS = typeof process != 'undefined' && process.env && /\bcontext\b/.test(process.env.LOG);
79526
79533
 
79527
79534
  const spaceChars = [
@@ -79915,7 +79922,7 @@
79915
79922
  }
79916
79923
 
79917
79924
  /**
79918
- * @param { Function }
79925
+ * @param { Function } fn
79919
79926
  *
79920
79927
  * @return { ValueProducer }
79921
79928
  */
@@ -79974,11 +79981,13 @@
79974
79981
  get(key) {
79975
79982
  const result = this.value[key];
79976
79983
 
79977
- if (this.constructor.isAtomic(result)) {
79984
+ const constructor = /** @type { typeof VariableContext } */ (this.constructor);
79985
+
79986
+ if (constructor.isAtomic(result)) {
79978
79987
  return result;
79979
79988
  }
79980
79989
 
79981
- return this.constructor.of(result);
79990
+ return constructor.of(result);
79982
79991
  }
79983
79992
 
79984
79993
  /**
@@ -79986,10 +79995,14 @@
79986
79995
  *
79987
79996
  * @param {String} key
79988
79997
  * @param {any} value
79998
+ *
79989
79999
  * @returns {VariableContext} new context with the given key added
79990
80000
  */
79991
80001
  set(key, value) {
79992
- return this.constructor.of({
80002
+
80003
+ const constructor = /** @type { typeof VariableContext } */ (this.constructor);
80004
+
80005
+ return constructor.of({
79993
80006
  ...this.value,
79994
80007
  [key]: value
79995
80008
  });
@@ -80047,9 +80060,9 @@
80047
80060
  tokens = [],
80048
80061
  children = [],
80049
80062
  parent = null,
80050
- context,
80051
- value,
80052
- raw
80063
+ context = null,
80064
+ value = null,
80065
+ raw = null
80053
80066
  } = {}) {
80054
80067
  this.name = name;
80055
80068
  this.tokens = tokens;
@@ -80195,6 +80208,9 @@
80195
80208
 
80196
80209
  pushChildren(children) {
80197
80210
 
80211
+ /**
80212
+ * @type {Variables}
80213
+ */
80198
80214
  let parent = this;
80199
80215
 
80200
80216
  for (const child of children) {
@@ -80314,7 +80330,7 @@
80314
80330
  * Wrap children of variables under the given named child.
80315
80331
  *
80316
80332
  * @param { Variables } variables
80317
- * @param { string } name
80333
+ * @param { string } scopeName
80318
80334
  * @param { string } code
80319
80335
  * @return { Variables }
80320
80336
  */
@@ -80436,6 +80452,7 @@
80436
80452
  .assign({ context: newContext || currentContext });
80437
80453
  }
80438
80454
 
80455
+ // @ts-expect-error internal method
80439
80456
  const code = input.read(input.pos, stack.pos);
80440
80457
 
80441
80458
  const end = contextEnds[term];
@@ -80643,7 +80660,7 @@
80643
80660
  function: tags$1.definitionKeyword,
80644
80661
  as: tags$1.keyword,
80645
80662
  'Type/...': tags$1.typeName,
80646
- Wildcard: tags$1.special,
80663
+ Wildcard: tags$1.special(tags$1.variableName),
80647
80664
  null: tags$1.null,
80648
80665
  LineComment: tags$1.lineComment,
80649
80666
  BlockComment: tags$1.blockComment,
@@ -80684,7 +80701,7 @@
80684
80701
  tokenData: "+l~RuXY#fYZ$ZZ[#f]^$Zpq#fqr$`rs$kwx&cxy&hyz&mz{&r{|'P|}'U}!O'Z!O!P'h!P!Q(Q!Q![){![!]*^!]!^*c!^!_*h!_!`$f!`!a*w!b!c+R!}#O+W#P#Q+]#Q#R&z#o#p+b#q#r+g$f$g#f#BY#BZ#f$IS$I_#f$I|$I}$Z$I}$JO$Z$JT$JU#f$KV$KW#f&FU&FV#f?HT?HU#f~#kY#q~XY#fZ[#fpq#f$f$g#f#BY#BZ#f$IS$I_#f$JT$JU#f$KV$KW#f&FU&FV#f?HT?HU#f~$`O#r~~$cP!_!`$f~$kOr~~$pW$h~OY$kZr$krs%Ys#O$k#O#P%_#P;'S$k;'S;=`&]<%lO$k~%_O$h~~%bRO;'S$k;'S;=`%k;=`O$k~%pX$h~OY$kZr$krs%Ys#O$k#O#P%_#P;'S$k;'S;=`&];=`<%l$k<%lO$k~&`P;=`<%l$k~&hO#z~~&mOv~~&rOx~~&wP^~z{&z~'PO_~~'UO[~~'ZO#}~R'`PZP!`!a'cQ'hO$]Q~'mQ#y~!O!P's!Q!['x~'xO#|~~'}P$g~!Q!['x~(VQ]~z{(]!P!Q)d~(`TOz(]z{(o{;'S(];'S;=`)^<%lO(]~(rVOz(]z{(o{!P(]!P!Q)X!Q;'S(];'S;=`)^<%lO(]~)^OQ~~)aP;=`<%l(]~)iSP~OY)dZ;'S)d;'S;=`)u<%lO)d~)xP;=`<%l)d~*QQ$g~!O!P*W!Q![){~*ZP!Q!['x~*cO$Z~~*hO$q~R*oP![QsP!_!`*rP*wOsPR+OP!XQsP!_!`*r~+WO$j~~+]O!h~~+bO!f~~+gO#R~~+lO#Q~",
80685
80702
  tokenizers: [propertyIdentifiers, identifiers, insertSemicolon, 0, 1],
80686
80703
  topRules: {"Expression":[0,3],"Expressions":[1,101],"UnaryTests":[2,102]},
80687
- dynamicPrecedences: {"31":-1,"71":-1,"73":-1},
80704
+ dynamicPrecedences: {"31":-1,"67":1,"71":-1,"73":-1},
80688
80705
  specialized: [{term: 121, get: (value) => spec_identifier[value] || -1}],
80689
80706
  tokenPrec: 2500
80690
80707
  });
@@ -80921,14 +80938,16 @@
80921
80938
  return new Error(`not implemented: ${thing}`);
80922
80939
  }
80923
80940
  /**
80941
+ * Returns a name from context or undefined if it does not exist.
80942
+ *
80924
80943
  * @param {string} name
80925
80944
  * @param {Record<string, any>} context
80926
80945
  *
80927
- * @return {any}
80946
+ * @return {any|undefined}
80928
80947
  */
80929
80948
  function getFromContext(name, context) {
80930
80949
  if (['nil', 'boolean', 'number', 'string'].includes(getType$2(context))) {
80931
- return null;
80950
+ return undefined;
80932
80951
  }
80933
80952
  if (name in context) {
80934
80953
  return context[name];
@@ -80941,7 +80960,7 @@
80941
80960
  if (entry) {
80942
80961
  return entry[1];
80943
80962
  }
80944
- return null;
80963
+ return undefined;
80945
80964
  }
80946
80965
 
80947
80966
  function duration$1(opts) {
@@ -81446,7 +81465,7 @@
81446
81465
  }, ['list', 'function']),
81447
81466
  // 10.3.4.10 Context function
81448
81467
  'get value': fn(function (m, key) {
81449
- return getFromContext(key, m);
81468
+ return getFromContext(key, m) || null;
81450
81469
  }, ['context', 'string']),
81451
81470
  'get entries': fn(function (m) {
81452
81471
  if (arguments.length !== 1) {
@@ -81839,7 +81858,7 @@
81839
81858
  }
81840
81859
  const interpreter = new Interpreter();
81841
81860
  function unaryTest(expression, context = {}) {
81842
- const value = context['?'] || null;
81861
+ const value = context['?'] !== undefined ? context['?'] : null;
81843
81862
  const { root } = interpreter.unaryTest(expression, context);
81844
81863
  // root = fn(ctx) => test(val)
81845
81864
  const test = root(context);
@@ -82007,7 +82026,10 @@
82007
82026
  case 'Name': return input.replace(/\s{2,}/g, ' ');
82008
82027
  case 'VariableName': return (context) => {
82009
82028
  const name = args.join(' ');
82010
- return getBuiltin(name) || getFromContext(name, context);
82029
+ const contextValue = getFromContext(name, context);
82030
+ return (typeof contextValue !== 'undefined'
82031
+ ? contextValue
82032
+ : getBuiltin(name) || null);
82011
82033
  };
82012
82034
  case 'QualifiedName': return (context) => {
82013
82035
  return args.reduce((context, arg) => arg(context), context);
@@ -82209,6 +82231,18 @@
82209
82231
  if (target === null) {
82210
82232
  return null;
82211
82233
  }
82234
+ // a[variable=number]
82235
+ if (typeof filterFn.type === 'undefined') {
82236
+ try {
82237
+ const value = filterFn(context);
82238
+ if (isNumber$2(value)) {
82239
+ filterFn.type = 'number';
82240
+ }
82241
+ }
82242
+ catch (err) {
82243
+ // ignore
82244
+ }
82245
+ }
82212
82246
  // a[1]
82213
82247
  if (filterFn.type === 'number') {
82214
82248
  const idx = filterFn(context);
@@ -104050,176 +104084,182 @@
104050
104084
 
104051
104085
  var lint = linter$1(cmFeelersLinter());
104052
104086
 
104053
- /**
104054
- * Creates a Feelers editor in the supplied container.
104055
- *
104056
- * @param {Object} config Configuration options for the Feelers editor.
104057
- * @param {DOMNode} [config.container] The DOM node that will contain the editor.
104058
- * @param {DOMNode|String} [config.tooltipContainer] The DOM node or CSS selector string for the tooltip container.
104059
- * @param {String} [config.hostLanguage] The host language for the editor (e.g., 'markdown').
104060
- * @param {Object} [config.hostLanguageParser] A custom parser for the host language.
104061
- * @param {Function} [config.onChange] Callback function that is called when the editor's content changes.
104062
- * @param {Function} [config.onKeyDown] Callback function that is called when a key is pressed within the editor.
104063
- * @param {Function} [config.onLint] Callback function that is called when linting messages are available.
104064
- * @param {Object} [config.contentAttributes] Additional attributes to set on the editor's content element.
104065
- * @param {Boolean} [config.readOnly] Set to true to make the editor read-only.
104066
- * @param {String} [config.value] Initial value of the editor.
104067
- * @param {Boolean} [config.enableGutters] Set to true to enable gutter decorations (e.g., line numbers).
104068
- * @param {Boolean} [config.darkMode] Set to true to use the dark theme for the editor.
104069
- *
104070
- * @returns {Object} editor An instance of the FeelersEditor class.
104071
- */
104072
- function FeelersEditor({
104073
- container,
104074
- tooltipContainer,
104075
- hostLanguage,
104076
- hostLanguageParser,
104077
- onChange = () => { },
104078
- onKeyDown = () => { },
104079
- onLint = () => { },
104080
- contentAttributes = { },
104081
- readOnly = false,
104082
- value = '',
104083
- enableGutters = false,
104084
- singleLine = false,
104085
- darkMode = false
104086
- }) {
104087
-
104088
- const changeHandler = EditorView.updateListener.of((update) => {
104089
- if (update.docChanged) {
104090
- onChange(update.state.doc.toString());
104091
- }
104092
- });
104093
-
104094
- const lintHandler = EditorView.updateListener.of((update) => {
104095
- const diagnosticEffects = update.transactions
104096
- .flatMap(t => t.effects)
104097
- .filter(effect => effect.is(setDiagnosticsEffect));
104098
-
104099
- if (!diagnosticEffects.length) {
104100
- return;
104101
- }
104102
-
104103
- const messages = diagnosticEffects.flatMap(effect => effect.value);
104104
-
104105
- onLint(messages);
104106
- });
104107
-
104108
- const contentAttributesExtension = EditorView.contentAttributes.of(contentAttributes);
104109
-
104110
- const keyHandler = EditorView.domEventHandlers(
104111
- {
104112
- keydown: onKeyDown
104113
- }
104114
- );
104115
-
104116
- if (typeof tooltipContainer === 'string') {
104117
- // eslint-disable-next-line no-undef
104118
- tooltipContainer = document.querySelector(tooltipContainer);
104119
- }
104120
-
104121
- const tooltipLayout = tooltipContainer ? tooltips({
104122
- tooltipSpace: function() {
104123
- return tooltipContainer.getBoundingClientRect();
104124
- }
104125
- }) : [];
104126
-
104127
- const _getHostLanguageParser = (hostLanguage) => {
104128
- switch (hostLanguage) {
104129
- case 'markdown':
104130
- return parser$1;
104131
- default:
104132
- return null;
104133
- }
104134
- };
104135
-
104136
- const feelersLanguageSupport = createFeelersLanguageSupport(hostLanguageParser || hostLanguage && _getHostLanguageParser(hostLanguage));
104137
-
104138
- const extensions = [
104139
- bracketMatching(),
104140
- changeHandler,
104141
- contentAttributesExtension,
104142
- closeBrackets(),
104143
- indentOnInput(),
104144
- keyHandler,
104145
- keymap.of([
104146
- ...defaultKeymap,
104147
- ]),
104148
- feelersLanguageSupport,
104149
- lint,
104150
- lintHandler,
104151
- tooltipLayout,
104152
- darkMode ? darkTheme : lightTheme,
104153
- ...(enableGutters ? [
104154
-
104155
- // todo: adjust folding boundaries first foldGutter(),
104156
- lineNumbers()
104157
- ] : []),
104158
- ...(singleLine ? [
104159
- EditorState.transactionFilter.of(tr => tr.newDoc.lines > 1 ? [] : tr)
104160
- ] : [])
104161
- ];
104162
-
104163
- if (readOnly) {
104164
- extensions.push(EditorView.editable.of(false));
104165
- }
104166
-
104167
- if (singleLine && value) {
104168
- value = value.toString().split('\n')[0];
104169
- }
104170
-
104171
- this._cmEditor = new EditorView({
104172
- state: EditorState.create({
104173
- doc: value,
104174
- extensions: extensions
104175
- }),
104176
- parent: container
104177
- });
104178
-
104179
- return this;
104180
- }
104181
-
104182
- /**
104183
- * Replaces the content of the Editor
104184
- *
104185
- * @param {String} value
104186
- */
104187
- FeelersEditor.prototype.setValue = function(value) {
104188
- this._cmEditor.dispatch({
104189
- changes: {
104190
- from: 0,
104191
- to: this._cmEditor.state.doc.length,
104192
- insert: value,
104193
- }
104194
- });
104195
- };
104196
-
104197
- /**
104198
- * Sets the focus in the editor.
104199
- */
104200
- FeelersEditor.prototype.focus = function(position) {
104201
- const cmEditor = this._cmEditor;
104202
-
104203
- // the Codemirror `focus` method always calls `focus` with `preventScroll`,
104204
- // so we have to focus + scroll manually
104205
- cmEditor.contentDOM.focus();
104206
- cmEditor.focus();
104207
-
104208
- if (typeof position === 'number') {
104209
- const end = cmEditor.state.doc.length;
104210
- cmEditor.dispatch({ selection: { anchor: position <= end ? position : end } });
104211
- }
104212
- };
104213
-
104214
- /**
104215
- * Returns the current selection ranges. If no text is selected, a single
104216
- * range with the start and end index at the cursor position will be returned.
104217
- *
104218
- * @returns {Object} selection
104219
- * @returns {Array} selection.ranges
104220
- */
104221
- FeelersEditor.prototype.getSelection = function() {
104222
- return this._cmEditor.state.selection;
104087
+ /**
104088
+ * Creates a Feelers editor in the supplied container.
104089
+ *
104090
+ * @param {Object} config Configuration options for the Feelers editor.
104091
+ * @param {DOMNode} [config.container] The DOM node that will contain the editor.
104092
+ * @param {DOMNode|String} [config.tooltipContainer] The DOM node or CSS selector string for the tooltip container.
104093
+ * @param {String} [config.hostLanguage] The host language for the editor (e.g., 'markdown').
104094
+ * @param {Object} [config.hostLanguageParser] A custom parser for the host language.
104095
+ * @param {Function} [config.onChange] Callback function that is called when the editor's content changes.
104096
+ * @param {Function} [config.onKeyDown] Callback function that is called when a key is pressed within the editor.
104097
+ * @param {Function} [config.onLint] Callback function that is called when linting messages are available.
104098
+ * @param {Object} [config.contentAttributes] Additional attributes to set on the editor's content element.
104099
+ * @param {Boolean} [config.readOnly] Set to true to make the editor read-only.
104100
+ * @param {String} [config.value] Initial value of the editor.
104101
+ * @param {Boolean} [config.enableGutters] Set to true to enable gutter decorations (e.g., line numbers).
104102
+ * @param {Boolean} [config.singleLine] Set to true to limit the editor to a single line.
104103
+ * @param {Boolean} [config.lineWrap] Set to true to enable line wrapping.
104104
+ * @param {Boolean} [config.darkMode] Set to true to use the dark theme for the editor.
104105
+ *
104106
+ * @returns {Object} editor An instance of the FeelersEditor class.
104107
+ */
104108
+ function FeelersEditor({
104109
+ container,
104110
+ tooltipContainer,
104111
+ hostLanguage,
104112
+ hostLanguageParser,
104113
+ onChange = () => { },
104114
+ onKeyDown = () => { },
104115
+ onLint = () => { },
104116
+ contentAttributes = { },
104117
+ readOnly = false,
104118
+ value = '',
104119
+ enableGutters = false,
104120
+ singleLine = false,
104121
+ lineWrap = false,
104122
+ darkMode = false
104123
+ }) {
104124
+
104125
+ const changeHandler = EditorView.updateListener.of((update) => {
104126
+ if (update.docChanged) {
104127
+ onChange(update.state.doc.toString());
104128
+ }
104129
+ });
104130
+
104131
+ const lintHandler = EditorView.updateListener.of((update) => {
104132
+ const diagnosticEffects = update.transactions
104133
+ .flatMap(t => t.effects)
104134
+ .filter(effect => effect.is(setDiagnosticsEffect));
104135
+
104136
+ if (!diagnosticEffects.length) {
104137
+ return;
104138
+ }
104139
+
104140
+ const messages = diagnosticEffects.flatMap(effect => effect.value);
104141
+
104142
+ onLint(messages);
104143
+ });
104144
+
104145
+ const contentAttributesExtension = EditorView.contentAttributes.of(contentAttributes);
104146
+
104147
+ const keyHandler = EditorView.domEventHandlers(
104148
+ {
104149
+ keydown: onKeyDown
104150
+ }
104151
+ );
104152
+
104153
+ if (typeof tooltipContainer === 'string') {
104154
+ // eslint-disable-next-line no-undef
104155
+ tooltipContainer = document.querySelector(tooltipContainer);
104156
+ }
104157
+
104158
+ const tooltipLayout = tooltipContainer ? tooltips({
104159
+ tooltipSpace: function() {
104160
+ return tooltipContainer.getBoundingClientRect();
104161
+ }
104162
+ }) : [];
104163
+
104164
+ const _getHostLanguageParser = (hostLanguage) => {
104165
+ switch (hostLanguage) {
104166
+ case 'markdown':
104167
+ return parser$1;
104168
+ default:
104169
+ return null;
104170
+ }
104171
+ };
104172
+
104173
+ const feelersLanguageSupport = createFeelersLanguageSupport(hostLanguageParser || hostLanguage && _getHostLanguageParser(hostLanguage));
104174
+
104175
+ const extensions = [
104176
+ bracketMatching(),
104177
+ changeHandler,
104178
+ contentAttributesExtension,
104179
+ closeBrackets(),
104180
+ indentOnInput(),
104181
+ keyHandler,
104182
+ keymap.of([
104183
+ ...defaultKeymap,
104184
+ ]),
104185
+ feelersLanguageSupport,
104186
+ lint,
104187
+ lintHandler,
104188
+ tooltipLayout,
104189
+ darkMode ? darkTheme : lightTheme,
104190
+ ...(enableGutters ? [
104191
+
104192
+ // todo: adjust folding boundaries first foldGutter(),
104193
+ lineNumbers()
104194
+ ] : []),
104195
+ ...(singleLine ? [
104196
+ EditorState.transactionFilter.of(tr => tr.newDoc.lines > 1 ? [] : tr)
104197
+ ] : []),
104198
+ ...(lineWrap ? [
104199
+ EditorView.lineWrapping
104200
+ ] : [])
104201
+ ];
104202
+
104203
+ if (readOnly) {
104204
+ extensions.push(EditorView.editable.of(false));
104205
+ }
104206
+
104207
+ if (singleLine && value) {
104208
+ value = value.toString().split('\n')[0];
104209
+ }
104210
+
104211
+ this._cmEditor = new EditorView({
104212
+ state: EditorState.create({
104213
+ doc: value,
104214
+ extensions: extensions
104215
+ }),
104216
+ parent: container
104217
+ });
104218
+
104219
+ return this;
104220
+ }
104221
+
104222
+ /**
104223
+ * Replaces the content of the Editor
104224
+ *
104225
+ * @param {String} value
104226
+ */
104227
+ FeelersEditor.prototype.setValue = function(value) {
104228
+ this._cmEditor.dispatch({
104229
+ changes: {
104230
+ from: 0,
104231
+ to: this._cmEditor.state.doc.length,
104232
+ insert: value,
104233
+ }
104234
+ });
104235
+ };
104236
+
104237
+ /**
104238
+ * Sets the focus in the editor.
104239
+ */
104240
+ FeelersEditor.prototype.focus = function(position) {
104241
+ const cmEditor = this._cmEditor;
104242
+
104243
+ // the Codemirror `focus` method always calls `focus` with `preventScroll`,
104244
+ // so we have to focus + scroll manually
104245
+ cmEditor.contentDOM.focus();
104246
+ cmEditor.focus();
104247
+
104248
+ if (typeof position === 'number') {
104249
+ const end = cmEditor.state.doc.length;
104250
+ cmEditor.dispatch({ selection: { anchor: position <= end ? position : end } });
104251
+ }
104252
+ };
104253
+
104254
+ /**
104255
+ * Returns the current selection ranges. If no text is selected, a single
104256
+ * range with the start and end index at the cursor position will be returned.
104257
+ *
104258
+ * @returns {Object} selection
104259
+ * @returns {Array} selection.ranges
104260
+ */
104261
+ FeelersEditor.prototype.getSelection = function() {
104262
+ return this._cmEditor.state.selection;
104223
104263
  };
104224
104264
 
104225
104265
  /**
@@ -107069,6 +107109,21 @@
107069
107109
  height: "16",
107070
107110
  viewBox: "0 0 32 32"
107071
107111
  };
107112
+ var CloseIcon = function CloseIcon(props) {
107113
+ return u("svg", {
107114
+ ...props,
107115
+ children: u("path", {
107116
+ fillRule: "evenodd",
107117
+ d: "m12 4.7-.7-.7L8 7.3 4.7 4l-.7.7L7.3 8 4 11.3l.7.7L8 8.7l3.3 3.3.7-.7L8.7 8 12 4.7Z",
107118
+ fill: "currentColor"
107119
+ })
107120
+ });
107121
+ };
107122
+ CloseIcon.defaultProps = {
107123
+ xmlns: "http://www.w3.org/2000/svg",
107124
+ width: "16",
107125
+ height: "16"
107126
+ };
107072
107127
 
107073
107128
  function Header$1(props) {
107074
107129
  const {
@@ -107779,7 +107834,8 @@
107779
107834
  tooltipContainer,
107780
107835
  enableGutters,
107781
107836
  hostLanguage,
107782
- singleLine
107837
+ singleLine,
107838
+ lineWrap: true
107783
107839
  });
107784
107840
  setEditor(editor);
107785
107841
  return () => {
@@ -107816,7 +107872,7 @@
107816
107872
  title: "Open pop-up editor",
107817
107873
  class: "bio-properties-panel-open-feel-popup",
107818
107874
  onClick: () => onPopupOpen('feelers'),
107819
- children: u(ExternalLinkIcon, {})
107875
+ children: u(PopupIcon, {})
107820
107876
  })]
107821
107877
  });
107822
107878
  });
@@ -108186,6 +108242,9 @@
108186
108242
  draggable,
108187
108243
  emit = () => {},
108188
108244
  title,
108245
+ showCloseButton = false,
108246
+ closeButtonTooltip = 'Close popup',
108247
+ onClose,
108189
108248
  ...rest
108190
108249
  } = props;
108191
108250
 
@@ -108256,7 +108315,12 @@
108256
108315
  }), u("div", {
108257
108316
  class: "bio-properties-panel-popup__title",
108258
108317
  children: title
108259
- }), children]
108318
+ }), children, showCloseButton && u("button", {
108319
+ title: closeButtonTooltip,
108320
+ class: "bio-properties-panel-popup__close",
108321
+ onClick: onClose,
108322
+ children: u(CloseIcon, {})
108323
+ })]
108260
108324
  });
108261
108325
  }
108262
108326
  function Body(props) {
@@ -108474,6 +108538,9 @@
108474
108538
  children: [u(Popup.Title, {
108475
108539
  title: title,
108476
108540
  emit: emit,
108541
+ showCloseButton: true,
108542
+ closeButtonTooltip: "Save and close",
108543
+ onClose: onClose,
108477
108544
  draggable: true,
108478
108545
  children: [type === 'feel' && u("a", {
108479
108546
  href: "https://docs.camunda.io/docs/components/modeler/feel/what-is-feel/",
@@ -108515,14 +108582,6 @@
108515
108582
  tooltipContainer: tooltipContainer
108516
108583
  })]
108517
108584
  })
108518
- }), u(Popup.Footer, {
108519
- children: u("button", {
108520
- type: "button",
108521
- onClick: () => onClose(),
108522
- title: "Close pop-up editor",
108523
- class: "bio-properties-panel-feel-popup__close-btn",
108524
- children: "Close"
108525
- })
108526
108585
  })]
108527
108586
  });
108528
108587
  }
@@ -109856,6 +109915,28 @@
109856
109915
  });
109857
109916
  }
109858
109917
 
109918
+ /**
109919
+ * @typedef { {
109920
+ * [key: string]: string;
109921
+ * } } TranslateReplacements
109922
+ */
109923
+
109924
+ /**
109925
+ * A simple translation stub to be used for multi-language support.
109926
+ * Can be easily replaced with a more sophisticated solution.
109927
+ *
109928
+ * @param {string} template to interpolate
109929
+ * @param {TranslateReplacements} [replacements] a map with substitutes
109930
+ *
109931
+ * @return {string} the translated string
109932
+ */
109933
+ function translateFallback(template, replacements) {
109934
+ replacements = replacements || {};
109935
+ return template.replace(/{([^}]+)}/g, function (_, key) {
109936
+ return replacements[key] || '{' + key + '}';
109937
+ });
109938
+ }
109939
+
109859
109940
  function CollapsibleEntry(props) {
109860
109941
  const {
109861
109942
  element,
@@ -109863,7 +109944,8 @@
109863
109944
  id,
109864
109945
  label,
109865
109946
  open: shouldOpen,
109866
- remove
109947
+ remove,
109948
+ translate = translateFallback
109867
109949
  } = props;
109868
109950
  const [open, setOpen] = h(shouldOpen);
109869
109951
  const toggleOpen = () => setOpen(!open);
@@ -109879,9 +109961,7 @@
109879
109961
  }
109880
109962
  }, [onShow, setOpen])
109881
109963
  };
109882
-
109883
- // todo(pinussilvestrus): translate once we have a translate mechanism for the core
109884
- const placeholderLabel = '<empty>';
109964
+ const placeholderLabel = translate('<empty>');
109885
109965
  return u("div", {
109886
109966
  "data-entry-id": id,
109887
109967
  class: classNames('bio-properties-panel-collapsible-entry', open ? 'open' : ''),
@@ -109894,14 +109974,14 @@
109894
109974
  children: label || placeholderLabel
109895
109975
  }), u("button", {
109896
109976
  type: "button",
109897
- title: "Toggle list item",
109977
+ title: translate('Toggle list item'),
109898
109978
  class: "bio-properties-panel-arrow bio-properties-panel-collapsible-entry-arrow",
109899
109979
  children: u(ArrowIcon, {
109900
109980
  class: open ? 'bio-properties-panel-arrow-down' : 'bio-properties-panel-arrow-right'
109901
109981
  })
109902
109982
  }), remove ? u("button", {
109903
109983
  type: "button",
109904
- title: "Delete item",
109984
+ title: translate('Delete item'),
109905
109985
  class: "bio-properties-panel-remove-entry",
109906
109986
  onClick: remove,
109907
109987
  children: u(DeleteIcon, {})
@@ -109929,7 +110009,8 @@
109929
110009
  function ListItem(props) {
109930
110010
  const {
109931
110011
  autoFocusEntry,
109932
- autoOpen
110012
+ autoOpen,
110013
+ translate = translateFallback
109933
110014
  } = props;
109934
110015
 
109935
110016
  // focus specified entry on auto open
@@ -109951,7 +110032,8 @@
109951
110032
  class: "bio-properties-panel-list-item",
109952
110033
  children: u(CollapsibleEntry, {
109953
110034
  ...props,
109954
- open: autoOpen
110035
+ open: autoOpen,
110036
+ translate: translate
109955
110037
  })
109956
110038
  });
109957
110039
  }
@@ -109968,7 +110050,8 @@
109968
110050
  id,
109969
110051
  items,
109970
110052
  label,
109971
- shouldOpen = true
110053
+ shouldOpen = true,
110054
+ translate = translateFallback
109972
110055
  } = props;
109973
110056
  p$1(() => {
109974
110057
  if (props.shouldSort != undefined) {
@@ -110070,20 +110153,22 @@
110070
110153
  class: "bio-properties-panel-group-header-buttons",
110071
110154
  children: [add ? u("button", {
110072
110155
  type: "button",
110073
- title: "Create new list item",
110156
+ title: translate('Create new list item'),
110074
110157
  class: "bio-properties-panel-group-header-button bio-properties-panel-add-entry",
110075
110158
  onClick: handleAddClick,
110076
110159
  children: [u(CreateIcon, {}), !hasItems ? u("span", {
110077
110160
  class: "bio-properties-panel-add-entry-label",
110078
- children: "Create"
110161
+ children: translate('Create')
110079
110162
  }) : null]
110080
110163
  }) : null, hasItems ? u("div", {
110081
- title: `List contains ${items.length} item${items.length != 1 ? 's' : ''}`,
110164
+ title: translate(`List contains {numOfItems} item${items.length != 1 ? 's' : ''}`, {
110165
+ numOfItems: items.length
110166
+ }),
110082
110167
  class: classNames('bio-properties-panel-list-badge', hasError ? 'bio-properties-panel-list-badge--error' : ''),
110083
110168
  children: items.length
110084
110169
  }) : null, hasItems ? u("button", {
110085
110170
  type: "button",
110086
- title: "Toggle section",
110171
+ title: translate('Toggle section'),
110087
110172
  class: "bio-properties-panel-group-header-button bio-properties-panel-arrow",
110088
110173
  children: u(ArrowIcon, {
110089
110174
  class: open ? 'bio-properties-panel-arrow-down' : 'bio-properties-panel-arrow-right'
@@ -110110,7 +110195,8 @@
110110
110195
  autoOpen: autoOpen,
110111
110196
  element: element,
110112
110197
  index: index,
110113
- key: id
110198
+ key: id,
110199
+ translate: translate
110114
110200
  });
110115
110201
  })
110116
110202
  })