eligius 1.0.17 → 1.0.19
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 +203 -71
- 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 +203 -71
- package/dist/eligius.esm.js.map +1 -1
- package/dist/operation/end-loop.d.ts +1 -2
- 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/start-loop.d.ts +1 -2
- package/dist/operation/types.d.ts +44 -2
- package/dist/operation/when.d.ts +1 -1
- package/package.json +2 -2
package/dist/action/action.d.ts
CHANGED
|
@@ -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
|
|
12
|
-
|
|
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
|
|
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
|
|
11
|
-
end(initOperationData: TOperationData): Promise<TOperationData
|
|
10
|
+
start(initOperationData?: TOperationData): Promise<TOperationData>;
|
|
11
|
+
end(initOperationData: TOperationData): Promise<TOperationData>;
|
|
12
12
|
}
|
package/dist/action/types.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
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
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
};
|
|
547
|
+
|
|
548
|
+
this._initializeContextStack();
|
|
549
|
+
|
|
550
550
|
var result = new Promise(function (resolve, reject) {
|
|
551
|
-
_this.executeOperation(_this.startOperations, 0, resolve, reject, initOperationData
|
|
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,47 @@ var Action = /*#__PURE__*/function () {
|
|
|
566
566
|
});
|
|
567
567
|
};
|
|
568
568
|
|
|
569
|
-
_proto.
|
|
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
|
+
get currentIndex() {
|
|
580
|
+
return parentContext.currentIndex;
|
|
581
|
+
},
|
|
582
|
+
|
|
583
|
+
set currentIndex(value) {
|
|
584
|
+
parentContext.currentIndex = value;
|
|
585
|
+
},
|
|
586
|
+
|
|
587
|
+
eventbus: parentContext.eventbus,
|
|
588
|
+
operations: parentContext.operations,
|
|
589
|
+
parent: parentContext
|
|
590
|
+
};
|
|
591
|
+
|
|
592
|
+
this._contextStack.push(newContext);
|
|
593
|
+
|
|
594
|
+
return newContext;
|
|
595
|
+
};
|
|
596
|
+
|
|
597
|
+
_proto._popContext = function _popContext() {
|
|
598
|
+
this._contextStack.pop();
|
|
599
|
+
};
|
|
600
|
+
|
|
601
|
+
_proto.executeOperation = function executeOperation(operations, idx, resolve, reject, previousOperationData) {
|
|
570
602
|
var _this2 = this;
|
|
571
603
|
|
|
572
604
|
if (previousOperationData === void 0) {
|
|
573
605
|
previousOperationData = {};
|
|
574
606
|
}
|
|
575
607
|
|
|
608
|
+
var context = this._contextStack[this._contextStack.length - 1];
|
|
609
|
+
|
|
576
610
|
if (context.newIndex !== undefined) {
|
|
577
611
|
idx = context.newIndex;
|
|
578
612
|
delete context.newIndex;
|
|
@@ -580,18 +614,20 @@ var Action = /*#__PURE__*/function () {
|
|
|
580
614
|
|
|
581
615
|
context.currentIndex = idx;
|
|
582
616
|
|
|
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
617
|
if (idx < operations.length) {
|
|
618
|
+
var _operationInfo$operat;
|
|
619
|
+
|
|
592
620
|
var operationInfo = operations[idx];
|
|
593
|
-
var copy =
|
|
621
|
+
var copy = deepCopy((_operationInfo$operat = operationInfo.operationData) != null ? _operationInfo$operat : {});
|
|
594
622
|
var mergedOperationData = Object.assign(previousOperationData, copy);
|
|
623
|
+
|
|
624
|
+
if (operationInfo.systemName === 'when') {
|
|
625
|
+
context = this._pushContext(context);
|
|
626
|
+
} else if (operationInfo.systemName === 'startLoop' && context.owner !== operationInfo) {
|
|
627
|
+
context = this._pushContext(context);
|
|
628
|
+
context.owner = operationInfo;
|
|
629
|
+
}
|
|
630
|
+
|
|
595
631
|
Diagnostics.active && Diagnostics.send('eligius-diagnostics-operation', {
|
|
596
632
|
systemName: operationInfo.systemName,
|
|
597
633
|
operationData: mergedOperationData,
|
|
@@ -601,14 +637,18 @@ var Action = /*#__PURE__*/function () {
|
|
|
601
637
|
});
|
|
602
638
|
var operationResult = operationInfo.instance.call(context, mergedOperationData);
|
|
603
639
|
|
|
640
|
+
if (operationInfo.systemName === 'endWhen' || operationInfo.systemName === 'endLoop' && context.newIndex === undefined) {
|
|
641
|
+
this._popContext();
|
|
642
|
+
}
|
|
643
|
+
|
|
604
644
|
if (isPromise(operationResult)) {
|
|
605
645
|
operationResult.then(function (promisedOperationResult) {
|
|
606
|
-
return _this2.executeOperation(operations, ++idx, resolve, reject, promisedOperationResult
|
|
646
|
+
return _this2.executeOperation(operations, ++idx, resolve, reject, promisedOperationResult);
|
|
607
647
|
})["catch"](function (error) {
|
|
608
648
|
reject(error);
|
|
609
649
|
});
|
|
610
650
|
} else {
|
|
611
|
-
this.executeOperation(operations, ++idx, resolve, reject, operationResult
|
|
651
|
+
this.executeOperation(operations, ++idx, resolve, reject, operationResult);
|
|
612
652
|
}
|
|
613
653
|
} else {
|
|
614
654
|
resolve(previousOperationData);
|
|
@@ -639,16 +679,18 @@ var EndableAction = /*#__PURE__*/function (_Action) {
|
|
|
639
679
|
Diagnostics.active && Diagnostics.send('eligius-diagnostics-action', ((_this$name = this.name) != null ? _this$name : 'Action') + " begins executing end operations");
|
|
640
680
|
|
|
641
681
|
if (!this.endOperations.length) {
|
|
642
|
-
return Promise.resolve(initOperationData);
|
|
682
|
+
return Promise.resolve(initOperationData != null ? initOperationData : {});
|
|
643
683
|
}
|
|
644
684
|
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
eventbus: this.eventbus
|
|
648
|
-
};
|
|
685
|
+
this._initializeContextStack();
|
|
686
|
+
|
|
649
687
|
var result = new Promise(function (resolve, reject) {
|
|
650
|
-
_this2.executeOperation(_this2.endOperations, 0, resolve, reject, initOperationData
|
|
688
|
+
_this2.executeOperation(_this2.endOperations, 0, resolve, reject, initOperationData);
|
|
651
689
|
})["catch"](function (e) {
|
|
690
|
+
Diagnostics.active && Diagnostics.send('eligius-diagnostics-action-error', {
|
|
691
|
+
name: _this2.name,
|
|
692
|
+
error: e
|
|
693
|
+
});
|
|
652
694
|
console.error("Error in action end '" + _this2.name + "'");
|
|
653
695
|
throw e;
|
|
654
696
|
});
|
|
@@ -684,7 +726,7 @@ var TimelineAction = /*#__PURE__*/function (_EndableAction) {
|
|
|
684
726
|
return _EndableAction.prototype.start.call(this, initOperationData);
|
|
685
727
|
}
|
|
686
728
|
|
|
687
|
-
return Promise.resolve(
|
|
729
|
+
return Promise.resolve({});
|
|
688
730
|
};
|
|
689
731
|
|
|
690
732
|
_proto.end = function end(initOperationData) {
|
|
@@ -1114,7 +1156,7 @@ var setGlobals = /*#__PURE__*/_setGlobals.bind(null, cache$1);
|
|
|
1114
1156
|
* @returns
|
|
1115
1157
|
*/
|
|
1116
1158
|
|
|
1117
|
-
function
|
|
1159
|
+
function resolveExternalPropertyChain(sourceObject, operationContext, propertyChainOrRegularObject) {
|
|
1118
1160
|
if (isString(propertyChainOrRegularObject)) {
|
|
1119
1161
|
var _propNames$shift;
|
|
1120
1162
|
|
|
@@ -1127,19 +1169,22 @@ function resolveOperationOrGlobalDataPropertyChain(sourceObject, propertyChainOr
|
|
|
1127
1169
|
|
|
1128
1170
|
case 'globaldata':
|
|
1129
1171
|
return getPropertyChainValue(propNames, getGlobals());
|
|
1172
|
+
|
|
1173
|
+
case 'context':
|
|
1174
|
+
return getPropertyChainValue(propNames, operationContext);
|
|
1130
1175
|
}
|
|
1131
1176
|
}
|
|
1132
1177
|
|
|
1133
1178
|
return propertyChainOrRegularObject;
|
|
1134
1179
|
}
|
|
1135
1180
|
|
|
1136
|
-
function resolveEventArguments(operationData, eventArgs) {
|
|
1181
|
+
function resolveEventArguments(operationData, operationContext, eventArgs) {
|
|
1137
1182
|
if (!eventArgs) {
|
|
1138
1183
|
return;
|
|
1139
1184
|
}
|
|
1140
1185
|
|
|
1141
|
-
var
|
|
1142
|
-
return eventArgs.map(
|
|
1186
|
+
var resolve = resolveExternalPropertyChain.bind(null, operationData, operationContext);
|
|
1187
|
+
return eventArgs.map(resolve);
|
|
1143
1188
|
}
|
|
1144
1189
|
|
|
1145
1190
|
/**
|
|
@@ -1153,7 +1198,7 @@ var broadcastEvent$1 = function broadcastEvent(operationData) {
|
|
|
1153
1198
|
var eventArgs = operationData.eventArgs,
|
|
1154
1199
|
eventTopic = operationData.eventTopic,
|
|
1155
1200
|
eventName = operationData.eventName;
|
|
1156
|
-
var eventArguments = resolveEventArguments(operationData, eventArgs);
|
|
1201
|
+
var eventArguments = resolveEventArguments(operationData, this, eventArgs);
|
|
1157
1202
|
|
|
1158
1203
|
if (eventTopic) {
|
|
1159
1204
|
this.eventbus.broadcastForTopic(eventName, eventTopic, eventArguments);
|
|
@@ -1166,9 +1211,9 @@ var broadcastEvent$1 = function broadcastEvent(operationData) {
|
|
|
1166
1211
|
};
|
|
1167
1212
|
|
|
1168
1213
|
var cache = [];
|
|
1169
|
-
function resolvePropertyValues(operationData, properties) {
|
|
1214
|
+
function resolvePropertyValues(operationData, operationContext, properties) {
|
|
1170
1215
|
var copy = properties !== operationData ? deepCopy(properties) : properties;
|
|
1171
|
-
var resolvePropertyChain =
|
|
1216
|
+
var resolvePropertyChain = resolveExternalPropertyChain.bind(null, operationData, operationContext);
|
|
1172
1217
|
resolveProperties(properties, copy, resolvePropertyChain);
|
|
1173
1218
|
return copy;
|
|
1174
1219
|
}
|
|
@@ -1237,7 +1282,7 @@ var calcFunctions = {
|
|
|
1237
1282
|
*/
|
|
1238
1283
|
|
|
1239
1284
|
var calc$1 = function calc(operationData) {
|
|
1240
|
-
operationData = resolvePropertyValues(operationData, operationData);
|
|
1285
|
+
operationData = resolvePropertyValues(operationData, this, operationData);
|
|
1241
1286
|
var _operationData = operationData,
|
|
1242
1287
|
left = _operationData.left,
|
|
1243
1288
|
right = _operationData.right,
|
|
@@ -1283,7 +1328,7 @@ var clearOperationData$1 = function clearOperationData(operationData) {
|
|
|
1283
1328
|
*/
|
|
1284
1329
|
|
|
1285
1330
|
var createElement$1 = function createElement(operationData) {
|
|
1286
|
-
operationData = resolvePropertyValues(operationData, operationData);
|
|
1331
|
+
operationData = resolvePropertyValues(operationData, this, operationData);
|
|
1287
1332
|
var _operationData = operationData,
|
|
1288
1333
|
elementName = _operationData.elementName,
|
|
1289
1334
|
attributes = _operationData.attributes,
|
|
@@ -1400,27 +1445,17 @@ var endAction$1 = function endAction(operationData) {
|
|
|
1400
1445
|
* @returns
|
|
1401
1446
|
*/
|
|
1402
1447
|
var endLoop$1 = function endLoop(operationData) {
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
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;
|
|
1448
|
+
if (this.loopIndex !== undefined && this.loopLength !== undefined && this.loopIndex < this.loopLength) {
|
|
1449
|
+
this.loopIndex = this.loopIndex + 1;
|
|
1450
|
+
this.newIndex = this.loopStartIndex;
|
|
1451
|
+
delete this.currentItem;
|
|
1417
1452
|
}
|
|
1418
1453
|
|
|
1419
1454
|
return operationData;
|
|
1420
1455
|
};
|
|
1421
1456
|
|
|
1422
1457
|
var endWhen$1 = function endWhen(operationData) {
|
|
1423
|
-
delete this.
|
|
1458
|
+
delete this.whenEvaluation;
|
|
1424
1459
|
return operationData;
|
|
1425
1460
|
};
|
|
1426
1461
|
|
|
@@ -1822,7 +1857,7 @@ var log$1 = function log(operationData) {
|
|
|
1822
1857
|
*/
|
|
1823
1858
|
|
|
1824
1859
|
var math$1 = function math(operationData) {
|
|
1825
|
-
operationData = resolvePropertyValues(operationData, operationData);
|
|
1860
|
+
operationData = resolvePropertyValues(operationData, this, operationData);
|
|
1826
1861
|
operationData.args = resolveMathConstants(operationData.args);
|
|
1827
1862
|
var _operationData = operationData,
|
|
1828
1863
|
args = _operationData.args,
|
|
@@ -1845,14 +1880,70 @@ function isMathProperty(value) {
|
|
|
1845
1880
|
return isString(value) && value in Math && !isFunction(Math[value]);
|
|
1846
1881
|
}
|
|
1847
1882
|
|
|
1883
|
+
/**
|
|
1884
|
+
* This function can be used to find the index of a matching operation within a list of operations.
|
|
1885
|
+
*
|
|
1886
|
+
* Given the array of operations:
|
|
1887
|
+
* ```ts
|
|
1888
|
+
* [
|
|
1889
|
+
* {systemName:'name1'}, // index 0
|
|
1890
|
+
* {systemName:'startLoop'}, // index 1
|
|
1891
|
+
* {systemName:'name2'}, // index 2
|
|
1892
|
+
* {systemName:'startLoop'} // index 3
|
|
1893
|
+
* {systemName:'name3'} // index 4
|
|
1894
|
+
* {systemName:'endLoop'} // index 5
|
|
1895
|
+
* {systemName:'endLoop'} // index 6
|
|
1896
|
+
* {systemName:'name3'} // index 7
|
|
1897
|
+
* ]
|
|
1898
|
+
* ```
|
|
1899
|
+
*
|
|
1900
|
+
* Given the startLoop instance at index 1, this function will return index 6. Given the startLoop at index 3, it will yield index 5.
|
|
1901
|
+
*
|
|
1902
|
+
* Returns true when the given operation.systemName equals the specified matchingName and the current counter value is zero.
|
|
1903
|
+
*
|
|
1904
|
+
* If the matchingName matches operation.systemName but the counter is greater than zero, the counter is decremented.
|
|
1905
|
+
*
|
|
1906
|
+
* If the operation.systemName equal self (the name of the operation that requires to find its match), then counter is incremented.
|
|
1907
|
+
*
|
|
1908
|
+
* @param this
|
|
1909
|
+
* @param operation
|
|
1910
|
+
* @returns
|
|
1911
|
+
*/
|
|
1912
|
+
function findMatchingOperationIndex(operation) {
|
|
1913
|
+
if (operation.systemName === this.self) {
|
|
1914
|
+
this.counter = this.counter + 1;
|
|
1915
|
+
return false;
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1918
|
+
if (operation.systemName === this.matchingName && this.counter === 0) {
|
|
1919
|
+
return true;
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1922
|
+
if (operation.systemName === this.matchingName && this.counter > 0) {
|
|
1923
|
+
this.counter = this.counter - 1;
|
|
1924
|
+
}
|
|
1925
|
+
|
|
1926
|
+
return false;
|
|
1927
|
+
}
|
|
1928
|
+
|
|
1848
1929
|
var otherwise$1 = function otherwise(operationData) {
|
|
1849
|
-
if (this.
|
|
1850
|
-
this.
|
|
1930
|
+
if (this.whenEvaluation) {
|
|
1931
|
+
this.newIndex = findEndWhenIndex(this);
|
|
1851
1932
|
}
|
|
1852
1933
|
|
|
1853
1934
|
return operationData;
|
|
1854
1935
|
};
|
|
1855
1936
|
|
|
1937
|
+
function findEndWhenIndex(context) {
|
|
1938
|
+
var list = context.operations.slice(context.currentIndex);
|
|
1939
|
+
var endWhenIndex = list.findIndex(findMatchingOperationIndex.bind({
|
|
1940
|
+
counter: 0,
|
|
1941
|
+
self: 'when',
|
|
1942
|
+
matchingName: 'endWhen'
|
|
1943
|
+
}));
|
|
1944
|
+
return endWhenIndex > -1 ? endWhenIndex + (context.currentIndex + 1) : context.operations.length;
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1856
1947
|
/**
|
|
1857
1948
|
* This operation removes the spcified class name from the specified selected element.
|
|
1858
1949
|
*
|
|
@@ -2105,7 +2196,7 @@ var setOperationData$1 = function setOperationData(operationData) {
|
|
|
2105
2196
|
properties = _operationData.properties;
|
|
2106
2197
|
delete operationData.properties;
|
|
2107
2198
|
delete operationData.override;
|
|
2108
|
-
var resolvedProperties = resolvePropertyValues(operationData, properties);
|
|
2199
|
+
var resolvedProperties = resolvePropertyValues(operationData, this, properties);
|
|
2109
2200
|
|
|
2110
2201
|
if (override) {
|
|
2111
2202
|
operationData = resolvedProperties;
|
|
@@ -2125,7 +2216,7 @@ var setOperationData$1 = function setOperationData(operationData) {
|
|
|
2125
2216
|
*/
|
|
2126
2217
|
|
|
2127
2218
|
var setStyle$1 = function setStyle(operationData) {
|
|
2128
|
-
var properties = resolvePropertyValues(operationData, operationData.properties);
|
|
2219
|
+
var properties = resolvePropertyValues(operationData, this, operationData.properties);
|
|
2129
2220
|
operationData.selectedElement.css(properties);
|
|
2130
2221
|
return operationData;
|
|
2131
2222
|
};
|
|
@@ -2161,36 +2252,54 @@ var startAction$1 = function startAction(operationData) {
|
|
|
2161
2252
|
* This operation starts a loop using the given collection.
|
|
2162
2253
|
*
|
|
2163
2254
|
* Each iteration the current item from the specified collection is
|
|
2164
|
-
* assigned to the `currentItem` property on the
|
|
2255
|
+
* assigned to the `currentItem` property on the operation context.
|
|
2165
2256
|
*
|
|
2166
2257
|
* @param operationData
|
|
2167
2258
|
* @returns
|
|
2168
2259
|
*/
|
|
2260
|
+
|
|
2169
2261
|
var startLoop$1 = function startLoop(operationData) {
|
|
2170
|
-
var context = this;
|
|
2171
2262
|
var collection = operationData.collection;
|
|
2172
2263
|
|
|
2173
2264
|
if (collection !== null && !Array.isArray(collection)) {
|
|
2174
2265
|
throw new Error('Expected collection to be array type, string value was probably not resolved correctly');
|
|
2175
|
-
}
|
|
2266
|
+
} // First iteration of the loop
|
|
2267
|
+
|
|
2268
|
+
|
|
2269
|
+
if (this.loopIndex === undefined) {
|
|
2270
|
+
this.loopEndIndex = findLoopEndIndex(this);
|
|
2176
2271
|
|
|
2177
|
-
if (context.loopIndex === undefined) {
|
|
2178
2272
|
if (collection != null && collection.length) {
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2273
|
+
this.loopIndex = 0;
|
|
2274
|
+
this.loopLength = collection.length - 1;
|
|
2275
|
+
this.loopStartIndex = this.currentIndex;
|
|
2182
2276
|
} else {
|
|
2183
|
-
|
|
2277
|
+
this.newIndex = this.loopEndIndex;
|
|
2278
|
+
delete this.loopIndex;
|
|
2279
|
+
delete this.loopLength;
|
|
2280
|
+
delete this.loopStartIndex;
|
|
2281
|
+
delete this.loopEndIndex;
|
|
2184
2282
|
}
|
|
2185
2283
|
}
|
|
2186
2284
|
|
|
2187
|
-
if (collection != null && collection.length &&
|
|
2188
|
-
|
|
2285
|
+
if (collection != null && collection.length && this.loopIndex !== undefined) {
|
|
2286
|
+
this.currentItem = collection[this.loopIndex];
|
|
2189
2287
|
}
|
|
2190
2288
|
|
|
2191
2289
|
return operationData;
|
|
2192
2290
|
};
|
|
2193
2291
|
|
|
2292
|
+
function findLoopEndIndex(context) {
|
|
2293
|
+
var list = context.operations.slice(context.currentIndex + 1);
|
|
2294
|
+
var index = list.findIndex(findMatchingOperationIndex.bind({
|
|
2295
|
+
counter: 0,
|
|
2296
|
+
self: 'startLoop',
|
|
2297
|
+
matchingName: 'endLoop'
|
|
2298
|
+
}));
|
|
2299
|
+
var endLoopIndex = index > -1 ? index + (context.currentIndex + 1) : context.operations.length;
|
|
2300
|
+
return endLoopIndex;
|
|
2301
|
+
}
|
|
2302
|
+
|
|
2194
2303
|
/**
|
|
2195
2304
|
* This operation toggles the specfied class name on the specified selected element.
|
|
2196
2305
|
*
|
|
@@ -2241,18 +2350,22 @@ var wait$2 = function wait(operationData) {
|
|
|
2241
2350
|
*/
|
|
2242
2351
|
|
|
2243
2352
|
var when = function when(operationData) {
|
|
2244
|
-
var _parseExpression = parseExpression(operationData.expression, operationData),
|
|
2353
|
+
var _parseExpression = parseExpression(operationData.expression, operationData, this),
|
|
2245
2354
|
left = _parseExpression[0],
|
|
2246
2355
|
operator = _parseExpression[1],
|
|
2247
2356
|
right = _parseExpression[2];
|
|
2248
2357
|
|
|
2249
|
-
|
|
2250
|
-
|
|
2358
|
+
this.whenEvaluation = evaluations[operator](left, right);
|
|
2359
|
+
|
|
2360
|
+
if (!this.whenEvaluation) {
|
|
2361
|
+
this.newIndex = findNextFlowControlIndex(this);
|
|
2362
|
+
}
|
|
2363
|
+
|
|
2251
2364
|
delete operationData.expression;
|
|
2252
2365
|
return operationData;
|
|
2253
2366
|
};
|
|
2254
2367
|
|
|
2255
|
-
function parseExpression(expression, operationData) {
|
|
2368
|
+
function parseExpression(expression, operationData, operationContext) {
|
|
2256
2369
|
var _expression$split = expression.split(/!=|==|>=|<=|>|</),
|
|
2257
2370
|
left = _expression$split[0],
|
|
2258
2371
|
right = _expression$split[1];
|
|
@@ -2260,7 +2373,7 @@ function parseExpression(expression, operationData) {
|
|
|
2260
2373
|
var operator = expression.substring(left.length, expression.length - right.length);
|
|
2261
2374
|
var leftNr = +left;
|
|
2262
2375
|
var rightNr = +right;
|
|
2263
|
-
return [isNaN(leftNr) ?
|
|
2376
|
+
return [isNaN(leftNr) ? resolveExternalPropertyChain(operationData, operationContext, left) : leftNr, operator, isNaN(rightNr) ? resolveExternalPropertyChain(operationData, operationContext, right) : rightNr];
|
|
2264
2377
|
}
|
|
2265
2378
|
|
|
2266
2379
|
var evaluations = {
|
|
@@ -2284,6 +2397,26 @@ var evaluations = {
|
|
|
2284
2397
|
}
|
|
2285
2398
|
};
|
|
2286
2399
|
|
|
2400
|
+
function findNextFlowControlIndex(context) {
|
|
2401
|
+
var list = context.operations.slice(context.currentIndex + 1);
|
|
2402
|
+
var otherWiseIndex = list.findIndex(findMatchingOperationIndex.bind({
|
|
2403
|
+
counter: 0,
|
|
2404
|
+
self: 'when',
|
|
2405
|
+
matchingName: 'otherwise'
|
|
2406
|
+
}));
|
|
2407
|
+
|
|
2408
|
+
if (otherWiseIndex > -1) {
|
|
2409
|
+
return otherWiseIndex + context.currentIndex + 1;
|
|
2410
|
+
}
|
|
2411
|
+
|
|
2412
|
+
var endWhenIndex = list.findIndex(findMatchingOperationIndex.bind({
|
|
2413
|
+
counter: 0,
|
|
2414
|
+
self: 'when',
|
|
2415
|
+
matchingName: 'endWhen'
|
|
2416
|
+
}));
|
|
2417
|
+
return endWhenIndex > -1 ? endWhenIndex + (context.currentIndex + 1) : context.operations.length;
|
|
2418
|
+
}
|
|
2419
|
+
|
|
2287
2420
|
var ops = {
|
|
2288
2421
|
__proto__: null,
|
|
2289
2422
|
addClass: addClass$1,
|
|
@@ -5229,8 +5362,7 @@ function startLoop() {
|
|
|
5229
5362
|
collection: {
|
|
5230
5363
|
type: 'ParameterType:array',
|
|
5231
5364
|
required: true
|
|
5232
|
-
}
|
|
5233
|
-
currentItem: 'ParameterType:object'
|
|
5365
|
+
}
|
|
5234
5366
|
}
|
|
5235
5367
|
};
|
|
5236
5368
|
}
|