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.
Files changed (70) hide show
  1. package/blockly.min.js +391 -398
  2. package/blockly.mjs +1 -1
  3. package/blockly_compressed.js +390 -397
  4. package/blockly_compressed.js.map +1 -1
  5. package/blocks_compressed.js +1 -1
  6. package/blocks_compressed.js.map +1 -1
  7. package/core/block.d.ts +1 -16
  8. package/core/block_svg.d.ts +3 -31
  9. package/core/blockly.d.ts +4 -8
  10. package/core/bubbles/bubble.d.ts +22 -3
  11. package/core/bubbles/textinput_bubble.d.ts +3 -5
  12. package/core/comments/rendered_workspace_comment.d.ts +11 -0
  13. package/core/common.d.ts +19 -7
  14. package/core/connection.d.ts +1 -2
  15. package/core/contextmenu_registry.d.ts +1 -1
  16. package/core/events/events.d.ts +0 -2
  17. package/core/events/predicates.d.ts +0 -3
  18. package/core/events/utils.d.ts +1 -5
  19. package/core/field.d.ts +20 -20
  20. package/core/field_checkbox.d.ts +0 -9
  21. package/core/field_dropdown.d.ts +7 -10
  22. package/core/field_image.d.ts +0 -11
  23. package/core/field_input.d.ts +9 -0
  24. package/core/field_label.d.ts +0 -9
  25. package/core/field_number.d.ts +0 -9
  26. package/core/field_textinput.d.ts +0 -9
  27. package/core/field_variable.d.ts +0 -2
  28. package/core/flyout_base.d.ts +3 -1
  29. package/core/flyout_button.d.ts +3 -24
  30. package/core/flyout_item.d.ts +3 -3
  31. package/core/flyout_navigator.d.ts +11 -0
  32. package/core/flyout_separator.d.ts +13 -11
  33. package/core/focus_manager.d.ts +9 -5
  34. package/core/icons/comment_icon.d.ts +3 -0
  35. package/core/icons/icon.d.ts +13 -0
  36. package/core/icons/mutator_icon.d.ts +3 -0
  37. package/core/icons/warning_icon.d.ts +3 -0
  38. package/core/interfaces/i_bubble.d.ts +2 -1
  39. package/core/interfaces/i_focusable_node.d.ts +39 -5
  40. package/core/interfaces/i_has_bubble.d.ts +13 -0
  41. package/core/interfaces/i_icon.d.ts +2 -1
  42. package/core/interfaces/i_navigation_policy.d.ts +26 -5
  43. package/core/interfaces/i_selectable.d.ts +7 -1
  44. package/core/keyboard_nav/block_navigation_policy.d.ts +17 -14
  45. package/core/keyboard_nav/connection_navigation_policy.d.ts +20 -6
  46. package/core/keyboard_nav/field_navigation_policy.d.ts +20 -6
  47. package/core/keyboard_nav/flyout_button_navigation_policy.d.ts +20 -6
  48. package/core/keyboard_nav/flyout_navigation_policy.d.ts +19 -5
  49. package/core/keyboard_nav/flyout_separator_navigation_policy.d.ts +20 -6
  50. package/core/keyboard_nav/line_cursor.d.ts +14 -104
  51. package/core/keyboard_nav/marker.d.ts +7 -10
  52. package/core/keyboard_nav/workspace_navigation_policy.d.ts +20 -6
  53. package/core/layer_manager.d.ts +3 -2
  54. package/core/navigator.d.ts +12 -12
  55. package/core/rendered_connection.d.ts +3 -14
  56. package/core/toolbox/toolbox.d.ts +2 -0
  57. package/core/toolbox/toolbox_item.d.ts +2 -0
  58. package/core/utils/object.d.ts +3 -0
  59. package/core/variable_map.d.ts +7 -2
  60. package/core/workspace.d.ts +1 -2
  61. package/core/workspace_dragger.d.ts +5 -0
  62. package/core/workspace_svg.d.ts +10 -15
  63. package/index.mjs +1 -1
  64. package/package.json +1 -1
  65. package/core/events/events_marker_move.d.ts +0 -69
  66. package/core/interfaces/i_ast_node_location.d.ts +0 -11
  67. package/core/interfaces/i_ast_node_location_svg.d.ts +0 -12
  68. package/core/interfaces/i_ast_node_location_with_block.d.ts +0 -19
  69. package/core/interfaces/i_navigable.d.ts +0 -30
  70. package/core/keyboard_nav/ast_node.d.ts +0 -185
