scratch-blocks 2.1.18 → 2.1.20

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":"scratch_field_angle.d.ts","sourceRoot":"","sources":["../../../../src/fields/scratch_field_angle.ts"],"names":[],"mappings":"AAkcA,MAAM,WAAW,2BAA2B;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;GAEG;AACH,wBAAgB,yBAAyB,SAExC"}
1
+ {"version":3,"file":"scratch_field_angle.d.ts","sourceRoot":"","sources":["../../../../src/fields/scratch_field_angle.ts"],"names":[],"mappings":"AAucA,MAAM,WAAW,2BAA2B;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;GAEG;AACH,wBAAgB,yBAAyB,SAExC"}
@@ -1 +1 @@
1
- {"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../../../src/renderer/renderer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE1C;;GAEG;AACH,qBAAa,eAAgB,SAAQ,OAAO,CAAC,KAAK,CAAC,QAAQ;IACzD;;;;OAIG;IACM,YAAY,IAAI,MAAM;IAI/B;;;;;;OAMG;IACM,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,cAAc,CAAC,UAAU,GAAG,MAAM;IAI9F;;;;OAIG;IACM,eAAe,CAAC,KAAK,EAAE,OAAO,CAAC,QAAQ,GAAG,UAAU;IAI7D;;;OAGG;IACM,cAAc,IAAI,gBAAgB;IAI3C;;;;;OAKG;IACM,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,UAAU,GAAG,UAAU;IAItF;;;;OAIG;IACM,yBAAyB,CAAC,UAAU,EAAE,OAAO,CAAC,kBAAkB,GAAG,OAAO;CAGpF"}
1
+ {"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../../../src/renderer/renderer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE1C;;GAEG;AACH,qBAAa,eAAgB,SAAQ,OAAO,CAAC,KAAK,CAAC,QAAQ;IACzD;;;;OAIG;IACM,YAAY,IAAI,MAAM;IAI/B;;;;;;OAMG;IACM,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,cAAc,CAAC,UAAU,GAAG,MAAM;IAI9F;;;;OAIG;IACM,eAAe,CAAC,KAAK,EAAE,OAAO,CAAC,QAAQ,GAAG,UAAU;IAI7D;;;OAGG;IACM,cAAc,IAAI,gBAAgB;IAI3C;;;;;OAKG;IACM,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,UAAU,GAAG,UAAU;IAItF;;;;OAIG;IACM,yBAAyB,CAAC,UAAU,EAAE,OAAO,CAAC,kBAAkB,GAAG,OAAO;CAIpF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scratch-blocks",
3
- "version": "2.1.18",
3
+ "version": "2.1.20",
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",
@@ -36,24 +36,24 @@
36
36
  "blockly": "^12.4.1"
37
37
  },
38
38
  "devDependencies": {
39
- "@commitlint/cli": "20.5.0",
40
- "@commitlint/config-conventional": "20.5.0",
41
- "@vitest/browser": "4.1.5",
42
- "@vitest/browser-playwright": "4.1.5",
43
- "eslint": "9.39.4",
44
- "eslint-config-scratch": "14.1.12",
39
+ "@commitlint/cli": "20.5.3",
40
+ "@commitlint/config-conventional": "20.5.3",
41
+ "@vitest/browser": "4.1.11",
42
+ "@vitest/browser-playwright": "4.1.11",
43
+ "eslint": "9.39.5",
44
+ "eslint-config-scratch": "14.1.79",
45
45
  "husky": "9.1.7",
46
- "playwright": "1.59.1",
47
- "prettier": "3.8.3",
46
+ "playwright": "1.63.0",
47
+ "prettier": "3.8.5",
48
48
  "scratch-semantic-release-config": "4.0.1",
49
- "semantic-release": "25.0.3",
49
+ "semantic-release": "25.0.9",
50
50
  "source-map-loader": "5.0.0",
51
- "ts-loader": "9.5.7",
51
+ "ts-loader": "9.6.2",
52
52
  "typescript": "5.9.3",
53
- "vitest": "4.1.5",
54
- "webpack": "5.106.2",
53
+ "vitest": "4.1.11",
54
+ "webpack": "5.111.1",
55
55
  "webpack-cli": "6.0.1",
56
- "webpack-dev-server": "5.2.3"
56
+ "webpack-dev-server": "5.2.6"
57
57
  },
