eligius 1.0.12 → 1.0.14

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 (32) hide show
  1. package/dist/action/action.d.ts +2 -2
  2. package/dist/action/timeline-action.d.ts +2 -2
  3. package/dist/action/types.d.ts +2 -2
  4. package/dist/eligius-engine.d.ts +9 -1
  5. package/dist/eligius.cjs.development.js +358 -212
  6. package/dist/eligius.cjs.development.js.map +1 -1
  7. package/dist/eligius.cjs.production.min.js +1 -1
  8. package/dist/eligius.cjs.production.min.js.map +1 -1
  9. package/dist/eligius.esm.js +358 -212
  10. package/dist/eligius.esm.js.map +1 -1
  11. package/dist/operation/end-action.d.ts +4 -0
  12. package/dist/operation/get-controller-instance.d.ts +2 -2
  13. package/dist/operation/helper/get-property-chain-value.d.ts +24 -0
  14. package/dist/operation/helper/resolve-operation-or-global-data-property-chain.d.ts +13 -0
  15. package/dist/operation/helper/resolve-property-chain.d.ts +23 -0
  16. package/dist/operation/helper/resolve-property-values.d.ts +1 -1
  17. package/dist/operation/log.d.ts +2 -2
  18. package/dist/operation/math.d.ts +1 -1
  19. package/dist/operation/set-style.d.ts +2 -3
  20. package/dist/operation/types.d.ts +1 -1
  21. package/dist/timelineproviders/jwplayer-timeline-provider.d.ts +2 -2
  22. package/dist/timelineproviders/request-animation-frame-timeline-provider.d.ts +2 -1
  23. package/dist/timelineproviders/types.d.ts +1 -1
  24. package/dist/util/guards/is-function.d.ts +1 -0
  25. package/dist/util/guards/is-object.d.ts +1 -0
  26. package/dist/util/guards/is-promise.d.ts +1 -0
  27. package/dist/util/guards/is-string.d.ts +1 -0
  28. package/package.json +5 -5
  29. package/dist/action/is-promise.d.ts +0 -1
  30. package/dist/operation/helper/extract-operation-data-argument-values.d.ts +0 -1
  31. package/dist/operation/helper/get-nested-property-value.d.ts +0 -1
  32. package/dist/operation/helper/get-nested-value.d.ts +0 -1
@@ -431,12 +431,20 @@ function _setPrototypeOf(o, p) {
431
431
  return _setPrototypeOf(o, p);
432
432
  }
433
433
 