@@ -3,6 +3,11 @@
3
3
  * Copyright 2017 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /**
7
+ * Methods for dragging a workspace visually.
8
+ *
9
+ * @class
10
+ */
6
11
  import { Coordinate } from './utils/coordinate.js';
7
12
  import type { WorkspaceSvg } from './workspace_svg.js';
8
13
  /**
@@ -20,7 +20,6 @@ import { ContextMenuOption } from './contextmenu_registry.js';
20
20
  import type { FlyoutButton } from './flyout_button.js';
21
21
  import { Gesture } from './gesture.js';
22
22
  import { Grid } from './grid.js';
23
- import type { IASTNodeLocationSvg } from './interfaces/i_ast_node_location_svg.js';
24
23
  import type { IBoundedElement } from './interfaces/i_bounded_element.js';
25
24
  import { IContextMenu } from './interfaces/i_contextmenu.js';
26
25
  import type { IDragTarget } from './interfaces/i_drag_target.js';
@@ -28,7 +27,6 @@ import type { IFlyout } from './interfaces/i_flyout.js';
28
27
  import { type IFocusableNode } from './interfaces/i_focusable_node.js';
29
28
  import type { IFocusableTree } from './interfaces/i_focusable_tree.js';
30
29
  import type { IMetricsManager } from './interfaces/i_metrics_manager.js';
31
- import type { INavigable } from './interfaces/i_navigable.js';
32
30
  import type { IToolbox } from './interfaces/i_toolbox.js';
33
31
  import type { LineCursor } from './keyboard_nav/line_cursor.js';
34
32
  import type { Marker } from './keyboard_nav/marker.js';
@@ -54,7 +52,7 @@ import { ZoomControls } from './zoom_controls.js';
54
52
  * Class for a workspace. This is an onscreen area with optional trashcan,
55
53
  * scrollbars, bubbles, and dragging.
56
54
  */
