@dualbox/editor 1.0.32 → 1.0.35
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/js/dist/GraphEditor.js +254 -231
- package/js/dist/GraphEditor.min.js +253 -230
- package/js/src/GraphEditor.js +232 -230
- package/package.json +2 -2
|
@@ -39476,7 +39476,7 @@ function () {
|
|
|
39476
39476
|
value: function eachPackage(f) {
|
|
39477
39477
|
var deps = this.getDependencies();
|
|
39478
39478
|
|
|
39479
|
-
_import.each(deps.
|
|
39479
|
+
_import.each(deps.lib, function (version, name) {
|
|
39480
39480
|
f(name, version);
|
|
39481
39481
|
});
|
|
39482
39482
|
|
|
@@ -39488,6 +39488,27 @@ function () {
|
|
|
39488
39488
|
f(name, version);
|
|
39489
39489
|
});
|
|
39490
39490
|
|
|
39491
|
+
return this; // for chaining
|
|
39492
|
+
}
|
|
39493
|
+
}, {
|
|
39494
|
+
key: "eachComponent",
|
|
39495
|
+
value: function eachComponent(f) {
|
|
39496
|
+
var _this = this;
|
|
39497
|
+
|
|
39498
|
+
var deps = this.getDependencies();
|
|
39499
|
+
|
|
39500
|
+
var applyArg = function applyArg(version, name) {
|
|
39501
|
+
if (_this.isDualboxComponent(name)) {
|
|
39502
|
+
f(name, version);
|
|
39503
|
+
}
|
|
39504
|
+
};
|
|
39505
|
+
|
|
39506
|
+
_import.each(deps.lib, applyArg);
|
|
39507
|
+
|
|
39508
|
+
_import.each(deps.module, applyArg);
|
|
39509
|
+
|
|
39510
|
+
_import.each(deps.ui, applyArg);
|
|
39511
|
+
|
|
39491
39512
|
return this; // for chaining
|
|
39492
39513
|
} // f(panel, panelName)
|
|
39493
39514
|
|
|
@@ -39532,7 +39553,7 @@ function () {
|
|
|
39532
39553
|
}, {
|
|
39533
39554
|
key: "updateVersions",
|
|
39534
39555
|
value: function updateVersions(map) {
|
|
39535
|
-
var
|
|
39556
|
+
var _this2 = this;
|
|
39536
39557
|
|
|
39537
39558
|
// update modules and UIs
|
|
39538
39559
|
var updateJson = function updateJson(json, id) {
|
|
@@ -39550,9 +39571,9 @@ function () {
|
|
|
39550
39571
|
_import.each(this.json.libs, function (version, name) {
|
|
39551
39572
|
var newVersion = map[name];
|
|
39552
39573
|
|
|
39553
|
-
if (newVersion && newVersion !=
|
|
39574
|
+
if (newVersion && newVersion != _this2.json.libs[name] && _this2.json.version != "*") {
|
|
39554
39575
|
console.log('[*] updating ' + name + ' from ' + version + ' to ' + newVersion);
|
|
39555
|
-
|
|
39576
|
+
_this2.json.libs[name] = newVersion;
|
|
39556
39577
|
}
|
|
39557
39578
|
});
|
|
39558
39579
|
|
|
@@ -39562,7 +39583,7 @@ function () {
|
|
|
39562
39583
|
}, {
|
|
39563
39584
|
key: "updateComponents",
|
|
39564
39585
|
value: function updateComponents(dmap) {
|
|
39565
|
-
var
|
|
39586
|
+
var _this3 = this;
|
|
39566
39587
|
|
|
39567
39588
|
if (!dmap) {
|
|
39568
39589
|
console.error("Dependencies map is mandatory in updateComponents.");
|
|
@@ -39603,21 +39624,21 @@ function () {
|
|
|
39603
39624
|
_import.each(this.json.libs, function (version, name) {
|
|
39604
39625
|
if (!libDeps[name] && natives.indexOf(name) == -1) {
|
|
39605
39626
|
console.log('[*] removing lib ' + name);
|
|
39606
|
-
delete
|
|
39627
|
+
delete _this3.json.libs[name];
|
|
39607
39628
|
}
|
|
39608
39629
|
}); // add the missing one
|
|
39609
39630
|
|
|
39610
39631
|
|
|
39611
39632
|
_import.each(libDeps, function (version, name) {
|
|
39612
|
-
if (
|
|
39633
|
+
if (_this3.json.libs && !_this3.json.libs[name]) {
|
|
39613
39634
|
console.log("[*] adding lib " + name);
|
|
39614
|
-
|
|
39635
|
+
_this3.json.libs[name] = version;
|
|
39615
39636
|
}
|
|
39616
39637
|
});
|
|
39617
39638
|
|
|
39618
39639
|
_import.each(natives, function (n) {
|
|
39619
|
-
if (
|
|
39620
|
-
|
|
39640
|
+
if (_this3.json.libs && !_this3.json.libs[n]) {
|
|
39641
|
+
_this3.json.libs[n] = "*";
|
|
39621
39642
|
}
|
|
39622
39643
|
});
|
|
39623
39644
|
|
|
@@ -39626,7 +39647,7 @@ function () {
|
|
|
39626
39647
|
}, {
|
|
39627
39648
|
key: "getDependencies",
|
|
39628
39649
|
value: function getDependencies() {
|
|
39629
|
-
var
|
|
39650
|
+
var _this4 = this;
|
|
39630
39651
|
|
|
39631
39652
|
var deps = {
|
|
39632
39653
|
lib: {
|
|
@@ -39644,7 +39665,7 @@ function () {
|
|
|
39644
39665
|
console.error(('[*] Error while parsing app definition: module ' + json.module + ' exists in version ' + deps.module[json.module] + " and in version " + json.version).red);
|
|
39645
39666
|
}
|
|
39646
39667
|
|
|
39647
|
-
if (
|
|
39668
|
+
if (_this4.isDualboxPackage(json.module)) {
|
|
39648
39669
|
deps.module[json.module] = json.version;
|
|
39649
39670
|
}
|
|
39650
39671
|
});
|
|
@@ -103791,238 +103812,241 @@ var jsplumb_6 = jsplumb.jsPlumb;
|
|
|
103791
103812
|
* Main class of the Graph Editor
|
|
103792
103813
|
*/
|
|
103793
103814
|
class DualboxEditor {
|
|
103794
|
-
|
|
103795
|
-
|
|
103796
|
-
|
|
103797
|
-
|
|
103798
|
-
|
|
103799
|
-
|
|
103800
|
-
|
|
103801
|
-
|
|
103802
|
-
|
|
103803
|
-
|
|
103804
|
-
|
|
103805
|
-
|
|
103806
|
-
|
|
103807
|
-
|
|
103808
|
-
|
|
103809
|
-
|
|
103810
|
-
|
|
103811
|
-
|
|
103812
|
-
|
|
103813
|
-
|
|
103814
|
-
|
|
103815
|
-
|
|
103816
|
-
|
|
103817
|
-
|
|
103818
|
-
|
|
103819
|
-
|
|
103820
|
-
|
|
103821
|
-
|
|
103822
|
-
|
|
103823
|
-
|
|
103824
|
-
|
|
103825
|
-
|
|
103826
|
-
|
|
103827
|
-
|
|
103828
|
-
|
|
103829
|
-
|
|
103830
|
-
|
|
103831
|
-
|
|
103832
|
-
|
|
103833
|
-
}
|
|
103834
|
-
});
|
|
103835
|
-
|
|
103836
|
-
if (type) {
|
|
103837
|
-
packages = lodash.filter(packages, o => {
|
|
103838
|
-
return o.name.startsWith('@dualbox/dualbox-' + type)
|
|
103839
|
-
|| (type == "module" && o.name.startsWith('dualbox-core'))
|
|
103840
|
-
});
|
|
103841
|
-
}
|
|
103842
|
-
resolve(packages);
|
|
103843
|
-
}
|
|
103844
|
-
});
|
|
103815
|
+
// div: selector or jquery div
|
|
103816
|
+
constructor(div, attrs) {
|
|
103817
|
+
this.div = $(div);
|
|
103818
|
+
this.div.addClass("main-editor-div");
|
|
103819
|
+
this.attrs = attrs;
|
|
103820
|
+
|
|
103821
|
+
// export itself top window
|
|
103822
|
+
window.dualboxEditor = this;
|
|
103823
|
+
|
|
103824
|
+
this.rootAppName = attrs.name ? attrs.name : "Application";
|
|
103825
|
+
|
|
103826
|
+
// MVC model
|
|
103827
|
+
this.m = new GraphModel(this);
|
|
103828
|
+
this.v = new GraphView(this, div, attrs);
|
|
103829
|
+
this.c = new GraphController(this);
|
|
103830
|
+
|
|
103831
|
+
// bind links
|
|
103832
|
+
this.v.m = this.c.m = this.m;
|
|
103833
|
+
this.v.c = this.m.c = this.c;
|
|
103834
|
+
this.c.v = this.m.v = this.v;
|
|
103835
|
+
|
|
103836
|
+
// cache for packages
|
|
103837
|
+
this.packages = {};
|
|
103838
|
+
this.DualBox = null; // local dualbox, for editor use
|
|
103839
|
+
|
|
103840
|
+
// the function to search for modules
|
|
103841
|
+
// attr.search signature: search( text, cb )
|
|
103842
|
+
// callback signature: cb( err, packages ), packages is an array of package.json
|
|
103843
|
+
this.search = (text, type) => {
|
|
103844
|
+
return new Promise((resolve, reject) => {
|
|
103845
|
+
attrs.search(text, (err, packages) => {
|
|
103846
|
+
if (err) {
|
|
103847
|
+
reject(err);
|
|
103848
|
+
} else {
|
|
103849
|
+
// cache packages in this.packages
|
|
103850
|
+
lodash.each(packages, r => {
|
|
103851
|
+
if (!this.packages[r.name]) {
|
|
103852
|
+
this.packages[r.name] = r;
|
|
103853
|
+
}
|
|
103845
103854
|
});
|
|
103846
|
-
};
|
|
103847
103855
|
|
|
103848
|
-
|
|
103849
|
-
|
|
103850
|
-
|
|
103851
|
-
|
|
103852
|
-
|
|
103853
|
-
|
|
103854
|
-
|
|
103855
|
-
var hasTypeDef = lodash.get(p, "dualbox.type");
|
|
103856
|
-
|
|
103857
|
-
if (isType && !hasTypeDef) {
|
|
103858
|
-
console.error('Type package ' + p.name + ' has no dualbox Type description.\n'
|
|
103859
|
-
+ 'Type was not imported');
|
|
103860
|
-
}
|
|
103861
|
-
return isType && hasTypeDef;
|
|
103862
|
-
});
|
|
103863
|
-
resolve(this.types);
|
|
103864
|
-
}).catch((e) => {
|
|
103865
|
-
reject(e);
|
|
103866
|
-
});
|
|
103867
|
-
});
|
|
103868
|
-
}
|
|
103869
|
-
else {
|
|
103870
|
-
return Promise.resolve(this.types);
|
|
103856
|
+
if (type) {
|
|
103857
|
+
packages = lodash.filter(packages, o => {
|
|
103858
|
+
return (
|
|
103859
|
+
o.name.startsWith("@dualbox/dualbox-" + type) ||
|
|
103860
|
+
(type == "module" && o.name.startsWith("dualbox-core"))
|
|
103861
|
+
);
|
|
103862
|
+
});
|
|
103871
103863
|
}
|
|
103872
|
-
|
|
103873
|
-
|
|
103874
|
-
|
|
103875
|
-
|
|
103876
|
-
|
|
103877
|
-
};
|
|
103878
|
-
|
|
103864
|
+
resolve(packages);
|
|
103865
|
+
}
|
|
103866
|
+
});
|
|
103867
|
+
});
|
|
103868
|
+
};
|
|
103879
103869
|
|
|
103880
|
-
|
|
103881
|
-
|
|
103882
|
-
|
|
103883
|
-
|
|
103870
|
+
this.types = [];
|
|
103871
|
+
this.getRootTypes = function() {
|
|
103872
|
+
if (lodash.isEmpty(this.types)) {
|
|
103873
|
+
return new Promise((resolve, reject) => {
|
|
103874
|
+
this.search("dualbox-type-")
|
|
103875
|
+
.then(packages => {
|
|
103876
|
+
this.types = lodash.filter(packages, p => {
|
|
103877
|
+
var isType = p.name.startsWith("@dualbox/dualbox-type");
|
|
103878
|
+
var hasTypeDef = lodash.get(p, "dualbox.type");
|
|
103879
|
+
|
|
103880
|
+
if (isType && !hasTypeDef) {
|
|
103881
|
+
console.error(
|
|
103882
|
+
"Type package " +
|
|
103883
|
+
p.name +
|
|
103884
|
+
" has no dualbox Type description.\n" +
|
|
103885
|
+
"Type was not imported"
|
|
103886
|
+
);
|
|
103887
|
+
}
|
|
103888
|
+
return isType && hasTypeDef;
|
|
103889
|
+
});
|
|
103890
|
+
resolve(this.types);
|
|
103891
|
+
})
|
|
103892
|
+
.catch(e => {
|
|
103893
|
+
reject(e);
|
|
103894
|
+
});
|
|
103895
|
+
});
|
|
103896
|
+
} else {
|
|
103897
|
+
return Promise.resolve(this.types);
|
|
103898
|
+
}
|
|
103899
|
+
};
|
|
103884
103900
|
|
|
103885
|
-
|
|
103886
|
-
|
|
103887
|
-
|
|
103888
|
-
|
|
103889
|
-
if (corePackage.name == name) {
|
|
103890
|
-
pkg = corePackage;
|
|
103891
|
-
return false;
|
|
103892
|
-
}
|
|
103893
|
-
});
|
|
103901
|
+
this.getAvailableTypes = async function() {
|
|
103902
|
+
var types = await this.getRootTypes();
|
|
103903
|
+
return lodash.map(types, t => lodash.get(t, "dualbox.type.name"));
|
|
103904
|
+
};
|
|
103894
103905
|
|
|
103895
|
-
|
|
103896
|
-
|
|
103897
|
-
|
|
103898
|
-
|
|
103899
|
-
else {
|
|
103900
|
-
reject("Couldn't resolve core package: " + name);
|
|
103901
|
-
}
|
|
103902
|
-
return;
|
|
103903
|
-
}
|
|
103906
|
+
// the function to find module by name and version (with cache)
|
|
103907
|
+
// signature: find( name, version ), return a Promise which, when resolved, is a package.json
|
|
103908
|
+
this.loadPackage = (name, version) => {
|
|
103909
|
+
version = version || "*";
|
|
103904
103910
|
|
|
103905
|
-
|
|
103906
|
-
|
|
103907
|
-
|
|
103908
|
-
|
|
103909
|
-
|
|
103910
|
-
|
|
103911
|
-
|
|
103912
|
-
|
|
103913
|
-
|
|
103914
|
-
}
|
|
103911
|
+
return new Promise((resolve, reject) => {
|
|
103912
|
+
if (name.startsWith("dualbox-core")) {
|
|
103913
|
+
var pkg = null;
|
|
103914
|
+
lodash.each(this.DualBox.core, corePackage => {
|
|
103915
|
+
if (corePackage.name == name) {
|
|
103916
|
+
pkg = corePackage;
|
|
103917
|
+
return false;
|
|
103918
|
+
}
|
|
103919
|
+
});
|
|
103915
103920
|
|
|
103916
|
-
|
|
103917
|
-
|
|
103918
|
-
|
|
103919
|
-
|
|
103920
|
-
|
|
103921
|
-
|
|
103922
|
-
|
|
103923
|
-
|
|
103921
|
+
if (pkg) {
|
|
103922
|
+
this.packages[name] = pkg;
|
|
103923
|
+
resolve(pkg);
|
|
103924
|
+
} else {
|
|
103925
|
+
reject("Couldn't resolve core package: " + name);
|
|
103926
|
+
}
|
|
103927
|
+
return;
|
|
103928
|
+
}
|
|
103924
103929
|
|
|
103925
|
-
|
|
103926
|
-
|
|
103927
|
-
|
|
103928
|
-
|
|
103929
|
-
|
|
103930
|
-
|
|
103931
|
-
|
|
103932
|
-
|
|
103933
|
-
|
|
103934
|
-
|
|
103930
|
+
var loadScript = (pkg, cb) => {
|
|
103931
|
+
if (attrs.load) {
|
|
103932
|
+
attrs.load(pkg.name, pkg.version, cb);
|
|
103933
|
+
} else {
|
|
103934
|
+
// Local editor. Bind the callback on the local script load
|
|
103935
|
+
var script = $('script[data-pkg="' + pkg.name + '"]');
|
|
103936
|
+
if (!script) {
|
|
103937
|
+
throw "Couldn't find script in the current document: " +
|
|
103938
|
+
pkg.name +
|
|
103939
|
+
". Did you forget gulp link-editor ?";
|
|
103940
|
+
}
|
|
103935
103941
|
|
|
103936
|
-
|
|
103937
|
-
|
|
103938
|
-
|
|
103939
|
-
|
|
103940
|
-
|
|
103941
|
-
|
|
103942
|
-
|
|
103943
|
-
|
|
103944
|
-
|
|
103945
|
-
|
|
103946
|
-
|
|
103947
|
-
|
|
103948
|
-
|
|
103949
|
-
|
|
103950
|
-
|
|
103951
|
-
|
|
103952
|
-
|
|
103953
|
-
}
|
|
103954
|
-
else {
|
|
103955
|
-
this.packages[name] = result; // cache result
|
|
103956
|
-
loadScript(this.packages[name], (err) => {
|
|
103957
|
-
if (err) reject(err);
|
|
103958
|
-
else resolve(result);
|
|
103959
|
-
});
|
|
103960
|
-
}
|
|
103961
|
-
});
|
|
103962
|
-
}
|
|
103963
|
-
})
|
|
103942
|
+
if (script.attr("data-loaded") === "true") {
|
|
103943
|
+
cb();
|
|
103944
|
+
return;
|
|
103945
|
+
} else {
|
|
103946
|
+
script[0].addEventListener("error", function() {
|
|
103947
|
+
throw "Failed to load script " + pkg.name;
|
|
103948
|
+
});
|
|
103949
|
+
|
|
103950
|
+
var timeout = setTimeout(function() {
|
|
103951
|
+
cb("Failed to load " + pkg.name + " after 5 seconds");
|
|
103952
|
+
}, 5000);
|
|
103953
|
+
script[0].addEventListener("load", () => {
|
|
103954
|
+
clearTimeout(timeout);
|
|
103955
|
+
cb();
|
|
103956
|
+
});
|
|
103957
|
+
}
|
|
103958
|
+
}
|
|
103964
103959
|
};
|
|
103965
103960
|
|
|
103966
|
-
|
|
103967
|
-
|
|
103968
|
-
|
|
103961
|
+
var onLoadedScript = err => {
|
|
103962
|
+
if (err) {
|
|
103963
|
+
reject(err);
|
|
103964
|
+
} else {
|
|
103965
|
+
require(name); // make sure the package is required at least once
|
|
103966
|
+
resolve(this.packages[name]);
|
|
103967
|
+
}
|
|
103969
103968
|
};
|
|
103970
103969
|
|
|
103971
|
-
|
|
103972
|
-
|
|
103973
|
-
|
|
103974
|
-
|
|
103975
|
-
|
|
103976
|
-
|
|
103977
|
-
|
|
103970
|
+
// we need to find the package.json and make sure the script is loaded
|
|
103971
|
+
if (this.packages[name]) {
|
|
103972
|
+
try {
|
|
103973
|
+
loadScript(this.packages[name], onLoadedScript);
|
|
103974
|
+
} catch (e) {
|
|
103975
|
+
reject(e);
|
|
103976
|
+
}
|
|
103977
|
+
} else {
|
|
103978
|
+
// mark the package as beeing resolved
|
|
103979
|
+
attrs.find(name, version, (err, result) => {
|
|
103980
|
+
if (err) {
|
|
103981
|
+
reject(err);
|
|
103982
|
+
} else {
|
|
103983
|
+
this.packages[name] = result; // cache result
|
|
103984
|
+
loadScript(this.packages[name], onLoadedScript);
|
|
103985
|
+
}
|
|
103986
|
+
});
|
|
103978
103987
|
}
|
|
103988
|
+
});
|
|
103989
|
+
};
|
|
103979
103990
|
|
|
103980
|
-
|
|
103991
|
+
// the function to require a dualbox module
|
|
103992
|
+
this.require = (name, version, cb) => {
|
|
103993
|
+
return require(name); // TODO: local only for now
|
|
103994
|
+
};
|
|
103981
103995
|
|
|
103982
|
-
|
|
103983
|
-
|
|
103984
|
-
|
|
103985
|
-
|
|
103986
|
-
|
|
103987
|
-
|
|
103988
|
-
});
|
|
103989
|
-
}
|
|
103996
|
+
// Safety when the user leave the page,
|
|
103997
|
+
// if not already defined externally
|
|
103998
|
+
if (!window.onbeforeunload) {
|
|
103999
|
+
window.onbeforeunload = function() {
|
|
104000
|
+
return "Unsaved changes will be lost, are you sure you want to leave the editor?";
|
|
104001
|
+
};
|
|
103990
104002
|
}
|
|
103991
104003
|
|
|
103992
|
-
|
|
103993
|
-
|
|
103994
|
-
|
|
104004
|
+
this.loadCorePackages();
|
|
104005
|
+
|
|
104006
|
+
if (attrs.json) {
|
|
104007
|
+
this.onReady(() => {
|
|
104008
|
+
var p = this.setApp(attrs.json);
|
|
104009
|
+
if (attrs.onLoaded) {
|
|
104010
|
+
p.then(attrs.onLoaded);
|
|
104011
|
+
}
|
|
104012
|
+
});
|
|
103995
104013
|
}
|
|
104014
|
+
}
|
|
103996
104015
|
|
|
103997
|
-
|
|
104016
|
+
// call cb when the editor is initialized
|
|
104017
|
+
onReady(cb) {
|
|
104018
|
+
this.v.onReady(cb);
|
|
104019
|
+
}
|
|
103998
104020
|
|
|
103999
|
-
|
|
104000
|
-
this.DualBox = window.DualBox = this.require('@dualbox/dualbox');
|
|
104001
|
-
lodash.each(this.DualBox.core, async (corePackage) => {
|
|
104002
|
-
await this.loadPackage(corePackage.name);
|
|
104003
|
-
});
|
|
104004
|
-
}
|
|
104021
|
+
async loadCorePackages() {
|
|
104005
104022
|
|
|
104006
|
-
|
|
104007
|
-
|
|
104008
|
-
|
|
104023
|
+
await this.loadPackage("@dualbox/dualbox");
|
|
104024
|
+
this.DualBox = window.DualBox = this.require("@dualbox/dualbox");
|
|
104025
|
+
lodash.each(this.DualBox.core, async corePackage => {
|
|
104026
|
+
await this.loadPackage(corePackage.name);
|
|
104027
|
+
});
|
|
104028
|
+
}
|
|
104009
104029
|
|
|
104010
|
-
|
|
104011
|
-
|
|
104012
|
-
|
|
104030
|
+
setApp(json) {
|
|
104031
|
+
return this.c.load(json);
|
|
104032
|
+
}
|
|
104013
104033
|
|
|
104014
|
-
|
|
104015
|
-
|
|
104016
|
-
|
|
104017
|
-
var promises = []; // array of promises
|
|
104018
|
-
this.promises = promises;
|
|
104034
|
+
getApp() {
|
|
104035
|
+
this.m.get();
|
|
104036
|
+
}
|
|
104019
104037
|
|
|
104020
|
-
|
|
104021
|
-
|
|
104022
|
-
|
|
104023
|
-
|
|
104038
|
+
// load all packages needed in the json
|
|
104039
|
+
// return a Promise
|
|
104040
|
+
loadPackages(json) {
|
|
104041
|
+
var promises = []; // array of promises
|
|
104042
|
+
this.promises = promises;
|
|
104024
104043
|
|
|
104025
|
-
|
|
104044
|
+
var parser = new AppParser_1(json);
|
|
104045
|
+
parser.eachComponent((name, version) => {
|
|
104046
|
+
promises.push(this.loadPackage(name, version));
|
|
104047
|
+
});
|
|
104048
|
+
|
|
104049
|
+
/*
|
|
104026
104050
|
// also load core nodes
|
|
104027
104051
|
promises.push(this.loadPackage('dualbox-core-if', '*'));
|
|
104028
104052
|
promises.push(this.loadPackage('dualbox-core-value', '*'));
|
|
@@ -104032,24 +104056,23 @@ class DualboxEditor {
|
|
|
104032
104056
|
promises.push(this.loadPackage('dualbox-core-switch', '*'));
|
|
104033
104057
|
*/
|
|
104034
104058
|
|
|
104035
|
-
|
|
104036
|
-
|
|
104059
|
+
return Promise.all(promises);
|
|
104060
|
+
}
|
|
104037
104061
|
|
|
104038
|
-
|
|
104039
|
-
|
|
104040
|
-
|
|
104041
|
-
|
|
104042
|
-
|
|
104043
|
-
|
|
104044
|
-
|
|
104062
|
+
// sync version of this.loadPackage. Will crash if the package has not been loaded yet
|
|
104063
|
+
getPackage(name, version) {
|
|
104064
|
+
if (this.packages[name] === undefined) {
|
|
104065
|
+
throw "Package " + name + " has not been loaded yet.";
|
|
104066
|
+
}
|
|
104067
|
+
return this.packages[name];
|
|
104068
|
+
}
|
|
104045
104069
|
}
|
|
104046
104070
|
|
|
104047
104071
|
// try to export in window if in browser context
|
|
104048
104072
|
try {
|
|
104049
|
-
|
|
104050
|
-
}
|
|
104051
|
-
|
|
104052
|
-
console.log('Could not export to window: ' + e);
|
|
104073
|
+
window.DualboxEditor = DualboxEditor;
|
|
104074
|
+
} catch (e) {
|
|
104075
|
+
console.log("Could not export to window: " + e);
|
|
104053
104076
|
}
|
|
104054
104077
|
|
|
104055
104078
|
//export default DualboxEditor;
|