feat!: Invalid Blocks (#7958)

* feat: Invalid Blocks

* Rename the new json property from invalid to invalidReasons.

* Merged isValid into isEnabled.

* Minor fixes.

* More minor fixes.

* Reverting some stuff that didn't need to change.

* Addressing PR feedback.

* Update the BlockInfo interface to match State.

* Make BlockChange.disabledReason private.
This commit is contained in:
John Nesky
2024-04-17 19:47:51 -07:00
committed by GitHub
parent 7d8f88a4f1
commit cee7f916bb
26 changed files with 492 additions and 97 deletions

View File

@@ -1,7 +1,7 @@
{
"@metadata": {
"author": "Ellen Spertus <ellen.spertus@gmail.com>",
"lastupdated": "2023-12-08 18:42:04.679586",
"lastupdated": "2024-03-08 22:38:32.330785",
"locale": "en",
"messagedocumentation" : "qqq"
},
@@ -369,6 +369,7 @@
"PROCEDURES_DEFNORETURN_PROCEDURE": "do something",
"PROCEDURES_BEFORE_PARAMS": "with:",
"PROCEDURES_CALL_BEFORE_PARAMS": "with:",
"PROCEDURES_CALL_DISABLED_DEF_WARNING": "Can't run the user-defined function '%1' because the definition block is disabled.",
"PROCEDURES_DEFNORETURN_DO": "",
"PROCEDURES_DEFNORETURN_TOOLTIP": "Creates a function with no output.",
"PROCEDURES_DEFNORETURN_COMMENT": "Describe this function...",

View File

@@ -375,6 +375,7 @@
"PROCEDURES_DEFNORETURN_PROCEDURE": "default name - This acts as a placeholder for the name of a function on a function definition block, as shown on [https://blockly-demo.appspot.com/static/apps/code/index.html?lang=en#w7cfju this block]. The user will replace it with the function's name.",
"PROCEDURES_BEFORE_PARAMS": "block text - This precedes the list of parameters on a function's definition block. See [https://blockly-demo.appspot.com/static/apps/code/index.html?lang=en#voztpd this sample function with parameters].",
"PROCEDURES_CALL_BEFORE_PARAMS": "block text - This precedes the list of parameters on a function's caller block. See [https://blockly-demo.appspot.com/static/apps/code/index.html?lang=en#voztpd this sample function with parameters].",
"PROCEDURES_CALL_DISABLED_DEF_WARNING": "warning - This appears if a block that runs a function can't run because the function definition block is disabled. See [https://blockly-demo.appspot.com/static/demos/code/index.html#q947d7 this sample of a disabled function definition and call block].",
"PROCEDURES_DEFNORETURN_DO": "{{Optional}}\nblock text - This appears next to the function's 'body', the blocks that should be run when the function is called, as shown in [https://blockly-demo.appspot.com/static/apps/code/index.html?lang=en#voztpd this sample function definition].",
"PROCEDURES_DEFNORETURN_TOOLTIP": "tooltip",
"PROCEDURES_DEFNORETURN_COMMENT": "Placeholder text that the user is encouraged to replace with a description of what their function does.",

View File

@@ -1489,6 +1489,12 @@ Blockly.Msg.PROCEDURES_BEFORE_PARAMS = 'with:';
/// function with parameters].
Blockly.Msg.PROCEDURES_CALL_BEFORE_PARAMS = 'with:';
/** @type {string} */
/// warning - This appears if a block that runs a function can't run because the function
/// definition block is disabled. See
/// [https://blockly-demo.appspot.com/static/demos/code/index.html#q947d7 this sample of a
/// disabled function definition and call block].
Blockly.Msg.PROCEDURES_CALL_DISABLED_DEF_WARNING = 'Can\'t run the user-defined function "%1" because the definition block is disabled.';
/** @type {string} */
/// {{Optional|Supply translation only if your language requires it. Most do not.}}
/// block text - This appears next to the function's "body", the blocks that should be
/// run when the function is called, as shown in