eligius 1.0.7 → 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/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 +328 -247
- 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 +327 -246
- 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
package/dist/eligius.esm.js
CHANGED
|
@@ -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 (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
|
|
|
@@ -2040,38 +2048,36 @@ var ctrls = {
|
|
|
2040
2048
|
*/
|
|
2041
2049
|
|
|
2042
2050
|
var EligiusEngine = /*#__PURE__*/function () {
|
|
2043
|
-
function EligiusEngine(configuration, eventbus, timelineProviders,
|
|
2051
|
+
function EligiusEngine(configuration, eventbus, timelineProviders, languageManager) {
|
|
2044
2052
|
this.configuration = void 0;
|
|
2045
2053
|
this.eventbus = void 0;
|
|
2046
2054
|
this.timelineProviders = void 0;
|
|
2047
|
-
this.
|
|
2055
|
+
this.languageManager = void 0;
|
|
2048
2056
|
this._timeLineActionsLookup = {};
|
|
2049
|
-
this.
|
|
2057
|
+
this._eventbusRemovers = [];
|
|
2050
2058
|
this._currentTimelineUri = '';
|
|
2051
2059
|
this._activeTimelineProvider = undefined;
|
|
2052
2060
|
this._lastPosition = -1;
|
|
2053
2061
|
this.configuration = configuration;
|
|
2054
2062
|
this.eventbus = eventbus;
|
|
2055
2063
|
this.timelineProviders = timelineProviders;
|
|
2056
|
-
this.
|
|
2064
|
+
this.languageManager = languageManager;
|
|
2057
2065
|
}
|
|
2058
2066
|
|
|
2059
2067
|
var _proto = EligiusEngine.prototype;
|
|
2060
2068
|
|
|
2061
2069
|
_proto.init = function init() {
|
|
2070
|
+
var _timelines$0$uri;
|
|
2071
|
+
|
|
2062
2072
|
this._createLayoutTemplate();
|
|
2063
2073
|
|
|
2064
2074
|
this._addInitialisationListeners();
|
|
2065
2075
|
|
|
2066
2076
|
var timelines = this.configuration.timelines;
|
|
2067
|
-
this._currentTimelineUri =
|
|
2077
|
+
this._currentTimelineUri = (_timelines$0$uri = timelines == null ? void 0 : timelines[0].uri) != null ? _timelines$0$uri : '';
|
|
2068
2078
|
|
|
2069
2079
|
this._createTimelineLookup();
|
|
2070
2080
|
|
|
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
2081
|
return this._initializeTimelineProvider();
|
|
2076
2082
|
};
|
|
2077
2083
|
|
|
@@ -2189,9 +2195,10 @@ var EligiusEngine = /*#__PURE__*/function () {
|
|
|
2189
2195
|
return this._cleanUp();
|
|
2190
2196
|
|
|
2191
2197
|
case 2:
|
|
2198
|
+
this.languageManager.destroy();
|
|
2192
2199
|
this._activeTimelineProvider = undefined;
|
|
2193
2200
|
|
|
2194
|
-
this.
|
|
2201
|
+
this._eventbusRemovers.forEach(function (remover) {
|
|
2195
2202
|
return remover();
|
|
2196
2203
|
});
|
|
2197
2204
|
|
|
@@ -2205,7 +2212,7 @@ var EligiusEngine = /*#__PURE__*/function () {
|
|
|
2205
2212
|
container = $(containerSelector);
|
|
2206
2213
|
container.empty();
|
|
2207
2214
|
|
|
2208
|
-
case
|
|
2215
|
+
case 9:
|
|
2209
2216
|
case "end":
|
|
2210
2217
|
return _context3.stop();
|
|
2211
2218
|
}
|
|
@@ -2220,20 +2227,28 @@ var EligiusEngine = /*#__PURE__*/function () {
|
|
|
2220
2227
|
return destroy;
|
|
2221
2228
|
}();
|
|
2222
2229
|
|
|
2230
|
+
_proto._addEventListener = function _addEventListener(eventName, eventHandler, eventTopic) {
|
|
2231
|
+
this._eventbusRemovers.push(this.eventbus.on(eventName, eventHandler, eventTopic));
|
|
2232
|
+
};
|
|
2233
|
+
|
|
2223
2234
|
_proto._addInitialisationListeners = function _addInitialisationListeners() {
|
|
2224
|
-
this.
|
|
2235
|
+
this._addEventListener(TimelineEventNames.REQUEST_ENGINE_ROOT, this._handleRequestEngineRoot.bind(this, this.configuration.containerSelector));
|
|
2236
|
+
|
|
2237
|
+
this._addEventListener(TimelineEventNames.REQUEST_TIMELINE_URI, this._handleRequestTimelineUri.bind(this));
|
|
2238
|
+
|
|
2239
|
+
this._addEventListener(TimelineEventNames.REQUEST_CURRENT_TIMELINE_POSITION, this._handleRequestTimelinePosition.bind(this, Math.floor));
|
|
2225
2240
|
|
|
2226
|
-
this.
|
|
2241
|
+
this._addEventListener(TimelineEventNames.REQUEST_TIMELINE_CLEANUP, this._handleTimelineComplete.bind(this));
|
|
2227
2242
|
|
|
2228
|
-
this.
|
|
2243
|
+
this._addEventListener(TimelineEventNames.EXECUTE_TIMELINEACTION, this._handleExecuteTimelineAction.bind(this));
|
|
2229
2244
|
|
|
2230
|
-
this.
|
|
2245
|
+
this._addEventListener(TimelineEventNames.RESIZE_TIMELINEACTION, this._resizeTimelineAction.bind(this));
|
|
2231
2246
|
|
|
2232
|
-
this.
|
|
2247
|
+
this._addEventListener(TimelineEventNames.REQUEST_CURRENT_TIMELINE, this._requestCurrentTimeline.bind(this));
|
|
2233
2248
|
|
|
2234
|
-
this.
|
|
2249
|
+
this._addEventListener(TimelineEventNames.TIME, this._onTimeHandler.bind(this, Math.floor));
|
|
2235
2250
|
|
|
2236
|
-
this.
|
|
2251
|
+
this._addEventListener(TimelineEventNames.SEEK, this._onSeekHandler.bind(this, Math.floor));
|
|
2237
2252
|
};
|
|
2238
2253
|
|
|
2239
2254
|
_proto._createTimelineLookup = function _createTimelineLookup() {
|
|
@@ -2694,6 +2709,9 @@ var Eventbus = /*#__PURE__*/function () {
|
|
|
2694
2709
|
};
|
|
2695
2710
|
|
|
2696
2711
|
this.on(eventName, eventHandlerDecorator, eventTopic);
|
|
2712
|
+
return function () {
|
|
2713
|
+
_this2.off(eventName, eventHandlerDecorator, eventTopic);
|
|
2714
|
+
};
|
|
2697
2715
|
};
|
|
2698
2716
|
|
|
2699
2717
|
_proto.off = function off(eventName, eventHandler, eventTopic) {
|
|
@@ -2717,13 +2735,29 @@ var Eventbus = /*#__PURE__*/function () {
|
|
|
2717
2735
|
};
|
|
2718
2736
|
|
|
2719
2737
|
_proto.registerEventlistener = function registerEventlistener(eventbusListener) {
|
|
2738
|
+
var _this3 = this;
|
|
2739
|
+
|
|
2720
2740
|
this.eventListeners.push(eventbusListener);
|
|
2741
|
+
return function () {
|
|
2742
|
+
var index = _this3.eventListeners.indexOf(eventbusListener);
|
|
2743
|
+
|
|
2744
|
+
if (index > -1) {
|
|
2745
|
+
_this3.eventListeners.splice(index, 1);
|
|
2746
|
+
}
|
|
2747
|
+
};
|
|
2721
2748
|
};
|
|
2722
2749
|
|
|
2723
2750
|
_proto.registerInterceptor = function registerInterceptor(eventName, interceptor, eventTopic) {
|
|
2724
2751
|
var interceptors = this._getEventInterceptors(eventName, eventTopic);
|
|
2725
2752
|
|
|
2726
2753
|
interceptors.push(interceptor);
|
|
2754
|
+
return function () {
|
|
2755
|
+
var index = interceptors.indexOf(interceptor);
|
|
2756
|
+
|
|
2757
|
+
if (index > -1) {
|
|
2758
|
+
interceptors.splice(index, 1);
|
|
2759
|
+
}
|
|
2760
|
+
};
|
|
2727
2761
|
};
|
|
2728
2762
|
|
|
2729
2763
|
_proto._callHandlers = function _callHandlers(eventName, eventTopic, args) {
|
|
@@ -2787,40 +2821,38 @@ var LanguageManager = /*#__PURE__*/function () {
|
|
|
2787
2821
|
function LanguageManager(_currentLanguage, labels, _eventbus) {
|
|
2788
2822
|
this._currentLanguage = void 0;
|
|
2789
2823
|
this._eventbus = void 0;
|
|
2790
|
-
this._labelLookup =
|
|
2791
|
-
this.
|
|
2824
|
+
this._labelLookup = void 0;
|
|
2825
|
+
this._eventbusRemovers = [];
|
|
2792
2826
|
this._currentLanguage = _currentLanguage;
|
|
2793
2827
|
this._eventbus = _eventbus;
|
|
2794
2828
|
|
|
2795
|
-
if (!_currentLanguage
|
|
2796
|
-
throw new Error('language ctor arg cannot
|
|
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');
|
|
2829
|
+
if (!_currentLanguage) {
|
|
2830
|
+
throw new Error('language ctor arg cannot have zero length');
|
|
2805
2831
|
}
|
|
2806
2832
|
|
|
2807
2833
|
this._setRootElementLang(_currentLanguage);
|
|
2808
2834
|
|
|
2809
|
-
this._createLabelLookup(labels);
|
|
2835
|
+
this._labelLookup = this._createLabelLookup(labels);
|
|
2810
2836
|
|
|
2811
2837
|
this._addEventbusListeners(_eventbus);
|
|
2812
2838
|
}
|
|
2813
2839
|
|
|
2814
2840
|
var _proto = LanguageManager.prototype;
|
|
2815
2841
|
|
|
2842
|
+
_proto.destroy = function destroy() {
|
|
2843
|
+
this._eventbusRemovers.forEach(function (x) {
|
|
2844
|
+
return x();
|
|
2845
|
+
});
|
|
2846
|
+
};
|
|
2847
|
+
|
|
2816
2848
|
_proto._addEventbusListeners = function _addEventbusListeners(eventbus) {
|
|
2817
|
-
this.
|
|
2849
|
+
this._eventbusRemovers.push(eventbus.on(TimelineEventNames.REQUEST_LABEL_COLLECTION, this._handleRequestLabelCollection.bind(this)));
|
|
2818
2850
|
|
|
2819
|
-
this.
|
|
2851
|
+
this._eventbusRemovers.push(eventbus.on(TimelineEventNames.REQUEST_LABEL_COLLECTIONS, this._handleRequestLabelCollections.bind(this)));
|
|
2820
2852
|
|
|
2821
|
-
this.
|
|
2853
|
+
this._eventbusRemovers.push(eventbus.on(TimelineEventNames.REQUEST_CURRENT_LANGUAGE, this._handleRequestCurrentLanguage.bind(this)));
|
|
2822
2854
|
|
|
2823
|
-
this.
|
|
2855
|
+
this._eventbusRemovers.push(eventbus.on(TimelineEventNames.LANGUAGE_CHANGE, this._handleLanguageChange.bind(this)));
|
|
2824
2856
|
};
|
|
2825
2857
|
|
|
2826
2858
|
_proto._handleRequestCurrentLanguage = function _handleRequestCurrentLanguage(resultCallback) {
|
|
@@ -2871,11 +2903,10 @@ var LanguageManager = /*#__PURE__*/function () {
|
|
|
2871
2903
|
};
|
|
2872
2904
|
|
|
2873
2905
|
_proto._createLabelLookup = function _createLabelLookup(labels) {
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
});
|
|
2906
|
+
return labels.reduce(function (acc, label) {
|
|
2907
|
+
acc[label.id] = label.labels;
|
|
2908
|
+
return acc;
|
|
2909
|
+
}, {});
|
|
2879
2910
|
};
|
|
2880
2911
|
|
|
2881
2912
|
return LanguageManager;
|
|
@@ -2883,47 +2914,93 @@ var LanguageManager = /*#__PURE__*/function () {
|
|
|
2883
2914
|
|
|
2884
2915
|
var EngineFactory = /*#__PURE__*/function () {
|
|
2885
2916
|
function EngineFactory(importer, windowRef, options) {
|
|
2886
|
-
var _options$devtools;
|
|
2917
|
+
var _options$eventbus, _options$devtools;
|
|
2887
2918
|
|
|
2888
|
-
this.
|
|
2889
|
-
this.
|
|
2890
|
-
this.
|
|
2891
|
-
this.
|
|
2892
|
-
this.
|
|
2893
|
-
this.
|
|
2894
|
-
this.eventbus =
|
|
2919
|
+
this._actionsLookup = {};
|
|
2920
|
+
this._eventbus = void 0;
|
|
2921
|
+
this._eventRemovers = [];
|
|
2922
|
+
this._importer = void 0;
|
|
2923
|
+
this._resizeTimeout = -1;
|
|
2924
|
+
this._importer = importer;
|
|
2925
|
+
this._eventbus = (_options$eventbus = options == null ? void 0 : options.eventbus) != null ? _options$eventbus : new Eventbus();
|
|
2895
2926
|
Diagnostics.active = (_options$devtools = options == null ? void 0 : options.devtools) != null ? _options$devtools : false;
|
|
2896
2927
|
|
|
2897
2928
|
if (Diagnostics.active) {
|
|
2898
|
-
this._initializeDevtools(this.
|
|
2929
|
+
this._initializeDevtools(this._eventbus);
|
|
2899
2930
|
}
|
|
2900
2931
|
|
|
2901
|
-
this.
|
|
2902
|
-
|
|
2903
|
-
this.
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2932
|
+
this._eventRemovers.push(this._eventbus.on(TimelineEventNames.REQUEST_INSTANCE, this._requestInstanceHandler.bind(this)));
|
|
2933
|
+
|
|
2934
|
+
this._eventRemovers.push(this._eventbus.on(TimelineEventNames.REQUEST_ACTION, this._requestActionHandler.bind(this)));
|
|
2935
|
+
|
|
2936
|
+
this._eventRemovers.push(this._eventbus.on(TimelineEventNames.REQUEST_FUNCTION, this._requestFunctionHandler.bind(this)));
|
|
2937
|
+
|
|
2938
|
+
var handleSpaceBound = this._handleSpacePress.bind(this);
|
|
2939
|
+
|
|
2940
|
+
hotkeys('space', handleSpaceBound);
|
|
2941
|
+
|
|
2942
|
+
this._eventRemovers.push(function () {
|
|
2943
|
+
return hotkeys.unbind('space', handleSpaceBound);
|
|
2944
|
+
});
|
|
2945
|
+
|
|
2946
|
+
var resizeBound = this._resizeHandler.bind(this);
|
|
2947
|
+
|
|
2948
|
+
var jqWin = $(windowRef);
|
|
2949
|
+
jqWin.on('resize', resizeBound);
|
|
2950
|
+
|
|
2951
|
+
this._eventRemovers.push(function () {
|
|
2952
|
+
return jqWin.off('resize', resizeBound);
|
|
2953
|
+
});
|
|
2907
2954
|
}
|
|
2908
2955
|
|
|
2909
2956
|
var _proto = EngineFactory.prototype;
|
|
2910
2957
|
|
|
2911
2958
|
_proto._handleSpacePress = function _handleSpacePress(keyboardEvent, _hotkeysEvent) {
|
|
2912
2959
|
keyboardEvent.preventDefault();
|
|
2913
|
-
|
|
2960
|
+
|
|
2961
|
+
this._eventbus.broadcast(TimelineEventNames.PLAY_TOGGLE_REQUEST);
|
|
2962
|
+
|
|
2914
2963
|
return false;
|
|
2915
2964
|
};
|
|
2916
2965
|
|
|
2917
2966
|
_proto._initializeDevtools = function _initializeDevtools(eventbus) {
|
|
2967
|
+
var _this = this;
|
|
2968
|
+
|
|
2918
2969
|
var diagnosticInfo = window[DEV_TOOLS_KEY];
|
|
2919
2970
|
|
|
2920
2971
|
if (diagnosticInfo) {
|
|
2921
2972
|
var agent = diagnosticInfo.agent;
|
|
2922
|
-
var eventbusListener = new DevToolEventListener(agent);
|
|
2923
|
-
eventbus.registerEventlistener(eventbusListener);
|
|
2924
2973
|
|
|
2925
|
-
|
|
2926
|
-
|
|
2974
|
+
this._eventRemovers.push(eventbus.registerEventlistener(new DevToolEventListener(agent)));
|
|
2975
|
+
|
|
2976
|
+
this._eventRemovers.push(agent.subscribe(function (message) {
|
|
2977
|
+
if (message.type === 'playcontrol') {
|
|
2978
|
+
switch (message.data.kind) {
|
|
2979
|
+
case 'play':
|
|
2980
|
+
_this._eventbus.broadcast(TimelineEventNames.PLAY_REQUEST);
|
|
2981
|
+
|
|
2982
|
+
break;
|
|
2983
|
+
|
|
2984
|
+
case 'stop':
|
|
2985
|
+
_this._eventbus.broadcast(TimelineEventNames.STOP_REQUEST);
|
|
2986
|
+
|
|
2987
|
+
break;
|
|
2988
|
+
|
|
2989
|
+
case 'pause':
|
|
2990
|
+
_this._eventbus.broadcast(TimelineEventNames.PAUSE_REQUEST);
|
|
2991
|
+
|
|
2992
|
+
break;
|
|
2993
|
+
|
|
2994
|
+
case 'seek':
|
|
2995
|
+
_this._eventbus.broadcast(TimelineEventNames.SEEK_REQUEST, [message.data.args]);
|
|
2996
|
+
|
|
2997
|
+
break;
|
|
2998
|
+
}
|
|
2999
|
+
}
|
|
3000
|
+
}));
|
|
3001
|
+
|
|
3002
|
+
Diagnostics.send = function (name, messageData) {
|
|
3003
|
+
var message = prepareValueForSerialization(messageData);
|
|
2927
3004
|
|
|
2928
3005
|
try {
|
|
2929
3006
|
agent.postMessage(name, message);
|
|
@@ -2936,35 +3013,37 @@ var EngineFactory = /*#__PURE__*/function () {
|
|
|
2936
3013
|
|
|
2937
3014
|
Diagnostics.send('eligius-diagnostics-factory', 'Diagnostics initialized');
|
|
2938
3015
|
} else {
|
|
2939
|
-
console.warn(DEV_TOOLS_KEY + " property not found on window, please install the extension.");
|
|
3016
|
+
console.warn(DEV_TOOLS_KEY + " property not found on window, please install the Eligius Devtools extension.");
|
|
2940
3017
|
}
|
|
2941
3018
|
};
|
|
2942
3019
|
|
|
2943
3020
|
_proto.destroy = function destroy() {
|
|
2944
|
-
this.
|
|
2945
|
-
|
|
3021
|
+
this._eventRemovers.forEach(function (x) {
|
|
3022
|
+
return x();
|
|
3023
|
+
});
|
|
2946
3024
|
};
|
|
2947
3025
|
|
|
2948
3026
|
_proto._resizeHandler = function _resizeHandler() {
|
|
2949
|
-
var
|
|
3027
|
+
var _this2 = this;
|
|
2950
3028
|
|
|
2951
|
-
if (this.
|
|
2952
|
-
clearTimeout(this.
|
|
3029
|
+
if (this._resizeTimeout) {
|
|
3030
|
+
clearTimeout(this._resizeTimeout);
|
|
3031
|
+
this._resizeTimeout = -1;
|
|
2953
3032
|
}
|
|
2954
3033
|
|
|
2955
|
-
this.
|
|
2956
|
-
|
|
3034
|
+
this._resizeTimeout = setTimeout(function () {
|
|
3035
|
+
_this2._eventbus.broadcast(TimelineEventNames.RESIZE);
|
|
2957
3036
|
}, 200);
|
|
2958
3037
|
};
|
|
2959
3038
|
|
|
2960
3039
|
_proto._importSystemEntryWithEventbusDependency = function _importSystemEntryWithEventbusDependency(systemName) {
|
|
2961
3040
|
var ctor = this._importSystemEntry(systemName);
|
|
2962
3041
|
|
|
2963
|
-
return new ctor(this.
|
|
3042
|
+
return new ctor(this._eventbus);
|
|
2964
3043
|
};
|
|
2965
3044
|
|
|
2966
3045
|
_proto._importSystemEntry = function _importSystemEntry(systemName) {
|
|
2967
|
-
return this.
|
|
3046
|
+
return this._importer["import"](systemName)[systemName];
|
|
2968
3047
|
};
|
|
2969
3048
|
|
|
2970
3049
|
_proto._requestInstanceHandler = function _requestInstanceHandler(systemName, resultCallback) {
|
|
@@ -2976,7 +3055,7 @@ var EngineFactory = /*#__PURE__*/function () {
|
|
|
2976
3055
|
};
|
|
2977
3056
|
|
|
2978
3057
|
_proto._requestActionHandler = function _requestActionHandler(systemName, resultCallback) {
|
|
2979
|
-
var action = this.
|
|
3058
|
+
var action = this._actionsLookup[systemName];
|
|
2980
3059
|
|
|
2981
3060
|
if (action) {
|
|
2982
3061
|
resultCallback(action);
|
|
@@ -2997,29 +3076,31 @@ var EngineFactory = /*#__PURE__*/function () {
|
|
|
2997
3076
|
|
|
2998
3077
|
if ((_configuration$eventA = configuration.eventActions) != null && _configuration$eventA.length) {
|
|
2999
3078
|
actionRegistryListener = new ActionRegistryEventbusListener();
|
|
3000
|
-
|
|
3079
|
+
|
|
3080
|
+
this._eventRemovers.push(this._eventbus.registerEventlistener(actionRegistryListener));
|
|
3001
3081
|
}
|
|
3002
3082
|
|
|
3003
|
-
this.
|
|
3004
|
-
|
|
3083
|
+
this._eventRemovers.push(this._eventbus.registerInterceptor(TimelineEventNames.REQUEST_TIMELINE_URI, new RequestVideoUriInterceptor(this._eventbus)));
|
|
3084
|
+
|
|
3085
|
+
resolver = resolver || new ConfigurationResolver(this._importer, this._eventbus);
|
|
3005
3086
|
|
|
3006
3087
|
var _resolver$process = resolver.process(configuration, actionRegistryListener),
|
|
3007
3088
|
actionLookup = _resolver$process[0],
|
|
3008
3089
|
resolvedConfiguration = _resolver$process[1];
|
|
3009
3090
|
|
|
3010
|
-
this.
|
|
3091
|
+
this._actionsLookup = actionLookup;
|
|
3011
3092
|
|
|
3012
|
-
var timelineProviders = this._createTimelineProviders(resolvedConfiguration, this.
|
|
3093
|
+
var timelineProviders = this._createTimelineProviders(resolvedConfiguration, this._eventbus);
|
|
3013
3094
|
|
|
3014
3095
|
var language = configuration.language,
|
|
3015
3096
|
labels = configuration.labels;
|
|
3016
|
-
var languageManager = new LanguageManager(language, labels, this.
|
|
3017
|
-
var engineInstance = new EngineClass(resolvedConfiguration, this.
|
|
3097
|
+
var languageManager = new LanguageManager(language, labels, this._eventbus);
|
|
3098
|
+
var engineInstance = new EngineClass(resolvedConfiguration, this._eventbus, timelineProviders, languageManager);
|
|
3018
3099
|
return engineInstance;
|
|
3019
3100
|
};
|
|
3020
3101
|
|
|
3021
3102
|
_proto._createTimelineProviders = function _createTimelineProviders(configuration, eventbus) {
|
|
3022
|
-
var
|
|
3103
|
+
var _this3 = this;
|
|
3023
3104
|
|
|
3024
3105
|
var timelineProviderSettings = configuration.timelineProviderSettings;
|
|
3025
3106
|
var result = Object.entries(timelineProviderSettings).reduce(function (acc, _ref) {
|
|
@@ -3030,7 +3111,7 @@ var EngineFactory = /*#__PURE__*/function () {
|
|
|
3030
3111
|
return acc;
|
|
3031
3112
|
}
|
|
3032
3113
|
|
|
3033
|
-
var timelineProviderClass =
|
|
3114
|
+
var timelineProviderClass = _this3._importSystemEntry(settings.systemName);
|
|
3034
3115
|
|
|
3035
3116
|
acc[timelineType] = {
|
|
3036
3117
|
id: settings.id,
|