blockly-fluid 1.3.22 → 1.3.23
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/index.js +13 -10
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -308,17 +308,20 @@ module.exports = (Blockly, { generator: languageGeneratorFallback, generators: l
|
|
|
308
308
|
...(input.name) ? {
|
|
309
309
|
[input.name]: (({
|
|
310
310
|
[Blockly.INPUT_VALUE]: () => {
|
|
311
|
-
const
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
(
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
311
|
+
const value = languageGenerator.valueToCode(block, input.name, languageGenerator.ORDER_ATOMIC);
|
|
312
|
+
|
|
313
|
+
if (Object.prototype.toString.call(inputs[input.name].options) === "[object Object]") {
|
|
314
|
+
return `((${
|
|
315
|
+
JSON.stringify(
|
|
316
|
+
Object.fromEntries(
|
|
317
|
+
Object.entries(inputs[input.name].options)
|
|
318
|
+
.map((option) => option.reverse())
|
|
319
|
+
)
|
|
320
|
+
)
|
|
321
|
+
})[${value}] || ${value})`;
|
|
322
|
+
};
|
|
320
323
|
|
|
321
|
-
return
|
|
324
|
+
return value;
|
|
322
325
|
},
|
|
323
326
|
[Blockly.NEXT_STATEMENT]: () => languageGenerator.statementToCode(block, input.name)
|
|
324
327
|
})[input.type] || (() => null))()
|