blockly 9.2.1 → 9.3.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.
Files changed (299) hide show
  1. package/blockly.min.js +1615 -1509
  2. package/blockly_compressed.js +1249 -1136
  3. package/blockly_compressed.js.map +1 -1
  4. package/blocks_compressed.js +166 -173
  5. package/blocks_compressed.js.map +1 -1
  6. package/core/any_aliases.d.ts +5 -0
  7. package/core/block.d.ts +49 -17
  8. package/core/block_animations.d.ts +0 -4
  9. package/core/block_dragger.d.ts +1 -6
  10. package/core/block_svg.d.ts +58 -8
  11. package/core/blockly.d.ts +27 -58
  12. package/core/blockly_options.d.ts +0 -2
  13. package/core/blocks.d.ts +0 -2
  14. package/core/browser_events.d.ts +0 -9
  15. package/core/bubble.d.ts +0 -2
  16. package/core/bubble_dragger.d.ts +0 -2
  17. package/core/bump_objects.d.ts +0 -3
  18. package/core/clipboard.d.ts +0 -3
  19. package/core/comment.d.ts +6 -10
  20. package/core/common.d.ts +0 -12
  21. package/core/component_manager.d.ts +0 -2
  22. package/core/connection.d.ts +19 -6
  23. package/core/connection_checker.d.ts +1 -3
  24. package/core/connection_db.d.ts +0 -2
  25. package/core/connection_type.d.ts +0 -2
  26. package/core/constants.d.ts +0 -4
  27. package/core/contextmenu.d.ts +0 -11
  28. package/core/contextmenu_items.d.ts +0 -27
  29. package/core/contextmenu_registry.d.ts +0 -2
  30. package/core/css.d.ts +0 -2
  31. package/core/delete_area.d.ts +0 -2
  32. package/core/dialog.d.ts +0 -6
  33. package/core/drag_target.d.ts +0 -2
  34. package/core/events/events.d.ts +2 -22
  35. package/core/events/events_abstract.d.ts +7 -3
  36. package/core/events/events_block_base.d.ts +2 -3
  37. package/core/events/events_block_change.d.ts +9 -3
  38. package/core/events/events_block_create.d.ts +6 -4
  39. package/core/events/events_block_delete.d.ts +7 -4
  40. package/core/events/events_block_drag.d.ts +7 -3
  41. package/core/events/events_block_move.d.ts +20 -3
  42. package/core/events/events_bubble_open.d.ts +3 -2
  43. package/core/events/events_click.d.ts +6 -3
  44. package/core/events/events_comment_base.d.ts +1 -2
  45. package/core/events/events_comment_change.d.ts +3 -3
  46. package/core/events/events_comment_create.d.ts +2 -3
  47. package/core/events/events_comment_delete.d.ts +2 -3
  48. package/core/events/events_comment_move.d.ts +4 -4
  49. package/core/events/events_marker_move.d.ts +10 -3
  50. package/core/events/events_selected.d.ts +6 -2
  51. package/core/events/events_theme_change.d.ts +2 -3
  52. package/core/events/events_toolbox_item_select.d.ts +3 -3
  53. package/core/events/events_trashcan_open.d.ts +5 -3
  54. package/core/events/events_ui.d.ts +0 -1
  55. package/core/events/events_ui_base.d.ts +0 -2
  56. package/core/events/events_var_base.d.ts +1 -2
  57. package/core/events/events_var_create.d.ts +3 -3
  58. package/core/events/events_var_delete.d.ts +4 -2
  59. package/core/events/events_var_rename.d.ts +4 -2
  60. package/core/events/events_viewport.d.ts +13 -2
  61. package/core/events/utils.d.ts +0 -89
  62. package/core/events/workspace_events.d.ts +2 -6
  63. package/core/extensions.d.ts +0 -8
  64. package/core/field.d.ts +55 -21
  65. package/core/field_angle.d.ts +61 -51
  66. package/core/field_checkbox.d.ts +34 -15
  67. package/core/field_colour.d.ts +56 -46
  68. package/core/field_dropdown.d.ts +35 -19
  69. package/core/field_image.d.ts +10 -14
  70. package/core/field_input.d.ts +39 -25
  71. package/core/field_label.d.ts +7 -10
  72. package/core/field_label_serializable.d.ts +4 -6
  73. package/core/field_multilineinput.d.ts +36 -14
  74. package/core/field_number.d.ts +27 -19
  75. package/core/field_registry.d.ts +0 -3
  76. package/core/field_textinput.d.ts +36 -8
  77. package/core/field_variable.d.ts +30 -18
  78. package/core/flyout_base.d.ts +5 -6
  79. package/core/flyout_button.d.ts +2 -2
  80. package/core/flyout_horizontal.d.ts +0 -2
  81. package/core/flyout_metrics_manager.d.ts +0 -2
  82. package/core/flyout_vertical.d.ts +0 -2
  83. package/core/generator.d.ts +0 -1
  84. package/core/gesture.d.ts +5 -18
  85. package/core/grid.d.ts +0 -2
  86. package/core/icon.d.ts +0 -2
  87. package/core/inject.d.ts +0 -1
  88. package/core/input.d.ts +0 -3
  89. package/core/input_types.d.ts +0 -2
  90. package/core/insertion_marker_manager.d.ts +6 -6
  91. package/core/interfaces/i_ast_node_location.d.ts +0 -2
  92. package/core/interfaces/i_ast_node_location_svg.d.ts +0 -2
  93. package/core/interfaces/i_ast_node_location_with_block.d.ts +0 -2
  94. package/core/interfaces/i_autohideable.d.ts +0 -2
  95. package/core/interfaces/i_block_dragger.d.ts +0 -2
  96. package/core/interfaces/i_bounded_element.d.ts +0 -2
  97. package/core/interfaces/i_bubble.d.ts +0 -2
  98. package/core/interfaces/i_collapsible_toolbox_item.d.ts +0 -2
  99. package/core/interfaces/i_component.d.ts +0 -2
  100. package/core/interfaces/i_connection_checker.d.ts +0 -2
  101. package/core/interfaces/i_contextmenu.d.ts +0 -1
  102. package/core/interfaces/i_copyable.d.ts +3 -2
  103. package/core/interfaces/i_deletable.d.ts +0 -2
  104. package/core/interfaces/i_delete_area.d.ts +0 -2
  105. package/core/interfaces/i_drag_target.d.ts +0 -2
  106. package/core/interfaces/i_draggable.d.ts +0 -2
  107. package/core/interfaces/i_flyout.d.ts +0 -2
  108. package/core/interfaces/i_keyboard_accessible.d.ts +0 -2
  109. package/core/interfaces/i_legacy_procedure_blocks.d.ts +34 -0
  110. package/core/interfaces/i_metrics_manager.d.ts +8 -8
  111. package/core/interfaces/i_movable.d.ts +0 -2
  112. package/core/interfaces/i_positionable.d.ts +0 -2
  113. package/core/interfaces/i_procedure_block.d.ts +3 -0
  114. package/core/interfaces/i_procedure_model.d.ts +0 -5
  115. package/core/interfaces/i_registrable.d.ts +0 -2
  116. package/core/interfaces/i_selectable.d.ts +0 -2
  117. package/core/interfaces/i_selectable_toolbox_item.d.ts +4 -2
  118. package/core/interfaces/i_serializer.d.ts +0 -2
  119. package/core/interfaces/i_styleable.d.ts +0 -2
  120. package/core/interfaces/i_toolbox.d.ts +0 -2
  121. package/core/interfaces/i_toolbox_item.d.ts +0 -2
  122. package/core/interfaces/i_variable_backed_parameter_model.d.ts +17 -0
  123. package/core/internal_constants.d.ts +0 -5
  124. package/core/keyboard_nav/ast_node.d.ts +0 -3
  125. package/core/keyboard_nav/basic_cursor.d.ts +0 -3
  126. package/core/keyboard_nav/cursor.d.ts +0 -3
  127. package/core/keyboard_nav/marker.d.ts +0 -2
  128. package/core/keyboard_nav/tab_navigate_cursor.d.ts +0 -2
  129. package/core/marker_manager.d.ts +0 -2
  130. package/core/menu.d.ts +0 -2
  131. package/core/menuitem.d.ts +0 -2
  132. package/core/metrics_manager.d.ts +8 -8
  133. package/core/mutator.d.ts +0 -2
  134. package/core/names.d.ts +0 -3
  135. package/core/{procedures/observable_procedure_map.d.ts → observable_procedure_map.d.ts} +4 -5
  136. package/core/options.d.ts +0 -2
  137. package/core/positionable_helpers.d.ts +0 -7
  138. package/core/procedures.d.ts +7 -28
  139. package/core/registry.d.ts +0 -11
  140. package/core/render_management.d.ts +15 -0
  141. package/core/rendered_connection.d.ts +22 -9
  142. package/core/renderers/common/block_rendering.d.ts +0 -3
  143. package/core/renderers/common/constants.d.ts +6 -51
  144. package/core/renderers/common/debug.d.ts +0 -3
  145. package/core/renderers/common/debugger.d.ts +9 -23
  146. package/core/renderers/common/drawer.d.ts +0 -5
  147. package/core/renderers/common/i_path_object.d.ts +0 -17
  148. package/core/renderers/common/info.d.ts +2 -12
  149. package/core/renderers/common/marker_svg.d.ts +2 -4
  150. package/core/renderers/common/path_object.d.ts +0 -24
  151. package/core/renderers/common/renderer.d.ts +5 -20
  152. package/core/renderers/geras/constants.d.ts +0 -5
  153. package/core/renderers/geras/drawer.d.ts +2 -4
  154. package/core/renderers/geras/highlight_constants.d.ts +6 -17
  155. package/core/renderers/geras/highlighter.d.ts +0 -13
  156. package/core/renderers/geras/info.d.ts +2 -5
  157. package/core/renderers/geras/measurables/inline_input.d.ts +0 -3
  158. package/core/renderers/geras/measurables/statement_input.d.ts +0 -3
  159. package/core/renderers/geras/path_object.d.ts +0 -8
  160. package/core/renderers/geras/renderer.d.ts +5 -7
  161. package/core/renderers/measurables/base.d.ts +0 -3
  162. package/core/renderers/measurables/bottom_row.d.ts +0 -9
  163. package/core/renderers/measurables/connection.d.ts +0 -3
  164. package/core/renderers/measurables/external_value_input.d.ts +0 -3
  165. package/core/renderers/measurables/field.d.ts +0 -3
  166. package/core/renderers/measurables/hat.d.ts +0 -3
  167. package/core/renderers/measurables/icon.d.ts +2 -5
  168. package/core/renderers/measurables/in_row_spacer.d.ts +0 -3
  169. package/core/renderers/measurables/inline_input.d.ts +1 -4
  170. package/core/renderers/measurables/input_connection.d.ts +1 -4
  171. package/core/renderers/measurables/input_row.d.ts +0 -7
  172. package/core/renderers/measurables/jagged_edge.d.ts +2 -5
  173. package/core/renderers/measurables/next_connection.d.ts +0 -3
  174. package/core/renderers/measurables/output_connection.d.ts +0 -3
  175. package/core/renderers/measurables/previous_connection.d.ts +0 -3
  176. package/core/renderers/measurables/round_corner.d.ts +0 -3
  177. package/core/renderers/measurables/row.d.ts +0 -39
  178. package/core/renderers/measurables/spacer_row.d.ts +0 -3
  179. package/core/renderers/measurables/square_corner.d.ts +0 -3
  180. package/core/renderers/measurables/statement_input.d.ts +0 -3
  181. package/core/renderers/measurables/top_row.d.ts +0 -6
  182. package/core/renderers/measurables/types.d.ts +0 -31
  183. package/core/renderers/minimalist/constants.d.ts +2 -4
  184. package/core/renderers/minimalist/drawer.d.ts +0 -3
  185. package/core/renderers/minimalist/info.d.ts +0 -4
  186. package/core/renderers/minimalist/renderer.d.ts +0 -3
  187. package/core/renderers/thrasos/info.d.ts +0 -4
  188. package/core/renderers/thrasos/renderer.d.ts +3 -3
  189. package/core/renderers/zelos/constants.d.ts +3 -17
  190. package/core/renderers/zelos/drawer.d.ts +0 -3
  191. package/core/renderers/zelos/info.d.ts +0 -4
  192. package/core/renderers/zelos/marker_svg.d.ts +0 -2
  193. package/core/renderers/zelos/measurables/bottom_row.d.ts +0 -3
  194. package/core/renderers/zelos/measurables/inputs.d.ts +0 -3
  195. package/core/renderers/zelos/measurables/row_elements.d.ts +0 -3
  196. package/core/renderers/zelos/measurables/top_row.d.ts +0 -3
  197. package/core/renderers/zelos/path_object.d.ts +0 -9
  198. package/core/renderers/zelos/renderer.d.ts +3 -5
  199. package/core/scrollbar.d.ts +0 -2
  200. package/core/scrollbar_pair.d.ts +0 -2
  201. package/core/serialization/blocks.d.ts +3 -9
  202. package/core/serialization/exceptions.d.ts +0 -8
  203. package/core/serialization/priorities.d.ts +0 -4
  204. package/core/serialization/procedures.d.ts +0 -7
  205. package/core/serialization/registry.d.ts +0 -2
  206. package/core/serialization/variables.d.ts +0 -4
  207. package/core/serialization/workspaces.d.ts +0 -2
  208. package/core/shortcut_items.d.ts +0 -17
  209. package/core/shortcut_registry.d.ts +0 -2
  210. package/core/sprites.d.ts +0 -2
  211. package/core/theme/classic.d.ts +0 -2
  212. package/core/theme/zelos.d.ts +0 -2
  213. package/core/theme.d.ts +0 -2
  214. package/core/theme_manager.d.ts +3 -6
  215. package/core/toolbox/category.d.ts +5 -7
  216. package/core/toolbox/collapsible_category.d.ts +0 -4
  217. package/core/toolbox/separator.d.ts +0 -2
  218. package/core/toolbox/toolbox.d.ts +2 -5
  219. package/core/toolbox/toolbox_item.d.ts +0 -2
  220. package/core/tooltip.d.ts +0 -29
  221. package/core/touch.d.ts +0 -13
  222. package/core/trashcan.d.ts +0 -2
  223. package/core/utils/aria.d.ts +0 -6
  224. package/core/utils/array.d.ts +0 -1
  225. package/core/utils/colour.d.ts +0 -12
  226. package/core/utils/coordinate.d.ts +0 -2
  227. package/core/utils/deprecation.d.ts +0 -1
  228. package/core/utils/dom.d.ts +0 -25
  229. package/core/utils/idgenerator.d.ts +0 -2
  230. package/core/utils/keycodes.d.ts +0 -2
  231. package/core/utils/math.d.ts +0 -3
  232. package/core/utils/metrics.d.ts +0 -1
  233. package/core/utils/object.d.ts +0 -4
  234. package/core/utils/parsing.d.ts +0 -4
  235. package/core/utils/rect.d.ts +0 -2
  236. package/core/utils/size.d.ts +0 -2
  237. package/core/utils/string.d.ts +0 -6
  238. package/core/utils/style.d.ts +0 -8
  239. package/core/utils/svg.d.ts +0 -2
  240. package/core/utils/svg_math.d.ts +0 -6
  241. package/core/utils/svg_paths.d.ts +0 -8
  242. package/core/utils/toolbox.d.ts +2 -35
  243. package/core/utils/useragent.d.ts +0 -8
  244. package/core/utils/xml.d.ts +9 -8
  245. package/core/utils.d.ts +0 -12
  246. package/core/variable_map.d.ts +1 -3
  247. package/core/variable_model.d.ts +0 -1
  248. package/core/variables.d.ts +13 -17
  249. package/core/variables_dynamic.d.ts +0 -4
  250. package/core/warning.d.ts +0 -2
  251. package/core/widgetdiv.d.ts +0 -10
  252. package/core/workspace.d.ts +3 -3
  253. package/core/workspace_audio.d.ts +0 -2
  254. package/core/workspace_comment.d.ts +1 -3
  255. package/core/workspace_comment_svg.d.ts +1 -3
  256. package/core/workspace_dragger.d.ts +0 -2
  257. package/core/workspace_svg.d.ts +4 -7
  258. package/core/xml.d.ts +1 -13
  259. package/core/zoom_controls.d.ts +4 -15
  260. package/dart_compressed.js +199 -199
  261. package/dart_compressed.js.map +1 -1
  262. package/javascript_compressed.js +168 -168
  263. package/javascript_compressed.js.map +1 -1
  264. package/lua_compressed.js +211 -211
  265. package/lua_compressed.js.map +1 -1
  266. package/msg/bn.js +2 -2
  267. package/msg/bs.js +7 -7
  268. package/msg/de.js +1 -1
  269. package/msg/fi.js +1 -1
  270. package/msg/fr.js +3 -3
  271. package/msg/ia.js +5 -5
  272. package/msg/kn.js +5 -5
  273. package/msg/ko.js +1 -1
  274. package/msg/lb.js +22 -22
  275. package/msg/sd.js +9 -9
  276. package/msg/skr-arab.js +2 -2
  277. package/msg/sl.js +18 -18
  278. package/msg/sw.js +1 -1
  279. package/msg/zh-hans.js +6 -6
  280. package/msg/zh-hant.js +2 -2
  281. package/package.json +9 -9
  282. package/php_compressed.js +185 -185
  283. package/php_compressed.js.map +1 -1
  284. package/python_compressed.js +138 -138
  285. package/python_compressed.js.map +1 -1
  286. package/core/events/events_procedure_base.d.ts +0 -26
  287. package/core/events/events_procedure_change_return.d.ts +0 -40
  288. package/core/events/events_procedure_create.d.ts +0 -34
  289. package/core/events/events_procedure_delete.d.ts +0 -32
  290. package/core/events/events_procedure_enable.d.ts +0 -34
  291. package/core/events/events_procedure_parameter_base.d.ts +0 -26
  292. package/core/events/events_procedure_parameter_create.d.ts +0 -42
  293. package/core/events/events_procedure_parameter_delete.d.ts +0 -41
  294. package/core/events/events_procedure_parameter_rename.d.ts +0 -36
  295. package/core/events/events_procedure_rename.d.ts +0 -35
  296. package/core/procedures/observable_parameter_model.d.ts +0 -62
  297. package/core/procedures/observable_procedure_model.d.ts +0 -75
  298. package/core/procedures/update_procedures.d.ts +0 -13
  299. package/core/utils/sentinel.d.ts +0 -13
