blockly 9.3.0-beta.0 → 9.3.1

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 (282) hide show
  1. package/blockly.min.js +1674 -1520
  2. package/blockly_compressed.js +1313 -1152
  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_drag_surface.d.ts +135 -0
  10. package/core/block_dragger.d.ts +2 -7
  11. package/core/block_svg.d.ts +72 -9
  12. package/core/blockly.d.ts +29 -58
  13. package/core/blockly_options.d.ts +0 -2
  14. package/core/blocks.d.ts +0 -2
  15. package/core/browser_events.d.ts +0 -9
  16. package/core/bubble.d.ts +6 -4
  17. package/core/bubble_dragger.d.ts +2 -3
  18. package/core/bump_objects.d.ts +0 -3
  19. package/core/clipboard.d.ts +0 -3
  20. package/core/comment.d.ts +6 -10
  21. package/core/common.d.ts +0 -12
  22. package/core/component_manager.d.ts +0 -2
  23. package/core/connection.d.ts +19 -6
  24. package/core/connection_checker.d.ts +1 -3
  25. package/core/connection_db.d.ts +0 -2
  26. package/core/connection_type.d.ts +0 -2
  27. package/core/constants.d.ts +0 -4
  28. package/core/contextmenu.d.ts +0 -11
  29. package/core/contextmenu_items.d.ts +0 -27
  30. package/core/contextmenu_registry.d.ts +0 -2
  31. package/core/css.d.ts +0 -2
  32. package/core/delete_area.d.ts +0 -2
  33. package/core/dialog.d.ts +0 -6
  34. package/core/drag_target.d.ts +0 -2
  35. package/core/events/events_abstract.d.ts +0 -3
  36. package/core/events/events_block_base.d.ts +0 -2
  37. package/core/events/events_block_change.d.ts +0 -2
  38. package/core/events/events_block_create.d.ts +0 -2
  39. package/core/events/events_block_delete.d.ts +0 -2
  40. package/core/events/events_block_drag.d.ts +0 -2
  41. package/core/events/events_block_move.d.ts +0 -2
  42. package/core/events/events_bubble_open.d.ts +0 -2
  43. package/core/events/events_click.d.ts +0 -2
  44. package/core/events/events_comment_base.d.ts +0 -2
  45. package/core/events/events_comment_change.d.ts +0 -2
  46. package/core/events/events_comment_create.d.ts +0 -2
  47. package/core/events/events_comment_delete.d.ts +0 -2
  48. package/core/events/events_comment_move.d.ts +0 -2
  49. package/core/events/events_marker_move.d.ts +0 -2
  50. package/core/events/events_selected.d.ts +0 -2
  51. package/core/events/events_theme_change.d.ts +0 -2
  52. package/core/events/events_toolbox_item_select.d.ts +0 -2
  53. package/core/events/events_trashcan_open.d.ts +0 -2
  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 +0 -2
  57. package/core/events/events_var_create.d.ts +0 -2
  58. package/core/events/events_viewport.d.ts +0 -2
  59. package/core/events/utils.d.ts +0 -73
  60. package/core/events/workspace_events.d.ts +0 -2
  61. package/core/extensions.d.ts +0 -8
  62. package/core/field.d.ts +16 -15
  63. package/core/field_angle.d.ts +60 -50
  64. package/core/field_checkbox.d.ts +22 -10
  65. package/core/field_colour.d.ts +55 -42
  66. package/core/field_dropdown.d.ts +34 -18
  67. package/core/field_image.d.ts +9 -12
  68. package/core/field_input.d.ts +34 -11
  69. package/core/field_label.d.ts +7 -10
  70. package/core/field_label_serializable.d.ts +4 -6
  71. package/core/field_multilineinput.d.ts +34 -12
  72. package/core/field_number.d.ts +27 -19
  73. package/core/field_registry.d.ts +0 -3
  74. package/core/field_textinput.d.ts +28 -12
  75. package/core/field_variable.d.ts +28 -16
  76. package/core/flyout_base.d.ts +5 -6
  77. package/core/flyout_button.d.ts +2 -2
  78. package/core/flyout_horizontal.d.ts +0 -2
  79. package/core/flyout_metrics_manager.d.ts +0 -2
  80. package/core/flyout_vertical.d.ts +0 -2
  81. package/core/generator.d.ts +0 -1
  82. package/core/gesture.d.ts +4 -17
  83. package/core/grid.d.ts +0 -2
  84. package/core/icon.d.ts +0 -2
  85. package/core/inject.d.ts +0 -1
  86. package/core/input.d.ts +0 -3
  87. package/core/input_types.d.ts +0 -2
  88. package/core/insertion_marker_manager.d.ts +6 -6
  89. package/core/interfaces/i_ast_node_location.d.ts +0 -2
  90. package/core/interfaces/i_ast_node_location_svg.d.ts +0 -2
  91. package/core/interfaces/i_ast_node_location_with_block.d.ts +0 -2
  92. package/core/interfaces/i_autohideable.d.ts +0 -2
  93. package/core/interfaces/i_block_dragger.d.ts +1 -3
  94. package/core/interfaces/i_bounded_element.d.ts +0 -2
  95. package/core/interfaces/i_bubble.d.ts +6 -4
  96. package/core/interfaces/i_collapsible_toolbox_item.d.ts +0 -2
  97. package/core/interfaces/i_component.d.ts +0 -2
  98. package/core/interfaces/i_connection_checker.d.ts +0 -2
  99. package/core/interfaces/i_contextmenu.d.ts +0 -1
  100. package/core/interfaces/i_copyable.d.ts +3 -2
  101. package/core/interfaces/i_deletable.d.ts +0 -2
  102. package/core/interfaces/i_delete_area.d.ts +0 -2
  103. package/core/interfaces/i_drag_target.d.ts +0 -2
  104. package/core/interfaces/i_draggable.d.ts +0 -2
  105. package/core/interfaces/i_flyout.d.ts +0 -2
  106. package/core/interfaces/i_keyboard_accessible.d.ts +0 -2
  107. package/core/interfaces/i_legacy_procedure_blocks.d.ts +34 -0
  108. package/core/interfaces/i_metrics_manager.d.ts +0 -2
  109. package/core/interfaces/i_movable.d.ts +0 -2
  110. package/core/interfaces/i_positionable.d.ts +0 -2
  111. package/core/interfaces/i_procedure_model.d.ts +0 -5
  112. package/core/interfaces/i_registrable.d.ts +0 -2
  113. package/core/interfaces/i_selectable.d.ts +0 -2
  114. package/core/interfaces/i_selectable_toolbox_item.d.ts +4 -2
  115. package/core/interfaces/i_serializer.d.ts +0 -2
  116. package/core/interfaces/i_styleable.d.ts +0 -2
  117. package/core/interfaces/i_toolbox.d.ts +0 -2
  118. package/core/interfaces/i_toolbox_item.d.ts +0 -2
  119. package/core/interfaces/i_variable_backed_parameter_model.d.ts +17 -0
  120. package/core/internal_constants.d.ts +0 -5
  121. package/core/keyboard_nav/ast_node.d.ts +0 -3
  122. package/core/keyboard_nav/basic_cursor.d.ts +0 -3
  123. package/core/keyboard_nav/cursor.d.ts +0 -3
  124. package/core/keyboard_nav/marker.d.ts +0 -2
  125. package/core/keyboard_nav/tab_navigate_cursor.d.ts +0 -2
  126. package/core/marker_manager.d.ts +0 -2
  127. package/core/menu.d.ts +0 -2
  128. package/core/menuitem.d.ts +0 -2
  129. package/core/metrics_manager.d.ts +0 -2
  130. package/core/mutator.d.ts +0 -2
  131. package/core/names.d.ts +0 -3
  132. package/core/options.d.ts +0 -2
  133. package/core/positionable_helpers.d.ts +0 -7
  134. package/core/procedures.d.ts +2 -25
  135. package/core/registry.d.ts +0 -11
  136. package/core/render_management.d.ts +15 -0
  137. package/core/rendered_connection.d.ts +22 -9
  138. package/core/renderers/common/block_rendering.d.ts +0 -3
  139. package/core/renderers/common/constants.d.ts +6 -51
  140. package/core/renderers/common/debug.d.ts +0 -3
  141. package/core/renderers/common/debugger.d.ts +9 -23
  142. package/core/renderers/common/drawer.d.ts +0 -5
  143. package/core/renderers/common/i_path_object.d.ts +0 -17
  144. package/core/renderers/common/info.d.ts +2 -12
  145. package/core/renderers/common/marker_svg.d.ts +2 -4
  146. package/core/renderers/common/path_object.d.ts +0 -24
  147. package/core/renderers/common/renderer.d.ts +5 -20
  148. package/core/renderers/geras/constants.d.ts +0 -5
  149. package/core/renderers/geras/drawer.d.ts +2 -4
  150. package/core/renderers/geras/highlight_constants.d.ts +6 -17
  151. package/core/renderers/geras/highlighter.d.ts +0 -13
  152. package/core/renderers/geras/info.d.ts +2 -5
  153. package/core/renderers/geras/measurables/inline_input.d.ts +0 -3
  154. package/core/renderers/geras/measurables/statement_input.d.ts +0 -3
  155. package/core/renderers/geras/path_object.d.ts +0 -8
  156. package/core/renderers/geras/renderer.d.ts +5 -7
  157. package/core/renderers/measurables/base.d.ts +0 -3
  158. package/core/renderers/measurables/bottom_row.d.ts +0 -9
  159. package/core/renderers/measurables/connection.d.ts +0 -3
  160. package/core/renderers/measurables/external_value_input.d.ts +0 -3
  161. package/core/renderers/measurables/field.d.ts +0 -3
  162. package/core/renderers/measurables/hat.d.ts +0 -3
  163. package/core/renderers/measurables/icon.d.ts +2 -5
  164. package/core/renderers/measurables/in_row_spacer.d.ts +0 -3
  165. package/core/renderers/measurables/inline_input.d.ts +1 -4
  166. package/core/renderers/measurables/input_connection.d.ts +1 -4
  167. package/core/renderers/measurables/input_row.d.ts +0 -7
  168. package/core/renderers/measurables/jagged_edge.d.ts +2 -5
  169. package/core/renderers/measurables/next_connection.d.ts +0 -3
  170. package/core/renderers/measurables/output_connection.d.ts +0 -3
  171. package/core/renderers/measurables/previous_connection.d.ts +0 -3
  172. package/core/renderers/measurables/round_corner.d.ts +0 -3
  173. package/core/renderers/measurables/row.d.ts +0 -39
  174. package/core/renderers/measurables/spacer_row.d.ts +0 -3
  175. package/core/renderers/measurables/square_corner.d.ts +0 -3
  176. package/core/renderers/measurables/statement_input.d.ts +0 -3
  177. package/core/renderers/measurables/top_row.d.ts +0 -6
  178. package/core/renderers/measurables/types.d.ts +0 -31
  179. package/core/renderers/minimalist/constants.d.ts +2 -4
  180. package/core/renderers/minimalist/drawer.d.ts +0 -3
  181. package/core/renderers/minimalist/info.d.ts +0 -4
  182. package/core/renderers/minimalist/renderer.d.ts +0 -3
  183. package/core/renderers/thrasos/info.d.ts +0 -4
  184. package/core/renderers/thrasos/renderer.d.ts +3 -3
  185. package/core/renderers/zelos/constants.d.ts +3 -17
  186. package/core/renderers/zelos/drawer.d.ts +0 -3
  187. package/core/renderers/zelos/info.d.ts +0 -4
  188. package/core/renderers/zelos/marker_svg.d.ts +0 -2
  189. package/core/renderers/zelos/measurables/bottom_row.d.ts +0 -3
  190. package/core/renderers/zelos/measurables/inputs.d.ts +0 -3
  191. package/core/renderers/zelos/measurables/row_elements.d.ts +0 -3
  192. package/core/renderers/zelos/measurables/top_row.d.ts +0 -3
  193. package/core/renderers/zelos/path_object.d.ts +0 -9
  194. package/core/renderers/zelos/renderer.d.ts +3 -5
  195. package/core/scrollbar.d.ts +0 -2
  196. package/core/scrollbar_pair.d.ts +0 -2
  197. package/core/serialization/blocks.d.ts +3 -9
  198. package/core/serialization/exceptions.d.ts +0 -8
  199. package/core/serialization/priorities.d.ts +0 -4
  200. package/core/serialization/registry.d.ts +0 -2
  201. package/core/serialization/variables.d.ts +0 -4
  202. package/core/serialization/workspaces.d.ts +0 -2
  203. package/core/shortcut_items.d.ts +0 -17
  204. package/core/shortcut_registry.d.ts +0 -2
  205. package/core/sprites.d.ts +0 -2
  206. package/core/theme/classic.d.ts +0 -2
  207. package/core/theme/zelos.d.ts +0 -2
  208. package/core/theme.d.ts +0 -2
  209. package/core/theme_manager.d.ts +3 -6
  210. package/core/toolbox/category.d.ts +5 -7
  211. package/core/toolbox/collapsible_category.d.ts +0 -4
  212. package/core/toolbox/separator.d.ts +0 -2
  213. package/core/toolbox/toolbox.d.ts +2 -5
  214. package/core/toolbox/toolbox_item.d.ts +0 -2
  215. package/core/tooltip.d.ts +0 -29
  216. package/core/touch.d.ts +0 -13
  217. package/core/trashcan.d.ts +0 -2
  218. package/core/utils/aria.d.ts +0 -6
  219. package/core/utils/array.d.ts +0 -1
  220. package/core/utils/colour.d.ts +0 -12
  221. package/core/utils/coordinate.d.ts +0 -2
  222. package/core/utils/deprecation.d.ts +0 -1
  223. package/core/utils/dom.d.ts +0 -25
  224. package/core/utils/idgenerator.d.ts +0 -2
  225. package/core/utils/keycodes.d.ts +0 -2
  226. package/core/utils/math.d.ts +0 -3
  227. package/core/utils/metrics.d.ts +0 -1
  228. package/core/utils/object.d.ts +0 -4
  229. package/core/utils/parsing.d.ts +0 -4
  230. package/core/utils/rect.d.ts +0 -2
  231. package/core/utils/size.d.ts +0 -2
  232. package/core/utils/string.d.ts +0 -6
  233. package/core/utils/style.d.ts +0 -8
  234. package/core/utils/svg.d.ts +0 -2
  235. package/core/utils/svg_math.d.ts +0 -6
  236. package/core/utils/svg_paths.d.ts +0 -8
  237. package/core/utils/toolbox.d.ts +2 -35
  238. package/core/utils/useragent.d.ts +0 -8
  239. package/core/utils/xml.d.ts +9 -8
  240. package/core/utils.d.ts +0 -12
  241. package/core/variable_map.d.ts +1 -3
  242. package/core/variable_model.d.ts +0 -1
  243. package/core/variables.d.ts +13 -17
  244. package/core/variables_dynamic.d.ts +0 -4
  245. package/core/warning.d.ts +0 -2
  246. package/core/widgetdiv.d.ts +0 -10
  247. package/core/workspace.d.ts +3 -3
  248. package/core/workspace_audio.d.ts +0 -2
  249. package/core/workspace_comment.d.ts +1 -3
  250. package/core/workspace_comment_svg.d.ts +16 -5
  251. package/core/workspace_drag_surface_svg.d.ts +74 -0
  252. package/core/workspace_dragger.d.ts +3 -2
  253. package/core/workspace_svg.d.ts +48 -8
  254. package/core/xml.d.ts +1 -13
  255. package/core/zoom_controls.d.ts +4 -15
  256. package/dart_compressed.js +199 -199
  257. package/dart_compressed.js.map +1 -1
  258. package/javascript_compressed.js +168 -168
  259. package/javascript_compressed.js.map +1 -1
  260. package/lua_compressed.js +211 -211
  261. package/lua_compressed.js.map +1 -1
  262. package/msg/bn.js +2 -2
  263. package/msg/bs.js +7 -7
  264. package/msg/de.js +1 -1
  265. package/msg/fi.js +1 -1
  266. package/msg/fr.js +3 -3
  267. package/msg/ia.js +5 -5
  268. package/msg/kn.js +5 -5
  269. package/msg/ko.js +1 -1
  270. package/msg/lb.js +22 -22
  271. package/msg/sd.js +9 -9
  272. package/msg/skr-arab.js +2 -2
  273. package/msg/sl.js +18 -18
  274. package/msg/sw.js +1 -1
  275. package/msg/zh-hans.js +6 -6
  276. package/msg/zh-hant.js +2 -2
  277. package/package.json +6 -6
  278. package/php_compressed.js +185 -185
  279. package/php_compressed.js.map +1 -1
  280. package/python_compressed.js +138 -138
  281. package/python_compressed.js.map +1 -1
  282. package/core/utils/sentinel.d.ts +0 -18
