scratch-blocks 2.0.0-spork.1 → 2.0.0-spork.3

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 (81) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/main.js +1 -1
  3. package/package.json +2 -3
  4. package/src/{block_reporting.js → block_reporting.ts} +7 -5
  5. package/src/blocks/{colour.js → colour.ts} +6 -6
  6. package/src/blocks/{control.js → control.ts} +21 -54
  7. package/src/blocks/{data.js → data.ts} +134 -142
  8. package/src/blocks/{event.js → event.ts} +12 -33
  9. package/src/blocks/{looks.js → looks.ts} +24 -73
  10. package/src/blocks/{math.js → math.ts} +6 -11
  11. package/src/blocks/{matrix.js → matrix.ts} +2 -3
  12. package/src/blocks/{motion.js → motion.ts} +23 -70
  13. package/src/blocks/{note.js → note.ts} +2 -3
  14. package/src/blocks/{operators.js → operators.ts} +18 -55
  15. package/src/blocks/{procedures.js → procedures.ts} +418 -269
  16. package/src/blocks/{sensing.js → sensing.ts} +21 -61
  17. package/src/blocks/{sound.js → sound.ts} +9 -28
  18. package/src/blocks/{text.js → text.ts} +1 -2
  19. package/src/blocks/{vertical_extensions.js → vertical_extensions.ts} +63 -100
  20. package/src/checkable_continuous_flyout.js +2 -2
  21. package/src/{checkbox_bubble.js → checkbox_bubble.ts} +36 -53
  22. package/src/{colours.js → colours.ts} +11 -4
  23. package/src/{constants.js → constants.ts} +13 -0
  24. package/src/{context_menu_items.js → context_menu_items.ts} +18 -12
  25. package/src/{data_category.js → data_category.ts} +216 -150
  26. package/src/events/{events_block_comment_base.js → events_block_comment_base.ts} +23 -4
  27. package/src/events/{events_block_comment_change.js → events_block_comment_change.ts} +29 -5
  28. package/src/events/{events_block_comment_collapse.js → events_block_comment_collapse.ts} +24 -6
  29. package/src/events/{events_block_comment_create.js → events_block_comment_create.ts} +36 -10
  30. package/src/events/{events_block_comment_delete.js → events_block_comment_delete.ts} +6 -2
  31. package/src/events/{events_block_comment_move.js → events_block_comment_move.ts} +36 -6
  32. package/src/events/events_block_comment_resize.ts +88 -0
  33. package/src/events/events_block_drag_end.ts +49 -0
  34. package/src/events/events_block_drag_outside.ts +44 -0
  35. package/src/events/{events_scratch_variable_create.js → events_scratch_variable_create.ts} +28 -15
  36. package/src/fields/{field_colour_slider.js → field_colour_slider.ts} +117 -106
  37. package/src/fields/{field_matrix.js → field_matrix.ts} +189 -215
  38. package/src/fields/{field_note.js → field_note.ts} +227 -286
  39. package/src/fields/{field_textinput_removable.js → field_textinput_removable.ts} +17 -20
  40. package/src/fields/{field_variable_getter.js → field_variable_getter.ts} +28 -17
  41. package/src/fields/{field_vertical_separator.js → field_vertical_separator.ts} +14 -30
  42. package/src/fields/{field_angle.js → scratch_field_angle.ts} +124 -80
  43. package/src/fields/{field_dropdown.js → scratch_field_dropdown.ts} +9 -7
  44. package/src/fields/{field_number.js → scratch_field_number.ts} +60 -55
  45. package/src/fields/{field_variable.js → scratch_field_variable.ts} +46 -27
  46. package/src/{flyout_checkbox_icon.js → flyout_checkbox_icon.ts} +15 -19
  47. package/src/{glows.js → glows.ts} +29 -18
  48. package/src/index.ts +59 -60
  49. package/src/procedures.ts +462 -0
  50. package/src/{recyclable_block_flyout_inflater.js → recyclable_block_flyout_inflater.ts} +35 -35
  51. package/src/renderer/{bowler_hat.js → bowler_hat.ts} +1 -1
  52. package/src/renderer/{constants.js → constants.ts} +26 -12
  53. package/src/renderer/{drawer.js → drawer.ts} +8 -3
  54. package/src/renderer/{path_object.js → path_object.ts} +2 -2
  55. package/src/renderer/{render_info.js → render_info.ts} +19 -7
  56. package/src/renderer/renderer.ts +76 -0
  57. package/src/{scratch_block_paster.js → scratch_block_paster.ts} +9 -7
  58. package/src/scratch_blocks_utils.ts +39 -0
  59. package/src/{scratch_comment_icon.js → scratch_comment_icon.ts} +43 -26
  60. package/src/scratch_connection_checker.ts +44 -0
  61. package/src/{scratch_continuous_category.js → scratch_continuous_category.ts} +20 -13
  62. package/src/{scratch_continuous_toolbox.js → scratch_continuous_toolbox.ts} +20 -18
  63. package/src/{scratch_dragger.js → scratch_dragger.ts} +97 -28
  64. package/src/{scratch_variable_map.js → scratch_variable_map.ts} +4 -1
  65. package/src/scratch_variable_model.ts +30 -0
  66. package/src/{shadows.js → shadows.ts} +8 -4
  67. package/src/{status_indicator_label.js → status_indicator_label.ts} +24 -36
  68. package/src/{status_indicator_label_flyout_inflater.js → status_indicator_label_flyout_inflater.ts} +9 -7
  69. package/src/{variables.js → variables.ts} +153 -123
  70. package/tsconfig.json +4 -2
  71. package/src/categories.js +0 -15
  72. package/src/events/events_block_comment_resize.js +0 -52
  73. package/src/events/events_block_drag_end.js +0 -33
  74. package/src/events/events_block_drag_outside.js +0 -30
  75. package/src/procedures.js +0 -425
  76. package/src/renderer/renderer.js +0 -74
  77. package/src/scratch_blocks_utils.js +0 -148
  78. package/src/scratch_connection_checker.js +0 -29
  79. package/src/scratch_variable_model.js +0 -24
  80. /package/src/{css.js → css.ts} +0 -0
  81. /package/{continuous-toolbox.d.ts → types/continuous-toolbox.d.ts} +0 -0
