blockly-fluid 1.0.3 → 1.0.5

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.
Files changed (2) hide show
  1. package/index.js +14 -4
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -142,7 +142,17 @@ module.exports = (Blockly, { generator: languageGeneratorFallback, generators: l
142
142
 
143
143
  if (!languageGenerator) return;
144
144
 
145
- languageGenerator.forBlock[name] = (block) => blockGenerator({
145
+ languageGenerator.forBlock[name] = (block) => (((code) => {
146
+ if (!output) return code;
147
+
148
+ return (Array.isArray(code)) ? [
149
+ code[0],
150
+ languageGenerator[`ORDER_${(code[1] || "NONE").toUpperCase()}`]
151
+ ] : [
152
+ code,
153
+ languageGenerator.ORDER_NONE
154
+ ];
155
+ })(blockGenerator({
146
156
  ...block.inputList.reduce((accumulator, input) => ({
147
157
  ...accumulator,
148
158
  ...Object.fromEntries(input.fieldRow.filter((field) => field.name).map((field) => [field.name, block.getFieldValue(field.name)])),
@@ -153,7 +163,7 @@ module.exports = (Blockly, { generator: languageGeneratorFallback, generators: l
153
163
  })[input.type] || (() => null))()
154
164
  } : {}
155
165
  }), {}),
156
- });
166
+ }, languageGenerator)));
157
167
  });
158
168
 
159
169
  return true;
@@ -174,7 +184,7 @@ module.exports = (Blockly, { generator: languageGeneratorFallback, generators: l
174
184
  output: true,
175
185
 
176
186
  generator({ TEXT = `""` }) {
177
- return [`"${TEXT}"`, Blockly.JavaScript.ORDER_ATOMIC];
187
+ return [`"${TEXT}"`, "atomic"];
178
188
  }
179
189
  };
180
190
 
@@ -193,7 +203,7 @@ module.exports = (Blockly, { generator: languageGeneratorFallback, generators: l
193
203
  output: Number,
194
204
 
195
205
  generator({ NUMBER = 0 }) {
196
- return [`${parseFloat(NUMBER)}`, Blockly.JavaScript.ORDER_ATOMIC];
206
+ return [`${parseFloat(NUMBER)}`, "atomic"];
197
207
  }
198
208
  };
199
209
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blockly-fluid",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "A flexible proxy wrapper for Blockly blocks.",
5
5
  "main": "index.js",
6
6
  "scripts": {