eligius 1.0.7 → 1.0.9

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.
Files changed (37) hide show
  1. package/README.md +2 -2
  2. package/dist/controllers/label-controller.d.ts +5 -2
  3. package/dist/controllers/lottie-controller.d.ts +2 -2
  4. package/dist/controllers/navigation-controller.d.ts +2 -2
  5. package/dist/controllers/progressbar-controller.d.ts +2 -2
  6. package/dist/controllers/routing-controller.d.ts +2 -2
  7. package/dist/controllers/subtitles-controller.d.ts +2 -2
  8. package/dist/diagnostics/types.d.ts +22 -2
  9. package/dist/eligius-engine.d.ts +19 -7
  10. package/dist/eligius.cjs.development.js +529 -390
  11. package/dist/eligius.cjs.development.js.map +1 -1
  12. package/dist/eligius.cjs.production.min.js +1 -1
  13. package/dist/eligius.cjs.production.min.js.map +1 -1
  14. package/dist/eligius.esm.js +527 -390
  15. package/dist/eligius.esm.js.map +1 -1
  16. package/dist/engine-factory.d.ts +5 -5
  17. package/dist/eventbus/eventbus.d.ts +5 -5
  18. package/dist/eventbus/types.d.ts +5 -5
  19. package/dist/language-manager.d.ts +4 -3
  20. package/dist/operation/calc.d.ts +1 -1
  21. package/dist/operation/create-element.d.ts +0 -1
  22. package/dist/operation/get-controller-instance.d.ts +1 -3
  23. package/dist/operation/get-query-params.d.ts +28 -0
  24. package/dist/operation/index.d.ts +2 -0
  25. package/dist/operation/invoke-object-method.d.ts +15 -0
  26. package/dist/operation/load-json.d.ts +2 -3
  27. package/dist/operation/math.d.ts +1 -1
  28. package/dist/operation/metadata/get-query-params.d.ts +4 -0
  29. package/dist/operation/metadata/index.d.ts +2 -0
  30. package/dist/operation/metadata/invoke-object-method.d.ts +4 -0
  31. package/dist/operation/metadata/types.d.ts +1 -1
  32. package/dist/operation/remove-properties-from-operation-data.d.ts +1 -0
  33. package/dist/operation/select-element.d.ts +2 -3
  34. package/dist/operation/set-style.d.ts +4 -4
  35. package/dist/operation/start-loop.d.ts +2 -3
  36. package/dist/types.d.ts +42 -3
  37. package/package.json +3 -2
@@ -2,187 +2,22 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var $ = require('jquery');
5
6
  var tsIsPresent = require('ts-is-present');
6
7
  var fs = require('fs');
7
8
  var path = require('path');
8
9
  var lottie = require('lottie-web');
9
- var $ = require('jquery');
10
10
  var hotkeys = require('hotkeys-js');
11
11
  var uuid = require('uuid');
12
12
 
13
13
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
14
14
 
15
+ var $__default = /*#__PURE__*/_interopDefaultLegacy($);
15
16
  var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
16
17
  var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
17
18
  var lottie__default = /*#__PURE__*/_interopDefaultLegacy(lottie);
18
- var $__default = /*#__PURE__*/_interopDefaultLegacy($);
19
19
  var hotkeys__default = /*#__PURE__*/_interopDefaultLegacy(hotkeys);
20
20
 
