camunda-bpmn-js 4.9.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) {
@@ -69204,6 +69204,8 @@
69204
69204
  var _a;
69205
69205
  let depth = action >> 19 /* Action.ReduceDepthShift */, type = action & 65535 /* Action.ValueMask */;
69206
69206
  let { parser } = this.p;
69207
+ if (this.reducePos < this.pos - 25 /* Lookahead.Margin */)
69208
+ this.setLookAhead(this.pos);
69207
69209
  let dPrec = parser.dynamicPrecedence(type);
69208
69210
  if (dPrec)
69209
69211
  this.score += dPrec;
@@ -70083,8 +70085,8 @@
70083
70085
  if (!(side < 0 ? cursor.childBefore(pos) : cursor.childAfter(pos)))
70084
70086
  for (;;) {
70085
70087
  if ((side < 0 ? cursor.to < pos : cursor.from > pos) && !cursor.type.isError)
70086
- return side < 0 ? Math.max(0, Math.min(cursor.to - 1, pos - 25 /* Safety.Margin */))
70087
- : Math.min(tree.length, Math.max(cursor.from + 1, pos + 25 /* Safety.Margin */));
70088
+ return side < 0 ? Math.max(0, Math.min(cursor.to - 1, pos - 25 /* Lookahead.Margin */))
70089
+ : Math.min(tree.length, Math.max(cursor.from + 1, pos + 25 /* Lookahead.Margin */));
70088
70090
  if (side < 0 ? cursor.prevSibling() : cursor.nextSibling())
70089
70091
  break;
70090
70092
  if (!cursor.parent())
@@ -70202,7 +70204,7 @@
70202
70204
  token.mask = mask;
70203
70205
  token.context = context;
70204
70206
  }
70205
- if (token.lookAhead > token.end + 25 /* Safety.Margin */)
70207
+ if (token.lookAhead > token.end + 25 /* Lookahead.Margin */)
70206
70208
  lookAhead = Math.max(token.lookAhead, lookAhead);
70207
70209
  if (token.value != 0 /* Term.Err */) {
70208
70210
  let startIndex = actionIndex;
@@ -71825,8 +71827,13 @@
71825
71827
  /* global console,process */
71826
71828
 
71827
71829
 
71830
+ // @ts-expect-error env access
71828
71831
  const LOG_PARSE = typeof process != 'undefined' && process.env && /\bfparse(:dbg)?\b/.test(process.env.LOG);
71832
+
71833
+ // @ts-expect-error env access
71829
71834
  const LOG_PARSE_DEBUG = typeof process != 'undefined' && process.env && /\bfparse:dbg\b/.test(process.env.LOG);
71835
+
71836
+ // @ts-expect-error env access
71830
71837
  const LOG_VARS = typeof process != 'undefined' && process.env && /\bcontext\b/.test(process.env.LOG);
71831
71838
 
71832
71839
  const spaceChars = [
@@ -72220,7 +72227,7 @@
72220
72227
  }
72221
72228
 
72222
72229
  /**
72223
- * @param { Function }
72230
+ * @param { Function } fn
72224
72231
  *
72225
72232
  * @return { ValueProducer }
72226
72233
  */
@@ -72279,11 +72286,13 @@
72279
72286
  get(key) {
72280
72287
  const result = this.value[key];
72281
72288
 
72282
- if (this.constructor.isAtomic(result)) {
72289
+ const constructor = /** @type { typeof VariableContext } */ (this.constructor);
72290
+
72291
+ if (constructor.isAtomic(result)) {
72283
72292
  return result;
72284
72293
  }
72285
72294
 
72286
- return this.constructor.of(result);
72295
+ return constructor.of(result);
72287
72296
  }
72288
72297
 
72289
72298
  /**
@@ -72291,10 +72300,14 @@
72291
72300
  *
72292
72301
  * @param {String} key
72293
72302
  * @param {any} value
72303
+ *
72294
72304
  * @returns {VariableContext} new context with the given key added
72295
72305
  */
72296
72306
  set(key, value) {
72297
- return this.constructor.of({
72307
+
72308
+ const constructor = /** @type { typeof VariableContext } */ (this.constructor);
72309
+
72310
+ return constructor.of({
72298
72311
  ...this.value,
72299
72312
  [key]: value
72300
72313
  });
@@ -72352,9 +72365,9 @@
72352
72365
  tokens = [],
72353
72366
  children = [],
72354
72367
  parent = null,
72355
- context,
72356
- value,
72357
- raw
72368
+ context = null,
72369
+ value = null,
72370
+ raw = null
72358
72371
  } = {}) {
72359
72372
  this.name = name;
72360
72373
  this.tokens = tokens;
@@ -72500,6 +72513,9 @@
72500
72513
 
72501
72514
  pushChildren(children) {
72502
72515
 
72516
+ /**
72517
+ * @type {Variables}
72518
+ */
72503
72519
  let parent = this;
72504
72520
 
72505
72521
  for (const child of children) {
@@ -72619,7 +72635,7 @@
72619
72635
  * Wrap children of variables under the given named child.
72620
72636
  *
72621
72637
  * @param { Variables } variables
72622
- * @param { string } name
72638
+ * @param { string } scopeName
72623
72639
  * @param { string } code
72624
72640
  * @return { Variables }
72625
72641
  */
@@ -72741,6 +72757,7 @@
72741
72757
  .assign({ context: newContext || currentContext });
72742
72758
  }
72743
72759
 
72760
+ // @ts-expect-error internal method
72744
72761
  const code = input.read(input.pos, stack.pos);
72745
72762
 
72746
72763
  const end = contextEnds[term];
@@ -72948,7 +72965,7 @@
72948
72965
  function: tags$1.definitionKeyword,
72949
72966
  as: tags$1.keyword,
72950
72967
  'Type/...': tags$1.typeName,
72951
- Wildcard: tags$1.special,
72968
+ Wildcard: tags$1.special(tags$1.variableName),
72952
72969
  null: tags$1.null,
72953
72970
  LineComment: tags$1.lineComment,
72954
72971
  BlockComment: tags$1.blockComment,
@@ -72989,7 +73006,7 @@
72989
73006
  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~",
72990
73007
  tokenizers: [propertyIdentifiers, identifiers, insertSemicolon, 0, 1],
72991
73008
  topRules: {"Expression":[0,3],"Expressions":[1,101],"UnaryTests":[2,102]},
72992
- dynamicPrecedences: {"31":-1,"71":-1,"73":-1},
73009
+ dynamicPrecedences: {"31":-1,"67":1,"71":-1,"73":-1},
72993
73010
  specialized: [{term: 121, get: (value) => spec_identifier[value] || -1}],
72994
73011
  tokenPrec: 2500
72995
73012
  });
@@ -85424,6 +85441,51 @@
85424
85441
  themeSpec[".cm-content"] = { caretColor: "transparent !important" };
85425
85442
  }
85426
85443
 
85444
+ let Placeholder$1 = class Placeholder extends WidgetType {
85445
+ constructor(content) {
85446
+ super();
85447
+ this.content = content;
85448
+ }
85449
+ toDOM() {
85450
+ let wrap = document.createElement("span");
85451
+ wrap.className = "cm-placeholder";
85452
+ wrap.style.pointerEvents = "none";
85453
+ wrap.appendChild(typeof this.content == "string" ? document.createTextNode(this.content) : this.content);
85454
+ if (typeof this.content == "string")
85455
+ wrap.setAttribute("aria-label", "placeholder " + this.content);
85456
+ else
85457
+ wrap.setAttribute("aria-hidden", "true");
85458
+ return wrap;
85459
+ }
85460
+ coordsAt(dom) {
85461
+ let rects = dom.firstChild ? clientRectsFor(dom.firstChild) : [];
85462
+ if (!rects.length)
85463
+ return null;
85464
+ let style = window.getComputedStyle(dom.parentNode);
85465
+ let rect = flattenRect(rects[0], style.direction != "rtl");
85466
+ let lineHeight = parseInt(style.lineHeight);
85467
+ if (rect.bottom - rect.top > lineHeight * 1.5)
85468
+ return { left: rect.left, right: rect.right, top: rect.top, bottom: rect.top + lineHeight };
85469
+ return rect;
85470
+ }
85471
+ ignoreEvent() { return false; }
85472
+ };
85473
+ /**
85474
+ Extension that enables a placeholder—a piece of example content
85475
+ to show when the editor is empty.
85476
+ */
85477
+ function placeholder(content) {
85478
+ return ViewPlugin.fromClass(class {
85479
+ constructor(view) {
85480
+ this.view = view;
85481
+ this.placeholder = content
85482
+ ? Decoration.set([Decoration.widget({ widget: new Placeholder$1(content), side: 1 }).range(0)])
85483
+ : Decoration.none;
85484
+ }
85485
+ get decorations() { return this.view.state.doc.length ? Decoration.none : this.placeholder; }
85486
+ }, { decorations: v => v.decorations });
85487
+ }
85488
+
85427
85489
  const Outside = "-10000px";
85428
85490
  class TooltipViewManager {
85429
85491
  constructor(view, facet, createTooltipView, removeTooltipView) {
@@ -94133,176 +94195,182 @@
94133
94195
 
94134
94196
  var lint = linter$1(cmFeelersLinter());
94135
94197
 
94136
- /**
94137
- * Creates a Feelers editor in the supplied container.
94138
- *
94139
- * @param {Object} config Configuration options for the Feelers editor.
94140
- * @param {DOMNode} [config.container] The DOM node that will contain the editor.
94141
- * @param {DOMNode|String} [config.tooltipContainer] The DOM node or CSS selector string for the tooltip container.
94142
- * @param {String} [config.hostLanguage] The host language for the editor (e.g., 'markdown').
94143
- * @param {Object} [config.hostLanguageParser] A custom parser for the host language.
94144
- * @param {Function} [config.onChange] Callback function that is called when the editor's content changes.
94145
- * @param {Function} [config.onKeyDown] Callback function that is called when a key is pressed within the editor.
94146
- * @param {Function} [config.onLint] Callback function that is called when linting messages are available.
94147
- * @param {Object} [config.contentAttributes] Additional attributes to set on the editor's content element.
94148
- * @param {Boolean} [config.readOnly] Set to true to make the editor read-only.
94149
- * @param {String} [config.value] Initial value of the editor.
94150
- * @param {Boolean} [config.enableGutters] Set to true to enable gutter decorations (e.g., line numbers).
94151
- * @param {Boolean} [config.darkMode] Set to true to use the dark theme for the editor.
94152
- *
94153
- * @returns {Object} editor An instance of the FeelersEditor class.
94154
- */
94155
- function FeelersEditor({
94156
- container,
94157
- tooltipContainer,
94158
- hostLanguage,
94159
- hostLanguageParser,
94160
- onChange = () => { },
94161
- onKeyDown = () => { },
94162
- onLint = () => { },
94163
- contentAttributes = { },
94164
- readOnly = false,
94165
- value = '',
94166
- enableGutters = false,
94167
- singleLine = false,
94168
- darkMode = false
94169
- }) {
94170
-
94171
- const changeHandler = EditorView.updateListener.of((update) => {
94172
- if (update.docChanged) {
94173
- onChange(update.state.doc.toString());
94174
- }
94175
- });
94176
-
94177
- const lintHandler = EditorView.updateListener.of((update) => {
94178
- const diagnosticEffects = update.transactions
94179
- .flatMap(t => t.effects)
94180
- .filter(effect => effect.is(setDiagnosticsEffect));
94181
-
94182
- if (!diagnosticEffects.length) {
94183
- return;
94184
- }
94185
-
94186
- const messages = diagnosticEffects.flatMap(effect => effect.value);
94187
-
94188
- onLint(messages);
94189
- });
94190
-
94191
- const contentAttributesExtension = EditorView.contentAttributes.of(contentAttributes);
94192
-
94193
- const keyHandler = EditorView.domEventHandlers(
94194
- {
94195
- keydown: onKeyDown
94196
- }
94197
- );
94198
-
94199
- if (typeof tooltipContainer === 'string') {
94200
- // eslint-disable-next-line no-undef
94201
- tooltipContainer = document.querySelector(tooltipContainer);
94202
- }
94203
-
94204
- const tooltipLayout = tooltipContainer ? tooltips({
94205
- tooltipSpace: function() {
94206
- return tooltipContainer.getBoundingClientRect();
94207
- }
94208
- }) : [];
94209
-
94210
- const _getHostLanguageParser = (hostLanguage) => {
94211
- switch (hostLanguage) {
94212
- case 'markdown':
94213
- return parser$1;
94214
- default:
94215
- return null;
94216
- }
94217
- };
94218
-
94219
- const feelersLanguageSupport = createFeelersLanguageSupport(hostLanguageParser || hostLanguage && _getHostLanguageParser(hostLanguage));
94220
-
94221
- const extensions = [
94222
- bracketMatching(),
94223
- changeHandler,
94224
- contentAttributesExtension,
94225
- closeBrackets(),
94226
- indentOnInput(),
94227
- keyHandler,
94228
- keymap.of([
94229
- ...defaultKeymap,
94230
- ]),
94231
- feelersLanguageSupport,
94232
- lint,
94233
- lintHandler,
94234
- tooltipLayout,
94235
- darkMode ? darkTheme : lightTheme,
94236
- ...(enableGutters ? [
94237
-
94238
- // todo: adjust folding boundaries first foldGutter(),
94239
- lineNumbers()
94240
- ] : []),
94241
- ...(singleLine ? [
94242
- EditorState.transactionFilter.of(tr => tr.newDoc.lines > 1 ? [] : tr)
94243
- ] : [])
94244
- ];
94245
-
94246
- if (readOnly) {
94247
- extensions.push(EditorView.editable.of(false));
94248
- }
94249
-
94250
- if (singleLine && value) {
94251
- value = value.toString().split('\n')[0];
94252
- }
94253
-
94254
- this._cmEditor = new EditorView({
94255
- state: EditorState.create({
94256
- doc: value,
94257
- extensions: extensions
94258
- }),
94259
- parent: container
94260
- });
94261
-
94262
- return this;
94263
- }
94264
-
94265
- /**
94266
- * Replaces the content of the Editor
94267
- *
94268
- * @param {String} value
94269
- */
94270
- FeelersEditor.prototype.setValue = function(value) {
94271
- this._cmEditor.dispatch({
94272
- changes: {
94273
- from: 0,
94274
- to: this._cmEditor.state.doc.length,
94275
- insert: value,
94276
- }
94277
- });
94278
- };
94279
-
94280
- /**
94281
- * Sets the focus in the editor.
94282
- */
94283
- FeelersEditor.prototype.focus = function(position) {
94284
- const cmEditor = this._cmEditor;
94285
-
94286
- // the Codemirror `focus` method always calls `focus` with `preventScroll`,
94287
- // so we have to focus + scroll manually
94288
- cmEditor.contentDOM.focus();
94289
- cmEditor.focus();
94290
-
94291
- if (typeof position === 'number') {
94292
- const end = cmEditor.state.doc.length;
94293
- cmEditor.dispatch({ selection: { anchor: position <= end ? position : end } });
94294
- }
94295
- };
94296
-
94297
- /**
94298
- * Returns the current selection ranges. If no text is selected, a single
94299
- * range with the start and end index at the cursor position will be returned.
94300
- *
94301
- * @returns {Object} selection
94302
- * @returns {Array} selection.ranges
94303
- */
94304
- FeelersEditor.prototype.getSelection = function() {
94305
- return this._cmEditor.state.selection;
94198
+ /**
94199
+ * Creates a Feelers editor in the supplied container.
94200
+ *
94201
+ * @param {Object} config Configuration options for the Feelers editor.
94202
+ * @param {DOMNode} [config.container] The DOM node that will contain the editor.
94203
+ * @param {DOMNode|String} [config.tooltipContainer] The DOM node or CSS selector string for the tooltip container.
94204
+ * @param {String} [config.hostLanguage] The host language for the editor (e.g., 'markdown').
94205
+ * @param {Object} [config.hostLanguageParser] A custom parser for the host language.
94206
+ * @param {Function} [config.onChange] Callback function that is called when the editor's content changes.
94207
+ * @param {Function} [config.onKeyDown] Callback function that is called when a key is pressed within the editor.
94208
+ * @param {Function} [config.onLint] Callback function that is called when linting messages are available.
94209
+ * @param {Object} [config.contentAttributes] Additional attributes to set on the editor's content element.
94210
+ * @param {Boolean} [config.readOnly] Set to true to make the editor read-only.
94211
+ * @param {String} [config.value] Initial value of the editor.
94212
+ * @param {Boolean} [config.enableGutters] Set to true to enable gutter decorations (e.g., line numbers).
94213
+ * @param {Boolean} [config.singleLine] Set to true to limit the editor to a single line.
94214
+ * @param {Boolean} [config.lineWrap] Set to true to enable line wrapping.
94215
+ * @param {Boolean} [config.darkMode] Set to true to use the dark theme for the editor.
94216
+ *
94217
+ * @returns {Object} editor An instance of the FeelersEditor class.
94218
+ */
94219
+ function FeelersEditor({
94220
+ container,
94221
+ tooltipContainer,
94222
+ hostLanguage,
94223
+ hostLanguageParser,
94224
+ onChange = () => { },
94225
+ onKeyDown = () => { },
94226
+ onLint = () => { },
94227
+ contentAttributes = { },
94228
+ readOnly = false,
94229
+ value = '',
94230
+ enableGutters = false,
94231
+ singleLine = false,
94232
+ lineWrap = false,
94233
+ darkMode = false
94234
+ }) {
94235
+
94236
+ const changeHandler = EditorView.updateListener.of((update) => {
94237
+ if (update.docChanged) {
94238
+ onChange(update.state.doc.toString());
94239
+ }
94240
+ });
94241
+
94242
+ const lintHandler = EditorView.updateListener.of((update) => {
94243
+ const diagnosticEffects = update.transactions
94244
+ .flatMap(t => t.effects)
94245
+ .filter(effect => effect.is(setDiagnosticsEffect));
94246
+
94247
+ if (!diagnosticEffects.length) {
94248
+ return;
94249
+ }
94250
+
94251
+ const messages = diagnosticEffects.flatMap(effect => effect.value);
94252
+
94253
+ onLint(messages);
94254
+ });
94255
+
94256
+ const contentAttributesExtension = EditorView.contentAttributes.of(contentAttributes);
94257
+
94258
+ const keyHandler = EditorView.domEventHandlers(
94259
+ {
94260
+ keydown: onKeyDown
94261
+ }
94262
+ );
94263
+
94264
+ if (typeof tooltipContainer === 'string') {
94265
+ // eslint-disable-next-line no-undef
94266
+ tooltipContainer = document.querySelector(tooltipContainer);
94267
+ }
94268
+
94269
+ const tooltipLayout = tooltipContainer ? tooltips({
94270
+ tooltipSpace: function() {
94271
+ return tooltipContainer.getBoundingClientRect();
94272
+ }
94273
+ }) : [];
94274
+
94275
+ const _getHostLanguageParser = (hostLanguage) => {
94276
+ switch (hostLanguage) {
94277
+ case 'markdown':
94278
+ return parser$1;
94279
+ default:
94280
+ return null;
94281
+ }
94282
+ };
94283
+
94284
+ const feelersLanguageSupport = createFeelersLanguageSupport(hostLanguageParser || hostLanguage && _getHostLanguageParser(hostLanguage));
94285
+
94286
+ const extensions = [
94287
+ bracketMatching(),
94288
+ changeHandler,
94289
+ contentAttributesExtension,
94290
+ closeBrackets(),
94291
+ indentOnInput(),
94292
+ keyHandler,
94293
+ keymap.of([
94294
+ ...defaultKeymap,
94295
+ ]),
94296
+ feelersLanguageSupport,
94297
+ lint,
94298
+ lintHandler,
94299
+ tooltipLayout,
94300
+ darkMode ? darkTheme : lightTheme,
94301
+ ...(enableGutters ? [
94302
+
94303
+ // todo: adjust folding boundaries first foldGutter(),
94304
+ lineNumbers()
94305
+ ] : []),
94306
+ ...(singleLine ? [
94307
+ EditorState.transactionFilter.of(tr => tr.newDoc.lines > 1 ? [] : tr)
94308
+ ] : []),
94309
+ ...(lineWrap ? [
94310
+ EditorView.lineWrapping
94311
+ ] : [])
94312
+ ];
94313
+
94314
+ if (readOnly) {
94315
+ extensions.push(EditorView.editable.of(false));
94316
+ }
94317
+
94318
+ if (singleLine && value) {
94319
+ value = value.toString().split('\n')[0];
94320
+ }
94321
+
94322
+ this._cmEditor = new EditorView({
94323
+ state: EditorState.create({
94324
+ doc: value,
94325
+ extensions: extensions
94326
+ }),
94327
+ parent: container
94328
+ });
94329
+
94330
+ return this;
94331
+ }
94332
+
94333
+ /**
94334
+ * Replaces the content of the Editor
94335
+ *
94336
+ * @param {String} value
94337
+ */
94338
+ FeelersEditor.prototype.setValue = function(value) {
94339
+ this._cmEditor.dispatch({
94340
+ changes: {
94341
+ from: 0,
94342
+ to: this._cmEditor.state.doc.length,
94343
+ insert: value,
94344
+ }
94345
+ });
94346
+ };
94347
+
94348
+ /**
94349
+ * Sets the focus in the editor.
94350
+ */
94351
+ FeelersEditor.prototype.focus = function(position) {
94352
+ const cmEditor = this._cmEditor;
94353
+
94354
+ // the Codemirror `focus` method always calls `focus` with `preventScroll`,
94355
+ // so we have to focus + scroll manually
94356
+ cmEditor.contentDOM.focus();
94357
+ cmEditor.focus();
94358
+
94359
+ if (typeof position === 'number') {
94360
+ const end = cmEditor.state.doc.length;
94361
+ cmEditor.dispatch({ selection: { anchor: position <= end ? position : end } });
94362
+ }
94363
+ };
94364
+
94365
+ /**
94366
+ * Returns the current selection ranges. If no text is selected, a single
94367
+ * range with the start and end index at the cursor position will be returned.
94368
+ *
94369
+ * @returns {Object} selection
94370
+ * @returns {Array} selection.ranges
94371
+ */
94372
+ FeelersEditor.prototype.getSelection = function() {
94373
+ return this._cmEditor.state.selection;
94306
94374
  };
94307
94375
 
94308
94376
  /**
@@ -95167,12 +95235,7 @@
95167
95235
 
95168
95236
  const variables = context.state.facet(variablesFacet)[0];
95169
95237
 
95170
- const options = variables.map(v => ({
95171
- label: v.name,
95172
- type: 'variable',
95173
- info: v.info,
95174
- detail: v.detail
95175
- }));
95238
+ const options = variables.map(v => createVariableSuggestion(v));
95176
95239
 
95177
95240
  // In most cases, use what is typed before the cursor
95178
95241
  let nodeBefore = syntaxTree(context.state).resolve(context.pos, -1);
@@ -95205,6 +95268,55 @@
95205
95268
  return result;
95206
95269
  };
95207
95270
 
95271
+ /**
95272
+ * @param {import('..').Variable} variable
95273
+ * @returns {import('@codemirror/autocomplete').Completion}
95274
+ */
95275
+ function createVariableSuggestion(variable) {
95276
+ if (variable.type === 'function') {
95277
+ return createFunctionVariable(variable);
95278
+ }
95279
+
95280
+ return {
95281
+ label: variable.name,
95282
+ type: 'variable',
95283
+ info: variable.info,
95284
+ detail: variable.detail
95285
+ };
95286
+ }
95287
+
95288
+ /**
95289
+ * @param {import('..').Variable} variable
95290
+ * @returns {import('@codemirror/autocomplete').Completion}
95291
+ */
95292
+ function createFunctionVariable(variable) {
95293
+ const {
95294
+ name,
95295
+ info,
95296
+ detail,
95297
+ params = []
95298
+ } = variable;
95299
+
95300
+ const paramsWithNames = params.map(({ name, type }, index) => ({
95301
+ name: name || `param ${index + 1}`,
95302
+ type
95303
+ }));
95304
+
95305
+ const template = `${name}(${paramsWithNames.map(p => '${' + p.name + '}').join(', ')})`;
95306
+
95307
+ const paramsSignature = paramsWithNames.map(({ name, type }) => (
95308
+ type ? `${name}: ${type}` : name
95309
+ )).join(', ');
95310
+ const label = `${name}(${paramsSignature})`;
95311
+
95312
+ return snippetCompletion(template, {
95313
+ label,
95314
+ type: 'function',
95315
+ info,
95316
+ detail
95317
+ });
95318
+ }
95319
+
95208
95320
  function autocompletion() {
95209
95321
  return [
95210
95322
  autocompletion$1({
@@ -95301,15 +95413,18 @@
95301
95413
 
95302
95414
  /**
95303
95415
  * @typedef {object} Variable
95304
- * @typedef {import('@codemirror/state').Extension} Extension
95305
95416
  * @property {string} name name or key of the variable
95306
95417
  * @property {string} [info] short information about the variable, e.g. type
95307
95418
  * @property {string} [detail] longer description of the variable content
95308
95419
  * @property {boolean} [isList] whether the variable is a list
95309
- * @property {array<Variable>} [schema] array of child variables if the variable is a context or list
95420
+ * @property {Array<Variable>} [schema] array of child variables if the variable is a context or list
95421
+ * @property {'function'|'variable'} [type] type of the variable
95422
+ * @property {Array<{name: string, type: string}>} [params] function parameters
95310
95423
  */
95311
95424
 
95312
95425
  const autocompletionConf = new Compartment();
95426
+ const placeholderConf = new Compartment();
95427
+
95313
95428
 
95314
95429
  /**
95315
95430
  * Creates a FEEL editor in the supplied container
@@ -95335,6 +95450,7 @@
95335
95450
  onChange = () => {},
95336
95451
  onKeyDown = () => {},
95337
95452
  onLint = () => {},
95453
+ placeholder: placeholder$1 = '',
95338
95454
  readOnly = false,
95339
95455
  value = '',
95340
95456
  variables = []
@@ -95391,6 +95507,7 @@
95391
95507
  language(),
95392
95508
  linter,
95393
95509
  lintHandler,
95510
+ placeholderConf.of(placeholder(placeholder$1)),
95394
95511
  tooltipLayout,
95395
95512
  theme,
95396
95513
  ...editorExtensions
@@ -95465,6 +95582,17 @@
95465
95582
  });
95466
95583
  };
95467
95584
 
95585
+ /**
95586
+ * Update placeholder text.
95587
+ * @param {string} placeholder
95588
+ * @returns {void}
95589
+ */
95590
+ FeelEditor.prototype.setPlaceholder = function(placeholder$1) {
95591
+ this._cmEditor.dispatch({
95592
+ effects: placeholderConf.reconfigure(placeholder(placeholder$1))
95593
+ });
95594
+ };
95595
+
95468
95596
  /*!
95469
95597
  * tabbable 6.2.0
95470
95598
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
@@ -97049,6 +97177,21 @@
97049
97177
  height: "16",
97050
97178
  viewBox: "0 0 32 32"
97051
97179
  };
97180
+ var CloseIcon = function CloseIcon(props) {
97181
+ return u("svg", {
97182
+ ...props,
97183
+ children: u("path", {
97184
+ fillRule: "evenodd",
97185
+ 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",
97186
+ fill: "currentColor"
97187
+ })
97188
+ });
97189
+ };
97190
+ CloseIcon.defaultProps = {
97191
+ xmlns: "http://www.w3.org/2000/svg",
97192
+ width: "16",
97193
+ height: "16"
97194
+ };
97052
97195
 
97053
97196
  function Header(props) {
97054
97197
  const {
@@ -97759,7 +97902,8 @@
97759
97902
  tooltipContainer,
97760
97903
  enableGutters,
97761
97904
  hostLanguage,
97762
- singleLine
97905
+ singleLine,
97906
+ lineWrap: true
97763
97907
  });
97764
97908
  setEditor(editor);
97765
97909
  return () => {
@@ -97796,7 +97940,7 @@
97796
97940
  title: "Open pop-up editor",
97797
97941
  class: "bio-properties-panel-open-feel-popup",
97798
97942
  onClick: () => onPopupOpen('feelers'),
97799
- children: u(ExternalLinkIcon, {})
97943
+ children: u(PopupIcon, {})
97800
97944
  })]
97801
97945
  });
97802
97946
  });
@@ -97837,6 +97981,7 @@
97837
97981
  onFeelToggle = noop$5,
97838
97982
  onLint = noop$5,
97839
97983
  onPopupOpen = noop$5,
97984
+ placeholder,
97840
97985
  popupOpen,
97841
97986
  disabled,
97842
97987
  tooltipContainer,
@@ -97873,6 +98018,7 @@
97873
98018
  onChange: handleInput,
97874
98019
  onKeyDown: onKeyDown,
97875
98020
  onLint: onLint,
98021
+ placeholder: placeholder,
97876
98022
  tooltipContainer: tooltipContainer,
97877
98023
  value: localValue,
97878
98024
  variables: variables,
@@ -97902,6 +98048,12 @@
97902
98048
  }
97903
98049
  editor.setVariables(variables);
97904
98050
  }, [variables]);
98051
+ p(() => {
98052
+ if (!editor) {
98053
+ return;
98054
+ }
98055
+ editor.setPlaceholder(placeholder);
98056
+ }, [placeholder]);
97905
98057
  const handleClick = () => {
97906
98058
  ref.current.focus();
97907
98059
  };
@@ -98111,6 +98263,9 @@
98111
98263
  draggable,
98112
98264
  emit = () => {},
98113
98265
  title,
98266
+ showCloseButton = false,
98267
+ closeButtonTooltip = 'Close popup',
98268
+ onClose,
98114
98269
  ...rest
98115
98270
  } = props;
98116
98271
 
@@ -98181,7 +98336,12 @@
98181
98336
  }), u("div", {
98182
98337
  class: "bio-properties-panel-popup__title",
98183
98338
  children: title
98184
- }), children]
98339
+ }), children, showCloseButton && u("button", {
98340
+ title: closeButtonTooltip,
98341
+ class: "bio-properties-panel-popup__close",
98342
+ onClick: onClose,
98343
+ children: u(CloseIcon, {})
98344
+ })]
98185
98345
  });
98186
98346
  }
98187
98347
  function Body(props) {
@@ -98399,6 +98559,9 @@
98399
98559
  children: [u(Popup.Title, {
98400
98560
  title: title,
98401
98561
  emit: emit,
98562
+ showCloseButton: true,
98563
+ closeButtonTooltip: "Save and close",
98564
+ onClose: onClose,
98402
98565
  draggable: true,
98403
98566
  children: [type === 'feel' && u("a", {
98404
98567
  href: "https://docs.camunda.io/docs/components/modeler/feel/what-is-feel/",
@@ -98440,14 +98603,6 @@
98440
98603
  tooltipContainer: tooltipContainer
98441
98604
  })]
98442
98605
  })
98443
- }), u(Popup.Footer, {
98444
- children: u("button", {
98445
- type: "button",
98446
- onClick: () => onClose(),
98447
- title: "Close pop-up editor",
98448
- class: "bio-properties-panel-feel-popup__close-btn",
98449
- children: "Close"
98450
- })
98451
98606
  })]
98452
98607
  });
98453
98608
  }
@@ -98621,7 +98776,8 @@
98621
98776
  onInput,
98622
98777
  value,
98623
98778
  onFocus,
98624
- onBlur
98779
+ onBlur,
98780
+ placeholder
98625
98781
  } = props;
98626
98782
  const inputRef = _();
98627
98783
 
@@ -98654,6 +98810,7 @@
98654
98810
  onInput: e => onInput(e.target.value),
98655
98811
  onFocus: onFocus,
98656
98812
  onBlur: onBlur,
98813
+ placeholder: placeholder,
98657
98814
  value: value || ''
98658
98815
  });
98659
98816
  });
@@ -98711,7 +98868,8 @@
98711
98868
  onInput,
98712
98869
  value,
98713
98870
  onFocus,
98714
- onBlur
98871
+ onBlur,
98872
+ placeholder
98715
98873
  } = props;
98716
98874
  const inputRef = _();
98717
98875
 
@@ -98739,6 +98897,7 @@
98739
98897
  onInput: e => onInput(e.target.value),
98740
98898
  onFocus: onFocus,
98741
98899
  onBlur: onBlur,
98900
+ placeholder: placeholder,
98742
98901
  value: value || '',
98743
98902
  "data-gramm": "false"
98744
98903
  });
@@ -99379,6 +99538,7 @@
99379
99538
  onFocus,
99380
99539
  onBlur,
99381
99540
  autoResize,
99541
+ placeholder,
99382
99542
  rows = autoResize ? 1 : 2,
99383
99543
  tooltip
99384
99544
  } = props;
@@ -99421,6 +99581,7 @@
99421
99581
  onInput: handleInput,
99422
99582
  onFocus: onFocus,
99423
99583
  onBlur: onBlur,
99584
+ placeholder: placeholder,
99424
99585
  rows: rows,
99425
99586
  value: localValue,
99426
99587
  disabled: disabled,
@@ -99460,6 +99621,7 @@
99460
99621
  validate,
99461
99622
  onFocus,
99462
99623
  onBlur,
99624
+ placeholder,
99463
99625
  autoResize,
99464
99626
  tooltip
99465
99627
  } = props;
@@ -99495,6 +99657,7 @@
99495
99657
  debounce: debounce,
99496
99658
  monospace: monospace,
99497
99659
  disabled: disabled,
99660
+ placeholder: placeholder,
99498
99661
  autoResize: autoResize,
99499
99662
  tooltip: tooltip,
99500
99663
  element: element
@@ -99527,6 +99690,7 @@
99527
99690
  onInput,
99528
99691
  onFocus,
99529
99692
  onBlur,
99693
+ placeholder,
99530
99694
  value = '',
99531
99695
  tooltip
99532
99696
  } = props;
@@ -99568,6 +99732,7 @@
99568
99732
  onInput: handleInput,
99569
99733
  onFocus: onFocus,
99570
99734
  onBlur: onBlur,
99735
+ placeholder: placeholder,
99571
99736
  value: localValue
99572
99737
  })]
99573
99738
  });
@@ -99601,6 +99766,7 @@
99601
99766
  validate,
99602
99767
  onFocus,
99603
99768
  onBlur,
99769
+ placeholder,
99604
99770
  tooltip
99605
99771
  } = props;
99606
99772
  const globalError = useError(id);
@@ -99632,6 +99798,7 @@
99632
99798
  onInput: onInput,
99633
99799
  onFocus: onFocus,
99634
99800
  onBlur: onBlur,
99801
+ placeholder: placeholder,
99635
99802
  value: value,
99636
99803
  tooltip: tooltip,
99637
99804
  element: element