58
58
  "config": {
59
59
  "commitizen": {
@@ -140,12 +140,15 @@ class ScratchFieldAngle extends Blockly.FieldNumber {
140
140
  this.gauge = undefined
141
141
  if (this.mouseDownWrapper_) {
142
142
  Blockly.browserEvents.unbind(this.mouseDownWrapper_)
143
+ this.mouseDownWrapper_ = undefined
143
144
  }
144
145
  if (this.mouseUpWrapper) {
145
146
  Blockly.browserEvents.unbind(this.mouseUpWrapper)
147
+ this.mouseUpWrapper = undefined
146
148
  }
147
149
  if (this.mouseMoveWrapper) {
148
150
  Blockly.browserEvents.unbind(this.mouseMoveWrapper)
151
+ this.mouseMoveWrapper = undefined
149
152
  }
150
153
  }
151
154
 
@@ -298,9 +301,11 @@ class ScratchFieldAngle extends Blockly.FieldNumber {
298
301
  onMouseUp() {
299
302
  if (this.mouseMoveWrapper) {
300
303
  Blockly.browserEvents.unbind(this.mouseMoveWrapper)
304
+ this.mouseMoveWrapper = undefined
301
305
  }
302
306
  if (this.mouseUpWrapper) {
303
307
  Blockly.browserEvents.unbind(this.mouseUpWrapper)
308
+ this.mouseUpWrapper = undefined
304
309
  }
305
310
  }
306
311
 
@@ -47,7 +47,7 @@ export class ScratchFieldVariable extends Blockly.FieldVariable {
47
47
  // dropdownCreate returns MenuOption[] rather than Blockly.MenuGenerator's
48
48
  // MenuOption[][] variant; the cast is needed to satisfy FieldVariable's
49
49
  // menuGenerator_ type while the actual runtime shape is compatible.
50
- this.menuGenerator_ = ScratchFieldVariable.dropdownCreate.bind(this) as unknown as Blockly.MenuGenerator
50
+ this.menuGenerator_ = ScratchFieldVariable.dropdownCreate.bind(this)
51
51
  }
52
52
 
53
53
  initModel() {
package/src/index.ts CHANGED
@@ -159,7 +159,7 @@ export function isContentNodeFocused(): boolean {
159
159
  return Blockly.getFocusManager().getFocusedNode() !== null
160
160
  }
161
161
 
162
- ;(registerContinuousToolbox as () => void)()
162
+ registerContinuousToolbox()
163
163
  Blockly.Scrollbar.scrollbarThickness = Blockly.Touch.TOUCH_ENABLED ? 14 : 11
164
164
  Blockly.FlyoutButton.TEXT_MARGIN_X = 40
165
165
  Blockly.FlyoutButton.TEXT_MARGIN_Y = 10
@@ -52,7 +52,7 @@ export class ConstantProvider extends Blockly.zelos.ConstantProvider {
52
52
  * @returns The shape object for the given connection.
53
53
  */
54
54
  override shapeFor(connection: Blockly.RenderedConnection): ReturnType<Blockly.zelos.ConstantProvider['shapeFor']> {
55
- const connectionType = connection.type as Blockly.ConnectionType
55
+ const connectionType: Blockly.ConnectionType = connection.type
56
56
  let checks = connection.getCheck()
57
57
  const hexagonal = this.HEXAGONAL
58
58
  const rounded = this.ROUNDED
@@ -64,7 +64,7 @@ export class Drawer extends Blockly.zelos.Drawer {
64
64
  */
65
65
  override drawConnectionHighlightPath(measurable: Blockly.blockRendering.Connection) {
66
66
  const conn = measurable.connectionModel
67
- const connectionType = conn.type as Blockly.ConnectionType
67
+ const connectionType: Blockly.ConnectionType = conn.type
68
68
  if (connectionType === Blockly.ConnectionType.INPUT_VALUE && measurable.isDynamicShape) {
69
69
  const input = measurable as Blockly.blockRendering.InlineInput
70
70
  const EXPAND_X = 0.5
@@ -65,7 +65,8 @@ export class ScratchRenderer extends Blockly.zelos.Renderer {
65
65
  * @returns True if we should highlight the connection.
66
66
  */
67
67
  override shouldHighlightConnection(connection: Blockly.RenderedConnection): boolean {
68
- return (connection.type as Blockly.ConnectionType) === Blockly.ConnectionType.INPUT_VALUE
68
+ const connectionType: Blockly.ConnectionType = connection.type
69
+ return connectionType === Blockly.ConnectionType.INPUT_VALUE
69
70
  }
70
71
  }
71
72
 
@@ -28,7 +28,8 @@ Blockly.Connection.getConnectionForOrphanedConnection = function (
28
28
  // Apply the wrapping logic when the orphaned connection is a statement
29
29
  // connection (PREVIOUS_STATEMENT). Value connections (OUTPUT_VALUE) are
30
30
  // already handled by the original implementation.
31
- if ((orphanConnection.type as Blockly.ConnectionType) === Blockly.ConnectionType.PREVIOUS_STATEMENT) {
31
+ const orphanType: Blockly.ConnectionType = orphanConnection.type
32
+ if (orphanType === Blockly.ConnectionType.PREVIOUS_STATEMENT) {
32
33
  const checker = orphanConnection.getConnectionChecker()
33
34
  for (const input of startBlock.inputList) {
34
35
  const conn = input.connection
@@ -87,7 +88,7 @@ Reflect.set(
87
88
  if (markerPreviousConnection?.isConnected() && !markerNextConnection?.isConnected()) {
88
89
  for (const input of marker.inputList) {
89
90
  const conn = input.connection
90
- const connType = conn?.type as Blockly.ConnectionType | undefined
91
+ const connType = conn?.type
91
92
  if (connType !== Blockly.ConnectionType.NEXT_STATEMENT || !conn?.isConnected()) {
92
93
  continue
93
94
  }
@@ -69,7 +69,7 @@ export class ScratchCommentBubble
69
69
  if (gesture) {
70
70
  // ScratchCommentBubble implements IBubble structurally but TypeScript
71
71
  // cannot verify it because IBubble.drag has a different signature here.
72
- gesture.handleBubbleStart(e, this as unknown as Blockly.IBubble)
72
+ gesture.handleBubbleStart(e, this)
73
73
  Blockly.common.setSelected(this)
74
74
  }
75
75
  }
@@ -50,8 +50,9 @@ class ScratchConnectionChecker extends Blockly.ConnectionChecker {
50
50
  // getConnectionForOrphanedConnection patch routes displaced blocks into
51
51
  // statement inputs, so we allow the connection when a suitable statement
52
52
  // input exists on the dragging block.
53
+ const bType: Blockly.ConnectionType = b.type
53
54
  if (
54
- (b.type as Blockly.ConnectionType) === Blockly.ConnectionType.NEXT_STATEMENT &&
55
+ bType === Blockly.ConnectionType.NEXT_STATEMENT &&
55
56
  b.isConnected() &&
56
57
  !(a.getSourceBlock() as Blockly.Block).nextConnection
57
58
  ) {