@@ -5,14 +5,10 @@
5
5
  */
6
6
  import './events/events_block_change.js';
7
7
  import { Field, FieldConfig, FieldValidator } from './field.js';
8
- import type { Sentinel } from './utils/sentinel.js';
9
8
  type BoolString = 'TRUE' | 'FALSE';
10
9
  type CheckboxBool = BoolString | boolean;
11
- export type FieldCheckboxValidator = FieldValidator<CheckboxBool>;
12
10
  /**
13
11
  * Class for a checkbox field.
14
- *
15
- * @alias Blockly.FieldCheckbox
16
12
  */
17
13
  export declare class FieldCheckbox extends Field<CheckboxBool> {
18
14
  /** Default character for the checkmark. */
@@ -33,20 +29,20 @@ export declare class FieldCheckbox extends Field<CheckboxBool> {
33
29
  */
34
30
  value_: boolean | null;
35
31
  /**
36
- * @param opt_value The initial value of the field. Should either be 'TRUE',
32
+ * @param value The initial value of the field. Should either be 'TRUE',
37
33
  * 'FALSE' or a boolean. Defaults to 'FALSE'. Also accepts
38
34
  * Field.SKIP_SETUP if you wish to skip setup (only used by subclasses
39
35
  * that want to handle configuration and setting the field value after
40
36
  * their own constructors have run).
41
- * @param opt_validator A function that is called to validate changes to the
37
+ * @param validator A function that is called to validate changes to the
42
38
  * field's value. Takes in a value ('TRUE' or 'FALSE') & returns a
43
39
  * validated value ('TRUE' or 'FALSE'), or null to abort the change.
44
- * @param opt_config A map of options used to configure the field.
40
+ * @param config A map of options used to configure the field.
45
41
  * See the [field creation documentation]{@link
46
42
  * https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/checkbox#creation}
47
43
  * for a list of properties this parameter supports.
48
44
  */
49
- constructor(opt_value?: CheckboxBool | Sentinel, opt_validator?: FieldCheckboxValidator, opt_config?: FieldCheckboxConfig);
45
+ constructor(value?: CheckboxBool | typeof Field.SKIP_SETUP, validator?: FieldCheckboxValidator, config?: FieldCheckboxConfig);
50
46
  /**
51
47
  * Configure the field based on the given map of options.
52
48
  *
@@ -80,10 +76,10 @@ export declare class FieldCheckbox extends Field<CheckboxBool> {
80
76
  /**
81
77
  * Ensure that the input value is valid ('TRUE' or 'FALSE').
82
78
  *
83
- * @param opt_newValue The input value.
79
+ * @param newValue The input value.
84
80
  * @returns A valid value ('TRUE' or 'FALSE), or null if invalid.
85
81
  */
86
- protected doClassValidation_(opt_newValue?: any): BoolString | null;
82
+ protected doClassValidation_(newValue?: any): BoolString | null;
87
83
  /**
88
84
  * Update the value of the field, and update the checkElement.
89
85
  *
@@ -141,5 +137,21 @@ export interface FieldCheckboxConfig extends FieldConfig {
141
137
  export interface FieldCheckboxFromJsonConfig extends FieldCheckboxConfig {
142
138
  checked?: boolean;
143
139
  }
140
+ /**
141
+ * A function that is called to validate changes to the field's value before
142
+ * they are set.
143
+ *
144
+ * @see {@link https://developers.google.com/blockly/guides/create-custom-blocks/fields/validators#return_values}
145
+ * @param newValue The value to be validated.
146
+ * @returns One of three instructions for setting the new value: `T`, `null`,
147
+ * or `undefined`.
148
+ *
149
+ * - `T` to set this function's returned value instead of `newValue`.
150
+ *
151
+ * - `null` to invoke `doValueInvalid_` and not set a value.
152
+ *
153
+ * - `undefined` to set `newValue` as is.
154
+ */
155
+ export type FieldCheckboxValidator = FieldValidator<CheckboxBool>;
144
156
  export {};
145
157
  //# sourceMappingURL=field_checkbox.d.ts.map
@@ -5,12 +5,8 @@
5
5
  */
6
6
  import './events/events_block_change.js';
7
7
  import { Field, FieldConfig, FieldValidator } from './field.js';
8
- import type { Sentinel } from './utils/sentinel.js';
9
- export type FieldColourValidator = FieldValidator<string>;
10
8
  /**
11
9
  * Class for a colour input field.
12
- *
13
- * @alias Blockly.FieldColour
14
10
  */
15
11
  export declare class FieldColour extends Field<string> {
16
12
  /**
@@ -31,19 +27,15 @@ export declare class FieldColour extends Field<string> {
31
27
  */
32
28
  static COLUMNS: number;
33
29
  /** The field's colour picker element. */
34
- private picker_;
30
+ private picker;
35
31
  /** Index of the currently highlighted element. */
36
- private highlightedIndex_;
37
- /** Mouse click event data. */
38
- private onClickWrapper_;
39
- /** Mouse move event data. */
40
- private onMouseMoveWrapper_;
41
- /** Mouse enter event data. */
42
- private onMouseEnterWrapper_;
43
- /** Mouse leave event data. */
44
- private onMouseLeaveWrapper_;
45
- /** Key down event data. */
46
- private onKeyDownWrapper_;
32
+ private highlightedIndex;
33
+ /**
34
+ * Array holding info needed to unbind events.
35
+ * Used for disposing.
36
+ * Ex: [[node, name, func], [node, name, func]].
37
+ */
38
+ private boundEvents;
47
39
  /**
48
40
  * Serializable fields are saved by the serializer, non-serializable fields
49
41
  * are not. Editable fields should also be serializable.
@@ -58,32 +50,32 @@ export declare class FieldColour extends Field<string> {
58
50
  */
59
51
  protected isDirty_: boolean;
60
52
  /** Array of colours used by this field. If null, use the global list. */
61
- private colours_;
53
+ private colours;
62
54
  /**
63
55
  * Array of colour tooltips used by this field. If null, use the global
64
56
  * list.
65
57
  */
66
- private titles_;
58
+ private titles;
67
59
  /**
68
60
  * Number of colour columns used by this field. If 0, use the global
69
61
  * setting. By default use the global constants for columns.
70
62
  */
71
- private columns_;
63
+ private columns;
72
64
  /**
73
- * @param opt_value The initial value of the field. Should be in '#rrggbb'
65
+ * @param value The initial value of the field. Should be in '#rrggbb'
74
66
  * format. Defaults to the first value in the default colour array. Also
75
67
  * accepts Field.SKIP_SETUP if you wish to skip setup (only used by
76
68
  * subclasses that want to handle configuration and setting the field
77
69
  * value after their own constructors have run).
78
- * @param opt_validator A function that is called to validate changes to the
70
+ * @param validator A function that is called to validate changes to the
79
71
  * field's value. Takes in a colour string & returns a validated colour
80
- * string ('#rrggbb' format), or null to abort the change.Blockly.
81
- * @param opt_config A map of options used to configure the field.
72
+ * string ('#rrggbb' format), or null to abort the change.
73
+ * @param config A map of options used to configure the field.
82
74
  * See the [field creation documentation]{@link
83
75
  * https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/colour}
84
76
  * for a list of properties this parameter supports.
85
77
  */
86
- constructor(opt_value?: string | Sentinel, opt_validator?: FieldColourValidator, opt_config?: FieldColourConfig);
78
+ constructor(value?: string | typeof Field.SKIP_SETUP, validator?: FieldColourValidator, config?: FieldColourConfig);
87
79
  /**
88
80
  * Configure the field based on the given map of options.
89
81
  *
@@ -96,14 +88,19 @@ export declare class FieldColour extends Field<string> {
96
88
  * @internal
97
89
  */
98
90
  initView(): void;
91
+ /**
92
+ * Updates text field to match the colour/style of the block.
93
+ *
94
+ * @internal
95
+ */
99
96
  applyColour(): void;
100
97
  /**
101
98
  * Ensure that the input value is a valid colour.
102
99
  *
103
- * @param opt_newValue The input value.
100
+ * @param newValue The input value.
104
101
  * @returns A valid colour, or null if invalid.
105
102
  */
106
- protected doClassValidation_(opt_newValue?: any): string | null;
103
+ protected doClassValidation_(newValue?: any): string | null;
107
104
  /**
108
105
  * Update the value of this colour field, and update the displayed colour.
109
106
  *
@@ -122,11 +119,11 @@ export declare class FieldColour extends Field<string> {
122
119
  *
123
120
  * @param colours Array of colours for this block, or null to use default
124
121
  * (FieldColour.COLOURS).
125
- * @param opt_titles Optional array of colour tooltips, or null to use default
122
+ * @param titles Optional array of colour tooltips, or null to use default
126
123
  * (FieldColour.TITLES).
127
124
  * @returns Returns itself (for method chaining).
128
125
  */
129
- setColours(colours: string[], opt_titles?: string[]): FieldColour;
126
+ setColours(colours: string[], titles?: string[]): FieldColour;
130
127
  /**
131
128
  * Set a custom grid size for this field.
132
129
  *
@@ -142,51 +139,51 @@ export declare class FieldColour extends Field<string> {
142
139
  *
143
140
  * @param e Mouse event.
144
141
  */
145
- private onClick_;
142
+ private onClick;
146
143
  /**
147
144
  * Handle a key down event. Navigate around the grid with the
148
145
  * arrow keys. Enter selects the highlighted colour.
149
146
  *
150
147
  * @param e Keyboard event.
151
148
  */
152
- private onKeyDown_;
149
+ private onKeyDown;
153
150
  /**
154
151
  * Move the currently highlighted position by dx and dy.
155
152
  *
156
- * @param dx Change of x
157
- * @param dy Change of y
153
+ * @param dx Change of x.
154
+ * @param dy Change of y.
158
155
  */
159
- private moveHighlightBy_;
156
+ private moveHighlightBy;
160
157
  /**
161
158
  * Handle a mouse move event. Highlight the hovered colour.
162
159
  *
163
160
  * @param e Mouse event.
164
161
  */
165
- private onMouseMove_;
162
+ private onMouseMove;
166
163
  /** Handle a mouse enter event. Focus the picker. */
167
- private onMouseEnter_;
164
+ private onMouseEnter;
168
165
  /**
169
166
  * Handle a mouse leave event. Blur the picker and unhighlight
170
167
  * the currently highlighted colour.
171
168
  */
172
- private onMouseLeave_;
169
+ private onMouseLeave;
173
170
  /**
174
171
  * Returns the currently highlighted item (if any).
175
172
  *
176
173
  * @returns Highlighted item (null if none).
177
174
  */
178
- private getHighlighted_;
175
+ private getHighlighted;
179
176
  /**
180
177
  * Update the currently highlighted cell.
181
178
  *
182
- * @param cell the new cell to highlight
183
- * @param index the index of the new cell
179
+ * @param cell The new cell to highlight.
180
+ * @param index The index of the new cell.
184
181
  */
185
- private setHighlightedCell_;
182
+ private setHighlightedCell;
186
183
  /** Create a colour picker dropdown editor. */
187
- private dropdownCreate_;
184
+ private dropdownCreate;
188
185
  /** Disposes of events and DOM-references belonging to the colour editor. */
189
- private dropdownDispose_;
186
+ private dropdownDispose;
190
187
  /**
191
188
  * Construct a FieldColour from a JSON arg object.
192
189
  *
@@ -211,4 +208,20 @@ export interface FieldColourConfig extends FieldConfig {
211
208
  export interface FieldColourFromJsonConfig extends FieldColourConfig {
212
209
  colour?: string;
213
210
  }
211
+ /**
212
+ * A function that is called to validate changes to the field's value before
213
+ * they are set.
214
+ *
215
+ * @see {@link https://developers.google.com/blockly/guides/create-custom-blocks/fields/validators#return_values}
216
+ * @param newValue The value to be validated.
217
+ * @returns One of three instructions for setting the new value: `T`, `null`,
218
+ * or `undefined`.
219
+ *
220
+ * - `T` to set this function's returned value instead of `newValue`.
221
+ *
222
+ * - `null` to invoke `doValueInvalid_` and not set a value.
223
+ *
224
+ * - `undefined` to set `newValue` as is.
225
+ */
226
+ export type FieldColourValidator = FieldValidator<string>;
214
227
  //# sourceMappingURL=field_colour.d.ts.map
@@ -6,12 +6,8 @@
6
6
  import { Field, FieldConfig, FieldValidator } from './field.js';
7
7
  import { Menu } from './menu.js';
8
8
  import { MenuItem } from './menuitem.js';
9
- import type { Sentinel } from './utils/sentinel.js';
10
- export type FieldDropdownValidator = FieldValidator<string>;
11
9
  /**
12
10
  * Class for an editable dropdown field.
13
- *
14
- * @alias Blockly.FieldDropdown
15
11
  */
16
12
  export declare class FieldDropdown extends Field<string> {
17
13
  /** Horizontal distance that a checkmark overhangs the dropdown. */
@@ -64,18 +60,18 @@ export declare class FieldDropdown extends Field<string> {
64
60
  * if you wish to skip setup (only used by subclasses that want to handle
65
61
  * configuration and setting the field value after their own constructors
66
62
  * have run).
67
- * @param opt_validator A function that is called to validate changes to the
63
+ * @param validator A function that is called to validate changes to the
68
64
  * field's value. Takes in a language-neutral dropdown option & returns a
69
65
  * validated language-neutral dropdown option, or null to abort the
70
66
  * change.
71
- * @param opt_config A map of options used to configure the field.
67
+ * @param config A map of options used to configure the field.
72
68
  * See the [field creation documentation]{@link
73
69
  * https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/dropdown#creation}
74
70
  * for a list of properties this parameter supports.
75
71
  * @throws {TypeError} If `menuGenerator` options are incorrectly structured.
76
72
  */
77
- constructor(menuGenerator: MenuGenerator, opt_validator?: FieldDropdownValidator, opt_config?: FieldConfig);
78
- constructor(menuGenerator: Sentinel);
73
+ constructor(menuGenerator: MenuGenerator, validator?: FieldDropdownValidator, config?: FieldDropdownConfig);
74
+ constructor(menuGenerator: typeof Field.SKIP_SETUP);
79
75
  /**
80
76
  * Sets the field's value based on the given XML element. Should only be
81
77
  * called by Blockly.Xml.
@@ -110,16 +106,16 @@ export declare class FieldDropdown extends Field<string> {
110
106
  /**
111
107
  * Create a dropdown menu under the text.
112
108
  *
113
- * @param opt_e Optional mouse event that triggered the field to open, or
109
+ * @param e Optional mouse event that triggered the field to open, or
114
110
  * undefined if triggered programmatically.
115
111
  */
116
- protected showEditor_(opt_e?: MouseEvent): void;
112
+ protected showEditor_(e?: MouseEvent): void;
117
113
  /** Create the dropdown editor. */
118
114
  private dropdownCreate_;
119
115
  /**
120
116
  * Disposes of events and DOM-references belonging to the dropdown editor.
121
117
  */
122
- private dropdownDispose_;
118
+ protected dropdownDispose_(): void;
123
119
  /**
124
120
  * Handle an action in the dropdown menu.
125
121
  *
@@ -141,20 +137,20 @@ export declare class FieldDropdown extends Field<string> {
141
137
  /**
142
138
  * Return a list of the options for this dropdown.
143
139
  *
144
- * @param opt_useCache For dynamic options, whether or not to use the cached
140
+ * @param useCache For dynamic options, whether or not to use the cached
145
141
  * options or to re-generate them.
146
142
  * @returns A non-empty array of option tuples:
147
143
  * (human-readable text or image, language-neutral name).
148
144
  * @throws {TypeError} If generated options are incorrectly structured.
149
145
  */
150
- getOptions(opt_useCache?: boolean): MenuOption[];
146
+ getOptions(useCache?: boolean): MenuOption[];
151
147
  /**
152
148
  * Ensure that the input value is a valid language-neutral option.
153
149
  *
154
- * @param opt_newValue The input value.
150
+ * @param newValue The input value.
155
151
  * @returns A valid language-neutral option, or null if invalid.
156
152
  */
157
- protected doClassValidation_(opt_newValue?: string): string | null;
153
+ protected doClassValidation_(newValue?: string): string | null;
158
154
  /**
159
155
  * Update the value of this dropdown field.
160
156
  *
@@ -188,8 +184,8 @@ export declare class FieldDropdown extends Field<string> {
188
184
  private positionSVGArrow_;
189
185
  /**
190
186
  * Use the `getText_` developer hook to override the field's text
191
- * representation. Get the selected option text. If the selected option is an
192
- * image we return the image alt text.
187
+ * representation. Get the selected option text. If the selected option is
188
+ * an image we return the image alt text.
193
189
  *
194
190
  * @returns Selected option text.
195
191
  */
@@ -229,10 +225,30 @@ export type MenuGeneratorFunction = (this: FieldDropdown) => MenuOption[];
229
225
  * menu options for FieldDropdown or its descendants.
230
226
  */
231
227
  export type MenuGenerator = MenuOption[] | MenuGeneratorFunction;
228
+ /**
229
+ * Config options for the dropdown field.
230
+ */
231
+ export type FieldDropdownConfig = FieldConfig;
232
232
  /**
233
233
  * fromJson config for the dropdown field.
234
234
  */
235
- export interface FieldDropdownFromJsonConfig extends FieldConfig {
235
+ export interface FieldDropdownFromJsonConfig extends FieldDropdownConfig {
236
236
  options?: MenuOption[];
237
237
  }
238
+ /**
239
+ * A function that is called to validate changes to the field's value before
240
+ * they are set.
241
+ *
242
+ * @see {@link https://developers.google.com/blockly/guides/create-custom-blocks/fields/validators#return_values}
243
+ * @param newValue The value to be validated.
244
+ * @returns One of three instructions for setting the new value: `T`, `null`,
245
+ * or `undefined`.
246
+ *
247
+ * - `T` to set this function's returned value instead of `newValue`.
248
+ *
249
+ * - `null` to invoke `doValueInvalid_` and not set a value.
250
+ *
251
+ * - `undefined` to set `newValue` as is.
252
+ */
253
+ export type FieldDropdownValidator = FieldValidator<string>;
238
254
  //# sourceMappingURL=field_dropdown.d.ts.map
@@ -4,12 +4,9 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import { Field, FieldConfig } from './field.js';
7
- import type { Sentinel } from './utils/sentinel.js';
8
7
  import { Size } from './utils/size.js';
9
8
  /**
10
9
  * Class for an image on a block.
11
- *
12
- * @alias Blockly.FieldImage
13
10
  */
14
11
  export declare class FieldImage extends Field<string> {
15
12
  /**
@@ -45,16 +42,16 @@ export declare class FieldImage extends Field<string> {
45
42
  * after their own constructors have run).
46
43
  * @param width Width of the image.
47
44
  * @param height Height of the image.
48
- * @param opt_alt Optional alt text for when block is collapsed.
49
- * @param opt_onClick Optional function to be called when the image is
50
- * clicked. If opt_onClick is defined, opt_alt must also be defined.
51
- * @param opt_flipRtl Whether to flip the icon in RTL.
52
- * @param opt_config A map of options used to configure the field.
45
+ * @param alt Optional alt text for when block is collapsed.
46
+ * @param onClick Optional function to be called when the image is
47
+ * clicked. If onClick is defined, alt must also be defined.
48
+ * @param flipRtl Whether to flip the icon in RTL.
49
+ * @param config A map of options used to configure the field.
53
50
  * See the [field creation documentation]{@link
54
51
  * https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/image#creation}
55
52
  * for a list of properties this parameter supports.
56
53
  */
57
- constructor(src: string | Sentinel, width: string | number, height: string | number, opt_alt?: string, opt_onClick?: (p1: FieldImage) => any, opt_flipRtl?: boolean, opt_config?: FieldImageConfig);
54
+ constructor(src: string | typeof Field.SKIP_SETUP, width: string | number, height: string | number, alt?: string, onClick?: (p1: FieldImage) => void, flipRtl?: boolean, config?: FieldImageConfig);
58
55
  /**
59
56
  * Configure the field based on the given map of options.
60
57
  *
@@ -71,10 +68,10 @@ export declare class FieldImage extends Field<string> {
71
68
  /**
72
69
  * Ensure that the input value (the source URL) is a string.
73
70
  *
74
- * @param opt_newValue The input value.
71
+ * @param newValue The input value.
75
72
  * @returns A string, or null if invalid.
76
73
  */
77
- protected doClassValidation_(opt_newValue?: any): string | null;
74
+ protected doClassValidation_(newValue?: any): string | null;
78
75
  /**
79
76
  * Update the value of this image field, and update the displayed image.
80
77
  *
@@ -105,7 +102,7 @@ export declare class FieldImage extends Field<string> {
105
102
  * @param func The function that is called when the image is clicked, or null
106
103
  * to remove.
107
104
  */
108
- setOnClickHandler(func: ((p1: FieldImage) => any) | null): void;
105
+ setOnClickHandler(func: ((p1: FieldImage) => void) | null): void;
109
106
  /**
110
107
  * Use the `getText_` developer hook to override the field's text
111
108
  * representation.
@@ -5,15 +5,18 @@
5
5
  */
6
6
  import './events/events_block_change.js';
7
7
  import { Field, FieldConfig, FieldValidator } from './field.js';
8
- import type { Sentinel } from './utils/sentinel.js';
9
8
  import type { WorkspaceSvg } from './workspace_svg.js';
10
- export type InputTypes = string | number;
11
- export type FieldInputValidator<T extends InputTypes> = FieldValidator<string | T>;
9
+ /**
10
+ * Supported types for FieldInput subclasses.
11
+ *
12
+ * @internal
13
+ */
14
+ type InputTypes = string | number;
12
15
  /**
13
16
  * Abstract class for an editable input field.
14
17
  *
15
- * @alias Blockly.FieldInput
16
18
  * @typeParam T - The value stored on the field.
19
+ * @internal
17
20
  */
18
21
  export declare abstract class FieldInput<T extends InputTypes> extends Field<string | T> {
19
22
  /**
@@ -50,20 +53,20 @@ export declare abstract class FieldInput<T extends InputTypes> extends Field<str
50
53
  /** Mouse cursor style when over the hotspot that initiates the editor. */
51
54
  CURSOR: string;
52
55
  /**
53
- * @param opt_value The initial value of the field. Should cast to a string.
56
+ * @param value The initial value of the field. Should cast to a string.
54
57
  * Defaults to an empty string if null or undefined. Also accepts
55
58
  * Field.SKIP_SETUP if you wish to skip setup (only used by subclasses
56
59
  * that want to handle configuration and setting the field value after
57
60
  * their own constructors have run).
58
- * @param opt_validator A function that is called to validate changes to the
61
+ * @param validator A function that is called to validate changes to the
59
62
  * field's value. Takes in a string & returns a validated string, or null
60
63
  * to abort the change.
61
- * @param opt_config A map of options used to configure the field.
64
+ * @param config A map of options used to configure the field.
62
65
  * See the [field creation documentation]{@link
63
66
  * https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/text-input#creation}
64
67
  * for a list of properties this parameter supports.
65
68
  */
66
- constructor(opt_value?: string | Sentinel, opt_validator?: FieldInputValidator<T> | null, opt_config?: FieldInputConfig);
69
+ constructor(value?: string | typeof Field.SKIP_SETUP, validator?: FieldInputValidator<T> | null, config?: FieldInputConfig);
67
70
  protected configure_(config: FieldInputConfig): void;
68
71
  /** @internal */
69
72
  initView(): void;
@@ -109,12 +112,12 @@ export declare abstract class FieldInput<T extends InputTypes> extends Field<str
109
112
  * Shows a prompt editor for mobile browsers if the modalInputs option is
110
113
  * enabled.
111
114
  *
112
- * @param _opt_e Optional mouse event that triggered the field to open, or
115
+ * @param _e Optional mouse event that triggered the field to open, or
113
116
  * undefined if triggered programmatically.
114
- * @param opt_quietInput True if editor should be created without focus.
117
+ * @param quietInput True if editor should be created without focus.
115
118
  * Defaults to false.
116
119
  */
117
- protected showEditor_(_opt_e?: Event, opt_quietInput?: boolean): void;
120
+ protected showEditor_(_e?: Event, quietInput?: boolean): void;
118
121
  /**
119
122
  * Create and show a text input editor that is a prompt (usually a popup).
120
123
  * Mobile browsers may have issues with in-line textareas (focus and
@@ -213,8 +216,28 @@ export declare abstract class FieldInput<T extends InputTypes> extends Field<str
213
216
  }
214
217
  /**
215
218
  * Config options for the input field.
219
+ *
220
+ * @internal
216
221
  */
217
222
  export interface FieldInputConfig extends FieldConfig {
218
223
  spellcheck?: boolean;
219
224
  }
225
+ /**
226
+ * A function that is called to validate changes to the field's value before
227
+ * they are set.
228
+ *
229
+ * @see {@link https://developers.google.com/blockly/guides/create-custom-blocks/fields/validators#return_values}
230
+ * @param newValue The value to be validated.
231
+ * @returns One of three instructions for setting the new value: `T`, `null`,
232
+ * or `undefined`.
233
+ *
234
+ * - `T` to set this function's returned value instead of `newValue`.
235
+ *
236
+ * - `null` to invoke `doValueInvalid_` and not set a value.
237
+ *
238
+ * - `undefined` to set `newValue` as is.
239
+ * @internal
240
+ */
241
+ export type FieldInputValidator<T extends InputTypes> = FieldValidator<string | T>;
242
+ export {};
220
243
  //# sourceMappingURL=field_input.d.ts.map
@@ -4,14 +4,11 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import { Field, FieldConfig } from './field.js';
7
- import type { Sentinel } from './utils/sentinel.js';
8
7
  /**
9
8
  * Class for a non-editable, non-serializable text field.
10
- *
11
- * @alias Blockly.FieldLabel
12
9
  */
13
10
  export declare class FieldLabel extends Field<string> {
14
- /** The html class name to use for this field. */
11
+ /** The HTML class name to use for this field. */
15
12
  private class_;
16
13
  /**
17
14
  * Editable fields usually show some sort of UI indicating they are
@@ -19,18 +16,18 @@ export declare class FieldLabel extends Field<string> {
19
16
  */
20
17
  EDITABLE: boolean;
21
18
  /**
22
- * @param opt_value The initial value of the field. Should cast to a string.
19
+ * @param value The initial value of the field. Should cast to a string.
23
20
  * Defaults to an empty string if null or undefined. Also accepts
24
21
  * Field.SKIP_SETUP if you wish to skip setup (only used by subclasses
25
22
  * that want to handle configuration and setting the field value after
26
23
  * their own constructors have run).
27
- * @param opt_class Optional CSS class for the field's text.
28
- * @param opt_config A map of options used to configure the field.
24
+ * @param textClass Optional CSS class for the field's text.
25
+ * @param config A map of options used to configure the field.
29
26
  * See the [field creation documentation]{@link
30
27
  * https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/label#creation}
31
28
  * for a list of properties this parameter supports.
32
29
  */
33
- constructor(opt_value?: string | Sentinel, opt_class?: string, opt_config?: FieldLabelConfig);
30
+ constructor(value?: string | typeof Field.SKIP_SETUP, textClass?: string, config?: FieldLabelConfig);
34
31
  protected configure_(config: FieldLabelConfig): void;
35
32
  /**
36
33
  * Create block UI for this label.
@@ -41,10 +38,10 @@ export declare class FieldLabel extends Field<string> {
41
38
  /**
42
39
  * Ensure that the input value casts to a valid string.
43
40
  *
44
- * @param opt_newValue The input value.
41
+ * @param newValue The input value.
45
42
  * @returns A valid string, or null if invalid.
46
43
  */
47
- protected doClassValidation_(opt_newValue?: any): string | null;
44
+ protected doClassValidation_(newValue?: any): string | null;
48
45
  /**
49
46
  * Set the CSS class applied to the field's textElement_.
50
47
  *
@@ -6,8 +6,6 @@
6
6
  import { FieldLabel, FieldLabelConfig, FieldLabelFromJsonConfig } from './field_label.js';
7
7
  /**
8
8
  * Class for a non-editable, serializable text field.
9
- *
10
- * @alias Blockly.FieldLabelSerializable
11
9
  */
12
10
  export declare class FieldLabelSerializable extends FieldLabel {
13
11
  /**
@@ -22,15 +20,15 @@ export declare class FieldLabelSerializable extends FieldLabel {
22
20
  */
23
21
  SERIALIZABLE: boolean;
24
22
  /**
25
- * @param opt_value The initial value of the field. Should cast to a string.
23
+ * @param value The initial value of the field. Should cast to a string.
26
24
  * Defaults to an empty string if null or undefined.
27
- * @param opt_class Optional CSS class for the field's text.
28
- * @param opt_config A map of options used to configure the field.
25
+ * @param textClass Optional CSS class for the field's text.
26
+ * @param config A map of options used to configure the field.
29
27
  * See the [field creation documentation]{@link
30
28
  * https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/label-serializable#creation}
31
29
  * for a list of properties this parameter supports.
32
30
  */
33
- constructor(opt_value?: string, opt_class?: string, opt_config?: FieldLabelConfig);
31
+ constructor(value?: string, textClass?: string, config?: FieldLabelConfig);
34
32
  /**
35
33
  * Construct a FieldLabelSerializable from a JSON arg object,
36
34
  * dereferencing any string table references.