blockly 12.0.0-beta.5 → 12.0.0-beta.6
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 +391 -398
- package/blockly.mjs +1 -1
- package/blockly_compressed.js +390 -397
- package/blockly_compressed.js.map +1 -1
- package/blocks_compressed.js +1 -1
- package/blocks_compressed.js.map +1 -1
- package/core/block.d.ts +1 -16
- package/core/block_svg.d.ts +3 -31
- package/core/blockly.d.ts +4 -8
- package/core/bubbles/bubble.d.ts +22 -3
- package/core/bubbles/textinput_bubble.d.ts +3 -5
- package/core/comments/rendered_workspace_comment.d.ts +11 -0
- package/core/common.d.ts +19 -7
- package/core/connection.d.ts +1 -2
- package/core/contextmenu_registry.d.ts +1 -1
- package/core/events/events.d.ts +0 -2
- package/core/events/predicates.d.ts +0 -3
- package/core/events/utils.d.ts +1 -5
- package/core/field.d.ts +20 -20
- package/core/field_checkbox.d.ts +0 -9
- package/core/field_dropdown.d.ts +7 -10
- package/core/field_image.d.ts +0 -11
- package/core/field_input.d.ts +9 -0
- package/core/field_label.d.ts +0 -9
- package/core/field_number.d.ts +0 -9
- package/core/field_textinput.d.ts +0 -9
- package/core/field_variable.d.ts +0 -2
- package/core/flyout_base.d.ts +3 -1
- package/core/flyout_button.d.ts +3 -24
- package/core/flyout_item.d.ts +3 -3
- package/core/flyout_navigator.d.ts +11 -0
- package/core/flyout_separator.d.ts +13 -11
- package/core/focus_manager.d.ts +9 -5
- package/core/icons/comment_icon.d.ts +3 -0
- package/core/icons/icon.d.ts +13 -0
- package/core/icons/mutator_icon.d.ts +3 -0
- package/core/icons/warning_icon.d.ts +3 -0
- package/core/interfaces/i_bubble.d.ts +2 -1
- package/core/interfaces/i_focusable_node.d.ts +39 -5
- package/core/interfaces/i_has_bubble.d.ts +13 -0
- package/core/interfaces/i_icon.d.ts +2 -1
- package/core/interfaces/i_navigation_policy.d.ts +26 -5
- package/core/interfaces/i_selectable.d.ts +7 -1
- package/core/keyboard_nav/block_navigation_policy.d.ts +17 -14
- package/core/keyboard_nav/connection_navigation_policy.d.ts +20 -6
- package/core/keyboard_nav/field_navigation_policy.d.ts +20 -6
- package/core/keyboard_nav/flyout_button_navigation_policy.d.ts +20 -6
- package/core/keyboard_nav/flyout_navigation_policy.d.ts +19 -5
- package/core/keyboard_nav/flyout_separator_navigation_policy.d.ts +20 -6
- package/core/keyboard_nav/line_cursor.d.ts +14 -104
- package/core/keyboard_nav/marker.d.ts +7 -10
- package/core/keyboard_nav/workspace_navigation_policy.d.ts +20 -6
- package/core/layer_manager.d.ts +3 -2
- package/core/navigator.d.ts +12 -12
- package/core/rendered_connection.d.ts +3 -14
- package/core/toolbox/toolbox.d.ts +2 -0
- package/core/toolbox/toolbox_item.d.ts +2 -0
- package/core/utils/object.d.ts +3 -0
- package/core/variable_map.d.ts +7 -2
- package/core/workspace.d.ts +1 -2
- package/core/workspace_dragger.d.ts +5 -0
- package/core/workspace_svg.d.ts +10 -15
- package/index.mjs +1 -1
- package/package.json +1 -1
- package/core/events/events_marker_move.d.ts +0 -69
- package/core/interfaces/i_ast_node_location.d.ts +0 -11
- package/core/interfaces/i_ast_node_location_svg.d.ts +0 -12
- package/core/interfaces/i_ast_node_location_with_block.d.ts +0 -19
- package/core/interfaces/i_navigable.d.ts +0 -30
- package/core/keyboard_nav/ast_node.d.ts +0 -185
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import
|
|
7
|
-
import type {
|
|
6
|
+
import { FlyoutButton } from '../flyout_button.js';
|
|
7
|
+
import type { IFocusableNode } from '../interfaces/i_focusable_node.js';
|
|
8
8
|
import type { INavigationPolicy } from '../interfaces/i_navigation_policy.js';
|
|
9
9
|
/**
|
|
10
10
|
* Set of rules controlling keyboard navigation from a flyout button.
|
|
@@ -16,27 +16,41 @@ export declare class FlyoutButtonNavigationPolicy implements INavigationPolicy<F
|
|
|
16
16
|
* @param _current The FlyoutButton instance to navigate from.
|
|
17
17
|
* @returns Null.
|
|
18
18
|
*/
|
|
19
|
-
getFirstChild(_current: FlyoutButton):
|
|
19
|
+
getFirstChild(_current: FlyoutButton): IFocusableNode | null;
|
|
20
20
|
/**
|
|
21
21
|
* Returns the parent workspace of the given flyout button.
|
|
22
22
|
*
|
|
23
23
|
* @param current The FlyoutButton instance to navigate from.
|
|
24
24
|
* @returns The given flyout button's parent workspace.
|
|
25
25
|
*/
|
|
26
|
-
getParent(current: FlyoutButton):
|
|
26
|
+
getParent(current: FlyoutButton): IFocusableNode | null;
|
|
27
27
|
/**
|
|
28
28
|
* Returns null since inter-item navigation is done by FlyoutNavigationPolicy.
|
|
29
29
|
*
|
|
30
30
|
* @param _current The FlyoutButton instance to navigate from.
|
|
31
31
|
* @returns Null.
|
|
32
32
|
*/
|
|
33
|
-
getNextSibling(_current: FlyoutButton):
|
|
33
|
+
getNextSibling(_current: FlyoutButton): IFocusableNode | null;
|
|
34
34
|
/**
|
|
35
35
|
* Returns null since inter-item navigation is done by FlyoutNavigationPolicy.
|
|
36
36
|
*
|
|
37
37
|
* @param _current The FlyoutButton instance to navigate from.
|
|
38
38
|
* @returns Null.
|
|
39
39
|
*/
|
|
40
|
-
getPreviousSibling(_current: FlyoutButton):
|
|
40
|
+
getPreviousSibling(_current: FlyoutButton): IFocusableNode | null;
|
|
41
|
+
/**
|
|
42
|
+
* Returns whether or not the given flyout button can be navigated to.
|
|
43
|
+
*
|
|
44
|
+
* @param current The instance to check for navigability.
|
|
45
|
+
* @returns True if the given flyout button can be focused.
|
|
46
|
+
*/
|
|
47
|
+
isNavigable(current: FlyoutButton): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Returns whether the given object can be navigated from by this policy.
|
|
50
|
+
*
|
|
51
|
+
* @param current The object to check if this policy applies to.
|
|
52
|
+
* @returns True if the object is a FlyoutButton.
|
|
53
|
+
*/
|
|
54
|
+
isApplicable(current: any): current is FlyoutButton;
|
|
41
55
|
}
|
|
42
56
|
//# sourceMappingURL=flyout_button_navigation_policy.d.ts.map
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import type { IFlyout } from '../interfaces/i_flyout.js';
|
|
7
|
-
import type {
|
|
7
|
+
import type { IFocusableNode } from '../interfaces/i_focusable_node.js';
|
|
8
8
|
import type { INavigationPolicy } from '../interfaces/i_navigation_policy.js';
|
|
9
9
|
/**
|
|
10
10
|
* Generic navigation policy that navigates between items in the flyout.
|
|
@@ -25,27 +25,41 @@ export declare class FlyoutNavigationPolicy<T> implements INavigationPolicy<T> {
|
|
|
25
25
|
* @param _current The flyout item to navigate from.
|
|
26
26
|
* @returns Null to prevent navigating into flyout items.
|
|
27
27
|
*/
|
|
28
|
-
getFirstChild(_current: T):
|
|
28
|
+
getFirstChild(_current: T): IFocusableNode | null;
|
|
29
29
|
/**
|
|
30
30
|
* Returns the parent of the given flyout item.
|
|
31
31
|
*
|
|
32
32
|
* @param current The flyout item to navigate from.
|
|
33
33
|
* @returns The parent of the given flyout item.
|
|
34
34
|
*/
|
|
35
|
-
getParent(current: T):
|
|
35
|
+
getParent(current: T): IFocusableNode | null;
|
|
36
36
|
/**
|
|
37
37
|
* Returns the next item in the flyout relative to the given item.
|
|
38
38
|
*
|
|
39
39
|
* @param current The flyout item to navigate from.
|
|
40
40
|
* @returns The flyout item following the given one.
|
|
41
41
|
*/
|
|
42
|
-
getNextSibling(current: T):
|
|
42
|
+
getNextSibling(current: T): IFocusableNode | null;
|
|
43
43
|
/**
|
|
44
44
|
* Returns the previous item in the flyout relative to the given item.
|
|
45
45
|
*
|
|
46
46
|
* @param current The flyout item to navigate from.
|
|
47
47
|
* @returns The flyout item preceding the given one.
|
|
48
48
|
*/
|
|
49
|
-
getPreviousSibling(current: T):
|
|
49
|
+
getPreviousSibling(current: T): IFocusableNode | null;
|
|
50
|
+
/**
|
|
51
|
+
* Returns whether or not the given flyout item can be navigated to.
|
|
52
|
+
*
|
|
53
|
+
* @param current The instance to check for navigability.
|
|
54
|
+
* @returns True if the given flyout item can be focused.
|
|
55
|
+
*/
|
|
56
|
+
isNavigable(current: T): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Returns whether the given object can be navigated from by this policy.
|
|
59
|
+
*
|
|
60
|
+
* @param current The object to check if this policy applies to.
|
|
61
|
+
* @returns True if the object is a BlockSvg.
|
|
62
|
+
*/
|
|
63
|
+
isApplicable(current: any): current is T;
|
|
50
64
|
}
|
|
51
65
|
//# sourceMappingURL=flyout_navigation_policy.d.ts.map
|
|
@@ -3,17 +3,31 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import
|
|
7
|
-
import type {
|
|
6
|
+
import { FlyoutSeparator } from '../flyout_separator.js';
|
|
7
|
+
import type { IFocusableNode } from '../interfaces/i_focusable_node.js';
|
|
8
8
|
import type { INavigationPolicy } from '../interfaces/i_navigation_policy.js';
|
|
9
9
|
/**
|
|
10
10
|
* Set of rules controlling keyboard navigation from a flyout separator.
|
|
11
11
|
* This is a no-op placeholder, since flyout separators can't be navigated to.
|
|
12
12
|
*/
|
|
13
13
|
export declare class FlyoutSeparatorNavigationPolicy implements INavigationPolicy<FlyoutSeparator> {
|
|
14
|
-
getFirstChild(_current: FlyoutSeparator):
|
|
15
|
-
getParent(_current: FlyoutSeparator):
|
|
16
|
-
getNextSibling(_current: FlyoutSeparator):
|
|
17
|
-
getPreviousSibling(_current: FlyoutSeparator):
|
|
14
|
+
getFirstChild(_current: FlyoutSeparator): IFocusableNode | null;
|
|
15
|
+
getParent(_current: FlyoutSeparator): IFocusableNode | null;
|
|
16
|
+
getNextSibling(_current: FlyoutSeparator): IFocusableNode | null;
|
|
17
|
+
getPreviousSibling(_current: FlyoutSeparator): IFocusableNode | null;
|
|
18
|
+
/**
|
|
19
|
+
* Returns whether or not the given flyout separator can be navigated to.
|
|
20
|
+
*
|
|
21
|
+
* @param _current The instance to check for navigability.
|
|
22
|
+
* @returns False.
|
|
23
|
+
*/
|
|
24
|
+
isNavigable(_current: FlyoutSeparator): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Returns whether the given object can be navigated from by this policy.
|
|
27
|
+
*
|
|
28
|
+
* @param current The object to check if this policy applies to.
|
|
29
|
+
* @returns True if the object is a FlyoutSeparator.
|
|
30
|
+
*/
|
|
31
|
+
isApplicable(current: any): current is FlyoutSeparator;
|
|
18
32
|
}
|
|
19
33
|
//# sourceMappingURL=flyout_separator_navigation_policy.d.ts.map
|
|
@@ -12,39 +12,21 @@
|
|
|
12
12
|
* @author aschmiedt@google.com (Abby Schmiedt)
|
|
13
13
|
*/
|
|
14
14
|
import { BlockSvg } from '../block_svg.js';
|
|
15
|
-
import type {
|
|
15
|
+
import type { IFocusableNode } from '../interfaces/i_focusable_node.js';
|
|
16
16
|
import { WorkspaceSvg } from '../workspace_svg.js';
|
|
17
17
|
import { Marker } from './marker.js';
|
|
18
|
-
/** Options object for LineCursor instances. */
|
|
19
|
-
export interface CursorOptions {
|
|
20
|
-
/**
|
|
21
|
-
* Can the cursor visit all stack connections (next/previous), or
|
|
22
|
-
* (if false) only unconnected next connections?
|
|
23
|
-
*/
|
|
24
|
-
stackConnections: boolean;
|
|
25
|
-
}
|
|
26
18
|
/**
|
|
27
19
|
* Class for a line cursor.
|
|
28
20
|
*/
|
|
29
21
|
export declare class LineCursor extends Marker {
|
|
30
22
|
protected readonly workspace: WorkspaceSvg;
|
|
31
23
|
type: string;
|
|
32
|
-
/** Options for this line cursor. */
|
|
33
|
-
private readonly options;
|
|
34
24
|
/** Locations to try moving the cursor to after a deletion. */
|
|
35
25
|
private potentialNodes;
|
|
36
|
-
/** Whether the renderer is zelos-style. */
|
|
37
|
-
private isZelos;
|
|
38
26
|
/**
|
|
39
27
|
* @param workspace The workspace this cursor belongs to.
|
|
40
|
-
* @param options Cursor options.
|
|
41
28
|
*/
|
|
42
|
-
constructor(workspace: WorkspaceSvg
|
|
43
|
-
/**
|
|
44
|
-
* Registers default navigation policies for Blockly's built-in types with
|
|
45
|
-
* this cursor's workspace.
|
|
46
|
-
*/
|
|
47
|
-
protected registerNavigationPolicies(): void;
|
|
29
|
+
constructor(workspace: WorkspaceSvg);
|
|
48
30
|
/**
|
|
49
31
|
* Moves the cursor to the next previous connection, next connection or block
|
|
50
32
|
* in the pre order traversal. Finds the next node in the pre order traversal.
|
|
@@ -52,7 +34,7 @@ export declare class LineCursor extends Marker {
|
|
|
52
34
|
* @returns The next node, or null if the current node is
|
|
53
35
|
* not set or there is no next value.
|
|
54
36
|
*/
|
|
55
|
-
next():
|
|
37
|
+
next(): IFocusableNode | null;
|
|
56
38
|
/**
|
|
57
39
|
* Moves the cursor to the next input connection or field
|
|
58
40
|
* in the pre order traversal.
|
|
@@ -60,7 +42,7 @@ export declare class LineCursor extends Marker {
|
|
|
60
42
|
* @returns The next node, or null if the current node is
|
|
61
43
|
* not set or there is no next value.
|
|
62
44
|
*/
|
|
63
|
-
in():
|
|
45
|
+
in(): IFocusableNode | null;
|
|
64
46
|
/**
|
|
65
47
|
* Moves the cursor to the previous next connection or previous connection in
|
|
66
48
|
* the pre order traversal.
|
|
@@ -68,7 +50,7 @@ export declare class LineCursor extends Marker {
|
|
|
68
50
|
* @returns The previous node, or null if the current node
|
|
69
51
|
* is not set or there is no previous value.
|
|
70
52
|
*/
|
|
71
|
-
prev():
|
|
53
|
+
prev(): IFocusableNode | null;
|
|
72
54
|
/**
|
|
73
55
|
* Moves the cursor to the previous input connection or field in the pre order
|
|
74
56
|
* traversal.
|
|
@@ -76,61 +58,14 @@ export declare class LineCursor extends Marker {
|
|
|
76
58
|
* @returns The previous node, or null if the current node
|
|
77
59
|
* is not set or there is no previous value.
|
|
78
60
|
*/
|
|
79
|
-
out():
|
|
61
|
+
out(): IFocusableNode | null;
|
|
80
62
|
/**
|
|
81
63
|
* Returns true iff the node to which we would navigate if in() were
|
|
82
|
-
* called
|
|
83
|
-
* - in effect, if the LineCursor is at the end of the 'current
|
|
64
|
+
* called is the same as the node to which we would navigate if next() were
|
|
65
|
+
* called - in effect, if the LineCursor is at the end of the 'current
|
|
84
66
|
* line' of the program.
|
|
85
67
|
*/
|
|
86
68
|
atEndOfLine(): boolean;
|
|
87
|
-
/**
|
|
88
|
-
* Returns true iff the given node represents the "beginning of a
|
|
89
|
-
* new line of code" (and thus can be visited by pressing the
|
|
90
|
-
* up/down arrow keys). Specifically, if the node is for:
|
|
91
|
-
*
|
|
92
|
-
* - Any block that is not a value block.
|
|
93
|
-
* - A top-level value block (one that is unconnected).
|
|
94
|
-
* - An unconnected next statement input.
|
|
95
|
-
* - An unconnected 'next' connection - the "blank line at the end".
|
|
96
|
-
* This is to facilitate connecting additional blocks to a
|
|
97
|
-
* stack/substack.
|
|
98
|
-
*
|
|
99
|
-
* If options.stackConnections is true (the default) then allow the
|
|
100
|
-
* cursor to visit all (useful) stack connection by additionally
|
|
101
|
-
* returning true for:
|
|
102
|
-
*
|
|
103
|
-
* - Any next statement input
|
|
104
|
-
* - Any 'next' connection.
|
|
105
|
-
* - An unconnected previous statement input.
|
|
106
|
-
*
|
|
107
|
-
* @param node The AST node to check.
|
|
108
|
-
* @returns True if the node should be visited, false otherwise.
|
|
109
|
-
*/
|
|
110
|
-
protected validLineNode(node: INavigable<any> | null): boolean;
|
|
111
|
-
/**
|
|
112
|
-
* Returns true iff the given node can be visited by the cursor when
|
|
113
|
-
* using the left/right arrow keys. Specifically, if the node is
|
|
114
|
-
* any node for which validLineNode would return true, plus:
|
|
115
|
-
*
|
|
116
|
-
* - Any block.
|
|
117
|
-
* - Any field that is not a full block field.
|
|
118
|
-
* - Any unconnected next or input connection. This is to
|
|
119
|
-
* facilitate connecting additional blocks.
|
|
120
|
-
*
|
|
121
|
-
* @param node The AST node to check whether it is valid.
|
|
122
|
-
* @returns True if the node should be visited, false otherwise.
|
|
123
|
-
*/
|
|
124
|
-
protected validInLineNode(node: INavigable<any> | null): boolean;
|
|
125
|
-
/**
|
|
126
|
-
* Returns true iff the given node can be visited by the cursor.
|
|
127
|
-
* Specifically, if the node is any for which validInLineNode would
|
|
128
|
-
* return true, or if it is a workspace node.
|
|
129
|
-
*
|
|
130
|
-
* @param node The AST node to check whether it is valid.
|
|
131
|
-
* @returns True if the node should be visited, false otherwise.
|
|
132
|
-
*/
|
|
133
|
-
protected validNode(node: INavigable<any> | null): boolean;
|
|
134
69
|
/**
|
|
135
70
|
* Uses pre order traversal to navigate the Blockly AST. This will allow
|
|
136
71
|
* a user to easily navigate the entire Blockly AST without having to go in
|
|
@@ -153,7 +88,7 @@ export declare class LineCursor extends Marker {
|
|
|
153
88
|
* valid node was found.
|
|
154
89
|
* @returns The next node in the traversal.
|
|
155
90
|
*/
|
|
156
|
-
getNextNode(node:
|
|
91
|
+
getNextNode(node: IFocusableNode | null, isValid: (p1: IFocusableNode | null) => boolean, loop: boolean): IFocusableNode | null;
|
|
157
92
|
/**
|
|
158
93
|
* Reverses the pre order traversal in order to find the previous node. This
|
|
159
94
|
* will allow a user to easily navigate the entire Blockly AST without having
|
|
@@ -178,15 +113,7 @@ export declare class LineCursor extends Marker {
|
|
|
178
113
|
* @returns The previous node in the traversal or null if no previous node
|
|
179
114
|
* exists.
|
|
180
115
|
*/
|
|
181
|
-
getPreviousNode(node:
|
|
182
|
-
/**
|
|
183
|
-
* From the given node find either the next valid sibling or the parent's
|
|
184
|
-
* next sibling.
|
|
185
|
-
*
|
|
186
|
-
* @param node The current position in the AST.
|
|
187
|
-
* @returns The next sibling node, the parent's next sibling, or null.
|
|
188
|
-
*/
|
|
189
|
-
private findSiblingOrParentSibling;
|
|
116
|
+
getPreviousNode(node: IFocusableNode | null, isValid: (p1: IFocusableNode | null) => boolean, loop: boolean): IFocusableNode | null;
|
|
190
117
|
/**
|
|
191
118
|
* Get the right most child of a node.
|
|
192
119
|
*
|
|
@@ -234,7 +161,7 @@ export declare class LineCursor extends Marker {
|
|
|
234
161
|
*
|
|
235
162
|
* @returns The current field, connection, or block the cursor is on.
|
|
236
163
|
*/
|
|
237
|
-
getCurNode():
|
|
164
|
+
getCurNode(): IFocusableNode | null;
|
|
238
165
|
/**
|
|
239
166
|
* Set the location of the cursor and draw it.
|
|
240
167
|
*
|
|
@@ -243,35 +170,18 @@ export declare class LineCursor extends Marker {
|
|
|
243
170
|
*
|
|
244
171
|
* @param newNode The new location of the cursor.
|
|
245
172
|
*/
|
|
246
|
-
setCurNode(newNode:
|
|
247
|
-
/**
|
|
248
|
-
* Updates the current node to match the selection.
|
|
249
|
-
*
|
|
250
|
-
* Clears the current node if it's on a block but the selection is null.
|
|
251
|
-
* Sets the node to a block if selected for our workspace.
|
|
252
|
-
* For shadow blocks selections the parent is used by default (unless we're
|
|
253
|
-
* already on the shadow block via keyboard) as that's where the visual
|
|
254
|
-
* selection is.
|
|
255
|
-
*/
|
|
256
|
-
private updateCurNodeFromSelection;
|
|
257
|
-
/**
|
|
258
|
-
* Updates the current node to match what's currently focused.
|
|
259
|
-
*
|
|
260
|
-
* @returns Whether the current node has been set successfully from the
|
|
261
|
-
* current focused node.
|
|
262
|
-
*/
|
|
263
|
-
private updateCurNodeFromFocus;
|
|
173
|
+
setCurNode(newNode: IFocusableNode | null): void;
|
|
264
174
|
/**
|
|
265
175
|
* Get the first navigable node on the workspace, or null if none exist.
|
|
266
176
|
*
|
|
267
177
|
* @returns The first navigable node on the workspace, or null.
|
|
268
178
|
*/
|
|
269
|
-
getFirstNode():
|
|
179
|
+
getFirstNode(): IFocusableNode | null;
|
|
270
180
|
/**
|
|
271
181
|
* Get the last navigable node on the workspace, or null if none exist.
|
|
272
182
|
*
|
|
273
183
|
* @returns The last navigable node on the workspace, or null.
|
|
274
184
|
*/
|
|
275
|
-
getLastNode():
|
|
185
|
+
getLastNode(): IFocusableNode | null;
|
|
276
186
|
}
|
|
277
187
|
//# sourceMappingURL=line_cursor.d.ts.map
|
|
@@ -10,8 +10,7 @@
|
|
|
10
10
|
* @class
|
|
11
11
|
*/
|
|
12
12
|
import { BlockSvg } from '../block_svg.js';
|
|
13
|
-
import type {
|
|
14
|
-
import { ASTNode } from './ast_node.js';
|
|
13
|
+
import type { IFocusableNode } from '../interfaces/i_focusable_node.js';
|
|
15
14
|
/**
|
|
16
15
|
* Class for a marker.
|
|
17
16
|
* This is used in keyboard navigation to save a location in the Blockly AST.
|
|
@@ -20,7 +19,7 @@ export declare class Marker {
|
|
|
20
19
|
/** The colour of the marker. */
|
|
21
20
|
colour: string | null;
|
|
22
21
|
/** The current location of the marker. */
|
|
23
|
-
protected curNode:
|
|
22
|
+
protected curNode: IFocusableNode | null;
|
|
24
23
|
/** The type of the marker. */
|
|
25
24
|
type: string;
|
|
26
25
|
/**
|
|
@@ -28,23 +27,21 @@ export declare class Marker {
|
|
|
28
27
|
*
|
|
29
28
|
* @returns The current field, connection, or block the marker is on.
|
|
30
29
|
*/
|
|
31
|
-
getCurNode():
|
|
30
|
+
getCurNode(): IFocusableNode | null;
|
|
32
31
|
/**
|
|
33
32
|
* Set the location of the marker and call the update method.
|
|
34
33
|
*
|
|
35
34
|
* @param newNode The new location of the marker, or null to remove it.
|
|
36
35
|
*/
|
|
37
|
-
setCurNode(newNode:
|
|
36
|
+
setCurNode(newNode: IFocusableNode | null): void;
|
|
38
37
|
/** Dispose of this marker. */
|
|
39
38
|
dispose(): void;
|
|
40
39
|
/**
|
|
41
|
-
*
|
|
40
|
+
* Returns the block that the given node is a child of.
|
|
42
41
|
*
|
|
43
|
-
* @
|
|
44
|
-
* @returns An ASTNode representation of the given object if possible,
|
|
45
|
-
* otherwise null.
|
|
42
|
+
* @returns The parent block of the node if any, otherwise null.
|
|
46
43
|
*/
|
|
47
|
-
|
|
44
|
+
getSourceBlockFromNode(node: IFocusableNode | null): BlockSvg | null;
|
|
48
45
|
/**
|
|
49
46
|
* Returns the block that this marker's current node is a child of.
|
|
50
47
|
*
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import type {
|
|
6
|
+
import type { IFocusableNode } from '../interfaces/i_focusable_node.js';
|
|
7
7
|
import type { INavigationPolicy } from '../interfaces/i_navigation_policy.js';
|
|
8
|
-
import
|
|
8
|
+
import { WorkspaceSvg } from '../workspace_svg.js';
|
|
9
9
|
/**
|
|
10
10
|
* Set of rules controlling keyboard navigation from a workspace.
|
|
11
11
|
*/
|
|
@@ -16,27 +16,41 @@ export declare class WorkspaceNavigationPolicy implements INavigationPolicy<Work
|
|
|
16
16
|
* @param current The workspace to return the first child of.
|
|
17
17
|
* @returns The top block of the first block stack, if any.
|
|
18
18
|
*/
|
|
19
|
-
getFirstChild(current: WorkspaceSvg):
|
|
19
|
+
getFirstChild(current: WorkspaceSvg): IFocusableNode | null;
|
|
20
20
|
/**
|
|
21
21
|
* Returns the parent of the given workspace.
|
|
22
22
|
*
|
|
23
23
|
* @param _current The workspace to return the parent of.
|
|
24
24
|
* @returns Null.
|
|
25
25
|
*/
|
|
26
|
-
getParent(_current: WorkspaceSvg):
|
|
26
|
+
getParent(_current: WorkspaceSvg): IFocusableNode | null;
|
|
27
27
|
/**
|
|
28
28
|
* Returns the next sibling of the given workspace.
|
|
29
29
|
*
|
|
30
30
|
* @param _current The workspace to return the next sibling of.
|
|
31
31
|
* @returns Null.
|
|
32
32
|
*/
|
|
33
|
-
getNextSibling(_current: WorkspaceSvg):
|
|
33
|
+
getNextSibling(_current: WorkspaceSvg): IFocusableNode | null;
|
|
34
34
|
/**
|
|
35
35
|
* Returns the previous sibling of the given workspace.
|
|
36
36
|
*
|
|
37
37
|
* @param _current The workspace to return the previous sibling of.
|
|
38
38
|
* @returns Null.
|
|
39
39
|
*/
|
|
40
|
-
getPreviousSibling(_current: WorkspaceSvg):
|
|
40
|
+
getPreviousSibling(_current: WorkspaceSvg): IFocusableNode | null;
|
|
41
|
+
/**
|
|
42
|
+
* Returns whether or not the given workspace can be navigated to.
|
|
43
|
+
*
|
|
44
|
+
* @param current The instance to check for navigability.
|
|
45
|
+
* @returns True if the given workspace can be focused.
|
|
46
|
+
*/
|
|
47
|
+
isNavigable(current: WorkspaceSvg): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Returns whether the given object can be navigated from by this policy.
|
|
50
|
+
*
|
|
51
|
+
* @param current The object to check if this policy applies to.
|
|
52
|
+
* @returns True if the object is a WorkspaceSvg.
|
|
53
|
+
*/
|
|
54
|
+
isApplicable(current: any): current is WorkspaceSvg;
|
|
41
55
|
}
|
|
42
56
|
//# sourceMappingURL=workspace_navigation_policy.d.ts.map
|
package/core/layer_manager.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Copyright 2023 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
import type { IFocusableNode } from './interfaces/i_focusable_node.js';
|
|
6
7
|
import { IRenderedElement } from './interfaces/i_rendered_element.js';
|
|
7
8
|
import { Coordinate } from './utils/coordinate.js';
|
|
8
9
|
import { WorkspaceSvg } from './workspace_svg.js';
|
|
@@ -39,13 +40,13 @@ export declare class LayerManager {
|
|
|
39
40
|
*
|
|
40
41
|
* @internal
|
|
41
42
|
*/
|
|
42
|
-
moveToDragLayer(elem: IRenderedElement): void;
|
|
43
|
+
moveToDragLayer(elem: IRenderedElement & IFocusableNode): void;
|
|
43
44
|
/**
|
|
44
45
|
* Moves the given element off of the drag layer.
|
|
45
46
|
*
|
|
46
47
|
* @internal
|
|
47
48
|
*/
|
|
48
|
-
moveOffDragLayer(elem: IRenderedElement, layerNum: number): void;
|
|
49
|
+
moveOffDragLayer(elem: IRenderedElement & IFocusableNode, layerNum: number): void;
|
|
49
50
|
/**
|
|
50
51
|
* Appends the given element to a layer. If the layer does not exist, it is
|
|
51
52
|
* created.
|
package/core/navigator.d.ts
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import type {
|
|
6
|
+
import type { IFocusableNode } from './interfaces/i_focusable_node.js';
|
|
7
7
|
import type { INavigationPolicy } from './interfaces/i_navigation_policy.js';
|
|
8
|
+
type RuleList<T> = INavigationPolicy<T>[];
|
|
8
9
|
/**
|
|
9
10
|
* Class responsible for determining where focus should move in response to
|
|
10
11
|
* keyboard navigation commands.
|
|
@@ -14,21 +15,19 @@ export declare class Navigator {
|
|
|
14
15
|
* Map from classes to a corresponding ruleset to handle navigation from
|
|
15
16
|
* instances of that class.
|
|
16
17
|
*/
|
|
17
|
-
|
|
18
|
+
protected rules: RuleList<any>;
|
|
18
19
|
/**
|
|
19
|
-
*
|
|
20
|
+
* Adds a navigation ruleset to this Navigator.
|
|
20
21
|
*
|
|
21
|
-
* @param key The class whose object instances should have their navigation
|
|
22
|
-
* controlled by the associated policy.
|
|
23
22
|
* @param policy A ruleset that determines where focus should move starting
|
|
24
|
-
* from an instance of
|
|
23
|
+
* from an instance of its managed class.
|
|
25
24
|
*/
|
|
26
|
-
|
|
25
|
+
addNavigationPolicy(policy: INavigationPolicy<any>): void;
|
|
27
26
|
/**
|
|
28
27
|
* Returns the navigation ruleset associated with the given object instance's
|
|
29
28
|
* class.
|
|
30
29
|
*
|
|
31
|
-
* @param
|
|
30
|
+
* @param current An object to retrieve a navigation ruleset for.
|
|
32
31
|
* @returns The navigation ruleset of objects of the given object's class, or
|
|
33
32
|
* undefined if no ruleset has been registered for the object's class.
|
|
34
33
|
*/
|
|
@@ -39,27 +38,28 @@ export declare class Navigator {
|
|
|
39
38
|
* @param current The object to retrieve the first child of.
|
|
40
39
|
* @returns The first child node of the given object, if any.
|
|
41
40
|
*/
|
|
42
|
-
getFirstChild
|
|
41
|
+
getFirstChild(current: IFocusableNode): IFocusableNode | null;
|
|
43
42
|
/**
|
|
44
43
|
* Returns the parent of the given object instance, if any.
|
|
45
44
|
*
|
|
46
45
|
* @param current The object to retrieve the parent of.
|
|
47
46
|
* @returns The parent node of the given object, if any.
|
|
48
47
|
*/
|
|
49
|
-
getParent
|
|
48
|
+
getParent(current: IFocusableNode): IFocusableNode | null;
|
|
50
49
|
/**
|
|
51
50
|
* Returns the next sibling of the given object instance, if any.
|
|
52
51
|
*
|
|
53
52
|
* @param current The object to retrieve the next sibling node of.
|
|
54
53
|
* @returns The next sibling node of the given object, if any.
|
|
55
54
|
*/
|
|
56
|
-
getNextSibling
|
|
55
|
+
getNextSibling(current: IFocusableNode): IFocusableNode | null;
|
|
57
56
|
/**
|
|
58
57
|
* Returns the previous sibling of the given object instance, if any.
|
|
59
58
|
*
|
|
60
59
|
* @param current The object to retrieve the previous sibling node of.
|
|
61
60
|
* @returns The previous sibling node of the given object, if any.
|
|
62
61
|
*/
|
|
63
|
-
getPreviousSibling
|
|
62
|
+
getPreviousSibling(current: IFocusableNode): IFocusableNode | null;
|
|
64
63
|
}
|
|
64
|
+
export {};
|
|
65
65
|
//# sourceMappingURL=navigator.d.ts.map
|
|
@@ -14,12 +14,11 @@ import { Connection } from './connection.js';
|
|
|
14
14
|
import { IContextMenu } from './interfaces/i_contextmenu.js';
|
|
15
15
|
import type { IFocusableNode } from './interfaces/i_focusable_node.js';
|
|
16
16
|
import type { IFocusableTree } from './interfaces/i_focusable_tree.js';
|
|
17
|
-
import type { INavigable } from './interfaces/i_navigable.js';
|
|
18
17
|
import { Coordinate } from './utils/coordinate.js';
|
|
19
18
|
/**
|
|
20
19
|
* Class for a connection between blocks that may be rendered on screen.
|
|
21
20
|
*/
|
|
22
|
-
export declare class RenderedConnection extends Connection implements IContextMenu, IFocusableNode
|
|
21
|
+
export declare class RenderedConnection extends Connection implements IContextMenu, IFocusableNode {
|
|
23
22
|
sourceBlock_: BlockSvg;
|
|
24
23
|
private readonly db;
|
|
25
24
|
private readonly dbOpposite;
|
|
@@ -237,19 +236,9 @@ export declare class RenderedConnection extends Connection implements IContextMe
|
|
|
237
236
|
onNodeFocus(): void;
|
|
238
237
|
/** See IFocusableNode.onNodeBlur. */
|
|
239
238
|
onNodeBlur(): void;
|
|
239
|
+
/** See IFocusableNode.canBeFocused. */
|
|
240
|
+
canBeFocused(): boolean;
|
|
240
241
|
private findHighlightSvg;
|
|
241
|
-
/**
|
|
242
|
-
* Returns whether or not this connection is keyboard-navigable.
|
|
243
|
-
*
|
|
244
|
-
* @returns True.
|
|
245
|
-
*/
|
|
246
|
-
isNavigable(): boolean;
|
|
247
|
-
/**
|
|
248
|
-
* Returns this connection's class for keyboard navigation.
|
|
249
|
-
*
|
|
250
|
-
* @returns RenderedConnection.
|
|
251
|
-
*/
|
|
252
|
-
getClass(): typeof RenderedConnection;
|
|
253
242
|
}
|
|
254
243
|
export declare namespace RenderedConnection {
|
|
255
244
|
/**
|
|
@@ -399,6 +399,8 @@ export declare class Toolbox extends DeleteArea implements IAutoHideable, IKeybo
|
|
|
399
399
|
onNodeFocus(): void;
|
|
400
400
|
/** See IFocusableNode.onNodeBlur. */
|
|
401
401
|
onNodeBlur(): void;
|
|
402
|
+
/** See IFocusableNode.canBeFocused. */
|
|
403
|
+
canBeFocused(): boolean;
|
|
402
404
|
/** See IFocusableTree.getRootFocusableNode. */
|
|
403
405
|
getRootFocusableNode(): IFocusableNode;
|
|
404
406
|
/** See IFocusableTree.getRestoredFocusableNode. */
|
|
@@ -103,5 +103,7 @@ export declare class ToolboxItem implements IToolboxItem {
|
|
|
103
103
|
onNodeFocus(): void;
|
|
104
104
|
/** See IFocusableNode.onNodeBlur. */
|
|
105
105
|
onNodeBlur(): void;
|
|
106
|
+
/** See IFocusableNode.canBeFocused. */
|
|
107
|
+
canBeFocused(): boolean;
|
|
106
108
|
}
|
|
107
109
|
//# sourceMappingURL=toolbox_item.d.ts.map
|
package/core/utils/object.d.ts
CHANGED
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* Complete a deep merge of all members of a source object with a target object.
|
|
8
8
|
*
|
|
9
|
+
* N.B. This is not a very sophisticated merge algorithm and does not
|
|
10
|
+
* handle complex cases. Use with caution.
|
|
11
|
+
*
|
|
9
12
|
* @param target Target.
|
|
10
13
|
* @param source Source.
|
|
11
14
|
* @returns The resulting object.
|
package/core/variable_map.d.ts
CHANGED
|
@@ -21,14 +21,19 @@ import type { Workspace } from './workspace.js';
|
|
|
21
21
|
*/
|
|
22
22
|
export declare class VariableMap implements IVariableMap<IVariableModel<IVariableState>> {
|
|
23
23
|
workspace: Workspace;
|
|
24
|
+
potentialMap: boolean;
|
|
24
25
|
/**
|
|
25
26
|
* A map from variable type to map of IDs to variables. The maps contain
|
|
26
27
|
* all of the named variables in the workspace, including variables that are
|
|
27
28
|
* not currently in use.
|
|
28
29
|
*/
|
|
29
30
|
private variableMap;
|
|
30
|
-
/**
|
|
31
|
-
|
|
31
|
+
/**
|
|
32
|
+
* @param workspace The workspace this map belongs to.
|
|
33
|
+
* @param potentialMap True if this holds variables that don't exist in the
|
|
34
|
+
* workspace yet.
|
|
35
|
+
*/
|
|
36
|
+
constructor(workspace: Workspace, potentialMap?: boolean);
|
|
32
37
|
/** Clear the variable map. Fires events for every deletion. */
|
|
33
38
|
clear(): void;
|
|
34
39
|
/**
|
package/core/workspace.d.ts
CHANGED
|
@@ -13,7 +13,6 @@ import type { Block } from './block.js';
|
|
|
13
13
|
import { WorkspaceComment } from './comments/workspace_comment.js';
|
|
14
14
|
import type { ConnectionDB } from './connection_db.js';
|
|
15
15
|
import type { Abstract } from './events/events_abstract.js';
|
|
16
|
-
import type { IASTNodeLocation } from './interfaces/i_ast_node_location.js';
|
|
17
16
|
import type { IConnectionChecker } from './interfaces/i_connection_checker.js';
|
|
18
17
|
import { IProcedureMap } from './interfaces/i_procedure_map.js';
|
|
19
18
|
import type { IVariableMap } from './interfaces/i_variable_map.js';
|
|
@@ -24,7 +23,7 @@ import type * as toolbox from './utils/toolbox.js';
|
|
|
24
23
|
* Class for a workspace. This is a data structure that contains blocks.
|
|
25
24
|
* There is no UI, and can be created headlessly.
|
|
26
25
|
*/
|
|
27
|
-
export declare class Workspace
|
|
26
|
+
export declare class Workspace {
|
|
28
27
|
/**
|
|
29
28
|
* Angle away from the horizontal to sweep for blocks. Order of execution is
|
|
30
29
|
* generally top to bottom, but a small angle changes the scan to give a bit
|