eligius 1.0.3 → 1.0.5
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/build/generate-importer-source-code.d.ts +15 -0
- package/dist/build/index.d.ts +1 -0
- package/dist/diagnostics/devtool-event-lister.d.ts +7 -0
- package/dist/diagnostics/diagnostics.d.ts +4 -0
- package/dist/diagnostics/index.d.ts +3 -0
- package/dist/diagnostics/types.d.ts +8 -0
- package/dist/eligius.cjs.development.js +454 -47
- 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 +446 -47
- package/dist/eligius.esm.js.map +1 -1
- package/dist/engine-factory.d.ts +1 -0
- package/dist/importer/{webpack-resource-importer.d.ts → eligius-resource-importer.d.ts} +1 -1
- package/dist/importer/index.d.ts +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/operation/broadcast-event.d.ts +0 -1
- package/dist/operation/calc.d.ts +14 -0
- package/dist/operation/index.d.ts +2 -0
- package/dist/operation/math.d.ts +12 -0
- package/dist/operation/metadata/calc.d.ts +4 -0
- package/dist/operation/metadata/index.d.ts +2 -0
- package/dist/operation/metadata/math.d.ts +4 -0
- package/dist/operation/metadata/types.d.ts +9 -6
- package/dist/schema-tools/generate-operation-schemas.d.ts +1 -0
- package/dist/schema-tools/html-tag-names.d.ts +1 -0
- package/dist/types.d.ts +1 -1
- package/dist/util/camel-case-to-dash.d.ts +1 -0
- package/dist/util/dash-to-camel-case.d.ts +1 -0
- package/package.json +8 -6
package/dist/eligius.esm.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { isDefined } from 'ts-is-present';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import path from 'path';
|
|
2
4
|
import lottie from 'lottie-web';
|
|
3
5
|
import $ from 'jquery';
|
|
4
6
|
import Mousetrap from 'mousetrap';
|
|
@@ -581,6 +583,207 @@ var TimelineAction = /*#__PURE__*/function (_EndableAction) {
|
|
|
581
583
|
return TimelineAction;
|
|
582
584
|
}(EndableAction);
|
|
583
585
|
|
|
586
|
+
function dashToCamelCase(input) {
|
|
587
|
+
return input.replace(/-([a-z])/g, function (g) {
|
|
588
|
+
return g[1].toUpperCase();
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* This function takes an Eligius engine configuration, a root path for the config and an arbitrary list of asset info.
|
|
594
|
+
* The asset info determines a number of subdirectories in the root path that contain the different assets used by the presentation.
|
|
595
|
+
* I.e. html, json, etc.
|
|
596
|
+
*
|
|
597
|
+
* @param config
|
|
598
|
+
* @param configPath
|
|
599
|
+
* @param assetInfo
|
|
600
|
+
*/
|
|
601
|
+
|
|
602
|
+
function generateImporterSourceCode(config, configPath, assetInfo) {
|
|
603
|
+
var importPaths = _gatherImportPaths(config, configPath, assetInfo);
|
|
604
|
+
|
|
605
|
+
var importerSourceCode = _generateSourceCode(importPaths);
|
|
606
|
+
|
|
607
|
+
return importerSourceCode;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
function _generateSourceCode(importPaths) {
|
|
611
|
+
var result = importPaths.filter(function (x) {
|
|
612
|
+
return x.defaultImport;
|
|
613
|
+
}).map(function (imp) {
|
|
614
|
+
return "import " + imp.systemName + " from '" + imp.path + "';";
|
|
615
|
+
}).concat(importPaths.filter(function (x) {
|
|
616
|
+
return !x.defaultImport;
|
|
617
|
+
}).map(function (imp) {
|
|
618
|
+
var _imp$path;
|
|
619
|
+
|
|
620
|
+
return "import {" + imp.systemName + "} from '" + ((_imp$path = imp.path) != null ? _imp$path : 'eligius') + "';";
|
|
621
|
+
}));
|
|
622
|
+
result.push("import { ISimpleResourceImporter } from 'eligius';");
|
|
623
|
+
result.push('');
|
|
624
|
+
result.push('const imports: Record<string, any> = {');
|
|
625
|
+
result.push.apply(result, importPaths.map(function (imp) {
|
|
626
|
+
return imp.systemName + ": { '" + imp.systemName + "': " + imp.systemName + " },";
|
|
627
|
+
}));
|
|
628
|
+
result.push('};');
|
|
629
|
+
result.push('');
|
|
630
|
+
result.push('class EligiusResourceImporter implements ISimpleResourceImporter {');
|
|
631
|
+
result.push('import(name: string): Record<string, any> {');
|
|
632
|
+
result.push('if (imports.hasOwnProperty(name)) { return imports[name]; }');
|
|
633
|
+
result.push('throw Error(`Unknown systemName: ${name}`);');
|
|
634
|
+
result.push('}}');
|
|
635
|
+
result.push('');
|
|
636
|
+
result.push('export default EligiusResourceImporter;');
|
|
637
|
+
return result.join('\n');
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
function _gatherImportPaths(config, configPath, assetInfo) {
|
|
641
|
+
return [].concat(_gatherOperations(config), assetInfo.flatMap(function (info) {
|
|
642
|
+
return _gatherAssets(configPath, info.path, info.extension);
|
|
643
|
+
}), _gatherControllers(config), _gatherProviders(config), _gatherEngines(config));
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
function _gatherAssets(assetPath, subdir, extension) {
|
|
647
|
+
var entries = fs.readdirSync(path.join(assetPath, subdir));
|
|
648
|
+
return entries.map(function (file) {
|
|
649
|
+
var importName = "" + dashToCamelCase(path.basename(file, extension));
|
|
650
|
+
return {
|
|
651
|
+
systemName: importName,
|
|
652
|
+
path: "./" + subdir + "/" + file,
|
|
653
|
+
defaultImport: true
|
|
654
|
+
};
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
function _gatherControllers(config) {
|
|
659
|
+
var _importPaths, _importPaths2, _importPaths3, _importPaths4;
|
|
660
|
+
|
|
661
|
+
var importPaths = [];
|
|
662
|
+
|
|
663
|
+
(_importPaths = importPaths).push.apply(_importPaths, _gatherControllerImportPathsFromActions(config.initActions));
|
|
664
|
+
|
|
665
|
+
(_importPaths2 = importPaths).push.apply(_importPaths2, _gatherControllerImportPathsFromActions(config.actions));
|
|
666
|
+
|
|
667
|
+
(_importPaths3 = importPaths).push.apply(_importPaths3, _gatherControllerImportPathsFromActions(config.timelines.flatMap(function (x) {
|
|
668
|
+
return x.timelineActions;
|
|
669
|
+
})));
|
|
670
|
+
|
|
671
|
+
(_importPaths4 = importPaths).push.apply(_importPaths4, _gatherControllerImportPathsFromActions(config.eventActions));
|
|
672
|
+
|
|
673
|
+
importPaths = dedupe(importPaths);
|
|
674
|
+
return importPaths;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
function _gatherProviders(config) {
|
|
678
|
+
if (config.timelineProviderSettings) {
|
|
679
|
+
return Object.values(config.timelineProviderSettings).map(function (settings) {
|
|
680
|
+
return {
|
|
681
|
+
systemName: settings.systemName
|
|
682
|
+
};
|
|
683
|
+
});
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
return [];
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
function _gatherEngines(config) {
|
|
690
|
+
if (config.engine) {
|
|
691
|
+
var systemName = config.engine.systemName;
|
|
692
|
+
return [{
|
|
693
|
+
systemName: systemName
|
|
694
|
+
}];
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
return [];
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
function _gatherOperations(config) {
|
|
701
|
+
var _config$eventActions;
|
|
702
|
+
|
|
703
|
+
var importPaths = _gatherOperationImportPathsFromActions(config.initActions.concat(config.actions).concat((_config$eventActions = config.eventActions) != null ? _config$eventActions : []));
|
|
704
|
+
|
|
705
|
+
if (config.timelines) {
|
|
706
|
+
var timelineActions = config.timelines.flatMap(function (x) {
|
|
707
|
+
return x.timelineActions;
|
|
708
|
+
});
|
|
709
|
+
importPaths = importPaths.concat(_gatherOperationImportPathsFromActions(timelineActions));
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
return dedupe(importPaths);
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
function _gatherControllerImportPathsFromActions(actionsConfig) {
|
|
716
|
+
if (!actionsConfig) {
|
|
717
|
+
return [];
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
var operations = actionsConfig.flatMap(function (x) {
|
|
721
|
+
var _x$endOperations;
|
|
722
|
+
|
|
723
|
+
return [].concat(x.startOperations, (_x$endOperations = x.endOperations) != null ? _x$endOperations : []);
|
|
724
|
+
});
|
|
725
|
+
return _gatherControllerImportPaths(operations);
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
function _gatherOperationImportPathsFromActions(actionsConfig) {
|
|
729
|
+
if (!actionsConfig) {
|
|
730
|
+
return [];
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
var operations = actionsConfig.flatMap(function (x) {
|
|
734
|
+
var _x$endOperations2;
|
|
735
|
+
|
|
736
|
+
return [].concat(x.startOperations, (_x$endOperations2 = x.endOperations) != null ? _x$endOperations2 : []);
|
|
737
|
+
});
|
|
738
|
+
return _gatherOperationImportPaths(operations);
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
function _gatherControllerImportPaths(operationConfigs) {
|
|
742
|
+
if (!operationConfigs) {
|
|
743
|
+
return [];
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
return operationConfigs.filter(function (operationConfig) {
|
|
747
|
+
var _operationConfig$oper;
|
|
748
|
+
|
|
749
|
+
if ((_operationConfig$oper = operationConfig.operationData) != null && _operationConfig$oper.hasOwnProperty('systemName')) {
|
|
750
|
+
return operationConfig.operationData.systemName.endsWith('Controller');
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
return false;
|
|
754
|
+
}).map(function (operationConfig) {
|
|
755
|
+
var systemName = operationConfig.operationData.systemName;
|
|
756
|
+
return {
|
|
757
|
+
systemName: systemName
|
|
758
|
+
};
|
|
759
|
+
});
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
function _gatherOperationImportPaths(operationConfigs) {
|
|
763
|
+
if (!operationConfigs) {
|
|
764
|
+
return [];
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
return operationConfigs.map(function (operationConfig) {
|
|
768
|
+
var systemName = operationConfig.systemName;
|
|
769
|
+
return {
|
|
770
|
+
systemName: systemName
|
|
771
|
+
};
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
function dedupe(importPaths) {
|
|
776
|
+
var lookup = {};
|
|
777
|
+
return importPaths.filter(function (imp) {
|
|
778
|
+
if (lookup[imp.systemName]) {
|
|
779
|
+
return false;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
lookup[imp.systemName] = true;
|
|
783
|
+
return true;
|
|
784
|
+
});
|
|
785
|
+
}
|
|
786
|
+
|
|
584
787
|
function getNestedValue(properties, sourceObject) {
|
|
585
788
|
if (!properties) {
|
|
586
789
|
throw Error('properties arg cannot be null');
|
|
@@ -1749,6 +1952,34 @@ var ctrls = {
|
|
|
1749
1952
|
SubtitlesController: SubtitlesController
|
|
1750
1953
|
};
|
|
1751
1954
|
|
|
1955
|
+
var DevToolEventListener = /*#__PURE__*/function () {
|
|
1956
|
+
function DevToolEventListener(agent) {
|
|
1957
|
+
this.agent = void 0;
|
|
1958
|
+
this.agent = agent;
|
|
1959
|
+
}
|
|
1960
|
+
|
|
1961
|
+
var _proto = DevToolEventListener.prototype;
|
|
1962
|
+
|
|
1963
|
+
_proto.handleEvent = function handleEvent(eventName, eventTopic, args) {
|
|
1964
|
+
this.agent.postMessage('eligius-diagnostics-event', {
|
|
1965
|
+
eventName: eventName,
|
|
1966
|
+
eventTopic: eventTopic
|
|
1967
|
+
});
|
|
1968
|
+
};
|
|
1969
|
+
|
|
1970
|
+
return DevToolEventListener;
|
|
1971
|
+
}();
|
|
1972
|
+
|
|
1973
|
+
var Diagnostics = /*#__PURE__*/function () {
|
|
1974
|
+
function Diagnostics() {}
|
|
1975
|
+
|
|
1976
|
+
Diagnostics.send = function send(_name, _data) {};
|
|
1977
|
+
|
|
1978
|
+
return Diagnostics;
|
|
1979
|
+
}();
|
|
1980
|
+
|
|
1981
|
+
var DEV_TOOLS_KEY = '__ELIGIUS_DEV_TOOLS__';
|
|
1982
|
+
|
|
1752
1983
|
/**
|
|
1753
1984
|
* EligiusEngine, this is where the magic happens. The engine is responsible for starting and stopping
|
|
1754
1985
|
* the given timeline provider and triggering the actions associated with it.
|
|
@@ -1810,6 +2041,7 @@ var EligiusEngine = /*#__PURE__*/function () {
|
|
|
1810
2041
|
|
|
1811
2042
|
_proto._initializeTimelineProvider = function _initializeTimelineProvider() {
|
|
1812
2043
|
var _this$configuration$t,
|
|
2044
|
+
_this$_activeTimeline,
|
|
1813
2045
|
_this = this;
|
|
1814
2046
|
|
|
1815
2047
|
if (!((_this$configuration$t = this.configuration.timelines) != null && _this$configuration$t.length)) {
|
|
@@ -1823,10 +2055,7 @@ var EligiusEngine = /*#__PURE__*/function () {
|
|
|
1823
2055
|
throw new Error("No timeline provider configured for type " + firstTimeline.type);
|
|
1824
2056
|
}
|
|
1825
2057
|
|
|
1826
|
-
|
|
1827
|
-
this._activeTimelineProvider.destroy();
|
|
1828
|
-
}
|
|
1829
|
-
|
|
2058
|
+
(_this$_activeTimeline = this._activeTimelineProvider) == null ? void 0 : _this$_activeTimeline.destroy();
|
|
1830
2059
|
this._activeTimelineProvider = providerSettings.provider;
|
|
1831
2060
|
return new Promise( /*#__PURE__*/function () {
|
|
1832
2061
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(resolve) {
|
|
@@ -1898,6 +2127,7 @@ var EligiusEngine = /*#__PURE__*/function () {
|
|
|
1898
2127
|
|
|
1899
2128
|
_proto.destroy = /*#__PURE__*/function () {
|
|
1900
2129
|
var _destroy = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
2130
|
+
var containerSelector, container;
|
|
1901
2131
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
1902
2132
|
while (1) {
|
|
1903
2133
|
switch (_context3.prev = _context3.next) {
|
|
@@ -1913,12 +2143,16 @@ var EligiusEngine = /*#__PURE__*/function () {
|
|
|
1913
2143
|
});
|
|
1914
2144
|
|
|
1915
2145
|
if (this.timelineProviders) {
|
|
1916
|
-
Object.values(this.timelineProviders).forEach(function (
|
|
1917
|
-
return
|
|
2146
|
+
Object.values(this.timelineProviders).forEach(function (providerInfo) {
|
|
2147
|
+
return providerInfo.provider.destroy();
|
|
1918
2148
|
});
|
|
1919
2149
|
}
|
|
1920
2150
|
|
|
1921
|
-
|
|
2151
|
+
containerSelector = this.configuration.containerSelector;
|
|
2152
|
+
container = $(containerSelector);
|
|
2153
|
+
container.empty();
|
|
2154
|
+
|
|
2155
|
+
case 8:
|
|
1922
2156
|
case "end":
|
|
1923
2157
|
return _context3.stop();
|
|
1924
2158
|
}
|
|
@@ -2187,9 +2421,9 @@ var EligiusEngine = /*#__PURE__*/function () {
|
|
|
2187
2421
|
};
|
|
2188
2422
|
|
|
2189
2423
|
_proto._handleRequestTimelinePosition = function _handleRequestTimelinePosition(floor, resultCallback) {
|
|
2190
|
-
var _this$
|
|
2424
|
+
var _this$_activeTimeline2;
|
|
2191
2425
|
|
|
2192
|
-
resultCallback(floor(((_this$
|
|
2426
|
+
resultCallback(floor(((_this$_activeTimeline2 = this._activeTimelineProvider) == null ? void 0 : _this$_activeTimeline2.getPosition()) || -1));
|
|
2193
2427
|
};
|
|
2194
2428
|
|
|
2195
2429
|
_proto._handleTimelineComplete = function _handleTimelineComplete() {
|
|
@@ -2235,19 +2469,19 @@ var EligiusEngine = /*#__PURE__*/function () {
|
|
|
2235
2469
|
|
|
2236
2470
|
_proto._onTimeHandler = function _onTimeHandler(floor, event) {
|
|
2237
2471
|
if (!isNaN(event.position)) {
|
|
2238
|
-
var _this$
|
|
2472
|
+
var _this$_activeTimeline4;
|
|
2239
2473
|
|
|
2240
2474
|
var pos = floor(event.position);
|
|
2241
2475
|
|
|
2242
2476
|
if (this._lastPosition !== pos) {
|
|
2243
|
-
var _this$
|
|
2477
|
+
var _this$_activeTimeline3;
|
|
2244
2478
|
|
|
2245
2479
|
this._executeActionsForPosition(pos);
|
|
2246
2480
|
|
|
2247
|
-
this.eventbus.broadcast(TimelineEventNames.POSITION_UPDATE, [pos, (_this$
|
|
2481
|
+
this.eventbus.broadcast(TimelineEventNames.POSITION_UPDATE, [pos, (_this$_activeTimeline3 = this._activeTimelineProvider) == null ? void 0 : _this$_activeTimeline3.getDuration()]);
|
|
2248
2482
|
}
|
|
2249
2483
|
|
|
2250
|
-
this.eventbus.broadcast(TimelineEventNames.TIME_UPDATE, [event.position, (_this$
|
|
2484
|
+
this.eventbus.broadcast(TimelineEventNames.TIME_UPDATE, [event.position, (_this$_activeTimeline4 = this._activeTimelineProvider) == null ? void 0 : _this$_activeTimeline4.getDuration()]);
|
|
2251
2485
|
}
|
|
2252
2486
|
};
|
|
2253
2487
|
|
|
@@ -2602,6 +2836,9 @@ var EngineFactory = /*#__PURE__*/function () {
|
|
|
2602
2836
|
this.eventbus = void 0;
|
|
2603
2837
|
this.importer = importer;
|
|
2604
2838
|
this.eventbus = eventbus || new Eventbus();
|
|
2839
|
+
|
|
2840
|
+
this._initializeDevtools(this.eventbus);
|
|
2841
|
+
|
|
2605
2842
|
this.eventbus.on(TimelineEventNames.REQUEST_INSTANCE, this._requestInstanceHandler.bind(this));
|
|
2606
2843
|
this.eventbus.on(TimelineEventNames.REQUEST_ACTION, this._requestActionHandler.bind(this));
|
|
2607
2844
|
this.eventbus.on(TimelineEventNames.REQUEST_FUNCTION, this._requestFunctionHandler.bind(this));
|
|
@@ -2610,6 +2847,20 @@ var EngineFactory = /*#__PURE__*/function () {
|
|
|
2610
2847
|
|
|
2611
2848
|
var _proto = EngineFactory.prototype;
|
|
2612
2849
|
|
|
2850
|
+
_proto._initializeDevtools = function _initializeDevtools(eventbus) {
|
|
2851
|
+
var diagnosticInfo = window[DEV_TOOLS_KEY];
|
|
2852
|
+
|
|
2853
|
+
if (diagnosticInfo) {
|
|
2854
|
+
var agent = diagnosticInfo.agent;
|
|
2855
|
+
var eventbusListener = new DevToolEventListener(agent);
|
|
2856
|
+
eventbus.registerEventlistener(eventbusListener);
|
|
2857
|
+
|
|
2858
|
+
Diagnostics.send = function (name, data) {
|
|
2859
|
+
agent.postMessage(name, data);
|
|
2860
|
+
};
|
|
2861
|
+
}
|
|
2862
|
+
};
|
|
2863
|
+
|
|
2613
2864
|
_proto.destroy = function destroy() {
|
|
2614
2865
|
this.eventbus.clear();
|
|
2615
2866
|
};
|
|
@@ -2884,7 +3135,6 @@ function resolveEventArguments(operationData, eventArgs) {
|
|
|
2884
3135
|
* event argumetns and optional event topic.
|
|
2885
3136
|
*
|
|
2886
3137
|
* @param operationData
|
|
2887
|
-
* @returns
|
|
2888
3138
|
*/
|
|
2889
3139
|
|
|
2890
3140
|
var broadcastEvent$1 = function broadcastEvent(operationData) {
|
|
@@ -2903,33 +3153,6 @@ var broadcastEvent$1 = function broadcastEvent(operationData) {
|
|
|
2903
3153
|
return operationData;
|
|
2904
3154
|
};
|
|
2905
3155
|
|
|
2906
|
-
/**
|
|
2907
|
-
* This operation removes all of the children from the specified selected element.
|
|
2908
|
-
*/
|
|
2909
|
-
var clearElement$1 = function clearElement(operationData) {
|
|
2910
|
-
var selectedElement = operationData.selectedElement;
|
|
2911
|
-
selectedElement.empty();
|
|
2912
|
-
return operationData;
|
|
2913
|
-
};
|
|
2914
|
-
|
|
2915
|
-
/**
|
|
2916
|
-
* This operation removes all of the properties on the current operation date.
|
|
2917
|
-
* Or, if the properties property is set only removes the properties defined by that list.
|
|
2918
|
-
*/
|
|
2919
|
-
var clearOperationData$1 = function clearOperationData(operationData) {
|
|
2920
|
-
var properties = operationData.properties;
|
|
2921
|
-
|
|
2922
|
-
if (properties) {
|
|
2923
|
-
properties.forEach(function (name) {
|
|
2924
|
-
delete operationData[name];
|
|
2925
|
-
});
|
|
2926
|
-
delete operationData.properties;
|
|
2927
|
-
return operationData;
|
|
2928
|
-
}
|
|
2929
|
-
|
|
2930
|
-
return {};
|
|
2931
|
-
};
|
|
2932
|
-
|
|
2933
3156
|
var cache = [];
|
|
2934
3157
|
function resolvePropertyValues(operationData, properties) {
|
|
2935
3158
|
var copy = properties !== operationData ? deepCopy(properties) : properties;
|
|
@@ -2974,6 +3197,71 @@ function resolveProperties(properties, copy, extract) {
|
|
|
2974
3197
|
}
|
|
2975
3198
|
}
|
|
2976
3199
|
|
|
3200
|
+
var calcFunctions = {
|
|
3201
|
+
'+': function _(left, right) {
|
|
3202
|
+
return left + right;
|
|
3203
|
+
},
|
|
3204
|
+
'-': function _(left, right) {
|
|
3205
|
+
return left - right;
|
|
3206
|
+
},
|
|
3207
|
+
'*': function _(left, right) {
|
|
3208
|
+
return left * right;
|
|
3209
|
+
},
|
|
3210
|
+
'/': function _(left, right) {
|
|
3211
|
+
return left / right;
|
|
3212
|
+
},
|
|
3213
|
+
'%': function _(left, right) {
|
|
3214
|
+
return left % right;
|
|
3215
|
+
},
|
|
3216
|
+
'**': function _(left, right) {
|
|
3217
|
+
return Math.pow(left, right);
|
|
3218
|
+
}
|
|
3219
|
+
};
|
|
3220
|
+
/**
|
|
3221
|
+
* This operation calculates the given left and right hand sides using the specified operator.
|
|
3222
|
+
*
|
|
3223
|
+
* @param operationData
|
|
3224
|
+
*/
|
|
3225
|
+
|
|
3226
|
+
var calc$1 = function calc(operationData) {
|
|
3227
|
+
operationData = resolvePropertyValues(operationData, operationData);
|
|
3228
|
+
var _operationData = operationData,
|
|
3229
|
+
left = _operationData.left,
|
|
3230
|
+
right = _operationData.right,
|
|
3231
|
+
operator = _operationData.operator,
|
|
3232
|
+
_operationData$proper = _operationData.propertyName,
|
|
3233
|
+
propertyName = _operationData$proper === void 0 ? 'calculationResult' : _operationData$proper;
|
|
3234
|
+
operationData[propertyName] = calcFunctions[operator](+left, +right);
|
|
3235
|
+
return operationData;
|
|
3236
|
+
};
|
|
3237
|
+
|
|
3238
|
+
/**
|
|
3239
|
+
* This operation removes all of the children from the specified selected element.
|
|
3240
|
+
*/
|
|
3241
|
+
var clearElement$1 = function clearElement(operationData) {
|
|
3242
|
+
var selectedElement = operationData.selectedElement;
|
|
3243
|
+
selectedElement.empty();
|
|
3244
|
+
return operationData;
|
|
3245
|
+
};
|
|
3246
|
+
|
|
3247
|
+
/**
|
|
3248
|
+
* This operation removes all of the properties on the current operation date.
|
|
3249
|
+
* Or, if the properties property is set only removes the properties defined by that list.
|
|
3250
|
+
*/
|
|
3251
|
+
var clearOperationData$1 = function clearOperationData(operationData) {
|
|
3252
|
+
var properties = operationData.properties;
|
|
3253
|
+
|
|
3254
|
+
if (properties) {
|
|
3255
|
+
properties.forEach(function (name) {
|
|
3256
|
+
delete operationData[name];
|
|
3257
|
+
});
|
|
3258
|
+
delete operationData.properties;
|
|
3259
|
+
return operationData;
|
|
3260
|
+
}
|
|
3261
|
+
|
|
3262
|
+
return {};
|
|
3263
|
+
};
|
|
3264
|
+
|
|
2977
3265
|
/**
|
|
2978
3266
|
* This operation creates the DOM element defined by the given properties and assigns
|
|
2979
3267
|
* the instance to the give property name on the current operation data.
|
|
@@ -3448,6 +3736,38 @@ var log$1 = function log(operationData) {
|
|
|
3448
3736
|
return operationData;
|
|
3449
3737
|
};
|
|
3450
3738
|
|
|
3739
|
+
/**
|
|
3740
|
+
* This operation performs the given math function of the specified arguments.
|
|
3741
|
+
*
|
|
3742
|
+
* @param operationData
|
|
3743
|
+
*/
|
|
3744
|
+
|
|
3745
|
+
var math$1 = function math(operationData) {
|
|
3746
|
+
operationData = resolvePropertyValues(operationData, operationData);
|
|
3747
|
+
operationData.args = resolveMathConstants(operationData.args);
|
|
3748
|
+
var _operationData = operationData,
|
|
3749
|
+
args = _operationData.args,
|
|
3750
|
+
functionName = _operationData.functionName,
|
|
3751
|
+
_operationData$proper = _operationData.propertyName,
|
|
3752
|
+
propertyName = _operationData$proper === void 0 ? 'mathResult' : _operationData$proper;
|
|
3753
|
+
operationData[propertyName] = Math[functionName].apply(null, args);
|
|
3754
|
+
return operationData;
|
|
3755
|
+
};
|
|
3756
|
+
|
|
3757
|
+
function resolveMathConstants(args) {
|
|
3758
|
+
return args.map(function (arg) {
|
|
3759
|
+
if (isMathProperty(arg)) {
|
|
3760
|
+
return Math[arg];
|
|
3761
|
+
}
|
|
3762
|
+
|
|
3763
|
+
return arg;
|
|
3764
|
+
});
|
|
3765
|
+
}
|
|
3766
|
+
|
|
3767
|
+
function isMathProperty(value) {
|
|
3768
|
+
return typeof value === 'string' && value in Math && typeof Math[value] !== 'function';
|
|
3769
|
+
}
|
|
3770
|
+
|
|
3451
3771
|
/**
|
|
3452
3772
|
* This operation removes the spcified class name from the specified selected element.
|
|
3453
3773
|
*
|
|
@@ -3825,6 +4145,7 @@ var ops = {
|
|
|
3825
4145
|
animate: animate$1,
|
|
3826
4146
|
animateWithClass: animateWithClass$1,
|
|
3827
4147
|
broadcastEvent: broadcastEvent$1,
|
|
4148
|
+
calc: calc$1,
|
|
3828
4149
|
clearElement: clearElement$1,
|
|
3829
4150
|
clearOperationData: clearOperationData$1,
|
|
3830
4151
|
createElement: createElement$1,
|
|
@@ -3838,6 +4159,7 @@ var ops = {
|
|
|
3838
4159
|
getImport: getImport$1,
|
|
3839
4160
|
loadJSON: loadJSON$1,
|
|
3840
4161
|
log: log$1,
|
|
4162
|
+
math: math$1,
|
|
3841
4163
|
removeClass: removeClass$1,
|
|
3842
4164
|
removeControllerFromElement: removeControllerFromElement$1,
|
|
3843
4165
|
removeElement: removeElement$1,
|
|
@@ -4364,13 +4686,13 @@ var operations = ops;
|
|
|
4364
4686
|
var controllers = ctrls;
|
|
4365
4687
|
var providers = prvdrs;
|
|
4366
4688
|
var eventbus = evtb;
|
|
4367
|
-
var
|
|
4368
|
-
function
|
|
4689
|
+
var EligiusResourceImporter = /*#__PURE__*/function () {
|
|
4690
|
+
function EligiusResourceImporter() {
|
|
4369
4691
|
this.engines = new Map();
|
|
4370
4692
|
this.engines.set('EligiusEngine', EligiusEngine);
|
|
4371
4693
|
}
|
|
4372
4694
|
|
|
4373
|
-
var _proto =
|
|
4695
|
+
var _proto = EligiusResourceImporter.prototype;
|
|
4374
4696
|
|
|
4375
4697
|
_proto.getOperationNames = function getOperationNames() {
|
|
4376
4698
|
return Object.keys(operations);
|
|
@@ -4391,7 +4713,7 @@ var WebpackResourceImporter = /*#__PURE__*/function () {
|
|
|
4391
4713
|
return _ref4 = {}, _ref4[name] = value, _ref4;
|
|
4392
4714
|
};
|
|
4393
4715
|
|
|
4394
|
-
return
|
|
4716
|
+
return EligiusResourceImporter;
|
|
4395
4717
|
}();
|
|
4396
4718
|
|
|
4397
4719
|
function addClass() {
|
|
@@ -4460,6 +4782,53 @@ function broadcastEvent() {
|
|
|
4460
4782
|
};
|
|
4461
4783
|
}
|
|
4462
4784
|
|
|
4785
|
+
function calc() {
|
|
4786
|
+
return {
|
|
4787
|
+
description: 'clears the given element',
|
|
4788
|
+
properties: {
|
|
4789
|
+
left: {
|
|
4790
|
+
type: 'ParameterType:integer',
|
|
4791
|
+
description: 'The left operand',
|
|
4792
|
+
required: true
|
|
4793
|
+
},
|
|
4794
|
+
right: {
|
|
4795
|
+
type: 'ParameterType:integer',
|
|
4796
|
+
description: 'The right operand',
|
|
4797
|
+
required: true
|
|
4798
|
+
},
|
|
4799
|
+
operator: [{
|
|
4800
|
+
value: '+',
|
|
4801
|
+
description: 'Adds the left and right operands'
|
|
4802
|
+
}, {
|
|
4803
|
+
value: '-',
|
|
4804
|
+
description: 'Subtracts the left and right operands'
|
|
4805
|
+
}, {
|
|
4806
|
+
value: '*',
|
|
4807
|
+
description: 'Multiplies the left and right operands'
|
|
4808
|
+
}, {
|
|
4809
|
+
value: '/',
|
|
4810
|
+
description: 'Divides the left and right operands'
|
|
4811
|
+
}, {
|
|
4812
|
+
value: '%',
|
|
4813
|
+
description: 'Returns the remainder left over after the left number is divided into a number of integer portions equal to the right number'
|
|
4814
|
+
}, {
|
|
4815
|
+
value: '**',
|
|
4816
|
+
description: 'Exponent: Raises a base number to the exponent power, that is, the base number multiplied by itself, exponent times.'
|
|
4817
|
+
}],
|
|
4818
|
+
propertyName: {
|
|
4819
|
+
type: 'ParameterType:string',
|
|
4820
|
+
defaultValue: 'calculationResult'
|
|
4821
|
+
}
|
|
4822
|
+
}
|
|
4823
|
+
/*outputProperties: {
|
|
4824
|
+
propertyName: {
|
|
4825
|
+
type: 'ParameterType:integer',
|
|
4826
|
+
},
|
|
4827
|
+
},*/
|
|
4828
|
+
|
|
4829
|
+
};
|
|
4830
|
+
}
|
|
4831
|
+
|
|
4463
4832
|
function clearElement() {
|
|
4464
4833
|
return {
|
|
4465
4834
|
description: 'clears the given element',
|
|
@@ -4620,6 +4989,33 @@ function log() {
|
|
|
4620
4989
|
};
|
|
4621
4990
|
}
|
|
4622
4991
|
|
|
4992
|
+
function math() {
|
|
4993
|
+
return {
|
|
4994
|
+
description: 'This operation performs the given math function of the specified arguments.',
|
|
4995
|
+
properties: {
|
|
4996
|
+
args: {
|
|
4997
|
+
type: 'ParameterType:array',
|
|
4998
|
+
required: true
|
|
4999
|
+
},
|
|
5000
|
+
functionName: createMathFunctionNames(),
|
|
5001
|
+
propertyName: {
|
|
5002
|
+
type: 'ParameterType:string',
|
|
5003
|
+
defaultValue: 'mathResult'
|
|
5004
|
+
}
|
|
5005
|
+
}
|
|
5006
|
+
};
|
|
5007
|
+
}
|
|
5008
|
+
|
|
5009
|
+
function createMathFunctionNames() {
|
|
5010
|
+
return Object.getOwnPropertyNames(Math).filter(function (x) {
|
|
5011
|
+
return typeof Math[x] === 'function';
|
|
5012
|
+
}).map(function (functionName) {
|
|
5013
|
+
return {
|
|
5014
|
+
value: functionName
|
|
5015
|
+
};
|
|
5016
|
+
});
|
|
5017
|
+
}
|
|
5018
|
+
|
|
4623
5019
|
function removeClass() {
|
|
4624
5020
|
return {
|
|
4625
5021
|
description: 'Removes the specified class from the selected element',
|
|
@@ -4680,7 +5076,8 @@ function requestAction() {
|
|
|
4680
5076
|
description: 'Retrieves an instance of the specified action',
|
|
4681
5077
|
properties: {
|
|
4682
5078
|
systemName: {
|
|
4683
|
-
type: 'ParameterType:actionName'
|
|
5079
|
+
type: 'ParameterType:actionName',
|
|
5080
|
+
required: true
|
|
4684
5081
|
}
|
|
4685
5082
|
},
|
|
4686
5083
|
outputProperties: {
|
|
@@ -4847,6 +5244,7 @@ var index = {
|
|
|
4847
5244
|
animate: animate,
|
|
4848
5245
|
animateWithClass: animateWithClass,
|
|
4849
5246
|
broadcastEvent: broadcastEvent,
|
|
5247
|
+
calc: calc,
|
|
4850
5248
|
clearElement: clearElement,
|
|
4851
5249
|
clearOperationData: clearOperationData,
|
|
4852
5250
|
createElement: createElement,
|
|
@@ -4860,6 +5258,7 @@ var index = {
|
|
|
4860
5258
|
getImport: getImport,
|
|
4861
5259
|
loadJSON: loadJSON,
|
|
4862
5260
|
log: log,
|
|
5261
|
+
math: math,
|
|
4863
5262
|
removeClass: removeClass,
|
|
4864
5263
|
removeControllerFromElement: removeControllerFromElement,
|
|
4865
5264
|
removeElement: removeElement,
|
|
@@ -4879,5 +5278,5 @@ var index = {
|
|
|
4879
5278
|
wait: wait
|
|
4880
5279
|
};
|
|
4881
5280
|
|
|
4882
|
-
export { Action, ActionRegistryEventbusListener, ConfigurationResolver, EligiusEngine, EndableAction, EngineFactory, EventListenerController, Eventbus, JwPlayerTimelineProvider, LabelController, LanguageManager, LottieController, NavigationController, ProgressbarController, RequestAnimationFrameTimelineProvider, RequestVideoUriInterceptor, RoutingController, SubtitlesController, TimelineAction, TimelineEventNames,
|
|
5281
|
+
export { Action, ActionRegistryEventbusListener, ConfigurationResolver, DEV_TOOLS_KEY, DevToolEventListener, Diagnostics, EligiusEngine, EligiusResourceImporter, EndableAction, EngineFactory, EventListenerController, Eventbus, JwPlayerTimelineProvider, LabelController, LanguageManager, LottieController, NavigationController, ProgressbarController, RequestAnimationFrameTimelineProvider, RequestVideoUriInterceptor, RoutingController, SubtitlesController, TimelineAction, TimelineEventNames, 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, extendController$1 as extendController, generateImporterSourceCode, getControllerFromElement$1 as getControllerFromElement, getControllerInstance$1 as getControllerInstance, getElementDimensions$1 as getElementDimensions, getImport$1 as getImport, loadJSON$1 as loadJSON, log$1 as log, math$1 as math, index as metadata, 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, setElementAttributes$1 as setElementAttributes, setElementContent$1 as setElementContent, 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$1 as wait };
|
|
4883
5282
|
//# sourceMappingURL=eligius.esm.js.map
|