Comparing version 0.0.1-prealpha.2 to 0.0.1-prealpha.3
@@ -7,2 +7,5 @@ export interface Queryable { | ||
} | ||
export interface SB3ProjectJSON { | ||
targets: SpriteProperties[]; | ||
} | ||
export interface SpriteProperties { | ||
@@ -48,4 +51,7 @@ isStage: boolean; | ||
attr: string; | ||
value: string; | ||
isType: boolean; | ||
queryValues: { | ||
opcode: string; | ||
type: string; | ||
shape: string; | ||
}; | ||
} |
@@ -7,3 +7,4 @@ declare enum BlockShapes { | ||
CAP = "cap", | ||
STACK = "stack" | ||
STACK = "stack", | ||
CUSTOM = "custom" | ||
} | ||
@@ -76,3 +77,94 @@ declare enum BlockOpcodes { | ||
LOOKS_NEXTCOSTUME = "looks_nextcostume", | ||
LOOKS_SWITCHBACKDROPTO = "looks_switchbackdropto" | ||
LOOKS_SWITCHBACKDROPTO = "looks_switchbackdropto", | ||
LOOKS_BACKDROPS = "looks_backdrops", | ||
LOOKS_GOTOFRONTBACK = "looks_gotofrontback", | ||
LOOKS_GOFORWARDBACKWARDLAYERS = "looks_goforwardbackwardlayers", | ||
LOOKS_BACKDROPNUMBERNAME = "looks_backdropnumbername", | ||
LOOKS_COSTUMENUMBERNAME = "looks_costumenumbername", | ||
LOOKS_SWITCHBACKDROPTOANDWAIT = "looks_switchbackdroptoandwait", | ||
LOOKS_NEXTBACKDROP = "looks_nextbackdrop", | ||
MOTION_MOVESTEPS = "motion_movesteps", | ||
MOTION_TURNRIGHT = "motion_turnright", | ||
MOTION_TURNLEFT = "motion_turnleft", | ||
MOTION_POINTINDIRECTION = "motion_pointindirection", | ||
MOTION_POINTTOWARDS_MENU = "motion_pointtowards_menu", | ||
MOTION_POINTOWARDS = "motion_pointtowards", | ||
MOTION_GOTO_MENU = "motion_goto_menu", | ||
MOTION_GOTOXY = "motion_gotoxy", | ||
MOTION_GLIDESECTOXY = "motion_glidesecstoxy", | ||
MOTION_GLIDETO_MENU = "motion_glideto_menu", | ||
MOTION_GLIDETO = "motion_glideto", | ||
MOTION_CHANGEXBY = "motion_changexby", | ||
MOTION_SETX = "motion_setx", | ||
MOTION_SETY = "motion_sety", | ||
MOTION_IFONEDGEBOUNCE = "motion_ifonedgebounce", | ||
MOTION_SETROTATIONSTYLE = "motion_setrotationstyle", | ||
MOTION_XPOSITION = "motion_xposition", | ||
MOTION_YPOSITION = "motion_yposition", | ||
MOTION_DIRECTION = "motion_direction", | ||
MOTION_SCROLL_RIGHT = "motion_scroll_right", | ||
MOTION_SCROLL_LEFT = "motion_scroll_left", | ||
MOTION_ALIGN_SCENE = "motion_align_scene", | ||
MOTION_XSCROLL = "motion_xscroll", | ||
MOTION_YSCROLL = "motion_yscroll", | ||
OPERATOR_ADD = "operator_add", | ||
OPERATOR_SUBTRACT = "operator_subtract", | ||
OPERATOR_MULTIPLY = "operator_multiply", | ||
OPERATOR_DIVIDE = "operator_divide", | ||
OPERATOR_RANDOM = "operator_random", | ||
OPERATOR_LT = "operator_lt", | ||
OPERATOR_EQUALS = "operator_equals", | ||
OPERATOR_GT = "operator_gt", | ||
OPERATOR_AND = "operator_and", | ||
OPERATOR_OR = "operator_or", | ||
OPERATOR_NOT = "operator_not", | ||
OPERATOR_JOIN = "operator_join", | ||
OPERATOR_LETTER_OF = "operator_letter_of", | ||
OPERATOR_LENGTH = "operator_length", | ||
OPERATOR_CONTAINS = "operator_contains", | ||
OPERATOR_MOD = "operator_mod", | ||
OPERATOR_ROUND = "operator_round", | ||
OPERATOR_MATHOP = "operator_mathop", | ||
PROCEDURES_DEFINITION = "procedures_definition", | ||
PROCEDURES_CALL = "procedures_call", | ||
PROCEDURES_PROTOTYPE = "procedures_prototype", | ||
PROCEDURES_DECLARATION = "procedures_declaration", | ||
ARGUMENT_REPORTER_BOOLEAN = "argument_reporter_boolean", | ||
ARGUMENT_REPORTER_STRING_NUMBER = "argument_reporter_string_number", | ||
ARGUMENT_EDITOR_BOOLEAN = "argument_editor_boolean", | ||
ARGUMENT_EDITOR_STRING_NUMBER = "argument_editor_string_number", | ||
SENSING_TOUCHINGOBJECT = "sensing_touchingobject", | ||
SENSING_TOUCHINGOBJECTMENU = "sensing_touchingobjectmenu", | ||
SENSING_TOUCHINGCOLOR = "sensing_touchingcolor", | ||
SENSING_COLORISTOUCHINGCOLOR = "sensing_coloristouchingcolor", | ||
SENSING_DISTANCETO = "sensing_distanceto", | ||
SENSING_DISTANCETOMENU = "sensing_distancetomenu", | ||
SENSING_ASKANDWAIT = "sensing_askandwait", | ||
SENSING_ANSWER = "sensing_answer", | ||
SENSING_KEYPRESSED = "sensing_keypressed", | ||
SENSING_KEYOPTIONS = "sensing_keyoptions", | ||
SENSING_MOUSEDOWN = "sensing_mousedown", | ||
SENSING_MOUSEX = "sensing_mousex", | ||
SENSING_MOUSEY = "sensing_mousey", | ||
SENSING_SETDRAGMODE = "sensing_setdragmode", | ||
SENSING_LOUDNESS = "sensing_loudness", | ||
SENSING_LOUD = "sensing_loud", | ||
SENSING_TIMER = "sensing_timer", | ||
SENSING_RESETTIMER = "sensing_resettimer", | ||
SENSING_OF_OBJECT_MENU = "sensing_of_object_menu", | ||
SENSING_OF = "sensing_of", | ||
SENSING_CURRENT = "sensing_current", | ||
SENSING_DAYSSINCE2000 = "sensing_dayssince2000", | ||
SENSING_USERNAME = "sensing_username", | ||
SENSING_USERID = "sensing_userid", | ||
SOUND_SOUNDS_MENU = "sounds_sounds_menu", | ||
SOUND_PLAY = "sound_play", | ||
SOUND_PLAYUNTILDONE = "sound_playuntildone", | ||
SOUND_STOPALLSOUNDS = "sound_stopallsounds", | ||
SOUND_SETEFFECTTO = "sound_seteffectto", | ||
SOUND_CHANGEEFFECTBY = "sound_changeeffectby", | ||
SOUND_CLEAREFFECTS = "sound_cleareffects", | ||
SOUND_CHANGEVOLUMEBY = "sound_changevolumeby", | ||
SOUND_SETVOLUMETO = "sound_setvolumeto", | ||
SOUND_VOLUME = "sound_volume" | ||
} | ||
@@ -146,3 +238,94 @@ export declare const BlockOpcodeToShape: { | ||
[BlockOpcodes.LOOKS_SWITCHBACKDROPTO]: BlockShapes; | ||
[BlockOpcodes.LOOKS_BACKDROPS]: BlockShapes; | ||
[BlockOpcodes.LOOKS_GOTOFRONTBACK]: BlockShapes; | ||
[BlockOpcodes.LOOKS_GOFORWARDBACKWARDLAYERS]: BlockShapes; | ||
[BlockOpcodes.LOOKS_BACKDROPNUMBERNAME]: BlockShapes; | ||
[BlockOpcodes.LOOKS_COSTUMENUMBERNAME]: BlockShapes; | ||
[BlockOpcodes.LOOKS_SWITCHBACKDROPTOANDWAIT]: BlockShapes; | ||
[BlockOpcodes.LOOKS_NEXTBACKDROP]: BlockShapes; | ||
[BlockOpcodes.MOTION_MOVESTEPS]: BlockShapes; | ||
[BlockOpcodes.MOTION_TURNRIGHT]: BlockShapes; | ||
[BlockOpcodes.MOTION_TURNLEFT]: BlockShapes; | ||
[BlockOpcodes.MOTION_POINTINDIRECTION]: BlockShapes; | ||
[BlockOpcodes.MOTION_POINTTOWARDS_MENU]: BlockShapes; | ||
[BlockOpcodes.MOTION_POINTOWARDS]: BlockShapes; | ||
[BlockOpcodes.MOTION_GOTO_MENU]: BlockShapes; | ||
[BlockOpcodes.MOTION_GOTOXY]: BlockShapes; | ||
[BlockOpcodes.MOTION_GLIDESECTOXY]: BlockShapes; | ||
[BlockOpcodes.MOTION_GLIDETO_MENU]: BlockShapes; | ||
[BlockOpcodes.MOTION_GLIDETO]: BlockShapes; | ||
[BlockOpcodes.MOTION_CHANGEXBY]: BlockShapes; | ||
[BlockOpcodes.MOTION_SETX]: BlockShapes; | ||
[BlockOpcodes.MOTION_SETY]: BlockShapes; | ||
[BlockOpcodes.MOTION_IFONEDGEBOUNCE]: BlockShapes; | ||
[BlockOpcodes.MOTION_SETROTATIONSTYLE]: BlockShapes; | ||
[BlockOpcodes.MOTION_XPOSITION]: BlockShapes; | ||
[BlockOpcodes.MOTION_YPOSITION]: BlockShapes; | ||
[BlockOpcodes.MOTION_DIRECTION]: BlockShapes; | ||
[BlockOpcodes.MOTION_SCROLL_RIGHT]: BlockShapes; | ||
[BlockOpcodes.MOTION_SCROLL_LEFT]: BlockShapes; | ||
[BlockOpcodes.MOTION_ALIGN_SCENE]: BlockShapes; | ||
[BlockOpcodes.MOTION_XSCROLL]: BlockShapes; | ||
[BlockOpcodes.MOTION_YSCROLL]: BlockShapes; | ||
[BlockOpcodes.OPERATOR_ADD]: BlockShapes; | ||
[BlockOpcodes.OPERATOR_SUBTRACT]: BlockShapes; | ||
[BlockOpcodes.OPERATOR_MULTIPLY]: BlockShapes; | ||
[BlockOpcodes.OPERATOR_DIVIDE]: BlockShapes; | ||
[BlockOpcodes.OPERATOR_RANDOM]: BlockShapes; | ||
[BlockOpcodes.OPERATOR_LT]: BlockShapes; | ||
[BlockOpcodes.OPERATOR_EQUALS]: BlockShapes; | ||
[BlockOpcodes.OPERATOR_GT]: BlockShapes; | ||
[BlockOpcodes.OPERATOR_AND]: BlockShapes; | ||
[BlockOpcodes.OPERATOR_OR]: BlockShapes; | ||
[BlockOpcodes.OPERATOR_NOT]: BlockShapes; | ||
[BlockOpcodes.OPERATOR_JOIN]: BlockShapes; | ||
[BlockOpcodes.OPERATOR_LETTER_OF]: BlockShapes; | ||
[BlockOpcodes.OPERATOR_LENGTH]: BlockShapes; | ||
[BlockOpcodes.OPERATOR_CONTAINS]: BlockShapes; | ||
[BlockOpcodes.OPERATOR_MOD]: BlockShapes; | ||
[BlockOpcodes.OPERATOR_ROUND]: BlockShapes; | ||
[BlockOpcodes.OPERATOR_MATHOP]: BlockShapes; | ||
[BlockOpcodes.PROCEDURES_DEFINITION]: BlockShapes; | ||
[BlockOpcodes.PROCEDURES_CALL]: BlockShapes; | ||
[BlockOpcodes.PROCEDURES_PROTOTYPE]: BlockShapes; | ||
[BlockOpcodes.PROCEDURES_DECLARATION]: BlockShapes; | ||
[BlockOpcodes.ARGUMENT_REPORTER_BOOLEAN]: BlockShapes; | ||
[BlockOpcodes.ARGUMENT_REPORTER_STRING_NUMBER]: BlockShapes; | ||
[BlockOpcodes.ARGUMENT_EDITOR_BOOLEAN]: BlockShapes; | ||
[BlockOpcodes.ARGUMENT_EDITOR_STRING_NUMBER]: BlockShapes; | ||
[BlockOpcodes.SENSING_TOUCHINGOBJECT]: BlockShapes; | ||
[BlockOpcodes.SENSING_TOUCHINGOBJECTMENU]: BlockShapes; | ||
[BlockOpcodes.SENSING_TOUCHINGCOLOR]: BlockShapes; | ||
[BlockOpcodes.SENSING_COLORISTOUCHINGCOLOR]: BlockShapes; | ||
[BlockOpcodes.SENSING_DISTANCETO]: BlockShapes; | ||
[BlockOpcodes.SENSING_DISTANCETOMENU]: BlockShapes; | ||
[BlockOpcodes.SENSING_ASKANDWAIT]: BlockShapes; | ||
[BlockOpcodes.SENSING_ANSWER]: BlockShapes; | ||
[BlockOpcodes.SENSING_KEYPRESSED]: BlockShapes; | ||
[BlockOpcodes.SENSING_KEYOPTIONS]: BlockShapes; | ||
[BlockOpcodes.SENSING_MOUSEDOWN]: BlockShapes; | ||
[BlockOpcodes.SENSING_MOUSEX]: BlockShapes; | ||
[BlockOpcodes.SENSING_MOUSEY]: BlockShapes; | ||
[BlockOpcodes.SENSING_SETDRAGMODE]: BlockShapes; | ||
[BlockOpcodes.SENSING_LOUDNESS]: BlockShapes; | ||
[BlockOpcodes.SENSING_LOUD]: BlockShapes; | ||
[BlockOpcodes.SENSING_TIMER]: BlockShapes; | ||
[BlockOpcodes.SENSING_RESETTIMER]: BlockShapes; | ||
[BlockOpcodes.SENSING_OF_OBJECT_MENU]: BlockShapes; | ||
[BlockOpcodes.SENSING_OF]: BlockShapes; | ||
[BlockOpcodes.SENSING_CURRENT]: BlockShapes; | ||
[BlockOpcodes.SENSING_DAYSSINCE2000]: BlockShapes; | ||
[BlockOpcodes.SENSING_USERNAME]: BlockShapes; | ||
[BlockOpcodes.SENSING_USERID]: BlockShapes; | ||
[BlockOpcodes.SOUND_SOUNDS_MENU]: BlockShapes; | ||
[BlockOpcodes.SOUND_PLAY]: BlockShapes; | ||
[BlockOpcodes.SOUND_PLAYUNTILDONE]: BlockShapes; | ||
[BlockOpcodes.SOUND_STOPALLSOUNDS]: BlockShapes; | ||
[BlockOpcodes.SOUND_SETEFFECTTO]: BlockShapes; | ||
[BlockOpcodes.SOUND_CHANGEEFFECTBY]: BlockShapes; | ||
[BlockOpcodes.SOUND_CLEAREFFECTS]: BlockShapes; | ||
[BlockOpcodes.SOUND_CHANGEVOLUMEBY]: BlockShapes; | ||
[BlockOpcodes.SOUND_SETVOLUMETO]: BlockShapes; | ||
[BlockOpcodes.SOUND_VOLUME]: BlockShapes; | ||
}; | ||
export {}; |
@@ -11,2 +11,3 @@ "use strict"; | ||
BlockShapes["STACK"] = "stack"; | ||
BlockShapes["CUSTOM"] = "custom"; | ||
})(BlockShapes || (BlockShapes = {})); | ||
@@ -81,2 +82,93 @@ var BlockOpcodes; | ||
BlockOpcodes["LOOKS_SWITCHBACKDROPTO"] = "looks_switchbackdropto"; | ||
BlockOpcodes["LOOKS_BACKDROPS"] = "looks_backdrops"; | ||
BlockOpcodes["LOOKS_GOTOFRONTBACK"] = "looks_gotofrontback"; | ||
BlockOpcodes["LOOKS_GOFORWARDBACKWARDLAYERS"] = "looks_goforwardbackwardlayers"; | ||
BlockOpcodes["LOOKS_BACKDROPNUMBERNAME"] = "looks_backdropnumbername"; | ||
BlockOpcodes["LOOKS_COSTUMENUMBERNAME"] = "looks_costumenumbername"; | ||
BlockOpcodes["LOOKS_SWITCHBACKDROPTOANDWAIT"] = "looks_switchbackdroptoandwait"; | ||
BlockOpcodes["LOOKS_NEXTBACKDROP"] = "looks_nextbackdrop"; | ||
BlockOpcodes["MOTION_MOVESTEPS"] = "motion_movesteps"; | ||
BlockOpcodes["MOTION_TURNRIGHT"] = "motion_turnright"; | ||
BlockOpcodes["MOTION_TURNLEFT"] = "motion_turnleft"; | ||
BlockOpcodes["MOTION_POINTINDIRECTION"] = "motion_pointindirection"; | ||
BlockOpcodes["MOTION_POINTTOWARDS_MENU"] = "motion_pointtowards_menu"; | ||
BlockOpcodes["MOTION_POINTOWARDS"] = "motion_pointtowards"; | ||
BlockOpcodes["MOTION_GOTO_MENU"] = "motion_goto_menu"; | ||
BlockOpcodes["MOTION_GOTOXY"] = "motion_gotoxy"; | ||
BlockOpcodes["MOTION_GLIDESECTOXY"] = "motion_glidesecstoxy"; | ||
BlockOpcodes["MOTION_GLIDETO_MENU"] = "motion_glideto_menu"; | ||
BlockOpcodes["MOTION_GLIDETO"] = "motion_glideto"; | ||
BlockOpcodes["MOTION_CHANGEXBY"] = "motion_changexby"; | ||
BlockOpcodes["MOTION_SETX"] = "motion_setx"; | ||
BlockOpcodes["MOTION_SETY"] = "motion_sety"; | ||
BlockOpcodes["MOTION_IFONEDGEBOUNCE"] = "motion_ifonedgebounce"; | ||
BlockOpcodes["MOTION_SETROTATIONSTYLE"] = "motion_setrotationstyle"; | ||
BlockOpcodes["MOTION_XPOSITION"] = "motion_xposition"; | ||
BlockOpcodes["MOTION_YPOSITION"] = "motion_yposition"; | ||
BlockOpcodes["MOTION_DIRECTION"] = "motion_direction"; | ||
BlockOpcodes["MOTION_SCROLL_RIGHT"] = "motion_scroll_right"; | ||
BlockOpcodes["MOTION_SCROLL_LEFT"] = "motion_scroll_left"; | ||
BlockOpcodes["MOTION_ALIGN_SCENE"] = "motion_align_scene"; | ||
BlockOpcodes["MOTION_XSCROLL"] = "motion_xscroll"; | ||
BlockOpcodes["MOTION_YSCROLL"] = "motion_yscroll"; | ||
BlockOpcodes["OPERATOR_ADD"] = "operator_add"; | ||
BlockOpcodes["OPERATOR_SUBTRACT"] = "operator_subtract"; | ||
BlockOpcodes["OPERATOR_MULTIPLY"] = "operator_multiply"; | ||
BlockOpcodes["OPERATOR_DIVIDE"] = "operator_divide"; | ||
BlockOpcodes["OPERATOR_RANDOM"] = "operator_random"; | ||
BlockOpcodes["OPERATOR_LT"] = "operator_lt"; | ||
BlockOpcodes["OPERATOR_EQUALS"] = "operator_equals"; | ||
BlockOpcodes["OPERATOR_GT"] = "operator_gt"; | ||
BlockOpcodes["OPERATOR_AND"] = "operator_and"; | ||
BlockOpcodes["OPERATOR_OR"] = "operator_or"; | ||
BlockOpcodes["OPERATOR_NOT"] = "operator_not"; | ||
BlockOpcodes["OPERATOR_JOIN"] = "operator_join"; | ||
BlockOpcodes["OPERATOR_LETTER_OF"] = "operator_letter_of"; | ||
BlockOpcodes["OPERATOR_LENGTH"] = "operator_length"; | ||
BlockOpcodes["OPERATOR_CONTAINS"] = "operator_contains"; | ||
BlockOpcodes["OPERATOR_MOD"] = "operator_mod"; | ||
BlockOpcodes["OPERATOR_ROUND"] = "operator_round"; | ||
BlockOpcodes["OPERATOR_MATHOP"] = "operator_mathop"; | ||
BlockOpcodes["PROCEDURES_DEFINITION"] = "procedures_definition"; | ||
BlockOpcodes["PROCEDURES_CALL"] = "procedures_call"; | ||
BlockOpcodes["PROCEDURES_PROTOTYPE"] = "procedures_prototype"; | ||
BlockOpcodes["PROCEDURES_DECLARATION"] = "procedures_declaration"; | ||
BlockOpcodes["ARGUMENT_REPORTER_BOOLEAN"] = "argument_reporter_boolean"; | ||
BlockOpcodes["ARGUMENT_REPORTER_STRING_NUMBER"] = "argument_reporter_string_number"; | ||
BlockOpcodes["ARGUMENT_EDITOR_BOOLEAN"] = "argument_editor_boolean"; | ||
BlockOpcodes["ARGUMENT_EDITOR_STRING_NUMBER"] = "argument_editor_string_number"; | ||
BlockOpcodes["SENSING_TOUCHINGOBJECT"] = "sensing_touchingobject"; | ||
BlockOpcodes["SENSING_TOUCHINGOBJECTMENU"] = "sensing_touchingobjectmenu"; | ||
BlockOpcodes["SENSING_TOUCHINGCOLOR"] = "sensing_touchingcolor"; | ||
BlockOpcodes["SENSING_COLORISTOUCHINGCOLOR"] = "sensing_coloristouchingcolor"; | ||
BlockOpcodes["SENSING_DISTANCETO"] = "sensing_distanceto"; | ||
BlockOpcodes["SENSING_DISTANCETOMENU"] = "sensing_distancetomenu"; | ||
BlockOpcodes["SENSING_ASKANDWAIT"] = "sensing_askandwait"; | ||
BlockOpcodes["SENSING_ANSWER"] = "sensing_answer"; | ||
BlockOpcodes["SENSING_KEYPRESSED"] = "sensing_keypressed"; | ||
BlockOpcodes["SENSING_KEYOPTIONS"] = "sensing_keyoptions"; | ||
BlockOpcodes["SENSING_MOUSEDOWN"] = "sensing_mousedown"; | ||
BlockOpcodes["SENSING_MOUSEX"] = "sensing_mousex"; | ||
BlockOpcodes["SENSING_MOUSEY"] = "sensing_mousey"; | ||
BlockOpcodes["SENSING_SETDRAGMODE"] = "sensing_setdragmode"; | ||
BlockOpcodes["SENSING_LOUDNESS"] = "sensing_loudness"; | ||
BlockOpcodes["SENSING_LOUD"] = "sensing_loud"; | ||
BlockOpcodes["SENSING_TIMER"] = "sensing_timer"; | ||
BlockOpcodes["SENSING_RESETTIMER"] = "sensing_resettimer"; | ||
BlockOpcodes["SENSING_OF_OBJECT_MENU"] = "sensing_of_object_menu"; | ||
BlockOpcodes["SENSING_OF"] = "sensing_of"; | ||
BlockOpcodes["SENSING_CURRENT"] = "sensing_current"; | ||
BlockOpcodes["SENSING_DAYSSINCE2000"] = "sensing_dayssince2000"; | ||
BlockOpcodes["SENSING_USERNAME"] = "sensing_username"; | ||
BlockOpcodes["SENSING_USERID"] = "sensing_userid"; | ||
BlockOpcodes["SOUND_SOUNDS_MENU"] = "sounds_sounds_menu"; | ||
BlockOpcodes["SOUND_PLAY"] = "sound_play"; | ||
BlockOpcodes["SOUND_PLAYUNTILDONE"] = "sound_playuntildone"; | ||
BlockOpcodes["SOUND_STOPALLSOUNDS"] = "sound_stopallsounds"; | ||
BlockOpcodes["SOUND_SETEFFECTTO"] = "sound_seteffectto"; | ||
BlockOpcodes["SOUND_CHANGEEFFECTBY"] = "sound_changeeffectby"; | ||
BlockOpcodes["SOUND_CLEAREFFECTS"] = "sound_cleareffects"; | ||
BlockOpcodes["SOUND_CHANGEVOLUMEBY"] = "sound_changevolumeby"; | ||
BlockOpcodes["SOUND_SETVOLUMETO"] = "sound_setvolumeto"; | ||
BlockOpcodes["SOUND_VOLUME"] = "sound_volume"; | ||
})(BlockOpcodes || (BlockOpcodes = {})); | ||
@@ -149,4 +241,95 @@ exports.BlockOpcodeToShape = { | ||
[BlockOpcodes.LOOKS_NEXTCOSTUME]: BlockShapes.STACK, | ||
[BlockOpcodes.LOOKS_SWITCHBACKDROPTO]: BlockShapes.STACK | ||
[BlockOpcodes.LOOKS_SWITCHBACKDROPTO]: BlockShapes.STACK, | ||
[BlockOpcodes.LOOKS_BACKDROPS]: BlockShapes.REPORTER, | ||
[BlockOpcodes.LOOKS_GOTOFRONTBACK]: BlockShapes.REPORTER, | ||
[BlockOpcodes.LOOKS_GOFORWARDBACKWARDLAYERS]: BlockShapes.STACK, | ||
[BlockOpcodes.LOOKS_BACKDROPNUMBERNAME]: BlockShapes.REPORTER, | ||
[BlockOpcodes.LOOKS_COSTUMENUMBERNAME]: BlockShapes.REPORTER, | ||
[BlockOpcodes.LOOKS_SWITCHBACKDROPTOANDWAIT]: BlockShapes.STACK, | ||
[BlockOpcodes.LOOKS_NEXTBACKDROP]: BlockShapes.STACK, | ||
[BlockOpcodes.MOTION_MOVESTEPS]: BlockShapes.STACK, | ||
[BlockOpcodes.MOTION_TURNRIGHT]: BlockShapes.STACK, | ||
[BlockOpcodes.MOTION_TURNLEFT]: BlockShapes.STACK, | ||
[BlockOpcodes.MOTION_POINTINDIRECTION]: BlockShapes.STACK, | ||
[BlockOpcodes.MOTION_POINTTOWARDS_MENU]: BlockShapes.REPORTER, | ||
[BlockOpcodes.MOTION_POINTOWARDS]: BlockShapes.STACK, | ||
[BlockOpcodes.MOTION_GOTO_MENU]: BlockShapes.REPORTER, | ||
[BlockOpcodes.MOTION_GOTOXY]: BlockShapes.STACK, | ||
[BlockOpcodes.MOTION_GLIDESECTOXY]: BlockShapes.STACK, | ||
[BlockOpcodes.MOTION_GLIDETO_MENU]: BlockShapes.REPORTER, | ||
[BlockOpcodes.MOTION_GLIDETO]: BlockShapes.STACK, | ||
[BlockOpcodes.MOTION_CHANGEXBY]: BlockShapes.STACK, | ||
[BlockOpcodes.MOTION_SETX]: BlockShapes.STACK, | ||
[BlockOpcodes.MOTION_SETY]: BlockShapes.STACK, | ||
[BlockOpcodes.MOTION_IFONEDGEBOUNCE]: BlockShapes.STACK, | ||
[BlockOpcodes.MOTION_SETROTATIONSTYLE]: BlockShapes.STACK, | ||
[BlockOpcodes.MOTION_XPOSITION]: BlockShapes.REPORTER, | ||
[BlockOpcodes.MOTION_YPOSITION]: BlockShapes.REPORTER, | ||
[BlockOpcodes.MOTION_DIRECTION]: BlockShapes.REPORTER, | ||
[BlockOpcodes.MOTION_SCROLL_RIGHT]: BlockShapes.STACK, | ||
[BlockOpcodes.MOTION_SCROLL_LEFT]: BlockShapes.STACK, | ||
[BlockOpcodes.MOTION_ALIGN_SCENE]: BlockShapes.STACK, | ||
[BlockOpcodes.MOTION_XSCROLL]: BlockShapes.STACK, | ||
[BlockOpcodes.MOTION_YSCROLL]: BlockShapes.STACK, | ||
[BlockOpcodes.OPERATOR_ADD]: BlockShapes.REPORTER, | ||
[BlockOpcodes.OPERATOR_SUBTRACT]: BlockShapes.REPORTER, | ||
[BlockOpcodes.OPERATOR_MULTIPLY]: BlockShapes.REPORTER, | ||
[BlockOpcodes.OPERATOR_DIVIDE]: BlockShapes.REPORTER, | ||
[BlockOpcodes.OPERATOR_RANDOM]: BlockShapes.REPORTER, | ||
[BlockOpcodes.OPERATOR_LT]: BlockShapes.BOOLEAN, | ||
[BlockOpcodes.OPERATOR_EQUALS]: BlockShapes.BOOLEAN, | ||
[BlockOpcodes.OPERATOR_GT]: BlockShapes.BOOLEAN, | ||
[BlockOpcodes.OPERATOR_AND]: BlockShapes.BOOLEAN, | ||
[BlockOpcodes.OPERATOR_OR]: BlockShapes.BOOLEAN, | ||
[BlockOpcodes.OPERATOR_NOT]: BlockShapes.BOOLEAN, | ||
[BlockOpcodes.OPERATOR_JOIN]: BlockShapes.REPORTER, | ||
[BlockOpcodes.OPERATOR_LETTER_OF]: BlockShapes.REPORTER, | ||
[BlockOpcodes.OPERATOR_LENGTH]: BlockShapes.REPORTER, | ||
[BlockOpcodes.OPERATOR_CONTAINS]: BlockShapes.BOOLEAN, | ||
[BlockOpcodes.OPERATOR_MOD]: BlockShapes.REPORTER, | ||
[BlockOpcodes.OPERATOR_ROUND]: BlockShapes.REPORTER, | ||
[BlockOpcodes.OPERATOR_MATHOP]: BlockShapes.REPORTER, | ||
[BlockOpcodes.PROCEDURES_DEFINITION]: BlockShapes.CUSTOM, | ||
[BlockOpcodes.PROCEDURES_CALL]: BlockShapes.STACK, | ||
[BlockOpcodes.PROCEDURES_PROTOTYPE]: BlockShapes.STACK, | ||
[BlockOpcodes.PROCEDURES_DECLARATION]: BlockShapes.STACK, | ||
[BlockOpcodes.ARGUMENT_REPORTER_BOOLEAN]: BlockShapes.BOOLEAN, | ||
[BlockOpcodes.ARGUMENT_REPORTER_STRING_NUMBER]: BlockShapes.REPORTER, | ||
[BlockOpcodes.ARGUMENT_EDITOR_BOOLEAN]: BlockShapes.BOOLEAN, | ||
[BlockOpcodes.ARGUMENT_EDITOR_STRING_NUMBER]: BlockShapes.REPORTER, | ||
[BlockOpcodes.SENSING_TOUCHINGOBJECT]: BlockShapes.BOOLEAN, | ||
[BlockOpcodes.SENSING_TOUCHINGOBJECTMENU]: BlockShapes.REPORTER, | ||
[BlockOpcodes.SENSING_TOUCHINGCOLOR]: BlockShapes.BOOLEAN, | ||
[BlockOpcodes.SENSING_COLORISTOUCHINGCOLOR]: BlockShapes.BOOLEAN, | ||
[BlockOpcodes.SENSING_DISTANCETO]: BlockShapes.REPORTER, | ||
[BlockOpcodes.SENSING_DISTANCETOMENU]: BlockShapes.REPORTER, | ||
[BlockOpcodes.SENSING_ASKANDWAIT]: BlockShapes.STACK, | ||
[BlockOpcodes.SENSING_ANSWER]: BlockShapes.REPORTER, | ||
[BlockOpcodes.SENSING_KEYPRESSED]: BlockShapes.BOOLEAN, | ||
[BlockOpcodes.SENSING_KEYOPTIONS]: BlockShapes.REPORTER, | ||
[BlockOpcodes.SENSING_MOUSEDOWN]: BlockShapes.BOOLEAN, | ||
[BlockOpcodes.SENSING_MOUSEX]: BlockShapes.REPORTER, | ||
[BlockOpcodes.SENSING_MOUSEY]: BlockShapes.REPORTER, | ||
[BlockOpcodes.SENSING_SETDRAGMODE]: BlockShapes.STACK, | ||
[BlockOpcodes.SENSING_LOUDNESS]: BlockShapes.REPORTER, | ||
[BlockOpcodes.SENSING_LOUD]: BlockShapes.BOOLEAN, | ||
[BlockOpcodes.SENSING_TIMER]: BlockShapes.REPORTER, | ||
[BlockOpcodes.SENSING_RESETTIMER]: BlockShapes.STACK, | ||
[BlockOpcodes.SENSING_OF_OBJECT_MENU]: BlockShapes.REPORTER, | ||
[BlockOpcodes.SENSING_OF]: BlockShapes.REPORTER, | ||
[BlockOpcodes.SENSING_CURRENT]: BlockShapes.REPORTER, | ||
[BlockOpcodes.SENSING_DAYSSINCE2000]: BlockShapes.REPORTER, | ||
[BlockOpcodes.SENSING_USERNAME]: BlockShapes.REPORTER, | ||
[BlockOpcodes.SENSING_USERID]: BlockShapes.REPORTER, | ||
[BlockOpcodes.SOUND_SOUNDS_MENU]: BlockShapes.REPORTER, | ||
[BlockOpcodes.SOUND_PLAY]: BlockShapes.STACK, | ||
[BlockOpcodes.SOUND_PLAYUNTILDONE]: BlockShapes.STACK, | ||
[BlockOpcodes.SOUND_STOPALLSOUNDS]: BlockShapes.STACK, | ||
[BlockOpcodes.SOUND_SETEFFECTTO]: BlockShapes.STACK, | ||
[BlockOpcodes.SOUND_CHANGEEFFECTBY]: BlockShapes.STACK, | ||
[BlockOpcodes.SOUND_CLEAREFFECTS]: BlockShapes.STACK, | ||
[BlockOpcodes.SOUND_CHANGEVOLUMEBY]: BlockShapes.STACK, | ||
[BlockOpcodes.SOUND_SETVOLUMETO]: BlockShapes.STACK, | ||
[BlockOpcodes.SOUND_VOLUME]: BlockShapes.REPORTER, | ||
}; | ||
//# sourceMappingURL=block-shapes.js.map |
@@ -1,4 +0,8 @@ | ||
import { Queryable, SpriteProperties, SpritePosition, BlockProperties } from './abstracts'; | ||
import { Queryable, SpriteProperties, SpritePosition, BlockProperties, SB3ProjectJSON } from './abstracts'; | ||
export declare class ScratchProject { | ||
constructor(projectJSON: JSON); | ||
/** | ||
* The project JSON as read from the project. | ||
*/ | ||
projectJSON: SB3ProjectJSON; | ||
constructor(projectJSON: SB3ProjectJSON | JSON); | ||
prop(property: string): any; | ||
@@ -5,0 +9,0 @@ sprites(selector?: string): SpriteCollection; |
@@ -6,6 +6,3 @@ "use strict"; | ||
const generators_1 = require("./generators"); | ||
var ScratchProjectKeys; | ||
(function (ScratchProjectKeys) { | ||
ScratchProjectKeys["TARGETS"] = "targets"; | ||
})(ScratchProjectKeys || (ScratchProjectKeys = {})); | ||
const block_shapes_1 = require("./block-shapes"); | ||
var SpriteAttributes; | ||
@@ -26,14 +23,15 @@ (function (SpriteAttributes) { | ||
constructor(projectJSON) { | ||
storage.set(this, projectJSON); | ||
this.projectJSON = projectJSON; | ||
} | ||
// DISABLING ESLINT: a prop can be a string, number, object, or boolean | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
prop(property) { | ||
return storage.get(this)[property]; | ||
return this.projectJSON[property]; | ||
} | ||
sprites(selector) { | ||
if (selector && typeof selector !== 'string') | ||
throw new Error('SpriteCollection selector should be a string!'); | ||
const sprites = this.prop(ScratchProjectKeys.TARGETS); | ||
if (!selector && typeof selector !== 'string') | ||
return new SpriteCollection(sprites); | ||
return new SpriteCollection(sprites).query(selector); | ||
const collection = new SpriteCollection(this.projectJSON.targets); | ||
if (selector !== undefined) { | ||
return collection.query(selector); | ||
} | ||
return collection; | ||
} | ||
@@ -67,2 +65,4 @@ stage() { | ||
} | ||
// DISABLING ESLINT: a prop can be a string, number, object, or boolean | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
prop(attribute) { | ||
@@ -122,2 +122,4 @@ const first = this.first(); | ||
} | ||
// DISABLING ESLINT: a prop can be a string, number, object, or boolean | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
prop(property) { | ||
@@ -136,2 +138,4 @@ const sprite = storage | ||
blocks() { | ||
// DISABLING ESLINT: the blocks in a sprite are an object with many things nested inside | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const blocksObj = this.prop('blocks'); | ||
@@ -142,4 +146,8 @@ const allBlocks = Object.entries(blocksObj).map(([blockId, block]) => (Object.assign({ id: blockId }, block))); | ||
broadcasts() { | ||
// DISABLING ESLINT: broadcasts are a nested object | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
return this.prop(SpriteAttributes.BROADCASTS); | ||
} | ||
// DISABLING ESLINT: lists are a nested object | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
lists() { | ||
@@ -165,8 +173,16 @@ return this.prop(SpriteAttributes.LISTS); | ||
query(selector) { | ||
const { attr, value, isType } = selector_parse_1.parseBlockQuerySelector(selector); | ||
const allBlocks = storage.get(this); | ||
let filterFunction = (b) => b[attr] === value; | ||
const { attr, queryValues: { type, shape, opcode }, } = selector_parse_1.parseBlockQuerySelector(selector); | ||
const allBlocks = this.propsIterable(); | ||
let filterFunction = (b) => b[attr] === opcode; | ||
// Check that the query is asking for block type | ||
if (isType) | ||
filterFunction = (b) => b[attr].includes(value); | ||
if (type) | ||
filterFunction = (b) => b[attr].includes(type); | ||
if (shape) { | ||
if (type) { | ||
filterFunction = (b) => b[attr].includes(type) && block_shapes_1.BlockOpcodeToShape[b.opcode] === shape; | ||
} | ||
else { | ||
filterFunction = (b) => block_shapes_1.BlockOpcodeToShape[b.opcode] === shape; | ||
} | ||
} | ||
const blocks = generators_1.makeIterable(allBlocks, (blockProps) => generators_1.filter(blockProps, filterFunction)); | ||
@@ -185,2 +201,4 @@ return new BlockCollection(blocks); | ||
} | ||
// DISABLING ESLINT: a prop can be a string, number, object, or boolean | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
prop(property) { | ||
@@ -187,0 +205,0 @@ const props = this.props(); |
@@ -11,2 +11,3 @@ "use strict"; | ||
SelectorSyntax["TYPE_SELECTOR"] = "."; | ||
SelectorSyntax["SHAPE_SELECTOR"] = ":"; | ||
})(SelectorSyntax || (SelectorSyntax = {})); | ||
@@ -35,12 +36,25 @@ function validateSpriteSelector(selector) { | ||
function parseBlockQuerySelector(selector) { | ||
let value = selector; | ||
let isType = false; | ||
let queryStrings = selector.split(' '); | ||
let shape, type, opcode; | ||
if (!selector.includes(SelectorSyntax.TYPE_SELECTOR) && !selector.includes(SelectorSyntax.SHAPE_SELECTOR)) | ||
opcode = selector; | ||
if (selector.includes(SelectorSyntax.TYPE_SELECTOR)) { | ||
isType = true; | ||
value = selector.substring(1); | ||
type = queryStrings | ||
.filter((s) => s.includes(SelectorSyntax.TYPE_SELECTOR)) | ||
.map((s) => s.substring(1)) | ||
.pop(); | ||
} | ||
if (selector.includes(SelectorSyntax.SHAPE_SELECTOR)) { | ||
shape = queryStrings | ||
.filter((s) => s.includes(SelectorSyntax.SHAPE_SELECTOR)) | ||
.map((s) => s.substring(1)) | ||
.pop(); | ||
} | ||
return { | ||
attr: 'opcode', | ||
value, | ||
isType, | ||
queryValues: { | ||
type, | ||
shape, | ||
opcode, | ||
}, | ||
}; | ||
@@ -47,0 +61,0 @@ } |
{ | ||
"name": "sb-util", | ||
"version": "0.0.1-prealpha.2", | ||
"version": "0.0.1-prealpha.3", | ||
"description": "Scratch blocks utilities: open and query Scratch blocks formats", | ||
@@ -12,3 +12,4 @@ "repository": "https://github.com/bocoup/sb-util", | ||
"prettier": "prettier \"src/**/*.ts\"", | ||
"test": "npm run prettier -- --check && npm run lint && npm run jest" | ||
"test": "npm run prettier -- --check && npm run lint && npm run jest", | ||
"prepublish": "npm run build" | ||
}, | ||
@@ -15,0 +16,0 @@ "main": "dist/sb-util.js", |
@@ -9,2 +9,6 @@ export interface Queryable { | ||
export interface SB3ProjectJSON { | ||
targets: SpriteProperties[]; | ||
} | ||
export interface SpriteProperties { | ||
@@ -11,0 +15,0 @@ isStage: boolean; |
@@ -7,2 +7,3 @@ import { | ||
BlockQueryProperties, | ||
SB3ProjectJSON, | ||
} from './abstracts'; | ||
@@ -23,6 +24,2 @@ | ||
enum ScratchProjectKeys { | ||
TARGETS = 'targets', | ||
} | ||
enum SpriteAttributes { | ||
@@ -44,4 +41,9 @@ BLOCKS = 'blocks', | ||
export class ScratchProject { | ||
public constructor(projectJSON: JSON) { | ||
storage.set(this, projectJSON); | ||
/** | ||
* The project JSON as read from the project. | ||
*/ | ||
public projectJSON: SB3ProjectJSON; | ||
public constructor(projectJSON: SB3ProjectJSON | JSON) { | ||
this.projectJSON = projectJSON as SB3ProjectJSON; | ||
} | ||
@@ -52,12 +54,11 @@ | ||
public prop(property: string): any { | ||
return storage.get(this)[property]; | ||
return this.projectJSON[property]; | ||
} | ||
public sprites(selector?: string): SpriteCollection { | ||
if (selector && typeof selector !== 'string') | ||
throw new Error('SpriteCollection selector should be a string!'); | ||
const sprites: Iterable<SpriteProperties> = this.prop(ScratchProjectKeys.TARGETS); | ||
if (!selector && typeof selector !== 'string') return new SpriteCollection(sprites); | ||
return new SpriteCollection(sprites).query(selector); | ||
const collection = new SpriteCollection(this.projectJSON.targets); | ||
if (selector !== undefined) { | ||
return collection.query(selector); | ||
} | ||
return collection; | ||
} | ||
@@ -64,0 +65,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
220176
2136
0