scratch-blocks 2.1.1 → 2.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.
@@ -1 +1 @@
1
- {"version":3,"file":"procedures.d.ts","sourceRoot":"","sources":["../../../../src/blocks/procedures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH;;GAEG;AACH,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAIvC;;GAEG;AACH,KAAK,aAAa,GAAG,MAAM,CACzB,MAAM,EACN;IACE,MAAM,EAAE,OAAO,CAAA;IACf,KAAK,EAAE,OAAO,CAAC,QAAQ,CAAA;CACxB,GAAG,IAAI,CACT,CAAA;AAED;;GAEG;AACH,aAAK,YAAY;IACf,MAAM,MAAM;IACZ,MAAM,MAAM;IACZ,OAAO,MAAM;CACd;AA2gCD,UAAU,cAAe,SAAQ,OAAO,CAAC,QAAQ;IAC/C,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,KAAK,EAAE,OAAO,CAAA;IACd,WAAW,EAAE,MAAM,MAAM,CAAA;IACzB,gBAAgB,EAAE,MAAM,IAAI,CAAA;IAC5B,oBAAoB,EAAE,MAAM,aAAa,CAAA;IACzC,sBAAsB,EAAE,CAAC,aAAa,EAAE,aAAa,KAAK,IAAI,CAAA;IAC9D,gBAAgB,EAAE,CAAC,aAAa,EAAE,aAAa,KAAK,IAAI,CAAA;IACxD,cAAc,EAAE,MAAM,IAAI,CAAA;IAC1B,iBAAiB,EAAE,CACjB,IAAI,EAAE,YAAY,EAClB,KAAK,EAAE,MAAM,EACb,aAAa,EAAE,aAAa,EAC5B,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,OAAO,CAAC,KAAK,KACjB,IAAI,CAAA;IACT,kBAAkB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CAC3C;AAED,MAAM,WAAW,yBAA0B,SAAQ,cAAc;I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EAAE,CAAC,aAAa,EAAE,aAAa,KAAK,IAAI,CAAA;IAC9D,gBAAgB,EAAE,CAAC,aAAa,EAAE,aAAa,KAAK,IAAI,CAAA;IACxD,cAAc,EAAE,MAAM,IAAI,CAAA;IAC1B,iBAAiB,EAAE,CACjB,IAAI,EAAE,YAAY,EAClB,KAAK,EAAE,MAAM,EACb,aAAa,EAAE,aAAa,EAC5B,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,OAAO,CAAC,KAAK,KACjB,IAAI,CAAA;IACT,kBAAkB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CAC3C;AAED,MAAM,WAAW,yBAA0B,SAAQ,cAAc;IAC/D,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,iBAAiB,EAAE,MAAM,EAAE,CAAA;IAC3B,mBAAmB,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,KAAK,IAAI,CAAA;IACnD,qBAAqB,EAAE,CAAC,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,QAAQ,CAAA;IAC5F,gBAAgB,EAAE,MAAM,IAAI,CAAA;IAC5B,OAAO,EAAE,MAAM,OAAO,CAAA;IACtB,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IAChC,gBAAgB,EAAE,MAAM,IAAI,CAAA;IAC5B,kBAAkB,EAAE,MAAM,IAAI,CAAA;IAC9B,uBAAuB,EAAE,MAAM,IAAI,CAAA;IACnC,UAAU,EAAE,MAAM,IAAI,CAAA;CACvB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scratch-blocks",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "Scratch Blocks is a library for building creative computing interfaces.",
5
5
  "author": "Massachusetts Institute of Technology",
6
6
  "license": "Apache-2.0",
@@ -32,10 +32,10 @@
32
32
  "blockly": "^12.4.1"
33
33
  },
34
34
  "devDependencies": {
35
- "@commitlint/cli": "20.4.3",
36
- "@commitlint/config-conventional": "20.4.3",
35
+ "@commitlint/cli": "20.4.4",
36
+ "@commitlint/config-conventional": "20.4.4",
37
37
  "eslint": "9.39.4",
38
- "eslint-config-scratch": "14.0.6",
38
+ "eslint-config-scratch": "14.0.8",
39
39
  "husky": "9.1.7",
40
40
  "prettier": "3.8.1",
41
41
  "scratch-semantic-release-config": "4.0.1",
@@ -570,10 +570,7 @@ function populateArgumentOnDeclaration_(
570
570
  oldBlock = saveInfo?.block ?? null
571
571
  }
572
572
 
573
- // TODO: This always returns false, because it checks for argument reporter
574
- // blocks instead of argument editor blocks. Create a new version for argument
575
- // editors.
576
- const oldTypeMatches = checkOldTypeMatches_(oldBlock, type)
573
+ const oldTypeMatches = checkOldEditorTypeMatches_(oldBlock, type)
577
574
  const displayName = this.displayNames_[index]
578
575
 
579
576
  // Decide which block to attach.
@@ -591,13 +588,13 @@ function populateArgumentOnDeclaration_(
591
588
  }
592
589
 
593
590
  /**
594
- * Check whether the type of the old block corresponds to the given argument
595
- * type.
591
+ * Check whether the type of the old argument reporter block corresponds to the
592
+ * given argument type.
596
593
  * @param oldBlock The old block to check.
597
- * @param type The argument type. One of 'n', 'n', or 's'.
594
+ * @param type The argument type. One of 'n', 'b', or 's'.
598
595
  * @returns True if the type matches, false otherwise.
599
596
  */
600
- function checkOldTypeMatches_(oldBlock: Blockly.BlockSvg | null, type: string): boolean {
597
+ function checkOldTypeMatches_(oldBlock: Blockly.BlockSvg | null, type: ArgumentType): boolean {
601
598
  if (!oldBlock) {
602
599
  return false
603
600
  }
@@ -613,6 +610,29 @@ function checkOldTypeMatches_(oldBlock: Blockly.BlockSvg | null, type: string):
613
610
  return false
614
611
  }
615
612
 
613
+ /**
614
+ * Check whether the type of the old argument editor block corresponds to the
615
+ * given argument type.
616
+ * @param oldBlock The old block to check.
617
+ * @param type The argument type. One of 'n', 'b', or 's'.
618
+ * @returns True if the type matches, false otherwise.
619
+ */
620
+ function checkOldEditorTypeMatches_(oldBlock: Blockly.BlockSvg | null, type: ArgumentType): boolean {
621
+ if (!oldBlock) {
622
+ return false
623
+ }
624
+ if (
625
+ (type === ArgumentType.NUMBER || type === ArgumentType.STRING) &&
626
+ oldBlock.type === 'argument_editor_string_number'
627
+ ) {
628
+ return true
629
+ }
630
+ if (type === ArgumentType.BOOLEAN && oldBlock.type === 'argument_editor_boolean') {
631
+ return true
632
+ }
633
+ return false
634
+ }
635
+
616
636
  /**
617
637
  * Create an argument editor.
618
638
  * An argument editor is a shadow block with a single text field, which is used