blockly 9.3.0-beta.0 → 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 +1674 -1520
- package/blockly_compressed.js +1313 -1152
- 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_drag_surface.d.ts +135 -0
- package/core/block_dragger.d.ts +2 -7
- package/core/block_svg.d.ts +72 -9
- package/core/blockly.d.ts +29 -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 +6 -4
- package/core/bubble_dragger.d.ts +2 -3
- 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_abstract.d.ts +0 -3
- package/core/events/events_block_base.d.ts +0 -2
- package/core/events/events_block_change.d.ts +0 -2
- package/core/events/events_block_create.d.ts +0 -2
- package/core/events/events_block_delete.d.ts +0 -2
- package/core/events/events_block_drag.d.ts +0 -2
- package/core/events/events_block_move.d.ts +0 -2
- package/core/events/events_bubble_open.d.ts +0 -2
- package/core/events/events_click.d.ts +0 -2
- package/core/events/events_comment_base.d.ts +0 -2
- package/core/events/events_comment_change.d.ts +0 -2
- package/core/events/events_comment_create.d.ts +0 -2
- package/core/events/events_comment_delete.d.ts +0 -2
- package/core/events/events_comment_move.d.ts +0 -2
- package/core/events/events_marker_move.d.ts +0 -2
- package/core/events/events_selected.d.ts +0 -2
- package/core/events/events_theme_change.d.ts +0 -2
- package/core/events/events_toolbox_item_select.d.ts +0 -2
- package/core/events/events_trashcan_open.d.ts +0 -2
- 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 +0 -2
- package/core/events/events_var_create.d.ts +0 -2
- package/core/events/events_viewport.d.ts +0 -2
- package/core/events/utils.d.ts +0 -73
- package/core/events/workspace_events.d.ts +0 -2
- package/core/extensions.d.ts +0 -8
- package/core/field.d.ts +16 -15
- package/core/field_angle.d.ts +60 -50
- package/core/field_checkbox.d.ts +22 -10
- package/core/field_colour.d.ts +55 -42
- package/core/field_dropdown.d.ts +34 -18
- package/core/field_image.d.ts +9 -12
- package/core/field_input.d.ts +34 -11
- package/core/field_label.d.ts +7 -10
- package/core/field_label_serializable.d.ts +4 -6
- package/core/field_multilineinput.d.ts +34 -12
- package/core/field_number.d.ts +27 -19
- package/core/field_registry.d.ts +0 -3
- package/core/field_textinput.d.ts +28 -12
- package/core/field_variable.d.ts +28 -16
- 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 +4 -17
- 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 +1 -3
- package/core/interfaces/i_bounded_element.d.ts +0 -2
- package/core/interfaces/i_bubble.d.ts +6 -4
- 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 +0 -2
- package/core/interfaces/i_movable.d.ts +0 -2
- package/core/interfaces/i_positionable.d.ts +0 -2
- 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 +0 -2
- package/core/mutator.d.ts +0 -2
- package/core/names.d.ts +0 -3
- package/core/options.d.ts +0 -2
- package/core/positionable_helpers.d.ts +0 -7
- package/core/procedures.d.ts +2 -25
- 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/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 +16 -5
- package/core/workspace_drag_surface_svg.d.ts +74 -0
- package/core/workspace_dragger.d.ts +3 -2
- package/core/workspace_svg.d.ts +48 -8
- 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 +6 -6
- 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/utils/sentinel.d.ts +0 -18
package/core/any_aliases.d.ts
CHANGED
package/core/block.d.ts
CHANGED
|
@@ -22,8 +22,6 @@ import type { Workspace } from './workspace.js';
|
|
|
22
22
|
/**
|
|
23
23
|
* Class for one block.
|
|
24
24
|
* Not normally called directly, workspace.newBlock() is preferred.
|
|
25
|
-
*
|
|
26
|
-
* @alias Blockly.Block
|
|
27
25
|
*/
|
|
28
26
|
export declare class Block implements IASTNodeLocation, IDeletable {
|
|
29
27
|
/**
|
|
@@ -31,7 +29,7 @@ export declare class Block implements IASTNodeLocation, IDeletable {
|
|
|
31
29
|
* changes. This is usually only called from the constructor, the block type
|
|
32
30
|
* initializer function, or an extension initializer function.
|
|
33
31
|
*/
|
|
34
|
-
onchange?: ((p1: Abstract) =>
|
|
32
|
+
onchange?: ((p1: Abstract) => void) | null;
|
|
35
33
|
/** The language-neutral ID given to the collapsed input. */
|
|
36
34
|
static readonly COLLAPSED_INPUT_NAME: string;
|
|
37
35
|
/** The language-neutral ID given to the collapsed field. */
|
|
@@ -57,7 +55,7 @@ export declare class Block implements IASTNodeLocation, IDeletable {
|
|
|
57
55
|
/** Name of the block style. */
|
|
58
56
|
protected styleName_: string;
|
|
59
57
|
/** An optional method called during initialization. */
|
|
60
|
-
init?: (() =>
|
|
58
|
+
init?: (() => void);
|
|
61
59
|
/** An optional method called during disposal. */
|
|
62
60
|
destroy?: (() => void);
|
|
63
61
|
/**
|
|
@@ -65,25 +63,25 @@ export declare class Block implements IASTNodeLocation, IDeletable {
|
|
|
65
63
|
* mutation state to XML. This must be coupled with defining
|
|
66
64
|
* `domToMutation`.
|
|
67
65
|
*/
|
|
68
|
-
mutationToDom?: (
|
|
66
|
+
mutationToDom?: (...p1: any[]) => Element;
|
|
69
67
|
/**
|
|
70
68
|
* An optional deserialization method for defining how to deserialize the
|
|
71
69
|
* mutation state from XML. This must be coupled with defining
|
|
72
70
|
* `mutationToDom`.
|
|
73
71
|
*/
|
|
74
|
-
domToMutation?: (
|
|
72
|
+
domToMutation?: (p1: Element) => void;
|
|
75
73
|
/**
|
|
76
74
|
* An optional serialization method for defining how to serialize the
|
|
77
75
|
* block's extra state (eg mutation state) to something JSON compatible.
|
|
78
76
|
* This must be coupled with defining `loadExtraState`.
|
|
79
77
|
*/
|
|
80
|
-
saveExtraState?: (
|
|
78
|
+
saveExtraState?: () => any;
|
|
81
79
|
/**
|
|
82
80
|
* An optional serialization method for defining how to deserialize the
|
|
83
81
|
* block's extra state (eg mutation state) from something JSON compatible.
|
|
84
82
|
* This must be coupled with defining `saveExtraState`.
|
|
85
83
|
*/
|
|
86
|
-
loadExtraState?: (
|
|
84
|
+
loadExtraState?: (p1: any) => void;
|
|
87
85
|
/**
|
|
88
86
|
* An optional property for suppressing adding STATEMENT_PREFIX and
|
|
89
87
|
* STATEMENT_SUFFIX to generated code.
|
|
@@ -95,21 +93,21 @@ export declare class Block implements IASTNodeLocation, IDeletable {
|
|
|
95
93
|
* shown to the user, but are declared as global variables in the generated
|
|
96
94
|
* code.
|
|
97
95
|
*/
|
|
98
|
-
getDeveloperVariables?: (
|
|
96
|
+
getDeveloperVariables?: () => string[];
|
|
99
97
|
/**
|
|
100
98
|
* An optional function that reconfigures the block based on the contents of
|
|
101
99
|
* the mutator dialog.
|
|
102
100
|
*/
|
|
103
|
-
compose?: (
|
|
101
|
+
compose?: (p1: Block) => void;
|
|
104
102
|
/**
|
|
105
103
|
* An optional function that populates the mutator's dialog with
|
|
106
104
|
* this block's components.
|
|
107
105
|
*/
|
|
108
|
-
decompose?: (
|
|
106
|
+
decompose?: (p1: Workspace) => Block;
|
|
109
107
|
id: string;
|
|
110
|
-
outputConnection: Connection;
|
|
111
|
-
nextConnection: Connection;
|
|
112
|
-
previousConnection: Connection;
|
|
108
|
+
outputConnection: Connection | null;
|
|
109
|
+
nextConnection: Connection | null;
|
|
110
|
+
previousConnection: Connection | null;
|
|
113
111
|
inputList: Input[];
|
|
114
112
|
inputsInline?: boolean;
|
|
115
113
|
private disabled;
|
|
@@ -147,7 +145,7 @@ export declare class Block implements IASTNodeLocation, IDeletable {
|
|
|
147
145
|
/**
|
|
148
146
|
* String for block help, or function that returns a URL. Null for no help.
|
|
149
147
|
*/
|
|
150
|
-
helpUrl: string | Function;
|
|
148
|
+
helpUrl: string | Function | null;
|
|
151
149
|
/** A bound callback function to use when the parent workspace changes. */
|
|
152
150
|
private onchangeWrapper_;
|
|
153
151
|
/**
|
|
@@ -179,6 +177,11 @@ export declare class Block implements IASTNodeLocation, IDeletable {
|
|
|
179
177
|
* @suppress {checkTypes}
|
|
180
178
|
*/
|
|
181
179
|
dispose(healStack: boolean): void;
|
|
180
|
+
/**
|
|
181
|
+
* Disposes of this block without doing things required by the top block.
|
|
182
|
+
* E.g. does not fire events, unplug the block, etc.
|
|
183
|
+
*/
|
|
184
|
+
protected disposeInternal(): void;
|
|
182
185
|
/**
|
|
183
186
|
* Returns true if the block is either in the process of being disposed, or
|
|
184
187
|
* is disposed.
|
|
@@ -348,6 +351,12 @@ export declare class Block implements IASTNodeLocation, IDeletable {
|
|
|
348
351
|
* @returns True if deletable.
|
|
349
352
|
*/
|
|
350
353
|
isDeletable(): boolean;
|
|
354
|
+
/**
|
|
355
|
+
* Return whether this block's own deletable property is true or false.
|
|
356
|
+
*
|
|
357
|
+
* @returns True if the block's deletable property is true, false otherwise.
|
|
358
|
+
*/
|
|
359
|
+
isOwnDeletable(): boolean;
|
|
351
360
|
/**
|
|
352
361
|
* Set whether this block is deletable or not.
|
|
353
362
|
*
|
|
@@ -358,8 +367,16 @@ export declare class Block implements IASTNodeLocation, IDeletable {
|
|
|
358
367
|
* Get whether this block is movable or not.
|
|
359
368
|
*
|
|
360
369
|
* @returns True if movable.
|
|
370
|
+
* @internal
|
|
361
371
|
*/
|
|
362
372
|
isMovable(): boolean;
|
|
373
|
+
/**
|
|
374
|
+
* Return whether this block's own movable property is true or false.
|
|
375
|
+
*
|
|
376
|
+
* @returns True if the block's movable property is true, false otherwise.
|
|
377
|
+
* @internal
|
|
378
|
+
*/
|
|
379
|
+
isOwnMovable(): boolean;
|
|
363
380
|
/**
|
|
364
381
|
* Set whether this block is movable or not.
|
|
365
382
|
*
|
|
@@ -406,8 +423,15 @@ export declare class Block implements IASTNodeLocation, IDeletable {
|
|
|
406
423
|
* Get whether this block is editable or not.
|
|
407
424
|
*
|
|
408
425
|
* @returns True if editable.
|
|
426
|
+
* @internal
|
|
409
427
|
*/
|
|
410
428
|
isEditable(): boolean;
|
|
429
|
+
/**
|
|
430
|
+
* Return whether this block's own editable property is true or false.
|
|
431
|
+
*
|
|
432
|
+
* @returns True if the block's editable property is true, false otherwise.
|
|
433
|
+
*/
|
|
434
|
+
isOwnEditable(): boolean;
|
|
411
435
|
/**
|
|
412
436
|
* Set whether this block is editable or not.
|
|
413
437
|
*
|
|
@@ -492,7 +516,7 @@ export declare class Block implements IASTNodeLocation, IDeletable {
|
|
|
492
516
|
* @param onchangeFn The callback to call when the block's workspace changes.
|
|
493
517
|
* @throws {Error} if onchangeFn is not falsey and not a function.
|
|
494
518
|
*/
|
|
495
|
-
setOnChange(onchangeFn: (p1: Abstract) =>
|
|
519
|
+
setOnChange(onchangeFn: (p1: Abstract) => void): void;
|
|
496
520
|
/**
|
|
497
521
|
* Returns the named field from a block.
|
|
498
522
|
*
|
|
@@ -627,11 +651,19 @@ export declare class Block implements IASTNodeLocation, IDeletable {
|
|
|
627
651
|
* Create a human-readable text representation of this block and any children.
|
|
628
652
|
*
|
|
629
653
|
* @param opt_maxLength Truncate the string to this length.
|
|
630
|
-
* @param opt_emptyToken The placeholder string used to denote an empty
|
|
654
|
+
* @param opt_emptyToken The placeholder string used to denote an empty input.
|
|
631
655
|
* If not specified, '?' is used.
|
|
632
656
|
* @returns Text of block.
|
|
633
657
|
*/
|
|
634
658
|
toString(opt_maxLength?: number, opt_emptyToken?: string): string;
|
|
659
|
+
/**
|
|
660
|
+
* Converts this block into string tokens.
|
|
661
|
+
*
|
|
662
|
+
* @param emptyToken The token to use in place of an empty input.
|
|
663
|
+
* Defaults to '?'.
|
|
664
|
+
* @returns The array of string tokens representing this block.
|
|
665
|
+
*/
|
|
666
|
+
private toTokens;
|
|
635
667
|
/**
|
|
636
668
|
* Shortcut for appending a value input row.
|
|
637
669
|
*
|
|
@@ -8,7 +8,6 @@ import type { BlockSvg } from './block_svg.js';
|
|
|
8
8
|
* Play some UI effects (sound, animation) when disposing of a block.
|
|
9
9
|
*
|
|
10
10
|
* @param block The block being disposed of.
|
|
11
|
-
* @alias Blockly.blockAnimations.disposeUiEffect
|
|
12
11
|
* @internal
|
|
13
12
|
*/
|
|
14
13
|
export declare function disposeUiEffect(block: BlockSvg): void;
|
|
@@ -16,7 +15,6 @@ export declare function disposeUiEffect(block: BlockSvg): void;
|
|
|
16
15
|
* Play some UI effects (sound, ripple) after a connection has been established.
|
|
17
16
|
*
|
|
18
17
|
* @param block The block being connected.
|
|
19
|
-
* @alias Blockly.blockAnimations.connectionUiEffect
|
|
20
18
|
* @internal
|
|
21
19
|
*/
|
|
22
20
|
export declare function connectionUiEffect(block: BlockSvg): void;
|
|
@@ -24,14 +22,12 @@ export declare function connectionUiEffect(block: BlockSvg): void;
|
|
|
24
22
|
* Play some UI effects (sound, animation) when disconnecting a block.
|
|
25
23
|
*
|
|
26
24
|
* @param block The block being disconnected.
|
|
27
|
-
* @alias Blockly.blockAnimations.disconnectUiEffect
|
|
28
25
|
* @internal
|
|
29
26
|
*/
|
|
30
27
|
export declare function disconnectUiEffect(block: BlockSvg): void;
|
|
31
28
|
/**
|
|
32
29
|
* Stop the disconnect UI animation immediately.
|
|
33
30
|
*
|
|
34
|
-
* @alias Blockly.blockAnimations.disconnectUiStop
|
|
35
31
|
* @internal
|
|
36
32
|
*/
|
|
37
33
|
export declare function disconnectUiStop(): void;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2016 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Coordinate } from './utils/coordinate.js';
|
|
7
|
+
/**
|
|
8
|
+
* Class for a drag surface for the currently dragged block. This is a separate
|
|
9
|
+
* SVG that contains only the currently moving block, or nothing.
|
|
10
|
+
*
|
|
11
|
+
* @alias Blockly.BlockDragSurfaceSvg
|
|
12
|
+
*/
|
|
13
|
+
export declare class BlockDragSurfaceSvg {
|
|
14
|
+
private readonly container;
|
|
15
|
+
/**
|
|
16
|
+
* The root element of the drag surface.
|
|
17
|
+
*/
|
|
18
|
+
private svg;
|
|
19
|
+
/**
|
|
20
|
+
* This is where blocks live while they are being dragged if the drag
|
|
21
|
+
* surface is enabled.
|
|
22
|
+
*/
|
|
23
|
+
private dragGroup;
|
|
24
|
+
/**
|
|
25
|
+
* Cached value for the scale of the drag surface.
|
|
26
|
+
* Used to set/get the correct translation during and after a drag.
|
|
27
|
+
*/
|
|
28
|
+
private scale;
|
|
29
|
+
/**
|
|
30
|
+
* Cached value for the translation of the drag surface.
|
|
31
|
+
* This translation is in pixel units, because the scale is applied to the
|
|
32
|
+
* drag group rather than the top-level SVG.
|
|
33
|
+
*/
|
|
34
|
+
private surfaceXY;
|
|
35
|
+
/**
|
|
36
|
+
* Cached value for the translation of the child drag surface in pixel
|
|
37
|
+
* units. Since the child drag surface tracks the translation of the
|
|
38
|
+
* workspace this is ultimately the translation of the workspace.
|
|
39
|
+
*/
|
|
40
|
+
private readonly childSurfaceXY;
|
|
41
|
+
/** @param container Containing element. */
|
|
42
|
+
constructor(container: Element);
|
|
43
|
+
/**
|
|
44
|
+
* Create the drag surface and inject it into the container.
|
|
45
|
+
*
|
|
46
|
+
* @deprecated The DOM is automatically created by the constructor.
|
|
47
|
+
*/
|
|
48
|
+
createDom(): void;
|
|
49
|
+
/**
|
|
50
|
+
* Set the SVG blocks on the drag surface's group and show the surface.
|
|
51
|
+
* Only one block group should be on the drag surface at a time.
|
|
52
|
+
*
|
|
53
|
+
* @param blocks Block or group of blocks to place on the drag surface.
|
|
54
|
+
*/
|
|
55
|
+
setBlocksAndShow(blocks: SVGElement): void;
|
|
56
|
+
/**
|
|
57
|
+
* Translate and scale the entire drag surface group to the given position, to
|
|
58
|
+
* keep in sync with the workspace.
|
|
59
|
+
*
|
|
60
|
+
* @param x X translation in pixel coordinates.
|
|
61
|
+
* @param y Y translation in pixel coordinates.
|
|
62
|
+
* @param scale Scale of the group.
|
|
63
|
+
*/
|
|
64
|
+
translateAndScaleGroup(x: number, y: number, scale: number): void;
|
|
65
|
+
/**
|
|
66
|
+
* Translate the drag surface's SVG based on its internal state.
|
|
67
|
+
*
|
|
68
|
+
* @internal
|
|
69
|
+
*/
|
|
70
|
+
translateSurfaceInternal_(): void;
|
|
71
|
+
/**
|
|
72
|
+
* Translates the entire surface by a relative offset.
|
|
73
|
+
*
|
|
74
|
+
* @param deltaX Horizontal offset in pixel units.
|
|
75
|
+
* @param deltaY Vertical offset in pixel units.
|
|
76
|
+
*/
|
|
77
|
+
translateBy(deltaX: number, deltaY: number): void;
|
|
78
|
+
/**
|
|
79
|
+
* Translate the entire drag surface during a drag.
|
|
80
|
+
* We translate the drag surface instead of the blocks inside the surface
|
|
81
|
+
* so that the browser avoids repainting the SVG.
|
|
82
|
+
* Because of this, the drag coordinates must be adjusted by scale.
|
|
83
|
+
*
|
|
84
|
+
* @param x X translation for the entire surface.
|
|
85
|
+
* @param y Y translation for the entire surface.
|
|
86
|
+
*/
|
|
87
|
+
translateSurface(x: number, y: number): void;
|
|
88
|
+
/**
|
|
89
|
+
* Reports the surface translation in scaled workspace coordinates.
|
|
90
|
+
* Use this when finishing a drag to return blocks to the correct position.
|
|
91
|
+
*
|
|
92
|
+
* @returns Current translation of the surface.
|
|
93
|
+
*/
|
|
94
|
+
getSurfaceTranslation(): Coordinate;
|
|
95
|
+
/**
|
|
96
|
+
* Provide a reference to the drag group (primarily for
|
|
97
|
+
* BlockSvg.getRelativeToSurfaceXY).
|
|
98
|
+
*
|
|
99
|
+
* @returns Drag surface group element.
|
|
100
|
+
*/
|
|
101
|
+
getGroup(): SVGElement;
|
|
102
|
+
/**
|
|
103
|
+
* Returns the SVG drag surface.
|
|
104
|
+
*
|
|
105
|
+
* @returns The SVG drag surface.
|
|
106
|
+
*/
|
|
107
|
+
getSvgRoot(): SVGElement;
|
|
108
|
+
/**
|
|
109
|
+
* Get the current blocks on the drag surface, if any (primarily
|
|
110
|
+
* for BlockSvg.getRelativeToSurfaceXY).
|
|
111
|
+
*
|
|
112
|
+
* @returns Drag surface block DOM element, or null if no blocks exist.
|
|
113
|
+
*/
|
|
114
|
+
getCurrentBlock(): Element | null;
|
|
115
|
+
/**
|
|
116
|
+
* Gets the translation of the child block surface
|
|
117
|
+
* This surface is in charge of keeping track of how much the workspace has
|
|
118
|
+
* moved.
|
|
119
|
+
*
|
|
120
|
+
* @returns The amount the workspace has been moved.
|
|
121
|
+
*/
|
|
122
|
+
getWsTranslation(): Coordinate;
|
|
123
|
+
/**
|
|
124
|
+
* Clear the group and hide the surface; move the blocks off onto the provided
|
|
125
|
+
* element.
|
|
126
|
+
* If the block is being deleted it doesn't need to go back to the original
|
|
127
|
+
* surface, since it would be removed immediately during dispose.
|
|
128
|
+
*
|
|
129
|
+
* @param opt_newSurface Surface the dragging blocks should be moved to, or
|
|
130
|
+
* null if the blocks should be removed from this surface without being
|
|
131
|
+
* moved to a different surface.
|
|
132
|
+
*/
|
|
133
|
+
clearAndHide(opt_newSurface?: Element): void;
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=block_drag_surface.d.ts.map
|
package/core/block_dragger.d.ts
CHANGED
|
@@ -13,8 +13,6 @@ import type { WorkspaceSvg } from './workspace_svg.js';
|
|
|
13
13
|
/**
|
|
14
14
|
* Class for a block dragger. It moves blocks around the workspace when they
|
|
15
15
|
* are being dragged by a mouse or touch.
|
|
16
|
-
*
|
|
17
|
-
* @alias Blockly.BlockDragger
|
|
18
16
|
*/
|
|
19
17
|
export declare class BlockDragger implements IBlockDragger {
|
|
20
18
|
/** The top block in the stack that is being dragged. */
|
|
@@ -40,7 +38,7 @@ export declare class BlockDragger implements IBlockDragger {
|
|
|
40
38
|
*/
|
|
41
39
|
dispose(): void;
|
|
42
40
|
/**
|
|
43
|
-
* Start dragging a block.
|
|
41
|
+
* Start dragging a block. This includes moving it to the drag surface.
|
|
44
42
|
*
|
|
45
43
|
* @param currentDragDeltaXY How far the pointer has moved from the position
|
|
46
44
|
* at mouse down, in pixel units.
|
|
@@ -103,11 +101,8 @@ export declare class BlockDragger implements IBlockDragger {
|
|
|
103
101
|
protected maybeDeleteBlock_(): boolean;
|
|
104
102
|
/**
|
|
105
103
|
* Updates the necessary information to place a block at a certain location.
|
|
106
|
-
*
|
|
107
|
-
* @param delta The change in location from where the block started the drag
|
|
108
|
-
* to where it ended the drag.
|
|
109
104
|
*/
|
|
110
|
-
protected updateBlockAfterMove_(
|
|
105
|
+
protected updateBlockAfterMove_(): void;
|
|
111
106
|
/** Fire a UI event at the end of a block drag. */
|
|
112
107
|
protected fireDragEndEvent_(): void;
|
|
113
108
|
/**
|
package/core/block_svg.d.ts
CHANGED
|
@@ -28,8 +28,6 @@ import type { WorkspaceSvg } from './workspace_svg.js';
|
|
|
28
28
|
/**
|
|
29
29
|
* Class for a block's SVG representation.
|
|
30
30
|
* Not normally called directly, workspace.newBlock() is preferred.
|
|
31
|
-
*
|
|
32
|
-
* @alias Blockly.BlockSvg
|
|
33
31
|
*/
|
|
34
32
|
export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBoundedElement, ICopyable, IDraggable {
|
|
35
33
|
/**
|
|
@@ -43,9 +41,9 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
|
|
|
43
41
|
* the block.
|
|
44
42
|
*/
|
|
45
43
|
static readonly COLLAPSED_WARNING_ID = "TEMP_COLLAPSED_WARNING_";
|
|
46
|
-
decompose?: (
|
|
47
|
-
saveConnections?: (
|
|
48
|
-
customContextMenu?: (
|
|
44
|
+
decompose?: (p1: Workspace) => BlockSvg;
|
|
45
|
+
saveConnections?: (p1: BlockSvg) => void;
|
|
46
|
+
customContextMenu?: (p1: Array<ContextMenuOption | LegacyContextMenuOption>) => void;
|
|
49
47
|
/**
|
|
50
48
|
* An property used internally to reference the block's rendering debugger.
|
|
51
49
|
*
|
|
@@ -78,6 +76,7 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
|
|
|
78
76
|
/** @internal */
|
|
79
77
|
pathObject: IPathObject;
|
|
80
78
|
rendered: boolean;
|
|
79
|
+
private visuallyDisabled;
|
|
81
80
|
/**
|
|
82
81
|
* Is this block currently rendering? Used to stop recursive render calls
|
|
83
82
|
* from actually triggering a re-render.
|
|
@@ -89,7 +88,21 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
|
|
|
89
88
|
outputConnection: RenderedConnection;
|
|
90
89
|
nextConnection: RenderedConnection;
|
|
91
90
|
previousConnection: RenderedConnection;
|
|
91
|
+
private readonly useDragSurface_;
|
|
92
92
|
private translation;
|
|
93
|
+
/**
|
|
94
|
+
* The ID of the setTimeout callback for bumping neighbours, or 0 if no bump
|
|
95
|
+
* is currently scheduled.
|
|
96
|
+
*/
|
|
97
|
+
private bumpNeighboursPid;
|
|
98
|
+
/**
|
|
99
|
+
* The location of the top left of this block (in workspace coordinates)
|
|
100
|
+
* relative to either its parent block, or the workspace origin if it has no
|
|
101
|
+
* parent.
|
|
102
|
+
*
|
|
103
|
+
* @internal
|
|
104
|
+
*/
|
|
105
|
+
relativeCoords: Coordinate;
|
|
93
106
|
/**
|
|
94
107
|
* @param workspace The block's workspace.
|
|
95
108
|
* @param prototypeName Name of the language object containing type-specific
|
|
@@ -169,6 +182,14 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
|
|
|
169
182
|
* @internal
|
|
170
183
|
*/
|
|
171
184
|
getTranslation(): string;
|
|
185
|
+
/**
|
|
186
|
+
* Move this block to its workspace's drag surface, accounting for
|
|
187
|
+
* positioning. Generally should be called at the same time as
|
|
188
|
+
* setDragging_(true). Does nothing if useDragSurface_ is false.
|
|
189
|
+
*
|
|
190
|
+
* @internal
|
|
191
|
+
*/
|
|
192
|
+
moveToDragSurface(): void;
|
|
172
193
|
/**
|
|
173
194
|
* Move a block to a position.
|
|
174
195
|
*
|
|
@@ -176,7 +197,18 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
|
|
|
176
197
|
*/
|
|
177
198
|
moveTo(xy: Coordinate): void;
|
|
178
199
|
/**
|
|
179
|
-
* Move this block
|
|
200
|
+
* Move this block back to the workspace block canvas.
|
|
201
|
+
* Generally should be called at the same time as setDragging_(false).
|
|
202
|
+
* Does nothing if useDragSurface_ is false.
|
|
203
|
+
*
|
|
204
|
+
* @param newXY The position the block should take on on the workspace canvas,
|
|
205
|
+
* in workspace coordinates.
|
|
206
|
+
* @internal
|
|
207
|
+
*/
|
|
208
|
+
moveOffDragSurface(newXY: Coordinate): void;
|
|
209
|
+
/**
|
|
210
|
+
* Move this block during a drag, taking into account whether we are using a
|
|
211
|
+
* drag surface to translate blocks.
|
|
180
212
|
* This block must be a top-level block.
|
|
181
213
|
*
|
|
182
214
|
* @param newLoc The location to translate to, in workspace coordinates.
|
|
@@ -306,6 +338,11 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
|
|
|
306
338
|
* @suppress {checkTypes}
|
|
307
339
|
*/
|
|
308
340
|
dispose(healStack?: boolean, animate?: boolean): void;
|
|
341
|
+
/**
|
|
342
|
+
* Disposes of this block without doing things required by the top block.
|
|
343
|
+
* E.g. does trigger UI effects, remove nodes, etc.
|
|
344
|
+
*/
|
|
345
|
+
disposeInternal(): void;
|
|
309
346
|
/**
|
|
310
347
|
* Delete a block and hide chaff when doing so. The block will not be deleted
|
|
311
348
|
* if it's in a flyout. This is called from the context menu and keyboard
|
|
@@ -495,7 +532,7 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
|
|
|
495
532
|
*
|
|
496
533
|
* @param all If true, return all connections even hidden ones.
|
|
497
534
|
* Otherwise, for a non-rendered block return an empty list, and for a
|
|
498
|
-
*
|
|
535
|
+
* collapsed block don't return inputs connections.
|
|
499
536
|
* @returns Array of connections.
|
|
500
537
|
* @internal
|
|
501
538
|
*/
|
|
@@ -586,20 +623,46 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
|
|
|
586
623
|
*/
|
|
587
624
|
getChildren(ordered: boolean): BlockSvg[];
|
|
588
625
|
/**
|
|
589
|
-
*
|
|
626
|
+
* Triggers a rerender after a delay to allow for batching.
|
|
627
|
+
*
|
|
628
|
+
* @internal
|
|
629
|
+
*/
|
|
630
|
+
queueRender(): void;
|
|
631
|
+
/**
|
|
632
|
+
* Immediately lays out and reflows a block based on its contents and
|
|
633
|
+
* settings.
|
|
590
634
|
*
|
|
591
635
|
* @param opt_bubble If false, just render this block.
|
|
592
636
|
* If true, also render block's parent, grandparent, etc. Defaults to true.
|
|
593
637
|
*/
|
|
594
638
|
render(opt_bubble?: boolean): void;
|
|
639
|
+
/**
|
|
640
|
+
* Renders this block in a way that's compatible with the more efficient
|
|
641
|
+
* render management system.
|
|
642
|
+
*
|
|
643
|
+
* @internal
|
|
644
|
+
*/
|
|
645
|
+
renderEfficiently(): void;
|
|
646
|
+
/**
|
|
647
|
+
* Tightens all children of this block so they are snuggly rendered against
|
|
648
|
+
* their parent connections.
|
|
649
|
+
*
|
|
650
|
+
* Does not update connection locations, so that they can be updated more
|
|
651
|
+
* efficiently by the render management system.
|
|
652
|
+
*
|
|
653
|
+
* @internal
|
|
654
|
+
*/
|
|
655
|
+
tightenChildrenEfficiently(): void;
|
|
595
656
|
/** Redraw any attached marker or cursor svgs if needed. */
|
|
596
657
|
protected updateMarkers_(): void;
|
|
597
658
|
/**
|
|
598
659
|
* Update all of the connections on this block with the new locations
|
|
599
660
|
* calculated during rendering. Also move all of the connected blocks based
|
|
600
661
|
* on the new connection locations.
|
|
662
|
+
*
|
|
663
|
+
* @internal
|
|
601
664
|
*/
|
|
602
|
-
|
|
665
|
+
updateConnectionLocations(): void;
|
|
603
666
|
/**
|
|
604
667
|
* Add the cursor SVG to this block's SVG group.
|
|
605
668
|
*
|