hikkaku 0.1.14 → 0.2.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/blocks/index.mjs CHANGED
@@ -1,134 +1,595 @@
1
- import { a as fromCostumeSource, i as valueBlock, o as fromPrimitiveSource, r as substack, s as fromSoundSource, t as block } from "../composer-JWWbnKkh.mjs";
1
+ import { a as valueBlock, c as fromSoundSource, i as substack, l as InputType, n as block, o as fromCostumeSource, s as fromPrimitiveSource, t as attachStack, u as Shadow } from "../composer-BudVTTBs.mjs";
2
2
 
3
3
  //#region src/blocks/control.ts
4
+ /**
5
+ * Repeats enclosed blocks a fixed number of times.
6
+ *
7
+ * Input: `times`, `handler`.
8
+ * Output: Scratch statement block definition that is appended to the current script stack.
9
+ *
10
+ * @param times PrimitiveSource<number>. number of iterations
11
+ * @param handler () => void. body of the loop
12
+ * @returns Scratch statement block definition that is appended to the current script stack.
13
+ * @example
14
+ * ```ts
15
+ * import { repeat } from 'hikkaku/blocks'
16
+ *
17
+ * repeat(10, () => {})
18
+ * ```
19
+ */
4
20
  const repeat = (times, handler) => {
5
21
  const substackId = substack(handler);
6
22
  return block("control_repeat", { inputs: {
7
23
  TIMES: fromPrimitiveSource(times),
8
- ...substackId ? { SUBSTACK: [2, substackId] } : {}
24
+ ...substackId ? { SUBSTACK: [Shadow.NoShadow, substackId] } : {}
9
25
  } });
10
26
  };
27
+ /**
28
+ * Repeats until the condition becomes true.
29
+ *
30
+ * Input: `condition`, `handler`.
31
+ * Output: Scratch statement block definition that is appended to the current script stack.
32
+ *
33
+ * @param condition PrimitiveSource<boolean>
34
+ * @param handler () => void
35
+ * @returns Scratch statement block definition that is appended to the current script stack.
36
+ * @example
37
+ * ```ts
38
+ * import { repeatUntil } from 'hikkaku/blocks'
39
+ *
40
+ * repeatUntil(true, () => {})
41
+ * ```
42
+ */
11
43
  const repeatUntil = (condition, handler) => {
12
44
  const substackId = substack(handler);
13
45
  return block("control_repeat_until", { inputs: {
14
46
  CONDITION: fromPrimitiveSource(condition),
15
- ...substackId ? { SUBSTACK: [2, substackId] } : {}
47
+ ...substackId ? { SUBSTACK: [Shadow.NoShadow, substackId] } : {}
16
48
  } });
17
49
  };
50
+ /**
51
+ * Repeats while the condition remains true.
52
+ *
53
+ * Input: `condition`, `handler`.
54
+ * Output: Scratch statement block definition that is appended to the current script stack.
55
+ *
56
+ * @param condition PrimitiveSource<boolean>
57
+ * @param handler () => void
58
+ * @returns Scratch statement block definition that is appended to the current script stack.
59
+ * @example
60
+ * ```ts
61
+ * import { repeatWhile } from 'hikkaku/blocks'
62
+ *
63
+ * repeatWhile(true, () => {})
64
+ * ```
65
+ */
18
66
  const repeatWhile = (condition, handler) => {
19
67
  const substackId = substack(handler);
20
68
  return block("control_while", { inputs: {
21
69
  CONDITION: fromPrimitiveSource(condition),
22
- ...substackId ? { SUBSTACK: [2, substackId] } : {}
70
+ ...substackId ? { SUBSTACK: [Shadow.NoShadow, substackId] } : {}
23
71
  } });
24
72
  };
73
+ /**
74
+ * Loops with a loop variable.
75
+ *
76
+ * Input: `variable`, `value`, `handler`.
77
+ * Output: Scratch statement block definition that is appended to the current script stack.
78
+ *
79
+ * @param variable VariableReference
80
+ * @param value PrimitiveSource<number>. upper bound
81
+ * @param handler () => void
82
+ * @returns Scratch statement block definition that is appended to the current script stack.
83
+ * @example
84
+ * ```ts
85
+ * import { forEach } from 'hikkaku/blocks'
86
+ *
87
+ * forEach(variable as any, 10, () => {})
88
+ * ```
89
+ */
25
90
  const forEach = (variable, value, handler) => {
26
91
  const substackId = substack(handler);
27
92
  return block("control_for_each", {
28
93
  inputs: {
29
94
  VALUE: fromPrimitiveSource(value),
30
- ...substackId ? { SUBSTACK: [2, substackId] } : {}
95
+ ...substackId ? { SUBSTACK: [Shadow.NoShadow, substackId] } : {}
31
96
  },
32
97
  fields: { VARIABLE: [variable.name, variable.id] }
33
98
  });
34
99
  };
100
+ /**
101
+ * Infinite loop.
102
+ *
103
+ * Input: `handler`.
104
+ * Output: Scratch statement block definition that is appended to the current script stack.
105
+ *
106
+ * @param handler () => void
107
+ * @returns Scratch statement block definition that is appended to the current script stack.
108
+ * @example
109
+ * ```ts
110
+ * import { forever } from 'hikkaku/blocks'
111
+ *
112
+ * forever(() => {})
113
+ * ```
114
+ */
35
115
  const forever = (handler) => {
36
116
  const substackId = substack(handler);
37
- return block("control_forever", { inputs: substackId ? { SUBSTACK: [2, substackId] } : {} });
38
- };
117
+ return block("control_forever", { inputs: substackId ? { SUBSTACK: [Shadow.NoShadow, substackId] } : {} });
118
+ };
119
+ /**
120
+ * Pauses execution.
121
+ *
122
+ * Input: `seconds`.
123
+ * Output: Scratch statement block definition that is appended to the current script stack.
124
+ *
125
+ * @param seconds PrimitiveSource<number>
126
+ * @returns Scratch statement block definition that is appended to the current script stack.
127
+ * @example
128
+ * ```ts
129
+ * import { wait } from 'hikkaku/blocks'
130
+ *
131
+ * wait(10)
132
+ * ```
133
+ */
39
134
  const wait = (seconds) => {
40
135
  return block("control_wait", { inputs: { DURATION: fromPrimitiveSource(seconds) } });
41
136
  };
137
+ /**
138
+ * Waits until condition becomes true.
139
+ *
140
+ * Input: `condition`.
141
+ * Output: Scratch statement block definition that is appended to the current script stack.
142
+ *
143
+ * @param condition PrimitiveSource<boolean>
144
+ * @returns Scratch statement block definition that is appended to the current script stack.
145
+ * @example
146
+ * ```ts
147
+ * import { waitUntil } from 'hikkaku/blocks'
148
+ *
149
+ * waitUntil(true)
150
+ * ```
151
+ */
42
152
  const waitUntil = (condition) => {
43
153
  return block("control_wait_until", { inputs: { CONDITION: fromPrimitiveSource(condition) } });
44
154
  };
155
+ /**
156
+ * Conditional execution.
157
+ *
158
+ * Input: `condition`, `handler`.
159
+ * Output: Scratch statement block definition that is appended to the current script stack.
160
+ *
161
+ * @param condition PrimitiveSource<boolean>
162
+ * @param handler () => void
163
+ * @returns Scratch statement block definition that is appended to the current script stack.
164
+ * @example
165
+ * ```ts
166
+ * import { ifThen } from 'hikkaku/blocks'
167
+ *
168
+ * ifThen(true, () => {})
169
+ * ```
170
+ */
45
171
  const ifThen = (condition, handler) => {
46
172
  const substackId = substack(handler);
47
173
  return block("control_if", { inputs: {
48
174
  CONDITION: fromPrimitiveSource(condition),
49
- ...substackId ? { SUBSTACK: [2, substackId] } : {}
175
+ ...substackId ? { SUBSTACK: [Shadow.NoShadow, substackId] } : {}
50
176
  } });
51
177
  };
178
+ /**
179
+ * If / else branching.
180
+ *
181
+ * Input: `condition`, `thenHandler`, `elseHandler`.
182
+ * Output: Scratch statement block definition that is appended to the current script stack.
183
+ *
184
+ * @param condition PrimitiveSource<boolean>
185
+ * @param thenHandler () => void
186
+ * @param elseHandler () => void
187
+ * @returns Scratch statement block definition that is appended to the current script stack.
188
+ * @example
189
+ * ```ts
190
+ * import { ifElse } from 'hikkaku/blocks'
191
+ *
192
+ * ifElse(true, () => {}, () => {})
193
+ * ```
194
+ */
52
195
  const ifElse = (condition, thenHandler, elseHandler) => {
53
196
  const thenSubstackId = substack(thenHandler);
54
197
  const elseSubstackId = substack(elseHandler);
55
198
  return block("control_if_else", { inputs: {
56
199
  CONDITION: fromPrimitiveSource(condition),
57
- ...thenSubstackId ? { SUBSTACK: [2, thenSubstackId] } : {},
58
- ...elseSubstackId ? { SUBSTACK2: [2, elseSubstackId] } : {}
200
+ ...thenSubstackId ? { SUBSTACK: [Shadow.NoShadow, thenSubstackId] } : {},
201
+ ...elseSubstackId ? { SUBSTACK2: [Shadow.NoShadow, elseSubstackId] } : {}
59
202
  } });
60
203
  };
204
+ /**
205
+ * Builds chained if / else-if / else branching from condition-handler pairs.
206
+ *
207
+ * Input: `branches`.
208
+ * Output: Scratch statement block definition that is appended to the current script stack.
209
+ *
210
+ * @param branches Input value used by this block.
211
+ * @returns Scratch statement block definition that is appended to the current script stack.
212
+ * @example
213
+ * ```ts
214
+ * import { match } from 'hikkaku/blocks'
215
+ *
216
+ * match(...[[true, () => {}]] as any)
217
+ * ```
218
+ */
219
+ const match = (...branches) => {
220
+ if (branches.length === 0) return;
221
+ const tail = branches[branches.length - 1];
222
+ const defaultHandler = typeof tail === "function" ? tail : null;
223
+ const branchList = defaultHandler ? branches.slice(0, -1) : branches;
224
+ if (branchList.length === 0) return defaultHandler?.();
225
+ let elseHandler = defaultHandler ?? (() => {});
226
+ for (let i = branchList.length - 1; i >= 0; i--) {
227
+ const branch = branchList[i];
228
+ if (!branch) continue;
229
+ const [condition, handler] = branch;
230
+ const next = elseHandler;
231
+ elseHandler = () => {
232
+ ifElse(condition, handler, next);
233
+ };
234
+ }
235
+ return elseHandler();
236
+ };
237
+ /**
238
+ * Stops scripts.
239
+ *
240
+ * Input: `option`.
241
+ * Output: Scratch statement block definition that is appended to the current script stack.
242
+ *
243
+ * @param option 'all' | 'this script' | 'other scripts in sprite' | 'other scripts in stage'
244
+ * @returns Scratch statement block definition that is appended to the current script stack.
245
+ * @example
246
+ * ```ts
247
+ * import { stop } from 'hikkaku/blocks'
248
+ *
249
+ * stop('all')
250
+ * ```
251
+ */
61
252
  const stop = (option) => {
62
253
  return block("control_stop", { fields: { STOP_OPTION: [option, null] } });
63
254
  };
255
+ /**
256
+ * Special menu value for cloning the current sprite.
257
+ *
258
+ * Input: none.
259
+ * Output: String constant used as the `target` argument of {@link createClone}.
260
+ *
261
+ * @example
262
+ * ```ts
263
+ * import { CREATE_CLONE_MYSELF, createClone } from 'hikkaku/blocks'
264
+ *
265
+ * createClone(CREATE_CLONE_MYSELF)
266
+ * ```
267
+ */
64
268
  const CREATE_CLONE_MYSELF = "_myself_";
269
+ /**
270
+ * Creates a clone of a target.
271
+ *
272
+ * Input: `target`.
273
+ * Output: Scratch statement block definition that is appended to the current script stack.
274
+ *
275
+ * @param target string
276
+ * @returns Scratch statement block definition that is appended to the current script stack.
277
+ * @example
278
+ * ```ts
279
+ * import { createClone } from 'hikkaku/blocks'
280
+ *
281
+ * createClone('mouse-pointer')
282
+ * ```
283
+ */
65
284
  const createClone = (target) => {
66
285
  return block("control_create_clone_of", { inputs: { CLONE_OPTION: fromPrimitiveSource(target) } });
67
286
  };
287
+ /**
288
+ * Deletes the current clone.
289
+ *
290
+ * Input: none.
291
+ * Output: Scratch statement block definition that is appended to the current script stack.
292
+ *
293
+ * @returns Scratch statement block definition that is appended to the current script stack.
294
+ * @example
295
+ * ```ts
296
+ * import { deleteThisClone } from 'hikkaku/blocks'
297
+ *
298
+ * deleteThisClone()
299
+ * ```
300
+ */
68
301
  const deleteThisClone = () => {
69
302
  return block("control_delete_this_clone", {});
70
303
  };
304
+ /**
305
+ * Returns the global counter value.
306
+ *
307
+ * Input: none.
308
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
309
+ *
310
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
311
+ * @example
312
+ * ```ts
313
+ * import { getCounter } from 'hikkaku/blocks'
314
+ *
315
+ * getCounter()
316
+ * ```
317
+ */
71
318
  const getCounter = () => {
72
319
  return valueBlock("control_get_counter", {});
73
320
  };
321
+ /**
322
+ * Increments the counter.
323
+ *
324
+ * Input: none.
325
+ * Output: Scratch statement block definition that is appended to the current script stack.
326
+ *
327
+ * @returns Scratch statement block definition that is appended to the current script stack.
328
+ * @example
329
+ * ```ts
330
+ * import { incrCounter } from 'hikkaku/blocks'
331
+ *
332
+ * incrCounter()
333
+ * ```
334
+ */
74
335
  const incrCounter = () => {
75
336
  return block("control_incr_counter", {});
76
337
  };
338
+ /**
339
+ * Resets the counter.
340
+ *
341
+ * Input: none.
342
+ * Output: Scratch statement block definition that is appended to the current script stack.
343
+ *
344
+ * @returns Scratch statement block definition that is appended to the current script stack.
345
+ * @example
346
+ * ```ts
347
+ * import { clearCounter } from 'hikkaku/blocks'
348
+ *
349
+ * clearCounter()
350
+ * ```
351
+ */
77
352
  const clearCounter = () => {
78
353
  return block("control_clear_counter", {});
79
354
  };
355
+ /**
356
+ * Starts the script when the clone is created. You should use this to control clone behavior.
357
+ *
358
+ * Input: `stack`.
359
+ * Output: Scratch statement block definition that is appended to the current script stack.
360
+ *
361
+ * @param stack Input value used by this block. Optional.
362
+ * @returns Scratch statement block definition that is appended to the current script stack.
363
+ * @example
364
+ * ```ts
365
+ * import { controlStartAsClone } from 'hikkaku/blocks'
366
+ *
367
+ * controlStartAsClone(() => {})
368
+ * ```
369
+ */
80
370
  const controlStartAsClone = (stack) => {
81
371
  const res = block("control_start_as_clone", { topLevel: true });
82
- stack?.();
372
+ attachStack(res.id, stack);
83
373
  return res;
84
374
  };
