sb-edit-custom 0.15.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/LICENSE.txt +9 -0
- package/README.md +0 -0
- package/lib/Block.d.ts +388 -0
- package/lib/Block.js +631 -0
- package/lib/BlockInput.d.ts +213 -0
- package/lib/BlockInput.js +3 -0
- package/lib/Costume.d.ts +25 -0
- package/lib/Costume.js +23 -0
- package/lib/Data.d.ts +50 -0
- package/lib/Data.js +44 -0
- package/lib/OpCode.d.ts +212 -0
- package/lib/OpCode.js +219 -0
- package/lib/Project.d.ts +29 -0
- package/lib/Project.js +66 -0
- package/lib/Script.d.ts +16 -0
- package/lib/Script.js +62 -0
- package/lib/Sound.d.ts +21 -0
- package/lib/Sound.js +21 -0
- package/lib/Target.d.ts +47 -0
- package/lib/Target.js +120 -0
- package/lib/cli/index.d.ts +2 -0
- package/lib/cli/index.js +511 -0
- package/lib/index.d.ts +10 -0
- package/lib/index.js +48 -0
- package/lib/io/leopard/toLeopard.d.ts +22 -0
- package/lib/io/leopard/toLeopard.js +2199 -0
- package/lib/io/sb2/fromSb2.d.ts +0 -0
- package/lib/io/sb2/fromSb2.js +2 -0
- package/lib/io/sb2/index.d.ts +48 -0
- package/lib/io/sb2/index.js +3 -0
- package/lib/io/sb2/toSb2.d.ts +0 -0
- package/lib/io/sb2/toSb2.js +2 -0
- package/lib/io/sb3/fromSb3.d.ts +16 -0
- package/lib/io/sb3/fromSb3.js +628 -0
- package/lib/io/sb3/interfaces.d.ts +624 -0
- package/lib/io/sb3/interfaces.js +336 -0
- package/lib/io/sb3/toSb3.d.ts +8 -0
- package/lib/io/sb3/toSb3.js +851 -0
- package/lib/io/scratchblocks/toScratchblocks.d.ts +7 -0
- package/lib/io/scratchblocks/toScratchblocks.js +606 -0
- package/lib/util/id.d.ts +1 -0
- package/lib/util/id.js +12 -0
- package/package.json +68 -0
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Copyright (c) Josh Pullen <hello@joshuapullen.com>
|
|
2
|
+
Copyright (c) Quasar Nebula <qznebula@protonmail.com>
|
|
3
|
+
Copyright (c) adroitwhiz <adroitwhiz@protonmail.com>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
File without changes
|
package/lib/Block.d.ts
ADDED
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
import * as BlockInput from "./BlockInput";
|
|
2
|
+
import { OpCode } from "./OpCode";
|
|
3
|
+
type DefaultInput<T extends BlockInput.Any = BlockInput.Any> = T extends BlockInput.Any ? {
|
|
4
|
+
type: Readonly<T["type"]>;
|
|
5
|
+
initial: Readonly<T["value"]>;
|
|
6
|
+
} : never;
|
|
7
|
+
export declare class BlockBase<MyOpCode extends OpCode, MyInputs extends {
|
|
8
|
+
[key: string]: BlockInput.Any;
|
|
9
|
+
}> {
|
|
10
|
+
static getDefaultInput(opcode: KnownBlock["opcode"], input: string): DefaultInput | void;
|
|
11
|
+
static isKnownBlock(opcode: OpCode): opcode is KnownBlock["opcode"];
|
|
12
|
+
id: string;
|
|
13
|
+
opcode: MyOpCode;
|
|
14
|
+
inputs: MyInputs;
|
|
15
|
+
parent: string | null;
|
|
16
|
+
next: string | null;
|
|
17
|
+
constructor(options: {
|
|
18
|
+
id?: string;
|
|
19
|
+
opcode: MyOpCode;
|
|
20
|
+
inputs: MyInputs;
|
|
21
|
+
parent?: string;
|
|
22
|
+
next?: string;
|
|
23
|
+
});
|
|
24
|
+
getDefaultInput(input: string): DefaultInput | void;
|
|
25
|
+
isKnownBlock(): this is KnownBlock;
|
|
26
|
+
get blocks(): Block[];
|
|
27
|
+
get isHat(): boolean;
|
|
28
|
+
}
|
|
29
|
+
export type MotionBlock = BlockBase<OpCode.motion_movesteps, {
|
|
30
|
+
STEPS: BlockInput.Number;
|
|
31
|
+
}> | BlockBase<OpCode.motion_turnright, {
|
|
32
|
+
DEGREES: BlockInput.Number;
|
|
33
|
+
}> | BlockBase<OpCode.motion_turnleft, {
|
|
34
|
+
DEGREES: BlockInput.Number;
|
|
35
|
+
}> | BlockBase<OpCode.motion_goto, {
|
|
36
|
+
TO: BlockInput.GoToTarget;
|
|
37
|
+
}> | BlockBase<OpCode.motion_gotoxy, {
|
|
38
|
+
X: BlockInput.Number;
|
|
39
|
+
Y: BlockInput.Number;
|
|
40
|
+
}> | BlockBase<OpCode.motion_glideto, {
|
|
41
|
+
SECS: BlockInput.Number;
|
|
42
|
+
TO: BlockInput.GoToTarget;
|
|
43
|
+
}> | BlockBase<OpCode.motion_glidesecstoxy, {
|
|
44
|
+
SECS: BlockInput.Number;
|
|
45
|
+
X: BlockInput.Number;
|
|
46
|
+
Y: BlockInput.Number;
|
|
47
|
+
}> | BlockBase<OpCode.motion_pointindirection, {
|
|
48
|
+
DIRECTION: BlockInput.Angle;
|
|
49
|
+
}> | BlockBase<OpCode.motion_pointtowards, {
|
|
50
|
+
TOWARDS: BlockInput.PointTowardsTarget;
|
|
51
|
+
}> | BlockBase<OpCode.motion_changexby, {
|
|
52
|
+
DX: BlockInput.Number;
|
|
53
|
+
}> | BlockBase<OpCode.motion_setx, {
|
|
54
|
+
X: BlockInput.Number;
|
|
55
|
+
}> | BlockBase<OpCode.motion_changeyby, {
|
|
56
|
+
DY: BlockInput.Number;
|
|
57
|
+
}> | BlockBase<OpCode.motion_sety, {
|
|
58
|
+
Y: BlockInput.Number;
|
|
59
|
+
}> | BlockBase<OpCode.motion_ifonedgebounce, {}> | BlockBase<OpCode.motion_setrotationstyle, {
|
|
60
|
+
STYLE: BlockInput.RotationStyle;
|
|
61
|
+
}> | BlockBase<OpCode.motion_xposition, {}> | BlockBase<OpCode.motion_yposition, {}> | BlockBase<OpCode.motion_direction, {}> | BlockBase<OpCode.motion_scroll_right, {
|
|
62
|
+
DISTANCE: BlockInput.Number;
|
|
63
|
+
}> | BlockBase<OpCode.motion_scroll_up, {
|
|
64
|
+
DISTANCE: BlockInput.Number;
|
|
65
|
+
}> | BlockBase<OpCode.motion_align_scene, {
|
|
66
|
+
ALIGNMENT: BlockInput.ScrollAlignment;
|
|
67
|
+
}>;
|
|
68
|
+
export type LooksBlock = BlockBase<OpCode.looks_sayforsecs, {
|
|
69
|
+
MESSAGE: BlockInput.String;
|
|
70
|
+
SECS: BlockInput.Number;
|
|
71
|
+
}> | BlockBase<OpCode.looks_say, {
|
|
72
|
+
MESSAGE: BlockInput.String;
|
|
73
|
+
}> | BlockBase<OpCode.looks_thinkforsecs, {
|
|
74
|
+
MESSAGE: BlockInput.String;
|
|
75
|
+
SECS: BlockInput.Number;
|
|
76
|
+
}> | BlockBase<OpCode.looks_think, {
|
|
77
|
+
MESSAGE: BlockInput.String;
|
|
78
|
+
}> | BlockBase<OpCode.looks_switchcostumeto, {
|
|
79
|
+
COSTUME: BlockInput.Costume;
|
|
80
|
+
}> | BlockBase<OpCode.looks_nextcostume, {}> | BlockBase<OpCode.looks_switchbackdropto, {
|
|
81
|
+
BACKDROP: BlockInput.Backdrop;
|
|
82
|
+
}> | BlockBase<OpCode.looks_nextbackdrop, {}> | BlockBase<OpCode.looks_changesizeby, {
|
|
83
|
+
CHANGE: BlockInput.Number;
|
|
84
|
+
}> | BlockBase<OpCode.looks_setsizeto, {
|
|
85
|
+
SIZE: BlockInput.Number;
|
|
86
|
+
}> | BlockBase<OpCode.looks_changeeffectby, {
|
|
87
|
+
EFFECT: BlockInput.GraphicEffect;
|
|
88
|
+
CHANGE: BlockInput.Number;
|
|
89
|
+
}> | BlockBase<OpCode.looks_seteffectto, {
|
|
90
|
+
EFFECT: BlockInput.GraphicEffect;
|
|
91
|
+
VALUE: BlockInput.Number;
|
|
92
|
+
}> | BlockBase<OpCode.looks_cleargraphiceffects, {}> | BlockBase<OpCode.looks_show, {}> | BlockBase<OpCode.looks_hide, {}> | BlockBase<OpCode.looks_gotofrontback, {
|
|
93
|
+
FRONT_BACK: BlockInput.FrontBackMenu;
|
|
94
|
+
}> | BlockBase<OpCode.looks_goforwardbackwardlayers, {
|
|
95
|
+
NUM: BlockInput.Number;
|
|
96
|
+
FORWARD_BACKWARD: BlockInput.ForwardBackwardMenu;
|
|
97
|
+
}> | BlockBase<OpCode.looks_costumenumbername, {
|
|
98
|
+
NUMBER_NAME: BlockInput.CostumeNumberName;
|
|
99
|
+
}> | BlockBase<OpCode.looks_backdropnumbername, {
|
|
100
|
+
NUMBER_NAME: BlockInput.CostumeNumberName;
|
|
101
|
+
}> | BlockBase<OpCode.looks_size, {}> | BlockBase<OpCode.looks_hideallsprites, {}> | BlockBase<OpCode.looks_switchbackdroptoandwait, {
|
|
102
|
+
BACKDROP: BlockInput.Backdrop;
|
|
103
|
+
}> | BlockBase<OpCode.looks_changestretchby, {
|
|
104
|
+
CHANGE: BlockInput.Number;
|
|
105
|
+
}> | BlockBase<OpCode.looks_setstretchto, {
|
|
106
|
+
STRETCH: BlockInput.Number;
|
|
107
|
+
}>;
|
|
108
|
+
export type SoundBlock = BlockBase<OpCode.sound_playuntildone, {
|
|
109
|
+
SOUND_MENU: BlockInput.Sound;
|
|
110
|
+
}> | BlockBase<OpCode.sound_play, {
|
|
111
|
+
SOUND_MENU: BlockInput.Sound;
|
|
112
|
+
}> | BlockBase<OpCode.sound_stopallsounds, {}> | BlockBase<OpCode.sound_changeeffectby, {
|
|
113
|
+
VALUE: BlockInput.Number;
|
|
114
|
+
EFFECT: BlockInput.SoundEffect;
|
|
115
|
+
}> | BlockBase<OpCode.sound_seteffectto, {
|
|
116
|
+
VALUE: BlockInput.Number;
|
|
117
|
+
EFFECT: BlockInput.SoundEffect;
|
|
118
|
+
}> | BlockBase<OpCode.sound_cleareffects, {}> | BlockBase<OpCode.sound_changevolumeby, {
|
|
119
|
+
VOLUME: BlockInput.Number;
|
|
120
|
+
}> | BlockBase<OpCode.sound_setvolumeto, {
|
|
121
|
+
VOLUME: BlockInput.Number;
|
|
122
|
+
}> | BlockBase<OpCode.sound_volume, {}>;
|
|
123
|
+
export type EventBlock = BlockBase<OpCode.event_whenflagclicked, {}> | BlockBase<OpCode.event_whenkeypressed, {
|
|
124
|
+
KEY_OPTION: BlockInput.Key;
|
|
125
|
+
}> | BlockBase<OpCode.event_whenthisspriteclicked, {}> | BlockBase<OpCode.event_whenstageclicked, {}> | BlockBase<OpCode.event_whenbackdropswitchesto, {
|
|
126
|
+
BACKDROP: BlockInput.Backdrop;
|
|
127
|
+
}> | BlockBase<OpCode.event_whengreaterthan, {
|
|
128
|
+
VALUE: BlockInput.Number;
|
|
129
|
+
WHENGREATERTHANMENU: BlockInput.GreaterThanMenu;
|
|
130
|
+
}> | BlockBase<OpCode.event_whenbroadcastreceived, {
|
|
131
|
+
BROADCAST_OPTION: BlockInput.Broadcast;
|
|
132
|
+
}> | BlockBase<OpCode.event_broadcast, {
|
|
133
|
+
BROADCAST_INPUT: BlockInput.Broadcast;
|
|
134
|
+
}> | BlockBase<OpCode.event_broadcastandwait, {
|
|
135
|
+
BROADCAST_INPUT: BlockInput.Broadcast;
|
|
136
|
+
}>;
|
|
137
|
+
export type ControlBlock = BlockBase<OpCode.control_wait, {
|
|
138
|
+
DURATION: BlockInput.Number;
|
|
139
|
+
}> | BlockBase<OpCode.control_repeat, {
|
|
140
|
+
TIMES: BlockInput.Number;
|
|
141
|
+
SUBSTACK: BlockInput.Blocks;
|
|
142
|
+
}> | BlockBase<OpCode.control_forever, {
|
|
143
|
+
SUBSTACK: BlockInput.Blocks;
|
|
144
|
+
}> | BlockBase<OpCode.control_if, {
|
|
145
|
+
CONDITION: BlockInput.Boolean;
|
|
146
|
+
SUBSTACK: BlockInput.Blocks;
|
|
147
|
+
}> | BlockBase<OpCode.control_if_else, {
|
|
148
|
+
CONDITION: BlockInput.Boolean;
|
|
149
|
+
SUBSTACK: BlockInput.Blocks;
|
|
150
|
+
SUBSTACK2: BlockInput.Blocks;
|
|
151
|
+
}> | BlockBase<OpCode.control_wait_until, {
|
|
152
|
+
CONDITION: BlockInput.Boolean;
|
|
153
|
+
}> | BlockBase<OpCode.control_repeat_until, {
|
|
154
|
+
CONDITION: BlockInput.Boolean;
|
|
155
|
+
SUBSTACK: BlockInput.Blocks;
|
|
156
|
+
}> | BlockBase<OpCode.control_stop, {
|
|
157
|
+
STOP_OPTION: BlockInput.StopMenu;
|
|
158
|
+
}> | BlockBase<OpCode.control_start_as_clone, {}> | BlockBase<OpCode.control_create_clone_of, {
|
|
159
|
+
CLONE_OPTION: BlockInput.CloneTarget;
|
|
160
|
+
}> | BlockBase<OpCode.control_delete_this_clone, {}> | BlockBase<OpCode.control_all_at_once, {
|
|
161
|
+
SUBSTACK: BlockInput.Blocks;
|
|
162
|
+
}> | BlockBase<OpCode.control_for_each, {
|
|
163
|
+
VARIABLE: BlockInput.Variable;
|
|
164
|
+
VALUE: BlockInput.Number;
|
|
165
|
+
SUBSTACK: BlockInput.Blocks;
|
|
166
|
+
}> | BlockBase<OpCode.control_while, {
|
|
167
|
+
CONDITION: BlockInput.Boolean;
|
|
168
|
+
SUBSTACK: BlockInput.Blocks;
|
|
169
|
+
}>;
|
|
170
|
+
export type SensingBlock = BlockBase<OpCode.sensing_touchingobject, {
|
|
171
|
+
TOUCHINGOBJECTMENU: BlockInput.TouchingTarget;
|
|
172
|
+
}> | BlockBase<OpCode.sensing_touchingcolor, {
|
|
173
|
+
COLOR: BlockInput.Color;
|
|
174
|
+
}> | BlockBase<OpCode.sensing_coloristouchingcolor, {
|
|
175
|
+
COLOR: BlockInput.Color;
|
|
176
|
+
COLOR2: BlockInput.Color;
|
|
177
|
+
}> | BlockBase<OpCode.sensing_distanceto, {
|
|
178
|
+
DISTANCETOMENU: BlockInput.DistanceToMenu;
|
|
179
|
+
}> | BlockBase<OpCode.sensing_askandwait, {
|
|
180
|
+
QUESTION: BlockInput.String;
|
|
181
|
+
}> | BlockBase<OpCode.sensing_answer, {}> | BlockBase<OpCode.sensing_keypressed, {
|
|
182
|
+
KEY_OPTION: BlockInput.Key;
|
|
183
|
+
}> | BlockBase<OpCode.sensing_mousedown, {}> | BlockBase<OpCode.sensing_mousex, {}> | BlockBase<OpCode.sensing_mousey, {}> | BlockBase<OpCode.sensing_setdragmode, {
|
|
184
|
+
DRAG_MODE: BlockInput.DragModeMenu;
|
|
185
|
+
}> | BlockBase<OpCode.sensing_loudness, {}> | BlockBase<OpCode.sensing_loud, {}> | BlockBase<OpCode.sensing_timer, {}> | BlockBase<OpCode.sensing_resettimer, {}> | BlockBase<OpCode.sensing_of, {
|
|
186
|
+
OBJECT: BlockInput.Target;
|
|
187
|
+
PROPERTY: BlockInput.PropertyOfMenu;
|
|
188
|
+
}> | BlockBase<OpCode.sensing_current, {
|
|
189
|
+
CURRENTMENU: BlockInput.CurrentMenu;
|
|
190
|
+
}> | BlockBase<OpCode.sensing_dayssince2000, {}> | BlockBase<OpCode.sensing_username, {}> | BlockBase<OpCode.sensing_userid, {}>;
|
|
191
|
+
export type OperatorBlock = BlockBase<OpCode.operator_add, {
|
|
192
|
+
NUM1: BlockInput.Number;
|
|
193
|
+
NUM2: BlockInput.Number;
|
|
194
|
+
}> | BlockBase<OpCode.operator_subtract, {
|
|
195
|
+
NUM1: BlockInput.Number;
|
|
196
|
+
NUM2: BlockInput.Number;
|
|
197
|
+
}> | BlockBase<OpCode.operator_multiply, {
|
|
198
|
+
NUM1: BlockInput.Number;
|
|
199
|
+
NUM2: BlockInput.Number;
|
|
200
|
+
}> | BlockBase<OpCode.operator_divide, {
|
|
201
|
+
NUM1: BlockInput.Number;
|
|
202
|
+
NUM2: BlockInput.Number;
|
|
203
|
+
}> | BlockBase<OpCode.operator_random, {
|
|
204
|
+
FROM: BlockInput.Number;
|
|
205
|
+
TO: BlockInput.Number;
|
|
206
|
+
}> | BlockBase<OpCode.operator_gt, {
|
|
207
|
+
OPERAND1: BlockInput.Number;
|
|
208
|
+
OPERAND2: BlockInput.Number;
|
|
209
|
+
}> | BlockBase<OpCode.operator_lt, {
|
|
210
|
+
OPERAND1: BlockInput.Number;
|
|
211
|
+
OPERAND2: BlockInput.Number;
|
|
212
|
+
}> | BlockBase<OpCode.operator_equals, {
|
|
213
|
+
OPERAND1: BlockInput.Number;
|
|
214
|
+
OPERAND2: BlockInput.Number;
|
|
215
|
+
}> | BlockBase<OpCode.operator_and, {
|
|
216
|
+
OPERAND1: BlockInput.Boolean;
|
|
217
|
+
OPERAND2: BlockInput.Boolean;
|
|
218
|
+
}> | BlockBase<OpCode.operator_or, {
|
|
219
|
+
OPERAND1: BlockInput.Boolean;
|
|
220
|
+
OPERAND2: BlockInput.Boolean;
|
|
221
|
+
}> | BlockBase<OpCode.operator_not, {
|
|
222
|
+
OPERAND: BlockInput.Boolean;
|
|
223
|
+
}> | BlockBase<OpCode.operator_join, {
|
|
224
|
+
STRING1: BlockInput.String;
|
|
225
|
+
STRING2: BlockInput.String;
|
|
226
|
+
}> | BlockBase<OpCode.operator_letter_of, {
|
|
227
|
+
LETTER: BlockInput.Number;
|
|
228
|
+
STRING: BlockInput.String;
|
|
229
|
+
}> | BlockBase<OpCode.operator_length, {
|
|
230
|
+
STRING: BlockInput.String;
|
|
231
|
+
}> | BlockBase<OpCode.operator_contains, {
|
|
232
|
+
STRING1: BlockInput.String;
|
|
233
|
+
STRING2: BlockInput.String;
|
|
234
|
+
}> | BlockBase<OpCode.operator_mod, {
|
|
235
|
+
NUM1: BlockInput.Number;
|
|
236
|
+
NUM2: BlockInput.Number;
|
|
237
|
+
}> | BlockBase<OpCode.operator_round, {
|
|
238
|
+
NUM: BlockInput.Number;
|
|
239
|
+
}> | BlockBase<OpCode.operator_mathop, {
|
|
240
|
+
OPERATOR: BlockInput.MathopMenu;
|
|
241
|
+
NUM: BlockInput.Number;
|
|
242
|
+
}>;
|
|
243
|
+
export type DataBlock = BlockBase<OpCode.data_variable, {
|
|
244
|
+
VARIABLE: BlockInput.Variable;
|
|
245
|
+
}> | BlockBase<OpCode.data_setvariableto, {
|
|
246
|
+
VARIABLE: BlockInput.Variable;
|
|
247
|
+
VALUE: BlockInput.String;
|
|
248
|
+
}> | BlockBase<OpCode.data_changevariableby, {
|
|
249
|
+
VARIABLE: BlockInput.Variable;
|
|
250
|
+
VALUE: BlockInput.Number;
|
|
251
|
+
}> | BlockBase<OpCode.data_showvariable, {
|
|
252
|
+
VARIABLE: BlockInput.Variable;
|
|
253
|
+
}> | BlockBase<OpCode.data_hidevariable, {
|
|
254
|
+
VARIABLE: BlockInput.Variable;
|
|
255
|
+
}> | BlockBase<OpCode.data_listcontents, {
|
|
256
|
+
LIST: BlockInput.List;
|
|
257
|
+
}> | BlockBase<OpCode.data_addtolist, {
|
|
258
|
+
LIST: BlockInput.List;
|
|
259
|
+
ITEM: BlockInput.String;
|
|
260
|
+
}> | BlockBase<OpCode.data_deleteoflist, {
|
|
261
|
+
LIST: BlockInput.List;
|
|
262
|
+
INDEX: BlockInput.Number;
|
|
263
|
+
}> | BlockBase<OpCode.data_deletealloflist, {
|
|
264
|
+
LIST: BlockInput.List;
|
|
265
|
+
}> | BlockBase<OpCode.data_insertatlist, {
|
|
266
|
+
LIST: BlockInput.List;
|
|
267
|
+
INDEX: BlockInput.Number;
|
|
268
|
+
ITEM: BlockInput.String;
|
|
269
|
+
}> | BlockBase<OpCode.data_replaceitemoflist, {
|
|
270
|
+
LIST: BlockInput.List;
|
|
271
|
+
INDEX: BlockInput.Number;
|
|
272
|
+
ITEM: BlockInput.String;
|
|
273
|
+
}> | BlockBase<OpCode.data_itemoflist, {
|
|
274
|
+
LIST: BlockInput.List;
|
|
275
|
+
INDEX: BlockInput.Number;
|
|
276
|
+
}> | BlockBase<OpCode.data_itemnumoflist, {
|
|
277
|
+
LIST: BlockInput.List;
|
|
278
|
+
ITEM: BlockInput.String;
|
|
279
|
+
}> | BlockBase<OpCode.data_lengthoflist, {
|
|
280
|
+
LIST: BlockInput.List;
|
|
281
|
+
}> | BlockBase<OpCode.data_listcontainsitem, {
|
|
282
|
+
LIST: BlockInput.List;
|
|
283
|
+
ITEM: BlockInput.String;
|
|
284
|
+
}> | BlockBase<OpCode.data_showlist, {
|
|
285
|
+
LIST: BlockInput.List;
|
|
286
|
+
}> | BlockBase<OpCode.data_hidelist, {
|
|
287
|
+
LIST: BlockInput.List;
|
|
288
|
+
}>;
|
|
289
|
+
export type ProcedureBlock = BlockBase<OpCode.procedures_definition, {
|
|
290
|
+
PROCCODE: BlockInput.String;
|
|
291
|
+
ARGUMENTS: BlockInput.CustomBlockArguments;
|
|
292
|
+
WARP: BlockInput.Boolean;
|
|
293
|
+
}> | BlockBase<OpCode.procedures_call, {
|
|
294
|
+
PROCCODE: BlockInput.String;
|
|
295
|
+
INPUTS: BlockInput.CustomBlockInputValues;
|
|
296
|
+
}>;
|
|
297
|
+
export type ArgumentBlock = BlockBase<OpCode.argument_reporter_string_number, {
|
|
298
|
+
VALUE: BlockInput.String;
|
|
299
|
+
}> | BlockBase<OpCode.argument_reporter_boolean, {
|
|
300
|
+
VALUE: BlockInput.String;
|
|
301
|
+
}>;
|
|
302
|
+
export type CustomBlock = ProcedureBlock | ArgumentBlock;
|
|
303
|
+
export type MusicBlock = BlockBase<OpCode.music_playDrumForBeats, {
|
|
304
|
+
DRUM: BlockInput.MusicDrum;
|
|
305
|
+
BEATS: BlockInput.Number;
|
|
306
|
+
}> | BlockBase<OpCode.music_restForBeats, {
|
|
307
|
+
BEATS: BlockInput.Number;
|
|
308
|
+
}> | BlockBase<OpCode.music_playNoteForBeats, {
|
|
309
|
+
NOTE: BlockInput.MusicInstrument;
|
|
310
|
+
BEATS: BlockInput.Number;
|
|
311
|
+
}> | BlockBase<OpCode.music_setInstrument, {
|
|
312
|
+
INSTRUMENT: BlockInput.Number;
|
|
313
|
+
}> | BlockBase<OpCode.music_setTempo, {
|
|
314
|
+
TEMPO: BlockInput.Number;
|
|
315
|
+
}> | BlockBase<OpCode.music_changeTempo, {
|
|
316
|
+
TEMPO: BlockInput.Number;
|
|
317
|
+
}> | BlockBase<OpCode.music_getTempo, {}> | BlockBase<OpCode.music_midiPlayDrumForBeats, {
|
|
318
|
+
DRUM: BlockInput.Number;
|
|
319
|
+
BEATS: BlockInput.Number;
|
|
320
|
+
}> | BlockBase<OpCode.music_midiSetInstrument, {
|
|
321
|
+
INSTRUMENT: BlockInput.Number;
|
|
322
|
+
}>;
|
|
323
|
+
export type PenBlock = BlockBase<OpCode.pen_clear, {}> | BlockBase<OpCode.pen_stamp, {}> | BlockBase<OpCode.pen_penDown, {}> | BlockBase<OpCode.pen_penUp, {}> | BlockBase<OpCode.pen_setPenColorToColor, {
|
|
324
|
+
COLOR: BlockInput.Color;
|
|
325
|
+
}> | BlockBase<OpCode.pen_changePenColorParamBy, {
|
|
326
|
+
COLOR_PARAM: BlockInput.PenColorParam;
|
|
327
|
+
VALUE: BlockInput.Number;
|
|
328
|
+
}> | BlockBase<OpCode.pen_setPenColorParamTo, {
|
|
329
|
+
COLOR_PARAM: BlockInput.PenColorParam;
|
|
330
|
+
VALUE: BlockInput.Number;
|
|
331
|
+
}> | BlockBase<OpCode.pen_changePenSizeBy, {
|
|
332
|
+
SIZE: BlockInput.Number;
|
|
333
|
+
}> | BlockBase<OpCode.pen_setPenSizeTo, {
|
|
334
|
+
SIZE: BlockInput.Number;
|
|
335
|
+
}> | BlockBase<OpCode.pen_setPenShadeToNumber, {
|
|
336
|
+
SHADE: BlockInput.Number;
|
|
337
|
+
}> | BlockBase<OpCode.pen_changePenShadeBy, {
|
|
338
|
+
SHADE: BlockInput.Number;
|
|
339
|
+
}> | BlockBase<OpCode.pen_setPenHueToNumber, {
|
|
340
|
+
HUE: BlockInput.Number;
|
|
341
|
+
}> | BlockBase<OpCode.pen_changePenHueBy, {
|
|
342
|
+
HUE: BlockInput.Number;
|
|
343
|
+
}>;
|
|
344
|
+
export type VideoSensingBlock = BlockBase<OpCode.videoSensing_whenMotionGreaterThan, {
|
|
345
|
+
REFERENCE: BlockInput.Number;
|
|
346
|
+
}> | BlockBase<OpCode.videoSensing_videoOn, {
|
|
347
|
+
ATTRIBUTE: BlockInput.VideoSensingAttribute;
|
|
348
|
+
SUBJECT: BlockInput.VideoSensingSubject;
|
|
349
|
+
}> | BlockBase<OpCode.videoSensing_videoToggle, {
|
|
350
|
+
VIDEO_STATE: BlockInput.VideoSensingVideoState;
|
|
351
|
+
}> | BlockBase<OpCode.videoSensing_setVideoTransparency, {
|
|
352
|
+
TRANSPARENCY: BlockInput.Number;
|
|
353
|
+
}>;
|
|
354
|
+
export type WeDo2Block = BlockBase<OpCode.wedo2_motorOnFor, {
|
|
355
|
+
MOTOR_ID: BlockInput.WeDo2MotorId;
|
|
356
|
+
DURATION: BlockInput.Number;
|
|
357
|
+
}> | BlockBase<OpCode.wedo2_motorOn, {
|
|
358
|
+
MOTOR_ID: BlockInput.WeDo2MotorId;
|
|
359
|
+
}> | BlockBase<OpCode.wedo2_motorOff, {
|
|
360
|
+
MOTOR_ID: BlockInput.WeDo2MotorId;
|
|
361
|
+
}> | BlockBase<OpCode.wedo2_startMotorPower, {
|
|
362
|
+
MOTOR_ID: BlockInput.WeDo2MotorId;
|
|
363
|
+
POWER: BlockInput.Number;
|
|
364
|
+
}> | BlockBase<OpCode.wedo2_setMotorDirection, {
|
|
365
|
+
MOTOR_ID: BlockInput.WeDo2MotorId;
|
|
366
|
+
MOTOR_DIRECTION: BlockInput.WeDo2MotorDirection;
|
|
367
|
+
}> | BlockBase<OpCode.wedo2_setLightHue, {
|
|
368
|
+
HUE: BlockInput.Number;
|
|
369
|
+
}> | BlockBase<OpCode.wedo2_whenDistance, {
|
|
370
|
+
OP: BlockInput.WeDo2Op;
|
|
371
|
+
REFERENCE: BlockInput.Number;
|
|
372
|
+
}> | BlockBase<OpCode.wedo2_whenTilted, {
|
|
373
|
+
TILT_DIRECTION_ANY: BlockInput.WeDo2TiltDirectionAny;
|
|
374
|
+
}> | BlockBase<OpCode.wedo2_getDistance, {}> | BlockBase<OpCode.wedo2_isTilted, {
|
|
375
|
+
TILT_DIRECTION_ANY: BlockInput.WeDo2TiltDirectionAny;
|
|
376
|
+
}> | BlockBase<OpCode.wedo2_getTiltAngle, {
|
|
377
|
+
TILT_DIRECTION: BlockInput.WeDo2TiltDirection;
|
|
378
|
+
}> | BlockBase<OpCode.wedo2_playNoteFor, {
|
|
379
|
+
NOTE: BlockInput.Number;
|
|
380
|
+
Duration: BlockInput.Number;
|
|
381
|
+
}>;
|
|
382
|
+
export type ExtensionBlock = MusicBlock | PenBlock | VideoSensingBlock | WeDo2Block;
|
|
383
|
+
export type KnownBlock = MotionBlock | LooksBlock | SoundBlock | EventBlock | ControlBlock | SensingBlock | OperatorBlock | DataBlock | CustomBlock | ExtensionBlock;
|
|
384
|
+
export type UnknownBlock = BlockBase<Exclude<OpCode, KnownBlock["opcode"]>, {
|
|
385
|
+
[key: string]: BlockInput.Any;
|
|
386
|
+
}>;
|
|
387
|
+
export type Block = KnownBlock | UnknownBlock;
|
|
388
|
+
export default Block;
|