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.
- package/dist/action/action.d.ts +6 -2
- package/dist/action/endable-action.d.ts +1 -1
- package/dist/action/timeline-action.d.ts +2 -2
- package/dist/action/types.d.ts +2 -2
- package/dist/eligius.cjs.development.js +306 -73
- package/dist/eligius.cjs.development.js.map +1 -1
- package/dist/eligius.cjs.production.min.js +1 -1
- package/dist/eligius.cjs.production.min.js.map +1 -1
- package/dist/eligius.esm.js +303 -73
- package/dist/eligius.esm.js.map +1 -1
- package/dist/operation/end-loop.d.ts +1 -2
- package/dist/operation/end-when.d.ts +2 -0
- package/dist/operation/helper/find-matching-operation-index.d.ts +35 -0
- package/dist/operation/helper/remove-global.d.ts +1 -0
- package/dist/operation/helper/resolve-event-arguments.d.ts +2 -2
- package/dist/operation/helper/{resolve-operation-or-global-data-property-chain.d.ts → resolve-external-property-chain.d.ts} +2 -1
- package/dist/operation/helper/resolve-property-values.d.ts +2 -2
- package/dist/operation/index.d.ts +3 -0
- package/dist/operation/metadata/end-when.d.ts +3 -0
- package/dist/operation/metadata/index.d.ts +3 -0
- package/dist/operation/metadata/otherwise.d.ts +3 -0
- package/dist/operation/metadata/types.d.ts +1 -1
- package/dist/operation/metadata/when.d.ts +4 -0
- package/dist/operation/otherwise.d.ts +2 -0
- package/dist/operation/start-loop.d.ts +1 -2
- package/dist/operation/types.d.ts +40 -2
- package/dist/operation/wait.d.ts +3 -3
- package/dist/operation/when.d.ts +17 -0
- package/package.json +7 -5
package/dist/eligius.esm.js
CHANGED
|
@@ -519,6 +519,7 @@ var Action = /*#__PURE__*/function () {
|
|
|
519
519
|
this.startOperations = void 0;
|
|
520
520
|
this.eventbus = void 0;
|
|
521
521
|
this.id = '';
|
|
522
|
+
this._contextStack = [];
|
|
522
523
|
this.name = name;
|
|
523
524
|
this.startOperations = startOperations;
|
|
524
525
|
this.eventbus = eventbus;
|
|
@@ -531,15 +532,14 @@ var Action = /*#__PURE__*/function () {
|
|
|
531
532
|
_this = this;
|
|
532
533
|
|
|
533
534
|
Diagnostics.active && Diagnostics.send('eligius-diagnostics-action', ((_this$name = this.name) != null ? _this$name : 'Action') + " begins executing start operations");
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
};
|
|
535
|
+
|
|
536
|
+
this._initializeContextStack();
|
|
537
|
+
|
|
538
538
|
var result = new Promise(function (resolve, reject) {
|
|
539
|
-
_this.executeOperation(_this.startOperations, 0, resolve, reject, initOperationData
|
|
539
|
+
_this.executeOperation(_this.startOperations, 0, resolve, reject, initOperationData);
|
|
540
540
|
})["catch"](function (e) {
|
|
541
541
|
Diagnostics.active && Diagnostics.send('eligius-diagnostics-action-error', {
|
|
542
|
-
name: name,
|
|
542
|
+
name: _this.name,
|
|
543
543
|
error: e
|
|
544
544
|
});
|
|
545
545
|
console.error("Error in action start '" + _this.name + "'");
|
|
@@ -554,13 +554,42 @@ var Action = /*#__PURE__*/function () {
|
|
|
554
554
|
});
|
|
555
555
|
};
|
|
556
556
|
|
|
557
|
-
_proto.
|
|
557
|
+
_proto._initializeContextStack = function _initializeContextStack() {
|
|
558
|
+
this._contextStack = [{
|
|
559
|
+
currentIndex: -1,
|
|
560
|
+
eventbus: this.eventbus,
|
|
561
|
+
operations: this.startOperations
|
|
562
|
+
}];
|
|
563
|
+
};
|
|
564
|
+
|
|
565
|
+
_proto._pushContext = function _pushContext(parentContext) {
|
|
566
|
+
var newContext = {
|
|
567
|
+
currentIndex: parentContext.currentIndex,
|
|
568
|
+
eventbus: parentContext.eventbus,
|
|
569
|
+
operations: parentContext.operations
|
|
570
|
+
};
|
|
571
|
+
|
|
572
|
+
this._contextStack.push(newContext);
|
|
573
|
+
|
|
574
|
+
return newContext;
|
|
575
|
+
};
|
|
576
|
+
|
|
577
|
+
_proto._popContext = function _popContext() {
|
|
578
|
+
var previousContext = this._contextStack.pop();
|
|
579
|
+
|
|
580
|
+
var newCurrentContext = this._contextStack[this._contextStack.length - 1];
|
|
581
|
+
newCurrentContext.currentIndex = previousContext.currentIndex;
|
|
582
|
+
};
|
|
583
|
+
|
|
584
|
+
_proto.executeOperation = function executeOperation(operations, idx, resolve, reject, previousOperationData) {
|
|
558
585
|
var _this2 = this;
|
|
559
586
|
|
|
560
587
|
if (previousOperationData === void 0) {
|
|
561
588
|
previousOperationData = {};
|
|
562
589
|
}
|
|
563
590
|
|
|
591
|
+
var context = this._contextStack[this._contextStack.length - 1];
|
|
592
|
+
|
|
564
593
|
if (context.newIndex !== undefined) {
|
|
565
594
|
idx = context.newIndex;
|
|
566
595
|
delete context.newIndex;
|
|
@@ -568,18 +597,20 @@ var Action = /*#__PURE__*/function () {
|
|
|
568
597
|
|
|
569
598
|
context.currentIndex = idx;
|
|
570
599
|
|
|
571
|
-
if (context.skipNextOperation) {
|
|
572
|
-
if (idx < operations.length) {
|
|
573
|
-
this.executeOperation(operations, ++idx, resolve, reject, previousOperationData, context);
|
|
574
|
-
} else {
|
|
575
|
-
resolve(previousOperationData);
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
|
|
579
600
|
if (idx < operations.length) {
|
|
601
|
+
var _operationInfo$operat;
|
|
602
|
+
|
|
580
603
|
var operationInfo = operations[idx];
|
|
581
|
-
var copy =
|
|
604
|
+
var copy = deepCopy((_operationInfo$operat = operationInfo.operationData) != null ? _operationInfo$operat : {});
|
|
582
605
|
var mergedOperationData = Object.assign(previousOperationData, copy);
|
|
606
|
+
|
|
607
|
+
if (operationInfo.systemName === 'when') {
|
|
608
|
+
context = this._pushContext(context);
|
|
609
|
+
} else if (operationInfo.systemName === 'startLoop' && context.owner !== operationInfo) {
|
|
610
|
+
context = this._pushContext(context);
|
|
611
|
+
context.owner = operationInfo;
|
|
612
|
+
}
|
|
613
|
+
|
|
583
614
|
Diagnostics.active && Diagnostics.send('eligius-diagnostics-operation', {
|
|
584
615
|
systemName: operationInfo.systemName,
|
|
585
616
|
operationData: mergedOperationData,
|
|
@@ -589,14 +620,18 @@ var Action = /*#__PURE__*/function () {
|
|
|
589
620
|
});
|
|
590
621
|
var operationResult = operationInfo.instance.call(context, mergedOperationData);
|
|
591
622
|
|
|
623
|
+
if (operationInfo.systemName === 'endWhen' || operationInfo.systemName === 'endLoop' && context.newIndex === undefined) {
|
|
624
|
+
this._popContext();
|
|
625
|
+
}
|
|
626
|
+
|
|
592
627
|
if (isPromise(operationResult)) {
|
|
593
628
|
operationResult.then(function (promisedOperationResult) {
|
|
594
|
-
return _this2.executeOperation(operations, ++idx, resolve, reject, promisedOperationResult
|
|
629
|
+
return _this2.executeOperation(operations, ++idx, resolve, reject, promisedOperationResult);
|
|
595
630
|
})["catch"](function (error) {
|
|
596
631
|
reject(error);
|
|
597
632
|
});
|
|
598
633
|
} else {
|
|
599
|
-
this.executeOperation(operations, ++idx, resolve, reject, operationResult
|
|
634
|
+
this.executeOperation(operations, ++idx, resolve, reject, operationResult);
|
|
600
635
|
}
|
|
601
636
|
} else {
|
|
602
637
|
resolve(previousOperationData);
|
|
@@ -627,16 +662,18 @@ var EndableAction = /*#__PURE__*/function (_Action) {
|
|
|
627
662
|
Diagnostics.active && Diagnostics.send('eligius-diagnostics-action', ((_this$name = this.name) != null ? _this$name : 'Action') + " begins executing end operations");
|
|
628
663
|
|
|
629
664
|
if (!this.endOperations.length) {
|
|
630
|
-
return Promise.resolve(initOperationData);
|
|
665
|
+
return Promise.resolve(initOperationData != null ? initOperationData : {});
|
|
631
666
|
}
|
|
632
667
|
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
eventbus: this.eventbus
|
|
636
|
-
};
|
|
668
|
+
this._initializeContextStack();
|
|
669
|
+
|
|
637
670
|
var result = new Promise(function (resolve, reject) {
|
|
638
|
-
_this2.executeOperation(_this2.endOperations, 0, resolve, reject, initOperationData
|
|
671
|
+
_this2.executeOperation(_this2.endOperations, 0, resolve, reject, initOperationData);
|
|
639
672
|
})["catch"](function (e) {
|
|
673
|
+
Diagnostics.active && Diagnostics.send('eligius-diagnostics-action-error', {
|
|
674
|
+
name: _this2.name,
|
|
675
|
+
error: e
|
|
676
|
+
});
|
|
640
677
|
console.error("Error in action end '" + _this2.name + "'");
|
|
641
678
|
throw e;
|
|
642
679
|
});
|
|
@@ -672,7 +709,7 @@ var TimelineAction = /*#__PURE__*/function (_EndableAction) {
|
|
|
672
709
|
return _EndableAction.prototype.start.call(this, initOperationData);
|
|
673
710
|
}
|
|
674
711
|
|
|
675
|
-
return Promise.resolve(
|
|
712
|
+
return Promise.resolve({});
|
|
676
713
|
};
|
|
677
714
|
|
|
678
715
|
_proto.end = function end(initOperationData) {
|
|
@@ -1102,32 +1139,35 @@ var setGlobals = /*#__PURE__*/_setGlobals.bind(null, cache$1);
|
|
|
1102
1139
|
* @returns
|
|
1103
1140
|
*/
|
|
1104
1141
|
|
|
1105
|
-
function
|
|
1142
|
+
function resolveExternalPropertyChain(sourceObject, operationContext, propertyChainOrRegularObject) {
|
|
1106
1143
|
if (isString(propertyChainOrRegularObject)) {
|
|
1107
1144
|
var _propNames$shift;
|
|
1108
1145
|
|
|
1109
1146
|
var propNames = propertyChainOrRegularObject.split('.');
|
|
1110
1147
|
var prefix = (_propNames$shift = propNames.shift()) == null ? void 0 : _propNames$shift.toLowerCase();
|
|
1111
1148
|
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1149
|
+
switch (prefix) {
|
|
1150
|
+
case 'operationdata':
|
|
1151
|
+
return getPropertyChainValue(propNames, sourceObject);
|
|
1115
1152
|
|
|
1116
|
-
|
|
1117
|
-
|
|
1153
|
+
case 'globaldata':
|
|
1154
|
+
return getPropertyChainValue(propNames, getGlobals());
|
|
1155
|
+
|
|
1156
|
+
case 'context':
|
|
1157
|
+
return getPropertyChainValue(propNames, operationContext);
|
|
1118
1158
|
}
|
|
1119
1159
|
}
|
|
1120
1160
|
|
|
1121
1161
|
return propertyChainOrRegularObject;
|
|
1122
1162
|
}
|
|
1123
1163
|
|
|
1124
|
-
function resolveEventArguments(operationData, eventArgs) {
|
|
1164
|
+
function resolveEventArguments(operationData, operationContext, eventArgs) {
|
|
1125
1165
|
if (!eventArgs) {
|
|
1126
1166
|
return;
|
|
1127
1167
|
}
|
|
1128
1168
|
|
|
1129
|
-
var
|
|
1130
|
-
return eventArgs.map(
|
|
1169
|
+
var resolve = resolveExternalPropertyChain.bind(null, operationData, operationContext);
|
|
1170
|
+
return eventArgs.map(resolve);
|
|
1131
1171
|
}
|
|
1132
1172
|
|
|
1133
1173
|
/**
|
|
@@ -1141,7 +1181,7 @@ var broadcastEvent$1 = function broadcastEvent(operationData) {
|
|
|
1141
1181
|
var eventArgs = operationData.eventArgs,
|
|
1142
1182
|
eventTopic = operationData.eventTopic,
|
|
1143
1183
|
eventName = operationData.eventName;
|
|
1144
|
-
var eventArguments = resolveEventArguments(operationData, eventArgs);
|
|
1184
|
+
var eventArguments = resolveEventArguments(operationData, this, eventArgs);
|
|
1145
1185
|
|
|
1146
1186
|
if (eventTopic) {
|
|
1147
1187
|
this.eventbus.broadcastForTopic(eventName, eventTopic, eventArguments);
|
|
@@ -1154,9 +1194,9 @@ var broadcastEvent$1 = function broadcastEvent(operationData) {
|
|
|
1154
1194
|
};
|
|
1155
1195
|
|
|
1156
1196
|
var cache = [];
|
|
1157
|
-
function resolvePropertyValues(operationData, properties) {
|
|
1197
|
+
function resolvePropertyValues(operationData, operationContext, properties) {
|
|
1158
1198
|
var copy = properties !== operationData ? deepCopy(properties) : properties;
|
|
1159
|
-
var resolvePropertyChain =
|
|
1199
|
+
var resolvePropertyChain = resolveExternalPropertyChain.bind(null, operationData, operationContext);
|
|
1160
1200
|
resolveProperties(properties, copy, resolvePropertyChain);
|
|
1161
1201
|
return copy;
|
|
1162
1202
|
}
|
|
@@ -1225,7 +1265,7 @@ var calcFunctions = {
|
|
|
1225
1265
|
*/
|
|
1226
1266
|
|
|
1227
1267
|
var calc$1 = function calc(operationData) {
|
|
1228
|
-
operationData = resolvePropertyValues(operationData, operationData);
|
|
1268
|
+
operationData = resolvePropertyValues(operationData, this, operationData);
|
|
1229
1269
|
var _operationData = operationData,
|
|
1230
1270
|
left = _operationData.left,
|
|
1231
1271
|
right = _operationData.right,
|
|
@@ -1271,7 +1311,7 @@ var clearOperationData$1 = function clearOperationData(operationData) {
|
|
|
1271
1311
|
*/
|
|
1272
1312
|
|
|
1273
1313
|
var createElement$1 = function createElement(operationData) {
|
|
1274
|
-
operationData = resolvePropertyValues(operationData, operationData);
|
|
1314
|
+
operationData = resolvePropertyValues(operationData, this, operationData);
|
|
1275
1315
|
var _operationData = operationData,
|
|
1276
1316
|
elementName = _operationData.elementName,
|
|
1277
1317
|
attributes = _operationData.attributes,
|
|
@@ -1388,25 +1428,20 @@ var endAction$1 = function endAction(operationData) {
|
|
|
1388
1428
|
* @returns
|
|
1389
1429
|
*/
|
|
1390
1430
|
var endLoop$1 = function endLoop(operationData) {
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
context.loopIndex = context.loopIndex + 1;
|
|
1396
|
-
context.newIndex = context.startIndex;
|
|
1397
|
-
} else {
|
|
1398
|
-
delete context.loopIndex;
|
|
1399
|
-
delete context.loopLength;
|
|
1400
|
-
delete context.startIndex;
|
|
1401
|
-
delete context.newIndex;
|
|
1402
|
-
}
|
|
1403
|
-
} else {
|
|
1404
|
-
delete context.skipNextOperation;
|
|
1431
|
+
if (this.loopIndex !== undefined && this.loopLength !== undefined && this.loopIndex < this.loopLength) {
|
|
1432
|
+
this.loopIndex = this.loopIndex + 1;
|
|
1433
|
+
this.newIndex = this.loopStartIndex;
|
|
1434
|
+
delete this.currentItem;
|
|
1405
1435
|
}
|
|
1406
1436
|
|
|
1407
1437
|
return operationData;
|
|
1408
1438
|
};
|
|
1409
1439
|
|
|
1440
|
+
var endWhen$1 = function endWhen(operationData) {
|
|
1441
|
+
delete this.whenEvaluation;
|
|
1442
|
+
return operationData;
|
|
1443
|
+
};
|
|
1444
|
+
|
|
1410
1445
|
var extendController$1 = function extendController(operationData) {
|
|
1411
1446
|
var controllerInstance = operationData.controllerInstance,
|
|
1412
1447
|
controllerExtension = operationData.controllerExtension;
|
|
@@ -1805,7 +1840,7 @@ var log$1 = function log(operationData) {
|
|
|
1805
1840
|
*/
|
|
1806
1841
|
|
|
1807
1842
|
var math$1 = function math(operationData) {
|
|
1808
|
-
operationData = resolvePropertyValues(operationData, operationData);
|
|
1843
|
+
operationData = resolvePropertyValues(operationData, this, operationData);
|
|
1809
1844
|
operationData.args = resolveMathConstants(operationData.args);
|
|
1810
1845
|
var _operationData = operationData,
|
|
1811
1846
|
args = _operationData.args,
|
|
@@ -1828,6 +1863,70 @@ function isMathProperty(value) {
|
|
|
1828
1863
|
return isString(value) && value in Math && !isFunction(Math[value]);
|
|
1829
1864
|
}
|
|
1830
1865
|
|
|
1866
|
+
/**
|
|
1867
|
+
* This function can be used to find the index of a matching operation within a list of operations.
|
|
1868
|
+
*
|
|
1869
|
+
* Given the array of operations:
|
|
1870
|
+
* ```ts
|
|
1871
|
+
* [
|
|
1872
|
+
* {systemName:'name1'}, // index 0
|
|
1873
|
+
* {systemName:'startLoop'}, // index 1
|
|
1874
|
+
* {systemName:'name2'}, // index 2
|
|
1875
|
+
* {systemName:'startLoop'} // index 3
|
|
1876
|
+
* {systemName:'name3'} // index 4
|
|
1877
|
+
* {systemName:'endLoop'} // index 5
|
|
1878
|
+
* {systemName:'endLoop'} // index 6
|
|
1879
|
+
* {systemName:'name3'} // index 7
|
|
1880
|
+
* ]
|
|
1881
|
+
* ```
|
|
1882
|
+
*
|
|
1883
|
+
* Given the startLoop instance at index 1, this function will return index 6. Given the startLoop at index 3, it will yield index 5.
|
|
1884
|
+
*
|
|
1885
|
+
* Returns true when the given operation.systemName equals the specified matchingName and the current counter value is zero.
|
|
1886
|
+
*
|
|
1887
|
+
* If the matchingName matches operation.systemName but the counter is greater than zero, the counter is decremented.
|
|
1888
|
+
*
|
|
1889
|
+
* If the operation.systemName equal self (the name of the operation that requires to find its match), then counter is incremented.
|
|
1890
|
+
*
|
|
1891
|
+
* @param this
|
|
1892
|
+
* @param operation
|
|
1893
|
+
* @returns
|
|
1894
|
+
*/
|
|
1895
|
+
function findMatchingOperationIndex(operation) {
|
|
1896
|
+
if (operation.systemName === this.self) {
|
|
1897
|
+
this.counter = this.counter + 1;
|
|
1898
|
+
return false;
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1901
|
+
if (operation.systemName === this.matchingName && this.counter === 0) {
|
|
1902
|
+
return true;
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
if (operation.systemName === this.matchingName && this.counter > 0) {
|
|
1906
|
+
this.counter = this.counter - 1;
|
|
1907
|
+
}
|
|
1908
|
+
|
|
1909
|
+
return false;
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1912
|
+
var otherwise$1 = function otherwise(operationData) {
|
|
1913
|
+
if (this.whenEvaluation) {
|
|
1914
|
+
this.newIndex = findEndWhenIndex(this);
|
|
1915
|
+
}
|
|
1916
|
+
|
|
1917
|
+
return operationData;
|
|
1918
|
+
};
|
|
1919
|
+
|
|
1920
|
+
function findEndWhenIndex(context) {
|
|
1921
|
+
var list = context.operations.slice(context.currentIndex);
|
|
1922
|
+
var endWhenIndex = list.findIndex(findMatchingOperationIndex.bind({
|
|
1923
|
+
counter: 0,
|
|
1924
|
+
self: 'when',
|
|
1925
|
+
matchingName: 'endWhen'
|
|
1926
|
+
}));
|
|
1927
|
+
return endWhenIndex > -1 ? endWhenIndex + (context.currentIndex + 1) : context.operations.length;
|
|
1928
|
+
}
|
|
1929
|
+
|
|
1831
1930
|
/**
|
|
1832
1931
|
* This operation removes the spcified class name from the specified selected element.
|
|
1833
1932
|
*
|
|
@@ -2080,7 +2179,7 @@ var setOperationData$1 = function setOperationData(operationData) {
|
|
|
2080
2179
|
properties = _operationData.properties;
|
|
2081
2180
|
delete operationData.properties;
|
|
2082
2181
|
delete operationData.override;
|
|
2083
|
-
var resolvedProperties = resolvePropertyValues(operationData, properties);
|
|
2182
|
+
var resolvedProperties = resolvePropertyValues(operationData, this, properties);
|
|
2084
2183
|
|
|
2085
2184
|
if (override) {
|
|
2086
2185
|
operationData = resolvedProperties;
|
|
@@ -2100,7 +2199,7 @@ var setOperationData$1 = function setOperationData(operationData) {
|
|
|
2100
2199
|
*/
|
|
2101
2200
|
|
|
2102
2201
|
var setStyle$1 = function setStyle(operationData) {
|
|
2103
|
-
var properties = resolvePropertyValues(operationData, operationData.properties);
|
|
2202
|
+
var properties = resolvePropertyValues(operationData, this, operationData.properties);
|
|
2104
2203
|
operationData.selectedElement.css(properties);
|
|
2105
2204
|
return operationData;
|
|
2106
2205
|
};
|
|
@@ -2136,36 +2235,54 @@ var startAction$1 = function startAction(operationData) {
|
|
|
2136
2235
|
* This operation starts a loop using the given collection.
|
|
2137
2236
|
*
|
|
2138
2237
|
* Each iteration the current item from the specified collection is
|
|
2139
|
-
* assigned to the `currentItem` property on the
|
|
2238
|
+
* assigned to the `currentItem` property on the operation context.
|
|
2140
2239
|
*
|
|
2141
2240
|
* @param operationData
|
|
2142
2241
|
* @returns
|
|
2143
2242
|
*/
|
|
2243
|
+
|
|
2144
2244
|
var startLoop$1 = function startLoop(operationData) {
|
|
2145
|
-
var context = this;
|
|
2146
2245
|
var collection = operationData.collection;
|
|
2147
2246
|
|
|
2148
2247
|
if (collection !== null && !Array.isArray(collection)) {
|
|
2149
2248
|
throw new Error('Expected collection to be array type, string value was probably not resolved correctly');
|
|
2150
|
-
}
|
|
2249
|
+
} // First iteration of the loop
|
|
2250
|
+
|
|
2251
|
+
|
|
2252
|
+
if (this.loopIndex === undefined) {
|
|
2253
|
+
this.loopEndIndex = findLoopEndIndex(this);
|
|
2151
2254
|
|
|
2152
|
-
if (context.loopIndex === undefined) {
|
|
2153
2255
|
if (collection != null && collection.length) {
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2256
|
+
this.loopIndex = 0;
|
|
2257
|
+
this.loopLength = collection.length - 1;
|
|
2258
|
+
this.loopStartIndex = this.currentIndex;
|
|
2157
2259
|
} else {
|
|
2158
|
-
|
|
2260
|
+
this.newIndex = this.loopEndIndex;
|
|
2261
|
+
delete this.loopIndex;
|
|
2262
|
+
delete this.loopLength;
|
|
2263
|
+
delete this.loopStartIndex;
|
|
2264
|
+
delete this.loopEndIndex;
|
|
2159
2265
|
}
|
|
2160
2266
|
}
|
|
2161
2267
|
|
|
2162
|
-
if (collection != null && collection.length &&
|
|
2163
|
-
|
|
2268
|
+
if (collection != null && collection.length && this.loopIndex !== undefined) {
|
|
2269
|
+
this.currentItem = collection[this.loopIndex];
|
|
2164
2270
|
}
|
|
2165
2271
|
|
|
2166
2272
|
return operationData;
|
|
2167
2273
|
};
|
|
2168
2274
|
|
|
2275
|
+
function findLoopEndIndex(context) {
|
|
2276
|
+
var list = context.operations.slice(context.currentIndex + 1);
|
|
2277
|
+
var index = list.findIndex(findMatchingOperationIndex.bind({
|
|
2278
|
+
counter: 0,
|
|
2279
|
+
self: 'startLoop',
|
|
2280
|
+
matchingName: 'endLoop'
|
|
2281
|
+
}));
|
|
2282
|
+
var endLoopIndex = index > -1 ? index + (context.currentIndex + 1) : context.operations.length;
|
|
2283
|
+
return endLoopIndex;
|
|
2284
|
+
}
|
|
2285
|
+
|
|
2169
2286
|
/**
|
|
2170
2287
|
* This operation toggles the specfied class name on the specified selected element.
|
|
2171
2288
|
*
|
|
@@ -2197,7 +2314,7 @@ var toggleElement$1 = function toggleElement(operationData) {
|
|
|
2197
2314
|
* @returns
|
|
2198
2315
|
*/
|
|
2199
2316
|
|
|
2200
|
-
var wait$
|
|
2317
|
+
var wait$2 = function wait(operationData) {
|
|
2201
2318
|
var milliseconds = operationData.milliseconds;
|
|
2202
2319
|
return new Promise(function (resolve) {
|
|
2203
2320
|
setTimeout(function () {
|
|
@@ -2206,6 +2323,83 @@ var wait$1 = function wait(operationData) {
|
|
|
2206
2323
|
});
|
|
2207
2324
|
};
|
|
2208
2325
|
|
|
2326
|
+
/**
|
|
2327
|
+
* When the given expression evaluates to false, subsequent operations will be skipped
|
|
2328
|
+
* until an `endWhen` operation is encountered.
|
|
2329
|
+
* Practically, this mean an `if` statement control flow implementation in a list of operations.
|
|
2330
|
+
*
|
|
2331
|
+
* @param operationData
|
|
2332
|
+
* @returns
|
|
2333
|
+
*/
|
|
2334
|
+
|
|
2335
|
+
var when = function when(operationData) {
|
|
2336
|
+
var _parseExpression = parseExpression(operationData.expression, operationData, this),
|
|
2337
|
+
left = _parseExpression[0],
|
|
2338
|
+
operator = _parseExpression[1],
|
|
2339
|
+
right = _parseExpression[2];
|
|
2340
|
+
|
|
2341
|
+
this.whenEvaluation = evaluations[operator](left, right);
|
|
2342
|
+
|
|
2343
|
+
if (!this.whenEvaluation) {
|
|
2344
|
+
this.newIndex = findNextFlowControlIndex(this);
|
|
2345
|
+
}
|
|
2346
|
+
|
|
2347
|
+
delete operationData.expression;
|
|
2348
|
+
return operationData;
|
|
2349
|
+
};
|
|
2350
|
+
|
|
2351
|
+
function parseExpression(expression, operationData, operationContext) {
|
|
2352
|
+
var _expression$split = expression.split(/!=|==|>=|<=|>|</),
|
|
2353
|
+
left = _expression$split[0],
|
|
2354
|
+
right = _expression$split[1];
|
|
2355
|
+
|
|
2356
|
+
var operator = expression.substring(left.length, expression.length - right.length);
|
|
2357
|
+
var leftNr = +left;
|
|
2358
|
+
var rightNr = +right;
|
|
2359
|
+
return [isNaN(leftNr) ? resolveExternalPropertyChain(operationData, operationContext, left) : leftNr, operator, isNaN(rightNr) ? resolveExternalPropertyChain(operationData, operationContext, right) : rightNr];
|
|
2360
|
+
}
|
|
2361
|
+
|
|
2362
|
+
var evaluations = {
|
|
2363
|
+
'==': function _(left, right) {
|
|
2364
|
+
return left === right;
|
|
2365
|
+
},
|
|
2366
|
+
'!=': function _(left, right) {
|
|
2367
|
+
return left !== right;
|
|
2368
|
+
},
|
|
2369
|
+
'>=': function _(left, right) {
|
|
2370
|
+
return left >= right;
|
|
2371
|
+
},
|
|
2372
|
+
'<=': function _(left, right) {
|
|
2373
|
+
return left <= right;
|
|
2374
|
+
},
|
|
2375
|
+
'>': function _(left, right) {
|
|
2376
|
+
return left > right;
|
|
2377
|
+
},
|
|
2378
|
+
'<': function _(left, right) {
|
|
2379
|
+
return left < right;
|
|
2380
|
+
}
|
|
2381
|
+
};
|
|
2382
|
+
|
|
2383
|
+
function findNextFlowControlIndex(context) {
|
|
2384
|
+
var list = context.operations.slice(context.currentIndex + 1);
|
|
2385
|
+
var otherWiseIndex = list.findIndex(findMatchingOperationIndex.bind({
|
|
2386
|
+
counter: 0,
|
|
2387
|
+
self: 'when',
|
|
2388
|
+
matchingName: 'otherwise'
|
|
2389
|
+
}));
|
|
2390
|
+
|
|
2391
|
+
if (otherWiseIndex > -1) {
|
|
2392
|
+
return otherWiseIndex + context.currentIndex + 1;
|
|
2393
|
+
}
|
|
2394
|
+
|
|
2395
|
+
var endWhenIndex = list.findIndex(findMatchingOperationIndex.bind({
|
|
2396
|
+
counter: 0,
|
|
2397
|
+
self: 'when',
|
|
2398
|
+
matchingName: 'endWhen'
|
|
2399
|
+
}));
|
|
2400
|
+
return endWhenIndex > -1 ? endWhenIndex + (context.currentIndex + 1) : context.operations.length;
|
|
2401
|
+
}
|
|
2402
|
+
|
|
2209
2403
|
var ops = {
|
|
2210
2404
|
__proto__: null,
|
|
2211
2405
|
addClass: addClass$1,
|
|
@@ -2220,6 +2414,7 @@ var ops = {
|
|
|
2220
2414
|
customFunction: customFunction$1,
|
|
2221
2415
|
endAction: endAction$1,
|
|
2222
2416
|
endLoop: endLoop$1,
|
|
2417
|
+
endWhen: endWhen$1,
|
|
2223
2418
|
extendController: extendController$1,
|
|
2224
2419
|
getControllerFromElement: getControllerFromElement$1,
|
|
2225
2420
|
getControllerInstance: getControllerInstance$1,
|
|
@@ -2230,6 +2425,7 @@ var ops = {
|
|
|
2230
2425
|
loadJSON: loadJSON$1,
|
|
2231
2426
|
log: log$1,
|
|
2232
2427
|
math: math$1,
|
|
2428
|
+
otherwise: otherwise$1,
|
|
2233
2429
|
removeClass: removeClass$1,
|
|
2234
2430
|
removeControllerFromElement: removeControllerFromElement$1,
|
|
2235
2431
|
removeElement: removeElement$1,
|
|
@@ -2247,7 +2443,8 @@ var ops = {
|
|
|
2247
2443
|
startLoop: startLoop$1,
|
|
2248
2444
|
toggleClass: toggleClass$1,
|
|
2249
2445
|
toggleElement: toggleElement$1,
|
|
2250
|
-
wait: wait$
|
|
2446
|
+
wait: wait$2,
|
|
2447
|
+
when: when
|
|
2251
2448
|
};
|
|
2252
2449
|
|
|
2253
2450
|
var ActionCreatorFactory = /*#__PURE__*/function () {
|
|
@@ -4808,6 +5005,12 @@ function endLoop() {
|
|
|
4808
5005
|
};
|
|
4809
5006
|
}
|
|
4810
5007
|
|
|
5008
|
+
function endWhen() {
|
|
5009
|
+
return {
|
|
5010
|
+
description: 'Ends the current when block'
|
|
5011
|
+
};
|
|
5012
|
+
}
|
|
5013
|
+
|
|
4811
5014
|
function extendController() {
|
|
4812
5015
|
return {
|
|
4813
5016
|
description: 'Extends the current controller',
|
|
@@ -4952,6 +5155,12 @@ function createMathFunctionNames() {
|
|
|
4952
5155
|
});
|
|
4953
5156
|
}
|
|
4954
5157
|
|
|
5158
|
+
function otherwise() {
|
|
5159
|
+
return {
|
|
5160
|
+
description: 'Inverts the control flow for `when` logic'
|
|
5161
|
+
};
|
|
5162
|
+
}
|
|
5163
|
+
|
|
4955
5164
|
function removeClass() {
|
|
4956
5165
|
return {
|
|
4957
5166
|
description: 'Removes the specified class from the selected element',
|
|
@@ -5136,8 +5345,7 @@ function startLoop() {
|
|
|
5136
5345
|
collection: {
|
|
5137
5346
|
type: 'ParameterType:array',
|
|
5138
5347
|
required: true
|
|
5139
|
-
}
|
|
5140
|
-
currentItem: 'ParameterType:object'
|
|
5348
|
+
}
|
|
5141
5349
|
}
|
|
5142
5350
|
};
|
|
5143
5351
|
}
|
|
@@ -5162,7 +5370,7 @@ function toggleElement() {
|
|
|
5162
5370
|
};
|
|
5163
5371
|
}
|
|
5164
5372
|
|
|
5165
|
-
function wait() {
|
|
5373
|
+
function wait$1() {
|
|
5166
5374
|
return {
|
|
5167
5375
|
description: 'Waits the given amount of milliseconds before the action continues',
|
|
5168
5376
|
properties: {
|
|
@@ -5174,6 +5382,18 @@ function wait() {
|
|
|
5174
5382
|
};
|
|
5175
5383
|
}
|
|
5176
5384
|
|
|
5385
|
+
function wait() {
|
|
5386
|
+
return {
|
|
5387
|
+
description: 'Evaluates the given expression, when it evaluates to false context.skipNextOperation will be set to true',
|
|
5388
|
+
properties: {
|
|
5389
|
+
expression: {
|
|
5390
|
+
type: 'ParameterType:expression',
|
|
5391
|
+
required: true
|
|
5392
|
+
}
|
|
5393
|
+
}
|
|
5394
|
+
};
|
|
5395
|
+
}
|
|
5396
|
+
|
|
5177
5397
|
var operationMetadata = {
|
|
5178
5398
|
__proto__: null,
|
|
5179
5399
|
addClass: addClass,
|
|
@@ -5188,6 +5408,7 @@ var operationMetadata = {
|
|
|
5188
5408
|
customFunction: customFunction,
|
|
5189
5409
|
endAction: endAction,
|
|
5190
5410
|
endLoop: endLoop,
|
|
5411
|
+
endWhen: endWhen,
|
|
5191
5412
|
extendController: extendController,
|
|
5192
5413
|
getControllerFromElement: getControllerFromElement,
|
|
5193
5414
|
getControllerInstance: getControllerInstance,
|
|
@@ -5198,6 +5419,7 @@ var operationMetadata = {
|
|
|
5198
5419
|
loadJSON: loadJSON,
|
|
5199
5420
|
log: log,
|
|
5200
5421
|
math: math,
|
|
5422
|
+
otherwise: otherwise,
|
|
5201
5423
|
removeClass: removeClass,
|
|
5202
5424
|
removeControllerFromElement: removeControllerFromElement,
|
|
5203
5425
|
removeElement: removeElement,
|
|
@@ -5215,7 +5437,8 @@ var operationMetadata = {
|
|
|
5215
5437
|
startLoop: startLoop,
|
|
5216
5438
|
toggleClass: toggleClass,
|
|
5217
5439
|
toggleElement: toggleElement,
|
|
5218
|
-
wait: wait
|
|
5440
|
+
wait: wait$1,
|
|
5441
|
+
when: wait
|
|
5219
5442
|
};
|
|
5220
5443
|
|
|
5221
5444
|
var OperationNamesProvider = /*#__PURE__*/function () {
|
|
@@ -6332,6 +6555,11 @@ var evtb = {
|
|
|
6332
6555
|
RequestVideoUriInterceptor: RequestVideoUriInterceptor
|
|
6333
6556
|
};
|
|
6334
6557
|
|
|
6558
|
+
function setGlobal(name, value) {
|
|
6559
|
+
var cache = getGlobals();
|
|
6560
|
+
cache[name] = value;
|
|
6561
|
+
}
|
|
6562
|
+
|
|
6335
6563
|
var LanguageManager = /*#__PURE__*/function () {
|
|
6336
6564
|
function LanguageManager(_currentLanguage, labels, _eventbus) {
|
|
6337
6565
|
this._currentLanguage = void 0;
|
|
@@ -6345,6 +6573,8 @@ var LanguageManager = /*#__PURE__*/function () {
|
|
|
6345
6573
|
throw new Error('language ctor arg cannot have zero length');
|
|
6346
6574
|
}
|
|
6347
6575
|
|
|
6576
|
+
setGlobal('defaultLanguage', _currentLanguage);
|
|
6577
|
+
|
|
6348
6578
|
this._setRootElementLang(_currentLanguage);
|
|
6349
6579
|
|
|
6350
6580
|
this._labelLookup = this._createLabelLookup(labels);
|
|
@@ -6675,5 +6905,5 @@ var EligiusResourceImporter = /*#__PURE__*/function () {
|
|
|
6675
6905
|
return EligiusResourceImporter;
|
|
6676
6906
|
}();
|
|
6677
6907
|
|
|
6678
|
-
export { Action, ActionCreator, ActionCreatorFactory, ActionEditor, ActionRegistryEventbusListener, ConfigurationFactory, ConfigurationResolver, ControllerNamesProvider, DEV_TOOLS_KEY, DevToolEventListener, Diagnostics, EligiusEngine, EligiusResourceImporter, EndableAction, EndableActionCreator, EndableActionEditor, EngineFactory, EventListenerController, Eventbus, JwPlayerTimelineProvider, LabelController, LanguageManager, LottieController, NavigationController, OperationEditor, OperationMetadataProvider, OperationNamesProvider, ProgressbarController, RequestAnimationFrameTimelineProvider, RequestVideoUriInterceptor, RoutingController, SubtitlesController, TimeLineEventNamesProvider, TimelineAction, TimelineActionCreator, TimelineActionEditor, TimelineEventNames, TimelineProviderSettingsEditor, TimelineProvidersSettingsEditor, addClass$1 as addClass, addControllerToElement$1 as addControllerToElement, animate$1 as animate, animateWithClass$1 as animateWithClass, broadcastEvent$1 as broadcastEvent, calc$1 as calc, clearElement$1 as clearElement, clearOperationData$1 as clearOperationData, createElement$1 as createElement, customFunction$1 as customFunction, endAction$1 as endAction, endLoop$1 as endLoop, extendController$1 as extendController, generateImporterSourceCode, getControllerFromElement$1 as getControllerFromElement, getControllerInstance$1 as getControllerInstance, getElementDimensions$1 as getElementDimensions, getImport$1 as getImport, getQueryParams$1 as getQueryParams, invokeObjectMethod$1 as invokeObjectMethod, loadJSON$1 as loadJSON, log$1 as log, math$1 as math, operationMetadata as metadata, removeClass$1 as removeClass, removeControllerFromElement$1 as removeControllerFromElement, removeElement$1 as removeElement, removePropertiesFromOperationData$1 as removePropertiesFromOperationData, reparentElement$1 as reparentElement, requestAction$1 as requestAction, resizeAction$1 as resizeAction, selectElement$1 as selectElement, setElementAttributes$1 as setElementAttributes, setElementContent$1 as setElementContent, setGlobalData$1 as setGlobalData, setOperationData$1 as setOperationData, setStyle$1 as setStyle, startAction$1 as startAction, startLoop$1 as startLoop, toggleClass$1 as toggleClass, toggleElement$1 as toggleElement, wait$
|
|
6908
|
+
export { Action, ActionCreator, ActionCreatorFactory, ActionEditor, ActionRegistryEventbusListener, ConfigurationFactory, ConfigurationResolver, ControllerNamesProvider, DEV_TOOLS_KEY, DevToolEventListener, Diagnostics, EligiusEngine, EligiusResourceImporter, EndableAction, EndableActionCreator, EndableActionEditor, EngineFactory, EventListenerController, Eventbus, JwPlayerTimelineProvider, LabelController, LanguageManager, LottieController, NavigationController, OperationEditor, OperationMetadataProvider, OperationNamesProvider, ProgressbarController, RequestAnimationFrameTimelineProvider, RequestVideoUriInterceptor, RoutingController, SubtitlesController, TimeLineEventNamesProvider, TimelineAction, TimelineActionCreator, TimelineActionEditor, TimelineEventNames, TimelineProviderSettingsEditor, TimelineProvidersSettingsEditor, addClass$1 as addClass, addControllerToElement$1 as addControllerToElement, animate$1 as animate, animateWithClass$1 as animateWithClass, broadcastEvent$1 as broadcastEvent, calc$1 as calc, clearElement$1 as clearElement, clearOperationData$1 as clearOperationData, createElement$1 as createElement, customFunction$1 as customFunction, endAction$1 as endAction, endLoop$1 as endLoop, endWhen$1 as endWhen, extendController$1 as extendController, generateImporterSourceCode, getControllerFromElement$1 as getControllerFromElement, getControllerInstance$1 as getControllerInstance, getElementDimensions$1 as getElementDimensions, getImport$1 as getImport, getQueryParams$1 as getQueryParams, invokeObjectMethod$1 as invokeObjectMethod, loadJSON$1 as loadJSON, log$1 as log, math$1 as math, operationMetadata as metadata, otherwise$1 as otherwise, removeClass$1 as removeClass, removeControllerFromElement$1 as removeControllerFromElement, removeElement$1 as removeElement, removePropertiesFromOperationData$1 as removePropertiesFromOperationData, reparentElement$1 as reparentElement, requestAction$1 as requestAction, resizeAction$1 as resizeAction, selectElement$1 as selectElement, setElementAttributes$1 as setElementAttributes, setElementContent$1 as setElementContent, setGlobalData$1 as setGlobalData, setOperationData$1 as setOperationData, setStyle$1 as setStyle, startAction$1 as startAction, startLoop$1 as startLoop, toggleClass$1 as toggleClass, toggleElement$1 as toggleElement, wait$2 as wait, when };
|
|
6679
6909
|
//# sourceMappingURL=eligius.esm.js.map
|