375
+ /**
376
+ * Executes enclosed blocks without screen refresh.
377
+ *
378
+ * Input: `handler`.
379
+ * Output: Scratch statement block definition that is appended to the current script stack.
380
+ *
381
+ * @param handler () => void
382
+ * @returns Scratch statement block definition that is appended to the current script stack.
383
+ * @example
384
+ * ```ts
385
+ * import { allAtOnce } from 'hikkaku/blocks'
386
+ *
387
+ * allAtOnce(() => {})
388
+ * ```
389
+ */
85
390
  const allAtOnce = (handler) => {
86
391
  const substackId = substack(handler);
87
- return block("control_all_at_once", { inputs: substackId ? { SUBSTACK: [2, substackId] } : {} });
392
+ return block("control_all_at_once", { inputs: substackId ? { SUBSTACK: [Shadow.NoShadow, substackId] } : {} });
88
393
  };
89
394
 
90
395
  //#endregion
91
396
  //#region src/blocks/data.ts
92
397
  const toField = (field) => [field.name, field.id];
398
+ /**
399
+ * Returns the value of a variable.
400
+ *
401
+ * Input: `variable`.
402
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
403
+ *
404
+ * @param variable VariableReference
405
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
406
+ * @example
407
+ * ```ts
408
+ * import { getVariable } from 'hikkaku/blocks'
409
+ *
410
+ * getVariable(variable as any)
411
+ * ```
412
+ */
93
413
  const getVariable = (variable) => {
94
414
  return valueBlock("data_variable", { fields: { VARIABLE: toField(variable) } });
95
415
  };
416
+ /**
417
+ * Sets a variable.
418
+ *
419
+ * Input: `variable`, `value`.
420
+ * Output: Scratch statement block definition that is appended to the current script stack.
421
+ *
422
+ * @param variable VariableReference
423
+ * @param value PrimitiveSource<number | string>
424
+ * @returns Scratch statement block definition that is appended to the current script stack.
425
+ * @example
426
+ * ```ts
427
+ * import { setVariableTo } from 'hikkaku/blocks'
428
+ *
429
+ * setVariableTo(variable as any, 10)
430
+ * ```
431
+ */
96
432
  const setVariableTo = (variable, value) => {
97
433
  return block("data_setvariableto", {
98
434
  inputs: { VALUE: fromPrimitiveSource(value) },
99
435
  fields: { VARIABLE: toField(variable) }
100
436
  });
101
437
  };
438
+ /**
439
+ * Changes a variable by an amount.
440
+ *
441
+ * Input: `variable`, `value`.
442
+ * Output: Scratch statement block definition that is appended to the current script stack.
443
+ *
444
+ * @param variable VariableReference
445
+ * @param value PrimitiveSource<number>
446
+ * @returns Scratch statement block definition that is appended to the current script stack.
447
+ * @example
448
+ * ```ts
449
+ * import { changeVariableBy } from 'hikkaku/blocks'
450
+ *
451
+ * changeVariableBy(variable as any, 10)
452
+ * ```
453
+ */
102
454
  const changeVariableBy = (variable, value) => {
103
455
  return block("data_changevariableby", {
104
456
  inputs: { VALUE: fromPrimitiveSource(value) },
105
457
  fields: { VARIABLE: toField(variable) }
106
458
  });
107
459
  };
460
+ /**
461
+ * Shows variable monitor.
462
+ *
463
+ * Input: `variable`.
464
+ * Output: Scratch statement block definition that is appended to the current script stack.
465
+ *
466
+ * @param variable See function signature for accepted input values.
467
+ * @returns Scratch statement block definition that is appended to the current script stack.
468
+ * @example
469
+ * ```ts
470
+ * import { showVariable } from 'hikkaku/blocks'
471
+ *
472
+ * showVariable(variable as any)
473
+ * ```
474
+ */
108
475
  const showVariable = (variable) => {
109
476
  return block("data_showvariable", { fields: { VARIABLE: toField(variable) } });
110
477
  };
478
+ /**
479
+ * Hides variable monitor.
480
+ *
481
+ * Input: `variable`.
482
+ * Output: Scratch statement block definition that is appended to the current script stack.
483
+ *
484
+ * @param variable See function signature for accepted input values.
485
+ * @returns Scratch statement block definition that is appended to the current script stack.
486
+ * @example
487
+ * ```ts
488
+ * import { hideVariable } from 'hikkaku/blocks'
489
+ *
490
+ * hideVariable(variable as any)
491
+ * ```
492
+ */
111
493
  const hideVariable = (variable) => {
112
494
  return block("data_hidevariable", { fields: { VARIABLE: toField(variable) } });
113
495
  };
496
+ /**
497
+ * Returns list contents as text.
498
+ *
499
+ * Input: `list`.
500
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
501
+ *
502
+ * @param list ListReference
503
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
504
+ * @example
505
+ * ```ts
506
+ * import { getListContents } from 'hikkaku/blocks'
507
+ *
508
+ * getListContents(list as any)
509
+ * ```
510
+ */
114
511
  const getListContents = (list) => {
115
512
  return valueBlock("data_listcontents", { fields: { LIST: toField(list) } });
116
513
  };
514
+ /**
515
+ * Appends an item.
516
+ *
517
+ * Input: `list`, `item`.
518
+ * Output: Scratch statement block definition that is appended to the current script stack.
519
+ *
520
+ * @param list ListReference
521
+ * @param item PrimitiveSource<string | number>
522
+ * @returns Scratch statement block definition that is appended to the current script stack.
523
+ * @example
524
+ * ```ts
525
+ * import { addToList } from 'hikkaku/blocks'
526
+ *
527
+ * addToList(list as any, undefined as any)
528
+ * ```
529
+ */
117
530
  const addToList = (list, item) => {
118
531
  return block("data_addtolist", {
119
532
  inputs: { ITEM: fromPrimitiveSource(item) },
120
533
  fields: { LIST: toField(list) }
121
534
  });
122
535
  };
536
+ /**
537
+ * Deletes an item.
538
+ *
539
+ * Input: `list`, `index`.
540
+ * Output: Scratch statement block definition that is appended to the current script stack.
541
+ *
542
+ * @param list Input value used by this block.
543
+ * @param index PrimitiveSource<number | string>
544
+ * @returns Scratch statement block definition that is appended to the current script stack.
545
+ * @example
546
+ * ```ts
547
+ * import { deleteOfList } from 'hikkaku/blocks'
548
+ *
549
+ * deleteOfList(list as any, undefined as any)
550
+ * ```
551
+ */
123
552
  const deleteOfList = (list, index) => {
124
553
  return block("data_deleteoflist", {
125
554
  inputs: { INDEX: fromPrimitiveSource(index) },
126
555
  fields: { LIST: toField(list) }
127
556
  });
128
557
  };
558
+ /**
559
+ * Clears list.
560
+ *
561
+ * Input: `list`.
562
+ * Output: Scratch statement block definition that is appended to the current script stack.
563
+ *
564
+ * @param list See function signature for accepted input values.
565
+ * @returns Scratch statement block definition that is appended to the current script stack.
566
+ * @example
567
+ * ```ts
568
+ * import { deleteAllOfList } from 'hikkaku/blocks'
569
+ *
570
+ * deleteAllOfList(list as any)
571
+ * ```
572
+ */
129
573
  const deleteAllOfList = (list) => {
130
574
  return block("data_deletealloflist", { fields: { LIST: toField(list) } });
131
575
  };