@@ -14,196 +14,124 @@ import type { CommentMove } from './events_comment_move.js';
14
14
  * Sets whether events should be added to the undo stack.
15
15
  *
16
16
  * @param newValue True if events should be added to the undo stack.
17
- * @alias Blockly.Events.utils.setRecordUndo
18
17
  */
19
18
  export declare function setRecordUndo(newValue: boolean): void;
20
19
  /**
21
20
  * Returns whether or not events will be added to the undo stack.
22
21
  *
23
22
  * @returns True if events will be added to the undo stack.
24
- * @alias Blockly.Events.utils.getRecordUndo
25
23
  */
26
24
  export declare function getRecordUndo(): boolean;
27
25
  /**
28
26
  * Name of event that creates a block. Will be deprecated for BLOCK_CREATE.
29
- *
30
- * @alias Blockly.Events.utils.CREATE
31
27
  */
32
28
  export declare const CREATE = "create";
33
29
  /**
34
30
  * Name of event that creates a block.
35
- *
36
- * @alias Blockly.Events.utils.BLOCK_CREATE
37
31
  */
38
32
  export declare const BLOCK_CREATE = "create";
39
33
  /**
40
34
  * Name of event that deletes a block. Will be deprecated for BLOCK_DELETE.
41
- *
42
- * @alias Blockly.Events.utils.DELETE
43
35
  */
