eligius 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/action/timeline-action.d.ts +4 -2
- package/dist/action/types.d.ts +1 -1
- package/dist/configuration/api/configuration-factory.d.ts +10 -7
- package/dist/configuration/api/index.d.ts +2 -0
- package/dist/configuration/api/label-editor.d.ts +11 -0
- package/dist/configuration/api/subtitle-converter.d.ts +11 -0
- package/dist/configuration/api/subtitle-editor.d.ts +14 -0
- package/dist/controllers/label-controller.d.ts +1 -0
- package/dist/controllers/subtitles-controller.d.ts +3 -3
- package/dist/eligius-engine.d.ts +11 -3
- package/dist/eligius.cjs.development.js +458 -58
- 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 +455 -59
- package/dist/eligius.esm.js.map +1 -1
- package/dist/operation/get-attributes-from-element.d.ts +20 -0
- package/dist/operation/helper/globals.d.ts +3 -2
- package/dist/operation/index.d.ts +2 -0
- package/dist/operation/log.d.ts +1 -1
- package/dist/operation/metadata/get-attributes-from-element.d.ts +4 -0
- package/dist/operation/metadata/index.d.ts +2 -0
- package/dist/operation/metadata/set-data.d.ts +4 -0
- package/dist/operation/set-data.d.ts +21 -0
- package/dist/timeline-event-names.d.ts +0 -2
- package/dist/types.d.ts +9 -0
- package/package.json +2 -2
|
@@ -738,7 +738,7 @@ var TimelineAction = /*#__PURE__*/function (_EndableAction) {
|
|
|
738
738
|
|
|
739
739
|
_this = _EndableAction.call(this, name, startOperations, endOperations, eventBus) || this;
|
|
740
740
|
_this.duration = void 0;
|
|
741
|
-
_this.
|
|
741
|
+
_this._active = false;
|
|
742
742
|
_this.duration = duration;
|
|
743
743
|
return _this;
|
|
744
744
|
}
|
|
@@ -747,7 +747,7 @@ var TimelineAction = /*#__PURE__*/function (_EndableAction) {
|
|
|
747
747
|
|
|
748
748
|
_proto.start = function start(initOperationData) {
|
|
749
749
|
if (!this.active || this.duration.end < 0) {
|
|
750
|
-
this.
|
|
750
|
+
this._active = this.endOperations.length > 0;
|
|
751
751
|
return _EndableAction.prototype.start.call(this, initOperationData);
|
|
752
752
|
}
|
|
753
753
|
|
|
@@ -755,10 +755,17 @@ var TimelineAction = /*#__PURE__*/function (_EndableAction) {
|
|
|
755
755
|
};
|
|
756
756
|
|
|
757
757
|
_proto.end = function end(initOperationData) {
|
|
758
|
-
this.
|
|
758
|
+
this._active = false;
|
|
759
759
|
return _EndableAction.prototype.end.call(this, initOperationData);
|
|
760
760
|
};
|
|
761
761
|
|
|
762
|
+
_createClass(TimelineAction, [{
|
|
763
|
+
key: "active",
|
|
764
|
+
get: function get() {
|
|
765
|
+
return this._active;
|
|
766
|
+
}
|
|
767
|
+
}]);
|
|
768
|
+
|
|
762
769
|
return TimelineAction;
|
|
763
770
|
}(EndableAction);
|
|
764
771
|
|
|
@@ -1136,6 +1143,10 @@ function getPropertyChainValue(propertyChain, sourceObject) {
|
|
|
1136
1143
|
var currentInstance = sourceObject;
|
|
1137
1144
|
var suffix = null;
|
|
1138
1145
|
propertyChain.forEach(function (prop, index) {
|
|
1146
|
+
if (!currentInstance) {
|
|
1147
|
+
throw new Error("Property chain '" + propertyChain.join('.') + "' cannot be resolved.");
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1139
1150
|
if (index === propertyChain.length - 1) {
|
|
1140
1151
|
var parts = prop.split('+');
|
|
1141
1152
|
|
|
@@ -1417,8 +1428,6 @@ TimelineEventNames.BEFORE_REQUEST_TIMELINE_URI = 'before-request-timeline-uri';
|
|
|
1417
1428
|
TimelineEventNames.REQUEST_ENGINE_ROOT = 'request-engine-root';
|
|
1418
1429
|
TimelineEventNames.REQUEST_CURRENT_TIMELINE_POSITION = 'request-current-timeline-position';
|
|
1419
1430
|
TimelineEventNames.REQUEST_TIMELINE_CLEANUP = 'request-timeline-cleanup';
|
|
1420
|
-
TimelineEventNames.EXECUTE_TIMELINEACTION = 'execute-timelineaction';
|
|
1421
|
-
TimelineEventNames.RESIZE_TIMELINEACTION = 'resize-timelineaction';
|
|
1422
1431
|
TimelineEventNames.REQUEST_LABEL_COLLECTION = 'request-label-collection';
|
|
1423
1432
|
TimelineEventNames.REQUEST_LABEL_COLLECTIONS = 'request-label-collections';
|
|
1424
1433
|
TimelineEventNames.REQUEST_CURRENT_LANGUAGE = 'request-current-language';
|
|
@@ -1514,6 +1523,24 @@ var extendController$1 = function extendController(operationData) {
|
|
|
1514
1523
|
return operationData;
|
|
1515
1524
|
};
|
|
1516
1525
|
|
|
1526
|
+
/**
|
|
1527
|
+
* This operation retrieves the values for the specified attribute names from the given selected element.
|
|
1528
|
+
*/
|
|
1529
|
+
var getAttributesFromElement$1 = function getAttributesFromElement(operationData) {
|
|
1530
|
+
var selectedElement = operationData.selectedElement,
|
|
1531
|
+
attributeNames = operationData.attributeNames;
|
|
1532
|
+
operationData.attributeValues = attributeNames.reduce(function (acc, attrName) {
|
|
1533
|
+
if (attrName !== 'value') {
|
|
1534
|
+
acc[attrName] = selectedElement == null ? void 0 : selectedElement.attr(attrName);
|
|
1535
|
+
} else {
|
|
1536
|
+
acc[attrName] = selectedElement == null ? void 0 : selectedElement.val();
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1539
|
+
return acc;
|
|
1540
|
+
}, {});
|
|
1541
|
+
return operationData;
|
|
1542
|
+
};
|
|
1543
|
+
|
|
1517
1544
|
/**
|
|
1518
1545
|
* This operation retrieves the controller instance with the specified name that is assigned to the given selected element.
|
|
1519
1546
|
*
|
|
@@ -1891,20 +1918,18 @@ var loadJSON$1 = /*#__PURE__*/function () {
|
|
|
1891
1918
|
}();
|
|
1892
1919
|
|
|
1893
1920
|
/**
|
|
1894
|
-
* This operation logs the current operation data and context to the console.
|
|
1921
|
+
* This operation logs the current operation data, global data and context to the console.
|
|
1895
1922
|
*
|
|
1896
1923
|
* @param operationData
|
|
1897
1924
|
* @returns
|
|
1898
1925
|
*/
|
|
1899
1926
|
|
|
1900
1927
|
var log$1 = function log(operationData) {
|
|
1928
|
+
var globalData = getGlobals();
|
|
1901
1929
|
console.group('Operation info');
|
|
1902
|
-
console.
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
console.dir({
|
|
1906
|
-
operationData: deepCopy(operationData)
|
|
1907
|
-
});
|
|
1930
|
+
console.log('context', this);
|
|
1931
|
+
console.log('operationData', operationData);
|
|
1932
|
+
console.log('globalData', globalData);
|
|
1908
1933
|
console.groupEnd();
|
|
1909
1934
|
return operationData;
|
|
1910
1935
|
};
|
|
@@ -2156,6 +2181,7 @@ function findElementBySelector(root, selector) {
|
|
|
2156
2181
|
|
|
2157
2182
|
|
|
2158
2183
|
var selectElement$1 = function selectElement(operationData) {
|
|
2184
|
+
operationData.selector = resolveExternalPropertyChain(operationData, this, operationData.selector);
|
|
2159
2185
|
var selector = operationData.selector,
|
|
2160
2186
|
_operationData$useSel = operationData.useSelectedElementAsRoot,
|
|
2161
2187
|
useSelectedElementAsRoot = _operationData$useSel === void 0 ? false : _operationData$useSel;
|
|
@@ -2178,6 +2204,59 @@ var selectElement$1 = function selectElement(operationData) {
|
|
|
2178
2204
|
return operationData;
|
|
2179
2205
|
};
|
|
2180
2206
|
|
|
2207
|
+
/**
|
|
2208
|
+
* This operation assigns the specified properties to the specified data targets.
|
|
2209
|
+
*
|
|
2210
|
+
* @example The various ways of assigning data
|
|
2211
|
+
* ```ts
|
|
2212
|
+
* setData({
|
|
2213
|
+
* 'operationdata.foo': 'context.currentItem', // context.currentItem will be assigned to operationdata.foo
|
|
2214
|
+
* 'globaldata.foo': 'context.currentItem', // context.currentItem will be assigned to globaldata.foo
|
|
2215
|
+
* 'context.newIndex': 100, // The constant 100 will be assigned to context.newIndex
|
|
2216
|
+
* })
|
|
2217
|
+
* ```
|
|
2218
|
+
*
|
|
2219
|
+
* @param operationData
|
|
2220
|
+
* @returns
|
|
2221
|
+
*/
|
|
2222
|
+
|
|
2223
|
+
var setData$1 = function setData(operationData) {
|
|
2224
|
+
var properties = operationData.properties;
|
|
2225
|
+
delete operationData.properties;
|
|
2226
|
+
resolveTargets(properties, operationData, this);
|
|
2227
|
+
return operationData;
|
|
2228
|
+
};
|
|
2229
|
+
|
|
2230
|
+
function resolveTargets(data, operationData, context) {
|
|
2231
|
+
var propertyChains = Object.keys(data);
|
|
2232
|
+
return propertyChains.forEach(function (item) {
|
|
2233
|
+
var _path$shift$toLowerCa, _path$shift, _path$pop;
|
|
2234
|
+
|
|
2235
|
+
var path = item.split('.');
|
|
2236
|
+
var rootTarget = (_path$shift$toLowerCa = (_path$shift = path.shift()) == null ? void 0 : _path$shift.toLowerCase()) != null ? _path$shift$toLowerCa : '';
|
|
2237
|
+
|
|
2238
|
+
if (!isDataTarget(rootTarget)) {
|
|
2239
|
+
throw new Error("Unrecognized target: " + rootTarget + ", known targets are: " + knownTargets.join(', '));
|
|
2240
|
+
}
|
|
2241
|
+
|
|
2242
|
+
var property = (_path$pop = path.pop()) != null ? _path$pop : '';
|
|
2243
|
+
var propertyValue = resolveExternalPropertyChain(operationData, context, data[item]);
|
|
2244
|
+
var targets = {
|
|
2245
|
+
context: context,
|
|
2246
|
+
operationdata: operationData,
|
|
2247
|
+
globaldata: getGlobals()
|
|
2248
|
+
};
|
|
2249
|
+
var propertyTarget = getPropertyChainValue(path, targets[rootTarget]);
|
|
2250
|
+
propertyTarget[property] = propertyValue;
|
|
2251
|
+
});
|
|
2252
|
+
}
|
|
2253
|
+
|
|
2254
|
+
var knownTargets = ['context', 'operationdata', 'globaldata'];
|
|
2255
|
+
|
|
2256
|
+
function isDataTarget(value) {
|
|
2257
|
+
return knownTargets.includes(value);
|
|
2258
|
+
}
|
|
2259
|
+
|
|
2181
2260
|
/**
|
|
2182
2261
|
* This operation sets the specified set of attributes on the given selected element.
|
|
2183
2262
|
*
|
|
@@ -2506,6 +2585,7 @@ var ops = {
|
|
|
2506
2585
|
endLoop: endLoop$1,
|
|
2507
2586
|
endWhen: endWhen$1,
|
|
2508
2587
|
extendController: extendController$1,
|
|
2588
|
+
getAttributesFromElement: getAttributesFromElement$1,
|
|
2509
2589
|
getControllerFromElement: getControllerFromElement$1,
|
|
2510
2590
|
getControllerInstance: getControllerInstance$1,
|
|
2511
2591
|
getElementDimensions: getElementDimensions$1,
|
|
@@ -2524,6 +2604,7 @@ var ops = {
|
|
|
2524
2604
|
requestAction: requestAction$1,
|
|
2525
2605
|
resizeAction: resizeAction$1,
|
|
2526
2606
|
selectElement: selectElement$1,
|
|
2607
|
+
setData: setData$1,
|
|
2527
2608
|
setElementAttributes: setElementAttributes$1,
|
|
2528
2609
|
setElementContent: setElementContent$1,
|
|
2529
2610
|
setGlobalData: setGlobalData$1,
|
|
@@ -3051,6 +3132,53 @@ var OperationEditor = /*#__PURE__*/function () {
|
|
|
3051
3132
|
return OperationEditor;
|
|
3052
3133
|
}();
|
|
3053
3134
|
|
|
3135
|
+
var LabelEditor = /*#__PURE__*/function () {
|
|
3136
|
+
function LabelEditor(factory, languageLabel) {
|
|
3137
|
+
this.factory = void 0;
|
|
3138
|
+
this.languageLabel = void 0;
|
|
3139
|
+
this.factory = factory;
|
|
3140
|
+
this.languageLabel = languageLabel;
|
|
3141
|
+
}
|
|
3142
|
+
|
|
3143
|
+
var _proto = LabelEditor.prototype;
|
|
3144
|
+
|
|
3145
|
+
_proto._internalGetLabel = function _internalGetLabel(languageCode) {
|
|
3146
|
+
return this.languageLabel.labels.find(function (x) {
|
|
3147
|
+
return x.languageCode === languageCode;
|
|
3148
|
+
});
|
|
3149
|
+
};
|
|
3150
|
+
|
|
3151
|
+
_proto.setLabel = function setLabel(languageCode, translation) {
|
|
3152
|
+
var label = this._internalGetLabel(languageCode);
|
|
3153
|
+
|
|
3154
|
+
if (label) ; else {
|
|
3155
|
+
throw new Error("No label found for language code '" + languageCode + "'");
|
|
3156
|
+
}
|
|
3157
|
+
|
|
3158
|
+
return this;
|
|
3159
|
+
};
|
|
3160
|
+
|
|
3161
|
+
_proto.removeLabel = function removeLabel(languageCode) {
|
|
3162
|
+
var idx = this.languageLabel.labels.findIndex(function (x) {
|
|
3163
|
+
return x.languageCode === languageCode;
|
|
3164
|
+
});
|
|
3165
|
+
|
|
3166
|
+
if (idx > -1) {
|
|
3167
|
+
this.languageLabel.labels.splice(idx, 1);
|
|
3168
|
+
} else {
|
|
3169
|
+
throw new Error("No label found for language code '" + languageCode + "'");
|
|
3170
|
+
}
|
|
3171
|
+
|
|
3172
|
+
return this;
|
|
3173
|
+
};
|
|
3174
|
+
|
|
3175
|
+
_proto.end = function end() {
|
|
3176
|
+
return this.factory;
|
|
3177
|
+
};
|
|
3178
|
+
|
|
3179
|
+
return LabelEditor;
|
|
3180
|
+
}();
|
|
3181
|
+
|
|
3054
3182
|
// https://gist.github.com/jakearchibald/cb03f15670817001b1157e62a076fe95
|
|
3055
3183
|
function animationInterval(ms, signal, callback) {
|
|
3056
3184
|
var _document$timeline$cu, _document, _document$timeline;
|
|
@@ -3370,7 +3498,7 @@ var TimelineProviderSettingsEditor = /*#__PURE__*/function () {
|
|
|
3370
3498
|
}();
|
|
3371
3499
|
|
|
3372
3500
|
/**
|
|
3373
|
-
* This class offers a fluent and strongly typed DSL for creating Eligius configurations.
|
|
3501
|
+
* This class offers a fluent, extensible and strongly typed DSL for creating Eligius configurations.
|
|
3374
3502
|
*
|
|
3375
3503
|
* @example Building a configuration using the factory
|
|
3376
3504
|
* To initialize a basic configuration to start off of:
|
|
@@ -3523,10 +3651,7 @@ var ConfigurationFactory = /*#__PURE__*/function () {
|
|
|
3523
3651
|
|
|
3524
3652
|
if (callBack) {
|
|
3525
3653
|
var newConfig = callBack.call(this, copy);
|
|
3526
|
-
|
|
3527
|
-
if (newConfig) {
|
|
3528
|
-
this.configuration = newConfig;
|
|
3529
|
-
}
|
|
3654
|
+
this.configuration = deepCopy(newConfig);
|
|
3530
3655
|
}
|
|
3531
3656
|
|
|
3532
3657
|
return copy;
|
|
@@ -3680,6 +3805,20 @@ var ConfigurationFactory = /*#__PURE__*/function () {
|
|
|
3680
3805
|
return translation;
|
|
3681
3806
|
};
|
|
3682
3807
|
|
|
3808
|
+
_proto.editLabel = function editLabel(id) {
|
|
3809
|
+
var _this$configuration$l;
|
|
3810
|
+
|
|
3811
|
+
var label = (_this$configuration$l = this.configuration.labels) == null ? void 0 : _this$configuration$l.find(function (x) {
|
|
3812
|
+
return x.id === id;
|
|
3813
|
+
});
|
|
3814
|
+
|
|
3815
|
+
if (label) {
|
|
3816
|
+
return new LabelEditor(this, label);
|
|
3817
|
+
} else {
|
|
3818
|
+
throw new Error("Language label with id '" + id + "' not found");
|
|
3819
|
+
}
|
|
3820
|
+
};
|
|
3821
|
+
|
|
3683
3822
|
_proto.addLabel = function addLabel(id, code, translation) {
|
|
3684
3823
|
var labels = this._initializeCollection(this.configuration, 'labels');
|
|
3685
3824
|
|
|
@@ -3691,6 +3830,17 @@ var ConfigurationFactory = /*#__PURE__*/function () {
|
|
|
3691
3830
|
return this;
|
|
3692
3831
|
};
|
|
3693
3832
|
|
|
3833
|
+
_proto.addLabels = function addLabels(id, translations) {
|
|
3834
|
+
var _this = this;
|
|
3835
|
+
|
|
3836
|
+
Object.entries(translations).forEach(function (_ref2) {
|
|
3837
|
+
var code = _ref2[0],
|
|
3838
|
+
translation = _ref2[1];
|
|
3839
|
+
return _this.addLabel(id, code, translation);
|
|
3840
|
+
});
|
|
3841
|
+
return this;
|
|
3842
|
+
};
|
|
3843
|
+
|
|
3694
3844
|
_proto.removeLabel = function removeLabel(id) {
|
|
3695
3845
|
var idx = this.configuration.labels.findIndex(function (x) {
|
|
3696
3846
|
return x.id === id;
|
|
@@ -3845,7 +3995,7 @@ var EventListenerController = /*#__PURE__*/function () {
|
|
|
3845
3995
|
var actionOperationData = this.operationData.actionOperationData ? deepCopy(this.operationData.actionOperationData) : {};
|
|
3846
3996
|
|
|
3847
3997
|
if (event.target) {
|
|
3848
|
-
actionOperationData.
|
|
3998
|
+
actionOperationData.eventTarget = event.target;
|
|
3849
3999
|
}
|
|
3850
4000
|
|
|
3851
4001
|
this._executeAction(this.actionInstanceInfos, actionOperationData, 0);
|
|
@@ -3951,7 +4101,11 @@ var LabelController = /*#__PURE__*/function () {
|
|
|
3951
4101
|
var _this2 = this;
|
|
3952
4102
|
|
|
3953
4103
|
eventbus.broadcast(TimelineEventNames.REQUEST_LABEL_COLLECTION, [labelId, function (labelCollection) {
|
|
3954
|
-
|
|
4104
|
+
if (labelCollection) {
|
|
4105
|
+
_this2._createTextDataLookup(labelCollection);
|
|
4106
|
+
} else {
|
|
4107
|
+
throw new Error("Label id '" + labelId + "' does not exist!");
|
|
4108
|
+
}
|
|
3955
4109
|
}]);
|
|
3956
4110
|
};
|
|
3957
4111
|
|
|
@@ -3959,7 +4113,17 @@ var LabelController = /*#__PURE__*/function () {
|
|
|
3959
4113
|
if (this.currentLanguage) {
|
|
3960
4114
|
var _this$operationData;
|
|
3961
4115
|
|
|
3962
|
-
|
|
4116
|
+
var text = this.labelData[this.currentLanguage];
|
|
4117
|
+
|
|
4118
|
+
if (!((_this$operationData = this.operationData) != null && _this$operationData.attributeName)) {
|
|
4119
|
+
var _this$operationData2;
|
|
4120
|
+
|
|
4121
|
+
(_this$operationData2 = this.operationData) == null ? void 0 : _this$operationData2.selectedElement.html(text);
|
|
4122
|
+
} else {
|
|
4123
|
+
var _this$operationData3, _this$operationData4;
|
|
4124
|
+
|
|
4125
|
+
(_this$operationData3 = this.operationData) == null ? void 0 : _this$operationData3.selectedElement.attr((_this$operationData4 = this.operationData) == null ? void 0 : _this$operationData4.attributeName, text);
|
|
4126
|
+
}
|
|
3963
4127
|
}
|
|
3964
4128
|
};
|
|
3965
4129
|
|
|
@@ -4733,7 +4897,7 @@ var SubtitlesController = /*#__PURE__*/function () {
|
|
|
4733
4897
|
|
|
4734
4898
|
for (var j = 0, jj = subtitleData.length; j < jj; j++) {
|
|
4735
4899
|
var subs = subtitleData[j];
|
|
4736
|
-
titleLanguageLookup[subs.
|
|
4900
|
+
titleLanguageLookup[subs.languageCode] = subs.titles[i].text;
|
|
4737
4901
|
}
|
|
4738
4902
|
|
|
4739
4903
|
subtitleTimeLookup[titles[i].duration.start] = this.setTitle.bind(this, container, titleLanguageLookup);
|
|
@@ -4947,6 +5111,23 @@ function extendController() {
|
|
|
4947
5111
|
};
|
|
4948
5112
|
}
|
|
4949
5113
|
|
|
5114
|
+
function getAttributesFromElement() {
|
|
5115
|
+
return {
|
|
5116
|
+
description: 'Retrieves the values for the specified attribute names from the given selected element.',
|
|
5117
|
+
dependentProperties: ['selectedElement'],
|
|
5118
|
+
properties: {
|
|
5119
|
+
attributeNames: {
|
|
5120
|
+
type: 'ParameterType:array',
|
|
5121
|
+
itemType: 'ParameterType:string',
|
|
5122
|
+
required: true
|
|
5123
|
+
}
|
|
5124
|
+
},
|
|
5125
|
+
outputProperties: {
|
|
5126
|
+
attributeValues: 'ParameterType:object'
|
|
5127
|
+
}
|
|
5128
|
+
};
|
|
5129
|
+
}
|
|
5130
|
+
|
|
4950
5131
|
function getControllerFromElement() {
|
|
4951
5132
|
return {
|
|
4952
5133
|
description: 'Retrieves the specified controller from the current element',
|
|
@@ -5183,6 +5364,18 @@ function selectElement() {
|
|
|
5183
5364
|
};
|
|
5184
5365
|
}
|
|
5185
5366
|
|
|
5367
|
+
function setData() {
|
|
5368
|
+
return {
|
|
5369
|
+
description: 'Copies the specified values to the specified targets',
|
|
5370
|
+
properties: {
|
|
5371
|
+
properties: {
|
|
5372
|
+
type: 'ParameterType:object',
|
|
5373
|
+
required: true
|
|
5374
|
+
}
|
|
5375
|
+
}
|
|
5376
|
+
};
|
|
5377
|
+
}
|
|
5378
|
+
|
|
5186
5379
|
function setElementAttributes() {
|
|
5187
5380
|
return {
|
|
5188
5381
|
description: 'Sets the given attributes on the selected element',
|
|
@@ -5336,6 +5529,7 @@ var operationMetadata = {
|
|
|
5336
5529
|
endLoop: endLoop,
|
|
5337
5530
|
endWhen: endWhen,
|
|
5338
5531
|
extendController: extendController,
|
|
5532
|
+
getAttributesFromElement: getAttributesFromElement,
|
|
5339
5533
|
getControllerFromElement: getControllerFromElement,
|
|
5340
5534
|
getControllerInstance: getControllerInstance,
|
|
5341
5535
|
getElementDimensions: getElementDimensions,
|
|
@@ -5354,6 +5548,7 @@ var operationMetadata = {
|
|
|
5354
5548
|
requestAction: requestAction,
|
|
5355
5549
|
resizeAction: resizeAction,
|
|
5356
5550
|
selectElement: selectElement,
|
|
5551
|
+
setData: setData,
|
|
5357
5552
|
setElementAttributes: setElementAttributes,
|
|
5358
5553
|
setElementContent: setElementContent,
|
|
5359
5554
|
setGlobalData: setGlobalData,
|
|
@@ -5418,6 +5613,187 @@ var TimeLineEventNamesProvider = /*#__PURE__*/function () {
|
|
|
5418
5613
|
return TimeLineEventNamesProvider;
|
|
5419
5614
|
}();
|
|
5420
5615
|
|
|
5616
|
+
/**
|
|
5617
|
+
* This class converts an AVID subtitle file to an `ISubtitle` array.
|
|
5618
|
+
*/
|
|
5619
|
+
var SubtitleImporter = /*#__PURE__*/function () {
|
|
5620
|
+
function SubtitleImporter() {}
|
|
5621
|
+
|
|
5622
|
+
var _proto = SubtitleImporter.prototype;
|
|
5623
|
+
|
|
5624
|
+
_proto.importSubtitles = function importSubtitles(rawLines) {
|
|
5625
|
+
var _this = this;
|
|
5626
|
+
|
|
5627
|
+
var result = [];
|
|
5628
|
+
var lines = [];
|
|
5629
|
+
|
|
5630
|
+
for (var i = 0, l = rawLines.length; i < l; i++) {
|
|
5631
|
+
var rawLine = this.stripNewlineChars(rawLines[i].toString());
|
|
5632
|
+
|
|
5633
|
+
if (this.isValidLine(rawLine)) {
|
|
5634
|
+
lines.push(rawLine);
|
|
5635
|
+
}
|
|
5636
|
+
}
|
|
5637
|
+
|
|
5638
|
+
if (lines[0] === '') {
|
|
5639
|
+
lines.splice(0, 1);
|
|
5640
|
+
}
|
|
5641
|
+
|
|
5642
|
+
while (lines[lines.length - 1] === '') {
|
|
5643
|
+
lines.pop();
|
|
5644
|
+
}
|
|
5645
|
+
|
|
5646
|
+
var caption = null;
|
|
5647
|
+
lines.forEach(function (line) {
|
|
5648
|
+
if (line.length === 0 || !caption) {
|
|
5649
|
+
caption = {
|
|
5650
|
+
text: ''
|
|
5651
|
+
};
|
|
5652
|
+
|
|
5653
|
+
if (line.length) {
|
|
5654
|
+
//this happens for first caption only
|
|
5655
|
+
caption.duration = _this.convertDuration(line);
|
|
5656
|
+
}
|
|
5657
|
+
|
|
5658
|
+
result.push(caption);
|
|
5659
|
+
} else {
|
|
5660
|
+
if (!caption.hasOwnProperty('duration')) {
|
|
5661
|
+
caption.duration = _this.convertDuration(line);
|
|
5662
|
+
} else {
|
|
5663
|
+
caption.text += line;
|
|
5664
|
+
}
|
|
5665
|
+
}
|
|
5666
|
+
});
|
|
5667
|
+
return result;
|
|
5668
|
+
};
|
|
5669
|
+
|
|
5670
|
+
_proto.stripNewlineChars = function stripNewlineChars(str) {
|
|
5671
|
+
var res = '';
|
|
5672
|
+
|
|
5673
|
+
for (var i = 0, l = str.length; i < l; i++) {
|
|
5674
|
+
if (str.charCodeAt(i) !== 13 && str.charCodeAt(i) !== 0) {
|
|
5675
|
+
res += str.charAt(i);
|
|
5676
|
+
}
|
|
5677
|
+
}
|
|
5678
|
+
|
|
5679
|
+
return res;
|
|
5680
|
+
};
|
|
5681
|
+
|
|
5682
|
+
_proto.isValidLine = function isValidLine(line) {
|
|
5683
|
+
return !line.startsWith('@') && !line.startsWith('<begin subtitles>') && !line.startsWith('<end subtitles>');
|
|
5684
|
+
};
|
|
5685
|
+
|
|
5686
|
+
_proto.convertDuration = function convertDuration(time) {
|
|
5687
|
+
var times = time.split(' ');
|
|
5688
|
+
return {
|
|
5689
|
+
start: this.convertTimeToSeconds(times[0]),
|
|
5690
|
+
end: this.convertTimeToSeconds(times[1])
|
|
5691
|
+
};
|
|
5692
|
+
};
|
|
5693
|
+
|
|
5694
|
+
_proto.convertTimeToSeconds = function convertTimeToSeconds(time) {
|
|
5695
|
+
var parts = time.split(':');
|
|
5696
|
+
return parseInt(parts[0], 10) * 3600 + parseInt(parts[1], 10) * 60 + parseInt(parts[2], 10);
|
|
5697
|
+
};
|
|
5698
|
+
|
|
5699
|
+
return SubtitleImporter;
|
|
5700
|
+
}();
|
|
5701
|
+
|
|
5702
|
+
/**
|
|
5703
|
+
* Used to edit and add to an {@link ISubtitleCollection}.
|
|
5704
|
+
*/
|
|
5705
|
+
|
|
5706
|
+
var SubtitleEditor = /*#__PURE__*/function () {
|
|
5707
|
+
function SubtitleEditor(collection) {
|
|
5708
|
+
if (collection === void 0) {
|
|
5709
|
+
collection = [];
|
|
5710
|
+
}
|
|
5711
|
+
|
|
5712
|
+
this.collection = void 0;
|
|
5713
|
+
this.collection = collection;
|
|
5714
|
+
}
|
|
5715
|
+
|
|
5716
|
+
var _proto = SubtitleEditor.prototype;
|
|
5717
|
+
|
|
5718
|
+
_proto._getLanguage = function _getLanguage(languageCode) {
|
|
5719
|
+
return this.collection.find(function (x) {
|
|
5720
|
+
return x.languageCode === languageCode;
|
|
5721
|
+
});
|
|
5722
|
+
};
|
|
5723
|
+
|
|
5724
|
+
_proto.addLanguage = function addLanguage(languageCode) {
|
|
5725
|
+
var language = this._getLanguage(languageCode);
|
|
5726
|
+
|
|
5727
|
+
if (language) {
|
|
5728
|
+
throw new Error("Language " + languageCode + " already exists.");
|
|
5729
|
+
}
|
|
5730
|
+
|
|
5731
|
+
var newLanguage = this.collection.length ? _extends({}, this.collection[0], {
|
|
5732
|
+
titles: this.collection[0].titles.map(function (x) {
|
|
5733
|
+
return {
|
|
5734
|
+
id: uuid.v4(),
|
|
5735
|
+
duration: _extends({}, x.duration),
|
|
5736
|
+
text: ''
|
|
5737
|
+
};
|
|
5738
|
+
})
|
|
5739
|
+
}) : {
|
|
5740
|
+
languageCode: languageCode,
|
|
5741
|
+
titles: []
|
|
5742
|
+
};
|
|
5743
|
+
this.collection.push(newLanguage);
|
|
5744
|
+
return this;
|
|
5745
|
+
};
|
|
5746
|
+
|
|
5747
|
+
_proto.addSubtitle = function addSubtitle(languageCode, subtitle) {
|
|
5748
|
+
var language = this._getLanguage(languageCode);
|
|
5749
|
+
|
|
5750
|
+
if (!language) {
|
|
5751
|
+
throw new Error("Language " + languageCode + " does not exist.");
|
|
5752
|
+
}
|
|
5753
|
+
|
|
5754
|
+
language.titles.push(subtitle);
|
|
5755
|
+
return this;
|
|
5756
|
+
};
|
|
5757
|
+
|
|
5758
|
+
_proto.addSubtitles = function addSubtitles(subtitles) {
|
|
5759
|
+
var _this = this;
|
|
5760
|
+
|
|
5761
|
+
Object.entries(subtitles).forEach(function (_ref) {
|
|
5762
|
+
var languageCode = _ref[0],
|
|
5763
|
+
subtitle = _ref[1];
|
|
5764
|
+
return _this.addSubtitle(languageCode, subtitle);
|
|
5765
|
+
});
|
|
5766
|
+
return this;
|
|
5767
|
+
};
|
|
5768
|
+
|
|
5769
|
+
_proto.setSubtitle = function setSubtitle(languageCode, subtitle) {
|
|
5770
|
+
var language = this._getLanguage(languageCode);
|
|
5771
|
+
|
|
5772
|
+
if (!language) {
|
|
5773
|
+
throw new Error("Language " + languageCode + " does not exist.");
|
|
5774
|
+
}
|
|
5775
|
+
|
|
5776
|
+
var titleIdx = language.titles.findIndex(function (x) {
|
|
5777
|
+
return x.id === subtitle.id;
|
|
5778
|
+
});
|
|
5779
|
+
|
|
5780
|
+
if (titleIdx < 0) {
|
|
5781
|
+
throw new Error("Subtitle with id '" + subtitle.id + "' was not found in language with code " + languageCode + ".");
|
|
5782
|
+
}
|
|
5783
|
+
|
|
5784
|
+
language.titles[titleIdx] = _extends({}, subtitle, {
|
|
5785
|
+
duration: _extends({}, subtitle.duration)
|
|
5786
|
+
});
|
|
5787
|
+
return this;
|
|
5788
|
+
};
|
|
5789
|
+
|
|
5790
|
+
_proto["export"] = function _export() {
|
|
5791
|
+
return this.collection;
|
|
5792
|
+
};
|
|
5793
|
+
|
|
5794
|
+
return SubtitleEditor;
|
|
5795
|
+
}();
|
|
5796
|
+
|
|
5421
5797
|
/**
|
|
5422
5798
|
* Gets the value for the given property chain. A property chain is defined by a period delimited string.
|
|
5423
5799
|
*
|
|
@@ -5866,10 +6242,6 @@ var EligiusEngine = /*#__PURE__*/function () {
|
|
|
5866
6242
|
|
|
5867
6243
|
this._addEventListener(TimelineEventNames.REQUEST_TIMELINE_CLEANUP, this._handleTimelineComplete.bind(this));
|
|
5868
6244
|
|
|
5869
|
-
this._addEventListener(TimelineEventNames.EXECUTE_TIMELINEACTION, this._handleExecuteTimelineAction.bind(this));
|
|
5870
|
-
|
|
5871
|
-
this._addEventListener(TimelineEventNames.RESIZE_TIMELINEACTION, this._resizeTimelineAction.bind(this));
|
|
5872
|
-
|
|
5873
6245
|
this._addEventListener(TimelineEventNames.REQUEST_CURRENT_TIMELINE, this._requestCurrentTimeline.bind(this));
|
|
5874
6246
|
|
|
5875
6247
|
this._addEventListener(TimelineEventNames.PLAY_TOGGLE_REQUEST, this._toggleplay.bind(this));
|
|
@@ -6016,11 +6388,35 @@ var EligiusEngine = /*#__PURE__*/function () {
|
|
|
6016
6388
|
// actions ends need to be in reversed order, otherwise, for example,
|
|
6017
6389
|
// elements that were created before dependent actions will already have been
|
|
6018
6390
|
// removed in the end phase.
|
|
6019
|
-
|
|
6020
|
-
|
|
6391
|
+
timelineInfo.timelineActions.forEach(_this._addTimelineActionEnd.bind(_this, timelineInfo.uri));
|
|
6392
|
+
});
|
|
6393
|
+
EligiusEngine.sortTimelines(Object.values(this._timeLineActionsLookup));
|
|
6394
|
+
};
|
|
6395
|
+
|
|
6396
|
+
EligiusEngine.sortTimelines = function sortTimelines(timelines) {
|
|
6397
|
+
timelines.forEach(function (timelineActions) {
|
|
6398
|
+
Object.keys(timelineActions).forEach(function (key) {
|
|
6399
|
+
return timelineActions[key] = EligiusEngine.sortActionsPerPosition(timelineActions[key]);
|
|
6400
|
+
});
|
|
6021
6401
|
});
|
|
6022
6402
|
};
|
|
6023
6403
|
|
|
6404
|
+
EligiusEngine.sortActionsPerPosition = function sortActionsPerPosition(actions) {
|
|
6405
|
+
var _actions$reduce = actions.reduce(function (acc, item) {
|
|
6406
|
+
if (item.isStart) {
|
|
6407
|
+
acc[0].push(item);
|
|
6408
|
+
} else {
|
|
6409
|
+
acc[1].push(item);
|
|
6410
|
+
}
|
|
6411
|
+
|
|
6412
|
+
return acc;
|
|
6413
|
+
}, [[], []]),
|
|
6414
|
+
startMethods = _actions$reduce[0],
|
|
6415
|
+
endMethods = _actions$reduce[1];
|
|
6416
|
+
|
|
6417
|
+
return [].concat(endMethods.sort(sortActionMethodsHighestStartPositionFirst), startMethods);
|
|
6418
|
+
};
|
|
6419
|
+
|
|
6024
6420
|
_proto._addTimelineActionStart = function _addTimelineActionStart(uri, timeLineAction) {
|
|
6025
6421
|
var _timeLineAction$id;
|
|
6026
6422
|
|
|
@@ -6032,9 +6428,9 @@ var EligiusEngine = /*#__PURE__*/function () {
|
|
|
6032
6428
|
|
|
6033
6429
|
if ((_timeLineAction$id = timeLineAction.id) != null && _timeLineAction$id.length) {
|
|
6034
6430
|
startMethod.id = timeLineAction.id;
|
|
6035
|
-
startMethod.isStart = true;
|
|
6036
6431
|
}
|
|
6037
6432
|
|
|
6433
|
+
startMethod.isStart = true;
|
|
6038
6434
|
timelineStartPositions.push(startMethod);
|
|
6039
6435
|
};
|
|
6040
6436
|
|
|
@@ -6046,14 +6442,18 @@ var EligiusEngine = /*#__PURE__*/function () {
|
|
|
6046
6442
|
}
|
|
6047
6443
|
|
|
6048
6444
|
if (isFinite(end)) {
|
|
6445
|
+
var _timeLineAction$id2;
|
|
6446
|
+
|
|
6049
6447
|
var timelineEndPositions = this._initializeTimelinePosition(this._timeLineActionsLookup[uri], end);
|
|
6050
6448
|
|
|
6051
6449
|
var endMethod = timeLineAction.end.bind(timeLineAction);
|
|
6052
6450
|
|
|
6053
|
-
if (
|
|
6451
|
+
if ((_timeLineAction$id2 = timeLineAction.id) != null && _timeLineAction$id2.length) {
|
|
6054
6452
|
endMethod.id = timeLineAction.id;
|
|
6453
|
+
endMethod.startPosition = timeLineAction.duration.start;
|
|
6055
6454
|
}
|
|
6056
6455
|
|
|
6456
|
+
endMethod.isStart = false;
|
|
6057
6457
|
timelineEndPositions.push(endMethod);
|
|
6058
6458
|
}
|
|
6059
6459
|
};
|
|
@@ -6253,11 +6653,11 @@ var EligiusEngine = /*#__PURE__*/function () {
|
|
|
6253
6653
|
var actions = allActions.filter(function (action) {
|
|
6254
6654
|
return action.active;
|
|
6255
6655
|
});
|
|
6256
|
-
return actions.sort(
|
|
6656
|
+
return actions.sort(sortActionsHighestStartPositionFirst);
|
|
6257
6657
|
};
|
|
6258
6658
|
|
|
6259
6659
|
_proto._executeRelevantActions = function _executeRelevantActions(filter, executionType) {
|
|
6260
|
-
var timelineActions = this.
|
|
6660
|
+
var timelineActions = this._getTimelineActionsForCurrentTimeline();
|
|
6261
6661
|
|
|
6262
6662
|
var currentActions = filter.apply(this, [timelineActions]);
|
|
6263
6663
|
return this._executeActions(currentActions, executionType, 0);
|
|
@@ -6273,27 +6673,7 @@ var EligiusEngine = /*#__PURE__*/function () {
|
|
|
6273
6673
|
this._cleanUpTimeline();
|
|
6274
6674
|
};
|
|
6275
6675
|
|
|
6276
|
-
_proto.
|
|
6277
|
-
var actions = this._getTimelineActionsForUri(uri);
|
|
6278
|
-
|
|
6279
|
-
var action = actions == null ? void 0 : actions[index];
|
|
6280
|
-
|
|
6281
|
-
if (action) {
|
|
6282
|
-
if (start) {
|
|
6283
|
-
action.start();
|
|
6284
|
-
} else {
|
|
6285
|
-
action.end();
|
|
6286
|
-
}
|
|
6287
|
-
}
|
|
6288
|
-
};
|
|
6289
|
-
|
|
6290
|
-
_proto._resizeTimelineAction = function
|
|
6291
|
-
/*uri: string, index: number*/
|
|
6292
|
-
_resizeTimelineAction() {
|
|
6293
|
-
console.error('no resizing implemented');
|
|
6294
|
-
};
|
|
6295
|
-
|
|
6296
|
-
_proto._getRelevantTimelineActions = function _getRelevantTimelineActions() {
|
|
6676
|
+
_proto._getTimelineActionsForCurrentTimeline = function _getTimelineActionsForCurrentTimeline() {
|
|
6297
6677
|
return this._getTimelineActionsForUri(this._currentTimelineUri);
|
|
6298
6678
|
};
|
|
6299
6679
|
|
|
@@ -6329,19 +6709,19 @@ var EligiusEngine = /*#__PURE__*/function () {
|
|
|
6329
6709
|
if (actions) {
|
|
6330
6710
|
var executions = actions[position];
|
|
6331
6711
|
executions == null ? void 0 : executions.forEach(function (exec) {
|
|
6332
|
-
exec();
|
|
6712
|
+
return exec();
|
|
6333
6713
|
});
|
|
6334
6714
|
}
|
|
6335
6715
|
};
|
|
6336
6716
|
|
|
6337
6717
|
_proto._executeSeekActions = /*#__PURE__*/function () {
|
|
6338
|
-
var _executeSeekActions2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(
|
|
6718
|
+
var _executeSeekActions2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(position) {
|
|
6339
6719
|
var timelineActions, currentActions, newActions, currentActionsEnd;
|
|
6340
6720
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
6341
6721
|
while (1) {
|
|
6342
6722
|
switch (_context8.prev = _context8.next) {
|
|
6343
6723
|
case 0:
|
|
6344
|
-
timelineActions = this.
|
|
6724
|
+
timelineActions = this._getTimelineActionsForCurrentTimeline();
|
|
6345
6725
|
|
|
6346
6726
|
if (timelineActions) {
|
|
6347
6727
|
_context8.next = 3;
|
|
@@ -6351,8 +6731,10 @@ var EligiusEngine = /*#__PURE__*/function () {
|
|
|
6351
6731
|
return _context8.abrupt("return", Promise.resolve());
|
|
6352
6732
|
|
|
6353
6733
|
case 3:
|
|
6354
|
-
currentActions = this._getActiveActions(timelineActions)
|
|
6355
|
-
|
|
6734
|
+
currentActions = this._getActiveActions(timelineActions).filter(function (action) {
|
|
6735
|
+
return !(action.duration.start <= position && action.duration.end >= position);
|
|
6736
|
+
});
|
|
6737
|
+
newActions = this._getActionsForPosition(position, timelineActions);
|
|
6356
6738
|
currentActionsEnd = this._executeActions(currentActions, 'end', 0);
|
|
6357
6739
|
_context8.next = 8;
|
|
6358
6740
|
return currentActionsEnd;
|
|
@@ -6378,7 +6760,7 @@ var EligiusEngine = /*#__PURE__*/function () {
|
|
|
6378
6760
|
return EligiusEngine;
|
|
6379
6761
|
}();
|
|
6380
6762
|
|
|
6381
|
-
var
|
|
6763
|
+
var sortActionsHighestStartPositionFirst = function sortActionsHighestStartPositionFirst(a, b) {
|
|
6382
6764
|
if (b.duration.start < a.duration.start) {
|
|
6383
6765
|
return -1;
|
|
6384
6766
|
} else if (b.duration.start > a.duration.start) {
|
|
@@ -6388,6 +6770,20 @@ var sortActions = function sortActions(a, b) {
|
|
|
6388
6770
|
}
|
|
6389
6771
|
};
|
|
6390
6772
|
|
|
6773
|
+
var sortActionMethodsHighestStartPositionFirst = function sortActionMethodsHighestStartPositionFirst(a, b) {
|
|
6774
|
+
if (b.startPosition === undefined || a.startPosition === undefined) {
|
|
6775
|
+
return 0;
|
|
6776
|
+
}
|
|
6777
|
+
|
|
6778
|
+
if (b.startPosition < a.startPosition) {
|
|
6779
|
+
return -1;
|
|
6780
|
+
} else if (b.startPosition > a.startPosition) {
|
|
6781
|
+
return 1;
|
|
6782
|
+
} else {
|
|
6783
|
+
return 0;
|
|
6784
|
+
}
|
|
6785
|
+
};
|
|
6786
|
+
|
|
6391
6787
|
/**
|
|
6392
6788
|
* The `IEventbusListener` first registers a number of actions that are then
|
|
6393
6789
|
* executed when the specified event is broadcast.
|
|
@@ -7006,6 +7402,8 @@ exports.ProgressbarController = ProgressbarController;
|
|
|
7006
7402
|
exports.RequestAnimationFrameTimelineProvider = RequestAnimationFrameTimelineProvider;
|
|
7007
7403
|
exports.RequestVideoUriInterceptor = RequestVideoUriInterceptor;
|
|
7008
7404
|
exports.RoutingController = RoutingController;
|
|
7405
|
+
exports.SubtitleEditor = SubtitleEditor;
|
|
7406
|
+
exports.SubtitleImporter = SubtitleImporter;
|
|
7009
7407
|
exports.SubtitlesController = SubtitlesController;
|
|
7010
7408
|
exports.TimeLineEventNamesProvider = TimeLineEventNamesProvider;
|
|
7011
7409
|
exports.TimelineAction = TimelineAction;
|
|
@@ -7029,6 +7427,7 @@ exports.endLoop = endLoop$1;
|
|
|
7029
7427
|
exports.endWhen = endWhen$1;
|
|
7030
7428
|
exports.extendController = extendController$1;
|
|
7031
7429
|
exports.generateImporterSourceCode = generateImporterSourceCode;
|
|
7430
|
+
exports.getAttributesFromElement = getAttributesFromElement$1;
|
|
7032
7431
|
exports.getControllerFromElement = getControllerFromElement$1;
|
|
7033
7432
|
exports.getControllerInstance = getControllerInstance$1;
|
|
7034
7433
|
exports.getElementDimensions = getElementDimensions$1;
|
|
@@ -7048,6 +7447,7 @@ exports.reparentElement = reparentElement$1;
|
|
|
7048
7447
|
exports.requestAction = requestAction$1;
|
|
7049
7448
|
exports.resizeAction = resizeAction$1;
|
|
7050
7449
|
exports.selectElement = selectElement$1;
|
|
7450
|
+
exports.setData = setData$1;
|
|
7051
7451
|
exports.setElementAttributes = setElementAttributes$1;
|
|
7052
7452
|
exports.setElementContent = setElementContent$1;
|
|
7053
7453
|
exports.setGlobalData = setGlobalData$1;
|