eligius 1.0.71 → 1.0.81
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 +326 -251
- 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 +326 -251
- 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 +3 -2
|
@@ -18,177 +18,6 @@ var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
|
|
|
18
18
|
var lottie__default = /*#__PURE__*/_interopDefaultLegacy(lottie);
|
|
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 $__default["default"]) {
|
|
25
|
-
return 'jQuery object';
|
|
26
|
-
} else if (typeof value === 'object') {
|
|
27
|
-
return Object.fromEntries(Object.entries(value).map(function (_ref) {
|
|
28
|
-
var propName = _ref[0],
|
|
29
|
-
propValue = _ref[1];
|
|
30
|
-
return [propName, prepareValueForSerialization(propValue)];
|
|
31
|
-
}));
|
|
32
|
-
} else if (typeof value === 'function') {
|
|
33
|
-
var funcString = value.toString();
|
|
34
|
-
var paranIndex = funcString.indexOf('{');
|
|
35
|
-
|
|
36
|
-
if (paranIndex > -1) {
|
|
37
|
-
return funcString.substring(0, funcString.indexOf('{') + 1);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return funcString;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return value;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
var DevToolEventListener = /*#__PURE__*/function () {
|
|
47
|
-
function DevToolEventListener(agent) {
|
|
48
|
-
this.agent = void 0;
|
|
49
|
-
this.agent = agent;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
var _proto = DevToolEventListener.prototype;
|
|
53
|
-
|
|
54
|
-
_proto.handleEvent = function handleEvent(eventName, eventTopic, args) {
|
|
55
|
-
var message = {
|
|
56
|
-
eventName: eventName,
|
|
57
|
-
eventTopic: eventTopic,
|
|
58
|
-
args: prepareValueForSerialization(args)
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
try {
|
|
62
|
-
this.agent.postMessage('eligius-diagnostics-event', message);
|
|
63
|
-
} catch (e) {
|
|
64
|
-
console.error('postmessage failed');
|
|
65
|
-
console.error(e);
|
|
66
|
-
console.log('message', message);
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
return DevToolEventListener;
|
|
71
|
-
}();
|
|
72
|
-
|
|
73
|
-
var Diagnostics = /*#__PURE__*/function () {
|
|
74
|
-
function Diagnostics() {}
|
|
75
|
-
|
|
76
|
-
Diagnostics.send = function send(_name, _data) {
|
|
77
|
-
console.log(_name, _data);
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
return Diagnostics;
|
|
81
|
-
}();
|
|
82
|
-
Diagnostics.active = void 0;
|
|
83
|
-
|
|
84
|
-
var DEV_TOOLS_KEY = '__ELIGIUS_DEV_TOOLS__';
|
|
85
|
-
|
|
86
|
-
var copyFunction = typeof structuredClone !== 'undefined' ? structuredClone : function (original) {
|
|
87
|
-
return JSON.parse(JSON.stringify(original));
|
|
88
|
-
};
|
|
89
|
-
function deepCopy(original) {
|
|
90
|
-
if (tsIsPresent.isDefined(original)) {
|
|
91
|
-
return copyFunction(original);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
return original;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
function isPromise(obj) {
|
|
98
|
-
return typeof obj === 'object' && typeof obj.then === 'function';
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
var Action = /*#__PURE__*/function () {
|
|
102
|
-
function Action(name, startOperations, eventbus) {
|
|
103
|
-
this.name = void 0;
|
|
104
|
-
this.startOperations = void 0;
|
|
105
|
-
this.eventbus = void 0;
|
|
106
|
-
this.id = '';
|
|
107
|
-
this.name = name;
|
|
108
|
-
this.startOperations = startOperations;
|
|
109
|
-
this.eventbus = eventbus;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
var _proto = Action.prototype;
|
|
113
|
-
|
|
114
|
-
_proto.start = function start(initOperationData) {
|
|
115
|
-
var _this$name,
|
|
116
|
-
_this = this;
|
|
117
|
-
|
|
118
|
-
Diagnostics.active && Diagnostics.send('eligius-diagnostics-action', ((_this$name = this.name) != null ? _this$name : 'Action') + " begins executing start operations");
|
|
119
|
-
var context = {
|
|
120
|
-
currentIndex: -1,
|
|
121
|
-
eventbus: this.eventbus
|
|
122
|
-
};
|
|
123
|
-
var result = new Promise(function (resolve, reject) {
|
|
124
|
-
_this.executeOperation(_this.startOperations, 0, resolve, reject, initOperationData, context);
|
|
125
|
-
})["catch"](function (e) {
|
|
126
|
-
Diagnostics.active && Diagnostics.send('eligius-diagnostics-action-error', {
|
|
127
|
-
name: name,
|
|
128
|
-
error: e
|
|
129
|
-
});
|
|
130
|
-
console.error("Error in action start '" + _this.name + "'");
|
|
131
|
-
console.error(e);
|
|
132
|
-
throw e;
|
|
133
|
-
});
|
|
134
|
-
return !Diagnostics.active ? result : result.then(function (operationsResult) {
|
|
135
|
-
var _this$name2;
|
|
136
|
-
|
|
137
|
-
Diagnostics.send('eligius-diagnostics-action', ((_this$name2 = _this.name) != null ? _this$name2 : 'Action') + " finished executing start operations");
|
|
138
|
-
return operationsResult;
|
|
139
|
-
});
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
_proto.executeOperation = function executeOperation(operations, idx, resolve, reject, previousOperationData, context) {
|
|
143
|
-
var _this2 = this;
|
|
144
|
-
|
|
145
|
-
if (previousOperationData === void 0) {
|
|
146
|
-
previousOperationData = {};
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
if (context.newIndex !== undefined) {
|
|
150
|
-
idx = context.newIndex;
|
|
151
|
-
delete context.newIndex;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
context.currentIndex = idx;
|
|
155
|
-
|
|
156
|
-
if (context.skipNextOperation) {
|
|
157
|
-
if (idx < operations.length) {
|
|
158
|
-
this.executeOperation(operations, ++idx, resolve, reject, previousOperationData, context);
|
|
159
|
-
} else {
|
|
160
|
-
resolve(previousOperationData);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
if (idx < operations.length) {
|
|
165
|
-
var operationInfo = operations[idx];
|
|
166
|
-
var copy = operationInfo.operationData ? deepCopy(operationInfo.operationData) : {};
|
|
167
|
-
var mergedOperationData = Object.assign(previousOperationData, copy);
|
|
168
|
-
Diagnostics.active && Diagnostics.send('eligius-diagnostics-operation', {
|
|
169
|
-
systemName: operationInfo.systemName,
|
|
170
|
-
operationData: operationInfo.operationData,
|
|
171
|
-
context: context
|
|
172
|
-
});
|
|
173
|
-
var operationResult = operationInfo.instance.call(context, mergedOperationData);
|
|
174
|
-
|
|
175
|
-
if (isPromise(operationResult)) {
|
|
176
|
-
operationResult.then(function (resultOperationData) {
|
|
177
|
-
_this2.executeOperation(operations, ++idx, resolve, reject, resultOperationData, context);
|
|
178
|
-
})["catch"](function (error) {
|
|
179
|
-
reject(error);
|
|
180
|
-
});
|
|
181
|
-
} else {
|
|
182
|
-
this.executeOperation(operations, ++idx, resolve, reject, operationResult, context);
|
|
183
|
-
}
|
|
184
|
-
} else {
|
|
185
|
-
resolve(previousOperationData);
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
return Action;
|
|
190
|
-
}();
|
|
191
|
-
|
|
192
21
|
function _regeneratorRuntime() {
|
|
193
22
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
194
23
|
|
|
@@ -602,6 +431,179 @@ function _setPrototypeOf(o, p) {
|
|
|
602
431
|
return _setPrototypeOf(o, p);
|
|
603
432
|
}
|
|
604
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 (value !== null && 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
|
+
|
|
605
607
|
var EndableAction = /*#__PURE__*/function (_Action) {
|
|
606
608
|
_inheritsLoose(EndableAction, _Action);
|
|
607
609
|
|
|
@@ -2058,38 +2060,36 @@ var ctrls = {
|
|
|
2058
2060
|
*/
|
|
2059
2061
|
|
|
2060
2062
|
var EligiusEngine = /*#__PURE__*/function () {
|
|
2061
|
-
function EligiusEngine(configuration, eventbus, timelineProviders,
|
|
2063
|
+
function EligiusEngine(configuration, eventbus, timelineProviders, languageManager) {
|
|
2062
2064
|
this.configuration = void 0;
|
|
2063
2065
|
this.eventbus = void 0;
|
|
2064
2066
|
this.timelineProviders = void 0;
|
|
2065
|
-
this.
|
|
2067
|
+
this.languageManager = void 0;
|
|
2066
2068
|
this._timeLineActionsLookup = {};
|
|
2067
|
-
this.
|
|
2069
|
+
this._eventbusRemovers = [];
|
|
2068
2070
|
this._currentTimelineUri = '';
|
|
2069
2071
|
this._activeTimelineProvider = undefined;
|
|
2070
2072
|
this._lastPosition = -1;
|
|
2071
2073
|
this.configuration = configuration;
|
|
2072
2074
|
this.eventbus = eventbus;
|
|
2073
2075
|
this.timelineProviders = timelineProviders;
|
|
2074
|
-
this.
|
|
2076
|
+
this.languageManager = languageManager;
|
|
2075
2077
|
}
|
|
2076
2078
|
|
|
2077
2079
|
var _proto = EligiusEngine.prototype;
|
|
2078
2080
|
|
|
2079
2081
|
_proto.init = function init() {
|
|
2082
|
+
var _timelines$0$uri;
|
|
2083
|
+
|
|
2080
2084
|
this._createLayoutTemplate();
|
|
2081
2085
|
|
|
2082
2086
|
this._addInitialisationListeners();
|
|
2083
2087
|
|
|
2084
2088
|
var timelines = this.configuration.timelines;
|
|
2085
|
-
this._currentTimelineUri =
|
|
2089
|
+
this._currentTimelineUri = (_timelines$0$uri = timelines == null ? void 0 : timelines[0].uri) != null ? _timelines$0$uri : '';
|
|
2086
2090
|
|
|
2087
2091
|
this._createTimelineLookup();
|
|
2088
2092
|
|
|
2089
|
-
this._eventbusListeners.push(this.eventbus.on(TimelineEventNames.TIME, this._onTimeHandler.bind(this, Math.floor)));
|
|
2090
|
-
|
|
2091
|
-
this._eventbusListeners.push(this.eventbus.on(TimelineEventNames.SEEK, this._onSeekHandler.bind(this, Math.floor)));
|
|
2092
|
-
|
|
2093
2093
|
return this._initializeTimelineProvider();
|
|
2094
2094
|
};
|
|
2095
2095
|
|
|
@@ -2207,9 +2207,10 @@ var EligiusEngine = /*#__PURE__*/function () {
|
|
|
2207
2207
|
return this._cleanUp();
|
|
2208
2208
|
|
|
2209
2209
|
case 2:
|
|
2210
|
+
this.languageManager.destroy();
|
|
2210
2211
|
this._activeTimelineProvider = undefined;
|
|
2211
2212
|
|
|
2212
|
-
this.
|
|
2213
|
+
this._eventbusRemovers.forEach(function (remover) {
|
|
2213
2214
|
return remover();
|
|
2214
2215
|
});
|
|
2215
2216
|
|
|
@@ -2223,7 +2224,7 @@ var EligiusEngine = /*#__PURE__*/function () {
|
|
|
2223
2224
|
container = $__default["default"](containerSelector);
|
|
2224
2225
|
container.empty();
|
|
2225
2226
|
|
|
2226
|
-
case
|
|
2227
|
+
case 9:
|
|
2227
2228
|
case "end":
|
|
2228
2229
|
return _context3.stop();
|
|
2229
2230
|
}
|
|
@@ -2238,20 +2239,28 @@ var EligiusEngine = /*#__PURE__*/function () {
|
|
|
2238
2239
|
return destroy;
|
|
2239
2240
|
}();
|
|
2240
2241
|
|
|
2242
|
+
_proto._addEventListener = function _addEventListener(eventName, eventHandler, eventTopic) {
|
|
2243
|
+
this._eventbusRemovers.push(this.eventbus.on(eventName, eventHandler, eventTopic));
|
|
2244
|
+
};
|
|
2245
|
+
|
|
2241
2246
|
_proto._addInitialisationListeners = function _addInitialisationListeners() {
|
|
2242
|
-
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));
|
|
2243
2250
|
|
|
2244
|
-
this.
|
|
2251
|
+
this._addEventListener(TimelineEventNames.REQUEST_CURRENT_TIMELINE_POSITION, this._handleRequestTimelinePosition.bind(this, Math.floor));
|
|
2245
2252
|
|
|
2246
|
-
this.
|
|
2253
|
+
this._addEventListener(TimelineEventNames.REQUEST_TIMELINE_CLEANUP, this._handleTimelineComplete.bind(this));
|
|
2247
2254
|
|
|
2248
|
-
this.
|
|
2255
|
+
this._addEventListener(TimelineEventNames.EXECUTE_TIMELINEACTION, this._handleExecuteTimelineAction.bind(this));
|
|
2249
2256
|
|
|
2250
|
-
this.
|
|
2257
|
+
this._addEventListener(TimelineEventNames.RESIZE_TIMELINEACTION, this._resizeTimelineAction.bind(this));
|
|
2251
2258
|
|
|
2252
|
-
this.
|
|
2259
|
+
this._addEventListener(TimelineEventNames.REQUEST_CURRENT_TIMELINE, this._requestCurrentTimeline.bind(this));
|
|
2253
2260
|
|
|
2254
|
-
this.
|
|
2261
|
+
this._addEventListener(TimelineEventNames.TIME, this._onTimeHandler.bind(this, Math.floor));
|
|
2262
|
+
|
|
2263
|
+
this._addEventListener(TimelineEventNames.SEEK, this._onSeekHandler.bind(this, Math.floor));
|
|
2255
2264
|
};
|
|
2256
2265
|
|
|
2257
2266
|
_proto._createTimelineLookup = function _createTimelineLookup() {
|
|
@@ -2712,6 +2721,9 @@ var Eventbus = /*#__PURE__*/function () {
|
|
|
2712
2721
|
};
|
|
2713
2722
|
|
|
2714
2723
|
this.on(eventName, eventHandlerDecorator, eventTopic);
|
|
2724
|
+
return function () {
|
|
2725
|
+
_this2.off(eventName, eventHandlerDecorator, eventTopic);
|
|
2726
|
+
};
|
|
2715
2727
|
};
|
|
2716
2728
|
|
|
2717
2729
|
_proto.off = function off(eventName, eventHandler, eventTopic) {
|
|
@@ -2735,13 +2747,29 @@ var Eventbus = /*#__PURE__*/function () {
|
|
|
2735
2747
|
};
|
|
2736
2748
|
|
|
2737
2749
|
_proto.registerEventlistener = function registerEventlistener(eventbusListener) {
|
|
2750
|
+
var _this3 = this;
|
|
2751
|
+
|
|
2738
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
|
+
};
|
|
2739
2760
|
};
|
|
2740
2761
|
|
|
2741
2762
|
_proto.registerInterceptor = function registerInterceptor(eventName, interceptor, eventTopic) {
|
|
2742
2763
|
var interceptors = this._getEventInterceptors(eventName, eventTopic);
|
|
2743
2764
|
|
|
2744
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
|
+
};
|
|
2745
2773
|
};
|
|
2746
2774
|
|
|
2747
2775
|
_proto._callHandlers = function _callHandlers(eventName, eventTopic, args) {
|
|
@@ -2805,40 +2833,38 @@ var LanguageManager = /*#__PURE__*/function () {
|
|
|
2805
2833
|
function LanguageManager(_currentLanguage, labels, _eventbus) {
|
|
2806
2834
|
this._currentLanguage = void 0;
|
|
2807
2835
|
this._eventbus = void 0;
|
|
2808
|
-
this._labelLookup =
|
|
2809
|
-
this.
|
|
2836
|
+
this._labelLookup = void 0;
|
|
2837
|
+
this._eventbusRemovers = [];
|
|
2810
2838
|
this._currentLanguage = _currentLanguage;
|
|
2811
2839
|
this._eventbus = _eventbus;
|
|
2812
2840
|
|
|
2813
|
-
if (!_currentLanguage
|
|
2814
|
-
throw new Error('language ctor arg cannot
|
|
2815
|
-
}
|
|
2816
|
-
|
|
2817
|
-
if (!labels) {
|
|
2818
|
-
throw new Error('labels ctor arg cannot be null');
|
|
2819
|
-
}
|
|
2820
|
-
|
|
2821
|
-
if (!_eventbus) {
|
|
2822
|
-
throw new Error('eventbus ctor arg cannot be null');
|
|
2841
|
+
if (!_currentLanguage) {
|
|
2842
|
+
throw new Error('language ctor arg cannot have zero length');
|
|
2823
2843
|
}
|
|
2824
2844
|
|
|
2825
2845
|
this._setRootElementLang(_currentLanguage);
|
|
2826
2846
|
|
|
2827
|
-
this._createLabelLookup(labels);
|
|
2847
|
+
this._labelLookup = this._createLabelLookup(labels);
|
|
2828
2848
|
|
|
2829
2849
|
this._addEventbusListeners(_eventbus);
|
|
2830
2850
|
}
|
|
2831
2851
|
|
|
2832
2852
|
var _proto = LanguageManager.prototype;
|
|
2833
2853
|
|
|
2854
|
+
_proto.destroy = function destroy() {
|
|
2855
|
+
this._eventbusRemovers.forEach(function (x) {
|
|
2856
|
+
return x();
|
|
2857
|
+
});
|
|
2858
|
+
};
|
|
2859
|
+
|
|
2834
2860
|
_proto._addEventbusListeners = function _addEventbusListeners(eventbus) {
|
|
2835
|
-
this.
|
|
2861
|
+
this._eventbusRemovers.push(eventbus.on(TimelineEventNames.REQUEST_LABEL_COLLECTION, this._handleRequestLabelCollection.bind(this)));
|
|
2836
2862
|
|
|
2837
|
-
this.
|
|
2863
|
+
this._eventbusRemovers.push(eventbus.on(TimelineEventNames.REQUEST_LABEL_COLLECTIONS, this._handleRequestLabelCollections.bind(this)));
|
|
2838
2864
|
|
|
2839
|
-
this.
|
|
2865
|
+
this._eventbusRemovers.push(eventbus.on(TimelineEventNames.REQUEST_CURRENT_LANGUAGE, this._handleRequestCurrentLanguage.bind(this)));
|
|
2840
2866
|
|
|
2841
|
-
this.
|
|
2867
|
+
this._eventbusRemovers.push(eventbus.on(TimelineEventNames.LANGUAGE_CHANGE, this._handleLanguageChange.bind(this)));
|
|
2842
2868
|
};
|
|
2843
2869
|
|
|
2844
2870
|
_proto._handleRequestCurrentLanguage = function _handleRequestCurrentLanguage(resultCallback) {
|
|
@@ -2889,11 +2915,10 @@ var LanguageManager = /*#__PURE__*/function () {
|
|
|
2889
2915
|
};
|
|
2890
2916
|
|
|
2891
2917
|
_proto._createLabelLookup = function _createLabelLookup(labels) {
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
});
|
|
2918
|
+
return labels.reduce(function (acc, label) {
|
|
2919
|
+
acc[label.id] = label.labels;
|
|
2920
|
+
return acc;
|
|
2921
|
+
}, {});
|
|
2897
2922
|
};
|
|
2898
2923
|
|
|
2899
2924
|
return LanguageManager;
|
|
@@ -2901,47 +2926,93 @@ var LanguageManager = /*#__PURE__*/function () {
|
|
|
2901
2926
|
|
|
2902
2927
|
var EngineFactory = /*#__PURE__*/function () {
|
|
2903
2928
|
function EngineFactory(importer, windowRef, options) {
|
|
2904
|
-
var _options$devtools;
|
|
2929
|
+
var _options$eventbus, _options$devtools;
|
|
2905
2930
|
|
|
2906
|
-
this.
|
|
2907
|
-
this.
|
|
2908
|
-
this.
|
|
2909
|
-
this.
|
|
2910
|
-
this.
|
|
2911
|
-
this.
|
|
2912
|
-
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();
|
|
2913
2938
|
Diagnostics.active = (_options$devtools = options == null ? void 0 : options.devtools) != null ? _options$devtools : false;
|
|
2914
2939
|
|
|
2915
2940
|
if (Diagnostics.active) {
|
|
2916
|
-
this._initializeDevtools(this.
|
|
2941
|
+
this._initializeDevtools(this._eventbus);
|
|
2917
2942
|
}
|
|
2918
2943
|
|
|
2919
|
-
this.
|
|
2920
|
-
|
|
2921
|
-
this.
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
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
|
+
});
|
|
2925
2966
|
}
|
|
2926
2967
|
|
|
2927
2968
|
var _proto = EngineFactory.prototype;
|
|
2928
2969
|
|
|
2929
2970
|
_proto._handleSpacePress = function _handleSpacePress(keyboardEvent, _hotkeysEvent) {
|
|
2930
2971
|
keyboardEvent.preventDefault();
|
|
2931
|
-
|
|
2972
|
+
|
|
2973
|
+
this._eventbus.broadcast(TimelineEventNames.PLAY_TOGGLE_REQUEST);
|
|
2974
|
+
|
|
2932
2975
|
return false;
|
|
2933
2976
|
};
|
|
2934
2977
|
|
|
2935
2978
|
_proto._initializeDevtools = function _initializeDevtools(eventbus) {
|
|
2979
|
+
var _this = this;
|
|
2980
|
+
|
|
2936
2981
|
var diagnosticInfo = window[DEV_TOOLS_KEY];
|
|
2937
2982
|
|
|
2938
2983
|
if (diagnosticInfo) {
|
|
2939
2984
|
var agent = diagnosticInfo.agent;
|
|
2940
|
-
var eventbusListener = new DevToolEventListener(agent);
|
|
2941
|
-
eventbus.registerEventlistener(eventbusListener);
|
|
2942
2985
|
|
|
2943
|
-
|
|
2944
|
-
|
|
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);
|
|
2945
3016
|
|
|
2946
3017
|
try {
|
|
2947
3018
|
agent.postMessage(name, message);
|
|
@@ -2954,35 +3025,37 @@ var EngineFactory = /*#__PURE__*/function () {
|
|
|
2954
3025
|
|
|
2955
3026
|
Diagnostics.send('eligius-diagnostics-factory', 'Diagnostics initialized');
|
|
2956
3027
|
} else {
|
|
2957
|
-
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.");
|
|
2958
3029
|
}
|
|
2959
3030
|
};
|
|
2960
3031
|
|
|
2961
3032
|
_proto.destroy = function destroy() {
|
|
2962
|
-
this.
|
|
2963
|
-
|
|
3033
|
+
this._eventRemovers.forEach(function (x) {
|
|
3034
|
+
return x();
|
|
3035
|
+
});
|
|
2964
3036
|
};
|
|
2965
3037
|
|
|
2966
3038
|
_proto._resizeHandler = function _resizeHandler() {
|
|
2967
|
-
var
|
|
3039
|
+
var _this2 = this;
|
|
2968
3040
|
|
|
2969
|
-
if (this.
|
|
2970
|
-
clearTimeout(this.
|
|
3041
|
+
if (this._resizeTimeout) {
|
|
3042
|
+
clearTimeout(this._resizeTimeout);
|
|
3043
|
+
this._resizeTimeout = -1;
|
|
2971
3044
|
}
|
|
2972
3045
|
|
|
2973
|
-
this.
|
|
2974
|
-
|
|
3046
|
+
this._resizeTimeout = setTimeout(function () {
|
|
3047
|
+
_this2._eventbus.broadcast(TimelineEventNames.RESIZE);
|
|
2975
3048
|
}, 200);
|
|
2976
3049
|
};
|
|
2977
3050
|
|
|
2978
3051
|
_proto._importSystemEntryWithEventbusDependency = function _importSystemEntryWithEventbusDependency(systemName) {
|
|
2979
3052
|
var ctor = this._importSystemEntry(systemName);
|
|
2980
3053
|
|
|
2981
|
-
return new ctor(this.
|
|
3054
|
+
return new ctor(this._eventbus);
|
|
2982
3055
|
};
|
|
2983
3056
|
|
|
2984
3057
|
_proto._importSystemEntry = function _importSystemEntry(systemName) {
|
|
2985
|
-
return this.
|
|
3058
|
+
return this._importer["import"](systemName)[systemName];
|
|
2986
3059
|
};
|
|
2987
3060
|
|
|
2988
3061
|
_proto._requestInstanceHandler = function _requestInstanceHandler(systemName, resultCallback) {
|
|
@@ -2994,7 +3067,7 @@ var EngineFactory = /*#__PURE__*/function () {
|
|
|
2994
3067
|
};
|
|
2995
3068
|
|
|
2996
3069
|
_proto._requestActionHandler = function _requestActionHandler(systemName, resultCallback) {
|
|
2997
|
-
var action = this.
|
|
3070
|
+
var action = this._actionsLookup[systemName];
|
|
2998
3071
|
|
|
2999
3072
|
if (action) {
|
|
3000
3073
|
resultCallback(action);
|
|
@@ -3015,29 +3088,31 @@ var EngineFactory = /*#__PURE__*/function () {
|
|
|
3015
3088
|
|
|
3016
3089
|
if ((_configuration$eventA = configuration.eventActions) != null && _configuration$eventA.length) {
|
|
3017
3090
|
actionRegistryListener = new ActionRegistryEventbusListener();
|
|
3018
|
-
|
|
3091
|
+
|
|
3092
|
+
this._eventRemovers.push(this._eventbus.registerEventlistener(actionRegistryListener));
|
|
3019
3093
|
}
|
|
3020
3094
|
|
|
3021
|
-
this.
|
|
3022
|
-
|
|
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);
|
|
3023
3098
|
|
|
3024
3099
|
var _resolver$process = resolver.process(configuration, actionRegistryListener),
|
|
3025
3100
|
actionLookup = _resolver$process[0],
|
|
3026
3101
|
resolvedConfiguration = _resolver$process[1];
|
|
3027
3102
|
|
|
3028
|
-
this.
|
|
3103
|
+
this._actionsLookup = actionLookup;
|
|
3029
3104
|
|
|
3030
|
-
var timelineProviders = this._createTimelineProviders(resolvedConfiguration, this.
|
|
3105
|
+
var timelineProviders = this._createTimelineProviders(resolvedConfiguration, this._eventbus);
|
|
3031
3106
|
|
|
3032
3107
|
var language = configuration.language,
|
|
3033
3108
|
labels = configuration.labels;
|
|
3034
|
-
var languageManager = new LanguageManager(language, labels, this.
|
|
3035
|
-
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);
|
|
3036
3111
|
return engineInstance;
|
|
3037
3112
|
};
|
|
3038
3113
|
|
|
3039
3114
|
_proto._createTimelineProviders = function _createTimelineProviders(configuration, eventbus) {
|
|
3040
|
-
var
|
|
3115
|
+
var _this3 = this;
|
|
3041
3116
|
|
|
3042
3117
|
var timelineProviderSettings = configuration.timelineProviderSettings;
|
|
3043
3118
|
var result = Object.entries(timelineProviderSettings).reduce(function (acc, _ref) {
|
|
@@ -3048,7 +3123,7 @@ var EngineFactory = /*#__PURE__*/function () {
|
|
|
3048
3123
|
return acc;
|
|
3049
3124
|
}
|
|
3050
3125
|
|
|
3051
|
-
var timelineProviderClass =
|
|
3126
|
+
var timelineProviderClass = _this3._importSystemEntry(settings.systemName);
|
|
3052
3127
|
|
|
3053
3128
|
acc[timelineType] = {
|
|
3054
3129
|
id: settings.id,
|