434
+ function isFunction(value) {
435
+ return typeof value === 'function';
436
+ }
437
+
438
+ function isObject(value) {
439
+ return value !== null && typeof value === 'object';
440
+ }
441
+
434
442
  function prepareValueForSerialization(value) {
435
443
  if (Array.isArray(value)) {
436
444
  return value.map(prepareValueForSerialization);
437
445
  } else if (value instanceof $__default["default"]) {
438
446
  return 'jQuery object';
439
- } else if (value !== null && typeof value === 'object') {
447
+ } else if (isObject(value)) {
440
448
  if (value.constructor.toString().substring(0, 5) === 'class' || !value.constructor.toString().startsWith('function Object()')) {
441
449
  var funcString = value.constructor.toString();
442
450
  return funcString.substring(0, funcString.indexOf('{') + 1);
@@ -447,7 +455,7 @@ function prepareValueForSerialization(value) {
447
455
  propValue = _ref[1];
448
456
  return [propName, prepareValueForSerialization(propValue)];
449
457
  }));
450
- } else if (typeof value === 'function') {
458
+ } else if (isFunction(value)) {
451
459
  var _funcString = value.toString();
452
460
 
453
461
  var paranIndex = _funcString.indexOf('{');
@@ -595,7 +603,7 @@ var Action = /*#__PURE__*/function () {
595
603
 
596
604
  if (isPromise(operationResult)) {
597
605
  operationResult.then(function (promisedOperationResult) {
598
- _this2.executeOperation(operations, ++idx, resolve, reject, promisedOperationResult, context);
606
+ return _this2.executeOperation(operations, ++idx, resolve, reject, promisedOperationResult, context);
599
607
  })["catch"](function (error) {
600
608
  reject(error);
601
609
  });
@@ -676,9 +684,7 @@ var TimelineAction = /*#__PURE__*/function (_EndableAction) {
676
684
  return _EndableAction.prototype.start.call(this, initOperationData);
677
685
  }
678
686
 
679
- return new Promise(function (resolve) {
680
- resolve();
681
- });
687
+ return Promise.resolve(undefined);
682
688
  };
683
689
 
684
690
  _proto.end = function end(initOperationData) {
@@ -858,7 +864,11 @@ function _gatherControllerImportPaths(operationConfigs) {
858
864
 
859
865
  return false;
860
866
  }).map(function (operationConfig) {
861
- var systemName = operationConfig.operationData.systemName;
867
+ var _operationConfig$oper2;
868
+
869
+ var _ref = (_operationConfig$oper2 = operationConfig.operationData) != null ? _operationConfig$oper2 : {},
870
+ systemName = _ref.systemName;
871
+
862
872
  return {
863
873
  systemName: systemName
864
874
  };
@@ -890,19 +900,34 @@ function dedupe(importPaths) {
890
900
  });
891
901
  }
892
902
 
893
- function getNestedValue(properties, sourceObject) {
894
- if (!properties) {
895
- throw Error('properties arg cannot be null');
896
- }
897
-
898
- if (!sourceObject) {
899
- throw Error('sourceObject arg cannot be null');
900
- }
901
-
903
+ /**
904
+ /**
905
+ * Gets the value for the given property chain. A property chain is defined by a string array.
906
+ *
907
+ * For example, this property chain: `[mySource, subSource, element, value]` should be extracted from an object of this shape:
908
+ * ```ts
909
+ * const foo = {
910
+ * mySource: {
911
+ * subSource: {
912
+ * element: {
913
+ * value: 'bar'
914
+ * }
915
+ * }
916
+ * }
917
+ * }
918
+ * ```
919
+ *
920
+ * The result of the invocation `getPropertyChainValue([mySource, subSource, element, value], foo)` would then yield the value `bar`.
921
+ *
922
+ * @param propertyChain
923
+ * @param sourceObject
924
+ * @returns
925
+ */
926
+ function getPropertyChainValue(propertyChain, sourceObject) {
902
927
  var currentInstance = sourceObject;
903
928
  var suffix = null;
904
- properties.forEach(function (prop, index) {
905
- if (index === properties.length - 1) {
929
+ propertyChain.forEach(function (prop, index) {
930
+ if (index === propertyChain.length - 1) {
906
931
  var parts = prop.split('+');
907
932
 
908
933
  if (parts.length > 1) {
@@ -913,12 +938,39 @@ function getNestedValue(properties, sourceObject) {
913
938
 
914
939
  currentInstance = currentInstance[prop];
915
940
  });
916
- return suffix ? currentInstance + suffix : currentInstance;
941
+ return suffix ? "" + currentInstance + suffix : currentInstance;
917
942
  }
918
943
 
919
- function getNestedPropertyValue(propertyChain, sourceObject) {
944
+ /**
945
+ * Gets the value for the given property chain. A property chain is defined by a period delimited string.
946
+ *
947
+ * For example, this property chain: `mySource.subSource.element.value` should be extracted from an object of this shape:
948
+ * ```ts
949
+ * const foo = {
950
+ * mySource: {
951
+ * subSource: {
952
+ * element: {
953
+ * value: 'bar'
954
+ * }
955
+ * }
956
+ * }
957
+ * }
958
+ * ```
959
+ *
960
+ * The result of the invocation `resolvePropertyChain('mySource.subSource.element.value', foo)` would then yield the value `bar`.
961
+ *
962
+ * @param propertyChain the specified property chain
963
+ * @param sourceObject the given source object
964
+ * @returns
965
+ */
966
+
967
+ function resolvePropertyChain(propertyChain, sourceObject) {
920
968
  var properties = propertyChain.split('.');
921
- return getNestedValue(properties, sourceObject);
969
+ return getPropertyChainValue(properties, sourceObject);
970
+ }
971
+
972
+ function isString(value) {
973
+ return typeof value === 'string';
922
974
  }
923
975
 
924
976
  var ConfigurationResolver = /*#__PURE__*/function () {
@@ -993,10 +1045,12 @@ function resolveTimelines(timelines, importer, eventbus) {
993
1045
  }
994
1046
 
995
1047
  function resolveOperation(importer, operationConfig) {
1048
+ var _deepCopy;
1049
+
996
1050
  return {
997
1051
  id: operationConfig.id,
998
1052
  systemName: operationConfig.systemName,
999
- operationData: deepCopy(operationConfig.operationData),
1053
+ operationData: (_deepCopy = deepCopy(operationConfig.operationData)) != null ? _deepCopy : {},
1000
1054
  instance: importer["import"](operationConfig.systemName)[operationConfig.systemName]
1001
1055
  };
1002
1056
  }
@@ -1068,10 +1122,10 @@ function resolvePlaceholders(configFragment, rootConfig, importer) {
1068
1122
  function resolvePlaceholder(key, configFragment, rootConfig, importer) {
1069
1123
  var configValue = configFragment[key];
1070
1124
 
1071
- if (typeof configValue === 'string') {
1125
+ if (isString(configValue)) {
1072
1126
  if (configValue.startsWith('config:')) {
1073
1127
  var configProperty = configValue.substring(7, configValue.length);
1074
- configFragment[key] = getNestedPropertyValue(configProperty, rootConfig);
1128
+ configFragment[key] = resolvePropertyChain(configProperty, rootConfig);
1075
1129
  } else if (configValue.startsWith('template:')) {
1076
1130
  var templateKey = configValue.substring(9, configValue.length);
1077
1131
  var template = importer["import"](templateKey)[templateKey];
@@ -1081,7 +1135,7 @@ function resolvePlaceholder(key, configFragment, rootConfig, importer) {
1081
1135
  var json = importer["import"](jsonKey)[jsonKey];
1082
1136
  configFragment[key] = json;
1083
1137
  }
1084
- } else if (typeof configValue === 'object') {
1138
+ } else if (isObject(configValue)) {
1085
1139
  resolvePlaceholders(configValue, rootConfig, importer);
1086
1140
  }
1087
1141
  }
@@ -2147,63 +2201,69 @@ var EligiusEngine = /*#__PURE__*/function () {
2147
2201
  }
2148
2202
  };
2149
2203
 
2150
- _proto._initializeTimelineProvider = function _initializeTimelineProvider() {
2151
- var _this$configuration$t,
2152
- _this$_activeTimeline,
2153
- _this = this;
2204
+ _proto._initializeTimelineProvider = /*#__PURE__*/function () {
2205
+ var _initializeTimelineProvider2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
2206
+ var _this$configuration$t, _this$_activeTimeline;
2154
2207
 
2155
- if (!((_this$configuration$t = this.configuration.timelines) != null && _this$configuration$t.length)) {
2156
- throw new Error('No timelines present');
2157
- }
2208
+ var firstTimeline, providerSettings;
2209
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
2210
+ while (1) {
2211
+ switch (_context.prev = _context.next) {
2212
+ case 0:
2213
+ if ((_this$configuration$t = this.configuration.timelines) != null && _this$configuration$t.length) {
2214
+ _context.next = 2;
2215
+ break;
2216
+ }
2158
2217
 
2159
- var firstTimeline = this.configuration.timelines[0];
2160
- var providerSettings = this.timelineProviders[firstTimeline.type];
2218
+ throw new Error('No timelines present');
2161
2219
 
2162
- if (!providerSettings) {
2163
- throw new Error("No timeline provider configured for type " + firstTimeline.type);
2164
- }
2220
+ case 2:
2221
+ firstTimeline = this.configuration.timelines[0];
2222
+ providerSettings = this.timelineProviders[firstTimeline.type];
2165
2223
 
2166
- (_this$_activeTimeline = this._activeTimelineProvider) == null ? void 0 : _this$_activeTimeline.destroy();
2167
- this._activeTimelineProvider = providerSettings.provider;
2168
- return new Promise( /*#__PURE__*/function () {
2169
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(resolve) {
2170
- return _regeneratorRuntime().wrap(function _callee$(_context) {
2171
- while (1) {
2172
- switch (_context.prev = _context.next) {
2173
- case 0:
2174
- if (!_this._activeTimelineProvider) {
2175
- _context.next = 8;
2176
- break;
2177
- }
2224
+ if (providerSettings) {
2225
+ _context.next = 6;
2226
+ break;
2227
+ }
2178
2228
 
2179
- _context.next = 3;
2180
- return _this._activeTimelineProvider.init();
2229
+ throw new Error("No timeline provider configured for type " + firstTimeline.type);
2181
2230
 
2182
- case 3:
2183
- _context.next = 5;
2184
- return _this._executeActions(_this.configuration.initActions, 'start');
2231
+ case 6:
2232
+ (_this$_activeTimeline = this._activeTimelineProvider) == null ? void 0 : _this$_activeTimeline.destroy();
2233
+ this._activeTimelineProvider = providerSettings.provider;
2185
2234
 
2186
- case 5:
2187
- resolve(_this._activeTimelineProvider);
2188
- _context.next = 9;
2235
+ if (this._activeTimelineProvider) {
2236
+ _context.next = 10;
2189
2237
  break;
2238
+ }
2190
2239
 
2191
- case 8:
2192
- throw new Error('NO ACTIVE TIMELINE PROVIDER');
2240
+ throw new Error('NO ACTIVE TIMELINE PROVIDER');
2193
2241
 
2194
- case 9:
2195
- case "end":
2196
- return _context.stop();
2197
- }
2242
+ case 10:
2243
+ _context.next = 12;
2244
+ return this._activeTimelineProvider.init();
2245
+
2246
+ case 12:
2247
+ _context.next = 14;
2248
+ return this._executeActions(this.configuration.initActions, 'start');
2249
+
2250
+ case 14:
2251
+ return _context.abrupt("return", this._activeTimelineProvider);
2252
+
2253
+ case 15:
2254
+ case "end":
2255
+ return _context.stop();
2198
2256
  }
2199
- }, _callee);
2200
- }));
2257
+ }
2258
+ }, _callee, this);
2259
+ }));
2201
2260
 
2202
- return function (_x) {
2203
- return _ref.apply(this, arguments);
2204
- };
2205
- }());
2206
- };
2261
+ function _initializeTimelineProvider() {
2262
+ return _initializeTimelineProvider2.apply(this, arguments);
2263
+ }
2264
+
2265
+ return _initializeTimelineProvider;
2266
+ }();
2207
2267
 
2208
2268
  _proto._cleanUp = /*#__PURE__*/function () {
2209
2269
  var _cleanUp2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
@@ -2216,7 +2276,7 @@ var EligiusEngine = /*#__PURE__*/function () {
2216
2276
 
2217
2277
  case 2:
2218
2278
  _context2.next = 4;
2219
- return this._executeActions(this.configuration.initActions, 'end');
2279
+ return this._executeActions([].concat(this.configuration.initActions).reverse(), 'end');
2220
2280
 
2221
2281
  case 4:
2222
2282
  case "end":
@@ -2312,18 +2372,25 @@ var EligiusEngine = /*#__PURE__*/function () {
2312
2372
  };
2313
2373
 
2314
2374
  _proto._createTimelineLookup = function _createTimelineLookup() {
2315
- var _this2 = this;
2375
+ var _this = this;
2316
2376
 
2317
2377
  if (!this.configuration.timelines) {
2318
2378
  return;
2319
2379
  }
2320
2380
 
2321
2381
  this.configuration.timelines.forEach(function (timelineInfo) {
2322
- timelineInfo.timelineActions.forEach(_this2._addTimelineAction.bind(_this2, timelineInfo.uri));
2382
+ timelineInfo.timelineActions.forEach(_this._addTimelineActionStart.bind(_this, timelineInfo.uri));
2383
+ });
2384
+ this.configuration.timelines.forEach(function (timelineInfo) {
2385
+ // actions ends need to be in reversed order, otherwise, for example,
2386
+ // elements that were created before dependent actions will already have been
2387
+ // removed in the end phase.
2388
+ var reversed = [].concat(timelineInfo.timelineActions).reverse();
2389
+ reversed.forEach(_this._addTimelineActionEnd.bind(_this, timelineInfo.uri));
2323
2390
  });
2324
2391
  };
2325
2392
 
2326
- _proto._addTimelineAction = function _addTimelineAction(uri, timeLineAction) {
2393
+ _proto._addTimelineActionStart = function _addTimelineActionStart(uri, timeLineAction) {
2327
2394
  var _timeLineAction$id;
2328
2395
 
2329
2396
  var startPosition = timeLineAction.duration.start;
@@ -2338,6 +2405,9 @@ var EligiusEngine = /*#__PURE__*/function () {
2338
2405
  }
2339
2406
 
2340
2407
  timelineStartPositions.push(startMethod);
2408
+ };
2409
+
2410
+ _proto._addTimelineActionEnd = function _addTimelineActionEnd(uri, timeLineAction) {
2341
2411
  var end = timeLineAction.duration.end;
2342
2412
 
2343
2413
  if (end < 0) {
@@ -2397,9 +2467,7 @@ var EligiusEngine = /*#__PURE__*/function () {
2397
2467
  return _context4.abrupt("return", this._executeActions(actions, methodName, ++idx));
2398
2468
 
2399
2469
  case 6:
2400
- return _context4.abrupt("return", new Promise(function (resolve) {
2401
- resolve();
2402
- }));
2470
+ return _context4.abrupt("return", Promise.resolve());
2403
2471
 
2404
2472
  case 7:
2405
2473
  case "end":
@@ -2409,7 +2477,7 @@ var EligiusEngine = /*#__PURE__*/function () {
2409
2477
  }, _callee4, this);
2410
2478
  }));
2411
2479
 
2412
- function _executeActions(_x2, _x3, _x4) {
2480
+ function _executeActions(_x, _x2, _x3) {
2413
2481
  return _executeActions2.apply(this, arguments);
2414
2482
  }
2415
2483
 
@@ -2421,27 +2489,29 @@ var EligiusEngine = /*#__PURE__*/function () {
2421
2489
  };
2422
2490
 
2423
2491
  _proto._handleRequestTimelineUri = /*#__PURE__*/function () {
2424
- var _handleRequestTimelineUri2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(uri, position, previousVideoPosition) {
2425
- var _position,
2426
- _this3 = this;
2492
+ var _handleRequestTimelineUri2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(uri, position) {
2493
+ var _this2 = this;
2427
2494
 
2428
2495
  var timelineConfig, newProviderSettings;
2429
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
2496
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
2430
2497
  while (1) {
2431
- switch (_context5.prev = _context5.next) {
2498
+ switch (_context6.prev = _context6.next) {
2432
2499
  case 0:
2500
+ if (position === void 0) {
2501
+ position = 0;
2502
+ }
2503
+
2433
2504
  if (this._activeTimelineProvider) {
2434
- _context5.next = 2;
2505
+ _context6.next = 3;
2435
2506
  break;
2436
2507
  }
2437
2508
 
2438
- return _context5.abrupt("return");
2439
-
2440
- case 2:
2509
+ return _context6.abrupt("return");
2441
2510
 
2511
+ case 3:
2442
2512
  this._activeTimelineProvider.stop();
2443
2513
 
2444
- _context5.next = 6;
2514
+ _context6.next = 6;
2445
2515
  return this._cleanUpTimeline();
2446
2516
 
2447
2517
  case 6:
@@ -2450,11 +2520,11 @@ var EligiusEngine = /*#__PURE__*/function () {
2450
2520
  });
2451
2521
 
2452
2522
  if (!(!timelineConfig || !this._activeTimelineProvider || this._currentTimelineUri === timelineConfig.uri)) {
2453
- _context5.next = 9;
2523
+ _context6.next = 9;
2454
2524
  break;
2455
2525
  }
2456
2526
 
2457
- return _context5.abrupt("return");
2527
+ return _context6.abrupt("return");
2458
2528
 
2459
2529
  case 9:
2460
2530
  this._currentTimelineUri = timelineConfig.uri;
@@ -2468,42 +2538,55 @@ var EligiusEngine = /*#__PURE__*/function () {
2468
2538
  }
2469
2539
 
2470
2540
  this._activeTimelineProvider.loop = timelineConfig.loop;
2471
- position = (_position = position) != null ? _position : 0;
2472
2541
 
2473
2542
  if (!this._activeTimelineProvider.loop && position > 0) {
2474
- this.eventbus.once(TimelineEventNames.FIRST_FRAME, function () {
2475
- if (!_this3._activeTimelineProvider) {
2476
- return;
2477
- }
2478
-
2479
- _this3._activeTimelineProvider.pause();
2480
-
2481
- _this3.eventbus.broadcast(TimelineEventNames.DURATION, [_this3._activeTimelineProvider.getDuration()]);
2482
-
2483
- _this3._executeStartActions().then(function () {
2484
- var _position2, _this3$_activeTimelin;
2485
-
2486
- position = (_position2 = position) != null ? _position2 : 0;
2487
- (_this3$_activeTimelin = _this3._activeTimelineProvider) == null ? void 0 : _this3$_activeTimelin.seek(position);
2488
-
2489
- _this3._onSeekHandler(Math.floor, {
2490
- offset: position
2491
- });
2492
- });
2493
- });
2543
+ this.eventbus.once(TimelineEventNames.FIRST_FRAME, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
2544
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
2545
+ while (1) {
2546
+ switch (_context5.prev = _context5.next) {
2547
+ case 0:
2548
+ if (_this2._activeTimelineProvider) {
2549
+ _context5.next = 2;
2550
+ break;
2551
+ }
2552
+
2553
+ return _context5.abrupt("return");
2554
+
2555
+ case 2:
2556
+ _this2._activeTimelineProvider.pause();
2557
+
2558
+ _this2.eventbus.broadcast(TimelineEventNames.DURATION, [_this2._activeTimelineProvider.getDuration()]);
2559
+
2560
+ _context5.next = 6;
2561
+ return _this2._executeStartActions();
2562
+
2563
+ case 6:
2564
+ _this2._activeTimelineProvider.seek(position);
2565
+
2566
+ _this2._onSeekHandler(Math.floor, {
2567
+ offset: position
2568
+ });
2569
+
2570
+ case 8:
2571
+ case "end":
2572
+ return _context5.stop();
2573
+ }
2574
+ }
2575
+ }, _callee5);
2576
+ })));
2494
2577
  }
2495
2578
 
2496
2579
  this._activeTimelineProvider.playlistItem(uri);
2497
2580
 
2498
- case 17:
2581
+ case 16:
2499
2582
  case "end":
2500
- return _context5.stop();
2583
+ return _context6.stop();
2501
2584
  }
2502
2585
  }
2503
- }, _callee5, this);
2586
+ }, _callee6, this);
2504
2587
  }));
2505
2588
 
2506
- function _handleRequestTimelineUri(_x5, _x6, _x7) {
2589
+ function _handleRequestTimelineUri(_x4, _x5) {
2507
2590
  return _handleRequestTimelineUri2.apply(this, arguments);
2508
2591
  }
2509
2592
 
@@ -2516,10 +2599,18 @@ var EligiusEngine = /*#__PURE__*/function () {
2516
2599
 
2517
2600
  _proto._executeStartActions = function _executeStartActions() {
2518
2601
  return this._executeRelevantActions(this._getActionsForPosition.bind(this, 0), 'start');
2519
- };
2602
+ }
2603
+ /**
2604
+ * Gets all of the inactive actions whose duration falls within the given timeline position.
2605
+ *
2606
+ * @param position the given position
2607
+ * @param actions all of the relevant actions
2608
+ * @returns
2609
+ */
2610
+ ;
2520
2611
 
2521
- _proto._getActionsForPosition = function _getActionsForPosition(position, allActions) {
2522
- return allActions.filter(function (action) {
2612
+ _proto._getActionsForPosition = function _getActionsForPosition(position, actions) {
2613
+ return actions.filter(function (action) {
2523
2614
  return !action.active && action.duration.start <= position && action.duration.end >= position;
2524
2615
  });
2525
2616
  };
@@ -2528,15 +2619,7 @@ var EligiusEngine = /*#__PURE__*/function () {
2528
2619
  var actions = allActions.filter(function (action) {
2529
2620
  return action.active;
2530
2621
  });
2531
- return actions.sort(function (a, b) {
2532
- if (b.duration.start < a.duration.start) {
2533
- return -1;
2534
- } else if (b.duration.start > a.duration.start) {
2535
- return 1;
2536
- } else {
2537
- return 0;
2538
- }
2539
- });
2622
+ return actions.sort(sortActions);
2540
2623
  };
2541
2624
 
2542
2625
  _proto._executeRelevantActions = function _executeRelevantActions(filter, executionType) {
@@ -2611,21 +2694,44 @@ var EligiusEngine = /*#__PURE__*/function () {
2611
2694
  }
2612
2695
  };
2613
2696
 
2614
- _proto._onSeekHandler = function _onSeekHandler(floor, event) {
2615
- var _this4 = this;
2697
+ _proto._onSeekHandler = /*#__PURE__*/function () {
2698
+ var _onSeekHandler2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(floor, event) {
2699
+ var _this$_activeTimeline5;
2616
2700
 
2617
- if (isNaN(event.offset)) {
2618
- return;
2619
- }
2701
+ var pos;
2702
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
2703
+ while (1) {
2704
+ switch (_context7.prev = _context7.next) {
2705
+ case 0:
2706
+ if (!isNaN(event.offset)) {
2707
+ _context7.next = 2;
2708
+ break;
2709
+ }
2620
2710
 
2621
- var pos = floor(event.offset);
2711
+ return _context7.abrupt("return");
2622
2712
 
2623
- this._executeSeekActions(pos).then(function () {
2624
- var _this4$_activeTimelin;
2713
+ case 2:
2714
+ pos = floor(event.offset);
2715
+ _context7.next = 5;
2716
+ return this._executeSeekActions(pos);
2625
2717
 
2626
- (_this4$_activeTimelin = _this4._activeTimelineProvider) == null ? void 0 : _this4$_activeTimelin.start();
2627
- });
2628
- };
2718
+ case 5:
2719
+ (_this$_activeTimeline5 = this._activeTimelineProvider) == null ? void 0 : _this$_activeTimeline5.start();
2720
+
2721
+ case 6:
2722
+ case "end":
2723
+ return _context7.stop();
2724
+ }
2725
+ }
2726
+ }, _callee7, this);
2727
+ }));
2728
+
2729
+ function _onSeekHandler(_x6, _x7) {
2730
+ return _onSeekHandler2.apply(this, arguments);
2731
+ }
2732
+
2733
+ return _onSeekHandler;
2734
+ }();
2629
2735
 
2630
2736
  _proto._executeActionsForPosition = function _executeActionsForPosition(position) {
2631
2737
  this._lastPosition = position;
@@ -2639,33 +2745,60 @@ var EligiusEngine = /*#__PURE__*/function () {
2639
2745
  }
2640
2746
  };
2641
2747
 
2642
- _proto._executeSeekActions = function _executeSeekActions(pos) {
2643
- var _this5 = this;
2748
+ _proto._executeSeekActions = /*#__PURE__*/function () {
2749
+ var _executeSeekActions2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(pos) {
2750
+ var timelineActions, currentActions, newActions, currentActionsEnd;
2751
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
2752
+ while (1) {
2753
+ switch (_context8.prev = _context8.next) {
2754
+ case 0:
2755
+ timelineActions = this._getRelevantTimelineActions();
2756
+
2757
+ if (timelineActions) {
2758
+ _context8.next = 3;
2759
+ break;
2760
+ }
2644
2761
 
2645
- var timelineActions = this._getRelevantTimelineActions();
2762
+ return _context8.abrupt("return", Promise.resolve());
2646
2763
 
2647
- if (!timelineActions) {
2648
- return Promise.resolve();
2649
- }
2764
+ case 3:
2765
+ currentActions = this._getActiveActions(timelineActions).reverse();
2766
+ newActions = this._getActionsForPosition(pos, timelineActions);
2767
+ currentActionsEnd = this._executeActions(currentActions, 'end', 0);
2768
+ _context8.next = 8;
2769
+ return currentActionsEnd;
2650
2770
 
2651
- var currentActions = this._getActiveActions(timelineActions);
2771
+ case 8:
2772
+ return _context8.abrupt("return", this._executeActions(newActions, 'start', 0));
2652
2773
 
2653
- var newActions = this._getActionsForPosition(pos, timelineActions);
2774
+ case 9:
2775
+ case "end":
2776
+ return _context8.stop();
2777
+ }
2778
+ }
2779
+ }, _callee8, this);
2780
+ }));
2654
2781
 