57
- export declare class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg, IContextMenu, IFocusableNode, IFocusableTree, INavigable<WorkspaceSvg> {
55
+ export declare class WorkspaceSvg extends Workspace implements IContextMenu, IFocusableNode, IFocusableTree {
58
56
  /**
59
57
  * A wrapper function called when a resize event occurs.
60
58
  * You can pass the result to `eventHandling.unbind`.
@@ -1043,6 +1041,8 @@ export declare class WorkspaceSvg extends Workspace implements IASTNodeLocationS
1043
1041
  onNodeFocus(): void;
1044
1042
  /** See IFocusableNode.onNodeBlur. */
1045
1043
  onNodeBlur(): void;
1044
+ /** See IFocusableNode.canBeFocused. */
1045
+ canBeFocused(): boolean;
1046
1046
  /** See IFocusableTree.getRootFocusableNode. */
1047
1047
  getRootFocusableNode(): IFocusableNode;
1048
1048
  /** See IFocusableTree.getRestoredFocusableNode. */
@@ -1055,18 +1055,6 @@ export declare class WorkspaceSvg extends Workspace implements IASTNodeLocationS
1055
1055
  onTreeFocus(_node: IFocusableNode, _previousTree: IFocusableTree | null): void;
1056
1056
  /** See IFocusableTree.onTreeBlur. */
1057
1057
  onTreeBlur(nextTree: IFocusableTree | null): void;
1058
- /**
1059
- * Returns the class of this workspace.
1060
- *
1061
- * @returns WorkspaceSvg.
1062
- */
1063
- getClass(): typeof WorkspaceSvg;
1064
- /**
1065
- * Returns whether or not this workspace is keyboard-navigable.
1066
- *
1067
- * @returns True.
1068
- */
1069
- isNavigable(): boolean;
1070
1058
  /**
1071
1059
  * Returns an object responsible for coordinating movement of focus between
1072
1060
  * items on this workspace in response to keyboard navigation commands.
@@ -1074,6 +1062,13 @@ export declare class WorkspaceSvg extends Workspace implements IASTNodeLocationS
1074
1062
  * @returns This workspace's Navigator instance.
1075
1063
  */
1076
1064
  getNavigator(): Navigator;
1065
+ /**
1066
+ * Sets the Navigator instance used by this workspace.
1067
+ *
1068
+ * @param newNavigator A Navigator object to coordinate movement between
1069
+ * elements on the workspace.
1070
+ */
1071
+ setNavigator(newNavigator: Navigator): void;
1077
1072
  }
1078
1073
  /**
1079
1074
  * Size the workspace when the contents change. This also updates
package/index.mjs CHANGED
@@ -1,6 +1,5 @@
1
1
  import Blockly from './index.js';
2
2
  export const {
3
- ASTNode,
4
3
  Block,
5
4
  BlockFlyoutInflater,
6
5
  BlockNavigationPolicy,
@@ -44,6 +43,7 @@ export const {
44
43
  FlyoutItem,
45
44
  FlyoutMetricsManager,
46
45
  FlyoutNavigationPolicy,
46
+ FlyoutNavigator,
47
47
  FlyoutSeparator,
48
48
  FlyoutSeparatorNavigationPolicy,
49
49
  FocusManager,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blockly",
3
- "version": "12.0.0-beta.5",
3
+ "version": "12.0.0-beta.6",
4
4
  "description": "Blockly is a library for building visual programming editors.",
5
5
  "keywords": [
6
6
  "blockly"
@@ -1,69 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2020 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- /**
7
- * Events fired as a result of a marker move.
8
- *
9
- * @class
10
- */
11
- import type { Block } from '../block.js';
12
- import { ASTNode } from '../keyboard_nav/ast_node.js';
13
- import type { Workspace } from '../workspace.js';
14
- import { AbstractEventJson } from './events_abstract.js';
15
- import { UiBase } from './events_ui_base.js';
16
- import { EventType } from './type.js';
17
- /**
18
- * Notifies listeners that a marker (used for keyboard navigation) has
19
- * moved.
20
- */
21
- export declare class MarkerMove extends UiBase {
22
- /** The ID of the block the marker is now on, if any. */
23
- blockId?: string;
24
- /** The old node the marker used to be on, if any. */
25
- oldNode?: ASTNode;
26
- /** The new node the marker is now on. */
27
- newNode?: ASTNode;
28
- /**
29
- * True if this is a cursor event, false otherwise.
30
- * For information about cursors vs markers see {@link
31
- * https://blocklycodelabs.dev/codelabs/keyboard-navigation/index.html?index=..%2F..index#1}.
32
- */
33
- isCursor?: boolean;
34
- type: EventType;
35
- /**
36
- * @param opt_block The affected block. Null if current node is of type
37
- * workspace. Undefined for a blank event.
38
- * @param isCursor Whether this is a cursor event. Undefined for a blank
39
- * event.
40
- * @param opt_oldNode The old node the marker used to be on.
41
- * Undefined for a blank event.
42
- * @param opt_newNode The new node the marker is now on.
43
- * Undefined for a blank event.
44
- */
45
- constructor(opt_block?: Block | null, isCursor?: boolean, opt_oldNode?: ASTNode | null, opt_newNode?: ASTNode);
46
- /**
47
- * Encode the event as JSON.
48
- *
49
- * @returns JSON representation.
50
- */
51
- toJson(): MarkerMoveJson;
52
- /**
53
- * Deserializes the JSON event.
54
- *
55
- * @param event The event to append new properties to. Should be a subclass
56
- * of MarkerMove, but we can't specify that due to the fact that
57
- * parameters to static methods in subclasses must be supertypes of
58
- * parameters to static methods in superclasses.
59
- * @internal
60
- */
61
- static fromJson(json: MarkerMoveJson, workspace: Workspace, event?: any): MarkerMove;
62
- }
63
- export interface MarkerMoveJson extends AbstractEventJson {
64
- isCursor: boolean;
65
- blockId?: string;
66
- oldNode?: ASTNode;
67
- newNode: ASTNode;
68
- }
69
- //# sourceMappingURL=events_marker_move.d.ts.map
@@ -1,11 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2020 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- /**
7
- * An AST node location interface.
8
- */
9
- export interface IASTNodeLocation {
10
- }
11
- //# sourceMappingURL=i_ast_node_location.d.ts.map
@@ -1,12 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2020 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import type { IASTNodeLocation } from './i_ast_node_location.js';
7
- /**
8
- * An AST node location SVG interface.
9
- */
10
- export interface IASTNodeLocationSvg extends IASTNodeLocation {
11
- }
12
- //# sourceMappingURL=i_ast_node_location_svg.d.ts.map
@@ -1,19 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2020 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import type { Block } from '../block.js';
7
- import type { IASTNodeLocation } from './i_ast_node_location.js';
8
- /**
9
- * An AST node location that has an associated block.
10
- */
11
- export interface IASTNodeLocationWithBlock extends IASTNodeLocation {
12
- /**
13
- * Get the source block associated with this node.
14
- *
15
- * @returns The source block.
16
- */
17
- getSourceBlock(): Block | null;
18
- }
19
- //# sourceMappingURL=i_ast_node_location_with_block.d.ts.map
@@ -1,30 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- /**
7
- * Represents a UI element which can be navigated to using the keyboard.
8
- */
9
- export interface INavigable<T> {
10
- /**
11
- * Returns whether or not this specific instance should be reachable via
12
- * keyboard navigation.
13
- *
14
- * Implementors should generally return true, unless there are circumstances
15
- * under which this item should be skipped while using keyboard navigation.
16
- * Common examples might include being disabled, invalid, readonly, or purely
17
- * a visual decoration. For example, while Fields are navigable, non-editable
18
- * fields return false, since they cannot be interacted with when focused.
19
- *
20
- * @returns True if this element should be included in keyboard navigation.
21
- */
22
- isNavigable(): boolean;
23
- /**
24
- * Returns the class of this instance.
25
- *
26
- * @returns This object's class.
27
- */
28
- getClass(): new (...args: any) => T;
29
- }
30
- //# sourceMappingURL=i_navigable.d.ts.map
@@ -1,185 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2019 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- /**
7
- * The class representing an AST node.
8
- * Used to traverse the Blockly AST.
9
- *
10
- * @class
11
- */
12
- import { Block } from '../block.js';
13
- import type { Connection } from '../connection.js';
14
- import type { Field } from '../field.js';
15
- import { FlyoutButton } from '../flyout_button.js';
16
- import type { Input } from '../inputs/input.js';
17
- import type { IASTNodeLocation } from '../interfaces/i_ast_node_location.js';
18
- import { Coordinate } from '../utils/coordinate.js';
19
- import type { Workspace } from '../workspace.js';
20
- /**
21
- * Class for an AST node.
22
- * It is recommended that you use one of the createNode methods instead of
23
- * creating a node directly.
24
- */
25
- export declare class ASTNode {
26
- /**
27
- * True to navigate to all fields. False to only navigate to clickable fields.
28
- */
29
- static NAVIGATE_ALL_FIELDS: boolean;
30
- /**
31
- * The default y offset to use when moving the cursor from a stack to the
32
- * workspace.
33
- */
34
- private static readonly DEFAULT_OFFSET_Y;
35
- private readonly type;
36
- private readonly isConnectionLocation;
37
- private readonly location;
38
- /** The coordinate on the workspace. */
39
- private wsCoordinate;
40
- /**
41
- * @param type The type of the location.
42
- * Must be in ASTNode.types.
43
- * @param location The position in the AST.
44
- * @param opt_params Optional dictionary of options.
45
- */
46
- constructor(type: string, location: IASTNodeLocation, opt_params?: Params);
47
- /**
48
- * Parse the optional parameters.
49
- *
50
- * @param params The user specified parameters.
51
- */
52
- private processParams;
53
- /**
54
- * Gets the value pointed to by this node.
55
- * It is the callers responsibility to check the node type to figure out what
56
- * type of object they get back from this.
57
- *
58
- * @returns The current field, connection, workspace, or block the cursor is
59
- * on.
60
- */
61
- getLocation(): IASTNodeLocation;
62
- /**
63
- * The type of the current location.
64
- * One of ASTNode.types
65
- *
66
- * @returns The type of the location.
67
- */
68
- getType(): string;
69
- /**
70
- * The coordinate on the workspace.
71
- *
72
- * @returns The workspace coordinate or null if the location is not a
73
- * workspace.
74
- */
75
- getWsCoordinate(): Coordinate | null;
76
- /**
77
- * Whether the node points to a connection.
78
- *
79
- * @returns [description]
80
- * @internal
81
- */
82
- isConnection(): boolean;
83
- private getVisibleInputs;
84
- /**
85
- * Finds the source block of the location of this node.
86
- *
87
- * @returns The source block of the location, or null if the node is of type
88
- * workspace or button.
89
- */
90
- getSourceBlock(): Block | null;
91
- /**
92
- * Whether an AST node of the given type points to a connection.
93
- *
94
- * @param type The type to check. One of ASTNode.types.
95
- * @returns True if a node of the given type points to a connection.
96
- */
97
- private static isConnectionType;
98
- /**
99
- * Create an AST node pointing to a field.
100
- *
101
- * @param field The location of the AST node.
102
- * @returns An AST node pointing to a field.
103
- */
104
- static createFieldNode(field: Field): ASTNode;
105
- /**
106
- * Creates an AST node pointing to a connection. If the connection has a
107
- * parent input then create an AST node of type input that will hold the
108
- * connection.
109
- *
110
- * @param connection This is the connection the node will point to.
111
- * @returns An AST node pointing to a connection.
112
- */
113
- static createConnectionNode(connection: Connection): ASTNode | null;
114
- /**
115
- * Creates an AST node pointing to an input. Stores the input connection as
116
- * the location.
117
- *
118
- * @param input The input used to create an AST node.
119
- * @returns An AST node pointing to a input.
120
- */
121
- static createInputNode(input: Input): ASTNode | null;
122
- /**
123
- * Creates an AST node pointing to a block.
124
- *
125
- * @param block The block used to create an AST node.
126
- * @returns An AST node pointing to a block.
127
- */
128
- static createBlockNode(block: Block): ASTNode;
129
- /**
130
- * Create an AST node of type stack. A stack, represented by its top block, is
131
- * the set of all blocks connected to a top block, including the top
132
- * block.
133
- *
134
- * @param topBlock A top block has no parent and can be found in the list
135
- * returned by workspace.getTopBlocks().
136
- * @returns An AST node of type stack that points to the top block on the
137
- * stack.
138
- */
139
- static createStackNode(topBlock: Block): ASTNode;
140
- /**
141
- * Create an AST node of type button. A button in this case refers
142
- * specifically to a button in a flyout.
143
- *
144
- * @param button A top block has no parent and can be found in the list
145
- * returned by workspace.getTopBlocks().
146
- * @returns An AST node of type stack that points to the top block on the
147
- * stack.
148
- */
149
- static createButtonNode(button: FlyoutButton): ASTNode;
150
- /**
151
- * Creates an AST node pointing to a workspace.
152
- *
153
- * @param workspace The workspace that we are on.
154
- * @param wsCoordinate The position on the workspace for this node.
155
- * @returns An AST node pointing to a workspace and a position on the
156
- * workspace.
157
- */
158
- static createWorkspaceNode(workspace: Workspace, wsCoordinate: Coordinate): ASTNode;
159
- /**
160
- * Creates an AST node for the top position on a block.
161
- * This is either an output connection, previous connection, or block.
162
- *
163
- * @param block The block to find the top most AST node on.
164
- * @returns The AST node holding the top most position on the block.
165
- */
166
- static createTopNode(block: Block): ASTNode | null;
167
- }
168
- export declare namespace ASTNode {
169
- interface Params {
170
- wsCoordinate: Coordinate;
171
- }
172
- enum types {
173
- FIELD = "field",
174
- BLOCK = "block",
175
- INPUT = "input",
176
- OUTPUT = "output",
177
- NEXT = "next",
178
- PREVIOUS = "previous",
179
- STACK = "stack",
180
- WORKSPACE = "workspace",
181
- BUTTON = "button"
182
- }
183
- }
184
- export type Params = ASTNode.Params;
185
- //# sourceMappingURL=ast_node.d.ts.map