@dualbox/editor 1.0.32 → 1.0.33
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 +252 -232
- package/js/dist/GraphEditor.min.js +251 -231
- package/js/src/GraphEditor.js +230 -231
- 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,238 @@ 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
|
-
this.
|
|
103968
|
-
|
|
103969
|
-
|
|
103961
|
+
// we need to find the package.json and make sure the script is loaded
|
|
103962
|
+
if (this.packages[name]) {
|
|
103963
|
+
try {
|
|
103964
|
+
loadScript(this.packages[name], err => {
|
|
103965
|
+
if (err) reject(err);
|
|
103966
|
+
else resolve(this.packages[name]);
|
|
103967
|
+
});
|
|
103968
|
+
} catch (e) {
|
|
103969
|
+
reject(e);
|
|
103970
|
+
}
|
|
103971
|
+
} else {
|
|
103972
|
+
// mark the package as beeing resolved
|
|
103973
|
+
attrs.find(name, version, (err, result) => {
|
|
103974
|
+
if (err) {
|
|
103975
|
+
reject(err);
|
|
103976
|
+
} else {
|
|
103977
|
+
this.packages[name] = result; // cache result
|
|
103978
|
+
loadScript(this.packages[name], err => {
|
|
103979
|
+
if (err) reject(err);
|
|
103980
|
+
else resolve(result);
|
|
103981
|
+
});
|
|
103982
|
+
}
|
|
103983
|
+
});
|
|
103984
|
+
}
|
|
103985
|
+
});
|
|
103986
|
+
};
|
|
103970
103987
|
|
|
103988
|
+
// the function to require a dualbox module
|
|
103989
|
+
this.require = (name, version, cb) => {
|
|
103990
|
+
return require(name); // TODO: local only for now
|
|
103991
|
+
};
|
|
103971
103992
|
|
|
103972
|
-
|
|
103973
|
-
|
|
103974
|
-
|
|
103975
|
-
|
|
103976
|
-
|
|
103977
|
-
|
|
103978
|
-
|
|
103993
|
+
// Safety when the user leave the page,
|
|
103994
|
+
// if not already defined externally
|
|
103995
|
+
if (!window.onbeforeunload) {
|
|
103996
|
+
window.onbeforeunload = function() {
|
|
103997
|
+
return "Unsaved changes will be lost, are you sure you want to leave the editor?";
|
|
103998
|
+
};
|
|
103999
|
+
}
|
|
103979
104000
|
|
|
103980
|
-
|
|
104001
|
+
this.loadCorePackages();
|
|
103981
104002
|
|
|
103982
|
-
|
|
103983
|
-
|
|
103984
|
-
|
|
103985
|
-
|
|
103986
|
-
|
|
103987
|
-
}
|
|
103988
|
-
});
|
|
104003
|
+
if (attrs.json) {
|
|
104004
|
+
this.onReady(() => {
|
|
104005
|
+
var p = this.setApp(attrs.json);
|
|
104006
|
+
if (attrs.onLoaded) {
|
|
104007
|
+
p.then(attrs.onLoaded);
|
|
103989
104008
|
}
|
|
104009
|
+
});
|
|
103990
104010
|
}
|
|
104011
|
+
}
|
|
103991
104012
|
|
|
103992
|
-
|
|
103993
|
-
|
|
103994
|
-
|
|
103995
|
-
|
|
104013
|
+
// call cb when the editor is initialized
|
|
104014
|
+
onReady(cb) {
|
|
104015
|
+
this.v.onReady(cb);
|
|
104016
|
+
}
|
|
103996
104017
|
|
|
103997
|
-
|
|
104018
|
+
async loadCorePackages() {
|
|
103998
104019
|
|
|
103999
|
-
|
|
104000
|
-
|
|
104001
|
-
|
|
104002
|
-
|
|
104003
|
-
|
|
104004
|
-
|
|
104020
|
+
await this.loadPackage("@dualbox/dualbox");
|
|
104021
|
+
this.DualBox = window.DualBox = this.require("@dualbox/dualbox");
|
|
104022
|
+
lodash.each(this.DualBox.core, async corePackage => {
|
|
104023
|
+
await this.loadPackage(corePackage.name);
|
|
104024
|
+
});
|
|
104025
|
+
}
|
|
104005
104026
|
|
|
104006
|
-
|
|
104007
|
-
|
|
104008
|
-
|
|
104027
|
+
setApp(json) {
|
|
104028
|
+
return this.c.load(json);
|
|
104029
|
+
}
|
|
104009
104030
|
|
|
104010
|
-
|
|
104011
|
-
|
|
104012
|
-
|
|
104031
|
+
getApp() {
|
|
104032
|
+
this.m.get();
|
|
104033
|
+
}
|
|
104013
104034
|
|
|
104014
|
-
|
|
104015
|
-
|
|
104016
|
-
|
|
104017
|
-
|
|
104018
|
-
|
|
104035
|
+
// load all packages needed in the json
|
|
104036
|
+
// return a Promise
|
|
104037
|
+
loadPackages(json) {
|
|
104038
|
+
var promises = []; // array of promises
|
|
104039
|
+
this.promises = promises;
|
|
104019
104040
|
|
|
104020
|
-
|
|
104021
|
-
|
|
104022
|
-
|
|
104023
|
-
|
|
104041
|
+
var parser = new AppParser_1(json);
|
|
104042
|
+
parser.eachComponent((name, version) => {
|
|
104043
|
+
promises.push(this.loadPackage(name, version));
|
|
104044
|
+
});
|
|
104024
104045
|
|
|
104025
|
-
|
|
104046
|
+
/*
|
|
104026
104047
|
// also load core nodes
|
|
104027
104048
|
promises.push(this.loadPackage('dualbox-core-if', '*'));
|
|
104028
104049
|
promises.push(this.loadPackage('dualbox-core-value', '*'));
|
|
@@ -104032,24 +104053,23 @@ class DualboxEditor {
|
|
|
104032
104053
|
promises.push(this.loadPackage('dualbox-core-switch', '*'));
|
|
104033
104054
|
*/
|
|
104034
104055
|
|
|
104035
|
-
|
|
104036
|
-
|
|
104056
|
+
return Promise.all(promises);
|
|
104057
|
+
}
|
|
104037
104058
|
|
|
104038
|
-
|
|
104039
|
-
|
|
104040
|
-
|
|
104041
|
-
|
|
104042
|
-
|
|
104043
|
-
|
|
104044
|
-
|
|
104059
|
+
// sync version of this.loadPackage. Will crash if the package has not been loaded yet
|
|
104060
|
+
getPackage(name, version) {
|
|
104061
|
+
if (this.packages[name] === undefined) {
|
|
104062
|
+
throw "Package " + name + " has not been loaded yet.";
|
|
104063
|
+
}
|
|
104064
|
+
return this.packages[name];
|
|
104065
|
+
}
|
|
104045
104066
|
}
|
|
104046
104067
|
|
|
104047
104068
|
// try to export in window if in browser context
|
|
104048
104069
|
try {
|
|
104049
|
-
|
|
104050
|
-
}
|
|
104051
|
-
|
|
104052
|
-
console.log('Could not export to window: ' + e);
|
|
104070
|
+
window.DualboxEditor = DualboxEditor;
|
|
104071
|
+
} catch (e) {
|
|
104072
|
+
console.log("Could not export to window: " + e);
|
|
104053
104073
|
}
|
|
104054
104074
|
|
|
104055
104075
|
//export default DualboxEditor;
|