2655
- var promise = this._executeActions(currentActions, 'end', 0);
2782
+ function _executeSeekActions(_x8) {
2783
+ return _executeSeekActions2.apply(this, arguments);
2784
+ }
2656
2785
 
2657
- return new Promise(function (resolve) {
2658
- promise.then(function () {
2659
- _this5._executeActions(newActions, 'start', 0).then(function () {
2660
- resolve();
2661
- });
2662
- });
2663
- });
2664
- };
2786
+ return _executeSeekActions;
2787
+ }();
2665
2788
 
2666
2789
  return EligiusEngine;
2667
2790
  }();
2668
2791
 
2792
+ var sortActions = function sortActions(a, b) {
2793
+ if (b.duration.start < a.duration.start) {
2794
+ return -1;
2795
+ } else if (b.duration.start > a.duration.start) {
2796
+ return 1;
2797
+ } else {
2798
+ return 0;
2799
+ }
2800
+ };
2801
+
2669
2802
  var ActionRegistryEventbusListener = /*#__PURE__*/function () {
2670
2803
  function ActionRegistryEventbusListener() {
2671
2804
  this._actionRegistry = new Map();
@@ -3335,28 +3468,41 @@ function _setGlobals(cache, newValues) {
3335
3468
  value = _ref[1];
3336
3469
  return cache[name] = value;
3337
3470
  });
3338
- console.log('cache', cache);
3339
3471
  }
