eligius 1.0.16 → 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.
@@ -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,32 +1151,35 @@ 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
 
1121
1158
  var propNames = propertyChainOrRegularObject.split('.');
1122
1159
  var prefix = (_propNames$shift = propNames.shift()) == null ? void 0 : _propNames$shift.toLowerCase();
1123
1160
 
1124
- if (prefix == 'operationdata') {
1125
- return getPropertyChainValue(propNames, sourceObject);
1126
- }
1161
+ switch (prefix) {
1162
+ case 'operationdata':
1163
+ return getPropertyChainValue(propNames, sourceObject);
1127
1164
 
1128
- if (prefix == 'globaldata') {
1129
- return getPropertyChainValue(propNames, getGlobals());
1165
+ case 'globaldata':
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,25 +1440,20 @@ 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
 
1452
+ var endWhen$1 = function endWhen(operationData) {
1453
+ delete this.whenEvaluation;
1454
+ return operationData;
1455
+ };
1456
+
1422
1457
  var extendController$1 = function extendController(operationData) {
1423
1458
  var controllerInstance = operationData.controllerInstance,
1424
1459
  controllerExtension = operationData.controllerExtension;
@@ -1817,7 +1852,7 @@ var log$1 = function log(operationData) {
1817
1852
  */
1818
1853
 
1819
1854
  var math$1 = function math(operationData) {
1820
- operationData = resolvePropertyValues(operationData, operationData);
1855
+ operationData = resolvePropertyValues(operationData, this, operationData);
1821
1856
  operationData.args = resolveMathConstants(operationData.args);
1822
1857
  var _operationData = operationData,
1823
1858
  args = _operationData.args,
@@ -1840,6 +1875,70 @@ function isMathProperty(value) {
1840
1875
  return isString(value) && value in Math && !isFunction(Math[value]);
1841
1876
  }
1842
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
+
1924
+ var otherwise$1 = function otherwise(operationData) {
1925
+ if (this.whenEvaluation) {
1926
+ this.newIndex = findEndWhenIndex(this);
1927
+ }
1928
+
1929
+ return operationData;
1930
+ };
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
+
1843
1942
  /**
1844
1943
  * This operation removes the spcified class name from the specified selected element.
1845
1944
  *
@@ -2092,7 +2191,7 @@ var setOperationData$1 = function setOperationData(operationData) {
2092
2191
  properties = _operationData.properties;
2093
2192
  delete operationData.properties;
2094
2193
  delete operationData.override;
2095
- var resolvedProperties = resolvePropertyValues(operationData, properties);
2194
+ var resolvedProperties = resolvePropertyValues(operationData, this, properties);
2096
2195
 
2097
2196
  if (override) {
2098
2197
  operationData = resolvedProperties;
@@ -2112,7 +2211,7 @@ var setOperationData$1 = function setOperationData(operationData) {
2112
2211
  */
2113
2212
 
2114
2213
  var setStyle$1 = function setStyle(operationData) {
2115
- var properties = resolvePropertyValues(operationData, operationData.properties);
2214
+ var properties = resolvePropertyValues(operationData, this, operationData.properties);
2116
2215
  operationData.selectedElement.css(properties);
2117
2216
  return operationData;
2118
2217
  };
@@ -2148,36 +2247,54 @@ var startAction$1 = function startAction(operationData) {
2148
2247
  * This operation starts a loop using the given collection.
2149
2248
  *
2150
2249
  * Each iteration the current item from the specified collection is
2151
- * assigned to the `currentItem` property on the current operation data.
2250
+ * assigned to the `currentItem` property on the operation context.
2152
2251
  *
2153
2252
  * @param operationData
2154
2253
  * @returns
2155
2254
  */
2255
+
2156
2256
  var startLoop$1 = function startLoop(operationData) {
2157
- var context = this;
2158
2257
  var collection = operationData.collection;
2159
2258
 
2160
2259
  if (collection !== null && !Array.isArray(collection)) {
2161
2260
  throw new Error('Expected collection to be array type, string value was probably not resolved correctly');
2162
- }
2261
+ } // First iteration of the loop
2262
+
2263
+
2264
+ if (this.loopIndex === undefined) {
2265
+ this.loopEndIndex = findLoopEndIndex(this);
2163
2266
 
2164
- if (context.loopIndex === undefined) {
2165
2267
  if (collection != null && collection.length) {
2166
- context.loopIndex = 0;
2167
- context.loopLength = collection.length - 1;
2168
- context.startIndex = context.currentIndex;
2268
+ this.loopIndex = 0;
2269
+ this.loopLength = collection.length - 1;
2270
+ this.loopStartIndex = this.currentIndex;
2169
2271
  } else {
2170
- context.skipNextOperation = true;
2272
+ this.newIndex = this.loopEndIndex;
2273
+ delete this.loopIndex;
2274
+ delete this.loopLength;
2275
+ delete this.loopStartIndex;
2276
+ delete this.loopEndIndex;
2171
2277
  }
2172
2278
  }
2173
2279
 
2174
- if (collection != null && collection.length && context.loopIndex !== undefined) {
2175
- operationData.currentItem = collection[context.loopIndex];
2280
+ if (collection != null && collection.length && this.loopIndex !== undefined) {
2281
+ this.currentItem = collection[this.loopIndex];
2176
2282
  }
2177
2283
 
2178
2284
  return operationData;
2179
2285
  };
2180
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
+
2181
2298
  /**
2182
2299
  * This operation toggles the specfied class name on the specified selected element.
2183
2300
  *
@@ -2209,7 +2326,7 @@ var toggleElement$1 = function toggleElement(operationData) {
2209
2326
  * @returns
2210
2327
  */
2211
2328
 
2212
- var wait$1 = function wait(operationData) {
2329
+ var wait$2 = function wait(operationData) {
2213
2330
  var milliseconds = operationData.milliseconds;
2214
2331
  return new Promise(function (resolve) {
2215
2332
  setTimeout(function () {
@@ -2218,6 +2335,83 @@ var wait$1 = function wait(operationData) {
2218
2335
  });
2219
2336
  };
2220
2337
 
2338
+ /**
2339
+ * When the given expression evaluates to false, subsequent operations will be skipped
2340
+ * until an `endWhen` operation is encountered.
2341
+ * Practically, this mean an `if` statement control flow implementation in a list of operations.
2342
+ *
2343
+ * @param operationData
2344
+ * @returns
2345
+ */
2346
+
2347
+ var when = function when(operationData) {
2348
+ var _parseExpression = parseExpression(operationData.expression, operationData, this),
2349
+ left = _parseExpression[0],
2350
+ operator = _parseExpression[1],
2351
+ right = _parseExpression[2];
2352
+
2353
+ this.whenEvaluation = evaluations[operator](left, right);
2354
+
2355
+ if (!this.whenEvaluation) {
2356
+ this.newIndex = findNextFlowControlIndex(this);
2357
+ }
2358
+
2359
+ delete operationData.expression;
2360
+ return operationData;
2361
+ };
2362
+
2363
+ function parseExpression(expression, operationData, operationContext) {
2364
+ var _expression$split = expression.split(/!=|==|>=|<=|>|</),
2365
+ left = _expression$split[0],
2366
+ right = _expression$split[1];
2367
+
2368
+ var operator = expression.substring(left.length, expression.length - right.length);
2369
+ var leftNr = +left;
2370
+ var rightNr = +right;
2371
+ return [isNaN(leftNr) ? resolveExternalPropertyChain(operationData, operationContext, left) : leftNr, operator, isNaN(rightNr) ? resolveExternalPropertyChain(operationData, operationContext, right) : rightNr];
2372
+ }
2373
+
2374
+ var evaluations = {
2375
+ '==': function _(left, right) {
2376
+ return left === right;
2377
+ },
2378
+ '!=': function _(left, right) {
2379
+ return left !== right;
2380
+ },
2381
+ '>=': function _(left, right) {
2382
+ return left >= right;
2383
+ },
2384
+ '<=': function _(left, right) {
2385
+ return left <= right;
2386
+ },
2387
+ '>': function _(left, right) {
2388
+ return left > right;
2389
+ },
2390
+ '<': function _(left, right) {
2391
+ return left < right;
2392
+ }
2393
+ };
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
+
2221
2415
  var ops = {
2222
2416
  __proto__: null,
2223
2417
  addClass: addClass$1,
@@ -2232,6 +2426,7 @@ var ops = {
2232
2426
  customFunction: customFunction$1,
2233
2427
  endAction: endAction$1,
2234
2428
  endLoop: endLoop$1,
2429
+ endWhen: endWhen$1,
2235
2430
  extendController: extendController$1,
2236
2431
  getControllerFromElement: getControllerFromElement$1,
2237
2432
  getControllerInstance: getControllerInstance$1,
@@ -2242,6 +2437,7 @@ var ops = {
2242
2437
  loadJSON: loadJSON$1,
2243
2438
  log: log$1,
2244
2439
  math: math$1,
2440
+ otherwise: otherwise$1,
2245
2441
  removeClass: removeClass$1,
2246
2442
  removeControllerFromElement: removeControllerFromElement$1,
2247
2443
  removeElement: removeElement$1,
@@ -2259,7 +2455,8 @@ var ops = {
2259
2455
  startLoop: startLoop$1,
2260
2456
  toggleClass: toggleClass$1,
2261
2457
  toggleElement: toggleElement$1,
2262
- wait: wait$1
2458
+ wait: wait$2,
2459
+ when: when
2263
2460
  };
2264
2461
 
2265
2462
  var ActionCreatorFactory = /*#__PURE__*/function () {
@@ -4820,6 +5017,12 @@ function endLoop() {
4820
5017
  };
4821
5018
  }
4822
5019
 
5020
+ function endWhen() {
5021
+ return {
5022
+ description: 'Ends the current when block'
5023
+ };
5024
+ }
5025
+
4823
5026
  function extendController() {
4824
5027
  return {
4825
5028
  description: 'Extends the current controller',
@@ -4964,6 +5167,12 @@ function createMathFunctionNames() {
4964
5167
  });
4965
5168
  }
4966
5169
 
5170
+ function otherwise() {
5171
+ return {
5172
+ description: 'Inverts the control flow for `when` logic'
5173
+ };
5174
+ }
5175
+
4967
5176
  function removeClass() {
4968
5177
  return {
4969
5178
  description: 'Removes the specified class from the selected element',
@@ -5148,8 +5357,7 @@ function startLoop() {
5148
5357
  collection: {
5149
5358
  type: 'ParameterType:array',
5150
5359
  required: true
5151
- },
5152
- currentItem: 'ParameterType:object'
5360
+ }
5153
5361
  }
5154
5362
  };
5155
5363
  }
@@ -5174,7 +5382,7 @@ function toggleElement() {
5174
5382
  };
5175
5383
  }
5176
5384
 
5177
- function wait() {
5385
+ function wait$1() {
5178
5386
  return {
5179
5387
  description: 'Waits the given amount of milliseconds before the action continues',
5180
5388
  properties: {
@@ -5186,6 +5394,18 @@ function wait() {
5186
5394
  };
5187
5395
  }
5188
5396
 
5397
+ function wait() {
5398
+ return {
5399
+ description: 'Evaluates the given expression, when it evaluates to false context.skipNextOperation will be set to true',
5400
+ properties: {
5401
+ expression: {
5402
+ type: 'ParameterType:expression',
5403
+ required: true
5404
+ }
5405
+ }
5406
+ };
5407
+ }
5408
+
5189
5409
  var operationMetadata = {
5190
5410
  __proto__: null,
5191
5411
  addClass: addClass,
@@ -5200,6 +5420,7 @@ var operationMetadata = {
5200
5420
  customFunction: customFunction,
5201
5421
  endAction: endAction,
5202
5422
  endLoop: endLoop,
5423
+ endWhen: endWhen,
5203
5424
  extendController: extendController,
5204
5425
  getControllerFromElement: getControllerFromElement,
5205
5426
  getControllerInstance: getControllerInstance,
@@ -5210,6 +5431,7 @@ var operationMetadata = {
5210
5431
  loadJSON: loadJSON,
5211
5432
  log: log,
5212
5433
  math: math,
5434
+ otherwise: otherwise,
5213
5435
  removeClass: removeClass,
5214
5436
  removeControllerFromElement: removeControllerFromElement,
5215
5437
  removeElement: removeElement,
@@ -5227,7 +5449,8 @@ var operationMetadata = {
5227
5449
  startLoop: startLoop,
5228
5450
  toggleClass: toggleClass,
5229
5451
  toggleElement: toggleElement,
5230
- wait: wait
5452
+ wait: wait$1,
5453
+ when: wait
5231
5454
  };
5232
5455
 
5233
5456
  var OperationNamesProvider = /*#__PURE__*/function () {
@@ -6344,6 +6567,11 @@ var evtb = {
6344
6567
  RequestVideoUriInterceptor: RequestVideoUriInterceptor
6345
6568
  };
6346
6569
 
6570
+ function setGlobal(name, value) {
6571
+ var cache = getGlobals();
6572
+ cache[name] = value;
6573
+ }
6574
+
6347
6575
  var LanguageManager = /*#__PURE__*/function () {
6348
6576
  function LanguageManager(_currentLanguage, labels, _eventbus) {
6349
6577
  this._currentLanguage = void 0;
@@ -6357,6 +6585,8 @@ var LanguageManager = /*#__PURE__*/function () {
6357
6585
  throw new Error('language ctor arg cannot have zero length');
6358
6586
  }
6359
6587
 
6588
+ setGlobal('defaultLanguage', _currentLanguage);
6589
+
6360
6590
  this._setRootElementLang(_currentLanguage);
6361
6591
 
6362
6592
  this._labelLookup = this._createLabelLookup(labels);
@@ -6738,6 +6968,7 @@ exports.createElement = createElement$1;
6738
6968
  exports.customFunction = customFunction$1;
6739
6969
  exports.endAction = endAction$1;
6740
6970
  exports.endLoop = endLoop$1;
6971
+ exports.endWhen = endWhen$1;
6741
6972
  exports.extendController = extendController$1;
6742
6973
  exports.generateImporterSourceCode = generateImporterSourceCode;
6743
6974
  exports.getControllerFromElement = getControllerFromElement$1;
@@ -6750,6 +6981,7 @@ exports.loadJSON = loadJSON$1;
6750
6981
  exports.log = log$1;
6751
6982
  exports.math = math$1;
6752
6983
  exports.metadata = operationMetadata;
6984
+ exports.otherwise = otherwise$1;
6753
6985
  exports.removeClass = removeClass$1;
6754
6986
  exports.removeControllerFromElement = removeControllerFromElement$1;
6755
6987
  exports.removeElement = removeElement$1;
@@ -6767,5 +6999,6 @@ exports.startAction = startAction$1;
6767
6999
  exports.startLoop = startLoop$1;
6768
7000
  exports.toggleClass = toggleClass$1;
6769
7001
  exports.toggleElement = toggleElement$1;
6770
- exports.wait = wait$1;
7002
+ exports.wait = wait$2;
7003
+ exports.when = when;
6771
7004
  //# sourceMappingURL=eligius.cjs.development.js.map