blockly 9.3.3 → 10.0.0-beta.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/README.md +9 -7
- package/blockly.min.js +1314 -1415
- package/blockly_compressed.js +1067 -1110
- package/blockly_compressed.js.map +1 -1
- package/blocks_compressed.js +120 -136
- package/blocks_compressed.js.map +1 -1
- package/core/block.d.ts +59 -32
- package/core/block_dragger.d.ts +2 -2
- package/core/block_svg.d.ts +38 -67
- package/core/blockly.d.ts +18 -112
- package/core/browser_events.d.ts +1 -2
- package/core/bubble_dragger.d.ts +1 -2
- package/core/{bubble.d.ts → bubble_old.d.ts} +3 -7
- package/core/bubbles/bubble.d.ts +174 -0
- package/core/bubbles/mini_workspace_bubble.d.ts +80 -0
- package/core/bubbles/text_bubble.d.ts +35 -0
- package/core/bubbles/textinput_bubble.d.ts +89 -0
- package/core/bump_objects.d.ts +6 -4
- package/core/connection.d.ts +19 -9
- package/core/connection_db.d.ts +4 -4
- package/core/contextmenu.d.ts +1 -2
- package/core/events/events.d.ts +1 -4
- package/core/events/events_abstract.d.ts +0 -6
- package/core/events/events_block_base.d.ts +0 -6
- package/core/events/events_block_change.d.ts +0 -6
- package/core/events/events_block_create.d.ts +0 -6
- package/core/events/events_block_delete.d.ts +0 -6
- package/core/events/events_block_drag.d.ts +0 -6
- package/core/events/events_block_move.d.ts +21 -7
- package/core/events/events_bubble_open.d.ts +0 -6
- package/core/events/events_click.d.ts +0 -6
- package/core/events/events_comment_base.d.ts +0 -6
- package/core/events/events_comment_change.d.ts +0 -6
- package/core/events/events_comment_create.d.ts +0 -6
- package/core/events/events_comment_move.d.ts +0 -6
- package/core/events/events_marker_move.d.ts +0 -6
- package/core/events/events_selected.d.ts +0 -6
- package/core/events/events_theme_change.d.ts +0 -6
- package/core/events/events_toolbox_item_select.d.ts +0 -6
- package/core/events/events_trashcan_open.d.ts +0 -6
- package/core/events/events_var_base.d.ts +0 -6
- package/core/events/events_var_create.d.ts +0 -6
- package/core/events/events_var_delete.d.ts +0 -6
- package/core/events/events_var_rename.d.ts +0 -6
- package/core/events/events_viewport.d.ts +0 -6
- package/core/events/utils.d.ts +1 -1
- package/core/events/workspace_events.d.ts +1 -16
- package/core/field.d.ts +31 -5
- package/core/field_checkbox.d.ts +1 -1
- package/core/field_colour.d.ts +0 -2
- package/core/field_dropdown.d.ts +11 -13
- package/core/field_image.d.ts +5 -5
- package/core/field_input.d.ts +9 -2
- package/core/field_label.d.ts +3 -1
- package/core/field_number.d.ts +4 -4
- package/core/field_variable.d.ts +5 -5
- package/core/flyout_base.d.ts +23 -25
- package/core/flyout_button.d.ts +9 -9
- package/core/flyout_horizontal.d.ts +1 -1
- package/core/flyout_vertical.d.ts +1 -1
- package/core/generator.d.ts +15 -2
- package/core/gesture.d.ts +58 -41
- package/core/icons/comment_icon.d.ts +108 -0
- package/core/icons/exceptions.d.ts +14 -0
- package/core/icons/icon.d.ts +38 -0
- package/core/icons/icon_types.d.ts +22 -0
- package/core/icons/mutator_icon.d.ts +90 -0
- package/core/icons/registry.d.ts +23 -0
- package/core/icons/warning_icon.d.ts +67 -0
- package/core/icons.d.ts +12 -0
- package/core/inputs/dummy_input.d.ts +20 -0
- package/core/{input.d.ts → inputs/input.d.ts} +20 -13
- package/core/{input_types.d.ts → inputs/input_types.d.ts} +2 -1
- package/core/inputs/statement_input.d.ts +22 -0
- package/core/inputs/value_input.d.ts +20 -0
- package/core/interfaces/i_block_dragger.d.ts +1 -1
- package/core/interfaces/i_bounded_element.d.ts +2 -1
- package/core/interfaces/i_bubble.d.ts +2 -14
- package/core/interfaces/i_has_bubble.d.ts +14 -0
- package/core/interfaces/i_icon.d.ts +75 -0
- package/core/interfaces/i_serializable.d.ts +24 -0
- package/core/keyboard_nav/ast_node.d.ts +15 -15
- package/core/keyboard_nav/basic_cursor.d.ts +2 -2
- package/core/keyboard_nav/marker.d.ts +2 -2
- package/core/main.d.ts +0 -10
- package/core/marker_manager.d.ts +0 -1
- package/core/names.d.ts +4 -4
- package/core/options.d.ts +3 -3
- package/core/procedures.d.ts +1 -4
- package/core/registry.d.ts +5 -0
- package/core/render_management.d.ts +9 -1
- package/core/rendered_connection.d.ts +7 -7
- package/core/renderers/common/block_rendering.d.ts +0 -10
- package/core/renderers/common/constants.d.ts +5 -7
- package/core/renderers/common/drawer.d.ts +7 -2
- package/core/renderers/common/info.d.ts +1 -4
- package/core/renderers/common/marker_svg.d.ts +4 -4
- package/core/renderers/common/renderer.d.ts +0 -9
- package/core/renderers/geras/highlighter.d.ts +1 -1
- package/core/renderers/geras/info.d.ts +1 -1
- package/core/renderers/geras/measurables/inline_input.d.ts +1 -1
- package/core/renderers/geras/measurables/statement_input.d.ts +1 -1
- package/core/renderers/geras/renderer.d.ts +1 -1
- package/core/renderers/measurables/external_value_input.d.ts +1 -1
- package/core/renderers/measurables/field.d.ts +1 -1
- package/core/renderers/measurables/icon.d.ts +5 -1
- package/core/renderers/measurables/inline_input.d.ts +1 -1
- package/core/renderers/measurables/input_connection.d.ts +1 -1
- package/core/renderers/measurables/statement_input.d.ts +1 -1
- package/core/renderers/zelos/constants.d.ts +2 -2
- package/core/renderers/zelos/info.d.ts +2 -2
- package/core/renderers/zelos/marker_svg.d.ts +3 -3
- package/core/renderers/zelos/measurables/inputs.d.ts +1 -1
- package/core/renderers/zelos/path_object.d.ts +3 -3
- package/core/scrollbar.d.ts +0 -2
- package/core/scrollbar_pair.d.ts +0 -2
- package/core/serialization/blocks.d.ts +3 -3
- package/core/serialization/exceptions.d.ts +11 -0
- package/core/shortcut_registry.d.ts +2 -2
- package/core/theme_manager.d.ts +0 -1
- package/core/touch.d.ts +0 -43
- package/core/trashcan.d.ts +19 -21
- package/core/utils/dom.d.ts +2 -2
- package/core/utils/object.d.ts +0 -25
- package/core/utils/rect.d.ts +2 -0
- package/core/utils/style.d.ts +0 -12
- package/core/utils/svg_math.d.ts +0 -8
- package/core/utils/xml.d.ts +15 -22
- package/core/utils.d.ts +0 -138
- package/core/widgetdiv.d.ts +5 -0
- package/core/workspace.d.ts +9 -3
- package/core/workspace_comment.d.ts +3 -3
- package/core/workspace_comment_svg.d.ts +31 -44
- package/core/workspace_dragger.d.ts +1 -4
- package/core/workspace_svg.d.ts +13 -50
- package/core/xml.d.ts +0 -12
- package/core-browser.js +0 -1
- package/core.js +0 -1
- package/dart_compressed.js +124 -159
- package/dart_compressed.js.map +1 -1
- package/javascript_compressed.js +127 -169
- package/javascript_compressed.js.map +1 -1
- package/lua_compressed.js +119 -142
- package/lua_compressed.js.map +1 -1
- package/msg/constants.d.ts +1 -3
- package/msg/msg.d.ts +1 -2
- package/msg/qqq.d.ts +1 -3
- package/msg/synonyms.d.ts +1 -3
- package/package.json +12 -13
- package/php_compressed.js +131 -161
- package/php_compressed.js.map +1 -1
- package/python_compressed.js +118 -149
- package/python_compressed.js.map +1 -1
- package/core/comment.d.ts +0 -115
- package/core/events/events_ui.d.ts +0 -40
- package/core/icon.d.ts +0 -89
- package/core/mutator.d.ts +0 -142
- package/core/renderers/common/debug.d.ts +0 -29
- package/core/renderers/common/debugger.d.ts +0 -117
- package/core/warning.d.ts +0 -53
|
@@ -29,12 +29,6 @@ export declare class BlockDelete extends BlockBase {
|
|
|
29
29
|
* @returns JSON representation.
|
|
30
30
|
*/
|
|
31
31
|
toJson(): BlockDeleteJson;
|
|
32
|
-
/**
|
|
33
|
-
* Decode the JSON event.
|
|
34
|
-
*
|
|
35
|
-
* @param json JSON representation.
|
|
36
|
-
*/
|
|
37
|
-
fromJson(json: BlockDeleteJson): void;
|
|
38
32
|
/**
|
|
39
33
|
* Deserializes the JSON event.
|
|
40
34
|
*
|
|
@@ -36,12 +36,6 @@ export declare class BlockDrag extends UiBase {
|
|
|
36
36
|
* @returns JSON representation.
|
|
37
37
|
*/
|
|
38
38
|
toJson(): BlockDragJson;
|
|
39
|
-
/**
|
|
40
|
-
* Decode the JSON event.
|
|
41
|
-
*
|
|
42
|
-
* @param json JSON representation.
|
|
43
|
-
*/
|
|
44
|
-
fromJson(json: BlockDragJson): void;
|
|
45
39
|
/**
|
|
46
40
|
* Deserializes the JSON event.
|
|
47
41
|
*
|
|
@@ -33,10 +33,23 @@ export declare class BlockMove extends BlockBase {
|
|
|
33
33
|
*/
|
|
34
34
|
newInputName?: string;
|
|
35
35
|
/**
|
|
36
|
-
* The new X and Y workspace coordinates of the block if it is a top
|
|
36
|
+
* The new X and Y workspace coordinates of the block if it is a top-level
|
|
37
37
|
* block. Undefined if it is not a top level block.
|
|
38
38
|
*/
|
|
39
39
|
newCoordinate?: Coordinate;
|
|
40
|
+
/**
|
|
41
|
+
* An explanation of what this move is for. Known values include:
|
|
42
|
+
* 'drag' -- A drag operation completed.
|
|
43
|
+
* 'bump' -- Block got bumped away from an invalid connection.
|
|
44
|
+
* 'snap' -- Block got shifted to line up with the grid.
|
|
45
|
+
* 'inbounds' -- Block got pushed back into a non-scrolling workspace.
|
|
46
|
+
* 'connect' -- Block got connected to another block.
|
|
47
|
+
* 'disconnect' -- Block got disconnected from another block.
|
|
48
|
+
* 'create' -- Block created via XML.
|
|
49
|
+
* 'cleanup' -- Workspace aligned top-level blocks.
|
|
50
|
+
* Event merging may create multiple reasons: ['drag', 'bump', 'snap'].
|
|
51
|
+
*/
|
|
52
|
+
reason?: string[];
|
|
40
53
|
/** @param opt_block The moved block. Undefined for a blank event. */
|
|
41
54
|
constructor(opt_block?: Block);
|
|
42
55
|
/**
|
|
@@ -45,12 +58,6 @@ export declare class BlockMove extends BlockBase {
|
|
|
45
58
|
* @returns JSON representation.
|
|
46
59
|
*/
|
|
47
60
|
toJson(): BlockMoveJson;
|
|
48
|
-
/**
|
|
49
|
-
* Decode the JSON event.
|
|
50
|
-
*
|
|
51
|
-
* @param json JSON representation.
|
|
52
|
-
*/
|
|
53
|
-
fromJson(json: BlockMoveJson): void;
|
|
54
61
|
/**
|
|
55
62
|
* Deserializes the JSON event.
|
|
56
63
|
*
|
|
@@ -63,6 +70,12 @@ export declare class BlockMove extends BlockBase {
|
|
|
63
70
|
static fromJson(json: BlockMoveJson, workspace: Workspace, event?: any): BlockMove;
|
|
64
71
|
/** Record the block's new location. Called after the move. */
|
|
65
72
|
recordNew(): void;
|
|
73
|
+
/**
|
|
74
|
+
* Set the reason for a move event.
|
|
75
|
+
*
|
|
76
|
+
* @param reason Why is this move happening? 'drag', 'bump', 'snap', ...
|
|
77
|
+
*/
|
|
78
|
+
setReason(reason: string[]): void;
|
|
66
79
|
/**
|
|
67
80
|
* Returns the parentId and input if the block is connected,
|
|
68
81
|
* or the XY location if disconnected.
|
|
@@ -90,6 +103,7 @@ export interface BlockMoveJson extends BlockBaseJson {
|
|
|
90
103
|
newParentId?: string;
|
|
91
104
|
newInputName?: string;
|
|
92
105
|
newCoordinate?: string;
|
|
106
|
+
reason?: string[];
|
|
93
107
|
recordUndo?: boolean;
|
|
94
108
|
}
|
|
95
109
|
//# sourceMappingURL=events_block_move.d.ts.map
|
|
@@ -32,12 +32,6 @@ export declare class BubbleOpen extends UiBase {
|
|
|
32
32
|
* @returns JSON representation.
|
|
33
33
|
*/
|
|
34
34
|
toJson(): BubbleOpenJson;
|
|
35
|
-
/**
|
|
36
|
-
* Decode the JSON event.
|
|
37
|
-
*
|
|
38
|
-
* @param json JSON representation.
|
|
39
|
-
*/
|
|
40
|
-
fromJson(json: BubbleOpenJson): void;
|
|
41
35
|
/**
|
|
42
36
|
* Deserializes the JSON event.
|
|
43
37
|
*
|
|
@@ -35,12 +35,6 @@ export declare class Click extends UiBase {
|
|
|
35
35
|
* @returns JSON representation.
|
|
36
36
|
*/
|
|
37
37
|
toJson(): ClickJson;
|
|
38
|
-
/**
|
|
39
|
-
* Decode the JSON event.
|
|
40
|
-
*
|
|
41
|
-
* @param json JSON representation.
|
|
42
|
-
*/
|
|
43
|
-
fromJson(json: ClickJson): void;
|
|
44
38
|
/**
|
|
45
39
|
* Deserializes the JSON event.
|
|
46
40
|
*
|
|
@@ -26,12 +26,6 @@ export declare class CommentBase extends AbstractEvent {
|
|
|
26
26
|
* @returns JSON representation.
|
|
27
27
|
*/
|
|
28
28
|
toJson(): CommentBaseJson;
|
|
29
|
-
/**
|
|
30
|
-
* Decode the JSON event.
|
|
31
|
-
*
|
|
32
|
-
* @param json JSON representation.
|
|
33
|
-
*/
|
|
34
|
-
fromJson(json: CommentBaseJson): void;
|
|
35
29
|
/**
|
|
36
30
|
* Deserializes the JSON event.
|
|
37
31
|
*
|
|
@@ -28,12 +28,6 @@ export declare class CommentChange extends CommentBase {
|
|
|
28
28
|
* @returns JSON representation.
|
|
29
29
|
*/
|
|
30
30
|
toJson(): CommentChangeJson;
|
|
31
|
-
/**
|
|
32
|
-
* Decode the JSON event.
|
|
33
|
-
*
|
|
34
|
-
* @param json JSON representation.
|
|
35
|
-
*/
|
|
36
|
-
fromJson(json: CommentChangeJson): void;
|
|
37
31
|
/**
|
|
38
32
|
* Deserializes the JSON event.
|
|
39
33
|
*
|
|
@@ -24,12 +24,6 @@ export declare class CommentCreate extends CommentBase {
|
|
|
24
24
|
* @returns JSON representation.
|
|
25
25
|
*/
|
|
26
26
|
toJson(): CommentCreateJson;
|
|
27
|
-
/**
|
|
28
|
-
* Decode the JSON event.
|
|
29
|
-
*
|
|
30
|
-
* @param json JSON representation.
|
|
31
|
-
*/
|
|
32
|
-
fromJson(json: CommentCreateJson): void;
|
|
33
27
|
/**
|
|
34
28
|
* Deserializes the JSON event.
|
|
35
29
|
*
|
|
@@ -41,12 +41,6 @@ export declare class CommentMove extends CommentBase {
|
|
|
41
41
|
* @returns JSON representation.
|
|
42
42
|
*/
|
|
43
43
|
toJson(): CommentMoveJson;
|
|
44
|
-
/**
|
|
45
|
-
* Decode the JSON event.
|
|
46
|
-
*
|
|
47
|
-
* @param json JSON representation.
|
|
48
|
-
*/
|
|
49
|
-
fromJson(json: CommentMoveJson): void;
|
|
50
44
|
/**
|
|
51
45
|
* Deserializes the JSON event.
|
|
52
46
|
*
|
|
@@ -43,12 +43,6 @@ export declare class MarkerMove extends UiBase {
|
|
|
43
43
|
* @returns JSON representation.
|
|
44
44
|
*/
|
|
45
45
|
toJson(): MarkerMoveJson;
|
|
46
|
-
/**
|
|
47
|
-
* Decode the JSON event.
|
|
48
|
-
*
|
|
49
|
-
* @param json JSON representation.
|
|
50
|
-
*/
|
|
51
|
-
fromJson(json: MarkerMoveJson): void;
|
|
52
46
|
/**
|
|
53
47
|
* Deserializes the JSON event.
|
|
54
48
|
*
|
|
@@ -34,12 +34,6 @@ export declare class Selected extends UiBase {
|
|
|
34
34
|
* @returns JSON representation.
|
|
35
35
|
*/
|
|
36
36
|
toJson(): SelectedJson;
|
|
37
|
-
/**
|
|
38
|
-
* Decode the JSON event.
|
|
39
|
-
*
|
|
40
|
-
* @param json JSON representation.
|
|
41
|
-
*/
|
|
42
|
-
fromJson(json: SelectedJson): void;
|
|
43
37
|
/**
|
|
44
38
|
* Deserializes the JSON event.
|
|
45
39
|
*
|
|
@@ -25,12 +25,6 @@ export declare class ThemeChange extends UiBase {
|
|
|
25
25
|
* @returns JSON representation.
|
|
26
26
|
*/
|
|
27
27
|
toJson(): ThemeChangeJson;
|
|
28
|
-
/**
|
|
29
|
-
* Decode the JSON event.
|
|
30
|
-
*
|
|
31
|
-
* @param json JSON representation.
|
|
32
|
-
*/
|
|
33
|
-
fromJson(json: ThemeChangeJson): void;
|
|
34
28
|
/**
|
|
35
29
|
* Deserializes the JSON event.
|
|
36
30
|
*
|
|
@@ -30,12 +30,6 @@ export declare class ToolboxItemSelect extends UiBase {
|
|
|
30
30
|
* @returns JSON representation.
|
|
31
31
|
*/
|
|
32
32
|
toJson(): ToolboxItemSelectJson;
|
|
33
|
-
/**
|
|
34
|
-
* Decode the JSON event.
|
|
35
|
-
*
|
|
36
|
-
* @param json JSON representation.
|
|
37
|
-
*/
|
|
38
|
-
fromJson(json: ToolboxItemSelectJson): void;
|
|
39
33
|
/**
|
|
40
34
|
* Deserializes the JSON event.
|
|
41
35
|
*
|
|
@@ -29,12 +29,6 @@ export declare class TrashcanOpen extends UiBase {
|
|
|
29
29
|
* @returns JSON representation.
|
|
30
30
|
*/
|
|
31
31
|
toJson(): TrashcanOpenJson;
|
|
32
|
-
/**
|
|
33
|
-
* Decode the JSON event.
|
|
34
|
-
*
|
|
35
|
-
* @param json JSON representation.
|
|
36
|
-
*/
|
|
37
|
-
fromJson(json: TrashcanOpenJson): void;
|
|
38
32
|
/**
|
|
39
33
|
* Deserializes the JSON event.
|
|
40
34
|
*
|
|
@@ -24,12 +24,6 @@ export declare class VarBase extends AbstractEvent {
|
|
|
24
24
|
* @returns JSON representation.
|
|
25
25
|
*/
|
|
26
26
|
toJson(): VarBaseJson;
|
|
27
|
-
/**
|
|
28
|
-
* Decode the JSON event.
|
|
29
|
-
*
|
|
30
|
-
* @param json JSON representation.
|
|
31
|
-
*/
|
|
32
|
-
fromJson(json: VarBaseJson): void;
|
|
33
27
|
/**
|
|
34
28
|
* Deserializes the JSON event.
|
|
35
29
|
*
|
|
@@ -25,12 +25,6 @@ export declare class VarCreate extends VarBase {
|
|
|
25
25
|
* @returns JSON representation.
|
|
26
26
|
*/
|
|
27
27
|
toJson(): VarCreateJson;
|
|
28
|
-
/**
|
|
29
|
-
* Decode the JSON event.
|
|
30
|
-
*
|
|
31
|
-
* @param json JSON representation.
|
|
32
|
-
*/
|
|
33
|
-
fromJson(json: VarCreateJson): void;
|
|
34
28
|
/**
|
|
35
29
|
* Deserializes the JSON event.
|
|
36
30
|
*
|
|
@@ -27,12 +27,6 @@ export declare class VarDelete extends VarBase {
|
|
|
27
27
|
* @returns JSON representation.
|
|
28
28
|
*/
|
|
29
29
|
toJson(): VarDeleteJson;
|
|
30
|
-
/**
|
|
31
|
-
* Decode the JSON event.
|
|
32
|
-
*
|
|
33
|
-
* @param json JSON representation.
|
|
34
|
-
*/
|
|
35
|
-
fromJson(json: VarDeleteJson): void;
|
|
36
30
|
/**
|
|
37
31
|
* Deserializes the JSON event.
|
|
38
32
|
*
|
|
@@ -28,12 +28,6 @@ export declare class VarRename extends VarBase {
|
|
|
28
28
|
* @returns JSON representation.
|
|
29
29
|
*/
|
|
30
30
|
toJson(): VarRenameJson;
|
|
31
|
-
/**
|
|
32
|
-
* Decode the JSON event.
|
|
33
|
-
*
|
|
34
|
-
* @param json JSON representation.
|
|
35
|
-
*/
|
|
36
|
-
fromJson(json: VarRenameJson): void;
|
|
37
31
|
/**
|
|
38
32
|
* Deserializes the JSON event.
|
|
39
33
|
*
|
|
@@ -46,12 +46,6 @@ export declare class ViewportChange extends UiBase {
|
|
|
46
46
|
* @returns JSON representation.
|
|
47
47
|
*/
|
|
48
48
|
toJson(): ViewportChangeJson;
|
|
49
|
-
/**
|
|
50
|
-
* Decode the JSON event.
|
|
51
|
-
*
|
|
52
|
-
* @param json JSON representation.
|
|
53
|
-
*/
|
|
54
|
-
fromJson(json: ViewportChangeJson): void;
|
|
55
49
|
/**
|
|
56
50
|
* Deserializes the JSON event.
|
|
57
51
|
*
|
package/core/events/utils.d.ts
CHANGED
|
@@ -222,7 +222,7 @@ export declare function fromJson(json: any, workspace: Workspace): Abstract;
|
|
|
222
222
|
* @param eventType The type of the event to get.
|
|
223
223
|
* @returns The event class with the given type.
|
|
224
224
|
*/
|
|
225
|
-
export declare function get(eventType: string):
|
|
225
|
+
export declare function get(eventType: string): new (...p1: any[]) => Abstract;
|
|
226
226
|
/**
|
|
227
227
|
* Enable/disable a block depending on whether it is properly connected.
|
|
228
228
|
* Use this on applications where all blocks should be connected to a top block.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import type { Workspace } from '../workspace.js';
|
|
7
|
-
import { Abstract as AbstractEvent
|
|
7
|
+
import { Abstract as AbstractEvent } from './events_abstract.js';
|
|
8
8
|
/**
|
|
9
9
|
* Notifies listeners when the workspace has finished deserializing from
|
|
10
10
|
* JSON/XML.
|
|
@@ -18,20 +18,5 @@ export declare class FinishedLoading extends AbstractEvent {
|
|
|
18
18
|
* for a blank event.
|
|
19
19
|
*/
|
|
20
20
|
constructor(opt_workspace?: Workspace);
|
|
21
|
-
/**
|
|
22
|
-
* Encode the event as JSON.
|
|
23
|
-
*
|
|
24
|
-
* @returns JSON representation.
|
|
25
|
-
*/
|
|
26
|
-
toJson(): FinishedLoadingJson;
|
|
27
|
-
/**
|
|
28
|
-
* Decode the JSON event.
|
|
29
|
-
*
|
|
30
|
-
* @param json JSON representation.
|
|
31
|
-
*/
|
|
32
|
-
fromJson(json: FinishedLoadingJson): void;
|
|
33
|
-
}
|
|
34
|
-
export interface FinishedLoadingJson extends AbstractEventJson {
|
|
35
|
-
workspaceId: string;
|
|
36
21
|
}
|
|
37
22
|
//# sourceMappingURL=workspace_events.d.ts.map
|
package/core/field.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import './events/events_block_change.js';
|
|
7
7
|
import type { Block } from './block.js';
|
|
8
|
-
import type { Input } from './input.js';
|
|
8
|
+
import type { Input } from './inputs/input.js';
|
|
9
9
|
import type { IASTNodeLocationSvg } from './interfaces/i_ast_node_location_svg.js';
|
|
10
10
|
import type { IASTNodeLocationWithBlock } from './interfaces/i_ast_node_location_with_block.js';
|
|
11
11
|
import type { IKeyboardAccessible } from './interfaces/i_keyboard_accessible.js';
|
|
@@ -16,6 +16,7 @@ import * as Tooltip from './tooltip.js';
|
|
|
16
16
|
import type { Coordinate } from './utils/coordinate.js';
|
|
17
17
|
import { Rect } from './utils/rect.js';
|
|
18
18
|
import { Size } from './utils/size.js';
|
|
19
|
+
import { ISerializable } from './interfaces/i_serializable.js';
|
|
19
20
|
/**
|
|
20
21
|
* A function that is called to validate changes to the field's value before
|
|
21
22
|
* they are set.
|
|
@@ -37,7 +38,7 @@ export type FieldValidator<T = any> = (newValue: T) => T | null | undefined;
|
|
|
37
38
|
*
|
|
38
39
|
* @typeParam T - The value stored on the field.
|
|
39
40
|
*/
|
|
40
|
-
export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IASTNodeLocationWithBlock, IKeyboardAccessible, IRegistrable {
|
|
41
|
+
export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IASTNodeLocationWithBlock, IKeyboardAccessible, IRegistrable, ISerializable {
|
|
41
42
|
/**
|
|
42
43
|
* To overwrite the default value which is set in **Field**, directly update
|
|
43
44
|
* the prototype.
|
|
@@ -380,10 +381,16 @@ export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IAS
|
|
|
380
381
|
*/
|
|
381
382
|
protected getTextContent(): Text;
|
|
382
383
|
/**
|
|
383
|
-
* Updates the field to match the colour/style of the block.
|
|
384
|
-
* called by BlockSvg.applyColour().
|
|
384
|
+
* Updates the field to match the colour/style of the block.
|
|
385
385
|
*
|
|
386
|
-
*
|
|
386
|
+
* Non-abstract sub-classes may wish to implement this if the colour of the
|
|
387
|
+
* field depends on the colour of the block. It will automatically be called
|
|
388
|
+
* at relevant times, such as when the parent block or renderer changes.
|
|
389
|
+
*
|
|
390
|
+
* See {@link
|
|
391
|
+
* https://developers.google.com/blockly/guides/create-custom-blocks/fields/customizing-fields/creating#matching_block_colours
|
|
392
|
+
* | the field documentation} for more information, or FieldDropdown for an
|
|
393
|
+
* example.
|
|
387
394
|
*/
|
|
388
395
|
applyColour(): void;
|
|
389
396
|
/**
|
|
@@ -411,6 +418,25 @@ export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IAS
|
|
|
411
418
|
* undefined if triggered programmatically.
|
|
412
419
|
*/
|
|
413
420
|
protected showEditor_(_e?: Event): void;
|
|
421
|
+
/**
|
|
422
|
+
* A developer hook to reposition the WidgetDiv during a window resize. You
|
|
423
|
+
* need to define this hook if your field has a WidgetDiv that needs to
|
|
424
|
+
* reposition itself when the window is resized. For example, text input
|
|
425
|
+
* fields define this hook so that the input WidgetDiv can reposition itself
|
|
426
|
+
* on a window resize event. This is especially important when modal inputs
|
|
427
|
+
* have been disabled, as Android devices will fire a window resize event when
|
|
428
|
+
* the soft keyboard opens.
|
|
429
|
+
*
|
|
430
|
+
* If you want the WidgetDiv to hide itself instead of repositioning, return
|
|
431
|
+
* false. This is the default behavior.
|
|
432
|
+
*
|
|
433
|
+
* DropdownDivs already handle their own positioning logic, so you do not need
|
|
434
|
+
* to override this function if your field only has a DropdownDiv.
|
|
435
|
+
*
|
|
436
|
+
* @returns True if the field should be repositioned,
|
|
437
|
+
* false if the WidgetDiv should hide itself instead.
|
|
438
|
+
*/
|
|
439
|
+
repositionForWindowResize(): boolean;
|
|
414
440
|
/**
|
|
415
441
|
* Updates the size of the field based on the text.
|
|
416
442
|
*
|
package/core/field_checkbox.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ type CheckboxBool = BoolString | boolean;
|
|
|
13
13
|
export declare class FieldCheckbox extends Field<CheckboxBool> {
|
|
14
14
|
/** Default character for the checkmark. */
|
|
15
15
|
static readonly CHECK_CHAR = "\u2713";
|
|
16
|
-
private
|
|
16
|
+
private checkChar;
|
|
17
17
|
/**
|
|
18
18
|
* Serializable fields are saved by the serializer, non-serializable fields
|
|
19
19
|
* are not. Editable fields should also be serializable.
|
package/core/field_colour.d.ts
CHANGED
package/core/field_dropdown.d.ts
CHANGED
|
@@ -19,17 +19,17 @@ export declare class FieldDropdown extends Field<string> {
|
|
|
19
19
|
static MAX_MENU_HEIGHT_VH: number;
|
|
20
20
|
static ARROW_CHAR: string;
|
|
21
21
|
/** A reference to the currently selected menu item. */
|
|
22
|
-
private
|
|
22
|
+
private selectedMenuItem;
|
|
23
23
|
/** The dropdown menu. */
|
|
24
24
|
protected menu_: Menu | null;
|
|
25
25
|
/**
|
|
26
26
|
* SVG image element if currently selected option is an image, or null.
|
|
27
27
|
*/
|
|
28
|
-
private
|
|
28
|
+
private imageElement;
|
|
29
29
|
/** Tspan based arrow element. */
|
|
30
|
-
private
|
|
30
|
+
private arrow;
|
|
31
31
|
/** SVG based arrow element. */
|
|
32
|
-
private
|
|
32
|
+
private svgArrow;
|
|
33
33
|
/**
|
|
34
34
|
* Serializable fields are saved by the serializer, non-serializable fields
|
|
35
35
|
* are not. Editable fields should also be serializable.
|
|
@@ -39,7 +39,7 @@ export declare class FieldDropdown extends Field<string> {
|
|
|
39
39
|
CURSOR: string;
|
|
40
40
|
protected menuGenerator_?: MenuGenerator;
|
|
41
41
|
/** A cache of the most recently generated options. */
|
|
42
|
-
private
|
|
42
|
+
private generatedOptions;
|
|
43
43
|
/**
|
|
44
44
|
* The prefix field label, of common words set after options are trimmed.
|
|
45
45
|
*
|
|
@@ -52,7 +52,7 @@ export declare class FieldDropdown extends Field<string> {
|
|
|
52
52
|
* @internal
|
|
53
53
|
*/
|
|
54
54
|
suffixField: string | null;
|
|
55
|
-
private
|
|
55
|
+
private selectedOption;
|
|
56
56
|
clickTarget_: SVGElement | null;
|
|
57
57
|
/**
|
|
58
58
|
* @param menuGenerator A non-empty array of options for a dropdown list, or a
|
|
@@ -111,7 +111,7 @@ export declare class FieldDropdown extends Field<string> {
|
|
|
111
111
|
*/
|
|
112
112
|
protected showEditor_(e?: MouseEvent): void;
|
|
113
113
|
/** Create the dropdown editor. */
|
|
114
|
-
private
|
|
114
|
+
private dropdownCreate;
|
|
115
115
|
/**
|
|
116
116
|
* Disposes of events and DOM-references belonging to the dropdown editor.
|
|
117
117
|
*/
|
|
@@ -121,7 +121,7 @@ export declare class FieldDropdown extends Field<string> {
|
|
|
121
121
|
*
|
|
122
122
|
* @param menuItem The MenuItem selected within menu.
|
|
123
123
|
*/
|
|
124
|
-
private
|
|
124
|
+
private handleMenuActionEvent;
|
|
125
125
|
/**
|
|
126
126
|
* Handle the selection of an item in the dropdown menu.
|
|
127
127
|
*
|
|
@@ -160,8 +160,6 @@ export declare class FieldDropdown extends Field<string> {
|
|
|
160
160
|
protected doValueUpdate_(newValue: string): void;
|
|
161
161
|
/**
|
|
162
162
|
* Updates the dropdown arrow to match the colour/style of the block.
|
|
163
|
-
*
|
|
164
|
-
* @internal
|
|
165
163
|
*/
|
|
166
164
|
applyColour(): void;
|
|
167
165
|
/** Draws the border with the correct width. */
|
|
@@ -171,9 +169,9 @@ export declare class FieldDropdown extends Field<string> {
|
|
|
171
169
|
*
|
|
172
170
|
* @param imageJson Selected option that must be an image.
|
|
173
171
|
*/
|
|
174
|
-
private
|
|
172
|
+
private renderSelectedImage;
|
|
175
173
|
/** Renders the selected option, which must be text. */
|
|
176
|
-
private
|
|
174
|
+
private renderSelectedText;
|
|
177
175
|
/**
|
|
178
176
|
* Position a drop-down arrow at the appropriate location at render-time.
|
|
179
177
|
*
|
|
@@ -181,7 +179,7 @@ export declare class FieldDropdown extends Field<string> {
|
|
|
181
179
|
* @param y Y position the arrow is being rendered at, in px.
|
|
182
180
|
* @returns Amount of space the arrow is taking up, in px.
|
|
183
181
|
*/
|
|
184
|
-
private
|
|
182
|
+
private positionSVGArrow;
|
|
185
183
|
/**
|
|
186
184
|
* Use the `getText_` developer hook to override the field's text
|
|
187
185
|
* representation. Get the selected option text. If the selected option is
|
package/core/field_image.d.ts
CHANGED
|
@@ -15,11 +15,11 @@ export declare class FieldImage extends Field<string> {
|
|
|
15
15
|
*/
|
|
16
16
|
private static readonly Y_PADDING;
|
|
17
17
|
protected size_: Size;
|
|
18
|
-
private readonly
|
|
18
|
+
private readonly imageHeight;
|
|
19
19
|
/** The function to be called when this field is clicked. */
|
|
20
|
-
private
|
|
20
|
+
private clickHandler;
|
|
21
21
|
/** The rendered field's image element. */
|
|
22
|
-
private
|
|
22
|
+
private imageElement;
|
|
23
23
|
/**
|
|
24
24
|
* Editable fields usually show some sort of UI indicating they are
|
|
25
25
|
* editable. This field should not.
|
|
@@ -32,9 +32,9 @@ export declare class FieldImage extends Field<string> {
|
|
|
32
32
|
*/
|
|
33
33
|
protected isDirty_: boolean;
|
|
34
34
|
/** Whether to flip this image in RTL. */
|
|
35
|
-
private
|
|
35
|
+
private flipRtl;
|
|
36
36
|
/** Alt text of this image. */
|
|
37
|
-
private
|
|
37
|
+
private altText;
|
|
38
38
|
/**
|
|
39
39
|
* @param src The URL of the image.
|
|
40
40
|
* Also accepts Field.SKIP_SETUP if you wish to skip setup (only used by
|
package/core/field_input.d.ts
CHANGED
|
@@ -91,8 +91,6 @@ export declare abstract class FieldInput<T extends InputTypes> extends Field<str
|
|
|
91
91
|
protected doValueUpdate_(newValue: string | T): void;
|
|
92
92
|
/**
|
|
93
93
|
* Updates text field to match the colour/style of the block.
|
|
94
|
-
*
|
|
95
|
-
* @internal
|
|
96
94
|
*/
|
|
97
95
|
applyColour(): void;
|
|
98
96
|
/**
|
|
@@ -177,6 +175,15 @@ export declare abstract class FieldInput<T extends InputTypes> extends Field<str
|
|
|
177
175
|
protected setEditorValue_(newValue: any): void;
|
|
178
176
|
/** Resize the editor to fit the text. */
|
|
179
177
|
protected resizeEditor_(): void;
|
|
178
|
+
/**
|
|
179
|
+
* Handles repositioning the WidgetDiv used for input fields when the
|
|
180
|
+
* workspace is resized. Will bump the block into the viewport and update the
|
|
181
|
+
* position of the field if necessary.
|
|
182
|
+
*
|
|
183
|
+
* @returns True for rendered workspaces, as we never want to hide the widget
|
|
184
|
+
* div.
|
|
185
|
+
*/
|
|
186
|
+
repositionForWindowResize(): boolean;
|
|
180
187
|
/**
|
|
181
188
|
* Returns whether or not the field is tab navigable.
|
|
182
189
|
*
|
package/core/field_label.d.ts
CHANGED
|
@@ -9,12 +9,14 @@ import { Field, FieldConfig } from './field.js';
|
|
|
9
9
|
*/
|
|
10
10
|
export declare class FieldLabel extends Field<string> {
|
|
11
11
|
/** The HTML class name to use for this field. */
|
|
12
|
-
private
|
|
12
|
+
private class;
|
|
13
13
|
/**
|
|
14
14
|
* Editable fields usually show some sort of UI indicating they are
|
|
15
15
|
* editable. This field should not.
|
|
16
16
|
*/
|
|
17
17
|
EDITABLE: boolean;
|
|
18
|
+
/** Text labels should not truncate. */
|
|
19
|
+
maxDisplayLength: number;
|
|
18
20
|
/**
|
|
19
21
|
* @param value The initial value of the field. Should cast to a string.
|
|
20
22
|
* Defaults to an empty string if null or undefined. Also accepts
|
package/core/field_number.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export declare class FieldNumber extends FieldInput<number> {
|
|
|
19
19
|
* The number of decimal places to allow, or null to allow any number of
|
|
20
20
|
* decimal digits.
|
|
21
21
|
*/
|
|
22
|
-
private
|
|
22
|
+
private decimalPlaces;
|
|
23
23
|
/** Don't spellcheck numbers. Our validator does a better job. */
|
|
24
24
|
protected spellcheck_: boolean;
|
|
25
25
|
/**
|
|
@@ -75,7 +75,7 @@ export declare class FieldNumber extends FieldInput<number> {
|
|
|
75
75
|
*
|
|
76
76
|
* @param min Minimum value.
|
|
77
77
|
*/
|
|
78
|
-
private
|
|
78
|
+
private setMinInternal;
|
|
79
79
|
/**
|
|
80
80
|
* Returns the current minimum value this field can contain. Default is
|
|
81
81
|
* -Infinity.
|
|
@@ -96,7 +96,7 @@ export declare class FieldNumber extends FieldInput<number> {
|
|
|
96
96
|
*
|
|
97
97
|
* @param max Maximum value.
|
|
98
98
|
*/
|
|
99
|
-
private
|
|
99
|
+
private setMaxInternal;
|
|
100
100
|
/**
|
|
101
101
|
* Returns the current maximum value this field can contain. Default is
|
|
102
102
|
* Infinity.
|
|
@@ -117,7 +117,7 @@ export declare class FieldNumber extends FieldInput<number> {
|
|
|
117
117
|
*
|
|
118
118
|
* @param precision The number to which the field's value is rounded.
|
|
119
119
|
*/
|
|
120
|
-
private
|
|
120
|
+
private setPrecisionInternal;
|
|
121
121
|
/**
|
|
122
122
|
* Returns the current precision of this field. The precision being the
|
|
123
123
|
* number to which the field's value is rounded. A precision of 0 means that
|