3340
3472
 
3341
3473
  var getGlobals = /*#__PURE__*/_getGlobals.bind(null, cache$1);
3342
3474
  var setGlobals = /*#__PURE__*/_setGlobals.bind(null, cache$1);
3343
3475
 
3344
- function extractOperationDataArgumentValues(sourceObject, argumentValue) {
3345
- if (typeof argumentValue === 'string' && argumentValue.toLowerCase().startsWith('operationdata.')) {
3346
- var propNames = argumentValue.split('.');
3347
- propNames.shift();
3348
- return getNestedValue(propNames, sourceObject);
3349
- }
3476
+ /**
3477
+ * Resolves operation and global data property chains.
3478
+ *
3479
+ * An operation data property chain is designated by a `operationdata.` suffix, followed by an arbitrary property chain.
3480
+ * For global data the suffix should be `globaldata.`
3481
+ *
3482
+ * If the propertyChainOrRegularObject is not a property chain, this value is returned instead.
3483
+ *
3484
+ * @param sourceObject The object that represents the operation data
3485
+ * @param propertyChainOrRegularObject A period delimited string, or just a regular object
3486
+ * @returns
3487
+ */
3350
3488
 
3351
- if (typeof argumentValue === 'string' && argumentValue.toLowerCase().startsWith('globaldata.')) {
3352
- var _propNames = argumentValue.split('.');
3489
+ function resolveOperationOrGlobalDataPropertyChain(sourceObject, propertyChainOrRegularObject) {
3490
+ if (isString(propertyChainOrRegularObject)) {
3491
+ var _propNames$shift;
3353
3492
 
3354
- _propNames.shift();
3493
+ var propNames = propertyChainOrRegularObject.split('.');
3494
+ var prefix = (_propNames$shift = propNames.shift()) == null ? void 0 : _propNames$shift.toLowerCase();
3355
3495
 
3356
- return getNestedValue(_propNames, getGlobals());
3496
+ if (prefix == 'operationdata') {
3497
+ return getPropertyChainValue(propNames, sourceObject);
3498
+ }
3499
+
3500
+ if (prefix == 'globaldata') {
3501
+ return getPropertyChainValue(propNames, getGlobals());
3502
+ }
3357
3503
  }
3358
3504
 
3359
- return argumentValue;
3505
+ return propertyChainOrRegularObject;
3360
3506
  }
3361
3507
 
3362
3508
  function resolveEventArguments(operationData, eventArgs) {
@@ -3364,7 +3510,7 @@ function resolveEventArguments(operationData, eventArgs) {
3364
3510
  return;
3365
3511
  }
3366
3512
 
3367
- var extract = extractOperationDataArgumentValues.bind(null, operationData);
3513
+ var extract = resolveOperationOrGlobalDataPropertyChain.bind(null, operationData);
3368
3514
  return eventArgs.map(extract);
3369
3515
  }
3370
3516
 
@@ -3394,12 +3540,13 @@ var broadcastEvent$1 = function broadcastEvent(operationData) {
3394
3540
  var cache = [];
3395
3541
  function resolvePropertyValues(operationData, properties) {
3396
3542
  var copy = properties !== operationData ? deepCopy(properties) : properties;
3397
- var extract = extractOperationDataArgumentValues.bind(null, operationData);
3398
- resolveProperties(properties, copy, extract);
3543
+ var resolvePropertyChain = resolveOperationOrGlobalDataPropertyChain.bind(null, operationData);
3544
+ resolveProperties(properties, copy, resolvePropertyChain);
3399
3545
  return copy;
3400
3546
  }
3401
3547
 
3402
- function resolveProperties(properties, copy, extract) {
3548
+ function resolveProperties(properties, copy, resolvePropertyChain) {
3549
+ // Prevent recursive looping
3403
3550
  if (cache.indexOf(properties) > -1) {
3404
3551
  return;
3405
3552
  }
@@ -3415,18 +3562,18 @@ function resolveProperties(properties, copy, extract) {
3415
3562
  return;
3416
3563
  }
3417
3564
 
3418
- if (typeof value === 'string') {
3419
- copy[key] = extract(value);
3565
+ if (isString(value)) {
3566
+ copy[key] = resolvePropertyChain(value);
3420
3567
  } else if (Array.isArray(value)) {
3421
3568
  value.forEach(function (item, index, arr) {
3422
- if (typeof item === 'string') {
3423
- arr[index] = extract(item);
3569
+ if (isString(item)) {
3570
+ arr[index] = resolvePropertyChain(item);
3424
3571
  } else {
3425
- resolveProperties(item, item, extract);
3572
+ resolveProperties(item, item, resolvePropertyChain);
3426
3573
  }
3427
3574
  });
3428
- } else if (typeof value === 'object') {
3429
- resolveProperties(value, value, extract);
3575
+ } else if (isObject(value)) {
3576
+ resolveProperties(value, value, resolvePropertyChain);
3430
3577
  }
3431
3578
  });
3432
3579
  } finally {
@@ -3513,7 +3660,7 @@ var createElement$1 = function createElement(operationData) {
3513
3660
  elementName = _operationData.elementName,
3514
3661
  attributes = _operationData.attributes,
3515
3662
  text = _operationData.text;
3516
- var serializedAttrs = attributes ? ' ' + Object.entries(attributes).map(function (_ref) {
3663
+ var serializedAttrs = attributes ? " " + Object.entries(attributes).map(function (_ref) {
3517
3664
  var key = _ref[0],
3518
3665
  value = _ref[1];
3519
3666
  return key + "=\"" + value + "\"";
@@ -3537,7 +3684,7 @@ var customFunction$1 = function customFunction(operationData) {
3537
3684
  var systemName = operationData.systemName;
3538
3685
  return new Promise(function (resolve, reject) {
3539
3686
  var resultCallback = function resultCallback(func) {
3540
- var promise = func(operationData, _this.eventbus);
3687
+ var promise = func.apply(_this, [operationData]);
3541
3688
 
3542
3689
  if (promise) {
3543
3690
  promise.then(function () {
@@ -3555,6 +3702,10 @@ var customFunction$1 = function customFunction(operationData) {
3555
3702
  /**
3556
3703
  * This operation invokes the end() method on the specified action instance.
3557
3704
  *
3705
+ * The action operation data is first merged with the current operation data before it is
3706
+ * passed on to the action. After the action has completed the action operation data properties
3707
+ * are removed from the current operation data.
3708
+ *
3558
3709
  * @param operationData
3559
3710
  * @returns
3560
3711
  */
@@ -3897,22 +4048,10 @@ var getImport$1 = function getImport(operationData) {
3897
4048
  var getQueryParams$1 = function getQueryParams(operationData) {
3898
4049
  var searchParams = new URLSearchParams(window.location.search);
3899
4050
  var queryParams = Object.fromEntries(searchParams.entries());
3900
- var defaultValues = operationData.defaultValues;
3901
-
3902
- if (defaultValues) {
3903
- var defaultEntries = Object.entries(defaultValues).filter(function (_ref) {
3904
- var name = _ref[0];
3905
- return !(name in queryParams);
3906
- });
3907
- defaultEntries.forEach(function (_ref2) {
3908
- var name = _ref2[0],
3909
- value = _ref2[1];
3910
- return queryParams[name] = value;
3911
- });
3912
- delete operationData.defaultValues;
3913
- }
3914
-
3915
- operationData.queryParams = queryParams;
4051
+ var _operationData$defaul = operationData.defaultValues,
4052
+ defaultValues = _operationData$defaul === void 0 ? {} : _operationData$defaul;
4053
+ delete operationData.defaultValues;
4054
+ operationData.queryParams = _extends({}, defaultValues, queryParams);
3916
4055
  return operationData;
3917
4056
  };
3918
4057
 
@@ -4005,7 +4144,7 @@ var log$1 = function log(operationData) {
4005
4144
  };
4006
4145
 
4007
4146
  /**
4008
- * This operation performs the given math function of the specified arguments.
4147
+ * This operation performs the given math function with the specified arguments.
4009
4148
  *
4010
4149
  * @param operationData
4011
4150
  */
@@ -4031,7 +4170,7 @@ function resolveMathConstants(args) {
4031
4170
  }
4032
4171
 
4033
4172
  function isMathProperty(value) {
4034
- return typeof value === 'string' && value in Math && typeof Math[value] !== 'function';
4173
+ return isString(value) && value in Math && !isFunction(Math[value]);
4035
4174
  }
4036
4175
 
4037
4176
  /**
@@ -4299,8 +4438,7 @@ var setOperationData$1 = function setOperationData(operationData) {
4299
4438
 
4300
4439
  /**
4301
4440
  * This operation assigns the specified CSS style properties to the
4302
- * specified selected element. The selected element is assigned to
4303
- * the `selectedElement` property.
4441
+ * specified selected element.
4304
4442
  *
4305
4443
  * @param operationData
4306
4444
  * @returns
@@ -4562,7 +4700,7 @@ var JwPlayerTimelineProvider = /*#__PURE__*/function () {
4562
4700
 
4563
4701
  _this2.eventbus.broadcast(TimelineEventNames.DURATION, [_this2.getDuration()]);
4564
4702
 
4565
- resolve(_this2);
4703
+ resolve();
4566
4704
  });
4567
4705
 
4568
4706
  this._player.on(TimelineEventNames.TIME, this._loopHandler.bind(this, Math.floor));
@@ -4832,11 +4970,6 @@ var RequestAnimationFrameTimelineProvider = /*#__PURE__*/function () {
4832
4970
  return;
4833
4971
  }
4834
4972
 
4835
- if (this._firstFrame) {
4836
- this._firstFrame = false;
4837
- this.eventbus.broadcast(TimelineEventNames.FIRST_FRAME);
4838
- }
4839
-
4840
4973
  this._currentPosition++;
4841
4974
 
4842
4975
  if (this._currentPosition > this._currentPlaylistItem.duration) {
@@ -4844,6 +4977,8 @@ var RequestAnimationFrameTimelineProvider = /*#__PURE__*/function () {
4844
4977
  this._resetToStartPosition();
4845
4978
 
4846
4979
  this.eventbus.broadcast(TimelineEventNames.RESTART);
4980
+
4981
+ this._broadCastPosition();
4847
4982
  } else {
4848
4983
  this.stop();
4849
4984
  this.eventbus.broadcast(TimelineEventNames.COMPLETE);
@@ -4851,6 +4986,10 @@ var RequestAnimationFrameTimelineProvider = /*#__PURE__*/function () {
4851
4986
  }
4852
4987
  }
4853
4988
 
4989
+ this._broadCastPosition();
4990
+ };
4991
+
4992
+ _proto._broadCastPosition = function _broadCastPosition() {
4854
4993
  this.eventbus.broadcast(TimelineEventNames.TIME, [{
4855
4994
  position: this._currentPosition
4856
4995
  }]);
@@ -4870,6 +5009,16 @@ var RequestAnimationFrameTimelineProvider = /*#__PURE__*/function () {
4870
5009
  this.playState = 'running';
4871
5010
  (_this$_abortControlle = this._abortController) == null ? void 0 : _this$_abortControlle.abort();
4872
5011
  this._abortController = new AbortController();
5012
+
5013
+ if (this._firstFrame) {
5014
+ this._firstFrame = false;
5015
+ this.eventbus.broadcast(TimelineEventNames.FIRST_FRAME);
5016
+ }
5017
+
5018
+ if (this._currentPosition == 0) {
5019
+ this._broadCastPosition();
5020
+ }
5021
+
4873
5022
  animationInterval(this._tickInterval, this._abortController.signal, this._updateBound);
4874
5023
  };
4875
5024
 
@@ -4878,7 +5027,7 @@ var RequestAnimationFrameTimelineProvider = /*#__PURE__*/function () {
4878
5027
  };
4879
5028
 
4880
5029
  _proto._resize = function _resize() {
4881
- console.error('Not implemented yet');
5030
+ console.error('Not implemented yet, not even sure this needs to be implemented...');
4882
5031
  };
4883
5032
 
4884
5033
  _proto._container = function _container(callBack) {
@@ -4910,10 +5059,7 @@ var RequestAnimationFrameTimelineProvider = /*#__PURE__*/function () {
4910
5059
  throw new Error("timeline selector '" + this._currentPlaylistItem.selector + "' not found");
4911
5060
  }
4912
5061
 
4913
- var promise = new Promise(function (resolve) {
4914
- resolve();
4915
- });
4916
- return promise;
5062
+ return Promise.resolve();
4917
5063
  };
4918
5064
 
4919
5065
  _proto.destroy = function destroy() {
@@ -5329,7 +5475,7 @@ function math() {
5329
5475
 
5330
5476
  function createMathFunctionNames() {
5331
5477
  return Object.getOwnPropertyNames(Math).filter(function (x) {
5332
- return typeof Math[x] === 'function';
5478
+ return isFunction(Math[x]);
5333
5479
  }).map(function (functionName) {
5334
5480
  return {
5335
5481
  value: functionName