576
+ /**
577
+ * Inserts item at index.
578
+ *
579
+ * Input: `list`, `index`, `item`.
580
+ * Output: Scratch statement block definition that is appended to the current script stack.
581
+ *
582
+ * @param list See function signature for accepted input values.
583
+ * @param index See function signature for accepted input values.
584
+ * @param item See function signature for accepted input values.
585
+ * @returns Scratch statement block definition that is appended to the current script stack.
586
+ * @example
587
+ * ```ts
588
+ * import { insertAtList } from 'hikkaku/blocks'
589
+ *
590
+ * insertAtList(list as any, undefined as any, undefined as any)
591
+ * ```
592
+ */
132
593
  const insertAtList = (list, index, item) => {
133
594
  return block("data_insertatlist", {
134
595
  inputs: {
@@ -138,6 +599,23 @@ const insertAtList = (list, index, item) => {
138
599
  fields: { LIST: toField(list) }
139
600
  });
140
601
  };
602
+ /**
603
+ * Replaces item at index.
604
+ *
605
+ * Input: `list`, `index`, `item`.
606
+ * Output: Scratch statement block definition that is appended to the current script stack.
607
+ *
608
+ * @param list See function signature for accepted input values.
609
+ * @param index See function signature for accepted input values.
610
+ * @param item See function signature for accepted input values.
611
+ * @returns Scratch statement block definition that is appended to the current script stack.
612
+ * @example
613
+ * ```ts
614
+ * import { replaceItemOfList } from 'hikkaku/blocks'
615
+ *
616
+ * replaceItemOfList(list as any, undefined as any, undefined as any)
617
+ * ```
618
+ */
141
619
  const replaceItemOfList = (list, index, item) => {
142
620
  return block("data_replaceitemoflist", {
143
621
  inputs: {
@@ -147,218 +625,968 @@ const replaceItemOfList = (list, index, item) => {
147
625
  fields: { LIST: toField(list) }
148
626
  });
149
627
  };
628
+ /**
629
+ * Returns list item.
630
+ *
631
+ * Input: `list`, `index`.
632
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
633
+ *
634
+ * @param list See function signature for accepted input values.
635
+ * @param index See function signature for accepted input values.
636
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
637
+ * @example
638
+ * ```ts
639
+ * import { getItemOfList } from 'hikkaku/blocks'
640
+ *
641
+ * getItemOfList(list as any, undefined as any)
642
+ * ```
643
+ */
150
644
  const getItemOfList = (list, index) => {
151
645
  return valueBlock("data_itemoflist", {
152
646
  inputs: { INDEX: fromPrimitiveSource(index) },
153
647
  fields: { LIST: toField(list) }
154
648
  });
155
649
  };
650
+ /**
651
+ * Returns index of item.
652
+ *
653
+ * Input: `list`, `item`.
654
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
655
+ *
656
+ * @param list See function signature for accepted input values.
657
+ * @param item See function signature for accepted input values.
658
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
659
+ * @example
660
+ * ```ts
661
+ * import { getItemNumOfList } from 'hikkaku/blocks'
662
+ *
663
+ * getItemNumOfList(list as any, undefined as any)
664
+ * ```
665
+ */
156
666
  const getItemNumOfList = (list, item) => {
157
667
  return valueBlock("data_itemnumoflist", {
158
668
  inputs: { ITEM: fromPrimitiveSource(item) },
159
669
  fields: { LIST: toField(list) }
160
670
  });
161
671
  };
672
+ /**
673
+ * Returns list length.
674
+ *
675
+ * Input: `list`.
676
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
677
+ *
678
+ * @param list See function signature for accepted input values.
679
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
680
+ * @example
681
+ * ```ts
682
+ * import { lengthOfList } from 'hikkaku/blocks'
683
+ *
684
+ * lengthOfList(list as any)
685
+ * ```
686
+ */
162
687
  const lengthOfList = (list) => {
163
688
  return valueBlock("data_lengthoflist", { fields: { LIST: toField(list) } });
164
689
  };
690
+ /**
691
+ * Checks membership.
692
+ *
693
+ * Input: `list`, `item`.
694
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
695
+ *
696
+ * @param list See function signature for accepted input values.
697
+ * @param item See function signature for accepted input values.
698
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
699
+ * @example
700
+ * ```ts
701
+ * import { listContainsItem } from 'hikkaku/blocks'
702
+ *
703
+ * listContainsItem(list as any, undefined as any)
704
+ * ```
705
+ */
165
706
  const listContainsItem = (list, item) => {
166
707
  return valueBlock("data_listcontainsitem", {
167
708
  inputs: { ITEM: fromPrimitiveSource(item) },
168
709
  fields: { LIST: toField(list) }
169
710
  });
170
711
  };
712
+ /**
713
+ * Shows list monitor.
714
+ *
715
+ * Input: `list`.
716
+ * Output: Scratch statement block definition that is appended to the current script stack.
717
+ *
718
+ * @param list See function signature for accepted input values.
719
+ * @returns Scratch statement block definition that is appended to the current script stack.
720
+ * @example
721
+ * ```ts
722
+ * import { showList } from 'hikkaku/blocks'
723
+ *
724
+ * showList(list as any)
725
+ * ```
726
+ */
171
727
  const showList = (list) => {
172
728
  return block("data_showlist", { fields: { LIST: toField(list) } });
173
729
  };
730
+ /**
731
+ * Hides list monitor.
732
+ *
733
+ * Input: `list`.
734
+ * Output: Scratch statement block definition that is appended to the current script stack.
735
+ *
736
+ * @param list See function signature for accepted input values.
737
+ * @returns Scratch statement block definition that is appended to the current script stack.
738
+ * @example
739
+ * ```ts
740
+ * import { hideList } from 'hikkaku/blocks'
741
+ *
742
+ * hideList(list as any)
743
+ * ```
744
+ */
174
745
  const hideList = (list) => {
175
746
  return block("data_hidelist", { fields: { LIST: toField(list) } });
176
747
  };
177
748
 
178
749
  //#endregion
179
750
  //#region src/blocks/events.ts
751
+ /**
752
+ * Runs when green flag is clicked.
753
+ *
754
+ * Input: `stack`.
755
+ * Output: Scratch statement block definition that is appended to the current script stack.
756
+ *
757
+ * @param stack () => void Optional.
758
+ * @returns Scratch statement block definition that is appended to the current script stack.
759
+ * @example
760
+ * ```ts
761
+ * import { whenFlagClicked } from 'hikkaku/blocks'
762
+ *
763
+ * whenFlagClicked(() => {})
764
+ * ```
765
+ */
180
766
  const whenFlagClicked = (stack) => {
181
767
  const res = block("event_whenflagclicked", { topLevel: true });
182
- stack?.();
768
+ attachStack(res.id, stack);
183
769
  return res;
184
770
  };
771
+ /**
772
+ * Runs when key is pressed.
773
+ *
774
+ * Input: `key`, `stack`.
775
+ * Output: Scratch statement block definition that is appended to the current script stack.
776
+ *
777
+ * @param key string
778
+ * @param stack Input value used by this block. Optional.
779
+ * @returns Scratch statement block definition that is appended to the current script stack.
780
+ * @example
781
+ * ```ts
782
+ * import { whenKeyPressed } from 'hikkaku/blocks'
783
+ *
784
+ * whenKeyPressed('space', () => {})
785
+ * ```
786
+ */
185
787
  const whenKeyPressed = (key, stack) => {
186
788
  const res = block("event_whenkeypressed", {
187
789
  topLevel: true,
188
790
  fields: { KEY_OPTION: [key, null] }
189
791
  });
190
- stack?.();
792
+ attachStack(res.id, stack);
191
793
  return res;
192
794
  };
795
+ /**
796
+ * Runs when sprite is clicked.
797
+ *
798
+ * Input: `stack`.
799
+ * Output: Scratch statement block definition that is appended to the current script stack.
800
+ *
801
+ * @param stack See function signature for accepted input values. Optional.
802
+ * @returns Scratch statement block definition that is appended to the current script stack.
803
+ * @example
804
+ * ```ts
805
+ * import { whenThisSpriteClicked } from 'hikkaku/blocks'
806
+ *
807
+ * whenThisSpriteClicked(() => {})
808
+ * ```
809
+ */
193
810
  const whenThisSpriteClicked = (stack) => {
194
811
  const res = block("event_whenthisspriteclicked", { topLevel: true });
195
- stack?.();
812
+ attachStack(res.id, stack);
196
813
  return res;
197
814
  };
815
+ /**
816
+ * Runs when stage is clicked.
817
+ *
818
+ * Input: `stack`.
819
+ * Output: Scratch statement block definition that is appended to the current script stack.
820
+ *
821
+ * @param stack See function signature for accepted input values. Optional.
822
+ * @returns Scratch statement block definition that is appended to the current script stack.
823
+ * @example
824
+ * ```ts
825
+ * import { whenStageClicked } from 'hikkaku/blocks'
826
+ *
827
+ * whenStageClicked(() => {})
828
+ * ```
829
+ */
198
830
  const whenStageClicked = (stack) => {
199
831
  const res = block("event_whenstageclicked", { topLevel: true });
200
- stack?.();
832
+ attachStack(res.id, stack);
201
833
  return res;
202
834
  };
835
+ /**
836
+ * Runs when backdrop changes.
837
+ *
838
+ * Input: `backdrop`, `stack`.
839
+ * Output: Scratch statement block definition that is appended to the current script stack.
840
+ *
841
+ * @param backdrop See function signature for accepted input values.
842
+ * @param stack See function signature for accepted input values. Optional.
843
+ * @returns Scratch statement block definition that is appended to the current script stack.
844
+ * @example
845
+ * ```ts
846
+ * import { whenBackdropSwitchesTo } from 'hikkaku/blocks'
847
+ *
848
+ * whenBackdropSwitchesTo('backdrop1', () => {})
849
+ * ```
850
+ */
203
851
  const whenBackdropSwitchesTo = (backdrop, stack) => {
204
852
  const res = block("event_whenbackdropswitchesto", {
205
853
  topLevel: true,
206
854
  fields: { BACKDROP: [backdrop, null] }
207
855
  });
208
- stack?.();
856
+ attachStack(res.id, stack);
209
857
  return res;
210
858
  };
859
+ /**
860
+ * Runs when a broadcast is received.
861
+ *
862
+ * Input: `broadcast`, `stack`.
863
+ * Output: Scratch statement block definition that is appended to the current script stack.
864
+ *
865
+ * @param broadcast See function signature for accepted input values.
866
+ * @param stack See function signature for accepted input values. Optional.
867
+ * @returns Scratch statement block definition that is appended to the current script stack.
868
+ * @example
869
+ * ```ts
870
+ * import { whenBroadcastReceived } from 'hikkaku/blocks'
871
+ *
872
+ * whenBroadcastReceived('message1', () => {})
873
+ * ```
874
+ */
211
875
  const whenBroadcastReceived = (broadcast, stack) => {
212
876
  const res = block("event_whenbroadcastreceived", {
213
877
  topLevel: true,
214
878
  fields: { BROADCAST_OPTION: [broadcast, null] }
215
879
  });
216
- stack?.();
880
+ attachStack(res.id, stack);
217
881
  return res;
218
882
  };
883
+ /**
884
+ * Runs when touching object.
885
+ *
886
+ * Input: `target`, `stack`.
887
+ * Output: Scratch statement block definition that is appended to the current script stack.
888
+ *
889
+ * @param target See function signature for accepted input values.
890
+ * @param stack See function signature for accepted input values. Optional.
891
+ * @returns Scratch statement block definition that is appended to the current script stack.
892
+ * @example
893
+ * ```ts
894
+ * import { whenTouchingObject } from 'hikkaku/blocks'
895
+ *
896
+ * whenTouchingObject('mouse-pointer', () => {})
897
+ * ```
898
+ */
219
899
  const whenTouchingObject = (target, stack) => {
220
900
  const res = block("event_whentouchingobject", {
221
901
  topLevel: true,
222
902
  fields: { TOUCHINGOBJECTMENU: [target, null] }
223
903
  });
224
- stack?.();
904
+ attachStack(res.id, stack);
225
905
  return res;
226
906
  };
907
+ /**
908
+ * Triggered by sensor threshold.
909
+ *
910
+ * Input: `menu`, `value`, `stack`.
911
+ * Output: Scratch statement block definition that is appended to the current script stack.
912
+ *
913
+ * @param menu See function signature for accepted input values.
914
+ * @param value See function signature for accepted input values.
915
+ * @param stack See function signature for accepted input values. Optional.
916
+ * @returns Scratch statement block definition that is appended to the current script stack.
917
+ * @example
918
+ * ```ts
919
+ * import { whenGreaterThan } from 'hikkaku/blocks'
920
+ *
921
+ * whenGreaterThan('loudness', 10, () => {})
922
+ * ```
923
+ */
227
924
  const whenGreaterThan = (menu, value, stack) => {
228
925
  const res = block("event_whengreaterthan", {
229
926
  topLevel: true,
230
927
  inputs: { VALUE: fromPrimitiveSource(value) },
231
928
  fields: { WHENGREATERTHANMENU: [menu, null] }
232
929
  });
233
- stack?.();
930
+ attachStack(res.id, stack);
234
931
  return res;
235
932
  };
933
+ /**
934
+ * Sends a broadcast.
935
+ *
936
+ * Input: `message`.
937
+ * Output: Scratch statement block definition that is appended to the current script stack.
938
+ *
939
+ * @param message See function signature for accepted input values.
940
+ * @returns Scratch statement block definition that is appended to the current script stack.
941
+ * @example
942
+ * ```ts
943
+ * import { broadcast } from 'hikkaku/blocks'
944
+ *
945
+ * broadcast('Hello')
946
+ * ```
947
+ */
236
948
  const broadcast = (message) => {
237
- return block("event_broadcast", { inputs: { BROADCAST_INPUT: typeof message === "string" ? [1, [11, message]] : fromPrimitiveSource(message) } });
238
- };
949
+ return block("event_broadcast", { inputs: { BROADCAST_INPUT: typeof message === "string" ? [Shadow.SameBlockShadow, [
950
+ InputType.Broadcast,
951
+ message,
952
+ message
953
+ ]] : fromPrimitiveSource(message) } });
954
+ };
955
+ /**
956
+ * Broadcasts and waits.
957
+ *
958
+ * Input: `message`.
959
+ * Output: Scratch statement block definition that is appended to the current script stack.
960
+ *
961
+ * @param message See function signature for accepted input values.
962
+ * @returns Scratch statement block definition that is appended to the current script stack.
963
+ * @example
964
+ * ```ts
965
+ * import { broadcastAndWait } from 'hikkaku/blocks'
966
+ *
967
+ * broadcastAndWait('Hello')
968
+ * ```
969
+ */
239
970
  const broadcastAndWait = (message) => {
240
971
  return block("event_broadcastandwait", { inputs: { BROADCAST_INPUT: fromPrimitiveSource(message) } });
241
972
  };
242
973
 
243
974
  //#endregion
244
975
  //#region src/blocks/looks.ts
976
+ /**
977
+ * Displays a speech bubble.
978
+ *
979
+ * Input: `message`.
980
+ * Output: Scratch statement block definition that is appended to the current script stack.
981
+ *
982
+ * @param message See function signature for accepted input values.
983
+ * @returns Scratch statement block definition that is appended to the current script stack.
984
+ * @example
985
+ * ```ts
986
+ * import { say } from 'hikkaku/blocks'
987
+ *
988
+ * say('Hello')
989
+ * ```
990
+ */
245
991
  const say = (message) => {
246
992
  return block("looks_say", { inputs: { MESSAGE: fromPrimitiveSource(message) } });
247
993
  };
994
+ /**
995
+ * Speaks for duration.
996
+ *
997
+ * Input: `message`, `seconds`.
998
+ * Output: Scratch statement block definition that is appended to the current script stack.
999
+ *
1000
+ * @param message See function signature for accepted input values.
1001
+ * @param seconds See function signature for accepted input values.
1002
+ * @returns Scratch statement block definition that is appended to the current script stack.
1003
+ * @example
1004
+ * ```ts
1005
+ * import { sayForSecs } from 'hikkaku/blocks'
1006
+ *
1007
+ * sayForSecs('Hello', 10)
1008
+ * ```
1009
+ */
248
1010
  const sayForSecs = (message, seconds) => {
249
1011
  return block("looks_sayforsecs", { inputs: {
250
1012
  MESSAGE: fromPrimitiveSource(message),
251
1013
  SECS: fromPrimitiveSource(seconds)
252
1014
  } });
253
1015
  };
1016
+ /**
1017
+ * Displays thought bubble.
1018
+ *
1019
+ * Input: `message`.
1020
+ * Output: Scratch statement block definition that is appended to the current script stack.
1021
+ *
1022
+ * @param message See function signature for accepted input values.
1023
+ * @returns Scratch statement block definition that is appended to the current script stack.
1024
+ * @example
1025
+ * ```ts
1026
+ * import { think } from 'hikkaku/blocks'
1027
+ *
1028
+ * think('Hello')
1029
+ * ```
1030
+ */
254
1031
  const think = (message) => {
255
1032
  return block("looks_think", { inputs: { MESSAGE: fromPrimitiveSource(message) } });
256
1033
  };
1034
+ /**
1035
+ * Thinks for duration.
1036
+ *
1037
+ * Input: `message`, `seconds`.
1038
+ * Output: Scratch statement block definition that is appended to the current script stack.
1039
+ *
1040
+ * @param message See function signature for accepted input values.
1041
+ * @param seconds See function signature for accepted input values.
1042
+ * @returns Scratch statement block definition that is appended to the current script stack.
1043
+ * @example
1044
+ * ```ts
1045
+ * import { thinkForSecs } from 'hikkaku/blocks'
1046
+ *
1047
+ * thinkForSecs('Hello', 10)
1048
+ * ```
1049
+ */
257
1050
  const thinkForSecs = (message, seconds) => {
258
1051
  return block("looks_thinkforsecs", { inputs: {
259
1052
  MESSAGE: fromPrimitiveSource(message),
260
1053
  SECS: fromPrimitiveSource(seconds)
261
1054
  } });
262
1055
  };
1056
+ /**
1057
+ * Shows sprite.
1058
+ *
1059
+ * Input: none.
1060
+ * Output: Scratch statement block definition that is appended to the current script stack.
1061
+ *
1062
+ * @returns Scratch statement block definition that is appended to the current script stack.
1063
+ * @example
1064
+ * ```ts
1065
+ * import { show } from 'hikkaku/blocks'
1066
+ *
1067
+ * show()
1068
+ * ```
1069
+ */
263
1070
  const show = () => {
264
1071
  return block("looks_show", {});
265
1072
  };
1073
+ /**
1074
+ * Hides sprite.
1075
+ *
1076
+ * Input: none.
1077
+ * Output: Scratch statement block definition that is appended to the current script stack.
1078
+ *
1079
+ * @returns Scratch statement block definition that is appended to the current script stack.
1080
+ * @example
1081
+ * ```ts
1082
+ * import { hide } from 'hikkaku/blocks'
1083
+ *
1084
+ * hide()
1085
+ * ```
1086
+ */
266
1087
  const hide = () => {
267
1088
  return block("looks_hide", {});
268
1089
  };
1090
+ /**
1091
+ * Switches costume.
1092
+ *
1093
+ * Input: `costume`.
1094
+ * Output: Scratch statement block definition that is appended to the current script stack.
1095
+ *
1096
+ * @param costume See function signature for accepted input values.
1097
+ * @returns Scratch statement block definition that is appended to the current script stack.
1098
+ * @example
1099
+ * ```ts
1100
+ * import { switchCostumeTo } from 'hikkaku/blocks'
1101
+ *
1102
+ * switchCostumeTo('costume1')
1103
+ * ```
1104
+ */
269
1105
  const switchCostumeTo = (costume) => {
270
1106
  return block("looks_switchcostumeto", { inputs: { COSTUME: fromCostumeSource(costume) } });
271
1107
  };
1108
+ /**
1109
+ * Next costume.
1110
+ *
1111
+ * Input: none.
1112
+ * Output: Scratch statement block definition that is appended to the current script stack.
1113
+ *
1114
+ * @returns Scratch statement block definition that is appended to the current script stack.
1115
+ * @example
1116
+ * ```ts
1117
+ * import { nextCostume } from 'hikkaku/blocks'
1118
+ *
1119
+ * nextCostume()
1120
+ * ```
1121
+ */
272
1122
  const nextCostume = () => {
273
1123
  return block("looks_nextcostume", {});
274
1124
  };
1125
+ /**
1126
+ * Switch backdrop.
1127
+ *
1128
+ * Input: `backdrop`.
1129
+ * Output: Scratch statement block definition that is appended to the current script stack.
1130
+ *
1131
+ * @param backdrop See function signature for accepted input values.
1132
+ * @returns Scratch statement block definition that is appended to the current script stack.
1133
+ * @example
1134
+ * ```ts
1135
+ * import { switchBackdropTo } from 'hikkaku/blocks'
1136
+ *
1137
+ * switchBackdropTo('backdrop1')
1138
+ * ```
1139
+ */
275
1140
  const switchBackdropTo = (backdrop) => {
276
1141
  return block("looks_switchbackdropto", { inputs: { BACKDROP: fromPrimitiveSource(backdrop) } });
277
1142
  };
1143
+ /**
1144
+ * Switch backdrop and wait.
1145
+ *
1146
+ * Input: `backdrop`.
1147
+ * Output: Scratch statement block definition that is appended to the current script stack.
1148
+ *
1149
+ * @param backdrop See function signature for accepted input values.
1150
+ * @returns Scratch statement block definition that is appended to the current script stack.
1151
+ * @example
1152
+ * ```ts
1153
+ * import { switchBackdropToAndWait } from 'hikkaku/blocks'
1154
+ *
1155
+ * switchBackdropToAndWait('backdrop1')
1156
+ * ```
1157
+ */
278
1158
  const switchBackdropToAndWait = (backdrop) => {
279
1159
  return block("looks_switchbackdroptoandwait", { inputs: { BACKDROP: fromPrimitiveSource(backdrop) } });
280
1160
  };
1161
+ /**
1162
+ * Next backdrop.
1163
+ *
1164
+ * Input: none.
1165
+ * Output: Scratch statement block definition that is appended to the current script stack.
1166
+ *
1167
+ * @returns Scratch statement block definition that is appended to the current script stack.
1168
+ * @example
1169
+ * ```ts
1170
+ * import { nextBackdrop } from 'hikkaku/blocks'
1171
+ *
1172
+ * nextBackdrop()
1173
+ * ```
1174
+ */
281
1175
  const nextBackdrop = () => {
282
1176
  return block("looks_nextbackdrop", {});
283
1177
  };
1178
+ /**
1179
+ * Changes graphic effect.
1180
+ *
1181
+ * Input: `effect`, `value`.
1182
+ * Output: Scratch statement block definition that is appended to the current script stack.
1183
+ *
1184
+ * @param effect See function signature for accepted input values.
1185
+ * @param value See function signature for accepted input values.
1186
+ * @returns Scratch statement block definition that is appended to the current script stack.
1187
+ * @example
1188
+ * ```ts
1189
+ * import { changeLooksEffectBy } from 'hikkaku/blocks'
1190
+ *
1191
+ * changeLooksEffectBy('color', 10)
1192
+ * ```
1193
+ */
284
1194
  const changeLooksEffectBy = (effect, value) => {
285
1195
  return block("looks_changeeffectby", {
286
1196
  inputs: { CHANGE: fromPrimitiveSource(value) },
287
1197
  fields: { EFFECT: [effect, null] }
288
1198
  });
289
1199
  };
1200
+ /**
1201
+ * Sets graphic effect.
1202
+ *
1203
+ * Input: `effect`, `value`.
1204
+ * Output: Scratch statement block definition that is appended to the current script stack.
1205
+ *
1206
+ * @param effect See function signature for accepted input values.
1207
+ * @param value See function signature for accepted input values.
1208
+ * @returns Scratch statement block definition that is appended to the current script stack.
1209
+ * @example
1210
+ * ```ts
1211
+ * import { setLooksEffectTo } from 'hikkaku/blocks'
1212
+ *
1213
+ * setLooksEffectTo('color', 10)
1214
+ * ```
1215
+ */
290
1216
  const setLooksEffectTo = (effect, value) => {
291
1217
  return block("looks_seteffectto", {
292
1218
  inputs: { VALUE: fromPrimitiveSource(value) },
293
1219
  fields: { EFFECT: [effect, null] }
294
1220
  });
295
1221
  };
1222
+ /**
1223
+ * Clears effects.
1224
+ *
1225
+ * Input: none.
1226
+ * Output: Scratch statement block definition that is appended to the current script stack.
1227
+ *
1228
+ * @returns Scratch statement block definition that is appended to the current script stack.
1229
+ * @example
1230
+ * ```ts
1231
+ * import { clearGraphicEffects } from 'hikkaku/blocks'
1232
+ *
1233
+ * clearGraphicEffects()
1234
+ * ```
1235
+ */
296
1236
  const clearGraphicEffects = () => {
297
1237
  return block("looks_cleargraphiceffects", {});
298
1238
  };
1239
+ /**
1240
+ * Changes size.
1241
+ *
1242
+ * Input: `value`.
1243
+ * Output: Scratch statement block definition that is appended to the current script stack.
1244
+ *
1245
+ * @param value See function signature for accepted input values.
1246
+ * @returns Scratch statement block definition that is appended to the current script stack.
1247
+ * @example
1248
+ * ```ts
1249
+ * import { changeSizeBy } from 'hikkaku/blocks'
1250
+ *
1251
+ * changeSizeBy(10)
1252
+ * ```
1253
+ */
299
1254
  const changeSizeBy = (value) => {
300
1255
  return block("looks_changesizeby", { inputs: { CHANGE: fromPrimitiveSource(value) } });
301
1256
  };
1257
+ /**
1258
+ * Sets size.
1259
+ *
1260
+ * Input: `value`.
1261
+ * Output: Scratch statement block definition that is appended to the current script stack.
1262
+ *
1263
+ * @param value See function signature for accepted input values.
1264
+ * @returns Scratch statement block definition that is appended to the current script stack.
1265
+ * @example
1266
+ * ```ts
1267
+ * import { setSizeTo } from 'hikkaku/blocks'
1268
+ *
1269
+ * setSizeTo(10)
1270
+ * ```
1271
+ */
302
1272
  const setSizeTo = (value) => {
303
1273
  return block("looks_setsizeto", { inputs: { SIZE: fromPrimitiveSource(value) } });
304
1274
  };
1275
+ /**
1276
+ * Moves sprite layer.
1277
+ *
1278
+ * Input: `position`.
1279
+ * Output: Scratch statement block definition that is appended to the current script stack.
1280
+ *
1281
+ * @param position See function signature for accepted input values.
1282
+ * @returns Scratch statement block definition that is appended to the current script stack.
1283
+ * @example
1284
+ * ```ts
1285
+ * import { goToFrontBack } from 'hikkaku/blocks'
1286
+ *
1287
+ * goToFrontBack('front')
1288
+ * ```
1289
+ */
305
1290
  const goToFrontBack = (position) => {
306
1291
  return block("looks_gotofrontback", { fields: { FRONT_BACK: [position, null] } });
307
1292
  };
1293
+ /**
1294
+ * Moves layers.
1295
+ *
1296
+ * Input: `direction`, `layers`.
1297
+ * Output: Scratch statement block definition that is appended to the current script stack.
1298
+ *
1299
+ * @param direction See function signature for accepted input values.
1300
+ * @param layers See function signature for accepted input values.
1301
+ * @returns Scratch statement block definition that is appended to the current script stack.
1302
+ * @example
1303
+ * ```ts
1304
+ * import { goForwardBackwardLayers } from 'hikkaku/blocks'
1305
+ *
1306
+ * goForwardBackwardLayers('forward', 10)
1307
+ * ```
1308
+ */
308
1309
  const goForwardBackwardLayers = (direction, layers) => {
309
1310
  return block("looks_goforwardbackwardlayers", {
310
1311
  inputs: { NUM: fromPrimitiveSource(layers) },
311
1312
  fields: { FORWARD_BACKWARD: [direction, null] }
312
1313
  });
313
1314
  };
1315
+ /**
1316
+ * Returns size.
1317
+ *
1318
+ * Input: none.
1319
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
1320
+ *
1321
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
1322
+ * @example
1323
+ * ```ts
1324
+ * import { getSize } from 'hikkaku/blocks'
1325
+ *
1326
+ * getSize()
1327
+ * ```
1328
+ */
314
1329
  const getSize = () => {
315
1330
  return valueBlock("looks_size", {});
316
1331
  };
1332
+ /**
1333
+ * Returns costume number or name.
1334
+ *
1335
+ * Input: `value`.
1336
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
1337
+ *
1338
+ * @param value See function signature for accepted input values.
1339
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
1340
+ * @example
1341
+ * ```ts
1342
+ * import { getCostumeNumberName } from 'hikkaku/blocks'
1343
+ *
1344
+ * getCostumeNumberName(10)
1345
+ * ```
1346
+ */
317
1347
  const getCostumeNumberName = (value) => {
318
1348
  return valueBlock("looks_costumenumbername", { fields: { NUMBER_NAME: [value, null] } });
319
1349
  };
1350
+ /**
1351
+ * Returns backdrop number or name.
1352
+ *
1353
+ * Input: `value`.
1354
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
1355
+ *
1356
+ * @param value See function signature for accepted input values.
1357
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
1358
+ * @example
1359
+ * ```ts
1360
+ * import { getBackdropNumberName } from 'hikkaku/blocks'
1361
+ *
1362
+ * getBackdropNumberName(10)
1363
+ * ```
1364
+ */
320
1365
  const getBackdropNumberName = (value) => {
321
1366
  return valueBlock("looks_backdropnumbername", { fields: { NUMBER_NAME: [value, null] } });
322
1367
  };
323
1368
 
324
1369
  //#endregion
325
1370
  //#region src/blocks/motion.ts
1371
+ /**
1372
+ * Moves sprite.
1373
+ *
1374
+ * Input: `steps`.
1375
+ * Output: Scratch statement block definition that is appended to the current script stack.
1376
+ *
1377
+ * @param steps See function signature for accepted input values.
1378
+ * @returns Scratch statement block definition that is appended to the current script stack.
1379
+ * @example
1380
+ * ```ts
1381
+ * import { moveSteps } from 'hikkaku/blocks'
1382
+ *
1383
+ * moveSteps(undefined as any)
1384
+ * ```
1385
+ */
326
1386
  const moveSteps = (steps) => {
327
1387
  return block("motion_movesteps", { inputs: { STEPS: fromPrimitiveSource(steps) } });
328
1388
  };
1389
+ /**
1390
+ * Moves to coordinates.
1391
+ *
1392
+ * Input: `x`, `y`.
1393
+ * Output: Scratch statement block definition that is appended to the current script stack.
1394
+ *
1395
+ * @param x See function signature for accepted input values.
1396
+ * @param y See function signature for accepted input values.
1397
+ * @returns Scratch statement block definition that is appended to the current script stack.
1398
+ * @example
1399
+ * ```ts
1400
+ * import { gotoXY } from 'hikkaku/blocks'
1401
+ *
1402
+ * gotoXY(10, 10)
1403
+ * ```
1404
+ */
329
1405
  const gotoXY = (x, y) => {
330
1406
  return block("motion_gotoxy", { inputs: {
331
1407
  X: fromPrimitiveSource(x),
332
1408
  Y: fromPrimitiveSource(y)
333
1409
  } });
334
1410
  };
1411
+ /**
1412
+ * Changes X.
1413
+ *
1414
+ * Input: `dx`.
1415
+ * Output: Scratch statement block definition that is appended to the current script stack.
1416
+ *
1417
+ * @param dx See function signature for accepted input values.
1418
+ * @returns Scratch statement block definition that is appended to the current script stack.
1419
+ * @example
1420
+ * ```ts
1421
+ * import { changeXBy } from 'hikkaku/blocks'
1422
+ *
1423
+ * changeXBy(10)
1424
+ * ```
1425
+ */
335
1426
  const changeXBy = (dx) => {
336
1427
  return block("motion_changexby", { inputs: { DX: fromPrimitiveSource(dx) } });
337
1428
  };
1429
+ /**
1430
+ * Changes Y.
1431
+ *
1432
+ * Input: `dy`.
1433
+ * Output: Scratch statement block definition that is appended to the current script stack.
1434
+ *
1435
+ * @param dy See function signature for accepted input values.
1436
+ * @returns Scratch statement block definition that is appended to the current script stack.
1437
+ * @example
1438
+ * ```ts
1439
+ * import { changeYBy } from 'hikkaku/blocks'
1440
+ *
1441
+ * changeYBy(10)
1442
+ * ```
1443
+ */
338
1444
  const changeYBy = (dy) => {
339
1445
  return block("motion_changeyby", { inputs: { DY: fromPrimitiveSource(dy) } });
340
1446
  };
1447
+ /**
1448
+ * Sets X.
1449
+ *
1450
+ * Input: `x`.
1451
+ * Output: Scratch statement block definition that is appended to the current script stack.
1452
+ *
1453
+ * @param x See function signature for accepted input values.
1454
+ * @returns Scratch statement block definition that is appended to the current script stack.
1455
+ * @example
1456
+ * ```ts
1457
+ * import { setX } from 'hikkaku/blocks'
1458
+ *
1459
+ * setX(10)
1460
+ * ```
1461
+ */
341
1462
  const setX = (x) => {
342
1463
  return block("motion_setx", { inputs: { X: fromPrimitiveSource(x) } });
343
1464
  };
1465
+ /**
1466
+ * Sets Y.
1467
+ *
1468
+ * Input: `y`.
1469
+ * Output: Scratch statement block definition that is appended to the current script stack.
1470
+ *
1471
+ * @param y See function signature for accepted input values.
1472
+ * @returns Scratch statement block definition that is appended to the current script stack.
1473
+ * @example
1474
+ * ```ts
1475
+ * import { setY } from 'hikkaku/blocks'
1476
+ *
1477
+ * setY(10)
1478
+ * ```
1479
+ */
344
1480
  const setY = (y) => {
345
1481
  return block("motion_sety", { inputs: { Y: fromPrimitiveSource(y) } });
346
1482
  };
1483
+ /**
1484
+ * Moves to target.
1485
+ *
1486
+ * Input: `target`.
1487
+ * Output: Scratch statement block definition that is appended to the current script stack.
1488
+ *
1489
+ * @param target See function signature for accepted input values.
1490
+ * @returns Scratch statement block definition that is appended to the current script stack.
1491
+ * @example
1492
+ * ```ts
1493
+ * import { goTo } from 'hikkaku/blocks'
1494
+ *
1495
+ * goTo('mouse-pointer')
1496
+ * ```
1497
+ */
347
1498
  const goTo = (target) => {
348
1499
  return block("motion_goto", { fields: { TO: [target, null] } });
349
1500
  };
1501
+ /**
1502
+ * Turns right.
1503
+ *
1504
+ * Input: `degrees`.
1505
+ * Output: Scratch statement block definition that is appended to the current script stack.
1506
+ *
1507
+ * @param degrees See function signature for accepted input values.
1508
+ * @returns Scratch statement block definition that is appended to the current script stack.
1509
+ * @example
1510
+ * ```ts
1511
+ * import { turnRight } from 'hikkaku/blocks'
1512
+ *
1513
+ * turnRight(10)
1514
+ * ```
1515
+ */
350
1516
  const turnRight = (degrees) => {
351
1517
  return block("motion_turnright", { inputs: { DEGREES: fromPrimitiveSource(degrees) } });
352
1518
  };
1519
+ /**
1520
+ * Turns left.
1521
+ *
1522
+ * Input: `degrees`.
1523
+ * Output: Scratch statement block definition that is appended to the current script stack.
1524
+ *
1525
+ * @param degrees See function signature for accepted input values.
1526
+ * @returns Scratch statement block definition that is appended to the current script stack.
1527
+ * @example
1528
+ * ```ts
1529
+ * import { turnLeft } from 'hikkaku/blocks'
1530
+ *
1531
+ * turnLeft(10)
1532
+ * ```
1533
+ */
353
1534
  const turnLeft = (degrees) => {
354
1535
  return block("motion_turnleft", { inputs: { DEGREES: fromPrimitiveSource(degrees) } });
355
1536
  };
1537
+ /**
1538
+ * Points direction.
1539
+ *
1540
+ * Input: `direction`.
1541
+ * Output: Scratch statement block definition that is appended to the current script stack.
1542
+ *
1543
+ * @param direction See function signature for accepted input values.
1544
+ * @returns Scratch statement block definition that is appended to the current script stack.
1545
+ * @example
1546
+ * ```ts
1547
+ * import { pointInDirection } from 'hikkaku/blocks'
1548
+ *
1549
+ * pointInDirection('forward')
1550
+ * ```
1551
+ */
356
1552
  const pointInDirection = (direction) => {
357
1553
  return block("motion_pointindirection", { inputs: { DIRECTION: fromPrimitiveSource(direction) } });
358
1554
  };
1555
+ /**
1556
+ * Points toward target.
1557
+ *
1558
+ * Input: `target`.
1559
+ * Output: Scratch statement block definition that is appended to the current script stack.
1560
+ *
1561
+ * @param target See function signature for accepted input values.
1562
+ * @returns Scratch statement block definition that is appended to the current script stack.
1563
+ * @example
1564
+ * ```ts
1565
+ * import { pointTowards } from 'hikkaku/blocks'
1566
+ *
1567
+ * pointTowards('mouse-pointer')
1568
+ * ```
1569
+ */
359
1570
  const pointTowards = (target) => {
360
1571
  return block("motion_pointtowards", { fields: { TOWARDS: [target, null] } });
361
1572
  };
1573
+ /**
1574
+ * Glides to position.
1575
+ *
1576
+ * Input: `seconds`, `x`, `y`.
1577
+ * Output: Scratch statement block definition that is appended to the current script stack.
1578
+ *
1579
+ * @param seconds See function signature for accepted input values.
1580
+ * @param x See function signature for accepted input values.
1581
+ * @param y See function signature for accepted input values.
1582
+ * @returns Scratch statement block definition that is appended to the current script stack.
1583
+ * @example
1584
+ * ```ts
1585
+ * import { glide } from 'hikkaku/blocks'
1586
+ *
1587
+ * glide(10, 10, 10)
1588
+ * ```
1589
+ */
362
1590
  const glide = (seconds, x, y) => {
363
1591
  return block("motion_glidesecstoxy", { inputs: {
364
1592
  SECS: fromPrimitiveSource(seconds),
@@ -366,123 +1594,495 @@ const glide = (seconds, x, y) => {
366
1594
  Y: fromPrimitiveSource(y)
367
1595
  } });
368
1596
  };
1597
+ /**
1598
+ * Glides to target.
1599
+ *
1600
+ * Input: `seconds`, `target`.
1601
+ * Output: Scratch statement block definition that is appended to the current script stack.
1602
+ *
1603
+ * @param seconds See function signature for accepted input values.
1604
+ * @param target See function signature for accepted input values.
1605
+ * @returns Scratch statement block definition that is appended to the current script stack.
1606
+ * @example
1607
+ * ```ts
1608
+ * import { glideTo } from 'hikkaku/blocks'
1609
+ *
1610
+ * glideTo(10, 'mouse-pointer')
1611
+ * ```
1612
+ */
369
1613
  const glideTo = (seconds, target) => {
370
1614
  return block("motion_glideto", {
371
1615
  inputs: { SECS: fromPrimitiveSource(seconds) },
372
1616
  fields: { TO: [target, null] }
373
1617
  });
374
1618
  };
1619
+ /**
1620
+ * Bounces on edge.
1621
+ *
1622
+ * Input: none.
1623
+ * Output: Scratch statement block definition that is appended to the current script stack.
1624
+ *
1625
+ * @returns Scratch statement block definition that is appended to the current script stack.
1626
+ * @example
1627
+ * ```ts
1628
+ * import { ifOnEdgeBounce } from 'hikkaku/blocks'
1629
+ *
1630
+ * ifOnEdgeBounce()
1631
+ * ```
1632
+ */
375
1633
  const ifOnEdgeBounce = () => {
376
1634
  return block("motion_ifonedgebounce", {});
377
1635
  };
1636
+ /**
1637
+ * Sets rotation style.
1638
+ *
1639
+ * Input: `style`.
1640
+ * Output: Scratch statement block definition that is appended to the current script stack.
1641
+ *
1642
+ * @param style See function signature for accepted input values.
1643
+ * @returns Scratch statement block definition that is appended to the current script stack.
1644
+ * @example
1645
+ * ```ts
1646
+ * import { setRotationStyle } from 'hikkaku/blocks'
1647
+ *
1648
+ * setRotationStyle('all around')
1649
+ * ```
1650
+ */
378
1651
  const setRotationStyle = (style) => {
379
1652
  return block("motion_setrotationstyle", { fields: { STYLE: [style, null] } });
380
1653
  };
1654
+ /**
1655
+ * Returns X position.
1656
+ *
1657
+ * Input: none.
1658
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
1659
+ *
1660
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
1661
+ * @example
1662
+ * ```ts
1663
+ * import { getX } from 'hikkaku/blocks'
1664
+ *
1665
+ * getX()
1666
+ * ```
1667
+ */
381
1668
  const getX = () => {
382
1669
  return valueBlock("motion_xposition", {});
383
1670
  };
1671
+ /**
1672
+ * Returns Y position.
1673
+ *
1674
+ * Input: none.
1675
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
1676
+ *
1677
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
1678
+ * @example
1679
+ * ```ts
1680
+ * import { getY } from 'hikkaku/blocks'
1681
+ *
1682
+ * getY()
1683
+ * ```
1684
+ */
384
1685
  const getY = () => {
385
1686
  return valueBlock("motion_yposition", {});
386
1687
  };
1688
+ /**
1689
+ * Returns direction.
1690
+ *
1691
+ * Input: none.
1692
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
1693
+ *
1694
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
1695
+ * @example
1696
+ * ```ts
1697
+ * import { getDirection } from 'hikkaku/blocks'
1698
+ *
1699
+ * getDirection()
1700
+ * ```
1701
+ */
387
1702
  const getDirection = () => {
388
1703
  return valueBlock("motion_direction", {});
389
1704
  };
390
1705
 
391
1706
  //#endregion
392
1707
  //#region src/blocks/operator.ts
1708
+ /**
1709
+ * Addition.
1710
+ *
1711
+ * Input: `a`, `b`.
1712
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
1713
+ *
1714
+ * @param a See function signature for accepted input values.
1715
+ * @param b See function signature for accepted input values.
1716
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
1717
+ * @example
1718
+ * ```ts
1719
+ * import { add } from 'hikkaku/blocks'
1720
+ *
1721
+ * add(1, 2)
1722
+ * ```
1723
+ */
393
1724
  const add = (a, b) => {
394
1725
  return valueBlock("operator_add", { inputs: {
395
1726
  NUM1: fromPrimitiveSource(a),
396
1727
  NUM2: fromPrimitiveSource(b)
397
1728
  } });
398
1729
  };
1730
+ /**
1731
+ * Subtraction.
1732
+ *
1733
+ * Input: `a`, `b`.
1734
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
1735
+ *
1736
+ * @param a See function signature for accepted input values.
1737
+ * @param b See function signature for accepted input values.
1738
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
1739
+ * @example
1740
+ * ```ts
1741
+ * import { subtract } from 'hikkaku/blocks'
1742
+ *
1743
+ * subtract(5, 3)
1744
+ * ```
1745
+ */
399
1746
  const subtract = (a, b) => {
400
1747
  return valueBlock("operator_subtract", { inputs: {
401
1748
  NUM1: fromPrimitiveSource(a),
402
1749
  NUM2: fromPrimitiveSource(b)
403
1750
  } });
404
1751
  };
1752
+ /**
1753
+ * Multiplication.
1754
+ *
1755
+ * Input: `a`, `b`.
1756
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
1757
+ *
1758
+ * @param a See function signature for accepted input values.
1759
+ * @param b See function signature for accepted input values.
1760
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
1761
+ * @example
1762
+ * ```ts
1763
+ * import { multiply } from 'hikkaku/blocks'
1764
+ *
1765
+ * multiply(3, 4)
1766
+ * ```
1767
+ */
405
1768
  const multiply = (a, b) => {
406
1769
  return valueBlock("operator_multiply", { inputs: {
407
1770
  NUM1: fromPrimitiveSource(a),
408
1771
  NUM2: fromPrimitiveSource(b)
409
1772
  } });
410
1773
  };
1774
+ /**
1775
+ * Division.
1776
+ *
1777
+ * Input: `a`, `b`.
1778
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
1779
+ *
1780
+ * @param a See function signature for accepted input values.
1781
+ * @param b See function signature for accepted input values.
1782
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
1783
+ * @example
1784
+ * ```ts
1785
+ * import { divide } from 'hikkaku/blocks'
1786
+ *
1787
+ * divide(10, 2)
1788
+ * ```
1789
+ */
411
1790
  const divide = (a, b) => {
412
1791
  return valueBlock("operator_divide", { inputs: {
413
1792
  NUM1: fromPrimitiveSource(a),
414
1793
  NUM2: fromPrimitiveSource(b)
415
1794
  } });
416
1795
  };
1796
+ /**
1797
+ * Less-than comparison.
1798
+ *
1799
+ * Input: `a`, `b`.
1800
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
1801
+ *
1802
+ * @param a See function signature for accepted input values.
1803
+ * @param b See function signature for accepted input values.
1804
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
1805
+ * @example
1806
+ * ```ts
1807
+ * import { lt } from 'hikkaku/blocks'
1808
+ *
1809
+ * lt(1, 2)
1810
+ * ```
1811
+ */
417
1812
  const lt = (a, b) => {
418
1813
  return valueBlock("operator_lt", { inputs: {
419
1814
  OPERAND1: fromPrimitiveSource(a),
420
1815
  OPERAND2: fromPrimitiveSource(b)
421
1816
  } });
422
1817
  };
1818
+ /**
1819
+ * Equality comparison.
1820
+ *
1821
+ * Input: `a`, `b`.
1822
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
1823
+ *
1824
+ * @param a See function signature for accepted input values.
1825
+ * @param b See function signature for accepted input values.
1826
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
1827
+ * @example
1828
+ * ```ts
1829
+ * import { equals } from 'hikkaku/blocks'
1830
+ *
1831
+ * equals(5, 5)
1832
+ * ```
1833
+ */
423
1834
  const equals = (a, b) => {
424
1835
  return valueBlock("operator_equals", { inputs: {
425
1836
  OPERAND1: fromPrimitiveSource(a),
426
1837
  OPERAND2: fromPrimitiveSource(b)
427
1838
  } });
428
1839
  };
1840
+ /**
1841
+ * Greater-than comparison.
1842
+ *
1843
+ * Input: `a`, `b`.
1844
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
1845
+ *
1846
+ * @param a See function signature for accepted input values.
1847
+ * @param b See function signature for accepted input values.
1848
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
1849
+ * @example
1850
+ * ```ts
1851
+ * import { gt } from 'hikkaku/blocks'
1852
+ *
1853
+ * gt(10, 5)
1854
+ * ```
1855
+ */
429
1856
  const gt = (a, b) => {
430
1857
  return valueBlock("operator_gt", { inputs: {
431
1858
  OPERAND1: fromPrimitiveSource(a),
432
1859
  OPERAND2: fromPrimitiveSource(b)
433
1860
  } });
434
1861
  };
1862
+ /**
1863
+ * Logical AND.
1864
+ *
1865
+ * Input: `a`, `b`.
1866
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
1867
+ *
1868
+ * @param a See function signature for accepted input values.
1869
+ * @param b See function signature for accepted input values.
1870
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
1871
+ * @example
1872
+ * ```ts
1873
+ * import { and } from 'hikkaku/blocks'
1874
+ *
1875
+ * and(true, false)
1876
+ * ```
1877
+ */
435
1878
  const and = (a, b) => {
436
1879
  return valueBlock("operator_and", { inputs: {
437
1880
  OPERAND1: fromPrimitiveSource(a),
438
1881
  OPERAND2: fromPrimitiveSource(b)
439
1882
  } });
440
1883
  };
1884
+ /**
1885
+ * Logical OR.
1886
+ *
1887
+ * Input: `a`, `b`.
1888
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
1889
+ *
1890
+ * @param a See function signature for accepted input values.
1891
+ * @param b See function signature for accepted input values.
1892
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
1893
+ * @example
1894
+ * ```ts
1895
+ * import { or } from 'hikkaku/blocks'
1896
+ *
1897
+ * or(true, false)
1898
+ * ```
1899
+ */
441
1900
  const or = (a, b) => {
442
1901
  return valueBlock("operator_or", { inputs: {
443
1902
  OPERAND1: fromPrimitiveSource(a),
444
1903
  OPERAND2: fromPrimitiveSource(b)
445
1904
  } });
446
1905
  };
1906
+ /**
1907
+ * Logical NOT.
1908
+ *
1909
+ * Input: `operand`.
1910
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
1911
+ *
1912
+ * @param operand See function signature for accepted input values.
1913
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
1914
+ * @example
1915
+ * ```ts
1916
+ * import { not } from 'hikkaku/blocks'
1917
+ *
1918
+ * not(false)
1919
+ * ```
1920
+ */
447
1921
  const not = (operand) => {
448
1922
  return valueBlock("operator_not", { inputs: { OPERAND: fromPrimitiveSource(operand) } });
449
1923
  };
1924
+ /**
1925
+ * Random number.
1926
+ *
1927
+ * Input: `from`, `to`.
1928
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
1929
+ *
1930
+ * @param from See function signature for accepted input values.
1931
+ * @param to See function signature for accepted input values.
1932
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
1933
+ * @example
1934
+ * ```ts
1935
+ * import { random } from 'hikkaku/blocks'
1936
+ *
1937
+ * random(10, 10)
1938
+ * ```
1939
+ */
450
1940
  const random = (from, to) => {
451
1941
  return valueBlock("operator_random", { inputs: {
452
1942
  FROM: fromPrimitiveSource(from),
453
1943
  TO: fromPrimitiveSource(to)
454
1944
  } });
455
1945
  };
1946
+ /**
1947
+ * String concatenation.
1948
+ *
1949
+ * Input: `a`, `b`.
1950
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
1951
+ *
1952
+ * @param a See function signature for accepted input values.
1953
+ * @param b See function signature for accepted input values.
1954
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
1955
+ * @example
1956
+ * ```ts
1957
+ * import { join } from 'hikkaku/blocks'
1958
+ *
1959
+ * join('Hello', 'World')
1960
+ * ```
1961
+ */
456
1962
  const join = (a, b) => {
457
1963
  return valueBlock("operator_join", { inputs: {
458
1964
  STRING1: fromPrimitiveSource(a),
459
1965
  STRING2: fromPrimitiveSource(b)
460
1966
  } });
461
1967
  };
1968
+ /**
1969
+ * Character extraction.
1970
+ *
1971
+ * Input: `letter`, `text`.
1972
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
1973
+ *
1974
+ * @param letter See function signature for accepted input values.
1975
+ * @param text See function signature for accepted input values.
1976
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
1977
+ * @example
1978
+ * ```ts
1979
+ * import { letterOf } from 'hikkaku/blocks'
1980
+ *
1981
+ * letterOf(10, 'Hello')
1982
+ * ```
1983
+ */
462
1984
  const letterOf = (letter, text) => {
463
1985
  return valueBlock("operator_letter_of", { inputs: {
464
1986
  LETTER: fromPrimitiveSource(letter),
465
1987
  STRING: fromPrimitiveSource(text)
466
1988
  } });
467
1989
  };
1990
+ /**
1991
+ * String length.
1992
+ *
1993
+ * Input: `text`.
1994
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
1995
+ *
1996
+ * @param text See function signature for accepted input values.
1997
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
1998
+ * @example
1999
+ * ```ts
2000
+ * import { length } from 'hikkaku/blocks'
2001
+ *
2002
+ * length('Hello')
2003
+ * ```
2004
+ */
468
2005
  const length = (text) => {
469
2006
  return valueBlock("operator_length", { inputs: { STRING: fromPrimitiveSource(text) } });
470
2007
  };
2008
+ /**
2009
+ * Substring check.
2010
+ *
2011
+ * Input: `text`, `substring`.
2012
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
2013
+ *
2014
+ * @param text See function signature for accepted input values.
2015
+ * @param substring See function signature for accepted input values.
2016
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
2017
+ * @example
2018
+ * ```ts
2019
+ * import { contains } from 'hikkaku/blocks'
2020
+ *
2021
+ * contains('Hello', 'Hello')
2022
+ * ```
2023
+ */
471
2024
  const contains = (text, substring) => {
472
2025
  return valueBlock("operator_contains", { inputs: {
473
2026
  STRING1: fromPrimitiveSource(text),
474
2027
  STRING2: fromPrimitiveSource(substring)
475
2028
  } });
476
2029
  };
2030
+ /**
2031
+ * Modulo.
2032
+ *
2033
+ * Input: `a`, `b`.
2034
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
2035
+ *
2036
+ * @param a See function signature for accepted input values.
2037
+ * @param b See function signature for accepted input values.
2038
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
2039
+ * @example
2040
+ * ```ts
2041
+ * import { mod } from 'hikkaku/blocks'
2042
+ *
2043
+ * mod(10, 3)
2044
+ * ```
2045
+ */
477
2046
  const mod = (a, b) => {
478
2047
  return valueBlock("operator_mod", { inputs: {
479
2048
  NUM1: fromPrimitiveSource(a),
480
2049
  NUM2: fromPrimitiveSource(b)
481
2050
  } });
482
2051
  };
2052
+ /**
2053
+ * Rounds number.
2054
+ *
2055
+ * Input: `value`.
2056
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
2057
+ *
2058
+ * @param value See function signature for accepted input values.
2059
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
2060
+ * @example
2061
+ * ```ts
2062
+ * import { round } from 'hikkaku/blocks'
2063
+ *
2064
+ * round(10)
2065
+ * ```
2066
+ */
483
2067
  const round = (value) => {
484
2068
  return valueBlock("operator_round", { inputs: { NUM: fromPrimitiveSource(value) } });
485
2069
  };
2070
+ /**
2071
+ * Math operation (sin, cos, log, etc.).
2072
+ *
2073
+ * Input: `operator`, `value`.
2074
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
2075
+ *
2076
+ * @param operator See function signature for accepted input values.
2077
+ * @param value See function signature for accepted input values.
2078
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
2079
+ * @example
2080
+ * ```ts
2081
+ * import { mathop } from 'hikkaku/blocks'
2082
+ *
2083
+ * mathop('abs', 10)
2084
+ * ```
2085
+ */
486
2086
  const mathop = (operator, value) => {
487
2087
  return valueBlock("operator_mathop", {
488
2088
  inputs: { NUM: fromPrimitiveSource(value) },
@@ -492,74 +2092,350 @@ const mathop = (operator, value) => {
492
2092
 
493
2093
  //#endregion
494
2094
  //#region src/blocks/pen.ts
2095
+ /**
2096
+ * Clears all pen marks.
2097
+ *
2098
+ * Input: none.
2099
+ * Output: Scratch statement block definition that is appended to the current script stack.
2100
+ *
2101
+ * @returns Scratch statement block definition that is appended to the current script stack.
2102
+ * @example
2103
+ * ```ts
2104
+ * import { eraseAll } from 'hikkaku/blocks'
2105
+ *
2106
+ * eraseAll()
2107
+ * ```
2108
+ */
495
2109
  const eraseAll = () => {
496
2110
  return block("pen_clear", {});
497
2111
  };
2112
+ /**
2113
+ * Alias for {@link eraseAll}.
2114
+ *
2115
+ * Input: none.
2116
+ * Output: Same Scratch statement block definition as {@link eraseAll}.
2117
+ *
2118
+ * @example
2119
+ * ```ts
2120
+ * import { clear } from 'hikkaku/blocks'
2121
+ *
2122
+ * clear()
2123
+ * ```
2124
+ */
498
2125
  const clear = eraseAll;
2126
+ /**
2127
+ * Stamps sprite costume.
2128
+ *
2129
+ * Input: none.
2130
+ * Output: Scratch statement block definition that is appended to the current script stack.
2131
+ *
2132
+ * @returns Scratch statement block definition that is appended to the current script stack.
2133
+ * @example
2134
+ * ```ts
2135
+ * import { stamp } from 'hikkaku/blocks'
2136
+ *
2137
+ * stamp()
2138
+ * ```
2139
+ */
499
2140
  const stamp = () => {
500
2141
  return block("pen_stamp", {});
501
2142
  };
2143
+ /**
2144
+ * Starts drawing.
2145
+ *
2146
+ * Input: none.
2147
+ * Output: Scratch statement block definition that is appended to the current script stack.
2148
+ *
2149
+ * @returns Scratch statement block definition that is appended to the current script stack.
2150
+ * @example
2151
+ * ```ts
2152
+ * import { penDown } from 'hikkaku/blocks'
2153
+ *
2154
+ * penDown()
2155
+ * ```
2156
+ */
502
2157
  const penDown = () => {
503
2158
  return block("pen_penDown", {});
504
2159
  };
2160
+ /**
2161
+ * Stops drawing.
2162
+ *
2163
+ * Input: none.
2164
+ * Output: Scratch statement block definition that is appended to the current script stack.
2165
+ *
2166
+ * @returns Scratch statement block definition that is appended to the current script stack.
2167
+ * @example
2168
+ * ```ts
2169
+ * import { penUp } from 'hikkaku/blocks'
2170
+ *
2171
+ * penUp()
2172
+ * ```
2173
+ */
505
2174
  const penUp = () => {
506
2175
  return block("pen_penUp", {});
507
2176
  };
2177
+ /**
2178
+ * Sets pen color.
2179
+ *
2180
+ * Input: `color`.
2181
+ * Output: Scratch statement block definition that is appended to the current script stack.
2182
+ *
2183
+ * @param color See function signature for accepted input values.
2184
+ * @returns Scratch statement block definition that is appended to the current script stack.
2185
+ * @example
2186
+ * ```ts
2187
+ * import { setPenColorTo } from 'hikkaku/blocks'
2188
+ *
2189
+ * setPenColorTo(undefined as any)
2190
+ * ```
2191
+ */
508
2192
  const setPenColorTo = (color) => {
509
2193
  return block("pen_setPenColorToColor", { inputs: { COLOR: fromPrimitiveSource(color) } });
510
2194
  };
2195
+ /**
2196
+ * Alias for {@link setPenColorTo}.
2197
+ *
2198
+ * Input: `color`.
2199
+ * Output: Same Scratch statement block definition as {@link setPenColorTo}.
2200
+ *
2201
+ * @param color See function signature for accepted input values.
2202
+ * @example
2203
+ * ```ts
2204
+ * import { setPenColorToColor } from 'hikkaku/blocks'
2205
+ *
2206
+ * setPenColorToColor('#ff0000')
2207
+ * ```
2208
+ */
511
2209
  const setPenColorToColor = setPenColorTo;
2210
+ /**
2211
+ * Changes pen color parameter by amount.
2212
+ *
2213
+ * Input: `param`, `value`.
2214
+ * Output: Scratch statement block definition that is appended to the current script stack.
2215
+ *
2216
+ * @param param See function signature for accepted input values.
2217
+ * @param value See function signature for accepted input values.
2218
+ * @returns Scratch statement block definition that is appended to the current script stack.
2219
+ * @example
2220
+ * ```ts
2221
+ * import { changePenColorParamBy } from 'hikkaku/blocks'
2222
+ *
2223
+ * changePenColorParamBy(undefined as any, 10)
2224
+ * ```
2225
+ */
512
2226
  const changePenColorParamBy = (param, value) => {
513
2227
  return block("pen_changePenColorParamBy", { inputs: {
514
2228
  COLOR_PARAM: fromPrimitiveSource(param),
515
2229
  VALUE: fromPrimitiveSource(value)
516
2230
  } });
517
2231
  };
2232
+ /**
2233
+ * Sets pen color parameter to value.
2234
+ *
2235
+ * Input: `param`, `value`.
2236
+ * Output: Scratch statement block definition that is appended to the current script stack.
2237
+ *
2238
+ * @param param See function signature for accepted input values.
2239
+ * @param value See function signature for accepted input values.
2240
+ * @returns Scratch statement block definition that is appended to the current script stack.
2241
+ * @example
2242
+ * ```ts
2243
+ * import { setPenColorParamTo } from 'hikkaku/blocks'
2244
+ *
2245
+ * setPenColorParamTo(undefined as any, 10)
2246
+ * ```
2247
+ */
518
2248
  const setPenColorParamTo = (param, value) => {
519
2249
  return block("pen_setPenColorParamTo", { inputs: {
520
2250
  COLOR_PARAM: fromPrimitiveSource(param),
521
2251
  VALUE: fromPrimitiveSource(value)
522
2252
  } });
523
2253
  };
2254
+ /**
2255
+ * Changes pen size by amount.
2256
+ *
2257
+ * Input: `size`.
2258
+ * Output: Scratch statement block definition that is appended to the current script stack.
2259
+ *
2260
+ * @param size See function signature for accepted input values.
2261
+ * @returns Scratch statement block definition that is appended to the current script stack.
2262
+ * @example
2263
+ * ```ts
2264
+ * import { changePenSizeBy } from 'hikkaku/blocks'
2265
+ *
2266
+ * changePenSizeBy(10)
2267
+ * ```
2268
+ */
524
2269
  const changePenSizeBy = (size) => {
525
2270
  return block("pen_changePenSizeBy", { inputs: { SIZE: fromPrimitiveSource(size) } });
526
2271
  };
2272
+ /**
2273
+ * Sets pen size to value.
2274
+ *
2275
+ * Input: `size`.
2276
+ * Output: Scratch statement block definition that is appended to the current script stack.
2277
+ *
2278
+ * @param size See function signature for accepted input values.
2279
+ * @returns Scratch statement block definition that is appended to the current script stack.
2280
+ * @example
2281
+ * ```ts
2282
+ * import { setPenSizeTo } from 'hikkaku/blocks'
2283
+ *
2284
+ * setPenSizeTo(10)
2285
+ * ```
2286
+ */
527
2287
  const setPenSizeTo = (size) => {
528
2288
  return block("pen_setPenSizeTo", { inputs: { SIZE: fromPrimitiveSource(size) } });
529
2289
  };
2290
+ /**
2291
+ * Sets pen shade to value.
2292
+ *
2293
+ * Input: `shade`.
2294
+ * Output: Scratch statement block definition that is appended to the current script stack.
2295
+ *
2296
+ * @param shade See function signature for accepted input values.
2297
+ * @returns Scratch statement block definition that is appended to the current script stack.
2298
+ * @example
2299
+ * ```ts
2300
+ * import { setPenShadeToNumber } from 'hikkaku/blocks'
2301
+ *
2302
+ * setPenShadeToNumber(10)
2303
+ * ```
2304
+ */
530
2305
  const setPenShadeToNumber = (shade) => {
531
2306
  return block("pen_setPenShadeToNumber", { inputs: { SHADE: fromPrimitiveSource(shade) } });
532
2307
  };
2308
+ /**
2309
+ * Changes pen shade by amount.
2310
+ *
2311
+ * Input: `shade`.
2312
+ * Output: Scratch statement block definition that is appended to the current script stack.
2313
+ *
2314
+ * @param shade See function signature for accepted input values.
2315
+ * @returns Scratch statement block definition that is appended to the current script stack.
2316
+ * @example
2317
+ * ```ts
2318
+ * import { changePenShadeBy } from 'hikkaku/blocks'
2319
+ *
2320
+ * changePenShadeBy(10)
2321
+ * ```
2322
+ */
533
2323
  const changePenShadeBy = (shade) => {
534
2324
  return block("pen_changePenShadeBy", { inputs: { SHADE: fromPrimitiveSource(shade) } });
535
2325
  };
2326
+ /**
2327
+ * Sets pen hue to value.
2328
+ *
2329
+ * Input: `hue`.
2330
+ * Output: Scratch statement block definition that is appended to the current script stack.
2331
+ *
2332
+ * @param hue See function signature for accepted input values.
2333
+ * @returns Scratch statement block definition that is appended to the current script stack.
2334
+ * @example
2335
+ * ```ts
2336
+ * import { setPenHueToNumber } from 'hikkaku/blocks'
2337
+ *
2338
+ * setPenHueToNumber(10)
2339
+ * ```
2340
+ */
536
2341
  const setPenHueToNumber = (hue) => {
537
2342
  return block("pen_setPenHueToNumber", { inputs: { HUE: fromPrimitiveSource(hue) } });
538
2343
  };
2344
+ /**
2345
+ * Changes pen hue by amount.
2346
+ *
2347
+ * Input: `hue`.
2348
+ * Output: Scratch statement block definition that is appended to the current script stack.
2349
+ *
2350
+ * @param hue See function signature for accepted input values.
2351
+ * @returns Scratch statement block definition that is appended to the current script stack.
2352
+ * @example
2353
+ * ```ts
2354
+ * import { changePenHueBy } from 'hikkaku/blocks'
2355
+ *
2356
+ * changePenHueBy(10)
2357
+ * ```
2358
+ */
539
2359
  const changePenHueBy = (hue) => {
540
2360
  return block("pen_changePenHueBy", { inputs: { HUE: fromPrimitiveSource(hue) } });
541
2361
  };
542
2362
 
543
2363
  //#endregion
544
2364
  //#region src/blocks/procedures.ts
2365
+ /**
2366
+ * Creates a label fragment used in `defineProcedure`.
2367
+ *
2368
+ * @param text Static text shown in the custom block signature.
2369
+ * @returns A procedure fragment describing a label segment.
2370
+ * @example
2371
+ * ```ts
2372
+ * import { procedureLabel } from 'hikkaku/blocks'
2373
+ *
2374
+ * procedureLabel('Hello')
2375
+ * ```
2376
+ */
545
2377
  const procedureLabel = (text) => {
546
2378
  return {
547
2379
  type: "label",
548
2380
  text
549
2381
  };
550
2382
  };
2383
+ /**
2384
+ * Creates a boolean argument fragment used in `defineProcedure`.
2385
+ *
2386
+ * @param name Argument name shown in the custom block signature.
2387
+ * @returns A procedure fragment describing a boolean input.
2388
+ * @example
2389
+ * ```ts
2390
+ * import { procedureBoolean } from 'hikkaku/blocks'
2391
+ *
2392
+ * procedureBoolean(undefined as any)
2393
+ * ```
2394
+ */
551
2395
  const procedureBoolean = (name) => {
552
2396
  return {
553
2397
  type: "boolean",
554
2398
  name
555
2399
  };
556
2400
  };
2401
+ /**
2402
+ * Creates a string/number argument fragment used in `defineProcedure`.
2403
+ *
2404
+ * @param name Argument name shown in the custom block signature.
2405
+ * @returns A procedure fragment describing a string/number input.
2406
+ * @example
2407
+ * ```ts
2408
+ * import { procedureStringOrNumber } from 'hikkaku/blocks'
2409
+ *
2410
+ * procedureStringOrNumber(undefined as any)
2411
+ * ```
2412
+ */
557
2413
  const procedureStringOrNumber = (name) => {
558
2414
  return {
559
2415
  type: "stringOrNumber",
560
2416
  name
561
2417
  };
562
2418
  };
2419
+ /**
2420
+ * Defines a custom procedure and returns its definition block.
2421
+ *
2422
+ * @param proclist List of procedure parts (labels and arguments) that define the procedure's signature.
2423
+ * @param stack Optional callback that composes the procedure body. Return `undefined` from this callback (implicit return is fine).
2424
+ * Argument references include `getter()` to create reporter blocks.
2425
+ * @param warp If `true`, run the procedure without screen refresh until completion.
2426
+ * @returns A procedure definition block with `reference` metadata for safe calls.
2427
+ * @example
2428
+ * ```ts
2429
+ * import { defineProcedure, procedureLabel, procedureStringOrNumber, say } from 'hikkaku/blocks'
2430
+ *
2431
+ * const greet = defineProcedure(
2432
+ * [procedureLabel('greet'), procedureStringOrNumber('name')],
2433
+ * ({ name }) => {
2434
+ * say(name.getter())
2435
+ * },
2436
+ * )
2437
+ * ```
2438
+ */
563
2439
  const defineProcedure = (proclist, stack, warp = false) => {
564
2440
  const proccode = proclist.map((proc) => {
565
2441
  switch (proc.type) {
@@ -583,33 +2459,105 @@ const defineProcedure = (proclist, stack, warp = false) => {
583
2459
  default: throw new Error("Unknown procedure proc type");
584
2460
  }
585
2461
  });
2462
+ const prototype = block("procedures_prototype", {
2463
+ mutation: {
2464
+ tagName: "mutation",
2465
+ children: [],
2466
+ proccode,
2467
+ argumentids: JSON.stringify(argumentids),
2468
+ argumentnames: JSON.stringify(argumentnames),
2469
+ argumentdefaults: JSON.stringify(argumentdefaults),
2470
+ warp: warp.toString()
2471
+ },
2472
+ isShadow: true
2473
+ });
586
2474
  const definition = block("procedures_definition", {
587
- inputs: { custom_block: [1, block("procedures_prototype", {
588
- mutation: {
589
- tagName: "mutation",
590
- children: [],
591
- proccode,
592
- argumentids: JSON.stringify(argumentids),
593
- argumentnames: JSON.stringify(argumentnames),
594
- argumentdefaults: JSON.stringify(argumentdefaults),
595
- warp: warp.toString()
596
- },
597
- isShadow: true
598
- }).id] },
2475
+ inputs: { custom_block: [Shadow.SameBlockShadow, prototype.id] },
599
2476
  topLevel: true
600
2477
  });
601
2478
  const references = Object.fromEntries(argumentProcs.map((proc, index) => {
602
- return [proc.name, {
603
- isProcedureArgument: true,
604
- name: proc.name,
605
- type: proc.type,
606
- id: argumentids[index]
607
- }];
2479
+ const argumentid = argumentids[index];
2480
+ if (!argumentid) throw new Error("Argument ID not found");
2481
+ let reference;
2482
+ if (proc.type === "boolean") {
2483
+ const boolReference = {
2484
+ isProcedureArgument: true,
2485
+ name: proc.name,
2486
+ type: proc.type,
2487
+ id: argumentid,
2488
+ getter: () => argumentReporterBoolean(boolReference)
2489
+ };
2490
+ reference = boolReference;
2491
+ } else if (proc.type === "stringOrNumber") {
2492
+ const strNumReference = {
2493
+ isProcedureArgument: true,
2494
+ name: proc.name,
2495
+ type: proc.type,
2496
+ id: argumentid,
2497
+ getter: () => argumentReporterStringNumber(strNumReference)
2498
+ };
2499
+ reference = strNumReference;
2500
+ } else throw new Error("Unknown procedure proc type");
2501
+ return [proc.name, reference];
608
2502
  }));
609
- stack?.(references);
610
- return definition;
2503
+ const reference = {
2504
+ type: "procedure",
2505
+ proccode,
2506
+ argumentids,
2507
+ warp,
2508
+ arguments: references
2509
+ };
2510
+ if (stack) attachStack(definition.id, () => {
2511
+ stack(references);
2512
+ });
2513
+ return {
2514
+ ...definition,
2515
+ reference
2516
+ };
611
2517
  };
612
- const callProcedure = (proccode, argumentIds, inputs, warp = false) => {
2518
+ /**
2519
+ * Calls a custom procedure.
2520
+ * Supports three call styles:
2521
+ * 1) Low-level: `callProcedure(proccode, argumentIds, inputs?, warp?)`
2522
+ * 2) Reference + array: `callProcedure(definitionOrReference, [{ reference, value }], warp?)`
2523
+ * 3) Reference + object: `callProcedure(definitionOrReference, { [argumentId]: value }, warp?)`
2524
+ *
2525
+ * @param proccodeOrReference Procedure code or the definition/reference returned by `defineProcedure`.
2526
+ * @param argumentIdsOrInputs Argument IDs for low-level calls, or argument inputs for reference-based calls.
2527
+ * @param inputsOrWarp Optional low-level inputs object or a warp override for reference-based calls.
2528
+ * @param warp Warp flag used by low-level calls.
2529
+ * @returns A `procedures_call` block.
2530
+ * @example
2531
+ * ```ts
2532
+ * import { callProcedure, defineProcedure, procedureLabel, procedureStringOrNumber } from 'hikkaku/blocks'
2533
+ *
2534
+ * const greet = defineProcedure([
2535
+ * procedureLabel('greet'),
2536
+ * procedureStringOrNumber('name'),
2537
+ * ])
2538
+ *
2539
+ * callProcedure(greet, [
2540
+ * { reference: greet.reference.arguments.name, value: 'Ada' },
2541
+ * ])
2542
+ * ```
2543
+ */
2544
+ const callProcedure = (proccodeOrReference, argumentIdsOrInputs, inputsOrWarp, warp = false) => {
2545
+ let proccode = "";
2546
+ let argumentIds = [];
2547
+ let inputs = {};
2548
+ if (typeof proccodeOrReference === "string") {
2549
+ proccode = proccodeOrReference;
2550
+ argumentIds = argumentIdsOrInputs;
2551
+ inputs = (typeof inputsOrWarp === "object" ? inputsOrWarp : void 0) ?? {};
2552
+ warp = typeof inputsOrWarp === "boolean" ? inputsOrWarp : warp;
2553
+ } else {
2554
+ const procedureReference = "reference" in proccodeOrReference ? proccodeOrReference.reference : proccodeOrReference;
2555
+ proccode = procedureReference.proccode;
2556
+ argumentIds = procedureReference.argumentids;
2557
+ warp = typeof inputsOrWarp === "boolean" ? inputsOrWarp : procedureReference.warp;
2558
+ if (Array.isArray(argumentIdsOrInputs) && argumentIdsOrInputs.every((input) => typeof input === "object" && input !== null && "reference" in input && "value" in input)) for (const input of argumentIdsOrInputs) inputs[input.reference.id] = input.value;
2559
+ else if (!Array.isArray(argumentIdsOrInputs)) inputs = argumentIdsOrInputs;
2560
+ }
613
2561
  const resolvedInputs = {};
614
2562
  for (const [key, value] of Object.entries(inputs)) resolvedInputs[key] = fromPrimitiveSource(value);
615
2563
  return block("procedures_call", {
@@ -623,9 +2571,33 @@ const callProcedure = (proccode, argumentIds, inputs, warp = false) => {
623
2571
  }
624
2572
  });
625
2573
  };
2574
+ /**
2575
+ * Creates a reporter block for a string/number procedure argument.
2576
+ *
2577
+ * @param reference String/number argument reference from `defineProcedure`.
2578
+ * @returns A reporter block that reads the current argument value.
2579
+ * @example
2580
+ * ```ts
2581
+ * import { argumentReporterStringNumber } from 'hikkaku/blocks'
2582
+ *
2583
+ * argumentReporterStringNumber(reference as any)
2584
+ * ```
2585
+ */
626
2586
  const argumentReporterStringNumber = (reference) => {
627
2587
  return valueBlock("argument_reporter_string_number", { fields: { VALUE: [reference.name, null] } });
628
2588
  };
2589
+ /**
2590
+ * Creates a reporter block for a boolean procedure argument.
2591
+ *
2592
+ * @param reference Boolean argument reference from `defineProcedure`.
2593
+ * @returns A reporter block that reads the current argument value.
2594
+ * @example
2595
+ * ```ts
2596
+ * import { argumentReporterBoolean } from 'hikkaku/blocks'
2597
+ *
2598
+ * argumentReporterBoolean(reference as any)
2599
+ * ```
2600
+ */
629
2601
  const argumentReporterBoolean = (reference) => {
630
2602
  return valueBlock("argument_reporter_boolean", {
631
2603
  fields: { VALUE: [reference.name, null] },
@@ -635,105 +2607,516 @@ const argumentReporterBoolean = (reference) => {
635
2607
 
636
2608
  //#endregion
637
2609
  //#region src/blocks/sensing.ts
2610
+ /**
2611
+ * Mouse position.
2612
+ *
2613
+ * Input: none.
2614
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
2615
+ *
2616
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
2617
+ * @example
2618
+ * ```ts
2619
+ * import { getMouseX } from 'hikkaku/blocks'
2620
+ *
2621
+ * getMouseX()
2622
+ * ```
2623
+ */
638
2624
  const getMouseX = () => {
639
2625
  return valueBlock("sensing_mousex", {});
640
2626
  };
2627
+ /**
2628
+ * getMouseY block helper.
2629
+ *
2630
+ * Input: none.
2631
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
2632
+ *
2633
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
2634
+ * @example
2635
+ * ```ts
2636
+ * import { getMouseY } from 'hikkaku/blocks'
2637
+ *
2638
+ * getMouseY()
2639
+ * ```
2640
+ */
641
2641
  const getMouseY = () => {
642
2642
  return valueBlock("sensing_mousey", {});
643
2643
  };
2644
+ /**
2645
+ * Touching target check.
2646
+ *
2647
+ * Input: `target`.
2648
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
2649
+ *
2650
+ * @param target See function signature for accepted input values.
2651
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
2652
+ * @example
2653
+ * ```ts
2654
+ * import { touchingObject } from 'hikkaku/blocks'
2655
+ *
2656
+ * touchingObject('mouse-pointer')
2657
+ * ```
2658
+ */
644
2659
  const touchingObject = (target) => {
645
2660
  return valueBlock("sensing_touchingobject", { inputs: { TOUCHINGOBJECTMENU: fromPrimitiveSource(target) } });
646
2661
  };
2662
+ /**
2663
+ * Touching color check.
2664
+ *
2665
+ * Input: `color`.
2666
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
2667
+ *
2668
+ * @param color See function signature for accepted input values.
2669
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
2670
+ * @example
2671
+ * ```ts
2672
+ * import { touchingColor } from 'hikkaku/blocks'
2673
+ *
2674
+ * touchingColor(undefined as any)
2675
+ * ```
2676
+ */
647
2677
  const touchingColor = (color) => {
648
2678
  return valueBlock("sensing_touchingcolor", { inputs: { COLOR: fromPrimitiveSource(color) } });
649
2679
  };
2680
+ /**
2681
+ * Color overlap check.
2682
+ *
2683
+ * Input: `color`, `targetColor`.
2684
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
2685
+ *
2686
+ * @param color See function signature for accepted input values.
2687
+ * @param targetColor See function signature for accepted input values.
2688
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
2689
+ * @example
2690
+ * ```ts
2691
+ * import { colorTouchingColor } from 'hikkaku/blocks'
2692
+ *
2693
+ * colorTouchingColor(undefined as any, undefined as any)
2694
+ * ```
2695
+ */
650
2696
  const colorTouchingColor = (color, targetColor) => {
651
2697
  return valueBlock("sensing_coloristouchingcolor", { inputs: {
652
2698
  COLOR: fromPrimitiveSource(color),
653
2699
  COLOR2: fromPrimitiveSource(targetColor)
654
2700
  } });
655
2701
  };
2702
+ /**
2703
+ * Distance to target.
2704
+ *
2705
+ * Input: `target`.
2706
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
2707
+ *
2708
+ * @param target See function signature for accepted input values.
2709
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
2710
+ * @example
2711
+ * ```ts
2712
+ * import { distanceTo } from 'hikkaku/blocks'
2713
+ *
2714
+ * distanceTo('mouse-pointer')
2715
+ * ```
2716
+ */
656
2717
  const distanceTo = (target) => {
657
2718
  return valueBlock("sensing_distanceto", { fields: { DISTANCETOMENU: [target, null] } });
658
2719
  };
2720
+ /**
2721
+ * Timer value.
2722
+ *
2723
+ * Input: none.
2724
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
2725
+ *
2726
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
2727
+ * @example
2728
+ * ```ts
2729
+ * import { getTimer } from 'hikkaku/blocks'
2730
+ *
2731
+ * getTimer()
2732
+ * ```
2733
+ */
659
2734
  const getTimer = () => {
660
2735
  return valueBlock("sensing_timer", {});
661
2736
  };
2737
+ /**
2738
+ * Resets timer.
2739
+ *
2740
+ * Input: none.
2741
+ * Output: Scratch statement block definition that is appended to the current script stack.
2742
+ *
2743
+ * @returns Scratch statement block definition that is appended to the current script stack.
2744
+ * @example
2745
+ * ```ts
2746
+ * import { resetTimer } from 'hikkaku/blocks'
2747
+ *
2748
+ * resetTimer()
2749
+ * ```
2750
+ */
662
2751
  const resetTimer = () => {
663
2752
  return block("sensing_resettimer", {});
664
2753
  };
2754
+ /**
2755
+ * Sets drag behavior.
2756
+ *
2757
+ * Input: `mode`.
2758
+ * Output: Scratch statement block definition that is appended to the current script stack.
2759
+ *
2760
+ * @param mode See function signature for accepted input values.
2761
+ * @returns Scratch statement block definition that is appended to the current script stack.
2762
+ * @example
2763
+ * ```ts
2764
+ * import { setDragMode } from 'hikkaku/blocks'
2765
+ *
2766
+ * setDragMode('draggable')
2767
+ * ```
2768
+ */
665
2769
  const setDragMode = (mode) => {
666
2770
  return block("sensing_setdragmode", { fields: { DRAG_MODE: [mode, null] } });
667
2771
  };
2772
+ /**
2773
+ * Mouse button state.
2774
+ *
2775
+ * Input: none.
2776
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
2777
+ *
2778
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
2779
+ * @example
2780
+ * ```ts
2781
+ * import { getMouseDown } from 'hikkaku/blocks'
2782
+ *
2783
+ * getMouseDown()
2784
+ * ```
2785
+ */
668
2786
  const getMouseDown = () => {
669
2787
  return valueBlock("sensing_mousedown", {});
670
2788
  };
2789
+ /**
2790
+ * Key state.
2791
+ *
2792
+ * Input: `key`.
2793
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
2794
+ *
2795
+ * @param key See function signature for accepted input values.
2796
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
2797
+ * @example
2798
+ * ```ts
2799
+ * import { getKeyPressed } from 'hikkaku/blocks'
2800
+ *
2801
+ * getKeyPressed('space')
2802
+ * ```
2803
+ */
671
2804
  const getKeyPressed = (key) => {
672
2805
  return valueBlock("sensing_keypressed", { inputs: { KEY_OPTION: fromPrimitiveSource(key) } });
673
2806
  };
2807
+ /**
2808
+ * Current date/time value.
2809
+ *
2810
+ * Input: `menu`.
2811
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
2812
+ *
2813
+ * @param menu See function signature for accepted input values.
2814
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
2815
+ * @example
2816
+ * ```ts
2817
+ * import { current } from 'hikkaku/blocks'
2818
+ *
2819
+ * current('loudness')
2820
+ * ```
2821
+ */
674
2822
  const current = (menu) => {
675
2823
  return valueBlock("sensing_current", { fields: { CURRENTMENU: [menu, null] } });
676
2824
  };
2825
+ /**
2826
+ * Reads target attribute.
2827
+ *
2828
+ * Input: `property`, `target`.
2829
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
2830
+ *
2831
+ * @param property See function signature for accepted input values.
2832
+ * @param target See function signature for accepted input values.
2833
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
2834
+ * @example
2835
+ * ```ts
2836
+ * import { getAttributeOf } from 'hikkaku/blocks'
2837
+ *
2838
+ * getAttributeOf(undefined as any, 'mouse-pointer')
2839
+ * ```
2840
+ */
677
2841
  const getAttributeOf = (property, target) => {
678
2842
  return valueBlock("sensing_of", { fields: {
679
2843
  PROPERTY: [property, null],
680
2844
  OBJECT: [target, null]
681
2845
  } });
682
2846
  };
2847
+ /**
2848
+ * Days since 2000-01-01.
2849
+ *
2850
+ * Input: none.
2851
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
2852
+ *
2853
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
2854
+ * @example
2855
+ * ```ts
2856
+ * import { daysSince2000 } from 'hikkaku/blocks'
2857
+ *
2858
+ * daysSince2000()
2859
+ * ```
2860
+ */
683
2861
  const daysSince2000 = () => {
684
2862
  return valueBlock("sensing_dayssince2000", {});
685
2863
  };
2864
+ /**
2865
+ * Microphone loudness.
2866
+ *
2867
+ * Input: none.
2868
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
2869
+ *
2870
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
2871
+ * @example
2872
+ * ```ts
2873
+ * import { getLoudness } from 'hikkaku/blocks'
2874
+ *
2875
+ * getLoudness()
2876
+ * ```
2877
+ */
686
2878
  const getLoudness = () => {
687
2879
  return valueBlock("sensing_loudness", {});
688
2880
  };
2881
+ /**
2882
+ * isLoud block helper.
2883
+ *
2884
+ * Input: none.
2885
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
2886
+ *
2887
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
2888
+ * @example
2889
+ * ```ts
2890
+ * import { isLoud } from 'hikkaku/blocks'
2891
+ *
2892
+ * isLoud()
2893
+ * ```
2894
+ */
689
2895
  const isLoud = () => {
690
2896
  return valueBlock("sensing_loud", {});
691
2897
  };
2898
+ /**
2899
+ * Asks user input.
2900
+ *
2901
+ * Input: `question`.
2902
+ * Output: Scratch statement block definition that is appended to the current script stack.
2903
+ *
2904
+ * @param question See function signature for accepted input values.
2905
+ * @returns Scratch statement block definition that is appended to the current script stack.
2906
+ * @example
2907
+ * ```ts
2908
+ * import { askAndWait } from 'hikkaku/blocks'
2909
+ *
2910
+ * askAndWait('Hello')
2911
+ * ```
2912
+ */
692
2913
  const askAndWait = (question) => {
693
2914
  return block("sensing_askandwait", { inputs: { QUESTION: fromPrimitiveSource(question) } });
694
2915
  };
2916
+ /**
2917
+ * Returns last answer.
2918
+ *
2919
+ * Input: none.
2920
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
2921
+ *
2922
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
2923
+ * @example
2924
+ * ```ts
2925
+ * import { getAnswer } from 'hikkaku/blocks'
2926
+ *
2927
+ * getAnswer()
2928
+ * ```
2929
+ */
695
2930
  const getAnswer = () => {
696
2931
  return valueBlock("sensing_answer", {});
697
2932
  };
2933
+ /**
2934
+ * Returns username.
2935
+ *
2936
+ * Input: none.
2937
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
2938
+ *
2939
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
2940
+ * @example
2941
+ * ```ts
2942
+ * import { getUsername } from 'hikkaku/blocks'
2943
+ *
2944
+ * getUsername()
2945
+ * ```
2946
+ */
698
2947
  const getUsername = () => {
699
2948
  return valueBlock("sensing_username", {});
700
2949
  };
701
2950
 
702
2951
  //#endregion
703
2952
  //#region src/blocks/sound.ts
2953
+ /**
2954
+ * Plays sound.
2955
+ *
2956
+ * Input: `sound`.
2957
+ * Output: Scratch statement block definition that is appended to the current script stack.
2958
+ *
2959
+ * @param sound See function signature for accepted input values.
2960
+ * @returns Scratch statement block definition that is appended to the current script stack.
2961
+ * @example
2962
+ * ```ts
2963
+ * import { playSound } from 'hikkaku/blocks'
2964
+ *
2965
+ * playSound('pop')
2966
+ * ```
2967
+ */
704
2968
  const playSound = (sound) => {
705
2969
  return block("sound_play", { inputs: { SOUND_MENU: fromSoundSource(sound) } });
706
2970
  };
2971
+ /**
2972
+ * Plays and waits.
2973
+ *
2974
+ * Input: `sound`.
2975
+ * Output: Scratch statement block definition that is appended to the current script stack.
2976
+ *
2977
+ * @param sound See function signature for accepted input values.
2978
+ * @returns Scratch statement block definition that is appended to the current script stack.
2979
+ * @example
2980
+ * ```ts
2981
+ * import { playSoundUntilDone } from 'hikkaku/blocks'
2982
+ *
2983
+ * playSoundUntilDone('pop')
2984
+ * ```
2985
+ */
707
2986
  const playSoundUntilDone = (sound) => {
708
2987
  return block("sound_playuntildone", { inputs: { SOUND_MENU: fromSoundSource(sound) } });
709
2988
  };
2989
+ /**
2990
+ * Stops all sounds.
2991
+ *
2992
+ * Input: none.
2993
+ * Output: Scratch statement block definition that is appended to the current script stack.
2994
+ *
2995
+ * @returns Scratch statement block definition that is appended to the current script stack.
2996
+ * @example
2997
+ * ```ts
2998
+ * import { stopAllSounds } from 'hikkaku/blocks'
2999
+ *
3000
+ * stopAllSounds()
3001
+ * ```
3002
+ */
710
3003
  const stopAllSounds = () => {
711
3004
  return block("sound_stopallsounds", {});
712
3005
  };
3006
+ /**
3007
+ * Sets sound effect.
3008
+ *
3009
+ * Input: `effect`, `value`.
3010
+ * Output: Scratch statement block definition that is appended to the current script stack.
3011
+ *
3012
+ * @param effect See function signature for accepted input values.
3013
+ * @param value See function signature for accepted input values.
3014
+ * @returns Scratch statement block definition that is appended to the current script stack.
3015
+ * @example
3016
+ * ```ts
3017
+ * import { setSoundEffectTo } from 'hikkaku/blocks'
3018
+ *
3019
+ * setSoundEffectTo('pitch', 10)
3020
+ * ```
3021
+ */
713
3022
  const setSoundEffectTo = (effect, value) => {
714
3023
  return block("sound_seteffectto", {
715
3024
  inputs: { VALUE: fromPrimitiveSource(value) },
716
3025
  fields: { EFFECT: [effect, null] }
717
3026
  });
718
3027
  };
3028
+ /**
3029
+ * Changes sound effect.
3030
+ *
3031
+ * Input: `effect`, `value`.
3032
+ * Output: Scratch statement block definition that is appended to the current script stack.
3033
+ *
3034
+ * @param effect See function signature for accepted input values.
3035
+ * @param value See function signature for accepted input values.
3036
+ * @returns Scratch statement block definition that is appended to the current script stack.
3037
+ * @example
3038
+ * ```ts
3039
+ * import { changeSoundEffectBy } from 'hikkaku/blocks'
3040
+ *
3041
+ * changeSoundEffectBy('pitch', 10)
3042
+ * ```
3043
+ */
719
3044
  const changeSoundEffectBy = (effect, value) => {
720
3045
  return block("sound_changeeffectby", {
721
3046
  inputs: { VALUE: fromPrimitiveSource(value) },
722
3047
  fields: { EFFECT: [effect, null] }
723
3048
  });
724
3049
  };
3050
+ /**
3051
+ * Clears sound effects.
3052
+ *
3053
+ * Input: none.
3054
+ * Output: Scratch statement block definition that is appended to the current script stack.
3055
+ *
3056
+ * @returns Scratch statement block definition that is appended to the current script stack.
3057
+ * @example
3058
+ * ```ts
3059
+ * import { clearEffects } from 'hikkaku/blocks'
3060
+ *
3061
+ * clearEffects()
3062
+ * ```
3063
+ */
725
3064
  const clearEffects = () => {
726
3065
  return block("sound_cleareffects", {});
727
3066
  };
3067
+ /**
3068
+ * Sets volume.
3069
+ *
3070
+ * Input: `value`.
3071
+ * Output: Scratch statement block definition that is appended to the current script stack.
3072
+ *
3073
+ * @param value See function signature for accepted input values.
3074
+ * @returns Scratch statement block definition that is appended to the current script stack.
3075
+ * @example
3076
+ * ```ts
3077
+ * import { setVolumeTo } from 'hikkaku/blocks'
3078
+ *
3079
+ * setVolumeTo(10)
3080
+ * ```
3081
+ */
728
3082
  const setVolumeTo = (value) => {
729
3083
  return block("sound_setvolumeto", { inputs: { VOLUME: fromPrimitiveSource(value) } });
730
3084
  };
3085
+ /**
3086
+ * Changes volume.
3087
+ *
3088
+ * Input: `value`.
3089
+ * Output: Scratch statement block definition that is appended to the current script stack.
3090
+ *
3091
+ * @param value See function signature for accepted input values.
3092
+ * @returns Scratch statement block definition that is appended to the current script stack.
3093
+ * @example
3094
+ * ```ts
3095
+ * import { changeVolumeBy } from 'hikkaku/blocks'
3096
+ *
3097
+ * changeVolumeBy(10)
3098
+ * ```
3099
+ */
731
3100
  const changeVolumeBy = (value) => {
732
3101
  return block("sound_changevolumeby", { inputs: { VOLUME: fromPrimitiveSource(value) } });
733
3102
  };
3103
+ /**
3104
+ * Returns volume.
3105
+ *
3106
+ * Input: none.
3107
+ * Output: Scratch reporter block definition that can be used as an input value in other blocks.
3108
+ *
3109
+ * @returns Scratch reporter block definition that can be used as an input value in other blocks.
3110
+ * @example
3111
+ * ```ts
3112
+ * import { getVolume } from 'hikkaku/blocks'
3113
+ *
3114
+ * getVolume()
3115
+ * ```
3116
+ */
734
3117
  const getVolume = () => {
735
3118
  return valueBlock("sound_volume", {});
736
3119
  };
737
3120
 
738
3121
  //#endregion
739
- export { CREATE_CLONE_MYSELF, add, addToList, allAtOnce, and, argumentReporterBoolean, argumentReporterStringNumber, askAndWait, broadcast, broadcastAndWait, callProcedure, changeLooksEffectBy, changePenColorParamBy, changePenHueBy, changePenShadeBy, changePenSizeBy, changeSizeBy, changeSoundEffectBy, changeVariableBy, changeVolumeBy, changeXBy, changeYBy, clear, clearCounter, clearEffects, clearGraphicEffects, colorTouchingColor, contains, controlStartAsClone, createClone, current, daysSince2000, defineProcedure, deleteAllOfList, deleteOfList, deleteThisClone, distanceTo, divide, equals, eraseAll, forEach, forever, getAnswer, getAttributeOf, getBackdropNumberName, getCostumeNumberName, getCounter, getDirection, getItemNumOfList, getItemOfList, getKeyPressed, getListContents, getLoudness, getMouseDown, getMouseX, getMouseY, getSize, getTimer, getUsername, getVariable, getVolume, getX, getY, glide, glideTo, goForwardBackwardLayers, goTo, goToFrontBack, gotoXY, gt, hide, hideList, hideVariable, ifElse, ifOnEdgeBounce, ifThen, incrCounter, insertAtList, isLoud, join, length, lengthOfList, letterOf, listContainsItem, lt, mathop, mod, moveSteps, multiply, nextBackdrop, nextCostume, not, or, penDown, penUp, playSound, playSoundUntilDone, pointInDirection, pointTowards, procedureBoolean, procedureLabel, procedureStringOrNumber, random, repeat, repeatUntil, repeatWhile, replaceItemOfList, resetTimer, round, say, sayForSecs, setDragMode, setLooksEffectTo, setPenColorParamTo, setPenColorTo, setPenColorToColor, setPenHueToNumber, setPenShadeToNumber, setPenSizeTo, setRotationStyle, setSizeTo, setSoundEffectTo, setVariableTo, setVolumeTo, setX, setY, show, showList, showVariable, stamp, stop, stopAllSounds, subtract, switchBackdropTo, switchBackdropToAndWait, switchCostumeTo, think, thinkForSecs, touchingColor, touchingObject, turnLeft, turnRight, wait, waitUntil, whenBackdropSwitchesTo, whenBroadcastReceived, whenFlagClicked, whenGreaterThan, whenKeyPressed, whenStageClicked, whenThisSpriteClicked, whenTouchingObject };
3122
+ export { CREATE_CLONE_MYSELF, add, addToList, allAtOnce, and, argumentReporterBoolean, argumentReporterStringNumber, askAndWait, broadcast, broadcastAndWait, callProcedure, changeLooksEffectBy, changePenColorParamBy, changePenHueBy, changePenShadeBy, changePenSizeBy, changeSizeBy, changeSoundEffectBy, changeVariableBy, changeVolumeBy, changeXBy, changeYBy, clear, clearCounter, clearEffects, clearGraphicEffects, colorTouchingColor, contains, controlStartAsClone, createClone, current, daysSince2000, defineProcedure, deleteAllOfList, deleteOfList, deleteThisClone, distanceTo, divide, equals, eraseAll, forEach, forever, getAnswer, getAttributeOf, getBackdropNumberName, getCostumeNumberName, getCounter, getDirection, getItemNumOfList, getItemOfList, getKeyPressed, getListContents, getLoudness, getMouseDown, getMouseX, getMouseY, getSize, getTimer, getUsername, getVariable, getVolume, getX, getY, glide, glideTo, goForwardBackwardLayers, goTo, goToFrontBack, gotoXY, gt, hide, hideList, hideVariable, ifElse, ifOnEdgeBounce, ifThen, incrCounter, insertAtList, isLoud, join, length, lengthOfList, letterOf, listContainsItem, lt, match, mathop, mod, moveSteps, multiply, nextBackdrop, nextCostume, not, or, penDown, penUp, playSound, playSoundUntilDone, pointInDirection, pointTowards, procedureBoolean, procedureLabel, procedureStringOrNumber, random, repeat, repeatUntil, repeatWhile, replaceItemOfList, resetTimer, round, say, sayForSecs, setDragMode, setLooksEffectTo, setPenColorParamTo, setPenColorTo, setPenColorToColor, setPenHueToNumber, setPenShadeToNumber, setPenSizeTo, setRotationStyle, setSizeTo, setSoundEffectTo, setVariableTo, setVolumeTo, setX, setY, show, showList, showVariable, stamp, stop, stopAllSounds, subtract, switchBackdropTo, switchBackdropToAndWait, switchCostumeTo, think, thinkForSecs, touchingColor, touchingObject, turnLeft, turnRight, wait, waitUntil, whenBackdropSwitchesTo, whenBroadcastReceived, whenFlagClicked, whenGreaterThan, whenKeyPressed, whenStageClicked, whenThisSpriteClicked, whenTouchingObject };