eligius 1.0.17 → 1.0.18

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.
@@ -7,7 +7,11 @@ export declare class Action implements IAction {
7
7
  startOperations: IResolvedOperation[];
8
8
  protected eventbus: IEventbus;
9
9
  id: string;
10
+ protected _contextStack: IOperationContext[];
10
11
  constructor(name: string, startOperations: IResolvedOperation[], eventbus: IEventbus);
11
- start(initOperationData?: TOperationData): Promise<TOperationData | undefined>;
12
- executeOperation(operations: IResolvedOperation[], idx: number, resolve: (value?: any | PromiseLike<any>) => void, reject: (reason?: any) => void, previousOperationData: TOperationData | undefined, context: IOperationContext): void;
12
+ start(initOperationData?: TOperationData): Promise<TOperationData>;
13
+ protected _initializeContextStack(): void;
14
+ private _pushContext;
15
+ private _popContext;
16
+ executeOperation(operations: IResolvedOperation[], idx: number, resolve: (value?: any | PromiseLike<any>) => void, reject: (reason?: any) => void, previousOperationData?: TOperationData | undefined): void;
13
17
  }
@@ -5,5 +5,5 @@ import { Action } from './action';
5
5
  export declare class EndableAction extends Action {
6
6
  endOperations: IResolvedOperation[];
7
7
  constructor(name: string, startOperations: IResolvedOperation[], endOperations: IResolvedOperation[], eventBus: IEventbus);
8
- end(initOperationData?: TOperationData): Promise<TOperationData | undefined>;
8
+ end(initOperationData?: TOperationData): Promise<TOperationData>;
9
9
  }
@@ -7,6 +7,6 @@ export declare class TimelineAction extends EndableAction {
7
7
  duration: IStrictDuration;
8
8
  active: boolean;
9
9
  constructor(name: string, startOperations: IResolvedOperation[], endOperations: IResolvedOperation[], duration: IStrictDuration, eventBus: IEventbus);
10
- start(initOperationData?: TOperationData): Promise<TOperationData | undefined>;
11
- end(initOperationData: TOperationData): Promise<TOperationData | undefined>;
10
+ start(initOperationData?: TOperationData): Promise<TOperationData>;
11
+ end(initOperationData: TOperationData): Promise<TOperationData>;
12
12
  }
@@ -5,11 +5,11 @@ export interface IAction {
5
5
  id: string;
6
6
  name: string;
7
7
  startOperations: IResolvedOperation[];
8
- start(initOperationData?: TOperationData): Promise<TOperationData | undefined>;
8
+ start(initOperationData?: TOperationData): Promise<TOperationData>;
9
9
  }
10
10
  export interface IEndableAction extends IAction {
11
11
  endOperations: IResolvedOperation[];
12
- end(initOperationData?: TOperationData): Promise<TOperationData | undefined>;
12
+ end(initOperationData?: TOperationData): Promise<TOperationData>;
13
13
  }