21
- function prepareValueForSerialization(value) {
22
- if (Array.isArray(value)) {
23
- return value.map(prepareValueForSerialization);
24
- } else if (value instanceof jQuery) {
25
- return 'jQuery object';
26
- } else if (typeof value === 'object') {
27
- return Object.fromEntries(Object.entries(value).map(function (_ref) {
28
- var name = _ref[0],
29
- value = _ref[1];
30
- return [name, prepareValueForSerialization(value)];
31
- }));
32
- } else if (typeof value === 'function') {
33
- var funcString = value.toString();
34
- return funcString.substring(0, funcString.indexOf('{') + 1);
35
- }
36
-
37
- return value;
38
- }
39
-
40
- var DevToolEventListener = /*#__PURE__*/function () {
41
- function DevToolEventListener(agent) {
42
- this.agent = void 0;
43
- this.agent = agent;
44
- }
45
-
46
- var _proto = DevToolEventListener.prototype;
47
-
48
- _proto.handleEvent = function handleEvent(eventName, eventTopic, args) {
49
- var message = {
50
- eventName: eventName,
51
- eventTopic: eventTopic,
52
- args: prepareValueForSerialization(args)
53
- };
54
-
55
- try {
56
- this.agent.postMessage('eligius-diagnostics-event', message);
57
- } catch (e) {
58
- console.error('postmessage failed');
59
- console.error(e);
60
- console.log('message', message);
61
- }
62
- };
63
-
64
- return DevToolEventListener;
65
- }();
66
-
67
- var Diagnostics = /*#__PURE__*/function () {
68
- function Diagnostics() {}
69
-
70
- Diagnostics.send = function send(_name, _data) {
71
- console.log(_name, _data);
72
- };
73
-
74
- return Diagnostics;
75
- }();
76
- Diagnostics.active = void 0;
77
-
78
- var DEV_TOOLS_KEY = '__ELIGIUS_DEV_TOOLS__';
79
-
80
- var copyFunction = typeof structuredClone !== 'undefined' ? structuredClone : function (original) {
81
- return JSON.parse(JSON.stringify(original));
82
- };
83
- function deepCopy(original) {
84
- if (tsIsPresent.isDefined(original)) {
85
- return copyFunction(original);
86
- }
87
-
88
- return original;
89
- }
90
-
91
- function isPromise(obj) {
92
- return typeof obj === 'object' && typeof obj.then === 'function';
93
- }
94
-
95
- var Action = /*#__PURE__*/function () {
96
- function Action(name, startOperations, eventbus) {
97
- this.name = void 0;
98
- this.startOperations = void 0;
99
- this.eventbus = void 0;
100
- this.id = '';
101
- this.name = name;
102
- this.startOperations = startOperations;
103
- this.eventbus = eventbus;
104
- }
105
-
106
- var _proto = Action.prototype;
107
-
108
- _proto.start = function start(initOperationData) {
109
- var _this$name,
110
- _this = this;
111
-
112
- Diagnostics.active && Diagnostics.send('eligius-diagnostics-action', ((_this$name = this.name) != null ? _this$name : 'Action') + " begins executing start operations");
113
- var context = {
114
- currentIndex: -1,
115
- eventbus: this.eventbus
116
- };
117
- var result = new Promise(function (resolve, reject) {
118
- _this.executeOperation(_this.startOperations, 0, resolve, reject, initOperationData, context);
119
- })["catch"](function (e) {
120
- Diagnostics.active && Diagnostics.send('eligius-diagnostics-action-error', {
121
- name: name,
122
- error: e
123
- });
124
- console.error("Error in action start '" + _this.name + "'");
125
- console.error(e);
126
- throw e;
127
- });
128
- return !Diagnostics.active ? result : result.then(function (operationsResult) {
129
- var _this$name2;
130
-
131
- Diagnostics.send('eligius-diagnostics-action', ((_this$name2 = _this.name) != null ? _this$name2 : 'Action') + " finished executing start operations");
132
- return operationsResult;
133
- });
134
- };
135
-
136
- _proto.executeOperation = function executeOperation(operations, idx, resolve, reject, previousOperationData, context) {
137
- var _this2 = this;
138
-
139
- if (previousOperationData === void 0) {
140
- previousOperationData = {};
141
- }
142
-
143
- if (context.newIndex !== undefined) {
144
- idx = context.newIndex;
145
- delete context.newIndex;
146
- }
147
-
148
- context.currentIndex = idx;
149
-
150
- if (context.skipNextOperation) {
151
- if (idx < operations.length) {
152
- this.executeOperation(operations, ++idx, resolve, reject, previousOperationData, context);
153
- } else {
154
- resolve(previousOperationData);
155
- }
156
- }
157
-
158
- if (idx < operations.length) {
159
- var operationInfo = operations[idx];
160
- var copy = operationInfo.operationData ? deepCopy(operationInfo.operationData) : {};
161
- var mergedOperationData = Object.assign(previousOperationData, copy);
162
- Diagnostics.active && Diagnostics.send('eligius-diagnostics-operation', {
163
- systemName: operationInfo.systemName,
164
- operationData: operationInfo.operationData,
165
- context: context
166
- });
167
- var operationResult = operationInfo.instance.call(context, mergedOperationData);
168
-
169
- if (isPromise(operationResult)) {
170
- operationResult.then(function (resultOperationData) {
171
- _this2.executeOperation(operations, ++idx, resolve, reject, resultOperationData, context);
172
- })["catch"](function (error) {
173
- reject(error);
174
- });
175
- } else {
176
- this.executeOperation(operations, ++idx, resolve, reject, operationResult, context);
177
- }
178
- } else {
179
- resolve(previousOperationData);
180
- }
181
- };
182
-
183
- return Action;
184
- }();
185
-
186
21
  function _regeneratorRuntime() {
187
22
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
188
23
 
@@ -596,6 +431,179 @@ function _setPrototypeOf(o, p) {
596
431
  return _setPrototypeOf(o, p);
597
432
  }
598
433
 
434
+ function prepareValueForSerialization(value) {
435
+ if (Array.isArray(value)) {
436
+ return value.map(prepareValueForSerialization);
437
+ } else if (value instanceof $__default["default"]) {
438
+ return 'jQuery object';
439
+ } else if (value !== null && typeof value === 'object') {
440
+ return Object.fromEntries(Object.entries(value).map(function (_ref) {
441
+ var propName = _ref[0],
442
+ propValue = _ref[1];
443
+ return [propName, prepareValueForSerialization(propValue)];
444
+ }));
445
+ } else if (typeof value === 'function') {
446
+ var funcString = value.toString();
447
+ var paranIndex = funcString.indexOf('{');
448
+
449
+ if (paranIndex > -1) {
450
+ return funcString.substring(0, funcString.indexOf('{') + 1);
451
+ }
452
+
453
+ return funcString;
454
+ }
455
+
456
+ return value;
457
+ }
458
+
459
+ var DevToolEventListener = /*#__PURE__*/function () {
460
+ function DevToolEventListener(agent) {
461
+ this.agent = void 0;
462
+ this.agent = agent;
463
+ }
464
+
465
+ var _proto = DevToolEventListener.prototype;
466
+
467
+ _proto.handleEvent = function handleEvent(eventName, eventTopic, args) {
468
+ var message = {
469
+ eventName: eventName,
470
+ eventTopic: eventTopic,
471
+ args: prepareValueForSerialization(args)
472
+ };
473
+
474
+ try {
475
+ this.agent.postMessage('eligius-diagnostics-event', message);
476
+ } catch (e) {
477
+ console.error('postmessage failed');
478
+ console.error(e);
479
+ console.log('message', message);
480
+ }
481
+ };
482
+
483
+ return DevToolEventListener;
484
+ }();
485
+
486
+ var Diagnostics = /*#__PURE__*/function () {
487
+ function Diagnostics() {}
488
+
489
+ Diagnostics.send = function send(_name, _data) {
490
+ console.log(_name, _data);
491
+ };
492
+
493
+ return Diagnostics;
494
+ }();
495
+ Diagnostics.active = void 0;
496
+
497
+ var DEV_TOOLS_KEY = '__ELIGIUS_DEV_TOOLS__';
498
+
499
+ var copyFunction = typeof structuredClone !== 'undefined' ? structuredClone : function (original) {
500
+ return JSON.parse(JSON.stringify(original));
501
+ };
502
+ function deepCopy(original) {
503
+ if (tsIsPresent.isDefined(original)) {
504
+ return copyFunction(original);
505
+ }
506
+
507
+ return original;
508
+ }
509
+
510
+ function isPromise(obj) {
511
+ return typeof obj === 'object' && typeof obj.then === 'function';
512
+ }
513
+
514
+ var Action = /*#__PURE__*/function () {
515
+ function Action(name, startOperations, eventbus) {
516
+ this.name = void 0;
517
+ this.startOperations = void 0;
518
+ this.eventbus = void 0;
519
+ this.id = '';
520
+ this.name = name;
521
+ this.startOperations = startOperations;
522
+ this.eventbus = eventbus;
523
+ }
524
+
525
+ var _proto = Action.prototype;
526
+
527
+ _proto.start = function start(initOperationData) {
528
+ var _this$name,
529
+ _this = this;
530
+
531
+ Diagnostics.active && Diagnostics.send('eligius-diagnostics-action', ((_this$name = this.name) != null ? _this$name : 'Action') + " begins executing start operations");
532
+ var context = {
533
+ currentIndex: -1,
534
+ eventbus: this.eventbus
535
+ };
536
+ var result = new Promise(function (resolve, reject) {
537
+ _this.executeOperation(_this.startOperations, 0, resolve, reject, initOperationData, context);
538
+ })["catch"](function (e) {
539
+ Diagnostics.active && Diagnostics.send('eligius-diagnostics-action-error', {
540
+ name: name,
541
+ error: e
542
+ });
543
+ console.error("Error in action start '" + _this.name + "'");
544
+ console.error(e);
545
+ throw e;
546
+ });
547
+ return !Diagnostics.active ? result : result.then(function (operationsResult) {
548
+ var _this$name2;
549
+
550
+ Diagnostics.send('eligius-diagnostics-action', ((_this$name2 = _this.name) != null ? _this$name2 : 'Action') + " finished executing start operations");
551
+ return operationsResult;
552
+ });
553
+ };
554
+
555
+ _proto.executeOperation = function executeOperation(operations, idx, resolve, reject, previousOperationData, context) {
556
+ var _this2 = this;
557
+
558
+ if (previousOperationData === void 0) {
559
+ previousOperationData = {};
560
+ }
561
+
562
+ if (context.newIndex !== undefined) {
563
+ idx = context.newIndex;
564
+ delete context.newIndex;
565
+ }
566
+
567
+ context.currentIndex = idx;
568
+
569
+ if (context.skipNextOperation) {
570
+ if (idx < operations.length) {
571
+ this.executeOperation(operations, ++idx, resolve, reject, previousOperationData, context);
572
+ } else {
573
+ resolve(previousOperationData);
574
+ }
575
+ }
576
+
577
+ if (idx < operations.length) {
578
+ var operationInfo = operations[idx];
579
+ var copy = operationInfo.operationData ? deepCopy(operationInfo.operationData) : {};
580
+ var mergedOperationData = Object.assign(previousOperationData, copy);
581
+ Diagnostics.active && Diagnostics.send('eligius-diagnostics-operation', {
582
+ systemName: operationInfo.systemName,
583
+ operationData: mergedOperationData,
584
+ context: _extends({}, context, {
585
+ eventbus: undefined
586
+ })
587
+ });
588
+ var operationResult = operationInfo.instance.call(context, mergedOperationData);
589
+
590
+ if (isPromise(operationResult)) {
591
+ operationResult.then(function (promisedOperationResult) {
592
+ _this2.executeOperation(operations, ++idx, resolve, reject, promisedOperationResult, context);
593
+ })["catch"](function (error) {
594
+ reject(error);
595
+ });
596
+ } else {
597
+ this.executeOperation(operations, ++idx, resolve, reject, operationResult, context);
598
+ }
599
+ } else {
600
+ resolve(previousOperationData);
601
+ }
602
+ };
603
+
604
+ return Action;
605
+ }();
606
+
599
607
  var EndableAction = /*#__PURE__*/function (_Action) {
600
608
  _inheritsLoose(EndableAction, _Action);
601
609
 
@@ -1244,6 +1252,7 @@ var LabelController = /*#__PURE__*/function () {
1244
1252
  this.operationData = null;
1245
1253
  this.labelData = {};
1246
1254
  this.name = 'LabelController';
1255
+ this.requestLabelDataBound = void 0;
1247
1256
  }
1248
1257
 
1249
1258
  var _proto = LabelController.prototype;
@@ -1252,6 +1261,13 @@ var LabelController = /*#__PURE__*/function () {
1252
1261
  this.operationData = Object.assign({}, operationData);
1253
1262
  };
1254
1263
 
1264
+ _proto.setLabelId = function setLabelId(newLabelId) {
1265
+ if (this.requestLabelDataBound) {
1266
+ this.requestLabelDataBound(newLabelId);
1267
+ this.setLabel();
1268
+ }
1269
+ };
1270
+
1255
1271
  _proto.attach = function attach(eventbus) {
1256
1272
  var _this = this;
1257
1273
 
@@ -1262,13 +1278,20 @@ var LabelController = /*#__PURE__*/function () {
1262
1278
  eventbus.broadcast(TimelineEventNames.REQUEST_CURRENT_LANGUAGE, [function (language) {
1263
1279
  _this.currentLanguage = language;
1264
1280
  }]);
1265
- eventbus.broadcast(TimelineEventNames.REQUEST_LABEL_COLLECTION, [this.operationData.labelId, function (labelCollection) {
1266
- _this.createTextDataLookup(labelCollection);
1267
- }]);
1281
+ this.requestLabelDataBound = this.requestLabelData.bind(this, eventbus);
1282
+ this.requestLabelDataBound(this.operationData.labelId);
1268
1283
  this.setLabel();
1269
1284
  this.listeners.push(eventbus.on(TimelineEventNames.LANGUAGE_CHANGE, this.handleLanguageChange.bind(this)));
1270
1285
  };
1271
1286
 
1287
+ _proto.requestLabelData = function requestLabelData(eventbus, labelId) {
1288
+ var _this2 = this;
1289
+
1290
+ eventbus.broadcast(TimelineEventNames.REQUEST_LABEL_COLLECTION, [labelId, function (labelCollection) {
1291
+ _this2.createTextDataLookup(labelCollection);
1292
+ }]);
1293
+ };
1294
+
1272
1295
  _proto.setLabel = function setLabel() {
1273
1296
  if (this.currentLanguage) {
1274
1297
  var _this$operationData;
@@ -1279,8 +1302,9 @@ var LabelController = /*#__PURE__*/function () {
1279
1302
 
1280
1303
  _proto.detach = function detach(_eventbus) {
1281
1304
  this.listeners.forEach(function (func) {
1282
- func();
1305
+ return func();
1283
1306
  });
1307
+ this.requestLabelDataBound = undefined;
1284
1308
  };
1285
1309
 
1286
1310
  _proto.handleLanguageChange = function handleLanguageChange(code) {
@@ -1289,10 +1313,10 @@ var LabelController = /*#__PURE__*/function () {
1289
1313
  };
1290
1314
 
1291
1315
  _proto.createTextDataLookup = function createTextDataLookup(data) {
1292
- var _this2 = this;
1316
+ var _this3 = this;
1293
1317
 
1294
1318
  data.forEach(function (d) {
1295
- _this2.labelData[d.languageCode] = d.label;
1319
+ _this3.labelData[d.languageCode] = d.label;
1296
1320
  });
1297
1321
  };
1298
1322
 
@@ -2046,44 +2070,46 @@ var ctrls = {
2046
2070
  };
2047
2071
 
2048
2072
  /**
2049
- * EligiusEngine, this is where the magic happens. The engine is responsible for starting and stopping
2050
- * the given timeline provider and triggering the actions associated with it.
2051
- * ...
2073
+ * This is where the magic happens. The engine is responsible for starting and stopping
2074
+ * the given timeline provider and triggering the actions associated with the positions along the timeline.
2052
2075
  */
2053
2076
 
2054
2077
  var EligiusEngine = /*#__PURE__*/function () {
2055
- function EligiusEngine(configuration, eventbus, timelineProviders, _languageManager) {
2078
+ function EligiusEngine(configuration, eventbus, timelineProviders, languageManager) {
2056
2079
  this.configuration = void 0;
2057
2080
  this.eventbus = void 0;
2058
2081
  this.timelineProviders = void 0;
2059
- this._languageManager = void 0;
2082
+ this.languageManager = void 0;
2060
2083
  this._timeLineActionsLookup = {};
2061
- this._eventbusListeners = [];
2084
+ this._eventbusRemovers = [];
2062
2085
  this._currentTimelineUri = '';
2063
2086
  this._activeTimelineProvider = undefined;
2064
2087
  this._lastPosition = -1;
2065
2088
  this.configuration = configuration;
2066
2089
  this.eventbus = eventbus;
2067
2090
  this.timelineProviders = timelineProviders;
2068
- this._languageManager = _languageManager;
2091
+ this.languageManager = languageManager;
2069
2092
  }
2093
+ /**
2094
+ * Initializes the engine by creating the HTML layout and the first time line
2095
+ * by executing its initActions.
2096
+ */
2097
+
2070
2098
 
2071
2099
  var _proto = EligiusEngine.prototype;
2072
2100
 
2073
2101
  _proto.init = function init() {
2102
+ var _timelines$0$uri;
2103
+
2074
2104
  this._createLayoutTemplate();
2075
2105
 
2076
2106
  this._addInitialisationListeners();
2077
2107
 
2078
2108
  var timelines = this.configuration.timelines;
2079
- this._currentTimelineUri = timelines && timelines.length ? timelines[0].uri : '';
2109
+ this._currentTimelineUri = (_timelines$0$uri = timelines == null ? void 0 : timelines[0].uri) != null ? _timelines$0$uri : '';
2080
2110
 
2081
2111
  this._createTimelineLookup();
2082
2112
 
2083
- this._eventbusListeners.push(this.eventbus.on(TimelineEventNames.TIME, this._onTimeHandler.bind(this, Math.floor)));
2084
-
2085
- this._eventbusListeners.push(this.eventbus.on(TimelineEventNames.SEEK, this._onSeekHandler.bind(this, Math.floor)));
2086
-
2087
2113
  return this._initializeTimelineProvider();
2088
2114
  };
2089
2115
 
@@ -2188,9 +2214,20 @@ var EligiusEngine = /*#__PURE__*/function () {
2188
2214
  }
2189
2215
 
2190
2216
  return _cleanUp;
2191
- }();
2192
-
2193
- _proto.destroy = /*#__PURE__*/function () {
2217
+ }()
2218
+ /**
2219
+ * Cleans up all the necessary parts that the engine initialized.
2220
+ * - It ends the currently active operations and the init actions.
2221
+ * - It removes all its eventbus listeners, handlers and interceptors.
2222
+ * - It destroys all of its timeline providers
2223
+ * - It empties the HTML element indicated by the containerSelector configuration property.
2224
+ *
2225
+ */
2226
+ ;
2227
+
2228
+ _proto.destroy =
2229
+ /*#__PURE__*/
2230
+ function () {
2194
2231
  var _destroy = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
2195
2232
  var containerSelector, container;
2196
2233
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
@@ -2201,9 +2238,10 @@ var EligiusEngine = /*#__PURE__*/function () {
2201
2238
  return this._cleanUp();
2202
2239
 
2203
2240
  case 2:
2241
+ this.languageManager.destroy();
2204
2242
  this._activeTimelineProvider = undefined;
2205
2243
 
2206
- this._eventbusListeners.forEach(function (remover) {
2244
+ this._eventbusRemovers.forEach(function (remover) {
2207
2245
  return remover();
2208
2246
  });
2209
2247
 
@@ -2217,7 +2255,7 @@ var EligiusEngine = /*#__PURE__*/function () {
2217
2255
  container = $__default["default"](containerSelector);
2218
2256
  container.empty();
2219
2257
 
2220
- case 8:
2258
+ case 9:
2221
2259
  case "end":
2222
2260
  return _context3.stop();
2223
2261
  }
@@ -2232,20 +2270,28 @@ var EligiusEngine = /*#__PURE__*/function () {
2232
2270
  return destroy;
2233
2271
  }();
2234
2272
 
2273
+ _proto._addEventListener = function _addEventListener(eventName, eventHandler, eventTopic) {
2274
+ this._eventbusRemovers.push(this.eventbus.on(eventName, eventHandler, eventTopic));
2275
+ };
2276
+
2235
2277
  _proto._addInitialisationListeners = function _addInitialisationListeners() {
2236
- this._eventbusListeners.push(this.eventbus.on(TimelineEventNames.REQUEST_ENGINE_ROOT, this._handleRequestEngineRoot.bind(this, this.configuration.containerSelector)));
2278
+ this._addEventListener(TimelineEventNames.REQUEST_ENGINE_ROOT, this._handleRequestEngineRoot.bind(this, this.configuration.containerSelector));
2279
+
2280
+ this._addEventListener(TimelineEventNames.REQUEST_TIMELINE_URI, this._handleRequestTimelineUri.bind(this));
2281
+
2282
+ this._addEventListener(TimelineEventNames.REQUEST_CURRENT_TIMELINE_POSITION, this._handleRequestTimelinePosition.bind(this, Math.floor));
2237
2283
 
2238
- this._eventbusListeners.push(this.eventbus.on(TimelineEventNames.REQUEST_TIMELINE_URI, this._handleRequestTimelineUri.bind(this)));
2284
+ this._addEventListener(TimelineEventNames.REQUEST_TIMELINE_CLEANUP, this._handleTimelineComplete.bind(this));
2239
2285
 
2240
- this._eventbusListeners.push(this.eventbus.on(TimelineEventNames.REQUEST_CURRENT_TIMELINE_POSITION, this._handleRequestTimelinePosition.bind(this, Math.floor)));
2286
+ this._addEventListener(TimelineEventNames.EXECUTE_TIMELINEACTION, this._handleExecuteTimelineAction.bind(this));
2241
2287
 
2242
- this._eventbusListeners.push(this.eventbus.on(TimelineEventNames.REQUEST_TIMELINE_CLEANUP, this._handleTimelineComplete.bind(this)));
2288
+ this._addEventListener(TimelineEventNames.RESIZE_TIMELINEACTION, this._resizeTimelineAction.bind(this));
2243
2289
 
2244
- this._eventbusListeners.push(this.eventbus.on(TimelineEventNames.EXECUTE_TIMELINEACTION, this._handleExecuteTimelineAction.bind(this)));
2290
+ this._addEventListener(TimelineEventNames.REQUEST_CURRENT_TIMELINE, this._requestCurrentTimeline.bind(this));
2245
2291
 
2246
- this._eventbusListeners.push(this.eventbus.on(TimelineEventNames.RESIZE_TIMELINEACTION, this._resizeTimelineAction.bind(this)));
2292
+ this._addEventListener(TimelineEventNames.TIME, this._onTimeHandler.bind(this, Math.floor));
2247
2293
 
2248
- this._eventbusListeners.push(this.eventbus.on(TimelineEventNames.REQUEST_CURRENT_TIMELINE, this._requestCurrentTimeline.bind(this)));
2294
+ this._addEventListener(TimelineEventNames.SEEK, this._onSeekHandler.bind(this, Math.floor));
2249
2295
  };
2250
2296
 
2251
2297
  _proto._createTimelineLookup = function _createTimelineLookup() {
@@ -2282,13 +2328,11 @@ var EligiusEngine = /*#__PURE__*/function () {
2282
2328
  }
2283
2329
 
2284
2330
  if (isFinite(end)) {
2285
- var _timeLineAction$id2;
2286
-
2287
2331
  var timelineEndPositions = this._initializeTimelinePosition(this._timeLineActionsLookup[uri], end);
2288
2332
 
2289
2333
  var endMethod = timeLineAction.end.bind(timeLineAction);
2290
2334
 
2291
- if ((_timeLineAction$id2 = timeLineAction.id) != null && _timeLineAction$id2.length) {
2335
+ if (!timeLineAction.id) {
2292
2336
  endMethod.id = timeLineAction.id;
2293
2337
  }
2294
2338
 
@@ -2706,6 +2750,9 @@ var Eventbus = /*#__PURE__*/function () {
2706
2750
  };
2707
2751
 
2708
2752
  this.on(eventName, eventHandlerDecorator, eventTopic);
2753
+ return function () {
2754
+ _this2.off(eventName, eventHandlerDecorator, eventTopic);
2755
+ };
2709
2756
  };
2710
2757
 
2711
2758
  _proto.off = function off(eventName, eventHandler, eventTopic) {
@@ -2729,13 +2776,29 @@ var Eventbus = /*#__PURE__*/function () {
2729
2776
  };
2730
2777
 
2731
2778
  _proto.registerEventlistener = function registerEventlistener(eventbusListener) {
2779
+ var _this3 = this;
2780
+
2732
2781
  this.eventListeners.push(eventbusListener);
2782
+ return function () {
2783
+ var index = _this3.eventListeners.indexOf(eventbusListener);
2784
+
2785
+ if (index > -1) {
2786
+ _this3.eventListeners.splice(index, 1);
2787
+ }
2788
+ };
2733
2789
  };
2734
2790
 
2735
2791
  _proto.registerInterceptor = function registerInterceptor(eventName, interceptor, eventTopic) {
2736
2792
  var interceptors = this._getEventInterceptors(eventName, eventTopic);
2737
2793
 
2738
2794
  interceptors.push(interceptor);
2795
+ return function () {
2796
+ var index = interceptors.indexOf(interceptor);
2797
+
2798
+ if (index > -1) {
2799
+ interceptors.splice(index, 1);
2800
+ }
2801
+ };
2739
2802
  };
2740
2803
 
2741
2804
  _proto._callHandlers = function _callHandlers(eventName, eventTopic, args) {
@@ -2799,40 +2862,38 @@ var LanguageManager = /*#__PURE__*/function () {
2799
2862
  function LanguageManager(_currentLanguage, labels, _eventbus) {
2800
2863
  this._currentLanguage = void 0;
2801
2864
  this._eventbus = void 0;
2802
- this._labelLookup = {};
2803
- this._eventbusListeners = [];
2865
+ this._labelLookup = void 0;
2866
+ this._eventbusRemovers = [];
2804
2867
  this._currentLanguage = _currentLanguage;
2805
2868
  this._eventbus = _eventbus;
2806
2869
 
2807
- if (!_currentLanguage || !_currentLanguage.length) {
2808
- throw new Error('language ctor arg cannot be null or have zero length');
2809
- }
2810
-
2811
- if (!labels) {
2812
- throw new Error('labels ctor arg cannot be null');
2813
- }
2814
-
2815
- if (!_eventbus) {
2816
- throw new Error('eventbus ctor arg cannot be null');
2870
+ if (!_currentLanguage) {
2871
+ throw new Error('language ctor arg cannot have zero length');
2817
2872
  }
2818
2873
 
2819
2874
  this._setRootElementLang(_currentLanguage);
2820
2875
 
2821
- this._createLabelLookup(labels);
2876
+ this._labelLookup = this._createLabelLookup(labels);
2822
2877
 
2823
2878
  this._addEventbusListeners(_eventbus);
2824
2879
  }
2825
2880
 
2826
2881
  var _proto = LanguageManager.prototype;
2827
2882
 
2883
+ _proto.destroy = function destroy() {
2884
+ this._eventbusRemovers.forEach(function (x) {
2885
+ return x();
2886
+ });
2887
+ };
2888
+
2828
2889
  _proto._addEventbusListeners = function _addEventbusListeners(eventbus) {
2829
- this._eventbusListeners.push(eventbus.on(TimelineEventNames.REQUEST_LABEL_COLLECTION, this._handleRequestLabelCollection.bind(this)));
2890
+ this._eventbusRemovers.push(eventbus.on(TimelineEventNames.REQUEST_LABEL_COLLECTION, this._handleRequestLabelCollection.bind(this)));
2830
2891
 
2831
- this._eventbusListeners.push(eventbus.on(TimelineEventNames.REQUEST_LABEL_COLLECTIONS, this._handleRequestLabelCollections.bind(this)));
2892
+ this._eventbusRemovers.push(eventbus.on(TimelineEventNames.REQUEST_LABEL_COLLECTIONS, this._handleRequestLabelCollections.bind(this)));
2832
2893
 
2833
- this._eventbusListeners.push(eventbus.on(TimelineEventNames.REQUEST_CURRENT_LANGUAGE, this._handleRequestCurrentLanguage.bind(this)));
2894
+ this._eventbusRemovers.push(eventbus.on(TimelineEventNames.REQUEST_CURRENT_LANGUAGE, this._handleRequestCurrentLanguage.bind(this)));
2834
2895
 
2835
- this._eventbusListeners.push(eventbus.on(TimelineEventNames.LANGUAGE_CHANGE, this._handleLanguageChange.bind(this)));
2896
+ this._eventbusRemovers.push(eventbus.on(TimelineEventNames.LANGUAGE_CHANGE, this._handleLanguageChange.bind(this)));
2836
2897
  };
2837
2898
 
2838
2899
  _proto._handleRequestCurrentLanguage = function _handleRequestCurrentLanguage(resultCallback) {
@@ -2883,11 +2944,10 @@ var LanguageManager = /*#__PURE__*/function () {
2883
2944
  };
2884
2945
 
2885
2946
  _proto._createLabelLookup = function _createLabelLookup(labels) {
2886
- var _this3 = this;
2887
-
2888
- labels.forEach(function (label) {
2889
- _this3._labelLookup[label.id] = label.labels;
2890
- });
2947
+ return labels.reduce(function (acc, label) {
2948
+ acc[label.id] = label.labels;
2949
+ return acc;
2950
+ }, {});
2891
2951
  };
2892
2952
 
2893
2953
  return LanguageManager;
@@ -2895,47 +2955,93 @@ var LanguageManager = /*#__PURE__*/function () {
2895
2955
 
2896
2956
  var EngineFactory = /*#__PURE__*/function () {
2897
2957
  function EngineFactory(importer, windowRef, options) {
2898
- var _options$devtools;
2958
+ var _options$eventbus, _options$devtools;
2899
2959
 
2900
- this.resizeTimeout = -1;
2901
- this.actionsLookup = {};
2902
- this.importer = void 0;
2903
- this.eventbus = void 0;
2904
- this._handleSpaceBound = void 0;
2905
- this.importer = importer;
2906
- this.eventbus = (options == null ? void 0 : options.eventbus) || new Eventbus();
2960
+ this._actionsLookup = {};
2961
+ this._eventbus = void 0;
2962
+ this._eventRemovers = [];
2963
+ this._importer = void 0;
2964
+ this._resizeTimeout = -1;
2965
+ this._importer = importer;
2966
+ this._eventbus = (_options$eventbus = options == null ? void 0 : options.eventbus) != null ? _options$eventbus : new Eventbus();
2907
2967
  Diagnostics.active = (_options$devtools = options == null ? void 0 : options.devtools) != null ? _options$devtools : false;
2908
2968
 
2909
2969
  if (Diagnostics.active) {
2910
- this._initializeDevtools(this.eventbus);
2970
+ this._initializeDevtools(this._eventbus);
2911
2971
  }
2912
2972
 
2913
- this.eventbus.on(TimelineEventNames.REQUEST_INSTANCE, this._requestInstanceHandler.bind(this));
2914
- this.eventbus.on(TimelineEventNames.REQUEST_ACTION, this._requestActionHandler.bind(this));
2915
- this.eventbus.on(TimelineEventNames.REQUEST_FUNCTION, this._requestFunctionHandler.bind(this));
2916
- this._handleSpaceBound = this._handleSpacePress.bind(this);
2917
- hotkeys__default["default"]('space', this._handleSpaceBound);
2918
- $__default["default"](windowRef).resize(this._resizeHandler.bind(this));
2973
+ this._eventRemovers.push(this._eventbus.on(TimelineEventNames.REQUEST_INSTANCE, this._requestInstanceHandler.bind(this)));
2974
+
2975
+ this._eventRemovers.push(this._eventbus.on(TimelineEventNames.REQUEST_ACTION, this._requestActionHandler.bind(this)));
2976
+
2977
+ this._eventRemovers.push(this._eventbus.on(TimelineEventNames.REQUEST_FUNCTION, this._requestFunctionHandler.bind(this)));
2978
+
2979
+ var handleSpaceBound = this._handleSpacePress.bind(this);
2980
+
2981
+ hotkeys__default["default"]('space', handleSpaceBound);
2982
+
2983
+ this._eventRemovers.push(function () {
2984
+ return hotkeys__default["default"].unbind('space', handleSpaceBound);
2985
+ });
2986
+
2987
+ var resizeBound = this._resizeHandler.bind(this);
2988
+
2989
+ var jqWin = $__default["default"](windowRef);
2990
+ jqWin.on('resize', resizeBound);
2991
+
2992
+ this._eventRemovers.push(function () {
2993
+ return jqWin.off('resize', resizeBound);
2994
+ });
2919
2995
  }
2920
2996
 
2921
2997
  var _proto = EngineFactory.prototype;
2922
2998
 
2923
2999
  _proto._handleSpacePress = function _handleSpacePress(keyboardEvent, _hotkeysEvent) {
2924
3000
  keyboardEvent.preventDefault();
2925
- this.eventbus.broadcast(TimelineEventNames.PLAY_TOGGLE_REQUEST);
3001
+
3002
+ this._eventbus.broadcast(TimelineEventNames.PLAY_TOGGLE_REQUEST);
3003
+
2926
3004
  return false;
2927
3005
  };
2928
3006
 
2929
3007
  _proto._initializeDevtools = function _initializeDevtools(eventbus) {
3008
+ var _this = this;
3009
+
2930
3010
  var diagnosticInfo = window[DEV_TOOLS_KEY];
2931
3011
 
2932
3012
  if (diagnosticInfo) {
2933
3013
  var agent = diagnosticInfo.agent;
2934
- var eventbusListener = new DevToolEventListener(agent);
2935
- eventbus.registerEventlistener(eventbusListener);
2936
3014
 
2937
- Diagnostics.send = function (name, data) {
2938
- var message = prepareValueForSerialization(data);
3015
+ this._eventRemovers.push(eventbus.registerEventlistener(new DevToolEventListener(agent)));
3016
+
3017
+ this._eventRemovers.push(agent.subscribe(function (message) {
3018
+ if (message.type === 'playcontrol') {
3019
+ switch (message.data.kind) {
3020
+ case 'play':
3021
+ _this._eventbus.broadcast(TimelineEventNames.PLAY_REQUEST);
3022
+
3023
+ break;
3024
+
3025
+ case 'stop':
3026
+ _this._eventbus.broadcast(TimelineEventNames.STOP_REQUEST);
3027
+
3028
+ break;
3029
+
3030
+ case 'pause':
3031
+ _this._eventbus.broadcast(TimelineEventNames.PAUSE_REQUEST);
3032
+
3033
+ break;
3034
+
3035
+ case 'seek':
3036
+ _this._eventbus.broadcast(TimelineEventNames.SEEK_REQUEST, [message.data.args]);
3037
+
3038
+ break;
3039
+ }
3040
+ }
3041
+ }));
3042
+
3043
+ Diagnostics.send = function (name, messageData) {
3044
+ var message = prepareValueForSerialization(messageData);
2939
3045
 
2940
3046
  try {
2941
3047
  agent.postMessage(name, message);
@@ -2948,35 +3054,37 @@ var EngineFactory = /*#__PURE__*/function () {
2948
3054
 
2949
3055
  Diagnostics.send('eligius-diagnostics-factory', 'Diagnostics initialized');
2950
3056
  } else {
2951
- console.warn(DEV_TOOLS_KEY + " property not found on window, please install the extension.");
3057
+ console.warn(DEV_TOOLS_KEY + " property not found on window, please install the Eligius Devtools extension.");
2952
3058
  }
2953
3059
  };
2954
3060
 
2955
3061
  _proto.destroy = function destroy() {
2956
- this.eventbus.clear();
2957
- hotkeys__default["default"].unbind('space', this._handleSpaceBound);
3062
+ this._eventRemovers.forEach(function (x) {
3063
+ return x();
3064
+ });
2958
3065
  };
2959
3066
 
2960
3067
  _proto._resizeHandler = function _resizeHandler() {
2961
- var _this = this;
3068
+ var _this2 = this;
2962
3069
 
2963
- if (this.resizeTimeout) {
2964
- clearTimeout(this.resizeTimeout);
3070
+ if (this._resizeTimeout) {
3071
+ clearTimeout(this._resizeTimeout);
3072
+ this._resizeTimeout = -1;
2965
3073
  }
2966
3074
 
2967
- this.resizeTimeout = setTimeout(function () {
2968
- _this.eventbus.broadcast(TimelineEventNames.RESIZE);
3075
+ this._resizeTimeout = setTimeout(function () {
3076
+ _this2._eventbus.broadcast(TimelineEventNames.RESIZE);
2969
3077
  }, 200);
2970
3078
  };
2971
3079
 
2972
3080
  _proto._importSystemEntryWithEventbusDependency = function _importSystemEntryWithEventbusDependency(systemName) {
2973
3081
  var ctor = this._importSystemEntry(systemName);
2974
3082
 
2975
- return new ctor(this.eventbus);
3083
+ return new ctor(this._eventbus);
2976
3084
  };
2977
3085
 
2978
3086
  _proto._importSystemEntry = function _importSystemEntry(systemName) {
2979
- return this.importer["import"](systemName)[systemName];
3087
+ return this._importer["import"](systemName)[systemName];
2980
3088
  };
2981
3089
 
2982
3090
  _proto._requestInstanceHandler = function _requestInstanceHandler(systemName, resultCallback) {
@@ -2988,7 +3096,7 @@ var EngineFactory = /*#__PURE__*/function () {
2988
3096
  };
2989
3097
 
2990
3098
  _proto._requestActionHandler = function _requestActionHandler(systemName, resultCallback) {
2991
- var action = this.actionsLookup[systemName];
3099
+ var action = this._actionsLookup[systemName];
2992
3100
 
2993
3101
  if (action) {
2994
3102
  resultCallback(action);
@@ -3009,29 +3117,31 @@ var EngineFactory = /*#__PURE__*/function () {
3009
3117
 
3010
3118
  if ((_configuration$eventA = configuration.eventActions) != null && _configuration$eventA.length) {
3011
3119
  actionRegistryListener = new ActionRegistryEventbusListener();
3012
- this.eventbus.registerEventlistener(actionRegistryListener);
3120
+
3121
+ this._eventRemovers.push(this._eventbus.registerEventlistener(actionRegistryListener));
3013
3122
  }
3014
3123
 
3015
- this.eventbus.registerInterceptor(TimelineEventNames.REQUEST_TIMELINE_URI, new RequestVideoUriInterceptor(this.eventbus));
3016
- resolver = resolver || new ConfigurationResolver(this.importer, this.eventbus);
3124
+ this._eventRemovers.push(this._eventbus.registerInterceptor(TimelineEventNames.REQUEST_TIMELINE_URI, new RequestVideoUriInterceptor(this._eventbus)));
3125
+
3126
+ resolver = resolver || new ConfigurationResolver(this._importer, this._eventbus);
3017
3127
 
3018
3128
  var _resolver$process = resolver.process(configuration, actionRegistryListener),
3019
3129
  actionLookup = _resolver$process[0],
3020
3130
  resolvedConfiguration = _resolver$process[1];
3021
3131
 
3022
- this.actionsLookup = actionLookup;
3132
+ this._actionsLookup = actionLookup;
3023
3133
 
3024
- var timelineProviders = this._createTimelineProviders(resolvedConfiguration, this.eventbus);
3134
+ var timelineProviders = this._createTimelineProviders(resolvedConfiguration, this._eventbus);
3025
3135
 
3026
3136
  var language = configuration.language,
3027
3137
  labels = configuration.labels;
3028
- var languageManager = new LanguageManager(language, labels, this.eventbus);
3029
- var engineInstance = new EngineClass(resolvedConfiguration, this.eventbus, timelineProviders, languageManager);
3138
+ var languageManager = new LanguageManager(language, labels, this._eventbus);
3139
+ var engineInstance = new EngineClass(resolvedConfiguration, this._eventbus, timelineProviders, languageManager);
3030
3140
  return engineInstance;
3031
3141
  };
3032
3142
 
3033
3143
  _proto._createTimelineProviders = function _createTimelineProviders(configuration, eventbus) {
3034
- var _this2 = this;
3144
+ var _this3 = this;
3035
3145
 
3036
3146
  var timelineProviderSettings = configuration.timelineProviderSettings;
3037
3147
  var result = Object.entries(timelineProviderSettings).reduce(function (acc, _ref) {
@@ -3042,7 +3152,7 @@ var EngineFactory = /*#__PURE__*/function () {
3042
3152
  return acc;
3043
3153
  }
3044
3154
 
3045
- var timelineProviderClass = _this2._importSystemEntry(settings.systemName);
3155
+ var timelineProviderClass = _this3._importSystemEntry(settings.systemName);
3046
3156
 
3047
3157
  acc[timelineType] = {
3048
3158
  id: settings.id,
@@ -3312,10 +3422,8 @@ var calc$1 = function calc(operationData) {
3312
3422
  var _operationData = operationData,
3313
3423
  left = _operationData.left,
3314
3424
  right = _operationData.right,
3315
- operator = _operationData.operator,
3316
- _operationData$proper = _operationData.propertyName,
3317
- propertyName = _operationData$proper === void 0 ? 'calculationResult' : _operationData$proper;
3318
- operationData[propertyName] = calcFunctions[operator](+left, +right);
3425
+ operator = _operationData.operator;
3426
+ operationData.calculationResult = calcFunctions[operator](+left, +right);
3319
3427
  return operationData;
3320
3428
  };
3321
3429
 
@@ -3360,17 +3468,14 @@ var createElement$1 = function createElement(operationData) {
3360
3468
  var _operationData = operationData,
3361
3469
  elementName = _operationData.elementName,
3362
3470
  attributes = _operationData.attributes,
3363
- text = _operationData.text,
3364
- _operationData$proper = _operationData.propertyName,
3365
- propertyName = _operationData$proper === void 0 ? 'template' : _operationData$proper;
3471
+ text = _operationData.text;
3366
3472
  var serializedAttrs = attributes ? ' ' + Object.entries(attributes).map(function (_ref) {
3367
3473
  var key = _ref[0],
3368
3474
  value = _ref[1];
3369
3475
  return key + "=\"" + value + "\"";
3370
3476
  }).join(' ') : '';
3371
3477
  var template = text ? $__default["default"]("<" + elementName + serializedAttrs + ">" + text + "</" + elementName + ">") : $__default["default"]("<" + elementName + serializedAttrs + "/>");
3372
- operationData[propertyName] = template;
3373
- delete operationData.propertyName;
3478
+ operationData.template = template;
3374
3479
  return operationData;
3375
3480
  };
3376
3481
 
@@ -3484,25 +3589,21 @@ var getControllerFromElement$1 = function getControllerFromElement(operationData
3484
3589
 
3485
3590
  /**
3486
3591
  * This operation retrieves an instance of the given controller name.
3487
- * It assigns this instance to the property on the current operation data
3488
- * defined by the propertyName property which defaults to 'controllerInstance'.
3592
+ * It assigns this instance to the `controllerInstance` property on the current operation data
3489
3593
  *
3490
3594
  * @param operationData
3491
3595
  * @returns
3492
3596
  */
3493
3597
 
3494
3598
  var getControllerInstance$1 = function getControllerInstance(operationData) {
3495
- var systemName = operationData.systemName,
3496
- _operationData$proper = operationData.propertyName,
3497
- propertyName = _operationData$proper === void 0 ? 'controllerInstance' : _operationData$proper;
3498
- operationData[propertyName] = null;
3599
+ var systemName = operationData.systemName;
3600
+ operationData.controllerInstance = undefined;
3499
3601
 
3500
3602
  var resultCallback = function resultCallback(instance) {
3501
- operationData[propertyName] = instance;
3603
+ operationData.controllerInstance = instance;
3502
3604
  };
3503
3605
 
3504
3606
  this.eventbus.broadcast(TimelineEventNames.REQUEST_INSTANCE, [systemName, resultCallback]);
3505
- delete operationData.propertyName;
3506
3607
  return operationData;
3507
3608
  };
3508
3609
 
@@ -3742,13 +3843,58 @@ var getImport$1 = function getImport(operationData) {
3742
3843
  return operationData;
3743
3844
  };
3744
3845
 
3846
+ /**
3847
+ * This operation retrieves the current query parameters from the browser's address bar and places
3848
+ * them on the returned operation data.
3849
+ *
3850
+ * @param operationData
3851
+ * @returns
3852
+ */
3853
+ var getQueryParams$1 = function getQueryParams(operationData) {
3854
+ var searchParams = new URLSearchParams(window.location.search);
3855
+ var queryParams = Object.fromEntries(searchParams.entries());
3856
+ var defaultValues = operationData.defaultValues;
3857
+
3858
+ if (defaultValues) {
3859
+ var defaultEntries = Object.entries(defaultValues).filter(function (_ref) {
3860
+ var name = _ref[0];
3861
+ return !(name in queryParams);
3862
+ });
3863
+ defaultEntries.forEach(function (_ref2) {
3864
+ var name = _ref2[0],
3865
+ value = _ref2[1];
3866
+ return queryParams[name] = value;
3867
+ });
3868
+ delete operationData.defaultValues;
3869
+ }
3870
+
3871
+ operationData.queryParams = queryParams;
3872
+ return operationData;
3873
+ };
3874
+
3875
+ /**
3876
+ * This operation invokes the specified method on the given object with the optional specified arguments
3877
+ * and assigns the result to the `methodResult` property.
3878
+ *
3879
+ * @param operationData
3880
+ * @returns
3881
+ */
3882
+ var invokeObjectMethod$1 = function invokeObjectMethod(operationData) {
3883
+ var methodName = operationData.methodName,
3884
+ methodArguments = operationData.methodArguments;
3885
+ delete operationData.methodName;
3886
+ delete operationData.methodArguments;
3887
+ operationData.methodResult = operationData.instance[methodName].apply(operationData.instance, methodArguments != null ? methodArguments : []);
3888
+ return operationData;
3889
+ };
3890
+
3745
3891
  var jsonCache = {};
3746
3892
  var addToCache = function addToCache(key, value) {
3747
3893
  jsonCache[key] = value;
3748
3894
  };
3749
3895
  /**
3750
- * This operation loads a JSON file from the specified url and assigns it to the specified
3751
- * property name on the current operation data. The property name defaults to 'json'.
3896
+ * This operation loads a JSON file from the specified url and assigns it to the json
3897
+ * property on the current operation data.
3752
3898
  *
3753
3899
  * If the cache property is set to true and a cached value already exists, this is assigned
3754
3900
  * instead of re-retrieving it from the url.
@@ -3759,47 +3905,41 @@ var addToCache = function addToCache(key, value) {
3759
3905
 
3760
3906
  var loadJSON$1 = function loadJSON(operationData) {
3761
3907
  var url = operationData.url,
3762
- cache = operationData.cache,
3763
- _operationData$proper = operationData.propertyName,
3764
- propertyName = _operationData$proper === void 0 ? 'json' : _operationData$proper;
3908
+ cache = operationData.cache;
3765
3909
 
3766
3910
  if (cache && jsonCache[url]) {
3767
- operationData[propertyName] = jsonCache[url];
3768
- delete operationData.propertyName;
3911
+ operationData.json = jsonCache[url];
3769
3912
  return operationData;
3770
3913
  }
3771
3914
 
3772
- return new Promise(function (resolve, reject) {
3773
- fetch(url).then( /*#__PURE__*/function () {
3774
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(response) {
3775
- var json, cacheValue;
3776
- return _regeneratorRuntime().wrap(function _callee$(_context) {
3777
- while (1) {
3778
- switch (_context.prev = _context.next) {
3779
- case 0:
3780
- _context.next = 2;
3781
- return response.json();
3915
+ return fetch(url).then( /*#__PURE__*/function () {
3916
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(response) {
3917
+ var json, cacheValue;
3918
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
3919
+ while (1) {
3920
+ switch (_context.prev = _context.next) {
3921
+ case 0:
3922
+ _context.next = 2;
3923
+ return response.json();
3782
3924
 
3783
- case 2:
3784
- json = _context.sent;
3785
- cacheValue = operationData[propertyName] = json;
3786
- delete operationData.propertyName;
3787
- addToCache(url, cacheValue);
3788
- resolve(operationData);
3925
+ case 2:
3926
+ json = _context.sent;
3927
+ cacheValue = operationData.json = json;
3928
+ addToCache(url, cacheValue);
3929
+ return _context.abrupt("return", operationData);
3789
3930
 
3790
- case 7:
3791
- case "end":
3792
- return _context.stop();
3793
- }
3931
+ case 6:
3932
+ case "end":
3933
+ return _context.stop();
3794
3934
  }
3795
- }, _callee);
3796
- }));
3935
+ }
3936
+ }, _callee);
3937
+ }));
3797
3938
 
3798
- return function (_x) {
3799
- return _ref.apply(this, arguments);
3800
- };
3801
- }())["catch"](reject);
3802
- });
3939
+ return function (_x) {
3940
+ return _ref.apply(this, arguments);
3941
+ };
3942
+ }());
3803
3943
  };
3804
3944
 
3805
3945
  /**
@@ -3831,10 +3971,8 @@ var math$1 = function math(operationData) {
3831
3971
  operationData.args = resolveMathConstants(operationData.args);
3832
3972
  var _operationData = operationData,
3833
3973
  args = _operationData.args,
3834
- functionName = _operationData.functionName,
3835
- _operationData$proper = _operationData.propertyName,
3836
- propertyName = _operationData$proper === void 0 ? 'mathResult' : _operationData$proper;
3837
- operationData[propertyName] = Math[functionName].apply(null, args);
3974
+ functionName = _operationData.functionName;
3975
+ operationData.mathResult = Math[functionName].apply(null, args);
3838
3976
  return operationData;
3839
3977
  };
3840
3978
 
@@ -3903,17 +4041,22 @@ var removeElement$1 = function removeElement(operationData) {
3903
4041
 
3904
4042
  /**
3905
4043
  * This operation removes the given list of properties from the current operation data.
4044
+ * It will also omit the property 'propertyNames' from the result.
3906
4045
  *
3907
4046
  * @param operationData
3908
4047
  * @returns
3909
4048
  */
3910
4049
  var removePropertiesFromOperationData$1 = function removePropertiesFromOperationData(operationData) {
3911
4050
  var propertyNames = operationData.propertyNames;
3912
- propertyNames.forEach(function (name) {
3913
- delete operationData[name];
3914
- });
3915
- delete operationData.propertyNames;
3916
- return operationData;
4051
+
4052
+ if (propertyNames.indexOf('propertyNames') < 0) {
4053
+ propertyNames.push('propertyNames');
4054
+ }
4055
+
4056
+ return Object.fromEntries(Object.entries(operationData).filter(function (_ref) {
4057
+ var name = _ref[0];
4058
+ return !propertyNames.includes(name);
4059
+ }));
3917
4060
  };
3918
4061
 
3919
4062
  /**
@@ -3969,25 +4112,21 @@ var resizeAction$1 = function resizeAction(operationData) {
3969
4112
  return operationData;
3970
4113
  };
3971
4114
 
3972
- function findElementBySelector(root, selector, operationData, propertyName) {
4115
+ function findElementBySelector(root, selector) {
3973
4116
  var element = root.find(selector);
3974
4117
 
3975
4118
  if (!element.length) {
3976
4119
  console.warn("selector '" + selector + "' wasn't found!");
3977
4120
  }
3978
4121
 
3979
- operationData[propertyName] = element;
3980
-
3981
- if (operationData.hasOwnProperty('propertyName')) {
3982
- delete operationData.propertyName;
3983
- }
4122
+ return element;
3984
4123
  }
3985
4124
  /**
3986
4125
  * This operation selects one or more elements using the specified selector.
3987
4126
  *
3988
4127
  * If useSelectedElementAsRoot is set to true and a valid DOM element is assigned
3989
- * to the current operation data defined by the given property name (defaults to 'selectedElement')
3990
- * then the element will be looked for only in the child elements of this DOM element.
4128
+ * to the current operation data's `selectedElement` property
4129
+ * then the element will be looked for only in the descendant elements of this DOM element.
3991
4130
  *
3992
4131
  * @param operationData
3993
4132
  * @returns
@@ -3996,23 +4135,21 @@ function findElementBySelector(root, selector, operationData, propertyName) {
3996
4135
 
3997
4136
  var selectElement$1 = function selectElement(operationData) {
3998
4137
  var selector = operationData.selector,
3999
- _operationData$proper = operationData.propertyName,
4000
- propertyName = _operationData$proper === void 0 ? 'selectedElement' : _operationData$proper,
4001
4138
  _operationData$useSel = operationData.useSelectedElementAsRoot,
4002
4139
  useSelectedElementAsRoot = _operationData$useSel === void 0 ? false : _operationData$useSel;
4003
4140
 
4004
4141
  if (!selector) {
4005
- throw new Error('selector is undefined!');
4142
+ throw new Error('selectElement: selector is either empty or not defined.');
4006
4143
  }
4007
4144
 
4008
- if (useSelectedElementAsRoot && operationData[propertyName]) {
4009
- var currentRoot = operationData[propertyName];
4010
- findElementBySelector(currentRoot, selector, operationData, propertyName);
4145
+ if (useSelectedElementAsRoot && operationData.selectedElement) {
4146
+ var currentRoot = operationData.selectedElement;
4147
+ operationData.selectedElement = findElementBySelector(currentRoot, selector);
4011
4148
  return operationData;
4012
4149
  }
4013
4150
 
4014
4151
  var rootCallback = function rootCallback(root) {
4015
- findElementBySelector(root, selector, operationData, propertyName);
4152
+ operationData.selectedElement = findElementBySelector(root, selector);
4016
4153
  };
4017
4154
 
4018
4155
  this.eventbus.broadcast(TimelineEventNames.REQUEST_ENGINE_ROOT, [rootCallback]);
@@ -4101,19 +4238,15 @@ var setOperationData$1 = function setOperationData(operationData) {
4101
4238
  /**
4102
4239
  * This operation assigns the specified CSS style properties to the
4103
4240
  * specified selected element. The selected element is assigned to
4104
- * the property defined by the propertyName property which defaults
4105
- * to 'selectedElement'.
4241
+ * the `selectedElement` property.
4106
4242
  *
4107
4243
  * @param operationData
4108
4244
  * @returns
4109
4245
  */
4110
4246
 
4111
4247
  var setStyle$1 = function setStyle(operationData) {
4112
- var _operationData$proper = operationData.propertyName,
4113
- propertyName = _operationData$proper === void 0 ? 'selectedElement' : _operationData$proper;
4114
4248
  var properties = resolvePropertyValues(operationData, operationData.properties);
4115
- operationData[propertyName].css(properties);
4116
- delete operationData.propertyName;
4249
+ operationData.selectedElement.css(properties);
4117
4250
  return operationData;
4118
4251
  };
4119
4252
 
@@ -4148,19 +4281,16 @@ var startAction$1 = function startAction(operationData) {
4148
4281
  * This operation starts a loop using the given collection.
4149
4282
  *
4150
4283
  * Each iteration the current item from the specified collection is
4151
- * assigned to the property on the current operation data specified
4152
- * by the propertyName property which defaults to 'currentItem'.
4284
+ * assigned to the `currentItem` property on the current operation data.
4153
4285
  *
4154
4286
  * @param operationData
4155
4287
  * @returns
4156
4288
  */
4157
4289
  var startLoop$1 = function startLoop(operationData) {
4158
4290
  var context = this;
4159
- var collection = operationData.collection,
4160
- _operationData$proper = operationData.propertyName,
4161
- propertyName = _operationData$proper === void 0 ? 'currentItem' : _operationData$proper;
4291
+ var collection = operationData.collection;
4162
4292
 
4163
- if (typeof collection === 'string') {
4293
+ if (collection !== null && !Array.isArray(collection)) {
4164
4294
  throw new Error('Expected collection to be array type, string value was probably not resolved correctly');
4165
4295
  }
4166
4296
 
@@ -4175,10 +4305,9 @@ var startLoop$1 = function startLoop(operationData) {
4175
4305
  }
4176
4306
 
4177
4307
  if (collection != null && collection.length && context.loopIndex !== undefined) {
4178
- operationData[propertyName] = collection[context.loopIndex];
4308
+ operationData.currentItem = collection[context.loopIndex];
4179
4309
  }
4180
4310
 
4181
- delete operationData.propertyName;
4182
4311
  return operationData;
4183
4312
  };
4184
4313
 
@@ -4241,6 +4370,8 @@ var ops = {
4241
4370
  getControllerInstance: getControllerInstance$1,
4242
4371
  getElementDimensions: getElementDimensions$1,
4243
4372
  getImport: getImport$1,
4373
+ getQueryParams: getQueryParams$1,
4374
+ invokeObjectMethod: invokeObjectMethod$1,
4244
4375
  loadJSON: loadJSON$1,
4245
4376
  log: log$1,
4246
4377
  math: math$1,
@@ -4863,7 +4994,7 @@ function animate() {
4863
4994
  required: true
4864
4995
  },
4865
4996
  animationDuration: {
4866
- type: 'ParameterType:integer',
4997
+ type: 'ParameterType:number',
4867
4998
  required: true
4868
4999
  }
4869
5000
  }
@@ -4900,15 +5031,15 @@ function broadcastEvent() {
4900
5031
 
4901
5032
  function calc() {
4902
5033
  return {
4903
- description: 'clears the given element',
5034
+ description: 'Calculates the given left and right hand sides using the specified operator',
4904
5035
  properties: {
4905
5036
  left: {
4906
- type: 'ParameterType:integer',
5037
+ type: 'ParameterType:number',
4907
5038
  description: 'The left operand',
4908
5039
  required: true
4909
5040
  },
4910
5041
  right: {
4911
- type: 'ParameterType:integer',
5042
+ type: 'ParameterType:number',
4912
5043
  description: 'The right operand',
4913
5044
  required: true
4914
5045
  },
@@ -4930,18 +5061,11 @@ function calc() {
4930
5061
  }, {
4931
5062
  value: '**',
4932
5063
  description: 'Exponent: Raises a base number to the exponent power, that is, the base number multiplied by itself, exponent times.'
4933
- }],
4934
- propertyName: {
4935
- type: 'ParameterType:string',
4936
- defaultValue: 'calculationResult'
4937
- }
5064
+ }]
5065
+ },
5066
+ outputProperties: {
5067
+ calculationResult: 'ParameterType:number'
4938
5068
  }
4939
- /*outputProperties: {
4940
- propertyName: {
4941
- type: 'ParameterType:integer',
4942
- },
4943
- },*/
4944
-
4945
5069
  };
4946
5070
  }
4947
5071
 
@@ -5039,10 +5163,6 @@ function getControllerInstance() {
5039
5163
  systemName: {
5040
5164
  type: 'ParameterType:controllerName',
5041
5165
  required: true
5042
- },
5043
- propertyName: {
5044
- type: 'ParameterType:string',
5045
- defaultValue: 'controllerInstance'
5046
5166
  }
5047
5167
  },
5048
5168
  outputProperties: {
@@ -5079,6 +5199,35 @@ function getImport() {
5079
5199
  };
5080
5200
  }
5081
5201
 
5202
+ function getQueryParams() {
5203
+ return {
5204
+ description: "Retrieves the current query parameters from the browser's address bar",
5205
+ outputProperties: {
5206
+ queryParams: 'ParameterType:object'
5207
+ }
5208
+ };
5209
+ }
5210
+
5211
+ function invokeObjectMethod() {
5212
+ return {
5213
+ description: 'Invokes the specified method on the given object with the optional specified arguments',
5214
+ properties: {
5215
+ instance: {
5216
+ type: 'ParameterType:object',
5217
+ required: true
5218
+ },
5219
+ methodName: {
5220
+ type: 'ParameterType:string',
5221
+ required: true
5222
+ },
5223
+ methodArguments: 'ParameterType:array'
5224
+ },
5225
+ outputProperties: {
5226
+ methodResult: 'ParameterType:object'
5227
+ }
5228
+ };
5229
+ }
5230
+
5082
5231
  function loadJSON() {
5083
5232
  return {
5084
5233
  description: 'Load JSON from the given url',
@@ -5087,11 +5236,7 @@ function loadJSON() {
5087
5236
  type: 'ParameterType:url',
5088
5237
  required: true
5089
5238
  },
5090
- cache: 'ParameterType:boolean',
5091
- propertyName: {
5092
- type: 'ParameterType:string',
5093
- defaultValue: 'json'
5094
- }
5239
+ cache: 'ParameterType:boolean'
5095
5240
  },
5096
5241
  outputProperties: {
5097
5242
  json: 'ParameterType:object'
@@ -5114,10 +5259,7 @@ function math() {
5114
5259
  required: true
5115
5260
  },
5116
5261
  functionName: createMathFunctionNames(),
5117
- propertyName: {
5118
- type: 'ParameterType:string',
5119
- defaultValue: 'mathResult'
5120
- }
5262
+ mathResult: 'ParameterType:number'
5121
5263
  }
5122
5264
  };
5123
5265
  }
@@ -5220,11 +5362,10 @@ function selectElement() {
5220
5362
  type: 'ParameterType:selector',
5221
5363
  required: true
5222
5364
  },
5223
- propertyName: 'ParameterType:string',
5224
5365
  useSelectedElementAsRoot: 'ParameterType:boolean'
5225
5366
  },
5226
5367
  outputProperties: {
5227
- selectedElement: 'ParameterType:object'
5368
+ selectedElement: 'ParameterType:jQuery'
5228
5369
  }
5229
5370
  };
5230
5371
  }
@@ -5287,10 +5428,7 @@ function setStyle() {
5287
5428
  type: 'ParameterType:object',
5288
5429
  required: true
5289
5430
  },
5290
- propertyName: {
5291
- type: 'ParameterType:string',
5292
- required: false
5293
- }
5431
+ selectedElement: 'ParameterType:jQuery'
5294
5432
  }
5295
5433
  };
5296
5434
  }
@@ -5313,10 +5451,7 @@ function startLoop() {
5313
5451
  type: 'ParameterType:array',
5314
5452
  required: true
5315
5453
  },
5316
- propertyName: {
5317
- type: 'ParameterType:string',
5318
- defaultValue: 'currentItem'
5319
- }
5454
+ currentItem: 'ParameterType:object'
5320
5455
  }
5321
5456
  };
5322
5457
  }
@@ -5346,7 +5481,7 @@ function wait() {
5346
5481
  description: 'Waits the given amount of milliseconds before the action continues',
5347
5482
  properties: {
5348
5483
  milliseconds: {
5349
- type: 'ParameterType:integer',
5484
+ type: 'ParameterType:number',
5350
5485
  required: true
5351
5486
  }
5352
5487
  }
@@ -5372,6 +5507,8 @@ var index = {
5372
5507
  getControllerInstance: getControllerInstance,
5373
5508
  getElementDimensions: getElementDimensions,
5374
5509
  getImport: getImport,
5510
+ getQueryParams: getQueryParams,
5511
+ invokeObjectMethod: invokeObjectMethod,
5375
5512
  loadJSON: loadJSON,
5376
5513
  log: log,
5377
5514
  math: math,
@@ -5436,6 +5573,8 @@ exports.getControllerFromElement = getControllerFromElement$1;
5436
5573
  exports.getControllerInstance = getControllerInstance$1;
5437
5574
  exports.getElementDimensions = getElementDimensions$1;
5438
5575
  exports.getImport = getImport$1;
5576
+ exports.getQueryParams = getQueryParams$1;
5577
+ exports.invokeObjectMethod = invokeObjectMethod$1;
5439
5578
  exports.loadJSON = loadJSON$1;
5440
5579
  exports.log = log$1;
5441
5580
  exports.math = math$1;