@@ -19,14 +19,12 @@
19
19
  */
20
20
 
21
21
  import * as Blockly from "blockly/core";
22
- import { Categories } from "../categories.js";
23
22
 
24
23
  Blockly.Blocks["operator_add"] = {
25
24
  /**
26
25
  * Block for adding two numbers.
27
- * @this Blockly.Block
28
26
  */
29
- init: function () {
27
+ init: function (this: Blockly.Block) {
30
28
  this.jsonInit({
31
29
  message0: Blockly.Msg.OPERATORS_ADD,
32
30
  args0: [
@@ -39,7 +37,6 @@ Blockly.Blocks["operator_add"] = {
39
37
  name: "NUM2",
40
38
  },
41
39
  ],
42
- category: Categories.operators,
43
40
  extensions: ["colours_operators", "output_number"],
44
41
  });
45
42
  },
@@ -48,9 +45,8 @@ Blockly.Blocks["operator_add"] = {
48
45
  Blockly.Blocks["operator_subtract"] = {
49
46
  /**
50
47
  * Block for subtracting two numbers.
51
- * @this Blockly.Block
52
48
  */
53
- init: function () {
49
+ init: function (this: Blockly.Block) {
54
50
  this.jsonInit({
55
51
  message0: Blockly.Msg.OPERATORS_SUBTRACT,
56
52
  args0: [
@@ -63,7 +59,6 @@ Blockly.Blocks["operator_subtract"] = {
63
59
  name: "NUM2",
64
60
  },
65
61
  ],
66
- category: Categories.operators,
67
62
  extensions: ["colours_operators", "output_number"],
68
63
  });
69
64
  },
@@ -72,9 +67,8 @@ Blockly.Blocks["operator_subtract"] = {
72
67
  Blockly.Blocks["operator_multiply"] = {
73
68
  /**
74
69
  * Block for multiplying two numbers.
75
- * @this Blockly.Block
76
70
  */
77
- init: function () {
71
+ init: function (this: Blockly.Block) {
78
72
  this.jsonInit({
79
73
  message0: Blockly.Msg.OPERATORS_MULTIPLY,
80
74
  args0: [
@@ -87,7 +81,6 @@ Blockly.Blocks["operator_multiply"] = {
87
81
  name: "NUM2",
88
82
  },
89
83
  ],
90
- category: Categories.operators,
91
84
  extensions: ["colours_operators", "output_number"],
92
85
  });
93
86
  },
@@ -96,9 +89,8 @@ Blockly.Blocks["operator_multiply"] = {
96
89
  Blockly.Blocks["operator_divide"] = {
97
90
  /**
98
91
  * Block for dividing two numbers.
99
- * @this Blockly.Block
100
92
  */
101
- init: function () {
93
+ init: function (this: Blockly.Block) {
102
94
  this.jsonInit({
103
95
  message0: Blockly.Msg.OPERATORS_DIVIDE,
104
96
  args0: [
@@ -111,7 +103,6 @@ Blockly.Blocks["operator_divide"] = {
111
103
  name: "NUM2",
112
104
  },
113
105
  ],
114
- category: Categories.operators,
115
106
  extensions: ["colours_operators", "output_number"],
116
107
  });
117
108
  },
@@ -120,9 +111,8 @@ Blockly.Blocks["operator_divide"] = {
120
111
  Blockly.Blocks["operator_random"] = {
121
112
  /**
122
113
  * Block for picking a random number.
123
- * @this Blockly.Block
124
114
  */
125
- init: function () {
115
+ init: function (this: Blockly.Block) {
126
116
  this.jsonInit({
127
117
  message0: Blockly.Msg.OPERATORS_RANDOM,
128
118
  args0: [
@@ -135,7 +125,6 @@ Blockly.Blocks["operator_random"] = {
135
125
  name: "TO",
136
126
  },
137
127
  ],
138
- category: Categories.operators,
139
128
  extensions: ["colours_operators", "output_number"],
140
129
  });
141
130
  },
@@ -144,9 +133,8 @@ Blockly.Blocks["operator_random"] = {
144
133
  Blockly.Blocks["operator_lt"] = {
145
134
  /**
146
135
  * Block for less than comparator.
147
- * @this Blockly.Block
148
136
  */
149
- init: function () {
137
+ init: function (this: Blockly.Block) {
150
138
  this.jsonInit({
151
139
  message0: Blockly.Msg.OPERATORS_LT,
152
140
  args0: [
@@ -159,7 +147,6 @@ Blockly.Blocks["operator_lt"] = {
159
147
  name: "OPERAND2",
160
148
  },
161
149
  ],
162
- category: Categories.operators,
163
150
  extensions: ["colours_operators", "output_boolean"],
164
151
  });
165
152
  },
@@ -168,9 +155,8 @@ Blockly.Blocks["operator_lt"] = {
168
155
  Blockly.Blocks["operator_equals"] = {
169
156
  /**
170
157
  * Block for equals comparator.
171
- * @this Blockly.Block
172
158
  */
173
- init: function () {
159
+ init: function (this: Blockly.Block) {
174
160
  this.jsonInit({
175
161
  message0: Blockly.Msg.OPERATORS_EQUALS,
176
162
  args0: [
@@ -183,7 +169,6 @@ Blockly.Blocks["operator_equals"] = {
183
169
  name: "OPERAND2",
184
170
  },
185
171
  ],
186
- category: Categories.operators,
187
172
  extensions: ["colours_operators", "output_boolean"],
188
173
  });
189
174
  },
@@ -192,9 +177,8 @@ Blockly.Blocks["operator_equals"] = {
192
177
  Blockly.Blocks["operator_gt"] = {
193
178
  /**
194
179
  * Block for greater than comparator.
195
- * @this Blockly.Block
196
180
  */
197
- init: function () {
181
+ init: function (this: Blockly.Block) {
198
182
  this.jsonInit({
199
183
  message0: Blockly.Msg.OPERATORS_GT,
200
184
  args0: [
@@ -207,7 +191,6 @@ Blockly.Blocks["operator_gt"] = {
207
191
  name: "OPERAND2",
208
192
  },
209
193
  ],
210
- category: Categories.operators,
211
194
  extensions: ["colours_operators", "output_boolean"],
212
195
  });
213
196
  },
@@ -216,9 +199,8 @@ Blockly.Blocks["operator_gt"] = {
216
199
  Blockly.Blocks["operator_and"] = {
217
200
  /**
218
201
  * Block for "and" boolean comparator.
219
- * @this Blockly.Block
220
202
  */
221
- init: function () {
203
+ init: function (this: Blockly.Block) {
222
204
  this.jsonInit({
223
205
  message0: Blockly.Msg.OPERATORS_AND,
224
206
  args0: [
@@ -233,7 +215,6 @@ Blockly.Blocks["operator_and"] = {
233
215
  check: "Boolean",
234
216
  },
235
217
  ],
236
- category: Categories.operators,
237
218
  extensions: ["colours_operators", "output_boolean"],
238
219
  });
239
220
  },
@@ -242,9 +223,8 @@ Blockly.Blocks["operator_and"] = {
242
223
  Blockly.Blocks["operator_or"] = {
243
224
  /**
244
225
  * Block for "or" boolean comparator.
245
- * @this Blockly.Block
246
226
  */
247
- init: function () {
227
+ init: function (this: Blockly.Block) {
248
228
  this.jsonInit({
249
229
  message0: Blockly.Msg.OPERATORS_OR,
250
230
  args0: [
@@ -259,7 +239,6 @@ Blockly.Blocks["operator_or"] = {
259
239
  check: "Boolean",
260
240
  },
261
241
  ],
262
- category: Categories.operators,
263
242
  extensions: ["colours_operators", "output_boolean"],
264
243
  });
265
244
  },
@@ -268,9 +247,8 @@ Blockly.Blocks["operator_or"] = {
268
247
  Blockly.Blocks["operator_not"] = {
269
248
  /**
270
249
  * Block for "not" unary boolean operator.
271
- * @this Blockly.Block
272
250
  */
273
- init: function () {
251
+ init: function (this: Blockly.Block) {
274
252
  this.jsonInit({
275
253
  message0: Blockly.Msg.OPERATORS_NOT,
276
254
  args0: [
@@ -280,7 +258,6 @@ Blockly.Blocks["operator_not"] = {
280
258
  check: "Boolean",
281
259
  },
282
260
  ],
283
- category: Categories.operators,
284
261
  extensions: ["colours_operators", "output_boolean"],
285
262
  });
286
263
  },
@@ -289,9 +266,8 @@ Blockly.Blocks["operator_not"] = {
289
266
  Blockly.Blocks["operator_join"] = {
290
267
  /**
291
268
  * Block for string join operator.
292
- * @this Blockly.Block
293
269
  */
294
- init: function () {
270
+ init: function (this: Blockly.Block) {
295
271
  this.jsonInit({
296
272
  message0: Blockly.Msg.OPERATORS_JOIN,
297
273
  args0: [
@@ -304,7 +280,6 @@ Blockly.Blocks["operator_join"] = {
304
280
  name: "STRING2",
305
281
  },
306
282
  ],
307
- category: Categories.operators,
308
283
  extensions: ["colours_operators", "output_string"],
309
284
  });
310
285
  },
@@ -313,9 +288,8 @@ Blockly.Blocks["operator_join"] = {
313
288
  Blockly.Blocks["operator_letter_of"] = {
314
289
  /**
315
290
  * Block for "letter _ of _" operator.
316
- * @this Blockly.Block
317
291
  */
318
- init: function () {
292
+ init: function (this: Blockly.Block) {
319
293
  this.jsonInit({
320
294
  message0: Blockly.Msg.OPERATORS_LETTEROF,
321
295
  args0: [
@@ -328,7 +302,6 @@ Blockly.Blocks["operator_letter_of"] = {
328
302
  name: "STRING",
329
303
  },
330
304
  ],
331
- category: Categories.operators,
332
305
  extensions: ["colours_operators", "output_string"],
333
306
  });
334
307
  },
@@ -337,9 +310,8 @@ Blockly.Blocks["operator_letter_of"] = {
337
310
  Blockly.Blocks["operator_length"] = {
338
311
  /**
339
312
  * Block for string length operator.
340
- * @this Blockly.Block
341
313
  */
342
- init: function () {
314
+ init: function (this: Blockly.Block) {
343
315
  this.jsonInit({
344
316
  message0: Blockly.Msg.OPERATORS_LENGTH,
345
317
  args0: [
@@ -348,7 +320,6 @@ Blockly.Blocks["operator_length"] = {
348
320
  name: "STRING",
349
321
  },
350
322
  ],
351
- category: Categories.operators,
352
323
  extensions: ["colours_operators", "output_string"],
353
324
  });
354
325
  },
@@ -357,9 +328,8 @@ Blockly.Blocks["operator_length"] = {
357
328
  Blockly.Blocks["operator_contains"] = {
358
329
  /**
359
330
  * Block for _ contains _ operator
360
- * @this Blockly.Block
361
331
  */
362
- init: function () {
332
+ init: function (this: Blockly.Block) {
363
333
  this.jsonInit({
364
334
  message0: Blockly.Msg.OPERATORS_CONTAINS,
365
335
  args0: [
@@ -372,7 +342,6 @@ Blockly.Blocks["operator_contains"] = {
372
342
  name: "STRING2",
373
343
  },
374
344
  ],
375
- category: Categories.operators,
376
345
  extensions: ["colours_operators", "output_boolean"],
377
346
  });
378
347
  },
@@ -381,9 +350,8 @@ Blockly.Blocks["operator_contains"] = {
381
350
  Blockly.Blocks["operator_mod"] = {
382
351
  /**
383
352
  * Block for mod two numbers.
384
- * @this Blockly.Block
385
353
  */
386
- init: function () {
354
+ init: function (this: Blockly.Block) {
387
355
  this.jsonInit({
388
356
  message0: Blockly.Msg.OPERATORS_MOD,
389
357
  args0: [
@@ -396,7 +364,6 @@ Blockly.Blocks["operator_mod"] = {
396
364
  name: "NUM2",
397
365
  },
398
366
  ],
399
- category: Categories.operators,
400
367
  extensions: ["colours_operators", "output_number"],
401
368
  });
402
369
  },
@@ -405,9 +372,8 @@ Blockly.Blocks["operator_mod"] = {
405
372
  Blockly.Blocks["operator_round"] = {
406
373
  /**
407
374
  * Block for rounding a numbers.
408
- * @this Blockly.Block
409
375
  */
410
- init: function () {
376
+ init: function (this: Blockly.Block) {
411
377
  this.jsonInit({
412
378
  message0: Blockly.Msg.OPERATORS_ROUND,
413
379
  args0: [
@@ -416,7 +382,6 @@ Blockly.Blocks["operator_round"] = {
416
382
  name: "NUM",
417
383
  },
418
384
  ],
419
- category: Categories.operators,
420
385
  extensions: ["colours_operators", "output_number"],
421
386
  });
422
387
  },
@@ -425,9 +390,8 @@ Blockly.Blocks["operator_round"] = {
425
390
  Blockly.Blocks["operator_mathop"] = {
426
391
  /**
427
392
  * Block for "advanced" math ops on a number.
428
- * @this Blockly.Block
429
393
  */
430
- init: function () {
394
+ init: function (this: Blockly.Block) {
431
395
  this.jsonInit({
432
396
  message0: Blockly.Msg.OPERATORS_MATHOP,
433
397
  args0: [
@@ -456,7 +420,6 @@ Blockly.Blocks["operator_mathop"] = {
456
420
  name: "NUM",
457
421
  },
458
422
  ],
459
- category: Categories.operators,
460
423
  extensions: ["colours_operators", "output_number"],
461
424
  });
462
425
  },