feat: Add support for displaying toast-style notifications. (#8896)

* feat: Allow resetting alert/prompt/confirm to defaults.

* chore: Add unit tests for Blockly.dialog.

* fix: Removed TEST_ONLY hack from Blockly.dialog.

* feat: Add a default toast notification implementation.

* feat: Add support for toasts to Blockly.dialog.

* chore: Add tests for default toast implementation.

* chore: Fix docstring.

* refactor: Use default arguments for dialog functions.

* refactor: Add 'close' to the list of messages.

* chore: Add new message in several other places.

* chore: clarify docstrings.

* feat: Make toast assertiveness configurable.
This commit is contained in:
Aaron Dodson
2025-04-21 15:32:45 -07:00
committed by GitHub
parent 9d127698d6
commit c6e58c4f92
12 changed files with 620 additions and 46 deletions

View File

@@ -18,6 +18,7 @@
"DELETE_X_BLOCKS": "Delete %1 Blocks",
"DELETE_ALL_BLOCKS": "Delete all %1 blocks?",
"CLEAN_UP": "Clean up Blocks",
"CLOSE": "Close",
"COLLAPSE_BLOCK": "Collapse Block",
"COLLAPSE_ALL": "Collapse Blocks",
"EXPAND_BLOCK": "Expand Block",

View File

@@ -24,6 +24,7 @@
"DELETE_X_BLOCKS": "context menu - Permanently delete the %1 selected blocks.\n\nParameters:\n* %1 - an integer greater than 1.",
"DELETE_ALL_BLOCKS": "confirmation prompt - Question the user if they really wanted to permanently delete all %1 blocks.\n\nParameters:\n* %1 - an integer greater than 1.",
"CLEAN_UP": "context menu - Reposition all the blocks so that they form a neat line.",
"CLOSE": "toast notification - Accessibility label for close button.",
"COLLAPSE_BLOCK": "context menu - Make the appearance of the selected block smaller by hiding some information about it.",
"COLLAPSE_ALL": "context menu - Make the appearance of all blocks smaller by hiding some information about it. Use the same terminology as in the previous message.",
"EXPAND_BLOCK": "context menu - Restore the appearance of the selected block by showing information about it that was hidden (collapsed) earlier.",

View File

@@ -103,6 +103,9 @@ Blockly.Msg.DELETE_ALL_BLOCKS = 'Delete all %1 blocks?';
/// context menu - Reposition all the blocks so that they form a neat line.
Blockly.Msg.CLEAN_UP = 'Clean up Blocks';
/** @type {string} */
/// toast notification - Accessibility label for close button.
Blockly.Msg.CLOSE = 'Close';
/** @type {string} */
/// context menu - Make the appearance of the selected block smaller by hiding some information about it.
Blockly.Msg.COLLAPSE_BLOCK = 'Collapse Block';
/** @type {string} */