scratch-blocks 2.1.7 → 2.1.9
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/AGENTS.md +33 -20
- package/dist/main.mjs +1 -1
- package/dist/types/src/blocks/procedures.d.ts.map +1 -1
- package/dist/types/src/renderer/render_info.d.ts +1 -1
- package/dist/types/src/renderer/render_info.d.ts.map +1 -1
- package/eslint.config.mjs +0 -16
- package/package.json +7 -7
- package/src/blocks/procedures.ts +2 -1
- package/src/renderer/render_info.ts +14 -4
|
@@ -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,GAAG,SAAS,CAAA;IAC3B,KAAK,EAAE,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAA;CAC/B,GAAG,IAAI,CACT,CAAA;AAED;;GAEG;AACH,aAAK,YAAY;IACf,MAAM,MAAM;IACZ,MAAM,MAAM;IACZ,OAAO,MAAM;CACd;
|
|
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,GAAG,SAAS,CAAA;IAC3B,KAAK,EAAE,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAA;CAC/B,GAAG,IAAI,CACT,CAAA;AAED;;GAEG;AACH,aAAK,YAAY;IACf,MAAM,MAAM;IACZ,MAAM,MAAM;IAC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AAU,EAAE,MAAM,IAAI,CAAA;CACvB"}
|
|
@@ -10,7 +10,7 @@ export declare class RenderInfo extends Blockly.zelos.RenderInfo {
|
|
|
10
10
|
populateTopRow_(): void;
|
|
11
11
|
populateBottomRow_(): void;
|
|
12
12
|
computeBounds_(): void;
|
|
13
|
-
getInRowSpacing_(prev: Blockly.blockRendering.Measurable, next: Blockly.blockRendering.Measurable): number;
|
|
13
|
+
getInRowSpacing_(prev: Blockly.blockRendering.Measurable | null, next: Blockly.blockRendering.Measurable | null): number;
|
|
14
14
|
getSpacerRowHeight_(prev: Blockly.blockRendering.Row, next: Blockly.blockRendering.Row): number;
|
|
15
15
|
getElemCenterline_(row: Blockly.blockRendering.Row, elem: Blockly.blockRendering.Measurable): number;
|
|
16
16
|
isBowlerHatBlock(): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render_info.d.ts","sourceRoot":"","sources":["../../../../src/renderer/render_info.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"render_info.d.ts","sourceRoot":"","sources":["../../../../src/renderer/render_info.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAS9C,qBAAa,UAAW,SAAQ,OAAO,CAAC,KAAK,CAAC,UAAU;IAC9C,UAAU,EAAE,gBAAgB,CAAA;IAE3B,eAAe;IAaf,kBAAkB;IAOlB,cAAc;IA0Bd,gBAAgB,CACvB,IAAI,EAAE,OAAO,CAAC,cAAc,CAAC,UAAU,GAAG,IAAI,EAC9C,IAAI,EAAE,OAAO,CAAC,cAAc,CAAC,UAAU,GAAG,IAAI,GAC7C,MAAM;IAYA,mBAAmB,CAAC,IAAI,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,GAAG,MAAM;IAQ/F,kBAAkB,CAAC,GAAG,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC,cAAc,CAAC,UAAU,GAAG,MAAM;IAmB7G,gBAAgB;IAIhB,aAAa;CAGd"}
|
package/eslint.config.mjs
CHANGED
|
@@ -16,22 +16,6 @@ export default eslintConfigScratch.defineConfig(
|
|
|
16
16
|
files: ['**/*.{ts,tsx,mts,cts}'],
|
|
17
17
|
plugins: { '@typescript-eslint': tseslint.plugin },
|
|
18
18
|
},
|
|
19
|
-
{
|
|
20
|
-
// TODO: upstream to eslint-config-scratch
|
|
21
|
-
files: ['**/*.{ts,tsx,mts,cts}'],
|
|
22
|
-
rules: {
|
|
23
|
-
'@typescript-eslint/no-empty-function': 'off',
|
|
24
|
-
'@typescript-eslint/no-unused-vars': [
|
|
25
|
-
'error',
|
|
26
|
-
{
|
|
27
|
-
argsIgnorePattern: '^_',
|
|
28
|
-
caughtErrorsIgnorePattern: '^_',
|
|
29
|
-
destructuredArrayIgnorePattern: '^_',
|
|
30
|
-
ignoreRestSiblings: true,
|
|
31
|
-
},
|
|
32
|
-
],
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
19
|
{
|
|
36
20
|
// Tests frequently introspect internals and invoke prototype methods directly.
|
|
37
21
|
files: ['tests/**/*.{ts,tsx,mts,cts}'],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scratch-blocks",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.9",
|
|
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",
|
|
@@ -38,19 +38,19 @@
|
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@commitlint/cli": "20.5.0",
|
|
40
40
|
"@commitlint/config-conventional": "20.5.0",
|
|
41
|
-
"@vitest/browser": "4.1.
|
|
42
|
-
"@vitest/browser-playwright": "4.1.
|
|
41
|
+
"@vitest/browser": "4.1.2",
|
|
42
|
+
"@vitest/browser-playwright": "4.1.2",
|
|
43
43
|
"eslint": "9.39.4",
|
|
44
|
-
"eslint-config-scratch": "14.
|
|
44
|
+
"eslint-config-scratch": "14.1.4",
|
|
45
45
|
"husky": "9.1.7",
|
|
46
|
-
"playwright": "1.
|
|
46
|
+
"playwright": "1.59.1",
|
|
47
47
|
"prettier": "3.8.1",
|
|
48
48
|
"scratch-semantic-release-config": "4.0.1",
|
|
49
49
|
"semantic-release": "25.0.3",
|
|
50
50
|
"source-map-loader": "5.0.0",
|
|
51
|
-
"ts-loader": "9.5.
|
|
51
|
+
"ts-loader": "9.5.7",
|
|
52
52
|
"typescript": "5.9.3",
|
|
53
|
-
"vitest": "4.1.
|
|
53
|
+
"vitest": "4.1.2",
|
|
54
54
|
"webpack": "5.105.4",
|
|
55
55
|
"webpack-cli": "6.0.1",
|
|
56
56
|
"webpack-dev-server": "5.2.3"
|
package/src/blocks/procedures.ts
CHANGED
|
@@ -274,7 +274,8 @@ function callerMutationToDom(this: ProcedureCallBlock): Element {
|
|
|
274
274
|
*/
|
|
275
275
|
function callerDomToMutation(this: ProcedureCallBlock, xmlElement: Element) {
|
|
276
276
|
this.procCode_ = getRequiredMutationAttribute(xmlElement, 'proccode')
|
|
277
|
-
|
|
277
|
+
const generateshadows = xmlElement.getAttribute('generateshadows')
|
|
278
|
+
this.generateShadows_ = generateshadows !== null ? JSON.parse(generateshadows) === true : false
|
|
278
279
|
this.argumentIds_ = parseRequiredMutationJson(xmlElement, 'argumentids', parseStringArrayMutationValue)
|
|
279
280
|
this.warp_ = parseRequiredMutationJson(xmlElement, 'warp', parseBooleanMutationValue)
|
|
280
281
|
this.updateDisplay_()
|
|
@@ -6,6 +6,13 @@ import * as Blockly from 'blockly/core'
|
|
|
6
6
|
import { BowlerHat } from './bowler_hat'
|
|
7
7
|
import { ConstantProvider } from './constants'
|
|
8
8
|
|
|
9
|
+
// Blockly's BlockSvg types previousConnection as non-null, but blocks without a
|
|
10
|
+
// previous connector (hat blocks) have it as null at runtime. This type corrects
|
|
11
|
+
// that so null checks are recognized by the type system instead of suppressed.
|
|
12
|
+
type BlockSvgWithNullableConnections = Omit<Blockly.BlockSvg, 'previousConnection'> & {
|
|
13
|
+
previousConnection: Blockly.RenderedConnection | null
|
|
14
|
+
}
|
|
15
|
+
|
|
9
16
|
export class RenderInfo extends Blockly.zelos.RenderInfo {
|
|
10
17
|
declare constants_: ConstantProvider
|
|
11
18
|
|
|
@@ -56,12 +63,12 @@ export class RenderInfo extends Blockly.zelos.RenderInfo {
|
|
|
56
63
|
}
|
|
57
64
|
|
|
58
65
|
override getInRowSpacing_(
|
|
59
|
-
prev: Blockly.blockRendering.Measurable,
|
|
60
|
-
next: Blockly.blockRendering.Measurable,
|
|
66
|
+
prev: Blockly.blockRendering.Measurable | null,
|
|
67
|
+
next: Blockly.blockRendering.Measurable | null,
|
|
61
68
|
): number {
|
|
62
69
|
if (
|
|
63
70
|
this.isBowlerHatBlock() &&
|
|
64
|
-
(Blockly.blockRendering.Types.isHat(prev) || Blockly.blockRendering.Types.isHat(next))
|
|
71
|
+
((prev && Blockly.blockRendering.Types.isHat(prev)) || (next && Blockly.blockRendering.Types.isHat(next)))
|
|
65
72
|
) {
|
|
66
73
|
// Bowler hat rows have no spacing/gaps, just the hat.
|
|
67
74
|
return 0
|
|
@@ -86,7 +93,10 @@ export class RenderInfo extends Blockly.zelos.RenderInfo {
|
|
|
86
93
|
this.block_.isScratchExtension &&
|
|
87
94
|
Blockly.blockRendering.Types.isField(elem) &&
|
|
88
95
|
elem.field instanceof Blockly.FieldImage &&
|
|
89
|
-
elem.field === this.block_.inputList[0].fieldRow[0]
|
|
96
|
+
elem.field === this.block_.inputList[0].fieldRow[0] &&
|
|
97
|
+
// Hat-style extension blocks have no previousConnection and use their
|
|
98
|
+
// own centering; only offset stack-style extensions.
|
|
99
|
+
(this.block_ as BlockSvgWithNullableConnections).previousConnection
|
|
90
100
|
) {
|
|
91
101
|
// Vertically center the icon on extension blocks.
|
|
92
102
|
return super.getElemCenterline_(row, elem) + this.constants_.GRID_UNIT
|