@dualbox/editor 1.0.11 → 1.0.13

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.
@@ -66,11 +66,249 @@ class DualboxEditor {
66
66
  // signature: find( name, version ), return a Promise which, when resolved, is a package.json
67
67
  this.loadPackage = (name, version) => {
68
68
  version = version || "*";
69
- if( name.startsWith('dualbox-core') ) {
70
- name = "@dualbox/dualbox";
71
- }
72
69
 
73
70
  return new Promise((resolve, reject) => {
71
+ if( name.startsWith('dualbox-core') ) {
72
+ switch(name) {
73
+ case "dualbox-core-if":
74
+ resolve({
75
+ "name": "dualbox-core-if",
76
+ "version": "*",
77
+ "description": "If cond is true, result is ifTrue, else result is ifFalse",
78
+ "dualbox" : {
79
+ "input" : {
80
+ "cond" : {
81
+ "type": "boolean",
82
+ "const": true
83
+ },
84
+ "ifTrue": {
85
+ "type": "*",
86
+ "const": true
87
+ },
88
+ "ifFalse": {
89
+ "type": "*",
90
+ "const": true
91
+ }
92
+ },
93
+ "output" : {
94
+ "result" : {
95
+ "type": "*"
96
+ }
97
+ }
98
+ }
99
+ });
100
+ break;
101
+ case "dualbox-core-value":
102
+ resolve({
103
+ "name": "dualbox-core-value",
104
+ "version": "*",
105
+ "description": "Simple module that transmit a value",
106
+ "dualbox": {
107
+ "input": {
108
+ "value": {
109
+ "type": "*",
110
+ "const": true
111
+ }
112
+ },
113
+ "output": {
114
+ "value": {
115
+ "type": "*"
116
+ }
117
+ }
118
+ }
119
+ });
120
+ break;
121
+ case "dualbox-core-from-json":
122
+ resolve({
123
+ "name": "dualbox-core-from-json",
124
+ "version": "*",
125
+ "description": "Module that deserialize a DualBox structure saved in JSON",
126
+ "dualbox": {
127
+ "input": {
128
+ "json": {
129
+ "type": "json",
130
+ "const": true
131
+ }
132
+ },
133
+ "output": {
134
+ "res": {
135
+ "type": "*"
136
+ }
137
+ }
138
+ }
139
+ });
140
+ break;
141
+ case "dualbox-core-to-json":
142
+ resolve({
143
+ "name": "dualbox-core-to-json",
144
+ "version": "*",
145
+ "description": "Module that serialize a DualBox structure to a JSON equivalent",
146
+ "dualbox": {
147
+ "input": {
148
+ "value": {
149
+ "type": "*",
150
+ "const": true
151
+ }
152
+ },
153
+ "output": {
154
+ "json": {
155
+ "type": "json"
156
+ }
157
+ }
158
+ }
159
+ });
160
+ break;
161
+ case "dualbox-core-script":
162
+ resolve({
163
+ "name": "dualbox-core-script",
164
+ "version": "*",
165
+ "description": "Executes the fonction provide in attrs.script. The function takes a json as a parameter and returns a json",
166
+ "dualbox": {
167
+ "input": {
168
+ "json": {
169
+ "type": "json"
170
+ }
171
+ },
172
+ "output": {
173
+ "json": {
174
+ "type": "json"
175
+ }
176
+ },
177
+ "attr": {
178
+ "script" : {
179
+ "type" : "String",
180
+ "desc" : "The string of the function to be executed"
181
+ }
182
+ }
183
+ }
184
+ });
185
+ break;
186
+ case "dualbox-core-switch":
187
+ resolve({
188
+ "name": "dualbox-core-switch",
189
+ "version": "*",
190
+ "description": "Resolve the condition value, then retrieve and respond with the matching value. If no match, respond with value value",
191
+ "dualbox" : {
192
+ "input" : {
193
+ "cond" : {
194
+ "type": "*",
195
+ "typeLink": "condition",
196
+ "const": true
197
+ },
198
+ "case1" : {
199
+ "type": "*",
200
+ "typeLink": "condition",
201
+ "const": true
202
+ },
203
+ "ifCase1": {
204
+ "type": "*",
205
+ "typeLink": "value",
206
+ "const": true
207
+ },
208
+ "case2" : {
209
+ "type": "*",
210
+ "typeLink": "condition",
211
+ "const": true,
212
+ "value": null
213
+ },
214
+ "ifCase2": {
215
+ "type": "*",
216
+ "typeLink": "value",
217
+ "const": true,
218
+ "value" : null
219
+ },
220
+ "case3" : {
221
+ "type": "*",
222
+ "typeLink": "condition",
223
+ "const": true,
224
+ "value": null
225
+ },
226
+ "ifCase3": {
227
+ "type": "*",
228
+ "typeLink": "value",
229
+ "const": true,
230
+ "value" : null
231
+ },
232
+ "case4" : {
233
+ "type": "*",
234
+ "typeLink": "condition",
235
+ "const": true,
236
+ "value": null
237
+ },
238
+ "ifCase4": {
239
+ "type": "*",
240
+ "typeLink": "value",
241
+ "const": true,
242
+ "value" : null
243
+ },
244
+ "case5" : {
245
+ "type": "*",
246
+ "typeLink": "condition",
247
+ "const": true,
248
+ "value": null
249
+ },
250
+ "ifCase5": {
251
+ "type": "*",
252
+ "typeLink": "value",
253
+ "const": true,
254
+ "value" : null
255
+ },
256
+ "case6" : {
257
+ "type": "*",
258
+ "typeLink": "condition",
259
+ "const": true,
260
+ "value": null
261
+ },
262
+ "ifCase6": {
263
+ "type": "*",
264
+ "typeLink": "value",
265
+ "const": true,
266
+ "value" : null
267
+ },
268
+ "case7" : {
269
+ "type": "*",
270
+ "typeLink": "condition",
271
+ "const": true,
272
+ "value": null
273
+ },
274
+ "ifCase7": {
275
+ "type": "*",
276
+ "typeLink": "value",
277
+ "const": true,
278
+ "value" : null
279
+ },
280
+ "case8" : {
281
+ "type": "*",
282
+ "typeLink": "condition",
283
+ "const": true,
284
+ "value": null
285
+ },
286
+ "ifCase8": {
287
+ "type": "*",
288
+ "typeLink": "value",
289
+ "const": true,
290
+ "value" : null
291
+ },
292
+ "default": {
293
+ "type": "*",
294
+ "typeLink": "value",
295
+ "const": true
296
+ }
297
+ },
298
+ "output" : {
299
+ "result" : {
300
+ "type": "*",
301
+ "typeLink": "value"
302
+ }
303
+ }
304
+ }
305
+ });
306
+ break;
307
+ default:
308
+ throw new Dualbox.Error("Unknown dualbox-core package: " + name);
309
+ }
310
+ }
311
+
74
312
  if( this.packages[name] ) {
75
313
  resolve(this.packages[name]);
76
314
  }
@@ -120,13 +358,17 @@ class DualboxEditor {
120
358
  }
121
359
 
122
360
  loadCorePackages() {
123
- this.loadPackage('@dualbox/dualbox');
124
- this.loadPackage('dualbox-core-if');
125
- this.loadPackage('dualbox-core-value');
126
- this.loadPackage('dualbox-core-from-json');
127
- this.loadPackage('dualbox-core-to-json');
128
- this.loadPackage('dualbox-core-script');
129
- this.loadPackage('dualbox-core-switch');
361
+ var onError = function(err) {
362
+ console.error(err);
363
+ }
364
+
365
+ this.loadPackage('@dualbox/dualbox').catch(onError);
366
+ this.loadPackage('dualbox-core-if').catch(onError);
367
+ this.loadPackage('dualbox-core-value').catch(onError);
368
+ this.loadPackage('dualbox-core-from-json').catch(onError);
369
+ this.loadPackage('dualbox-core-to-json').catch(onError);
370
+ this.loadPackage('dualbox-core-script').catch(onError);
371
+ this.loadPackage('dualbox-core-switch').catch(onError);
130
372
  }
131
373
 
132
374
  setApp(json) {
@@ -578,6 +578,8 @@ class GraphController {
578
578
  $("<option/>", { "value" : uiName }).append(uiName)
579
579
  );
580
580
  });
581
+ }).catch((err) => {
582
+ console.error(err);
581
583
  });
582
584
  }
583
585
 
@@ -146,6 +146,8 @@ var TemplateBinds = function(view, div) {
146
146
  });
147
147
 
148
148
  view.c.addNewMetabox(name, json);
149
+ }).catch((err) => {
150
+ console.error(err);
149
151
  });
150
152
  }
151
153
  reader.readAsText(file)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dualbox/editor",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "description": "Editor of Dualbox apps",
5
5
  "browser": "js/dist/GraphEditor.js",
6
6
  "main": "js/dist/GraphEditor.js",