eligius 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/controllers/label-controller.d.ts +2 -2
- package/dist/controllers/lottie-controller.d.ts +2 -2
- package/dist/controllers/navigation-controller.d.ts +2 -2
- package/dist/controllers/progressbar-controller.d.ts +2 -2
- package/dist/controllers/routing-controller.d.ts +2 -2
- package/dist/controllers/subtitles-controller.d.ts +2 -2
- package/dist/diagnostics/types.d.ts +22 -2
- package/dist/eligius-engine.d.ts +4 -3
- package/dist/eligius.cjs.development.js +336 -236
- package/dist/eligius.cjs.development.js.map +1 -1
- package/dist/eligius.cjs.production.min.js +1 -1
- package/dist/eligius.cjs.production.min.js.map +1 -1
- package/dist/eligius.esm.js +335 -235
- package/dist/eligius.esm.js.map +1 -1
- package/dist/engine-factory.d.ts +5 -5
- package/dist/eventbus/eventbus.d.ts +5 -5
- package/dist/eventbus/types.d.ts +5 -5
- package/dist/language-manager.d.ts +4 -3
- package/package.json +2 -1
|
@@ -2,176 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var $ = require('jquery');
|
|
5
6
|
var tsIsPresent = require('ts-is-present');
|
|
6
7
|
var fs = require('fs');
|
|
7
8
|
var path = require('path');
|
|
8
9
|
var lottie = require('lottie-web');
|
|
9
|
-
var $ = require('jquery');
|
|
10
10
|
var hotkeys = require('hotkeys-js');
|
|
11
11
|
var uuid = require('uuid');
|
|
12
12
|
|
|
13
13
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
14
|
|
|
15
|
+
var $__default = /*#__PURE__*/_interopDefaultLegacy($);
|
|
15
16
|
var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
|
|
16
17
|
var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
|
|
17
18
|
var lottie__default = /*#__PURE__*/_interopDefaultLegacy(lottie);
|
|
18
|
-
var $__default = /*#__PURE__*/_interopDefaultLegacy($);
|
|
19
19
|
var hotkeys__default = /*#__PURE__*/_interopDefaultLegacy(hotkeys);
|
|
20
20
|
|
|
21
|
-
function prepareValueForSerialization(value) {
|
|
22
|
-
if (Array.isArray(value)) {
|
|
23
|
-
return value.map(prepareValueForSerialization);
|
|
24
|
-
} else if (typeof value === 'object') {
|
|
25
|
-
return Object.fromEntries(Object.entries(value).map(function (_ref) {
|
|
26
|
-
var name = _ref[0],
|
|
27
|
-
value = _ref[1];
|
|
28
|
-
return [name, prepareValueForSerialization(value)];
|
|
29
|
-
}));
|
|
30
|
-
} else if (typeof value === 'function') {
|
|
31
|
-
return value.toString();
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return value;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
var DevToolEventListener = /*#__PURE__*/function () {
|
|
38
|
-
function DevToolEventListener(agent) {
|
|
39
|
-
this.agent = void 0;
|
|
40
|
-
this.agent = agent;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
var _proto = DevToolEventListener.prototype;
|
|
44
|
-
|
|
45
|
-
_proto.handleEvent = function handleEvent(eventName, eventTopic, args) {
|
|
46
|
-
this.agent.postMessage('eligius-diagnostics-event', {
|
|
47
|
-
eventName: eventName,
|
|
48
|
-
eventTopic: eventTopic,
|
|
49
|
-
args: prepareValueForSerialization(args)
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
return DevToolEventListener;
|
|
54
|
-
}();
|
|
55
|
-
|
|
56
|
-
var Diagnostics = /*#__PURE__*/function () {
|
|
57
|
-
function Diagnostics() {}
|
|
58
|
-
|
|
59
|
-
Diagnostics.send = function send(_name, _data) {
|
|
60
|
-
console.log(_name, _data);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
return Diagnostics;
|
|
64
|
-
}();
|
|
65
|
-
Diagnostics.active = void 0;
|
|
66
|
-
|
|
67
|
-
var DEV_TOOLS_KEY = '__ELIGIUS_DEV_TOOLS__';
|
|
68
|
-
|
|
69
|
-
var copyFunction = typeof structuredClone !== 'undefined' ? structuredClone : function (original) {
|
|
70
|
-
return JSON.parse(JSON.stringify(original));
|
|
71
|
-
};
|
|
72
|
-
function deepCopy(original) {
|
|
73
|
-
if (tsIsPresent.isDefined(original)) {
|
|
74
|
-
return copyFunction(original);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return original;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function isPromise(obj) {
|
|
81
|
-
return typeof obj === 'object' && typeof obj.then === 'function';
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
var Action = /*#__PURE__*/function () {
|
|
85
|
-
function Action(name, startOperations, eventbus) {
|
|
86
|
-
this.name = void 0;
|
|
87
|
-
this.startOperations = void 0;
|
|
88
|
-
this.eventbus = void 0;
|
|
89
|
-
this.id = '';
|
|
90
|
-
this.name = name;
|
|
91
|
-
this.startOperations = startOperations;
|
|
92
|
-
this.eventbus = eventbus;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
var _proto = Action.prototype;
|
|
96
|
-
|
|
97
|
-
_proto.start = function start(initOperationData) {
|
|
98
|
-
var _this$name,
|
|
99
|
-
_this = this;
|
|
100
|
-
|
|
101
|
-
Diagnostics.active && Diagnostics.send('eligius-diagnostics-action', ((_this$name = this.name) != null ? _this$name : 'Action') + " begins executing start operations");
|
|
102
|
-
var context = {
|
|
103
|
-
currentIndex: -1,
|
|
104
|
-
eventbus: this.eventbus
|
|
105
|
-
};
|
|
106
|
-
var result = new Promise(function (resolve, reject) {
|
|
107
|
-
_this.executeOperation(_this.startOperations, 0, resolve, reject, initOperationData, context);
|
|
108
|
-
})["catch"](function (e) {
|
|
109
|
-
Diagnostics.active && Diagnostics.send('eligius-diagnostics-action-error', {
|
|
110
|
-
name: name,
|
|
111
|
-
error: e
|
|
112
|
-
});
|
|
113
|
-
console.error("Error in action start '" + _this.name + "'");
|
|
114
|
-
console.error(e);
|
|
115
|
-
throw e;
|
|
116
|
-
});
|
|
117
|
-
return !Diagnostics.active ? result : result.then(function (operationsResult) {
|
|
118
|
-
var _this$name2;
|
|
119
|
-
|
|
120
|
-
Diagnostics.send('eligius-diagnostics-action', ((_this$name2 = _this.name) != null ? _this$name2 : 'Action') + " finished executing start operations");
|
|
121
|
-
return operationsResult;
|
|
122
|
-
});
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
_proto.executeOperation = function executeOperation(operations, idx, resolve, reject, previousOperationData, context) {
|
|
126
|
-
var _this2 = this;
|
|
127
|
-
|
|
128
|
-
if (previousOperationData === void 0) {
|
|
129
|
-
previousOperationData = {};
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
if (context.newIndex !== undefined) {
|
|
133
|
-
idx = context.newIndex;
|
|
134
|
-
delete context.newIndex;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
context.currentIndex = idx;
|
|
138
|
-
|
|
139
|
-
if (context.skipNextOperation) {
|
|
140
|
-
if (idx < operations.length) {
|
|
141
|
-
this.executeOperation(operations, ++idx, resolve, reject, previousOperationData, context);
|
|
142
|
-
} else {
|
|
143
|
-
resolve(previousOperationData);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
if (idx < operations.length) {
|
|
148
|
-
var operationInfo = operations[idx];
|
|
149
|
-
var copy = operationInfo.operationData ? deepCopy(operationInfo.operationData) : {};
|
|
150
|
-
var mergedOperationData = Object.assign(previousOperationData, copy);
|
|
151
|
-
Diagnostics.active && Diagnostics.send('eligius-diagnostics-operation', {
|
|
152
|
-
systemName: operationInfo.systemName,
|
|
153
|
-
operationData: operationInfo.operationData,
|
|
154
|
-
context: context
|
|
155
|
-
});
|
|
156
|
-
var operationResult = operationInfo.instance.call(context, mergedOperationData);
|
|
157
|
-
|
|
158
|
-
if (isPromise(operationResult)) {
|
|
159
|
-
operationResult.then(function (resultOperationData) {
|
|
160
|
-
_this2.executeOperation(operations, ++idx, resolve, reject, resultOperationData, context);
|
|
161
|
-
})["catch"](function (error) {
|
|
162
|
-
reject(error);
|
|
163
|
-
});
|
|
164
|
-
} else {
|
|
165
|
-
this.executeOperation(operations, ++idx, resolve, reject, operationResult, context);
|
|
166
|
-
}
|
|
167
|
-
} else {
|
|
168
|
-
resolve(previousOperationData);
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
return Action;
|
|
173
|
-
}();
|
|
174
|
-
|
|
175
21
|
function _regeneratorRuntime() {
|
|
176
22
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
177
23
|
|
|
@@ -585,6 +431,179 @@ function _setPrototypeOf(o, p) {
|
|
|
585
431
|
return _setPrototypeOf(o, p);
|
|
586
432
|
}
|
|
587
433
|
|
|
434
|
+
function prepareValueForSerialization(value) {
|
|
435
|
+
if (Array.isArray(value)) {
|
|
436
|
+
return value.map(prepareValueForSerialization);
|
|
437
|
+
} else if (value instanceof $__default["default"]) {
|
|
438
|
+
return 'jQuery object';
|
|
439
|
+
} else if (typeof value === 'object') {
|
|
440
|
+
return Object.fromEntries(Object.entries(value).map(function (_ref) {
|
|
441
|
+
var propName = _ref[0],
|
|
442
|
+
propValue = _ref[1];
|
|
443
|
+
return [propName, prepareValueForSerialization(propValue)];
|
|
444
|
+
}));
|
|
445
|
+
} else if (typeof value === 'function') {
|
|
446
|
+
var funcString = value.toString();
|
|
447
|
+
var paranIndex = funcString.indexOf('{');
|
|
448
|
+
|
|
449
|
+
if (paranIndex > -1) {
|
|
450
|
+
return funcString.substring(0, funcString.indexOf('{') + 1);
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
return funcString;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
return value;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
var DevToolEventListener = /*#__PURE__*/function () {
|
|
460
|
+
function DevToolEventListener(agent) {
|
|
461
|
+
this.agent = void 0;
|
|
462
|
+
this.agent = agent;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
var _proto = DevToolEventListener.prototype;
|
|
466
|
+
|
|
467
|
+
_proto.handleEvent = function handleEvent(eventName, eventTopic, args) {
|
|
468
|
+
var message = {
|
|
469
|
+
eventName: eventName,
|
|
470
|
+
eventTopic: eventTopic,
|
|
471
|
+
args: prepareValueForSerialization(args)
|
|
472
|
+
};
|
|
473
|
+
|
|
474
|
+
try {
|
|
475
|
+
this.agent.postMessage('eligius-diagnostics-event', message);
|
|
476
|
+
} catch (e) {
|
|
477
|
+
console.error('postmessage failed');
|
|
478
|
+
console.error(e);
|
|
479
|
+
console.log('message', message);
|
|
480
|
+
}
|
|
481
|
+
};
|
|
482
|
+
|
|
483
|
+
return DevToolEventListener;
|
|
484
|
+
}();
|
|
485
|
+
|
|
486
|
+
var Diagnostics = /*#__PURE__*/function () {
|
|
487
|
+
function Diagnostics() {}
|
|
488
|
+
|
|
489
|
+
Diagnostics.send = function send(_name, _data) {
|
|
490
|
+
console.log(_name, _data);
|
|
491
|
+
};
|
|
492
|
+
|
|
493
|
+
return Diagnostics;
|
|
494
|
+
}();
|
|
495
|
+
Diagnostics.active = void 0;
|
|
496
|
+
|
|
497
|
+
var DEV_TOOLS_KEY = '__ELIGIUS_DEV_TOOLS__';
|
|
498
|
+
|
|
499
|
+
var copyFunction = typeof structuredClone !== 'undefined' ? structuredClone : function (original) {
|
|
500
|
+
return JSON.parse(JSON.stringify(original));
|
|
501
|
+
};
|
|
502
|
+
function deepCopy(original) {
|
|
503
|
+
if (tsIsPresent.isDefined(original)) {
|
|
504
|
+
return copyFunction(original);
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
return original;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
function isPromise(obj) {
|
|
511
|
+
return typeof obj === 'object' && typeof obj.then === 'function';
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
var Action = /*#__PURE__*/function () {
|
|
515
|
+
function Action(name, startOperations, eventbus) {
|
|
516
|
+
this.name = void 0;
|
|
517
|
+
this.startOperations = void 0;
|
|
518
|
+
this.eventbus = void 0;
|
|
519
|
+
this.id = '';
|
|
520
|
+
this.name = name;
|
|
521
|
+
this.startOperations = startOperations;
|
|
522
|
+
this.eventbus = eventbus;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
var _proto = Action.prototype;
|
|
526
|
+
|
|
527
|
+
_proto.start = function start(initOperationData) {
|
|
528
|
+
var _this$name,
|
|
529
|
+
_this = this;
|
|
530
|
+
|
|
531
|
+
Diagnostics.active && Diagnostics.send('eligius-diagnostics-action', ((_this$name = this.name) != null ? _this$name : 'Action') + " begins executing start operations");
|
|
532
|
+
var context = {
|
|
533
|
+
currentIndex: -1,
|
|
534
|
+
eventbus: this.eventbus
|
|
535
|
+
};
|
|
536
|
+
var result = new Promise(function (resolve, reject) {
|
|
537
|
+
_this.executeOperation(_this.startOperations, 0, resolve, reject, initOperationData, context);
|
|
538
|
+
})["catch"](function (e) {
|
|
539
|
+
Diagnostics.active && Diagnostics.send('eligius-diagnostics-action-error', {
|
|
540
|
+
name: name,
|
|
541
|
+
error: e
|
|
542
|
+
});
|
|
543
|
+
console.error("Error in action start '" + _this.name + "'");
|
|
544
|
+
console.error(e);
|
|
545
|
+
throw e;
|
|
546
|
+
});
|
|
547
|
+
return !Diagnostics.active ? result : result.then(function (operationsResult) {
|
|
548
|
+
var _this$name2;
|
|
549
|
+
|
|
550
|
+
Diagnostics.send('eligius-diagnostics-action', ((_this$name2 = _this.name) != null ? _this$name2 : 'Action') + " finished executing start operations");
|
|
551
|
+
return operationsResult;
|
|
552
|
+
});
|
|
553
|
+
};
|
|
554
|
+
|
|
555
|
+
_proto.executeOperation = function executeOperation(operations, idx, resolve, reject, previousOperationData, context) {
|
|
556
|
+
var _this2 = this;
|
|
557
|
+
|
|
558
|
+
if (previousOperationData === void 0) {
|
|
559
|
+
previousOperationData = {};
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
if (context.newIndex !== undefined) {
|
|
563
|
+
idx = context.newIndex;
|
|
564
|
+
delete context.newIndex;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
context.currentIndex = idx;
|
|
568
|
+
|
|
569
|
+
if (context.skipNextOperation) {
|
|
570
|
+
if (idx < operations.length) {
|
|
571
|
+
this.executeOperation(operations, ++idx, resolve, reject, previousOperationData, context);
|
|
572
|
+
} else {
|
|
573
|
+
resolve(previousOperationData);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
if (idx < operations.length) {
|
|
578
|
+
var operationInfo = operations[idx];
|
|
579
|
+
var copy = operationInfo.operationData ? deepCopy(operationInfo.operationData) : {};
|
|
580
|
+
var mergedOperationData = Object.assign(previousOperationData, copy);
|
|
581
|
+
Diagnostics.active && Diagnostics.send('eligius-diagnostics-operation', {
|
|
582
|
+
systemName: operationInfo.systemName,
|
|
583
|
+
operationData: mergedOperationData,
|
|
584
|
+
context: _extends({}, context, {
|
|
585
|
+
eventbus: undefined
|
|
586
|
+
})
|
|
587
|
+
});
|
|
588
|
+
var operationResult = operationInfo.instance.call(context, mergedOperationData);
|
|
589
|
+
|
|
590
|
+
if (isPromise(operationResult)) {
|
|
591
|
+
operationResult.then(function (promisedOperationResult) {
|
|
592
|
+
_this2.executeOperation(operations, ++idx, resolve, reject, promisedOperationResult, context);
|
|
593
|
+
})["catch"](function (error) {
|
|
594
|
+
reject(error);
|
|
595
|
+
});
|
|
596
|
+
} else {
|
|
597
|
+
this.executeOperation(operations, ++idx, resolve, reject, operationResult, context);
|
|
598
|
+
}
|
|
599
|
+
} else {
|
|
600
|
+
resolve(previousOperationData);
|
|
601
|
+
}
|
|
602
|
+
};
|
|
603
|
+
|
|
604
|
+
return Action;
|
|
605
|
+
}();
|
|
606
|
+
|
|
588
607
|
var EndableAction = /*#__PURE__*/function (_Action) {
|
|
589
608
|
_inheritsLoose(EndableAction, _Action);
|
|
590
609
|
|
|
@@ -2041,38 +2060,36 @@ var ctrls = {
|
|
|
2041
2060
|
*/
|
|
2042
2061
|
|
|
2043
2062
|
var EligiusEngine = /*#__PURE__*/function () {
|
|
2044
|
-
function EligiusEngine(configuration, eventbus, timelineProviders,
|
|
2063
|
+
function EligiusEngine(configuration, eventbus, timelineProviders, languageManager) {
|
|
2045
2064
|
this.configuration = void 0;
|
|
2046
2065
|
this.eventbus = void 0;
|
|
2047
2066
|
this.timelineProviders = void 0;
|
|
2048
|
-
this.
|
|
2067
|
+
this.languageManager = void 0;
|
|
2049
2068
|
this._timeLineActionsLookup = {};
|
|
2050
|
-
this.
|
|
2069
|
+
this._eventbusRemovers = [];
|
|
2051
2070
|
this._currentTimelineUri = '';
|
|
2052
2071
|
this._activeTimelineProvider = undefined;
|
|
2053
2072
|
this._lastPosition = -1;
|
|
2054
2073
|
this.configuration = configuration;
|
|
2055
2074
|
this.eventbus = eventbus;
|
|
2056
2075
|
this.timelineProviders = timelineProviders;
|
|
2057
|
-
this.
|
|
2076
|
+
this.languageManager = languageManager;
|
|
2058
2077
|
}
|
|
2059
2078
|
|
|
2060
2079
|
var _proto = EligiusEngine.prototype;
|
|
2061
2080
|
|
|
2062
2081
|
_proto.init = function init() {
|
|
2082
|
+
var _timelines$0$uri;
|
|
2083
|
+
|
|
2063
2084
|
this._createLayoutTemplate();
|
|
2064
2085
|
|
|
2065
2086
|
this._addInitialisationListeners();
|
|
2066
2087
|
|
|
2067
2088
|
var timelines = this.configuration.timelines;
|
|
2068
|
-
this._currentTimelineUri =
|
|
2089
|
+
this._currentTimelineUri = (_timelines$0$uri = timelines == null ? void 0 : timelines[0].uri) != null ? _timelines$0$uri : '';
|
|
2069
2090
|
|
|
2070
2091
|
this._createTimelineLookup();
|
|
2071
2092
|
|
|
2072
|
-
this._eventbusListeners.push(this.eventbus.on(TimelineEventNames.TIME, this._onTimeHandler.bind(this, Math.floor)));
|
|
2073
|
-
|
|
2074
|
-
this._eventbusListeners.push(this.eventbus.on(TimelineEventNames.SEEK, this._onSeekHandler.bind(this, Math.floor)));
|
|
2075
|
-
|
|
2076
2093
|
return this._initializeTimelineProvider();
|
|
2077
2094
|
};
|
|
2078
2095
|
|
|
@@ -2190,9 +2207,10 @@ var EligiusEngine = /*#__PURE__*/function () {
|
|
|
2190
2207
|
return this._cleanUp();
|
|
2191
2208
|
|
|
2192
2209
|
case 2:
|
|
2210
|
+
this.languageManager.destroy();
|
|
2193
2211
|
this._activeTimelineProvider = undefined;
|
|
2194
2212
|
|
|
2195
|
-
this.
|
|
2213
|
+
this._eventbusRemovers.forEach(function (remover) {
|
|
2196
2214
|
return remover();
|
|
2197
2215
|
});
|
|
2198
2216
|
|
|
@@ -2206,7 +2224,7 @@ var EligiusEngine = /*#__PURE__*/function () {
|
|
|
2206
2224
|
container = $__default["default"](containerSelector);
|
|
2207
2225
|
container.empty();
|
|
2208
2226
|
|
|
2209
|
-
case
|
|
2227
|
+
case 9:
|
|
2210
2228
|
case "end":
|
|
2211
2229
|
return _context3.stop();
|
|
2212
2230
|
}
|
|
@@ -2221,20 +2239,28 @@ var EligiusEngine = /*#__PURE__*/function () {
|
|
|
2221
2239
|
return destroy;
|
|
2222
2240
|
}();
|
|
2223
2241
|
|
|
2242
|
+
_proto._addEventListener = function _addEventListener(eventName, eventHandler, eventTopic) {
|
|
2243
|
+
this._eventbusRemovers.push(this.eventbus.on(eventName, eventHandler, eventTopic));
|
|
2244
|
+
};
|
|
2245
|
+
|
|
2224
2246
|
_proto._addInitialisationListeners = function _addInitialisationListeners() {
|
|
2225
|
-
this.
|
|
2247
|
+
this._addEventListener(TimelineEventNames.REQUEST_ENGINE_ROOT, this._handleRequestEngineRoot.bind(this, this.configuration.containerSelector));
|
|
2248
|
+
|
|
2249
|
+
this._addEventListener(TimelineEventNames.REQUEST_TIMELINE_URI, this._handleRequestTimelineUri.bind(this));
|
|
2226
2250
|
|
|
2227
|
-
this.
|
|
2251
|
+
this._addEventListener(TimelineEventNames.REQUEST_CURRENT_TIMELINE_POSITION, this._handleRequestTimelinePosition.bind(this, Math.floor));
|
|
2228
2252
|
|
|
2229
|
-
this.
|
|
2253
|
+
this._addEventListener(TimelineEventNames.REQUEST_TIMELINE_CLEANUP, this._handleTimelineComplete.bind(this));
|
|
2230
2254
|
|
|
2231
|
-
this.
|
|
2255
|
+
this._addEventListener(TimelineEventNames.EXECUTE_TIMELINEACTION, this._handleExecuteTimelineAction.bind(this));
|
|
2232
2256
|
|
|
2233
|
-
this.
|
|
2257
|
+
this._addEventListener(TimelineEventNames.RESIZE_TIMELINEACTION, this._resizeTimelineAction.bind(this));
|
|
2234
2258
|
|
|
2235
|
-
this.
|
|
2259
|
+
this._addEventListener(TimelineEventNames.REQUEST_CURRENT_TIMELINE, this._requestCurrentTimeline.bind(this));
|
|
2236
2260
|
|
|
2237
|
-
this.
|
|
2261
|
+
this._addEventListener(TimelineEventNames.TIME, this._onTimeHandler.bind(this, Math.floor));
|
|
2262
|
+
|
|
2263
|
+
this._addEventListener(TimelineEventNames.SEEK, this._onSeekHandler.bind(this, Math.floor));
|
|
2238
2264
|
};
|
|
2239
2265
|
|
|
2240
2266
|
_proto._createTimelineLookup = function _createTimelineLookup() {
|
|
@@ -2695,6 +2721,9 @@ var Eventbus = /*#__PURE__*/function () {
|
|
|
2695
2721
|
};
|
|
2696
2722
|
|
|
2697
2723
|
this.on(eventName, eventHandlerDecorator, eventTopic);
|
|
2724
|
+
return function () {
|
|
2725
|
+
_this2.off(eventName, eventHandlerDecorator, eventTopic);
|
|
2726
|
+
};
|
|
2698
2727
|
};
|
|
2699
2728
|
|
|
2700
2729
|
_proto.off = function off(eventName, eventHandler, eventTopic) {
|
|
@@ -2718,13 +2747,29 @@ var Eventbus = /*#__PURE__*/function () {
|
|
|
2718
2747
|
};
|
|
2719
2748
|
|
|
2720
2749
|
_proto.registerEventlistener = function registerEventlistener(eventbusListener) {
|
|
2750
|
+
var _this3 = this;
|
|
2751
|
+
|
|
2721
2752
|
this.eventListeners.push(eventbusListener);
|
|
2753
|
+
return function () {
|
|
2754
|
+
var index = _this3.eventListeners.indexOf(eventbusListener);
|
|
2755
|
+
|
|
2756
|
+
if (index > -1) {
|
|
2757
|
+
_this3.eventListeners.splice(index, 1);
|
|
2758
|
+
}
|
|
2759
|
+
};
|
|
2722
2760
|
};
|
|
2723
2761
|
|
|
2724
2762
|
_proto.registerInterceptor = function registerInterceptor(eventName, interceptor, eventTopic) {
|
|
2725
2763
|
var interceptors = this._getEventInterceptors(eventName, eventTopic);
|
|
2726
2764
|
|
|
2727
2765
|
interceptors.push(interceptor);
|
|
2766
|
+
return function () {
|
|
2767
|
+
var index = interceptors.indexOf(interceptor);
|
|
2768
|
+
|
|
2769
|
+
if (index > -1) {
|
|
2770
|
+
interceptors.splice(index, 1);
|
|
2771
|
+
}
|
|
2772
|
+
};
|
|
2728
2773
|
};
|
|
2729
2774
|
|
|
2730
2775
|
_proto._callHandlers = function _callHandlers(eventName, eventTopic, args) {
|
|
@@ -2788,40 +2833,38 @@ var LanguageManager = /*#__PURE__*/function () {
|
|
|
2788
2833
|
function LanguageManager(_currentLanguage, labels, _eventbus) {
|
|
2789
2834
|
this._currentLanguage = void 0;
|
|
2790
2835
|
this._eventbus = void 0;
|
|
2791
|
-
this._labelLookup =
|
|
2792
|
-
this.
|
|
2836
|
+
this._labelLookup = void 0;
|
|
2837
|
+
this._eventbusRemovers = [];
|
|
2793
2838
|
this._currentLanguage = _currentLanguage;
|
|
2794
2839
|
this._eventbus = _eventbus;
|
|
2795
2840
|
|
|
2796
|
-
if (!_currentLanguage
|
|
2797
|
-
throw new Error('language ctor arg cannot
|
|
2798
|
-
}
|
|
2799
|
-
|
|
2800
|
-
if (!labels) {
|
|
2801
|
-
throw new Error('labels ctor arg cannot be null');
|
|
2802
|
-
}
|
|
2803
|
-
|
|
2804
|
-
if (!_eventbus) {
|
|
2805
|
-
throw new Error('eventbus ctor arg cannot be null');
|
|
2841
|
+
if (!_currentLanguage) {
|
|
2842
|
+
throw new Error('language ctor arg cannot have zero length');
|
|
2806
2843
|
}
|
|
2807
2844
|
|
|
2808
2845
|
this._setRootElementLang(_currentLanguage);
|
|
2809
2846
|
|
|
2810
|
-
this._createLabelLookup(labels);
|
|
2847
|
+
this._labelLookup = this._createLabelLookup(labels);
|
|
2811
2848
|
|
|
2812
2849
|
this._addEventbusListeners(_eventbus);
|
|
2813
2850
|
}
|
|
2814
2851
|
|
|
2815
2852
|
var _proto = LanguageManager.prototype;
|
|
2816
2853
|
|
|
2854
|
+
_proto.destroy = function destroy() {
|
|
2855
|
+
this._eventbusRemovers.forEach(function (x) {
|
|
2856
|
+
return x();
|
|
2857
|
+
});
|
|
2858
|
+
};
|
|
2859
|
+
|
|
2817
2860
|
_proto._addEventbusListeners = function _addEventbusListeners(eventbus) {
|
|
2818
|
-
this.
|
|
2861
|
+
this._eventbusRemovers.push(eventbus.on(TimelineEventNames.REQUEST_LABEL_COLLECTION, this._handleRequestLabelCollection.bind(this)));
|
|
2819
2862
|
|
|
2820
|
-
this.
|
|
2863
|
+
this._eventbusRemovers.push(eventbus.on(TimelineEventNames.REQUEST_LABEL_COLLECTIONS, this._handleRequestLabelCollections.bind(this)));
|
|
2821
2864
|
|
|
2822
|
-
this.
|
|
2865
|
+
this._eventbusRemovers.push(eventbus.on(TimelineEventNames.REQUEST_CURRENT_LANGUAGE, this._handleRequestCurrentLanguage.bind(this)));
|
|
2823
2866
|
|
|
2824
|
-
this.
|
|
2867
|
+
this._eventbusRemovers.push(eventbus.on(TimelineEventNames.LANGUAGE_CHANGE, this._handleLanguageChange.bind(this)));
|
|
2825
2868
|
};
|
|
2826
2869
|
|
|
2827
2870
|
_proto._handleRequestCurrentLanguage = function _handleRequestCurrentLanguage(resultCallback) {
|
|
@@ -2872,11 +2915,10 @@ var LanguageManager = /*#__PURE__*/function () {
|
|
|
2872
2915
|
};
|
|
2873
2916
|
|
|
2874
2917
|
_proto._createLabelLookup = function _createLabelLookup(labels) {
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
});
|
|
2918
|
+
return labels.reduce(function (acc, label) {
|
|
2919
|
+
acc[label.id] = label.labels;
|
|
2920
|
+
return acc;
|
|
2921
|
+
}, {});
|
|
2880
2922
|
};
|
|
2881
2923
|
|
|
2882
2924
|
return LanguageManager;
|
|
@@ -2884,80 +2926,136 @@ var LanguageManager = /*#__PURE__*/function () {
|
|
|
2884
2926
|
|
|
2885
2927
|
var EngineFactory = /*#__PURE__*/function () {
|
|
2886
2928
|
function EngineFactory(importer, windowRef, options) {
|
|
2887
|
-
var _options$devtools;
|
|
2929
|
+
var _options$eventbus, _options$devtools;
|
|
2888
2930
|
|
|
2889
|
-
this.
|
|
2890
|
-
this.
|
|
2891
|
-
this.
|
|
2892
|
-
this.
|
|
2893
|
-
this.
|
|
2894
|
-
this.
|
|
2895
|
-
this.eventbus =
|
|
2931
|
+
this._actionsLookup = {};
|
|
2932
|
+
this._eventbus = void 0;
|
|
2933
|
+
this._eventRemovers = [];
|
|
2934
|
+
this._importer = void 0;
|
|
2935
|
+
this._resizeTimeout = -1;
|
|
2936
|
+
this._importer = importer;
|
|
2937
|
+
this._eventbus = (_options$eventbus = options == null ? void 0 : options.eventbus) != null ? _options$eventbus : new Eventbus();
|
|
2896
2938
|
Diagnostics.active = (_options$devtools = options == null ? void 0 : options.devtools) != null ? _options$devtools : false;
|
|
2897
2939
|
|
|
2898
2940
|
if (Diagnostics.active) {
|
|
2899
|
-
this._initializeDevtools(this.
|
|
2941
|
+
this._initializeDevtools(this._eventbus);
|
|
2900
2942
|
}
|
|
2901
2943
|
|
|
2902
|
-
this.
|
|
2903
|
-
|
|
2904
|
-
this.
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2944
|
+
this._eventRemovers.push(this._eventbus.on(TimelineEventNames.REQUEST_INSTANCE, this._requestInstanceHandler.bind(this)));
|
|
2945
|
+
|
|
2946
|
+
this._eventRemovers.push(this._eventbus.on(TimelineEventNames.REQUEST_ACTION, this._requestActionHandler.bind(this)));
|
|
2947
|
+
|
|
2948
|
+
this._eventRemovers.push(this._eventbus.on(TimelineEventNames.REQUEST_FUNCTION, this._requestFunctionHandler.bind(this)));
|
|
2949
|
+
|
|
2950
|
+
var handleSpaceBound = this._handleSpacePress.bind(this);
|
|
2951
|
+
|
|
2952
|
+
hotkeys__default["default"]('space', handleSpaceBound);
|
|
2953
|
+
|
|
2954
|
+
this._eventRemovers.push(function () {
|
|
2955
|
+
return hotkeys__default["default"].unbind('space', handleSpaceBound);
|
|
2956
|
+
});
|
|
2957
|
+
|
|
2958
|
+
var resizeBound = this._resizeHandler.bind(this);
|
|
2959
|
+
|
|
2960
|
+
var jqWin = $__default["default"](windowRef);
|
|
2961
|
+
jqWin.on('resize', resizeBound);
|
|
2962
|
+
|
|
2963
|
+
this._eventRemovers.push(function () {
|
|
2964
|
+
return jqWin.off('resize', resizeBound);
|
|
2965
|
+
});
|
|
2908
2966
|
}
|
|
2909
2967
|
|
|
2910
2968
|
var _proto = EngineFactory.prototype;
|
|
2911
2969
|
|
|
2912
2970
|
_proto._handleSpacePress = function _handleSpacePress(keyboardEvent, _hotkeysEvent) {
|
|
2913
2971
|
keyboardEvent.preventDefault();
|
|
2914
|
-
|
|
2972
|
+
|
|
2973
|
+
this._eventbus.broadcast(TimelineEventNames.PLAY_TOGGLE_REQUEST);
|
|
2974
|
+
|
|
2915
2975
|
return false;
|
|
2916
2976
|
};
|
|
2917
2977
|
|
|
2918
2978
|
_proto._initializeDevtools = function _initializeDevtools(eventbus) {
|
|
2979
|
+
var _this = this;
|
|
2980
|
+
|
|
2919
2981
|
var diagnosticInfo = window[DEV_TOOLS_KEY];
|
|
2920
2982
|
|
|
2921
2983
|
if (diagnosticInfo) {
|
|
2922
2984
|
var agent = diagnosticInfo.agent;
|
|
2923
|
-
var eventbusListener = new DevToolEventListener(agent);
|
|
2924
|
-
eventbus.registerEventlistener(eventbusListener);
|
|
2925
2985
|
|
|
2926
|
-
|
|
2927
|
-
|
|
2986
|
+
this._eventRemovers.push(eventbus.registerEventlistener(new DevToolEventListener(agent)));
|
|
2987
|
+
|
|
2988
|
+
this._eventRemovers.push(agent.subscribe(function (message) {
|
|
2989
|
+
if (message.type === 'playcontrol') {
|
|
2990
|
+
switch (message.data.kind) {
|
|
2991
|
+
case 'play':
|
|
2992
|
+
_this._eventbus.broadcast(TimelineEventNames.PLAY_REQUEST);
|
|
2993
|
+
|
|
2994
|
+
break;
|
|
2995
|
+
|
|
2996
|
+
case 'stop':
|
|
2997
|
+
_this._eventbus.broadcast(TimelineEventNames.STOP_REQUEST);
|
|
2998
|
+
|
|
2999
|
+
break;
|
|
3000
|
+
|
|
3001
|
+
case 'pause':
|
|
3002
|
+
_this._eventbus.broadcast(TimelineEventNames.PAUSE_REQUEST);
|
|
3003
|
+
|
|
3004
|
+
break;
|
|
3005
|
+
|
|
3006
|
+
case 'seek':
|
|
3007
|
+
_this._eventbus.broadcast(TimelineEventNames.SEEK_REQUEST, [message.data.args]);
|
|
3008
|
+
|
|
3009
|
+
break;
|
|
3010
|
+
}
|
|
3011
|
+
}
|
|
3012
|
+
}));
|
|
3013
|
+
|
|
3014
|
+
Diagnostics.send = function (name, messageData) {
|
|
3015
|
+
var message = prepareValueForSerialization(messageData);
|
|
3016
|
+
|
|
3017
|
+
try {
|
|
3018
|
+
agent.postMessage(name, message);
|
|
3019
|
+
} catch (e) {
|
|
3020
|
+
console.error('postmessage failed');
|
|
3021
|
+
console.error(e);
|
|
3022
|
+
console.log('message', message);
|
|
3023
|
+
}
|
|
2928
3024
|
};
|
|
2929
3025
|
|
|
2930
3026
|
Diagnostics.send('eligius-diagnostics-factory', 'Diagnostics initialized');
|
|
2931
3027
|
} else {
|
|
2932
|
-
console.warn(DEV_TOOLS_KEY + " property not found on window, please install the extension.");
|
|
3028
|
+
console.warn(DEV_TOOLS_KEY + " property not found on window, please install the Eligius Devtools extension.");
|
|
2933
3029
|
}
|
|
2934
3030
|
};
|
|
2935
3031
|
|
|
2936
3032
|
_proto.destroy = function destroy() {
|
|
2937
|
-
this.
|
|
2938
|
-
|
|
3033
|
+
this._eventRemovers.forEach(function (x) {
|
|
3034
|
+
return x();
|
|
3035
|
+
});
|
|
2939
3036
|
};
|
|
2940
3037
|
|
|
2941
3038
|
_proto._resizeHandler = function _resizeHandler() {
|
|
2942
|
-
var
|
|
3039
|
+
var _this2 = this;
|
|
2943
3040
|
|
|
2944
|
-
if (this.
|
|
2945
|
-
clearTimeout(this.
|
|
3041
|
+
if (this._resizeTimeout) {
|
|
3042
|
+
clearTimeout(this._resizeTimeout);
|
|
3043
|
+
this._resizeTimeout = -1;
|
|
2946
3044
|
}
|
|
2947
3045
|
|
|
2948
|
-
this.
|
|
2949
|
-
|
|
3046
|
+
this._resizeTimeout = setTimeout(function () {
|
|
3047
|
+
_this2._eventbus.broadcast(TimelineEventNames.RESIZE);
|
|
2950
3048
|
}, 200);
|
|
2951
3049
|
};
|
|
2952
3050
|
|
|
2953
3051
|
_proto._importSystemEntryWithEventbusDependency = function _importSystemEntryWithEventbusDependency(systemName) {
|
|
2954
3052
|
var ctor = this._importSystemEntry(systemName);
|
|
2955
3053
|
|
|
2956
|
-
return new ctor(this.
|
|
3054
|
+
return new ctor(this._eventbus);
|
|
2957
3055
|
};
|
|
2958
3056
|
|
|
2959
3057
|
_proto._importSystemEntry = function _importSystemEntry(systemName) {
|
|
2960
|
-
return this.
|
|
3058
|
+
return this._importer["import"](systemName)[systemName];
|
|
2961
3059
|
};
|
|
2962
3060
|
|
|
2963
3061
|
_proto._requestInstanceHandler = function _requestInstanceHandler(systemName, resultCallback) {
|
|
@@ -2969,7 +3067,7 @@ var EngineFactory = /*#__PURE__*/function () {
|
|
|
2969
3067
|
};
|
|
2970
3068
|
|
|
2971
3069
|
_proto._requestActionHandler = function _requestActionHandler(systemName, resultCallback) {
|
|
2972
|
-
var action = this.
|
|
3070
|
+
var action = this._actionsLookup[systemName];
|
|
2973
3071
|
|
|
2974
3072
|
if (action) {
|
|
2975
3073
|
resultCallback(action);
|
|
@@ -2990,29 +3088,31 @@ var EngineFactory = /*#__PURE__*/function () {
|
|
|
2990
3088
|
|
|
2991
3089
|
if ((_configuration$eventA = configuration.eventActions) != null && _configuration$eventA.length) {
|
|
2992
3090
|
actionRegistryListener = new ActionRegistryEventbusListener();
|
|
2993
|
-
|
|
3091
|
+
|
|
3092
|
+
this._eventRemovers.push(this._eventbus.registerEventlistener(actionRegistryListener));
|
|
2994
3093
|
}
|
|
2995
3094
|
|
|
2996
|
-
this.
|
|
2997
|
-
|
|
3095
|
+
this._eventRemovers.push(this._eventbus.registerInterceptor(TimelineEventNames.REQUEST_TIMELINE_URI, new RequestVideoUriInterceptor(this._eventbus)));
|
|
3096
|
+
|
|
3097
|
+
resolver = resolver || new ConfigurationResolver(this._importer, this._eventbus);
|
|
2998
3098
|
|
|
2999
3099
|
var _resolver$process = resolver.process(configuration, actionRegistryListener),
|
|
3000
3100
|
actionLookup = _resolver$process[0],
|
|
3001
3101
|
resolvedConfiguration = _resolver$process[1];
|
|
3002
3102
|
|
|
3003
|
-
this.
|
|
3103
|
+
this._actionsLookup = actionLookup;
|
|
3004
3104
|
|
|
3005
|
-
var timelineProviders = this._createTimelineProviders(resolvedConfiguration, this.
|
|
3105
|
+
var timelineProviders = this._createTimelineProviders(resolvedConfiguration, this._eventbus);
|
|
3006
3106
|
|
|
3007
3107
|
var language = configuration.language,
|
|
3008
3108
|
labels = configuration.labels;
|
|
3009
|
-
var languageManager = new LanguageManager(language, labels, this.
|
|
3010
|
-
var engineInstance = new EngineClass(resolvedConfiguration, this.
|
|
3109
|
+
var languageManager = new LanguageManager(language, labels, this._eventbus);
|
|
3110
|
+
var engineInstance = new EngineClass(resolvedConfiguration, this._eventbus, timelineProviders, languageManager);
|
|
3011
3111
|
return engineInstance;
|
|
3012
3112
|
};
|
|
3013
3113
|
|
|
3014
3114
|
_proto._createTimelineProviders = function _createTimelineProviders(configuration, eventbus) {
|
|
3015
|
-
var
|
|
3115
|
+
var _this3 = this;
|
|
3016
3116
|
|
|
3017
3117
|
var timelineProviderSettings = configuration.timelineProviderSettings;
|
|
3018
3118
|
var result = Object.entries(timelineProviderSettings).reduce(function (acc, _ref) {
|
|
@@ -3023,7 +3123,7 @@ var EngineFactory = /*#__PURE__*/function () {
|
|
|
3023
3123
|
return acc;
|
|
3024
3124
|
}
|
|
3025
3125
|
|
|
3026
|
-
var timelineProviderClass =
|
|
3126
|
+
var timelineProviderClass = _this3._importSystemEntry(settings.systemName);
|
|
3027
3127
|
|
|
3028
3128
|
acc[timelineType] = {
|
|
3029
3129
|
id: settings.id,
|