eligius 1.0.15 → 1.0.17
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/configuration/api/action-creator-factory.d.ts +1 -1
- package/dist/configuration/api/configuration-factory.d.ts +8 -2
- package/dist/eligius.cjs.development.js +134 -14
- 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 +131 -14
- package/dist/eligius.esm.js.map +1 -1
- package/dist/operation/add-controller-to-element.d.ts +4 -4
- package/dist/operation/end-when.d.ts +2 -0
- package/dist/operation/helper/resolve-operation-or-global-data-property-chain.d.ts +1 -1
- 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/wait.d.ts +3 -3
- package/dist/operation/when.d.ts +17 -0
- package/package.json +7 -5
|
@@ -4,7 +4,7 @@ import { ConfigurationFactory } from './configuration-factory';
|
|
|
4
4
|
export declare class ActionCreatorFactory {
|
|
5
5
|
private readonly configurationfactory;
|
|
6
6
|
constructor(configurationfactory: ConfigurationFactory);
|
|
7
|
-
createAction(name: string):
|
|
7
|
+
createAction(name: string): EndableActionCreator;
|
|
8
8
|
createInitAction(name: string): EndableActionCreator;
|
|
9
9
|
createEventAction(name: string): ActionCreator;
|
|
10
10
|
createTimelineAction(uri: string, name: string): TimelineActionCreator;
|
|
@@ -4,10 +4,15 @@ import { ActionCreatorFactory } from './action-creator-factory';
|
|
|
4
4
|
import { ActionEditor, EndableActionEditor, TimelineActionEditor } from './action-editor';
|
|
5
5
|
import { TimelineProvidersSettingsEditor } from './timeline-provider-settings-editor';
|
|
6
6
|
export declare type TEngineConfigurationLists = Pick<IEngineConfiguration, 'availableLanguages' | 'initActions' | 'actions' | 'eventActions' | 'timelines' | 'labels'>;
|
|
7
|
+
declare type ConfigurationFactoryExtension = (this: ConfigurationFactory, ...rest: any[]) => void;
|
|
7
8
|
export declare class ConfigurationFactory {
|
|
8
9
|
actionCreatorFactory: ActionCreatorFactory;
|
|
9
10
|
configuration: IEngineConfiguration;
|
|
10
11
|
constructor(config?: IEngineConfiguration);
|
|
12
|
+
static extend<T extends ConfigurationFactory, K extends string | number | symbol, C extends ConfigurationFactoryExtension>(factory: T, extensionMethodName: K, extensionMethod: C): T & { [k in K]: C; };
|
|
13
|
+
static extendMultiple<T extends ConfigurationFactory, C extends ConfigurationFactoryExtension, D extends {
|
|
14
|
+
[name: string]: C;
|
|
15
|
+
}>(factory: T, extensions: D): T & D;
|
|
11
16
|
init(defaultLanguage: string): this;
|
|
12
17
|
setLayoutTemplate(layoutTemplate: string): this;
|
|
13
18
|
setDefaultLanguage(defaultLanguage: string): this;
|
|
@@ -21,7 +26,7 @@ export declare class ConfigurationFactory {
|
|
|
21
26
|
addInitAction(action: IActionConfiguration): void;
|
|
22
27
|
addEventAction(action: IActionConfiguration): void;
|
|
23
28
|
addTimelineAction(uri: string, action: ITimelineActionConfiguration): void;
|
|
24
|
-
createAction(name: string): import("./action-creator-factory").
|
|
29
|
+
createAction(name: string): import("./action-creator-factory").EndableActionCreator<import("../types").IEndableActionConfiguration>;
|
|
25
30
|
createInitAction(name: string): import("./action-creator-factory").EndableActionCreator<import("../types").IEndableActionConfiguration>;
|
|
26
31
|
createEventAction(name: string): import("./action-creator-factory").ActionCreator<IActionConfiguration>;
|
|
27
32
|
createTimelineAction(uri: string, name: string): import("./action-creator-factory").TimelineActionCreator;
|
|
@@ -31,8 +36,9 @@ export declare class ConfigurationFactory {
|
|
|
31
36
|
_initializeLabel(id: string, labels: ILanguageLabel[]): ILanguageLabel;
|
|
32
37
|
_getLabelTranslation(labelTranslations: ILabel[], languageCode: string): ILabel;
|
|
33
38
|
addLabel(id: string, code: string, translation: string): this;
|
|
34
|
-
editAction(id: string):
|
|
39
|
+
editAction(id: string): EndableActionEditor<import("../types").IEndableActionConfiguration>;
|
|
35
40
|
editEventAction(id: string): ActionEditor<import("../types").IEventActionConfiguration>;
|
|
36
41
|
editInitAction(id: string): EndableActionEditor<import("../types").IEndableActionConfiguration>;
|
|
37
42
|
editTimelineAction(uri: string, id: string): TimelineActionEditor;
|
|
38
43
|
}
|
|
44
|
+
export {};
|
|
@@ -1121,12 +1121,12 @@ function resolveOperationOrGlobalDataPropertyChain(sourceObject, propertyChainOr
|
|
|
1121
1121
|
var propNames = propertyChainOrRegularObject.split('.');
|
|
1122
1122
|
var prefix = (_propNames$shift = propNames.shift()) == null ? void 0 : _propNames$shift.toLowerCase();
|
|
1123
1123
|
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1124
|
+
switch (prefix) {
|
|
1125
|
+
case 'operationdata':
|
|
1126
|
+
return getPropertyChainValue(propNames, sourceObject);
|
|
1127
1127
|
|
|
1128
|
-
|
|
1129
|
-
|
|
1128
|
+
case 'globaldata':
|
|
1129
|
+
return getPropertyChainValue(propNames, getGlobals());
|
|
1130
1130
|
}
|
|
1131
1131
|
}
|
|
1132
1132
|
|
|
@@ -1419,6 +1419,11 @@ var endLoop$1 = function endLoop(operationData) {
|
|
|
1419
1419
|
return operationData;
|
|
1420
1420
|
};
|
|
1421
1421
|
|
|
1422
|
+
var endWhen$1 = function endWhen(operationData) {
|
|
1423
|
+
delete this.skipNextOperation;
|
|
1424
|
+
return operationData;
|
|
1425
|
+
};
|
|
1426
|
+
|
|
1422
1427
|
var extendController$1 = function extendController(operationData) {
|
|
1423
1428
|
var controllerInstance = operationData.controllerInstance,
|
|
1424
1429
|
controllerExtension = operationData.controllerExtension;
|
|
@@ -1840,6 +1845,14 @@ function isMathProperty(value) {
|
|
|
1840
1845
|
return isString(value) && value in Math && !isFunction(Math[value]);
|
|
1841
1846
|
}
|
|
1842
1847
|
|
|
1848
|
+
var otherwise$1 = function otherwise(operationData) {
|
|
1849
|
+
if (this.skipNextOperation === false) {
|
|
1850
|
+
this.skipNextOperation = true;
|
|
1851
|
+
}
|
|
1852
|
+
|
|
1853
|
+
return operationData;
|
|
1854
|
+
};
|
|
1855
|
+
|
|
1843
1856
|
/**
|
|
1844
1857
|
* This operation removes the spcified class name from the specified selected element.
|
|
1845
1858
|
*
|
|
@@ -2209,7 +2222,7 @@ var toggleElement$1 = function toggleElement(operationData) {
|
|
|
2209
2222
|
* @returns
|
|
2210
2223
|
*/
|
|
2211
2224
|
|
|
2212
|
-
var wait$
|
|
2225
|
+
var wait$2 = function wait(operationData) {
|
|
2213
2226
|
var milliseconds = operationData.milliseconds;
|
|
2214
2227
|
return new Promise(function (resolve) {
|
|
2215
2228
|
setTimeout(function () {
|
|
@@ -2218,6 +2231,59 @@ var wait$1 = function wait(operationData) {
|
|
|
2218
2231
|
});
|
|
2219
2232
|
};
|
|
2220
2233
|
|
|
2234
|
+
/**
|
|
2235
|
+
* When the given expression evaluates to false, subsequent operations will be skipped
|
|
2236
|
+
* until an `endWhen` operation is encountered.
|
|
2237
|
+
* Practically, this mean an `if` statement control flow implementation in a list of operations.
|
|
2238
|
+
*
|
|
2239
|
+
* @param operationData
|
|
2240
|
+
* @returns
|
|
2241
|
+
*/
|
|
2242
|
+
|
|
2243
|
+
var when = function when(operationData) {
|
|
2244
|
+
var _parseExpression = parseExpression(operationData.expression, operationData),
|
|
2245
|
+
left = _parseExpression[0],
|
|
2246
|
+
operator = _parseExpression[1],
|
|
2247
|
+
right = _parseExpression[2];
|
|
2248
|
+
|
|
2249
|
+
var evaluationResult = evaluations[operator](left, right);
|
|
2250
|
+
this.skipNextOperation = !evaluationResult;
|
|
2251
|
+
delete operationData.expression;
|
|
2252
|
+
return operationData;
|
|
2253
|
+
};
|
|
2254
|
+
|
|
2255
|
+
function parseExpression(expression, operationData) {
|
|
2256
|
+
var _expression$split = expression.split(/!=|==|>=|<=|>|</),
|
|
2257
|
+
left = _expression$split[0],
|
|
2258
|
+
right = _expression$split[1];
|
|
2259
|
+
|
|
2260
|
+
var operator = expression.substring(left.length, expression.length - right.length);
|
|
2261
|
+
var leftNr = +left;
|
|
2262
|
+
var rightNr = +right;
|
|
2263
|
+
return [isNaN(leftNr) ? resolveOperationOrGlobalDataPropertyChain(operationData, left) : leftNr, operator, isNaN(rightNr) ? resolveOperationOrGlobalDataPropertyChain(operationData, right) : rightNr];
|
|
2264
|
+
}
|
|
2265
|
+
|
|
2266
|
+
var evaluations = {
|
|
2267
|
+
'==': function _(left, right) {
|
|
2268
|
+
return left === right;
|
|
2269
|
+
},
|
|
2270
|
+
'!=': function _(left, right) {
|
|
2271
|
+
return left !== right;
|
|
2272
|
+
},
|
|
2273
|
+
'>=': function _(left, right) {
|
|
2274
|
+
return left >= right;
|
|
2275
|
+
},
|
|
2276
|
+
'<=': function _(left, right) {
|
|
2277
|
+
return left <= right;
|
|
2278
|
+
},
|
|
2279
|
+
'>': function _(left, right) {
|
|
2280
|
+
return left > right;
|
|
2281
|
+
},
|
|
2282
|
+
'<': function _(left, right) {
|
|
2283
|
+
return left < right;
|
|
2284
|
+
}
|
|
2285
|
+
};
|
|
2286
|
+
|
|
2221
2287
|
var ops = {
|
|
2222
2288
|
__proto__: null,
|
|
2223
2289
|
addClass: addClass$1,
|
|
@@ -2232,6 +2298,7 @@ var ops = {
|
|
|
2232
2298
|
customFunction: customFunction$1,
|
|
2233
2299
|
endAction: endAction$1,
|
|
2234
2300
|
endLoop: endLoop$1,
|
|
2301
|
+
endWhen: endWhen$1,
|
|
2235
2302
|
extendController: extendController$1,
|
|
2236
2303
|
getControllerFromElement: getControllerFromElement$1,
|
|
2237
2304
|
getControllerInstance: getControllerInstance$1,
|
|
@@ -2242,6 +2309,7 @@ var ops = {
|
|
|
2242
2309
|
loadJSON: loadJSON$1,
|
|
2243
2310
|
log: log$1,
|
|
2244
2311
|
math: math$1,
|
|
2312
|
+
otherwise: otherwise$1,
|
|
2245
2313
|
removeClass: removeClass$1,
|
|
2246
2314
|
removeControllerFromElement: removeControllerFromElement$1,
|
|
2247
2315
|
removeElement: removeElement$1,
|
|
@@ -2259,7 +2327,8 @@ var ops = {
|
|
|
2259
2327
|
startLoop: startLoop$1,
|
|
2260
2328
|
toggleClass: toggleClass$1,
|
|
2261
2329
|
toggleElement: toggleElement$1,
|
|
2262
|
-
wait: wait$
|
|
2330
|
+
wait: wait$2,
|
|
2331
|
+
when: when
|
|
2263
2332
|
};
|
|
2264
2333
|
|
|
2265
2334
|
var ActionCreatorFactory = /*#__PURE__*/function () {
|
|
@@ -3335,9 +3404,9 @@ var TimelineProvidersSettingsEditor = /*#__PURE__*/function () {
|
|
|
3335
3404
|
}
|
|
3336
3405
|
|
|
3337
3406
|
var settings = {
|
|
3338
|
-
id:
|
|
3339
|
-
poster:
|
|
3340
|
-
selector:
|
|
3407
|
+
id: uuid.v4(),
|
|
3408
|
+
poster: undefined,
|
|
3409
|
+
selector: undefined,
|
|
3341
3410
|
systemName: '',
|
|
3342
3411
|
vendor: ''
|
|
3343
3412
|
};
|
|
@@ -3409,6 +3478,20 @@ var ConfigurationFactory = /*#__PURE__*/function () {
|
|
|
3409
3478
|
this.actionCreatorFactory = new ActionCreatorFactory(this);
|
|
3410
3479
|
}
|
|
3411
3480
|
|
|
3481
|
+
ConfigurationFactory.extend = function extend(factory, extensionMethodName, extensionMethod) {
|
|
3482
|
+
factory[extensionMethodName] = extensionMethod.bind(factory);
|
|
3483
|
+
return factory;
|
|
3484
|
+
};
|
|
3485
|
+
|
|
3486
|
+
ConfigurationFactory.extendMultiple = function extendMultiple(factory, extensions) {
|
|
3487
|
+
Object.entries(extensions).forEach(function (_ref) {
|
|
3488
|
+
var name = _ref[0],
|
|
3489
|
+
method = _ref[1];
|
|
3490
|
+
return ConfigurationFactory.extend(factory, name, method);
|
|
3491
|
+
});
|
|
3492
|
+
return factory;
|
|
3493
|
+
};
|
|
3494
|
+
|
|
3412
3495
|
var _proto = ConfigurationFactory.prototype;
|
|
3413
3496
|
|
|
3414
3497
|
_proto.init = function init(defaultLanguage) {
|
|
@@ -3625,7 +3708,7 @@ var ConfigurationFactory = /*#__PURE__*/function () {
|
|
|
3625
3708
|
});
|
|
3626
3709
|
|
|
3627
3710
|
if (actionConfig) {
|
|
3628
|
-
return new
|
|
3711
|
+
return new EndableActionEditor(actionConfig, this);
|
|
3629
3712
|
}
|
|
3630
3713
|
|
|
3631
3714
|
throw new Error("Action not found for id " + id);
|
|
@@ -4806,6 +4889,12 @@ function endLoop() {
|
|
|
4806
4889
|
};
|
|
4807
4890
|
}
|
|
4808
4891
|
|
|
4892
|
+
function endWhen() {
|
|
4893
|
+
return {
|
|
4894
|
+
description: 'Ends the current when block'
|
|
4895
|
+
};
|
|
4896
|
+
}
|
|
4897
|
+
|
|
4809
4898
|
function extendController() {
|
|
4810
4899
|
return {
|
|
4811
4900
|
description: 'Extends the current controller',
|
|
@@ -4950,6 +5039,12 @@ function createMathFunctionNames() {
|
|
|
4950
5039
|
});
|
|
4951
5040
|
}
|
|
4952
5041
|
|
|
5042
|
+
function otherwise() {
|
|
5043
|
+
return {
|
|
5044
|
+
description: 'Inverts the control flow for `when` logic'
|
|
5045
|
+
};
|
|
5046
|
+
}
|
|
5047
|
+
|
|
4953
5048
|
function removeClass() {
|
|
4954
5049
|
return {
|
|
4955
5050
|
description: 'Removes the specified class from the selected element',
|
|
@@ -5160,7 +5255,7 @@ function toggleElement() {
|
|
|
5160
5255
|
};
|
|
5161
5256
|
}
|
|
5162
5257
|
|
|
5163
|
-
function wait() {
|
|
5258
|
+
function wait$1() {
|
|
5164
5259
|
return {
|
|
5165
5260
|
description: 'Waits the given amount of milliseconds before the action continues',
|
|
5166
5261
|
properties: {
|
|
@@ -5172,6 +5267,18 @@ function wait() {
|
|
|
5172
5267
|
};
|
|
5173
5268
|
}
|
|
5174
5269
|
|
|
5270
|
+
function wait() {
|
|
5271
|
+
return {
|
|
5272
|
+
description: 'Evaluates the given expression, when it evaluates to false context.skipNextOperation will be set to true',
|
|
5273
|
+
properties: {
|
|
5274
|
+
expression: {
|
|
5275
|
+
type: 'ParameterType:expression',
|
|
5276
|
+
required: true
|
|
5277
|
+
}
|
|
5278
|
+
}
|
|
5279
|
+
};
|
|
5280
|
+
}
|
|
5281
|
+
|
|
5175
5282
|
var operationMetadata = {
|
|
5176
5283
|
__proto__: null,
|
|
5177
5284
|
addClass: addClass,
|
|
@@ -5186,6 +5293,7 @@ var operationMetadata = {
|
|
|
5186
5293
|
customFunction: customFunction,
|
|
5187
5294
|
endAction: endAction,
|
|
5188
5295
|
endLoop: endLoop,
|
|
5296
|
+
endWhen: endWhen,
|
|
5189
5297
|
extendController: extendController,
|
|
5190
5298
|
getControllerFromElement: getControllerFromElement,
|
|
5191
5299
|
getControllerInstance: getControllerInstance,
|
|
@@ -5196,6 +5304,7 @@ var operationMetadata = {
|
|
|
5196
5304
|
loadJSON: loadJSON,
|
|
5197
5305
|
log: log,
|
|
5198
5306
|
math: math,
|
|
5307
|
+
otherwise: otherwise,
|
|
5199
5308
|
removeClass: removeClass,
|
|
5200
5309
|
removeControllerFromElement: removeControllerFromElement,
|
|
5201
5310
|
removeElement: removeElement,
|
|
@@ -5213,7 +5322,8 @@ var operationMetadata = {
|
|
|
5213
5322
|
startLoop: startLoop,
|
|
5214
5323
|
toggleClass: toggleClass,
|
|
5215
5324
|
toggleElement: toggleElement,
|
|
5216
|
-
wait: wait
|
|
5325
|
+
wait: wait$1,
|
|
5326
|
+
when: wait
|
|
5217
5327
|
};
|
|
5218
5328
|
|
|
5219
5329
|
var OperationNamesProvider = /*#__PURE__*/function () {
|
|
@@ -6330,6 +6440,11 @@ var evtb = {
|
|
|
6330
6440
|
RequestVideoUriInterceptor: RequestVideoUriInterceptor
|
|
6331
6441
|
};
|
|
6332
6442
|
|
|
6443
|
+
function setGlobal(name, value) {
|
|
6444
|
+
var cache = getGlobals();
|
|
6445
|
+
cache[name] = value;
|
|
6446
|
+
}
|
|
6447
|
+
|
|
6333
6448
|
var LanguageManager = /*#__PURE__*/function () {
|
|
6334
6449
|
function LanguageManager(_currentLanguage, labels, _eventbus) {
|
|
6335
6450
|
this._currentLanguage = void 0;
|
|
@@ -6343,6 +6458,8 @@ var LanguageManager = /*#__PURE__*/function () {
|
|
|
6343
6458
|
throw new Error('language ctor arg cannot have zero length');
|
|
6344
6459
|
}
|
|
6345
6460
|
|
|
6461
|
+
setGlobal('defaultLanguage', _currentLanguage);
|
|
6462
|
+
|
|
6346
6463
|
this._setRootElementLang(_currentLanguage);
|
|
6347
6464
|
|
|
6348
6465
|
this._labelLookup = this._createLabelLookup(labels);
|
|
@@ -6724,6 +6841,7 @@ exports.createElement = createElement$1;
|
|
|
6724
6841
|
exports.customFunction = customFunction$1;
|
|
6725
6842
|
exports.endAction = endAction$1;
|
|
6726
6843
|
exports.endLoop = endLoop$1;
|
|
6844
|
+
exports.endWhen = endWhen$1;
|
|
6727
6845
|
exports.extendController = extendController$1;
|
|
6728
6846
|
exports.generateImporterSourceCode = generateImporterSourceCode;
|
|
6729
6847
|
exports.getControllerFromElement = getControllerFromElement$1;
|
|
@@ -6736,6 +6854,7 @@ exports.loadJSON = loadJSON$1;
|
|
|
6736
6854
|
exports.log = log$1;
|
|
6737
6855
|
exports.math = math$1;
|
|
6738
6856
|
exports.metadata = operationMetadata;
|
|
6857
|
+
exports.otherwise = otherwise$1;
|
|
6739
6858
|
exports.removeClass = removeClass$1;
|
|
6740
6859
|
exports.removeControllerFromElement = removeControllerFromElement$1;
|
|
6741
6860
|
exports.removeElement = removeElement$1;
|
|
@@ -6753,5 +6872,6 @@ exports.startAction = startAction$1;
|
|
|
6753
6872
|
exports.startLoop = startLoop$1;
|
|
6754
6873
|
exports.toggleClass = toggleClass$1;
|
|
6755
6874
|
exports.toggleElement = toggleElement$1;
|
|
6756
|
-
exports.wait = wait$
|
|
6875
|
+
exports.wait = wait$2;
|
|
6876
|
+
exports.when = when;
|
|
6757
6877
|
//# sourceMappingURL=eligius.cjs.development.js.map
|