blockly 11.2.0-beta.2 → 12.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/blockly.min.js +700 -698
- package/blockly.mjs +5 -1
- package/blockly_compressed.js +688 -686
- package/blockly_compressed.js.map +1 -1
- package/blocks_compressed.js +12 -12
- package/blocks_compressed.js.map +1 -1
- package/core/block.d.ts +3 -3
- package/core/block_flyout_inflater.d.ts +89 -0
- package/core/block_svg.d.ts +18 -0
- package/core/blockly.d.ts +11 -4
- package/core/bubbles/textinput_bubble.d.ts +9 -0
- package/core/button_flyout_inflater.d.ts +36 -0
- package/core/clipboard.d.ts +2 -2
- package/core/comments/comment_view.d.ts +4 -0
- package/core/comments/rendered_workspace_comment.d.ts +2 -0
- package/core/dropdowndiv.d.ts +1 -1
- package/core/events/events.d.ts +1 -0
- package/core/events/events_var_base.d.ts +2 -2
- package/core/events/events_var_create.d.ts +7 -2
- package/core/events/events_var_delete.d.ts +2 -2
- package/core/events/events_var_rename.d.ts +2 -2
- package/core/events/events_var_type_change.d.ts +55 -0
- package/core/events/type.d.ts +2 -0
- package/core/field.d.ts +0 -13
- package/core/field_checkbox.d.ts +0 -4
- package/core/field_dropdown.d.ts +0 -2
- package/core/field_input.d.ts +0 -2
- package/core/field_number.d.ts +6 -0
- package/core/field_textinput.d.ts +1 -0
- package/core/field_variable.d.ts +9 -2
- package/core/flyout_base.d.ts +47 -176
- package/core/flyout_button.d.ts +25 -6
- package/core/flyout_horizontal.d.ts +2 -3
- package/core/flyout_separator.d.ts +45 -0
- package/core/flyout_vertical.d.ts +3 -4
- package/core/grid.d.ts +4 -1
- package/core/icons/comment_icon.d.ts +15 -0
- package/core/interfaces/i_comment_icon.d.ts +3 -0
- package/core/interfaces/i_flyout_inflater.d.ts +39 -0
- package/core/interfaces/i_toolbox.d.ts +8 -1
- package/core/interfaces/i_variable_backed_parameter_model.d.ts +2 -2
- package/core/interfaces/i_variable_map.d.ts +48 -0
- package/core/interfaces/i_variable_model.d.ts +36 -0
- package/core/label_flyout_inflater.d.ts +36 -0
- package/core/menuitem.d.ts +0 -7
- package/core/names.d.ts +8 -2
- package/core/registry.d.ts +6 -0
- package/core/renderers/common/constants.d.ts +6 -1
- package/core/renderers/common/i_path_object.d.ts +13 -13
- package/core/renderers/common/renderer.d.ts +12 -17
- package/core/renderers/geras/renderer.d.ts +1 -1
- package/core/renderers/zelos/constants.d.ts +8 -2
- package/core/renderers/zelos/renderer.d.ts +0 -7
- package/core/separator_flyout_inflater.d.ts +47 -0
- package/core/serialization/variables.d.ts +3 -10
- package/core/toolbox/toolbox.d.ts +2 -5
- package/core/variable_map.d.ts +27 -29
- package/core/variable_model.d.ts +37 -11
- package/core/variables.d.ts +38 -8
- package/core/widgetdiv.d.ts +2 -2
- package/core/workspace.d.ts +21 -19
- package/core/workspace_svg.d.ts +33 -6
- package/core/xml.d.ts +2 -2
- package/index.mjs +5 -1
- package/package.json +1 -1
- package/php_compressed.js +1 -1
- package/php_compressed.js.map +1 -1
- package/python_compressed.js +1 -1
- package/python_compressed.js.map +1 -1
- package/core/insertion_marker_manager.d.ts +0 -249
package/core/block.d.ts
CHANGED
|
@@ -20,10 +20,10 @@ import type { MutatorIcon } from './icons/mutator_icon.js';
|
|
|
20
20
|
import { Input } from './inputs/input.js';
|
|
21
21
|
import type { IASTNodeLocation } from './interfaces/i_ast_node_location.js';
|
|
22
22
|
import { type IIcon } from './interfaces/i_icon.js';
|
|
23
|
+
import type { IVariableModel, IVariableState } from './interfaces/i_variable_model.js';
|
|
23
24
|
import * as Tooltip from './tooltip.js';
|
|
24
25
|
import { Coordinate } from './utils/coordinate.js';
|
|
25
26
|
import { Size } from './utils/size.js';
|
|
26
|
-
import type { VariableModel } from './variable_model.js';
|
|
27
27
|
import type { Workspace } from './workspace.js';
|
|
28
28
|
/**
|
|
29
29
|
* Class for one block.
|
|
@@ -552,7 +552,7 @@ export declare class Block implements IASTNodeLocation {
|
|
|
552
552
|
* @returns List of variable models.
|
|
553
553
|
* @internal
|
|
554
554
|
*/
|
|
555
|
-
getVarModels():
|
|
555
|
+
getVarModels(): IVariableModel<IVariableState>[];
|
|
556
556
|
/**
|
|
557
557
|
* Notification that a variable is renaming but keeping the same ID. If the
|
|
558
558
|
* variable is in use on this block, rerender to show the new name.
|
|
@@ -560,7 +560,7 @@ export declare class Block implements IASTNodeLocation {
|
|
|
560
560
|
* @param variable The variable being renamed.
|
|
561
561
|
* @internal
|
|
562
562
|
*/
|
|
563
|
-
updateVarName(variable:
|
|
563
|
+
updateVarName(variable: IVariableModel<IVariableState>): void;
|
|
564
564
|
/**
|
|
565
565
|
* Notification that a variable is renaming.
|
|
566
566
|
* If the ID matches one of this block's variables, rename it.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2024 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { BlockSvg } from './block_svg.js';
|
|
7
|
+
import * as browserEvents from './browser_events.js';
|
|
8
|
+
import type { IBoundedElement } from './interfaces/i_bounded_element.js';
|
|
9
|
+
import type { IFlyout } from './interfaces/i_flyout.js';
|
|
10
|
+
import type { IFlyoutInflater } from './interfaces/i_flyout_inflater.js';
|
|
11
|
+
import type { BlockInfo } from './utils/toolbox.js';
|
|
12
|
+
import type { WorkspaceSvg } from './workspace_svg.js';
|
|
13
|
+
/**
|
|
14
|
+
* Class responsible for creating blocks for flyouts.
|
|
15
|
+
*/
|
|
16
|
+
export declare class BlockFlyoutInflater implements IFlyoutInflater {
|
|
17
|
+
protected permanentlyDisabledBlocks: Set<BlockSvg>;
|
|
18
|
+
protected listeners: Map<string, browserEvents.Data[]>;
|
|
19
|
+
protected flyoutWorkspace?: WorkspaceSvg;
|
|
20
|
+
protected flyout?: IFlyout;
|
|
21
|
+
private capacityWrapper;
|
|
22
|
+
/**
|
|
23
|
+
* Creates a new BlockFlyoutInflater instance.
|
|
24
|
+
*/
|
|
25
|
+
constructor();
|
|
26
|
+
/**
|
|
27
|
+
* Inflates a flyout block from the given state and adds it to the flyout.
|
|
28
|
+
*
|
|
29
|
+
* @param state A JSON representation of a flyout block.
|
|
30
|
+
* @param flyoutWorkspace The workspace to create the block on.
|
|
31
|
+
* @returns A newly created block.
|
|
32
|
+
*/
|
|
33
|
+
load(state: object, flyoutWorkspace: WorkspaceSvg): IBoundedElement;
|
|
34
|
+
/**
|
|
35
|
+
* Creates a block on the given workspace.
|
|
36
|
+
*
|
|
37
|
+
* @param blockDefinition A JSON representation of the block to create.
|
|
38
|
+
* @param workspace The workspace to create the block on.
|
|
39
|
+
* @returns The newly created block.
|
|
40
|
+
*/
|
|
41
|
+
createBlock(blockDefinition: BlockInfo, workspace: WorkspaceSvg): BlockSvg;
|
|
42
|
+
/**
|
|
43
|
+
* Returns the amount of space that should follow this block.
|
|
44
|
+
*
|
|
45
|
+
* @param state A JSON representation of a flyout block.
|
|
46
|
+
* @param defaultGap The default spacing for flyout items.
|
|
47
|
+
* @returns The amount of space that should follow this block.
|
|
48
|
+
*/
|
|
49
|
+
gapForElement(state: object, defaultGap: number): number;
|
|
50
|
+
/**
|
|
51
|
+
* Disposes of the given block.
|
|
52
|
+
*
|
|
53
|
+
* @param element The flyout block to dispose of.
|
|
54
|
+
*/
|
|
55
|
+
disposeElement(element: IBoundedElement): void;
|
|
56
|
+
/**
|
|
57
|
+
* Removes event listeners for the block with the given ID.
|
|
58
|
+
*
|
|
59
|
+
* @param blockId The ID of the block to remove event listeners from.
|
|
60
|
+
*/
|
|
61
|
+
protected removeListeners(blockId: string): void;
|
|
62
|
+
/**
|
|
63
|
+
* Updates this inflater's flyout workspace.
|
|
64
|
+
*
|
|
65
|
+
* @param workspace The workspace of the flyout that owns this inflater.
|
|
66
|
+
*/
|
|
67
|
+
protected setFlyoutWorkspace(workspace: WorkspaceSvg): void;
|
|
68
|
+
/**
|
|
69
|
+
* Updates the enabled state of the given block based on the capacity of the
|
|
70
|
+
* workspace.
|
|
71
|
+
*
|
|
72
|
+
* @param block The block to update the enabled/disabled state of.
|
|
73
|
+
*/
|
|
74
|
+
private updateStateBasedOnCapacity;
|
|
75
|
+
/**
|
|
76
|
+
* Add listeners to a block that has been added to the flyout.
|
|
77
|
+
*
|
|
78
|
+
* @param block The block to add listeners for.
|
|
79
|
+
*/
|
|
80
|
+
protected addBlockListeners(block: BlockSvg): void;
|
|
81
|
+
/**
|
|
82
|
+
* Updates the state of blocks in our owning flyout to be disabled/enabled
|
|
83
|
+
* based on the capacity of the workspace for more blocks of that type.
|
|
84
|
+
*
|
|
85
|
+
* @param event The event that triggered this update.
|
|
86
|
+
*/
|
|
87
|
+
private filterFlyoutBasedOnCapacity;
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=block_flyout_inflater.d.ts.map
|
package/core/block_svg.d.ts
CHANGED
|
@@ -275,6 +275,18 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
|
|
|
275
275
|
private updateConnectionLocations;
|
|
276
276
|
private updateIconLocations;
|
|
277
277
|
private updateFieldLocations;
|
|
278
|
+
/**
|
|
279
|
+
* Add a CSS class to the SVG group of this block.
|
|
280
|
+
*
|
|
281
|
+
* @param className
|
|
282
|
+
*/
|
|
283
|
+
addClass(className: string): void;
|
|
284
|
+
/**
|
|
285
|
+
* Remove a CSS class from the SVG group of this block.
|
|
286
|
+
*
|
|
287
|
+
* @param className
|
|
288
|
+
*/
|
|
289
|
+
removeClass(className: string): void;
|
|
278
290
|
/**
|
|
279
291
|
* Recursively adds or removes the dragging class to this node and its
|
|
280
292
|
* children.
|
|
@@ -406,6 +418,11 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
|
|
|
406
418
|
* update whether the block is currently disabled for this reason.
|
|
407
419
|
*/
|
|
408
420
|
setDisabledReason(disabled: boolean, reason: string): void;
|
|
421
|
+
/**
|
|
422
|
+
* Add blocklyNotDeletable class when block is not deletable
|
|
423
|
+
* Or remove class when block is deletable
|
|
424
|
+
*/
|
|
425
|
+
setDeletable(deletable: boolean): void;
|
|
409
426
|
/**
|
|
410
427
|
* Set whether the block is highlighted or not. Block highlighting is
|
|
411
428
|
* often used to visually mark blocks currently being executed.
|
|
@@ -706,5 +723,6 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
|
|
|
706
723
|
* Returns a representation of this block that can be displayed in a flyout.
|
|
707
724
|
*/
|
|
708
725
|
toFlyoutInfo(): FlyoutItemInfo[];
|
|
726
|
+
jsonInit(json: any): void;
|
|
709
727
|
}
|
|
710
728
|
//# sourceMappingURL=block_svg.d.ts.map
|
package/core/blockly.d.ts
CHANGED
|
@@ -9,12 +9,14 @@ import './events/events_ui_base.js';
|
|
|
9
9
|
import './events/events_var_create.js';
|
|
10
10
|
import { Block } from './block.js';
|
|
11
11
|
import * as blockAnimations from './block_animations.js';
|
|
12
|
+
import { BlockFlyoutInflater } from './block_flyout_inflater.js';
|
|
12
13
|
import { BlockSvg } from './block_svg.js';
|
|
13
14
|
import { BlocklyOptions } from './blockly_options.js';
|
|
14
15
|
import { Blocks } from './blocks.js';
|
|
15
16
|
import * as browserEvents from './browser_events.js';
|
|
16
17
|
import * as bubbles from './bubbles.js';
|
|
17
18
|
import * as bumpObjects from './bump_objects.js';
|
|
19
|
+
import { ButtonFlyoutInflater } from './button_flyout_inflater.js';
|
|
18
20
|
import * as clipboard from './clipboard.js';
|
|
19
21
|
import * as comments from './comments.js';
|
|
20
22
|
import * as common from './common.js';
|
|
@@ -38,7 +40,7 @@ import * as Events from './events/events.js';
|
|
|
38
40
|
import * as Extensions from './extensions.js';
|
|
39
41
|
import { Field, FieldConfig, FieldValidator, UnattachedFieldError } from './field.js';
|
|
40
42
|
import { FieldCheckbox, FieldCheckboxConfig, FieldCheckboxFromJsonConfig, FieldCheckboxValidator } from './field_checkbox.js';
|
|
41
|
-
import { FieldDropdown, FieldDropdownConfig, FieldDropdownFromJsonConfig, FieldDropdownValidator, MenuGenerator, MenuGeneratorFunction, MenuOption } from './field_dropdown.js';
|
|
43
|
+
import { FieldDropdown, FieldDropdownConfig, FieldDropdownFromJsonConfig, FieldDropdownValidator, ImageProperties, MenuGenerator, MenuGeneratorFunction, MenuOption } from './field_dropdown.js';
|
|
42
44
|
import { FieldImage, FieldImageConfig, FieldImageFromJsonConfig } from './field_image.js';
|
|
43
45
|
import { FieldLabel, FieldLabelConfig, FieldLabelFromJsonConfig } from './field_label.js';
|
|
44
46
|
import { FieldLabelSerializable } from './field_label_serializable.js';
|
|
@@ -46,10 +48,11 @@ import { FieldNumber, FieldNumberConfig, FieldNumberFromJsonConfig, FieldNumberV
|
|
|
46
48
|
import * as fieldRegistry from './field_registry.js';
|
|
47
49
|
import { FieldTextInput, FieldTextInputConfig, FieldTextInputFromJsonConfig, FieldTextInputValidator } from './field_textinput.js';
|
|
48
50
|
import { FieldVariable, FieldVariableConfig, FieldVariableFromJsonConfig, FieldVariableValidator } from './field_variable.js';
|
|
49
|
-
import { Flyout } from './flyout_base.js';
|
|
51
|
+
import { Flyout, FlyoutItem } from './flyout_base.js';
|
|
50
52
|
import { FlyoutButton } from './flyout_button.js';
|
|
51
53
|
import { HorizontalFlyout } from './flyout_horizontal.js';
|
|
52
54
|
import { FlyoutMetricsManager } from './flyout_metrics_manager.js';
|
|
55
|
+
import { FlyoutSeparator } from './flyout_separator.js';
|
|
53
56
|
import { VerticalFlyout } from './flyout_vertical.js';
|
|
54
57
|
import { CodeGenerator } from './generator.js';
|
|
55
58
|
import { Gesture } from './gesture.js';
|
|
@@ -57,8 +60,10 @@ import { Grid } from './grid.js';
|
|
|
57
60
|
import * as icons from './icons.js';
|
|
58
61
|
import { inject } from './inject.js';
|
|
59
62
|
import * as inputs from './inputs.js';
|
|
63
|
+
import { IFlyoutInflater } from './interfaces/i_flyout_inflater.js';
|
|
64
|
+
import { LabelFlyoutInflater } from './label_flyout_inflater.js';
|
|
65
|
+
import { SeparatorFlyoutInflater } from './separator_flyout_inflater.js';
|
|
60
66
|
import { Input } from './inputs/input.js';
|
|
61
|
-
import { InsertionMarkerManager } from './insertion_marker_manager.js';
|
|
62
67
|
import { InsertionMarkerPreviewer } from './insertion_marker_previewer.js';
|
|
63
68
|
import { IASTNodeLocation } from './interfaces/i_ast_node_location.js';
|
|
64
69
|
import { IASTNodeLocationSvg } from './interfaces/i_ast_node_location_svg.js';
|
|
@@ -95,6 +100,8 @@ import { IStyleable } from './interfaces/i_styleable.js';
|
|
|
95
100
|
import { IToolbox } from './interfaces/i_toolbox.js';
|
|
96
101
|
import { IToolboxItem } from './interfaces/i_toolbox_item.js';
|
|
97
102
|
import { IVariableBackedParameterModel, isVariableBackedParameterModel } from './interfaces/i_variable_backed_parameter_model.js';
|
|
103
|
+
import { IVariableMap } from './interfaces/i_variable_map.js';
|
|
104
|
+
import { IVariableModel, IVariableState } from './interfaces/i_variable_model.js';
|
|
98
105
|
import { ASTNode } from './keyboard_nav/ast_node.js';
|
|
99
106
|
import { BasicCursor } from './keyboard_nav/basic_cursor.js';
|
|
100
107
|
import { Cursor } from './keyboard_nav/cursor.js';
|
|
@@ -264,5 +271,5 @@ export declare const VARIABLE_DYNAMIC_CATEGORY_NAME: string;
|
|
|
264
271
|
export declare const PROCEDURE_CATEGORY_NAME: string;
|
|
265
272
|
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, };
|
|
266
273
|
export declare const DropDownDiv: typeof dropDownDiv;
|
|
267
|
-
export { 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, FlyoutMetricsManager, 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, IHasBubble, IIcon, IKeyboardAccessible, IMetricsManager, IMovable, IObservable, IPaster, IPositionable, IRegistrable, IRenderedElement, ISelectable, ISelectableToolboxItem, ISerializable, IStyleable, IToolbox, IToolboxItem, IVariableBackedParameterModel,
|
|
274
|
+
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, };
|
|
268
275
|
//# sourceMappingURL=blockly.d.ts.map
|
|
@@ -36,6 +36,8 @@ export declare class TextInputBubble extends Bubble {
|
|
|
36
36
|
private textChangeListeners;
|
|
37
37
|
/** Functions listening for changes to the size of this bubble. */
|
|
38
38
|
private sizeChangeListeners;
|
|
39
|
+
/** Functions listening for changes to the location of this bubble. */
|
|
40
|
+
private locationChangeListeners;
|
|
39
41
|
/** The text of this bubble. */
|
|
40
42
|
private text;
|
|
41
43
|
/** The default size of this bubble, including borders. */
|
|
@@ -63,6 +65,8 @@ export declare class TextInputBubble extends Bubble {
|
|
|
63
65
|
addTextChangeListener(listener: () => void): void;
|
|
64
66
|
/** Adds a change listener to be notified when this bubble's size changes. */
|
|
65
67
|
addSizeChangeListener(listener: () => void): void;
|
|
68
|
+
/** Adds a change listener to be notified when this bubble's location changes. */
|
|
69
|
+
addLocationChangeListener(listener: () => void): void;
|
|
66
70
|
/** Creates the editor UI for this bubble. */
|
|
67
71
|
private createEditor;
|
|
68
72
|
/** Binds events to the text area element. */
|
|
@@ -80,6 +84,9 @@ export declare class TextInputBubble extends Bubble {
|
|
|
80
84
|
setSize(size: Size, relayout?: boolean): void;
|
|
81
85
|
/** @returns the size of this bubble. */
|
|
82
86
|
getSize(): Size;
|
|
87
|
+
moveDuringDrag(newLoc: Coordinate): void;
|
|
88
|
+
setPositionRelativeToAnchor(left: number, top: number): void;
|
|
89
|
+
protected positionByRect(rect?: Rect): void;
|
|
83
90
|
/** Handles mouse down events on the resize target. */
|
|
84
91
|
private onResizePointerDown;
|
|
85
92
|
/** Handles pointer up events on the resize target. */
|
|
@@ -94,5 +101,7 @@ export declare class TextInputBubble extends Bubble {
|
|
|
94
101
|
private onTextChange;
|
|
95
102
|
/** Handles a size change event for the text area. Calls event listeners. */
|
|
96
103
|
private onSizeChange;
|
|
104
|
+
/** Handles a location change event for the text area. Calls event listeners. */
|
|
105
|
+
private onLocationChange;
|
|
97
106
|
}
|
|
98
107
|
//# sourceMappingURL=textinput_bubble.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2024 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { IBoundedElement } from './interfaces/i_bounded_element.js';
|
|
7
|
+
import type { IFlyoutInflater } from './interfaces/i_flyout_inflater.js';
|
|
8
|
+
import type { WorkspaceSvg } from './workspace_svg.js';
|
|
9
|
+
/**
|
|
10
|
+
* Class responsible for creating buttons for flyouts.
|
|
11
|
+
*/
|
|
12
|
+
export declare class ButtonFlyoutInflater implements IFlyoutInflater {
|
|
13
|
+
/**
|
|
14
|
+
* Inflates a flyout button from the given state and adds it to the flyout.
|
|
15
|
+
*
|
|
16
|
+
* @param state A JSON representation of a flyout button.
|
|
17
|
+
* @param flyoutWorkspace The workspace to create the button on.
|
|
18
|
+
* @returns A newly created FlyoutButton.
|
|
19
|
+
*/
|
|
20
|
+
load(state: object, flyoutWorkspace: WorkspaceSvg): IBoundedElement;
|
|
21
|
+
/**
|
|
22
|
+
* Returns the amount of space that should follow this button.
|
|
23
|
+
*
|
|
24
|
+
* @param state A JSON representation of a flyout button.
|
|
25
|
+
* @param defaultGap The default spacing for flyout items.
|
|
26
|
+
* @returns The amount of space that should follow this button.
|
|
27
|
+
*/
|
|
28
|
+
gapForElement(state: object, defaultGap: number): number;
|
|
29
|
+
/**
|
|
30
|
+
* Disposes of the given button.
|
|
31
|
+
*
|
|
32
|
+
* @param element The flyout button to dispose of.
|
|
33
|
+
*/
|
|
34
|
+
disposeElement(element: IBoundedElement): void;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=button_flyout_inflater.d.ts.map
|
package/core/clipboard.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright 2021 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { BlockPaster } from './clipboard/block_paster.js';
|
|
6
|
+
import { BlockCopyData, BlockPaster } from './clipboard/block_paster.js';
|
|
7
7
|
import * as registry from './clipboard/registry.js';
|
|
8
8
|
import type { ICopyData, ICopyable } from './interfaces/i_copyable.js';
|
|
9
9
|
import { Coordinate } from './utils/coordinate.js';
|
|
@@ -38,5 +38,5 @@ export declare const TEST_ONLY: {
|
|
|
38
38
|
duplicateInternal: typeof duplicateInternal;
|
|
39
39
|
copyInternal: typeof copyInternal;
|
|
40
40
|
};
|
|
41
|
-
export { BlockPaster, registry };
|
|
41
|
+
export { BlockCopyData, BlockPaster, registry };
|
|
42
42
|
//# sourceMappingURL=clipboard.d.ts.map
|
|
@@ -67,6 +67,8 @@ export declare class CommentView implements IRenderedElement {
|
|
|
67
67
|
private disposed;
|
|
68
68
|
/** Size of this comment when the resize drag was initiated. */
|
|
69
69
|
private preResizeSize?;
|
|
70
|
+
/** The default size of newly created comments. */
|
|
71
|
+
static defaultCommentSize: Size;
|
|
70
72
|
constructor(workspace: WorkspaceSvg);
|
|
71
73
|
/**
|
|
72
74
|
* Creates the rect we use for highlighting the comment when it's selected.
|
|
@@ -190,6 +192,8 @@ export declare class CommentView implements IRenderedElement {
|
|
|
190
192
|
getText(): string;
|
|
191
193
|
/** Sets the current text of the comment. */
|
|
192
194
|
setText(text: string): void;
|
|
195
|
+
/** Sets the placeholder text displayed for an empty comment. */
|
|
196
|
+
setPlaceholderText(text: string): void;
|
|
193
197
|
/** Registers a callback that listens for text changes. */
|
|
194
198
|
addTextChangeListener(listener: (oldText: string, newText: string) => void): void;
|
|
195
199
|
/** Removes the given listener from the list of text change listeners. */
|
|
@@ -30,6 +30,8 @@ export declare class RenderedWorkspaceComment extends WorkspaceComment implement
|
|
|
30
30
|
private addModelUpdateBindings;
|
|
31
31
|
/** Sets the text of the comment. */
|
|
32
32
|
setText(text: string): void;
|
|
33
|
+
/** Sets the placeholder text displayed if the comment is empty. */
|
|
34
|
+
setPlaceholderText(text: string): void;
|
|
33
35
|
/** Sets the size of the comment. */
|
|
34
36
|
setSize(size: Size): void;
|
|
35
37
|
/** Sets whether the comment is collapsed or not. */
|
package/core/dropdowndiv.d.ts
CHANGED
|
@@ -75,7 +75,7 @@ export declare function getOwner(): Field | null;
|
|
|
75
75
|
*
|
|
76
76
|
* @returns Div to populate with content.
|
|
77
77
|
*/
|
|
78
|
-
export declare function getContentDiv():
|
|
78
|
+
export declare function getContentDiv(): HTMLDivElement;
|
|
79
79
|
/** Clear the content of the drop-down. */
|
|
80
80
|
export declare function clearContent(): void;
|
|
81
81
|
/**
|
package/core/events/events.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export { VarBase, VarBaseJson } from './events_var_base.js';
|
|
|
32
32
|
export { VarCreate, VarCreateJson } from './events_var_create.js';
|
|
33
33
|
export { VarDelete, VarDeleteJson } from './events_var_delete.js';
|
|
34
34
|
export { VarRename, VarRenameJson } from './events_var_rename.js';
|
|
35
|
+
export { VarTypeChange, VarTypeChangeJson } from './events_var_type_change.js';
|
|
35
36
|
export { ViewportChange, ViewportChangeJson } from './events_viewport.js';
|
|
36
37
|
export { FinishedLoading } from './workspace_events.js';
|
|
37
38
|
export type { BumpEvent } from './utils.js';
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @class
|
|
10
10
|
*/
|
|
11
|
-
import type {
|
|
11
|
+
import type { IVariableModel, IVariableState } from '../interfaces/i_variable_model.js';
|
|
12
12
|
import type { Workspace } from '../workspace.js';
|
|
13
13
|
import { Abstract as AbstractEvent, AbstractEventJson } from './events_abstract.js';
|
|
14
14
|
/**
|
|
@@ -22,7 +22,7 @@ export declare class VarBase extends AbstractEvent {
|
|
|
22
22
|
* @param opt_variable The variable this event corresponds to. Undefined for
|
|
23
23
|
* a blank event.
|
|
24
24
|
*/
|
|
25
|
-
constructor(opt_variable?:
|
|
25
|
+
constructor(opt_variable?: IVariableModel<IVariableState>);
|
|
26
26
|
/**
|
|
27
27
|
* Encode the event as JSON.
|
|
28
28
|
*
|
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
* Copyright 2018 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Class for a variable creation event.
|
|
8
|
+
*
|
|
9
|
+
* @class
|
|
10
|
+
*/
|
|
11
|
+
import type { IVariableModel, IVariableState } from '../interfaces/i_variable_model.js';
|
|
7
12
|
import type { Workspace } from '../workspace.js';
|
|
8
13
|
import { VarBase, VarBaseJson } from './events_var_base.js';
|
|
9
14
|
import { EventType } from './type.js';
|
|
@@ -19,7 +24,7 @@ export declare class VarCreate extends VarBase {
|
|
|
19
24
|
/**
|
|
20
25
|
* @param opt_variable The created variable. Undefined for a blank event.
|
|
21
26
|
*/
|
|
22
|
-
constructor(opt_variable?:
|
|
27
|
+
constructor(opt_variable?: IVariableModel<IVariableState>);
|
|
23
28
|
/**
|
|
24
29
|
* Encode the event as JSON.
|
|
25
30
|
*
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright 2018 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import type {
|
|
6
|
+
import type { IVariableModel, IVariableState } from '../interfaces/i_variable_model.js';
|
|
7
7
|
import type { Workspace } from '../workspace.js';
|
|
8
8
|
import { VarBase, VarBaseJson } from './events_var_base.js';
|
|
9
9
|
import { EventType } from './type.js';
|
|
@@ -21,7 +21,7 @@ export declare class VarDelete extends VarBase {
|
|
|
21
21
|
/**
|
|
22
22
|
* @param opt_variable The deleted variable. Undefined for a blank event.
|
|
23
23
|
*/
|
|
24
|
-
constructor(opt_variable?:
|
|
24
|
+
constructor(opt_variable?: IVariableModel<IVariableState>);
|
|
25
25
|
/**
|
|
26
26
|
* Encode the event as JSON.
|
|
27
27
|
*
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright 2018 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import type {
|
|
6
|
+
import type { IVariableModel, IVariableState } from '../interfaces/i_variable_model.js';
|
|
7
7
|
import type { Workspace } from '../workspace.js';
|
|
8
8
|
import { VarBase, VarBaseJson } from './events_var_base.js';
|
|
9
9
|
import { EventType } from './type.js';
|
|
@@ -22,7 +22,7 @@ export declare class VarRename extends VarBase {
|
|
|
22
22
|
* @param opt_variable The renamed variable. Undefined for a blank event.
|
|
23
23
|
* @param newName The new name the variable will be changed to.
|
|
24
24
|
*/
|
|
25
|
-
constructor(opt_variable?:
|
|
25
|
+
constructor(opt_variable?: IVariableModel<IVariableState>, newName?: string);
|
|
26
26
|
/**
|
|
27
27
|
* Encode the event as JSON.
|
|
28
28
|
*
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2024 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Class for a variable type change event.
|
|
8
|
+
*
|
|
9
|
+
* @class
|
|
10
|
+
*/
|
|
11
|
+
import type { IVariableModel, IVariableState } from '../interfaces/i_variable_model.js';
|
|
12
|
+
import type { Workspace } from '../workspace.js';
|
|
13
|
+
import { VarBase, VarBaseJson } from './events_var_base.js';
|
|
14
|
+
import { EventType } from './type.js';
|
|
15
|
+
/**
|
|
16
|
+
* Notifies listeners that a variable's type has changed.
|
|
17
|
+
*/
|
|
18
|
+
export declare class VarTypeChange extends VarBase {
|
|
19
|
+
oldType?: string | undefined;
|
|
20
|
+
newType?: string | undefined;
|
|
21
|
+
type: EventType;
|
|
22
|
+
/**
|
|
23
|
+
* @param variable The variable whose type changed. Undefined for a blank event.
|
|
24
|
+
* @param oldType The old type of the variable. Undefined for a blank event.
|
|
25
|
+
* @param newType The new type of the variable. Undefined for a blank event.
|
|
26
|
+
*/
|
|
27
|
+
constructor(variable?: IVariableModel<IVariableState>, oldType?: string | undefined, newType?: string | undefined);
|
|
28
|
+
/**
|
|
29
|
+
* Encode the event as JSON.
|
|
30
|
+
*
|
|
31
|
+
* @returns JSON representation.
|
|
32
|
+
*/
|
|
33
|
+
toJson(): VarTypeChangeJson;
|
|
34
|
+
/**
|
|
35
|
+
* Deserializes the JSON event.
|
|
36
|
+
*
|
|
37
|
+
* @param event The event to append new properties to. Should be a subclass
|
|
38
|
+
* of VarTypeChange, but we can't specify that due to the fact that
|
|
39
|
+
* parameters to static methods in subclasses must be supertypes of
|
|
40
|
+
* parameters to static methods in superclasses.
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
static fromJson(json: VarTypeChangeJson, workspace: Workspace, event?: any): VarTypeChange;
|
|
44
|
+
/**
|
|
45
|
+
* Run a variable type change event.
|
|
46
|
+
*
|
|
47
|
+
* @param forward True if run forward, false if run backward (undo).
|
|
48
|
+
*/
|
|
49
|
+
run(forward: boolean): void;
|
|
50
|
+
}
|
|
51
|
+
export interface VarTypeChangeJson extends VarBaseJson {
|
|
52
|
+
oldType: string;
|
|
53
|
+
newType: string;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=events_var_type_change.d.ts.map
|
package/core/events/type.d.ts
CHANGED
|
@@ -27,6 +27,8 @@ export declare enum EventType {
|
|
|
27
27
|
VAR_DELETE = "var_delete",
|
|
28
28
|
/** Type of event that renames a variable. */
|
|
29
29
|
VAR_RENAME = "var_rename",
|
|
30
|
+
/** Type of event that changes the type of a variable. */
|
|
31
|
+
VAR_TYPE_CHANGE = "var_type_change",
|
|
30
32
|
/**
|
|
31
33
|
* Type of generic event that records a UI change.
|
|
32
34
|
*
|
package/core/field.d.ts
CHANGED
|
@@ -141,8 +141,6 @@ export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IAS
|
|
|
141
141
|
* case by default so that SERIALIZABLE is backwards compatible.
|
|
142
142
|
*/
|
|
143
143
|
SERIALIZABLE: boolean;
|
|
144
|
-
/** Mouse cursor style when over the hotspot that initiates the editor. */
|
|
145
|
-
CURSOR: string;
|
|
146
144
|
/**
|
|
147
145
|
* @param value The initial value of the field.
|
|
148
146
|
* Also accepts Field.SKIP_SETUP if you wish to skip setup (only used by
|
|
@@ -231,7 +229,6 @@ export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IAS
|
|
|
231
229
|
* called by Blockly.Xml.
|
|
232
230
|
*
|
|
233
231
|
* @param fieldElement The element containing info about the field's state.
|
|
234
|
-
* @internal
|
|
235
232
|
*/
|
|
236
233
|
fromXml(fieldElement: Element): void;
|
|
237
234
|
/**
|
|
@@ -240,7 +237,6 @@ export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IAS
|
|
|
240
237
|
* @param fieldElement The element to populate with info about the field's
|
|
241
238
|
* state.
|
|
242
239
|
* @returns The element containing info about the field's state.
|
|
243
|
-
* @internal
|
|
244
240
|
*/
|
|
245
241
|
toXml(fieldElement: Element): Element;
|
|
246
242
|
/**
|
|
@@ -254,7 +250,6 @@ export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IAS
|
|
|
254
250
|
* {@link https://developers.devsite.google.com/blockly/guides/create-custom-blocks/fields/customizing-fields/creating#full_serialization_and_backing_data | field serialization docs}
|
|
255
251
|
* for more information.
|
|
256
252
|
* @returns JSON serializable state.
|
|
257
|
-
* @internal
|
|
258
253
|
*/
|
|
259
254
|
saveState(_doFullSerialization?: boolean): any;
|
|
260
255
|
/**
|
|
@@ -262,7 +257,6 @@ export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IAS
|
|
|
262
257
|
* called by the serialization system.
|
|
263
258
|
*
|
|
264
259
|
* @param state The state we want to apply to the field.
|
|
265
|
-
* @internal
|
|
266
260
|
*/
|
|
267
261
|
loadState(state: any): void;
|
|
268
262
|
/**
|
|
@@ -287,8 +281,6 @@ export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IAS
|
|
|
287
281
|
loadLegacyState(callingClass: FieldProto, state: any): boolean;
|
|
288
282
|
/**
|
|
289
283
|
* Dispose of all DOM objects and events belonging to this editable field.
|
|
290
|
-
*
|
|
291
|
-
* @internal
|
|
292
284
|
*/
|
|
293
285
|
dispose(): void;
|
|
294
286
|
/** Add or remove the UI indicating if this field is editable or not. */
|
|
@@ -540,8 +532,6 @@ export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IAS
|
|
|
540
532
|
* rerender this field and adjust for any sizing changes.
|
|
541
533
|
* Other fields on the same block will not rerender, because their sizes have
|
|
542
534
|
* already been recorded.
|
|
543
|
-
*
|
|
544
|
-
* @internal
|
|
545
535
|
*/
|
|
546
536
|
forceRerender(): void;
|
|
547
537
|
/**
|
|
@@ -651,14 +641,11 @@ export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IAS
|
|
|
651
641
|
* Subclasses may override this.
|
|
652
642
|
*
|
|
653
643
|
* @returns True if this field has any variable references.
|
|
654
|
-
* @internal
|
|
655
644
|
*/
|
|
656
645
|
referencesVariables(): boolean;
|
|
657
646
|
/**
|
|
658
647
|
* Refresh the variable name referenced by this field if this field references
|
|
659
648
|
* variables.
|
|
660
|
-
*
|
|
661
|
-
* @internal
|
|
662
649
|
*/
|
|
663
650
|
refreshVariableName(): void;
|
|
664
651
|
/**
|
package/core/field_checkbox.d.ts
CHANGED
|
@@ -24,10 +24,6 @@ export declare class FieldCheckbox extends Field<CheckboxBool> {
|
|
|
24
24
|
* are not. Editable fields should also be serializable.
|
|
25
25
|
*/
|
|
26
26
|
SERIALIZABLE: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Mouse cursor style when over the hotspot that initiates editability.
|
|
29
|
-
*/
|
|
30
|
-
CURSOR: string;
|
|
31
27
|
/**
|
|
32
28
|
* NOTE: The default value is set in `Field`, so maintain that value instead
|
|
33
29
|
* of overwriting it here or in the constructor.
|
package/core/field_dropdown.d.ts
CHANGED
|
@@ -35,8 +35,6 @@ export declare class FieldDropdown extends Field<string> {
|
|
|
35
35
|
* are not. Editable fields should also be serializable.
|
|
36
36
|
*/
|
|
37
37
|
SERIALIZABLE: boolean;
|
|
38
|
-
/** Mouse cursor style when over the hotspot that initiates the editor. */
|
|
39
|
-
CURSOR: string;
|
|
40
38
|
protected menuGenerator_?: MenuGenerator;
|
|
41
39
|
/** A cache of the most recently generated options. */
|
|
42
40
|
private generatedOptions;
|
package/core/field_input.d.ts
CHANGED
|
@@ -62,8 +62,6 @@ export declare abstract class FieldInput<T extends InputTypes> extends Field<str
|
|
|
62
62
|
* are not. Editable fields should also be serializable.
|
|
63
63
|
*/
|
|
64
64
|
SERIALIZABLE: boolean;
|
|
65
|
-
/** Mouse cursor style when over the hotspot that initiates the editor. */
|
|
66
|
-
CURSOR: string;
|
|
67
65
|
/**
|
|
68
66
|
* @param value The initial value of the field. Should cast to a string.
|
|
69
67
|
* Defaults to an empty string if null or undefined. Also accepts
|
package/core/field_number.d.ts
CHANGED
|
@@ -145,6 +145,12 @@ export declare class FieldNumber extends FieldInput<number> {
|
|
|
145
145
|
* @returns The newly created number input editor.
|
|
146
146
|
*/
|
|
147
147
|
protected widgetCreate_(): HTMLInputElement;
|
|
148
|
+
/**
|
|
149
|
+
* Initialize the field's DOM.
|
|
150
|
+
*
|
|
151
|
+
* @override
|
|
152
|
+
*/
|
|
153
|
+
initView(): void;
|
|
148
154
|
/**
|
|
149
155
|
* Construct a FieldNumber from a JSON arg object.
|
|
150
156
|
*
|
|
@@ -30,6 +30,7 @@ export declare class FieldTextInput extends FieldInput<string> {
|
|
|
30
30
|
* for a list of properties this parameter supports.
|
|
31
31
|
*/
|
|
32
32
|
constructor(value?: string | typeof Field.SKIP_SETUP, validator?: FieldTextInputValidator | null, config?: FieldTextInputConfig);
|
|
33
|
+
initView(): void;
|
|
33
34
|
/**
|
|
34
35
|
* Ensure that the input value casts to a valid string.
|
|
35
36
|
*
|