hikkaku 0.3.1 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,6 +4,8 @@
4
4
 
5
5
  [![NPM Version](https://img.shields.io/npm/v/hikkaku)](https://www.npmjs.com/package/hikkaku)
6
6
 
7
+ [Docs](https://pnsk-lab.github.io/hikkaku/) | [Playground](https://pnsk-lab.github.io/playground/)
8
+
7
9
  Scratch with TypeScript.
8
10
 
9
11
  ## Installation
@@ -150,4 +152,7 @@ npx skills add pnsk-lab/hikkaku/packages/skill # npm
150
152
 
151
153
  ### Build project
152
154
 
153
- Not support yet. To get .sb3 file, you need to download the project file using dev server, or manually convert JSON to .sb3 using external tools.
155
+ With Vite Plugin:
156
+ ```ts
157
+ vite build
158
+ ```
@@ -1,4 +1,4 @@
1
- import { D as SoundSource, M as VariableReference, g as CostumeSource, w as PrimitiveSource, x as ListReference, y as HikkakuBlock } from "../project-djJPtrq7.mjs";
1
+ import { E as ListReference, L as VariableReference, M as SoundSource, k as PrimitiveSource, w as HikkakuBlock, x as CostumeSource } from "../project-CpV5Dm-X.mjs";
2
2
 
3
3
  //#region src/blocks/control.d.ts
4
4
  type StopOption = 'all' | 'this script' | 'other scripts in sprite' | 'other scripts in stage';
@@ -67,7 +67,7 @@ declare const repeatWhile: (condition: PrimitiveSource<boolean>, handler: () =>
67
67
  * ```ts
68
68
  * import { forEach } from 'hikkaku/blocks'
69
69
  *
70
- * forEach(variable as any, 10, () => {})
70
+ * forEach(variable, 10, () => {})
71
71
  * ```
72
72
  */
73
73
  declare const forEach: (variable: VariableReference, value: PrimitiveSource<number>, handler: () => void) => HikkakuBlock;
@@ -212,10 +212,11 @@ declare const CREATE_CLONE_MYSELF = "_myself_";
212
212
  * ```ts
213
213
  * import { createClone } from 'hikkaku/blocks'
214
214
  *
215
- * createClone('mouse-pointer')
215
+ * createClone('Sprite1')
216
216
  * ```
217
217
  */
218
218
  declare const createClone: (target: PrimitiveSource<string>) => HikkakuBlock;
219
+ declare const menuOfCreateClone: (target?: (string & {}) | typeof CREATE_CLONE_MYSELF) => HikkakuBlock;
219
220
  /**
220
221
  * Deletes the current clone.
221
222
  *
@@ -323,7 +324,7 @@ type ListIndex = PrimitiveSource<number | string>;
323
324
  * ```ts
324
325
  * import { getVariable } from 'hikkaku/blocks'
325
326
  *
326
- * getVariable(variable as any)
327
+ * getVariable(variable)
327
328
  * ```
328
329
  */
329
330
  declare const getVariable: (variable: VariableReference) => HikkakuBlock;
@@ -340,7 +341,7 @@ declare const getVariable: (variable: VariableReference) => HikkakuBlock;
340
341
  * ```ts
341
342
  * import { setVariableTo } from 'hikkaku/blocks'
342
343
  *
343
- * setVariableTo(variable as any, 10)
344
+ * setVariableTo(variable, 10)
344
345
  * ```
345
346
  */
346
347
  declare const setVariableTo: (variable: VariableReference, value: PrimitiveSource<number | string>) => HikkakuBlock;
@@ -357,7 +358,7 @@ declare const setVariableTo: (variable: VariableReference, value: PrimitiveSourc
357
358
  * ```ts
358
359
  * import { changeVariableBy } from 'hikkaku/blocks'
359
360
  *
360
- * changeVariableBy(variable as any, 10)
361
+ * changeVariableBy(variable, 10)
361
362
  * ```
362
363
  */
363
364
  declare const changeVariableBy: (variable: VariableReference, value: PrimitiveSource<number>) => HikkakuBlock;
@@ -373,7 +374,7 @@ declare const changeVariableBy: (variable: VariableReference, value: PrimitiveSo
373
374
  * ```ts
374
375
  * import { showVariable } from 'hikkaku/blocks'
375
376
  *
376
- * showVariable(variable as any)
377
+ * showVariable(variable)
377
378
  * ```
378
379
  */
379
380
  declare const showVariable: (variable: VariableReference) => HikkakuBlock;
@@ -389,7 +390,7 @@ declare const showVariable: (variable: VariableReference) => HikkakuBlock;
389
390
  * ```ts
390
391
  * import { hideVariable } from 'hikkaku/blocks'
391
392
  *
392
- * hideVariable(variable as any)
393
+ * hideVariable(variable)
393
394
  * ```
394
395
  */
395
396
  declare const hideVariable: (variable: VariableReference) => HikkakuBlock;
@@ -405,7 +406,7 @@ declare const hideVariable: (variable: VariableReference) => HikkakuBlock;
405
406
  * ```ts
406
407
  * import { getListContents } from 'hikkaku/blocks'
407
408
  *
408
- * getListContents(list as any)
409
+ * getListContents(list)
409
410
  * ```
410
411
  */
411
412
  declare const getListContents: (list: ListReference) => HikkakuBlock;
@@ -422,7 +423,7 @@ declare const getListContents: (list: ListReference) => HikkakuBlock;
422
423
  * ```ts
423
424
  * import { addToList } from 'hikkaku/blocks'
424
425
  *
425
- * addToList(list as any, undefined as any)
426
+ * addToList(list, "banana")
426
427
  * ```
427
428
  */
428
429
  declare const addToList: (list: ListReference, item: PrimitiveSource<string | number>) => HikkakuBlock;
@@ -439,7 +440,7 @@ declare const addToList: (list: ListReference, item: PrimitiveSource<string | nu
439
440
  * ```ts
440
441
  * import { deleteOfList } from 'hikkaku/blocks'
441
442
  *
442
- * deleteOfList(list as any, undefined as any)
443
+ * deleteOfList(list, 1)
443
444
  * ```
444
445
  */
445
446
  declare const deleteOfList: (list: ListReference, index: ListIndex) => HikkakuBlock;
@@ -455,7 +456,7 @@ declare const deleteOfList: (list: ListReference, index: ListIndex) => HikkakuBl
455
456
  * ```ts
456
457
  * import { deleteAllOfList } from 'hikkaku/blocks'
457
458
  *
458
- * deleteAllOfList(list as any)
459
+ * deleteAllOfList(list)
459
460
  * ```
460
461
  */
461
462
  declare const deleteAllOfList: (list: ListReference) => HikkakuBlock;
@@ -473,7 +474,7 @@ declare const deleteAllOfList: (list: ListReference) => HikkakuBlock;
473
474
  * ```ts
474
475
  * import { insertAtList } from 'hikkaku/blocks'
475
476
  *
476
- * insertAtList(list as any, undefined as any, undefined as any)
477
+ * insertAtList(list, 42, "banana")
477
478
  * ```
478
479
  */
479
480
  declare const insertAtList: (list: ListReference, index: ListIndex, item: PrimitiveSource<string | number>) => HikkakuBlock;
@@ -491,7 +492,7 @@ declare const insertAtList: (list: ListReference, index: ListIndex, item: Primit
491
492
  * ```ts
492
493
  * import { replaceItemOfList } from 'hikkaku/blocks'
493
494
  *
494
- * replaceItemOfList(list as any, undefined as any, undefined as any)
495
+ * replaceItemOfList(list, 42, "banana")
495
496
  * ```
496
497
  */
497
498
  declare const replaceItemOfList: (list: ListReference, index: ListIndex, item: PrimitiveSource<string | number>) => HikkakuBlock;
@@ -508,7 +509,7 @@ declare const replaceItemOfList: (list: ListReference, index: ListIndex, item: P
508
509
  * ```ts
509
510
  * import { getItemOfList } from 'hikkaku/blocks'
510
511
  *
511
- * getItemOfList(list as any, undefined as any)
512
+ * getItemOfList(list, 1)
512
513
  * ```
513
514
  */
514
515
  declare const getItemOfList: (list: ListReference, index: ListIndex) => HikkakuBlock;
@@ -525,7 +526,7 @@ declare const getItemOfList: (list: ListReference, index: ListIndex) => HikkakuB
525
526
  * ```ts
526
527
  * import { getItemNumOfList } from 'hikkaku/blocks'
527
528
  *
528
- * getItemNumOfList(list as any, undefined as any)
529
+ * getItemNumOfList(list, "banana")
529
530
  * ```
530
531
  */
531
532
  declare const getItemNumOfList: (list: ListReference, item: PrimitiveSource<string | number>) => HikkakuBlock;
@@ -541,7 +542,7 @@ declare const getItemNumOfList: (list: ListReference, item: PrimitiveSource<stri
541
542
  * ```ts
542
543
  * import { lengthOfList } from 'hikkaku/blocks'
543
544
  *
544
- * lengthOfList(list as any)
545
+ * lengthOfList(list)
545
546
  * ```
546
547
  */
547
548
  declare const lengthOfList: (list: ListReference) => HikkakuBlock;
@@ -558,7 +559,7 @@ declare const lengthOfList: (list: ListReference) => HikkakuBlock;
558
559
  * ```ts
559
560
  * import { listContainsItem } from 'hikkaku/blocks'
560
561
  *
561
- * listContainsItem(list as any, undefined as any)
562
+ * listContainsItem(list,"banana")
562
563
  * ```
563
564
  */
564
565
  declare const listContainsItem: (list: ListReference, item: PrimitiveSource<string | number>) => HikkakuBlock;
@@ -574,7 +575,7 @@ declare const listContainsItem: (list: ListReference, item: PrimitiveSource<stri
574
575
  * ```ts
575
576
  * import { showList } from 'hikkaku/blocks'
576
577
  *
577
- * showList(list as any)
578
+ * showList(list)
578
579
  * ```
579
580
  */
580
581
  declare const showList: (list: ListReference) => HikkakuBlock;
@@ -590,7 +591,7 @@ declare const showList: (list: ListReference) => HikkakuBlock;
590
591
  * ```ts
591
592
  * import { hideList } from 'hikkaku/blocks'
592
593
  *
593
- * hideList(list as any)
594
+ * hideList(list)
594
595
  * ```
595
596
  */
596
597
  declare const hideList: (list: ListReference) => HikkakuBlock;
@@ -880,6 +881,7 @@ declare const hide: () => HikkakuBlock;
880
881
  * ```
881
882
  */
882
883
  declare const switchCostumeTo: (costume: CostumeSource) => HikkakuBlock;
884
+ declare const menuOfCostume: (costume?: string) => HikkakuBlock;
883
885
  /**
884
886
  * Next costume.
885
887
  *
@@ -911,6 +913,7 @@ declare const nextCostume: () => HikkakuBlock;
911
913
  * ```
912
914
  */
913
915
  declare const switchBackdropTo: (backdrop: PrimitiveSource<string>) => HikkakuBlock;
916
+ declare const menuOfBackdrop: (backdrop?: string) => HikkakuBlock;
914
917
  /**
915
918
  * Switch backdrop and wait.
916
919
  *
@@ -1117,7 +1120,7 @@ declare const getBackdropNumberName: (value: NumberName) => HikkakuBlock;
1117
1120
  * ```ts
1118
1121
  * import { moveSteps } from 'hikkaku/blocks'
1119
1122
  *
1120
- * moveSteps(undefined as any)
1123
+ * moveSteps(10)
1121
1124
  * ```
1122
1125
  */
1123
1126
  declare const moveSteps: (steps: PrimitiveSource<number>) => HikkakuBlock;
@@ -1217,7 +1220,9 @@ declare const setY: (y: PrimitiveSource<number>) => HikkakuBlock;
1217
1220
  * goTo('mouse-pointer')
1218
1221
  * ```
1219
1222
  */
1220
- declare const goTo: (target: string) => HikkakuBlock;
1223
+ declare const goTo: (target: PrimitiveSource<string>) => HikkakuBlock;
1224
+ declare const GOTO_RANDOM = "_random_";
1225
+ declare const menuOfGoTo: (target?: string) => HikkakuBlock;
1221
1226
  /**
1222
1227
  * Turns right.
1223
1228
  *
@@ -1281,7 +1286,8 @@ declare const pointInDirection: (direction: PrimitiveSource<number>) => HikkakuB
1281
1286
  * pointTowards('mouse-pointer')
1282
1287
  * ```
1283
1288
  */
1284
- declare const pointTowards: (target: string) => HikkakuBlock;
1289
+ declare const pointTowards: (target: PrimitiveSource<string>) => HikkakuBlock;
1290
+ declare const menuOfPointTowards: (target?: string) => HikkakuBlock;
1285
1291
  /**
1286
1292
  * Glides to position.
1287
1293
  *
@@ -1316,7 +1322,8 @@ declare const glide: (seconds: PrimitiveSource<number>, x: PrimitiveSource<numbe
1316
1322
  * glideTo(10, 'mouse-pointer')
1317
1323
  * ```
1318
1324
  */
1319
- declare const glideTo: (seconds: PrimitiveSource<number>, target: string) => HikkakuBlock;
1325
+ declare const glideTo: (seconds: PrimitiveSource<number>, target: PrimitiveSource<string>) => HikkakuBlock;
1326
+ declare const menuOfGlideTo: (target?: string) => HikkakuBlock;
1320
1327
  /**
1321
1328
  * Bounces on edge.
1322
1329
  *
@@ -1927,7 +1934,7 @@ declare const penUp: () => HikkakuBlock;
1927
1934
  /**
1928
1935
  * Sets pen color.
1929
1936
  *
1930
- * Input: `color`.
1937
+ * Input: `color`. like: #ffffff, #fff. This does not accept values like "red" or "green" that CSS accepts.
1931
1938
  * Output: Scratch statement block definition that is appended to the current script stack.
1932
1939
  *
1933
1940
  * @param color See function signature for accepted input values.
@@ -1936,10 +1943,10 @@ declare const penUp: () => HikkakuBlock;
1936
1943
  * ```ts
1937
1944
  * import { setPenColorTo } from 'hikkaku/blocks'
1938
1945
  *
1939
- * setPenColorTo(undefined as any)
1946
+ * setPenColorTo("#ff0000")
1940
1947
  * ```
1941
1948
  */
1942
- declare const setPenColorTo: (color: PrimitiveSource<string>) => HikkakuBlock;
1949
+ declare const setPenColorTo: (color: PrimitiveSource<`#${string}` | (string & {})>) => HikkakuBlock;
1943
1950
  /**
1944
1951
  * Alias for {@link setPenColorTo}.
1945
1952
  *
@@ -1954,7 +1961,7 @@ declare const setPenColorTo: (color: PrimitiveSource<string>) => HikkakuBlock;
1954
1961
  * setPenColorToColor('#ff0000')
1955
1962
  * ```
1956
1963
  */
1957
- declare const setPenColorToColor: (color: PrimitiveSource<string>) => HikkakuBlock;
1964
+ declare const setPenColorToColor: (color: PrimitiveSource<`#${string}` | (string & {})>) => HikkakuBlock;
1958
1965
  /**
1959
1966
  * Changes pen color parameter by amount.
1960
1967
  *
@@ -1968,10 +1975,11 @@ declare const setPenColorToColor: (color: PrimitiveSource<string>) => HikkakuBlo
1968
1975
  * ```ts
1969
1976
  * import { changePenColorParamBy } from 'hikkaku/blocks'
1970
1977
  *
1971
- * changePenColorParamBy(undefined as any, 10)
1978
+ * changePenColorParamBy('color', 10)
1972
1979
  * ```
1973
1980
  */
1974
1981
  declare const changePenColorParamBy: (param: PrimitiveSource<PenColorParam>, value: PrimitiveSource<number>) => HikkakuBlock;
1982
+ declare const menuOfPenColorParam: (colorParam?: PenColorParam) => HikkakuBlock;
1975
1983
  /**
1976
1984
  * Sets pen color parameter to value.
1977
1985
  *
@@ -1985,7 +1993,7 @@ declare const changePenColorParamBy: (param: PrimitiveSource<PenColorParam>, val
1985
1993
  * ```ts
1986
1994
  * import { setPenColorParamTo } from 'hikkaku/blocks'
1987
1995
  *
1988
- * setPenColorParamTo(undefined as any, 10)
1996
+ * setPenColorParamTo('color', 10)
1989
1997
  * ```
1990
1998
  */
1991
1999
  declare const setPenColorParamTo: (param: PrimitiveSource<PenColorParam>, value: PrimitiveSource<number>) => HikkakuBlock;
@@ -2307,6 +2315,7 @@ type DragMode = 'draggable' | 'not draggable';
2307
2315
  * ```
2308
2316
  */
2309
2317
  declare const touchingObject: (target: string) => HikkakuBlock;
2318
+ declare const menuOfTouchingObject: (target?: string) => HikkakuBlock;
2310
2319
  /**
2311
2320
  * Touching color check.
2312
2321
  *
@@ -2319,10 +2328,10 @@ declare const touchingObject: (target: string) => HikkakuBlock;
2319
2328
  * ```ts
2320
2329
  * import { touchingColor } from 'hikkaku/blocks'
2321
2330
  *
2322
- * touchingColor(undefined as any)
2331
+ * touchingColor("#ff0000")
2323
2332
  * ```
2324
2333
  */
2325
- declare const touchingColor: (color: PrimitiveSource<string>) => HikkakuBlock;
2334
+ declare const touchingColor: (color: PrimitiveSource<`#${string}`>) => HikkakuBlock;
2326
2335
  /**
2327
2336
  * Color overlap check.
2328
2337
  *
@@ -2336,10 +2345,10 @@ declare const touchingColor: (color: PrimitiveSource<string>) => HikkakuBlock;
2336
2345
  * ```ts
2337
2346
  * import { colorTouchingColor } from 'hikkaku/blocks'
2338
2347
  *
2339
- * colorTouchingColor(undefined as any, undefined as any)
2348
+ * colorTouchingColor("#ff0000", "#00ff00")
2340
2349
  * ```
2341
2350
  */
2342
- declare const colorTouchingColor: (color: PrimitiveSource<string>, targetColor: PrimitiveSource<string>) => HikkakuBlock;
2351
+ declare const colorTouchingColor: (color: PrimitiveSource<`#${string}`>, targetColor: PrimitiveSource<`#${string}`>) => HikkakuBlock;
2343
2352
  /**
2344
2353
  * Distance to target.
2345
2354
  *
@@ -2356,6 +2365,7 @@ declare const colorTouchingColor: (color: PrimitiveSource<string>, targetColor:
2356
2365
  * ```
2357
2366
  */
2358
2367
  declare const distanceTo: (target: string) => HikkakuBlock;
2368
+ declare const menuOfDistanceTo: (target?: string) => HikkakuBlock;
2359
2369
  /**
2360
2370
  * Timer value.
2361
2371
  *
@@ -2433,6 +2443,7 @@ declare const getMouseDown: () => HikkakuBlock;
2433
2443
  * ```
2434
2444
  */
2435
2445
  declare const getKeyPressed: (key: PrimitiveSource<string>) => HikkakuBlock;
2446
+ declare const menuOfKeyOptions: (key?: string) => HikkakuBlock;
2436
2447
  /**
2437
2448
  * Current date/time value.
2438
2449
  *
@@ -2462,10 +2473,11 @@ declare const current: (menu: CurrentMenu) => HikkakuBlock;
2462
2473
  * ```ts
2463
2474
  * import { getAttributeOf } from 'hikkaku/blocks'
2464
2475
  *
2465
- * getAttributeOf(undefined as any, 'mouse-pointer')
2476
+ * getAttributeOf('x position', 'cat')
2466
2477
  * ```
2467
2478
  */
2468
2479
  declare const getAttributeOf: (property: string, target: string) => HikkakuBlock;
2480
+ declare const menuOfAttributeObject: (object?: string) => HikkakuBlock;
2469
2481
  /**
2470
2482
  * Days since 2000-01-01.
2471
2483
  *
@@ -2609,6 +2621,7 @@ declare const playSound: (sound: SoundSource) => HikkakuBlock;
2609
2621
  * ```
2610
2622
  */
2611
2623
  declare const playSoundUntilDone: (sound: SoundSource) => HikkakuBlock;
2624
+ declare const menuOfSounds: (sound?: string) => HikkakuBlock;
2612
2625
  /**
2613
2626
  * Stops all sounds.
2614
2627
  *
@@ -2721,4 +2734,4 @@ declare const changeVolumeBy: (value: PrimitiveSource<number>) => HikkakuBlock;
2721
2734
  */
2722
2735
  declare const getVolume: () => HikkakuBlock;
2723
2736
  //#endregion
2724
- export { CREATE_CLONE_MYSELF, CurrentMenu, DragMode, ForwardBackward, FrontBack, ListIndex, LookEffect, MathOpOperator, NumberName, PenColorParam, ProcedureArgumentDefault, ProcedureBooleanReference, ProcedureCallInput, ProcedureDefinition, ProcedureDefinitionReference, ProcedureProc, ProcedureProcBoolean, ProcedureProcLabel, ProcedureProcStringOrNumber, ProcedureReference, ProcedureReferenceBase, ProcedureStringOrNumberReference, SoundEffect, StopOption, add, addToList, allAtOnce, and, argumentReporterBoolean, argumentReporterStringNumber, askAndWait, broadcast, broadcastAndWait, callProcedure, changeLooksEffectBy, changePenColorParamBy, changePenHueBy, changePenShadeBy, changePenSizeBy, changeSizeBy, changeSoundEffectBy, changeTempo, 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, getTempo, 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, midiPlayDrumForBeats, midiSetInstrument, mod, moveSteps, multiply, nextBackdrop, nextCostume, not, or, penDown, penUp, playDrumForBeats, playNoteForBeats, playSound, playSoundUntilDone, pointInDirection, pointTowards, procedureBoolean, procedureLabel, procedureStringOrNumber, random, repeat, repeatUntil, repeatWhile, replaceItemOfList, resetTimer, restForBeats, round, say, sayForSecs, setDragMode, setInstrument, setLooksEffectTo, setPenColorParamTo, setPenColorTo, setPenColorToColor, setPenHueToNumber, setPenShadeToNumber, setPenSizeTo, setRotationStyle, setSizeTo, setSoundEffectTo, setTempo, 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 };
2737
+ export { CREATE_CLONE_MYSELF, CurrentMenu, DragMode, ForwardBackward, FrontBack, GOTO_RANDOM, ListIndex, LookEffect, MathOpOperator, NumberName, PenColorParam, ProcedureArgumentDefault, ProcedureBooleanReference, ProcedureCallInput, ProcedureDefinition, ProcedureDefinitionReference, ProcedureProc, ProcedureProcBoolean, ProcedureProcLabel, ProcedureProcStringOrNumber, ProcedureReference, ProcedureReferenceBase, ProcedureStringOrNumberReference, SoundEffect, StopOption, add, addToList, allAtOnce, and, argumentReporterBoolean, argumentReporterStringNumber, askAndWait, broadcast, broadcastAndWait, callProcedure, changeLooksEffectBy, changePenColorParamBy, changePenHueBy, changePenShadeBy, changePenSizeBy, changeSizeBy, changeSoundEffectBy, changeTempo, 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, getTempo, 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, menuOfAttributeObject, menuOfBackdrop, menuOfCostume, menuOfCreateClone, menuOfDistanceTo, menuOfGlideTo, menuOfGoTo, menuOfKeyOptions, menuOfPenColorParam, menuOfPointTowards, menuOfSounds, menuOfTouchingObject, midiPlayDrumForBeats, midiSetInstrument, mod, moveSteps, multiply, nextBackdrop, nextCostume, not, or, penDown, penUp, playDrumForBeats, playNoteForBeats, playSound, playSoundUntilDone, pointInDirection, pointTowards, procedureBoolean, procedureLabel, procedureStringOrNumber, random, repeat, repeatUntil, repeatWhile, replaceItemOfList, resetTimer, restForBeats, round, say, sayForSecs, setDragMode, setInstrument, setLooksEffectTo, setPenColorParamTo, setPenColorTo, setPenColorToColor, setPenHueToNumber, setPenShadeToNumber, setPenSizeTo, setRotationStyle, setSizeTo, setSoundEffectTo, setTempo, 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 };
package/blocks/index.mjs CHANGED
@@ -1,4 +1,4 @@
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-DpyUR2R3.mjs";
1
+ import { a as valueBlock, d as menuInput, f as unwrapCostumeSource, h as Shadow, i as substack, m as InputType, n as block, o as fromPrimitiveSource, p as unwrapSoundSource, s as fromPrimitiveSourceColor, t as attachStack } from "../composer-bPcsVhIg.mjs";
2
2
 
3
3
  //#region src/blocks/control.ts
4
4
  /**
@@ -84,7 +84,7 @@ const repeatWhile = (condition, handler) => {
84
84
  * ```ts
85
85
  * import { forEach } from 'hikkaku/blocks'
86
86
  *
87
- * forEach(variable as any, 10, () => {})
87
+ * forEach(variable, 10, () => {})
88
88
  * ```
89
89
  */
90
90
  const forEach = (variable, value, handler) => {
@@ -278,11 +278,17 @@ const CREATE_CLONE_MYSELF = "_myself_";
278
278
  * ```ts
279
279
  * import { createClone } from 'hikkaku/blocks'
280
280
  *
281
- * createClone('mouse-pointer')
281
+ * createClone('Sprite1')
282
282
  * ```
283
283
  */
284
284
  const createClone = (target) => {
285
- return block("control_create_clone_of", { inputs: { CLONE_OPTION: fromPrimitiveSource(target) } });
285
+ return block("control_create_clone_of", { inputs: { CLONE_OPTION: menuInput(target, menuOfCreateClone) } });
286
+ };
287
+ const menuOfCreateClone = (target = CREATE_CLONE_MYSELF) => {
288
+ return valueBlock("control_create_clone_of_menu", {
289
+ fields: { CLONE_OPTION: [target, null] },
290
+ isShadow: true
291
+ });
286
292
  };
287
293
  /**
288
294
  * Deletes the current clone.
@@ -407,7 +413,7 @@ const toField = (field) => [field.name, field.id];
407
413
  * ```ts
408
414
  * import { getVariable } from 'hikkaku/blocks'
409
415
  *
410
- * getVariable(variable as any)
416
+ * getVariable(variable)
411
417
  * ```
412
418
  */
413
419
  const getVariable = (variable) => {
@@ -426,7 +432,7 @@ const getVariable = (variable) => {
426
432
  * ```ts
427
433
  * import { setVariableTo } from 'hikkaku/blocks'
428
434
  *
429
- * setVariableTo(variable as any, 10)
435
+ * setVariableTo(variable, 10)
430
436
  * ```
431
437
  */
432
438
  const setVariableTo = (variable, value) => {
@@ -448,7 +454,7 @@ const setVariableTo = (variable, value) => {
448
454
  * ```ts
449
455
  * import { changeVariableBy } from 'hikkaku/blocks'
450
456
  *
451
- * changeVariableBy(variable as any, 10)
457
+ * changeVariableBy(variable, 10)
452
458
  * ```
453
459
  */
454
460
  const changeVariableBy = (variable, value) => {
@@ -469,7 +475,7 @@ const changeVariableBy = (variable, value) => {
469
475
  * ```ts
470
476
  * import { showVariable } from 'hikkaku/blocks'
471
477
  *
472
- * showVariable(variable as any)
478
+ * showVariable(variable)
473
479
  * ```
474
480
  */
475
481
  const showVariable = (variable) => {
@@ -487,7 +493,7 @@ const showVariable = (variable) => {
487
493
  * ```ts
488
494
  * import { hideVariable } from 'hikkaku/blocks'
489
495
  *
490
- * hideVariable(variable as any)
496
+ * hideVariable(variable)
491
497
  * ```
492
498
  */
493
499
  const hideVariable = (variable) => {
@@ -505,7 +511,7 @@ const hideVariable = (variable) => {
505
511
  * ```ts
506
512
  * import { getListContents } from 'hikkaku/blocks'
507
513
  *
508
- * getListContents(list as any)
514
+ * getListContents(list)
509
515
  * ```
510
516
  */
511
517
  const getListContents = (list) => {
@@ -524,7 +530,7 @@ const getListContents = (list) => {
524
530
  * ```ts
525
531
  * import { addToList } from 'hikkaku/blocks'
526
532
  *
527
- * addToList(list as any, undefined as any)
533
+ * addToList(list, "banana")
528
534
  * ```
529
535
  */
530
536
  const addToList = (list, item) => {
@@ -546,7 +552,7 @@ const addToList = (list, item) => {
546
552
  * ```ts
547
553
  * import { deleteOfList } from 'hikkaku/blocks'
548
554
  *
549
- * deleteOfList(list as any, undefined as any)
555
+ * deleteOfList(list, 1)
550
556
  * ```
551
557
  */
552
558
  const deleteOfList = (list, index) => {
@@ -567,7 +573,7 @@ const deleteOfList = (list, index) => {
567
573
  * ```ts
568
574
  * import { deleteAllOfList } from 'hikkaku/blocks'
569
575
  *
570
- * deleteAllOfList(list as any)
576
+ * deleteAllOfList(list)
571
577
  * ```
572
578
  */
573
579
  const deleteAllOfList = (list) => {
@@ -587,7 +593,7 @@ const deleteAllOfList = (list) => {
587
593
  * ```ts
588
594
  * import { insertAtList } from 'hikkaku/blocks'
589
595
  *
590
- * insertAtList(list as any, undefined as any, undefined as any)
596
+ * insertAtList(list, 42, "banana")
591
597
  * ```
592
598
  */
593
599
  const insertAtList = (list, index, item) => {
@@ -613,7 +619,7 @@ const insertAtList = (list, index, item) => {
613
619
  * ```ts
614
620
  * import { replaceItemOfList } from 'hikkaku/blocks'
615
621
  *
616
- * replaceItemOfList(list as any, undefined as any, undefined as any)
622
+ * replaceItemOfList(list, 42, "banana")
617
623
  * ```
618
624
  */
619
625
  const replaceItemOfList = (list, index, item) => {
@@ -638,7 +644,7 @@ const replaceItemOfList = (list, index, item) => {
638
644
  * ```ts
639
645
  * import { getItemOfList } from 'hikkaku/blocks'
640
646
  *
641
- * getItemOfList(list as any, undefined as any)
647
+ * getItemOfList(list, 1)
642
648
  * ```
643
649
  */
644
650
  const getItemOfList = (list, index) => {
@@ -660,7 +666,7 @@ const getItemOfList = (list, index) => {
660
666
  * ```ts
661
667
  * import { getItemNumOfList } from 'hikkaku/blocks'
662
668
  *
663
- * getItemNumOfList(list as any, undefined as any)
669
+ * getItemNumOfList(list, "banana")
664
670
  * ```
665
671
  */
666
672
  const getItemNumOfList = (list, item) => {
@@ -681,7 +687,7 @@ const getItemNumOfList = (list, item) => {
681
687
  * ```ts
682
688
  * import { lengthOfList } from 'hikkaku/blocks'
683
689
  *
684
- * lengthOfList(list as any)
690
+ * lengthOfList(list)
685
691
  * ```
686
692
  */
687
693
  const lengthOfList = (list) => {
@@ -700,7 +706,7 @@ const lengthOfList = (list) => {
700
706
  * ```ts
701
707
  * import { listContainsItem } from 'hikkaku/blocks'
702
708
  *
703
- * listContainsItem(list as any, undefined as any)
709
+ * listContainsItem(list,"banana")
704
710
  * ```
705
711
  */
706
712
  const listContainsItem = (list, item) => {
@@ -721,7 +727,7 @@ const listContainsItem = (list, item) => {
721
727
  * ```ts
722
728
  * import { showList } from 'hikkaku/blocks'
723
729
  *
724
- * showList(list as any)
730
+ * showList(list)
725
731
  * ```
726
732
  */
727
733
  const showList = (list) => {
@@ -739,7 +745,7 @@ const showList = (list) => {
739
745
  * ```ts
740
746
  * import { hideList } from 'hikkaku/blocks'
741
747
  *
742
- * hideList(list as any)
748
+ * hideList(list)
743
749
  * ```
744
750
  */
745
751
  const hideList = (list) => {
@@ -968,7 +974,11 @@ const broadcast = (message) => {
968
974
  * ```
969
975
  */
970
976
  const broadcastAndWait = (message) => {
971
- return block("event_broadcastandwait", { inputs: { BROADCAST_INPUT: fromPrimitiveSource(message) } });
977
+ return block("event_broadcastandwait", { inputs: { BROADCAST_INPUT: typeof message === "string" ? [Shadow.SameBlockShadow, [
978
+ InputType.Broadcast,
979
+ message,
980
+ message
981
+ ]] : fromPrimitiveSource(message) } });
972
982
  };
973
983
 
974
984
  //#endregion
@@ -1103,7 +1113,13 @@ const hide = () => {
1103
1113
  * ```
1104
1114
  */
1105
1115
  const switchCostumeTo = (costume) => {
1106
- return block("looks_switchcostumeto", { inputs: { COSTUME: fromCostumeSource(costume) } });
1116
+ return block("looks_switchcostumeto", { inputs: { COSTUME: menuInput(unwrapCostumeSource(costume), menuOfCostume) } });
1117
+ };
1118
+ const menuOfCostume = (costume = "") => {
1119
+ return valueBlock("looks_costume", {
1120
+ fields: { COSTUME: [costume, null] },
1121
+ isShadow: true
1122
+ });
1107
1123
  };
1108
1124
  /**
1109
1125
  * Next costume.
@@ -1138,7 +1154,13 @@ const nextCostume = () => {
1138
1154
  * ```
1139
1155
  */
1140
1156
  const switchBackdropTo = (backdrop) => {
1141
- return block("looks_switchbackdropto", { inputs: { BACKDROP: fromPrimitiveSource(backdrop) } });
1157
+ return block("looks_switchbackdropto", { inputs: { BACKDROP: menuInput(backdrop, menuOfBackdrop) } });
1158
+ };
1159
+ const menuOfBackdrop = (backdrop = "") => {
1160
+ return valueBlock("looks_backdrops", {
1161
+ fields: { BACKDROP: [backdrop, null] },
1162
+ isShadow: true
1163
+ });
1142
1164
  };
1143
1165
  /**
1144
1166
  * Switch backdrop and wait.
@@ -1156,7 +1178,7 @@ const switchBackdropTo = (backdrop) => {
1156
1178
  * ```
1157
1179
  */
1158
1180
  const switchBackdropToAndWait = (backdrop) => {
1159
- return block("looks_switchbackdroptoandwait", { inputs: { BACKDROP: fromPrimitiveSource(backdrop) } });
1181
+ return block("looks_switchbackdroptoandwait", { inputs: { BACKDROP: menuInput(backdrop, menuOfBackdrop) } });
1160
1182
  };
1161
1183
  /**
1162
1184
  * Next backdrop.
@@ -1380,7 +1402,7 @@ const getBackdropNumberName = (value) => {
1380
1402
  * ```ts
1381
1403
  * import { moveSteps } from 'hikkaku/blocks'
1382
1404
  *
1383
- * moveSteps(undefined as any)
1405
+ * moveSteps(10)
1384
1406
  * ```
1385
1407
  */
1386
1408
  const moveSteps = (steps) => {
@@ -1496,7 +1518,14 @@ const setY = (y) => {
1496
1518
  * ```
1497
1519
  */
1498
1520
  const goTo = (target) => {
1499
- return block("motion_goto", { fields: { TO: [target, null] } });
1521
+ return block("motion_goto", { inputs: { TO: menuInput(target, menuOfGoTo) } });
1522
+ };
1523
+ const GOTO_RANDOM = "_random_";
1524
+ const menuOfGoTo = (target = GOTO_RANDOM) => {
1525
+ return valueBlock("motion_goto_menu", {
1526
+ fields: { TO: [target, null] },
1527
+ isShadow: true
1528
+ });
1500
1529
  };
1501
1530
  /**
1502
1531
  * Turns right.
@@ -1568,7 +1597,14 @@ const pointInDirection = (direction) => {
1568
1597
  * ```
1569
1598
  */
1570
1599
  const pointTowards = (target) => {
1571
- return block("motion_pointtowards", { fields: { TOWARDS: [target, null] } });
1600
+ return block("motion_pointtowards", { inputs: { TOWARDS: menuInput(target, menuOfPointTowards) } });
1601
+ };
1602
+ const TOWARDS_MOUSE_POINTER = "_mouse_";
1603
+ const menuOfPointTowards = (target = TOWARDS_MOUSE_POINTER) => {
1604
+ return valueBlock("motion_pointtowards_menu", {
1605
+ fields: { TOWARDS: [target, null] },
1606
+ isShadow: true
1607
+ });
1572
1608
  };
1573
1609
  /**
1574
1610
  * Glides to position.
@@ -1611,9 +1647,15 @@ const glide = (seconds, x, y) => {
1611
1647
  * ```
1612
1648
  */
1613
1649
  const glideTo = (seconds, target) => {
1614
- return block("motion_glideto", {
1615
- inputs: { SECS: fromPrimitiveSource(seconds) },
1616
- fields: { TO: [target, null] }
1650
+ return block("motion_glideto", { inputs: {
1651
+ SECS: fromPrimitiveSource(seconds),
1652
+ TO: menuInput(target, menuOfGlideTo)
1653
+ } });
1654
+ };
1655
+ const menuOfGlideTo = (target = GOTO_RANDOM) => {
1656
+ return valueBlock("motion_glideto_menu", {
1657
+ fields: { TO: [target, null] },
1658
+ isShadow: true
1617
1659
  });
1618
1660
  };
1619
1661
  /**
@@ -2353,7 +2395,7 @@ const penUp = () => {
2353
2395
  /**
2354
2396
  * Sets pen color.
2355
2397
  *
2356
- * Input: `color`.
2398
+ * Input: `color`. like: #ffffff, #fff. This does not accept values like "red" or "green" that CSS accepts.
2357
2399
  * Output: Scratch statement block definition that is appended to the current script stack.
2358
2400
  *
2359
2401
  * @param color See function signature for accepted input values.
@@ -2362,11 +2404,11 @@ const penUp = () => {
2362
2404
  * ```ts
2363
2405
  * import { setPenColorTo } from 'hikkaku/blocks'
2364
2406
  *
2365
- * setPenColorTo(undefined as any)
2407
+ * setPenColorTo("#ff0000")
2366
2408
  * ```
2367
2409
  */
2368
2410
  const setPenColorTo = (color) => {
2369
- return block("pen_setPenColorToColor", { inputs: { COLOR: fromPrimitiveSource(color) } });
2411
+ return block("pen_setPenColorToColor", { inputs: { COLOR: fromPrimitiveSourceColor(color) } });
2370
2412
  };
2371
2413
  /**
2372
2414
  * Alias for {@link setPenColorTo}.
@@ -2396,15 +2438,21 @@ const setPenColorToColor = setPenColorTo;
2396
2438
  * ```ts
2397
2439
  * import { changePenColorParamBy } from 'hikkaku/blocks'
2398
2440
  *
2399
- * changePenColorParamBy(undefined as any, 10)
2441
+ * changePenColorParamBy('color', 10)
2400
2442
  * ```
2401
2443
  */
2402
2444
  const changePenColorParamBy = (param, value) => {
2403
2445
  return block("pen_changePenColorParamBy", { inputs: {
2404
- COLOR_PARAM: fromPrimitiveSource(param),
2446
+ COLOR_PARAM: menuInput(param, menuOfPenColorParam),
2405
2447
  VALUE: fromPrimitiveSource(value)
2406
2448
  } });
2407
2449
  };
2450
+ const menuOfPenColorParam = (colorParam = "color") => {
2451
+ return valueBlock("pen_menu_colorParam", {
2452
+ fields: { colorParam: [colorParam, null] },
2453
+ isShadow: true
2454
+ });
2455
+ };
2408
2456
  /**
2409
2457
  * Sets pen color parameter to value.
2410
2458
  *
@@ -2418,12 +2466,12 @@ const changePenColorParamBy = (param, value) => {
2418
2466
  * ```ts
2419
2467
  * import { setPenColorParamTo } from 'hikkaku/blocks'
2420
2468
  *
2421
- * setPenColorParamTo(undefined as any, 10)
2469
+ * setPenColorParamTo('color', 10)
2422
2470
  * ```
2423
2471
  */
2424
2472
  const setPenColorParamTo = (param, value) => {
2425
2473
  return block("pen_setPenColorParamTo", { inputs: {
2426
- COLOR_PARAM: fromPrimitiveSource(param),
2474
+ COLOR_PARAM: menuInput(param, menuOfPenColorParam),
2427
2475
  VALUE: fromPrimitiveSource(value)
2428
2476
  } });
2429
2477
  };
@@ -2833,7 +2881,13 @@ const getMouseY = () => {
2833
2881
  * ```
2834
2882
  */
2835
2883
  const touchingObject = (target) => {
2836
- return valueBlock("sensing_touchingobject", { inputs: { TOUCHINGOBJECTMENU: fromPrimitiveSource(target) } });
2884
+ return valueBlock("sensing_touchingobject", { inputs: { TOUCHINGOBJECTMENU: menuInput(target, menuOfTouchingObject) } });
2885
+ };
2886
+ const menuOfTouchingObject = (target = "_mouse_") => {
2887
+ return valueBlock("sensing_touchingobjectmenu", {
2888
+ fields: { TOUCHINGOBJECTMENU: [target, null] },
2889
+ isShadow: true
2890
+ });
2837
2891
  };
2838
2892
  /**
2839
2893
  * Touching color check.
@@ -2847,11 +2901,11 @@ const touchingObject = (target) => {
2847
2901
  * ```ts
2848
2902
  * import { touchingColor } from 'hikkaku/blocks'
2849
2903
  *
2850
- * touchingColor(undefined as any)
2904
+ * touchingColor("#ff0000")
2851
2905
  * ```
2852
2906
  */
2853
2907
  const touchingColor = (color) => {
2854
- return valueBlock("sensing_touchingcolor", { inputs: { COLOR: fromPrimitiveSource(color) } });
2908
+ return valueBlock("sensing_touchingcolor", { inputs: { COLOR: fromPrimitiveSourceColor(color) } });
2855
2909
  };
2856
2910
  /**
2857
2911
  * Color overlap check.
@@ -2866,13 +2920,13 @@ const touchingColor = (color) => {
2866
2920
  * ```ts
2867
2921
  * import { colorTouchingColor } from 'hikkaku/blocks'
2868
2922
  *
2869
- * colorTouchingColor(undefined as any, undefined as any)
2923
+ * colorTouchingColor("#ff0000", "#00ff00")
2870
2924
  * ```
2871
2925
  */
2872
2926
  const colorTouchingColor = (color, targetColor) => {
2873
2927
  return valueBlock("sensing_coloristouchingcolor", { inputs: {
2874
- COLOR: fromPrimitiveSource(color),
2875
- COLOR2: fromPrimitiveSource(targetColor)
2928
+ COLOR: fromPrimitiveSourceColor(color),
2929
+ COLOR2: fromPrimitiveSourceColor(targetColor)
2876
2930
  } });
2877
2931
  };
2878
2932
  /**
@@ -2891,7 +2945,13 @@ const colorTouchingColor = (color, targetColor) => {
2891
2945
  * ```
2892
2946
  */
2893
2947
  const distanceTo = (target) => {
2894
- return valueBlock("sensing_distanceto", { fields: { DISTANCETOMENU: [target, null] } });
2948
+ return valueBlock("sensing_distanceto", { inputs: { DISTANCETOMENU: menuInput(target, menuOfDistanceTo) } });
2949
+ };
2950
+ const menuOfDistanceTo = (target = "_mouse_") => {
2951
+ return valueBlock("sensing_distancetomenu", {
2952
+ fields: { DISTANCETOMENU: [target, null] },
2953
+ isShadow: true
2954
+ });
2895
2955
  };
2896
2956
  /**
2897
2957
  * Timer value.
@@ -2978,7 +3038,13 @@ const getMouseDown = () => {
2978
3038
  * ```
2979
3039
  */
2980
3040
  const getKeyPressed = (key) => {
2981
- return valueBlock("sensing_keypressed", { inputs: { KEY_OPTION: fromPrimitiveSource(key) } });
3041
+ return valueBlock("sensing_keypressed", { inputs: { KEY_OPTION: menuInput(key, menuOfKeyOptions) } });
3042
+ };
3043
+ const menuOfKeyOptions = (key = "space") => {
3044
+ return valueBlock("sensing_keyoptions", {
3045
+ fields: { KEY_OPTION: [key, null] },
3046
+ isShadow: true
3047
+ });
2982
3048
  };
2983
3049
  /**
2984
3050
  * Current date/time value.
@@ -3011,14 +3077,20 @@ const current = (menu) => {
3011
3077
  * ```ts
3012
3078
  * import { getAttributeOf } from 'hikkaku/blocks'
3013
3079
  *
3014
- * getAttributeOf(undefined as any, 'mouse-pointer')
3080
+ * getAttributeOf('x position', 'cat')
3015
3081
  * ```
3016
3082
  */
3017
3083
  const getAttributeOf = (property, target) => {
3018
- return valueBlock("sensing_of", { fields: {
3019
- PROPERTY: [property, null],
3020
- OBJECT: [target, null]
3021
- } });
3084
+ return valueBlock("sensing_of", {
3085
+ fields: { PROPERTY: [property, null] },
3086
+ inputs: { OBJECT: menuInput(target, menuOfAttributeObject) }
3087
+ });
3088
+ };
3089
+ const menuOfAttributeObject = (object = "_stage_") => {
3090
+ return valueBlock("sensing_of_object_menu", {
3091
+ fields: { OBJECT: [object, null] },
3092
+ isShadow: true
3093
+ });
3022
3094
  };
3023
3095
  /**
3024
3096
  * Days since 2000-01-01.
@@ -3151,7 +3223,7 @@ const getUsername = () => {
3151
3223
  * ```
3152
3224
  */
3153
3225
  const playSound = (sound) => {
3154
- return block("sound_play", { inputs: { SOUND_MENU: fromSoundSource(sound) } });
3226
+ return block("sound_play", { inputs: { SOUND_MENU: menuInput(unwrapSoundSource(sound), menuOfSounds) } });
3155
3227
  };
3156
3228
  /**
3157
3229
  * Plays and waits.
@@ -3177,7 +3249,13 @@ const playSound = (sound) => {
3177
3249
  * ```
3178
3250
  */
3179
3251
  const playSoundUntilDone = (sound) => {
3180
- return block("sound_playuntildone", { inputs: { SOUND_MENU: fromSoundSource(sound) } });
3252
+ return block("sound_playuntildone", { inputs: { SOUND_MENU: menuInput(unwrapSoundSource(sound), menuOfSounds) } });
3253
+ };
3254
+ const menuOfSounds = (sound = "") => {
3255
+ return valueBlock("sound_sounds_menu", {
3256
+ fields: { SOUND_MENU: [sound, null] },
3257
+ isShadow: true
3258
+ });
3181
3259
  };
3182
3260
  /**
3183
3261
  * Stops all sounds.
@@ -3312,4 +3390,4 @@ const getVolume = () => {
3312
3390
  };
3313
3391
 
3314
3392
  //#endregion
3315
- export { CREATE_CLONE_MYSELF, add, addToList, allAtOnce, and, argumentReporterBoolean, argumentReporterStringNumber, askAndWait, broadcast, broadcastAndWait, callProcedure, changeLooksEffectBy, changePenColorParamBy, changePenHueBy, changePenShadeBy, changePenSizeBy, changeSizeBy, changeSoundEffectBy, changeTempo, 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, getTempo, 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, midiPlayDrumForBeats, midiSetInstrument, mod, moveSteps, multiply, nextBackdrop, nextCostume, not, or, penDown, penUp, playDrumForBeats, playNoteForBeats, playSound, playSoundUntilDone, pointInDirection, pointTowards, procedureBoolean, procedureLabel, procedureStringOrNumber, random, repeat, repeatUntil, repeatWhile, replaceItemOfList, resetTimer, restForBeats, round, say, sayForSecs, setDragMode, setInstrument, setLooksEffectTo, setPenColorParamTo, setPenColorTo, setPenColorToColor, setPenHueToNumber, setPenShadeToNumber, setPenSizeTo, setRotationStyle, setSizeTo, setSoundEffectTo, setTempo, 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 };
3393
+ export { CREATE_CLONE_MYSELF, GOTO_RANDOM, add, addToList, allAtOnce, and, argumentReporterBoolean, argumentReporterStringNumber, askAndWait, broadcast, broadcastAndWait, callProcedure, changeLooksEffectBy, changePenColorParamBy, changePenHueBy, changePenShadeBy, changePenSizeBy, changeSizeBy, changeSoundEffectBy, changeTempo, 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, getTempo, 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, menuOfAttributeObject, menuOfBackdrop, menuOfCostume, menuOfCreateClone, menuOfDistanceTo, menuOfGlideTo, menuOfGoTo, menuOfKeyOptions, menuOfPenColorParam, menuOfPointTowards, menuOfSounds, menuOfTouchingObject, midiPlayDrumForBeats, midiSetInstrument, mod, moveSteps, multiply, nextBackdrop, nextCostume, not, or, penDown, penUp, playDrumForBeats, playNoteForBeats, playSound, playSoundUntilDone, pointInDirection, pointTowards, procedureBoolean, procedureLabel, procedureStringOrNumber, random, repeat, repeatUntil, repeatWhile, replaceItemOfList, resetTimer, restForBeats, round, say, sayForSecs, setDragMode, setInstrument, setLooksEffectTo, setPenColorParamTo, setPenColorTo, setPenColorToColor, setPenHueToNumber, setPenShadeToNumber, setPenSizeTo, setRotationStyle, setSizeTo, setSoundEffectTo, setTempo, 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 };
@@ -22,7 +22,8 @@ const InputType$1 = {
22
22
  Number: toNumericEnum(inputType.Number, 4),
23
23
  PositiveInteger: toNumericEnum(inputType.PositiveInteger ?? inputType.PossiveInteger, 6),
24
24
  String: toNumericEnum(inputType.String, 10),
25
- Broadcast: toNumericEnum(inputType.Broadcast, 11)
25
+ Broadcast: toNumericEnum(inputType.Broadcast, 11),
26
+ Color: toNumericEnum(inputType.Color, 9)
26
27
  };
27
28
 
28
29
  //#endregion
@@ -33,13 +34,37 @@ const fromPrimitiveSource = (source) => {
33
34
  if (typeof source === "string") return [Shadow$1.SameBlockShadow, [InputType$1.String, source]];
34
35
  return [Shadow$1.SameBlockShadow, source.id];
35
36
  };
36
- const fromCostumeSource = (source) => {
37
- if (typeof source === "object" && source !== null && "type" in source && source.type === "costume") return fromPrimitiveSource(source.name);
38
- return fromPrimitiveSource(source);
37
+ const fromPrimitiveSourceColor = (color) => {
38
+ if (typeof color === "string") return [Shadow$1.SameBlockShadow, [InputType$1.Color, color]];
39
+ return fromPrimitiveSource(color);
40
+ };
41
+ const unwrapCostumeSource = (source) => {
42
+ if (isCostumeReference(source)) return source.name;
43
+ return source;
44
+ };
45
+ const unwrapSoundSource = (source) => {
46
+ if (isSoundReference(source)) return source.name;
47
+ return source;
48
+ };
49
+ const isHikkakuBlock = (block) => {
50
+ return typeof block === "object" && block !== null && "isBlock" in block && block.isBlock === true && "id" in block && typeof block.id === "string";
51
+ };
52
+ const menuInput = (source, createMenu) => {
53
+ if (isHikkakuBlock(source)) {
54
+ const shadow = createMenu();
55
+ return [
56
+ Shadow$1.DiffBlockShadow,
57
+ source.id,
58
+ shadow.id
59
+ ];
60
+ }
61
+ return fromPrimitiveSource(createMenu(source));
62
+ };
63
+ const isCostumeReference = (source) => {
64
+ return typeof source === "object" && source !== null && "type" in source && source.type === "costume";
39
65
  };
40
- const fromSoundSource = (source) => {
41
- if (typeof source === "object" && source !== null && "type" in source && source.type === "sound") return fromPrimitiveSource(source.name);
42
- return fromPrimitiveSource(source);
66
+ const isSoundReference = (source) => {
67
+ return typeof source === "object" && source !== null && "type" in source && source.type === "sound";
43
68
  };
44
69
 
45
70
  //#endregion
@@ -69,22 +94,24 @@ const block = (opcode, init) => {
69
94
  ctx.blocks[id] = block;
70
95
  ctx.blockToId.set(block, id);
71
96
  if (init.isValue) ctx.valueBlockSet.add(block);
72
- if (init.inputs) {
73
- for (const [_key, value] of Object.entries(init.inputs)) if (typeof value[1] === "string") {
74
- const valueBlockId = value[1];
75
- const valueBlock = ctx.blocks[valueBlockId];
76
- if (valueBlock) {
77
- valueBlock.parent = id;
78
- ctx.usedAsValueSet.add(valueBlock);
79
- }
80
- }
81
- }
97
+ if (init.inputs) for (const [_key, value] of Object.entries(init.inputs)) value.slice(1).forEach((input) => {
98
+ if (typeof input === "string") attachValueBlock(ctx, id, input);
99
+ });
82
100
  if (ctx.adder) ctx.adder(id, block);
83
101
  return {
84
102
  isBlock: true,
85
103
  id
86
104
  };
87
105
  };
106
+ function attachValueBlock(ctx, parentId, blockId) {
107
+ const block = ctx.blocks[blockId];
108
+ if (!block) {
109
+ console.warn(`Block with ID ${blockId} not found (referenced from block ${parentId})`);
110
+ return;
111
+ }
112
+ block.parent = parentId;
113
+ ctx.usedAsValueSet.add(block);
114
+ }
88
115
  const valueBlock = (opcode, init) => {
89
116
  return block(opcode, {
90
117
  ...init,
@@ -206,4 +233,4 @@ const createBlocks = (handler) => {
206
233
  };
207
234
 
208
235
  //#endregion
209
- export { valueBlock as a, fromSoundSource as c, substack as i, InputType$1 as l, block as n, fromCostumeSource as o, createBlocks as r, fromPrimitiveSource as s, attachStack as t, Shadow$1 as u };
236
+ export { valueBlock as a, isCostumeReference as c, menuInput as d, unwrapCostumeSource as f, Shadow$1 as h, substack as i, isHikkakuBlock as l, InputType$1 as m, block as n, fromPrimitiveSource as o, unwrapSoundSource as p, createBlocks as r, fromPrimitiveSourceColor as s, attachStack as t, isSoundReference as u };
package/index.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { A as VariableMonitorMode, C as PrimitiveAvailableOnScratch, D as SoundSource, E as SoundReference, M as VariableReference, O as VariableBase, S as MonitorPosition, T as SoundData, _ as CreateListOptions, a as Handler, b as ListMonitorOptions, c as createBlocks, d as fromCostumeSource, f as fromPrimitiveSource, g as CostumeSource, h as CostumeReference, i as BlockInit, j as VariableMonitorOptions, k as VariableDefinition, l as substack, m as CostumeData, n as SpriteOptions, o as attachStack, p as fromSoundSource, r as Target, s as block, t as Project, u as valueBlock, v as CreateVariableOptions, w as PrimitiveSource, x as ListReference, y as HikkakuBlock } from "./project-djJPtrq7.mjs";
2
- export { BlockInit, CostumeData, CostumeReference, CostumeSource, CreateListOptions, CreateVariableOptions, Handler, HikkakuBlock, ListMonitorOptions, ListReference, MonitorPosition, PrimitiveAvailableOnScratch, PrimitiveSource, Project, SoundData, SoundReference, SoundSource, SpriteOptions, Target, VariableBase, VariableDefinition, VariableMonitorMode, VariableMonitorOptions, VariableReference, attachStack, block, createBlocks, fromCostumeSource, fromPrimitiveSource, fromSoundSource, substack, valueBlock };
1
+ import { A as SoundData, C as CreateVariableOptions, D as MonitorPosition, E as ListReference, F as VariableMonitorMode, I as VariableMonitorOptions, L as VariableReference, M as SoundSource, N as VariableBase, O as PrimitiveAvailableOnScratch, P as VariableDefinition, S as CreateListOptions, T as ListMonitorOptions, _ as unwrapCostumeSource, a as Handler, b as CostumeReference, c as createBlocks, d as fromPrimitiveSource, f as fromPrimitiveSourceColor, g as menuInput, h as isSoundReference, i as BlockInit, j as SoundReference, k as PrimitiveSource, l as substack, m as isHikkakuBlock, n as SpriteOptions, o as attachStack, p as isCostumeReference, r as Target, s as block, t as Project, u as valueBlock, v as unwrapSoundSource, w as HikkakuBlock, x as CostumeSource, y as CostumeData } from "./project-CpV5Dm-X.mjs";
2
+ export { BlockInit, CostumeData, CostumeReference, CostumeSource, CreateListOptions, CreateVariableOptions, Handler, HikkakuBlock, ListMonitorOptions, ListReference, MonitorPosition, PrimitiveAvailableOnScratch, PrimitiveSource, Project, SoundData, SoundReference, SoundSource, SpriteOptions, Target, VariableBase, VariableDefinition, VariableMonitorMode, VariableMonitorOptions, VariableReference, attachStack, block, createBlocks, fromPrimitiveSource, fromPrimitiveSourceColor, isCostumeReference, isHikkakuBlock, isSoundReference, menuInput, substack, unwrapCostumeSource, unwrapSoundSource, valueBlock };
package/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as valueBlock, c as fromSoundSource, i as substack, n as block, o as fromCostumeSource, r as createBlocks, s as fromPrimitiveSource, t as attachStack } from "./composer-DpyUR2R3.mjs";
1
+ import { a as valueBlock, c as isCostumeReference, d as menuInput, f as unwrapCostumeSource, i as substack, l as isHikkakuBlock, n as block, o as fromPrimitiveSource, p as unwrapSoundSource, r as createBlocks, s as fromPrimitiveSourceColor, t as attachStack, u as isSoundReference } from "./composer-bPcsVhIg.mjs";
2
2
 
3
3
  //#region src/core/monitors.ts
4
4
  const createVariableMonitor = (id, name, defaultValue, spriteName, options) => {
@@ -229,4 +229,4 @@ var Project = class {
229
229
  };
230
230
 
231
231
  //#endregion
232
- export { Project, Target, attachStack, block, createBlocks, fromCostumeSource, fromPrimitiveSource, fromSoundSource, substack, valueBlock };
232
+ export { Project, Target, attachStack, block, createBlocks, fromPrimitiveSource, fromPrimitiveSourceColor, isCostumeReference, isHikkakuBlock, isSoundReference, menuInput, substack, unwrapCostumeSource, unwrapSoundSource, valueBlock };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hikkaku",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "exports": {
@@ -37,7 +37,7 @@
37
37
  "@turbowarp/packager": "^3.11.0",
38
38
  "@types/bun": "latest",
39
39
  "@typescript/native-preview": "^7.0.0-dev.20260127.1",
40
- "rolldown": "1.0.0-beta.60",
40
+ "rolldown": "1.0.0-rc.4",
41
41
  "tsdown": "^0.20.0-beta.4"
42
42
  },
43
43
  "peerDependencies": {
@@ -46,7 +46,7 @@
46
46
  "dependencies": {
47
47
  "fflate": "^0.8.2",
48
48
  "sb3-types": "^0.1.16",
49
- "vite": "8.0.0-beta.8"
49
+ "vite": "8.0.0-beta.14"
50
50
  },
51
51
  "repository": {
52
52
  "url": "https://github.com/pnsk-lab/hikkaku",
@@ -65,8 +65,13 @@ type SoundData = Sound & {
65
65
  //#endregion
66
66
  //#region src/core/block-helper.d.ts
67
67
  declare const fromPrimitiveSource: <T extends PrimitiveAvailableOnScratch>(source: PrimitiveSource<T>) => sb3.Input;
68
- declare const fromCostumeSource: (source: CostumeSource) => sb3.Input;
69
- declare const fromSoundSource: (source: SoundSource) => sb3.Input;
68
+ declare const fromPrimitiveSourceColor: (color: PrimitiveSource<`#${string}` | (string & {})>) => sb3.Input;
69
+ declare const unwrapCostumeSource: (source: CostumeSource) => PrimitiveSource<string>;
70
+ declare const unwrapSoundSource: (source: SoundSource) => PrimitiveSource<string>;
71
+ declare const isHikkakuBlock: (block: unknown) => block is HikkakuBlock;
72
+ declare const menuInput: <T extends PrimitiveAvailableOnScratch>(source: PrimitiveSource<T>, createMenu: (source?: T) => HikkakuBlock) => sb3.Input;
73
+ declare const isCostumeReference: (source: unknown) => source is CostumeReference;
74
+ declare const isSoundReference: (source: unknown) => source is SoundReference;
70
75
  //#endregion
71
76
  //#region src/core/composer.d.ts
72
77
  type Handler = () => void;
@@ -152,4 +157,4 @@ declare class Project {
152
157
  getAdditionalAssets(): Map<string, Uint8Array>;
153
158
  }
154
159
  //#endregion
155
- export { VariableMonitorMode as A, PrimitiveAvailableOnScratch as C, SoundSource as D, SoundReference as E, VariableReference as M, VariableBase as O, MonitorPosition as S, SoundData as T, CreateListOptions as _, Handler as a, ListMonitorOptions as b, createBlocks as c, fromCostumeSource as d, fromPrimitiveSource as f, CostumeSource as g, CostumeReference as h, BlockInit as i, VariableMonitorOptions as j, VariableDefinition as k, substack as l, CostumeData as m, SpriteOptions as n, attachStack as o, fromSoundSource as p, Target as r, block as s, Project as t, valueBlock as u, CreateVariableOptions as v, PrimitiveSource as w, ListReference as x, HikkakuBlock as y };
160
+ export { SoundData as A, CreateVariableOptions as C, MonitorPosition as D, ListReference as E, VariableMonitorMode as F, VariableMonitorOptions as I, VariableReference as L, SoundSource as M, VariableBase as N, PrimitiveAvailableOnScratch as O, VariableDefinition as P, CreateListOptions as S, ListMonitorOptions as T, unwrapCostumeSource as _, Handler as a, CostumeReference as b, createBlocks as c, fromPrimitiveSource as d, fromPrimitiveSourceColor as f, menuInput as g, isSoundReference as h, BlockInit as i, SoundReference as j, PrimitiveSource as k, substack as l, isHikkakuBlock as m, SpriteOptions as n, attachStack as o, isCostumeReference as p, Target as r, block as s, Project as t, valueBlock as u, unwrapSoundSource as v, HikkakuBlock as w, CostumeSource as x, CostumeData as y };