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
@@ -1,176 +1,11 @@
1
+ import $ from 'jquery';
1
2
  import { isDefined } from 'ts-is-present';
2
3
  import fs from 'fs';
3
4
  import path from 'path';
4
5
  import lottie from 'lottie-web';
5
- import $ from 'jquery';
6
6
  import hotkeys from 'hotkeys-js';
7
7
  import { v4 } from 'uuid';
8
8
 
9
- function prepareValueForSerialization(value) {
10
- if (Array.isArray(value)) {
11
- return value.map(prepareValueForSerialization);
12
- } else if (value instanceof jQuery) {
13
- return 'jQuery object';
14
- } else if (typeof value === 'object') {
15
- return Object.fromEntries(Object.entries(value).map(function (_ref) {
16
- var name = _ref[0],
17
- value = _ref[1];
18
- return [name, prepareValueForSerialization(value)];
19
- }));
20
- } else if (typeof value === 'function') {
21
- var funcString = value.toString();
22
- return funcString.substring(0, funcString.indexOf('{') + 1);
23
- }
24
-
25
- return value;
26
- }
27
-
28
- var DevToolEventListener = /*#__PURE__*/function () {
29
- function DevToolEventListener(agent) {
30
- this.agent = void 0;
31
- this.agent = agent;
32
- }
33
-
34
- var _proto = DevToolEventListener.prototype;
35
-
36
- _proto.handleEvent = function handleEvent(eventName, eventTopic, args) {
37
- var message = {
38
- eventName: eventName,
39
- eventTopic: eventTopic,
40
- args: prepareValueForSerialization(args)
41
- };
42
-
43
- try {
44
- this.agent.postMessage('eligius-diagnostics-event', message);
45
- } catch (e) {
46
- console.error('postmessage failed');
47
- console.error(e);
48
- console.log('message', message);
49
- }
50
- };
51
-
52
- return DevToolEventListener;
53
- }();
54
-
55
- var Diagnostics = /*#__PURE__*/function () {
56
- function Diagnostics() {}
57
-
58
- Diagnostics.send = function send(_name, _data) {
59
- console.log(_name, _data);
60
- };
61
-
62
- return Diagnostics;
63
- }();
64
- Diagnostics.active = void 0;
65
-
66
- var DEV_TOOLS_KEY = '__ELIGIUS_DEV_TOOLS__';
67
-
68
- var copyFunction = typeof structuredClone !== 'undefined' ? structuredClone : function (original) {
69
- return JSON.parse(JSON.stringify(original));
70
- };
71
- function deepCopy(original) {
72
- if (isDefined(original)) {
73
- return copyFunction(original);
74
- }
75
-
76
- return original;
77
- }
78
-
79
- function isPromise(obj) {
80
- return typeof obj === 'object' && typeof obj.then === 'function';
81
- }
82
-
83
- var Action = /*#__PURE__*/function () {
84
- function Action(name, startOperations, eventbus) {
85
- this.name = void 0;
86
- this.startOperations = void 0;
87
- this.eventbus = void 0;
88
- this.id = '';
89
- this.name = name;
90
- this.startOperations = startOperations;
91
- this.eventbus = eventbus;
92
- }
93
-
94
- var _proto = Action.prototype;
95
-
96
- _proto.start = function start(initOperationData) {
97
- var _this$name,
98
- _this = this;
99
-
100
- Diagnostics.active && Diagnostics.send('eligius-diagnostics-action', ((_this$name = this.name) != null ? _this$name : 'Action') + " begins executing start operations");
101
- var context = {
102
- currentIndex: -1,
103
- eventbus: this.eventbus
104
- };
105
- var result = new Promise(function (resolve, reject) {
106
- _this.executeOperation(_this.startOperations, 0, resolve, reject, initOperationData, context);
107
- })["catch"](function (e) {
108
- Diagnostics.active && Diagnostics.send('eligius-diagnostics-action-error', {
109
- name: name,
110
- error: e
111
- });
112
- console.error("Error in action start '" + _this.name + "'");
113
- console.error(e);
114
- throw e;
115
- });
116
- return !Diagnostics.active ? result : result.then(function (operationsResult) {
117
- var _this$name2;
118
-
119
- Diagnostics.send('eligius-diagnostics-action', ((_this$name2 = _this.name) != null ? _this$name2 : 'Action') + " finished executing start operations");
120
- return operationsResult;
121
- });
122
- };
123
-
124
- _proto.executeOperation = function executeOperation(operations, idx, resolve, reject, previousOperationData, context) {
125
- var _this2 = this;
126
-
127
- if (previousOperationData === void 0) {
128
- previousOperationData = {};
129
- }
130
-
131
- if (context.newIndex !== undefined) {
132
- idx = context.newIndex;
133
- delete context.newIndex;
134
- }
135
-
136
- context.currentIndex = idx;
137
-
138
- if (context.skipNextOperation) {
139
- if (idx < operations.length) {
140
- this.executeOperation(operations, ++idx, resolve, reject, previousOperationData, context);
141
- } else {
142
- resolve(previousOperationData);
143
- }
144
- }
145
-
146
- if (idx < operations.length) {
147
- var operationInfo = operations[idx];
148
- var copy = operationInfo.operationData ? deepCopy(operationInfo.operationData) : {};
149
- var mergedOperationData = Object.assign(previousOperationData, copy);
150
- Diagnostics.active && Diagnostics.send('eligius-diagnostics-operation', {
151
- systemName: operationInfo.systemName,
152
- operationData: operationInfo.operationData,
153
- context: context
154
- });
155
- var operationResult = operationInfo.instance.call(context, mergedOperationData);
156
-
157
- if (isPromise(operationResult)) {
158
- operationResult.then(function (resultOperationData) {
159
- _this2.executeOperation(operations, ++idx, resolve, reject, resultOperationData, context);
160
- })["catch"](function (error) {
161
- reject(error);
162
- });
163
- } else {
164
- this.executeOperation(operations, ++idx, resolve, reject, operationResult, context);
165
- }
166
- } else {
167
- resolve(previousOperationData);
168
- }
169
- };
170
-
171
- return Action;
172
- }();
173
-
174
9
  function _regeneratorRuntime() {
175
10
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
176
11
 
@@ -584,6 +419,179 @@ function _setPrototypeOf(o, p) {
584
419
  return _setPrototypeOf(o, p);
585
420
  }
586
421
 
422
+ function prepareValueForSerialization(value) {
423
+ if (Array.isArray(value)) {
424
+ return value.map(prepareValueForSerialization);
425
+ } else if (value instanceof $) {
426
+ return 'jQuery object';
427
+ } else if (value !== null && typeof value === 'object') {
428
+ return Object.fromEntries(Object.entries(value).map(function (_ref) {
429
+ var propName = _ref[0],
430
+ propValue = _ref[1];
431
+ return [propName, prepareValueForSerialization(propValue)];
432
+ }));
433
+ } else if (typeof value === 'function') {
434
+ var funcString = value.toString();
435
+ var paranIndex = funcString.indexOf('{');
436
+
437
+ if (paranIndex > -1) {
438
+ return funcString.substring(0, funcString.indexOf('{') + 1);
439
+ }
440
+
441
+ return funcString;
442
+ }
443
+
444
+ return value;
445
+ }
446
+
447
+ var DevToolEventListener = /*#__PURE__*/function () {
448
+ function DevToolEventListener(agent) {
449
+ this.agent = void 0;
450
+ this.agent = agent;
451
+ }
452
+
453
+ var _proto = DevToolEventListener.prototype;
454
+
455
+ _proto.handleEvent = function handleEvent(eventName, eventTopic, args) {
456
+ var message = {
457
+ eventName: eventName,
458
+ eventTopic: eventTopic,
459
+ args: prepareValueForSerialization(args)
460
+ };
461
+
462
+ try {
463
+ this.agent.postMessage('eligius-diagnostics-event', message);
464
+ } catch (e) {
465
+ console.error('postmessage failed');
466
+ console.error(e);
467
+ console.log('message', message);
468
+ }
469
+ };
470
+
471
+ return DevToolEventListener;
472
+ }();
473
+
474
+ var Diagnostics = /*#__PURE__*/function () {
475
+ function Diagnostics() {}
476
+
477
+ Diagnostics.send = function send(_name, _data) {
478
+ console.log(_name, _data);
479
+ };
480
+
481
+ return Diagnostics;
482
+ }();
483
+ Diagnostics.active = void 0;
484
+
485
+ var DEV_TOOLS_KEY = '__ELIGIUS_DEV_TOOLS__';
486
+
487
+ var copyFunction = typeof structuredClone !== 'undefined' ? structuredClone : function (original) {
488
+ return JSON.parse(JSON.stringify(original));
489
+ };
490
+ function deepCopy(original) {
491
+ if (isDefined(original)) {
492
+ return copyFunction(original);
493
+ }
494
+
495
+ return original;
496
+ }
497
+
498
+ function isPromise(obj) {
499
+ return typeof obj === 'object' && typeof obj.then === 'function';
500
+ }
501
+
502
+ var Action = /*#__PURE__*/function () {
503
+ function Action(name, startOperations, eventbus) {
504
+ this.name = void 0;
505
+ this.startOperations = void 0;
506
+ this.eventbus = void 0;
507
+ this.id = '';
508
+ this.name = name;
509
+ this.startOperations = startOperations;
510
+ this.eventbus = eventbus;
511
+ }
512
+
513
+ var _proto = Action.prototype;
514
+
515
+ _proto.start = function start(initOperationData) {
516
+ var _this$name,
517
+ _this = this;
518
+
519
+ Diagnostics.active && Diagnostics.send('eligius-diagnostics-action', ((_this$name = this.name) != null ? _this$name : 'Action') + " begins executing start operations");
520
+ var context = {
521
+ currentIndex: -1,
522
+ eventbus: this.eventbus
523
+ };
524
+ var result = new Promise(function (resolve, reject) {
525
+ _this.executeOperation(_this.startOperations, 0, resolve, reject, initOperationData, context);
526
+ })["catch"](function (e) {
527
+ Diagnostics.active && Diagnostics.send('eligius-diagnostics-action-error', {
528
+ name: name,
529
+ error: e
530
+ });
531
+ console.error("Error in action start '" + _this.name + "'");
532
+ console.error(e);
533
+ throw e;
534
+ });
535
+ return !Diagnostics.active ? result : result.then(function (operationsResult) {
536
+ var _this$name2;
537
+
538
+ Diagnostics.send('eligius-diagnostics-action', ((_this$name2 = _this.name) != null ? _this$name2 : 'Action') + " finished executing start operations");
539
+ return operationsResult;
540
+ });
541
+ };
542
+
543
+ _proto.executeOperation = function executeOperation(operations, idx, resolve, reject, previousOperationData, context) {
544
+ var _this2 = this;
545
+
546
+ if (previousOperationData === void 0) {
547
+ previousOperationData = {};
548
+ }
549
+
550
+ if (context.newIndex !== undefined) {
551
+ idx = context.newIndex;
552
+ delete context.newIndex;
553
+ }
554
+
555
+ context.currentIndex = idx;
556
+
557
+ if (context.skipNextOperation) {
558
+ if (idx < operations.length) {
559
+ this.executeOperation(operations, ++idx, resolve, reject, previousOperationData, context);
560
+ } else {
561
+ resolve(previousOperationData);
562
+ }
563
+ }
564
+
565
+ if (idx < operations.length) {
566
+ var operationInfo = operations[idx];
567
+ var copy = operationInfo.operationData ? deepCopy(operationInfo.operationData) : {};
568
+ var mergedOperationData = Object.assign(previousOperationData, copy);
569
+ Diagnostics.active && Diagnostics.send('eligius-diagnostics-operation', {
570
+ systemName: operationInfo.systemName,
571
+ operationData: mergedOperationData,
572
+ context: _extends({}, context, {
573
+ eventbus: undefined
574
+ })
575
+ });
576
+ var operationResult = operationInfo.instance.call(context, mergedOperationData);
577
+
578
+ if (isPromise(operationResult)) {
579
+ operationResult.then(function (promisedOperationResult) {
580
+ _this2.executeOperation(operations, ++idx, resolve, reject, promisedOperationResult, context);
581
+ })["catch"](function (error) {
582
+ reject(error);
583
+ });
584
+ } else {
585
+ this.executeOperation(operations, ++idx, resolve, reject, operationResult, context);
586
+ }
587
+ } else {
588
+ resolve(previousOperationData);
589
+ }
590
+ };
591
+
592
+ return Action;
593
+ }();
594
+
587
595
  var EndableAction = /*#__PURE__*/function (_Action) {
588
596
  _inheritsLoose(EndableAction, _Action);
589
597
 
@@ -1232,6 +1240,7 @@ var LabelController = /*#__PURE__*/function () {
1232
1240
  this.operationData = null;
1233
1241
  this.labelData = {};
1234
1242
  this.name = 'LabelController';
1243
+ this.requestLabelDataBound = void 0;
1235
1244
  }
1236
1245
 
1237
1246
  var _proto = LabelController.prototype;
@@ -1240,6 +1249,13 @@ var LabelController = /*#__PURE__*/function () {
1240
1249
  this.operationData = Object.assign({}, operationData);
1241
1250
  };
1242
1251
 
1252
+ _proto.setLabelId = function setLabelId(newLabelId) {
1253
+ if (this.requestLabelDataBound) {
1254
+ this.requestLabelDataBound(newLabelId);
1255
+ this.setLabel();
1256
+ }
1257
+ };
1258
+
1243
1259
  _proto.attach = function attach(eventbus) {
1244
1260
  var _this = this;
1245
1261
 
@@ -1250,13 +1266,20 @@ var LabelController = /*#__PURE__*/function () {
1250
1266
  eventbus.broadcast(TimelineEventNames.REQUEST_CURRENT_LANGUAGE, [function (language) {
1251
1267
  _this.currentLanguage = language;
1252
1268
  }]);
1253
- eventbus.broadcast(TimelineEventNames.REQUEST_LABEL_COLLECTION, [this.operationData.labelId, function (labelCollection) {
1254
- _this.createTextDataLookup(labelCollection);
1255
- }]);
1269
+ this.requestLabelDataBound = this.requestLabelData.bind(this, eventbus);
1270
+ this.requestLabelDataBound(this.operationData.labelId);
1256
1271
  this.setLabel();
1257
1272
  this.listeners.push(eventbus.on(TimelineEventNames.LANGUAGE_CHANGE, this.handleLanguageChange.bind(this)));
1258
1273
  };
1259
1274
 
1275
+ _proto.requestLabelData = function requestLabelData(eventbus, labelId) {
1276
+ var _this2 = this;
1277
+
1278
+ eventbus.broadcast(TimelineEventNames.REQUEST_LABEL_COLLECTION, [labelId, function (labelCollection) {
1279
+ _this2.createTextDataLookup(labelCollection);
1280
+ }]);
1281
+ };
1282
+
1260
1283
  _proto.setLabel = function setLabel() {
1261
1284
  if (this.currentLanguage) {
1262
1285
  var _this$operationData;
@@ -1267,8 +1290,9 @@ var LabelController = /*#__PURE__*/function () {
1267
1290
 
1268
1291
  _proto.detach = function detach(_eventbus) {
1269
1292
  this.listeners.forEach(function (func) {
1270
- func();
1293
+ return func();
1271
1294
  });
1295
+ this.requestLabelDataBound = undefined;
1272
1296
  };
1273
1297
 
1274
1298
  _proto.handleLanguageChange = function handleLanguageChange(code) {
@@ -1277,10 +1301,10 @@ var LabelController = /*#__PURE__*/function () {
1277
1301
  };
1278
1302
 
1279
1303
  _proto.createTextDataLookup = function createTextDataLookup(data) {
1280
- var _this2 = this;
1304
+ var _this3 = this;
1281
1305
 
1282
1306
  data.forEach(function (d) {
1283
- _this2.labelData[d.languageCode] = d.label;
1307
+ _this3.labelData[d.languageCode] = d.label;
1284
1308
  });
1285
1309
  };
1286
1310
 
@@ -2034,44 +2058,46 @@ var ctrls = {
2034
2058
  };
2035
2059
 
2036
2060
  /**
2037
- * EligiusEngine, this is where the magic happens. The engine is responsible for starting and stopping
2038
- * the given timeline provider and triggering the actions associated with it.
2039
- * ...
2061
+ * This is where the magic happens. The engine is responsible for starting and stopping
2062
+ * the given timeline provider and triggering the actions associated with the positions along the timeline.
2040
2063
  */
2041
2064
 
2042
2065
  var EligiusEngine = /*#__PURE__*/function () {
2043
- function EligiusEngine(configuration, eventbus, timelineProviders, _languageManager) {
2066
+ function EligiusEngine(configuration, eventbus, timelineProviders, languageManager) {
2044
2067
  this.configuration = void 0;
2045
2068
  this.eventbus = void 0;
2046
2069
  this.timelineProviders = void 0;
2047
- this._languageManager = void 0;
2070
+ this.languageManager = void 0;
2048
2071
  this._timeLineActionsLookup = {};
2049
- this._eventbusListeners = [];
2072
+ this._eventbusRemovers = [];
2050
2073
  this._currentTimelineUri = '';
2051
2074
  this._activeTimelineProvider = undefined;
2052
2075
  this._lastPosition = -1;
2053
2076
  this.configuration = configuration;
2054
2077
  this.eventbus = eventbus;
2055
2078
  this.timelineProviders = timelineProviders;
2056
- this._languageManager = _languageManager;
2079
+ this.languageManager = languageManager;
2057
2080
  }
2081
+ /**
2082
+ * Initializes the engine by creating the HTML layout and the first time line
2083
+ * by executing its initActions.
2084
+ */
2085
+
2058
2086
 
2059
2087
  var _proto = EligiusEngine.prototype;
2060
2088
 
2061
2089
  _proto.init = function init() {
2090
+ var _timelines$0$uri;
2091
+
2062
2092
  this._createLayoutTemplate();
2063
2093
 
2064
2094
  this._addInitialisationListeners();
2065
2095
 
2066
2096
  var timelines = this.configuration.timelines;
2067
- this._currentTimelineUri = timelines && timelines.length ? timelines[0].uri : '';
2097
+ this._currentTimelineUri = (_timelines$0$uri = timelines == null ? void 0 : timelines[0].uri) != null ? _timelines$0$uri : '';
2068
2098
 
2069
2099
  this._createTimelineLookup();
2070
2100
 
2071
- this._eventbusListeners.push(this.eventbus.on(TimelineEventNames.TIME, this._onTimeHandler.bind(this, Math.floor)));
2072
-
2073
- this._eventbusListeners.push(this.eventbus.on(TimelineEventNames.SEEK, this._onSeekHandler.bind(this, Math.floor)));
2074
-
2075
2101
  return this._initializeTimelineProvider();
2076
2102
  };
2077
2103
 
@@ -2176,9 +2202,20 @@ var EligiusEngine = /*#__PURE__*/function () {
2176
2202
  }
2177
2203
 
2178
2204
  return _cleanUp;
2179
- }();
2180
-
2181
- _proto.destroy = /*#__PURE__*/function () {
2205
+ }()
2206
+ /**
2207
+ * Cleans up all the necessary parts that the engine initialized.
2208
+ * - It ends the currently active operations and the init actions.
2209
+ * - It removes all its eventbus listeners, handlers and interceptors.
2210
+ * - It destroys all of its timeline providers
2211
+ * - It empties the HTML element indicated by the containerSelector configuration property.
2212
+ *
2213
+ */
2214
+ ;
2215
+
2216
+ _proto.destroy =
2217
+ /*#__PURE__*/
2218
+ function () {
2182
2219
  var _destroy = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
2183
2220
  var containerSelector, container;
2184
2221
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
@@ -2189,9 +2226,10 @@ var EligiusEngine = /*#__PURE__*/function () {
2189
2226
  return this._cleanUp();
2190
2227
 
2191
2228
  case 2:
2229
+ this.languageManager.destroy();
2192
2230
  this._activeTimelineProvider = undefined;
2193
2231
 
2194
- this._eventbusListeners.forEach(function (remover) {
2232
+ this._eventbusRemovers.forEach(function (remover) {
2195
2233
  return remover();
2196
2234
  });
2197
2235
 
@@ -2205,7 +2243,7 @@ var EligiusEngine = /*#__PURE__*/function () {
2205
2243
  container = $(containerSelector);
2206
2244
  container.empty();
2207
2245
 
2208
- case 8:
2246
+ case 9:
2209
2247
  case "end":
2210
2248
  return _context3.stop();
2211
2249
  }
@@ -2220,20 +2258,28 @@ var EligiusEngine = /*#__PURE__*/function () {
2220
2258
  return destroy;
2221
2259
  }();
2222
2260
 
2261
+ _proto._addEventListener = function _addEventListener(eventName, eventHandler, eventTopic) {
2262
+ this._eventbusRemovers.push(this.eventbus.on(eventName, eventHandler, eventTopic));
2263
+ };
2264
+
2223
2265
  _proto._addInitialisationListeners = function _addInitialisationListeners() {
2224
- this._eventbusListeners.push(this.eventbus.on(TimelineEventNames.REQUEST_ENGINE_ROOT, this._handleRequestEngineRoot.bind(this, this.configuration.containerSelector)));
2266
+ this._addEventListener(TimelineEventNames.REQUEST_ENGINE_ROOT, this._handleRequestEngineRoot.bind(this, this.configuration.containerSelector));
2225
2267
 
2226
- this._eventbusListeners.push(this.eventbus.on(TimelineEventNames.REQUEST_TIMELINE_URI, this._handleRequestTimelineUri.bind(this)));
2268
+ this._addEventListener(TimelineEventNames.REQUEST_TIMELINE_URI, this._handleRequestTimelineUri.bind(this));
2227
2269
 
2228
- this._eventbusListeners.push(this.eventbus.on(TimelineEventNames.REQUEST_CURRENT_TIMELINE_POSITION, this._handleRequestTimelinePosition.bind(this, Math.floor)));
2270
+ this._addEventListener(TimelineEventNames.REQUEST_CURRENT_TIMELINE_POSITION, this._handleRequestTimelinePosition.bind(this, Math.floor));
2229
2271
 
2230
- this._eventbusListeners.push(this.eventbus.on(TimelineEventNames.REQUEST_TIMELINE_CLEANUP, this._handleTimelineComplete.bind(this)));
2272
+ this._addEventListener(TimelineEventNames.REQUEST_TIMELINE_CLEANUP, this._handleTimelineComplete.bind(this));
2231
2273
 
2232
- this._eventbusListeners.push(this.eventbus.on(TimelineEventNames.EXECUTE_TIMELINEACTION, this._handleExecuteTimelineAction.bind(this)));
2274
+ this._addEventListener(TimelineEventNames.EXECUTE_TIMELINEACTION, this._handleExecuteTimelineAction.bind(this));
2233
2275
 
2234
- this._eventbusListeners.push(this.eventbus.on(TimelineEventNames.RESIZE_TIMELINEACTION, this._resizeTimelineAction.bind(this)));
2276
+ this._addEventListener(TimelineEventNames.RESIZE_TIMELINEACTION, this._resizeTimelineAction.bind(this));
2235
2277
 
2236
- this._eventbusListeners.push(this.eventbus.on(TimelineEventNames.REQUEST_CURRENT_TIMELINE, this._requestCurrentTimeline.bind(this)));
2278
+ this._addEventListener(TimelineEventNames.REQUEST_CURRENT_TIMELINE, this._requestCurrentTimeline.bind(this));
2279
+
2280
+ this._addEventListener(TimelineEventNames.TIME, this._onTimeHandler.bind(this, Math.floor));
2281
+
2282
+ this._addEventListener(TimelineEventNames.SEEK, this._onSeekHandler.bind(this, Math.floor));
2237
2283
  };
2238
2284
 
2239
2285
  _proto._createTimelineLookup = function _createTimelineLookup() {
@@ -2270,13 +2316,11 @@ var EligiusEngine = /*#__PURE__*/function () {
2270
2316
  }
2271
2317
 
2272
2318
  if (isFinite(end)) {
2273
- var _timeLineAction$id2;
2274
-
2275
2319
  var timelineEndPositions = this._initializeTimelinePosition(this._timeLineActionsLookup[uri], end);
2276
2320
 
2277
2321
  var endMethod = timeLineAction.end.bind(timeLineAction);
2278
2322
 
2279
- if ((_timeLineAction$id2 = timeLineAction.id) != null && _timeLineAction$id2.length) {
2323
+ if (!timeLineAction.id) {
2280
2324
  endMethod.id = timeLineAction.id;
2281
2325
  }
2282
2326
 
@@ -2694,6 +2738,9 @@ var Eventbus = /*#__PURE__*/function () {
2694
2738
  };
2695
2739
 
2696
2740
  this.on(eventName, eventHandlerDecorator, eventTopic);
2741
+ return function () {
2742
+ _this2.off(eventName, eventHandlerDecorator, eventTopic);
2743
+ };
2697
2744
  };
2698
2745
 
2699
2746
  _proto.off = function off(eventName, eventHandler, eventTopic) {
@@ -2717,13 +2764,29 @@ var Eventbus = /*#__PURE__*/function () {
2717
2764
  };
2718
2765
 
2719
2766
  _proto.registerEventlistener = function registerEventlistener(eventbusListener) {
2767
+ var _this3 = this;
2768
+
2720
2769
  this.eventListeners.push(eventbusListener);
2770
+ return function () {
2771
+ var index = _this3.eventListeners.indexOf(eventbusListener);
2772
+
2773
+ if (index > -1) {
2774
+ _this3.eventListeners.splice(index, 1);
2775
+ }
2776
+ };
2721
2777
  };
2722
2778
 
2723
2779
  _proto.registerInterceptor = function registerInterceptor(eventName, interceptor, eventTopic) {
2724
2780
  var interceptors = this._getEventInterceptors(eventName, eventTopic);
2725
2781
 
2726
2782
  interceptors.push(interceptor);
2783
+ return function () {
2784
+ var index = interceptors.indexOf(interceptor);
2785
+
2786
+ if (index > -1) {
2787
+ interceptors.splice(index, 1);
2788
+ }
2789
+ };
2727
2790
  };
2728
2791
 
2729
2792
  _proto._callHandlers = function _callHandlers(eventName, eventTopic, args) {
@@ -2787,40 +2850,38 @@ var LanguageManager = /*#__PURE__*/function () {
2787
2850
  function LanguageManager(_currentLanguage, labels, _eventbus) {
2788
2851
  this._currentLanguage = void 0;
2789
2852
  this._eventbus = void 0;
2790
- this._labelLookup = {};
2791
- this._eventbusListeners = [];
2853
+ this._labelLookup = void 0;
2854
+ this._eventbusRemovers = [];
2792
2855
  this._currentLanguage = _currentLanguage;
2793
2856
  this._eventbus = _eventbus;
2794
2857
 
2795
- if (!_currentLanguage || !_currentLanguage.length) {
2796
- throw new Error('language ctor arg cannot be null or have zero length');
2797
- }
2798
-
2799
- if (!labels) {
2800
- throw new Error('labels ctor arg cannot be null');
2801
- }
2802
-
2803
- if (!_eventbus) {
2804
- throw new Error('eventbus ctor arg cannot be null');
2858
+ if (!_currentLanguage) {
2859
+ throw new Error('language ctor arg cannot have zero length');
2805
2860
  }
2806
2861
 
2807
2862
  this._setRootElementLang(_currentLanguage);
2808
2863
 
2809
- this._createLabelLookup(labels);
2864
+ this._labelLookup = this._createLabelLookup(labels);
2810
2865
 
2811
2866
  this._addEventbusListeners(_eventbus);
2812
2867
  }
2813
2868
 
2814
2869
  var _proto = LanguageManager.prototype;
2815
2870
 
2871
+ _proto.destroy = function destroy() {
2872
+ this._eventbusRemovers.forEach(function (x) {
2873
+ return x();
2874
+ });
2875
+ };
2876
+
2816
2877
  _proto._addEventbusListeners = function _addEventbusListeners(eventbus) {
2817
- this._eventbusListeners.push(eventbus.on(TimelineEventNames.REQUEST_LABEL_COLLECTION, this._handleRequestLabelCollection.bind(this)));
2878
+ this._eventbusRemovers.push(eventbus.on(TimelineEventNames.REQUEST_LABEL_COLLECTION, this._handleRequestLabelCollection.bind(this)));
2818
2879
 
2819
- this._eventbusListeners.push(eventbus.on(TimelineEventNames.REQUEST_LABEL_COLLECTIONS, this._handleRequestLabelCollections.bind(this)));
2880
+ this._eventbusRemovers.push(eventbus.on(TimelineEventNames.REQUEST_LABEL_COLLECTIONS, this._handleRequestLabelCollections.bind(this)));
2820
2881
 
2821
- this._eventbusListeners.push(eventbus.on(TimelineEventNames.REQUEST_CURRENT_LANGUAGE, this._handleRequestCurrentLanguage.bind(this)));
2882
+ this._eventbusRemovers.push(eventbus.on(TimelineEventNames.REQUEST_CURRENT_LANGUAGE, this._handleRequestCurrentLanguage.bind(this)));
2822
2883
 
2823
- this._eventbusListeners.push(eventbus.on(TimelineEventNames.LANGUAGE_CHANGE, this._handleLanguageChange.bind(this)));
2884
+ this._eventbusRemovers.push(eventbus.on(TimelineEventNames.LANGUAGE_CHANGE, this._handleLanguageChange.bind(this)));
2824
2885
  };
2825
2886
 
2826
2887
  _proto._handleRequestCurrentLanguage = function _handleRequestCurrentLanguage(resultCallback) {
@@ -2871,11 +2932,10 @@ var LanguageManager = /*#__PURE__*/function () {
2871
2932
  };
2872
2933
 
2873
2934
  _proto._createLabelLookup = function _createLabelLookup(labels) {
2874
- var _this3 = this;
2875
-
2876
- labels.forEach(function (label) {
2877
- _this3._labelLookup[label.id] = label.labels;
2878
- });
2935
+ return labels.reduce(function (acc, label) {
2936
+ acc[label.id] = label.labels;
2937
+ return acc;
2938
+ }, {});
2879
2939
  };
2880
2940
 
2881
2941
  return LanguageManager;
@@ -2883,47 +2943,93 @@ var LanguageManager = /*#__PURE__*/function () {
2883
2943
 
2884
2944
  var EngineFactory = /*#__PURE__*/function () {
2885
2945
  function EngineFactory(importer, windowRef, options) {
2886
- var _options$devtools;
2946
+ var _options$eventbus, _options$devtools;
2887
2947
 
2888
- this.resizeTimeout = -1;
2889
- this.actionsLookup = {};
2890
- this.importer = void 0;
2891
- this.eventbus = void 0;
2892
- this._handleSpaceBound = void 0;
2893
- this.importer = importer;
2894
- this.eventbus = (options == null ? void 0 : options.eventbus) || new Eventbus();
2948
+ this._actionsLookup = {};
2949
+ this._eventbus = void 0;
2950
+ this._eventRemovers = [];
2951
+ this._importer = void 0;
2952
+ this._resizeTimeout = -1;
2953
+ this._importer = importer;
2954
+ this._eventbus = (_options$eventbus = options == null ? void 0 : options.eventbus) != null ? _options$eventbus : new Eventbus();
2895
2955
  Diagnostics.active = (_options$devtools = options == null ? void 0 : options.devtools) != null ? _options$devtools : false;
2896
2956
 
2897
2957
  if (Diagnostics.active) {
2898
- this._initializeDevtools(this.eventbus);
2958
+ this._initializeDevtools(this._eventbus);
2899
2959
  }
2900
2960
 
2901
- this.eventbus.on(TimelineEventNames.REQUEST_INSTANCE, this._requestInstanceHandler.bind(this));
2902
- this.eventbus.on(TimelineEventNames.REQUEST_ACTION, this._requestActionHandler.bind(this));
2903
- this.eventbus.on(TimelineEventNames.REQUEST_FUNCTION, this._requestFunctionHandler.bind(this));
2904
- this._handleSpaceBound = this._handleSpacePress.bind(this);
2905
- hotkeys('space', this._handleSpaceBound);
2906
- $(windowRef).resize(this._resizeHandler.bind(this));
2961
+ this._eventRemovers.push(this._eventbus.on(TimelineEventNames.REQUEST_INSTANCE, this._requestInstanceHandler.bind(this)));
2962
+
2963
+ this._eventRemovers.push(this._eventbus.on(TimelineEventNames.REQUEST_ACTION, this._requestActionHandler.bind(this)));
2964
+
2965
+ this._eventRemovers.push(this._eventbus.on(TimelineEventNames.REQUEST_FUNCTION, this._requestFunctionHandler.bind(this)));
2966
+
2967
+ var handleSpaceBound = this._handleSpacePress.bind(this);
2968
+
2969
+ hotkeys('space', handleSpaceBound);
2970
+
2971
+ this._eventRemovers.push(function () {
2972
+ return hotkeys.unbind('space', handleSpaceBound);
2973
+ });
2974
+
2975
+ var resizeBound = this._resizeHandler.bind(this);
2976
+
2977
+ var jqWin = $(windowRef);
2978
+ jqWin.on('resize', resizeBound);
2979
+
2980
+ this._eventRemovers.push(function () {
2981
+ return jqWin.off('resize', resizeBound);
2982
+ });
2907
2983
  }
2908
2984
 
2909
2985
  var _proto = EngineFactory.prototype;
2910
2986
 
2911
2987
  _proto._handleSpacePress = function _handleSpacePress(keyboardEvent, _hotkeysEvent) {
2912
2988
  keyboardEvent.preventDefault();
2913
- this.eventbus.broadcast(TimelineEventNames.PLAY_TOGGLE_REQUEST);
2989
+
2990
+ this._eventbus.broadcast(TimelineEventNames.PLAY_TOGGLE_REQUEST);
2991
+
2914
2992
  return false;
2915
2993
  };
2916
2994
 
2917
2995
  _proto._initializeDevtools = function _initializeDevtools(eventbus) {
2996
+ var _this = this;
2997
+
2918
2998
  var diagnosticInfo = window[DEV_TOOLS_KEY];
2919
2999
 
2920
3000
  if (diagnosticInfo) {
2921
3001
  var agent = diagnosticInfo.agent;
2922
- var eventbusListener = new DevToolEventListener(agent);
2923
- eventbus.registerEventlistener(eventbusListener);
2924
3002
 
2925
- Diagnostics.send = function (name, data) {
2926
- var message = prepareValueForSerialization(data);
3003
+ this._eventRemovers.push(eventbus.registerEventlistener(new DevToolEventListener(agent)));
3004
+
3005
+ this._eventRemovers.push(agent.subscribe(function (message) {
3006
+ if (message.type === 'playcontrol') {
3007
+ switch (message.data.kind) {
3008
+ case 'play':
3009
+ _this._eventbus.broadcast(TimelineEventNames.PLAY_REQUEST);
3010
+
3011
+ break;
3012
+
3013
+ case 'stop':
3014
+ _this._eventbus.broadcast(TimelineEventNames.STOP_REQUEST);
3015
+
3016
+ break;
3017
+
3018
+ case 'pause':
3019
+ _this._eventbus.broadcast(TimelineEventNames.PAUSE_REQUEST);
3020
+
3021
+ break;
3022
+
3023
+ case 'seek':
3024
+ _this._eventbus.broadcast(TimelineEventNames.SEEK_REQUEST, [message.data.args]);
3025
+
3026
+ break;
3027
+ }
3028
+ }
3029
+ }));
3030
+
3031
+ Diagnostics.send = function (name, messageData) {
3032
+ var message = prepareValueForSerialization(messageData);
2927
3033
 
2928
3034
  try {
2929
3035
  agent.postMessage(name, message);
@@ -2936,35 +3042,37 @@ var EngineFactory = /*#__PURE__*/function () {
2936
3042
 
2937
3043
  Diagnostics.send('eligius-diagnostics-factory', 'Diagnostics initialized');
2938
3044
  } else {
2939
- console.warn(DEV_TOOLS_KEY + " property not found on window, please install the extension.");
3045
+ console.warn(DEV_TOOLS_KEY + " property not found on window, please install the Eligius Devtools extension.");
2940
3046
  }
2941
3047
  };
2942
3048
 
2943
3049
  _proto.destroy = function destroy() {
2944
- this.eventbus.clear();
2945
- hotkeys.unbind('space', this._handleSpaceBound);
3050
+ this._eventRemovers.forEach(function (x) {
3051
+ return x();
3052
+ });
2946
3053
  };
2947
3054
 
2948
3055
  _proto._resizeHandler = function _resizeHandler() {
2949
- var _this = this;
3056
+ var _this2 = this;
2950
3057
 
2951
- if (this.resizeTimeout) {
2952
- clearTimeout(this.resizeTimeout);
3058
+ if (this._resizeTimeout) {
3059
+ clearTimeout(this._resizeTimeout);
3060
+ this._resizeTimeout = -1;
2953
3061
  }
2954
3062
 
2955
- this.resizeTimeout = setTimeout(function () {
2956
- _this.eventbus.broadcast(TimelineEventNames.RESIZE);
3063
+ this._resizeTimeout = setTimeout(function () {
3064
+ _this2._eventbus.broadcast(TimelineEventNames.RESIZE);
2957
3065
  }, 200);
2958
3066
  };
2959
3067
 
2960
3068
  _proto._importSystemEntryWithEventbusDependency = function _importSystemEntryWithEventbusDependency(systemName) {
2961
3069
  var ctor = this._importSystemEntry(systemName);
2962
3070
 
2963
- return new ctor(this.eventbus);
3071
+ return new ctor(this._eventbus);
2964
3072
  };
2965
3073
 
2966
3074
  _proto._importSystemEntry = function _importSystemEntry(systemName) {
2967
- return this.importer["import"](systemName)[systemName];
3075
+ return this._importer["import"](systemName)[systemName];
2968
3076
  };
2969
3077
 
2970
3078
  _proto._requestInstanceHandler = function _requestInstanceHandler(systemName, resultCallback) {
@@ -2976,7 +3084,7 @@ var EngineFactory = /*#__PURE__*/function () {
2976
3084
  };
2977
3085
 
2978
3086
  _proto._requestActionHandler = function _requestActionHandler(systemName, resultCallback) {
2979
- var action = this.actionsLookup[systemName];
3087
+ var action = this._actionsLookup[systemName];
2980
3088
 
2981
3089
  if (action) {
2982
3090
  resultCallback(action);
@@ -2997,29 +3105,31 @@ var EngineFactory = /*#__PURE__*/function () {
2997
3105
 
2998
3106
  if ((_configuration$eventA = configuration.eventActions) != null && _configuration$eventA.length) {
2999
3107
  actionRegistryListener = new ActionRegistryEventbusListener();
3000
- this.eventbus.registerEventlistener(actionRegistryListener);
3108
+
3109
+ this._eventRemovers.push(this._eventbus.registerEventlistener(actionRegistryListener));
3001
3110
  }
3002
3111
 
3003
- this.eventbus.registerInterceptor(TimelineEventNames.REQUEST_TIMELINE_URI, new RequestVideoUriInterceptor(this.eventbus));
3004
- resolver = resolver || new ConfigurationResolver(this.importer, this.eventbus);
3112
+ this._eventRemovers.push(this._eventbus.registerInterceptor(TimelineEventNames.REQUEST_TIMELINE_URI, new RequestVideoUriInterceptor(this._eventbus)));
3113
+
3114
+ resolver = resolver || new ConfigurationResolver(this._importer, this._eventbus);
3005
3115
 
3006
3116
  var _resolver$process = resolver.process(configuration, actionRegistryListener),
3007
3117
  actionLookup = _resolver$process[0],
3008
3118
  resolvedConfiguration = _resolver$process[1];
3009
3119
 
3010
- this.actionsLookup = actionLookup;
3120
+ this._actionsLookup = actionLookup;
3011
3121
 
3012
- var timelineProviders = this._createTimelineProviders(resolvedConfiguration, this.eventbus);
3122
+ var timelineProviders = this._createTimelineProviders(resolvedConfiguration, this._eventbus);
3013
3123
 
3014
3124
  var language = configuration.language,
3015
3125
  labels = configuration.labels;
3016
- var languageManager = new LanguageManager(language, labels, this.eventbus);
3017
- var engineInstance = new EngineClass(resolvedConfiguration, this.eventbus, timelineProviders, languageManager);
3126
+ var languageManager = new LanguageManager(language, labels, this._eventbus);
3127
+ var engineInstance = new EngineClass(resolvedConfiguration, this._eventbus, timelineProviders, languageManager);
3018
3128
  return engineInstance;
3019
3129
  };
3020
3130
 
3021
3131
  _proto._createTimelineProviders = function _createTimelineProviders(configuration, eventbus) {
3022
- var _this2 = this;
3132
+ var _this3 = this;
3023
3133
 
3024
3134
  var timelineProviderSettings = configuration.timelineProviderSettings;
3025
3135
  var result = Object.entries(timelineProviderSettings).reduce(function (acc, _ref) {
@@ -3030,7 +3140,7 @@ var EngineFactory = /*#__PURE__*/function () {
3030
3140
  return acc;
3031
3141
  }
3032
3142
 
3033
- var timelineProviderClass = _this2._importSystemEntry(settings.systemName);
3143
+ var timelineProviderClass = _this3._importSystemEntry(settings.systemName);
3034
3144
 
3035
3145
  acc[timelineType] = {
3036
3146
  id: settings.id,
@@ -3300,10 +3410,8 @@ var calc$1 = function calc(operationData) {
3300
3410
  var _operationData = operationData,
3301
3411
  left = _operationData.left,
3302
3412
  right = _operationData.right,
3303
- operator = _operationData.operator,
3304
- _operationData$proper = _operationData.propertyName,
3305
- propertyName = _operationData$proper === void 0 ? 'calculationResult' : _operationData$proper;
3306
- operationData[propertyName] = calcFunctions[operator](+left, +right);
3413
+ operator = _operationData.operator;
3414
+ operationData.calculationResult = calcFunctions[operator](+left, +right);
3307
3415
  return operationData;
3308
3416
  };
3309
3417
 
@@ -3348,17 +3456,14 @@ var createElement$1 = function createElement(operationData) {
3348
3456
  var _operationData = operationData,
3349
3457
  elementName = _operationData.elementName,
3350
3458
  attributes = _operationData.attributes,
3351
- text = _operationData.text,
3352
- _operationData$proper = _operationData.propertyName,
3353
- propertyName = _operationData$proper === void 0 ? 'template' : _operationData$proper;
3459
+ text = _operationData.text;
3354
3460
  var serializedAttrs = attributes ? ' ' + Object.entries(attributes).map(function (_ref) {
3355
3461
  var key = _ref[0],
3356
3462
  value = _ref[1];
3357
3463
  return key + "=\"" + value + "\"";
3358
3464
  }).join(' ') : '';
3359
3465
  var template = text ? $("<" + elementName + serializedAttrs + ">" + text + "</" + elementName + ">") : $("<" + elementName + serializedAttrs + "/>");
3360
- operationData[propertyName] = template;
3361
- delete operationData.propertyName;
3466
+ operationData.template = template;
3362
3467
  return operationData;
3363
3468
  };
3364
3469
 
@@ -3472,25 +3577,21 @@ var getControllerFromElement$1 = function getControllerFromElement(operationData
3472
3577
 
3473
3578
  /**
3474
3579
  * This operation retrieves an instance of the given controller name.
3475
- * It assigns this instance to the property on the current operation data
3476
- * defined by the propertyName property which defaults to 'controllerInstance'.
3580
+ * It assigns this instance to the `controllerInstance` property on the current operation data
3477
3581
  *
3478
3582
  * @param operationData
3479
3583
  * @returns
3480
3584
  */
3481
3585
 
3482
3586
  var getControllerInstance$1 = function getControllerInstance(operationData) {
3483
- var systemName = operationData.systemName,
3484
- _operationData$proper = operationData.propertyName,
3485
- propertyName = _operationData$proper === void 0 ? 'controllerInstance' : _operationData$proper;
3486
- operationData[propertyName] = null;
3587
+ var systemName = operationData.systemName;
3588
+ operationData.controllerInstance = undefined;
3487
3589
 
3488
3590
  var resultCallback = function resultCallback(instance) {
3489
- operationData[propertyName] = instance;
3591
+ operationData.controllerInstance = instance;
3490
3592
  };
3491
3593
 
3492
3594
  this.eventbus.broadcast(TimelineEventNames.REQUEST_INSTANCE, [systemName, resultCallback]);
3493
- delete operationData.propertyName;
3494
3595
  return operationData;
3495
3596
  };
3496
3597
 
@@ -3730,13 +3831,58 @@ var getImport$1 = function getImport(operationData) {
3730
3831
  return operationData;
3731
3832
  };
3732
3833
 
3834
+ /**
3835
+ * This operation retrieves the current query parameters from the browser's address bar and places
3836
+ * them on the returned operation data.
3837
+ *
3838
+ * @param operationData
3839
+ * @returns
3840
+ */
3841
+ var getQueryParams$1 = function getQueryParams(operationData) {
3842
+ var searchParams = new URLSearchParams(window.location.search);
3843
+ var queryParams = Object.fromEntries(searchParams.entries());
3844
+ var defaultValues = operationData.defaultValues;
3845
+
3846
+ if (defaultValues) {
3847
+ var defaultEntries = Object.entries(defaultValues).filter(function (_ref) {
3848
+ var name = _ref[0];
3849
+ return !(name in queryParams);
3850
+ });
3851
+ defaultEntries.forEach(function (_ref2) {
3852
+ var name = _ref2[0],
3853
+ value = _ref2[1];
3854
+ return queryParams[name] = value;
3855
+ });
3856
+ delete operationData.defaultValues;
3857
+ }
3858
+
3859
+ operationData.queryParams = queryParams;
3860
+ return operationData;
3861
+ };
3862
+
3863
+ /**
3864
+ * This operation invokes the specified method on the given object with the optional specified arguments
3865
+ * and assigns the result to the `methodResult` property.
3866
+ *
3867
+ * @param operationData
3868
+ * @returns
3869
+ */
3870
+ var invokeObjectMethod$1 = function invokeObjectMethod(operationData) {
3871
+ var methodName = operationData.methodName,
3872
+ methodArguments = operationData.methodArguments;
3873
+ delete operationData.methodName;
3874
+ delete operationData.methodArguments;
3875
+ operationData.methodResult = operationData.instance[methodName].apply(operationData.instance, methodArguments != null ? methodArguments : []);
3876
+ return operationData;
3877
+ };
3878
+
3733
3879
  var jsonCache = {};
3734
3880
  var addToCache = function addToCache(key, value) {
3735
3881
  jsonCache[key] = value;
3736
3882
  };
3737
3883
  /**
3738
- * This operation loads a JSON file from the specified url and assigns it to the specified
3739
- * property name on the current operation data. The property name defaults to 'json'.
3884
+ * This operation loads a JSON file from the specified url and assigns it to the json
3885
+ * property on the current operation data.
3740
3886
  *
3741
3887
  * If the cache property is set to true and a cached value already exists, this is assigned
3742
3888
  * instead of re-retrieving it from the url.
@@ -3747,47 +3893,41 @@ var addToCache = function addToCache(key, value) {
3747
3893
 
3748
3894
  var loadJSON$1 = function loadJSON(operationData) {
3749
3895
  var url = operationData.url,
3750
- cache = operationData.cache,
3751
- _operationData$proper = operationData.propertyName,
3752
- propertyName = _operationData$proper === void 0 ? 'json' : _operationData$proper;
3896
+ cache = operationData.cache;
3753
3897
 
3754
3898
  if (cache && jsonCache[url]) {
3755
- operationData[propertyName] = jsonCache[url];
3756
- delete operationData.propertyName;
3899
+ operationData.json = jsonCache[url];
3757
3900
  return operationData;
3758
3901
  }
3759
3902
 
3760
- return new Promise(function (resolve, reject) {
3761
- fetch(url).then( /*#__PURE__*/function () {
3762
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(response) {
3763
- var json, cacheValue;
3764
- return _regeneratorRuntime().wrap(function _callee$(_context) {
3765
- while (1) {
3766
- switch (_context.prev = _context.next) {
3767
- case 0:
3768
- _context.next = 2;
3769
- return response.json();
3903
+ return fetch(url).then( /*#__PURE__*/function () {
3904
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(response) {
3905
+ var json, cacheValue;
3906
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
3907
+ while (1) {
3908
+ switch (_context.prev = _context.next) {
3909
+ case 0:
3910
+ _context.next = 2;
3911
+ return response.json();
3770
3912
 
3771
- case 2:
3772
- json = _context.sent;
3773
- cacheValue = operationData[propertyName] = json;
3774
- delete operationData.propertyName;
3775
- addToCache(url, cacheValue);
3776
- resolve(operationData);
3913
+ case 2:
3914
+ json = _context.sent;
3915
+ cacheValue = operationData.json = json;
3916
+ addToCache(url, cacheValue);
3917
+ return _context.abrupt("return", operationData);
3777
3918
 
3778
- case 7:
3779
- case "end":
3780
- return _context.stop();
3781
- }
3919
+ case 6:
3920
+ case "end":
3921
+ return _context.stop();
3782
3922
  }
3783
- }, _callee);
3784
- }));
3923
+ }
3924
+ }, _callee);
3925
+ }));
3785
3926
 
3786
- return function (_x) {
3787
- return _ref.apply(this, arguments);
3788
- };
3789
- }())["catch"](reject);
3790
- });
3927
+ return function (_x) {
3928
+ return _ref.apply(this, arguments);
3929
+ };
3930
+ }());
3791
3931
  };
3792
3932
 
3793
3933
  /**
@@ -3819,10 +3959,8 @@ var math$1 = function math(operationData) {
3819
3959
  operationData.args = resolveMathConstants(operationData.args);
3820
3960
  var _operationData = operationData,
3821
3961
  args = _operationData.args,
3822
- functionName = _operationData.functionName,
3823
- _operationData$proper = _operationData.propertyName,
3824
- propertyName = _operationData$proper === void 0 ? 'mathResult' : _operationData$proper;
3825
- operationData[propertyName] = Math[functionName].apply(null, args);
3962
+ functionName = _operationData.functionName;
3963
+ operationData.mathResult = Math[functionName].apply(null, args);
3826
3964
  return operationData;
3827
3965
  };
3828
3966
 
@@ -3891,17 +4029,22 @@ var removeElement$1 = function removeElement(operationData) {
3891
4029
 
3892
4030
  /**
3893
4031
  * This operation removes the given list of properties from the current operation data.
4032
+ * It will also omit the property 'propertyNames' from the result.
3894
4033
  *
3895
4034
  * @param operationData
3896
4035
  * @returns
3897
4036
  */
3898
4037
  var removePropertiesFromOperationData$1 = function removePropertiesFromOperationData(operationData) {
3899
4038
  var propertyNames = operationData.propertyNames;
3900
- propertyNames.forEach(function (name) {
3901
- delete operationData[name];
3902
- });
3903
- delete operationData.propertyNames;
3904
- return operationData;
4039
+
4040
+ if (propertyNames.indexOf('propertyNames') < 0) {
4041
+ propertyNames.push('propertyNames');
4042
+ }
4043
+
4044
+ return Object.fromEntries(Object.entries(operationData).filter(function (_ref) {
4045
+ var name = _ref[0];
4046
+ return !propertyNames.includes(name);
4047
+ }));
3905
4048
  };
3906
4049
 
3907
4050
  /**
@@ -3957,25 +4100,21 @@ var resizeAction$1 = function resizeAction(operationData) {
3957
4100
  return operationData;
3958
4101
  };
3959
4102
 
3960
- function findElementBySelector(root, selector, operationData, propertyName) {
4103
+ function findElementBySelector(root, selector) {
3961
4104
  var element = root.find(selector);
3962
4105
 
3963
4106
  if (!element.length) {
3964
4107
  console.warn("selector '" + selector + "' wasn't found!");
3965
4108
  }
3966
4109
 
3967
- operationData[propertyName] = element;
3968
-
3969
- if (operationData.hasOwnProperty('propertyName')) {
3970
- delete operationData.propertyName;
3971
- }
4110
+ return element;
3972
4111
  }
3973
4112
  /**
3974
4113
  * This operation selects one or more elements using the specified selector.
3975
4114
  *
3976
4115
  * If useSelectedElementAsRoot is set to true and a valid DOM element is assigned
3977
- * to the current operation data defined by the given property name (defaults to 'selectedElement')
3978
- * then the element will be looked for only in the child elements of this DOM element.
4116
+ * to the current operation data's `selectedElement` property
4117
+ * then the element will be looked for only in the descendant elements of this DOM element.
3979
4118
  *
3980
4119
  * @param operationData
3981
4120
  * @returns
@@ -3984,23 +4123,21 @@ function findElementBySelector(root, selector, operationData, propertyName) {
3984
4123
 
3985
4124
  var selectElement$1 = function selectElement(operationData) {
3986
4125
  var selector = operationData.selector,
3987
- _operationData$proper = operationData.propertyName,
3988
- propertyName = _operationData$proper === void 0 ? 'selectedElement' : _operationData$proper,
3989
4126
  _operationData$useSel = operationData.useSelectedElementAsRoot,
3990
4127
  useSelectedElementAsRoot = _operationData$useSel === void 0 ? false : _operationData$useSel;
3991
4128
 
3992
4129
  if (!selector) {
3993
- throw new Error('selector is undefined!');
4130
+ throw new Error('selectElement: selector is either empty or not defined.');
3994
4131
  }
3995
4132
 
3996
- if (useSelectedElementAsRoot && operationData[propertyName]) {
3997
- var currentRoot = operationData[propertyName];
3998
- findElementBySelector(currentRoot, selector, operationData, propertyName);
4133
+ if (useSelectedElementAsRoot && operationData.selectedElement) {
4134
+ var currentRoot = operationData.selectedElement;
4135
+ operationData.selectedElement = findElementBySelector(currentRoot, selector);
3999
4136
  return operationData;
4000
4137
  }
4001
4138
 
4002
4139
  var rootCallback = function rootCallback(root) {
4003
- findElementBySelector(root, selector, operationData, propertyName);
4140
+ operationData.selectedElement = findElementBySelector(root, selector);
4004
4141
  };
4005
4142
 
4006
4143
  this.eventbus.broadcast(TimelineEventNames.REQUEST_ENGINE_ROOT, [rootCallback]);
@@ -4089,19 +4226,15 @@ var setOperationData$1 = function setOperationData(operationData) {
4089
4226
  /**
4090
4227
  * This operation assigns the specified CSS style properties to the
4091
4228
  * specified selected element. The selected element is assigned to
4092
- * the property defined by the propertyName property which defaults
4093
- * to 'selectedElement'.
4229
+ * the `selectedElement` property.
4094
4230
  *
4095
4231
  * @param operationData
4096
4232
  * @returns
4097
4233
  */
4098
4234
 
4099
4235
  var setStyle$1 = function setStyle(operationData) {
4100
- var _operationData$proper = operationData.propertyName,
4101
- propertyName = _operationData$proper === void 0 ? 'selectedElement' : _operationData$proper;
4102
4236
  var properties = resolvePropertyValues(operationData, operationData.properties);
4103
- operationData[propertyName].css(properties);
4104
- delete operationData.propertyName;
4237
+ operationData.selectedElement.css(properties);
4105
4238
  return operationData;
4106
4239
  };
4107
4240
 
@@ -4136,19 +4269,16 @@ var startAction$1 = function startAction(operationData) {
4136
4269
  * This operation starts a loop using the given collection.
4137
4270
  *
4138
4271
  * Each iteration the current item from the specified collection is
4139
- * assigned to the property on the current operation data specified
4140
- * by the propertyName property which defaults to 'currentItem'.
4272
+ * assigned to the `currentItem` property on the current operation data.
4141
4273
  *
4142
4274
  * @param operationData
4143
4275
  * @returns
4144
4276
  */
4145
4277
  var startLoop$1 = function startLoop(operationData) {
4146
4278
  var context = this;
4147
- var collection = operationData.collection,
4148
- _operationData$proper = operationData.propertyName,
4149
- propertyName = _operationData$proper === void 0 ? 'currentItem' : _operationData$proper;
4279
+ var collection = operationData.collection;
4150
4280
 
4151
- if (typeof collection === 'string') {
4281
+ if (collection !== null && !Array.isArray(collection)) {
4152
4282
  throw new Error('Expected collection to be array type, string value was probably not resolved correctly');
4153
4283
  }
4154
4284
 
@@ -4163,10 +4293,9 @@ var startLoop$1 = function startLoop(operationData) {
4163
4293
  }
4164
4294
 
4165
4295
  if (collection != null && collection.length && context.loopIndex !== undefined) {
4166
- operationData[propertyName] = collection[context.loopIndex];
4296
+ operationData.currentItem = collection[context.loopIndex];
4167
4297
  }
4168
4298
 
4169
- delete operationData.propertyName;
4170
4299
  return operationData;
4171
4300
  };
4172
4301
 
@@ -4229,6 +4358,8 @@ var ops = {
4229
4358
  getControllerInstance: getControllerInstance$1,
4230
4359
  getElementDimensions: getElementDimensions$1,
4231
4360
  getImport: getImport$1,
4361
+ getQueryParams: getQueryParams$1,
4362
+ invokeObjectMethod: invokeObjectMethod$1,
4232
4363
  loadJSON: loadJSON$1,
4233
4364
  log: log$1,
4234
4365
  math: math$1,
@@ -4851,7 +4982,7 @@ function animate() {
4851
4982
  required: true
4852
4983
  },
4853
4984
  animationDuration: {
4854
- type: 'ParameterType:integer',
4985
+ type: 'ParameterType:number',
4855
4986
  required: true
4856
4987
  }
4857
4988
  }
@@ -4888,15 +5019,15 @@ function broadcastEvent() {
4888
5019
 
4889
5020
  function calc() {
4890
5021
  return {
4891
- description: 'clears the given element',
5022
+ description: 'Calculates the given left and right hand sides using the specified operator',
4892
5023
  properties: {
4893
5024
  left: {
4894
- type: 'ParameterType:integer',
5025
+ type: 'ParameterType:number',
4895
5026
  description: 'The left operand',
4896
5027
  required: true
4897
5028
  },
4898
5029
  right: {
4899
- type: 'ParameterType:integer',
5030
+ type: 'ParameterType:number',
4900
5031
  description: 'The right operand',
4901
5032
  required: true
4902
5033
  },
@@ -4918,18 +5049,11 @@ function calc() {
4918
5049
  }, {
4919
5050
  value: '**',
4920
5051
  description: 'Exponent: Raises a base number to the exponent power, that is, the base number multiplied by itself, exponent times.'
4921
- }],
4922
- propertyName: {
4923
- type: 'ParameterType:string',
4924
- defaultValue: 'calculationResult'
4925
- }
5052
+ }]
5053
+ },
5054
+ outputProperties: {
5055
+ calculationResult: 'ParameterType:number'
4926
5056
  }
4927
- /*outputProperties: {
4928
- propertyName: {
4929
- type: 'ParameterType:integer',
4930
- },
4931
- },*/
4932
-
4933
5057
  };
4934
5058
  }
4935
5059
 
@@ -5027,10 +5151,6 @@ function getControllerInstance() {
5027
5151
  systemName: {
5028
5152
  type: 'ParameterType:controllerName',
5029
5153
  required: true
5030
- },
5031
- propertyName: {
5032
- type: 'ParameterType:string',
5033
- defaultValue: 'controllerInstance'
5034
5154
  }
5035
5155
  },
5036
5156
  outputProperties: {
@@ -5067,6 +5187,35 @@ function getImport() {
5067
5187
  };
5068
5188
  }
5069
5189
 
5190
+ function getQueryParams() {
5191
+ return {
5192
+ description: "Retrieves the current query parameters from the browser's address bar",
5193
+ outputProperties: {
5194
+ queryParams: 'ParameterType:object'
5195
+ }
5196
+ };
5197
+ }
5198
+
5199
+ function invokeObjectMethod() {
5200
+ return {
5201
+ description: 'Invokes the specified method on the given object with the optional specified arguments',
5202
+ properties: {
5203
+ instance: {
5204
+ type: 'ParameterType:object',
5205
+ required: true
5206
+ },
5207
+ methodName: {
5208
+ type: 'ParameterType:string',
5209
+ required: true
5210
+ },
5211
+ methodArguments: 'ParameterType:array'
5212
+ },
5213
+ outputProperties: {
5214
+ methodResult: 'ParameterType:object'
5215
+ }
5216
+ };
5217
+ }
5218
+
5070
5219
  function loadJSON() {
5071
5220
  return {
5072
5221
  description: 'Load JSON from the given url',
@@ -5075,11 +5224,7 @@ function loadJSON() {
5075
5224
  type: 'ParameterType:url',
5076
5225
  required: true
5077
5226
  },
5078
- cache: 'ParameterType:boolean',
5079
- propertyName: {
5080
- type: 'ParameterType:string',
5081
- defaultValue: 'json'
5082
- }
5227
+ cache: 'ParameterType:boolean'
5083
5228
  },
5084
5229
  outputProperties: {
5085
5230
  json: 'ParameterType:object'
@@ -5102,10 +5247,7 @@ function math() {
5102
5247
  required: true
5103
5248
  },
5104
5249
  functionName: createMathFunctionNames(),
5105
- propertyName: {
5106
- type: 'ParameterType:string',
5107
- defaultValue: 'mathResult'
5108
- }
5250
+ mathResult: 'ParameterType:number'
5109
5251
  }
5110
5252
  };
5111
5253
  }
@@ -5208,11 +5350,10 @@ function selectElement() {
5208
5350
  type: 'ParameterType:selector',
5209
5351
  required: true
5210
5352
  },
5211
- propertyName: 'ParameterType:string',
5212
5353
  useSelectedElementAsRoot: 'ParameterType:boolean'
5213
5354
  },
5214
5355
  outputProperties: {
5215
- selectedElement: 'ParameterType:object'
5356
+ selectedElement: 'ParameterType:jQuery'
5216
5357
  }
5217
5358
  };
5218
5359
  }
@@ -5275,10 +5416,7 @@ function setStyle() {
5275
5416
  type: 'ParameterType:object',
5276
5417
  required: true
5277
5418
  },
5278
- propertyName: {
5279
- type: 'ParameterType:string',
5280
- required: false
5281
- }
5419
+ selectedElement: 'ParameterType:jQuery'
5282
5420
  }
5283
5421
  };
5284
5422
  }
@@ -5301,10 +5439,7 @@ function startLoop() {
5301
5439
  type: 'ParameterType:array',
5302
5440
  required: true
5303
5441
  },
5304
- propertyName: {
5305
- type: 'ParameterType:string',
5306
- defaultValue: 'currentItem'
5307
- }
5442
+ currentItem: 'ParameterType:object'
5308
5443
  }
5309
5444
  };
5310
5445
  }
@@ -5334,7 +5469,7 @@ function wait() {
5334
5469
  description: 'Waits the given amount of milliseconds before the action continues',
5335
5470
  properties: {
5336
5471
  milliseconds: {
5337
- type: 'ParameterType:integer',
5472
+ type: 'ParameterType:number',
5338
5473
  required: true
5339
5474
  }
5340
5475
  }
@@ -5360,6 +5495,8 @@ var index = {
5360
5495
  getControllerInstance: getControllerInstance,
5361
5496
  getElementDimensions: getElementDimensions,
5362
5497
  getImport: getImport,
5498
+ getQueryParams: getQueryParams,
5499
+ invokeObjectMethod: invokeObjectMethod,
5363
5500
  loadJSON: loadJSON,
5364
5501
  log: log,
5365
5502
  math: math,
@@ -5382,5 +5519,5 @@ var index = {
5382
5519
  wait: wait
5383
5520
  };
5384
5521
 
5385
- export { Action, ActionRegistryEventbusListener, ConfigurationResolver, DEV_TOOLS_KEY, DevToolEventListener, Diagnostics, EligiusEngine, EligiusResourceImporter, EndableAction, EngineFactory, EventListenerController, Eventbus, JwPlayerTimelineProvider, LabelController, LanguageManager, LottieController, NavigationController, ProgressbarController, RequestAnimationFrameTimelineProvider, RequestVideoUriInterceptor, RoutingController, SubtitlesController, TimelineAction, TimelineEventNames, addClass$1 as addClass, addControllerToElement$1 as addControllerToElement, animate$1 as animate, animateWithClass$1 as animateWithClass, broadcastEvent$1 as broadcastEvent, calc$1 as calc, clearElement$1 as clearElement, clearOperationData$1 as clearOperationData, createElement$1 as createElement, customFunction$1 as customFunction, endAction$1 as endAction, endLoop$1 as endLoop, extendController$1 as extendController, generateImporterSourceCode, getControllerFromElement$1 as getControllerFromElement, getControllerInstance$1 as getControllerInstance, getElementDimensions$1 as getElementDimensions, getImport$1 as getImport, loadJSON$1 as loadJSON, log$1 as log, math$1 as math, index as metadata, removeClass$1 as removeClass, removeControllerFromElement$1 as removeControllerFromElement, removeElement$1 as removeElement, removePropertiesFromOperationData$1 as removePropertiesFromOperationData, reparentElement$1 as reparentElement, requestAction$1 as requestAction, resizeAction$1 as resizeAction, selectElement$1 as selectElement, setElementAttributes$1 as setElementAttributes, setElementContent$1 as setElementContent, setOperationData$1 as setOperationData, setStyle$1 as setStyle, startAction$1 as startAction, startLoop$1 as startLoop, toggleClass$1 as toggleClass, toggleElement$1 as toggleElement, wait$1 as wait };
5522
+ export { Action, ActionRegistryEventbusListener, ConfigurationResolver, DEV_TOOLS_KEY, DevToolEventListener, Diagnostics, EligiusEngine, EligiusResourceImporter, EndableAction, EngineFactory, EventListenerController, Eventbus, JwPlayerTimelineProvider, LabelController, LanguageManager, LottieController, NavigationController, ProgressbarController, RequestAnimationFrameTimelineProvider, RequestVideoUriInterceptor, RoutingController, SubtitlesController, TimelineAction, TimelineEventNames, addClass$1 as addClass, addControllerToElement$1 as addControllerToElement, animate$1 as animate, animateWithClass$1 as animateWithClass, broadcastEvent$1 as broadcastEvent, calc$1 as calc, clearElement$1 as clearElement, clearOperationData$1 as clearOperationData, createElement$1 as createElement, customFunction$1 as customFunction, endAction$1 as endAction, endLoop$1 as endLoop, extendController$1 as extendController, generateImporterSourceCode, getControllerFromElement$1 as getControllerFromElement, getControllerInstance$1 as getControllerInstance, getElementDimensions$1 as getElementDimensions, getImport$1 as getImport, getQueryParams$1 as getQueryParams, invokeObjectMethod$1 as invokeObjectMethod, loadJSON$1 as loadJSON, log$1 as log, math$1 as math, index as metadata, removeClass$1 as removeClass, removeControllerFromElement$1 as removeControllerFromElement, removeElement$1 as removeElement, removePropertiesFromOperationData$1 as removePropertiesFromOperationData, reparentElement$1 as reparentElement, requestAction$1 as requestAction, resizeAction$1 as resizeAction, selectElement$1 as selectElement, setElementAttributes$1 as setElementAttributes, setElementContent$1 as setElementContent, setOperationData$1 as setOperationData, setStyle$1 as setStyle, startAction$1 as startAction, startLoop$1 as startLoop, toggleClass$1 as toggleClass, toggleElement$1 as toggleElement, wait$1 as wait };
5386
5523
  //# sourceMappingURL=eligius.esm.js.map