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