@dualbox/editor 1.0.1 → 1.0.3
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/src/GraphEditor.js +159 -0
- package/js/src/c/GraphController.js +646 -0
- package/js/src/libs/CodeMirror.js +8 -0
- package/js/src/libs/fontawesome.js +1 -0
- package/js/src/libs/jsoneditor.css +2 -0
- package/js/src/libs/jsoneditor.js +4 -0
- package/js/src/m/DualboxUtils.js +35 -0
- package/js/src/m/GraphModel.js +2167 -0
- package/js/src/m/History.js +94 -0
- package/js/src/m/Merger.js +357 -0
- package/js/src/v/AppManager.js +61 -0
- package/js/src/v/CanvasSizeHandler.js +136 -0
- package/js/src/v/ContextMenu.css +45 -0
- package/js/src/v/ContextMenu.js +239 -0
- package/js/src/v/GraphView.js +928 -0
- package/js/src/v/PlumbStyle.js +254 -0
- package/js/src/v/Selector.js +239 -0
- package/js/src/v/TemplateManager.js +79 -0
- package/js/src/v/Translater.js +174 -0
- package/js/src/v/Utils.js +7 -0
- package/js/src/v/Zoomer.js +201 -0
- package/js/src/v/templates/addNode.css +45 -0
- package/js/src/v/templates/addNode.html +62 -0
- package/js/src/v/templates/addNode.js +34 -0
- package/js/src/v/templates/debugNodeInfos.css +5 -0
- package/js/src/v/templates/debugNodeInfos.html +336 -0
- package/js/src/v/templates/debugNodeInfos.js +31 -0
- package/js/src/v/templates/editMainSettings.css +67 -0
- package/js/src/v/templates/editMainSettings.html +265 -0
- package/js/src/v/templates/editMainSettings.js +240 -0
- package/js/src/v/templates/editNodeSettings.css +86 -0
- package/js/src/v/templates/editNodeSettings.html +539 -0
- package/js/src/v/templates/editNodeSettings.js +356 -0
- package/js/src/v/templates/graphNode.css +333 -0
- package/js/src/v/templates/graphNode.html +227 -0
- package/js/src/v/templates/graphNode.js +412 -0
- package/js/src/v/templates/main.css +353 -0
- package/js/src/v/templates/main.html +149 -0
- package/js/src/v/templates/main.js +511 -0
- package/js/src/v/templates/searchResults.css +50 -0
- package/js/src/v/templates/searchResults.html +46 -0
- package/js/src/v/templates/searchResults.js +176 -0
- package/package.json +3 -2
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
const _ = require('lodash');
|
|
2
|
+
const swal = require('sweetalert2');
|
|
3
|
+
const utils = require('../Utils');
|
|
4
|
+
|
|
5
|
+
jQuery.fn.outerHTML = function() {
|
|
6
|
+
return jQuery('<div />').append(this.eq(0).clone()).html();
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
var buildInputsDescription = function(inputs) {
|
|
10
|
+
var result = $('<table/>', {
|
|
11
|
+
class: 'table table-striped table-desc',
|
|
12
|
+
style: 'width: auto; font-size: 12px;'
|
|
13
|
+
}).append(
|
|
14
|
+
$('<thead/>').append(
|
|
15
|
+
$('<tr/>').append(
|
|
16
|
+
$('<th/>').append('name'),
|
|
17
|
+
$('<th/>').append('type'),
|
|
18
|
+
$('<th/>').append('desc'),
|
|
19
|
+
$('<th/>').append('default'),
|
|
20
|
+
$('<th/>').append('default')
|
|
21
|
+
)
|
|
22
|
+
)
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
var tbody = $('<tbody/>');
|
|
26
|
+
_.each( inputs, (inputDesc, inputName) => {
|
|
27
|
+
tbody.append( $('<tr/>').append(
|
|
28
|
+
$('<td/>').append(inputName),
|
|
29
|
+
$('<td/>').append($('<span/>', { 'class':'badge badge-secondary', 'style':'font-weight: bold;' }).append(utils.htmlentities(inputDesc.type))),
|
|
30
|
+
$('<td/>').append(inputDesc.desc),
|
|
31
|
+
$('<td/>').append(inputDesc.value),
|
|
32
|
+
$('<td/>').append( inputDesc.const ? "True" : "False" )
|
|
33
|
+
));
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
result.append(tbody);
|
|
37
|
+
return result.outerHTML();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
var buildOutputsDescription = function(outputs) {
|
|
41
|
+
var result = $('<table/>', {
|
|
42
|
+
class: 'table table-striped table-desc',
|
|
43
|
+
style: 'width: auto; font-size: 12px;'
|
|
44
|
+
}).append(
|
|
45
|
+
$('<thead/>').append(
|
|
46
|
+
$('<tr/>').append(
|
|
47
|
+
$('<th/>').append('name'),
|
|
48
|
+
$('<th/>').append('type'),
|
|
49
|
+
$('<th/>').append('desc')
|
|
50
|
+
)
|
|
51
|
+
)
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
var tbody = $('<tbody/>');
|
|
55
|
+
_.each( outputs, (outputDesc, outputName) => {
|
|
56
|
+
tbody.append( $('<tr/>').append(
|
|
57
|
+
$('<td/>').append(outputName),
|
|
58
|
+
$('<td/>').append($('<span/>', { class:'badge badge-secondary' }).append(utils.htmlentities(outputDesc.type))),
|
|
59
|
+
$('<td/>').append(outputDesc.desc)
|
|
60
|
+
));
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
result.append(tbody);
|
|
64
|
+
return result.outerHTML();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
var buildAttributesDescription = function(attrs) {
|
|
68
|
+
var result = $('<table/>', {
|
|
69
|
+
class: 'table table-striped table-desc',
|
|
70
|
+
style: 'width: auto; font-size: 12px;'
|
|
71
|
+
}).append(
|
|
72
|
+
$('<thead/>').append(
|
|
73
|
+
$('<tr/>').append(
|
|
74
|
+
$('<th/>').append('name'),
|
|
75
|
+
$('<th/>').append('type'),
|
|
76
|
+
$('<th/>').append('desc'),
|
|
77
|
+
$('<th/>').append('default')
|
|
78
|
+
)
|
|
79
|
+
)
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
var tbody = $('<tbody/>');
|
|
83
|
+
_.each( attrs, (attrDesc, attrName) => {
|
|
84
|
+
tbody.append( $('<tr/>').append(
|
|
85
|
+
$('<td/>').append(attrName),
|
|
86
|
+
$('<td/>').append($('<span/>', { class:'badge badge-secondary' }).append(utils.htmlentities(attrDesc.type || "*"))),
|
|
87
|
+
$('<td/>').append(attrDesc.desc),
|
|
88
|
+
$('<td/>').append(attrDesc.value)
|
|
89
|
+
));
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
result.append(tbody);
|
|
93
|
+
return result.outerHTML();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
var TemplateBinds = function(view) {
|
|
100
|
+
var buildExampleDiv = function(name, desc) {
|
|
101
|
+
var exampleDiv = $('<div/>', { 'class' : 'dualbox-graph-canvas', 'style': 'overflow: visible;' }).append();
|
|
102
|
+
return exampleDiv.outerHTML();
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// on result click, change the description on the right of the panel
|
|
106
|
+
$('.node-result').click(function() {
|
|
107
|
+
$('.node-result').removeClass('selected');
|
|
108
|
+
$(this).addClass('selected');
|
|
109
|
+
|
|
110
|
+
var pkgName = $(this).data('package');
|
|
111
|
+
var pkgShortName = $(this).data('short-name').trim();
|
|
112
|
+
|
|
113
|
+
var pkg = _.find( view.e.searchResults, { 'name' : pkgName });
|
|
114
|
+
if( pkg ) {
|
|
115
|
+
pkg.shortName = pkgShortName;
|
|
116
|
+
$('.module-name').text(pkgShortName);
|
|
117
|
+
$('.module-show-description').show();
|
|
118
|
+
$('.module-long-description').text(pkg.description);
|
|
119
|
+
|
|
120
|
+
// Add the example div
|
|
121
|
+
$('.module-signature').html("");
|
|
122
|
+
$('.module-signature').append(
|
|
123
|
+
$('<div/>', {
|
|
124
|
+
'class' : 'dualbox-graph-canvas',
|
|
125
|
+
'style': 'overflow: visible; padding-left: 80px; padding-right: 80px; background-color: transparent; border: none;'
|
|
126
|
+
})
|
|
127
|
+
)
|
|
128
|
+
view.templateMgr.appendTemplate($('.module-signature .dualbox-graph-canvas'),
|
|
129
|
+
"graphNode",
|
|
130
|
+
{ pkg: pkg, id: pkgShortName, n: view.m.createExampleNode(pkg.name, pkgShortName), example: true, utils: view.utils },
|
|
131
|
+
() => {
|
|
132
|
+
// remove the "position: absolute;" that messes up the display
|
|
133
|
+
$('.module-signature .dualbox-graph-canvas .card').css('position', 'static');
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
swal("Oups", "can't find package named '" + pkgName + "'", "error");
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if( pkg.dualbox ) {
|
|
143
|
+
// show input desc
|
|
144
|
+
if( !_.isEmpty(pkg.dualbox.input) ) {
|
|
145
|
+
$('.module-show-inputs').show();
|
|
146
|
+
$('.module-inputs').html( buildInputsDescription(pkg.dualbox.input) );
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
$('.module-show-inputs').hide();
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// show output desc
|
|
153
|
+
if( !_.isEmpty(pkg.dualbox.output) ) {
|
|
154
|
+
$('.module-show-outputs').show();
|
|
155
|
+
$('.module-outputs').html( buildOutputsDescription(pkg.dualbox.output) );
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
$('.module-show-outputs').hide();
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// show attributes desc
|
|
162
|
+
if( !_.isEmpty(pkg.dualbox.attr) ) {
|
|
163
|
+
$('.module-show-attributes').show();
|
|
164
|
+
$('.module-attributes').html( buildAttributesDescription(pkg.dualbox.attr) );
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
$('.module-show-attributes').hide();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
swal("Oups", "No dualbox description found in package '" + pkgName + "'", "error");
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
module.exports = TemplateBinds;
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dualbox/editor",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Editor of Dualbox apps",
|
|
5
|
+
"browser": "js/dist/GraphEditor.js",
|
|
5
6
|
"main": "js/dist/GraphEditor.js",
|
|
6
7
|
"directories": {
|
|
7
8
|
"lib": "lib"
|
|
@@ -40,7 +41,7 @@
|
|
|
40
41
|
"files": [
|
|
41
42
|
"css/*",
|
|
42
43
|
"html/*",
|
|
43
|
-
"js
|
|
44
|
+
"js/*",
|
|
44
45
|
"lib/*"
|
|
45
46
|
]
|
|
46
47
|
}
|