blockly-fluid 1.0.6 → 1.0.8

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 +10 -1
  2. package/package.json +18 -18
package/index.js CHANGED
@@ -142,6 +142,15 @@ module.exports = (Blockly, { generator: languageGeneratorFallback, generators: l
142
142
 
143
143
  if (!languageGenerator) return;
144
144
 
145
+ if (!languageGenerator.uniqueVariable) {
146
+ languageGenerator.uniqueVariable = (variable) => {
147
+ return languageGenerator.variableDB_.getDistinctName(
148
+ variable,
149
+ Blockly.VARIABLE_CATEGORY_NAME
150
+ );
151
+ };
152
+ };
153
+
145
154
  languageGenerator.forBlock[name] = (block) => (((code) => {
146
155
  if (!output) return code;
147
156
 
@@ -158,7 +167,7 @@ module.exports = (Blockly, { generator: languageGeneratorFallback, generators: l
158
167
  ...Object.fromEntries(input.fieldRow.filter((field) => field.name).map((field) => [
159
168
  field.name,
160
169
  ((value) => {
161
- if (field.type !== "variable") return value;
170
+ if (!(field instanceof Blockly.FieldVariable)) return value;
162
171
 
163
172
  return languageGenerator.nameDB_.getName(value, Blockly.VARIABLE_CATEGORY_NAME);
164
173
  })(block.getFieldValue(field.name))
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
- {
2
- "name": "blockly-fluid",
3
- "version": "1.0.6",
4
- "description": "A flexible proxy wrapper for Blockly blocks.",
5
- "main": "index.js",
6
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
8
- },
9
- "keywords": [
10
- "blockly",
11
- "blocks",
12
- "fluid",
13
- "proxy",
14
- "wrapper"
15
- ],
16
- "author": "DinoscapeProgramming",
17
- "license": "MIT",
18
- "type": "commonjs"
1
+ {
2
+ "name": "blockly-fluid",
3
+ "version": "1.0.8",
4
+ "description": "A flexible proxy wrapper for Blockly blocks.",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "keywords": [
10
+ "blockly",
11
+ "blocks",
12
+ "fluid",
13
+ "proxy",
14
+ "wrapper"
15
+ ],
16
+ "author": "DinoscapeProgramming",
17
+ "license": "MIT",
18
+ "type": "commonjs"
19
19
  }