@protorobotics/jenga 1.1.0 → 1.1.2

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/jenga.js +5 -2
  2. package/package.json +1 -1
package/jenga.js CHANGED
@@ -48,6 +48,7 @@ const BlocklyType = {
48
48
  /**
49
49
  * @callback CodeGenFunction
50
50
  * @param {Block} block The blockly block.
51
+ * @param {CodeGenerator | undefined} generator The blockly generator.
51
52
  * @returns {string} The generated code.
52
53
  */
53
54
 
@@ -101,16 +102,18 @@ function initBlocklyBlock(entry, category, generator) {
101
102
  init: function () {
102
103
  const inputConn = entry.blocklyInput;
103
104
  const rootInput = !inputConn
104
- ? this.appendDummyInput()
105
+ ? this.appendDummyInput("dummyInput")
105
106
  : this.appendValueInput(inputConn.name).setCheck(inputConn.type);
106
107
 
107
108
  for (const field of entry.blocklyTemplate) {
108
109
  if (field.text) {
109
110
  // Plain text
110
111
  rootInput.appendField(field.text);
111
- } else {
112
+ } else if (field.field) {
112
113
  // Additional user input
113
114
  rootInput.appendField(field.field(), field.name);
115
+ } else {
116
+ console.error("unknown field type: ", field);
114
117
  }
115
118
  }
116
119
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protorobotics/jenga",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Build a function vocabulary and a blockly instance from one JSON object",
5
5
  "keywords": [
6
6
  "blockly",