44
36
  export declare const DELETE = "delete";
45
37
  /**
46
38
  * Name of event that deletes a block.
47
- *
48
- * @alias Blockly.Events.utils.BLOCK_DELETE
49
39
  */
50
40
  export declare const BLOCK_DELETE = "delete";
51
41
  /**
52
42
  * Name of event that changes a block. Will be deprecated for BLOCK_CHANGE.
53
- *
54
- * @alias Blockly.Events.utils.CHANGE
55
43
  */
56
44
  export declare const CHANGE = "change";
57
45
  /**
58
46
  * Name of event that changes a block.
59
- *
60
- * @alias Blockly.Events.utils.BLOCK_CHANGE
61
47
  */
62
48
  export declare const BLOCK_CHANGE = "change";
63
49
  /**
64
50
  * Name of event that moves a block. Will be deprecated for BLOCK_MOVE.
65
- *
66
- * @alias Blockly.Events.utils.MOVE
67
51
  */
68
52
  export declare const MOVE = "move";
69
53
  /**
70
54
  * Name of event that moves a block.
71
- *
72
- * @alias Blockly.Events.utils.BLOCK_MOVE
73
55
  */
74
56
  export declare const BLOCK_MOVE = "move";
75
57
  /**
76
58
  * Name of event that creates a variable.
77
- *
78
- * @alias Blockly.Events.utils.VAR_CREATE
79
59
  */
