blockly 11.2.0-beta.1 → 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 +737 -734
- package/blockly.mjs +5 -1
- package/blockly_compressed.js +719 -717
- package/blockly_compressed.js.map +1 -1
- package/blocks_compressed.js +18 -17
- package/blocks_compressed.js.map +1 -1
- package/core/block.d.ts +22 -22
- package/core/block_flyout_inflater.d.ts +89 -0
- package/core/block_svg.d.ts +21 -10
- 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/component_manager.d.ts +1 -1
- package/core/contextmenu_registry.d.ts +1 -1
- package/core/dragging/block_drag_strategy.d.ts +2 -0
- package/core/dropdowndiv.d.ts +1 -1
- package/core/events/events.d.ts +1 -0
- package/core/events/events_block_move.d.ts +1 -1
- 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 +5 -18
- package/core/field_checkbox.d.ts +1 -5
- package/core/field_dropdown.d.ts +0 -2
- package/core/field_input.d.ts +5 -7
- 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 +48 -177
- package/core/flyout_button.d.ts +25 -6
- package/core/flyout_horizontal.d.ts +2 -3
- package/core/flyout_metrics_manager.d.ts +1 -1
- package/core/flyout_separator.d.ts +45 -0
- package/core/flyout_vertical.d.ts +3 -4
- package/core/generator.d.ts +1 -1
- package/core/gesture.d.ts +1 -1
- 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/marker_manager.d.ts +3 -3
- package/core/menuitem.d.ts +0 -7
- package/core/names.d.ts +8 -2
- package/core/options.d.ts +4 -4
- 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/scrollbar_pair.d.ts +1 -1
- package/core/separator_flyout_inflater.d.ts +47 -0
- package/core/serialization/variables.d.ts +3 -10
- package/core/shortcut_registry.d.ts +2 -2
- package/core/theme_manager.d.ts +1 -1
- package/core/toolbox/category.d.ts +2 -2
- package/core/toolbox/collapsible_category.d.ts +1 -1
- package/core/toolbox/separator.d.ts +1 -1
- package/core/toolbox/toolbox.d.ts +10 -13
- package/core/variable_map.d.ts +29 -31
- package/core/variable_model.d.ts +38 -12
- package/core/variables.d.ts +38 -8
- package/core/widgetdiv.d.ts +2 -2
- package/core/workspace.d.ts +22 -20
- package/core/workspace_audio.d.ts +1 -1
- package/core/workspace_dragger.d.ts +2 -2
- package/core/workspace_svg.d.ts +40 -13
- package/core/xml.d.ts +2 -2
- package/index.mjs +5 -1
- package/package.json +7 -6
- 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.
|
|
@@ -55,7 +55,7 @@ export declare class Block implements IASTNodeLocation {
|
|
|
55
55
|
* Colour of the block as HSV hue value (0-360)
|
|
56
56
|
* This may be null if the block colour was not set via a hue number.
|
|
57
57
|
*/
|
|
58
|
-
private
|
|
58
|
+
private hue;
|
|
59
59
|
/** Colour of the block in '#RRGGBB' format. */
|
|
60
60
|
protected colour_: string;
|
|
61
61
|
/** Name of the block style. */
|
|
@@ -134,10 +134,10 @@ export declare class Block implements IASTNodeLocation {
|
|
|
134
134
|
contextMenu: boolean;
|
|
135
135
|
protected parentBlock_: this | null;
|
|
136
136
|
protected childBlocks_: this[];
|
|
137
|
-
private
|
|
138
|
-
private
|
|
139
|
-
private
|
|
140
|
-
private
|
|
137
|
+
private deletable;
|
|
138
|
+
private movable;
|
|
139
|
+
private editable;
|
|
140
|
+
private shadow;
|
|
141
141
|
protected collapsed_: boolean;
|
|
142
142
|
protected outputShape_: number | null;
|
|
143
143
|
/**
|
|
@@ -150,7 +150,7 @@ export declare class Block implements IASTNodeLocation {
|
|
|
150
150
|
* @internal
|
|
151
151
|
*/
|
|
152
152
|
initialized: boolean;
|
|
153
|
-
private readonly
|
|
153
|
+
private readonly xy;
|
|
154
154
|
isInFlyout: boolean;
|
|
155
155
|
isInMutator: boolean;
|
|
156
156
|
RTL: boolean;
|
|
@@ -165,7 +165,7 @@ export declare class Block implements IASTNodeLocation {
|
|
|
165
165
|
*/
|
|
166
166
|
helpUrl: string | (() => string) | null;
|
|
167
167
|
/** A bound callback function to use when the parent workspace changes. */
|
|
168
|
-
private
|
|
168
|
+
private onchangeWrapper;
|
|
169
169
|
/**
|
|
170
170
|
* A count of statement inputs on the block.
|
|
171
171
|
*
|
|
@@ -230,7 +230,7 @@ export declare class Block implements IASTNodeLocation {
|
|
|
230
230
|
* @param opt_healStack Disconnect right-side block and connect to left-side
|
|
231
231
|
* block. Defaults to false.
|
|
232
232
|
*/
|
|
233
|
-
private
|
|
233
|
+
private unplugFromRow;
|
|
234
234
|
/**
|
|
235
235
|
* Returns the connection on the value input that is connected to another
|
|
236
236
|
* block. When an insertion marker is connected to a connection with a block
|
|
@@ -240,7 +240,7 @@ export declare class Block implements IASTNodeLocation {
|
|
|
240
240
|
*
|
|
241
241
|
* @returns The connection on the value input, or null.
|
|
242
242
|
*/
|
|
243
|
-
private
|
|
243
|
+
private getOnlyValueConnection;
|
|
244
244
|
/**
|
|
245
245
|
* Unplug this statement block from its superior block. Optionally reconnect
|
|
246
246
|
* the block underneath with the block on top.
|
|
@@ -248,7 +248,7 @@ export declare class Block implements IASTNodeLocation {
|
|
|
248
248
|
* @param opt_healStack Disconnect child statement and reconnect stack.
|
|
249
249
|
* Defaults to false.
|
|
250
250
|
*/
|
|
251
|
-
private
|
|
251
|
+
private unplugFromStack;
|
|
252
252
|
/**
|
|
253
253
|
* Returns all connections originating from this block.
|
|
254
254
|
*
|
|
@@ -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.
|
|
@@ -783,14 +783,14 @@ export declare class Block implements IASTNodeLocation {
|
|
|
783
783
|
* @param json Structured data describing the block.
|
|
784
784
|
* @param warningPrefix Warning prefix string identifying block.
|
|
785
785
|
*/
|
|
786
|
-
private
|
|
786
|
+
private jsonInitColour;
|
|
787
787
|
/**
|
|
788
788
|
* Initialize the style of this block from the JSON description.
|
|
789
789
|
*
|
|
790
790
|
* @param json Structured data describing the block.
|
|
791
791
|
* @param warningPrefix Warning prefix string identifying block.
|
|
792
792
|
*/
|
|
793
|
-
private
|
|
793
|
+
private jsonInitStyle;
|
|
794
794
|
/**
|
|
795
795
|
* Add key/values from mixinObj to this block object. By default, this method
|
|
796
796
|
* will check that the keys in mixinObj will not overwrite existing values in
|
|
@@ -812,7 +812,7 @@ export declare class Block implements IASTNodeLocation {
|
|
|
812
812
|
* of newline tokens, how should it be aligned?
|
|
813
813
|
* @param warningPrefix Warning prefix string identifying block.
|
|
814
814
|
*/
|
|
815
|
-
private
|
|
815
|
+
private interpolate;
|
|
816
816
|
/**
|
|
817
817
|
* Validates that the tokens are within the correct bounds, with no
|
|
818
818
|
* duplicates, and that all of the arguments are referred to. Throws errors if
|
|
@@ -821,7 +821,7 @@ export declare class Block implements IASTNodeLocation {
|
|
|
821
821
|
* @param tokens An array of tokens to validate
|
|
822
822
|
* @param argsCount The number of args that need to be referred to.
|
|
823
823
|
*/
|
|
824
|
-
private
|
|
824
|
+
private validateTokens;
|
|
825
825
|
/**
|
|
826
826
|
* Inserts args in place of numerical tokens. String args are converted to
|
|
827
827
|
* JSON that defines a label field. Newline characters are converted to
|
|
@@ -834,7 +834,7 @@ export declare class Block implements IASTNodeLocation {
|
|
|
834
834
|
* or dummy inputs, if necessary.
|
|
835
835
|
* @returns The JSON definitions of field and inputs to add to the block.
|
|
836
836
|
*/
|
|
837
|
-
private
|
|
837
|
+
private interpolateArguments;
|
|
838
838
|
/**
|
|
839
839
|
* Creates a field from the JSON definition of a field. If a field with the
|
|
840
840
|
* given type cannot be found, this attempts to create a different field using
|
|
@@ -843,7 +843,7 @@ export declare class Block implements IASTNodeLocation {
|
|
|
843
843
|
* @param element The element to try to turn into a field.
|
|
844
844
|
* @returns The field defined by the JSON, or null if one couldn't be created.
|
|
845
845
|
*/
|
|
846
|
-
private
|
|
846
|
+
private fieldFromJson;
|
|
847
847
|
/**
|
|
848
848
|
* Creates an input from the JSON definition of an input. Sets the input's
|
|
849
849
|
* check and alignment if they are provided.
|
|
@@ -854,7 +854,7 @@ export declare class Block implements IASTNodeLocation {
|
|
|
854
854
|
* @returns The input that has been created, or null if one could not be
|
|
855
855
|
* created for some reason (should never happen).
|
|
856
856
|
*/
|
|
857
|
-
private
|
|
857
|
+
private inputFromJson;
|
|
858
858
|
/**
|
|
859
859
|
* Returns true if the given string matches one of the input keywords.
|
|
860
860
|
*
|
|
@@ -862,7 +862,7 @@ export declare class Block implements IASTNodeLocation {
|
|
|
862
862
|
* @returns True if the given string matches one of the input keywords, false
|
|
863
863
|
* otherwise.
|
|
864
864
|
*/
|
|
865
|
-
private
|
|
865
|
+
private isInputKeyword;
|
|
866
866
|
/**
|
|
867
867
|
* Turns a string into the JSON definition of a label field. If the string
|
|
868
868
|
* becomes an empty string when trimmed, this returns null.
|
|
@@ -870,7 +870,7 @@ export declare class Block implements IASTNodeLocation {
|
|
|
870
870
|
* @param str String to turn into the JSON definition of a label field.
|
|
871
871
|
* @returns The JSON definition or null.
|
|
872
872
|
*/
|
|
873
|
-
private
|
|
873
|
+
private stringToFieldJson;
|
|
874
874
|
/**
|
|
875
875
|
* Move a named input to a different location on this block.
|
|
876
876
|
*
|
|
@@ -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
|
@@ -91,20 +91,13 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
|
|
|
91
91
|
private warningTextDb;
|
|
92
92
|
/** Block's mutator icon (if any). */
|
|
93
93
|
mutator: MutatorIcon | null;
|
|
94
|
-
private
|
|
94
|
+
private svgGroup;
|
|
95
95
|
style: BlockStyle;
|
|
96
96
|
/** @internal */
|
|
97
97
|
pathObject: IPathObject;
|
|
98
98
|
/** Is this block a BlockSVG? */
|
|
99
99
|
readonly rendered = true;
|
|
100
100
|
private visuallyDisabled;
|
|
101
|
-
/**
|
|
102
|
-
* Is this block currently rendering? Used to stop recursive render calls
|
|
103
|
-
* from actually triggering a re-render.
|
|
104
|
-
*/
|
|
105
|
-
private renderIsInProgress_;
|
|
106
|
-
/** Whether mousedown events have been bound yet. */
|
|
107
|
-
private eventsInit_;
|
|
108
101
|
workspace: WorkspaceSvg;
|
|
109
102
|
outputConnection: RenderedConnection;
|
|
110
103
|
nextConnection: RenderedConnection;
|
|
@@ -238,7 +231,7 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
|
|
|
238
231
|
* Makes sure that when the block is collapsed, it is rendered correctly
|
|
239
232
|
* for that state.
|
|
240
233
|
*/
|
|
241
|
-
private
|
|
234
|
+
private updateCollapsed;
|
|
242
235
|
/**
|
|
243
236
|
* Open the next (or previous) FieldTextInput.
|
|
244
237
|
*
|
|
@@ -251,7 +244,7 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
|
|
|
251
244
|
*
|
|
252
245
|
* @param e Pointer down event.
|
|
253
246
|
*/
|
|
254
|
-
private
|
|
247
|
+
private onMouseDown;
|
|
255
248
|
/**
|
|
256
249
|
* Load the block's help page in a new window.
|
|
257
250
|
*
|
|
@@ -282,6 +275,18 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
|
|
|
282
275
|
private updateConnectionLocations;
|
|
283
276
|
private updateIconLocations;
|
|
284
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;
|
|
285
290
|
/**
|
|
286
291
|
* Recursively adds or removes the dragging class to this node and its
|
|
287
292
|
* children.
|
|
@@ -413,6 +418,11 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
|
|
|
413
418
|
* update whether the block is currently disabled for this reason.
|
|
414
419
|
*/
|
|
415
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;
|
|
416
426
|
/**
|
|
417
427
|
* Set whether the block is highlighted or not. Block highlighting is
|
|
418
428
|
* often used to visually mark blocks currently being executed.
|
|
@@ -713,5 +723,6 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
|
|
|
713
723
|
* Returns a representation of this block that can be displayed in a flyout.
|
|
714
724
|
*/
|
|
715
725
|
toFlyoutInfo(): FlyoutItemInfo[];
|
|
726
|
+
jsonInit(json: any): void;
|
|
716
727
|
}
|
|
717
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. */
|
|
@@ -18,7 +18,7 @@ declare class Capability<_T> {
|
|
|
18
18
|
static DRAG_TARGET: Capability<IDragTarget>;
|
|
19
19
|
static DELETE_AREA: Capability<IDeleteArea>;
|
|
20
20
|
static AUTOHIDEABLE: Capability<IAutoHideable>;
|
|
21
|
-
private readonly
|
|
21
|
+
private readonly name;
|
|
22
22
|
/** @param name The name of the component capability. */
|
|
23
23
|
constructor(name: string);
|
|
24
24
|
/**
|
|
@@ -19,7 +19,7 @@ import type { WorkspaceSvg } from './workspace_svg.js';
|
|
|
19
19
|
export declare class ContextMenuRegistry {
|
|
20
20
|
static registry: ContextMenuRegistry;
|
|
21
21
|
/** Registry of all registered RegistryItems, keyed by ID. */
|
|
22
|
-
private
|
|
22
|
+
private registeredItems;
|
|
23
23
|
/** Resets the existing singleton instance of ContextMenuRegistry. */
|
|
24
24
|
constructor();
|
|
25
25
|
/** Clear and recreate the registry. */
|
|
@@ -96,6 +96,8 @@ export declare class BlockDragStrategy implements IDragStrategy {
|
|
|
96
96
|
* connections.
|
|
97
97
|
*/
|
|
98
98
|
endDrag(e?: PointerEvent): void;
|
|
99
|
+
/** Disposes of any state at the end of the drag. */
|
|
100
|
+
private disposeStep;
|
|
99
101
|
/** Connects the given candidate connections. */
|
|
100
102
|
private applyConnections;
|
|
101
103
|
/**
|
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
|
*
|