@dualbox/editor 1.0.42 → 1.0.44
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/html/editor.html +148 -152
- package/js/dist/GraphEditor.js +108 -34
- package/js/dist/GraphEditor.min.js +107 -33
- package/js/src/GraphEditor.js +15 -17
- package/js/src/m/GraphModel.js +38 -4
- package/js/src/v/templates/graph.vue +4 -3
- package/js/src/v/templates/graphNode.vue +4 -2
- package/js/src/v/templates/main.vue +36 -4
- package/package.json +1 -1
package/html/editor.html
CHANGED
|
@@ -1,60 +1,52 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
2
|
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
|
6
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
|
7
|
-
<meta name="viewport" content="width=device-width" />
|
|
8
|
-
<script src="../lib/jquery.min.js"></script>
|
|
9
|
-
<script src="../lib/jquery.autocomplete.min.js"></script>
|
|
10
|
-
<script src="../lib/popper.min.js"></script>
|
|
11
|
-
<link rel="stylesheet" href="../css/plumb.css" />
|
|
12
|
-
|
|
13
|
-
<!-- Bootstrap -->
|
|
14
|
-
<link
|
|
15
|
-
href="../lib/bootstrap-4.0.0-dist/css/bootstrap.min.css"
|
|
16
|
-
rel="stylesheet"
|
|
17
|
-
/>
|
|
18
|
-
<script src="../lib/bootstrap-4.0.0-dist/js/bootstrap.min.js"></script>
|
|
19
|
-
|
|
20
|
-
<!-- Font awesome -->
|
|
21
|
-
<link
|
|
22
|
-
href="../lib/fontawesome-free-5.0.6/web-fonts-with-css/css/fontawesome-all.min.css"
|
|
23
|
-
rel="stylesheet"
|
|
24
|
-
/>
|
|
25
|
-
|
|
26
|
-
<!-- lodash -->
|
|
27
|
-
<script src="../lib/lodash.js"></script>
|
|
28
|
-
|
|
29
|
-
<!-- fuse search -->
|
|
30
|
-
<script src="../lib/fuse.min.js"></script>
|
|
31
|
-
|
|
32
|
-
<!-- Bootstrap-select (see: ) -->
|
|
33
|
-
<link
|
|
34
|
-
rel="stylesheet"
|
|
35
|
-
href="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.10/dist/css/bootstrap-select.min.css"
|
|
36
|
-
/>
|
|
37
|
-
<script src="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.10/dist/js/bootstrap-select.min.js"></script>
|
|
38
|
-
|
|
39
|
-
<!-- Vue.js -->
|
|
40
|
-
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.js"></script>
|
|
41
|
-
<script>
|
|
42
|
-
Vue.config.devtools = true;
|
|
43
|
-
</script>
|
|
44
|
-
|
|
45
|
-
<style>
|
|
46
|
-
.html,
|
|
47
|
-
body {
|
|
48
|
-
margin: 0;
|
|
49
|
-
padding: 0;
|
|
50
|
-
}
|
|
51
|
-
</style>
|
|
52
|
-
</head>
|
|
53
|
-
|
|
54
|
-
<body id="superbody" bgcolor="#e3e4e6" style="height: 100vh;">
|
|
55
|
-
<div id="editor" style="width: 100%; height: 100vh;"></div>
|
|
56
3
|
|
|
57
|
-
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="utf-8" />
|
|
6
|
+
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
|
7
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
|
8
|
+
<meta name="viewport" content="width=device-width" />
|
|
9
|
+
<script src="../lib/jquery.min.js"></script>
|
|
10
|
+
<script src="../lib/jquery.autocomplete.min.js"></script>
|
|
11
|
+
<script src="../lib/popper.min.js"></script>
|
|
12
|
+
<link rel="stylesheet" href="../css/plumb.css" />
|
|
13
|
+
|
|
14
|
+
<!-- Bootstrap -->
|
|
15
|
+
<link href="../lib/bootstrap-4.0.0-dist/css/bootstrap.min.css" rel="stylesheet" />
|
|
16
|
+
<script src="../lib/bootstrap-4.0.0-dist/js/bootstrap.min.js"></script>
|
|
17
|
+
|
|
18
|
+
<!-- Font awesome -->
|
|
19
|
+
<link href="../lib/fontawesome-free-5.0.6/web-fonts-with-css/css/fontawesome-all.min.css" rel="stylesheet" />
|
|
20
|
+
|
|
21
|
+
<!-- lodash -->
|
|
22
|
+
<script src="../lib/lodash.js"></script>
|
|
23
|
+
|
|
24
|
+
<!-- fuse search -->
|
|
25
|
+
<script src="../lib/fuse.min.js"></script>
|
|
26
|
+
|
|
27
|
+
<!-- Bootstrap-select (see: ) -->
|
|
28
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.10/dist/css/bootstrap-select.min.css" />
|
|
29
|
+
<script src="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.10/dist/js/bootstrap-select.min.js"></script>
|
|
30
|
+
|
|
31
|
+
<!-- Vue.js -->
|
|
32
|
+
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.js"></script>
|
|
33
|
+
<script>
|
|
34
|
+
Vue.config.devtools = true;
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<style>
|
|
38
|
+
.html,
|
|
39
|
+
body {
|
|
40
|
+
margin: 0;
|
|
41
|
+
padding: 0;
|
|
42
|
+
}
|
|
43
|
+
</style>
|
|
44
|
+
</head>
|
|
45
|
+
|
|
46
|
+
<body id="superbody" bgcolor="#e3e4e6" style="height: 100vh;">
|
|
47
|
+
<div id="editor" style="width: 100%; height: 100vh;"></div>
|
|
48
|
+
|
|
49
|
+
<!--
|
|
58
50
|
<script src="../js2/dist/DefaultHTMLFormat.js"></script>
|
|
59
51
|
<script src="../js2/dist/GraphEditor.js"></script>
|
|
60
52
|
<script src="../js2/dist/EditorUtils.js"></script>
|
|
@@ -62,105 +54,109 @@
|
|
|
62
54
|
<script src="../js2/dist/plumb.js"></script>
|
|
63
55
|
-->
|
|
64
56
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
var fileName = path.replace(/^.*[\\\/]/, "").replace(".js", "");
|
|
80
|
-
var packageName = "@dualbox/" + fileName;
|
|
81
|
-
window.DualBoxRessources[packageName] = new URL(
|
|
82
|
-
path,
|
|
83
|
-
window.location.href
|
|
84
|
-
).href;
|
|
85
|
-
|
|
86
|
-
var s = document.createElement("script");
|
|
87
|
-
s.setAttribute("src", path);
|
|
88
|
-
s.setAttribute("charset", "utf-8");
|
|
89
|
-
s.setAttribute("data-pkg", pkgName);
|
|
90
|
-
sources[path]["script"] = s;
|
|
91
|
-
s.onload = function() {
|
|
92
|
-
sources[path].ready = true;
|
|
93
|
-
sources[path].script.setAttribute("data-loaded", true);
|
|
94
|
-
|
|
95
|
-
// check if all our sources are ready
|
|
96
|
-
var keys = Object.keys(sources);
|
|
97
|
-
for (var i = 0; i < keys.length; i++) {
|
|
98
|
-
var s = sources[keys[i]];
|
|
99
|
-
if (!s.ready) return false;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// we're here if all sources are ready
|
|
103
|
-
for (var i = 0; i < keys.length; i++) {
|
|
104
|
-
var s = sources[keys[i]];
|
|
105
|
-
if (s.cb) s.cb();
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
document.body.appendChild(s);
|
|
109
|
-
};
|
|
110
|
-
</script>
|
|
111
|
-
<script src="../require/require.js"></script>
|
|
112
|
-
|
|
113
|
-
<script>
|
|
114
|
-
var packages = _.map(pkgIndex, function(o) {
|
|
115
|
-
return o.pkg;
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
window.editor = new DualboxEditor($("#editor"), {
|
|
119
|
-
showLoadButton: true,
|
|
120
|
-
showSaveButton: true,
|
|
121
|
-
|
|
122
|
-
search: function(text, cb) {
|
|
123
|
-
var options = {
|
|
124
|
-
shouldSort: true,
|
|
125
|
-
threshold: 0.6,
|
|
126
|
-
location: 0,
|
|
127
|
-
distance: 100,
|
|
128
|
-
maxPatternLength: 32,
|
|
129
|
-
minMatchCharLength: 1,
|
|
130
|
-
tokenize: true,
|
|
131
|
-
matchAllTokens: true,
|
|
132
|
-
keys: ["name", "description"]
|
|
133
|
-
};
|
|
134
|
-
var fuse = new Fuse(packages, options); // "list" is the item array
|
|
135
|
-
var result = fuse.search(text);
|
|
136
|
-
cb(null, result);
|
|
137
|
-
},
|
|
138
|
-
|
|
139
|
-
find: function(name, version, cb) {
|
|
140
|
-
// We don't handle version here, only the latest
|
|
141
|
-
if (!pkgIndex[name]) {
|
|
142
|
-
cb("No package with name " + name + " found!", null);
|
|
143
|
-
} else {
|
|
144
|
-
cb(null, pkgIndex[name].pkg);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
// For debug purpose
|
|
150
|
-
window.getApp = function() {
|
|
151
|
-
return window.dualboxEditor.v.appManager.app;
|
|
57
|
+
<!--<script src="../lib/jsPlumb-2.1.8.js"></script> -->
|
|
58
|
+
<script src="../js/dist/GraphEditor.js"></script>
|
|
59
|
+
<script src="../require/index.js"></script>
|
|
60
|
+
<script>
|
|
61
|
+
THREE = {}; // for debug
|
|
62
|
+
</script>
|
|
63
|
+
<script>
|
|
64
|
+
// Useful for require.js to work
|
|
65
|
+
var sources = {};
|
|
66
|
+
window.DualBoxRessources = {};
|
|
67
|
+
var addSource = function (pkgName, path, cb) {
|
|
68
|
+
sources[path] = {
|
|
69
|
+
ready: false,
|
|
70
|
+
cb: cb
|
|
152
71
|
};
|
|
153
|
-
</script>
|
|
154
|
-
<script>
|
|
155
|
-
Vue.config.productionTip = false;
|
|
156
72
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
73
|
+
// log it into DualBox ressources
|
|
74
|
+
var fileName = path.replace(/^.*[\\\/]/, "").replace(".js", "");
|
|
75
|
+
var packageName = "@dualbox/" + fileName;
|
|
76
|
+
window.DualBoxRessources[packageName] = new URL(
|
|
77
|
+
path,
|
|
78
|
+
window.location.href
|
|
79
|
+
).href;
|
|
80
|
+
|
|
81
|
+
var s = document.createElement("script");
|
|
82
|
+
s.setAttribute("src", path);
|
|
83
|
+
s.setAttribute("charset", "utf-8");
|
|
84
|
+
s.setAttribute("data-pkg", pkgName);
|
|
85
|
+
sources[path]["script"] = s;
|
|
86
|
+
s.onload = function () {
|
|
87
|
+
sources[path].ready = true;
|
|
88
|
+
sources[path].script.setAttribute("data-loaded", true);
|
|
89
|
+
|
|
90
|
+
// check if all our sources are ready
|
|
91
|
+
var keys = Object.keys(sources);
|
|
92
|
+
for (var i = 0; i < keys.length; i++) {
|
|
93
|
+
var s = sources[keys[i]];
|
|
94
|
+
if (!s.ready) return false;
|
|
95
|
+
}
|
|
160
96
|
|
|
161
|
-
|
|
162
|
-
|
|
97
|
+
// we're here if all sources are ready
|
|
98
|
+
for (var i = 0; i < keys.length; i++) {
|
|
99
|
+
var s = sources[keys[i]];
|
|
100
|
+
if (s.cb) s.cb();
|
|
101
|
+
}
|
|
163
102
|
};
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
</
|
|
103
|
+
document.body.appendChild(s);
|
|
104
|
+
};
|
|
105
|
+
</script>
|
|
106
|
+
<script src="../require/require.js"></script>
|
|
107
|
+
|
|
108
|
+
<script>
|
|
109
|
+
var packages = _.map(pkgIndex, function (o) {
|
|
110
|
+
return o.pkg;
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
window.editor = new DualboxEditor($("#editor"), {
|
|
114
|
+
showLoadButton: true,
|
|
115
|
+
showSaveButton: true,
|
|
116
|
+
|
|
117
|
+
search: function (text, cb) {
|
|
118
|
+
var options = {
|
|
119
|
+
shouldSort: true,
|
|
120
|
+
threshold: 0.6,
|
|
121
|
+
location: 0,
|
|
122
|
+
distance: 100,
|
|
123
|
+
maxPatternLength: 32,
|
|
124
|
+
minMatchCharLength: 1,
|
|
125
|
+
tokenize: true,
|
|
126
|
+
matchAllTokens: true,
|
|
127
|
+
keys: ["name", "description"]
|
|
128
|
+
};
|
|
129
|
+
var fuse = new Fuse(packages, options); // "list" is the item array
|
|
130
|
+
var result = fuse.search(text);
|
|
131
|
+
cb(null, result);
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
find: function (name, version, cb) {
|
|
135
|
+
// We don't handle version here, only the latest
|
|
136
|
+
if (!pkgIndex[name]) {
|
|
137
|
+
cb("No package with name " + name + " found!", null);
|
|
138
|
+
} else {
|
|
139
|
+
cb(null, pkgIndex[name].pkg);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
// For debug purpose
|
|
145
|
+
window.getApp = function () {
|
|
146
|
+
return window.dualboxEditor.v.appManager.app;
|
|
147
|
+
};
|
|
148
|
+
</script>
|
|
149
|
+
<script>
|
|
150
|
+
Vue.config.productionTip = false;
|
|
151
|
+
|
|
152
|
+
Vue.config.errorHandler = function (err, vm, info) {
|
|
153
|
+
console.error(err);
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
Vue.config.warnHandler = function (msg, vm, trace) {
|
|
157
|
+
console.warn(`Vue Warn: ${msg}\nTrace: ${trace}`);
|
|
158
|
+
};
|
|
159
|
+
</script>
|
|
160
|
+
</body>
|
|
161
|
+
|
|
162
|
+
</html>
|