eligius 1.1.1 → 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/configuration/api/configuration-factory.d.ts +1 -1
- package/dist/configuration/api/index.d.ts +2 -0
- package/dist/configuration/api/subtitle-converter.d.ts +11 -0
- package/dist/configuration/api/subtitle-editor.d.ts +14 -0
- package/dist/controllers/subtitles-controller.d.ts +3 -3
- package/dist/eligius.cjs.development.js +185 -2
- 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 +184 -3
- package/dist/eligius.esm.js.map +1 -1
- package/dist/types.d.ts +9 -0
- package/package.json +1 -1
package/dist/eligius.esm.js
CHANGED
|
@@ -3486,7 +3486,7 @@ var TimelineProviderSettingsEditor = /*#__PURE__*/function () {
|
|
|
3486
3486
|
}();
|
|
3487
3487
|
|
|
3488
3488
|
/**
|
|
3489
|
-
* This class offers a fluent and strongly typed DSL for creating Eligius configurations.
|
|
3489
|
+
* This class offers a fluent, extensible and strongly typed DSL for creating Eligius configurations.
|
|
3490
3490
|
*
|
|
3491
3491
|
* @example Building a configuration using the factory
|
|
3492
3492
|
* To initialize a basic configuration to start off of:
|
|
@@ -4885,7 +4885,7 @@ var SubtitlesController = /*#__PURE__*/function () {
|
|
|
4885
4885
|
|
|
4886
4886
|
for (var j = 0, jj = subtitleData.length; j < jj; j++) {
|
|
4887
4887
|
var subs = subtitleData[j];
|
|
4888
|
-
titleLanguageLookup[subs.
|
|
4888
|
+
titleLanguageLookup[subs.languageCode] = subs.titles[i].text;
|
|
4889
4889
|
}
|
|
4890
4890
|
|
|
4891
4891
|
subtitleTimeLookup[titles[i].duration.start] = this.setTitle.bind(this, container, titleLanguageLookup);
|
|
@@ -5601,6 +5601,187 @@ var TimeLineEventNamesProvider = /*#__PURE__*/function () {
|
|
|
5601
5601
|
return TimeLineEventNamesProvider;
|
|
5602
5602
|
}();
|
|
5603
5603
|
|
|
5604
|
+
/**
|
|
5605
|
+
* This class converts an AVID subtitle file to an `ISubtitle` array.
|
|
5606
|
+
*/
|
|
5607
|
+
var SubtitleImporter = /*#__PURE__*/function () {
|
|
5608
|
+
function SubtitleImporter() {}
|
|
5609
|
+
|
|
5610
|
+
var _proto = SubtitleImporter.prototype;
|
|
5611
|
+
|
|
5612
|
+
_proto.importSubtitles = function importSubtitles(rawLines) {
|
|
5613
|
+
var _this = this;
|
|
5614
|
+
|
|
5615
|
+
var result = [];
|
|
5616
|
+
var lines = [];
|
|
5617
|
+
|
|
5618
|
+
for (var i = 0, l = rawLines.length; i < l; i++) {
|
|
5619
|
+
var rawLine = this.stripNewlineChars(rawLines[i].toString());
|
|
5620
|
+
|
|
5621
|
+
if (this.isValidLine(rawLine)) {
|
|
5622
|
+
lines.push(rawLine);
|
|
5623
|
+
}
|
|
5624
|
+
}
|
|
5625
|
+
|
|
5626
|
+
if (lines[0] === '') {
|
|
5627
|
+
lines.splice(0, 1);
|
|
5628
|
+
}
|
|
5629
|
+
|
|
5630
|
+
while (lines[lines.length - 1] === '') {
|
|
5631
|
+
lines.pop();
|
|
5632
|
+
}
|
|
5633
|
+
|
|
5634
|
+
var caption = null;
|
|
5635
|
+
lines.forEach(function (line) {
|
|
5636
|
+
if (line.length === 0 || !caption) {
|
|
5637
|
+
caption = {
|
|
5638
|
+
text: ''
|
|
5639
|
+
};
|
|
5640
|
+
|
|
5641
|
+
if (line.length) {
|
|
5642
|
+
//this happens for first caption only
|
|
5643
|
+
caption.duration = _this.convertDuration(line);
|
|
5644
|
+
}
|
|
5645
|
+
|
|
5646
|
+
result.push(caption);
|
|
5647
|
+
} else {
|
|
5648
|
+
if (!caption.hasOwnProperty('duration')) {
|
|
5649
|
+
caption.duration = _this.convertDuration(line);
|
|
5650
|
+
} else {
|
|
5651
|
+
caption.text += line;
|
|
5652
|
+
}
|
|
5653
|
+
}
|
|
5654
|
+
});
|
|
5655
|
+
return result;
|
|
5656
|
+
};
|
|
5657
|
+
|
|
5658
|
+
_proto.stripNewlineChars = function stripNewlineChars(str) {
|
|
5659
|
+
var res = '';
|
|
5660
|
+
|
|
5661
|
+
for (var i = 0, l = str.length; i < l; i++) {
|
|
5662
|
+
if (str.charCodeAt(i) !== 13 && str.charCodeAt(i) !== 0) {
|
|
5663
|
+
res += str.charAt(i);
|
|
5664
|
+
}
|
|
5665
|
+
}
|
|
5666
|
+
|
|
5667
|
+
return res;
|
|
5668
|
+
};
|
|
5669
|
+
|
|
5670
|
+
_proto.isValidLine = function isValidLine(line) {
|
|
5671
|
+
return !line.startsWith('@') && !line.startsWith('<begin subtitles>') && !line.startsWith('<end subtitles>');
|
|
5672
|
+
};
|
|
5673
|
+
|
|
5674
|
+
_proto.convertDuration = function convertDuration(time) {
|
|
5675
|
+
var times = time.split(' ');
|
|
5676
|
+
return {
|
|
5677
|
+
start: this.convertTimeToSeconds(times[0]),
|
|
5678
|
+
end: this.convertTimeToSeconds(times[1])
|
|
5679
|
+
};
|
|
5680
|
+
};
|
|
5681
|
+
|
|
5682
|
+
_proto.convertTimeToSeconds = function convertTimeToSeconds(time) {
|
|
5683
|
+
var parts = time.split(':');
|
|
5684
|
+
return parseInt(parts[0], 10) * 3600 + parseInt(parts[1], 10) * 60 + parseInt(parts[2], 10);
|
|
5685
|
+
};
|
|
5686
|
+
|
|
5687
|
+
return SubtitleImporter;
|
|
5688
|
+
}();
|
|
5689
|
+
|
|
5690
|
+
/**
|
|
5691
|
+
* Used to edit and add to an {@link ISubtitleCollection}.
|
|
5692
|
+
*/
|
|
5693
|
+
|
|
5694
|
+
var SubtitleEditor = /*#__PURE__*/function () {
|
|
5695
|
+
function SubtitleEditor(collection) {
|
|
5696
|
+
if (collection === void 0) {
|
|
5697
|
+
collection = [];
|
|
5698
|
+
}
|
|
5699
|
+
|
|
5700
|
+
this.collection = void 0;
|
|
5701
|
+
this.collection = collection;
|
|
5702
|
+
}
|
|
5703
|
+
|
|
5704
|
+
var _proto = SubtitleEditor.prototype;
|
|
5705
|
+
|
|
5706
|
+
_proto._getLanguage = function _getLanguage(languageCode) {
|
|
5707
|
+
return this.collection.find(function (x) {
|
|
5708
|
+
return x.languageCode === languageCode;
|
|
5709
|
+
});
|
|
5710
|
+
};
|
|
5711
|
+
|
|
5712
|
+
_proto.addLanguage = function addLanguage(languageCode) {
|
|
5713
|
+
var language = this._getLanguage(languageCode);
|
|
5714
|
+
|
|
5715
|
+
if (language) {
|
|
5716
|
+
throw new Error("Language " + languageCode + " already exists.");
|
|
5717
|
+
}
|
|
5718
|
+
|
|
5719
|
+
var newLanguage = this.collection.length ? _extends({}, this.collection[0], {
|
|
5720
|
+
titles: this.collection[0].titles.map(function (x) {
|
|
5721
|
+
return {
|
|
5722
|
+
id: v4(),
|
|
5723
|
+
duration: _extends({}, x.duration),
|
|
5724
|
+
text: ''
|
|
5725
|
+
};
|
|
5726
|
+
})
|
|
5727
|
+
}) : {
|
|
5728
|
+
languageCode: languageCode,
|
|
5729
|
+
titles: []
|
|
5730
|
+
};
|
|
5731
|
+
this.collection.push(newLanguage);
|
|
5732
|
+
return this;
|
|
5733
|
+
};
|
|
5734
|
+
|
|
5735
|
+
_proto.addSubtitle = function addSubtitle(languageCode, subtitle) {
|
|
5736
|
+
var language = this._getLanguage(languageCode);
|
|
5737
|
+
|
|
5738
|
+
if (!language) {
|
|
5739
|
+
throw new Error("Language " + languageCode + " does not exist.");
|
|
5740
|
+
}
|
|
5741
|
+
|
|
5742
|
+
language.titles.push(subtitle);
|
|
5743
|
+
return this;
|
|
5744
|
+
};
|
|
5745
|
+
|
|
5746
|
+
_proto.addSubtitles = function addSubtitles(subtitles) {
|
|
5747
|
+
var _this = this;
|
|
5748
|
+
|
|
5749
|
+
Object.entries(subtitles).forEach(function (_ref) {
|
|
5750
|
+
var languageCode = _ref[0],
|
|
5751
|
+
subtitle = _ref[1];
|
|
5752
|
+
return _this.addSubtitle(languageCode, subtitle);
|
|
5753
|
+
});
|
|
5754
|
+
return this;
|
|
5755
|
+
};
|
|
5756
|
+
|
|
5757
|
+
_proto.setSubtitle = function setSubtitle(languageCode, subtitle) {
|
|
5758
|
+
var language = this._getLanguage(languageCode);
|
|
5759
|
+
|
|
5760
|
+
if (!language) {
|
|
5761
|
+
throw new Error("Language " + languageCode + " does not exist.");
|
|
5762
|
+
}
|
|
5763
|
+
|
|
5764
|
+
var titleIdx = language.titles.findIndex(function (x) {
|
|
5765
|
+
return x.id === subtitle.id;
|
|
5766
|
+
});
|
|
5767
|
+
|
|
5768
|
+
if (titleIdx < 0) {
|
|
5769
|
+
throw new Error("Subtitle with id '" + subtitle.id + "' was not found in language with code " + languageCode + ".");
|
|
5770
|
+
}
|
|
5771
|
+
|
|
5772
|
+
language.titles[titleIdx] = _extends({}, subtitle, {
|
|
5773
|
+
duration: _extends({}, subtitle.duration)
|
|
5774
|
+
});
|
|
5775
|
+
return this;
|
|
5776
|
+
};
|
|
5777
|
+
|
|
5778
|
+
_proto["export"] = function _export() {
|
|
5779
|
+
return this.collection;
|
|
5780
|
+
};
|
|
5781
|
+
|
|
5782
|
+
return SubtitleEditor;
|
|
5783
|
+
}();
|
|
5784
|
+
|
|
5604
5785
|
/**
|
|
5605
5786
|
* Gets the value for the given property chain. A property chain is defined by a period delimited string.
|
|
5606
5787
|
*
|
|
@@ -7179,5 +7360,5 @@ var EligiusResourceImporter = /*#__PURE__*/function () {
|
|
|
7179
7360
|
return EligiusResourceImporter;
|
|
7180
7361
|
}();
|
|
7181
7362
|
|
|
7182
|
-
export { Action, ActionCreator, ActionCreatorFactory, ActionEditor, ActionRegistryEventbusListener, ConfigurationFactory, ConfigurationResolver, ControllerNamesProvider, DEV_TOOLS_KEY, DevToolEventListener, Diagnostics, EligiusEngine, EligiusResourceImporter, EndableAction, EndableActionCreator, EndableActionEditor, EngineFactory, EventListenerController, Eventbus, LabelController, LanguageManager, LottieController, NavigationController, OperationEditor, OperationMetadataProvider, OperationNamesProvider, ProgressbarController, RequestAnimationFrameTimelineProvider, RequestVideoUriInterceptor, RoutingController, SubtitlesController, TimeLineEventNamesProvider, TimelineAction, TimelineActionCreator, TimelineActionEditor, TimelineEventNames, TimelineProviderSettingsEditor, TimelineProvidersSettingsEditor, addClass$1 as addClass, addControllerToElement$1 as addControllerToElement, animate$1 as animate, animateWithClass$1 as animateWithClass, broadcastEvent$1 as broadcastEvent, calc$1 as calc, clearElement$1 as clearElement, clearOperationData$1 as clearOperationData, createElement$1 as createElement, customFunction$1 as customFunction, endAction$1 as endAction, endLoop$1 as endLoop, endWhen$1 as endWhen, extendController$1 as extendController, generateImporterSourceCode, getAttributesFromElement$1 as getAttributesFromElement, getControllerFromElement$1 as getControllerFromElement, getControllerInstance$1 as getControllerInstance, getElementDimensions$1 as getElementDimensions, getImport$1 as getImport, getQueryParams$1 as getQueryParams, invokeObjectMethod$1 as invokeObjectMethod, loadJSON$1 as loadJSON, log$1 as log, math$1 as math, operationMetadata as metadata, otherwise$1 as otherwise, removeClass$1 as removeClass, removeControllerFromElement$1 as removeControllerFromElement, removeElement$1 as removeElement, removePropertiesFromOperationData$1 as removePropertiesFromOperationData, reparentElement$1 as reparentElement, requestAction$1 as requestAction, resizeAction$1 as resizeAction, selectElement$1 as selectElement, setData$1 as setData, setElementAttributes$1 as setElementAttributes, setElementContent$1 as setElementContent, setGlobalData$1 as setGlobalData, setOperationData$1 as setOperationData, setStyle$1 as setStyle, startAction$1 as startAction, startLoop$1 as startLoop, toggleClass$1 as toggleClass, toggleElement$1 as toggleElement, wait$2 as wait, when };
|
|
7363
|
+
export { Action, ActionCreator, ActionCreatorFactory, ActionEditor, ActionRegistryEventbusListener, ConfigurationFactory, ConfigurationResolver, ControllerNamesProvider, DEV_TOOLS_KEY, DevToolEventListener, Diagnostics, EligiusEngine, EligiusResourceImporter, EndableAction, EndableActionCreator, EndableActionEditor, EngineFactory, EventListenerController, Eventbus, LabelController, LanguageManager, LottieController, NavigationController, OperationEditor, OperationMetadataProvider, OperationNamesProvider, ProgressbarController, RequestAnimationFrameTimelineProvider, RequestVideoUriInterceptor, RoutingController, SubtitleEditor, SubtitleImporter, SubtitlesController, TimeLineEventNamesProvider, TimelineAction, TimelineActionCreator, TimelineActionEditor, TimelineEventNames, TimelineProviderSettingsEditor, TimelineProvidersSettingsEditor, addClass$1 as addClass, addControllerToElement$1 as addControllerToElement, animate$1 as animate, animateWithClass$1 as animateWithClass, broadcastEvent$1 as broadcastEvent, calc$1 as calc, clearElement$1 as clearElement, clearOperationData$1 as clearOperationData, createElement$1 as createElement, customFunction$1 as customFunction, endAction$1 as endAction, endLoop$1 as endLoop, endWhen$1 as endWhen, extendController$1 as extendController, generateImporterSourceCode, getAttributesFromElement$1 as getAttributesFromElement, getControllerFromElement$1 as getControllerFromElement, getControllerInstance$1 as getControllerInstance, getElementDimensions$1 as getElementDimensions, getImport$1 as getImport, getQueryParams$1 as getQueryParams, invokeObjectMethod$1 as invokeObjectMethod, loadJSON$1 as loadJSON, log$1 as log, math$1 as math, operationMetadata as metadata, otherwise$1 as otherwise, removeClass$1 as removeClass, removeControllerFromElement$1 as removeControllerFromElement, removeElement$1 as removeElement, removePropertiesFromOperationData$1 as removePropertiesFromOperationData, reparentElement$1 as reparentElement, requestAction$1 as requestAction, resizeAction$1 as resizeAction, selectElement$1 as selectElement, setData$1 as setData, setElementAttributes$1 as setElementAttributes, setElementContent$1 as setElementContent, setGlobalData$1 as setGlobalData, setOperationData$1 as setOperationData, setStyle$1 as setStyle, startAction$1 as startAction, startLoop$1 as startLoop, toggleClass$1 as toggleClass, toggleElement$1 as toggleElement, wait$2 as wait, when };
|
|
7183
7364
|
//# sourceMappingURL=eligius.esm.js.map
|