blockly 12.0.0-beta.1 → 12.0.0-beta.2
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 +178 -178
- package/blockly_compressed.js +163 -163
- package/blockly_compressed.js.map +1 -1
- package/core/block_flyout_inflater.d.ts +5 -6
- package/core/blockly.d.ts +3 -1
- 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 +2 -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 +0 -2
- package/core/field_dropdown.d.ts +7 -9
- package/core/interfaces/i_flyout_inflater.d.ts +3 -3
- package/core/interfaces/i_focusable_node.d.ts +34 -0
- package/core/interfaces/i_focusable_tree.d.ts +48 -0
- package/core/keyboard_nav/marker.d.ts +4 -8
- package/core/label_flyout_inflater.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/renderers/common/marker_svg.d.ts +2 -2
- package/core/separator_flyout_inflater.d.ts +3 -3
- package/core/utils/aria.d.ts +2 -1
- package/core/utils/toolbox.d.ts +0 -2
- package/core/workspace.d.ts +13 -0
- package/core/workspace_svg.d.ts +1 -0
- package/dart_compressed.js +1 -1
- package/dart_compressed.js.map +1 -1
- 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
|
@@ -16,7 +16,6 @@ import type { WorkspaceSvg } from './workspace_svg.js';
|
|
|
16
16
|
export declare class BlockFlyoutInflater implements IFlyoutInflater {
|
|
17
17
|
protected permanentlyDisabledBlocks: Set<BlockSvg>;
|
|
18
18
|
protected listeners: Map<string, browserEvents.Data[]>;
|
|
19
|
-
protected flyoutWorkspace?: WorkspaceSvg;
|
|
20
19
|
protected flyout?: IFlyout;
|
|
21
20
|
private capacityWrapper;
|
|
22
21
|
/**
|
|
@@ -27,10 +26,10 @@ export declare class BlockFlyoutInflater implements IFlyoutInflater {
|
|
|
27
26
|
* Inflates a flyout block from the given state and adds it to the flyout.
|
|
28
27
|
*
|
|
29
28
|
* @param state A JSON representation of a flyout block.
|
|
30
|
-
* @param
|
|
29
|
+
* @param flyout The flyout to create the block on.
|
|
31
30
|
* @returns A newly created block.
|
|
32
31
|
*/
|
|
33
|
-
load(state: object,
|
|
32
|
+
load(state: object, flyout: IFlyout): FlyoutItem;
|
|
34
33
|
/**
|
|
35
34
|
* Creates a block on the given workspace.
|
|
36
35
|
*
|
|
@@ -60,11 +59,11 @@ export declare class BlockFlyoutInflater implements IFlyoutInflater {
|
|
|
60
59
|
*/
|
|
61
60
|
protected removeListeners(blockId: string): void;
|
|
62
61
|
/**
|
|
63
|
-
* Updates this inflater's flyout
|
|
62
|
+
* Updates this inflater's flyout.
|
|
64
63
|
*
|
|
65
|
-
* @param
|
|
64
|
+
* @param flyout The flyout that owns this inflater.
|
|
66
65
|
*/
|
|
67
|
-
protected
|
|
66
|
+
protected setFlyout(flyout: IFlyout): void;
|
|
68
67
|
/**
|
|
69
68
|
* Updates the enabled state of the given block based on the capacity of the
|
|
70
69
|
* workspace.
|
package/core/blockly.d.ts
CHANGED
|
@@ -84,6 +84,8 @@ import { IDragTarget } from './interfaces/i_drag_target.js';
|
|
|
84
84
|
import { IDragStrategy, IDraggable, isDraggable } from './interfaces/i_draggable.js';
|
|
85
85
|
import { IDragger } from './interfaces/i_dragger.js';
|
|
86
86
|
import { IFlyout } from './interfaces/i_flyout.js';
|
|
87
|
+
import { IFocusableNode } from './interfaces/i_focusable_node.js';
|
|
88
|
+
import { IFocusableTree } from './interfaces/i_focusable_tree.js';
|
|
87
89
|
import { IHasBubble, hasBubble } from './interfaces/i_has_bubble.js';
|
|
88
90
|
import { IIcon, isIcon } from './interfaces/i_icon.js';
|
|
89
91
|
import { IKeyboardAccessible } from './interfaces/i_keyboard_accessible.js';
|
|
@@ -272,5 +274,5 @@ export declare const VARIABLE_DYNAMIC_CATEGORY_NAME: string;
|
|
|
272
274
|
export declare const PROCEDURE_CATEGORY_NAME: string;
|
|
273
275
|
export { ASTNode, BasicCursor, Block, BlockSvg, BlocklyOptions, Blocks, CollapsibleToolboxCategory, ComponentManager, Connection, ConnectionChecker, ConnectionDB, ConnectionType, ContextMenu, ContextMenuItems, ContextMenuRegistry, Css, Cursor, DeleteArea, DragTarget, Events, Extensions, Procedures, ShortcutItems, Themes, Tooltip, Touch, Variables, VariablesDynamic, WidgetDiv, Xml, blockAnimations, blockRendering, browserEvents, bubbles, bumpObjects, clipboard, comments, common, constants, dialog, dragging, fieldRegistry, geras, Procedures as procedures, registry, thrasos, uiPosition, utils, zelos, };
|
|
274
276
|
export declare const DropDownDiv: typeof dropDownDiv;
|
|
275
|
-
export { BlockFlyoutInflater, ButtonFlyoutInflater, CodeGenerator, Field, FieldCheckbox, FieldCheckboxConfig, FieldCheckboxFromJsonConfig, FieldCheckboxValidator, FieldConfig, FieldDropdown, FieldDropdownConfig, FieldDropdownFromJsonConfig, FieldDropdownValidator, FieldImage, FieldImageConfig, FieldImageFromJsonConfig, FieldLabel, FieldLabelConfig, FieldLabelFromJsonConfig, FieldLabelSerializable, FieldNumber, FieldNumberConfig, FieldNumberFromJsonConfig, FieldNumberValidator, FieldTextInput, FieldTextInputConfig, FieldTextInputFromJsonConfig, FieldTextInputValidator, FieldValidator, FieldVariable, FieldVariableConfig, FieldVariableFromJsonConfig, FieldVariableValidator, Flyout, FlyoutButton, FlyoutItem, FlyoutMetricsManager, FlyoutSeparator, CodeGenerator as Generator, Gesture, Grid, HorizontalFlyout, IASTNodeLocation, IASTNodeLocationSvg, IASTNodeLocationWithBlock, IAutoHideable, IBoundedElement, IBubble, ICollapsibleToolboxItem, IComponent, IConnectionChecker, IConnectionPreviewer, IContextMenu, ICopyData, ICopyable, IDeletable, IDeleteArea, IDragStrategy, IDragTarget, IDraggable, IDragger, IFlyout, IFlyoutInflater, IHasBubble, IIcon, IKeyboardAccessible, IMetricsManager, IMovable, IObservable, IPaster, IPositionable, IRegistrable, IRenderedElement, ISelectable, ISelectableToolboxItem, ISerializable, IStyleable, IToolbox, IToolboxItem, IVariableBackedParameterModel, IVariableMap, IVariableModel, IVariableState, ImageProperties, Input, InsertionMarkerPreviewer, LabelFlyoutInflater, LayerManager, Marker, MarkerManager, Menu, MenuGenerator, MenuGeneratorFunction, MenuItem, MenuOption, MetricsManager, Msg, Names, Options, RenderedConnection, Scrollbar, ScrollbarPair, SeparatorFlyoutInflater, ShortcutRegistry, TabNavigateCursor, Theme, ThemeManager, Toolbox, ToolboxCategory, ToolboxItem, ToolboxSeparator, Trashcan, UnattachedFieldError, VariableMap, VariableModel, VerticalFlyout, Workspace, WorkspaceAudio, WorkspaceDragger, WorkspaceSvg, ZoomControls, config, hasBubble, icons, inject, inputs, isCopyable, isDeletable, isDraggable, isIcon, isObservable, isPaster, isRenderedElement, isSelectable, isSerializable, isVariableBackedParameterModel, layers, renderManagement, serialization, setLocale, };
|
|
277
|
+
export { BlockFlyoutInflater, ButtonFlyoutInflater, CodeGenerator, Field, FieldCheckbox, FieldCheckboxConfig, FieldCheckboxFromJsonConfig, FieldCheckboxValidator, FieldConfig, FieldDropdown, FieldDropdownConfig, FieldDropdownFromJsonConfig, FieldDropdownValidator, FieldImage, FieldImageConfig, FieldImageFromJsonConfig, FieldLabel, FieldLabelConfig, FieldLabelFromJsonConfig, FieldLabelSerializable, FieldNumber, FieldNumberConfig, FieldNumberFromJsonConfig, FieldNumberValidator, FieldTextInput, FieldTextInputConfig, FieldTextInputFromJsonConfig, FieldTextInputValidator, FieldValidator, FieldVariable, FieldVariableConfig, FieldVariableFromJsonConfig, FieldVariableValidator, Flyout, FlyoutButton, FlyoutItem, FlyoutMetricsManager, FlyoutSeparator, CodeGenerator as Generator, Gesture, Grid, HorizontalFlyout, IASTNodeLocation, IASTNodeLocationSvg, IASTNodeLocationWithBlock, IAutoHideable, IBoundedElement, IBubble, ICollapsibleToolboxItem, IComponent, IConnectionChecker, IConnectionPreviewer, IContextMenu, ICopyData, ICopyable, IDeletable, IDeleteArea, IDragStrategy, IDragTarget, IDraggable, IDragger, IFlyout, IFlyoutInflater, IFocusableNode, IFocusableTree, IHasBubble, IIcon, IKeyboardAccessible, IMetricsManager, IMovable, IObservable, IPaster, IPositionable, IRegistrable, IRenderedElement, ISelectable, ISelectableToolboxItem, ISerializable, IStyleable, IToolbox, IToolboxItem, IVariableBackedParameterModel, IVariableMap, IVariableModel, IVariableState, ImageProperties, Input, InsertionMarkerPreviewer, LabelFlyoutInflater, LayerManager, Marker, MarkerManager, Menu, MenuGenerator, MenuGeneratorFunction, MenuItem, MenuOption, MetricsManager, Msg, Names, Options, RenderedConnection, Scrollbar, ScrollbarPair, SeparatorFlyoutInflater, ShortcutRegistry, TabNavigateCursor, Theme, ThemeManager, Toolbox, ToolboxCategory, ToolboxItem, ToolboxSeparator, Trashcan, UnattachedFieldError, VariableMap, VariableModel, VerticalFlyout, Workspace, WorkspaceAudio, WorkspaceDragger, WorkspaceSvg, ZoomControls, config, hasBubble, icons, inject, inputs, isCopyable, isDeletable, isDraggable, isIcon, isObservable, isPaster, isRenderedElement, isSelectable, isSerializable, isVariableBackedParameterModel, layers, renderManagement, serialization, setLocale, };
|
|
276
278
|
//# sourceMappingURL=blockly.d.ts.map
|
|
@@ -26,12 +26,12 @@ export declare class TextBubble extends Bubble {
|
|
|
26
26
|
* broken up by newlines.
|
|
27
27
|
*/
|
|
28
28
|
private stringToSvg;
|
|
29
|
-
/** Creates the paragraph container for this bubble's view's
|
|
29
|
+
/** Creates the paragraph container for this bubble's view's text fragments. */
|
|
30
30
|
private createParagraph;
|
|
31
|
-
/** Creates the
|
|
32
|
-
private
|
|
33
|
-
/** Right aligns the given
|
|
34
|
-
private
|
|
31
|
+
/** Creates the text fragments visualizing the text of this bubble. */
|
|
32
|
+
private createTextFragments;
|
|
33
|
+
/** Right aligns the given text fragments. */
|
|
34
|
+
private rightAlignTextFragments;
|
|
35
35
|
/** Updates the size of this bubble to account for the size of the text. */
|
|
36
36
|
private updateBubbleSize;
|
|
37
37
|
}
|
|
@@ -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
|
* Class responsible for creating buttons for flyouts.
|
|
11
11
|
*/
|
|
@@ -14,10 +14,10 @@ export declare class ButtonFlyoutInflater implements IFlyoutInflater {
|
|
|
14
14
|
* Inflates a flyout button from the given state and adds it to the flyout.
|
|
15
15
|
*
|
|
16
16
|
* @param state A JSON representation of a flyout button.
|
|
17
|
-
* @param
|
|
17
|
+
* @param flyout The flyout to create the button on.
|
|
18
18
|
* @returns A newly created FlyoutButton.
|
|
19
19
|
*/
|
|
20
|
-
load(state: object,
|
|
20
|
+
load(state: object, flyout: IFlyout): FlyoutItem;
|
|
21
21
|
/**
|
|
22
22
|
* Returns the amount of space that should follow this button.
|
|
23
23
|
*
|
|
@@ -8,7 +8,7 @@ import { Coordinate } from '../utils/coordinate.js';
|
|
|
8
8
|
import { Size } from '../utils/size.js';
|
|
9
9
|
import { WorkspaceSvg } from '../workspace_svg.js';
|
|
10
10
|
export declare class CommentView implements IRenderedElement {
|
|
11
|
-
|
|
11
|
+
readonly workspace: WorkspaceSvg;
|
|
12
12
|
/** The root group element of the comment view. */
|
|
13
13
|
private svgRoot;
|
|
14
14
|
/**
|
|
@@ -62,9 +62,9 @@ export declare class CommentView implements IRenderedElement {
|
|
|
62
62
|
*/
|
|
63
63
|
private resizePointerMoveListener;
|
|
64
64
|
/** Whether this comment view is currently being disposed or not. */
|
|
65
|
-
|
|
65
|
+
protected disposing: boolean;
|
|
66
66
|
/** Whether this comment view has been disposed or not. */
|
|
67
|
-
|
|
67
|
+
protected disposed: boolean;
|
|
68
68
|
/** Size of this comment when the resize drag was initiated. */
|
|
69
69
|
private preResizeSize?;
|
|
70
70
|
/** The default size of newly created comments. */
|
|
@@ -62,7 +62,7 @@ export declare namespace ContextMenuRegistry {
|
|
|
62
62
|
* rendered in multiple scopes, e.g. on both a block and a workspace, it
|
|
63
63
|
* should be registered for each scope.
|
|
64
64
|
*/
|
|
65
|
-
enum ScopeType {
|
|
65
|
+
export enum ScopeType {
|
|
66
66
|
BLOCK = "block",
|
|
67
67
|
WORKSPACE = "workspace",
|
|
68
68
|
COMMENT = "comment"
|
|
@@ -71,15 +71,23 @@ export declare namespace ContextMenuRegistry {
|
|
|
71
71
|
* The actual workspace/block where the menu is being rendered. This is passed
|
|
72
72
|
* to callback and displayText functions that depend on this information.
|
|
73
73
|
*/
|
|
74
|
-
interface Scope {
|
|
74
|
+
export interface Scope {
|
|
75
75
|
block?: BlockSvg;
|
|
76
76
|
workspace?: WorkspaceSvg;
|
|
77
77
|
comment?: RenderedWorkspaceComment;
|
|
78
78
|
}
|
|
79
79
|
/**
|
|
80
|
-
*
|
|
80
|
+
* Fields common to all context menu registry items.
|
|
81
|
+
*/
|
|
82
|
+
interface CoreRegistryItem {
|
|
83
|
+
scopeType: ScopeType;
|
|
84
|
+
weight: number;
|
|
85
|
+
id: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* A representation of a normal, clickable menu item in the registry.
|
|
81
89
|
*/
|
|
82
|
-
interface
|
|
90
|
+
interface ActionRegistryItem extends CoreRegistryItem {
|
|
83
91
|
/**
|
|
84
92
|
* @param scope Object that provides a reference to the thing that had its
|
|
85
93
|
* context menu opened.
|
|
@@ -87,16 +95,34 @@ export declare namespace ContextMenuRegistry {
|
|
|
87
95
|
* the event that triggered the click on the option.
|
|
88
96
|
*/
|
|
89
97
|
callback: (scope: Scope, e: PointerEvent) => void;
|
|
90
|
-
scopeType: ScopeType;
|
|
91
98
|
displayText: ((p1: Scope) => string | HTMLElement) | string | HTMLElement;
|
|
92
99
|
preconditionFn: (p1: Scope) => string;
|
|
100
|
+
separator?: never;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* A representation of a menu separator item in the registry.
|
|
104
|
+
*/
|
|
105
|
+
interface SeparatorRegistryItem extends CoreRegistryItem {
|
|
106
|
+
separator: true;
|
|
107
|
+
callback?: never;
|
|
108
|
+
displayText?: never;
|
|
109
|
+
preconditionFn?: never;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* A menu item as entered in the registry.
|
|
113
|
+
*/
|
|
114
|
+
export type RegistryItem = ActionRegistryItem | SeparatorRegistryItem;
|
|
115
|
+
/**
|
|
116
|
+
* Fields common to all context menu items as used by contextmenu.ts.
|
|
117
|
+
*/
|
|
118
|
+
export interface CoreContextMenuOption {
|
|
119
|
+
scope: Scope;
|
|
93
120
|
weight: number;
|
|
94
|
-
id: string;
|
|
95
121
|
}
|
|
96
122
|
/**
|
|
97
|
-
* A menu item
|
|
123
|
+
* A representation of a normal, clickable menu item in contextmenu.ts.
|
|
98
124
|
*/
|
|
99
|
-
interface
|
|
125
|
+
export interface ActionContextMenuOption extends CoreContextMenuOption {
|
|
100
126
|
text: string | HTMLElement;
|
|
101
127
|
enabled: boolean;
|
|
102
128
|
/**
|
|
@@ -106,18 +132,32 @@ export declare namespace ContextMenuRegistry {
|
|
|
106
132
|
* the event that triggered the click on the option.
|
|
107
133
|
*/
|
|
108
134
|
callback: (scope: Scope, e: PointerEvent) => void;
|
|
109
|
-
|
|
110
|
-
|
|
135
|
+
separator?: never;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* A representation of a menu separator item in contextmenu.ts.
|
|
139
|
+
*/
|
|
140
|
+
export interface SeparatorContextMenuOption extends CoreContextMenuOption {
|
|
141
|
+
separator: true;
|
|
142
|
+
text?: never;
|
|
143
|
+
enabled?: never;
|
|
144
|
+
callback?: never;
|
|
111
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* A menu item as presented to contextmenu.ts.
|
|
148
|
+
*/
|
|
149
|
+
export type ContextMenuOption = ActionContextMenuOption | SeparatorContextMenuOption;
|
|
112
150
|
/**
|
|
113
151
|
* A subset of ContextMenuOption corresponding to what was publicly
|
|
114
152
|
* documented. ContextMenuOption should be preferred for new code.
|
|
115
153
|
*/
|
|
116
|
-
interface LegacyContextMenuOption {
|
|
154
|
+
export interface LegacyContextMenuOption {
|
|
117
155
|
text: string;
|
|
118
156
|
enabled: boolean;
|
|
119
157
|
callback: (p1: Scope) => void;
|
|
158
|
+
separator?: never;
|
|
120
159
|
}
|
|
160
|
+
export {};
|
|
121
161
|
}
|
|
122
162
|
export type ScopeType = ContextMenuRegistry.ScopeType;
|
|
123
163
|
export declare const ScopeType: typeof ContextMenuRegistry.ScopeType;
|
|
@@ -25,8 +25,8 @@ export declare class BlockDragStrategy implements IDragStrategy {
|
|
|
25
25
|
* block, to add to the drag location. In workspace units.
|
|
26
26
|
*/
|
|
27
27
|
private dragOffset;
|
|
28
|
-
/**
|
|
29
|
-
private
|
|
28
|
+
/** Used to persist an event group when snapping is done async. */
|
|
29
|
+
private originalEventGroup;
|
|
30
30
|
constructor(block: BlockSvg);
|
|
31
31
|
/** Returns true if the block is currently movable. False otherwise. */
|
|
32
32
|
isMovable(): boolean;
|
|
@@ -10,8 +10,6 @@ export declare class BubbleDragStrategy implements IDragStrategy {
|
|
|
10
10
|
private bubble;
|
|
11
11
|
private workspace;
|
|
12
12
|
private startLoc;
|
|
13
|
-
/** Was there already an event group in progress when the drag started? */
|
|
14
|
-
private inGroup;
|
|
15
13
|
constructor(bubble: IBubble, workspace: WorkspaceSvg);
|
|
16
14
|
isMovable(): boolean;
|
|
17
15
|
startDrag(): void;
|
|
@@ -10,8 +10,6 @@ export declare class CommentDragStrategy implements IDragStrategy {
|
|
|
10
10
|
private comment;
|
|
11
11
|
private startLoc;
|
|
12
12
|
private workspace;
|
|
13
|
-
/** Was there already an event group in progress when the drag started? */
|
|
14
|
-
private inGroup;
|
|
15
13
|
constructor(comment: RenderedWorkspaceComment);
|
|
16
14
|
isMovable(): boolean;
|
|
17
15
|
startDrag(): void;
|
package/core/field.d.ts
CHANGED
|
@@ -54,8 +54,6 @@ export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IAS
|
|
|
54
54
|
* `FieldImage.prototype.DEFAULT_VALUE = null;`
|
|
55
55
|
*/
|
|
56
56
|
DEFAULT_VALUE: T | null;
|
|
57
|
-
/** Non-breaking space. */
|
|
58
|
-
static readonly NBSP = "\u00A0";
|
|
59
57
|
/**
|
|
60
58
|
* A value used to signal when a field's constructor should *not* set the
|
|
61
59
|
* field's value or run configure_, and should allow a subclass to do that
|
package/core/field_dropdown.d.ts
CHANGED
|
@@ -10,13 +10,10 @@ import { MenuItem } from './menuitem.js';
|
|
|
10
10
|
* Class for an editable dropdown field.
|
|
11
11
|
*/
|
|
12
12
|
export declare class FieldDropdown extends Field<string> {
|
|
13
|
-
/** Horizontal distance that a checkmark overhangs the dropdown. */
|
|
14
|
-
static CHECKMARK_OVERHANG: number;
|
|
15
13
|
/**
|
|
16
|
-
*
|
|
17
|
-
* height.
|
|
14
|
+
* Magic constant used to represent a separator in a list of dropdown items.
|
|
18
15
|
*/
|
|
19
|
-
static
|
|
16
|
+
static readonly SEPARATOR = "separator";
|
|
20
17
|
static ARROW_CHAR: string;
|
|
21
18
|
/** A reference to the currently selected menu item. */
|
|
22
19
|
private selectedMenuItem;
|
|
@@ -239,11 +236,12 @@ export interface ImageProperties {
|
|
|
239
236
|
height: number;
|
|
240
237
|
}
|
|
241
238
|
/**
|
|
242
|
-
* An individual option in the dropdown menu.
|
|
243
|
-
*
|
|
244
|
-
*
|
|
239
|
+
* An individual option in the dropdown menu. Can be either the string literal
|
|
240
|
+
* `separator` for a menu separator item, or an array for normal action menu
|
|
241
|
+
* items. In the latter case, the first element is the human-readable value
|
|
242
|
+
* (text or image), and the second element is the language-neutral value.
|
|
245
243
|
*/
|
|
246
|
-
export type MenuOption = [string | ImageProperties, string];
|
|
244
|
+
export type MenuOption = [string | ImageProperties, string] | 'separator';
|
|
247
245
|
/**
|
|
248
246
|
* A function that generates an array of menu options for FieldDropdown
|
|
249
247
|
* or its descendants.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { FlyoutItem } from '../flyout_item.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { IFlyout } from './i_flyout.js';
|
|
3
3
|
export interface IFlyoutInflater {
|
|
4
4
|
/**
|
|
5
5
|
* Loads the object represented by the given state onto the workspace.
|
|
@@ -8,14 +8,14 @@ export interface IFlyoutInflater {
|
|
|
8
8
|
* allow for code reuse.
|
|
9
9
|
*
|
|
10
10
|
* @param state A JSON representation of an element to inflate on the flyout.
|
|
11
|
-
* @param
|
|
11
|
+
* @param flyout The flyout on whose workspace the inflated element
|
|
12
12
|
* should be created. If the inflated element is an `IRenderedElement` it
|
|
13
13
|
* itself or the inflater should append it to the workspace; the flyout
|
|
14
14
|
* will not do so itself. The flyout is responsible for positioning the
|
|
15
15
|
* element, however.
|
|
16
16
|
* @returns The newly inflated flyout element.
|
|
17
17
|
*/
|
|
18
|
-
load(state: object,
|
|
18
|
+
load(state: object, flyout: IFlyout): FlyoutItem;
|
|
19
19
|
/**
|
|
20
20
|
* Returns the amount of spacing that should follow the element corresponding
|
|
21
21
|
* to the given JSON representation.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { IFocusableTree } from './i_focusable_tree.js';
|
|
7
|
+
/** Represents anything that can have input focus. */
|
|
8
|
+
export interface IFocusableNode {
|
|
9
|
+
/**
|
|
10
|
+
* Returns the DOM element that can be explicitly requested to receive focus.
|
|
11
|
+
*
|
|
12
|
+
* IMPORTANT: Please note that this element is expected to have a visual
|
|
13
|
+
* presence on the page as it will both be explicitly focused and have its
|
|
14
|
+
* style changed depending on its current focus state (i.e. blurred, actively
|
|
15
|
+
* focused, and passively focused). The element will have one of two styles
|
|
16
|
+
* attached (where no style indicates blurred/not focused):
|
|
17
|
+
* - blocklyActiveFocus
|
|
18
|
+
* - blocklyPassiveFocus
|
|
19
|
+
*
|
|
20
|
+
* The returned element must also have a valid ID specified, and unique to the
|
|
21
|
+
* element relative to its nearest IFocusableTree parent.
|
|
22
|
+
*
|
|
23
|
+
* It's expected the return element will not change for the lifetime of the
|
|
24
|
+
* node.
|
|
25
|
+
*/
|
|
26
|
+
getFocusableElement(): HTMLElement | SVGElement;
|
|
27
|
+
/**
|
|
28
|
+
* Returns the closest parent tree of this node (in cases where a tree has
|
|
29
|
+
* distinct trees underneath it), which represents the tree to which this node
|
|
30
|
+
* belongs.
|
|
31
|
+
*/
|
|
32
|
+
getFocusableTree(): IFocusableTree;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=i_focusable_node.d.ts.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { IFocusableNode } from './i_focusable_node.js';
|
|
7
|
+
/**
|
|
8
|
+
* Represents a tree of focusable elements with its own active/passive focus
|
|
9
|
+
* context.
|
|
10
|
+
*
|
|
11
|
+
* Note that focus is handled by FocusManager, and tree implementations can have
|
|
12
|
+
* at most one IFocusableNode focused at one time. If the tree itself has focus,
|
|
13
|
+
* then the tree's focused node is considered 'active' ('passive' if another
|
|
14
|
+
* tree has focus).
|
|
15
|
+
*
|
|
16
|
+
* Focus is shared between one or more trees, where each tree can have exactly
|
|
17
|
+
* one active or passive node (and only one active node can exist on the whole
|
|
18
|
+
* page at any given time). The idea of passive focus is to provide context to
|
|
19
|
+
* users on where their focus will be restored upon navigating back to a
|
|
20
|
+
* previously focused tree.
|
|
21
|
+
*/
|
|
22
|
+
export interface IFocusableTree {
|
|
23
|
+
/**
|
|
24
|
+
* Returns the current node with focus in this tree, or null if none (or if
|
|
25
|
+
* the root has focus).
|
|
26
|
+
*
|
|
27
|
+
* Note that this will never return a node from a nested sub-tree as that tree
|
|
28
|
+
* should specifically be called in order to retrieve its focused node.
|
|
29
|
+
*/
|
|
30
|
+
getFocusedNode(): IFocusableNode | null;
|
|
31
|
+
/**
|
|
32
|
+
* Returns the top-level focusable node of the tree.
|
|
33
|
+
*
|
|
34
|
+
* It's expected that the returned node will be focused in cases where
|
|
35
|
+
* FocusManager wants to focus a tree in a situation where it does not
|
|
36
|
+
* currently have a focused node.
|
|
37
|
+
*/
|
|
38
|
+
getRootFocusableNode(): IFocusableNode;
|
|
39
|
+
/**
|
|
40
|
+
* Returns the IFocusableNode corresponding to the select element, or null if
|
|
41
|
+
* the element does not have such a node.
|
|
42
|
+
*
|
|
43
|
+
* The provided element must have a non-null ID that conforms to the contract
|
|
44
|
+
* mentioned in IFocusableNode.
|
|
45
|
+
*/
|
|
46
|
+
findFocusableNodeFor(element: HTMLElement | SVGElement): IFocusableNode | null;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=i_focusable_tree.d.ts.map
|
|
@@ -27,8 +27,6 @@ export declare class Marker {
|
|
|
27
27
|
private drawer;
|
|
28
28
|
/** The type of the marker. */
|
|
29
29
|
type: string;
|
|
30
|
-
/** Constructs a new Marker instance. */
|
|
31
|
-
constructor();
|
|
32
30
|
/**
|
|
33
31
|
* Sets the object in charge of drawing the marker.
|
|
34
32
|
*
|
|
@@ -40,21 +38,19 @@ export declare class Marker {
|
|
|
40
38
|
*
|
|
41
39
|
* @returns The object in charge of drawing the marker.
|
|
42
40
|
*/
|
|
43
|
-
getDrawer(): MarkerSvg;
|
|
41
|
+
getDrawer(): MarkerSvg | null;
|
|
44
42
|
/**
|
|
45
43
|
* Gets the current location of the marker.
|
|
46
44
|
*
|
|
47
45
|
* @returns The current field, connection, or block the marker is on.
|
|
48
46
|
*/
|
|
49
|
-
getCurNode(): ASTNode;
|
|
47
|
+
getCurNode(): ASTNode | null;
|
|
50
48
|
/**
|
|
51
49
|
* Set the location of the marker and call the update method.
|
|
52
|
-
* Setting isStack to true will only work if the newLocation is the top most
|
|
53
|
-
* output or previous connection on a stack.
|
|
54
50
|
*
|
|
55
|
-
* @param newNode The new location of the marker.
|
|
51
|
+
* @param newNode The new location of the marker, or null to remove it.
|
|
56
52
|
*/
|
|
57
|
-
setCurNode(newNode: ASTNode): void;
|
|
53
|
+
setCurNode(newNode: ASTNode | null): void;
|
|
58
54
|
/**
|
|
59
55
|
* Redraw the current marker.
|
|
60
56
|
*
|
|
@@ -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
|
* Class responsible for creating labels for flyouts.
|
|
11
11
|
*/
|
|
@@ -14,10 +14,10 @@ export declare class LabelFlyoutInflater implements IFlyoutInflater {
|
|
|
14
14
|
* Inflates a flyout label from the given state and adds it to the flyout.
|
|
15
15
|
*
|
|
16
16
|
* @param state A JSON representation of a flyout label.
|
|
17
|
-
* @param
|
|
17
|
+
* @param flyout The flyout to create the label on.
|
|
18
18
|
* @returns A FlyoutButton configured as a label.
|
|
19
19
|
*/
|
|
20
|
-
load(state: object,
|
|
20
|
+
load(state: object, flyout: IFlyout): FlyoutItem;
|
|
21
21
|
/**
|
|
22
22
|
* Returns the amount of space that should follow this label.
|
|
23
23
|
*
|
package/core/menu.d.ts
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import type {
|
|
6
|
+
import type { MenuSeparator } from './menu_separator.js';
|
|
7
|
+
import { MenuItem } from './menuitem.js';
|
|
7
8
|
import * as aria from './utils/aria.js';
|
|
8
9
|
import { Coordinate } from './utils/coordinate.js';
|
|
9
10
|
import type { Size } from './utils/size.js';
|
|
@@ -12,14 +13,12 @@ import type { Size } from './utils/size.js';
|
|
|
12
13
|
*/
|
|
13
14
|
export declare class Menu {
|
|
14
15
|
/**
|
|
15
|
-
* Array of menu items.
|
|
16
|
-
* (Nulls are never in the array, but typing the array as nullable prevents
|
|
17
|
-
* the compiler from objecting to .indexOf(null))
|
|
16
|
+
* Array of menu items and separators.
|
|
18
17
|
*/
|
|
19
18
|
private readonly menuItems;
|
|
20
19
|
/**
|
|
21
|
-
* Coordinates of the
|
|
22
|
-
* prevent the consequent
|
|
20
|
+
* Coordinates of the pointerdown event that caused this menu to open. Used to
|
|
21
|
+
* prevent the consequent pointerup event due to a simple click from
|
|
23
22
|
* activating a menu item immediately.
|
|
24
23
|
*/
|
|
25
24
|
openingCoords: Coordinate | null;
|
|
@@ -28,14 +27,14 @@ export declare class Menu {
|
|
|
28
27
|
* A value of null means no menu item is highlighted.
|
|
29
28
|
*/
|
|
30
29
|
private highlightedItem;
|
|
31
|
-
/**
|
|
32
|
-
private
|
|
30
|
+
/** Pointer over event data. */
|
|
31
|
+
private pointerMoveHandler;
|
|
33
32
|
/** Click event data. */
|
|
34
33
|
private clickHandler;
|
|
35
|
-
/**
|
|
36
|
-
private
|
|
37
|
-
/**
|
|
38
|
-
private
|
|
34
|
+
/** Pointer enter event data. */
|
|
35
|
+
private pointerEnterHandler;
|
|
36
|
+
/** Pointer leave event data. */
|
|
37
|
+
private pointerLeaveHandler;
|
|
39
38
|
/** Key down event data. */
|
|
40
39
|
private onKeyDownHandler;
|
|
41
40
|
/** The menu's root DOM element. */
|
|
@@ -47,10 +46,10 @@ export declare class Menu {
|
|
|
47
46
|
/**
|
|
48
47
|
* Add a new menu item to the bottom of this menu.
|
|
49
48
|
*
|
|
50
|
-
* @param menuItem Menu item to append.
|
|
49
|
+
* @param menuItem Menu item or separator to append.
|
|
51
50
|
* @internal
|
|
52
51
|
*/
|
|
53
|
-
addChild(menuItem: MenuItem): void;
|
|
52
|
+
addChild(menuItem: MenuItem | MenuSeparator): void;
|
|
54
53
|
/**
|
|
55
54
|
* Creates the menu DOM.
|
|
56
55
|
*
|
|
@@ -124,11 +123,12 @@ export declare class Menu {
|
|
|
124
123
|
*/
|
|
125
124
|
private highlightHelper;
|
|
126
125
|
/**
|
|
127
|
-
* Handles
|
|
126
|
+
* Handles pointermove events. Highlight menu items as the user hovers over
|
|
127
|
+
* them.
|
|
128
128
|
*
|
|
129
|
-
* @param e
|
|
129
|
+
* @param e Pointer event to handle.
|
|
130
130
|
*/
|
|
131
|
-
private
|
|
131
|
+
private handlePointerMove;
|
|
132
132
|
/**
|
|
133
133
|
* Handles click events. Pass the event onto the child menuitem to handle.
|
|
134
134
|
*
|
|
@@ -136,17 +136,17 @@ export declare class Menu {
|
|
|
136
136
|
*/
|
|
137
137
|
private handleClick;
|
|
138
138
|
/**
|
|
139
|
-
* Handles
|
|
139
|
+
* Handles pointer enter events. Focus the element.
|
|
140
140
|
*
|
|
141
|
-
* @param _e
|
|
141
|
+
* @param _e Pointer event to handle.
|
|
142
142
|
*/
|
|
143
|
-
private
|
|
143
|
+
private handlePointerEnter;
|
|
144
144
|
/**
|
|
145
|
-
* Handles
|
|
145
|
+
* Handles pointer leave events by clearing the active highlight.
|
|
146
146
|
*
|
|
147
|
-
* @param _e
|
|
147
|
+
* @param _e Pointer event to handle.
|
|
148
148
|
*/
|
|
149
|
-
private
|
|
149
|
+
private handlePointerLeave;
|
|
150
150
|
/**
|
|
151
151
|
* Attempts to handle a keyboard event.
|
|
152
152
|
*
|
|
@@ -160,5 +160,11 @@ export declare class Menu {
|
|
|
160
160
|
* @internal
|
|
161
161
|
*/
|
|
162
162
|
getSize(): Size;
|
|
163
|
+
/**
|
|
164
|
+
* Returns the action menu items (omitting separators) in this menu.
|
|
165
|
+
*
|
|
166
|
+
* @returns The MenuItem objects displayed in this menu.
|
|
167
|
+
*/
|
|
168
|
+
private getMenuItems;
|
|
163
169
|
}
|
|
164
170
|
//# sourceMappingURL=menu.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Representation of a section separator in a menu.
|
|
8
|
+
*/
|
|
9
|
+
export declare class MenuSeparator {
|
|
10
|
+
/**
|
|
11
|
+
* DOM element representing this separator in a menu.
|
|
12
|
+
*/
|
|
13
|
+
private element;
|
|
14
|
+
/**
|
|
15
|
+
* Creates the DOM representation of this separator.
|
|
16
|
+
*
|
|
17
|
+
* @returns An <hr> element.
|
|
18
|
+
*/
|
|
19
|
+
createDom(): HTMLHRElement;
|
|
20
|
+
/**
|
|
21
|
+
* Disposes of this separator.
|
|
22
|
+
*/
|
|
23
|
+
dispose(): void;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=menu_separator.d.ts.map
|
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
|
*
|
|
@@ -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
|
*
|