80
60
  export declare const VAR_CREATE = "var_create";
81
61
  /**
82
62
  * Name of event that deletes a variable.
83
- *
84
- * @alias Blockly.Events.utils.VAR_DELETE
85
63
  */
86
64
  export declare const VAR_DELETE = "var_delete";
87
65
  /**
88
66
  * Name of event that renames a variable.
89
- *
90
- * @alias Blockly.Events.utils.VAR_RENAME
91
67
  */
92
68
  export declare const VAR_RENAME = "var_rename";
93
69
  /**
94
70
  * Name of generic event that records a UI change.
95
- *
96
- * @alias Blockly.Events.utils.UI
97
71
  */
98
72
  export declare const UI = "ui";
99
73
  /**
100
74
  * Name of event that record a block drags a block.
101
- *
102
- * @alias Blockly.Events.utils.BLOCK_DRAG
103
75
  */
104
76
  export declare const BLOCK_DRAG = "drag";
105
77
  /**
106
78
  * Name of event that records a change in selected element.
107
- *
108
- * @alias Blockly.Events.utils.SELECTED
109
79
  */
110
80
  export declare const SELECTED = "selected";
111
81
  /**
112
82
  * Name of event that records a click.
113
- *
114
- * @alias Blockly.Events.utils.CLICK
115
83
  */
