blockly 12.0.0-beta.1 → 12.0.0-beta.3
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 +297 -276
- package/blockly.mjs +3 -3
- package/blockly_compressed.js +282 -261
- package/blockly_compressed.js.map +1 -1
- package/core/block_flyout_inflater.d.ts +5 -6
- package/core/block_svg.d.ts +0 -8
- package/core/blockly.d.ts +6 -5
- package/core/bubbles/text_bubble.d.ts +5 -5
- package/core/button_flyout_inflater.d.ts +3 -3
- package/core/comments/comment_view.d.ts +3 -3
- package/core/contextmenu_registry.d.ts +51 -11
- package/core/dragging/block_drag_strategy.d.ts +14 -2
- package/core/dragging/bubble_drag_strategy.d.ts +0 -2
- package/core/dragging/comment_drag_strategy.d.ts +0 -2
- package/core/field.d.ts +3 -9
- package/core/field_dropdown.d.ts +7 -9
- package/core/field_input.d.ts +1 -7
- package/core/field_variable.d.ts +3 -3
- package/core/focus_manager.d.ts +163 -0
- package/core/interfaces/i_flyout_inflater.d.ts +3 -3
- package/core/interfaces/i_focusable_node.d.ts +37 -0
- package/core/interfaces/i_focusable_tree.d.ts +58 -0
- package/core/keyboard_nav/ast_node.d.ts +6 -6
- package/core/keyboard_nav/line_cursor.d.ts +313 -0
- package/core/keyboard_nav/marker.d.ts +4 -8
- package/core/label_flyout_inflater.d.ts +3 -3
- package/core/marker_manager.d.ts +3 -3
- package/core/menu.d.ts +29 -23
- package/core/menu_separator.d.ts +25 -0
- package/core/menuitem.d.ts +7 -0
- package/core/registry.d.ts +2 -2
- package/core/renderers/common/marker_svg.d.ts +2 -2
- package/core/renderers/zelos/path_object.d.ts +2 -1
- package/core/separator_flyout_inflater.d.ts +3 -3
- package/core/utils/aria.d.ts +2 -1
- package/core/utils/focusable_tree_traverser.d.ts +53 -0
- package/core/utils/toolbox.d.ts +0 -2
- package/core/workspace.d.ts +13 -1
- package/core/workspace_svg.d.ts +16 -2
- package/dart_compressed.js +1 -1
- package/dart_compressed.js.map +1 -1
- package/index.mjs +3 -3
- package/javascript_compressed.js +15 -15
- package/javascript_compressed.js.map +1 -1
- package/lua_compressed.js +1 -1
- package/lua_compressed.js.map +1 -1
- package/package.json +2 -2
- package/php_compressed.js +1 -1
- package/php_compressed.js.map +1 -1
- package/python_compressed.js +3 -3
- package/python_compressed.js.map +1 -1
- package/core/keyboard_nav/basic_cursor.d.ts +0 -96
- package/core/keyboard_nav/cursor.d.ts +0 -44
- package/core/keyboard_nav/tab_navigate_cursor.d.ts +0 -20
package/core/menuitem.d.ts
CHANGED
|
@@ -95,6 +95,13 @@ export declare class MenuItem {
|
|
|
95
95
|
* @internal
|
|
96
96
|
*/
|
|
97
97
|
setChecked(checked: boolean): void;
|
|
98
|
+
/**
|
|
99
|
+
* Highlights or unhighlights the component.
|
|
100
|
+
*
|
|
101
|
+
* @param highlight Whether to highlight or unhighlight the component.
|
|
102
|
+
* @internal
|
|
103
|
+
*/
|
|
104
|
+
setHighlighted(highlight: boolean): void;
|
|
98
105
|
/**
|
|
99
106
|
* Returns true if the menu item is enabled, false otherwise.
|
|
100
107
|
*
|
package/core/registry.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ import type { ISerializer } from './interfaces/i_serializer.js';
|
|
|
19
19
|
import type { IToolbox } from './interfaces/i_toolbox.js';
|
|
20
20
|
import type { IVariableMap } from './interfaces/i_variable_map.js';
|
|
21
21
|
import type { IVariableModel, IVariableModelStatic, IVariableState } from './interfaces/i_variable_model.js';
|
|
22
|
-
import type {
|
|
22
|
+
import type { LineCursor } from './keyboard_nav/line_cursor.js';
|
|
23
23
|
import type { Options } from './options.js';
|
|
24
24
|
import type { Renderer } from './renderers/common/renderer.js';
|
|
25
25
|
import type { Theme } from './theme.js';
|
|
@@ -50,7 +50,7 @@ export declare class Type<_T> {
|
|
|
50
50
|
toString(): string;
|
|
51
51
|
static CONNECTION_CHECKER: Type<IConnectionChecker>;
|
|
52
52
|
static CONNECTION_PREVIEWER: Type<IConnectionPreviewer>;
|
|
53
|
-
static CURSOR: Type<
|
|
53
|
+
static CURSOR: Type<LineCursor>;
|
|
54
54
|
static EVENT: Type<Abstract>;
|
|
55
55
|
static FIELD: Type<Field<any>>;
|
|
56
56
|
static INPUT: Type<Input>;
|
|
@@ -78,7 +78,7 @@ export declare class MarkerSvg {
|
|
|
78
78
|
* @param oldNode The previous node the marker was on or null.
|
|
79
79
|
* @param curNode The node that we want to draw the marker for.
|
|
80
80
|
*/
|
|
81
|
-
draw(oldNode: ASTNode, curNode: ASTNode): void;
|
|
81
|
+
draw(oldNode: ASTNode | null, curNode: ASTNode | null): void;
|
|
82
82
|
/**
|
|
83
83
|
* Update the marker's visible state based on the type of curNode..
|
|
84
84
|
*
|
|
@@ -229,7 +229,7 @@ export declare class MarkerSvg {
|
|
|
229
229
|
* @param oldNode The old node the marker used to be on.
|
|
230
230
|
* @param curNode The new node the marker is currently on.
|
|
231
231
|
*/
|
|
232
|
-
protected fireMarkerEvent(oldNode: ASTNode, curNode: ASTNode): void;
|
|
232
|
+
protected fireMarkerEvent(oldNode: ASTNode | null, curNode: ASTNode): void;
|
|
233
233
|
/**
|
|
234
234
|
* Get the properties to make a marker blink.
|
|
235
235
|
*
|
|
@@ -61,10 +61,11 @@ export declare class PathObject extends BasePathObject {
|
|
|
61
61
|
/**
|
|
62
62
|
* Create's an outline path for the specified input.
|
|
63
63
|
*
|
|
64
|
+
* @internal
|
|
64
65
|
* @param name The input name.
|
|
65
66
|
* @returns The SVG outline path.
|
|
66
67
|
*/
|
|
67
|
-
|
|
68
|
+
getOutlinePath(name: string): SVGElement;
|
|
68
69
|
/**
|
|
69
70
|
* Remove an outline path that is associated with the specified input.
|
|
70
71
|
*
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { FlyoutItem } from './flyout_item.js';
|
|
7
|
+
import type { IFlyout } from './interfaces/i_flyout.js';
|
|
7
8
|
import type { IFlyoutInflater } from './interfaces/i_flyout_inflater.js';
|
|
8
|
-
import type { WorkspaceSvg } from './workspace_svg.js';
|
|
9
9
|
/**
|
|
10
10
|
* @internal
|
|
11
11
|
*/
|
|
@@ -29,10 +29,10 @@ export declare class SeparatorFlyoutInflater implements IFlyoutInflater {
|
|
|
29
29
|
* returned by gapForElement, which knows the default gap, unlike this method.
|
|
30
30
|
*
|
|
31
31
|
* @param _state A JSON representation of a flyout separator.
|
|
32
|
-
* @param
|
|
32
|
+
* @param flyout The flyout to create the separator for.
|
|
33
33
|
* @returns A newly created FlyoutSeparator.
|
|
34
34
|
*/
|
|
35
|
-
load(_state: object,
|
|
35
|
+
load(_state: object, flyout: IFlyout): FlyoutItem;
|
|
36
36
|
/**
|
|
37
37
|
* Returns the size of the separator. See `load` for more details.
|
|
38
38
|
*
|
package/core/utils/aria.d.ts
CHANGED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { IFocusableNode } from '../interfaces/i_focusable_node.js';
|
|
7
|
+
import type { IFocusableTree } from '../interfaces/i_focusable_tree.js';
|
|
8
|
+
/**
|
|
9
|
+
* A helper utility for IFocusableTree implementations to aid with common
|
|
10
|
+
* tree traversals.
|
|
11
|
+
*/
|
|
12
|
+
export declare class FocusableTreeTraverser {
|
|
13
|
+
private static readonly ACTIVE_CLASS_NAME;
|
|
14
|
+
private static readonly PASSIVE_CSS_CLASS_NAME;
|
|
15
|
+
private static readonly ACTIVE_FOCUS_NODE_CSS_SELECTOR;
|
|
16
|
+
private static readonly PASSIVE_FOCUS_NODE_CSS_SELECTOR;
|
|
17
|
+
/**
|
|
18
|
+
* Returns the current IFocusableNode that is styled (and thus represented) as
|
|
19
|
+
* having either passive or active focus, only considering HTML and SVG
|
|
20
|
+
* elements.
|
|
21
|
+
*
|
|
22
|
+
* This can match against the tree's root.
|
|
23
|
+
*
|
|
24
|
+
* Note that this will never return a node from a nested sub-tree as that tree
|
|
25
|
+
* should specifically be used to retrieve its focused node.
|
|
26
|
+
*
|
|
27
|
+
* @param tree The IFocusableTree in which to search for a focused node.
|
|
28
|
+
* @returns The IFocusableNode currently with focus, or null if none.
|
|
29
|
+
*/
|
|
30
|
+
static findFocusedNode(tree: IFocusableTree): IFocusableNode | null;
|
|
31
|
+
/**
|
|
32
|
+
* Returns the IFocusableNode corresponding to the specified HTML or SVG
|
|
33
|
+
* element iff it's the root element or a descendent of the root element of
|
|
34
|
+
* the specified IFocusableTree.
|
|
35
|
+
*
|
|
36
|
+
* If the element exists within the specified tree's DOM structure but does
|
|
37
|
+
* not directly correspond to a node, the nearest parent node (or the tree's
|
|
38
|
+
* root) will be returned to represent the provided element.
|
|
39
|
+
*
|
|
40
|
+
* If the tree contains another nested IFocusableTree, the nested tree may be
|
|
41
|
+
* traversed but its nodes will never be returned here per the contract of
|
|
42
|
+
* IFocusableTree.lookUpFocusableNode.
|
|
43
|
+
*
|
|
44
|
+
* The provided element must have a non-null ID that conforms to the contract
|
|
45
|
+
* mentioned in IFocusableNode.
|
|
46
|
+
*
|
|
47
|
+
* @param element The HTML or SVG element being sought.
|
|
48
|
+
* @param tree The tree under which the provided element may be a descendant.
|
|
49
|
+
* @returns The matching IFocusableNode, or null if there is no match.
|
|
50
|
+
*/
|
|
51
|
+
static findFocusableNodeFor(element: HTMLElement | SVGElement, tree: IFocusableTree): IFocusableNode | null;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=focusable_tree_traverser.d.ts.map
|
package/core/utils/toolbox.d.ts
CHANGED
package/core/workspace.d.ts
CHANGED
|
@@ -82,6 +82,7 @@ export declare class Workspace implements IASTNodeLocation {
|
|
|
82
82
|
private readonly typedBlocksDB;
|
|
83
83
|
private variableMap;
|
|
84
84
|
private procedureMap;
|
|
85
|
+
private readOnly;
|
|
85
86
|
/**
|
|
86
87
|
* Blocks in the flyout can refer to variables that don't exist in the main
|
|
87
88
|
* workspace. For instance, the "get item in list" block refers to an
|
|
@@ -410,7 +411,6 @@ export declare class Workspace implements IASTNodeLocation {
|
|
|
410
411
|
* These exist in the flyout but not in the workspace.
|
|
411
412
|
*
|
|
412
413
|
* @returns The potential variable map.
|
|
413
|
-
* @internal
|
|
414
414
|
*/
|
|
415
415
|
getPotentialVariableMap(): IVariableMap<IVariableModel<IVariableState>> | null;
|
|
416
416
|
/**
|
|
@@ -456,5 +456,17 @@ export declare class Workspace implements IASTNodeLocation {
|
|
|
456
456
|
*/
|
|
457
457
|
static getAll(): Workspace[];
|
|
458
458
|
protected getVariableMapClass(): new (...p1: any[]) => IVariableMap<IVariableModel<IVariableState>>;
|
|
459
|
+
/**
|
|
460
|
+
* Returns whether or not this workspace is in readonly mode.
|
|
461
|
+
*
|
|
462
|
+
* @returns True if the workspace is readonly, otherwise false.
|
|
463
|
+
*/
|
|
464
|
+
isReadOnly(): boolean;
|
|
465
|
+
/**
|
|
466
|
+
* Sets whether or not this workspace is in readonly mode.
|
|
467
|
+
*
|
|
468
|
+
* @param readOnly True to make the workspace readonly, otherwise false.
|
|
469
|
+
*/
|
|
470
|
+
setIsReadOnly(readOnly: boolean): void;
|
|
459
471
|
}
|
|
460
472
|
//# sourceMappingURL=workspace.d.ts.map
|
package/core/workspace_svg.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ import type { IFlyout } from './interfaces/i_flyout.js';
|
|
|
27
27
|
import type { IMetricsManager } from './interfaces/i_metrics_manager.js';
|
|
28
28
|
import type { IToolbox } from './interfaces/i_toolbox.js';
|
|
29
29
|
import type { IVariableModel, IVariableState } from './interfaces/i_variable_model.js';
|
|
30
|
-
import type {
|
|
30
|
+
import type { LineCursor } from './keyboard_nav/line_cursor.js';
|
|
31
31
|
import type { Marker } from './keyboard_nav/marker.js';
|
|
32
32
|
import { LayerManager } from './layer_manager.js';
|
|
33
33
|
import { MarkerManager } from './marker_manager.js';
|
|
@@ -304,7 +304,7 @@ export declare class WorkspaceSvg extends Workspace implements IASTNodeLocationS
|
|
|
304
304
|
*
|
|
305
305
|
* @returns The cursor for the workspace.
|
|
306
306
|
*/
|
|
307
|
-
getCursor():
|
|
307
|
+
getCursor(): LineCursor | null;
|
|
308
308
|
/**
|
|
309
309
|
* Get the block renderer attached to this workspace.
|
|
310
310
|
*
|
|
@@ -1003,6 +1003,20 @@ export declare class WorkspaceSvg extends Workspace implements IASTNodeLocationS
|
|
|
1003
1003
|
* @param className Name of class to remove.
|
|
1004
1004
|
*/
|
|
1005
1005
|
removeClass(className: string): void;
|
|
1006
|
+
setIsReadOnly(readOnly: boolean): void;
|
|
1007
|
+
/**
|
|
1008
|
+
* Scrolls the provided bounds into view.
|
|
1009
|
+
*
|
|
1010
|
+
* In the case of small workspaces/large bounds, this function prioritizes
|
|
1011
|
+
* getting the top left corner of the bounds into view. It also adds some
|
|
1012
|
+
* padding around the bounds to allow the element to be comfortably in view.
|
|
1013
|
+
*
|
|
1014
|
+
* @internal
|
|
1015
|
+
* @param bounds A rectangle to scroll into view, as best as possible.
|
|
1016
|
+
* @param padding Amount of spacing to put between the bounds and the edge of
|
|
1017
|
+
* the workspace's viewport.
|
|
1018
|
+
*/
|
|
1019
|
+
scrollBoundsIntoView(bounds: Rect, padding?: number): void;
|
|
1006
1020
|
}
|
|
1007
1021
|
/**
|
|
1008
1022
|
* Size the workspace when the contents change. This also updates
|
package/dart_compressed.js
CHANGED
|
@@ -79,7 +79,7 @@ List ${b.FUNCTION_NAME_PLACEHOLDER_}(List list, String type, int direction) {
|
|
|
79
79
|
}
|
|
80
80
|
`)+"("+c+', "'+a+'", '+d+")",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},lists_split$$module$build$src$generators$dart$lists=function(a,b){let c=b.valueToCode(a,"INPUT",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX);b=b.valueToCode(a,"DELIM",Order$$module$build$src$generators$dart$dart_generator.NONE)||"''";a=a.getFieldValue("MODE");if("SPLIT"===a)c||(c="''"),a="split";else if("JOIN"===a)c||(c="[]"),a="join";else throw Error("Unknown mode: "+a);return[c+
|
|
81
81
|
"."+a+"("+b+")",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},lists_reverse$$module$build$src$generators$dart$lists=function(a,b){return["new List.from("+(b.valueToCode(a,"LIST",Order$$module$build$src$generators$dart$dart_generator.NONE)||"[]")+".reversed)",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},controls_if$$module$build$src$generators$dart$logic=function(a,b){let c=0,d="",e,f;b.STATEMENT_PREFIX&&(d+=b.injectId(b.STATEMENT_PREFIX,a));do f=
|
|
82
|
-
b.valueToCode(a,"IF"+c,Order$$module$build$src$generators$dart$dart_generator.NONE)||"false",e=b.statementToCode(a,"DO"+c),b.STATEMENT_SUFFIX&&(e=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,a),b.INDENT)+e),d+=(0<c?"else ":"")+"if ("+f+") {\n"+e+"}",c++;while(a.getInput("IF"+c));if(a.getInput("ELSE")||b.STATEMENT_SUFFIX)e=b.statementToCode(a,"ELSE"),b.STATEMENT_SUFFIX&&(e=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,a),b.INDENT)+e),d+=" else {\n"+e+"}";return d+"\n"},logic_compare$$module$build$src$generators$dart$logic=
|
|
82
|
+
b.valueToCode(a,"IF"+c,Order$$module$build$src$generators$dart$dart_generator.NONE)||"false",e=b.statementToCode(a,"DO"+c),b.STATEMENT_SUFFIX&&(e=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,a),b.INDENT)+e),d+=(0<c?"else ":"")+"if ("+f+") {\n"+e+"}",c++;while(a.getInput("IF"+c));if(a.getInput("ELSE")||b.STATEMENT_SUFFIX)e=a.getInput("ELSE")?b.statementToCode(a,"ELSE"):"",b.STATEMENT_SUFFIX&&(e=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,a),b.INDENT)+e),d+=" else {\n"+e+"}";return d+"\n"},logic_compare$$module$build$src$generators$dart$logic=
|
|
83
83
|
function(a,b){const c={EQ:"==",NEQ:"!=",LT:"<",LTE:"<=",GT:">",GTE:">="}[a.getFieldValue("OP")],d="=="===c||"!="===c?Order$$module$build$src$generators$dart$dart_generator.EQUALITY:Order$$module$build$src$generators$dart$dart_generator.RELATIONAL,e=b.valueToCode(a,"A",d)||"0";a=b.valueToCode(a,"B",d)||"0";return[e+" "+c+" "+a,d]},logic_operation$$module$build$src$generators$dart$logic=function(a,b){const c="AND"===a.getFieldValue("OP")?"&&":"||",d="&&"===c?Order$$module$build$src$generators$dart$dart_generator.LOGICAL_AND:
|
|
84
84
|
Order$$module$build$src$generators$dart$dart_generator.LOGICAL_OR;let e=b.valueToCode(a,"A",d);a=b.valueToCode(a,"B",d);e||a?(b="&&"===c?"true":"false",e||(e=b),a||(a=b)):a=e="false";return[e+" "+c+" "+a,d]},logic_negate$$module$build$src$generators$dart$logic=function(a,b){const c=Order$$module$build$src$generators$dart$dart_generator.UNARY_PREFIX;return["!"+(b.valueToCode(a,"BOOL",c)||"true"),c]},logic_boolean$$module$build$src$generators$dart$logic=function(a,b){return["TRUE"===a.getFieldValue("BOOL")?
|
|
85
85
|
"true":"false",Order$$module$build$src$generators$dart$dart_generator.ATOMIC]},logic_null$$module$build$src$generators$dart$logic=function(a,b){return["null",Order$$module$build$src$generators$dart$dart_generator.ATOMIC]},logic_ternary$$module$build$src$generators$dart$logic=function(a,b){const c=b.valueToCode(a,"IF",Order$$module$build$src$generators$dart$dart_generator.CONDITIONAL)||"false",d=b.valueToCode(a,"THEN",Order$$module$build$src$generators$dart$dart_generator.CONDITIONAL)||"null";a=b.valueToCode(a,
|