eligius 1.0.3 → 1.0.4
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 +450 -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 +442 -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
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var tsIsPresent = require('ts-is-present');
|
|
6
|
+
var fs = require('fs');
|
|
7
|
+
var path = require('path');
|
|
6
8
|
var lottie = require('lottie-web');
|
|
7
9
|
var $ = require('jquery');
|
|
8
10
|
var Mousetrap = require('mousetrap');
|
|
@@ -10,6 +12,8 @@ var uuid = require('uuid');
|
|
|
10
12
|
|
|
11
13
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
14
|
|
|
15
|
+
var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
|
|
16
|
+
var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
|
|
13
17
|
var lottie__default = /*#__PURE__*/_interopDefaultLegacy(lottie);
|
|
14
18
|
var $__default = /*#__PURE__*/_interopDefaultLegacy($);
|
|
15
19
|
var Mousetrap__default = /*#__PURE__*/_interopDefaultLegacy(Mousetrap);
|
|
@@ -591,6 +595,203 @@ var TimelineAction = /*#__PURE__*/function (_EndableAction) {
|
|
|
591
595
|
return TimelineAction;
|
|
592
596
|
}(EndableAction);
|
|
593
597
|
|
|
598
|
+
function dashToCamelCase(input) {
|
|
599
|
+
return input.replace(/-([a-z])/g, function (g) {
|
|
600
|
+
return g[1].toUpperCase();
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
* This function takes an Eligius engine configuration, a root path for the config and an arbitrary list of asset info.
|
|
606
|
+
* The asset info determines a number of subdirectories in the root path that contain the different assets used by the presentation.
|
|
607
|
+
* I.e. html, json, etc.
|
|
608
|
+
*
|
|
609
|
+
* @param config
|
|
610
|
+
* @param configPath
|
|
611
|
+
* @param assetInfo
|
|
612
|
+
*/
|
|
613
|
+
|
|
614
|
+
function generateImporterSourceCode(config, configPath, assetInfo) {
|
|
615
|
+
var importPaths = _gatherImportPaths(config, configPath, assetInfo);
|
|
616
|
+
|
|
617
|
+
var importerSourceCode = _generateSourceCode(importPaths);
|
|
618
|
+
|
|
619
|
+
return importerSourceCode;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
function _generateSourceCode(importPaths) {
|
|
623
|
+
var result = importPaths.filter(function (x) {
|
|
624
|
+
return x.defaultImport;
|
|
625
|
+
}).map(function (imp) {
|
|
626
|
+
return "import " + imp.systemName + " from '" + imp.path + "';";
|
|
627
|
+
}).concat(importPaths.filter(function (x) {
|
|
628
|
+
return !x.defaultImport;
|
|
629
|
+
}).map(function (imp) {
|
|
630
|
+
var _imp$path;
|
|
631
|
+
|
|
632
|
+
return "import {" + imp.systemName + "} from '" + ((_imp$path = imp.path) != null ? _imp$path : 'eligius') + "';";
|
|
633
|
+
}));
|
|
634
|
+
result.push('const imports: Record<string, any> = {');
|
|
635
|
+
result.push.apply(result, importPaths.map(function (imp) {
|
|
636
|
+
return imp.systemName + ": { '" + imp.systemName + "': " + imp.systemName + " },";
|
|
637
|
+
}));
|
|
638
|
+
result.push('};');
|
|
639
|
+
result.push('class EligiusResourceImporter implements ISimpleResourceImporter {');
|
|
640
|
+
result.push('import(name: string): Record<string, any> {');
|
|
641
|
+
result.push('if (imports.hasOwnProperty(name)) { return imports[name]; }');
|
|
642
|
+
result.push('throw Error(`Unknown systemName: ${name}`);');
|
|
643
|
+
result.push('}}');
|
|
644
|
+
result.push('export default EligiusResourceImporter;');
|
|
645
|
+
return result.join('\n');
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
function _gatherImportPaths(config, configPath, assetInfo) {
|
|
649
|
+
return [].concat(_gatherOperations(config), assetInfo.flatMap(function (info) {
|
|
650
|
+
return _gatherAssets(configPath, info.path, info.extension);
|
|
651
|
+
}), _gatherControllers(config), _gatherProviders(config), _gatherEngines(config));
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
function _gatherAssets(assetPath, subdir, extension) {
|
|
655
|
+
var entries = fs__default["default"].readdirSync(path__default["default"].join(assetPath, subdir));
|
|
656
|
+
return entries.map(function (file) {
|
|
657
|
+
var importName = "" + dashToCamelCase(path__default["default"].basename(file, extension));
|
|
658
|
+
return {
|
|
659
|
+
systemName: importName,
|
|
660
|
+
path: "./" + subdir + "/" + file,
|
|
661
|
+
defaultImport: true
|
|
662
|
+
};
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
function _gatherControllers(config) {
|
|
667
|
+
var _importPaths, _importPaths2, _importPaths3, _importPaths4;
|
|
668
|
+
|
|
669
|
+
var importPaths = [];
|
|
670
|
+
|
|
671
|
+
(_importPaths = importPaths).push.apply(_importPaths, _gatherControllerImportPathsFromActions(config.initActions));
|
|
672
|
+
|
|
673
|
+
(_importPaths2 = importPaths).push.apply(_importPaths2, _gatherControllerImportPathsFromActions(config.actions));
|
|
674
|
+
|
|
675
|
+
(_importPaths3 = importPaths).push.apply(_importPaths3, _gatherControllerImportPathsFromActions(config.timelines.flatMap(function (x) {
|
|
676
|
+
return x.timelineActions;
|
|
677
|
+
})));
|
|
678
|
+
|
|
679
|
+
(_importPaths4 = importPaths).push.apply(_importPaths4, _gatherControllerImportPathsFromActions(config.eventActions));
|
|
680
|
+
|
|
681
|
+
importPaths = dedupe(importPaths);
|
|
682
|
+
return importPaths;
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
function _gatherProviders(config) {
|
|
686
|
+
if (config.timelineProviderSettings) {
|
|
687
|
+
return Object.values(config.timelineProviderSettings).map(function (settings) {
|
|
688
|
+
return {
|
|
689
|
+
systemName: settings.systemName
|
|
690
|
+
};
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
return [];
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
function _gatherEngines(config) {
|
|
698
|
+
if (config.engine) {
|
|
699
|
+
var systemName = config.engine.systemName;
|
|
700
|
+
return [{
|
|
701
|
+
systemName: systemName
|
|
702
|
+
}];
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
return [];
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
function _gatherOperations(config) {
|
|
709
|
+
var _config$eventActions;
|
|
710
|
+
|
|
711
|
+
var importPaths = _gatherOperationImportPathsFromActions(config.initActions.concat(config.actions).concat((_config$eventActions = config.eventActions) != null ? _config$eventActions : []));
|
|
712
|
+
|
|
713
|
+
if (config.timelines) {
|
|
714
|
+
var timelineActions = config.timelines.flatMap(function (x) {
|
|
715
|
+
return x.timelineActions;
|
|
716
|
+
});
|
|
717
|
+
importPaths = importPaths.concat(_gatherOperationImportPathsFromActions(timelineActions));
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
return dedupe(importPaths);
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
function _gatherControllerImportPathsFromActions(actionsConfig) {
|
|
724
|
+
if (!actionsConfig) {
|
|
725
|
+
return [];
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
var operations = actionsConfig.flatMap(function (x) {
|
|
729
|
+
var _x$endOperations;
|
|
730
|
+
|
|
731
|
+
return [].concat(x.startOperations, (_x$endOperations = x.endOperations) != null ? _x$endOperations : []);
|
|
732
|
+
});
|
|
733
|
+
return _gatherControllerImportPaths(operations);
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
function _gatherOperationImportPathsFromActions(actionsConfig) {
|
|
737
|
+
if (!actionsConfig) {
|
|
738
|
+
return [];
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
var operations = actionsConfig.flatMap(function (x) {
|
|
742
|
+
var _x$endOperations2;
|
|
743
|
+
|
|
744
|
+
return [].concat(x.startOperations, (_x$endOperations2 = x.endOperations) != null ? _x$endOperations2 : []);
|
|
745
|
+
});
|
|
746
|
+
return _gatherOperationImportPaths(operations);
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
function _gatherControllerImportPaths(operationConfigs) {
|
|
750
|
+
if (!operationConfigs) {
|
|
751
|
+
return [];
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
return operationConfigs.filter(function (operationConfig) {
|
|
755
|
+
var _operationConfig$oper;
|
|
756
|
+
|
|
757
|
+
if ((_operationConfig$oper = operationConfig.operationData) != null && _operationConfig$oper.hasOwnProperty('systemName')) {
|
|
758
|
+
return operationConfig.operationData.systemName.endsWith('Controller');
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
return false;
|
|
762
|
+
}).map(function (operationConfig) {
|
|
763
|
+
var systemName = operationConfig.operationData.systemName;
|
|
764
|
+
return {
|
|
765
|
+
systemName: systemName
|
|
766
|
+
};
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
function _gatherOperationImportPaths(operationConfigs) {
|
|
771
|
+
if (!operationConfigs) {
|
|
772
|
+
return [];
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
return operationConfigs.map(function (operationConfig) {
|
|
776
|
+
var systemName = operationConfig.systemName;
|
|
777
|
+
return {
|
|
778
|
+
systemName: systemName
|
|
779
|
+
};
|
|
780
|
+
});
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
function dedupe(importPaths) {
|
|
784
|
+
var lookup = {};
|
|
785
|
+
return importPaths.filter(function (imp) {
|
|
786
|
+
if (lookup[imp.systemName]) {
|
|
787
|
+
return false;
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
lookup[imp.systemName] = true;
|
|
791
|
+
return true;
|
|
792
|
+
});
|
|
793
|
+
}
|
|
794
|
+
|
|
594
795
|
function getNestedValue(properties, sourceObject) {
|
|
595
796
|
if (!properties) {
|
|
596
797
|
throw Error('properties arg cannot be null');
|
|
@@ -1759,6 +1960,34 @@ var ctrls = {
|
|
|
1759
1960
|
SubtitlesController: SubtitlesController
|
|
1760
1961
|
};
|
|
1761
1962
|
|
|
1963
|
+
var DevToolEventListener = /*#__PURE__*/function () {
|
|
1964
|
+
function DevToolEventListener(agent) {
|
|
1965
|
+
this.agent = void 0;
|
|
1966
|
+
this.agent = agent;
|
|
1967
|
+
}
|
|
1968
|
+
|
|
1969
|
+
var _proto = DevToolEventListener.prototype;
|
|
1970
|
+
|
|
1971
|
+
_proto.handleEvent = function handleEvent(eventName, eventTopic, args) {
|
|
1972
|
+
this.agent.postMessage('eligius-diagnostics-event', {
|
|
1973
|
+
eventName: eventName,
|
|
1974
|
+
eventTopic: eventTopic
|
|
1975
|
+
});
|
|
1976
|
+
};
|
|
1977
|
+
|
|
1978
|
+
return DevToolEventListener;
|
|
1979
|
+
}();
|
|
1980
|
+
|
|
1981
|
+
var Diagnostics = /*#__PURE__*/function () {
|
|
1982
|
+
function Diagnostics() {}
|
|
1983
|
+
|
|
1984
|
+
Diagnostics.send = function send(_name, _data) {};
|
|
1985
|
+
|
|
1986
|
+
return Diagnostics;
|
|
1987
|
+
}();
|
|
1988
|
+
|
|
1989
|
+
var DEV_TOOLS_KEY = '__ELIGIUS_DEV_TOOLS__';
|
|
1990
|
+
|
|
1762
1991
|
/**
|
|
1763
1992
|
* EligiusEngine, this is where the magic happens. The engine is responsible for starting and stopping
|
|
1764
1993
|
* the given timeline provider and triggering the actions associated with it.
|
|
@@ -1820,6 +2049,7 @@ var EligiusEngine = /*#__PURE__*/function () {
|
|
|
1820
2049
|
|
|
1821
2050
|
_proto._initializeTimelineProvider = function _initializeTimelineProvider() {
|
|
1822
2051
|
var _this$configuration$t,
|
|
2052
|
+
_this$_activeTimeline,
|
|
1823
2053
|
_this = this;
|
|
1824
2054
|
|
|
1825
2055
|
if (!((_this$configuration$t = this.configuration.timelines) != null && _this$configuration$t.length)) {
|
|
@@ -1833,10 +2063,7 @@ var EligiusEngine = /*#__PURE__*/function () {
|
|
|
1833
2063
|
throw new Error("No timeline provider configured for type " + firstTimeline.type);
|
|
1834
2064
|
}
|
|
1835
2065
|
|
|
1836
|
-
|
|
1837
|
-
this._activeTimelineProvider.destroy();
|
|
1838
|
-
}
|
|
1839
|
-
|
|
2066
|
+
(_this$_activeTimeline = this._activeTimelineProvider) == null ? void 0 : _this$_activeTimeline.destroy();
|
|
1840
2067
|
this._activeTimelineProvider = providerSettings.provider;
|
|
1841
2068
|
return new Promise( /*#__PURE__*/function () {
|
|
1842
2069
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(resolve) {
|
|
@@ -1908,6 +2135,7 @@ var EligiusEngine = /*#__PURE__*/function () {
|
|
|
1908
2135
|
|
|
1909
2136
|
_proto.destroy = /*#__PURE__*/function () {
|
|
1910
2137
|
var _destroy = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
2138
|
+
var containerSelector, container;
|
|
1911
2139
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
1912
2140
|
while (1) {
|
|
1913
2141
|
switch (_context3.prev = _context3.next) {
|
|
@@ -1923,12 +2151,16 @@ var EligiusEngine = /*#__PURE__*/function () {
|
|
|
1923
2151
|
});
|
|
1924
2152
|
|
|
1925
2153
|
if (this.timelineProviders) {
|
|
1926
|
-
Object.values(this.timelineProviders).forEach(function (
|
|
1927
|
-
return
|
|
2154
|
+
Object.values(this.timelineProviders).forEach(function (providerInfo) {
|
|
2155
|
+
return providerInfo.provider.destroy();
|
|
1928
2156
|
});
|
|
1929
2157
|
}
|
|
1930
2158
|
|
|
1931
|
-
|
|
2159
|
+
containerSelector = this.configuration.containerSelector;
|
|
2160
|
+
container = $__default["default"](containerSelector);
|
|
2161
|
+
container.empty();
|
|
2162
|
+
|
|
2163
|
+
case 8:
|
|
1932
2164
|
case "end":
|
|
1933
2165
|
return _context3.stop();
|
|
1934
2166
|
}
|
|
@@ -2197,9 +2429,9 @@ var EligiusEngine = /*#__PURE__*/function () {
|
|
|
2197
2429
|
};
|
|
2198
2430
|
|
|
2199
2431
|
_proto._handleRequestTimelinePosition = function _handleRequestTimelinePosition(floor, resultCallback) {
|
|
2200
|
-
var _this$
|
|
2432
|
+
var _this$_activeTimeline2;
|
|
2201
2433
|
|
|
2202
|
-
resultCallback(floor(((_this$
|
|
2434
|
+
resultCallback(floor(((_this$_activeTimeline2 = this._activeTimelineProvider) == null ? void 0 : _this$_activeTimeline2.getPosition()) || -1));
|
|
2203
2435
|
};
|
|
2204
2436
|
|
|
2205
2437
|
_proto._handleTimelineComplete = function _handleTimelineComplete() {
|
|
@@ -2245,19 +2477,19 @@ var EligiusEngine = /*#__PURE__*/function () {
|
|
|
2245
2477
|
|
|
2246
2478
|
_proto._onTimeHandler = function _onTimeHandler(floor, event) {
|
|
2247
2479
|
if (!isNaN(event.position)) {
|
|
2248
|
-
var _this$
|
|
2480
|
+
var _this$_activeTimeline4;
|
|
2249
2481
|
|
|
2250
2482
|
var pos = floor(event.position);
|
|
2251
2483
|
|
|
2252
2484
|
if (this._lastPosition !== pos) {
|
|
2253
|
-
var _this$
|
|
2485
|
+
var _this$_activeTimeline3;
|
|
2254
2486
|
|
|
2255
2487
|
this._executeActionsForPosition(pos);
|
|
2256
2488
|
|
|
2257
|
-
this.eventbus.broadcast(TimelineEventNames.POSITION_UPDATE, [pos, (_this$
|
|
2489
|
+
this.eventbus.broadcast(TimelineEventNames.POSITION_UPDATE, [pos, (_this$_activeTimeline3 = this._activeTimelineProvider) == null ? void 0 : _this$_activeTimeline3.getDuration()]);
|
|
2258
2490
|
}
|
|
2259
2491
|
|
|
2260
|
-
this.eventbus.broadcast(TimelineEventNames.TIME_UPDATE, [event.position, (_this$
|
|
2492
|
+
this.eventbus.broadcast(TimelineEventNames.TIME_UPDATE, [event.position, (_this$_activeTimeline4 = this._activeTimelineProvider) == null ? void 0 : _this$_activeTimeline4.getDuration()]);
|
|
2261
2493
|
}
|
|
2262
2494
|
};
|
|
2263
2495
|
|
|
@@ -2612,6 +2844,9 @@ var EngineFactory = /*#__PURE__*/function () {
|
|
|
2612
2844
|
this.eventbus = void 0;
|
|
2613
2845
|
this.importer = importer;
|
|
2614
2846
|
this.eventbus = eventbus || new Eventbus();
|
|
2847
|
+
|
|
2848
|
+
this._initializeDevtools(this.eventbus);
|
|
2849
|
+
|
|
2615
2850
|
this.eventbus.on(TimelineEventNames.REQUEST_INSTANCE, this._requestInstanceHandler.bind(this));
|
|
2616
2851
|
this.eventbus.on(TimelineEventNames.REQUEST_ACTION, this._requestActionHandler.bind(this));
|
|
2617
2852
|
this.eventbus.on(TimelineEventNames.REQUEST_FUNCTION, this._requestFunctionHandler.bind(this));
|
|
@@ -2620,6 +2855,20 @@ var EngineFactory = /*#__PURE__*/function () {
|
|
|
2620
2855
|
|
|
2621
2856
|
var _proto = EngineFactory.prototype;
|
|
2622
2857
|
|
|
2858
|
+
_proto._initializeDevtools = function _initializeDevtools(eventbus) {
|
|
2859
|
+
var diagnosticInfo = window[DEV_TOOLS_KEY];
|
|
2860
|
+
|
|
2861
|
+
if (diagnosticInfo) {
|
|
2862
|
+
var agent = diagnosticInfo.agent;
|
|
2863
|
+
var eventbusListener = new DevToolEventListener(agent);
|
|
2864
|
+
eventbus.registerEventlistener(eventbusListener);
|
|
2865
|
+
|
|
2866
|
+
Diagnostics.send = function (name, data) {
|
|
2867
|
+
agent.postMessage(name, data);
|
|
2868
|
+
};
|
|
2869
|
+
}
|
|
2870
|
+
};
|
|
2871
|
+
|
|
2623
2872
|
_proto.destroy = function destroy() {
|
|
2624
2873
|
this.eventbus.clear();
|
|
2625
2874
|
};
|
|
@@ -2894,7 +3143,6 @@ function resolveEventArguments(operationData, eventArgs) {
|
|
|
2894
3143
|
* event argumetns and optional event topic.
|
|
2895
3144
|
*
|
|
2896
3145
|
* @param operationData
|
|
2897
|
-
* @returns
|
|
2898
3146
|
*/
|
|
2899
3147
|
|
|
2900
3148
|
var broadcastEvent$1 = function broadcastEvent(operationData) {
|
|
@@ -2913,33 +3161,6 @@ var broadcastEvent$1 = function broadcastEvent(operationData) {
|
|
|
2913
3161
|
return operationData;
|
|
2914
3162
|
};
|
|
2915
3163
|
|
|
2916
|
-
/**
|
|
2917
|
-
* This operation removes all of the children from the specified selected element.
|
|
2918
|
-
*/
|
|
2919
|
-
var clearElement$1 = function clearElement(operationData) {
|
|
2920
|
-
var selectedElement = operationData.selectedElement;
|
|
2921
|
-
selectedElement.empty();
|
|
2922
|
-
return operationData;
|
|
2923
|
-
};
|
|
2924
|
-
|
|
2925
|
-
/**
|
|
2926
|
-
* This operation removes all of the properties on the current operation date.
|
|
2927
|
-
* Or, if the properties property is set only removes the properties defined by that list.
|
|
2928
|
-
*/
|
|
2929
|
-
var clearOperationData$1 = function clearOperationData(operationData) {
|
|
2930
|
-
var properties = operationData.properties;
|
|
2931
|
-
|
|
2932
|
-
if (properties) {
|
|
2933
|
-
properties.forEach(function (name) {
|
|
2934
|
-
delete operationData[name];
|
|
2935
|
-
});
|
|
2936
|
-
delete operationData.properties;
|
|
2937
|
-
return operationData;
|
|
2938
|
-
}
|
|
2939
|
-
|
|
2940
|
-
return {};
|
|
2941
|
-
};
|
|
2942
|
-
|
|
2943
3164
|
var cache = [];
|
|
2944
3165
|
function resolvePropertyValues(operationData, properties) {
|
|
2945
3166
|
var copy = properties !== operationData ? deepCopy(properties) : properties;
|
|
@@ -2984,6 +3205,71 @@ function resolveProperties(properties, copy, extract) {
|
|
|
2984
3205
|
}
|
|
2985
3206
|
}
|
|
2986
3207
|
|
|
3208
|
+
var calcFunctions = {
|
|
3209
|
+
'+': function _(left, right) {
|
|
3210
|
+
return left + right;
|
|
3211
|
+
},
|
|
3212
|
+
'-': function _(left, right) {
|
|
3213
|
+
return left - right;
|
|
3214
|
+
},
|
|
3215
|
+
'*': function _(left, right) {
|
|
3216
|
+
return left * right;
|
|
3217
|
+
},
|
|
3218
|
+
'/': function _(left, right) {
|
|
3219
|
+
return left / right;
|
|
3220
|
+
},
|
|
3221
|
+
'%': function _(left, right) {
|
|
3222
|
+
return left % right;
|
|
3223
|
+
},
|
|
3224
|
+
'**': function _(left, right) {
|
|
3225
|
+
return Math.pow(left, right);
|
|
3226
|
+
}
|
|
3227
|
+
};
|
|
3228
|
+
/**
|
|
3229
|
+
* This operation calculates the given left and right hand sides using the specified operator.
|
|
3230
|
+
*
|
|
3231
|
+
* @param operationData
|
|
3232
|
+
*/
|
|
3233
|
+
|
|
3234
|
+
var calc$1 = function calc(operationData) {
|
|
3235
|
+
operationData = resolvePropertyValues(operationData, operationData);
|
|
3236
|
+
var _operationData = operationData,
|
|
3237
|
+
left = _operationData.left,
|
|
3238
|
+
right = _operationData.right,
|
|
3239
|
+
operator = _operationData.operator,
|
|
3240
|
+
_operationData$proper = _operationData.propertyName,
|
|
3241
|
+
propertyName = _operationData$proper === void 0 ? 'calculationResult' : _operationData$proper;
|
|
3242
|
+
operationData[propertyName] = calcFunctions[operator](+left, +right);
|
|
3243
|
+
return operationData;
|
|
3244
|
+
};
|
|
3245
|
+
|
|
3246
|
+
/**
|
|
3247
|
+
* This operation removes all of the children from the specified selected element.
|
|
3248
|
+
*/
|
|
3249
|
+
var clearElement$1 = function clearElement(operationData) {
|
|
3250
|
+
var selectedElement = operationData.selectedElement;
|
|
3251
|
+
selectedElement.empty();
|
|
3252
|
+
return operationData;
|
|
3253
|
+
};
|
|
3254
|
+
|
|
3255
|
+
/**
|
|
3256
|
+
* This operation removes all of the properties on the current operation date.
|
|
3257
|
+
* Or, if the properties property is set only removes the properties defined by that list.
|
|
3258
|
+
*/
|
|
3259
|
+
var clearOperationData$1 = function clearOperationData(operationData) {
|
|
3260
|
+
var properties = operationData.properties;
|
|
3261
|
+
|
|
3262
|
+
if (properties) {
|
|
3263
|
+
properties.forEach(function (name) {
|
|
3264
|
+
delete operationData[name];
|
|
3265
|
+
});
|
|
3266
|
+
delete operationData.properties;
|
|
3267
|
+
return operationData;
|
|
3268
|
+
}
|
|
3269
|
+
|
|
3270
|
+
return {};
|
|
3271
|
+
};
|
|
3272
|
+
|
|
2987
3273
|
/**
|
|
2988
3274
|
* This operation creates the DOM element defined by the given properties and assigns
|
|
2989
3275
|
* the instance to the give property name on the current operation data.
|
|
@@ -3458,6 +3744,38 @@ var log$1 = function log(operationData) {
|
|
|
3458
3744
|
return operationData;
|
|
3459
3745
|
};
|
|
3460
3746
|
|
|
3747
|
+
/**
|
|
3748
|
+
* This operation performs the given math function of the specified arguments.
|
|
3749
|
+
*
|
|
3750
|
+
* @param operationData
|
|
3751
|
+
*/
|
|
3752
|
+
|
|
3753
|
+
var math$1 = function math(operationData) {
|
|
3754
|
+
operationData = resolvePropertyValues(operationData, operationData);
|
|
3755
|
+
operationData.args = resolveMathConstants(operationData.args);
|
|
3756
|
+
var _operationData = operationData,
|
|
3757
|
+
args = _operationData.args,
|
|
3758
|
+
functionName = _operationData.functionName,
|
|
3759
|
+
_operationData$proper = _operationData.propertyName,
|
|
3760
|
+
propertyName = _operationData$proper === void 0 ? 'mathResult' : _operationData$proper;
|
|
3761
|
+
operationData[propertyName] = Math[functionName].apply(null, args);
|
|
3762
|
+
return operationData;
|
|
3763
|
+
};
|
|
3764
|
+
|
|
3765
|
+
function resolveMathConstants(args) {
|
|
3766
|
+
return args.map(function (arg) {
|
|
3767
|
+
if (isMathProperty(arg)) {
|
|
3768
|
+
return Math[arg];
|
|
3769
|
+
}
|
|
3770
|
+
|
|
3771
|
+
return arg;
|
|
3772
|
+
});
|
|
3773
|
+
}
|
|
3774
|
+
|
|
3775
|
+
function isMathProperty(value) {
|
|
3776
|
+
return typeof value === 'string' && value in Math && typeof Math[value] !== 'function';
|
|
3777
|
+
}
|
|
3778
|
+
|
|
3461
3779
|
/**
|
|
3462
3780
|
* This operation removes the spcified class name from the specified selected element.
|
|
3463
3781
|
*
|
|
@@ -3835,6 +4153,7 @@ var ops = {
|
|
|
3835
4153
|
animate: animate$1,
|
|
3836
4154
|
animateWithClass: animateWithClass$1,
|
|
3837
4155
|
broadcastEvent: broadcastEvent$1,
|
|
4156
|
+
calc: calc$1,
|
|
3838
4157
|
clearElement: clearElement$1,
|
|
3839
4158
|
clearOperationData: clearOperationData$1,
|
|
3840
4159
|
createElement: createElement$1,
|
|
@@ -3848,6 +4167,7 @@ var ops = {
|
|
|
3848
4167
|
getImport: getImport$1,
|
|
3849
4168
|
loadJSON: loadJSON$1,
|
|
3850
4169
|
log: log$1,
|
|
4170
|
+
math: math$1,
|
|
3851
4171
|
removeClass: removeClass$1,
|
|
3852
4172
|
removeControllerFromElement: removeControllerFromElement$1,
|
|
3853
4173
|
removeElement: removeElement$1,
|
|
@@ -4374,13 +4694,13 @@ var operations = ops;
|
|
|
4374
4694
|
var controllers = ctrls;
|
|
4375
4695
|
var providers = prvdrs;
|
|
4376
4696
|
var eventbus = evtb;
|
|
4377
|
-
var
|
|
4378
|
-
function
|
|
4697
|
+
var EligiusResourceImporter = /*#__PURE__*/function () {
|
|
4698
|
+
function EligiusResourceImporter() {
|
|
4379
4699
|
this.engines = new Map();
|
|
4380
4700
|
this.engines.set('EligiusEngine', EligiusEngine);
|
|
4381
4701
|
}
|
|
4382
4702
|
|
|
4383
|
-
var _proto =
|
|
4703
|
+
var _proto = EligiusResourceImporter.prototype;
|
|
4384
4704
|
|
|
4385
4705
|
_proto.getOperationNames = function getOperationNames() {
|
|
4386
4706
|
return Object.keys(operations);
|
|
@@ -4401,7 +4721,7 @@ var WebpackResourceImporter = /*#__PURE__*/function () {
|
|
|
4401
4721
|
return _ref4 = {}, _ref4[name] = value, _ref4;
|
|
4402
4722
|
};
|
|
4403
4723
|
|
|
4404
|
-
return
|
|
4724
|
+
return EligiusResourceImporter;
|
|
4405
4725
|
}();
|
|
4406
4726
|
|
|
4407
4727
|
function addClass() {
|
|
@@ -4470,6 +4790,53 @@ function broadcastEvent() {
|
|
|
4470
4790
|
};
|
|
4471
4791
|
}
|
|
4472
4792
|
|
|
4793
|
+
function calc() {
|
|
4794
|
+
return {
|
|
4795
|
+
description: 'clears the given element',
|
|
4796
|
+
properties: {
|
|
4797
|
+
left: {
|
|
4798
|
+
type: 'ParameterType:integer',
|
|
4799
|
+
description: 'The left operand',
|
|
4800
|
+
required: true
|
|
4801
|
+
},
|
|
4802
|
+
right: {
|
|
4803
|
+
type: 'ParameterType:integer',
|
|
4804
|
+
description: 'The right operand',
|
|
4805
|
+
required: true
|
|
4806
|
+
},
|
|
4807
|
+
operator: [{
|
|
4808
|
+
value: '+',
|
|
4809
|
+
description: 'Adds the left and right operands'
|
|
4810
|
+
}, {
|
|
4811
|
+
value: '-',
|
|
4812
|
+
description: 'Subtracts the left and right operands'
|
|
4813
|
+
}, {
|
|
4814
|
+
value: '*',
|
|
4815
|
+
description: 'Multiplies the left and right operands'
|
|
4816
|
+
}, {
|
|
4817
|
+
value: '/',
|
|
4818
|
+
description: 'Divides the left and right operands'
|
|
4819
|
+
}, {
|
|
4820
|
+
value: '%',
|
|
4821
|
+
description: 'Returns the remainder left over after the left number is divided into a number of integer portions equal to the right number'
|
|
4822
|
+
}, {
|
|
4823
|
+
value: '**',
|
|
4824
|
+
description: 'Exponent: Raises a base number to the exponent power, that is, the base number multiplied by itself, exponent times.'
|
|
4825
|
+
}],
|
|
4826
|
+
propertyName: {
|
|
4827
|
+
type: 'ParameterType:string',
|
|
4828
|
+
defaultValue: 'calculationResult'
|
|
4829
|
+
}
|
|
4830
|
+
}
|
|
4831
|
+
/*outputProperties: {
|
|
4832
|
+
propertyName: {
|
|
4833
|
+
type: 'ParameterType:integer',
|
|
4834
|
+
},
|
|
4835
|
+
},*/
|
|
4836
|
+
|
|
4837
|
+
};
|
|
4838
|
+
}
|
|
4839
|
+
|
|
4473
4840
|
function clearElement() {
|
|
4474
4841
|
return {
|
|
4475
4842
|
description: 'clears the given element',
|
|
@@ -4630,6 +4997,33 @@ function log() {
|
|
|
4630
4997
|
};
|
|
4631
4998
|
}
|
|
4632
4999
|
|
|
5000
|
+
function math() {
|
|
5001
|
+
return {
|
|
5002
|
+
description: 'This operation performs the given math function of the specified arguments.',
|
|
5003
|
+
properties: {
|
|
5004
|
+
args: {
|
|
5005
|
+
type: 'ParameterType:array',
|
|
5006
|
+
required: true
|
|
5007
|
+
},
|
|
5008
|
+
functionName: createMathFunctionNames(),
|
|
5009
|
+
propertyName: {
|
|
5010
|
+
type: 'ParameterType:string',
|
|
5011
|
+
defaultValue: 'mathResult'
|
|
5012
|
+
}
|
|
5013
|
+
}
|
|
5014
|
+
};
|
|
5015
|
+
}
|
|
5016
|
+
|
|
5017
|
+
function createMathFunctionNames() {
|
|
5018
|
+
return Object.getOwnPropertyNames(Math).filter(function (x) {
|
|
5019
|
+
return typeof Math[x] === 'function';
|
|
5020
|
+
}).map(function (functionName) {
|
|
5021
|
+
return {
|
|
5022
|
+
value: functionName
|
|
5023
|
+
};
|
|
5024
|
+
});
|
|
5025
|
+
}
|
|
5026
|
+
|
|
4633
5027
|
function removeClass() {
|
|
4634
5028
|
return {
|
|
4635
5029
|
description: 'Removes the specified class from the selected element',
|
|
@@ -4690,7 +5084,8 @@ function requestAction() {
|
|
|
4690
5084
|
description: 'Retrieves an instance of the specified action',
|
|
4691
5085
|
properties: {
|
|
4692
5086
|
systemName: {
|
|
4693
|
-
type: 'ParameterType:actionName'
|
|
5087
|
+
type: 'ParameterType:actionName',
|
|
5088
|
+
required: true
|
|
4694
5089
|
}
|
|
4695
5090
|
},
|
|
4696
5091
|
outputProperties: {
|
|
@@ -4857,6 +5252,7 @@ var index = {
|
|
|
4857
5252
|
animate: animate,
|
|
4858
5253
|
animateWithClass: animateWithClass,
|
|
4859
5254
|
broadcastEvent: broadcastEvent,
|
|
5255
|
+
calc: calc,
|
|
4860
5256
|
clearElement: clearElement,
|
|
4861
5257
|
clearOperationData: clearOperationData,
|
|
4862
5258
|
createElement: createElement,
|
|
@@ -4870,6 +5266,7 @@ var index = {
|
|
|
4870
5266
|
getImport: getImport,
|
|
4871
5267
|
loadJSON: loadJSON,
|
|
4872
5268
|
log: log,
|
|
5269
|
+
math: math,
|
|
4873
5270
|
removeClass: removeClass,
|
|
4874
5271
|
removeControllerFromElement: removeControllerFromElement,
|
|
4875
5272
|
removeElement: removeElement,
|
|
@@ -4892,7 +5289,11 @@ var index = {
|
|
|
4892
5289
|
exports.Action = Action;
|
|
4893
5290
|
exports.ActionRegistryEventbusListener = ActionRegistryEventbusListener;
|
|
4894
5291
|
exports.ConfigurationResolver = ConfigurationResolver;
|
|
5292
|
+
exports.DEV_TOOLS_KEY = DEV_TOOLS_KEY;
|
|
5293
|
+
exports.DevToolEventListener = DevToolEventListener;
|
|
5294
|
+
exports.Diagnostics = Diagnostics;
|
|
4895
5295
|
exports.EligiusEngine = EligiusEngine;
|
|
5296
|
+
exports.EligiusResourceImporter = EligiusResourceImporter;
|
|
4896
5297
|
exports.EndableAction = EndableAction;
|
|
4897
5298
|
exports.EngineFactory = EngineFactory;
|
|
4898
5299
|
exports.EventListenerController = EventListenerController;
|
|
@@ -4909,12 +5310,12 @@ exports.RoutingController = RoutingController;
|
|
|
4909
5310
|
exports.SubtitlesController = SubtitlesController;
|
|
4910
5311
|
exports.TimelineAction = TimelineAction;
|
|
4911
5312
|
exports.TimelineEventNames = TimelineEventNames;
|
|
4912
|
-
exports.WebpackResourceImporter = WebpackResourceImporter;
|
|
4913
5313
|
exports.addClass = addClass$1;
|
|
4914
5314
|
exports.addControllerToElement = addControllerToElement$1;
|
|
4915
5315
|
exports.animate = animate$1;
|
|
4916
5316
|
exports.animateWithClass = animateWithClass$1;
|
|
4917
5317
|
exports.broadcastEvent = broadcastEvent$1;
|
|
5318
|
+
exports.calc = calc$1;
|
|
4918
5319
|
exports.clearElement = clearElement$1;
|
|
4919
5320
|
exports.clearOperationData = clearOperationData$1;
|
|
4920
5321
|
exports.createElement = createElement$1;
|
|
@@ -4922,12 +5323,14 @@ exports.customFunction = customFunction$1;
|
|
|
4922
5323
|
exports.endAction = endAction$1;
|
|
4923
5324
|
exports.endLoop = endLoop$1;
|
|
4924
5325
|
exports.extendController = extendController$1;
|
|
5326
|
+
exports.generateImporterSourceCode = generateImporterSourceCode;
|
|
4925
5327
|
exports.getControllerFromElement = getControllerFromElement$1;
|
|
4926
5328
|
exports.getControllerInstance = getControllerInstance$1;
|
|
4927
5329
|
exports.getElementDimensions = getElementDimensions$1;
|
|
4928
5330
|
exports.getImport = getImport$1;
|
|
4929
5331
|
exports.loadJSON = loadJSON$1;
|
|
4930
5332
|
exports.log = log$1;
|
|
5333
|
+
exports.math = math$1;
|
|
4931
5334
|
exports.metadata = index;
|
|
4932
5335
|
exports.removeClass = removeClass$1;
|
|
4933
5336
|
exports.removeControllerFromElement = removeControllerFromElement$1;
|