116
84
  export declare const CLICK = "click";
117
85
  /**
118
86
  * Name of event that records a marker move.
119
- *
120
- * @alias Blockly.Events.utils.MARKER_MOVE
121
87
  */
122
88
  export declare const MARKER_MOVE = "marker_move";
123
89
  /**
124
90
  * Name of event that records a bubble open.
125
- *
126
- * @alias Blockly.Events.utils.BUBBLE_OPEN
127
91
  */
128
92
  export declare const BUBBLE_OPEN = "bubble_open";
129
93
  /**
130
94
  * Name of event that records a trashcan open.
131
- *
132
- * @alias Blockly.Events.utils.TRASHCAN_OPEN
133
95
  */
134
96
  export declare const TRASHCAN_OPEN = "trashcan_open";
135
97
  /**
136
98
  * Name of event that records a toolbox item select.
137
- *
138
- * @alias Blockly.Events.utils.TOOLBOX_ITEM_SELECT
139
99
  */
140
100
  export declare const TOOLBOX_ITEM_SELECT = "toolbox_item_select";
141
101
  /**
142
102
  * Name of event that records a theme change.
143
- *
144
- * @alias Blockly.Events.utils.THEME_CHANGE
145
103
  */
146
104
  export declare const THEME_CHANGE = "theme_change";
147
105
  /**
148
106
  * Name of event that records a viewport change.
149
- *
150
- * @alias Blockly.Events.utils.VIEWPORT_CHANGE
151
107
  */
152
108
  export declare const VIEWPORT_CHANGE = "viewport_change";
153
109
  /**
154
110
  * Name of event that creates a comment.
155
- *
156
- * @alias Blockly.Events.utils.COMMENT_CREATE
157
111
  */
158
112
  export declare const COMMENT_CREATE = "comment_create";
159
113
  /**
160
114
  * Name of event that deletes a comment.
161
- *
162
- * @alias Blockly.Events.utils.COMMENT_DELETE
163
115
  */
164
116
  export declare const COMMENT_DELETE = "comment_delete";
165
117
  /**
166
118
  * Name of event that changes a comment.
167
- *
168
- * @alias Blockly.Events.utils.COMMENT_CHANGE
169
119
  */
170
120
  export declare const COMMENT_CHANGE = "comment_change";
171
121
  /**
172
122
  * Name of event that moves a comment.
173
- *
174
- * @alias Blockly.Events.utils.COMMENT_MOVE
175
123
  */
176
124
  export declare const COMMENT_MOVE = "comment_move";
177
125
  /**
178
126
  * Name of event that records a workspace load.
179
- *
180
- * @alias Blockly.Events.utils.FINISHED_LOADING
181
127
  */
182
128
  export declare const FINISHED_LOADING = "finished_loading";
183
- /** Name of event that creates a procedure model. */
184
- export declare const PROCEDURE_CREATE = "procedure_create";
185
- /** Name of event that deletes a procedure model. */
186
- export declare const PROCEDURE_DELETE = "procedure_delete";
187
- /** Name of event that renames a procedure model. */
188
- export declare const PROCEDURE_RENAME = "procedure_rename";
189
- /** Name of event that enables/disables a procedure model. */
190
- export declare const PROCEDURE_ENABLE = "procedure_enable";
191
- /** Name of event that changes the returntype of a procedure model. */
192
- export declare const PROCEDURE_CHANGE_RETURN = "procedure_change_return";
193
- /** Name of event that creates a procedure parameter. */
194
- export declare const PROCEDURE_PARAMETER_CREATE = "procedure_parameter_create";
195
- /** Name of event that deletes a procedure parameter. */
196
- export declare const PROCEDURE_PARAMETER_DELETE = "procedure_parameter_delete";
197
- /** Name of event that renames a procedure parameter. */
198
- export declare const PROCEDURE_PARAMETER_RENAME = "procedure_parameter_rename";
199
129
  /**
200
130
  * Type of events that cause objects to be bumped back into the visible
201
131
  * portion of the workspace.
202
132
  *
203
133
  * Not to be confused with bumping so that disconnected connections do not
204
134
  * appear connected.
205
- *
206
- * @alias Blockly.Events.utils.BumpEvent
207
135
  */
