blockly 11.2.0 → 12.0.0-beta.1
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 +783 -767
- package/blockly.mjs +6 -1
- package/blockly_compressed.js +768 -752
- package/blockly_compressed.js.map +1 -1
- package/blocks_compressed.js +15 -15
- package/blocks_compressed.js.map +1 -1
- package/core/block.d.ts +11 -6
- package/core/block_flyout_inflater.d.ts +95 -0
- package/core/block_svg.d.ts +26 -2
- package/core/blockly.d.ts +11 -3
- package/core/bubbles/textinput_bubble.d.ts +9 -0
- package/core/button_flyout_inflater.d.ts +42 -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/connection.d.ts +1 -1
- 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 -4
- package/core/events/events_var_rename.d.ts +2 -4
- 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 +45 -181
- package/core/flyout_button.d.ts +25 -6
- package/core/flyout_horizontal.d.ts +4 -4
- package/core/flyout_item.d.ts +32 -0
- package/core/flyout_separator.d.ts +45 -0
- package/core/flyout_vertical.d.ts +5 -5
- 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.d.ts +1 -1
- package/core/interfaces/i_flyout_inflater.d.ts +48 -0
- package/core/interfaces/i_metrics_manager.d.ts +1 -1
- package/core/interfaces/i_rendered_element.d.ts +1 -4
- 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 +42 -0
- package/core/menu.d.ts +1 -3
- package/core/menuitem.d.ts +0 -7
- package/core/metrics_manager.d.ts +1 -1
- package/core/names.d.ts +8 -2
- package/core/procedures.d.ts +7 -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 +13 -18
- package/core/renderers/geras/renderer.d.ts +1 -1
- package/core/renderers/measurables/in_row_spacer.d.ts +1 -0
- package/core/renderers/measurables/jagged_edge.d.ts +1 -0
- package/core/renderers/measurables/next_connection.d.ts +1 -0
- package/core/renderers/measurables/previous_connection.d.ts +1 -0
- package/core/renderers/measurables/round_corner.d.ts +1 -0
- package/core/renderers/measurables/square_corner.d.ts +1 -0
- package/core/renderers/measurables/statement_input.d.ts +1 -0
- package/core/renderers/measurables/types.d.ts +49 -24
- 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 +57 -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 +56 -12
- package/core/variables_dynamic.d.ts +7 -5
- package/core/widgetdiv.d.ts +2 -2
- package/core/workspace.d.ts +21 -19
- package/core/workspace_svg.d.ts +34 -6
- package/core/xml.d.ts +2 -2
- package/index.mjs +6 -1
- package/media/1x1.gif +0 -0
- package/media/click.mp3 +0 -0
- package/media/click.ogg +0 -0
- package/media/click.wav +0 -0
- package/media/delete.mp3 +0 -0
- package/media/delete.ogg +0 -0
- package/media/delete.wav +0 -0
- package/media/disconnect.mp3 +0 -0
- package/media/disconnect.ogg +0 -0
- package/media/disconnect.wav +0 -0
- package/media/handclosed.cur +0 -0
- package/media/handdelete.cur +0 -0
- package/media/handopen.cur +0 -0
- package/media/pilcrow.png +0 -0
- package/media/quote0.png +0 -0
- package/media/quote1.png +0 -0
- package/media/sprites.png +0 -0
- 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
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* Copyright 2017 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { Flyout
|
|
6
|
+
import { Flyout } from './flyout_base.js';
|
|
7
|
+
import type { FlyoutItem } from './flyout_item.js';
|
|
7
8
|
import type { Options } from './options.js';
|
|
8
9
|
import type { Coordinate } from './utils/coordinate.js';
|
|
9
10
|
import { Rect } from './utils/rect.js';
|
|
@@ -57,10 +58,9 @@ export declare class VerticalFlyout extends Flyout {
|
|
|
57
58
|
/**
|
|
58
59
|
* Lay out the blocks in the flyout.
|
|
59
60
|
*
|
|
60
|
-
* @param contents The
|
|
61
|
-
* @param gaps The visible gaps between blocks.
|
|
61
|
+
* @param contents The flyout items to lay out.
|
|
62
62
|
*/
|
|
63
|
-
protected layout_(contents: FlyoutItem[]
|
|
63
|
+
protected layout_(contents: FlyoutItem[]): void;
|
|
64
64
|
/**
|
|
65
65
|
* Determine if a drag delta is toward the workspace, based on the position
|
|
66
66
|
* and orientation of the flyout. This is used in determineDragIntention_ to
|
|
@@ -80,7 +80,7 @@ export declare class VerticalFlyout extends Flyout {
|
|
|
80
80
|
*/
|
|
81
81
|
getClientRect(): Rect | null;
|
|
82
82
|
/**
|
|
83
|
-
* Compute width of flyout.
|
|
83
|
+
* Compute width of flyout.
|
|
84
84
|
* For RTL: Lay out the blocks and buttons to be right-aligned.
|
|
85
85
|
*/
|
|
86
86
|
protected reflowInternal_(): void;
|
package/core/grid.d.ts
CHANGED
|
@@ -113,9 +113,12 @@ export declare class Grid {
|
|
|
113
113
|
* @param rnd A random ID to append to the pattern's ID.
|
|
114
114
|
* @param gridOptions The object containing grid configuration.
|
|
115
115
|
* @param defs The root SVG element for this workspace's defs.
|
|
116
|
+
* @param injectionDiv The div containing the parent workspace and all related
|
|
117
|
+
* workspaces and block containers. CSS variables representing SVG patterns
|
|
118
|
+
* will be scoped to this container.
|
|
116
119
|
* @returns The SVG element for the grid pattern.
|
|
117
120
|
* @internal
|
|
118
121
|
*/
|
|
119
|
-
static createDom(rnd: string, gridOptions: GridOptions, defs: SVGElement): SVGElement;
|
|
122
|
+
static createDom(rnd: string, gridOptions: GridOptions, defs: SVGElement, injectionDiv?: HTMLElement): SVGElement;
|
|
120
123
|
}
|
|
121
124
|
//# sourceMappingURL=grid.d.ts.map
|
|
@@ -28,6 +28,8 @@ export declare class CommentIcon extends Icon implements IHasBubble, ISerializab
|
|
|
28
28
|
private text;
|
|
29
29
|
/** The size of this comment (which is applied to the editable bubble). */
|
|
30
30
|
private bubbleSize;
|
|
31
|
+
/** The location of the comment bubble in workspace coordinates. */
|
|
32
|
+
private bubbleLocation?;
|
|
31
33
|
/**
|
|
32
34
|
* The visibility of the bubble for this comment.
|
|
33
35
|
*
|
|
@@ -60,6 +62,14 @@ export declare class CommentIcon extends Icon implements IHasBubble, ISerializab
|
|
|
60
62
|
setBubbleSize(size: Size): void;
|
|
61
63
|
/** @returns the size of the editable bubble for this comment. */
|
|
62
64
|
getBubbleSize(): Size;
|
|
65
|
+
/**
|
|
66
|
+
* Sets the location of the comment bubble in the workspace.
|
|
67
|
+
*/
|
|
68
|
+
setBubbleLocation(location: Coordinate): void;
|
|
69
|
+
/**
|
|
70
|
+
* @returns the location of the comment bubble in the workspace.
|
|
71
|
+
*/
|
|
72
|
+
getBubbleLocation(): Coordinate | undefined;
|
|
63
73
|
/**
|
|
64
74
|
* @returns the state of the comment as a JSON serializable value if the
|
|
65
75
|
* comment has text. Otherwise returns null.
|
|
@@ -79,6 +89,7 @@ export declare class CommentIcon extends Icon implements IHasBubble, ISerializab
|
|
|
79
89
|
* input bubble.
|
|
80
90
|
*/
|
|
81
91
|
onSizeChange(): void;
|
|
92
|
+
onBubbleLocationChange(): void;
|
|
82
93
|
bubbleIsVisible(): boolean;
|
|
83
94
|
setBubbleVisible(visible: boolean): Promise<void>;
|
|
84
95
|
/**
|
|
@@ -112,5 +123,9 @@ export interface CommentState {
|
|
|
112
123
|
height?: number;
|
|
113
124
|
/** The width of the comment bubble. */
|
|
114
125
|
width?: number;
|
|
126
|
+
/** The X coordinate of the comment bubble. */
|
|
127
|
+
x?: number;
|
|
128
|
+
/** The Y coordinate of the comment bubble. */
|
|
129
|
+
y?: number;
|
|
115
130
|
}
|
|
116
131
|
//# sourceMappingURL=comment_icon.d.ts.map
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { CommentState } from '../icons/comment_icon.js';
|
|
7
|
+
import { Coordinate } from '../utils/coordinate.js';
|
|
7
8
|
import { Size } from '../utils/size.js';
|
|
8
9
|
import { IHasBubble } from './i_has_bubble.js';
|
|
9
10
|
import { IIcon } from './i_icon.js';
|
|
@@ -13,6 +14,8 @@ export interface ICommentIcon extends IIcon, IHasBubble, ISerializable {
|
|
|
13
14
|
getText(): string;
|
|
14
15
|
setBubbleSize(size: Size): void;
|
|
15
16
|
getBubbleSize(): Size;
|
|
17
|
+
setBubbleLocation(location: Coordinate): void;
|
|
18
|
+
getBubbleLocation(): Coordinate | undefined;
|
|
16
19
|
saveState(): CommentState;
|
|
17
20
|
loadState(state: CommentState): void;
|
|
18
21
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import type { BlockSvg } from '../block_svg.js';
|
|
7
|
-
import { FlyoutItem } from '../
|
|
7
|
+
import type { FlyoutItem } from '../flyout_item.js';
|
|
8
8
|
import type { Coordinate } from '../utils/coordinate.js';
|
|
9
9
|
import type { Svg } from '../utils/svg.js';
|
|
10
10
|
import type { FlyoutDefinition } from '../utils/toolbox.js';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { FlyoutItem } from '../flyout_item.js';
|
|
2
|
+
import type { WorkspaceSvg } from '../workspace_svg.js';
|
|
3
|
+
export interface IFlyoutInflater {
|
|
4
|
+
/**
|
|
5
|
+
* Loads the object represented by the given state onto the workspace.
|
|
6
|
+
*
|
|
7
|
+
* Note that this method's interface is identical to that in ISerializer, to
|
|
8
|
+
* allow for code reuse.
|
|
9
|
+
*
|
|
10
|
+
* @param state A JSON representation of an element to inflate on the flyout.
|
|
11
|
+
* @param flyoutWorkspace The flyout's workspace, where the inflated element
|
|
12
|
+
* should be created. If the inflated element is an `IRenderedElement` it
|
|
13
|
+
* itself or the inflater should append it to the workspace; the flyout
|
|
14
|
+
* will not do so itself. The flyout is responsible for positioning the
|
|
15
|
+
* element, however.
|
|
16
|
+
* @returns The newly inflated flyout element.
|
|
17
|
+
*/
|
|
18
|
+
load(state: object, flyoutWorkspace: WorkspaceSvg): FlyoutItem;
|
|
19
|
+
/**
|
|
20
|
+
* Returns the amount of spacing that should follow the element corresponding
|
|
21
|
+
* to the given JSON representation.
|
|
22
|
+
*
|
|
23
|
+
* @param state A JSON representation of the element preceding the gap.
|
|
24
|
+
* @param defaultGap The default gap for elements in this flyout.
|
|
25
|
+
* @returns The gap that should follow the given element.
|
|
26
|
+
*/
|
|
27
|
+
gapForItem(state: object, defaultGap: number): number;
|
|
28
|
+
/**
|
|
29
|
+
* Disposes of the given element.
|
|
30
|
+
*
|
|
31
|
+
* If the element in question resides on the flyout workspace, it should remove
|
|
32
|
+
* itself. Implementers are not otherwise required to fully dispose of the
|
|
33
|
+
* element; it may be e.g. cached for performance purposes.
|
|
34
|
+
*
|
|
35
|
+
* @param element The flyout element to dispose of.
|
|
36
|
+
*/
|
|
37
|
+
disposeItem(item: FlyoutItem): void;
|
|
38
|
+
/**
|
|
39
|
+
* Returns the type of items that this inflater is responsible for inflating.
|
|
40
|
+
* This should be the same as the name under which this inflater registers
|
|
41
|
+
* itself, as well as the value returned by `getType()` on the `FlyoutItem`
|
|
42
|
+
* objects returned by `load()`.
|
|
43
|
+
*
|
|
44
|
+
* @returns The type of items this inflater creates.
|
|
45
|
+
*/
|
|
46
|
+
getType(): string;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=i_flyout_inflater.d.ts.map
|
|
@@ -47,7 +47,7 @@ export interface IMetricsManager {
|
|
|
47
47
|
* Gets the width, height and position of the toolbox on the workspace in
|
|
48
48
|
* pixel coordinates. Returns 0 for the width and height if the workspace has
|
|
49
49
|
* a simple toolbox instead of a category toolbox. To get the width and height
|
|
50
|
-
* of a simple toolbox, see {@link IMetricsManager
|
|
50
|
+
* of a simple toolbox, see {@link IMetricsManager.getFlyoutMetrics}.
|
|
51
51
|
*
|
|
52
52
|
* @returns The object with the width, height and position of the toolbox.
|
|
53
53
|
*/
|
|
@@ -3,17 +3,14 @@
|
|
|
3
3
|
* Copyright 2023 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
/** @internal */
|
|
7
6
|
export interface IRenderedElement {
|
|
8
7
|
/**
|
|
9
|
-
* @returns The root SVG element of
|
|
8
|
+
* @returns The root SVG element of this rendered element.
|
|
10
9
|
*/
|
|
11
10
|
getSvgRoot(): SVGElement;
|
|
12
11
|
}
|
|
13
12
|
/**
|
|
14
13
|
* @returns True if the given object is an IRenderedElement.
|
|
15
|
-
*
|
|
16
|
-
* @internal
|
|
17
14
|
*/
|
|
18
15
|
export declare function isRenderedElement(obj: any): obj is IRenderedElement;
|
|
19
16
|
//# sourceMappingURL=i_rendered_element.d.ts.map
|
|
@@ -77,7 +77,7 @@ export interface IToolbox extends IRegistrable {
|
|
|
77
77
|
*/
|
|
78
78
|
setVisible(isVisible: boolean): void;
|
|
79
79
|
/**
|
|
80
|
-
* Selects the toolbox item by
|
|
80
|
+
* Selects the toolbox item by its position in the list of toolbox items.
|
|
81
81
|
*
|
|
82
82
|
* @param position The position of the item to select.
|
|
83
83
|
*/
|
|
@@ -88,6 +88,13 @@ export interface IToolbox extends IRegistrable {
|
|
|
88
88
|
* @returns The selected item, or null if no item is currently selected.
|
|
89
89
|
*/
|
|
90
90
|
getSelectedItem(): IToolboxItem | null;
|
|
91
|
+
/**
|
|
92
|
+
* Sets the selected item.
|
|
93
|
+
*
|
|
94
|
+
* @param item The toolbox item to select, or null to remove the current
|
|
95
|
+
* selection.
|
|
96
|
+
*/
|
|
97
|
+
setSelectedItem(item: IToolboxItem | null): void;
|
|
91
98
|
/** Disposes of this toolbox. */
|
|
92
99
|
dispose(): void;
|
|
93
100
|
}
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
* Copyright 2023 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import type { VariableModel } from '../variable_model.js';
|
|
7
6
|
import { IParameterModel } from './i_parameter_model.js';
|
|
7
|
+
import type { IVariableModel, IVariableState } from './i_variable_model.js';
|
|
8
8
|
/** Interface for a parameter model that holds a variable model. */
|
|
9
9
|
export interface IVariableBackedParameterModel extends IParameterModel {
|
|
10
10
|
/** Returns the variable model held by this type. */
|
|
11
|
-
getVariableModel():
|
|
11
|
+
getVariableModel(): IVariableModel<IVariableState>;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* Returns whether the given object is a variable holder or not.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2024 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { IVariableModel, IVariableState } from './i_variable_model.js';
|
|
7
|
+
/**
|
|
8
|
+
* Variable maps are container objects responsible for storing and managing the
|
|
9
|
+
* set of variables referenced on a workspace.
|
|
10
|
+
*
|
|
11
|
+
* Any of these methods may define invariants about which names and types are
|
|
12
|
+
* legal, and throw if they are not met.
|
|
13
|
+
*/
|
|
14
|
+
export interface IVariableMap<T extends IVariableModel<IVariableState>> {
|
|
15
|
+
getVariableById(id: string): T | null;
|
|
16
|
+
/**
|
|
17
|
+
* Returns the variable with the given name, or null if not found. If `type`
|
|
18
|
+
* is provided, the variable's type must also match, or null should be
|
|
19
|
+
* returned.
|
|
20
|
+
*/
|
|
21
|
+
getVariable(name: string, type?: string): T | null;
|
|
22
|
+
getAllVariables(): T[];
|
|
23
|
+
/**
|
|
24
|
+
* Returns a list of all of the variables of the given type managed by this
|
|
25
|
+
* variable map.
|
|
26
|
+
*/
|
|
27
|
+
getVariablesOfType(type: string): T[];
|
|
28
|
+
/**
|
|
29
|
+
* Returns a list of the set of types of the variables managed by this
|
|
30
|
+
* variable map.
|
|
31
|
+
*/
|
|
32
|
+
getTypes(): string[];
|
|
33
|
+
/**
|
|
34
|
+
* Creates a new variable with the given name. If ID is not specified, the
|
|
35
|
+
* variable map should create one. Returns the new variable.
|
|
36
|
+
*/
|
|
37
|
+
createVariable(name: string, id?: string, type?: string | null): T;
|
|
38
|
+
addVariable(variable: T): void;
|
|
39
|
+
/**
|
|
40
|
+
* Changes the name of the given variable to the name provided and returns the
|
|
41
|
+
* renamed variable.
|
|
42
|
+
*/
|
|
43
|
+
renameVariable(variable: T, newName: string): T;
|
|
44
|
+
changeVariableType(variable: T, newType: string): T;
|
|
45
|
+
deleteVariable(variable: T): void;
|
|
46
|
+
clear(): void;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=i_variable_map.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 { Workspace } from '../workspace.js';
|
|
7
|
+
export interface IVariableModel<T extends IVariableState> {
|
|
8
|
+
getId(): string;
|
|
9
|
+
getName(): string;
|
|
10
|
+
/**
|
|
11
|
+
* Returns the type of the variable like 'int' or 'string'. Does not need to be
|
|
12
|
+
* unique. This will default to '' which is a specific type.
|
|
13
|
+
*/
|
|
14
|
+
getType(): string;
|
|
15
|
+
setName(name: string): this;
|
|
16
|
+
setType(type: string): this;
|
|
17
|
+
getWorkspace(): Workspace;
|
|
18
|
+
save(): T;
|
|
19
|
+
}
|
|
20
|
+
export interface IVariableModelStatic<T extends IVariableState> {
|
|
21
|
+
new (workspace: Workspace, name: string, type?: string, id?: string): IVariableModel<T>;
|
|
22
|
+
/**
|
|
23
|
+
* Creates a new IVariableModel corresponding to the given state on the
|
|
24
|
+
* specified workspace. This method must be static in your implementation.
|
|
25
|
+
*/
|
|
26
|
+
load(state: T, workspace: Workspace): IVariableModel<T>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Represents the state of a given variable.
|
|
30
|
+
*/
|
|
31
|
+
export interface IVariableState {
|
|
32
|
+
name: string;
|
|
33
|
+
id: string;
|
|
34
|
+
type?: string;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=i_variable_model.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2024 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { FlyoutItem } from './flyout_item.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 labels for flyouts.
|
|
11
|
+
*/
|
|
12
|
+
export declare class LabelFlyoutInflater implements IFlyoutInflater {
|
|
13
|
+
/**
|
|
14
|
+
* Inflates a flyout label from the given state and adds it to the flyout.
|
|
15
|
+
*
|
|
16
|
+
* @param state A JSON representation of a flyout label.
|
|
17
|
+
* @param flyoutWorkspace The workspace to create the label on.
|
|
18
|
+
* @returns A FlyoutButton configured as a label.
|
|
19
|
+
*/
|
|
20
|
+
load(state: object, flyoutWorkspace: WorkspaceSvg): FlyoutItem;
|
|
21
|
+
/**
|
|
22
|
+
* Returns the amount of space that should follow this label.
|
|
23
|
+
*
|
|
24
|
+
* @param state A JSON representation of a flyout label.
|
|
25
|
+
* @param defaultGap The default spacing for flyout items.
|
|
26
|
+
* @returns The amount of space that should follow this label.
|
|
27
|
+
*/
|
|
28
|
+
gapForItem(state: object, defaultGap: number): number;
|
|
29
|
+
/**
|
|
30
|
+
* Disposes of the given label.
|
|
31
|
+
*
|
|
32
|
+
* @param item The flyout label to dispose of.
|
|
33
|
+
*/
|
|
34
|
+
disposeItem(item: FlyoutItem): void;
|
|
35
|
+
/**
|
|
36
|
+
* Returns the type of items this inflater is responsible for creating.
|
|
37
|
+
*
|
|
38
|
+
* @returns An identifier for the type of items this inflater creates.
|
|
39
|
+
*/
|
|
40
|
+
getType(): string;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=label_flyout_inflater.d.ts.map
|
package/core/menu.d.ts
CHANGED
|
@@ -148,9 +148,7 @@ export declare class Menu {
|
|
|
148
148
|
*/
|
|
149
149
|
private handleMouseLeave;
|
|
150
150
|
/**
|
|
151
|
-
* Attempts to handle a keyboard event
|
|
152
|
-
* calling
|
|
153
|
-
* {@link Menu#handleKeyEventInternal_}.
|
|
151
|
+
* Attempts to handle a keyboard event.
|
|
154
152
|
*
|
|
155
153
|
* @param e Key event to handle.
|
|
156
154
|
*/
|
package/core/menuitem.d.ts
CHANGED
|
@@ -95,13 +95,6 @@ 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;
|
|
105
98
|
/**
|
|
106
99
|
* Returns true if the menu item is enabled, false otherwise.
|
|
107
100
|
*
|
|
@@ -48,7 +48,7 @@ export declare class MetricsManager implements IMetricsManager {
|
|
|
48
48
|
* Gets the width, height and position of the toolbox on the workspace in
|
|
49
49
|
* pixel coordinates. Returns 0 for the width and height if the workspace has
|
|
50
50
|
* a simple toolbox instead of a category toolbox. To get the width and height
|
|
51
|
-
* of a simple toolbox, see {@link MetricsManager
|
|
51
|
+
* of a simple toolbox, see {@link (MetricsManager:class).getFlyoutMetrics}.
|
|
52
52
|
*
|
|
53
53
|
* @returns The object with the width, height and position of the toolbox.
|
|
54
54
|
*/
|
package/core/names.d.ts
CHANGED
|
@@ -3,7 +3,13 @@
|
|
|
3
3
|
* Copyright 2012 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Utility functions for handling variable and procedure names.
|
|
8
|
+
*
|
|
9
|
+
* @class
|
|
10
|
+
*/
|
|
11
|
+
import type { IVariableMap } from './interfaces/i_variable_map.js';
|
|
12
|
+
import type { IVariableModel, IVariableState } from './interfaces/i_variable_model.js';
|
|
7
13
|
import type { Workspace } from './workspace.js';
|
|
8
14
|
/**
|
|
9
15
|
* Class for a database of entity names (variables, procedures, etc).
|
|
@@ -40,7 +46,7 @@ export declare class Names {
|
|
|
40
46
|
*
|
|
41
47
|
* @param map The map to track.
|
|
42
48
|
*/
|
|
43
|
-
setVariableMap(map:
|
|
49
|
+
setVariableMap(map: IVariableMap<IVariableModel<IVariableState>>): void;
|
|
44
50
|
/**
|
|
45
51
|
* Get the name for a user-defined variable, based on its ID.
|
|
46
52
|
* This should only be used for variables of NameType VARIABLE.
|
package/core/procedures.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ import { IProcedureBlock, isProcedureBlock } from './interfaces/i_procedure_bloc
|
|
|
13
13
|
import { IProcedureMap } from './interfaces/i_procedure_map.js';
|
|
14
14
|
import { IProcedureModel } from './interfaces/i_procedure_model.js';
|
|
15
15
|
import { ObservableProcedureMap } from './observable_procedure_map.js';
|
|
16
|
+
import type { FlyoutItemInfo } from './utils/toolbox.js';
|
|
16
17
|
import type { Workspace } from './workspace.js';
|
|
17
18
|
import type { WorkspaceSvg } from './workspace_svg.js';
|
|
18
19
|
/**
|
|
@@ -64,12 +65,14 @@ export declare function isNameUsed(name: string, workspace: Workspace, opt_exclu
|
|
|
64
65
|
*/
|
|
65
66
|
export declare function rename(this: Field, name: string): string;
|
|
66
67
|
/**
|
|
67
|
-
*
|
|
68
|
+
* Internal wrapper that returns the contents of the procedure category.
|
|
68
69
|
*
|
|
69
|
-
* @
|
|
70
|
-
* @
|
|
70
|
+
* @internal
|
|
71
|
+
* @param workspace The workspace to populate procedure blocks for.
|
|
71
72
|
*/
|
|
72
|
-
export declare function
|
|
73
|
+
export declare function internalFlyoutCategory(workspace: WorkspaceSvg): FlyoutItemInfo[];
|
|
74
|
+
export declare function flyoutCategory(workspace: WorkspaceSvg, useXml: true): Element[];
|
|
75
|
+
export declare function flyoutCategory(workspace: WorkspaceSvg, useXml: false): FlyoutItemInfo[];
|
|
73
76
|
/**
|
|
74
77
|
* Listens for when a procedure mutator is opened. Then it triggers a flyout
|
|
75
78
|
* update and adds a mutator change listener to the mutator workspace.
|
package/core/registry.d.ts
CHANGED
|
@@ -11,11 +11,14 @@ import type { IConnectionPreviewer } from './interfaces/i_connection_previewer.j
|
|
|
11
11
|
import type { ICopyable } from './interfaces/i_copyable.js';
|
|
12
12
|
import type { IDragger } from './interfaces/i_dragger.js';
|
|
13
13
|
import type { IFlyout } from './interfaces/i_flyout.js';
|
|
14
|
+
import type { IFlyoutInflater } from './interfaces/i_flyout_inflater.js';
|
|
14
15
|
import type { IIcon } from './interfaces/i_icon.js';
|
|
15
16
|
import type { IMetricsManager } from './interfaces/i_metrics_manager.js';
|
|
16
17
|
import type { IPaster } from './interfaces/i_paster.js';
|
|
17
18
|
import type { ISerializer } from './interfaces/i_serializer.js';
|
|
18
19
|
import type { IToolbox } from './interfaces/i_toolbox.js';
|
|
20
|
+
import type { IVariableMap } from './interfaces/i_variable_map.js';
|
|
21
|
+
import type { IVariableModel, IVariableModelStatic, IVariableState } from './interfaces/i_variable_model.js';
|
|
19
22
|
import type { Cursor } from './keyboard_nav/cursor.js';
|
|
20
23
|
import type { Options } from './options.js';
|
|
21
24
|
import type { Renderer } from './renderers/common/renderer.js';
|
|
@@ -57,6 +60,7 @@ export declare class Type<_T> {
|
|
|
57
60
|
static TOOLBOX_ITEM: Type<ToolboxItem>;
|
|
58
61
|
static FLYOUTS_VERTICAL_TOOLBOX: Type<IFlyout>;
|
|
59
62
|
static FLYOUTS_HORIZONTAL_TOOLBOX: Type<IFlyout>;
|
|
63
|
+
static FLYOUT_INFLATER: Type<IFlyoutInflater>;
|
|
60
64
|
static METRICS_MANAGER: Type<IMetricsManager>;
|
|
61
65
|
/**
|
|
62
66
|
* Type for an IDragger. Formerly behavior was mostly covered by
|
|
@@ -69,6 +73,8 @@ export declare class Type<_T> {
|
|
|
69
73
|
static ICON: Type<IIcon>;
|
|
70
74
|
/** @internal */
|
|
71
75
|
static PASTER: Type<IPaster<ICopyable.ICopyData, ICopyable<ICopyable.ICopyData>>>;
|
|
76
|
+
static VARIABLE_MODEL: Type<IVariableModelStatic<IVariableState>>;
|
|
77
|
+
static VARIABLE_MAP: Type<IVariableMap<IVariableModel<IVariableState>>>;
|
|
72
78
|
}
|
|
73
79
|
/**
|
|
74
80
|
* Registers a class based on a type and name.
|
|
@@ -424,8 +424,13 @@ export declare class ConstantProvider {
|
|
|
424
424
|
* @param svg The root of the workspace's SVG.
|
|
425
425
|
* @param tagName The name to use for the CSS style tag.
|
|
426
426
|
* @param selector The CSS selector to use.
|
|
427
|
+
* @param injectionDivIfIsParent The div containing the parent workspace and
|
|
428
|
+
* all related workspaces and block containers, if this renderer is for the
|
|
429
|
+
* parent workspace. CSS variables representing SVG patterns will be scoped
|
|
430
|
+
* to this container. Child workspaces should not override the CSS variables
|
|
431
|
+
* created by the parent and thus do not need access to the injection div.
|
|
427
432
|
*/
|
|
428
|
-
createDom(svg: SVGElement, tagName: string, selector: string): void;
|
|
433
|
+
createDom(svg: SVGElement, tagName: string, selector: string, injectionDivIfIsParent?: HTMLElement): void;
|
|
429
434
|
/**
|
|
430
435
|
* Create a filter for highlighting the currently rendering block during
|
|
431
436
|
* render debugging.
|
|
@@ -39,19 +39,6 @@ export interface IPathObject {
|
|
|
39
39
|
* @param pathString The path.
|
|
40
40
|
*/
|
|
41
41
|
setPath(pathString: string): void;
|
|
42
|
-
/**
|
|
43
|
-
* Apply the stored colours to the block's path, taking into account whether
|
|
44
|
-
* the paths belong to a shadow block.
|
|
45
|
-
*
|
|
46
|
-
* @param block The source block.
|
|
47
|
-
*/
|
|
48
|
-
applyColour(block: BlockSvg): void;
|
|
49
|
-
/**
|
|
50
|
-
* Update the style.
|
|
51
|
-
*
|
|
52
|
-
* @param blockStyle The block style to use.
|
|
53
|
-
*/
|
|
54
|
-
setStyle(blockStyle: BlockStyle): void;
|
|
55
42
|
/**
|
|
56
43
|
* Flip the SVG paths in RTL.
|
|
57
44
|
*/
|
|
@@ -104,9 +91,22 @@ export interface IPathObject {
|
|
|
104
91
|
updateMovable(enabled: boolean): void;
|
|
105
92
|
/** Adds the given path as a connection highlight for the given connection. */
|
|
106
93
|
addConnectionHighlight?(connection: RenderedConnection, connectionPath: string, offset: Coordinate, rtl: boolean): void;
|
|
94
|
+
/**
|
|
95
|
+
* Apply the stored colours to the block's path, taking into account whether
|
|
96
|
+
* the paths belong to a shadow block.
|
|
97
|
+
*
|
|
98
|
+
* @param block The source block.
|
|
99
|
+
*/
|
|
100
|
+
applyColour?(block: BlockSvg): void;
|
|
107
101
|
/**
|
|
108
102
|
* Removes any highlight associated with the given connection, if it exists.
|
|
109
103
|
*/
|
|
110
104
|
removeConnectionHighlight?(connection: RenderedConnection): void;
|
|
105
|
+
/**
|
|
106
|
+
* Update the style.
|
|
107
|
+
*
|
|
108
|
+
* @param blockStyle The block style to use.
|
|
109
|
+
*/
|
|
110
|
+
setStyle?(blockStyle: BlockStyle): void;
|
|
111
111
|
}
|
|
112
112
|
//# sourceMappingURL=i_path_object.d.ts.map
|
|
@@ -5,10 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { BlockSvg } from '../../block_svg.js';
|
|
7
7
|
import { Connection } from '../../connection.js';
|
|
8
|
-
import { PreviewType } from '../../insertion_marker_manager.js';
|
|
9
8
|
import type { IRegistrable } from '../../interfaces/i_registrable.js';
|
|
10
9
|
import type { Marker } from '../../keyboard_nav/marker.js';
|
|
11
|
-
import type { RenderedConnection } from '../../rendered_connection.js';
|
|
12
10
|
import type { BlockStyle, Theme } from '../../theme.js';
|
|
13
11
|
import type { WorkspaceSvg } from '../../workspace_svg.js';
|
|
14
12
|
import { ConstantProvider } from './constants.js';
|
|
@@ -49,20 +47,30 @@ export declare class Renderer implements IRegistrable {
|
|
|
49
47
|
/**
|
|
50
48
|
* Create any DOM elements that this renderer needs.
|
|
51
49
|
* If you need to create additional DOM elements, override the
|
|
52
|
-
* {@link ConstantProvider
|
|
50
|
+
* {@link blockRendering#ConstantProvider.createDom} method instead.
|
|
53
51
|
*
|
|
54
52
|
* @param svg The root of the workspace's SVG.
|
|
55
53
|
* @param theme The workspace theme object.
|
|
54
|
+
* @param injectionDivIfIsParent The div containing the parent workspace and
|
|
55
|
+
* all related workspaces and block containers, if this renderer is for the
|
|
56
|
+
* parent workspace. CSS variables representing SVG patterns will be scoped
|
|
57
|
+
* to this container. Child workspaces should not override the CSS variables
|
|
58
|
+
* created by the parent and thus do not need access to the injection div.
|
|
56
59
|
* @internal
|
|
57
60
|
*/
|
|
58
|
-
createDom(svg: SVGElement, theme: Theme): void;
|
|
61
|
+
createDom(svg: SVGElement, theme: Theme, injectionDivIfIsParent?: HTMLElement): void;
|
|
59
62
|
/**
|
|
60
63
|
* Refresh the renderer after a theme change.
|
|
61
64
|
*
|
|
62
65
|
* @param svg The root of the workspace's SVG.
|
|
63
66
|
* @param theme The workspace theme object.
|
|
67
|
+
* @param injectionDivIfIsParent The div containing the parent workspace and
|
|
68
|
+
* all related workspaces and block containers, if this renderer is for the
|
|
69
|
+
* parent workspace. CSS variables representing SVG patterns will be scoped
|
|
70
|
+
* to this container. Child workspaces should not override the CSS variables
|
|
71
|
+
* created by the parent and thus do not need access to the injection div.
|
|
64
72
|
*/
|
|
65
|
-
refreshDom(svg: SVGElement, theme: Theme): void;
|
|
73
|
+
refreshDom(svg: SVGElement, theme: Theme, injectionDivIfIsParent?: HTMLElement): void;
|
|
66
74
|
/**
|
|
67
75
|
* Dispose of this renderer.
|
|
68
76
|
* Delete all DOM elements that this renderer and its constants created.
|
|
@@ -133,19 +141,6 @@ export declare class Renderer implements IRegistrable {
|
|
|
133
141
|
* @returns Whether there is a home for the orphan or not.
|
|
134
142
|
*/
|
|
135
143
|
protected orphanCanConnectAtEnd(topBlock: BlockSvg, orphanBlock: BlockSvg, localType: number): boolean;
|
|
136
|
-
/**
|
|
137
|
-
* Chooses a connection preview method based on the available connection, the
|
|
138
|
-
* current dragged connection, and the block being dragged.
|
|
139
|
-
*
|
|
140
|
-
* @param closest The available connection.
|
|
141
|
-
* @param local The connection currently being dragged.
|
|
142
|
-
* @param topBlock The block currently being dragged.
|
|
143
|
-
* @returns The preview type to display.
|
|
144
|
-
*
|
|
145
|
-
* @deprecated v10 - This function is no longer respected. A custom
|
|
146
|
-
* IConnectionPreviewer may be able to fulfill the functionality.
|
|
147
|
-
*/
|
|
148
|
-
getConnectionPreviewMethod(closest: RenderedConnection, local: RenderedConnection, topBlock: BlockSvg): PreviewType;
|
|
149
144
|
/**
|
|
150
145
|
* Render the block.
|
|
151
146
|
*
|
|
@@ -34,7 +34,7 @@ export declare class Renderer extends BaseRenderer {
|
|
|
34
34
|
init(theme: Theme, opt_rendererOverrides?: {
|
|
35
35
|
[rendererConstant: string]: any;
|
|
36
36
|
}): void;
|
|
37
|
-
refreshDom(svg: SVGElement, theme: Theme): void;
|
|
37
|
+
refreshDom(svg: SVGElement, theme: Theme, injectionDiv: HTMLElement): void;
|
|
38
38
|
makeConstants_(): ConstantProvider;
|
|
39
39
|
/**
|
|
40
40
|
* Create a new instance of the renderer's render info object.
|
|
@@ -11,6 +11,7 @@ import { Connection } from './connection.js';
|
|
|
11
11
|
* up during rendering.
|
|
12
12
|
*/
|
|
13
13
|
export declare class NextConnection extends Connection {
|
|
14
|
+
private nextConnection;
|
|
14
15
|
/**
|
|
15
16
|
* @param constants The rendering constants provider.
|
|
16
17
|
* @param connectionModel The connection object on the block that this
|
|
@@ -11,6 +11,7 @@ import { Connection } from './connection.js';
|
|
|
11
11
|
* up during rendering.
|
|
12
12
|
*/
|
|
13
13
|
export declare class PreviousConnection extends Connection {
|
|
14
|
+
private previousConnection;
|
|
14
15
|
/**
|
|
15
16
|
* @param constants The rendering constants provider.
|
|
16
17
|
* @param connectionModel The connection object on the block that this
|