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
package/dist/eligius.esm.js
CHANGED
|
@@ -6,177 +6,6 @@ import lottie from 'lottie-web';
|
|
|
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 $) {
|
|
13
|
-
return 'jQuery object';
|
|
14
|
-
} else if (typeof value === 'object') {
|
|
15
|
-
return Object.fromEntries(Object.entries(value).map(function (_ref) {
|
|
16
|
-
var propName = _ref[0],
|
|
17
|
-
propValue = _ref[1];
|
|
18
|
-
return [propName, prepareValueForSerialization(propValue)];
|
|
19
|
-
}));
|
|
20
|
-
} else if (typeof value === 'function') {
|
|
21
|
-
var funcString = value.toString();
|
|
22
|
-
var paranIndex = funcString.indexOf('{');
|
|
23
|
-
|
|
24
|
-
if (paranIndex > -1) {
|
|
25
|
-
return funcString.substring(0, funcString.indexOf('{') + 1);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return funcString;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return value;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
var DevToolEventListener = /*#__PURE__*/function () {
|
|
35
|
-
function DevToolEventListener(agent) {
|
|
36
|
-
this.agent = void 0;
|
|
37
|
-
this.agent = agent;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
var _proto = DevToolEventListener.prototype;
|
|
41
|
-
|
|
42
|
-
_proto.handleEvent = function handleEvent(eventName, eventTopic, args) {
|
|
43
|
-
var message = {
|
|
44
|
-
eventName: eventName,
|
|
45
|
-
eventTopic: eventTopic,
|
|
46
|
-
args: prepareValueForSerialization(args)
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
try {
|
|
50
|
-
this.agent.postMessage('eligius-diagnostics-event', message);
|
|
51
|
-
} catch (e) {
|
|
52
|
-
console.error('postmessage failed');
|
|
53
|
-
console.error(e);
|
|
54
|
-
console.log('message', message);
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
return DevToolEventListener;
|
|
59
|
-
}();
|
|
60
|
-
|
|
61
|
-
var Diagnostics = /*#__PURE__*/function () {
|
|
62
|
-
function Diagnostics() {}
|
|
63
|
-
|
|
64
|
-
Diagnostics.send = function send(_name, _data) {
|
|
65
|
-
console.log(_name, _data);
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
return Diagnostics;
|
|
69
|
-
}();
|
|
70
|
-
Diagnostics.active = void 0;
|
|
71
|
-
|
|
72
|
-
var DEV_TOOLS_KEY = '__ELIGIUS_DEV_TOOLS__';
|
|
73
|
-
|
|
74
|
-
var copyFunction = typeof structuredClone !== 'undefined' ? structuredClone : function (original) {
|
|
75
|
-
return JSON.parse(JSON.stringify(original));
|
|
76
|
-
};
|
|
77
|
-
function deepCopy(original) {
|
|
78
|
-
if (isDefined(original)) {
|
|
79
|
-
return copyFunction(original);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return original;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function isPromise(obj) {
|
|
86
|
-
return typeof obj === 'object' && typeof obj.then === 'function';
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
var Action = /*#__PURE__*/function () {
|
|
90
|
-
function Action(name, startOperations, eventbus) {
|
|
91
|
-
this.name = void 0;
|
|
92
|
-
this.startOperations = void 0;
|
|
93
|
-
this.eventbus = void 0;
|
|
94
|
-
this.id = '';
|
|
95
|
-
this.name = name;
|
|
96
|
-
this.startOperations = startOperations;
|
|
97
|
-
this.eventbus = eventbus;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
var _proto = Action.prototype;
|
|
101
|
-
|
|
102
|
-
_proto.start = function start(initOperationData) {
|
|
103
|
-
var _this$name,
|
|
104
|
-
_this = this;
|
|
105
|
-
|
|
106
|
-
Diagnostics.active && Diagnostics.send('eligius-diagnostics-action', ((_this$name = this.name) != null ? _this$name : 'Action') + " begins executing start operations");
|
|
107
|
-
var context = {
|
|
108
|
-
currentIndex: -1,
|
|
109
|
-
eventbus: this.eventbus
|
|
110
|
-
};
|
|
111
|
-
var result = new Promise(function (resolve, reject) {
|
|
112
|
-
_this.executeOperation(_this.startOperations, 0, resolve, reject, initOperationData, context);
|
|
113
|
-
})["catch"](function (e) {
|
|
114
|
-
Diagnostics.active && Diagnostics.send('eligius-diagnostics-action-error', {
|
|
115
|
-
name: name,
|
|
116
|
-
error: e
|
|
117
|
-
});
|
|
118
|
-
console.error("Error in action start '" + _this.name + "'");
|
|
119
|
-
console.error(e);
|
|
120
|
-
throw e;
|
|
121
|
-
});
|
|
122
|
-
return !Diagnostics.active ? result : result.then(function (operationsResult) {
|
|
123
|
-
var _this$name2;
|
|
124
|
-
|
|
125
|
-
Diagnostics.send('eligius-diagnostics-action', ((_this$name2 = _this.name) != null ? _this$name2 : 'Action') + " finished executing start operations");
|
|
126
|
-
return operationsResult;
|
|
127
|
-
});
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
_proto.executeOperation = function executeOperation(operations, idx, resolve, reject, previousOperationData, context) {
|
|
131
|
-
var _this2 = this;
|
|
132
|
-
|
|
133
|
-
if (previousOperationData === void 0) {
|
|
134
|
-
previousOperationData = {};
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if (context.newIndex !== undefined) {
|
|
138
|
-
idx = context.newIndex;
|
|
139
|
-
delete context.newIndex;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
context.currentIndex = idx;
|
|
143
|
-
|
|
144
|
-
if (context.skipNextOperation) {
|
|
145
|
-
if (idx < operations.length) {
|
|
146
|
-
this.executeOperation(operations, ++idx, resolve, reject, previousOperationData, context);
|
|
147
|
-
} else {
|
|
148
|
-
resolve(previousOperationData);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
if (idx < operations.length) {
|
|
153
|
-
var operationInfo = operations[idx];
|
|
154
|
-
var copy = operationInfo.operationData ? deepCopy(operationInfo.operationData) : {};
|
|
155
|
-
var mergedOperationData = Object.assign(previousOperationData, copy);
|
|
156
|
-
Diagnostics.active && Diagnostics.send('eligius-diagnostics-operation', {
|
|
157
|
-
systemName: operationInfo.systemName,
|
|
158
|
-
operationData: operationInfo.operationData,
|
|
159
|
-
context: context
|
|
160
|
-
});
|
|
161
|
-
var operationResult = operationInfo.instance.call(context, mergedOperationData);
|
|
162
|
-
|
|
163
|
-
if (isPromise(operationResult)) {
|
|
164
|
-
operationResult.then(function (resultOperationData) {
|
|
165
|
-
_this2.executeOperation(operations, ++idx, resolve, reject, resultOperationData, context);
|
|
166
|
-
})["catch"](function (error) {
|
|
167
|
-
reject(error);
|
|
168
|
-
});
|
|
169
|
-
} else {
|
|
170
|
-
this.executeOperation(operations, ++idx, resolve, reject, operationResult, context);
|
|
171
|
-
}
|
|
172
|
-
} else {
|
|
173
|
-
resolve(previousOperationData);
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
return Action;
|
|
178
|
-
}();
|
|
179
|
-
|
|
180
9
|
function _regeneratorRuntime() {
|
|
181
10
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
182
11
|
|
|
@@ -590,6 +419,179 @@ function _setPrototypeOf(o, p) {
|
|
|
590
419
|
return _setPrototypeOf(o, p);
|
|
591
420
|
}
|
|
592
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 (value !== null && 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
|
+
|
|
593
595
|
var EndableAction = /*#__PURE__*/function (_Action) {
|
|
594
596
|
_inheritsLoose(EndableAction, _Action);
|
|
595
597
|
|
|
@@ -2046,38 +2048,36 @@ var ctrls = {
|
|
|
2046
2048
|
*/
|
|
2047
2049
|
|
|
2048
2050
|
var EligiusEngine = /*#__PURE__*/function () {
|
|
2049
|
-
function EligiusEngine(configuration, eventbus, timelineProviders,
|
|
2051
|
+
function EligiusEngine(configuration, eventbus, timelineProviders, languageManager) {
|
|
2050
2052
|
this.configuration = void 0;
|
|
2051
2053
|
this.eventbus = void 0;
|
|
2052
2054
|
this.timelineProviders = void 0;
|
|
2053
|
-
this.
|
|
2055
|
+
this.languageManager = void 0;
|
|
2054
2056
|
this._timeLineActionsLookup = {};
|
|
2055
|
-
this.
|
|
2057
|
+
this._eventbusRemovers = [];
|
|
2056
2058
|
this._currentTimelineUri = '';
|
|
2057
2059
|
this._activeTimelineProvider = undefined;
|
|
2058
2060
|
this._lastPosition = -1;
|
|
2059
2061
|
this.configuration = configuration;
|
|
2060
2062
|
this.eventbus = eventbus;
|
|
2061
2063
|
this.timelineProviders = timelineProviders;
|
|
2062
|
-
this.
|
|
2064
|
+
this.languageManager = languageManager;
|
|
2063
2065
|
}
|
|
2064
2066
|
|
|
2065
2067
|
var _proto = EligiusEngine.prototype;
|
|
2066
2068
|
|
|
2067
2069
|
_proto.init = function init() {
|
|
2070
|
+
var _timelines$0$uri;
|
|
2071
|
+
|
|
2068
2072
|
this._createLayoutTemplate();
|
|
2069
2073
|
|
|
2070
2074
|
this._addInitialisationListeners();
|
|
2071
2075
|
|
|
2072
2076
|
var timelines = this.configuration.timelines;
|
|
2073
|
-
this._currentTimelineUri =
|
|
2077
|
+
this._currentTimelineUri = (_timelines$0$uri = timelines == null ? void 0 : timelines[0].uri) != null ? _timelines$0$uri : '';
|
|
2074
2078
|
|
|
2075
2079
|
this._createTimelineLookup();
|
|
2076
2080
|
|
|
2077
|
-
this._eventbusListeners.push(this.eventbus.on(TimelineEventNames.TIME, this._onTimeHandler.bind(this, Math.floor)));
|
|
2078
|
-
|
|
2079
|
-
this._eventbusListeners.push(this.eventbus.on(TimelineEventNames.SEEK, this._onSeekHandler.bind(this, Math.floor)));
|
|
2080
|
-
|
|
2081
2081
|
return this._initializeTimelineProvider();
|
|
2082
2082
|
};
|
|
2083
2083
|
|
|
@@ -2195,9 +2195,10 @@ var EligiusEngine = /*#__PURE__*/function () {
|
|
|
2195
2195
|
return this._cleanUp();
|
|
2196
2196
|
|
|
2197
2197
|
case 2:
|
|
2198
|
+
this.languageManager.destroy();
|
|
2198
2199
|
this._activeTimelineProvider = undefined;
|
|
2199
2200
|
|
|
2200
|
-
this.
|
|
2201
|
+
this._eventbusRemovers.forEach(function (remover) {
|
|
2201
2202
|
return remover();
|
|
2202
2203
|
});
|
|
2203
2204
|
|
|
@@ -2211,7 +2212,7 @@ var EligiusEngine = /*#__PURE__*/function () {
|
|
|
2211
2212
|
container = $(containerSelector);
|
|
2212
2213
|
container.empty();
|
|
2213
2214
|
|
|
2214
|
-
case
|
|
2215
|
+
case 9:
|
|
2215
2216
|
case "end":
|
|
2216
2217
|
return _context3.stop();
|
|
2217
2218
|
}
|
|
@@ -2226,20 +2227,28 @@ var EligiusEngine = /*#__PURE__*/function () {
|
|
|
2226
2227
|
return destroy;
|
|
2227
2228
|
}();
|
|
2228
2229
|
|
|
2230
|
+
_proto._addEventListener = function _addEventListener(eventName, eventHandler, eventTopic) {
|
|
2231
|
+
this._eventbusRemovers.push(this.eventbus.on(eventName, eventHandler, eventTopic));
|
|
2232
|
+
};
|
|
2233
|
+
|
|
2229
2234
|
_proto._addInitialisationListeners = function _addInitialisationListeners() {
|
|
2230
|
-
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));
|
|
2231
2238
|
|
|
2232
|
-
this.
|
|
2239
|
+
this._addEventListener(TimelineEventNames.REQUEST_CURRENT_TIMELINE_POSITION, this._handleRequestTimelinePosition.bind(this, Math.floor));
|
|
2233
2240
|
|
|
2234
|
-
this.
|
|
2241
|
+
this._addEventListener(TimelineEventNames.REQUEST_TIMELINE_CLEANUP, this._handleTimelineComplete.bind(this));
|
|
2235
2242
|
|
|
2236
|
-
this.
|
|
2243
|
+
this._addEventListener(TimelineEventNames.EXECUTE_TIMELINEACTION, this._handleExecuteTimelineAction.bind(this));
|
|
2237
2244
|
|
|
2238
|
-
this.
|
|
2245
|
+
this._addEventListener(TimelineEventNames.RESIZE_TIMELINEACTION, this._resizeTimelineAction.bind(this));
|
|
2239
2246
|
|
|
2240
|
-
this.
|
|
2247
|
+
this._addEventListener(TimelineEventNames.REQUEST_CURRENT_TIMELINE, this._requestCurrentTimeline.bind(this));
|
|
2241
2248
|
|
|
2242
|
-
this.
|
|
2249
|
+
this._addEventListener(TimelineEventNames.TIME, this._onTimeHandler.bind(this, Math.floor));
|
|
2250
|
+
|
|
2251
|
+
this._addEventListener(TimelineEventNames.SEEK, this._onSeekHandler.bind(this, Math.floor));
|
|
2243
2252
|
};
|
|
2244
2253
|
|
|
2245
2254
|
_proto._createTimelineLookup = function _createTimelineLookup() {
|
|
@@ -2700,6 +2709,9 @@ var Eventbus = /*#__PURE__*/function () {
|
|
|
2700
2709
|
};
|
|
2701
2710
|
|
|
2702
2711
|
this.on(eventName, eventHandlerDecorator, eventTopic);
|
|
2712
|
+
return function () {
|
|
2713
|
+
_this2.off(eventName, eventHandlerDecorator, eventTopic);
|
|
2714
|
+
};
|
|
2703
2715
|
};
|
|
2704
2716
|
|
|
2705
2717
|
_proto.off = function off(eventName, eventHandler, eventTopic) {
|
|
@@ -2723,13 +2735,29 @@ var Eventbus = /*#__PURE__*/function () {
|
|
|
2723
2735
|
};
|
|
2724
2736
|
|
|
2725
2737
|
_proto.registerEventlistener = function registerEventlistener(eventbusListener) {
|
|
2738
|
+
var _this3 = this;
|
|
2739
|
+
|
|
2726
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
|
+
};
|
|
2727
2748
|
};
|
|
2728
2749
|
|
|
2729
2750
|
_proto.registerInterceptor = function registerInterceptor(eventName, interceptor, eventTopic) {
|
|
2730
2751
|
var interceptors = this._getEventInterceptors(eventName, eventTopic);
|
|
2731
2752
|
|
|
2732
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
|
+
};
|
|
2733
2761
|
};
|
|
2734
2762
|
|
|
2735
2763
|
_proto._callHandlers = function _callHandlers(eventName, eventTopic, args) {
|
|
@@ -2793,40 +2821,38 @@ var LanguageManager = /*#__PURE__*/function () {
|
|
|
2793
2821
|
function LanguageManager(_currentLanguage, labels, _eventbus) {
|
|
2794
2822
|
this._currentLanguage = void 0;
|
|
2795
2823
|
this._eventbus = void 0;
|
|
2796
|
-
this._labelLookup =
|
|
2797
|
-
this.
|
|
2824
|
+
this._labelLookup = void 0;
|
|
2825
|
+
this._eventbusRemovers = [];
|
|
2798
2826
|
this._currentLanguage = _currentLanguage;
|
|
2799
2827
|
this._eventbus = _eventbus;
|
|
2800
2828
|
|
|
2801
|
-
if (!_currentLanguage
|
|
2802
|
-
throw new Error('language ctor arg cannot
|
|
2803
|
-
}
|
|
2804
|
-
|
|
2805
|
-
if (!labels) {
|
|
2806
|
-
throw new Error('labels ctor arg cannot be null');
|
|
2807
|
-
}
|
|
2808
|
-
|
|
2809
|
-
if (!_eventbus) {
|
|
2810
|
-
throw new Error('eventbus ctor arg cannot be null');
|
|
2829
|
+
if (!_currentLanguage) {
|
|
2830
|
+
throw new Error('language ctor arg cannot have zero length');
|
|
2811
2831
|
}
|
|
2812
2832
|
|
|
2813
2833
|
this._setRootElementLang(_currentLanguage);
|
|
2814
2834
|
|
|
2815
|
-
this._createLabelLookup(labels);
|
|
2835
|
+
this._labelLookup = this._createLabelLookup(labels);
|
|
2816
2836
|
|
|
2817
2837
|
this._addEventbusListeners(_eventbus);
|
|
2818
2838
|
}
|
|
2819
2839
|
|
|
2820
2840
|
var _proto = LanguageManager.prototype;
|
|
2821
2841
|
|
|
2842
|
+
_proto.destroy = function destroy() {
|
|
2843
|
+
this._eventbusRemovers.forEach(function (x) {
|
|
2844
|
+
return x();
|
|
2845
|
+
});
|
|
2846
|
+
};
|
|
2847
|
+
|
|
2822
2848
|
_proto._addEventbusListeners = function _addEventbusListeners(eventbus) {
|
|
2823
|
-
this.
|
|
2849
|
+
this._eventbusRemovers.push(eventbus.on(TimelineEventNames.REQUEST_LABEL_COLLECTION, this._handleRequestLabelCollection.bind(this)));
|
|
2824
2850
|
|
|
2825
|
-
this.
|
|
2851
|
+
this._eventbusRemovers.push(eventbus.on(TimelineEventNames.REQUEST_LABEL_COLLECTIONS, this._handleRequestLabelCollections.bind(this)));
|
|
2826
2852
|
|
|
2827
|
-
this.
|
|
2853
|
+
this._eventbusRemovers.push(eventbus.on(TimelineEventNames.REQUEST_CURRENT_LANGUAGE, this._handleRequestCurrentLanguage.bind(this)));
|
|
2828
2854
|
|
|
2829
|
-
this.
|
|
2855
|
+
this._eventbusRemovers.push(eventbus.on(TimelineEventNames.LANGUAGE_CHANGE, this._handleLanguageChange.bind(this)));
|
|
2830
2856
|
};
|
|
2831
2857
|
|
|
2832
2858
|
_proto._handleRequestCurrentLanguage = function _handleRequestCurrentLanguage(resultCallback) {
|
|
@@ -2877,11 +2903,10 @@ var LanguageManager = /*#__PURE__*/function () {
|
|
|
2877
2903
|
};
|
|
2878
2904
|
|
|
2879
2905
|
_proto._createLabelLookup = function _createLabelLookup(labels) {
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
});
|
|
2906
|
+
return labels.reduce(function (acc, label) {
|
|
2907
|
+
acc[label.id] = label.labels;
|
|
2908
|
+
return acc;
|
|
2909
|
+
}, {});
|
|
2885
2910
|
};
|
|
2886
2911
|
|
|
2887
2912
|
return LanguageManager;
|
|
@@ -2889,47 +2914,93 @@ var LanguageManager = /*#__PURE__*/function () {
|
|
|
2889
2914
|
|
|
2890
2915
|
var EngineFactory = /*#__PURE__*/function () {
|
|
2891
2916
|
function EngineFactory(importer, windowRef, options) {
|
|
2892
|
-
var _options$devtools;
|
|
2917
|
+
var _options$eventbus, _options$devtools;
|
|
2893
2918
|
|
|
2894
|
-
this.
|
|
2895
|
-
this.
|
|
2896
|
-
this.
|
|
2897
|
-
this.
|
|
2898
|
-
this.
|
|
2899
|
-
this.
|
|
2900
|
-
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();
|
|
2901
2926
|
Diagnostics.active = (_options$devtools = options == null ? void 0 : options.devtools) != null ? _options$devtools : false;
|
|
2902
2927
|
|
|
2903
2928
|
if (Diagnostics.active) {
|
|
2904
|
-
this._initializeDevtools(this.
|
|
2929
|
+
this._initializeDevtools(this._eventbus);
|
|
2905
2930
|
}
|
|
2906
2931
|
|
|
2907
|
-
this.
|
|
2908
|
-
|
|
2909
|
-
this.
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
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
|
+
});
|
|
2913
2954
|
}
|
|
2914
2955
|
|
|
2915
2956
|
var _proto = EngineFactory.prototype;
|
|
2916
2957
|
|
|
2917
2958
|
_proto._handleSpacePress = function _handleSpacePress(keyboardEvent, _hotkeysEvent) {
|
|
2918
2959
|
keyboardEvent.preventDefault();
|
|
2919
|
-
|
|
2960
|
+
|
|
2961
|
+
this._eventbus.broadcast(TimelineEventNames.PLAY_TOGGLE_REQUEST);
|
|
2962
|
+
|
|
2920
2963
|
return false;
|
|
2921
2964
|
};
|
|
2922
2965
|
|
|
2923
2966
|
_proto._initializeDevtools = function _initializeDevtools(eventbus) {
|
|
2967
|
+
var _this = this;
|
|
2968
|
+
|
|
2924
2969
|
var diagnosticInfo = window[DEV_TOOLS_KEY];
|
|
2925
2970
|
|
|
2926
2971
|
if (diagnosticInfo) {
|
|
2927
2972
|
var agent = diagnosticInfo.agent;
|
|
2928
|
-
var eventbusListener = new DevToolEventListener(agent);
|
|
2929
|
-
eventbus.registerEventlistener(eventbusListener);
|
|
2930
2973
|
|
|
2931
|
-
|
|
2932
|
-
|
|
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);
|
|
2933
3004
|
|
|
2934
3005
|
try {
|
|
2935
3006
|
agent.postMessage(name, message);
|
|
@@ -2942,35 +3013,37 @@ var EngineFactory = /*#__PURE__*/function () {
|
|
|
2942
3013
|
|
|
2943
3014
|
Diagnostics.send('eligius-diagnostics-factory', 'Diagnostics initialized');
|
|
2944
3015
|
} else {
|
|
2945
|
-
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.");
|
|
2946
3017
|
}
|
|
2947
3018
|
};
|
|
2948
3019
|
|
|
2949
3020
|
_proto.destroy = function destroy() {
|
|
2950
|
-
this.
|
|
2951
|
-
|
|
3021
|
+
this._eventRemovers.forEach(function (x) {
|
|
3022
|
+
return x();
|
|
3023
|
+
});
|
|
2952
3024
|
};
|
|
2953
3025
|
|
|
2954
3026
|
_proto._resizeHandler = function _resizeHandler() {
|
|
2955
|
-
var
|
|
3027
|
+
var _this2 = this;
|
|
2956
3028
|
|
|
2957
|
-
if (this.
|
|
2958
|
-
clearTimeout(this.
|
|
3029
|
+
if (this._resizeTimeout) {
|
|
3030
|
+
clearTimeout(this._resizeTimeout);
|
|
3031
|
+
this._resizeTimeout = -1;
|
|
2959
3032
|
}
|
|
2960
3033
|
|
|
2961
|
-
this.
|
|
2962
|
-
|
|
3034
|
+
this._resizeTimeout = setTimeout(function () {
|
|
3035
|
+
_this2._eventbus.broadcast(TimelineEventNames.RESIZE);
|
|
2963
3036
|
}, 200);
|
|
2964
3037
|
};
|
|
2965
3038
|
|
|
2966
3039
|
_proto._importSystemEntryWithEventbusDependency = function _importSystemEntryWithEventbusDependency(systemName) {
|
|
2967
3040
|
var ctor = this._importSystemEntry(systemName);
|
|
2968
3041
|
|
|
2969
|
-
return new ctor(this.
|
|
3042
|
+
return new ctor(this._eventbus);
|
|
2970
3043
|
};
|
|
2971
3044
|
|
|
2972
3045
|
_proto._importSystemEntry = function _importSystemEntry(systemName) {
|
|
2973
|
-
return this.
|
|
3046
|
+
return this._importer["import"](systemName)[systemName];
|
|
2974
3047
|
};
|
|
2975
3048
|
|
|
2976
3049
|
_proto._requestInstanceHandler = function _requestInstanceHandler(systemName, resultCallback) {
|
|
@@ -2982,7 +3055,7 @@ var EngineFactory = /*#__PURE__*/function () {
|
|
|
2982
3055
|
};
|
|
2983
3056
|
|
|
2984
3057
|
_proto._requestActionHandler = function _requestActionHandler(systemName, resultCallback) {
|
|
2985
|
-
var action = this.
|
|
3058
|
+
var action = this._actionsLookup[systemName];
|
|
2986
3059
|
|
|
2987
3060
|
if (action) {
|
|
2988
3061
|
resultCallback(action);
|
|
@@ -3003,29 +3076,31 @@ var EngineFactory = /*#__PURE__*/function () {
|
|
|
3003
3076
|
|
|
3004
3077
|
if ((_configuration$eventA = configuration.eventActions) != null && _configuration$eventA.length) {
|
|
3005
3078
|
actionRegistryListener = new ActionRegistryEventbusListener();
|
|
3006
|
-
|
|
3079
|
+
|
|
3080
|
+
this._eventRemovers.push(this._eventbus.registerEventlistener(actionRegistryListener));
|
|
3007
3081
|
}
|
|
3008
3082
|
|
|
3009
|
-
this.
|
|
3010
|
-
|
|
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);
|
|
3011
3086
|
|
|
3012
3087
|
var _resolver$process = resolver.process(configuration, actionRegistryListener),
|
|
3013
3088
|
actionLookup = _resolver$process[0],
|
|
3014
3089
|
resolvedConfiguration = _resolver$process[1];
|
|
3015
3090
|
|
|
3016
|
-
this.
|
|
3091
|
+
this._actionsLookup = actionLookup;
|
|
3017
3092
|
|
|
3018
|
-
var timelineProviders = this._createTimelineProviders(resolvedConfiguration, this.
|
|
3093
|
+
var timelineProviders = this._createTimelineProviders(resolvedConfiguration, this._eventbus);
|
|
3019
3094
|
|
|
3020
3095
|
var language = configuration.language,
|
|
3021
3096
|
labels = configuration.labels;
|
|
3022
|
-
var languageManager = new LanguageManager(language, labels, this.
|
|
3023
|
-
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);
|
|
3024
3099
|
return engineInstance;
|
|
3025
3100
|
};
|
|
3026
3101
|
|
|
3027
3102
|
_proto._createTimelineProviders = function _createTimelineProviders(configuration, eventbus) {
|
|
3028
|
-
var
|
|
3103
|
+
var _this3 = this;
|
|
3029
3104
|
|
|
3030
3105
|
var timelineProviderSettings = configuration.timelineProviderSettings;
|
|
3031
3106
|
var result = Object.entries(timelineProviderSettings).reduce(function (acc, _ref) {
|
|
@@ -3036,7 +3111,7 @@ var EngineFactory = /*#__PURE__*/function () {
|
|
|
3036
3111
|
return acc;
|
|
3037
3112
|
}
|
|
3038
3113
|
|
|
3039
|
-
var timelineProviderClass =
|
|
3114
|
+
var timelineProviderClass = _this3._importSystemEntry(settings.systemName);
|
|
3040
3115
|
|
|
3041
3116
|
acc[timelineType] = {
|
|
3042
3117
|
id: settings.id,
|