blockly-fluid 1.2.3 → 1.2.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 +17 -14
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -22,6 +22,8 @@ module.exports = (Blockly, { generator: languageGeneratorFallback, generators: l
22
22
  } = configuration;
23
23
 
24
24
  Blockly.Blocks[name] = {
25
+ ...Blockly.Blocks[name],
26
+
25
27
  init: function () {
26
28
  if ((typeof hat === "function") ? hat() : hat) this.setStyle("hat_blocks");
27
29
 
@@ -54,9 +56,20 @@ module.exports = (Blockly, { generator: languageGeneratorFallback, generators: l
54
56
  };
55
57
 
56
58
  if (input.options) {
57
- if (typeof input.options === "function") (input.options = input.options());
58
-
59
- valueInput.connection.setShadowDom(new DOMParser().parseFromString(`<shadow type="shadow_dropdown"><field name="DROPDOWN">${(typeof input.default === "function") ? input.default() : (input.default || "")}</field></shadow>`, "text/xml").firstChild);
59
+ const dropdownId = Date.now();
60
+
61
+ Blocks[`shadow_dropdown_${dropdownId}`] = {
62
+ layout: "DROPDOWN",
63
+ fields: {
64
+ DROPDOWN: {
65
+ type: "dropdown",
66
+ default: input.default,
67
+ options: input.options
68
+ }
69
+ }
70
+ };
71
+
72
+ valueInput.connection.setShadowDom(new DOMParser().parseFromString(`<shadow type="shadow_dropdown_${dropdownId}"><field name="DROPDOWN"></field></shadow>`, "text/xml").firstChild);
60
73
  };
61
74
 
62
75
  if (input.shadow) {
@@ -189,7 +202,7 @@ module.exports = (Blockly, { generator: languageGeneratorFallback, generators: l
189
202
  if (!output) return code;
190
203
 
191
204
  return (Array.isArray(code)) ? [
192
- (code[1]?.toLowerCase() !== "nugget") ? code[0] : `(() => {\n${code[0].split("\n").map((line) => " " + line).join("\n")}\n})()`,
205
+ (code[1]?.toLowerCase() !== "nugget") ? code[0] : `await (async () => {\n${code[0].split("\n").map((line) => " " + line).join("\n")}\n})()`,
193
206
  languageGenerator[`ORDER_${(code[1]?.toLowerCase().replaceAll("nugget", "") || "NONE").toUpperCase()}`]
194
207
  ] : [
195
208
  code,
@@ -265,15 +278,5 @@ module.exports = (Blockly, { generator: languageGeneratorFallback, generators: l
265
278
  ]
266
279
  };
267
280
 
268
- Blocks["shadow_dropdown"] = {
269
- layout: "DROPDOWN",
270
- fields: {
271
- DROPDOWN: {
272
- type: "dropdown",
273
- options: () => shadowDropdownOptions
274
- }
275
- }
276
- };
277
-
278
281
  return Blocks;
279
282
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blockly-fluid",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "description": "A flexible proxy wrapper for Blockly blocks.",
5
5
  "main": "index.js",
6
6
  "scripts": {