208
136
  export type BumpEvent = BlockCreate | BlockMove | CommentCreate | CommentMove;
209
137
  /**
@@ -212,15 +140,12 @@ export type BumpEvent = BlockCreate | BlockMove | CommentCreate | CommentMove;
212
140
  *
213
141
  * Not to be confused with bumping so that disconnected connections do not
214
142
  * appear connected.
215
- *
216
- * @alias Blockly.Events.utils.BUMP_EVENTS
217
143
  */
218
144
  export declare const BUMP_EVENTS: string[];
219
145
  /**
220
146
  * Create a custom event and fire it.
221
147
  *
222
148
  * @param event Custom data for event.
223
- * @alias Blockly.Events.utils.fire
224
149
  */
225
150
  export declare function fire(event: Abstract): void;
226
151
  /**
@@ -235,41 +160,32 @@ declare function fireNow(): void;
235
160
  * @param queueIn Array of events.
236
161
  * @param forward True if forward (redo), false if backward (undo).
237
162
  * @returns Array of filtered events.
238
- * @alias Blockly.Events.utils.filter
239
163
  */
240
164
  export declare function filter(queueIn: Abstract[], forward: boolean): Abstract[];
241
165
  /**
242
166
  * Modify pending undo events so that when they are fired they don't land
243
167
  * in the undo stack. Called by Workspace.clearUndo.
244
- *
245
- * @alias Blockly.Events.utils.clearPendingUndo
246
168
  */
247
169
  export declare function clearPendingUndo(): void;
248
170
  /**
249
171
  * Stop sending events. Every call to this function MUST also call enable.
250
- *
251
- * @alias Blockly.Events.utils.disable
252
172
  */
253
173
  export declare function disable(): void;
254
174
  /**
255
175
  * Start sending events. Unless events were already disabled when the
256
176
  * corresponding call to disable was made.
257
- *
258
- * @alias Blockly.Events.utils.enable
259
177
  */
260
178
  export declare function enable(): void;
261
179
  /**
262
180
  * Returns whether events may be fired or not.
263
181
  *
264
182
  * @returns True if enabled.
265
- * @alias Blockly.Events.utils.isEnabled
266
183
  */
267
184
  export declare function isEnabled(): boolean;
268
185
  /**
269
186
  * Current group.
270
187
  *
271
188
  * @returns ID string.
272
- * @alias Blockly.Events.utils.getGroup
273
189
  */
274
190
  export declare function getGroup(): string;
275
191
  /**
@@ -277,7 +193,6 @@ export declare function getGroup(): string;
277
193
  *
278
194
  * @param state True to start new group, false to end group.
279
195
  * String to set group explicitly.
280
- * @alias Blockly.Events.utils.setGroup
281
196
  */
282
197
  export declare function setGroup(state: boolean | string): void;
283
198
  /**
@@ -289,7 +204,6 @@ declare function setGroupInternal(state: boolean | string): void;
289
204
  *
290
205
  * @param block The root block.
291
206
  * @returns List of block IDs.
292
- * @alias Blockly.Events.utils.getDescendantIds
293
207
  * @internal
294
208
  */
295
209
  export declare function getDescendantIds(block: Block): string[];
@@ -300,7 +214,6 @@ export declare function getDescendantIds(block: Block): string[];
300
214
  * @param workspace Target workspace for event.
301
215
  * @returns The event represented by the JSON.
302
216
  * @throws {Error} if an event type is not found in the registry.
303
- * @alias Blockly.Events.utils.fromJson
304
217
  */
305
218
  export declare function fromJson(json: any, workspace: Workspace): Abstract;
306
219
  /**
@@ -308,7 +221,6 @@ export declare function fromJson(json: any, workspace: Workspace): Abstract;
308
221
  *
309
222
  * @param eventType The type of the event to get.
310
223
  * @returns The event class with the given type.
311
- * @alias Blockly.Events.utils.get
312
224
  */
313
225
  export declare function get(eventType: string): (new (...p1: any[]) => Abstract);
314
226
  /**
@@ -318,7 +230,6 @@ export declare function get(eventType: string): (new (...p1: any[]) => Abstract)
318
230
  * users don't try to re-enable disabled orphan blocks.
319
231
  *
320
232
  * @param event Custom data for event.
321
- * @alias Blockly.Events.utils.disableOrphans
322
233
  */
323
234
  export declare function disableOrphans(event: Abstract): void;
