@protorobotics/jenga 1.0.2 → 1.1.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.1.0 --- 2025-10-08
4
+
5
+ ### Changed
6
+
7
+ - Fields are now passed as functions that return fields
8
+ - Renamed `process` to `processJengaTower`
9
+
3
10
  ## 1.0.1 --- 2025-10-03
4
11
 
5
12
  ### Added
@@ -10,4 +17,4 @@
10
17
 
11
18
  ### Added
12
19
 
13
- - Project start
20
+ - Project start
package/jenga.js CHANGED
@@ -17,10 +17,15 @@ import { Block, CodeGenerator, common, Field, Toolbox } from "blockly";
17
17
  * @property {CodeGenFunction} codeGenerator The code generator function used by blockly.
18
18
  */
19
19
 
20
+ /**
21
+ * @callback FieldFunction
22
+ * @returns {Field} The blockly field object.
23
+ */
24
+
20
25
  /**
21
26
  * @typedef {object} BlocklyField
22
27
  * @property {string?} name The name of the field.
23
- * @property {Field?} field The blockly field object.
28
+ * @property {FieldFunction?} field Function that generates the blockly field object.
24
29
  * @property {string?} text Text displayed in place of the field.
25
30
  */
26
31
 
@@ -53,7 +58,7 @@ const BlocklyType = {
53
58
  * @param {CodeGenerator} generator The blockly code generator.
54
59
  * @returns {{toolbox: Toolbox, vocab: Vocabulary}} The generated structures.
55
60
  */
56
- export function process(categories, generator) {
61
+ export function processJengaTower(categories, generator) {
57
62
  const blocklyCategories = [];
58
63
 
59
64
  for (const category of categories) {
@@ -105,7 +110,7 @@ function initBlocklyBlock(entry, category, generator) {
105
110
  rootInput.appendField(field.text);
106
111
  } else {
107
112
  // Additional user input
108
- rootInput.appendField(field.field, field.name);
113
+ rootInput.appendField(field.field(), field.name);
109
114
  }
110
115
  }
111
116
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protorobotics/jenga",
3
- "version": "1.0.2",
3
+ "version": "1.1.0",
4
4
  "description": "Build a function vocabulary and a blockly instance from one JSON object",
5
5
  "keywords": [
6
6
  "blockly",