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.
- package/blockly.min.js +1615 -1509
- package/blockly_compressed.js +1249 -1136
- package/blockly_compressed.js.map +1 -1
- package/blocks_compressed.js +166 -173
- package/blocks_compressed.js.map +1 -1
- package/core/any_aliases.d.ts +5 -0
- package/core/block.d.ts +49 -17
- package/core/block_animations.d.ts +0 -4
- package/core/block_dragger.d.ts +1 -6
- package/core/block_svg.d.ts +58 -8
- package/core/blockly.d.ts +27 -58
- package/core/blockly_options.d.ts +0 -2
- package/core/blocks.d.ts +0 -2
- package/core/browser_events.d.ts +0 -9
- package/core/bubble.d.ts +0 -2
- package/core/bubble_dragger.d.ts +0 -2
- package/core/bump_objects.d.ts +0 -3
- package/core/clipboard.d.ts +0 -3
- package/core/comment.d.ts +6 -10
- package/core/common.d.ts +0 -12
- package/core/component_manager.d.ts +0 -2
- package/core/connection.d.ts +19 -6
- package/core/connection_checker.d.ts +1 -3
- package/core/connection_db.d.ts +0 -2
- package/core/connection_type.d.ts +0 -2
- package/core/constants.d.ts +0 -4
- package/core/contextmenu.d.ts +0 -11
- package/core/contextmenu_items.d.ts +0 -27
- package/core/contextmenu_registry.d.ts +0 -2
- package/core/css.d.ts +0 -2
- package/core/delete_area.d.ts +0 -2
- package/core/dialog.d.ts +0 -6
- package/core/drag_target.d.ts +0 -2
- package/core/events/events.d.ts +2 -22
- package/core/events/events_abstract.d.ts +7 -3
- package/core/events/events_block_base.d.ts +2 -3
- package/core/events/events_block_change.d.ts +9 -3
- package/core/events/events_block_create.d.ts +6 -4
- package/core/events/events_block_delete.d.ts +7 -4
- package/core/events/events_block_drag.d.ts +7 -3
- package/core/events/events_block_move.d.ts +20 -3
- package/core/events/events_bubble_open.d.ts +3 -2
- package/core/events/events_click.d.ts +6 -3
- package/core/events/events_comment_base.d.ts +1 -2
- package/core/events/events_comment_change.d.ts +3 -3
- package/core/events/events_comment_create.d.ts +2 -3
- package/core/events/events_comment_delete.d.ts +2 -3
- package/core/events/events_comment_move.d.ts +4 -4
- package/core/events/events_marker_move.d.ts +10 -3
- package/core/events/events_selected.d.ts +6 -2
- package/core/events/events_theme_change.d.ts +2 -3
- package/core/events/events_toolbox_item_select.d.ts +3 -3
- package/core/events/events_trashcan_open.d.ts +5 -3
- package/core/events/events_ui.d.ts +0 -1
- package/core/events/events_ui_base.d.ts +0 -2
- package/core/events/events_var_base.d.ts +1 -2
- package/core/events/events_var_create.d.ts +3 -3
- package/core/events/events_var_delete.d.ts +4 -2
- package/core/events/events_var_rename.d.ts +4 -2
- package/core/events/events_viewport.d.ts +13 -2
- package/core/events/utils.d.ts +0 -89
- package/core/events/workspace_events.d.ts +2 -6
- package/core/extensions.d.ts +0 -8
- package/core/field.d.ts +55 -21
- package/core/field_angle.d.ts +61 -51
- package/core/field_checkbox.d.ts +34 -15
- package/core/field_colour.d.ts +56 -46
- package/core/field_dropdown.d.ts +35 -19
- package/core/field_image.d.ts +10 -14
- package/core/field_input.d.ts +39 -25
- package/core/field_label.d.ts +7 -10
- package/core/field_label_serializable.d.ts +4 -6
- package/core/field_multilineinput.d.ts +36 -14
- package/core/field_number.d.ts +27 -19
- package/core/field_registry.d.ts +0 -3
- package/core/field_textinput.d.ts +36 -8
- package/core/field_variable.d.ts +30 -18
- package/core/flyout_base.d.ts +5 -6
- package/core/flyout_button.d.ts +2 -2
- package/core/flyout_horizontal.d.ts +0 -2
- package/core/flyout_metrics_manager.d.ts +0 -2
- package/core/flyout_vertical.d.ts +0 -2
- package/core/generator.d.ts +0 -1
- package/core/gesture.d.ts +5 -18
- package/core/grid.d.ts +0 -2
- package/core/icon.d.ts +0 -2
- package/core/inject.d.ts +0 -1
- package/core/input.d.ts +0 -3
- package/core/input_types.d.ts +0 -2
- package/core/insertion_marker_manager.d.ts +6 -6
- package/core/interfaces/i_ast_node_location.d.ts +0 -2
- package/core/interfaces/i_ast_node_location_svg.d.ts +0 -2
- package/core/interfaces/i_ast_node_location_with_block.d.ts +0 -2
- package/core/interfaces/i_autohideable.d.ts +0 -2
- package/core/interfaces/i_block_dragger.d.ts +0 -2
- package/core/interfaces/i_bounded_element.d.ts +0 -2
- package/core/interfaces/i_bubble.d.ts +0 -2
- package/core/interfaces/i_collapsible_toolbox_item.d.ts +0 -2
- package/core/interfaces/i_component.d.ts +0 -2
- package/core/interfaces/i_connection_checker.d.ts +0 -2
- package/core/interfaces/i_contextmenu.d.ts +0 -1
- package/core/interfaces/i_copyable.d.ts +3 -2
- package/core/interfaces/i_deletable.d.ts +0 -2
- package/core/interfaces/i_delete_area.d.ts +0 -2
- package/core/interfaces/i_drag_target.d.ts +0 -2
- package/core/interfaces/i_draggable.d.ts +0 -2
- package/core/interfaces/i_flyout.d.ts +0 -2
- package/core/interfaces/i_keyboard_accessible.d.ts +0 -2
- package/core/interfaces/i_legacy_procedure_blocks.d.ts +34 -0
- package/core/interfaces/i_metrics_manager.d.ts +8 -8
- package/core/interfaces/i_movable.d.ts +0 -2
- package/core/interfaces/i_positionable.d.ts +0 -2
- package/core/interfaces/i_procedure_block.d.ts +3 -0
- package/core/interfaces/i_procedure_model.d.ts +0 -5
- package/core/interfaces/i_registrable.d.ts +0 -2
- package/core/interfaces/i_selectable.d.ts +0 -2
- package/core/interfaces/i_selectable_toolbox_item.d.ts +4 -2
- package/core/interfaces/i_serializer.d.ts +0 -2
- package/core/interfaces/i_styleable.d.ts +0 -2
- package/core/interfaces/i_toolbox.d.ts +0 -2
- package/core/interfaces/i_toolbox_item.d.ts +0 -2
- package/core/interfaces/i_variable_backed_parameter_model.d.ts +17 -0
- package/core/internal_constants.d.ts +0 -5
- package/core/keyboard_nav/ast_node.d.ts +0 -3
- package/core/keyboard_nav/basic_cursor.d.ts +0 -3
- package/core/keyboard_nav/cursor.d.ts +0 -3
- package/core/keyboard_nav/marker.d.ts +0 -2
- package/core/keyboard_nav/tab_navigate_cursor.d.ts +0 -2
- package/core/marker_manager.d.ts +0 -2
- package/core/menu.d.ts +0 -2
- package/core/menuitem.d.ts +0 -2
- package/core/metrics_manager.d.ts +8 -8
- package/core/mutator.d.ts +0 -2
- package/core/names.d.ts +0 -3
- package/core/{procedures/observable_procedure_map.d.ts → observable_procedure_map.d.ts} +4 -5
- package/core/options.d.ts +0 -2
- package/core/positionable_helpers.d.ts +0 -7
- package/core/procedures.d.ts +7 -28
- package/core/registry.d.ts +0 -11
- package/core/render_management.d.ts +15 -0
- package/core/rendered_connection.d.ts +22 -9
- package/core/renderers/common/block_rendering.d.ts +0 -3
- package/core/renderers/common/constants.d.ts +6 -51
- package/core/renderers/common/debug.d.ts +0 -3
- package/core/renderers/common/debugger.d.ts +9 -23
- package/core/renderers/common/drawer.d.ts +0 -5
- package/core/renderers/common/i_path_object.d.ts +0 -17
- package/core/renderers/common/info.d.ts +2 -12
- package/core/renderers/common/marker_svg.d.ts +2 -4
- package/core/renderers/common/path_object.d.ts +0 -24
- package/core/renderers/common/renderer.d.ts +5 -20
- package/core/renderers/geras/constants.d.ts +0 -5
- package/core/renderers/geras/drawer.d.ts +2 -4
- package/core/renderers/geras/highlight_constants.d.ts +6 -17
- package/core/renderers/geras/highlighter.d.ts +0 -13
- package/core/renderers/geras/info.d.ts +2 -5
- package/core/renderers/geras/measurables/inline_input.d.ts +0 -3
- package/core/renderers/geras/measurables/statement_input.d.ts +0 -3
- package/core/renderers/geras/path_object.d.ts +0 -8
- package/core/renderers/geras/renderer.d.ts +5 -7
- package/core/renderers/measurables/base.d.ts +0 -3
- package/core/renderers/measurables/bottom_row.d.ts +0 -9
- package/core/renderers/measurables/connection.d.ts +0 -3
- package/core/renderers/measurables/external_value_input.d.ts +0 -3
- package/core/renderers/measurables/field.d.ts +0 -3
- package/core/renderers/measurables/hat.d.ts +0 -3
- package/core/renderers/measurables/icon.d.ts +2 -5
- package/core/renderers/measurables/in_row_spacer.d.ts +0 -3
- package/core/renderers/measurables/inline_input.d.ts +1 -4
- package/core/renderers/measurables/input_connection.d.ts +1 -4
- package/core/renderers/measurables/input_row.d.ts +0 -7
- package/core/renderers/measurables/jagged_edge.d.ts +2 -5
- package/core/renderers/measurables/next_connection.d.ts +0 -3
- package/core/renderers/measurables/output_connection.d.ts +0 -3
- package/core/renderers/measurables/previous_connection.d.ts +0 -3
- package/core/renderers/measurables/round_corner.d.ts +0 -3
- package/core/renderers/measurables/row.d.ts +0 -39
- package/core/renderers/measurables/spacer_row.d.ts +0 -3
- package/core/renderers/measurables/square_corner.d.ts +0 -3
- package/core/renderers/measurables/statement_input.d.ts +0 -3
- package/core/renderers/measurables/top_row.d.ts +0 -6
- package/core/renderers/measurables/types.d.ts +0 -31
- package/core/renderers/minimalist/constants.d.ts +2 -4
- package/core/renderers/minimalist/drawer.d.ts +0 -3
- package/core/renderers/minimalist/info.d.ts +0 -4
- package/core/renderers/minimalist/renderer.d.ts +0 -3
- package/core/renderers/thrasos/info.d.ts +0 -4
- package/core/renderers/thrasos/renderer.d.ts +3 -3
- package/core/renderers/zelos/constants.d.ts +3 -17
- package/core/renderers/zelos/drawer.d.ts +0 -3
- package/core/renderers/zelos/info.d.ts +0 -4
- package/core/renderers/zelos/marker_svg.d.ts +0 -2
- package/core/renderers/zelos/measurables/bottom_row.d.ts +0 -3
- package/core/renderers/zelos/measurables/inputs.d.ts +0 -3
- package/core/renderers/zelos/measurables/row_elements.d.ts +0 -3
- package/core/renderers/zelos/measurables/top_row.d.ts +0 -3
- package/core/renderers/zelos/path_object.d.ts +0 -9
- package/core/renderers/zelos/renderer.d.ts +3 -5
- package/core/scrollbar.d.ts +0 -2
- package/core/scrollbar_pair.d.ts +0 -2
- package/core/serialization/blocks.d.ts +3 -9
- package/core/serialization/exceptions.d.ts +0 -8
- package/core/serialization/priorities.d.ts +0 -4
- package/core/serialization/procedures.d.ts +0 -7
- package/core/serialization/registry.d.ts +0 -2
- package/core/serialization/variables.d.ts +0 -4
- package/core/serialization/workspaces.d.ts +0 -2
- package/core/shortcut_items.d.ts +0 -17
- package/core/shortcut_registry.d.ts +0 -2
- package/core/sprites.d.ts +0 -2
- package/core/theme/classic.d.ts +0 -2
- package/core/theme/zelos.d.ts +0 -2
- package/core/theme.d.ts +0 -2
- package/core/theme_manager.d.ts +3 -6
- package/core/toolbox/category.d.ts +5 -7
- package/core/toolbox/collapsible_category.d.ts +0 -4
- package/core/toolbox/separator.d.ts +0 -2
- package/core/toolbox/toolbox.d.ts +2 -5
- package/core/toolbox/toolbox_item.d.ts +0 -2
- package/core/tooltip.d.ts +0 -29
- package/core/touch.d.ts +0 -13
- package/core/trashcan.d.ts +0 -2
- package/core/utils/aria.d.ts +0 -6
- package/core/utils/array.d.ts +0 -1
- package/core/utils/colour.d.ts +0 -12
- package/core/utils/coordinate.d.ts +0 -2
- package/core/utils/deprecation.d.ts +0 -1
- package/core/utils/dom.d.ts +0 -25
- package/core/utils/idgenerator.d.ts +0 -2
- package/core/utils/keycodes.d.ts +0 -2
- package/core/utils/math.d.ts +0 -3
- package/core/utils/metrics.d.ts +0 -1
- package/core/utils/object.d.ts +0 -4
- package/core/utils/parsing.d.ts +0 -4
- package/core/utils/rect.d.ts +0 -2
- package/core/utils/size.d.ts +0 -2
- package/core/utils/string.d.ts +0 -6
- package/core/utils/style.d.ts +0 -8
- package/core/utils/svg.d.ts +0 -2
- package/core/utils/svg_math.d.ts +0 -6
- package/core/utils/svg_paths.d.ts +0 -8
- package/core/utils/toolbox.d.ts +2 -35
- package/core/utils/useragent.d.ts +0 -8
- package/core/utils/xml.d.ts +9 -8
- package/core/utils.d.ts +0 -12
- package/core/variable_map.d.ts +1 -3
- package/core/variable_model.d.ts +0 -1
- package/core/variables.d.ts +13 -17
- package/core/variables_dynamic.d.ts +0 -4
- package/core/warning.d.ts +0 -2
- package/core/widgetdiv.d.ts +0 -10
- package/core/workspace.d.ts +3 -3
- package/core/workspace_audio.d.ts +0 -2
- package/core/workspace_comment.d.ts +1 -3
- package/core/workspace_comment_svg.d.ts +1 -3
- package/core/workspace_dragger.d.ts +0 -2
- package/core/workspace_svg.d.ts +4 -7
- package/core/xml.d.ts +1 -13
- package/core/zoom_controls.d.ts +4 -15
- package/dart_compressed.js +199 -199
- package/dart_compressed.js.map +1 -1
- package/javascript_compressed.js +168 -168
- package/javascript_compressed.js.map +1 -1
- package/lua_compressed.js +211 -211
- package/lua_compressed.js.map +1 -1
- package/msg/bn.js +2 -2
- package/msg/bs.js +7 -7
- package/msg/de.js +1 -1
- package/msg/fi.js +1 -1
- package/msg/fr.js +3 -3
- package/msg/ia.js +5 -5
- package/msg/kn.js +5 -5
- package/msg/ko.js +1 -1
- package/msg/lb.js +22 -22
- package/msg/sd.js +9 -9
- package/msg/skr-arab.js +2 -2
- package/msg/sl.js +18 -18
- package/msg/sw.js +1 -1
- package/msg/zh-hans.js +6 -6
- package/msg/zh-hant.js +2 -2
- package/package.json +9 -9
- package/php_compressed.js +185 -185
- package/php_compressed.js.map +1 -1
- package/python_compressed.js +138 -138
- package/python_compressed.js.map +1 -1
- package/core/events/events_procedure_base.d.ts +0 -26
- package/core/events/events_procedure_change_return.d.ts +0 -40
- package/core/events/events_procedure_create.d.ts +0 -34
- package/core/events/events_procedure_delete.d.ts +0 -32
- package/core/events/events_procedure_enable.d.ts +0 -34
- package/core/events/events_procedure_parameter_base.d.ts +0 -26
- package/core/events/events_procedure_parameter_create.d.ts +0 -42
- package/core/events/events_procedure_parameter_delete.d.ts +0 -41
- package/core/events/events_procedure_parameter_rename.d.ts +0 -36
- package/core/events/events_procedure_rename.d.ts +0 -35
- package/core/procedures/observable_parameter_model.d.ts +0 -62
- package/core/procedures/observable_procedure_model.d.ts +0 -75
- package/core/procedures/update_procedures.d.ts +0 -13
- package/core/utils/sentinel.d.ts +0 -13
package/core/field_image.d.ts
CHANGED
|
@@ -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
|
/**
|
|
@@ -38,7 +35,6 @@ export declare class FieldImage extends Field<string> {
|
|
|
38
35
|
private flipRtl_;
|
|
39
36
|
/** Alt text of this image. */
|
|
40
37
|
private altText_;
|
|
41
|
-
value_: any;
|
|
42
38
|
/**
|
|
43
39
|
* @param src The URL of the image.
|
|
44
40
|
* Also accepts Field.SKIP_SETUP if you wish to skip setup (only used by
|
|
@@ -46,16 +42,16 @@ export declare class FieldImage extends Field<string> {
|
|
|
46
42
|
* after their own constructors have run).
|
|
47
43
|
* @param width Width of the image.
|
|
48
44
|
* @param height Height of the image.
|
|
49
|
-
* @param
|
|
50
|
-
* @param
|
|
51
|
-
* clicked. If
|
|
52
|
-
* @param
|
|
53
|
-
* @param
|
|
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.
|
|
54
50
|
* See the [field creation documentation]{@link
|
|
55
51
|
* https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/image#creation}
|
|
56
52
|
* for a list of properties this parameter supports.
|
|
57
53
|
*/
|
|
58
|
-
constructor(src: string |
|
|
54
|
+
constructor(src: string | typeof Field.SKIP_SETUP, width: string | number, height: string | number, alt?: string, onClick?: (p1: FieldImage) => void, flipRtl?: boolean, config?: FieldImageConfig);
|
|
59
55
|
/**
|
|
60
56
|
* Configure the field based on the given map of options.
|
|
61
57
|
*
|
|
@@ -72,17 +68,17 @@ export declare class FieldImage extends Field<string> {
|
|
|
72
68
|
/**
|
|
73
69
|
* Ensure that the input value (the source URL) is a string.
|
|
74
70
|
*
|
|
75
|
-
* @param
|
|
71
|
+
* @param newValue The input value.
|
|
76
72
|
* @returns A string, or null if invalid.
|
|
77
73
|
*/
|
|
78
|
-
protected doClassValidation_(
|
|
74
|
+
protected doClassValidation_(newValue?: any): string | null;
|
|
79
75
|
/**
|
|
80
76
|
* Update the value of this image field, and update the displayed image.
|
|
81
77
|
*
|
|
82
78
|
* @param newValue The value to be saved. The default validator guarantees
|
|
83
79
|
* that this is a string.
|
|
84
80
|
*/
|
|
85
|
-
protected doValueUpdate_(newValue:
|
|
81
|
+
protected doValueUpdate_(newValue: string): void;
|
|
86
82
|
/**
|
|
87
83
|
* Get whether to flip this image in RTL
|
|
88
84
|
*
|
|
@@ -106,7 +102,7 @@ export declare class FieldImage extends Field<string> {
|
|
|
106
102
|
* @param func The function that is called when the image is clicked, or null
|
|
107
103
|
* to remove.
|
|
108
104
|
*/
|
|
109
|
-
setOnClickHandler(func: ((p1: FieldImage) =>
|
|
105
|
+
setOnClickHandler(func: ((p1: FieldImage) => void) | null): void;
|
|
110
106
|
/**
|
|
111
107
|
* Use the `getText_` developer hook to override the field's text
|
|
112
108
|
* representation.
|
package/core/field_input.d.ts
CHANGED
|
@@ -5,16 +5,20 @@
|
|
|
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<T>;
|
|
12
9
|
/**
|
|
13
|
-
*
|
|
10
|
+
* Supported types for FieldInput subclasses.
|
|
14
11
|
*
|
|
15
|
-
* @
|
|
12
|
+
* @internal
|
|
16
13
|
*/
|
|
17
|
-
|
|
14
|
+
type InputTypes = string | number;
|
|
15
|
+
/**
|
|
16
|
+
* Abstract class for an editable input field.
|
|
17
|
+
*
|
|
18
|
+
* @typeParam T - The value stored on the field.
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export declare abstract class FieldInput<T extends InputTypes> extends Field<string | T> {
|
|
18
22
|
/**
|
|
19
23
|
* Pixel size of input border radius.
|
|
20
24
|
* Should match blocklyText's border-radius in CSS.
|
|
@@ -48,34 +52,24 @@ export declare abstract class FieldInput<T extends InputTypes> extends Field<T>
|
|
|
48
52
|
SERIALIZABLE: boolean;
|
|
49
53
|
/** Mouse cursor style when over the hotspot that initiates the editor. */
|
|
50
54
|
CURSOR: string;
|
|
51
|
-
clickTarget_: any;
|
|
52
|
-
value_: any;
|
|
53
|
-
isDirty_: any;
|
|
54
55
|
/**
|
|
55
|
-
* @param
|
|
56
|
+
* @param value The initial value of the field. Should cast to a string.
|
|
56
57
|
* Defaults to an empty string if null or undefined. Also accepts
|
|
57
58
|
* Field.SKIP_SETUP if you wish to skip setup (only used by subclasses
|
|
58
59
|
* that want to handle configuration and setting the field value after
|
|
59
60
|
* their own constructors have run).
|
|
60
|
-
* @param
|
|
61
|
+
* @param validator A function that is called to validate changes to the
|
|
61
62
|
* field's value. Takes in a string & returns a validated string, or null
|
|
62
63
|
* to abort the change.
|
|
63
|
-
* @param
|
|
64
|
+
* @param config A map of options used to configure the field.
|
|
64
65
|
* See the [field creation documentation]{@link
|
|
65
66
|
* https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/text-input#creation}
|
|
66
67
|
* for a list of properties this parameter supports.
|
|
67
68
|
*/
|
|
68
|
-
constructor(
|
|
69
|
+
constructor(value?: string | typeof Field.SKIP_SETUP, validator?: FieldInputValidator<T> | null, config?: FieldInputConfig);
|
|
69
70
|
protected configure_(config: FieldInputConfig): void;
|
|
70
71
|
/** @internal */
|
|
71
72
|
initView(): void;
|
|
72
|
-
/**
|
|
73
|
-
* Ensure that the input value casts to a valid string.
|
|
74
|
-
*
|
|
75
|
-
* @param opt_newValue The input value.
|
|
76
|
-
* @returns A valid string, or null if invalid.
|
|
77
|
-
*/
|
|
78
|
-
protected doClassValidation_(opt_newValue?: any): any;
|
|
79
73
|
/**
|
|
80
74
|
* Called by setValue if the text input is not valid. If the field is
|
|
81
75
|
* currently being edited it reverts value of the field to the previous
|
|
@@ -94,7 +88,7 @@ export declare abstract class FieldInput<T extends InputTypes> extends Field<T>
|
|
|
94
88
|
* @param newValue The value to be saved. The default validator guarantees
|
|
95
89
|
* that this is a string.
|
|
96
90
|
*/
|
|
97
|
-
protected doValueUpdate_(newValue:
|
|
91
|
+
protected doValueUpdate_(newValue: string | T): void;
|
|
98
92
|
/**
|
|
99
93
|
* Updates text field to match the colour/style of the block.
|
|
100
94
|
*
|
|
@@ -118,12 +112,12 @@ export declare abstract class FieldInput<T extends InputTypes> extends Field<T>
|
|
|
118
112
|
* Shows a prompt editor for mobile browsers if the modalInputs option is
|
|
119
113
|
* enabled.
|
|
120
114
|
*
|
|
121
|
-
* @param
|
|
115
|
+
* @param _e Optional mouse event that triggered the field to open, or
|
|
122
116
|
* undefined if triggered programmatically.
|
|
123
|
-
* @param
|
|
117
|
+
* @param quietInput True if editor should be created without focus.
|
|
124
118
|
* Defaults to false.
|
|
125
119
|
*/
|
|
126
|
-
protected showEditor_(
|
|
120
|
+
protected showEditor_(_e?: Event, quietInput?: boolean): void;
|
|
127
121
|
/**
|
|
128
122
|
* Create and show a text input editor that is a prompt (usually a popup).
|
|
129
123
|
* Mobile browsers may have issues with in-line textareas (focus and
|
|
@@ -166,7 +160,7 @@ export declare abstract class FieldInput<T extends InputTypes> extends Field<T>
|
|
|
166
160
|
*
|
|
167
161
|
* @param e Keyboard event.
|
|
168
162
|
*/
|
|
169
|
-
protected onHtmlInputKeyDown_(e:
|
|
163
|
+
protected onHtmlInputKeyDown_(e: KeyboardEvent): void;
|
|
170
164
|
/**
|
|
171
165
|
* Handle a change to the editor.
|
|
172
166
|
*
|
|
@@ -222,8 +216,28 @@ export declare abstract class FieldInput<T extends InputTypes> extends Field<T>
|
|
|
222
216
|
}
|
|
223
217
|
/**
|
|
224
218
|
* Config options for the input field.
|
|
219
|
+
*
|
|
220
|
+
* @internal
|
|
225
221
|
*/
|
|
226
222
|
export interface FieldInputConfig extends FieldConfig {
|
|
227
223
|
spellcheck?: boolean;
|
|
228
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 {};
|
|
229
243
|
//# sourceMappingURL=field_input.d.ts.map
|
package/core/field_label.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
28
|
-
* @param
|
|
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(
|
|
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
|
|
41
|
+
* @param newValue The input value.
|
|
45
42
|
* @returns A valid string, or null if invalid.
|
|
46
43
|
*/
|
|
47
|
-
protected doClassValidation_(
|
|
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
|
|
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
|
|
28
|
-
* @param
|
|
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(
|
|
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.
|
|
@@ -3,20 +3,17 @@
|
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
import { Field } from './field.js';
|
|
6
7
|
import { FieldTextInput, FieldTextInputConfig, FieldTextInputValidator } from './field_textinput.js';
|
|
7
|
-
import type { Sentinel } from './utils/sentinel.js';
|
|
8
|
-
export type FieldMultilineInputValidator = FieldTextInputValidator;
|
|
9
8
|
/**
|
|
10
9
|
* Class for an editable text area field.
|
|
11
|
-
*
|
|
12
|
-
* @alias Blockly.FieldMultilineInput
|
|
13
10
|
*/
|
|
14
11
|
export declare class FieldMultilineInput extends FieldTextInput {
|
|
15
12
|
/**
|
|
16
13
|
* The SVG group element that will contain a text element for each text row
|
|
17
14
|
* when initialized.
|
|
18
15
|
*/
|
|
19
|
-
|
|
16
|
+
textGroup: SVGGElement | null;
|
|
20
17
|
/**
|
|
21
18
|
* Defines the maximum number of lines of field.
|
|
22
19
|
* If exceeded, scrolling functionality is enabled.
|
|
@@ -25,21 +22,26 @@ export declare class FieldMultilineInput extends FieldTextInput {
|
|
|
25
22
|
/** Whether Y overflow is currently occurring. */
|
|
26
23
|
protected isOverflowedY_: boolean;
|
|
27
24
|
/**
|
|
28
|
-
* @param
|
|
25
|
+
* @param value The initial content of the field. Should cast to a string.
|
|
29
26
|
* Defaults to an empty string if null or undefined. Also accepts
|
|
30
27
|
* Field.SKIP_SETUP if you wish to skip setup (only used by subclasses
|
|
31
28
|
* that want to handle configuration and setting the field value after
|
|
32
29
|
* their own constructors have run).
|
|
33
|
-
* @param
|
|
30
|
+
* @param validator An optional function that is called to validate any
|
|
34
31
|
* constraints on what the user entered. Takes the new text as an
|
|
35
32
|
* argument and returns either the accepted text, a replacement text, or
|
|
36
33
|
* null to abort the change.
|
|
37
|
-
* @param
|
|
34
|
+
* @param config A map of options used to configure the field.
|
|
38
35
|
* See the [field creation documentation]{@link
|
|
39
36
|
* https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/multiline-text-input#creation}
|
|
40
37
|
* for a list of properties this parameter supports.
|
|
41
38
|
*/
|
|
42
|
-
constructor(
|
|
39
|
+
constructor(value?: string | typeof Field.SKIP_SETUP, validator?: FieldMultilineInputValidator, config?: FieldMultilineInputConfig);
|
|
40
|
+
/**
|
|
41
|
+
* Configure the field based on the given map of options.
|
|
42
|
+
*
|
|
43
|
+
* @param config A map of options to configure the field based on.
|
|
44
|
+
*/
|
|
43
45
|
protected configure_(config: FieldMultilineInputConfig): void;
|
|
44
46
|
/**
|
|
45
47
|
* Serializes this field's value to XML. Should only be called by Blockly.Xml.
|
|
@@ -60,6 +62,8 @@ export declare class FieldMultilineInput extends FieldTextInput {
|
|
|
60
62
|
fromXml(fieldElement: Element): void;
|
|
61
63
|
/**
|
|
62
64
|
* Saves this field's value.
|
|
65
|
+
* This function only exists for subclasses of FieldMultilineInput which
|
|
66
|
+
* predate the load/saveState API and only define to/fromXml.
|
|
63
67
|
*
|
|
64
68
|
* @returns The state of this field.
|
|
65
69
|
* @internal
|
|
@@ -67,6 +71,8 @@ export declare class FieldMultilineInput extends FieldTextInput {
|
|
|
67
71
|
saveState(): any;
|
|
68
72
|
/**
|
|
69
73
|
* Sets the field's value based on the given state.
|
|
74
|
+
* This function only exists for subclasses of FieldMultilineInput which
|
|
75
|
+
* predate the load/saveState API and only define to/fromXml.
|
|
70
76
|
*
|
|
71
77
|
* @param state The state of the variable to assign to this variable field.
|
|
72
78
|
* @internal
|
|
@@ -94,7 +100,7 @@ export declare class FieldMultilineInput extends FieldTextInput {
|
|
|
94
100
|
* @param newValue The value to be saved. The default validator guarantees
|
|
95
101
|
* that this is a string.
|
|
96
102
|
*/
|
|
97
|
-
protected doValueUpdate_(newValue:
|
|
103
|
+
protected doValueUpdate_(newValue: string): void;
|
|
98
104
|
/** Updates the text of the textElement. */
|
|
99
105
|
protected render_(): void;
|
|
100
106
|
/** Updates the size of the field based on the text. */
|
|
@@ -104,12 +110,12 @@ export declare class FieldMultilineInput extends FieldTextInput {
|
|
|
104
110
|
* Overrides the default behaviour to force rerender in order to
|
|
105
111
|
* correct block size, based on editor text.
|
|
106
112
|
*
|
|
107
|
-
* @param
|
|
113
|
+
* @param e Optional mouse event that triggered the field to open, or
|
|
108
114
|
* undefined if triggered programmatically.
|
|
109
|
-
* @param
|
|
115
|
+
* @param quietInput True if editor should be created without focus.
|
|
110
116
|
* Defaults to false.
|
|
111
117
|
*/
|
|
112
|
-
showEditor_(
|
|
118
|
+
showEditor_(e?: Event, quietInput?: boolean): void;
|
|
113
119
|
/**
|
|
114
120
|
* Create the text input editor widget.
|
|
115
121
|
*
|
|
@@ -135,7 +141,7 @@ export declare class FieldMultilineInput extends FieldTextInput {
|
|
|
135
141
|
*
|
|
136
142
|
* @param e Keyboard event.
|
|
137
143
|
*/
|
|
138
|
-
protected onHtmlInputKeyDown_(e:
|
|
144
|
+
protected onHtmlInputKeyDown_(e: KeyboardEvent): void;
|
|
139
145
|
/**
|
|
140
146
|
* Construct a FieldMultilineInput from a JSON arg object,
|
|
141
147
|
* dereferencing any string table references.
|
|
@@ -159,4 +165,20 @@ export interface FieldMultilineInputConfig extends FieldTextInputConfig {
|
|
|
159
165
|
export interface FieldMultilineInputFromJsonConfig extends FieldMultilineInputConfig {
|
|
160
166
|
text?: string;
|
|
161
167
|
}
|
|
168
|
+
/**
|
|
169
|
+
* A function that is called to validate changes to the field's value before
|
|
170
|
+
* they are set.
|
|
171
|
+
*
|
|
172
|
+
* @see {@link https://developers.google.com/blockly/guides/create-custom-blocks/fields/validators#return_values}
|
|
173
|
+
* @param newValue The value to be validated.
|
|
174
|
+
* @returns One of three instructions for setting the new value: `T`, `null`,
|
|
175
|
+
* or `undefined`.
|
|
176
|
+
*
|
|
177
|
+
* - `T` to set this function's returned value instead of `newValue`.
|
|
178
|
+
*
|
|
179
|
+
* - `null` to invoke `doValueInvalid_` and not set a value.
|
|
180
|
+
*
|
|
181
|
+
* - `undefined` to set `newValue` as is.
|
|
182
|
+
*/
|
|
183
|
+
export type FieldMultilineInputValidator = FieldTextInputValidator;
|
|
162
184
|
//# sourceMappingURL=field_multilineinput.d.ts.map
|
package/core/field_number.d.ts
CHANGED
|
@@ -3,13 +3,10 @@
|
|
|
3
3
|
* Copyright 2016 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
import { Field } from './field.js';
|
|
6
7
|
import { FieldInput, FieldInputConfig, FieldInputValidator } from './field_input.js';
|
|
7
|
-
import type { Sentinel } from './utils/sentinel.js';
|
|
8
|
-
export type FieldNumberValidator = FieldInputValidator<number>;
|
|
9
8
|
/**
|
|
10
9
|
* Class for an editable number field.
|
|
11
|
-
*
|
|
12
|
-
* @alias Blockly.FieldNumber
|
|
13
10
|
*/
|
|
14
11
|
export declare class FieldNumber extends FieldInput<number> {
|
|
15
12
|
/** The minimum value this number field can contain. */
|
|
@@ -23,33 +20,28 @@ export declare class FieldNumber extends FieldInput<number> {
|
|
|
23
20
|
* decimal digits.
|
|
24
21
|
*/
|
|
25
22
|
private decimalPlaces_;
|
|
26
|
-
/**
|
|
27
|
-
* Serializable fields are saved by the serializer, non-serializable fields
|
|
28
|
-
* are not. Editable fields should also be serializable.
|
|
29
|
-
*/
|
|
30
|
-
SERIALIZABLE: boolean;
|
|
31
23
|
/** Don't spellcheck numbers. Our validator does a better job. */
|
|
32
24
|
protected spellcheck_: boolean;
|
|
33
25
|
/**
|
|
34
|
-
* @param
|
|
26
|
+
* @param value The initial value of the field. Should cast to a number.
|
|
35
27
|
* Defaults to 0. Also accepts Field.SKIP_SETUP if you wish to skip setup
|
|
36
28
|
* (only used by subclasses that want to handle configuration and setting
|
|
37
29
|
* the field value after their own constructors have run).
|
|
38
|
-
* @param
|
|
30
|
+
* @param min Minimum value. Will only be used if config is not
|
|
39
31
|
* provided.
|
|
40
|
-
* @param
|
|
32
|
+
* @param max Maximum value. Will only be used if config is not
|
|
41
33
|
* provided.
|
|
42
|
-
* @param
|
|
34
|
+
* @param precision Precision for value. Will only be used if config
|
|
43
35
|
* is not provided.
|
|
44
|
-
* @param
|
|
36
|
+
* @param validator A function that is called to validate changes to the
|
|
45
37
|
* field's value. Takes in a number & returns a validated number, or null
|
|
46
38
|
* to abort the change.
|
|
47
|
-
* @param
|
|
39
|
+
* @param config A map of options used to configure the field.
|
|
48
40
|
* See the [field creation documentation]{@link
|
|
49
41
|
* https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/number#creation}
|
|
50
42
|
* for a list of properties this parameter supports.
|
|
51
43
|
*/
|
|
52
|
-
constructor(
|
|
44
|
+
constructor(value?: string | number | typeof Field.SKIP_SETUP, min?: string | number | null, max?: string | number | null, precision?: string | number | null, validator?: FieldNumberValidator | null, config?: FieldNumberConfig);
|
|
53
45
|
/**
|
|
54
46
|
* Configure the field based on the given map of options.
|
|
55
47
|
*
|
|
@@ -138,16 +130,16 @@ export declare class FieldNumber extends FieldInput<number> {
|
|
|
138
130
|
* Ensure that the input value is a valid number (must fulfill the
|
|
139
131
|
* constraints placed on the field).
|
|
140
132
|
*
|
|
141
|
-
* @param
|
|
133
|
+
* @param newValue The input value.
|
|
142
134
|
* @returns A valid number, or null if invalid.
|
|
143
135
|
*/
|
|
144
|
-
protected doClassValidation_(
|
|
136
|
+
protected doClassValidation_(newValue?: any): number | null;
|
|
145
137
|
/**
|
|
146
138
|
* Create the number input editor widget.
|
|
147
139
|
*
|
|
148
140
|
* @returns The newly created number input editor.
|
|
149
141
|
*/
|
|
150
|
-
protected widgetCreate_():
|
|
142
|
+
protected widgetCreate_(): HTMLInputElement;
|
|
151
143
|
/**
|
|
152
144
|
* Construct a FieldNumber from a JSON arg object.
|
|
153
145
|
*
|
|
@@ -172,4 +164,20 @@ export interface FieldNumberConfig extends FieldInputConfig {
|
|
|
172
164
|
export interface FieldNumberFromJsonConfig extends FieldNumberConfig {
|
|
173
165
|
value?: number;
|
|
174
166
|
}
|
|
167
|
+
/**
|
|
168
|
+
* A function that is called to validate changes to the field's value before
|
|
169
|
+
* they are set.
|
|
170
|
+
*
|
|
171
|
+
* @see {@link https://developers.google.com/blockly/guides/create-custom-blocks/fields/validators#return_values}
|
|
172
|
+
* @param newValue The value to be validated.
|
|
173
|
+
* @returns One of three instructions for setting the new value: `T`, `null`,
|
|
174
|
+
* or `undefined`.
|
|
175
|
+
*
|
|
176
|
+
* - `T` to set this function's returned value instead of `newValue`.
|
|
177
|
+
*
|
|
178
|
+
* - `null` to invoke `doValueInvalid_` and not set a value.
|
|
179
|
+
*
|
|
180
|
+
* - `undefined` to set `newValue` as is.
|
|
181
|
+
*/
|
|
182
|
+
export type FieldNumberValidator = FieldInputValidator<number>;
|
|
175
183
|
//# sourceMappingURL=field_number.d.ts.map
|
package/core/field_registry.d.ts
CHANGED
|
@@ -18,14 +18,12 @@ interface RegistryOptions {
|
|
|
18
18
|
* construct an instance of the field.
|
|
19
19
|
* @throws {Error} if the type name is empty, the field is already registered,
|
|
20
20
|
* or the fieldClass is not an object containing a fromJson function.
|
|
21
|
-
* @alias Blockly.fieldRegistry.register
|
|
22
21
|
*/
|
|
23
22
|
export declare function register(type: string, fieldClass: FieldProto): void;
|
|
24
23
|
/**
|
|
25
24
|
* Unregisters the field registered with the given type.
|
|
26
25
|
*
|
|
27
26
|
* @param type The field type name as used in the JSON definition.
|
|
28
|
-
* @alias Blockly.fieldRegistry.unregister
|
|
29
27
|
*/
|
|
30
28
|
export declare function unregister(type: string): void;
|
|
31
29
|
/**
|
|
@@ -37,7 +35,6 @@ export declare function unregister(type: string): void;
|
|
|
37
35
|
* type.
|
|
38
36
|
* @returns The new field instance or null if a field wasn't found with the
|
|
39
37
|
* given type name
|
|
40
|
-
* @alias Blockly.fieldRegistry.fromJson
|
|
41
38
|
* @internal
|
|
42
39
|
*/
|
|
43
40
|
export declare function fromJson<T>(options: RegistryOptions): Field<T> | null;
|
|
@@ -4,25 +4,34 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import './events/events_block_change.js';
|
|
7
|
+
import { Field } from './field.js';
|
|
7
8
|
import { FieldInput, FieldInputConfig, FieldInputValidator } from './field_input.js';
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Class for an editable text field.
|
|
11
|
+
*/
|
|
10
12
|
export declare class FieldTextInput extends FieldInput<string> {
|
|
11
13
|
/**
|
|
12
|
-
* @param
|
|
14
|
+
* @param value The initial value of the field. Should cast to a string.
|
|
13
15
|
* Defaults to an empty string if null or undefined. Also accepts
|
|
14
16
|
* Field.SKIP_SETUP if you wish to skip setup (only used by subclasses
|
|
15
17
|
* that want to handle configuration and setting the field value after
|
|
16
18
|
* their own constructors have run).
|
|
17
|
-
* @param
|
|
19
|
+
* @param validator A function that is called to validate changes to the
|
|
18
20
|
* field's value. Takes in a string & returns a validated string, or null
|
|
19
21
|
* to abort the change.
|
|
20
|
-
* @param
|
|
22
|
+
* @param config A map of options used to configure the field.
|
|
21
23
|
* See the [field creation documentation]{@link
|
|
22
24
|
* https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/text-input#creation}
|
|
23
25
|
* for a list of properties this parameter supports.
|
|
24
26
|
*/
|
|
25
|
-
constructor(
|
|
27
|
+
constructor(value?: string | typeof Field.SKIP_SETUP, validator?: FieldTextInputValidator | null, config?: FieldTextInputConfig);
|
|
28
|
+
/**
|
|
29
|
+
* Ensure that the input value casts to a valid string.
|
|
30
|
+
*
|
|
31
|
+
* @param newValue The input value.
|
|
32
|
+
* @returns A valid string, or null if invalid.
|
|
33
|
+
*/
|
|
34
|
+
protected doClassValidation_(newValue?: any): string | null;
|
|
26
35
|
/**
|
|
27
36
|
* Construct a FieldTextInput from a JSON arg object,
|
|
28
37
|
* dereferencing any string table references.
|
|
@@ -34,11 +43,30 @@ export declare class FieldTextInput extends FieldInput<string> {
|
|
|
34
43
|
*/
|
|
35
44
|
static fromJson(options: FieldTextInputFromJsonConfig): FieldTextInput;
|
|
36
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Config options for the text input field.
|
|
48
|
+
*/
|
|
49
|
+
export type FieldTextInputConfig = FieldInputConfig;
|
|
37
50
|
/**
|
|
38
51
|
* fromJson config options for the text input field.
|
|
39
52
|
*/
|
|
40
|
-
export interface FieldTextInputFromJsonConfig extends
|
|
53
|
+
export interface FieldTextInputFromJsonConfig extends FieldTextInputConfig {
|
|
41
54
|
text?: string;
|
|
42
55
|
}
|
|
43
|
-
|
|
56
|
+
/**
|
|
57
|
+
* A function that is called to validate changes to the field's value before
|
|
58
|
+
* they are set.
|
|
59
|
+
*
|
|
60
|
+
* @see {@link https://developers.google.com/blockly/guides/create-custom-blocks/fields/validators#return_values}
|
|
61
|
+
* @param newValue The value to be validated.
|
|
62
|
+
* @returns One of three instructions for setting the new value: `T`, `null`,
|
|
63
|
+
* or `undefined`.
|
|
64
|
+
*
|
|
65
|
+
* - `T` to set this function's returned value instead of `newValue`.
|
|
66
|
+
*
|
|
67
|
+
* - `null` to invoke `doValueInvalid_` and not set a value.
|
|
68
|
+
*
|
|
69
|
+
* - `undefined` to set `newValue` as is.
|
|
70
|
+
*/
|
|
71
|
+
export type FieldTextInputValidator = FieldInputValidator<string>;
|
|
44
72
|
//# sourceMappingURL=field_textinput.d.ts.map
|