324
235
  export declare const TEST_ONLY: {
@@ -6,12 +6,8 @@
6
6
  import type { Workspace } from '../workspace.js';
7
7
  import { Abstract as AbstractEvent, AbstractEventJson } from './events_abstract.js';
8
8
  /**
9
- * Class for a finished loading event.
10
- * Used to notify the developer when the workspace has finished loading (i.e
11
- * domToWorkspace).
12
- * Finished loading events do not record undo or redo.
13
- *
14
- * @alias Blockly.Events.FinishedLoading
9
+ * Notifies listeners when the workspace has finished deserializing from
10
+ * JSON/XML.
15
11
  */
16
12
  export declare class FinishedLoading extends AbstractEvent {
17
13
  isBlank: boolean;
@@ -17,7 +17,6 @@ export declare const TEST_ONLY: {
17
17
  * @param initFn The function to initialize an extended block.
18
18
  * @throws {Error} if the extension name is empty, the extension is already
19
19
  * registered, or extensionFn is not a function.
20
- * @alias Blockly.Extensions.register
21
20
  */
22
21
  export declare function register(name: string, initFn: Function): void;
23
22
  /**
@@ -27,7 +26,6 @@ export declare function register(name: string, initFn: Function): void;
27
26
  * @param mixinObj The values to mix in.
28
27
  * @throws {Error} if the extension name is empty or the extension is already
29
28
  * registered.
30
- * @alias Blockly.Extensions.registerMixin
31
29
  */
32
30
  export declare function registerMixin(name: string, mixinObj: any): void;
33
31
  /**
@@ -42,14 +40,12 @@ export declare function registerMixin(name: string, mixinObj: any): void;
42
40
  * @param opt_blockList A list of blocks to appear in the flyout of the mutator
43
41
  * dialog.
44
42
  * @throws {Error} if the mutation is invalid or can't be applied to the block.
45
- * @alias Blockly.Extensions.registerMutator
46
43
  */
47
44
  export declare function registerMutator(name: string, mixinObj: any, opt_helperFn?: () => any, opt_blockList?: string[]): void;
48
45
  /**
49
46
  * Unregisters the extension registered with the given name.
50
47
  *
51
48
  * @param name The name of the extension to unregister.
52
- * @alias Blockly.Extensions.unregister
53
49
  */
54
50
  export declare function unregister(name: string): void;
55
51
  /**
@@ -57,7 +53,6 @@ export declare function unregister(name: string): void;
57
53
  *
58
54
  * @param name The name of the extension to check for.
59
55
  * @returns True if the extension is registered. False if it is not registered.
60
- * @alias Blockly.Extensions.isRegistered
61
56
  */
62
57
  export declare function isRegistered(name: string): boolean;
63
58
  /**
@@ -68,7 +63,6 @@ export declare function isRegistered(name: string): boolean;
68
63
  * @param block The block to apply the named extension to.
69
64
  * @param isMutator True if this extension defines a mutator.
70
65
  * @throws {Error} if the extension is not found.
71
- * @alias Blockly.Extensions.apply
72
66
  */
73
67
  export declare function apply(name: string, block: Block, isMutator: boolean): void;
74
68
  /**
@@ -97,7 +91,6 @@ export declare function runAfterPageLoad(fn: () => void): void;
97
91
  * lookup table.
98
92
  * @param lookupTable The table of field values to tooltip text.
99
93
  * @returns The extension function.
100
- * @alias Blockly.Extensions.buildTooltipForDropdown
101
94
  */
102
95
  export declare function buildTooltipForDropdown(dropdownName: string, lookupTable: {
103
96
  [key: string]: string;
@@ -111,7 +104,6 @@ export declare function buildTooltipForDropdown(dropdownName: string, lookupTabl
111
104
  * placeholder.
112
105
  * @param fieldName The field with the replacement text.
113
106
  * @returns The extension function.
114
- * @alias Blockly.Extensions.buildTooltipWithFieldText
115
107
  */
116
108
  export declare function buildTooltipWithFieldText(msgTemplate: string, fieldName: string): Function;
117
109
  //# sourceMappingURL=extensions.d.ts.map
package/core/field.d.ts CHANGED
@@ -15,13 +15,27 @@ import type { KeyboardShortcut } from './shortcut_registry.js';
15
15
  import * as Tooltip from './tooltip.js';
16
16
  import type { Coordinate } from './utils/coordinate.js';
17
17
  import { Rect } from './utils/rect.js';
18
- import { Sentinel } from './utils/sentinel.js';
19
18
  import { Size } from './utils/size.js';
20
- export type FieldValidator<T = any> = (value?: T) => T | null | undefined;
19
+ /**
20
+ * A function that is called to validate changes to the field's value before
21
+ * they are set.
22
+ *
23
+ * @see {@link https://developers.google.com/blockly/guides/create-custom-blocks/fields/validators#return_values}
24
+ * @param newValue The value to be validated.
25
+ * @returns One of three instructions for setting the new value: `T`, `null`,
26
+ * or `undefined`.
27
+ *
28
+ * - `T` to set this function's returned value instead of `newValue`.
29
+ *
30
+ * - `null` to invoke `doValueInvalid_` and not set a value.
31
+ *
32
+ * - `undefined` to set `newValue` as is.
33
+ */
34
+ export type FieldValidator<T = any> = (newValue: T) => T | null | undefined;
21
35
  /**
22
36
  * Abstract class for an editable field.
23
37
  *
24
- * @alias Blockly.Field
38
+ * @typeParam T - The value stored on the field.
25
39
  */
26
40
  export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IASTNodeLocationWithBlock, IKeyboardAccessible, IRegistrable {
27
41
  /**
@@ -41,7 +55,7 @@ export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IAS
41
55
  * field's value or run configure_, and should allow a subclass to do that
42
56
  * instead.
43
57
  */
44
- static readonly SKIP_SETUP: Sentinel;
58
+ static readonly SKIP_SETUP: unique symbol;
45
59
  /**
46
60
  * Name of field. Unique within each block.
47
61
  * Static labels are usually unnamed.
@@ -128,14 +142,14 @@ export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IAS
128
142
  * Also accepts Field.SKIP_SETUP if you wish to skip setup (only used by
129
143
  * subclasses that want to handle configuration and setting the field value
130
144
  * after their own constructors have run).
131
- * @param opt_validator A function that is called to validate changes to the
145
+ * @param validator A function that is called to validate changes to the
132
146
  * field's value. Takes in a value & returns a validated value, or null to
133
147
  * abort the change.
134
- * @param opt_config A map of options used to configure the field.
148
+ * @param config A map of options used to configure the field.
135
149
  * Refer to the individual field's documentation for a list of properties
136
150
  * this parameter supports.
137
151
  */
138
- constructor(value: T | Sentinel, opt_validator?: FieldValidator<T> | null, opt_config?: FieldConfig);
152
+ constructor(value: T | typeof Field.SKIP_SETUP, validator?: FieldValidator<T> | null, config?: FieldConfig);
139
153
  /**
140
154
  * Process the configuration map passed to the field.
141
155
  *
@@ -336,7 +350,7 @@ export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IAS
336
350
  *
337
351
  * @returns Validation function, or null.
338
352
  */
339
- getValidator(): Function | null;
353
+ getValidator(): FieldValidator<T> | null;
340
354
  /**
341
355
  * Gets the group element for this editable field.
342
356
  * Used for measuring the size and for positioning.
@@ -383,12 +397,12 @@ export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IAS
383
397
  * Calls showEditor_ when the field is clicked if the field is clickable.
384
398
  * Do not override.
385
399
  *
386
- * @param opt_e Optional mouse event that triggered the field to open, or
400
+ * @param e Optional mouse event that triggered the field to open, or
387
401
  * undefined if triggered programmatically.
388
402
  * @sealed
389
403
  * @internal
390
404
  */
391
- showEditor(opt_e?: Event): void;
405
+ showEditor(e?: Event): void;
392
406
  /**
393
407
  * A developer hook to create an editor for the field. This is no-op by
394
408
  * default, and must be overriden to create an editor.
@@ -400,9 +414,9 @@ export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IAS
400
414
  /**
401
415
  * Updates the size of the field based on the text.
402
416
  *
403
- * @param opt_margin margin to use when positioning the text element.
417
+ * @param margin margin to use when positioning the text element.
404
418
  */
405
- protected updateSize_(opt_margin?: number): void;
419
+ protected updateSize_(margin?: number): void;
406
420
  /**
407
421
  * Position a field's text element after a size change. This handles both LTR
408
422
  * and RTL positioning.
@@ -495,22 +509,36 @@ export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IAS
495
509
  *
496
510
  * @returns Current value.
497
511
  */
498
- getValue(): any;
512
+ getValue(): T | null;
499
513
  /**
500
- * Used to validate a value. Returns input by default. Can be overridden by
501
- * subclasses, see FieldDropdown.
514
+ * Validate the changes to a field's value before they are set. See
515
+ * **FieldDropdown** for an example of subclass implementation.
516
+ *
517
+ * **NOTE:** Validation returns one option between `T`, `null`, and
518
+ * `undefined`. **Field**'s implementation will never return `undefined`, but
519
+ * it is valid for a subclass to return `undefined` if the new value is
520
+ * compatible with `T`.
521
+ *
522
+ * @see {@link https://developers.google.com/blockly/guides/create-custom-blocks/fields/validators#return_values}
523
+ * @param newValue - The value to be validated.
524
+ * @returns One of three instructions for setting the new value: `T`, `null`,
525
+ * or `undefined`.
502
526
  *
503
- * @param opt_newValue The value to be validated.
504
- * @returns The validated value, same as input by default.
527
+ * - `T` to set this function's returned value instead of `newValue`.
528
+ *
529
+ * - `null` to invoke `doValueInvalid_` and not set a value.
530
+ *
531
+ * - `undefined` to set `newValue` as is.
505
532
  */
506
- protected doClassValidation_(opt_newValue?: any): any;
533
+ protected doClassValidation_(newValue: T): T | null | undefined;
534
+ protected doClassValidation_(newValue?: any): T | null;
507
535
  /**
508
536
  * Used to update the value of a field. Can be overridden by subclasses to do
509
537
  * custom storage of values/updating of external things.
510
538
  *
511
539
  * @param newValue The value to be saved.
512
540
  */
513
- protected doValueUpdate_(newValue: any): void;
541
+ protected doValueUpdate_(newValue: T): void;
514
542
  /**
515
543
  * Used to notify the field an invalid value was input. Can be overridden by
516
544
  * subclasses, see FieldTextInput.
@@ -612,8 +640,12 @@ export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IAS
612
640
  * @internal
613
641
  */
614
642
  setMarkerSvg(markerSvg: SVGElement): void;
615
- /** Redraw any attached marker or cursor svgs if needed. */
616
- protected updateMarkers_(): void;
643
+ /**
644
+ * Redraw any attached marker or cursor svgs if needed.
645
+ *
646
+ * @internal
647
+ */
648
+ updateMarkers_(): void;
617
649
  }
618
650
  /**
619
651
  * Extra configuration options for the base field.
@@ -624,6 +656,8 @@ export interface FieldConfig {
624
656
  /**
625
657
  * For use by Field and descendants of Field. Constructors can change
626
658
  * in descendants, though they should contain all of Field's prototype methods.
659
+ *
660
+ * @internal
627
661
  */
628
662
  export type FieldProto = Pick<typeof Field, 'prototype'>;
629
663
  /**