14
14
  export interface ITimelineAction extends IEndableAction {
15
15
  active: boolean;
@@ -531,6 +531,7 @@ var Action = /*#__PURE__*/function () {
531
531
  this.startOperations = void 0;
532
532
  this.eventbus = void 0;
533
533
  this.id = '';
534
+ this._contextStack = [];
534
535
  this.name = name;
535
536
  this.startOperations = startOperations;
536
537
  this.eventbus = eventbus;
@@ -543,15 +544,14 @@ var Action = /*#__PURE__*/function () {
543
544
  _this = this;
544
545
 
545
546
  Diagnostics.active && Diagnostics.send('eligius-diagnostics-action', ((_this$name = this.name) != null ? _this$name : 'Action') + " begins executing start operations");
546
- var context = {
547
- currentIndex: -1,
548
- eventbus: this.eventbus
549
- };
547
+
548
+ this._initializeContextStack();
549
+
550
550
  var result = new Promise(function (resolve, reject) {
551
- _this.executeOperation(_this.startOperations, 0, resolve, reject, initOperationData, context);
551
+ _this.executeOperation(_this.startOperations, 0, resolve, reject, initOperationData);
552
552
  })["catch"](function (e) {
553
553
  Diagnostics.active && Diagnostics.send('eligius-diagnostics-action-error', {
554
- name: name,
554
+ name: _this.name,
555
555
  error: e
556
556
  });
557
557
  console.error("Error in action start '" + _this.name + "'");
@@ -566,13 +566,42 @@ var Action = /*#__PURE__*/function () {
566
566
  });
567
567
  };
568
568
 
569
- _proto.executeOperation = function executeOperation(operations, idx, resolve, reject, previousOperationData, context) {
569
+ _proto._initializeContextStack = function _initializeContextStack() {
570
+ this._contextStack = [{
571
+ currentIndex: -1,
572
+ eventbus: this.eventbus,
573
+ operations: this.startOperations
574
+ }];
575
+ };
576
+
577
+ _proto._pushContext = function _pushContext(parentContext) {
578
+ var newContext = {
579
+ currentIndex: parentContext.currentIndex,
580
+ eventbus: parentContext.eventbus,
581
+ operations: parentContext.operations
582
+ };
583
+
584
+ this._contextStack.push(newContext);
585
+
586
+ return newContext;
587
+ };
588
+
589
+ _proto._popContext = function _popContext() {
590
+ var previousContext = this._contextStack.pop();
591
+
592
+ var newCurrentContext = this._contextStack[this._contextStack.length - 1];
593
+ newCurrentContext.currentIndex = previousContext.currentIndex;
594
+ };
595
+
596
+ _proto.executeOperation = function executeOperation(operations, idx, resolve, reject, previousOperationData) {
570
597
  var _this2 = this;
571
598
 
572
599
  if (previousOperationData === void 0) {
573
600
  previousOperationData = {};
574
601
  }
575
602
 
603
+ var context = this._contextStack[this._contextStack.length - 1];
604
+
576
605
  if (context.newIndex !== undefined) {
577
606
  idx = context.newIndex;
578
607
  delete context.newIndex;
@@ -580,18 +609,20 @@ var Action = /*#__PURE__*/function () {
580
609
 
581
610
  context.currentIndex = idx;
582
611
 
583
- if (context.skipNextOperation) {
584
- if (idx < operations.length) {
585
- this.executeOperation(operations, ++idx, resolve, reject, previousOperationData, context);
586
- } else {
587
- resolve(previousOperationData);
588
- }
589
- }
590
-
591
612
  if (idx < operations.length) {
613
+ var _operationInfo$operat;
614
+
592
615
  var operationInfo = operations[idx];
593
- var copy = operationInfo.operationData ? deepCopy(operationInfo.operationData) : {};
616
+ var copy = deepCopy((_operationInfo$operat = operationInfo.operationData) != null ? _operationInfo$operat : {});
594
617
  var mergedOperationData = Object.assign(previousOperationData, copy);
618
+
619
+ if (operationInfo.systemName === 'when') {
620
+ context = this._pushContext(context);
621
+ } else if (operationInfo.systemName === 'startLoop' && context.owner !== operationInfo) {
622
+ context = this._pushContext(context);
623
+ context.owner = operationInfo;
624
+ }
625
+
595
626
  Diagnostics.active && Diagnostics.send('eligius-diagnostics-operation', {
596
627
  systemName: operationInfo.systemName,
597
628
  operationData: mergedOperationData,
@@ -601,14 +632,18 @@ var Action = /*#__PURE__*/function () {
601
632
  });
602
633
  var operationResult = operationInfo.instance.call(context, mergedOperationData);
603
634
 
635
+ if (operationInfo.systemName === 'endWhen' || operationInfo.systemName === 'endLoop' && context.newIndex === undefined) {
636
+ this._popContext();
637
+ }
638
+
604
639
  if (isPromise(operationResult)) {
605
640
  operationResult.then(function (promisedOperationResult) {
606
- return _this2.executeOperation(operations, ++idx, resolve, reject, promisedOperationResult, context);
641
+ return _this2.executeOperation(operations, ++idx, resolve, reject, promisedOperationResult);
607
642
  })["catch"](function (error) {
608
643
  reject(error);
609
644
  });
610
645
  } else {
611
- this.executeOperation(operations, ++idx, resolve, reject, operationResult, context);
646
+ this.executeOperation(operations, ++idx, resolve, reject, operationResult);
612
647
  }
613
648
  } else {
614
649
  resolve(previousOperationData);
@@ -639,16 +674,18 @@ var EndableAction = /*#__PURE__*/function (_Action) {
639
674
  Diagnostics.active && Diagnostics.send('eligius-diagnostics-action', ((_this$name = this.name) != null ? _this$name : 'Action') + " begins executing end operations");
640
675
 
641
676
  if (!this.endOperations.length) {
642
- return Promise.resolve(initOperationData);
677
+ return Promise.resolve(initOperationData != null ? initOperationData : {});
643
678
  }
644
679
 
645
- var context = {
646
- currentIndex: -1,
647
- eventbus: this.eventbus
648
- };
680
+ this._initializeContextStack();
681
+
649
682
  var result = new Promise(function (resolve, reject) {
650
- _this2.executeOperation(_this2.endOperations, 0, resolve, reject, initOperationData, context);
683
+ _this2.executeOperation(_this2.endOperations, 0, resolve, reject, initOperationData);
651
684
  })["catch"](function (e) {
685
+ Diagnostics.active && Diagnostics.send('eligius-diagnostics-action-error', {
686
+ name: _this2.name,
687
+ error: e
688
+ });
652
689
  console.error("Error in action end '" + _this2.name + "'");
653
690
  throw e;
654
691
  });
@@ -684,7 +721,7 @@ var TimelineAction = /*#__PURE__*/function (_EndableAction) {
684
721
  return _EndableAction.prototype.start.call(this, initOperationData);
685
722
  }
686
723
 
687
- return Promise.resolve(undefined);
724
+ return Promise.resolve({});
688
725
  };
689
726
 
690
727
  _proto.end = function end(initOperationData) {
@@ -1114,7 +1151,7 @@ var setGlobals = /*#__PURE__*/_setGlobals.bind(null, cache$1);
1114
1151
  * @returns
1115
1152
  */
1116
1153
 
1117
- function resolveOperationOrGlobalDataPropertyChain(sourceObject, propertyChainOrRegularObject) {
1154
+ function resolveExternalPropertyChain(sourceObject, operationContext, propertyChainOrRegularObject) {
1118
1155
  if (isString(propertyChainOrRegularObject)) {
1119
1156
  var _propNames$shift;
1120
1157
 
@@ -1127,19 +1164,22 @@ function resolveOperationOrGlobalDataPropertyChain(sourceObject, propertyChainOr
1127
1164
 
1128
1165
  case 'globaldata':
1129
1166
  return getPropertyChainValue(propNames, getGlobals());
1167
+
1168
+ case 'context':
1169
+ return getPropertyChainValue(propNames, operationContext);
1130
1170
  }
1131
1171
  }
1132
1172
 
1133
1173
  return propertyChainOrRegularObject;
1134
1174
  }
1135
1175
 
1136
- function resolveEventArguments(operationData, eventArgs) {
1176
+ function resolveEventArguments(operationData, operationContext, eventArgs) {
1137
1177
  if (!eventArgs) {
1138
1178
  return;
1139
1179
  }
1140
1180
 
1141
- var extract = resolveOperationOrGlobalDataPropertyChain.bind(null, operationData);
1142
- return eventArgs.map(extract);
1181
+ var resolve = resolveExternalPropertyChain.bind(null, operationData, operationContext);
1182
+ return eventArgs.map(resolve);
1143
1183
  }
1144
1184
 
1145
1185
  /**
@@ -1153,7 +1193,7 @@ var broadcastEvent$1 = function broadcastEvent(operationData) {
1153
1193
  var eventArgs = operationData.eventArgs,
1154
1194
  eventTopic = operationData.eventTopic,
1155
1195
  eventName = operationData.eventName;
1156
- var eventArguments = resolveEventArguments(operationData, eventArgs);
1196
+ var eventArguments = resolveEventArguments(operationData, this, eventArgs);
1157
1197
 
1158
1198
  if (eventTopic) {
1159
1199
  this.eventbus.broadcastForTopic(eventName, eventTopic, eventArguments);
@@ -1166,9 +1206,9 @@ var broadcastEvent$1 = function broadcastEvent(operationData) {
1166
1206
  };
1167
1207
 
1168
1208
  var cache = [];
1169
- function resolvePropertyValues(operationData, properties) {
1209
+ function resolvePropertyValues(operationData, operationContext, properties) {
1170
1210
  var copy = properties !== operationData ? deepCopy(properties) : properties;
1171
- var resolvePropertyChain = resolveOperationOrGlobalDataPropertyChain.bind(null, operationData);
1211
+ var resolvePropertyChain = resolveExternalPropertyChain.bind(null, operationData, operationContext);
1172
1212
  resolveProperties(properties, copy, resolvePropertyChain);
1173
1213
  return copy;
1174
1214
  }
@@ -1237,7 +1277,7 @@ var calcFunctions = {
1237
1277
  */
1238
1278
 
1239
1279
  var calc$1 = function calc(operationData) {
1240
- operationData = resolvePropertyValues(operationData, operationData);
1280
+ operationData = resolvePropertyValues(operationData, this, operationData);
1241
1281
  var _operationData = operationData,
1242
1282
  left = _operationData.left,
1243
1283
  right = _operationData.right,
@@ -1283,7 +1323,7 @@ var clearOperationData$1 = function clearOperationData(operationData) {
1283
1323
  */
1284
1324
 
1285
1325
  var createElement$1 = function createElement(operationData) {
1286
- operationData = resolvePropertyValues(operationData, operationData);
1326
+ operationData = resolvePropertyValues(operationData, this, operationData);
1287
1327
  var _operationData = operationData,
1288
1328
  elementName = _operationData.elementName,
1289
1329
  attributes = _operationData.attributes,
@@ -1400,27 +1440,17 @@ var endAction$1 = function endAction(operationData) {
1400
1440
  * @returns
1401
1441
  */
1402
1442
  var endLoop$1 = function endLoop(operationData) {
1403
- var context = this;
1404
-
1405
- if (!context.skipNextOperation) {
1406
- if (context.loopIndex !== undefined && context.loopLength !== undefined && context.loopIndex < context.loopLength) {
1407
- context.loopIndex = context.loopIndex + 1;
1408
- context.newIndex = context.startIndex;
1409
- } else {
1410
- delete context.loopIndex;
1411
- delete context.loopLength;
1412
- delete context.startIndex;
1413
- delete context.newIndex;
1414
- }
1415
- } else {
1416
- delete context.skipNextOperation;
1443
+ if (this.loopIndex !== undefined && this.loopLength !== undefined && this.loopIndex < this.loopLength) {
1444
+ this.loopIndex = this.loopIndex + 1;
1445
+ this.newIndex = this.loopStartIndex;
1446
+ delete this.currentItem;
1417
1447
  }
1418
1448
 
1419
1449
  return operationData;
1420
1450
  };
1421
1451
 
1422
1452
  var endWhen$1 = function endWhen(operationData) {
1423
- delete this.skipNextOperation;
1453
+ delete this.whenEvaluation;
1424
1454
  return operationData;
1425
1455
  };
1426
1456
 
@@ -1822,7 +1852,7 @@ var log$1 = function log(operationData) {
1822
1852
  */
1823
1853
 
1824
1854
  var math$1 = function math(operationData) {
1825
- operationData = resolvePropertyValues(operationData, operationData);
1855
+ operationData = resolvePropertyValues(operationData, this, operationData);
1826
1856
  operationData.args = resolveMathConstants(operationData.args);
1827
1857
  var _operationData = operationData,
1828
1858
  args = _operationData.args,
@@ -1845,14 +1875,70 @@ function isMathProperty(value) {
1845
1875
  return isString(value) && value in Math && !isFunction(Math[value]);
1846
1876
  }
1847
1877
 
1878
+ /**
1879
+ * This function can be used to find the index of a matching operation within a list of operations.
1880
+ *
1881
+ * Given the array of operations:
1882
+ * ```ts
1883
+ * [
1884
+ * {systemName:'name1'}, // index 0
1885
+ * {systemName:'startLoop'}, // index 1
1886
+ * {systemName:'name2'}, // index 2
1887
+ * {systemName:'startLoop'} // index 3
1888
+ * {systemName:'name3'} // index 4
1889
+ * {systemName:'endLoop'} // index 5
1890
+ * {systemName:'endLoop'} // index 6
1891
+ * {systemName:'name3'} // index 7
1892
+ * ]
1893
+ * ```
1894
+ *
1895
+ * Given the startLoop instance at index 1, this function will return index 6. Given the startLoop at index 3, it will yield index 5.
1896
+ *
1897
+ * Returns true when the given operation.systemName equals the specified matchingName and the current counter value is zero.
1898
+ *
1899
+ * If the matchingName matches operation.systemName but the counter is greater than zero, the counter is decremented.
1900
+ *
1901
+ * If the operation.systemName equal self (the name of the operation that requires to find its match), then counter is incremented.
1902
+ *
1903
+ * @param this
1904
+ * @param operation
1905
+ * @returns
1906
+ */
1907
+ function findMatchingOperationIndex(operation) {
1908
+ if (operation.systemName === this.self) {
1909
+ this.counter = this.counter + 1;
1910
+ return false;
1911
+ }
1912
+
1913
+ if (operation.systemName === this.matchingName && this.counter === 0) {
1914
+ return true;
1915
+ }
1916
+
1917
+ if (operation.systemName === this.matchingName && this.counter > 0) {
1918
+ this.counter = this.counter - 1;
1919
+ }
1920
+
1921
+ return false;
1922
+ }
1923
+
1848
1924
  var otherwise$1 = function otherwise(operationData) {
1849
- if (this.skipNextOperation === false) {
1850
- this.skipNextOperation = true;
1925
+ if (this.whenEvaluation) {
1926
+ this.newIndex = findEndWhenIndex(this);
1851
1927
  }
1852
1928
 
1853
1929
  return operationData;
1854
1930
  };
1855
1931
 
1932
+ function findEndWhenIndex(context) {
1933
+ var list = context.operations.slice(context.currentIndex);
1934
+ var endWhenIndex = list.findIndex(findMatchingOperationIndex.bind({
1935
+ counter: 0,
1936
+ self: 'when',
1937
+ matchingName: 'endWhen'
1938
+ }));
1939
+ return endWhenIndex > -1 ? endWhenIndex + (context.currentIndex + 1) : context.operations.length;
1940
+ }
1941
+
1856
1942
  /**
1857
1943
  * This operation removes the spcified class name from the specified selected element.
1858
1944
  *
@@ -2105,7 +2191,7 @@ var setOperationData$1 = function setOperationData(operationData) {
2105
2191
  properties = _operationData.properties;
2106
2192
  delete operationData.properties;
2107
2193
  delete operationData.override;
2108
- var resolvedProperties = resolvePropertyValues(operationData, properties);
2194
+ var resolvedProperties = resolvePropertyValues(operationData, this, properties);
2109
2195
 
2110
2196
  if (override) {
2111
2197
  operationData = resolvedProperties;
@@ -2125,7 +2211,7 @@ var setOperationData$1 = function setOperationData(operationData) {
2125
2211
  */
2126
2212
 
2127
2213
  var setStyle$1 = function setStyle(operationData) {
2128
- var properties = resolvePropertyValues(operationData, operationData.properties);
2214
+ var properties = resolvePropertyValues(operationData, this, operationData.properties);
2129
2215
  operationData.selectedElement.css(properties);
2130
2216
  return operationData;
2131
2217
  };
@@ -2161,36 +2247,54 @@ var startAction$1 = function startAction(operationData) {
2161
2247
  * This operation starts a loop using the given collection.
2162
2248
  *
2163
2249
  * Each iteration the current item from the specified collection is
2164
- * assigned to the `currentItem` property on the current operation data.
2250
+ * assigned to the `currentItem` property on the operation context.
2165
2251
  *
2166
2252
  * @param operationData
2167
2253
  * @returns
2168
2254
  */
2255
+
2169
2256
  var startLoop$1 = function startLoop(operationData) {
2170
- var context = this;
2171
2257
  var collection = operationData.collection;
2172
2258
 
2173
2259
  if (collection !== null && !Array.isArray(collection)) {
2174
2260
  throw new Error('Expected collection to be array type, string value was probably not resolved correctly');
2175
- }
2261
+ } // First iteration of the loop
2262
+
2263
+
2264
+ if (this.loopIndex === undefined) {
2265
+ this.loopEndIndex = findLoopEndIndex(this);
2176
2266
 
2177
- if (context.loopIndex === undefined) {
2178
2267
  if (collection != null && collection.length) {
2179
- context.loopIndex = 0;
2180
- context.loopLength = collection.length - 1;
2181
- context.startIndex = context.currentIndex;
2268
+ this.loopIndex = 0;
2269
+ this.loopLength = collection.length - 1;
2270
+ this.loopStartIndex = this.currentIndex;
2182
2271
  } else {
2183
- context.skipNextOperation = true;
2272
+ this.newIndex = this.loopEndIndex;
2273
+ delete this.loopIndex;
2274
+ delete this.loopLength;
2275
+ delete this.loopStartIndex;
2276
+ delete this.loopEndIndex;
2184
2277
  }
2185
2278
  }
2186
2279
 
2187
- if (collection != null && collection.length && context.loopIndex !== undefined) {
2188
- operationData.currentItem = collection[context.loopIndex];
2280
+ if (collection != null && collection.length && this.loopIndex !== undefined) {
2281
+ this.currentItem = collection[this.loopIndex];
2189
2282
  }
2190
2283
 
2191
2284
  return operationData;
2192
2285
  };
2193
2286
 
2287
+ function findLoopEndIndex(context) {
2288
+ var list = context.operations.slice(context.currentIndex + 1);
2289
+ var index = list.findIndex(findMatchingOperationIndex.bind({
2290
+ counter: 0,
2291
+ self: 'startLoop',
2292
+ matchingName: 'endLoop'
2293
+ }));
2294
+ var endLoopIndex = index > -1 ? index + (context.currentIndex + 1) : context.operations.length;
2295
+ return endLoopIndex;
2296
+ }
2297
+
2194
2298
  /**
2195
2299
  * This operation toggles the specfied class name on the specified selected element.
2196
2300
  *
@@ -2241,18 +2345,22 @@ var wait$2 = function wait(operationData) {
2241
2345
  */
2242
2346
 
2243
2347
  var when = function when(operationData) {
2244
- var _parseExpression = parseExpression(operationData.expression, operationData),
2348
+ var _parseExpression = parseExpression(operationData.expression, operationData, this),
2245
2349
  left = _parseExpression[0],
2246
2350
  operator = _parseExpression[1],
2247
2351
  right = _parseExpression[2];
2248
2352
 
2249
- var evaluationResult = evaluations[operator](left, right);
2250
- this.skipNextOperation = !evaluationResult;
2353
+ this.whenEvaluation = evaluations[operator](left, right);
2354
+
2355
+ if (!this.whenEvaluation) {
2356
+ this.newIndex = findNextFlowControlIndex(this);
2357
+ }
2358
+
2251
2359
  delete operationData.expression;
2252
2360
  return operationData;
2253
2361
  };
2254
2362
 
2255
- function parseExpression(expression, operationData) {
2363
+ function parseExpression(expression, operationData, operationContext) {
2256
2364
  var _expression$split = expression.split(/!=|==|>=|<=|>|</),
2257
2365
  left = _expression$split[0],
2258
2366
  right = _expression$split[1];
@@ -2260,7 +2368,7 @@ function parseExpression(expression, operationData) {
2260
2368
  var operator = expression.substring(left.length, expression.length - right.length);
2261
2369
  var leftNr = +left;
2262
2370
  var rightNr = +right;
2263
- return [isNaN(leftNr) ? resolveOperationOrGlobalDataPropertyChain(operationData, left) : leftNr, operator, isNaN(rightNr) ? resolveOperationOrGlobalDataPropertyChain(operationData, right) : rightNr];
2371
+ return [isNaN(leftNr) ? resolveExternalPropertyChain(operationData, operationContext, left) : leftNr, operator, isNaN(rightNr) ? resolveExternalPropertyChain(operationData, operationContext, right) : rightNr];
2264
2372
  }
2265
2373
 
2266
2374
  var evaluations = {
@@ -2284,6 +2392,26 @@ var evaluations = {
2284
2392
  }
2285
2393
  };
2286
2394
 
2395
+ function findNextFlowControlIndex(context) {
2396
+ var list = context.operations.slice(context.currentIndex + 1);
2397
+ var otherWiseIndex = list.findIndex(findMatchingOperationIndex.bind({
2398
+ counter: 0,
2399
+ self: 'when',
2400
+ matchingName: 'otherwise'
2401
+ }));
2402
+
2403
+ if (otherWiseIndex > -1) {
2404
+ return otherWiseIndex + context.currentIndex + 1;
2405
+ }
2406
+
2407
+ var endWhenIndex = list.findIndex(findMatchingOperationIndex.bind({
2408
+ counter: 0,
2409
+ self: 'when',
2410
+ matchingName: 'endWhen'
2411
+ }));
2412
+ return endWhenIndex > -1 ? endWhenIndex + (context.currentIndex + 1) : context.operations.length;
2413
+ }
2414
+
2287
2415
  var ops = {
2288
2416
  __proto__: null,
2289
2417
  addClass: addClass$1,
@@ -5229,8 +5357,7 @@ function startLoop() {
5229
5357
  collection: {
5230
5358
  type: 'ParameterType:array',
5231
5359
  required: true
5232
- },
5233
- currentItem: 'ParameterType:object'
5360
+ }
5234
5361
  }
5235
5362
  };
5236
5363
  }